foamlib 1.0.0__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {foamlib-1.0.0 → foamlib-1.1.0}/.github/workflows/ci.yml +4 -2
- {foamlib-1.0.0 → foamlib-1.1.0}/.github/workflows/docker.yml +1 -1
- {foamlib-1.0.0 → foamlib-1.1.0}/.gitignore +4 -0
- foamlib-1.1.0/CITATION.cff +36 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/Dockerfile +1 -1
- {foamlib-1.0.0 → foamlib-1.1.0}/PKG-INFO +44 -2
- {foamlib-1.0.0 → foamlib-1.1.0}/README.md +42 -1
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/conf.py +1 -1
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/index.rst +2 -0
- foamlib-1.1.0/docs/parametricstudy.rst +195 -0
- foamlib-1.1.0/docs/postprocessing.rst +96 -0
- foamlib-1.1.0/example/parametricStudy/createStudyFromCSV.py +15 -0
- foamlib-1.1.0/example/parametricStudy/createStudyGrid.py +55 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/0/T +49 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/0/U +47 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/0/alpha.water +49 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/0/p +53 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/0/p_rgh +53 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/Allclean +10 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/Allrun +11 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/constant/g +22 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/constant/thermophysicalProperties +28 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/constant/thermophysicalProperties.air +48 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/constant/thermophysicalProperties.water +69 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/constant/transportProperties +36 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/constant/turbulenceProperties +21 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/system/blockMeshDict +110 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/system/controlDict +166 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/system/decomposeParDict +45 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/system/fvSchemes +59 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/system/fvSolution +117 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/system/setFieldsDict +40 -0
- foamlib-1.1.0/example/parametricStudy/damBreak/system/simulationParameters +28 -0
- foamlib-1.1.0/example/parametricStudy/gatherResults.py +55 -0
- foamlib-1.1.0/example/parametricStudy/parameter_study.json +634 -0
- foamlib-1.1.0/example/parametricStudy/parastudy.csv +3 -0
- foamlib-1.1.0/example/parametricStudy/plotResults.py +16 -0
- foamlib-1.1.0/example/parametricStudy/results/forces.csv +4772 -0
- foamlib-1.1.0/example/parametricStudy/results/probe_u.csv +4772 -0
- foamlib-1.1.0/example/parametricStudy/results/surface_heights.csv +73 -0
- foamlib-1.1.0/example/parametricStudy/runStudy.py +14 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/__init__.py +1 -1
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/_async.py +1 -1
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_files/_parsing.py +3 -3
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_files/_serialization.py +4 -4
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_files/_types.py +6 -6
- foamlib-1.1.0/foamlib/postprocessing/__init__.py +6 -0
- foamlib-1.1.0/foamlib/postprocessing/load_tables.py +311 -0
- foamlib-1.1.0/foamlib/postprocessing/table_reader.py +315 -0
- foamlib-1.1.0/foamlib/preprocessing/__init__.py +1 -0
- foamlib-1.1.0/foamlib/preprocessing/case_modifier.py +45 -0
- foamlib-1.1.0/foamlib/preprocessing/grid_parameter_sweep.py +27 -0
- foamlib-1.1.0/foamlib/preprocessing/of_dict.py +40 -0
- foamlib-1.1.0/foamlib/preprocessing/parameter_study.py +113 -0
- foamlib-1.1.0/foamlib/preprocessing/system.py +38 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/pyproject.toml +19 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_example.py +3 -3
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_dumps.py +3 -3
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_files.py +6 -6
- foamlib-1.1.0/tests/test_files/test_parsing/__init__.py +0 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/Allclean +10 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/Allrun +11 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/case.json +13 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/constant/g +22 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/constant/thermophysicalProperties +28 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/constant/thermophysicalProperties.air +48 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/constant/thermophysicalProperties.water +69 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/constant/transportProperties +36 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/constant/turbulenceProperties +21 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/explicitOperators.xml +460 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/forces/0/force.dat +113 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/forces/0/moment.dat +113 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/freeSurface/0.1/U_freeSurface.raw +280 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/freeSurface/0.1/p_freeSurface.raw +280 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/freeSurface/0.2/U_freeSurface.raw +323 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/freeSurface/0.2/p_freeSurface.raw +323 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/freeSurface/0.4/U_freeSurface.raw +584 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/freeSurface/0.4/p_freeSurface.raw +584 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/probes/0/T +111 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/probes/0/U +111 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/probes/0/p +111 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/sample1/0.1/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/sample1/0.2/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/sample1/0.4/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/sample2/0.1/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/sample2/0.2/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/postProcessing/sample2/0.4/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/system/blockMeshDict +114 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/system/controlDict +166 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/system/decomposeParDict +45 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/system/fvSchemes +59 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/system/fvSolution +117 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid1/system/setFieldsDict +40 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/Allclean +10 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/Allrun +11 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/case.json +12 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/constant/g +22 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/constant/thermophysicalProperties +28 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/constant/thermophysicalProperties.air +48 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/constant/thermophysicalProperties.water +69 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/constant/transportProperties +36 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/constant/turbulenceProperties +21 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/damBreak.foam +0 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/explicitOperators.xml +460 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/forces/0/force.dat +249 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/forces/0/moment.dat +249 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/freeSurface/0.1/U_freeSurface.raw +535 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/freeSurface/0.1/p_freeSurface.raw +535 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/freeSurface/0.2/U_freeSurface.raw +772 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/freeSurface/0.2/p_freeSurface.raw +772 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/freeSurface/0.4/U_freeSurface.raw +1371 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/freeSurface/0.4/p_freeSurface.raw +1371 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/probes/0/T +247 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/probes/0/U +247 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/probes/0/p +247 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/sample1/0.1/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/sample1/0.2/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/postProcessing/sample1/0.4/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/system/blockMeshDict +114 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/system/controlDict +144 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/system/decomposeParDict +45 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/system/fvSchemes +59 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/system/fvSolution +117 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_02/grid2/system/setFieldsDict +40 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/Allclean +10 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/Allrun +11 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/case.json +12 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/constant/g +22 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/constant/thermophysicalProperties +28 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/constant/thermophysicalProperties.air +48 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/constant/thermophysicalProperties.water +69 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/constant/transportProperties +36 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/constant/turbulenceProperties +21 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/damBreak.foam +0 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/explicitOperators.xml +460 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/forces/0/force.dat +745 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/forces/0/moment.dat +745 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/freeSurface/0.1/U_freeSurface.raw +979 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/freeSurface/0.1/p_freeSurface.raw +979 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/freeSurface/0.2/U_freeSurface.raw +1513 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/freeSurface/0.2/p_freeSurface.raw +1513 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/freeSurface/0.4/U_freeSurface.raw +2782 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/freeSurface/0.4/p_freeSurface.raw +2782 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/probes/0/T +743 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/probes/0/U +743 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/probes/0/p +743 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/sample1/0.1/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/sample1/0.2/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/postProcessing/sample1/0.4/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/system/blockMeshDict +114 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/system/controlDict +144 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/system/decomposeParDict +45 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/system/fvSchemes +59 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/system/fvSolution +117 -0
- foamlib-1.1.0/tests/test_postprocessing/Cases/fluidHeight_03/grid3/system/setFieldsDict +40 -0
- foamlib-1.1.0/tests/test_postprocessing/__init__.py +0 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/forces/0/force.dat +113 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/forces/0/moment.dat +113 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.05/U_freeSurface.raw +263 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.05/p_freeSurface.raw +263 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.1/U_freeSurface.raw +280 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.1/p_freeSurface.raw +280 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.15/U_freeSurface.raw +260 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.15/p_freeSurface.raw +260 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.2/U_freeSurface.raw +323 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.2/p_freeSurface.raw +323 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.25/U_freeSurface.raw +394 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.25/p_freeSurface.raw +394 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.3/U_freeSurface.raw +489 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.3/p_freeSurface.raw +489 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.35/U_freeSurface.raw +516 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.35/p_freeSurface.raw +516 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.4/U_freeSurface.raw +584 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/freeSurface/0.4/p_freeSurface.raw +584 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/probes/0/T +111 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/probes/0/U +111 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/probes/0/p +111 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.05/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.1/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.15/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.2/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.25/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.3/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.35/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample1/0.4/centreLine_T.xy +100 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.05/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.1/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.15/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.2/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.25/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.3/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.35/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/postProcessing/sample2/0.4/centreLine_U.csv +101 -0
- foamlib-1.1.0/tests/test_postprocessing/test_load_tables.py +147 -0
- foamlib-1.1.0/tests/test_postprocessing/test_readers.py +140 -0
- foamlib-1.1.0/tests/test_preprocessing/__init__.py +0 -0
- foamlib-1.1.0/tests/test_preprocessing/dictionaries/testDictionary +38 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/0/T +49 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/0/U +47 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/0/alpha.water +49 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/0/p +53 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/0/p_rgh +53 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/Allclean +10 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/Allrun +11 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/constant/g +22 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/constant/thermophysicalProperties +28 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/constant/thermophysicalProperties.air +48 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/constant/thermophysicalProperties.water +69 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/constant/transportProperties +36 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/constant/turbulenceProperties +21 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/damBreak.foam +0 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/postProcessing/forces/0/force.dat +113 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/system/blockMeshDict +110 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/system/controlDict +166 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/system/decomposeParDict +45 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/system/fvSchemes +59 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/system/fvSolution +117 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/system/setFieldsDict +40 -0
- foamlib-1.1.0/tests/test_preprocessing/templates/damBreak/system/simulationParameters +28 -0
- foamlib-1.1.0/tests/test_preprocessing/test_case_modifier.py +92 -0
- foamlib-1.1.0/tests/test_preprocessing/test_csv_generator.py +91 -0
- foamlib-1.1.0/tests/test_preprocessing/test_grid_generator.py +146 -0
- foamlib-1.1.0/tests/test_preprocessing/test_of_dict.py +49 -0
- foamlib-1.1.0/tests/test_preprocessing/test_parastudy.csv +3 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/.devcontainer.json +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/.dockerignore +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/.git-blame-ignore-revs +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/.github/dependabot.yml +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/.github/workflows/dockerhub-description.yml +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/.github/workflows/pypi-publish.yml +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/.readthedocs.yaml +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/CONTRIBUTING.md +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/LICENSE.txt +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/benchmark/benchmark.png +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/benchmark/benchmark.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/benchmark/requirements.txt +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/benchmark/ruff.toml +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/Makefile +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/cases.rst +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/example.rst +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/files.rst +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/make.bat +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/docs/ruff.toml +0 -0
- /foamlib-1.0.0/foamlib/py.typed → /foamlib-1.1.0/example/parametricStudy/damBreak/damBreak.foam +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/__init__.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/_base.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/_run.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/_slurm.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/_subprocess.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/_sync.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_cases/_util.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_files/__init__.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_files/_files.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/foamlib/_files/_io.py +0 -0
- /foamlib-1.0.0/tests/__init__.py → /foamlib-1.1.0/foamlib/py.typed +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/logo.png +0 -0
- {foamlib-1.0.0/tests/test_cases → foamlib-1.1.0/tests}/__init__.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/ruff.toml +0 -0
- {foamlib-1.0.0/tests/test_files → foamlib-1.1.0/tests/test_cases}/__init__.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_cases/test_cavity.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_cases/test_cavity_async.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_cases/test_flange.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_cases/test_flange_async.py +0 -0
- {foamlib-1.0.0/tests/test_files/test_parsing → foamlib-1.1.0/tests/test_files}/__init__.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_advanced.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_basic.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_decompose_par.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_fields.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_fv_schemes.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_intermediate.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_loads.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_parsing/test_poly_mesh.py +0 -0
- {foamlib-1.0.0 → foamlib-1.1.0}/tests/test_files/test_types.py +0 -0
@@ -35,6 +35,8 @@ jobs:
|
|
35
35
|
python-version-file: pyproject.toml
|
36
36
|
- name: Check types with mypy
|
37
37
|
run: |
|
38
|
+
uv add pip
|
39
|
+
uv run mypy --install-types --non-interactive
|
38
40
|
uv run mypy
|
39
41
|
|
40
42
|
test:
|
@@ -49,11 +51,11 @@ jobs:
|
|
49
51
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
50
52
|
strategy:
|
51
53
|
matrix:
|
52
|
-
openfoam-version: [
|
54
|
+
openfoam-version: [2506, 2006, 12, 9]
|
53
55
|
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
|
54
56
|
slurm: [false]
|
55
57
|
include:
|
56
|
-
- openfoam-version:
|
58
|
+
- openfoam-version: 2506
|
57
59
|
python-version: '3.13'
|
58
60
|
slurm: true
|
59
61
|
- openfoam-version: 12
|
@@ -0,0 +1,36 @@
|
|
1
|
+
cff-version: "1.2.0"
|
2
|
+
authors:
|
3
|
+
- family-names: Gerlero
|
4
|
+
given-names: Gabriel S.
|
5
|
+
orcid: "https://orcid.org/0000-0002-5138-0328"
|
6
|
+
- family-names: Kler
|
7
|
+
given-names: Pablo A.
|
8
|
+
orcid: "https://orcid.org/0000-0003-4217-698X"
|
9
|
+
contact:
|
10
|
+
- family-names: Gerlero
|
11
|
+
given-names: Gabriel S.
|
12
|
+
orcid: "https://orcid.org/0000-0002-5138-0328"
|
13
|
+
doi: 10.5281/zenodo.15442960
|
14
|
+
message: If you use this software, please cite our article in the
|
15
|
+
Journal of Open Source Software.
|
16
|
+
preferred-citation:
|
17
|
+
authors:
|
18
|
+
- family-names: Gerlero
|
19
|
+
given-names: Gabriel S.
|
20
|
+
orcid: "https://orcid.org/0000-0002-5138-0328"
|
21
|
+
- family-names: Kler
|
22
|
+
given-names: Pablo A.
|
23
|
+
orcid: "https://orcid.org/0000-0003-4217-698X"
|
24
|
+
date-published: 2025-05-23
|
25
|
+
doi: 10.21105/joss.07633
|
26
|
+
issn: 2475-9066
|
27
|
+
issue: 109
|
28
|
+
journal: Journal of Open Source Software
|
29
|
+
publisher:
|
30
|
+
name: Open Journals
|
31
|
+
start: 7633
|
32
|
+
title: "foamlib: A modern Python package for working with OpenFOAM"
|
33
|
+
type: article
|
34
|
+
url: "https://joss.theoj.org/papers/10.21105/joss.07633"
|
35
|
+
volume: 10
|
36
|
+
title: "foamlib: A modern Python package for working with OpenFOAM"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: foamlib
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.1.0
|
4
4
|
Summary: A Python interface for interacting with OpenFOAM
|
5
5
|
Project-URL: Homepage, https://github.com/gerlero/foamlib
|
6
6
|
Project-URL: Repository, https://github.com/gerlero/foamlib
|
@@ -34,6 +34,7 @@ Provides-Extra: docs
|
|
34
34
|
Requires-Dist: ruff; extra == 'docs'
|
35
35
|
Requires-Dist: sphinx-rtd-theme; extra == 'docs'
|
36
36
|
Requires-Dist: sphinx<9,>=5; extra == 'docs'
|
37
|
+
Requires-Dist: sphinxcontrib-mermaid; extra == 'docs'
|
37
38
|
Description-Content-Type: text/markdown
|
38
39
|
|
39
40
|
[<img alt="foamlib" src="https://github.com/gerlero/foamlib/raw/main/logo.png" height="65">](https://github.com/gerlero/foamlib)
|
@@ -51,6 +52,8 @@ Description-Content-Type: text/markdown
|
|
51
52
|

|
52
53
|
[](https://github.com/gerlero/foamlib/actions/workflows/docker.yml)
|
53
54
|
[](https://hub.docker.com/r/microfluidica/foamlib/)
|
55
|
+
[](https://doi.org/10.21105/joss.07633)
|
56
|
+
|
54
57
|
|
55
58
|
**foamlib** provides a simple, modern, ergonomic and fast Python interface for interacting with [OpenFOAM](https://www.openfoam.com).
|
56
59
|
|
@@ -92,6 +95,12 @@ Compared to [PyFoam](https://openfoamwiki.net/index.php/Contrib/PyFoam) and othe
|
|
92
95
|
conda install -c conda-forge foamlib
|
93
96
|
```
|
94
97
|
|
98
|
+
* With [Homebrew](https://brew.sh):
|
99
|
+
|
100
|
+
```bash
|
101
|
+
brew install gerlero/openfoam/foamlib
|
102
|
+
```
|
103
|
+
|
95
104
|
### 🐑 Clone a case
|
96
105
|
|
97
106
|
```python
|
@@ -210,6 +219,39 @@ If you believe you have found a bug in **foamlib**, please open an [issue](https
|
|
210
219
|
|
211
220
|
You're welcome to contribute to **foamlib**! Check out the [contributing guidelines](CONTRIBUTING.md) for more information.
|
212
221
|
|
213
|
-
##
|
222
|
+
## 🖋️Citation
|
223
|
+
|
224
|
+
If you find **foamlib** useful for your work, don't forget to cite it!
|
225
|
+
|
226
|
+
Citations help us a lot. You may find the following snippets useful:
|
227
|
+
|
228
|
+
<details>
|
229
|
+
<summary>BibTeX</summary>
|
230
|
+
|
231
|
+
```bibtex
|
232
|
+
@article{foamlib,
|
233
|
+
author = {Gerlero, Gabriel S. and Kler, Pablo A.},
|
234
|
+
doi = {10.21105/joss.07633},
|
235
|
+
journal = {Journal of Open Source Software},
|
236
|
+
month = may,
|
237
|
+
number = {109},
|
238
|
+
pages = {7633},
|
239
|
+
title = {{foamlib: A modern Python package for working with OpenFOAM}},
|
240
|
+
url = {https://joss.theoj.org/papers/10.21105/joss.07633},
|
241
|
+
volume = {10},
|
242
|
+
year = {2025}
|
243
|
+
}
|
244
|
+
```
|
245
|
+
|
246
|
+
</details>
|
247
|
+
|
248
|
+
<details>
|
249
|
+
<summary>APA</summary>
|
250
|
+
|
251
|
+
Gerlero, G. S., & Kler, P. A. (2025). foamlib: A modern Python package for working with OpenFOAM. Journal of Open Source Software, 10(109), 7633. https://doi.org/10.21105/joss.07633
|
252
|
+
|
253
|
+
</details>
|
254
|
+
|
255
|
+
## 👟 Footnotes
|
214
256
|
|
215
257
|
<a id="benchmark">[1]</a> foamlib 0.8.1 vs PyFoam 2023.7 on a MacBook Air (2020, M1) with 8 GB of RAM. [Benchmark script](benchmark/benchmark.py).
|
@@ -13,6 +13,8 @@
|
|
13
13
|

|
14
14
|
[](https://github.com/gerlero/foamlib/actions/workflows/docker.yml)
|
15
15
|
[](https://hub.docker.com/r/microfluidica/foamlib/)
|
16
|
+
[](https://doi.org/10.21105/joss.07633)
|
17
|
+
|
16
18
|
|
17
19
|
**foamlib** provides a simple, modern, ergonomic and fast Python interface for interacting with [OpenFOAM](https://www.openfoam.com).
|
18
20
|
|
@@ -54,6 +56,12 @@ Compared to [PyFoam](https://openfoamwiki.net/index.php/Contrib/PyFoam) and othe
|
|
54
56
|
conda install -c conda-forge foamlib
|
55
57
|
```
|
56
58
|
|
59
|
+
* With [Homebrew](https://brew.sh):
|
60
|
+
|
61
|
+
```bash
|
62
|
+
brew install gerlero/openfoam/foamlib
|
63
|
+
```
|
64
|
+
|
57
65
|
### 🐑 Clone a case
|
58
66
|
|
59
67
|
```python
|
@@ -172,6 +180,39 @@ If you believe you have found a bug in **foamlib**, please open an [issue](https
|
|
172
180
|
|
173
181
|
You're welcome to contribute to **foamlib**! Check out the [contributing guidelines](CONTRIBUTING.md) for more information.
|
174
182
|
|
175
|
-
##
|
183
|
+
## 🖋️Citation
|
184
|
+
|
185
|
+
If you find **foamlib** useful for your work, don't forget to cite it!
|
186
|
+
|
187
|
+
Citations help us a lot. You may find the following snippets useful:
|
188
|
+
|
189
|
+
<details>
|
190
|
+
<summary>BibTeX</summary>
|
191
|
+
|
192
|
+
```bibtex
|
193
|
+
@article{foamlib,
|
194
|
+
author = {Gerlero, Gabriel S. and Kler, Pablo A.},
|
195
|
+
doi = {10.21105/joss.07633},
|
196
|
+
journal = {Journal of Open Source Software},
|
197
|
+
month = may,
|
198
|
+
number = {109},
|
199
|
+
pages = {7633},
|
200
|
+
title = {{foamlib: A modern Python package for working with OpenFOAM}},
|
201
|
+
url = {https://joss.theoj.org/papers/10.21105/joss.07633},
|
202
|
+
volume = {10},
|
203
|
+
year = {2025}
|
204
|
+
}
|
205
|
+
```
|
206
|
+
|
207
|
+
</details>
|
208
|
+
|
209
|
+
<details>
|
210
|
+
<summary>APA</summary>
|
211
|
+
|
212
|
+
Gerlero, G. S., & Kler, P. A. (2025). foamlib: A modern Python package for working with OpenFOAM. Journal of Open Source Software, 10(109), 7633. https://doi.org/10.21105/joss.07633
|
213
|
+
|
214
|
+
</details>
|
215
|
+
|
216
|
+
## 👟 Footnotes
|
176
217
|
|
177
218
|
<a id="benchmark">[1]</a> foamlib 0.8.1 vs PyFoam 2023.7 on a MacBook Air (2020, M1) with 8 GB of RAM. [Benchmark script](benchmark/benchmark.py).
|
@@ -13,7 +13,7 @@ author = "Gabriel S. Gerlero"
|
|
13
13
|
# -- General configuration ---------------------------------------------------
|
14
14
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
15
15
|
|
16
|
-
extensions = ["sphinx.ext.autodoc"]
|
16
|
+
extensions = ["sphinx.ext.autodoc", "sphinxcontrib.mermaid"]
|
17
17
|
|
18
18
|
templates_path = ["_templates"]
|
19
19
|
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
@@ -0,0 +1,195 @@
|
|
1
|
+
Parametric Study
|
2
|
+
================
|
3
|
+
|
4
|
+
This functionality allows users to set up and run a parametric study in OpenFOAM, where multiple simulations are executed with varying parameters to analyze their effects on the results. The study can be configured to modify specific fields or solver settings across different runs.
|
5
|
+
|
6
|
+
Overview
|
7
|
+
--------
|
8
|
+
|
9
|
+
The general workflow for a parametric study in OpenFOAM using foamlib is as follows:
|
10
|
+
|
11
|
+
.. mermaid::
|
12
|
+
|
13
|
+
graph LR
|
14
|
+
A[Template Case] --> B[Generate Case Variants]
|
15
|
+
C[Modify Parameters] --> B
|
16
|
+
B --> D[Run Simulation]
|
17
|
+
D --> E[Post-process and Analyze]
|
18
|
+
|
19
|
+
A template case is created with the necessary configuration files. The user can then generate multiple case variants by modifying specific parameters, such as initial conditions, boundary conditions, or solver settings. Each variant is run independently, and the results are collected for post-processing and analysis.
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
The general concept of the parametric study is that template cases are copied to a new folder, and the parameters are modified in the copied case. This requires the definition of the following parameters:
|
24
|
+
|
25
|
+
- template_case: The path to the template case that will be copied and modified.
|
26
|
+
- output_folder: The folder where the modified cases will be stored.
|
27
|
+
- case_name: The name of the case that will be created.
|
28
|
+
- instructions: A list of the file and the key entry that needs to be modified in the template case.
|
29
|
+
- value: the value for each instruction
|
30
|
+
- case category: A category for the case, which can be used to group cases together for easier post-processing.
|
31
|
+
|
32
|
+
|
33
|
+
Multiple parammetric study generators are avaible and describe below in detail.
|
34
|
+
|
35
|
+
CSV Generator
|
36
|
+
-------------
|
37
|
+
|
38
|
+
The csv generator create the parametric study based on a CSV file that contains the parameters to be varied. This generator reads the CSV file, extracts the parameters, and generates multiple case variants by modifying the specified fields in the template case.
|
39
|
+
|
40
|
+
.. code-block:: python
|
41
|
+
|
42
|
+
from foamlib.preprocessing.parameter_study import csv_generator
|
43
|
+
|
44
|
+
# Example usage
|
45
|
+
csv_generator(
|
46
|
+
csv_file="path/to/your/parameters.csv",
|
47
|
+
template_case="path/to/template/case",
|
48
|
+
output_folder="path/to/output/folder"
|
49
|
+
).create_study()
|
50
|
+
|
51
|
+
This simple generator specifies the above requirements in the csv file, where the instruction (file and key name (here: NX,NY and someModel)) is defined in the `system/simulationParameters` file. The case_name and the category will be defined as additional columns in the CSV file.
|
52
|
+
|
53
|
+
|
54
|
+
.. code-block:: c++
|
55
|
+
|
56
|
+
/*--------------------------------*- C++ -*----------------------------------*\
|
57
|
+
| ========= | |
|
58
|
+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
59
|
+
| \\ / O peration | Version: plus |
|
60
|
+
| \\ / A nd | Web: www.OpenFOAM.com |
|
61
|
+
| \\/ M anipulation | |
|
62
|
+
\*---------------------------------------------------------------------------*/
|
63
|
+
FoamFile
|
64
|
+
{
|
65
|
+
version 2.0;
|
66
|
+
format ascii;
|
67
|
+
class dictionary;
|
68
|
+
location "system";
|
69
|
+
object simulationParameters;
|
70
|
+
}
|
71
|
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
72
|
+
|
73
|
+
NX 23;
|
74
|
+
NY 8;
|
75
|
+
|
76
|
+
someModel SomeModelName;
|
77
|
+
|
78
|
+
|
79
|
+
// ************************************************************************* //
|
80
|
+
|
81
|
+
The file can be included in every openfoam dictionary by adding the following line and can be referenced with a dollar sign in the dictionary:
|
82
|
+
|
83
|
+
.. code-block:: c++
|
84
|
+
|
85
|
+
#include "system/simulationParameters"
|
86
|
+
|
87
|
+
blocks
|
88
|
+
(
|
89
|
+
hex (0 1 2 3 4 5 6 7) ($NX $NY 1) simpleGrading (1 1 1)
|
90
|
+
);
|
91
|
+
|
92
|
+
|
93
|
+
The csv file needs to be contain a case_name column and the parameters to be varied. Additionally, columns can be specified to categorize the cases: `Resolution`, and `Model`. The generator will create a case for each row in the CSV file. This is necessary to simplify the post-processing. The csv file should look like this:
|
94
|
+
|
95
|
+
|
96
|
+
========== ==== ==== ========== ============ ===================
|
97
|
+
case_name NX NY someModel Resolution Model
|
98
|
+
========== ==== ==== ========== ============ ===================
|
99
|
+
case_001 100 200 modelA coarse k-epsilon
|
100
|
+
case_002 150 300 modelB fine Spalart-Allmaras
|
101
|
+
========== ==== ==== ========== ============ ===================
|
102
|
+
|
103
|
+
|
104
|
+
Grid Parameter sweep
|
105
|
+
--------------------
|
106
|
+
|
107
|
+
The grid parameter sweep generator allows users to define a set of parameters and creates all combinations of these parameters to generate multiple cases.
|
108
|
+
In the example below, the grid resolution and initial height are varied across multiple cases.
|
109
|
+
|
110
|
+
The most important class for the grid generator is the `GridParameter`. This class encapsulates both the `FoamDictInstruction` and the `CaseParameter`. The `FoamDictInstruction` class is used to specify which files and keys in the OpenFOAM case should be modified.
|
111
|
+
|
112
|
+
|
113
|
+
.. code-block:: python
|
114
|
+
|
115
|
+
from foamlib.preprocessing.grid_parameter_sweep import CaseParameter, GridParameter
|
116
|
+
from foamlib.preprocessing.of_dict import FoamDictInstruction
|
117
|
+
|
118
|
+
# helper function
|
119
|
+
def grid_parameters(scale) -> list[int]:
|
120
|
+
return [
|
121
|
+
int(23 * scale),
|
122
|
+
int(8 * scale),
|
123
|
+
int(19 * scale),
|
124
|
+
int(42 * scale),
|
125
|
+
int(4 * scale),
|
126
|
+
]
|
127
|
+
|
128
|
+
|
129
|
+
grid = GridParameter(
|
130
|
+
parameter_name="grid",
|
131
|
+
# generate 5 instructions in system/simulationParameters with the key1..5
|
132
|
+
modify_dict=[
|
133
|
+
FoamDictInstruction(
|
134
|
+
file_name=Path("system/simulationParameters"),
|
135
|
+
keys=[f"res{i}"],
|
136
|
+
)
|
137
|
+
for i in range(1, 6)
|
138
|
+
],
|
139
|
+
parameters=[
|
140
|
+
CaseParameter(
|
141
|
+
name="coarse", values=grid_parameters(1) # return [23, 8, 19, 42, 4]
|
142
|
+
),
|
143
|
+
CaseParameter(
|
144
|
+
name="mid", values=grid_parameters(2) # return [46, 16, 38, 84, 8]
|
145
|
+
),
|
146
|
+
CaseParameter(
|
147
|
+
name="fine", values=grid_parameters(4) # return [92, 32, 76, 168, 16]
|
148
|
+
)]
|
149
|
+
)
|
150
|
+
|
151
|
+
The modify_dict varaible stores the instructions for the OpenFOAM dictionary that will be modified. The `keys` parameter specifies the keys in the dictionary that will be modified. The `parameters` variable stores the parameters that will be used to modify the keys in the dictionary. Each `CaseParameter` contains a name and a list of values that will be used to modify the keys in the dictionary.
|
152
|
+
|
153
|
+
.. code-block:: python
|
154
|
+
|
155
|
+
from foamlib.preprocessing.grid_parameter_sweep import grid_generator
|
156
|
+
|
157
|
+
init_height = GridParameter(
|
158
|
+
parameter_name="initHeight",
|
159
|
+
modify_dict=[
|
160
|
+
FoamDictInstruction(
|
161
|
+
file_name=Path("system/simulationParameters"),
|
162
|
+
keys=["initHeight"],
|
163
|
+
)
|
164
|
+
],
|
165
|
+
parameters=[
|
166
|
+
CaseParameter(
|
167
|
+
name="height_02", values=[0.2]
|
168
|
+
),
|
169
|
+
CaseParameter(
|
170
|
+
name="height_03", values=[0.3]
|
171
|
+
),
|
172
|
+
CaseParameter(
|
173
|
+
name="height_04", values=[0.4]
|
174
|
+
)
|
175
|
+
],
|
176
|
+
)
|
177
|
+
|
178
|
+
study = grid_generator(
|
179
|
+
parameters=[grid, init_height],
|
180
|
+
template_case=template_case,
|
181
|
+
output_folder=root / "Cases",
|
182
|
+
)
|
183
|
+
|
184
|
+
study.create_study(study_base_folder=root)
|
185
|
+
|
186
|
+
This code creates a parametric study that varies the grid resolution and initial height across multiple cases. The `grid_generator` function takes a list of `GridParameter` objects, which define the parameters to be varied, and generates all combinations of these parameters to create multiple cases. So, 3 times 3 cases will be generated, resulting in 9 cases in total. Each case will have a unique name based on the parameters used.
|
187
|
+
|
188
|
+
Convenience Functions for FoamDictInstruction
|
189
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
190
|
+
|
191
|
+
This section provides a reference to all functions available in the `foamlib.preprocessing.system` module.
|
192
|
+
|
193
|
+
.. automodule:: foamlib.preprocessing.system
|
194
|
+
:members:
|
195
|
+
|
@@ -0,0 +1,96 @@
|
|
1
|
+
Post Processing
|
2
|
+
===============
|
3
|
+
|
4
|
+
Analyzing large parametric studies can be cumbersome, especially when dealing with numerous cases and parameters. To facilitate this process, FoamLib provides a post-processing module that allows users to analyze and visualize the results of their parametric studies efficiently.
|
5
|
+
|
6
|
+
The general concept is that the post processing case are all located in the same folder and with the following structure:
|
7
|
+
|
8
|
+
- cases
|
9
|
+
* case1
|
10
|
+
+ postProcessing
|
11
|
+
- function object 1
|
12
|
+
- function object 2
|
13
|
+
* case2
|
14
|
+
+ postProcessing
|
15
|
+
- function object 1
|
16
|
+
- function object 2
|
17
|
+
|
18
|
+
The post-processing module can be used to extract data from the post-processing files and visualize it in a user-friendly manner.
|
19
|
+
|
20
|
+
The main idea is to gather all the post-processing files from different cases into a single dataframe that stores the data in a long format. This allows for easy manipulation and visualization of the data using libraries like seaborn, ploty.express or altair or numerous other plotting libraries.
|
21
|
+
|
22
|
+
time series data
|
23
|
+
----------------
|
24
|
+
|
25
|
+
|
26
|
+
.. code-block:: python
|
27
|
+
|
28
|
+
from foamlib.postprocessing.load_tables import OutputFile, list_outputfiles, load_tables
|
29
|
+
|
30
|
+
forces = load_tables(
|
31
|
+
source=OutputFile(file_name="force.dat", folder="forces"), dir_name="Cases"
|
32
|
+
)
|
33
|
+
forces.to_csv(
|
34
|
+
results / "forces.csv",
|
35
|
+
index=False,
|
36
|
+
)
|
37
|
+
|
38
|
+
The following example would load all the force.dat files from the post-processing folder of each case in the Cases directory and save the results in a CSV file. The resulting dataframe will have columns for the case name, time, and force components (fx, fy, fz, ..) and the case category specified in the case.json file that gets automatically generated when creating a case with FoamLib pre-processing module.
|
39
|
+
|
40
|
+
The OutputFile class is used to specify the file name and folder where the post-processing files are located, where the general syntax in OpenFOAM is as followed:
|
41
|
+
|
42
|
+
.. code-block::
|
43
|
+
|
44
|
+
postProcessing / folder1 / folder2 / timeName / file_name
|
45
|
+
|
46
|
+
Only the folder and file_name are required, the timeName is optional and can be used to specify a specific time folder. If not specified, the post-processing module will look for the file in all time folders.
|
47
|
+
|
48
|
+
list outputfiles
|
49
|
+
----------------
|
50
|
+
|
51
|
+
The `list_outputfiles` function can be used to list all the output files in a given directory, and the `load_tables` function can be used to load the data from the output files into a dataframe. The resulting dataframe will have columns for the case name, time, and force components (fx, fy, fz, ..) and the case category specified in the case.json file that gets automatically generated when creating a case with FoamLib pre-processing module.
|
52
|
+
|
53
|
+
|
54
|
+
.. code-block:: python
|
55
|
+
|
56
|
+
out_files = list_outputfiles(root / "Cases")
|
57
|
+
|
58
|
+
forces = load_tables(
|
59
|
+
source=out_files["forces--force.dat"], dir_name=root / "Cases"
|
60
|
+
)
|
61
|
+
|
62
|
+
spatial data (surfaces, sets, ...)
|
63
|
+
----------------------------------
|
64
|
+
|
65
|
+
|
66
|
+
The post-processing module also supports loading spatial data from OpenFOAM cases, such as surface data or sets. OpenFOAM stores for each time name a new file with the same name that contains the spatial data. These data can be loaded into a dataframe using the `load_tables` function, which will automatically handle the parsing of the data and return it in a long format.
|
67
|
+
|
68
|
+
However, the resulting dataframe may contain a lot of data, so these dataframe can be filtererd with a custum function that return a filtered dataframe.
|
69
|
+
|
70
|
+
.. code-block:: python
|
71
|
+
|
72
|
+
from foamlib.postprocessing.load_tables import OutputFile, load_tables
|
73
|
+
|
74
|
+
def max_height_filter(table: pd.DataFrame, parameters: dict[str, str]) -> pd.DataFrame:
|
75
|
+
"""Filter the table to get the maximum height."""
|
76
|
+
d = {
|
77
|
+
"x": [table["x"].max()],
|
78
|
+
"y": [table["y"].max()],
|
79
|
+
"z": [table["z"].max()],
|
80
|
+
}
|
81
|
+
d.update(parameters)
|
82
|
+
return pd.DataFrame(d)
|
83
|
+
|
84
|
+
|
85
|
+
file = OutputFile(file_name="U_freeSurface.raw", folder="freeSurface")
|
86
|
+
surface_heights = load_tables(
|
87
|
+
source=file, dir_name=root / "Cases", filter_table=max_height_filter
|
88
|
+
)
|
89
|
+
surface_heights.to_csv(
|
90
|
+
results / "surface_heights.csv",
|
91
|
+
index=False,
|
92
|
+
)
|
93
|
+
|
94
|
+
generally,the `load_tables` functions should be stored in a seperate file and the resulting tables should be written to disc as e.g csv feater or formats. The post-processing module can then be used to load the data from the files and visualize it in a user-friendly manner.
|
95
|
+
|
96
|
+
This allows the implementation of dashboards to quickly explore the data. Additionally, the table gathering process can be easily outgenerate from the CLI.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# %%
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
from foamlib.preprocessing.parameter_study import csv_generator
|
6
|
+
|
7
|
+
# damBreak
|
8
|
+
root = Path(__file__).parent
|
9
|
+
template_case = root / "damBreak"
|
10
|
+
|
11
|
+
study = csv_generator(
|
12
|
+
csv_file=root / "parastudy.csv", template_case=template_case, output_folder=root / "Cases"
|
13
|
+
)
|
14
|
+
|
15
|
+
study.create_study(study_base_folder=root)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
from foamlib.preprocessing.grid_parameter_sweep import CaseParameter, GridParameter
|
4
|
+
from foamlib.preprocessing.of_dict import FoamDictInstruction
|
5
|
+
from foamlib.preprocessing.parameter_study import grid_generator
|
6
|
+
from foamlib.preprocessing.system import simulationParameters
|
7
|
+
|
8
|
+
# damBreak
|
9
|
+
root = Path(__file__).parent
|
10
|
+
template_case = root / "damBreak"
|
11
|
+
|
12
|
+
|
13
|
+
def grid_parameters(scale) -> list[int]:
|
14
|
+
return [
|
15
|
+
int(23 * scale),
|
16
|
+
int(8 * scale),
|
17
|
+
int(19 * scale),
|
18
|
+
int(42 * scale),
|
19
|
+
int(4 * scale),
|
20
|
+
]
|
21
|
+
|
22
|
+
|
23
|
+
grid = GridParameter(
|
24
|
+
parameter_name="grid",
|
25
|
+
# generate 5 instructions in system/simulationParameters with the key1..5
|
26
|
+
# This is simulationParameters is identical to the following:
|
27
|
+
# FoamDictInstruction(
|
28
|
+
# file_name=Path("system/simulationParameters"),
|
29
|
+
# keys=[f"res{i}"],
|
30
|
+
# )
|
31
|
+
modify_dict=[simulationParameters(keys=[f"res{i}"]) for i in range(1, 6)],
|
32
|
+
parameters=[
|
33
|
+
CaseParameter(name="coarse", values=grid_parameters(1)),
|
34
|
+
CaseParameter(name="mid", values=grid_parameters(2)),
|
35
|
+
CaseParameter(name="fine", values=grid_parameters(4)),
|
36
|
+
],
|
37
|
+
)
|
38
|
+
|
39
|
+
init_height = GridParameter(
|
40
|
+
parameter_name="initHeight",
|
41
|
+
modify_dict=[simulationParameters(keys=["initHeight"])],
|
42
|
+
parameters=[
|
43
|
+
CaseParameter(name="height_02", values=[0.2]),
|
44
|
+
CaseParameter(name="height_03", values=[0.3]),
|
45
|
+
CaseParameter(name="height_04", values=[0.4]),
|
46
|
+
],
|
47
|
+
)
|
48
|
+
|
49
|
+
study = grid_generator(
|
50
|
+
parameters=[grid, init_height],
|
51
|
+
template_case=template_case,
|
52
|
+
output_folder=root / "Cases",
|
53
|
+
)
|
54
|
+
|
55
|
+
study.create_study(study_base_folder=root)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/*--------------------------------*- C++ -*----------------------------------*\
|
2
|
+
| ========= | |
|
3
|
+
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
4
|
+
| \\ / O peration | Version: plus |
|
5
|
+
| \\ / A nd | Web: www.OpenFOAM.com |
|
6
|
+
| \\/ M anipulation | |
|
7
|
+
\*---------------------------------------------------------------------------*/
|
8
|
+
FoamFile
|
9
|
+
{
|
10
|
+
version 2.0;
|
11
|
+
format ascii;
|
12
|
+
class volScalarField;
|
13
|
+
object T;
|
14
|
+
}
|
15
|
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
16
|
+
|
17
|
+
dimensions [0 0 0 1 0 0 0];
|
18
|
+
|
19
|
+
internalField uniform 300;
|
20
|
+
|
21
|
+
boundaryField
|
22
|
+
{
|
23
|
+
leftWall
|
24
|
+
{
|
25
|
+
type zeroGradient;
|
26
|
+
}
|
27
|
+
|
28
|
+
rightWall
|
29
|
+
{
|
30
|
+
type zeroGradient;
|
31
|
+
}
|
32
|
+
|
33
|
+
lowerWall
|
34
|
+
{
|
35
|
+
type zeroGradient;
|
36
|
+
}
|
37
|
+
|
38
|
+
atmosphere
|
39
|
+
{
|
40
|
+
type zeroGradient;
|
41
|
+
}
|
42
|
+
|
43
|
+
defaultFaces
|
44
|
+
{
|
45
|
+
type empty;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
// ************************************************************************* //
|