Difference between revisions of "Contrib solidParticleFoam"

From OpenFOAMWiki
m (Example cases)
m (damBreak)
Line 41: Line 41:
 
Add the solidParticleCloud class to the interFoam/damBreak tutorial by doing the following, and you will have some nice animation to view:
 
Add the solidParticleCloud class to the interFoam/damBreak tutorial by doing the following, and you will have some nice animation to view:
  
Copy the \verb+interFoam+ solver, clean up, re-name and compile
+
Copy the interFoam solver, clean up, re-name and compile
\begin{verbatim}
+
<cpp>
 
cd $WM_PROJECT_USER_DIR/applications
 
cd $WM_PROJECT_USER_DIR/applications
 
cp -r $FOAM_APP/solvers/multiphase/interFoam solidParticleInterFoam
 
cp -r $FOAM_APP/solvers/multiphase/interFoam solidParticleInterFoam
 
cd solidParticleInterFoam
 
cd solidParticleInterFoam
 
wclean
 
wclean
rm -r Make/linux*
+
rm -rf Make/linux*
 
mv interFoam.C solidParticleInterFoam.C
 
mv interFoam.C solidParticleInterFoam.C
 
sed s/interFoam/solidParticleInterFoam/g Make/files > temp1
 
sed s/interFoam/solidParticleInterFoam/g Make/files > temp1
 
sed s/FOAM_APPBIN/FOAM_USER_APPBIN/g temp1 > Make/files
 
sed s/FOAM_APPBIN/FOAM_USER_APPBIN/g temp1 > Make/files
 
wmake
 
wmake
\end{verbatim}
+
</cpp>
 +
At this point you can check that the code still works for the damBreak tutorial.
  
Add functionality from the solidParticleCloud class, described at:
+
Add functionality from the solidParticleCloud class, described at http://openfoamwiki.net/index.php/Contrib_solidParticleFoam. Do a checkout, so that we can grab some files easily (the grabbing later assumes that you have followed the above instructions exactly, so that you are now in the $WM_PROJECT_USER_DIR/applications/solidParticleInterFoam directory):
\verb+http://openfoamwiki.net/index.php/Contrib_solidParticleFoam+
+
<cpp>
\begin{verbatim}
+
 
svn checkout http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/
 
svn checkout http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/
\end{verbatim}
+
</cpp>
  
After a look in the example, we know that we need to include the class definitions in \verb+solidParticleCloud.H+, we should create a \verb+solidParticleCloud+, and we should use the \verb+move+ member function to move the particles each time step:
+
After a look in the solidParticleCloud example, we know that we need to include the class definitions in solidParticleCloud.H, we should create a solidParticleCloud, and we should use the 'move' member function to move the particles each time step:
\begin{verbatim}
+
<cpp>
 
sed s/'#include "twoPhaseMixture.H"'/'#include "twoPhaseMixture.H"\n#include "solidParticleCloud.H"'/g solidParticleInterFoam.C > temp2
 
sed s/'#include "twoPhaseMixture.H"'/'#include "twoPhaseMixture.H"\n#include "solidParticleCloud.H"'/g solidParticleInterFoam.C > temp2
 
sed s/'#include "setInitialDeltaT.H"'/'#include "setInitialDeltaT.H"\n    solidParticleCloud particles(mesh);'/g temp2 > temp3
 
sed s/'#include "setInitialDeltaT.H"'/'#include "setInitialDeltaT.H"\n    solidParticleCloud particles(mesh);'/g temp2 > temp3
 
sed s/'runTime.write();'/'particles.move(g);\n        runTime.write();'/g temp3 > solidParticleInterFoam.C
 
sed s/'runTime.write();'/'particles.move(g);\n        runTime.write();'/g temp3 > solidParticleInterFoam.C
 
rm temp*
 
rm temp*
\end{verbatim}
+
</cpp>
  
 
We need to add two libraries when we compile:
 
We need to add two libraries when we compile:
\begin{verbatim}
+
<cpp>
 
sed s/'finiteVolume\/lnInclude'/'finiteVolume\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/basic\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/solidParticle\/lnInclude'/g Make/options > temp1
 
sed s/'finiteVolume\/lnInclude'/'finiteVolume\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/basic\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/solidParticle\/lnInclude'/g Make/options > temp1
 
sed s/'-lfiniteVolume'/'-lfiniteVolume \\\n    -llagrangian \\\n    -lsolidParticle'/g temp1 > Make/options
 
sed s/'-lfiniteVolume'/'-lfiniteVolume \\\n    -llagrangian \\\n    -lsolidParticle'/g temp1 > Make/options
 
rm temp*
 
rm temp*
 
wmake
 
wmake
\end{verbatim}
+
</cpp>
  
Now, let's modify the \verb+interFoam/damBreak+ tutorial and include the particles of the \verb+solidParticleFoam/box+ tutorial:
+
Now, let's modify the interFoam/damBreak tutorial and include the particles of the solidParticleFoam/box tutorial (we have to modify the initial positions since we will use them in a new geometry):
\begin{verbatim}
+
<cpp>
 
run
 
run
cp -r $FOAM_TUTORIALS/interFoam/damBreak .
+
cp -r $FOAM_TUTORIALS/interFoam/damBreak SolidParticleDamBreak
cd damBreak
+
cd solidParticleDamBreak
 
cp -r $WM_PROJECT_USER_DIR/applications/solidParticleInterFoam/solidParticleFoam/box/0/lagrangian 0
 
cp -r $WM_PROJECT_USER_DIR/applications/solidParticleInterFoam/solidParticleFoam/box/0/lagrangian 0
 
rm -rf 0/lagrangian/myCloud
 
rm -rf 0/lagrangian/myCloud
Line 90: Line 90:
 
setFields
 
setFields
 
solidParticleInterFoam >& log_solidParticleInterFoam &
 
solidParticleInterFoam >& log_solidParticleInterFoam &
\end{verbatim}
+
</cpp>
  
View the results in \verb+paraview+ (there is a problem with LPT in paraFoam).\\
+
View the results in paraview (there is a problem with LPT in paraFoam):
\begin{verbatim}
+
 
foamToVTK
 
foamToVTK
 
paraview
 
paraview
 
File/open: VTK/damBreak_..vtk
 
File/open: VTK/damBreak_..vtk
 
File/open: VTK/lagrangian/defaultCloud/defaultCloud_..vtk
 
File/open: VTK/lagrangian/defaultCloud/defaultCloud_..vtk
\end{verbatim}
 
 
For the damBreak object:
 
For the damBreak object:
\verb+Display: Opacity 0,3+\\
+
Display: Opacity 0,3
\verb+Color By: gamma+ (cell values)\\
+
Color By: gamma+ (cell values)
 
For the defaultCloud object:
 
For the defaultCloud object:
Create box glyphs (length: 10/10/10, Scale Mode off) to visualize the particles.\\
+
Create box glyphs (length: 10/10/10, Scale Mode off) to visualize the particles.
 
Run the animation and enjoy...
 
Run the animation and enjoy...
  

Revision as of 21:12, 15 November 2008

Valid versions: OF version 15.png

1 Short description

A minimalistic code and case set-up to show how to use the solidParticleCloud class.

Note that OpenFOAM-1.5.x is required! It does not work with OpenFOAM-1.5!

2 Usage

Do the following steps:

  • cd solidParticleFoam/solidParticleFoam
  • wmake
  • rehash
  • cd ../box
  • blockMesh
  • solidParticleFoam

2.1 Post-Processing

Do the following steps while standing in the 'box' directory:

  • foamToVTK
  • paraview
  • In Paraview: Load state baseState.pvsm and click on the 'play' button to run an animation.

3 Physics

The code includes interaction with walls, but no collisions. The particles are affected by drag, but the fluid is unaffected by the particles.

This solver is not to be used for simulations that resemble the real world. It's just a demo.

4 Example cases

4.1 Box

Two particles with different initial velocities are inserted in the field. See above for how to run the case.

4.2 damBreak

Add the solidParticleCloud class to the interFoam/damBreak tutorial by doing the following, and you will have some nice animation to view:

Copy the interFoam solver, clean up, re-name and compile

 
cd $WM_PROJECT_USER_DIR/applications
cp -r $FOAM_APP/solvers/multiphase/interFoam solidParticleInterFoam
cd solidParticleInterFoam
wclean
rm -rf Make/linux*
mv interFoam.C solidParticleInterFoam.C
sed s/interFoam/solidParticleInterFoam/g Make/files > temp1
sed s/FOAM_APPBIN/FOAM_USER_APPBIN/g temp1 > Make/files
wmake

At this point you can check that the code still works for the damBreak tutorial.

Add functionality from the solidParticleCloud class, described at http://openfoamwiki.net/index.php/Contrib_solidParticleFoam. Do a checkout, so that we can grab some files easily (the grabbing later assumes that you have followed the above instructions exactly, so that you are now in the $WM_PROJECT_USER_DIR/applications/solidParticleInterFoam directory):

 
svn checkout http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/

After a look in the solidParticleCloud example, we know that we need to include the class definitions in solidParticleCloud.H, we should create a solidParticleCloud, and we should use the 'move' member function to move the particles each time step:

 
sed s/'#include "twoPhaseMixture.H"'/'#include "twoPhaseMixture.H"\n#include "solidParticleCloud.H"'/g solidParticleInterFoam.C > temp2
sed s/'#include "setInitialDeltaT.H"'/'#include "setInitialDeltaT.H"\n    solidParticleCloud particles(mesh);'/g temp2 > temp3
sed s/'runTime.write();'/'particles.move(g);\n        runTime.write();'/g temp3 > solidParticleInterFoam.C
rm temp*

We need to add two libraries when we compile:

 
sed s/'finiteVolume\/lnInclude'/'finiteVolume\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/basic\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/solidParticle\/lnInclude'/g Make/options > temp1
sed s/'-lfiniteVolume'/'-lfiniteVolume \\\n    -llagrangian \\\n    -lsolidParticle'/g temp1 > Make/options
rm temp*
wmake

Now, let's modify the interFoam/damBreak tutorial and include the particles of the solidParticleFoam/box tutorial (we have to modify the initial positions since we will use them in a new geometry):

 
run
cp -r $FOAM_TUTORIALS/interFoam/damBreak SolidParticleDamBreak
cd solidParticleDamBreak
cp -r $WM_PROJECT_USER_DIR/applications/solidParticleInterFoam/solidParticleFoam/box/0/lagrangian 0
rm -rf 0/lagrangian/myCloud
cp -r $WM_PROJECT_USER_DIR/applications/solidParticleInterFoam/solidParticleFoam/box/constant/particleProperties constant
sed s/'0.05'/'0.005'/g 0/lagrangian/defaultCloud/positions > temp1
sed s/'9e-2'/'0.58'/g temp1 > 0/lagrangian/defaultCloud/positions
rm temp1
blockMesh
setFields
solidParticleInterFoam >& log_solidParticleInterFoam &

View the results in paraview (there is a problem with LPT in paraFoam): foamToVTK paraview File/open: VTK/damBreak_..vtk File/open: VTK/lagrangian/defaultCloud/defaultCloud_..vtk For the damBreak object: Display: Opacity 0,3 Color By: gamma+ (cell values) For the defaultCloud object: Create box glyphs (length: 10/10/10, Scale Mode off) to visualize the particles. Run the animation and enjoy...

5 Download

The most up-to-date version of the sources can be downloaded via subversion:

svn checkout http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/

6 History

  • 2008-11-07: Initial upload

--Hani 10:09, 7 October 2008 (CEST)