More Tutorials
More Tutorials
We will now learn how to use a (small) number of useful utilities and libraries. Some of them are described in the UserGuide and ProgrammersGuide, and some of them have been discussed in the Forum. In your home assignment you will be asked to go through all the written tutorials in the UserGuide and ProgrammersGuide, where you will nd some written tutorials. If you nd a utility, solver or library that is not described anywhere, you can include a description of it in your project tutorial. I would prefer if you then use A my L TEX slide template, so that I can easily use it in coming courses. At the end of this part we will learn how to search for additional tutorials and other information on the use of different applications and libraries.
67
68
69
surfaces ( outputName { //type patch; //patchName movingWall; //triangulate false; type plane; basePoint (0.05 0.05 0.005); normalVector (0 0 1); } ); Visualize the surfaces in paraview.
70
71
72
73
74
75
76
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 -pointSet nonAlignedEdges The result appears in the VTK directory. The flattenMesh utility can sometimes x the problem, like in this case.
77
78
79
80
81
82
83
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
84
85
86
87
88
Run the icoFoam cavity tutorials using the Allrun script (1/5)
(Note that I did not have time to make sure that the description below is without any error after conversion to 1.6.x. The principle is however correct.)
In the icoFoam tutorial directory there is an Allrun script. When running this script it is preferred to copy the entire $FOAM_TUTORIALS/incompressible/icoFoam directory to your run directory.
If you run the Allrun script for the icoFoam cavity tutorials you actually rst run the cavity case #Running blockMesh on cavity: blockMesh #Running icoFoam on cavity: icoFoam
89
Run the icoFoam cavity tutorials using the Allrun script (2/5)
If you run the Allrun script for the icoFoam cavity tutorials you actually then run 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
90
Run the icoFoam cavity tutorials using the Allrun script (3/5)
If you run the Allrun script for the icoFoam cavity tutorials you actually then run 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
91
Run the icoFoam cavity tutorials using the Allrun script (4/5)
If you run the Allrun script for the icoFoam cavity tutorials you actually then run 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
92
Run the icoFoam cavity tutorials using the Allrun script (5/5)
If you run the Allrun script for the icoFoam cavity tutorials you actually then run 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
93
94
95
96