# Building the code

In your chosen parent directory for the sofcFoam model, (e.g. your OpenFoam work space $WM_PROJECT_USER_DIR/applications/), check out the master branch, from the git repository using your favourite graphical git tool, or the command git clone git://git.code.sf.net/p/openfuelcell/git openfuelcell This creates directory openfuelcell/ in the current working directory. src To compile the library and application source code, go to openfuelcell/src/ directory and run the Allwmake script. Type ./Allwmake at the prompt. This should generate shared object library libsofcFoam.so in the$FOAM_USER_LIBBIN directory and application executable sofcFoam in the \$FOAM_USER_APPBIN directory. A lnInclude/ directory, containing links to all of the libSrc class files, will appear in the libSrc/ directory.

cases
As can be seen in Figure 2(b), a case directory contains only one polyMesh/ directory immediately after checkout, and it contains only the dictionary file blockMeshDict. This dictionary, together with the setSet batch command files in the <case>/config/ directory, describes the global and regional meshes. After the global mesh is made by the OpenFOAM utility blockMesh, the utility splitMeshRegions generates the required regional meshes and map files. For more information on the blockMesh, setSet, and setsToZones utilities, see Chapter 5 “Mesh generation and conversion” and Section 3.6 “Standard utilities” in the OpenFOAM User Guide.

Making the global and regional meshes is handled in sofcFoam by the Makefile in the case directory. See, for example, run/coFlow/Makefile. The command

make mesh

issued from the case directory, will generate the global mesh and the region meshes. During model execution, various material property and other field values will be mapped from the region meshes to the global mesh. Cells that began life labeled as a fluid in the global mesh may have become a solid, and some of these may have boundary faces on the original fluid inlet or outlet patches. Accordingly, the fluid inlet and outlet patches may need to be redefined for the new reality. The redefinitions are specified by the make.face[Air|Fuel|Set] files in the config directory. See Appendix A for a description of the steps required to specify a new geometry.