Implement a passive scalar transport solver
Implement a passive scalar transport solver
Contents
•You will add an additional scalar transport equation to an existing solver.
Prerequisites
•You are familiar with the directory structure of OpenFOAM applications.
•You are familiar with user compilation procedures of applications.
•You are familiar with the fundamental high-level components of application codes,and how new classes can be introduced to an application.
Learning outcomes
•You will practice high-level coding and modification of solvers.
•You will adapt case set-ups according to the new solver.
•You will improve your understanding of classes and object orientation,from a high-level perspective.
Implement a passive scalar transport solver
Very important note:
•The instructions in these slides are for icoFoam and the icoFoam/cavity case,but:
•To make it slightly more interesting you should use the instructions to instead implement this for pimpleFoam and the pimpleFoam/RAS/pitzDaily case.
•Assume that you want to add a passive scalarfield that you can use to visualize how far into the computational domain theflow has passed for each time step.Thus,initialize the internalfield of the scalar to zero and set the inlet value to one.When the value of the scalar is one in the entire domain,you have an indication that theflow has passed through the entire domain.
•Does this mean that you have reached a point where theflow is fully developed?
Note that you will be asked to pack up yourfinal cleaned-up directories and submit them for assessment of completion:
passiveScalarPimpleFoam
passiveScalarPitzDaily
(not the icoFoam/cavity alternative)
Copy the icoFoam solver,rename it,and test that it still compiles •We copy the icoFoam solver and put it in our$WM_PROJECT_USER_DIR with the samefile structure as in the OpenFOAM installation:
foam
cp-r--parents applications/solvers/incompressible/icoFoam$WM_PROJECT_USER_DIR
cd$WM_PROJECT_USER_DIR/applications/solvers/incompressible
mv icoFoam passiveScalarIcoFoam
cd passiveScalarIcoFoam
wclean
mv icoFoam.C passiveScalarIcoFoam.C
•Modify Make/files(most portable way):
string="passiveScalarIcoFoam.C\nEXE=\$(FOAM_USER_APPBIN)/passiveScalarIcoFoam" printf"%b\n""$string">Make/files
Make sure that you understand what this command does,and why it is done!
•Compile with wmake in the hash if necessary.
Test on the cavity case
We will quickly visit the run directory
pushd$FOAM_RUN#so that we can easily go back to the current directory rm-r cavity
cp-r$FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity.
blockMesh-case cavity
passiveScalarIcoFoam-case cavity
After checking that it worked,go back to the passiveScalarIcoFoam directory:
popd#brings you back to the directory where you typed the pushd command
You can also do everything’remotely’:
rm-r$FOAM_RUN/cavity
cp-r$FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity$FOAM_RUN blockMesh-case$FOAM_RUN/cavity
springboot实现aoppassiveScalarIcoFoam-case$FOAM_RUN/cavity

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。