Professional Documents
Culture Documents
More Tutorials
More Tutorials
We will start by searching the source code for information on how to use solvers, utilities and libraries. Then we will learn how to use a small number of useful utilities and libraries. Some of them are described in the UserGuide and ProgrammersGuide, some are described in the OpenFOAM Wiki (e.g. Turbomachinery Working Group) and some of them have been discussed in the Forum. In your home assignment you will be asked to go through some of the written tutorials in the UserGuide and ProgrammersGuide, where you will nd some written tutorials. It is HIGHLY recommended that you dig through ALL of the UserGuide and ProgrammersGuide (before complaining that there is not enough OpenFOAM documentation). If you nd a utility, solver or library that is not described anywhere (or insufciently described), you can include a description of it in your project tutorial. I A would prefer if you then use my LTEX slide template, so that I can easily use it in coming courses (then please proved the raw tex-le and accompanying graphical les).
68
69
Run the icoFoam cavity tutorials using the Allrun script (1/7)
(Note that the following description shows the principle. There might be small differences in exactly what is done by the Allrun script between versions.)
In the icoFoam tutorial directory there is an Allrun script. When running this script it is preferred to copy the entire directory to your run directory. Type: cp -r $FOAM_TUTORIALS/incompressible/icoFoam $FOAM_RUN cd $FOAM_RUN/icoFoam ./Allrun >& log_Allrun& Looking in the Allrun script, you can see a list of cases that will be executed: cavityCases="cavity cavityFine cavityGrade cavityHighRe cavityClipped" Some of those cases are actually created by the script. At the end of the script it also runs the elbow case. The script contains Linux commands and calls for OpenFOAM applications in order to set up and run the simulations.
70
Run the icoFoam cavity tutorials using the Allrun script (2/7)
The Allrun script for the icoFoam cavity tutorials actually rst runs the cavity case #Running blockMesh on cavity: blockMesh #Running icoFoam on cavity: icoFoam
71
Run the icoFoam cavity tutorials using the Allrun script (3/7)
The Allrun script for the icoFoam cavity tutorials actually then runs the cavityFine case: #Cloning cavityFine case from cavity: mkdir cavityFine cp -r cavity/{0,system,constant} cavityFine [change "20 20 1" in blockMeshDict to "41 41 1"] [set startTime in controlDict to 0.5] [set endTime in controlDict to 0.7] [set deltaT in controlDict to 0.0025] [set writeControl in controlDict to runTime] [set writeInterval in controlDict to 0.1] #Running blockMesh on cavityFine blockMesh #Running mapFields from cavity to cavityFine mapFields -case cavity -sourceTime latestTime -consistent #Running icoFoam on cavityFine icoFoam
72
Run the icoFoam cavity tutorials using the Allrun script (4/7)
The Allrun script for the icoFoam cavity tutorials actually then runs the cavityGrade case: #Running blockMesh on cavityGrade blockMesh #Running mapFields from cavityFine to cavityGrade mapFields -case cavityFine -sourceTime latestTime -consistent #Running icoFoam on cavityGrade icoFoam
73
Run the icoFoam cavity tutorials using the Allrun script (5/7)
The Allrun script for the icoFoam cavity tutorials actually then runs the cavityHighRe case: #Cloning cavityHighRe case from cavity mkdir cavityHighRe cp -r cavity/{0,system,constant} cavityHighRe #Setting cavityHighRe to generate a secondary vortex [set startFrom in controlDict to latestTime;] [set endTime in controlDict to 2.0;] [change 0.01 in transportProperties to 0.001] #Copying cavity/0* directory to cavityHighRe cp -r cavity/0* cavityHighRe #Running blockMesh on cavityHighRe blockMesh #Running icoFoam on cavityHighRe icoFoam
74
Run the icoFoam cavity tutorials using the Allrun script (6/7)
The Allrun script for the icoFoam cavity tutorials actually then runs the cavityClipped case: #Running blockMesh on cavityClipped blockMesh #Running mapFields from cavity to cavityClipped cp -r cavityClipped/0 cavityClipped/0.5 mapFields -case cavity -sourceTime latestTime [Reset the boundary condition for fixedWalls to:] [ type fixedValue; ] [ value uniform (0 0 0); ] [ We do this since the fixedWalls got ] [ interpolated values by cutting the domain ] #Running icoFoam on cavityClipped icoFoam
75
Run the icoFoam cavity tutorials using the Allrun script (7/7)
The Allrun script for the icoFoam cavity tutorials actually nally runs the elbow case
76
77
You will get a list of example dictionaries for the utilities that use a dictionary. Some of those examples can be found next to the source code of each particular utility, and some are also used in the solver tutorials. The ones that dont use a dictionary are usually easier to learn how to use, in particular when using the -help ag.
78
We will now have a look at some utilities and libraries. Please feel free to improve/expand these descriptions as part of your assignment (e.g. 2.0.x, gures etc.)! Use previously mentioned dictionary hints to nd alternatives for entries.
79
80
Running sample -case cavity, the pressure, p, is extracted along a horizontal line at 100 points, and the results are written in cavity/sets. Plot in gnuplot: plot "cavity/sets/0.5/horizontalLine_p.xy" sample can also sample surfaces...
81
surfaces ( outputName { //type patch; //patchName movingWall; //triangulate false; type plane; basePoint (0.05 0.05 0.005); normalVector (0 0 1); } );
Run with sample -case cavity The result is written in cavity/surfaces Visualize the surfaces in paraview (File / Open and nd a vtk le in the surfaces directory).
82
83
84
Surfaces:
thresholdCellFaces cuttingPlane isoSurfaceCell patch isoSurface distanceSurface plane
See the source code for exact denitions (and help me expand this information): $FOAM_UTILITIES/postProcessing/sampling/sample/sample.C
85
86
- The defaultFieldValues sets the default values of the elds. - A boxToCell bounding box is used to dene a set of cells where the fieldValues should be different than the defaultFieldValues. - Use a dummy instead of boxToCell to see the topoSetSource alternatives. - An advanced user could describe different topoSetSources
87
88
The point labels are written to constant/polyMesh/sets/nonAlignedEdges Take the opportunity to visualize the point set in paraFoam: First open the cavity case in paraFoam, then use File/Open <case>.OpenFOAM to read in the same case again. This time mark Include Sets, mark only Mesh Parts/NonAlignedEdges, and visualize using box glyphs. Another way to view the problematic points in paraview (not paraFoam): foamToVTK -case cavity -pointSet nonAlignedEdges The result appears in the VTK directory. The flattenMesh utility can sometimes x the problem, like in this case.
89
90
91
92
93
94
functionObjects
functionObjects are general libraries that can be attached run-time to any solver, without having to re-compile the solver. An example can be found in the incompressible/pisoFoam/les/pitzDaily tutorial. A functionObject is added to a solver by adding a functions entry in system/controlDict You can nd functionObjects in the source code, in the OpenFOAM Wiki (www.openfoamwiki.net), and in the OpenFOAM-extend project (www.sourceforge.net). Search the tutorials for examples using: grep -r functionObjectLibs $FOAM_TUTORIALS The implementations can be found in: $FOAM_SRC/postProcessing/functionObjects I need your help documenting this.
95
96
97
98
More functionObjects
http://openfoamwiki.net/index.php/Contrib_simpleFunctionObjects
http://openfoamwiki.net/index.php/Sig_Turbomachienry_/_ERCOFTAC_centrifugal_pump_with_a_vaned_diffuser#Optional_tools
99