Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Allwmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cd ${0%/*} || exit 1 # Run from this directory

wmake src/thermophysicalModels/thermophysicalProperties
wmake src/thermophysicalModels/basic
wmake src/functionObjects/field
wmake src/CanteraMixture
wmake src/thermophysicalModels/SLGThermo
wmake src/dfChemistryModel
wmake src/TurbulenceModels/compressible
wmake src/TurbulenceModels/turbulenceModels
wmake src/regionModels/surfaceFilmModels
src/lagrangian/Allwmake $targetType $*

Expand Down
3 changes: 1 addition & 2 deletions examples/dfHighSpeedFoam/det_1D_H2_01mm/system/controlDict
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ FoamFile
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
libs ("libfieldFunctionObjects.so");

application dfHighSpeedFoam;

Expand Down Expand Up @@ -57,7 +56,7 @@ functions
minMax
{
type fieldMinMax;
libs ("libfieldFunctionObjects.so");
libs ("libdfFieldFunctionObjects.so");
writeControl timeStep; //writeTime;
fields (p);
}
Expand Down
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ else
mkdir -p src_orig/thermophysicalModels
mkdir -p src_orig/lagrangian
mkdir -p src_orig/regionModels
mkdir -p src_orig/functionObjects
cp -r $FOAM_SRC/TurbulenceModels/compressible src_orig/TurbulenceModels
cp -r $FOAM_SRC/thermophysicalModels/basic src_orig/thermophysicalModels
cp -r $FOAM_SRC/thermophysicalModels/thermophysicalProperties src_orig/thermophysicalModels
cp -r $FOAM_SRC/lagrangian/intermediate src_orig/lagrangian
cp -r $FOAM_SRC/lagrangian/turbulence src_orig/lagrangian
cp -r $FOAM_SRC/regionModels/surfaceFilmModels src_orig/regionModels
cp -r $FOAM_SRC/functionObjects/field src_orig/functionObjects
fi


Expand Down
3 changes: 3 additions & 0 deletions src/TurbulenceModels/turbulenceModels/Make/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
makeTurbulentFluidThermoModels.C

LIB = $(FOAM_USER_LIBBIN)/libdfTurbulenceModels
16 changes: 16 additions & 0 deletions src/TurbulenceModels/turbulenceModels/Make/options
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

LIB_LIBS = \
-lcompressibleTransportModels \
-lturbulenceModels \
-lfiniteVolume \
-lmeshTools \
-L$(FOAM_USER_LIBBIN) \
-ldfCompressibleTurbulenceModels \
-ldfFluidThermophysicalModels
19 changes: 19 additions & 0 deletions src/TurbulenceModels/turbulenceModels/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# TurbulenceModels

## Using

- Add the following line into your 'controlDict':

`libs ( "libdfTurbulenceModels.so" )`

- In 'constant/turbulenceProperties', e.g. for Sigma model, set:

```c++
simulationType LES;

LES
{
LESModel Sigma;
filter simple;
}
```
186 changes: 186 additions & 0 deletions src/TurbulenceModels/turbulenceModels/Sigma/Sigma.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "Sigma.H"
#include "fvOptions.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace LESModels
{

// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

template<class BasicTurbulenceModel>
void Sigma<BasicTurbulenceModel>::correctNut()
{
tmp<volTensorField> tgradU(fvc::grad(this->U_));
tensorField& gradU = tgradU.ref().primitiveFieldRef();
volScalarField Dsg(mag(fvc::grad(this->U_)));
scalarField& DsgCells = Dsg.primitiveFieldRef();
const cellList& cells = this->mesh().cells();
Switch zeroSigma = false;

forAll(cells,celli)
{
RectangularMatrix<scalar> gradUMatrix(3,3);
for (label ii = 0; ii<3; ii++)
{
for (label jj = 0; jj<3; jj++)
{
gradUMatrix[ii][jj] = gradU[celli].component(ii*3+jj);
}
}

DiagonalMatrix<scalar> sigmas(SVD(gradUMatrix).S());
scalar sigma_1(max(sigmas));
scalar sigma_2(sigma_1);
scalar sigma_3(min(sigmas));

for (label ii = 0; ii<3; ii++)
{
if(sigmas[ii]>=sigma_3 && sigmas[ii]<=sigma_1) sigma_2 = sigmas[ii];

if(sigmas[ii]<0)
{
WarningInFunction
<< "Negative sigular values!!! sigmas = \n"
<< sigmas <<endl;
}
}

if(abs(sigma_1)<ROOTVSMALL && !zeroSigma) zeroSigma = true;

DsgCells[celli] = sigma_3*(sigma_1-sigma_2)*(sigma_2-sigma_3)
/(sqr(sigma_1)+VSMALL);
}

if(zeroSigma) WarningInFunction << "Zero sigma_1 value!!!" << endl;

this->nut_ = sqr(Csg_*this->delta())*Dsg;
this->nut_.correctBoundaryConditions();
fv::options::New(this->mesh_).correct(this->nut_);

BasicTurbulenceModel::correctNut();
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

template<class BasicTurbulenceModel>
Sigma<BasicTurbulenceModel>::Sigma
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName,
const word& type
)
:
LESeddyViscosity<BasicTurbulenceModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
),
Csg_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Csg",
this->coeffDict_,
1.5
)
),
k_
(
IOobject
(
IOobject::groupName("k", this->U_.group()),
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar ("k", dimensionSet(0,2,-2,0,0,0,0),SMALL)
),
simpleFilter_(U.mesh()),
filterPtr_(LESfilter::New(U.mesh(), this->coeffDict())),
filter_(filterPtr_())
{
if (type == typeName)
{
this->printCoeffs(type);
}
}

// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

template<class BasicTurbulenceModel>
bool Sigma<BasicTurbulenceModel>::read()
{
if (LESeddyViscosity<BasicTurbulenceModel>::read())
{
Csg_.read(this->coeffDict());

return true;
}
else
{
return false;
}
}


template<class BasicTurbulenceModel>
void Sigma<BasicTurbulenceModel>::correct()
{
if (!this->turbulence_)
{
return;
}

LESeddyViscosity<BasicTurbulenceModel>::correct();
correctNut();
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace LESModels
} // End namespace Foam

// ************************************************************************* //
Loading