Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-11-30 14:45:30 +00:00
194 changed files with 4578 additions and 945 deletions

View File

@ -243,6 +243,7 @@ $(schemes)/harmonic/harmonic.C
$(schemes)/fixedBlended/fixedBlended.C
$(schemes)/localBlended/localBlended.C
$(schemes)/limiterBlended/limiterBlended.C
$(schemes)/CoBlended/CoBlended.C
$(schemes)/localMax/localMax.C
$(schemes)/localMin/localMin.C

View File

@ -79,7 +79,7 @@ timeVaryingMappedFixedValueFvPatchField
endSampleTime_(-1),
endSampledValues_(0),
endAverage_(pTraits<Type>::zero),
offset_()
offset_(ptf.offset_().clone().ptr())
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,7 +31,7 @@ Description
does not exceed the specified value.
This scheme should only be used for steady-state computations
using transient codes where local time-stepping is preferably to
using transient codes where local time-stepping is preferable to
under-relaxation for transport consistency reasons.
SourceFiles

View File

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

View File

@ -0,0 +1,275 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::CoBlended
Description
Two-scheme Courant number based blending differencing scheme.
Similar to localBlended but uses a blending factor computed from the
face-based Courant number and the alpha factor supplied:
weight = 1 - Co/alpha
The weight applies to the first scheme and 1-factor to the second scheme.
SourceFiles
CoBlended.C
\*---------------------------------------------------------------------------*/
#ifndef CoBlended_H
#define CoBlended_H
#include "surfaceInterpolationScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class CoBlended Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class CoBlended
:
public surfaceInterpolationScheme<Type>
{
// Private data
const scalar alpha_;
// Private Member Functions
//- Scheme 1
tmp<surfaceInterpolationScheme<Type> > tScheme1_;
//- Scheme 2
tmp<surfaceInterpolationScheme<Type> > tScheme2_;
//- The face-flux used to compute the face Courant number
const surfaceScalarField& faceFlux_;
//- Disallow default bitwise copy construct
CoBlended(const CoBlended&);
//- Disallow default bitwise assignment
void operator=(const CoBlended&);
public:
//- Runtime type information
TypeName("CoBlended");
// Constructors
//- Construct from mesh and Istream.
// The name of the flux field is read from the Istream and looked-up
// from the mesh objectRegistry
CoBlended
(
const fvMesh& mesh,
Istream& is
)
:
surfaceInterpolationScheme<Type>(mesh),
alpha_(readScalar(is)),
tScheme1_
(
surfaceInterpolationScheme<Type>::New(mesh, is)
),
tScheme2_
(
surfaceInterpolationScheme<Type>::New(mesh, is)
),
faceFlux_
(
mesh.lookupObject<surfaceScalarField>
(
word(is)
)
)
{
if (alpha_ <= 0 )
{
FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is)
<< "coefficient = " << alpha_
<< " should be > 0"
<< exit(FatalIOError);
}
}
//- Construct from mesh, faceFlux and Istream
CoBlended
(
const fvMesh& mesh,
const surfaceScalarField& faceFlux,
Istream& is
)
:
surfaceInterpolationScheme<Type>(mesh),
alpha_(readScalar(is)),
tScheme1_
(
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
),
tScheme2_
(
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
),
faceFlux_(faceFlux)
{
if (alpha_ <= 0)
{
FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is)
<< "coefficient = " << alpha_
<< " should be > 0"
<< exit(FatalIOError);
}
}
// Member Functions
//- Return the face-based Courant number blending factor
tmp<surfaceScalarField> blendingFactor() const
{
const fvMesh& mesh = faceFlux_.mesh();
return
(
max
(
scalar(1)
- mesh.time().deltaT()*mesh.deltaCoeffs()*mag(faceFlux_)
/(mesh.magSf()*alpha_),
scalar(0)
)
);
}
//- Return the interpolation weighting factors
tmp<surfaceScalarField>
weights
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
surfaceScalarField bf(blendingFactor());
return
bf*tScheme1_().weights(vf)
+ (scalar(1.0) - bf)*tScheme2_().weights(vf);
}
//- Return the face-interpolate of the given cell field
// with explicit correction
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
surfaceScalarField bf(blendingFactor());
return
bf*tScheme1_().interpolate(vf)
+ (scalar(1.0) - bf)*tScheme2_().interpolate(vf);
}
//- Return true if this scheme uses an explicit correction
virtual bool corrected() const
{
return tScheme1_().corrected() || tScheme2_().corrected();
}
//- Return the explicit correction to the face-interpolate
// for the given field
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correction
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
surfaceScalarField bf(blendingFactor());
if (tScheme1_().corrected())
{
if (tScheme2_().corrected())
{
return
(
bf
* tScheme1_().correction(vf)
+ (scalar(1.0) - bf)
* tScheme2_().correction(vf)
);
}
else
{
return
(
bf
* tScheme1_().correction(vf)
);
}
}
else if (tScheme2_().corrected())
{
return
(
(scalar(1.0) - bf)
* tScheme2_().correction(vf)
);
}
else
{
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
(
NULL
);
}
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -39,6 +39,7 @@ The current range of features comprises of:
- \ref grpCloudFunctionObjects
- \ref grpFieldFunctionObjects
- \ref grpForcesFunctionObjects
- \ref grpFVFunctionObjects
- \ref grpIOFunctionObjects
- \ref grpJobControlFunctionObjects
- \ref grpUtilitiesFunctionObjects

View File

@ -181,7 +181,8 @@ Foam::fieldValues::cellSource::cellSource
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
nCells_(0),
cellId_()
cellId_(),
weightFieldName_("none")
{
read(dict);
}

View File

@ -0,0 +1,10 @@
calcFvcDiv/calcFvcDiv.C
calcFvcDiv/calcFvcDivFunctionObject.C
calcFvcGrad/calcFvcGrad.C
calcFvcGrad/calcFvcGradFunctionObject.C
calcMag/calcMag.C
calcMag/calcMagFunctionObject.C
LIB = $(FOAM_LIBBIN)/libFVFunctionObjects

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOcalcFvcDiv
Description
Instance of the generic IOOutputFilter for calcFvcDiv.
\*---------------------------------------------------------------------------*/
#ifndef IOcalcFvcDiv_H
#define IOcalcFvcDiv_H
#include "calcFvcDiv.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<calcFvcDiv> IOcalcFvcDiv;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "calcFvcDiv.H"
#include "volFields.H"
#include "dictionary.H"
#include "calcFvcDiv.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::calcFvcDiv, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::volScalarField& Foam::calcFvcDiv::divField
(
const word& divName,
const dimensionSet& dims
)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
if (!mesh.foundObject<volScalarField>(divName))
{
volScalarField* divFieldPtr
(
new volScalarField
(
IOobject
(
divName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dims/dimLength, 0.0)
)
);
mesh.objectRegistry::store(divFieldPtr);
}
const volScalarField& field = mesh.lookupObject<volScalarField>(divName);
return const_cast<volScalarField&>(field);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::calcFvcDiv::calcFvcDiv
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"calcFvcDiv::calcFvcDiv"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::calcFvcDiv::~calcFvcDiv()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::calcFvcDiv::read(const dictionary& dict)
{
if (active_)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
}
}
void Foam::calcFvcDiv::execute()
{
// Do nothing - only valid on write
}
void Foam::calcFvcDiv::end()
{
// Do nothing - only valid on write
}
void Foam::calcFvcDiv::write()
{
if (active_)
{
bool processed = false;
calcDiv<surfaceScalarField>(fieldName_, resultName_, processed);
calcDiv<volVectorField>(fieldName_, resultName_, processed);
if (!processed)
{
WarningIn("void Foam::calcFvcDiv::write()")
<< "Unprocessed field " << fieldName_ << endl;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::calcFvcDiv
Group
grpFVFunctionObjects
Description
This function object calculates the divergence of a field. The operation is
limited to surfaceScalarFields and volumeVector fields, and the output is a
volume scalar field.
SourceFiles
calcFvcDiv.C
IOcalcFvcDiv.H
\*---------------------------------------------------------------------------*/
#ifndef calcFvcDiv_H
#define calcFvcDiv_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class dimensionSet;
/*---------------------------------------------------------------------------*\
Class calcFvcDiv Declaration
\*---------------------------------------------------------------------------*/
class calcFvcDiv
{
// Private data
//- Name of this calcFvcDiv object
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Name of field to process
word fieldName_;
//- Name of result field
word resultName_;
// Private Member Functions
//- Helper function to create/store/return the divergence field
volScalarField& divField
(
const word& gradName,
const dimensionSet& dims
);
//- Helper function to calculate the divergence of different field types
template<class FieldType>
void calcDiv
(
const word& fieldName,
const word& resultName,
bool& processed
);
//- Disallow default bitwise copy construct
calcFvcDiv(const calcFvcDiv&);
//- Disallow default bitwise assignment
void operator=(const calcFvcDiv&);
public:
//- Runtime type information
TypeName("calcFvcDiv");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
calcFvcDiv
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~calcFvcDiv();
// Member Functions
//- Return name of the set of calcFvcDiv
virtual const word& name() const
{
return name_;
}
//- Read the calcFvcDiv data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the calcFvcDiv and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "calcFvcDivTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "calcFvcDivFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(calcFvcDivFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
calcFvcDivFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::calcFvcDivFunctionObject
Description
FunctionObject wrapper around calcFvcDiv to allow it to be created
via the functions entry within controlDict.
SourceFiles
calcFvcDivFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef calcFvcDivFunctionObject_H
#define calcFvcDivFunctionObject_H
#include "calcFvcDiv.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<calcFvcDiv> calcFvcDivFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "fvMesh.H"
#include "fvcDiv.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class FieldType>
void Foam::calcFvcDiv::calcDiv
(
const word& fieldName,
const word& resultName,
bool& processed
)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
word divName = resultName;
if (divName == "none")
{
divName = "fvc::div(" + fieldName + ")";
}
if (mesh.foundObject<FieldType>(fieldName))
{
const FieldType& vf = mesh.lookupObject<FieldType>(fieldName);
volScalarField& field = divField(divName, vf.dimensions());
field = fvc::div(vf);
Info<< type() << " output:" << nl
<< " writing " << field.name() << " field" << nl << endl;
field.write();
processed = true;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOcalcFvcGrad
Description
Instance of the generic IOOutputFilter for calcFvcGrad.
\*---------------------------------------------------------------------------*/
#ifndef IOcalcFvcGrad_H
#define IOcalcFvcGrad_H
#include "calcFvcGrad.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<calcFvcGrad> IOcalcFvcGrad;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "calcFvcGrad.H"
#include "volFields.H"
#include "dictionary.H"
#include "calcFvcGrad.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::calcFvcGrad, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::calcFvcGrad::calcFvcGrad
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"calcFvcGrad::calcFvcGrad"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::calcFvcGrad::~calcFvcGrad()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::calcFvcGrad::read(const dictionary& dict)
{
if (active_)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
}
}
void Foam::calcFvcGrad::execute()
{
// Do nothing - only valid on write
}
void Foam::calcFvcGrad::end()
{
// Do nothing - only valid on write
}
void Foam::calcFvcGrad::write()
{
if (active_)
{
bool processed = false;
calcGrad<scalar>(fieldName_, resultName_, processed);
calcGrad<vector>(fieldName_, resultName_, processed);
if (!processed)
{
WarningIn("void Foam::calcFvcGrad::write()")
<< "Unprocessed field " << fieldName_ << endl;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::calcFvcGrad
Group
grpFVFunctionObjects
Description
This function object calculates the gradient of a field. The operation is
limited to scalar and vector volume or surface fields, and the output is a
volume vector or tensor field.
SourceFiles
calcFvcGrad.C
IOcalcFvcGrad.H
\*---------------------------------------------------------------------------*/
#ifndef calcFvcGrad_H
#define calcFvcGrad_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class dimensionSet;
/*---------------------------------------------------------------------------*\
Class calcFvcGrad Declaration
\*---------------------------------------------------------------------------*/
class calcFvcGrad
{
// Private data
//- Name of this calcFvcGrad object
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Name of field to process
word fieldName_;
//- Name of result field
word resultName_;
// Private Member Functions
//- Helper function to create/store/return the gradient field
template<class Type>
GeometricField
<
typename outerProduct<vector, Type>::type,
fvPatchField,
volMesh
>&
gradField(const word& gradName, const dimensionSet& dims);
//- Helper function to calculate the gradient of different field types
template<class Type>
void calcGrad
(
const word& fieldName,
const word& resultName,
bool& processed
);
//- Disallow default bitwise copy construct
calcFvcGrad(const calcFvcGrad&);
//- Disallow default bitwise assignment
void operator=(const calcFvcGrad&);
public:
//- Runtime type information
TypeName("calcFvcGrad");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
calcFvcGrad
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~calcFvcGrad();
// Member Functions
//- Return name of the set of calcFvcGrad
virtual const word& name() const
{
return name_;
}
//- Read the calcFvcGrad data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the calcFvcGrad and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "calcFvcGradTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "calcFvcGradFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(calcFvcGradFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
calcFvcGradFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::calcFvcGradFunctionObject
Description
FunctionObject wrapper around calcFvcGrad to allow it to be created
via the functions entry within controlDict.
SourceFiles
calcFvcGradFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef calcFvcGradFunctionObject_H
#define calcFvcGradFunctionObject_H
#include "calcFvcGrad.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<calcFvcGrad> calcFvcGradFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,133 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "fvMesh.H"
#include "fvcGrad.H"
template<class Type>
Foam::GeometricField
<
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>&
Foam::calcFvcGrad::gradField(const word& gradName, const dimensionSet& dims)
{
typedef typename outerProduct<vector, Type>::type gradType;
typedef GeometricField<gradType, fvPatchField, volMesh> vfGradType;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
if (!mesh.foundObject<vfGradType>(gradName))
{
vfGradType* gradFieldPtr
(
new vfGradType
(
IOobject
(
gradName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensioned<gradType>
(
"zero",
dims/dimLength,
pTraits<gradType>::zero
)
)
);
mesh.objectRegistry::store(gradFieldPtr);
}
const vfGradType& field = mesh.lookupObject<vfGradType>(gradName);
return const_cast<vfGradType&>(field);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::calcFvcGrad::calcGrad
(
const word& fieldName,
const word& resultName,
bool& processed
)
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
typedef typename outerProduct<vector, Type>::type gradType;
typedef GeometricField<gradType, fvPatchField, volMesh> vfGradType;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
word gradName = resultName;
if (gradName == "none")
{
gradName = "fvc::grad(" + fieldName + ")";
}
if (mesh.foundObject<vfType>(fieldName))
{
const vfType& vf = mesh.lookupObject<vfType>(fieldName);
vfGradType& field = gradField<Type>(gradName, vf.dimensions());
field = fvc::grad(vf);
Info<< type() << " output:" << nl
<< " writing " << field.name() << " field" << nl << endl;
field.write();
processed = true;
}
else if (mesh.foundObject<sfType>(fieldName))
{
const sfType& sf = mesh.lookupObject<sfType>(fieldName);
vfGradType& field = gradField<Type>(gradName, sf.dimensions());
field = fvc::grad(sf);
Info<< type() << " output:" << nl
<< " writing " << field.name() << " field" << nl << endl;
field.write();
processed = true;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOcalcMag
Description
Instance of the generic IOOutputFilter for calcMag.
\*---------------------------------------------------------------------------*/
#ifndef IOcalcMag_H
#define IOcalcMag_H
#include "calcMag.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<calcMag> IOcalcMag;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "calcMag.H"
#include "volFields.H"
#include "dictionary.H"
#include "calcMag.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::calcMag, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::calcMag::calcMag
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"calcMag::calcMag"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::calcMag::~calcMag()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::calcMag::read(const dictionary& dict)
{
if (active_)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
}
}
void Foam::calcMag::execute()
{
// Do nothing - only valid on write
}
void Foam::calcMag::end()
{
// Do nothing - only valid on write
}
void Foam::calcMag::write()
{
if (active_)
{
bool processed = false;
calc<scalar>(fieldName_, resultName_, processed);
calc<vector>(fieldName_, resultName_, processed);
calc<sphericalTensor>(fieldName_, resultName_, processed);
calc<symmTensor>(fieldName_, resultName_, processed);
calc<tensor>(fieldName_, resultName_, processed);
if (!processed)
{
WarningIn("void Foam::calcMag::write()")
<< "Unprocessed field " << fieldName_ << endl;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::calcMag
Group
grpFVFunctionObjects
Description
This function object calculates the magnitude of a field. The operation
can be applied to any volume or surface fieldsm and the output is a
volume or surface scalar field.
SourceFiles
calcMag.C
IOcalcMag.H
\*---------------------------------------------------------------------------*/
#ifndef calcMag_H
#define calcMag_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class dimensionSet;
/*---------------------------------------------------------------------------*\
Class calcMag Declaration
\*---------------------------------------------------------------------------*/
class calcMag
{
// Private data
//- Name of this calcMag object
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Name of field to process
word fieldName_;
//- Name of result field
word resultName_;
// Private Member Functions
//- Helper function to create/store/return the mag field
template<class FieldType>
FieldType& magField(const word& magName, const dimensionSet& dims);
//- Helper function to calculate the magnitude of different field types
template<class Type>
void calc
(
const word& fieldName,
const word& resultName,
bool& processed
);
//- Disallow default bitwise copy construct
calcMag(const calcMag&);
//- Disallow default bitwise assignment
void operator=(const calcMag&);
public:
//- Runtime type information
TypeName("calcMag");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
calcMag
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~calcMag();
// Member Functions
//- Return name of the set of calcMag
virtual const word& name() const
{
return name_;
}
//- Read the calcMag data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the calcMag and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "calcMagTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "calcMagFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(calcMagFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
calcMagFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::calcMagFunctionObject
Description
FunctionObject wrapper around calcMag to allow it to be created
via the functions entry within controlDict.
SourceFiles
calcMagFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef calcMagFunctionObject_H
#define calcMagFunctionObject_H
#include "calcMag.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<calcMag> calcMagFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "fvMesh.H"
#include "Time.H"
#include "volFields.H"
#include "surfaceFields.H"
template<class FieldType>
FieldType& Foam::calcMag::magField
(
const word& magName,
const dimensionSet& dims
)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
if (!mesh.foundObject<FieldType>(magName))
{
FieldType* magFieldPtr
(
new FieldType
(
IOobject
(
magName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dims, 0.0)
)
);
mesh.objectRegistry::store(magFieldPtr);
}
const FieldType& f = mesh.lookupObject<FieldType>(magName);
return const_cast<FieldType&>(f);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::calcMag::calc
(
const word& fieldName,
const word& resultName,
bool& processed
)
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
word magName = resultName;
if (magName == "none")
{
magName = "mag(" + fieldName + ")";
}
if (mesh.foundObject<vfType>(fieldName))
{
const vfType& vf = mesh.lookupObject<vfType>(fieldName);
volScalarField& field =
magField<volScalarField>(magName, vf.dimensions());
field = mag(vf);
Info<< type() << " output:" << nl
<< " writing " << field.name() << " field" << nl << endl;
field.write();
processed = true;
}
else if (mesh.foundObject<sfType>(fieldName))
{
const sfType& sf = mesh.lookupObject<sfType>(fieldName);
surfaceScalarField& field =
magField<surfaceScalarField>(magName, sf.dimensions());
field = mag(sf);
Info<< type() << " output:" << nl
<< " writing " << field.name() << " field" << nl << endl;
field.write();
processed = true;
}
}
// ************************************************************************* //

View File

@ -58,7 +58,9 @@ Foam::tmp<Foam::volScalarField> Foam::CourantNo::rho
(
"rho",
mesh.time().timeName(),
mesh
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("rho", dimless, 1.0)
@ -116,7 +118,8 @@ Foam::CourantNo::CourantNo
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0.0),

View File

@ -24,6 +24,9 @@ License
Class
Foam::CourantNo
Group
grpUtilitiesFunctionObjects
Description
This function object calculates and outputs the Courant number as a
volScalarField. The field is stored on the mesh database so that it can

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOLambda2
Description
Instance of the generic IOOutputFilter for Lambda2.
\*---------------------------------------------------------------------------*/
#ifndef IOLambda2_H
#define IOLambda2_H
#include "Lambda2.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<Lambda2> IOLambda2;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,159 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "Lambda2.H"
#include "volFields.H"
#include "dictionary.H"
#include "zeroGradientFvPatchFields.H"
#include "fvcGrad.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::Lambda2, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Lambda2::Lambda2
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
UName_("U")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"Lambda2::Lambda2"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
read(dict);
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* Lambda2Ptr
(
new volScalarField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimless/sqr(dimTime), 0.0)
)
);
mesh.objectRegistry::store(Lambda2Ptr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Lambda2::~Lambda2()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::Lambda2::read(const dictionary& dict)
{
if (active_)
{
UName_ = dict.lookupOrDefault<word>("UName", "U");
}
}
void Foam::Lambda2::execute()
{
// Do nothing - only valid on write
}
void Foam::Lambda2::end()
{
// Do nothing - only valid on write
}
void Foam::Lambda2::write()
{
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const volVectorField& U =
mesh.lookupObject<volVectorField>(UName_);
const volTensorField gradU(fvc::grad(U));
const volTensorField SSplusWW
(
(symm(gradU) & symm(gradU))
+ (skew(gradU) & skew(gradU))
);
volScalarField& Lambda2 =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(type())
);
Lambda2 = -eigenValues(SSplusWW)().component(vector::Y);
Lambda2.write();
Info<< type() << " output:" << nl
<< " writing " << Lambda2.name() << " field" << nl << endl;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::Lambda2
Group
grpUtilitiesFunctionObjects
Description
This function object calculates and outputs the second largest eigenvalue
of the sum of the square of the symmetrical and anti-symmetrical parts of
the velocity gradient tensor.
SourceFiles
Lambda2.C
IOLambda2.H
\*---------------------------------------------------------------------------*/
#ifndef Lambda2_H
#define Lambda2_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class Lambda2 Declaration
\*---------------------------------------------------------------------------*/
class Lambda2
{
// Private data
//- Name of this set of Lambda2 objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Name of velocity field, default is "U"
word UName_;
// Private Member Functions
//- Disallow default bitwise copy construct
Lambda2(const Lambda2&);
//- Disallow default bitwise assignment
void operator=(const Lambda2&);
public:
//- Runtime type information
TypeName("Lambda2");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
Lambda2
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~Lambda2();
// Member Functions
//- Return name of the set of Lambda2
virtual const word& name() const
{
return name_;
}
//- Read the Lambda2 data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the Lambda2 and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "Lambda2FunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(Lambda2FunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
Lambda2FunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::Lambda2FunctionObject
Description
FunctionObject wrapper around Lambda2 to allow it to be created
via the functions entry within controlDict.
SourceFiles
Lambda2FunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef Lambda2FunctionObject_H
#define Lambda2FunctionObject_H
#include "Lambda2.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<Lambda2> Lambda2FunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -3,6 +3,15 @@ codedFunctionObject/codedFunctionObject.C
CourantNo/CourantNo.C
CourantNo/CourantNoFunctionObject.C
Lambda2/Lambda2.C
Lambda2/Lambda2FunctionObject.C
Peclet/Peclet.C
Peclet/PecletFunctionObject.C
Q/Q.C
Q/QFunctionObject.C
DESModelRegions/DESModelRegions.C
DESModelRegions/DESModelRegionsFunctionObject.C

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOPeclet
Description
Instance of the generic IOOutputFilter for Peclet.
\*---------------------------------------------------------------------------*/
#ifndef IOPeclet_H
#define IOPeclet_H
#include "Peclet.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<Peclet> IOPeclet;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,196 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "Peclet.H"
#include "volFields.H"
#include "dictionary.H"
#include "surfaceFields.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::Peclet, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Peclet::Peclet
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
phiName_("phi"),
rhoName_("rho")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"Peclet::Peclet"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
read(dict);
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
surfaceScalarField* PecletPtr
(
new surfaceScalarField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0.0)
)
);
mesh.objectRegistry::store(PecletPtr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Peclet::~Peclet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::Peclet::read(const dictionary& dict)
{
if (active_)
{
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
}
}
void Foam::Peclet::execute()
{
// Do nothing - only valid on write
}
void Foam::Peclet::end()
{
// Do nothing - only valid on write
}
void Foam::Peclet::write()
{
typedef compressible::turbulenceModel cmpTurbModel;
typedef incompressible::turbulenceModel icoTurbModel;
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
tmp<volScalarField> nuEff;
if (mesh.foundObject<cmpTurbModel>("turbulenceModel"))
{
const cmpTurbModel& model =
mesh.lookupObject<cmpTurbModel>("turbulenceModel");
const volScalarField& rho =
mesh.lookupObject<volScalarField>(rhoName_);
nuEff = model.muEff()/rho;
}
else if (mesh.foundObject<icoTurbModel>("turbulenceModel"))
{
const icoTurbModel& model =
mesh.lookupObject<icoTurbModel>("turbulenceModel");
nuEff = model.nuEff();
}
else if (mesh.foundObject<transportModel>("transportProperties"))
{
const transportModel& model =
mesh.lookupObject<transportModel>("transportProperties");
nuEff = model.nu();
}
else
{
FatalErrorIn("void Foam::wallShearStress::write()")
<< "Unable to determine the viscosity"
<< exit(FatalError);
}
const surfaceScalarField& phi =
mesh.lookupObject<surfaceScalarField>(phiName_);
surfaceScalarField& Peclet =
const_cast<surfaceScalarField&>
(
mesh.lookupObject<surfaceScalarField>(type())
);
Peclet =
mag(phi)
/(
mesh.magSf()
*mesh.surfaceInterpolation::deltaCoeffs()
*fvc::interpolate(nuEff)
);
Peclet.write();
Info<< type() << " output:" << nl
<< " writing " << Peclet.name() << " field" << nl << endl;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,153 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::Peclet
Group
grpUtilitiesFunctionObjects
Description
This function object calculates and outputs the Peclet number as a
surfaceScalarField.
SourceFiles
Peclet.C
IOPeclet.H
\*---------------------------------------------------------------------------*/
#ifndef Peclet_H
#define Peclet_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class Peclet Declaration
\*---------------------------------------------------------------------------*/
class Peclet
{
// Private data
//- Name of this set of Peclet objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Name of flux field, default is "phi"
word phiName_;
//- Name of density field (compressible cases only), default is "rho"
word rhoName_;
// Private Member Functions
//- Disallow default bitwise copy construct
Peclet(const Peclet&);
//- Disallow default bitwise assignment
void operator=(const Peclet&);
public:
//- Runtime type information
TypeName("Peclet");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
Peclet
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~Peclet();
// Member Functions
//- Return name of the set of Peclet
virtual const word& name() const
{
return name_;
}
//- Read the Peclet data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the Peclet and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "PecletFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(PecletFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
PecletFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::PecletFunctionObject
Description
FunctionObject wrapper around Peclet to allow it to be created
via the functions entry within controlDict.
SourceFiles
PecletFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef PecletFunctionObject_H
#define PecletFunctionObject_H
#include "Peclet.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<Peclet> PecletFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOQ
Description
Instance of the generic IOOutputFilter for Q.
\*---------------------------------------------------------------------------*/
#ifndef IOQ_H
#define IOQ_H
#include "Q.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<Q> IOQ;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,152 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "Q.H"
#include "volFields.H"
#include "dictionary.H"
#include "fvcGrad.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::Q, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Q::Q
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
UName_("U")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"Q::Q"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
read(dict);
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* QPtr
(
new volScalarField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimless/sqr(dimTime), 0.0)
)
);
mesh.objectRegistry::store(QPtr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Q::~Q()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::Q::read(const dictionary& dict)
{
if (active_)
{
UName_ = dict.lookupOrDefault<word>("UName", "U");
}
}
void Foam::Q::execute()
{
// Do nothing - only valid on write
}
void Foam::Q::end()
{
// Do nothing - only valid on write
}
void Foam::Q::write()
{
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const volVectorField& U =
mesh.lookupObject<volVectorField>(UName_);
const volTensorField gradU(fvc::grad(U));
volScalarField& Q =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(type())
);
Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU))));
Q.write();
Info<< type() << " output:" << nl
<< " writing " << Q.name() << " field" << nl << endl;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::Q
Group
grpUtilitiesFunctionObjects
Description
This function object calculates and outputs the second invariant of the
velocity gradient tensor [1/s^2].
\f[
Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U))))
\f]
SourceFiles
Q.C
IOQ.H
\*---------------------------------------------------------------------------*/
#ifndef Q_H
#define Q_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class Q Declaration
\*---------------------------------------------------------------------------*/
class Q
{
// Private data
//- Name of this set of Q objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Name of velocity field, default is "U"
word UName_;
// Private Member Functions
//- Disallow default bitwise copy construct
Q(const Q&);
//- Disallow default bitwise assignment
void operator=(const Q&);
public:
//- Runtime type information
TypeName("Q");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
Q
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~Q();
// Member Functions
//- Return name of the set of Q
virtual const word& name() const
{
return name_;
}
//- Read the Q data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the Q and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "QFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(QFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
QFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::QFunctionObject
Description
FunctionObject wrapper around Q to allow it to be created
via the functions entry within controlDict.
SourceFiles
QFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef QFunctionObject_H
#define QFunctionObject_H
#include "Q.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<Q> QFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,6 +24,9 @@ License
Class
Foam::scalarTransport
Group
grpUtilitiesFunctionObjects
Description
This function object evolves a passive scalar transport equation. The
field in ininitially zero, to which sources are added. The field name

View File

@ -99,7 +99,6 @@ Foam::wallShearStress::wallShearStress
obr_(obr),
active_(true),
log_(false),
phiName_("phi"),
patchSet_()
{
// Check if the available mesh is an fvMesh, otherwise deactivate
@ -136,7 +135,6 @@ void Foam::wallShearStress::read(const dictionary& dict)
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
@ -231,38 +229,27 @@ void Foam::wallShearStress::write()
}
const surfaceScalarField& phi =
obr_.lookupObject<surfaceScalarField>(phiName_);
tmp<volSymmTensorField> Reff;
if (phi.dimensions() == dimMass/dimTime)
if (mesh.foundObject<cmpModel>("turbulenceModel"))
{
if (!mesh.foundObject<cmpModel>("turbulenceModel"))
{
FatalErrorIn("void Foam::wallShearStress::write()")
<< "Unable to find compressible turbulence model in the "
<< "database" << exit(FatalError);
}
const cmpModel& model =
mesh.lookupObject<cmpModel>("turbulenceModel");
Reff = model.devRhoReff();
}
else
else if (mesh.foundObject<icoModel>("turbulenceModel"))
{
if (!mesh.foundObject<icoModel>("turbulenceModel"))
{
FatalErrorIn("void Foam::wallShearStress::write()")
<< "Unable to find incompressible turbulence model in the "
<< "database" << exit(FatalError);
}
const icoModel& model =
mesh.lookupObject<icoModel>("turbulenceModel");
Reff = model.devReff();
}
else
{
FatalErrorIn("void Foam::wallShearStress::write()")
<< "Unable to find incompressible turbulence model in the "
<< "database" << exit(FatalError);
}
calcShearStress(mesh, Reff(), wallShearStress);

View File

@ -113,9 +113,6 @@ protected:
//- Switch to send output to Info as well as to file
Switch log_;
//- Name of mass/volume flux field (optional, default = phi)
word phiName_;
//- Optional list of patches to process
labelHashSet patchSet_;

View File

@ -56,7 +56,7 @@ void Foam::yPlusRAS::calcIncompressibleYPlus
volScalarField& yPlus
)
{
typedef incompressible::RASModels::nutWallFunctionFvPatchScalarField
typedef incompressible::nutWallFunctionFvPatchScalarField
wallFunctionPatchField;
const incompressible::RASModel& model =
@ -114,7 +114,7 @@ void Foam::yPlusRAS::calcCompressibleYPlus
volScalarField& yPlus
)
{
typedef compressible::RASModels::mutWallFunctionFvPatchScalarField
typedef compressible::mutWallFunctionFvPatchScalarField
wallFunctionPatchField;
const compressible::RASModel& model =

View File

@ -80,8 +80,7 @@ constantRadiation::constantRadiation
IOobject::AUTO_WRITE
),
owner.regionMesh(),
dimensionedScalar("one", dimless, 1.0),
zeroGradientFvPatchScalarField::typeName
dimensionedScalar("one", dimless, 1.0)
),
timeStart_(readScalar(coeffs_.lookup("timeStart"))),
duration_(readScalar(coeffs_.lookup("duration")))

View File

@ -169,7 +169,7 @@ public:
//- Const access to the coefficients dictionary,
// which provides info. about choice of models,
// and all related data (particularly model coefficients).
inline const dictionary& coeffDict() const
virtual const dictionary& coeffDict() const
{
return coeffDict_;
}

View File

@ -342,7 +342,7 @@ void LRR::correct()
RASModel::correct();
volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
volScalarField G("RASModel.G", 0.5*mag(tr(P)));
volScalarField G(type() + ".G", 0.5*mag(tr(P)));
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();

View File

@ -379,7 +379,7 @@ void LaunderGibsonRSTM::correct()
}
volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_)));
volScalarField G("RASModel.G", 0.5*mag(tr(P)));
volScalarField G(type() + ".G", 0.5*mag(tr(P)));
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();

View File

@ -304,7 +304,7 @@ void LaunderSharmaKE::correct()
}
tmp<volTensorField> tgradU = fvc::grad(U_);
volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();

View File

@ -209,7 +209,7 @@ public:
}
//- Const access to the coefficients dictionary
const dictionary& coeffDict() const
virtual const dictionary& coeffDict() const
{
return coeffDict_;
}

View File

@ -303,7 +303,7 @@ void RNGkEpsilon::correct()
volScalarField S2((tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();
volScalarField G("RASModel.G", mut_*S2);
volScalarField G(type() + ".G", mut_*S2);
volScalarField eta(sqrt(mag(S2))*k_/epsilon_);
volScalarField eta3(eta*sqr(eta));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,7 +76,7 @@ tmp<volScalarField> autoCreateAlphat
if (isA<wallFvPatch>(bm[patchI]))
{
alphatBoundaryTypes[patchI] =
RASModels::alphatWallFunctionFvPatchScalarField::typeName;
alphatWallFunctionFvPatchScalarField::typeName;
}
else
{
@ -146,7 +146,7 @@ tmp<volScalarField> autoCreateMut
if (isA<wallFvPatch>(bm[patchI]))
{
mutBoundaryTypes[patchI] =
RASModels::mutkWallFunctionFvPatchScalarField::typeName;
mutkWallFunctionFvPatchScalarField::typeName;
}
else
{
@ -216,7 +216,7 @@ tmp<volScalarField> autoCreateLowReMut
if (isA<wallFvPatch>(bm[patchI]))
{
mutBoundaryTypes[patchI] =
RASModels::mutLowReWallFunctionFvPatchScalarField::typeName;
mutLowReWallFunctionFvPatchScalarField::typeName;
}
else
{
@ -262,7 +262,7 @@ tmp<volScalarField> autoCreateEpsilon
autoCreateWallFunctionField
<
scalar,
RASModels::epsilonWallFunctionFvPatchScalarField
epsilonWallFunctionFvPatchScalarField
>
(
fieldName,
@ -281,7 +281,7 @@ tmp<volScalarField> autoCreateOmega
autoCreateWallFunctionField
<
scalar,
RASModels::omegaWallFunctionFvPatchScalarField
omegaWallFunctionFvPatchScalarField
>
(
fieldName,
@ -300,7 +300,7 @@ tmp<volScalarField> autoCreateK
autoCreateWallFunctionField
<
scalar,
RASModels::kqRWallFunctionFvPatchField<scalar>
kqRWallFunctionFvPatchField<scalar>
>
(
fieldName,
@ -319,7 +319,7 @@ tmp<volScalarField> autoCreateQ
autoCreateWallFunctionField
<
scalar,
RASModels::kqRWallFunctionFvPatchField<scalar>
kqRWallFunctionFvPatchField<scalar>
>
(
fieldName,
@ -338,7 +338,7 @@ tmp<volSymmTensorField> autoCreateR
autoCreateWallFunctionField
<
symmTensor,
RASModels::kqRWallFunctionFvPatchField<symmTensor>
kqRWallFunctionFvPatchField<symmTensor>
>
(
fieldName,

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "convectiveHeatTransferFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "addToRunTimeSelectionTable.H"
@ -34,8 +34,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -167,7 +165,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::convectiveHeatTransferFvPatchScalarField
Foam::compressible::convectiveHeatTransferFvPatchScalarField
Group
grpCmpRASBoundaryConditions
@ -85,8 +85,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class convectiveHeatTransferFvPatchScalarField Declaration
@ -190,7 +188,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -28,7 +28,7 @@ License
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
#include "volFields.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -131,10 +131,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
}
// Lookup Cmu corresponding to the turbulence model selected
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalar Cmu =
rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
const scalar Cmu75 = pow(Cmu, 0.75);

View File

@ -131,10 +131,11 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
}
// Lookup Cmu corresponding to the turbulence model selected
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalar Cmu =
rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
const scalar Cmu25 = pow(Cmu, 0.25);

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "alphatJayatillekeWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -36,8 +36,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -312,7 +310,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
alphatJayatillekeWallFunctionFvPatchScalarField
Foam::compressible::alphatJayatillekeWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -72,8 +72,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class alphatJayatillekeWallFunctionFvPatchScalarField Declaration
@ -211,7 +209,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,13 +34,10 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphatWallFunctionFvPatchScalarField::
alphatWallFunctionFvPatchScalarField
alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -52,8 +49,7 @@ alphatWallFunctionFvPatchScalarField
{}
alphatWallFunctionFvPatchScalarField::
alphatWallFunctionFvPatchScalarField
alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
(
const alphatWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -67,8 +63,7 @@ alphatWallFunctionFvPatchScalarField
{}
alphatWallFunctionFvPatchScalarField::
alphatWallFunctionFvPatchScalarField
alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -81,8 +76,7 @@ alphatWallFunctionFvPatchScalarField
{}
alphatWallFunctionFvPatchScalarField::
alphatWallFunctionFvPatchScalarField
alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
(
const alphatWallFunctionFvPatchScalarField& awfpsf
)
@ -93,8 +87,7 @@ alphatWallFunctionFvPatchScalarField
{}
alphatWallFunctionFvPatchScalarField::
alphatWallFunctionFvPatchScalarField
alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField
(
const alphatWallFunctionFvPatchScalarField& awfpsf,
const DimensionedField<scalar, volMesh>& iF
@ -143,7 +136,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::alphatWallFunctionFvPatchScalarField
Foam::compressible::alphatWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -84,8 +84,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class alphatWallFunctionFvPatchScalarField Declaration
@ -190,7 +188,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "epsilonLowReWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -35,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -132,11 +130,18 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbulence.y()[patchI];
volScalarField& G =
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
const_cast<volScalarField&>
(
db().lookupObject<volScalarField>
(
turbulence.type() + ".G"
)
);
DimensionedField<scalar, volMesh>& epsilon =
const_cast<DimensionedField<scalar, volMesh>&>
@ -144,19 +149,19 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs()
dimensionedInternalField()
);
const tmp<volScalarField> tk = rasModel.k();
const tmp<volScalarField> tk = turbulence.k();
const volScalarField& k = tk();
const tmp<volScalarField> tmu = rasModel.mu();
const tmp<volScalarField> tmu = turbulence.mu();
const scalarField& muw = tmu().boundaryField()[patchI];
const tmp<volScalarField> tmut = rasModel.mut();
const tmp<volScalarField> tmut = turbulence.mut();
const volScalarField& mut = tmut();
const scalarField& mutw = mut.boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& rhow = turbulence.rho().boundaryField()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI];
const scalarField magGradUw(mag(Uw.snGrad()));
const scalar Cmu25 = pow025(Cmu_);
@ -175,7 +180,8 @@ void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs()
}
else
{
epsilon[faceCellI] = 2.0*Cmu25*pow(k[faceCellI], 1.5)/y[faceI];
epsilon[faceCellI] =
2.0*k[faceCellI]*muw[faceI]/rhow[faceI]/sqr(y[faceI]);
}
G[faceCellI] =
@ -201,7 +207,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::iompressible::RASModels::epsilonLowReWallFunctionFvPatchScalarField
Foam::iompressible::epsilonLowReWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -74,8 +74,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class epsilonLowReWallFunctionFvPatchScalarField Declaration
@ -180,7 +178,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "epsilonWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -37,8 +37,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -58,7 +56,6 @@ void epsilonWallFunctionFvPatchScalarField::checkType()
void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_);
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
@ -74,7 +71,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(p, iF),
GName_("RASModel.G"),
Cmu_(0.09),
kappa_(0.41),
E_(9.8)
@ -92,7 +88,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
GName_(ptf.GName_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_)
@ -109,7 +104,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
GName_(dict.lookupOrDefault<word>("G", "RASModel.G")),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8))
@ -124,7 +118,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(ewfpsf),
GName_(ewfpsf.GName_),
Cmu_(ewfpsf.Cmu_),
kappa_(ewfpsf.kappa_),
E_(ewfpsf.E_)
@ -140,7 +133,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF),
GName_(ewfpsf.GName_),
Cmu_(ewfpsf.Cmu_),
kappa_(ewfpsf.kappa_),
E_(ewfpsf.E_)
@ -160,15 +152,22 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalar Cmu25 = pow025(Cmu_);
const scalar Cmu75 = pow(Cmu_, 0.75);
const scalarField& y = rasModel.y()[patchI];
const scalarField& y = turbulence.y()[patchI];
volScalarField& G =
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
const_cast<volScalarField&>
(
db().lookupObject<volScalarField>
(
turbulence.type() + ".G"
)
);
DimensionedField<scalar, volMesh>& epsilon =
const_cast<DimensionedField<scalar, volMesh>&>
@ -176,16 +175,16 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
dimensionedInternalField()
);
const tmp<volScalarField> tk = rasModel.k();
const tmp<volScalarField> tk = turbulence.k();
const volScalarField& k = tk();
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& muw = turbulence.mu().boundaryField()[patchI];
const tmp<volScalarField> tmut = rasModel.mut();
const tmp<volScalarField> tmut = turbulence.mut();
const volScalarField& mut = tmut();
const scalarField& mutw = mut.boundaryField()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI];
const scalarField magGradUw(mag(Uw.snGrad()));
@ -236,7 +235,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::epsilonWallFunctionFvPatchScalarField
Foam::compressible::epsilonWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -47,7 +47,6 @@ Description
\table
Property | Description | Required | Default value
G | turbulence generation field name | no | G
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
@ -80,8 +79,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class epsilonWallFunctionFvPatchScalarField Declaration
@ -95,9 +92,6 @@ protected:
// Protected data
//- Name of turbulence generation field
word GName_;
//- Cmu coefficient
scalar Cmu_;
@ -206,7 +200,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "fWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
@ -168,8 +167,9 @@ void fWallFunctionFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const v2f& v2fModel = refCast<const v2f>(rasModel);
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const v2f& v2fModel = refCast<const v2f>(turbulence);
const scalarField& y = v2fModel.y()[patchI];

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "kLowReWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -36,8 +36,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -174,16 +172,17 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbulence.y()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const tmp<volScalarField> tk = turbulence.k();
const volScalarField& k = tk();
const tmp<volScalarField> tmu = rasModel.mu();
const tmp<volScalarField> tmu = turbulence.mu();
const scalarField& muw = tmu().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& rhow = turbulence.rho().boundaryField()[patchI];
const scalar Cmu25 = pow025(Cmu_);
@ -250,7 +249,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::kLowReWallFunctionFvPatchScalarField
Foam::compressible::kLowReWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -71,8 +71,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class kLowReWallFunctionFvPatchScalarField Declaration
@ -199,7 +197,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,8 +34,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -146,7 +144,6 @@ void kqRWallFunctionFvPatchField<Type>::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::kqRWallFunctionFvPatchField
Foam::compressible::kqRWallFunctionFvPatchField
Group
grpCmpWallFunctions
@ -60,8 +60,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class kqRWallFunctionFvPatchField Declaration
@ -168,7 +166,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,8 +34,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -43,7 +41,6 @@ makePatchFields(kqRWallFunction);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,7 +42,6 @@ makePatchTypeFieldTypedefs(kqRWallFunction);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mutLowReWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -35,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -129,7 +127,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutLowReWallFunctionFvPatchScalarField
Foam::compressible::mutLowReWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -43,7 +43,7 @@ Description
\endverbatim
SeeAlso
Foam::mutWallFunctionFvPatchScalarField
Foam::compressible::mutWallFunctionFvPatchScalarField
SourceFiles
mutLowReWallFunctionFvPatchScalarField.C
@ -61,8 +61,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutLowReWallFunctionFvPatchScalarField Declaration
@ -160,7 +158,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -26,7 +26,7 @@ License
#include "mutURoughWallFunctionFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -35,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -311,7 +309,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutURoughWallFunctionFvPatchScalarField
Foam::compressible:::mutURoughWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -52,7 +52,7 @@ Description
\endverbatim
SeeAlso
Foam::mutWallFunctionFvPatchScalarField
Foam::compressible::mutWallFunctionFvPatchScalarField
SourceFiles
mutURoughWallFunctionFvPatchScalarField.C
@ -70,8 +70,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutURoughWallFunctionFvPatchScalarField Declaration
@ -232,7 +230,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -26,7 +26,7 @@ License
#include "mutUSpaldingWallFunctionFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -35,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -219,7 +217,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutUSpaldingWallFunctionFvPatchScalarField
Foam::compressible::mutUSpaldingWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -56,7 +56,7 @@ Description
\endverbatim
SeeAlso
Foam::mutWallFunctionFvPatchScalarField
Foam::compressible::mutWallFunctionFvPatchScalarField
SourceFiles
mutUSpaldingWallFunctionFvPatchScalarField.C
@ -74,8 +74,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutUSpaldingWallFunctionFvPatchScalarField Declaration
@ -182,7 +180,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mutUWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -35,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -197,7 +195,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutUWallFunctionFvPatchScalarField
Foam::compressible::mutUWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -42,7 +42,7 @@ Description
\endverbatim
SeeAlso
Foam::mutWallFunctionFvPatchScalarField
Foam::compressible::mutWallFunctionFvPatchScalarField
SourceFiles
mutUWallFunctionFvPatchScalarField.C
@ -60,8 +60,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutUWallFunctionFvPatchScalarField Declaration
@ -168,7 +166,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "mutWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
@ -36,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -184,7 +181,6 @@ void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField
Foam::compressible::mutWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -61,8 +61,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutWallFunctionFvPatchScalarField Declaration
@ -173,7 +171,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mutkRoughWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -35,8 +35,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -237,7 +235,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutkRoughWallFunctionFvPatchScalarField
Foam::compressible::mutkRoughWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -56,7 +56,7 @@ Description
\endverbatim
SeeAlso
Foam::mutkRoughWallFunctionFvPatchScalarField
Foam::compressible::mutkRoughWallFunctionFvPatchScalarField
SourceFiles
mutkRoughWallFunctionFvPatchScalarField.C
@ -74,8 +74,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutkRoughWallFunctionFvPatchScalarField Declaration
@ -198,7 +196,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mutkWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
@ -36,8 +36,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -159,7 +157,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::mutkWallFunctionFvPatchScalarField
Foam::compressible::mutkWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -43,7 +43,7 @@ Description
\endverbatim
SeeAlso
Foam::mutWallFunctionFvPatchScalarField
Foam::compressible::mutWallFunctionFvPatchScalarField
SourceFiles
mutkWallFunctionFvPatchScalarField.C
@ -61,8 +61,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutkWallFunctionFvPatchScalarField Declaration
@ -160,7 +158,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "omegaWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
@ -37,8 +37,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -58,7 +56,6 @@ void omegaWallFunctionFvPatchScalarField::checkType()
void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_);
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
@ -75,7 +72,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(p, iF),
GName_("RASModel.G"),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
@ -96,7 +92,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
GName_(ptf.GName_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
@ -115,7 +110,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
GName_(dict.lookupOrDefault<word>("G", "RASModel.G")),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
@ -132,7 +126,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(owfpsf),
GName_(owfpsf.GName_),
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
@ -150,7 +143,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
)
:
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
GName_(owfpsf.GName_),
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
@ -173,13 +165,19 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patch().index()];
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbulence.y()[patch().index()];
const scalar Cmu25 = pow025(Cmu_);
volScalarField& G = const_cast<volScalarField&>
(db().lookupObject<volScalarField>(GName_));
(
db().lookupObject<volScalarField>
(
turbulence.type() + ".G"
)
);
DimensionedField<scalar, volMesh>& omega =
const_cast<DimensionedField<scalar, volMesh>&>
@ -187,18 +185,18 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
dimensionedInternalField()
);
const tmp<volScalarField> tk = rasModel.k();
const tmp<volScalarField> tk = turbulence.k();
const volScalarField& k = tk();
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& rhow = turbulence.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& muw = turbulence.mu().boundaryField()[patchI];
const tmp<volScalarField> tmut = rasModel.mut();
const tmp<volScalarField> tmut = turbulence.mut();
const volScalarField& mut = tmut();
const scalarField& mutw = mut.boundaryField()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI];
const scalarField magGradUw(mag(Uw.snGrad()));
@ -242,7 +240,6 @@ makePatchTypeField
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::RASModels::omegaWallFunctionFvPatchScalarField
Foam::compressible::omegaWallFunctionFvPatchScalarField
Group
grpCmpWallFunctions
@ -54,7 +54,6 @@ Description
\table
Property | Description | Required | Default value
G | turbulence generation field name | no | G
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
@ -85,8 +84,6 @@ namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class omegaWallFunctionFvPatchScalarField Declaration
@ -100,9 +97,6 @@ protected:
// Protected data
//- Name of turbulence generation field
word GName_;
//- Cmu coefficient
scalar Cmu_;
@ -214,7 +208,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -167,16 +167,17 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const turbulenceModel& turbulence =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbulence.y()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const tmp<volScalarField> tk = turbulence.k();
const volScalarField& k = tk();
const tmp<volScalarField> tmu = rasModel.mu();
const tmp<volScalarField> tmu = turbulence.mu();
const scalarField& muw = tmu().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& rhow = turbulence.rho().boundaryField()[patchI];
const scalar Cmu25 = pow025(Cmu_);

View File

@ -281,7 +281,7 @@ void kEpsilon::correct()
}
tmp<volTensorField> tgradU = fvc::grad(U_);
volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();
// Update epsilon and G at the wall

View File

@ -85,6 +85,18 @@ tmp<volScalarField> kOmegaSST::F2() const
}
tmp<volScalarField> kOmegaSST::F3() const
{
tmp<volScalarField> arg3 = min
(
150*(mu()/rho_)/(omega_*sqr(y_)),
scalar(10)
);
return 1 - tanh(pow4(arg3));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
kOmegaSST::kOmegaSST
@ -198,6 +210,15 @@ kOmegaSST::kOmegaSST
0.31
)
),
b1_
(
dimensioned<scalar>::lookupOrAddToDict
(
"b1",
coeffDict_,
1.0
)
),
c1_
(
dimensioned<scalar>::lookupOrAddToDict
@ -268,7 +289,7 @@ kOmegaSST::kOmegaSST
/ max
(
a1_*omega_,
F2()*sqrt(2.0)*mag(symm(fvc::grad(U_)))
b1_*F2()*F3()*sqrt(2.0)*mag(symm(fvc::grad(U_)))
)
);
mut_.correctBoundaryConditions();
@ -347,6 +368,7 @@ bool kOmegaSST::read()
beta2_.readIfPresent(coeffDict());
betaStar_.readIfPresent(coeffDict());
a1_.readIfPresent(coeffDict());
b1_.readIfPresent(coeffDict());
c1_.readIfPresent(coeffDict());
return true;
@ -392,7 +414,7 @@ void kOmegaSST::correct()
tmp<volTensorField> tgradU = fvc::grad(U_);
volScalarField S2(2*magSqr(symm(tgradU())));
volScalarField GbyMu((tgradU() && dev(twoSymm(tgradU()))));
volScalarField G("RASModel.G", mut_*GbyMu);
volScalarField G(type() + ".G", mut_*GbyMu);
tgradU.clear();
// Update omega and G at the wall
@ -448,7 +470,7 @@ void kOmegaSST::correct()
// Re-calculate viscosity
mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(S2));
mut_ = a1_*rho_*k_/max(a1_*omega_, b1_*F2()*F3()*sqrt(S2));
mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity

View File

@ -38,6 +38,15 @@ Description
Nov. 2001
\endverbatim
with the addition of the F3 term for rough walls from
\verbatim
Hellsten, A.
"Some Improvements in Menters k-omega-SST turbulence model"
29th AIAA Fluid Dynamics Conference,
AIAA-98-2554,
June 1998.
\endverbatim
Note that this implementation is written in terms of alpha diffusion
coefficients rather than the more traditional sigma (alpha = 1/sigma) so
that the blending can be applied to all coefficuients in a consistent
@ -69,6 +78,7 @@ Description
gamma1 0.5532;
gamma2 0.4403;
a1 0.31;
b1 1.0;
c1 10.0;
}
\endverbatim
@ -125,6 +135,7 @@ protected:
dimensionedScalar betaStar_;
dimensionedScalar a1_;
dimensionedScalar b1_;
dimensionedScalar c1_;
@ -144,6 +155,7 @@ protected:
tmp<volScalarField> F1(const volScalarField& CDkOmega) const;
tmp<volScalarField> F2() const;
tmp<volScalarField> F3() const;
tmp<volScalarField> blend
(

View File

@ -321,7 +321,7 @@ void realizableKE::correct()
volScalarField eta(magS*k_/epsilon_);
volScalarField C1(max(eta/(scalar(5) + eta), scalar(0.43)));
volScalarField G("RASModel.G", mut_*(gradU && dev(twoSymm(gradU))));
volScalarField G(type() + ".G", mut_*(gradU && dev(twoSymm(gradU))));
// Update epsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();

View File

@ -398,7 +398,7 @@ void v2f::correct()
const volTensorField gradU(fvc::grad(U_));
const volScalarField S2(2*magSqr(dev(symm(gradU))));
const volScalarField G("RASModel.G", mut_*S2);
const volScalarField G(type() + ".G", mut_*S2);
const volScalarField T(Ts());
const volScalarField L2("v2f.L2", sqr(Ls()));
const volScalarField alpha

View File

@ -79,6 +79,12 @@ autoPtr<laminar> laminar::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const dictionary& laminar::coeffDict() const
{
return dictionary::null;
}
tmp<volScalarField> laminar::mut() const
{
return tmp<volScalarField>

View File

@ -91,6 +91,9 @@ public:
// Member Functions
//- Const access to the coefficients dictionary
virtual const dictionary& coeffDict() const;
//- Return the turbulence viscosity, i.e. 0 for laminar flow
virtual tmp<volScalarField> mut() const;

Some files were not shown because too many files have changed in this diff Show More