pybFoam 0.1.7__tar.gz → 0.1.9__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.
Files changed (172) hide show
  1. {pybfoam-0.1.7 → pybfoam-0.1.9}/CMakeLists.txt +1 -1
  2. {pybfoam-0.1.7 → pybfoam-0.1.9}/PKG-INFO +1 -1
  3. pybfoam-0.1.9/docs/api.rst +6 -0
  4. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/conf.py +1 -1
  5. {pybfoam-0.1.7 → pybfoam-0.1.9}/pyproject.toml +1 -1
  6. pybfoam-0.1.9/src/pybFoam/_version.py +1 -0
  7. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvc/bind_fvc.cpp +11 -0
  8. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvc.pyi +34 -1
  9. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvm/bind_fvm.cpp +1 -0
  10. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_cfdTools.cpp +25 -0
  11. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_dict.cpp +47 -0
  12. pybfoam-0.1.9/src/pybFoam/pybFoam_core/bind_dimensioned.cpp +132 -0
  13. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_dimensioned.hpp +1 -1
  14. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_fields.cpp +77 -4
  15. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_geo_fields.cpp +168 -13
  16. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_mesh.cpp +1 -0
  17. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/bind_sampling.cpp +16 -16
  18. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/test_parse_ofdict.py +30 -0
  19. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/test_dict.py +1 -1
  20. pybfoam-0.1.9/tests/pybind/test_dimensioned.py +416 -0
  21. pybfoam-0.1.9/tests/pybind/test_fvc.py +69 -0
  22. pybfoam-0.1.9/tests/pybind/test_geoFields.py +192 -0
  23. pybfoam-0.1.9/tests/pybind/test_uniform_fields.py +68 -0
  24. pybfoam-0.1.7/docs/api.rst +0 -6
  25. pybfoam-0.1.7/src/pybFoam/_version.py +0 -1
  26. pybfoam-0.1.7/src/pybFoam/pybFoam_core/bind_dimensioned.cpp +0 -47
  27. pybfoam-0.1.7/tests/pybind/test_fvc.py +0 -34
  28. pybfoam-0.1.7/tests/pybind/test_geoFields.py +0 -66
  29. {pybfoam-0.1.7 → pybfoam-0.1.9}/.github/workflows/ci.yaml +0 -0
  30. {pybfoam-0.1.7 → pybfoam-0.1.9}/.github/workflows/pages.yaml +0 -0
  31. {pybfoam-0.1.7 → pybfoam-0.1.9}/.github/workflows/release.yaml +0 -0
  32. {pybfoam-0.1.7 → pybfoam-0.1.9}/.gitignore +0 -0
  33. {pybfoam-0.1.7 → pybfoam-0.1.9}/CHANGELOG.md +0 -0
  34. {pybfoam-0.1.7 → pybfoam-0.1.9}/CMakePresets.json +0 -0
  35. {pybfoam-0.1.7 → pybfoam-0.1.9}/LICENSE +0 -0
  36. {pybfoam-0.1.7 → pybfoam-0.1.9}/README.md +0 -0
  37. {pybfoam-0.1.7 → pybfoam-0.1.9}/benchmark/bench_complex.png +0 -0
  38. {pybfoam-0.1.7 → pybfoam-0.1.9}/benchmark/bench_vec_add.png +0 -0
  39. {pybfoam-0.1.7 → pybfoam-0.1.9}/benchmark/bench_vec_add_4.png +0 -0
  40. {pybfoam-0.1.7 → pybfoam-0.1.9}/benchmark/benchmark_expression_complex.py +0 -0
  41. {pybfoam-0.1.7 → pybfoam-0.1.9}/benchmark/benchmark_expression_vec_add.py +0 -0
  42. {pybfoam-0.1.7 → pybfoam-0.1.9}/benchmark/benchmark_expression_vec_add_4.py +0 -0
  43. {pybfoam-0.1.7 → pybfoam-0.1.9}/cmake/Dependencies.cmake +0 -0
  44. {pybfoam-0.1.7 → pybfoam-0.1.9}/cmake/FindOpenFOAM.cmake +0 -0
  45. {pybfoam-0.1.7 → pybfoam-0.1.9}/conftest.py +0 -0
  46. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/Makefile +0 -0
  47. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/README.md +0 -0
  48. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/changelog.rst +0 -0
  49. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/contributing.rst +0 -0
  50. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/index.rst +0 -0
  51. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/installation.rst +0 -0
  52. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/introduction.rst +0 -0
  53. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/make.bat +0 -0
  54. {pybfoam-0.1.7 → pybfoam-0.1.9}/docs/usage.rst +0 -0
  55. {pybfoam-0.1.7 → pybfoam-0.1.9}/scripts/generate_stubs.py +0 -0
  56. {pybfoam-0.1.7 → pybfoam-0.1.9}/scripts/pyInstall.sh +0 -0
  57. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/CMakeLists.txt +0 -0
  58. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/__init__.py +0 -0
  59. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvc/CMakeLists.txt +0 -0
  60. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvc/bind_fvc.hpp +0 -0
  61. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvc/fvc.cpp +0 -0
  62. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvm/CMakeLists.txt +0 -0
  63. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvm/bind_fvm.hpp +0 -0
  64. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/fvm/fvm.cpp +0 -0
  65. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/io/__init__.py +0 -0
  66. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/io/model_base.py +0 -0
  67. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/io/system.py +0 -0
  68. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/py.typed +0 -0
  69. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/CMakeLists.txt +0 -0
  70. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_cfdTools.hpp +0 -0
  71. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_control.cpp +0 -0
  72. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_control.hpp +0 -0
  73. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_dict.hpp +0 -0
  74. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_fields.hpp +0 -0
  75. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_fvMatrix.cpp +0 -0
  76. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_fvMatrix.hpp +0 -0
  77. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_geo_fields.hpp +0 -0
  78. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_io.cpp +0 -0
  79. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_io.hpp +0 -0
  80. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_mesh.hpp +0 -0
  81. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_primitives.cpp +0 -0
  82. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/bind_primitives.hpp +0 -0
  83. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core/pybFoam.cpp +0 -0
  84. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/pybFoam_core.pyi +0 -0
  85. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/runTimeTables/CMakeLists.txt +0 -0
  86. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/runTimeTables/foam_runTimeTables.C +0 -0
  87. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/runTimeTables/foam_runTimeTables.H +0 -0
  88. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/runTimeTables/runTimeTables.C +0 -0
  89. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/runTimeTables.pyi +0 -0
  90. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/CMakeLists.txt +0 -0
  91. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/__init__.py +0 -0
  92. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/bind_sampling.hpp +0 -0
  93. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/sampling.cpp +0 -0
  94. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/set_configs.py +0 -0
  95. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/surface_configs.py +0 -0
  96. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling/utils.py +0 -0
  97. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/sampling.pyi +0 -0
  98. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/thermo/CMakeLists.txt +0 -0
  99. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/thermo/bind_thermo.cpp +0 -0
  100. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/thermo/bind_thermo.hpp +0 -0
  101. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/thermo/thermo.cpp +0 -0
  102. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/thermo.pyi +0 -0
  103. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/turbulence/CMakeLists.txt +0 -0
  104. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/turbulence/bind_turbulence.cpp +0 -0
  105. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/turbulence/bind_turbulence.hpp +0 -0
  106. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/turbulence/turbulence.cpp +0 -0
  107. {pybfoam-0.1.7 → pybfoam-0.1.9}/src/pybFoam/turbulence.pyi +0 -0
  108. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/0.orig/U +0 -0
  109. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/0.orig/nu +0 -0
  110. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/0.orig/p +0 -0
  111. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/Allclean +0 -0
  112. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/Allrun +0 -0
  113. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/constant/transportProperties +0 -0
  114. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/icoFoam.py +0 -0
  115. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/log2 +0 -0
  116. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/system/PDRblockMeshDict +0 -0
  117. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/system/blockMeshDict +0 -0
  118. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/system/controlDict +0 -0
  119. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/system/decomposeParDict +0 -0
  120. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/system/fvSchemes +0 -0
  121. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/cavity/system/fvSolution +0 -0
  122. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/0.orig/U +0 -0
  123. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/0.orig/nu +0 -0
  124. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/0.orig/p +0 -0
  125. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/Allclean +0 -0
  126. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/Allrun +0 -0
  127. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/constant/transportProperties +0 -0
  128. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/icoFoam.py +0 -0
  129. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/system/controlDict +0 -0
  130. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/system/foamDataToFluentDict +0 -0
  131. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/system/fvSchemes +0 -0
  132. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/elbow/system/fvSolution +0 -0
  133. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/TestDict +0 -0
  134. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/TestDict.json +0 -0
  135. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/TestDict.yaml +0 -0
  136. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/controlDict +0 -0
  137. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/fvSchemes +0 -0
  138. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/fvSolution +0 -0
  139. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/test_controlDict.py +0 -0
  140. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/test_fvSchemes.py +0 -0
  141. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/io/test_fvSolution.py +0 -0
  142. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/0/U +0 -0
  143. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/0/alpha.water +0 -0
  144. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/0/p_rgh +0 -0
  145. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/0.orig/U +0 -0
  146. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/0.orig/alpha.water +0 -0
  147. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/0.orig/p_rgh +0 -0
  148. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/Allclean +0 -0
  149. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/Allrun +0 -0
  150. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/Allrun-parallel +0 -0
  151. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/dynamicMeshDict +0 -0
  152. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/g +0 -0
  153. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/polyMesh/boundary +0 -0
  154. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/polyMesh/faces +0 -0
  155. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/polyMesh/neighbour +0 -0
  156. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/polyMesh/owner +0 -0
  157. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/polyMesh/points +0 -0
  158. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/transportProperties +0 -0
  159. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/constant/turbulenceProperties +0 -0
  160. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/system/TestDict +0 -0
  161. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/system/blockMeshDict +0 -0
  162. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/system/controlDict +0 -0
  163. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/system/decomposeParDict +0 -0
  164. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/system/fvSchemes +0 -0
  165. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/system/fvSolution +0 -0
  166. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/system/setFieldsDict +0 -0
  167. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/test_fvm.py +0 -0
  168. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/test_primitives.py +0 -0
  169. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/test_set_sampling.py +0 -0
  170. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/pybind/test_surface_sampling.py +0 -0
  171. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/test_sampling_models.py +0 -0
  172. {pybfoam-0.1.7 → pybfoam-0.1.9}/tests/test_sampling_set_configs.py +0 -0
@@ -5,7 +5,7 @@ if(POLICY CMP0169)
5
5
  cmake_policy(SET CMP0169 OLD)
6
6
  endif()
7
7
 
8
- project(pybFoam VERSION 0.1.7 LANGUAGES CXX)
8
+ project(pybFoam VERSION 0.1.9 LANGUAGES CXX)
9
9
 
10
10
  # Set C++ standard
11
11
  set(CMAKE_CXX_STANDARD 17)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybFoam
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: python bindings for OpenFOAM
5
5
  Keywords: OpenFOAM,simulation,CFD
6
6
  Author-Email: Henning Scheufler <henning.scheufler@web.de>
@@ -0,0 +1,6 @@
1
+ API Reference
2
+ =============
3
+
4
+ .. automodule:: pybFoam
5
+ :members:
6
+ :undoc-members:
@@ -9,7 +9,7 @@
9
9
  project = "pybFoam"
10
10
  copyright = "2025, Henning Scheufler"
11
11
  author = "Henning Scheufler"
12
- release = "0.1.7"
12
+ release = "0.1.9"
13
13
 
14
14
  # -- General configuration ---------------------------------------------------
15
15
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pybFoam"
3
- version = "0.1.7"
3
+ version = "0.1.9"
4
4
  authors = [
5
5
  {name = "Henning Scheufler", email = "henning.scheufler@web.de"},
6
6
  ]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.9"
@@ -140,4 +140,15 @@ void Foam::bindFVC(pybind11::module& fvc)
140
140
 
141
141
  // ddtCorr
142
142
  fvc.def("ddtCorr", [](const volVectorField& vf, const surfaceScalarField& ssf){return fvc::ddtCorr(vf,ssf);});
143
+
144
+ fvc.def("snGrad", [](const volScalarField& vf){return fvc::snGrad(vf);});
145
+ fvc.def("snGrad", [](const tmp<volScalarField>& vf){return fvc::snGrad(vf);});
146
+ fvc.def("snGrad", [](const volVectorField& vf){return fvc::snGrad(vf);});
147
+ fvc.def("snGrad", [](const tmp<volVectorField>& vf){return fvc::snGrad(vf);});
148
+
149
+
150
+ fvc.def("reconstruct", [](const surfaceScalarField& sf){return fvc::reconstruct(sf);});
151
+ fvc.def("reconstruct", [](const tmp<surfaceScalarField>& sf){return fvc::reconstruct(sf);});
152
+ fvc.def("reconstruct", [](const surfaceVectorField& sf){return fvc::reconstruct(sf);});
153
+ fvc.def("reconstruct", [](const tmp<surfaceVectorField>& sf){return fvc::reconstruct(sf);});
143
154
  }
@@ -4,7 +4,40 @@ finite volume calculus
4
4
  from __future__ import annotations
5
5
  import pybFoam.pybFoam_core
6
6
  import typing
7
- __all__ = ['div', 'flux', 'grad', 'interpolate', 'laplacian']
7
+ __all__ = ['ddtCorr', 'div', 'flux', 'grad', 'interpolate', 'laplacian', 'reconstruct', 'snGrad']
8
+
9
+ # ==== snGrad - surface normal gradient ====
10
+ @typing.overload
11
+ def snGrad(arg0: pybFoam.pybFoam_core.volScalarField) -> pybFoam.pybFoam_core.tmp_surfaceScalarField:
12
+ ...
13
+ @typing.overload
14
+ def snGrad(arg0: pybFoam.pybFoam_core.tmp_volScalarField) -> pybFoam.pybFoam_core.tmp_surfaceScalarField:
15
+ ...
16
+ @typing.overload
17
+ def snGrad(arg0: pybFoam.pybFoam_core.volVectorField) -> pybFoam.pybFoam_core.tmp_surfaceVectorField:
18
+ ...
19
+ @typing.overload
20
+ def snGrad(arg0: pybFoam.pybFoam_core.tmp_volVectorField) -> pybFoam.pybFoam_core.tmp_surfaceVectorField:
21
+ ...
22
+
23
+ # ==== reconstruct - reconstruct vector from surface flux ====
24
+ @typing.overload
25
+ def reconstruct(arg0: pybFoam.pybFoam_core.surfaceScalarField) -> pybFoam.pybFoam_core.tmp_volVectorField:
26
+ ...
27
+ @typing.overload
28
+ def reconstruct(arg0: pybFoam.pybFoam_core.tmp_surfaceScalarField) -> pybFoam.pybFoam_core.tmp_volVectorField:
29
+ ...
30
+ @typing.overload
31
+ def reconstruct(arg0: pybFoam.pybFoam_core.surfaceVectorField) -> pybFoam.pybFoam_core.tmp_volTensorField:
32
+ ...
33
+ @typing.overload
34
+ def reconstruct(arg0: pybFoam.pybFoam_core.tmp_surfaceVectorField) -> pybFoam.pybFoam_core.tmp_volTensorField:
35
+ ...
36
+
37
+ # ==== ddtCorr ====
38
+ def ddtCorr(arg0: pybFoam.pybFoam_core.volVectorField, arg1: pybFoam.pybFoam_core.surfaceScalarField) -> pybFoam.pybFoam_core.tmp_surfaceScalarField:
39
+ ...
40
+
8
41
  @typing.overload
9
42
  def div(arg0: pybFoam.pybFoam_core.volVectorField) -> pybFoam.pybFoam_core.tmp_volScalarField:
10
43
  ...
@@ -97,6 +97,7 @@ void Foam::bindFVM(pybind11::module& fvm)
97
97
  bindFvmDdt<vector>(fvm);
98
98
  bindFvmDdt<tensor>(fvm);
99
99
 
100
+ bindFvmDiv<scalar>(fvm);
100
101
  bindFvmDiv<vector>(fvm);
101
102
  bindFvmDiv<tensor>(fvm);
102
103
  bindFvmDiv<symmTensor>(fvm);
@@ -53,6 +53,29 @@ namespace Foam
53
53
 
54
54
  return std::make_tuple(CoNum, meanCoNum);
55
55
  }
56
+
57
+ std::tuple <scalar, scalar> computeContinuityErrors
58
+ (
59
+ const surfaceScalarField& phi
60
+ )
61
+ {
62
+ // Get mesh and time
63
+ const fvMesh& mesh = phi.mesh();
64
+ const Time& runTime = mesh.time();
65
+
66
+ // Compute divergence of flux
67
+ volScalarField contErr(fvc::div(phi));
68
+
69
+ // Calculate local continuity error (absolute sum)
70
+ scalar sumLocalContErr = runTime.deltaTValue()*
71
+ mag(contErr)().weightedAverage(mesh.V()).value();
72
+
73
+ // Calculate global continuity error (signed)
74
+ scalar globalContErr = runTime.deltaTValue()*
75
+ contErr.weightedAverage(mesh.V()).value();
76
+
77
+ return std::make_tuple(sumLocalContErr, globalContErr);
78
+ }
56
79
 
57
80
 
58
81
  template <typename RAUType>
@@ -70,6 +93,7 @@ namespace Foam
70
93
 
71
94
  m.def("adjustPhi", &adjustPhi);
72
95
  declare_constrainPressure<volScalarField>(m);
96
+ declare_constrainPressure<surfaceScalarField>(m);
73
97
  m.def("constrainHbyA", &constrainHbyA);
74
98
  m.def("createPhi", [](const volVectorField &U)
75
99
  {
@@ -97,6 +121,7 @@ namespace Foam
97
121
  return std::make_tuple(pRefCell, pRefValue);
98
122
  }, py::arg("p"), py::arg("dict"), py::arg("forceReference") = false);
99
123
  m.def("computeCFLNumber", &computeCFLNumber);
124
+ m.def("computeContinuityErrors", &computeContinuityErrors, py::arg("phi"));
100
125
  }
101
126
 
102
127
  } // namespace Foam
@@ -145,10 +145,12 @@ public:
145
145
  auto it = reg.find(type_name);
146
146
  if (it == reg.end())
147
147
  throw std::runtime_error("Unsupported type for dictionary.get: " + type_name);
148
+
148
149
  struct TypeCaller {
149
150
  Foam::dictionary& dict;
150
151
  GetterFunc func;
151
152
  TypeCaller(Foam::dictionary& d, GetterFunc f) : dict(d), func(f) {}
153
+
152
154
  pybind11::object operator()(const std::string& key) {
153
155
  if (!dict.found(key)) {
154
156
  throw pybind11::key_error("Key '" + key + "' not found in dictionary");
@@ -156,6 +158,7 @@ public:
156
158
  return func(dict, key);
157
159
  }
158
160
  };
161
+
159
162
  return pybind11::cpp_function(TypeCaller(dict, it->second));
160
163
  }
161
164
 
@@ -167,6 +170,36 @@ public:
167
170
  }
168
171
  };
169
172
 
173
+ class DictionaryGetOrDefaultProxy {
174
+ public:
175
+ using GetterFunc = std::function<pybind11::object(Foam::dictionary&, const std::string&)>;
176
+
177
+ Foam::dictionary& dict;
178
+ DictionaryGetOrDefaultProxy(Foam::dictionary& d) : dict(d) {}
179
+
180
+ pybind11::object operator[](pybind11::object py_type) {
181
+ std::string type_name = pybind11::str(py_type.attr("__name__"));
182
+ auto& reg = DictionaryGetProxy::type_registry();
183
+ auto it = reg.find(type_name);
184
+ if (it == reg.end())
185
+ throw std::runtime_error("Unsupported type for dictionary.getOrDefault: " + type_name);
186
+
187
+ struct TypeCaller {
188
+ Foam::dictionary& dict;
189
+ GetterFunc func;
190
+ TypeCaller(Foam::dictionary& d, GetterFunc f) : dict(d), func(f) {}
191
+
192
+ pybind11::object operator()(const std::string& key, pybind11::object default_value) {
193
+ if (!dict.found(key)) {
194
+ return default_value;
195
+ }
196
+ return func(dict, key);
197
+ }
198
+ };
199
+ return pybind11::cpp_function(TypeCaller(dict, it->second));
200
+ }
201
+ };
202
+
170
203
  void bindDict(pybind11::module& m)
171
204
  {
172
205
  namespace py = pybind11;
@@ -197,6 +230,10 @@ void bindDict(pybind11::module& m)
197
230
  .def("toc", &Foam::dictionary::toc)
198
231
  .def("clear", &Foam::dictionary::clear)
199
232
  .def("clear", &Foam::dictionary::clear)
233
+ .def("found", [](const Foam::dictionary& self, const std::string key)
234
+ {
235
+ return self.found(Foam::word(key));
236
+ })
200
237
  .def("isDict", [](const Foam::dictionary& self, const std::string key)
201
238
  {
202
239
  return self.isDict(Foam::word(key));
@@ -265,11 +302,21 @@ void bindDict(pybind11::module& m)
265
302
  },
266
303
  py::return_value_policy::reference_internal
267
304
  )
305
+ .def_property_readonly(
306
+ "getOrDefault",
307
+ [](Foam::dictionary& self) {
308
+ return DictionaryGetOrDefaultProxy(self);
309
+ },
310
+ py::return_value_policy::reference_internal
311
+ )
268
312
  ;
269
313
 
270
314
  py::class_<DictionaryGetProxy>(m, "DictionaryGetProxy")
271
315
  .def("__getitem__", &DictionaryGetProxy::operator[]);
272
316
 
317
+ py::class_<DictionaryGetOrDefaultProxy>(m, "DictionaryGetOrDefaultProxy")
318
+ .def("__getitem__", &DictionaryGetOrDefaultProxy::operator[]);
319
+
273
320
  // Register types for get directly
274
321
  DictionaryGetProxy::type_registry()["str"] = [](Foam::dictionary& d, const std::string& key) {
275
322
  auto* entry = d.findEntry(Foam::word(key));
@@ -0,0 +1,132 @@
1
+ /*---------------------------------------------------------------------------*\
2
+ Copyright (c) 20212, Henning Scheufler
3
+ -------------------------------------------------------------------------------
4
+ License
5
+ This file is part of the pybFoam source code library, which is an
6
+ unofficial extension to OpenFOAM.
7
+ OpenFOAM is free software: you can redistribute it and/or modify it
8
+ under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
12
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
+ for more details.
15
+ You should have received a copy of the GNU General Public License
16
+ along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ \*---------------------------------------------------------------------------*/
19
+
20
+ #include "bind_dimensioned.hpp"
21
+ #include "dimensionedType.H"
22
+ #include "dimensionSet.H"
23
+ #include "volFields.H"
24
+ #include "surfaceFields.H"
25
+ #include "tmp.H"
26
+
27
+ namespace Foam
28
+ {
29
+
30
+ template<class Type>
31
+ auto declare_dimensioned(py::module &m, std::string className)
32
+ {
33
+ return py::class_<dimensioned<Type>>(m, className.c_str())
34
+ .def(py::init<const word&, const dimensionSet, const Type&>())
35
+ .def(py::init<const word&, const dimensionSet, const dictionary&>())
36
+ .def(py::init([](const std::string& name, const dimensionSet& dims, const Type& value) {
37
+ return dimensioned<Type>(word(name), dims, value);
38
+ }))
39
+ .def("name", [](const dimensioned<Type>& self) { return std::string(self.name()); })
40
+ .def("dimensions", [](const dimensioned<Type>& self) { return self.dimensions(); })
41
+ .def("value", [](const dimensioned<Type>& self) { return self.value(); })
42
+
43
+ .def("__mul__", [](const dimensioned<Type>& self, const GeometricField<scalar, fvPatchField, volMesh>& field) {
44
+ return self * field;
45
+ }, "dimensioned × volScalarField")
46
+ .def("__mul__", [](const dimensioned<Type>& self, const tmp<GeometricField<scalar, fvPatchField, volMesh>>& field) {
47
+ return self * field;
48
+ }, "dimensioned × tmp<volScalarField>")
49
+
50
+ .def("__mul__", [](const dimensioned<Type>& self, const GeometricField<scalar, fvsPatchField, surfaceMesh>& field) {
51
+ return self * field;
52
+ }, "dimensioned × surfaceScalarField")
53
+ .def("__mul__", [](const dimensioned<Type>& self, const tmp<GeometricField<scalar, fvsPatchField, surfaceMesh>>& field) {
54
+ return self * field;
55
+ }, "dimensioned × tmp<surfaceScalarField>")
56
+
57
+ .def("__add__", [](const dimensioned<Type>& self, const GeometricField<Type, fvPatchField, volMesh>& field) {
58
+ return self + field;
59
+ }, "dimensioned + volField")
60
+ .def("__add__", [](const dimensioned<Type>& self, const tmp<GeometricField<Type, fvPatchField, volMesh>>& field) {
61
+ return self + field;
62
+ }, "dimensioned + tmp<volField>")
63
+
64
+ .def("__sub__", [](const dimensioned<Type>& self, const GeometricField<Type, fvPatchField, volMesh>& field) {
65
+ return self - field;
66
+ }, "dimensioned - volField")
67
+ .def("__sub__", [](const dimensioned<Type>& self, const tmp<GeometricField<Type, fvPatchField, volMesh>>& field) {
68
+ return self - field;
69
+ }, "dimensioned - tmp<volField>")
70
+ ;
71
+ }
72
+
73
+ }
74
+
75
+
76
+ void bindDimensioned(pybind11::module& m)
77
+ {
78
+ namespace py = pybind11;
79
+
80
+ // Bind dimensionSet class
81
+ py::class_<Foam::dimensionSet>(m, "dimensionSet")
82
+ .def(py::init<Foam::scalar, Foam::scalar, Foam::scalar, Foam::scalar, Foam::scalar, Foam::scalar, Foam::scalar>())
83
+ .def("__pow__", [](const Foam::dimensionSet& self, Foam::scalar p) {
84
+ return Foam::pow(self, p);
85
+ })
86
+ .def("__mul__", [](const Foam::dimensionSet& self, const Foam::dimensionSet& other) {
87
+ return self * other;
88
+ })
89
+ .def("__truediv__", [](const Foam::dimensionSet& self, const Foam::dimensionSet& other) {
90
+ return self / other;
91
+ })
92
+ .def("__and__", [](const Foam::dimensionSet& self, const Foam::dimensionSet& other) {
93
+ return self & other;
94
+ })
95
+ ;
96
+
97
+ // Bind common dimension constants
98
+ m.attr("dimless") = Foam::dimless;
99
+ m.attr("dimMass") = Foam::dimMass;
100
+ m.attr("dimLength") = Foam::dimLength;
101
+ m.attr("dimArea") = Foam::dimArea;
102
+ m.attr("dimTime") = Foam::dimTime;
103
+ m.attr("dimTemperature") = Foam::dimTemperature;
104
+ m.attr("dimMoles") = Foam::dimMoles;
105
+ m.attr("dimCurrent") = Foam::dimCurrent;
106
+ m.attr("dimLuminousIntensity") = Foam::dimLuminousIntensity;
107
+ m.attr("dimVelocity") = Foam::dimVelocity;
108
+ m.attr("dimAcceleration") = Foam::dimAcceleration;
109
+ m.attr("dimForce") = Foam::dimForce;
110
+ m.attr("dimPressure") = Foam::dimPressure;
111
+ m.attr("dimDensity") = Foam::dimDensity;
112
+ m.attr("dimEnergy") = Foam::dimEnergy;
113
+ m.attr("dimPower") = Foam::dimPower;
114
+ m.attr("dimViscosity") = Foam::dimViscosity;
115
+
116
+ auto dsf = Foam::declare_dimensioned<Foam::scalar>(m, "dimensionedScalar");
117
+ auto dvf = Foam::declare_dimensioned<Foam::vector>(m, "dimensionedVector");
118
+ auto dtf = Foam::declare_dimensioned<Foam::tensor>(m, "dimensionedTensor");
119
+
120
+ // Add scalar-specific cross-type multiplication operators for dimensioned<scalar>
121
+ // (scalar × vector/tensor fields, etc.)
122
+ // dimensioned<scalar> × volVectorField
123
+ dsf.def("__mul__", [](const Foam::dimensioned<Foam::scalar>& self, const Foam::volVectorField& field) {
124
+ return self * field;
125
+ }, "dimensioned × volVectorField")
126
+ .def("__mul__", [](const Foam::dimensioned<Foam::scalar>& self, const Foam::tmp<Foam::volVectorField>& field) {
127
+ return self * field;
128
+ }, "dimensioned × tmp<volVectorField>")
129
+ ;
130
+
131
+
132
+ }
@@ -40,7 +40,7 @@ namespace Foam
40
40
  namespace py = pybind11;
41
41
 
42
42
  template<class Type>
43
- void declare_dimensioned(py::module &m, std::string className);
43
+ auto declare_dimensioned(py::module &m, std::string className);
44
44
 
45
45
 
46
46
  }
@@ -21,6 +21,10 @@ License
21
21
  #include "bind_primitives.hpp"
22
22
  #include "bind_primitives.hpp"
23
23
  #include "instantList.H"
24
+ #include "uniformDimensionedFields.H"
25
+ #include "fvMesh.H"
26
+ #include "volFields.H"
27
+ #include "surfaceFields.H"
24
28
 
25
29
 
26
30
  namespace py = pybind11;
@@ -98,10 +102,14 @@ py::class_< Field<Type>> declare_fields(py::module &m, std::string className) {
98
102
  .def("__setitem__", [](Field<Type>& self, const label idx,const Type& s) {
99
103
  self[idx] = s;
100
104
  })
101
- .def("__add__", &Foam::add<Field<Type> >)
105
+ .def("__add__", [](const Field<Type>& self, const Field<Type>& f) {
106
+ return Field<Type>(self + f);
107
+ })
102
108
  .def("__add__", [](Field<Type>& self, const Type& s) {return Field<Type>(self + s);})
103
- .def("__sub__", &Foam::subtract<Field<Type> >)
104
- .def("__sub__", [](Field<Type>& self, const Type& s) {return Field<Type>(self + s);})
109
+ .def("__sub__", [](const Field<Type>& self, const Field<Type>& f) {
110
+ return Field<Type>(self - f);
111
+ })
112
+ .def("__sub__", [](Field<Type>& self, const Type& s) {return Field<Type>(self - s);})
105
113
  .def("__mul__", [](Field<Type>& self, const scalar& s) {return Field<Type>(self * s);})
106
114
  .def("__mul__", [](Foam::Field<Type>& self, const Field<scalar>& sf)
107
115
  {
@@ -110,7 +118,7 @@ py::class_< Field<Type>> declare_fields(py::module &m, std::string className) {
110
118
  .def("__truediv__", [](Field<Type>& self, const scalar& s) {return Field<Type>(self / s);})
111
119
  .def("__truediv__", [](Field<Type>& self, const Field<scalar>& sf)
112
120
  {
113
- return Field<Type>(self * sf);
121
+ return Field<Type>(self / sf);
114
122
  })
115
123
  .def_buffer([](Field<Type>& self) -> py::buffer_info {
116
124
  constexpr bool isScalar = std::is_same<Type, Foam::scalar>::value;
@@ -308,4 +316,69 @@ void Foam::bindFields(py::module& m)
308
316
  m.def("sum",declare_sum<vector>);
309
317
  m.def("sum",declare_sum<tensor>);
310
318
  m.def("sum",declare_sum<symmTensor>);
319
+
320
+ // ==== uniformDimensionedVectorField bindings ====
321
+ // Used for reading constant fields like gravity
322
+ py::class_<Foam::uniformDimensionedVectorField>(m, "uniformDimensionedVectorField")
323
+ .def(py::init([](const Foam::fvMesh& mesh, const std::string& fieldName) {
324
+ return Foam::uniformDimensionedVectorField(
325
+ Foam::IOobject(
326
+ fieldName,
327
+ mesh.time().constant(),
328
+ mesh,
329
+ Foam::IOobject::MUST_READ,
330
+ Foam::IOobject::NO_WRITE
331
+ )
332
+ );
333
+ }), py::arg("mesh"),
334
+ py::arg("fieldName"),
335
+ "Read a uniformDimensionedVectorField from constant/ directory")
336
+ .def("value", [](const Foam::uniformDimensionedVectorField& self) {
337
+ return self.value();
338
+ }, "Get the uniform vector value")
339
+ .def("name", [](const Foam::uniformDimensionedVectorField& self) {
340
+ return self.name();
341
+ }, "Get the field name")
342
+ .def("dimensions", [](const Foam::uniformDimensionedVectorField& self) {
343
+ return self.dimensions();
344
+ }, "Get the field dimensions")
345
+ .def("__and__", [](const Foam::uniformDimensionedVectorField& self,
346
+ const Foam::volVectorField& vf) {
347
+ // Use the base class dimensioned<vector> which has operator& defined
348
+ const Foam::dimensioned<Foam::vector>& dv = self;
349
+ return dv & vf;
350
+ }, py::arg("vf"), "Dot product with volVectorField, returns tmp<volScalarField>")
351
+ .def("__and__", [](const Foam::uniformDimensionedVectorField& self,
352
+ const Foam::surfaceVectorField& vf) {
353
+ // Use the base class dimensioned<vector> which has operator& defined
354
+ const Foam::dimensioned<Foam::vector>& dv = self;
355
+ return dv & vf;
356
+ }, py::arg("vf"), "Dot product with surfaceVectorField, returns tmp<surfaceScalarField>")
357
+ ;
358
+
359
+ // ==== uniformDimensionedScalarField bindings ====
360
+ py::class_<Foam::uniformDimensionedScalarField>(m, "uniformDimensionedScalarField")
361
+ .def(py::init([](const Foam::fvMesh& mesh, const std::string& fieldName) {
362
+ return Foam::uniformDimensionedScalarField(
363
+ Foam::IOobject(
364
+ fieldName,
365
+ mesh.time().constant(),
366
+ mesh,
367
+ Foam::IOobject::MUST_READ,
368
+ Foam::IOobject::NO_WRITE
369
+ )
370
+ );
371
+ }), py::arg("mesh"),
372
+ py::arg("fieldName"),
373
+ "Read a uniformDimensionedScalarField from constant/ directory")
374
+ .def("value", [](const Foam::uniformDimensionedScalarField& self) {
375
+ return self.value();
376
+ }, "Get the uniform scalar value")
377
+ .def("name", [](const Foam::uniformDimensionedScalarField& self) {
378
+ return self.name();
379
+ }, "Get the field name")
380
+ .def("dimensions", [](const Foam::uniformDimensionedScalarField& self) {
381
+ return self.dimensions();
382
+ }, "Get the field dimensions")
383
+ ;
311
384
  }