Contrib solidParticleFoam

From OpenFOAMWiki

Valid versions: OF Version 15x.png OF Version 20.png OF Version 21.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:

For 1.5.x:

svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/solvers/other/solidParticleFoam/

For 2.0.x and 2.1.x:

svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/solvers/other/solidParticleFoam

Compile solidParticleFoam and run the box test case:

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

2.1 Post-Processing

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

sed -i -e 's=/chalmers/users/hani/OpenFOAM/hani-2.1.x/run/solidParticleFoam/box='$PWD'=' baseState.pvsm
 
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 solidParticleDamBreak

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_DIR
cp -r --parents applications/solvers/multiphase/interFoam $WM_PROJECT_USER_DIR
cd $WM_PROJECT_USER_DIR/applications/solvers/multiphase
mv interFoam solidParticleInterFoam
cd solidParticleInterFoam
wclean
rm -rf Make/linux*
mv interFoam.C solidParticleInterFoam.C
sed -i.orig s/interFoam/solidParticleInterFoam/g Make/files
sed -i s/FOAM_APPBIN/FOAM_USER_APPBIN/g Make/files
wmake

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

Now we will add functionality from the solidParticle class.

We need to include the class declarations in solidParticleCloud.H, we should create a solidParticleCloud, and we should use the 'move' member function to move the particles each time step:

cd $WM_PROJECT_USER_DIR/applications/solvers/multiphase/solidParticleInterFoam
sed -i.orig s/'#include "twoPhaseMixture.H"'/'#include "twoPhaseMixture.H"\n#include "solidParticleCloud.H"'/g solidParticleInterFoam.C
sed -i s/'#include "setInitialDeltaT.H"'/'#include "setInitialDeltaT.H"\n    solidParticleCloud particles(mesh);'/g solidParticleInterFoam.C
sed -i s/'runTime.write();'/'particles.move(g);\n        runTime.write();'/g solidParticleInterFoam.C

We need to add some libraries when we compile:

sed -i.orig s/'finiteVolume\/lnInclude'/'finiteVolume\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/basic\/lnInclude \\\n    -I$(LIB_SRC)\/lagrangian\/solidParticle\/lnInclude \\\n    -I$(LIB_SRC)\/meshTools\/lnInclude'/g Make/options
sed -i s/'-lfiniteVolume'/'-lfiniteVolume \\\n    -llagrangian \\\n    -lsolidParticle'/g Make/options
wmake
rehash

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):

For 1.5.x:

run
cp -r $FOAM_TUTORIALS/interFoam/damBreak solidParticleDamBreak
cd solidParticleDamBreak/0
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/solvers/other/solidParticleFoam/box/0/lagrangian
cd ../constant
wget https://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/solvers/other/solidParticleFoam/box/constant/particleProperties
cd ..

For 2.*:

run
cp -r $FOAM_TUTORIALS/multiphase/interFoam/ras/damBreak solidParticleDamBreak
cd solidParticleDamBreak/0
svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/solvers/other/solidParticleFoam/box/0/lagrangian
cd ../constant
wget https://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/solvers/other/solidParticleFoam/box/constant/particleProperties
cd ..

Continue:

rm -rf 0/lagrangian/myCloud
sed -i.orig s/'0.05'/'0.005'/g 0/lagrangian/defaultCloud/positions
sed -i s/'9e-2'/'0.58'/g 0/lagrangian/defaultCloud/positions
blockMesh
setFields
solidParticleInterFoam >& log_solidParticleInterFoam &

View the results in paraview:

foamToVTK
paraview
  • File/open: VTK/solidParticeDamBreak_..vtk
  • File/open: VTK/lagrangian/defaultCloud/defaultCloud_..vtk
  • For the solidParticleDamBreak object: Display: Opacity 0,3. Color By: gamma (1.5) or alpha1 (2.*) (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:

For 1.5.x:

svn checkout svn://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.5/solvers/other/solidParticleFoam/

For 2.0.x and 2.1.x:

svn checkout http://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_2.0/solvers/other/solidParticleFoam/

6 History

  • 2012-09-12: Updated to 2.*
  • 2008-11-15: Added the solidParticleDamBreak example
  • 2008-11-07: Initial upload

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