Create a complete OpenFOAM simulation (pure_openfoam_cas es/tiny-tgv) directory from the fluidsimfoam API
The next step is to create in a test a directory similar to pure_openfoam_cases/tiny-tgv
, but with our fluidsimfoam API.
First, modify the test to check if a file is created, and if the created file is equal to the brother file in tiny-tgv
.
Reading a file could be done with something like (in the test file)
from pathlib import Path
here = Path(__file__).absolute().parent
path_tiny = here / "pure_openfoam_cases/tiny-tgv"
path_fvsolution = path_tiny / "system/fvSolution"
text_manual = path_fvsolution.read_text()
# same to get text_produced (from the produced file) (with path sim.path_run)
assert text_manual == text_produced
At the beginning the test has to fail. At this point, commit.
Then, we have to code to (i) add parameters and (ii) produce the file. If there is nothing evident in PyFoam to produce OpenFOAM files, we could try to do it with Jinja2 https://jinja.palletsprojects.com.
Then, the same for the other files...