CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [PyFoam] Using snappyHexMesh -overwrite with BasicRunner (https://www.cfd-online.com/Forums/openfoam-community-contributions/240289-using-snappyhexmesh-overwrite-basicrunner.html)

DaveyGravy December 23, 2021 18:52

Using snappyHexMesh -overwrite with BasicRunner
 
Hello,

I am trying to automate a mesh convergence study using PyFoam to vary the refinement levels of my mesh.

I haven't found a way to use the -overwrite option for snappyHexMesh with BasicRunner, leaving me unable to run a solver.

Here is my BasicRunner code:
Code:

# decompose case for parallel run
Decomposer(args=["--progress", "--method=simple",
            "--n=3,2,1", "--delta=1e-4", "--decomposer=decomposePar -copyZero", case.name, 6]
)
machine = LAMMachine(nr=6)
# run snappy
runSnappy = BasicRunner(
    argv=["snappyHexMesh", "-case", case.name], silent=True, parameters="overwrite", logname="snappyHexMesh", lam=machine
)
runSnappy.start()

And here is the fatal error that is returned:
Code:

Create time

Create mesh for time = 3

 Reading field p

[3] --> FOAM FATAL ERROR:
[3] cannot find file "/home/daveygravy/scripting/OpenFOAM/dragOverSphereSnappy/flowAroundSphereSnappy-nu100/processor3/3/p"
[3]
[3]    From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
[3]    in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 539.
[3]
FOAM parallel run exiting

If I can use snappyHexMesh -overwrite, then Create mesh for time = 3 will change to Create mesh for time = 0, and my run can progress.


I've taken a look at the source code, though I don't see a straightforward way to implement -overwrite.


Any help is appreciated, thanks!

DaveyGravy August 11, 2022 20:44

Hoping someone has attempted this in the meantime...


All times are GMT -4. The time now is 00:17.