Running the code

Running on a sequential machine:

With the application compiled, the command:

make srun

will run the executable from the command line, using the available case data. The model can also be run by typing the executable name, and the output directed to Standard Out can be redirected to a file:

sofcFoam | tee

Instead of running the model from the command line, a runscript is available to submit a job to a queue. The script usage line may need editing for your queuing system.

After the model has run to completion, VTK files for visualization, e.g. with paraview, can be prepared easily using the Makefile. Typing:

make view

will generate VTK files for the last output step, whereas:

make viewAll

will generate VTK files for all output directories.

Running on a parallel machine:

Case quickTestPar is essentially case quickTest, modified for parallel decomposition. The makefile, however, is different from the serial file. 

Edit system/decomposeParDict

Export environment variable NPROCS to desired number of processors (e.g. in csh: setenv NPROCS n)

make mesh

Builds the mesh

make parprep

Decompose the mesh and initial field data

make run

Run the decomposed case in parallel

make reconstruct

Reconstruct the mesh and data

make view

Generate the VTK files for viewing.

To start over type:


Here, the field files in the region subdirectories 0/air and 0/fuel have counterparts on the global mesh, i.e., in the top level of the 0/ directory. These files in the top level 0/ directory will be subset during parallel mesh splitting, and the subset fields will be moved to the processor/0/air and processor/0/fuel directories.

In the out−of−box case configuration, air species are O2 and N2, while fuel species are H2 and H2O. If species Sp are added or changed, it is necessary to have diffSp and YSp files for the new species, in accordance with sections 11.8.4 and 11.8.5 of the "gettingStarted_Cell268_OF21x.pdf" document in the docs/ directory. In order to reconstruct and visualize the fluid region fields, the fluid region polyMesh subdirectories must be present in the constant directory. Furthermore, the *ProcAddressing files usually generated by decomposePar −region <name> are required in the processor polyMesh directories.

We also need the *RegionAddressing files in our processor polyMesh directories to enable mapping between global and region meshes.

Accomplishing all of the above requires two decompositions for parallelism, one for the region meshes only and one for the entire mesh. The second decomposition can’t proceed in the presence of the processor* directories created from the first decomposition, so we rename them to keep their *ProcAddressing files for later use. There are also two mesh splittings, the second of them in parallel.

We proceed with steps 1 to 11 below. Note that Step 2 is controlled by the makefile:

$ make mesh | tee log.mesh

Steps 3 through 11 are controlled by parprep.csh, either directly or through the Makefile:

$ ./parprep.csh or $ make parpre
Step 10 is controlled by cleanup.csh, which contains lists noGlobal, noAir and noFuel, of files that are to be removed from, respectively, the processor*/0, processor*/0/air and processor*/0/fuel directories. These lists may need to be edited for additions or changes, particularly with respect to species. cleanup.csh is executed within parprep.csh.

  1. Edit system/decomposeParDict for the desired mesh decomposition and copy to system/air and system/fuel.
    Set environment variable NPROCS to number of processors in decomposeParDict
  2. Build the mesh and split off the regions
  3. Decompose the fluid regions for parallel run
  4. Rename the processor* directories as proc_*
  5. Decompose the global mesh in parallel
  6. Split the global mesh in parallel
  7. Install newly created region/polyMesh dirs and field files to processors
  8. Mesh splitting introduces interface patches named <regionA>_to_<regionB>.
    Their field subdirectories need to be edited. A sed script exists for this.
  9. Sets and zones need to be recreated for the processor* meshes
  10. Directories are cleaned up by removing extraneous files
  11. The *ProcAddressing files are copied from proc_* to corresponding dirctories in processor*

To run the code:

mpirun −mca mpi_warn_on_fork 0 −np $NPROCS sofcFoam −parallel

The script


will issue the above command, and

make runwill launch the prun script.

To reconstruct the parallel run:

reconstructPar −region air
reconstructPar −region fuel

or simply

make reconstruct

To make the VTK files

foamToVTK −latestTime
foamToVTK −latestTime −region air
foamToVTK −latestTime −region fuel
foamToVTK −latestTime −region electrolyte
foamToVTK −latestTime −region interconnect0
foamToVTK −latestTime −region interconnect1

or simply

make view