Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x

This commit is contained in:
andy 2014-04-22 12:40:32 +01:00
commit f8d5b1e870
22 changed files with 1212 additions and 58 deletions

View file

@ -22,6 +22,7 @@ EXE_LIBS = \
-lmeshTools \
-llagrangian \
-llagrangianIntermediate \
-llagrangianTurbulentSubModels \
-lthermophysicalFunctions \
-lspecie \
-lradiationModels \

View file

@ -21,6 +21,7 @@ EXE_LIBS = \
-lmeshTools \
-llagrangian \
-llagrangianIntermediate \
-llagrangianTurbulentSubModels \
-lthermophysicalFunctions \
-lspecie \
-lradiationModels \

View file

@ -394,6 +394,8 @@ int main(int argc, char *argv[])
Info<< endl;
}
Info<< "End\n" << endl;
return 0;
}

View file

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -126,8 +126,8 @@ if [ "$WM_PROJECT" ]
then
for i in \
$HOME/.WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.WM_PROJECT \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
;
do

View file

@ -191,26 +191,40 @@ void Foam::porosityModels::DarcyForchheimer::correct
fvVectorMatrix& UEqn
) const
{
const vectorField& U = UEqn.psi();
const volVectorField& U = UEqn.psi();
const scalarField& V = mesh_.V();
scalarField& Udiag = UEqn.diag();
vectorField& Usource = UEqn.source();
word rhoName(IOobject::groupName(rhoName_, U.group()));
word muName(IOobject::groupName(muName_, U.group()));
word nuName(IOobject::groupName(nuName_, U.group()));
if (UEqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
const volScalarField& mu =
mesh_.lookupObject<volScalarField>(muName_);
const volScalarField& rho = mesh_.lookupObject<volScalarField>(rhoName);
const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName);
apply(Udiag, Usource, V, rho, mu, U);
}
else
{
const volScalarField& nu =
mesh_.lookupObject<volScalarField>(nuName_);
if (mesh_.foundObject<volScalarField>(nuName))
{
const volScalarField& nu =
mesh_.lookupObject<volScalarField>(nuName);
apply(Udiag, Usource, V, geometricOneField(), nu, U);
apply(Udiag, Usource, V, geometricOneField(), nu, U);
}
else
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName);
const volScalarField& mu =
mesh_.lookupObject<volScalarField>(muName);
apply(Udiag, Usource, V, geometricOneField(), mu/rho, U);
}
}
}
@ -237,23 +251,37 @@ void Foam::porosityModels::DarcyForchheimer::correct
volTensorField& AU
) const
{
const vectorField& U = UEqn.psi();
const volVectorField& U = UEqn.psi();
word rhoName(IOobject::groupName(rhoName_, U.group()));
word muName(IOobject::groupName(muName_, U.group()));
word nuName(IOobject::groupName(nuName_, U.group()));
if (UEqn.dimensions() == dimForce)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
const volScalarField& mu =
mesh_.lookupObject<volScalarField>(muName_);
const volScalarField& rho = mesh_.lookupObject<volScalarField>(rhoName);
const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName);
apply(AU, rho, mu, U);
}
else
{
const volScalarField& nu =
mesh_.lookupObject<volScalarField>(nuName_);
if (mesh_.foundObject<volScalarField>(nuName))
{
const volScalarField& nu =
mesh_.lookupObject<volScalarField>(nuName);
apply(AU, geometricOneField(), nu, U);
apply(AU, geometricOneField(), nu, U);
}
else
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName);
const volScalarField& mu =
mesh_.lookupObject<volScalarField>(muName);
apply(AU, geometricOneField(), mu/rho, U);
}
}
}

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -170,7 +170,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
correct();
const volScalarField& h = eqn.psi();
const volScalarField& he = eqn.psi();
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
@ -214,19 +214,21 @@ void Foam::fv::interRegionHeatTransferModel::addSup
if (semiImplicit_)
{
if (h.dimensions() == dimEnergy/dimMass)
if (he.dimensions() == dimEnergy/dimMass)
{
if (mesh_.foundObject<fluidThermo>("thermophysicalProperties"))
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
eqn += htc_*Tmapped - fvm::SuSp(htc_/thermo.Cp(), h);
volScalarField htcByCpv(htc_/thermo.Cpv());
eqn += htc_*(Tmapped - T) + htcByCpv*he - fvm::Sp(htcByCpv, he);
if (debug)
{
const dimensionedScalar energy =
fvc::domainIntegrate(htc_*(h/thermo.Cp() - Tmapped));
fvc::domainIntegrate(htc_*(he/thermo.Cp() - Tmapped));
Info<< "Energy exchange from region " << nbrMesh.name()
<< " To " << mesh_.name() << " : " << energy.value()
@ -251,9 +253,9 @@ void Foam::fv::interRegionHeatTransferModel::addSup
<< exit(FatalError);
}
}
else if (h.dimensions() == dimTemperature)
else if (he.dimensions() == dimTemperature)
{
eqn += htc_*Tmapped - fvm::SuSp(htc_, h);
eqn += htc_*Tmapped - fvm::Sp(htc_, he);
}
}
else

View file

@ -8,6 +8,7 @@ wmake $makeType basic
wmake $makeType solidParticle
wmake $makeType intermediate
wmake $makeType turbulence
wmake $makeType Turbulence
wmake $makeType spray
wmake $makeType dsmc
wmake $makeType coalCombustion

View file

@ -0,0 +1,10 @@
PARCELS=parcels
DERIVEDPARCELS=$(PARCELS)/derived
KINEMATICCOLLIDINGPARCEL=$(DERIVEDPARCELS)/basicKinematicCollidingParcel
$(KINEMATICCOLLIDINGPARCEL)/makeBasicKinematicCollidingParcelSubmodels.C
KINEMATICMPPICPARCEL=$(DERIVEDPARCELS)/basicKinematicMPPICParcel
$(KINEMATICMPPICPARCEL)/makeBasicKinematicMPPICParcelSubmodels.C
LIB = $(FOAM_LIBBIN)/liblagrangianTurbulentSubModels

View file

@ -0,0 +1,45 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-llagrangian \
-llagrangianIntermediate \
-ldistributionModels \
-lspecie \
-lfluidThermophysicalModels \
-lliquidProperties \
-lliquidMixtureProperties \
-lsolidProperties \
-lsolidMixtureProperties \
-lreactionThermophysicalModels \
-lSLGThermo \
-lradiationModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lregionModels \
-lsurfaceFilmModels \
-ldynamicFvMesh \
-lsampling

View file

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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 "basicKinematicCollidingCloud.H"
#include "makeParcelTurbulenceDispersionModels.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeParcelTurbulenceDispersionModels(basicKinematicCollidingCloud);
}
// ************************************************************************* //

View file

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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 "basicKinematicMPPICCloud.H"
#include "makeParcelTurbulenceDispersionModels.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeParcelTurbulenceDispersionModels(basicKinematicMPPICCloud);
}
// ************************************************************************* //

View file

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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/>.
\*---------------------------------------------------------------------------*/
#ifndef makeParcelTurbulenceDispersionModels_h
#define makeParcelTurbulenceDispersionModels_h
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "GradientDispersionRAS.H"
#include "StochasticDispersionRAS.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeParcelTurbulenceDispersionModels(CloudType) \
\
typedef CloudType::kinematicCloudType kinematicCloudType; \
defineNamedTemplateTypeNameAndDebug \
( \
DispersionRASModel<kinematicCloudType>, \
0 \
); \
\
makeDispersionModelType(GradientDispersionRAS, CloudType); \
makeDispersionModelType(StochasticDispersionRAS, CloudType); \
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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 "DispersionRASModel.H"
#include "demandDrivenData.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::tmp<Foam::volScalarField>
Foam::DispersionRASModel<CloudType>::kModel() const
{
const objectRegistry& obr = this->owner().mesh();
const word turbName =
IOobject::groupName
(
turbulenceModel::propertiesName,
this->owner().U().group()
);
if (obr.foundObject<turbulenceModel>(turbName))
{
const turbulenceModel& model =
obr.lookupObject<turbulenceModel>(turbName);
return model.k();
}
else
{
FatalErrorIn
(
"Foam::tmp<Foam::volScalarField>"
"Foam::DispersionRASModel<CloudType>::kModel() const"
)
<< "Turbulence model not found in mesh database" << nl
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>(NULL);
}
}
template<class CloudType>
Foam::tmp<Foam::volScalarField>
Foam::DispersionRASModel<CloudType>::epsilonModel() const
{
const objectRegistry& obr = this->owner().mesh();
const word turbName =
IOobject::groupName
(
turbulenceModel::propertiesName,
this->owner().U().group()
);
if (obr.foundObject<turbulenceModel>(turbName))
{
const turbulenceModel& model =
obr.lookupObject<turbulenceModel>(turbName);
return model.epsilon();
}
else
{
FatalErrorIn
(
"Foam::tmp<Foam::volScalarField>"
"Foam::DispersionRASModel<CloudType>::epsilonModel() const"
)
<< "Turbulence model not found in mesh database" << nl
<< "Database objects include: " << obr.sortedToc()
<< abort(FatalError);
return tmp<volScalarField>(NULL);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::DispersionRASModel<CloudType>::DispersionRASModel
(
const dictionary&,
CloudType& owner
)
:
DispersionModel<CloudType>(owner),
kPtr_(NULL),
ownK_(false),
epsilonPtr_(NULL),
ownEpsilon_(false)
{}
template<class CloudType>
Foam::DispersionRASModel<CloudType>::DispersionRASModel
(
DispersionRASModel<CloudType>& dm
)
:
DispersionModel<CloudType>(dm),
kPtr_(dm.kPtr_),
ownK_(dm.ownK_),
epsilonPtr_(dm.epsilonPtr_),
ownEpsilon_(dm.ownEpsilon_)
{
dm.ownK_ = false;
dm.ownEpsilon_ = false;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::DispersionRASModel<CloudType>::~DispersionRASModel()
{
cacheFields(false);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::DispersionRASModel<CloudType>::cacheFields(const bool store)
{
if (store)
{
tmp<volScalarField> tk = this->kModel();
if (tk.isTmp())
{
kPtr_ = tk.ptr();
ownK_ = true;
}
else
{
kPtr_ = tk.operator->();
ownK_ = false;
}
tmp<volScalarField> tepsilon = this->epsilonModel();
if (tepsilon.isTmp())
{
epsilonPtr_ = tepsilon.ptr();
ownEpsilon_ = true;
}
else
{
epsilonPtr_ = tepsilon.operator->();
ownEpsilon_ = false;
}
}
else
{
if (ownK_ && kPtr_)
{
deleteDemandDrivenData(kPtr_);
ownK_ = false;
}
if (ownEpsilon_ && epsilonPtr_)
{
deleteDemandDrivenData(epsilonPtr_);
ownEpsilon_ = false;
}
}
}
template<class CloudType>
void Foam::DispersionRASModel<CloudType>::write(Ostream& os) const
{
DispersionModel<CloudType>::write(os);
os.writeKeyword("ownK") << ownK_ << token::END_STATEMENT << endl;
os.writeKeyword("ownEpsilon") << ownEpsilon_ << token::END_STATEMENT
<< endl;
}
// ************************************************************************* //

View file

@ -0,0 +1,135 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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/>.
Class
Foam::DispersionRASModel
Description
Base class for particle dispersion models based on RAS turbulence.
\*---------------------------------------------------------------------------*/
#ifndef DispersionRASModel_H
#define DispersionRASModel_H
#include "DispersionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class DispersionRASModel Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class DispersionRASModel
:
public DispersionModel<CloudType>
{
protected:
// Protected data
// Locally cached turbulence fields
//- Turbulence k
const volScalarField* kPtr_;
//- Take ownership of the k field
bool ownK_;
//- Turbulence epsilon
const volScalarField* epsilonPtr_;
//- Take ownership of the epsilon field
bool ownEpsilon_;
// Protected Functions
//- Return the k field from the turbulence model
tmp<volScalarField> kModel() const;
//- Return the epsilon field from the turbulence model
tmp<volScalarField> epsilonModel() const;
public:
//- Runtime type information
TypeName("dispersionRASModel");
// Constructors
//- Construct from components
DispersionRASModel(const dictionary& dict, CloudType& owner);
//- Construct copy
DispersionRASModel(DispersionRASModel<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new DispersionRASModel<CloudType>(*this)
);
}
//- Destructor
virtual ~DispersionRASModel();
// Member Functions
//- Cache carrier fields
virtual void cacheFields(const bool store);
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "DispersionRASModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,169 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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 "GradientDispersionRAS.H"
#include "demandDrivenData.H"
#include "fvcGrad.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::GradientDispersionRAS<CloudType>::GradientDispersionRAS
(
const dictionary& dict,
CloudType& owner
)
:
DispersionRASModel<CloudType>(dict, owner),
gradkPtr_(NULL),
ownGradK_(false)
{}
template<class CloudType>
Foam::GradientDispersionRAS<CloudType>::GradientDispersionRAS
(
GradientDispersionRAS<CloudType>& dm
)
:
DispersionRASModel<CloudType>(dm),
gradkPtr_(dm.gradkPtr_),
ownGradK_(dm.ownGradK_)
{
dm.ownGradK_ = false;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::GradientDispersionRAS<CloudType>::~GradientDispersionRAS()
{
cacheFields(false);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::GradientDispersionRAS<CloudType>::cacheFields(const bool store)
{
DispersionRASModel<CloudType>::cacheFields(store);
if (store)
{
gradkPtr_ = fvc::grad(*this->kPtr_).ptr();
ownGradK_ = true;
}
else
{
if (ownGradK_)
{
deleteDemandDrivenData(gradkPtr_);
gradkPtr_ = NULL;
ownGradK_ = false;
}
}
}
template<class CloudType>
Foam::vector Foam::GradientDispersionRAS<CloudType>::update
(
const scalar dt,
const label cellI,
const vector& U,
const vector& Uc,
vector& UTurb,
scalar& tTurb
)
{
cachedRandom& rnd = this->owner().rndGen();
const scalar cps = 0.16432;
const scalar k = this->kPtr_->internalField()[cellI];
const scalar epsilon =
this->epsilonPtr_->internalField()[cellI] + ROOTVSMALL;
const vector& gradk = this->gradkPtr_->internalField()[cellI];
const scalar UrelMag = mag(U - Uc - UTurb);
const scalar tTurbLoc =
min(k/epsilon, cps*pow(k, 1.5)/epsilon/(UrelMag + SMALL));
// Parcel is perturbed by the turbulence
if (dt < tTurbLoc)
{
tTurb += dt;
if (tTurb > tTurbLoc)
{
tTurb = 0.0;
scalar sigma = sqrt(2.0*k/3.0);
vector dir = -gradk/(mag(gradk) + SMALL);
// Numerical Recipes... Ch. 7. Random Numbers...
scalar x1 = 0.0;
scalar x2 = 0.0;
scalar rsq = 10.0;
while ((rsq > 1.0) || (rsq == 0.0))
{
x1 = 2.0*rnd.sample01<scalar>() - 1.0;
x2 = 2.0*rnd.sample01<scalar>() - 1.0;
rsq = x1*x1 + x2*x2;
}
scalar fac = sqrt(-2.0*log(rsq)/rsq);
// In 2D calculations the -grad(k) is always
// away from the axis of symmetry
// This creates a 'hole' in the spray and to
// prevent this we let x1 be both negative/positive
if (this->owner().mesh().nSolutionD() == 2)
{
fac *= x1;
}
else
{
fac *= mag(x1);
}
UTurb = sigma*fac*dir;
}
}
else
{
tTurb = GREAT;
UTurb = vector::zero;
}
return Uc + UTurb;
}
// ************************************************************************* //

View file

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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/>.
Class
Foam::GradientDispersionRAS
Description
The velocity is perturbed in the direction of -grad(k), with a
Gaussian random number distribution with variance sigma.
where sigma is defined below
\*---------------------------------------------------------------------------*/
#ifndef GradientDispersionRAS_H
#define GradientDispersionRAS_H
#include "DispersionRASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class GradientDispersionRAS Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class GradientDispersionRAS
:
public DispersionRASModel<CloudType>
{
protected:
// Protected data
// Locally cached turbulence fields
//- Gradient of k
const volVectorField* gradkPtr_;
//- Take ownership of the grad(k)
bool ownGradK_;
public:
//- Runtime type information
TypeName("gradientDispersionRAS");
// Constructors
//- Construct from components
GradientDispersionRAS(const dictionary& dict, CloudType& owner);
//- Construct copy
GradientDispersionRAS(GradientDispersionRAS<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new GradientDispersionRAS<CloudType>(*this)
);
}
//- Destructor
virtual ~GradientDispersionRAS();
// Member Functions
//- Cache carrier fields
virtual void cacheFields(const bool store);
//- Update (disperse particles)
virtual vector update
(
const scalar dt,
const label cellI,
const vector& U,
const vector& Uc,
vector& UTurb,
scalar& tTurb
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "GradientDispersionRAS.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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 "StochasticDispersionRAS.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::StochasticDispersionRAS<CloudType>::StochasticDispersionRAS
(
const dictionary& dict,
CloudType& owner
)
:
DispersionRASModel<CloudType>(dict, owner)
{}
template<class CloudType>
Foam::StochasticDispersionRAS<CloudType>::StochasticDispersionRAS
(
StochasticDispersionRAS<CloudType>& dm
)
:
DispersionRASModel<CloudType>(dm)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::StochasticDispersionRAS<CloudType>::~StochasticDispersionRAS()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::vector Foam::StochasticDispersionRAS<CloudType>::update
(
const scalar dt,
const label cellI,
const vector& U,
const vector& Uc,
vector& UTurb,
scalar& tTurb
)
{
cachedRandom& rnd = this->owner().rndGen();
const scalar cps = 0.16432;
const scalar k = this->kPtr_->internalField()[cellI];
const scalar epsilon =
this->epsilonPtr_->internalField()[cellI] + ROOTVSMALL;
const scalar UrelMag = mag(U - Uc - UTurb);
const scalar tTurbLoc =
min(k/epsilon, cps*pow(k, 1.5)/epsilon/(UrelMag + SMALL));
// Parcel is perturbed by the turbulence
if (dt < tTurbLoc)
{
tTurb += dt;
if (tTurb > tTurbLoc)
{
tTurb = 0.0;
scalar sigma = sqrt(2.0*k/3.0);
vector dir = 2.0*rnd.sample01<vector>() - vector::one;
dir /= mag(dir) + SMALL;
// Numerical Recipes... Ch. 7. Random Numbers...
scalar x1 = 0.0;
scalar x2 = 0.0;
scalar rsq = 10.0;
while ((rsq > 1.0) || (rsq == 0.0))
{
x1 = 2.0*rnd.sample01<scalar>() - 1.0;
x2 = 2.0*rnd.sample01<scalar>() - 1.0;
rsq = x1*x1 + x2*x2;
}
scalar fac = sqrt(-2.0*log(rsq)/rsq);
fac *= mag(x1);
UTurb = sigma*fac*dir;
}
}
else
{
tTurb = GREAT;
UTurb = vector::zero;
}
return Uc + UTurb;
}
// ************************************************************************* //

View file

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 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/>.
Class
Foam::StochasticDispersionRAS
Description
The velocity is perturbed in random direction, with a
Gaussian random number distribution with variance sigma.
where sigma is defined below
\*---------------------------------------------------------------------------*/
#ifndef StochasticDispersionRAS_H
#define StochasticDispersionRAS_H
#include "DispersionRASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class StochasticDispersionRAS Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class StochasticDispersionRAS
:
public DispersionRASModel<CloudType>
{
public:
//- Runtime type information
TypeName("stochasticDispersionRAS");
// Constructors
//- Construct from components
StochasticDispersionRAS(const dictionary& dict, CloudType& owner);
//- Construct copy
StochasticDispersionRAS(StochasticDispersionRAS<CloudType>& dm);
//- Construct and return a clone
virtual autoPtr<DispersionModel<CloudType> > clone()
{
return autoPtr<DispersionModel<CloudType> >
(
new StochasticDispersionRAS<CloudType>(*this)
);
}
//- Destructor
virtual ~StochasticDispersionRAS();
// Member Functions
//- Update (disperse particles)
virtual vector update
(
const scalar dt,
const label cellI,
const vector& U,
const vector& Uc,
vector& UTurb,
scalar& tTurb
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "StochasticDispersionRAS.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -135,7 +135,7 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
pp.localPoints(),
nonManifoldPoint
);
Info<< "Found " << nNonManifoldPoints << " non-mainfold point(s)."
Info<< "Found " << nNonManifoldPoints << " non-manifold point(s)."
<< endl;

View file

@ -39,6 +39,7 @@ License
//#include "globalIndex.H"
#include "OBJstream.H"
#include "cellSet.H"
#include "treeDataCell.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -353,7 +354,14 @@ void Foam::meshRefinement::markFeatureCellLevel
label tetFaceI = -1;
label tetPtI = -1;
mesh_.findCellFacePt(keepPoint, cellI, tetFaceI, tetPtI);
// Force construction of search tree even if processor holds no
// cells
(void)mesh_.cellTree();
if (mesh_.nCells())
{
mesh_.findCellFacePt(keepPoint, cellI, tetFaceI, tetPtI);
}
if (cellI != -1)
{
@ -402,7 +410,8 @@ void Foam::meshRefinement::markFeatureCellLevel
featureMesh.points()[pointI], // endpos
featureLevel, // level
featI, // featureMesh
pointI // end point
pointI, // end point
-1 // feature edge
)
);
@ -446,7 +455,8 @@ void Foam::meshRefinement::markFeatureCellLevel
featureMesh.points()[pointI], // endpos
featureLevel, // level
featI, // featureMesh
pointI // end point
pointI, // end point
-1 // feature edge
)
);
}
@ -459,8 +469,22 @@ void Foam::meshRefinement::markFeatureCellLevel
// Largest refinement level of any feature passed through
maxFeatureLevel = labelList(mesh_.nCells(), -1);
// Whether edge has been visited.
List<PackedBoolList> featureEdgeVisited(features_.size());
forAll(features_, featI)
{
featureEdgeVisited[featI].setSize(features_[featI].edges().size());
featureEdgeVisited[featI] = 0u;
}
// Database to pass into trackedParticle::move
trackedParticle::trackingData td(startPointCloud, maxFeatureLevel);
trackedParticle::trackingData td
(
startPointCloud,
maxFeatureLevel,
featureEdgeVisited
);
// Track all particles to their end position (= starting feature point)
@ -477,15 +501,10 @@ void Foam::meshRefinement::markFeatureCellLevel
startPointCloud.move(td, maxTrackLen);
// Reset level
// Reset levels
maxFeatureLevel = -1;
// Whether edge has been visited.
List<PackedBoolList> featureEdgeVisited(features_.size());
forAll(features_, featI)
{
featureEdgeVisited[featI].setSize(features_[featI].edges().size());
featureEdgeVisited[featI] = 0u;
}
@ -528,6 +547,7 @@ void Foam::meshRefinement::markFeatureCellLevel
trackedParticle* tp(new trackedParticle(startTp));
tp->end() = featureMesh.points()[otherPointI];
tp->j() = otherPointI;
tp->k() = edgeI;
if (debug&meshRefinement::FEATURESEEDS)
{
@ -587,6 +607,7 @@ void Foam::meshRefinement::markFeatureCellLevel
tp.end() = featureMesh.points()[otherPointI];
tp.j() = otherPointI;
tp.k() = edgeI;
keepParticle = true;
break;
}

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ License
#include "trackedParticle.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::trackedParticle::trackedParticle
@ -37,14 +38,16 @@ Foam::trackedParticle::trackedParticle
const point& end,
const label level,
const label i,
const label j
const label j,
const label k
)
:
particle(mesh, position, cellI, tetFaceI, tetPtI),
end_(end),
level_(level),
i_(i),
j_(j)
j_(j),
k_(k)
{}
@ -65,13 +68,15 @@ Foam::trackedParticle::trackedParticle
level_ = readLabel(is);
i_ = readLabel(is);
j_ = readLabel(is);
k_ = readLabel(is);
}
else
{
is.read
(
reinterpret_cast<char*>(&end_),
sizeof(end_) + sizeof(level_) + sizeof(i_) + sizeof(j_)
sizeof(end_) + sizeof(level_)
+ sizeof(i_) + sizeof(j_) + sizeof(k_)
);
}
}
@ -113,7 +118,7 @@ bool Foam::trackedParticle::move
scalar dt = min(dtMax, tEnd);
// mark visited cell with max level.
td.maxLevel()[cell()] = max(td.maxLevel()[cell()], level_);
td.maxLevel_[cell()] = max(td.maxLevel_[cell()], level_);
dt *= trackToFace(end_, td);
@ -217,6 +222,26 @@ void Foam::trackedParticle::hitPatch
}
void Foam::trackedParticle::correctAfterParallelTransfer
(
const label patchI,
trackingData& td
)
{
particle::correctAfterParallelTransfer(patchI, td);
label edgeI = k();
if (edgeI != -1)
{
label featI = i();
// Mark edge we're currently on (was set on sending processor but not
// receiving sender)
td.featureEdgeVisited_[featI].set(edgeI, 1u);
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
@ -227,7 +252,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
<< token::SPACE << p.end_
<< token::SPACE << p.level_
<< token::SPACE << p.i_
<< token::SPACE << p.j_;
<< token::SPACE << p.j_
<< token::SPACE << p.k_;
}
else
{
@ -235,7 +261,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
os.write
(
reinterpret_cast<const char*>(&p.end_),
sizeof(p.end_) + sizeof(p.level_) + sizeof(p.i_) + sizeof(p.j_)
sizeof(p.end_) + sizeof(p.level_)
+ sizeof(p.i_) + sizeof(p.j_) + sizeof(p.k_)
);
}

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -62,12 +62,15 @@ class trackedParticle
//- level of this particle
label level_;
//- passive label
//- passive label (used to store feature edge mesh)
label i_;
//- passive label
//- passive label (used to store feature edge point)
label j_;
//- passive label (used to store feature edge label)
label k_;
public:
@ -78,26 +81,27 @@ public:
:
public particle::TrackingData<Cloud<trackedParticle> >
{
public:
labelList& maxLevel_;
public:
List<PackedBoolList>& featureEdgeVisited_;
// Constructors
trackingData(Cloud<trackedParticle>& cloud, labelList& maxLevel)
trackingData
(
Cloud<trackedParticle>& cloud,
labelList& maxLevel,
List<PackedBoolList>& featureEdgeVisited
)
:
particle::TrackingData<Cloud<trackedParticle> >(cloud),
maxLevel_(maxLevel)
maxLevel_(maxLevel),
featureEdgeVisited_(featureEdgeVisited)
{}
// Member functions
labelList& maxLevel()
{
return maxLevel_;
}
};
@ -115,7 +119,8 @@ public:
const point& end,
const label level,
const label i,
const label j
const label j,
const label k
);
//- Construct from Istream
@ -187,6 +192,18 @@ public:
return j_;
}
//- transported label
label k() const
{
return k_;
}
//- transported label
label& k()
{
return k_;
}
// Tracking
@ -259,6 +276,10 @@ public:
trackingData& td
);
//- Convert processor patch addressing to the global equivalents
// and set the cellI to the face-neighbour
void correctAfterParallelTransfer(const label, trackingData&);
// Ostream Operator