OpenFOAM Overview
OpenFOAM Overview
OpenFOAM Overview
OpenFOAM
Feng Chen
HPC User Services
LSU HPC & LONI
[email protected]
2/24/2016 4
OpenFOAM overview
Open Field of Operation And Manipulation (FOAM)
Free, open source CFD software package
The GNU Public License (GPL) gives freedom to contribute to any or all
of these projects.
Open architecturewill be detailed later
Low(Zero)-cost CFD
Problem-independent numerics and discretization
Efficient environment for complex physics problems
C++ programming language
A set of libraries for continuum mechanics
Based on Finite Volume Method (FVM)
U
UU U p
t
solve
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(mu, U)
==
- fvc::grad(p)
);
20
20
transportProperties-representation of SI system
transportModel Newtonian; //viscosity options: newtonian/non-newtonian
nu nu [ 0 2 -1 0 0 0 0 ] 0.01; // kinematic viscosity
U http://www.openfoam.org/docs/user/fvSolutio
{ n.php
solver PBiCG;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
}
}
// pressure - velocity coupling
// SIMPLE (Semi - Implicit Method for
Pressure - Linked Equations )
numberOfSubdomains 20;
method simple;
simpleCoeffs
{
n ( 4 5 1 );
delta 0.001;
}
fixedWalls
{
type fixedValue;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
fixedWalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
cd /work/fchen14/foam_run/intro_of/cavity_parallel_is
decomposePar //specify the parallel run params
mpirun --hostfile <machines> -np <nProcs>
<foamExec> <otherArgs> -parallel > log
Examples on Mike:
mpirun --hostfile $PBS_NODEFILE -np 16 icoFoam -parallel > log
Examples on Eric:
mpirun --hostfile $PBS_NODEFILE -np 8 icoFoam -parallel > log
2/24/2016 44
Stress analysis of plateHole
Analytical Solution: R 2 3R 4
1 2 4 for y R
xx x 0 2y 2y
0 for y R
2/24/2016 Introduction to OpenFOAM 45
Part of the solidDisplacementFoam code
do // loop for residual and iterations
{
if (thermalStress)
{
volScalarField& T = Tptr();
solve
(
fvm::ddt(T) == fvm::laplacian(DT, T)
);
}
{
fvVectorMatrix DEqn // not a N-S equation
(
fvm::d2dt2(D)
==
fvm::laplacian(2*mu + lambda, D, "laplacian(DD,D)")
+ divSigmaExp
);
...
} while (initialResidual > convergenceTolerance && ++iCorr < nCorr);
2/24/2016 53
Before trying to develop your own solver...
Understand the background, e.g. go through commented icoFoam
PISO solver, see http://openfoamwiki.net/index.php/IcoFoam
write() makes sure that all the variables that were defined as an
Ioobject with IOobject::AUTO_WRITE are written to the time directory
according to the settings in the $FOAM_CASE/system/controlDict file.
elapsedCPUTime() is the elapsed CPU time.
elapsedClockTime() is the elapsed wall clock time.
T
UT T 0
t
This is how we implement and solve it in TEqn.H after the PISO
correction loop:
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
);
Now compile the application with wmake in the
icoScalarTransportFoam directory.
User forum:
http://www.cfd-online.com/Forums/openfoam/