ENH: Adding:

1) basicSource for explicit sources(ActuationDisk and
	   explicit source so far)
	2) cylindricalInlet BC
	3) swirlMassFlowRate BC
	4) dynamicLagrangian LES incompressible turbulence model
	5) atmospheric boundary layer inlet BC for velocity and
	   epsilon
This commit is contained in:
sergio
2010-06-22 15:21:12 +01:00
parent 1a2973c4f4
commit ddcf2ee997
27 changed files with 3489 additions and 80 deletions

View File

@ -157,6 +157,7 @@ $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/swirlMassFlowRateInletVelocity/swirlMassFlowRateInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
@ -355,4 +356,13 @@ fieldSources = $(general)/fieldSources
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
basicSource = $(general)/fieldSources/basicSource
$(basicSource)/basicSource/basicSource.C
$(basicSource)/basicSource/basicSourceIO.C
$(basicSource)/basicSource/basicSourceList.C
$(basicSource)/basicSource/IObasicSourceList.C
$(basicSource)/actuationDiskSource/actuationDiskSource.C
$(basicSource)/explicitSource/explicitSource.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -0,0 +1,196 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "actuationDiskSource.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "geometricOneField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(actuationDiskSource, 0);
addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::actuationDiskSource::checkData()
{
if
(
magSqr(diskArea_) <= VSMALL
|| Cp_ <= VSMALL
|| Ct_ <= VSMALL
|| diskDir_ == vector::zero
)
{
FatalIOErrorIn
(
"Foam::actuationDiskSource::checkData()",
dict_
) << "diskArea, Cp or Ct is small "
<< "or disk direction not specified"
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::actuationDiskSource::actuationDiskSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, dict, mesh),
cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
diskDir_(vector::zero),
Cp_(0),
Ct_(0),
diskArea_(0),
dict_(dict.subDict(typeName + "Coeffs"))
{
Info<< " - creating actuation disk zone: "
<< this->name() << endl;
bool foundZone = (cellZoneID_ != -1);
reduce(foundZone, orOp<bool>());
if (!foundZone && Pstream::master())
{
FatalErrorIn
(
"Foam::actuationDiskSource::actuationDiskSource"
"(const word&, const dictionary&, const fvMesh&)"
) << "cannot find porous cellZone " << this->name()
<< exit(FatalError);
}
dict_.readIfPresent("diskDir", diskDir_);
dict_.readIfPresent("Cp", Cp_);
dict_.readIfPresent("Ct", Ct_);
dict_.readIfPresent("diskArea", diskArea_);
checkData();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
{
if (cellZoneID_ == -1)
{
return;
}
bool compressible = false;
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
{
compressible = true;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const scalarField& V = this->mesh().V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
if (compressible)
{
addActuationDiskAxialInertialResistance
(
Usource,
cells,//this->cells(),
V,
this->mesh().lookupObject<volScalarField>("rho"),
U
);
}
else
{
addActuationDiskAxialInertialResistance
(
Usource,
cells,//this->cells(),
V,
geometricOneField(),
U
);
}
}
void Foam::actuationDiskSource::writeData(Ostream& os) const
{
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
if (dict_.found("note"))
{
os.writeKeyword("note") << string(dict_.lookup("note"))
<< token::END_STATEMENT << nl;
}
os << indent << "actuationDisk";
dict_.write(os);
os << decrIndent << indent << token::END_BLOCK << endl;
}
bool Foam::actuationDiskSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs =
sourceDict.subDict(typeName + "Coeffs");
subDictCoeffs.readIfPresent("diskDir", diskDir_);
subDictCoeffs.readIfPresent("Cp", Cp_);
subDictCoeffs.readIfPresent("Ct", Ct_);
subDictCoeffs.readIfPresent("diskArea", diskArea_);
checkData();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,213 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::actuationDiskSource
Description
Actuation disk zone definition.
Constant values for momentum source for actuation disk
T = 2*rho*A*sqr(Uo)*a*(1-a)
U1 = (1 -a)Uo
where:
A: disk area
Uo: upstream velocity
a: 1 - Cp/Ct
U1: velocity at the disk
SourceFiles
actuationDiskSource.C
actuationDiskSourceTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef actuationDiskSource_H
#define actuationDiskSource_H
#include "IOdictionary.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "wordList.H"
#include "labelList.H"
#include "DimensionedField.H"
#include "volFieldsFwd.H"
#include "fvMatricesFwd.H"
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class actuationDiskSource Declaration
\*---------------------------------------------------------------------------*/
class actuationDiskSource
:
public basicSource
{
// Private data
//- Cell zone ID
label cellZoneID_;
//- Disk area normal
vector diskDir_;
//- Power coefficient
scalar Cp_;
//- Thrust coefficient
scalar Ct_;
//- Disk area
scalar diskArea_;
//- Sub dictionary with actuationDisk information
const dictionary& dict_;
// Private Member Functions
//- Check data
void checkData();
//- Add resistance to the UEqn
template<class RhoFieldType>
void addActuationDiskAxialInertialResistance
(
vectorField& Usource,
const labelList& cells,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const;
//- Disallow default bitwise copy construct
actuationDiskSource(const actuationDiskSource&);
//- Disallow default bitwise assignment
void operator=(const actuationDiskSource&);
public:
//- Runtime type information
TypeName("actuationDiskSource");
// Constructors
//- Construct from components
actuationDiskSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~actuationDiskSource()
{}
// Member Functions
// Access
//- cellZone number
label zoneId() const
{
return cellZoneID_;
}
//- Return Cp
scalar Cp() const
{
return Cp_;
}
//- Return Ct
scalar Ct() const
{
return Ct_;
}
//- Normal disk direction
const vector& diskDir() const
{
return diskDir_;
}
//- Disk area
scalar diskArea() const
{
return diskArea_;
}
// Public Functions
//-Source term to fvMatrix<vector>
virtual void addSu(fvMatrix<vector>& UEqn);
//-Source term to fvMatrix<scalar>
virtual void addSu(fvMatrix<scalar>& UEqn){}
//- Add all explicit source
virtual void addExplicitSources(){}
//- Add source to scalar field
virtual void addSu(DimensionedField<scalar, volMesh>& field){}
//- Add source to vector field
virtual void addSu(DimensionedField<vector, volMesh>& field){}
// I-O
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "actuationDiskSourceTemplates.C"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "actuationDiskSource.H"
#include "volFields.H"
#include "fvMatrix.H"
#include "fvm.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class RhoFieldType>
void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
(
vectorField& Usource,
const labelList& cells,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const
{
scalar a = 1.0 - Cp_/Ct_;
scalar totVol = 0.0;
scalarField T(cells.size());
vector uniDiskDir = diskDir_/mag(diskDir_);
tensor E(tensor::zero);
E.xx() = uniDiskDir.x();
E.yy() = uniDiskDir.y();
E.zz() = uniDiskDir.z();
vectorField U1 = (1.0 - a)*U;
forAll(cells, i)
{
totVol += V[cells[i]];
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
}
forAll(cells, i)
{
Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]];
}
}
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "IObasicSourceList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::IObasicSourceList::IObasicSourceList
(
const fvMesh& mesh
)
:
IOdictionary
(
IOobject
(
"sourcesProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
basicSourceList(mesh, *this)
{}
bool Foam::IObasicSourceList::read()
{
if (regIOobject::read())
{
basicSourceList::read(*this);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::IObasicSourceList
Description
IObasicSourceList
SourceFiles
IObasicSourceList.C
\*---------------------------------------------------------------------------*/
#ifndef IObasicSourceList_H
#define IObasicSourceList_H
#include "basicSourceList.H"
#include "IOdictionary.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IObasicSourceList Declaration
\*---------------------------------------------------------------------------*/
class IObasicSourceList
:
public IOdictionary,
public basicSourceList
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
IObasicSourceList
(
const IObasicSourceList&
);
//- Disallow default bitwise assignment
void operator=(const IObasicSourceList&);
public:
// Constructors
//- Construct from components with list of field names
IObasicSourceList
(
const fvMesh& mesh
);
// Destructor
virtual ~IObasicSourceList()
{}
//- Read dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,292 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "basicSource.H"
#include "fvMesh.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(basicSource, 0);
defineRunTimeSelectionTable(basicSource, dictionary);
}
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
const Foam::wordList Foam::basicSource::
selectionModeTypeNames_
(
IStringStream("(points cellSet cellZone all)")()
);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::basicSource::selectionModeType
Foam::basicSource::wordToSelectionModeType
(
const word& smtName
) const
{
forAll(selectionModeTypeNames_, i)
{
if (smtName == selectionModeTypeNames_[i])
{
return selectionModeType(i);
}
}
FatalErrorIn
(
"basicSource::selectionModeType"
"basicSource::wordToSelectionModeType"
"("
"const word&"
")"
) << "Unknown selectionMode type " << smtName
<< ". Valid selectionMode types are:" << nl << selectionModeTypeNames_
<< exit(FatalError);
return selectionModeType(0);
}
Foam::word Foam::basicSource::selectionModeTypeToWord
(
const selectionModeType& smtType
) const
{
if (smtType > selectionModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return selectionModeTypeNames_[smtType];
}
}
void Foam::basicSource::setSelection
(
const dictionary& dict
)
{
switch (selectionMode_)
{
case smPoints:
{
//Do nothing. It should be sorted out by derived class//
break;
}
case smCellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
case smCellZone:
{
dict.lookup("cellZone") >> cellSetName_;
break;
}
case smAll:
{
break;
}
default:
{
FatalErrorIn
(
"basicSource::setSelection(const dictionary&)"
) << "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
}
void Foam::basicSource::setCellSet()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
switch (selectionMode_)
{
case smPoints:
{
break;
}
case smCellSet:
{
Info<< indent << "- selecting cells using cellSet "
<< cellSetName_ << endl;
cellSet selectedCells(mesh_, cellSetName_);
cells_ = selectedCells.toc();
break;
}
case smCellZone:
{
Info<< indent << "- selecting cells using cellZone "
<< cellSetName_ << endl;
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
if (zoneID == -1)
{
FatalErrorIn("basicSource<Type>::setCellIds()")
<< "Cannot find cellZone " << cellSetName_ << endl
<< "Valid cellZones are " << mesh_.cellZones().names()
<< exit(FatalError);
}
cells_ = mesh_.cellZones()[zoneID];
break;
}
case smAll:
{
Info<< indent << "- selecting all cells" << endl;
cells_ = identity(mesh_.nCells());
break;
}
default:
{
FatalErrorIn("basicSource<Type>::setCellIds()")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
// Set volume information
if (selectionMode_ != smPoints)
{
V_ = 0.0;
forAll(cells_, i)
{
V_ += mesh_.V()[cells_[i]];
}
reduce(V_, sumOp<scalar>());
Info<< indent << "- selected "
<< returnReduce(cells_.size(), sumOp<label>())
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSource::basicSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
:
name_(name),
mesh_(mesh),
dict_(dict),
active_(readBool(dict_.lookup("active"))),
timeStart_(readScalar(dict_.lookup("timeStart"))),
duration_(readScalar(dict_.lookup("duration"))),
selectionMode_(wordToSelectionModeType(dict_.lookup("selectionMode"))),
cellSetName_("none"),
V_(1.0)
{
setSelection(dict_);
setCellSet();
}
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
{
word typeModel;
{
dict.lookup("typeModel") >> typeModel;
}
Info<< "Selecting model type " << typeModel << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(typeModel);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"basicSource::New(const volVectorField&, "
"const surfaceScalarField&, transportModel&)"
) << "Unknown Model type " << typeModel
<< endl << endl
<< "Valid model types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<basicSource>(cstrIter()(name, dict, mesh));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::basicSource::isActive()
{
if
(
active_
&& (mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= timeEnd())
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
setCellSet();
}
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,384 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::basicSource
Description
Basic source abtract class
Sources described by:
source1
{
typeModel actuationDiskSource; // explicitSource
active on; // on/off switch
timeStart 0.0; // start time
duration 1000.0; // duration
selectionMode cellSet; // cellSet // points //cellZone
cellSet c0; // cellSet name
actuationDiskSourceCoeffs
{
diskDir (-1 0 0); // orientation of the disk
Cp 0.53; // Cp
Ct 0.58; // Ct
diskArea 40; // disk area
}
}
source2
{
typeModel explicitSource;
active on;
timeStart 0.0;
duration 1000.0;
selectionMode points;
cellSet c0;
explicitSourceCoeffs
{
points // list of points when selectionMode = points
(
(-0.088 0.007 -0.02)
(-0.028 0.007 -0.02)
);
volumeMode specific; //absolute
fieldData //field data
{
k 30.7;
epsilon 1.5;
}
}
}
SourceFiles
basicSource.C
basicSourceIO.C
\*---------------------------------------------------------------------------*/
#ifndef basicSource_H
#define basicSource_H
#include "fvMatrices.H"
#include "cellSet.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class basicSource Declaration
\*---------------------------------------------------------------------------*/
class basicSource
{
public:
// Public data
//- Enumeration for selection mode types
enum selectionModeType
{
smPoints,
smCellSet,
smCellZone,
smAll
};
//- Word list of selection mode type names
static const wordList selectionModeTypeNames_;
protected:
// Protected data
//- Source name
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Dictionary containing the data of the source
const dictionary& dict_;
//- Source active flag
bool active_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Cell selection mode
selectionModeType selectionMode_;
//- Name of cell set for "cellSet" and "cellZone" selectionMode
word cellSetName_;
//- Set of cells to apply source to
labelList cells_;
//- Sum of cell volumes
scalar V_;
// Protected functions
//- Helper function to convert from a word to a selectionModeType
selectionModeType wordToSelectionModeType(const word& smtName) const;
//- Helper function to convert from a selectionModeType to a word
word selectionModeTypeToWord(const selectionModeType& smtType) const;
//- Set the cellSet or points selection
void setSelection(const dictionary& dict);
//- Set the cell set based on the user input selection mode
void setCellSet();
public:
//- Runtime type information
TypeName("basicSource");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
basicSource,
dictionary,
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
),
(name, dict, mesh)
);
// Constructors
//- Construct from components
basicSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Return clone
autoPtr<basicSource> clone() const
{
notImplemented
(
"autoPtr<basicSource> clone() const"
);
return autoPtr<basicSource>(NULL);
}
//- Return pointer to new basicSource object created
// on the freestore from an Istream
class iNew
{
//- Reference to the mesh database
const fvMesh& mesh_;
const word& name_;
public:
iNew
(
const fvMesh& mesh,
const word& name
)
:
mesh_(mesh),
name_(name)
{}
autoPtr<basicSource> operator()(Istream& is) const
{
//const word name(is);
const dictionary dict(is);
return autoPtr<basicSource>
(
basicSource::New
(
name_,
dict,
mesh_
)
);
}
};
// Selectors
//- Return a reference to the selected basicSource model
static autoPtr<basicSource> New
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~basicSource()
{}
// Member Functions
// Access
//- Return const access to the source name
inline const word& name() const;
//- Return const access to the mesh database
inline const fvMesh& mesh() const;
//- Return dictionay
inline const dictionary& dictCoeffs() const;
//- Return const access to the source active flag
inline bool active() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return const access to the cell selection mode
inline const selectionModeType& selectionMode() const;
//- Return const access to the name of cell set for "cellSet"
// selectionMode
inline const word& cellSetName() const;
//- Return const access to the total cell volume
inline scalar V() const;
//- Return const access to the cell set
inline const labelList& cells() const;
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the source active flag
inline bool& active();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
//- Return access to the cell selection mode
inline selectionModeType& selectionMode();
//- Return access to the list of points for "points" selectionMode
inline List<point>& points();
//- Return access to the name of cell set for "cellSet"
// selectionMode
inline word& cellSetName();
//- Return access to the total cell volume
inline scalar& V();
//- Return access to the cell set
inline labelList& cells();
// Checks
//- Is the source active?
bool isActive();
// Evaluation
//- Add all explicit sources
virtual void addExplicitSources() = 0;
//- Add source to scalar field
virtual void addSu(DimensionedField<scalar, volMesh>& field) = 0;
//- Add source to vector field
virtual void addSu(DimensionedField<vector, volMesh>& field) = 0;
//- Add source term to vector fvMatrix
virtual void addSu(fvMatrix<vector>& Eqn) = 0;
//- Add source term to scalar fvMatrix
virtual void addSu(fvMatrix<scalar>& Eqn) = 0;
// I-O
//- Write the source properties
virtual void writeData(Ostream&) const = 0;
//- Read source dictionary
virtual bool read(const dictionary& dict) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "basicSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::word& Foam::basicSource::name() const
{
return name_;
}
inline const Foam::fvMesh& Foam::basicSource::mesh() const
{
return mesh_;
}
inline const Foam::dictionary& Foam::basicSource::dictCoeffs() const
{
return dict_;
}
inline bool Foam::basicSource::active() const
{
return active_;
}
inline Foam::scalar Foam::basicSource::timeStart() const
{
return timeStart_;
}
inline Foam::scalar Foam::basicSource::duration() const
{
return duration_;
}
inline Foam::scalar Foam::basicSource::timeEnd() const
{
return timeStart_ + duration_;
}
inline const Foam::basicSource::selectionModeType&
Foam::basicSource::selectionMode() const
{
return selectionMode_;
}
inline const Foam::word&
Foam::basicSource::cellSetName() const
{
return cellSetName_;
}
inline Foam::scalar Foam::basicSource::V() const
{
return V_;
}
inline const Foam::labelList&
Foam::basicSource::cells() const
{
return cells_;
}
inline Foam::word& Foam::basicSource::name()
{
return name_;
}
inline bool& Foam::basicSource::active()
{
return active_;
}
inline Foam::scalar& Foam::basicSource::timeStart()
{
return timeStart_;
}
inline Foam::scalar& Foam::basicSource::duration()
{
return duration_;
}
inline Foam::word& Foam::basicSource::cellSetName()
{
return cellSetName_;
}
inline Foam::basicSource::selectionModeType&
Foam::basicSource::selectionMode()
{
return selectionMode_;
}
inline Foam::scalar& Foam::basicSource::V()
{
return V_;
}
inline Foam::labelList& Foam::basicSource::cells()
{
return cells_;
}
// ************************************************************************* //

View File

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "basicSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::basicSource::writeData(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
os.writeKeyword("selectionMode")
<< selectionModeTypeToWord(selectionMode_) << nl;
switch (selectionMode_)
{
case smPoints:
{
break;
}
case smCellSet:
{
os.writeKeyword("cellSet") << cellSetName_
<< token::END_STATEMENT << nl;
break;
}
default:
{
FatalErrorIn
(
"basicSource::writeData"
"("
"Ostream&, "
"bool"
") const"
) << "Unknown selectionMode "
<< selectionModeTypeToWord(selectionMode_)
<< abort(FatalError);
}
}
os << decrIndent << indent << token::END_BLOCK << endl;
}
bool Foam::basicSource::read(const dictionary& dict)
{
const dictionary& sourceDict = dict.subDict(name_);
active_ = readBool(sourceDict.lookup("active"));
timeStart_ = readScalar(sourceDict.lookup("timeStart"));
duration_ = readScalar(sourceDict.lookup("duration"));
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "basicSourceList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSourceList::basicSourceList
(
const fvMesh& mesh,
const dictionary& dict
)
:
PtrList<basicSource>(),
mesh_(mesh)
{
label count = 0;
forAllConstIter(dictionary, dict, iter)
{
// safety:
if (iter().isDict())
{
count ++;
}
}
this->setSize(count);
label i = 0;
forAllConstIter(dictionary, dict, iter)
{
const word& name = iter().keyword();
const dictionary& dict = iter().dict();
this->set
(
i++,
basicSource::New(name, dict, mesh)
);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::basicSourceList::addSu(fvMatrix<scalar>& Eqn)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(Eqn);
}
}
}
void Foam::basicSourceList::addSu(fvMatrix<vector>& Eqn)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(Eqn);
}
}
}
void Foam::basicSourceList::addExplicitSources()
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addExplicitSources();
}
}
}
void Foam::basicSourceList::addSu
(
DimensionedField<scalar, volMesh>& field
)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(field);
}
}
}
void Foam::basicSourceList::addSu
(
DimensionedField<vector, volMesh>& field
)
{
forAll(*this, i)
{
if (this->operator[](i).isActive())
{
this->operator[](i).addSu(field);
}
}
}
bool Foam::basicSourceList::read(const dictionary& dict)
{
forAll(*this, i)
{
this->operator[](i).read(dict);
}
return true;
}
bool Foam::basicSourceList::writeData(Ostream& os) const
{
// Write size of list
os << nl << this->size();
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
this->operator[](i).writeData(os);
}
// Write end of contents
os << token::END_LIST << token::END_STATEMENT << nl;
// Check state of IOstream
return os.good();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const basicSourceList& sources
)
{
sources.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::basicsourceList
Description
List of explict sources
SourceFile
basicSourceList.C
\*---------------------------------------------------------------------------*/
#ifndef basicSourceList_H
#define basicSourceList_H
#include "PtrList.H"
#include "DimensionedField.H"
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicSourceList Declaration
\*---------------------------------------------------------------------------*/
class basicSourceList
:
public PtrList<basicSource>
{
private:
// Private data
//- Reference to the mesh database
const fvMesh& mesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
basicSourceList
(
const basicSourceList&
);
//- Disallow default bitwise assignment
void operator=(const basicSourceList&);
public:
// Constructors
//- Construct from components with list of field names
basicSourceList
(
const fvMesh& mesh,
const dictionary& dict
);
// Destructor
virtual ~basicSourceList()
{}
// Member Functions
// Evaluation
//- Add all explicit sources
void addExplicitSources();
//- Add source to scalar field
void addSu(DimensionedField<scalar, volMesh>& field);
//- Add source to vector field
void addSu(DimensionedField<vector, volMesh>& field);
//- Add source terms to scalar fvMatrix
void addSu(fvMatrix<scalar>& Eq);
//- Add source terms to vector fvMatrix
void addSu(fvMatrix<vector>& Eq);
// I-O
//- Read dictionary
virtual bool read(const dictionary& dict);
//- Write data to Istream
virtual bool writeData(Ostream& os) const;
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const basicSourceList& sources
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,321 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "explicitSource.H"
#include "fvMesh.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "HashSet.H"
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(explicitSource, 0);
addToRunTimeSelectionTable
(
basicSource,
explicitSource,
dictionary
);
}
const Foam::wordList Foam::explicitSource::volumeModeTypeNames_
(
IStringStream("(absolute specific)")()
);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::explicitSource::setSelectedCellsFromPoints()
{
labelHashSet selectedCells;
forAll(points_, i)
{
label cellI = this->mesh().findCell(points_[i]);
if (cellI >= 0)
{
selectedCells.insert(cellI);
}
label globalCellI = returnReduce(cellI, maxOp<label>());
if (globalCellI < 0)
{
WarningIn
(
"explicitSource::setSelectedCellsFromPoints()"
)
<< "Unable to find owner cell for point " << points_[i]
<< endl;
}
}
this->cells() = selectedCells.toc();
}
template<class Type>
void Foam::explicitSource::addSources
(
Field<Type>& fieldSource,
Type& data
) const
{
forAll(this->cells(), i)
{
fieldSource[this->cells()[i]] = data/volSource_[i];
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::explicitSource::volumeModeType
Foam::explicitSource::wordToVolumeModeType
(
const word& vmtName
) const
{
forAll(volumeModeTypeNames_, i)
{
if (vmtName == volumeModeTypeNames_[i])
{
return volumeModeType(i);
}
}
FatalErrorIn
(
"explicitSource<Type>::volumeModeType"
"explicitSource<Type>::wordToVolumeModeType(const word&)"
) << "Unknown volumeMode type " << vmtName
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
<< exit(FatalError);
return volumeModeType(0);
}
Foam::word Foam::explicitSource::volumeModeTypeToWord
(
const volumeModeType& vmtType
) const
{
if (vmtType > volumeModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return volumeModeTypeNames_[vmtType];
}
}
template <class Type>
void Foam::explicitSource::addField
(
HashTable<Type>& fields,
const wordList& fieldTypes,
const wordList& fieldNames,
const dictionary& fieldDataDict
)
{
forAll (fieldTypes, fieldI)
{
word fieldName = fieldNames[fieldI];
word fieldType = fieldTypes[fieldI];
typedef GeometricField<Type, fvPatchField, volMesh> geometricField;
if
(
(
fieldType
== GeometricField<Type, fvPatchField, volMesh>::typeName
) &&
(
this->mesh().foundObject<geometricField>(fieldName)
)
)
{
Type fieldValue = fieldDataDict.lookupOrDefault<Type>
(
fieldName,
pTraits<Type>::zero
);
fields.insert(fieldName, fieldValue);
}
}
}
void Foam::explicitSource::setFieldData
(
const dictionary& dict
)
{
scalarFields_.clear();
vectorFields_.clear();
wordList fieldTypes(dict.toc().size());
wordList fieldNames(dict.toc().size());
forAll(dict.toc(), i)
{
const word& fieldName = dict.toc()[i];
IOobject io
(
fieldName,
this->mesh().time().timeName(0),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
if (io.headerOk())
{
fieldTypes[i] = io.headerClassName();
fieldNames[i] = dict.toc()[i];
}
else
{
FatalErrorIn
(
"explicitSource::setFieldData"
) << "header not OK " << io.name()
<< exit(FatalError);
}
}
addField(scalarFields_, fieldTypes, fieldNames, dict);
addField(vectorFields_, fieldTypes, fieldNames, dict);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::explicitSource::explicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, dict, mesh),
scalarFields_(0, *this),
vectorFields_(0, *this),
dict_(dict.subDict(typeName + "Coeffs")),
volumeMode_(wordToVolumeModeType(dict_.lookup("volumeMode"))),
points_(),
volSource_(this->cells().size(), 1.0)
{
setFieldData(dict_.subDict("fieldData"));
// Set points if selectionMode is smPoints
if (this->selectionMode() == smPoints)
{
dict_.lookup("points") >> points_;
setSelectedCellsFromPoints();
volSource_.setSize(points_.size(), 1.0);
}
const labelList& cellList = this->cells();
scalar V = 0.0;
if (volumeMode_ == vmAbsolute)
{
forAll(cellList, cellI)
{
volSource_[cellI] = mesh.V()[cellList[cellI]];
V += volSource_[cellI];
}
}
else
{
forAll(cellList, cellI)
{
V += mesh.V()[cellList[cellI]];
}
}
reduce(V, sumOp<scalar>());
Info<< "- selected " << returnReduce(cellList.size(), sumOp<label>())
<< " cell(s) with Volume: " << V << " in time activated sources "
<< endl;
}
void Foam::explicitSource::addSu
(
fvMatrix<scalar>& Eqn
)
{
Field<scalar>& source = Eqn.source();
scalar data = scalarFields_[Eqn.psi().name()];
addSources<scalar>(source, data);
}
void Foam::explicitSource::addSu
(
fvMatrix<vector>& Eqn
)
{
Field<vector>& source = Eqn.source();
vector data = vectorFields_[Eqn.psi().name()];
addSources<vector>(source, data);
}
void Foam::explicitSource::addSu
(
DimensionedField<scalar, volMesh>& field
)
{
scalar data = scalarFields_[field.name()];
addSources<scalar>(field, data);
}
void Foam::explicitSource::addSu
(
DimensionedField<vector, volMesh>& field
)
{
vector data = vectorFields_[field.name()];
addSources<vector>(field, data);
}
void Foam::explicitSource::addExplicitSources()
{
scalarFields_.applySources();
vectorFields_.applySources();
}
// ************************************************************************* //

View File

@ -0,0 +1,289 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::explicitSource
Description
Explicit source.
Sources described by:
explicitSourceCoeffs
{
points // list of points when selectionMode = points
(
(-0.088 0.007 -0.02)
(-0.028 0.007 -0.02)
);
volumeMode specific; //absolute
fieldData // field data - usage for multiple fields
{
k 30.7;
epsilon 1.5;
}
}
SourceFiles
explicitSource.C
\*---------------------------------------------------------------------------*/
#ifndef explicitSource_H
#define explicitSource_H
#include "cellSet.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
#include "basicSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class explicitSource Declaration
\*---------------------------------------------------------------------------*/
class explicitSource
:
public basicSource
{
// Private classes
template<class Type>
class fieldList
:
public HashTable<Type>
{
explicitSource& OwnerPtr_;
public:
//- null Constructor
fieldList()
:
HashTable<Type>(0),
OwnerPtr_()
{}
//- Constructor
fieldList(label size, explicitSource& ownerPtr)
:
HashTable<Type>(size),
OwnerPtr_(ownerPtr)
{}
void applySources()
{
typedef GeometricField<Type, fvPatchField, volMesh>
geometricField;
forAll(this->toc(), i)
{
geometricField& field = const_cast<geometricField&>
(
OwnerPtr_.mesh().lookupObject<geometricField>
(this->toc()[i])
);
Type data = this->operator[](field.name());
OwnerPtr_.addSources<Type>(field.internalField(), data);
}
}
};
private:
// Private cdata
//- List of field types
fieldList<scalar> scalarFields_;
fieldList<vector> vectorFields_;
//- Add field names and values to field table for types.
template<class Type>
void addField
(
HashTable<Type>& fields,
const wordList& fieldTypes,
const wordList& fieldNames,
const dictionary& dict_
);
//- Add data to field source
template<class Type>
void addSources
(
Field<Type>& fieldSource,
Type& data
) const;
public:
// Public data
//- Enumeration for volume types
enum volumeModeType
{
vmAbsolute,
vmSpecific
};
//- Word list of volume mode type names
static const wordList volumeModeTypeNames_;
protected:
// Protected data
//- Sub dictionary for time activated explicit sources
const dictionary& dict_;
//- Volume mode
volumeModeType volumeMode_;
//- List of points for "points" selectionMode
List<point> points_;
//- Volume of the explicit source
scalarList volSource_;
// Protected functions
//- Helper function to convert from a word to a volumeModeType
volumeModeType wordToVolumeModeType(const word& vtName) const;
//- Helper function to convert from a volumeModeType to a word
word volumeModeTypeToWord(const volumeModeType& vtType) const;
//- Set the local field data
void setFieldData(const dictionary& dict);
//- Set selected cells when smPoint is used
void setSelectedCellsFromPoints();
public:
//- Runtime type information
TypeName("explicitSource");
// Constructors
//- Construct from components
explicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh
);
//- Return clone
autoPtr<explicitSource> clone() const
{
notImplemented
(
"autoPtr<explicitSource> clone() const"
);
return autoPtr<explicitSource>(NULL);
}
// Member Functions
// Access
//- Return const access to the volume mode
inline const volumeModeType& volumeMode() const;
// Edit
//- Return access to the volume mode
inline volumeModeType& volumeMode();
//- Return points
inline const List<point>& points() const;
// Evaluation
//-Source term to fvMatrix<vector>
virtual void addSu(fvMatrix<vector>& UEqn);
//-Source term to fvMatrix<scalar>
virtual void addSu(fvMatrix<scalar>& UEqn);
//- Add all explicit source
virtual void addExplicitSources();
//- Add source to scalar field
virtual void addSu(DimensionedField<vector, volMesh>& field);
//- Add source to vector field
virtual void addSu(DimensionedField<scalar, volMesh>& field);
// I-O
//- Write the source properties
virtual void writeData(Ostream&) const;
//- Read fieldData in sub-dictionary
virtual bool read(const dictionary& dict);
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const explicitSource& source
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "explicitSourceIO.C"
#include "explicitSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "explicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::explicitSource::volumeModeType&
Foam::explicitSource::volumeMode() const
{
return volumeMode_;
}
inline Foam::explicitSource::volumeModeType&
Foam::explicitSource::volumeMode()
{
return volumeMode_;
}
inline const Foam::List<Foam::point>&
Foam::explicitSource::points() const
{
return points_;
}
// ************************************************************************* //

View File

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "explicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::explicitSource::writeData(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
<< token::END_STATEMENT << nl;
if (scalarFields_.size() > 0)
{
os.writeKeyword("scalarFields") << scalarFields_
<< token::END_STATEMENT << nl;
}
if (vectorFields_.size() > 0)
{
os.writeKeyword("vectorFields") << vectorFields_
<< token::END_STATEMENT << nl;
}
os << decrIndent << indent << token::END_BLOCK << endl;
}
bool Foam::explicitSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs = sourceDict.subDict(typeName + "Coeffs");
setFieldData(subDictCoeffs.subDict("fieldData"));
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const explicitSource& source
)
{
source.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "cylindricalInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
axialVelocity_(0),
centre_(pTraits<vector>::zero),
axis_(pTraits<vector>::zero),
rpm_(0),
radialVelocity_(0)
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
axialVelocity_(ptf.axialVelocity_),
centre_(ptf.centre_),
axis_(ptf.axis_),
rpm_(ptf.rpm_),
radialVelocity_(ptf.radialVelocity_)
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
axialVelocity_(readScalar(dict.lookup("axialVelocity"))),
centre_(dict.lookup("centre")),
axis_(dict.lookup("axis")),
rpm_(readScalar(dict.lookup("rpm"))),
radialVelocity_(readScalar(dict.lookup("radialVelocity")))
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
axialVelocity_(ptf.axialVelocity_),
centre_(ptf.centre_),
axis_(ptf.axis_),
rpm_(ptf.rpm_),
radialVelocity_(ptf.radialVelocity_)
{}
Foam::
cylindricalInletVelocityFvPatchVectorField::
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(ptf, iF),
axialVelocity_(ptf.axialVelocity_),
centre_(ptf.centre_),
axis_(ptf.axis_),
rpm_(ptf.rpm_),
radialVelocity_(ptf.radialVelocity_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
vector hatAxis = axis_/mag(axis_);
vectorField r = (patch().Cf() - centre_);
vectorField d = r - (hatAxis & r)*hatAxis;
vectorField tangVelo =
(rpm_*constant::mathematical::pi/30.0)*(hatAxis)^d;
operator==(tangVelo + axis_*axialVelocity_ + radialVelocity_*d);
fixedValueFvPatchField<vector>::updateCoeffs();
}
void Foam::cylindricalInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("axialVelocity") << axialVelocity_ <<
token::END_STATEMENT << nl;
os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl;
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
os.writeKeyword("radialVelocity") << radialVelocity_ <<
token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
cylindricalInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,175 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cylindricalInletVelocityFvPatchVectorField
Description
Describes an inlet vector boundary condition in cylindrical coordinates
given a central axis, central point, rpm, axial and radial velocity.
Example of the boundary condition specification:
@verbatim
inlet
{
type cylindricalInletVelocity;
axis (0 0 1);
centre (0 0 0);
axialVelocity 30;
rpm 100;
radialVelocity -10;
}
@endverbatim
SourceFiles
cylindricalInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef cylindricalInletVelocityFvPatchVectorField_H
#define cylindricalInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cylindricalInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class cylindricalInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Axial velocity
scalar axialVelocity_;
//- Central point
vector centre_;
//- Axis
vector axis_;
//- RPM
scalar rpm_;
//- Radial velocity
scalar radialVelocity_;
public:
//- Runtime type information
TypeName("cylindricalInletVelocity");
// Constructors
//- Construct from patch and internal field
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
cylindricalInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new cylindricalInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
cylindricalInletVelocityFvPatchVectorField
(
const cylindricalInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new cylindricalInletVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -10,7 +10,7 @@ License
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 2 of the License, or (at your
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

View File

@ -19,6 +19,7 @@ dynSmagorinsky/dynSmagorinsky.C
LRRDiffStress/LRRDiffStress.C
DeardorffDiffStress/DeardorffDiffStress.C
spectEddyVisc/spectEddyVisc.C
dynLagrangian/dynLagrangian.C
scaleSimilarity/scaleSimilarity.C
mixedSmagorinsky/mixedSmagorinsky.C

View File

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "dynLagrangian.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace LESModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(dynLagrangian, 0);
addToRunTimeSelectionTable(LESModel, dynLagrangian, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void dynLagrangian::updateSubGridScaleFields
(
const tmp<volTensorField>& gradU
)
{
nuSgs_ = (flm_/fmm_)*delta()*sqrt(k(gradU));
nuSgs_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
dynLagrangian::dynLagrangian
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
)
:
LESModel(typeName, U, phi, transport),
GenEddyVisc(U, phi, transport),
flm_
(
IOobject
(
"flm",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
fmm_
(
IOobject
(
"fmm",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
),
theta_
(
dimensioned<scalar>::lookupOrAddToDict
(
"theta",
coeffDict_,
1.5
)
),
simpleFilter_(U.mesh()),
filterPtr_(LESfilter::New(U.mesh(), coeffDict())),
filter_(filterPtr_()),
flm0_("flm0", flm_.dimensions(), 0.0),
fmm0_("fmm0", fmm_.dimensions(), VSMALL)
{
updateSubGridScaleFields(fvc::grad(U));
printCoeffs();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void dynLagrangian::correct(const tmp<volTensorField>& gradU)
{
LESModel::correct(gradU);
volSymmTensorField S = dev(symm(gradU()));
volScalarField magS = mag(S);
volVectorField Uf = filter_(U());
volSymmTensorField Sf = dev(symm(fvc::grad(Uf)));
volScalarField magSf = mag(Sf);
volSymmTensorField L = dev(filter_(sqr(U())) - (sqr(filter_(U()))));
volSymmTensorField M = 2.0*sqr(delta())*(filter_(magS*S) - 4.0*magSf*Sf);
volScalarField invT =
(1.0/(theta_.value()*delta()))*pow(flm_*fmm_, 1.0/8.0);
volScalarField LM = L && M;
fvScalarMatrix flmEqn
(
fvm::ddt(flm_)
+ fvm::div(phi(), flm_)
==
invT*LM
- fvm::Sp(invT, flm_)
);
flmEqn.relax();
flmEqn.solve();
bound(flm_, flm0_);
volScalarField MM = M && M;
fvScalarMatrix fmmEqn
(
fvm::ddt(fmm_)
+ fvm::div(phi(), fmm_)
==
invT*MM
- fvm::Sp(invT, fmm_)
);
fmmEqn.relax();
fmmEqn.solve();
bound(fmm_, fmm0_);
updateSubGridScaleFields(gradU);
}
bool dynLagrangian::read()
{
if (GenEddyVisc::read())
{
filter_.read(coeffDict());
theta_.readIfPresent(coeffDict());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,184 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::incompressible::LESModels::dynLagrangian
Description
Lagrangian Two Equations Eddy Viscosity Model for incompressible
flows
@verbatim
B = 2/3*k*I - 2*nuSgs*dev(D)
Beff = 2/3*k*I - 2*nuEff*dev(D)
where
D = symm(grad(U))
nuSgs = (flm/fmm)*delta^2*sqrt(2)*|D|
nuEff = nuSgs + nu
Two relaxation equations are used to evaluate flm and fmm:
d/dt(flm) + div(U*flm)
=
(1/T)*(L && M - flm)
d/dt(fmm) + div(U*fmm)
=
(1/T)*(M && M - flm)
where
L = F(U.U) - F(U).F(U)
M = 2.0 delta^2 (F(|D|.D) - 4 F(|D|).F(D))
T = 1.5*delta*(flm.fmm)^(-1.0/8.0)
@endverbatim
Reference:
1. Charles Meneveau, Thomas Lund and William Cabot
"A Lagrangian dynamic subgrid-scale model of turbulence"
J. Fluid Mech (1996), vol 319, pp. 353-385
SourceFiles
dynLagrangian.C
\*---------------------------------------------------------------------------*/
#ifndef dynLagrangian_H
#define dynLagrangian_H
#include "GenEddyVisc.H"
#include "simpleFilter.H"
#include "LESfilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class dynLagrangian Declaration
\*---------------------------------------------------------------------------*/
class dynLagrangian
:
public GenEddyVisc
{
// Private data
volScalarField flm_;
volScalarField fmm_;
dimensionedScalar theta_;
simpleFilter simpleFilter_;
autoPtr<LESfilter> filterPtr_;
LESfilter& filter_;
dimensionedScalar flm0_;
dimensionedScalar fmm0_;
// Private Member Functions
//- Update sub-grid scale fields
void updateSubGridScaleFields
(
const tmp<volTensorField>& gradU
);
// Disallow default bitwise copy construct and assignment
dynLagrangian(const dynLagrangian&);
dynLagrangian& operator=(const dynLagrangian&);
public:
//- Runtime type information
TypeName("dynLagrangian");
// Constructors
//- Construct from components
dynLagrangian
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
);
//- Destructor
virtual ~dynLagrangian()
{}
// Member Functions
//- Return SGS kinetic energy
tmp<volScalarField> k(const tmp<volTensorField>& gradU) const
{
return 2.0*sqr(delta())*magSqr(dev(symm(gradU)));
}
//- Return SGS kinetic energy
virtual tmp<volScalarField> k() const
{
return k(fvc::grad(U()));
}
//- Return the effective diffusivity for k
tmp<volScalarField> DkEff() const
{
return tmp<volScalarField>
(
new volScalarField("DkEff", nuSgs_ + nu())
);
}
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read LESProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -44,8 +44,8 @@ derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFv
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
derivedFvPatchFields/ABLInletEpsilon/ABLInletEpsilonFvPatchScalarField.C
derivedFvPatchFields/ABLInletVelocity/ABLInletVelocityFvPatchVectorField.C
derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "ABLInletEpsilonFvPatchScalarField.H"
#include "atmBoundaryLayerInletEpsilonFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -39,7 +39,8 @@ namespace incompressible
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField::
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -49,13 +50,15 @@ ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
Ustar_(0),
z_(pTraits<vector>::zero),
z0_(0),
kappa_(0.41)
kappa_(0.41),
zGround_(0)
{}
ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField::
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const ABLInletEpsilonFvPatchScalarField& ptf,
const atmBoundaryLayerInletEpsilonFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -65,11 +68,13 @@ ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
Ustar_(ptf.Ustar_),
z_(ptf.z_),
z0_(ptf.z0_),
kappa_(ptf.kappa_)
kappa_(ptf.kappa_),
zGround_(ptf.zGround_)
{}
ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField::
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -80,11 +85,12 @@ ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
Ustar_(readScalar(dict.lookup("Ustar"))),
z_(dict.lookup("z")),
z0_(readScalar(dict.lookup("z0"))),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41))
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
zGround_(readScalar(dict.lookup("zGround")))
{
if (mag(z_) < SMALL)
{
FatalErrorIn("ABLInletEpsilonFvPatchScalarField(dict)")
FatalErrorIn("atmBoundaryLayerInletEpsilonFvPatchScalarField(dict)")
<< "z is not correct"
<< abort(FatalError);
}
@ -95,9 +101,10 @@ ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
}
ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField::
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const ABLInletEpsilonFvPatchScalarField& fcvpvf,
const atmBoundaryLayerInletEpsilonFvPatchScalarField& fcvpvf,
const DimensionedField<scalar, volMesh>& iF
)
:
@ -105,22 +112,23 @@ ABLInletEpsilonFvPatchScalarField::ABLInletEpsilonFvPatchScalarField
Ustar_(fcvpvf.Ustar_),
z_(fcvpvf.z_),
z0_(fcvpvf.z0_),
kappa_(fcvpvf.kappa_)
kappa_(fcvpvf.kappa_),
zGround_(fcvpvf.zGround_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void ABLInletEpsilonFvPatchScalarField::updateCoeffs()
void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs()
{
const vectorField& c = patch().Cf();
scalarField coord = (c & z_);
scalarField::operator=(pow(Ustar_, 3.0)/(kappa_*(coord + z0_)));
scalarField::operator=(pow(Ustar_, 3.0)/(kappa_*(coord - zGround_ + z0_)));
}
// Write
void ABLInletEpsilonFvPatchScalarField::write(Ostream& os) const
void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("Ustar")
@ -131,13 +139,19 @@ void ABLInletEpsilonFvPatchScalarField::write(Ostream& os) const
<< z0_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa")
<< kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("zGround")
<< zGround_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, ABLInletEpsilonFvPatchScalarField);
makePatchTypeField
(
fvPatchScalarField,
atmBoundaryLayerInletEpsilonFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField
Description
Boundary condition specifies a epsilon inlet for the atmospheric boundary
@ -31,7 +31,7 @@ Description
ABLInletVelocity.
@verbatim
epsilon = Ustar^3 / (K(z + z0))
epsilon = Ustar^3 / (K(z - zGround + z0))
where:
@ -39,6 +39,7 @@ Description
K is karman's constant
z is the verical coordinate
z0 is the surface roughness lenght
zGround minium vlaue in z direction
@endverbatim
@ -49,12 +50,12 @@ Description
Journal of Wind Engineering and Industrial Aerodynamics 95(2007) 355-369.
SourceFiles
ABLInletEpsilonFvPatchScalarField.C
atmBoundaryLayerInletEpsilonFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef ABLInletEpsilonFvPatchScalarField_H
#define ABLInletEpsilonFvPatchScalarField_H
#ifndef atmBoundaryLayerInletEpsilonFvPatchScalarField_H
#define atmBoundaryLayerInletEpsilonFvPatchScalarField_H
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H"
@ -67,16 +68,16 @@ namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class ABLInletEpsilonFvPatchScalarField Declaration
Class atmBoundaryLayerInletEpsilonFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class ABLInletEpsilonFvPatchScalarField
class atmBoundaryLayerInletEpsilonFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Peak velocity magnitude
//- Frictional velocity
scalar Ustar_;
//- Direction of the z-coordinate
@ -88,34 +89,37 @@ class ABLInletEpsilonFvPatchScalarField
//- Von Karman constant
scalar kappa_;
//- Minimum corrdinate value in z direction
scalar zGround_;
public:
//- Runtime type information
TypeName("ABLInletEpsilon");
TypeName("atmBoundaryLayerInletEpsilon");
// Constructors
//- Construct from patch and internal field
ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given ABLInletEpsilonFvPatchScalarField
// onto a new patch
ABLInletEpsilonFvPatchScalarField
//- Construct by mapping given
// atmBoundaryLayerInletEpsilonFvPatchScalarField onto a new patch
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const ABLInletEpsilonFvPatchScalarField&,
const atmBoundaryLayerInletEpsilonFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
@ -126,14 +130,14 @@ public:
{
return tmp<fvPatchScalarField>
(
new ABLInletEpsilonFvPatchScalarField(*this)
new atmBoundaryLayerInletEpsilonFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
ABLInletEpsilonFvPatchScalarField
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const ABLInletEpsilonFvPatchScalarField&,
const atmBoundaryLayerInletEpsilonFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -145,7 +149,7 @@ public:
{
return tmp<fvPatchScalarField>
(
new ABLInletEpsilonFvPatchScalarField(*this, iF)
new atmBoundaryLayerInletEpsilonFvPatchScalarField(*this, iF)
);
}

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "ABLInletVelocityFvPatchVectorField.H"
#include "atmBoundaryLayerInletVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -39,7 +39,8 @@ namespace incompressible
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField::
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
@ -50,13 +51,17 @@ ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
n_(pTraits<vector>::zero),
z_(pTraits<vector>::zero),
z0_(0),
kappa_(0.41)
kappa_(0.41),
Uref_(0),
Href_(0),
zGround_(0)
{}
ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField::
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const ABLInletVelocityFvPatchVectorField& ptf,
const atmBoundaryLayerInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -67,11 +72,15 @@ ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
n_(ptf.n_),
z_(ptf.z_),
z0_(ptf.z0_),
kappa_(ptf.kappa_)
kappa_(ptf.kappa_),
Uref_(ptf.Uref_),
Href_(ptf.Href_),
zGround_(ptf.zGround_)
{}
ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField::
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
@ -79,29 +88,35 @@ ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
Ustar_(readScalar(dict.lookup("Ustar"))),
Ustar_(0),
n_(dict.lookup("n")),
z_(dict.lookup("z")),
z0_(readScalar(dict.lookup("z0"))),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41))
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Uref_(readScalar(dict.lookup("Uref"))),
Href_(readScalar(dict.lookup("Href"))),
zGround_(readScalar(dict.lookup("zGround")))
{
if (mag(n_) < SMALL || mag(z_) < SMALL)
if (mag(n_) < SMALL || mag(z_) < SMALL || mag(z0_) < SMALL)
{
FatalErrorIn("ABLInletVelocityFvPatchVectorField(dict)")
<< "n or z given with zero size not correct"
FatalErrorIn("atmBoundaryLayerInletVelocityFvPatchVectorField(dict)")
<< "n, z or z0 given are close to zero is not correct"
<< abort(FatalError);
}
n_ /= mag(n_);
z_ /= mag(z_);
Ustar_ = kappa_*Uref_/(log((Href_ + z0_)/min(z0_ , 0.001)));
evaluate();
}
ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField::
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const ABLInletVelocityFvPatchVectorField& fcvpvf,
const atmBoundaryLayerInletVelocityFvPatchVectorField& fcvpvf,
const DimensionedField<vector, volMesh>& iF
)
:
@ -110,41 +125,68 @@ ABLInletVelocityFvPatchVectorField::ABLInletVelocityFvPatchVectorField
n_(fcvpvf.n_),
z_(fcvpvf.z_),
z0_(fcvpvf.z0_),
kappa_(fcvpvf.kappa_)
kappa_(fcvpvf.kappa_),
Uref_(fcvpvf.Uref_),
Href_(fcvpvf.Href_),
zGround_(fcvpvf.zGround_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void ABLInletVelocityFvPatchVectorField::updateCoeffs()
void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs()
{
const vectorField& c = patch().Cf();
scalarField coord = (c & z_);
vectorField::operator=(n_*(Ustar_/kappa_)*log((coord + z0_)/z0_));
scalarField Un(coord.size());
forAll(coord, i)
{
if((coord[i] - zGround_) < Href_)
{
Un[i] = (Ustar_/kappa_)*log((coord[i] - zGround_ + z0_)/z0_);
}
else
{
Un[i] = (Uref_);
}
}
vectorField::operator=(n_*Un);
fixedValueFvPatchVectorField::updateCoeffs();
}
// Write
void ABLInletVelocityFvPatchVectorField::write(Ostream& os) const
void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("Ustar")
<< Ustar_ << token::END_STATEMENT << nl;
os.writeKeyword("z0")
<< z0_ << token::END_STATEMENT << nl;
os.writeKeyword("n")
<< n_ << token::END_STATEMENT << nl;
os.writeKeyword("z")
<< z_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa")
os.writeKeyword("kappa")
<< kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Uref")
<< Uref_ << token::END_STATEMENT << nl;
os.writeKeyword("Href")
<< Href_ << token::END_STATEMENT << nl;
os.writeKeyword("zGround")
<< zGround_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchVectorField, ABLInletVelocityFvPatchVectorField);
makePatchTypeField
(
fvPatchVectorField,
atmBoundaryLayerInletVelocityFvPatchVectorField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField
Description
Boundary condition specifies a atmospheric boundary layer (ABL)
@ -31,7 +31,7 @@ Description
flow direction n and direction of the parabolic coordinate z.
@verbatim
U = (Ustar/K) ln((z + z0)/z0)
U = (Ustar/K) ln((z - zGround + z0)/z0)
where:
@ -39,6 +39,7 @@ Description
K is karman's constant
z0 is the surface roughness lenght
z is the verical coordinate
zGround is the minumum coordinate value in z direction.
and:
@ -63,12 +64,12 @@ NOTE: D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the k-epsilon
reference
SourceFiles
ABLInletVelocityFvPatchVectorField.C
atmBoundaryLayerInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef ABLInletVelocityFvPatchVectorField_H
#define ABLInletVelocityFvPatchVectorField_H
#ifndef atmBoundaryLayerInletVelocityFvPatchVectorField_H
#define atmBoundaryLayerInletVelocityFvPatchVectorField_H
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H"
@ -81,16 +82,16 @@ namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class ABLInletVelocityFvPatchVectorField Declaration
Class atmBoundaryLayerInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class ABLInletVelocityFvPatchVectorField
class atmBoundaryLayerInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Friction velocity
//- Frictional velocity
scalar Ustar_;
//- Flow direction
@ -105,34 +106,43 @@ class ABLInletVelocityFvPatchVectorField
//- Von Karman constant
scalar kappa_;
//- Reference velocity
scalar Uref_;
//- Reference hight
scalar Href_;
//- Minimum corrdinate value in z direction
scalar zGround_;
public:
//- Runtime type information
TypeName("ABLInletVelocity");
TypeName("atmBoundaryLayerInletVelocity");
// Constructors
//- Construct from patch and internal field
ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given ABLInletVelocityFvPatchVectorField
//- Construct by mapping given atmBoundaryLayerInletVelocityFvPatchVectorField
// onto a new patch
ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const ABLInletVelocityFvPatchVectorField&,
const atmBoundaryLayerInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
@ -143,14 +153,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new ABLInletVelocityFvPatchVectorField(*this)
new atmBoundaryLayerInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
ABLInletVelocityFvPatchVectorField
atmBoundaryLayerInletVelocityFvPatchVectorField
(
const ABLInletVelocityFvPatchVectorField&,
const atmBoundaryLayerInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -162,14 +172,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new ABLInletVelocityFvPatchVectorField(*this, iF)
new atmBoundaryLayerInletVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
//- Return max value
//- Return Ustar
scalar& Ustar()
{
return Ustar_;
@ -181,7 +191,7 @@ public:
return n_;
}
//- Return y direction
//- Return z direction
vector& z()
{
return z_;