Difference between revisions of "HowTo Add a Coriolis Force And Make a Tornado"
(add image) |
(app name my_tornado causes problems with `getAppilcation`, change to myTornado. Also instruct to edit controlDict) |
||
Line 5: | Line 5: | ||
mkdir $WM_PROJECT_USER_DIR/applications/solvers | mkdir $WM_PROJECT_USER_DIR/applications/solvers | ||
− | Copy the original tutorial code for buoyantBoussinesqPimpleFoam into your solver directory, renaming it to | + | Copy the original tutorial code for buoyantBoussinesqPimpleFoam into your solver directory, renaming it to myTornado: |
cd $FOAM_SOLVERS | cd $FOAM_SOLVERS | ||
cd heatTransfer | cd heatTransfer | ||
− | cp -r buoyantBoussinesqPimpleFoam $WM_PROJECT_USER_DIR/applications/solvers/ | + | cp -r buoyantBoussinesqPimpleFoam $WM_PROJECT_USER_DIR/applications/solvers/myTornado |
With this code in its new location, we need to copy a file that was shared in the the previous location: | With this code in its new location, we need to copy a file that was shared in the the previous location: | ||
− | cp buoyantBoussinesqSimpleFoam/readTransportProperties.H $WM_PROJECT_USER_DIR/applications/solvers/ | + | cp buoyantBoussinesqSimpleFoam/readTransportProperties.H $WM_PROJECT_USER_DIR/applications/solvers/myTornado/. |
Check that the code compiles in its new location: | Check that the code compiles in its new location: | ||
cd $WM_PROJECT_USER_DIR/applications/solvers | cd $WM_PROJECT_USER_DIR/applications/solvers | ||
ls -l | ls -l | ||
− | cd | + | cd myTornado |
if you have this file, delete it: | if you have this file, delete it: | ||
Line 28: | Line 28: | ||
and edit the file named "files" to this: | and edit the file named "files" to this: | ||
− | + | myTornado.C | |
− | EXE = $(FOAM_APPBIN)/ | + | EXE = $(FOAM_APPBIN)/myTornado |
cd .. | cd .. | ||
wmake | wmake | ||
− | You may get a few warnings. But hopefully you will see a new app | + | You may get a few warnings. But hopefully you will see a new app myTornado (though without any ability yet to make a tornado) : |
ls $FOAM_USER_APPBIN | ls $FOAM_USER_APPBIN | ||
Line 67: | Line 67: | ||
cd $FOAM_RUN/tutorials/heatTransfer | cd $FOAM_RUN/tutorials/heatTransfer | ||
− | cp -r buoyantBoussinesqPimpleFoam/hotRoom $FOAM_RUN/ | + | cp -r buoyantBoussinesqPimpleFoam/hotRoom $FOAM_RUN/myTornado |
We consolidate some code that were separate in the original tutorial structure: | We consolidate some code that were separate in the original tutorial structure: | ||
− | cp -r buoyantPimpleFoam/hotRoom/setHotRoom $FOAM_RUN/ | + | cp -r buoyantPimpleFoam/hotRoom/setHotRoom $FOAM_RUN/myTornado/. |
− | cd $FOAM_RUN/ | + | cd $FOAM_RUN/myTornado |
./Allclean | ./Allclean | ||
ls | ls | ||
Line 78: | Line 78: | ||
You should see something like this: | You should see something like this: | ||
0/ Allclean* Allrun* constant/ setHotRoom/ system/ | 0/ Allclean* Allrun* constant/ setHotRoom/ system/ | ||
+ | |||
+ | edit system/controlDict so that the application line reads (remove the original line rather than attempting to comment it out) : | ||
+ | application myTornado; | ||
Edit Allrun so that the compileApplication line is simply: | Edit Allrun so that the compileApplication line is simply: | ||
Line 100: | Line 103: | ||
After about 20 seconds of CPU time, the run should finish. Now you should be apple to view the results with paraFoam. | After about 20 seconds of CPU time, the run should finish. Now you should be apple to view the results with paraFoam. | ||
− | [[File: | + | [[File:myTornado.png|200px|thumb|right|clip though center, show pressure and isosurface]] |
Note the log files. | Note the log files. | ||
Line 114: | Line 117: | ||
setHotRoom | setHotRoom | ||
blockMesh | blockMesh | ||
− | + | myTornado |
Revision as of 20:57, 23 January 2011
1 Copy Some Source Code
if you do not yet have a solver directory in $WM_PROJECT_USER_DIR , create it:
mkdir $WM_PROJECT_USER_DIR/applications/solvers
Copy the original tutorial code for buoyantBoussinesqPimpleFoam into your solver directory, renaming it to myTornado:
cd $FOAM_SOLVERS cd heatTransfer cp -r buoyantBoussinesqPimpleFoam $WM_PROJECT_USER_DIR/applications/solvers/myTornado
With this code in its new location, we need to copy a file that was shared in the the previous location:
cp buoyantBoussinesqSimpleFoam/readTransportProperties.H $WM_PROJECT_USER_DIR/applications/solvers/myTornado/.
Check that the code compiles in its new location:
cd $WM_PROJECT_USER_DIR/applications/solvers ls -l cd myTornado
if you have this file, delete it:
rm buoyantBoussinesqPimpleFoam.dep
cd Make
If you have this directory, then delete it:
rm -rf linux64GccDPOpt
and edit the file named "files" to this:
myTornado.C EXE = $(FOAM_APPBIN)/myTornado
cd .. wmake
You may get a few warnings. But hopefully you will see a new app myTornado (though without any ability yet to make a tornado) :
ls $FOAM_USER_APPBIN
Next we add the capabiltiy to make the tornado.
2 Add the Coriolis Force
Add a single line UEqn.H, so that the top of the file is:
// Solve the momentum equation fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) + (2*myVector ^ U) // Coriolis force );
Add one line to the end of readTransportProperties.H
dimensionedVector myVector(laminarTransport.lookup("myVector"));
Then recompile
wmake
3 Prepare the Run Directory
cd $FOAM_RUN/tutorials/heatTransfer
cp -r buoyantBoussinesqPimpleFoam/hotRoom $FOAM_RUN/myTornado
We consolidate some code that were separate in the original tutorial structure:
cp -r buoyantPimpleFoam/hotRoom/setHotRoom $FOAM_RUN/myTornado/.
cd $FOAM_RUN/myTornado ./Allclean ls
You should see something like this:
0/ Allclean* Allrun* constant/ setHotRoom/ system/
edit system/controlDict so that the application line reads (remove the original line rather than attempting to comment it out) :
application myTornado;
Edit Allrun so that the compileApplication line is simply:
compileApplication setHotRoom
Now we need to specify myVector, which we will use as the rotation vector in the calculation of the Coriolis force:
cd constant
Edit transportProperties near the end to include this line:
myVector myVector [0 0 -1 0 0 0 0] (0 0.001 0);
Then
cd ..
A quick way to proceed is to do:
./Allrun
After about 20 seconds of CPU time, the run should finish. Now you should be apple to view the results with paraFoam.
Note the log files.
If you want to experience the details that were scripted by Allrun, do this instead:
cd setHotRoom wmake
This should reveal a new app setHotRoom:
ls $FOAM_USER_APPBIN
cd .. setHotRoom blockMesh myTornado