Difference between revisions of "User:Bfiedler/DraftCoriolisForce"

From OpenFOAMWiki
(copy some source code)
Line 2: Line 2:
 
=== copy  some  source code ===
 
=== copy  some  source code ===
  
if you do not have a solver directory in $WM_PROJECT_USER_DIR do
+
if you do not yet have a solver directory in $WM_PROJECT_USER_DIR ,  create it:
  
 
  mkdir $WM_PROJECT_USER_DIR/applications/solvers
 
  mkdir $WM_PROJECT_USER_DIR/applications/solvers
  
get the original tutorial code for  
+
Copy the original tutorial code for   buoyantBoussinesqPimpleFoam  into your solver directory, renaming it to my_tornado:
  
 
  cd $FOAM_SOLVERS
 
  cd $FOAM_SOLVERS
Line 12: Line 12:
 
  cp -r buoyantBoussinesqPimpleFoam  $WM_PROJECT_USER_DIR/applications/solvers/my_tornado
 
  cp -r buoyantBoussinesqPimpleFoam  $WM_PROJECT_USER_DIR/applications/solvers/my_tornado
  
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/my_tornado/.
 
  cp buoyantBoussinesqSimpleFoam/readTransportProperties.H  $WM_PROJECT_USER_DIR/applications/solvers/my_tornado/.
 
   
 
   
 
+
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
Line 32: Line 32:
  
 
  EXE = $(FOAM_APPBIN)/my_tornado
 
  EXE = $(FOAM_APPBIN)/my_tornado
 
  
 
  cd ..
 
  cd ..
Line 40: Line 39:
  
 
  ls $FOAM_USER_APPBIN
 
  ls $FOAM_USER_APPBIN
 +
 +
Next we add the capabiltiy to make the tornado.
  
 
=== Add the Coriolis Force ===
 
=== Add the Coriolis Force ===

Revision as of 20:31, 22 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 my_tornado:

cd $FOAM_SOLVERS
cd heatTransfer
cp -r buoyantBoussinesqPimpleFoam  $WM_PROJECT_USER_DIR/applications/solvers/my_tornado

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/my_tornado/.

Check that the code compiles in its new location:

cd $WM_PROJECT_USER_DIR/applications/solvers
ls -l
cd my_tornado

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:

my_tornado.C
EXE = $(FOAM_APPBIN)/my_tornado
cd ..
wmake

You may get a few warnings. But hopefully you will see a new app my_tornado (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 Ready to run

cd $FOAM_RUN/tutorials/heatTransfer


cp -r buoyantBoussinesqPimpleFoam/hotRoom $FOAM_RUN/my_tornado

We consolidate some code that were separate in the original tutorial structure:

cp -r buoyantPimpleFoam/hotRoom/setHotRoom $FOAM_RUN/my_tornado/.
cd $FOAM_RUN/my_tornado
./Allclean
ls

You should see something like this:

0/  Allclean*  Allrun*  constant/  setHotRoom/  system/

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

Then 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
my_tornado