Difference between revisions of "Contrib solidParticleFoam"

From OpenFOAMWiki
(solidParticleDamBreak)
(solidParticleDamBreak)
Line 77: Line 77:
  
 
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):
 
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
 
  
 
For 1.5.x:
 
For 1.5.x:
 +
run
 
  cp -r $FOAM_TUTORIALS/interFoam/damBreak solidParticleDamBreak
 
  cp -r $FOAM_TUTORIALS/interFoam/damBreak solidParticleDamBreak
 
  cd solidParticleDamBreak/0
 
  cd solidParticleDamBreak/0
Line 86: Line 86:
 
  wget http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/box/constant/particleProperties
 
  wget http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/box/constant/particleProperties
 
  cd ..
 
  cd ..
 
  
 
For 2.*:
 
For 2.*:
 +
run
 
  cp -r $FOAM_TUTORIALS/multiphase/interFoam/ras/damBreak solidParticleDamBreak
 
  cp -r $FOAM_TUTORIALS/multiphase/interFoam/ras/damBreak solidParticleDamBreak
 
  cd solidParticleDamBreak/0
 
  cd solidParticleDamBreak/0
Line 104: Line 104:
 
  solidParticleInterFoam >& log_solidParticleInterFoam &
 
  solidParticleInterFoam >& log_solidParticleInterFoam &
  
View the results in paraview (there is a problem with LPT in paraFoam):
+
View the results in paraview:
* foamToVTK
+
foamToVTK
* paraview
+
paraview
 +
 
 
* File/open: VTK/solidParticeDamBreak_..vtk
 
* File/open: VTK/solidParticeDamBreak_..vtk
 
* File/open: VTK/lagrangian/defaultCloud/defaultCloud_..vtk
 
* File/open: VTK/lagrangian/defaultCloud/defaultCloud_..vtk
* For the solidParticleDamBreak object: Display: Opacity 0,3. Color By: gamma (cell values)
+
* 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.
 
* For the defaultCloud object: 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 14:49, 12 September 2012

Valid versions: OF version 15.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 http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/

For 2.0.x and 2.1.x:

svn checkout http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/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:

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 http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.5/solvers/other/solidParticleFoam/box/0/lagrangian
cd ../constant
wget http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/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 http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_2.0/solvers/other/solidParticleFoam/box/0/lagrangian
cd ../constant
wget http://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/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:

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
  • 2008-11-15: Added the solidParticleDamBreak example

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