ENH: finiteArea - integration updates

This commit is contained in:
Andrew Heather
2017-12-19 17:07:08 +00:00
parent d20b981fef
commit f187dd8aa3
16 changed files with 1161 additions and 38 deletions

View File

@ -15,7 +15,6 @@ EXE_LIBS = \
-ldecompositionMethods \ -ldecompositionMethods \
-L$(FOAM_LIBBIN)/dummy \ -L$(FOAM_LIBBIN)/dummy \
-lkahipDecomp -lmetisDecomp -lscotchDecomp \ -lkahipDecomp -lmetisDecomp -lscotchDecomp \
-lfiniteArea \
-llagrangian \ -llagrangian \
-ldynamicMesh \ -ldynamicMesh \
-lregionModels -lregionModels

View File

@ -40,9 +40,8 @@ wmakeLnInclude -u fvOptions
wmake $targetType finiteVolume wmake $targetType finiteVolume
wmake $targetType lagrangian/basic wmake $targetType lagrangian/basic
wmake $targetType lagrangian/distributionModels wmake $targetType lagrangian/distributionModels
wmake $targetType genericPatchFields
wmake $targetType finiteArea wmake $targetType finiteArea
wmake $targetType genericPatchFields
conversion/Allwmake $targetType $* conversion/Allwmake $targetType $*
wmake $targetType mesh/extrudeModel wmake $targetType mesh/extrudeModel

View File

@ -140,8 +140,8 @@ Foam::calculatedFaPatchField<Type>::valueInternalCoeffs
FatalErrorInFunction FatalErrorInFunction
<< "valueInternalCoeffs cannot be called for a calculatedFaPatchField" << "valueInternalCoeffs cannot be called for a calculatedFaPatchField"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a " << "\n You are probably trying to solve for a field with a "
"default boundary condition." "default boundary condition."
<< exit(FatalError); << exit(FatalError);
@ -160,8 +160,8 @@ Foam::calculatedFaPatchField<Type>::valueBoundaryCoeffs
FatalErrorInFunction FatalErrorInFunction
<< "valueBoundaryCoeffs cannot be called for a calculatedFaPatchField" << "valueBoundaryCoeffs cannot be called for a calculatedFaPatchField"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a " << "\n You are probably trying to solve for a field with a "
"default boundary condition." "default boundary condition."
<< exit(FatalError); << exit(FatalError);
@ -178,8 +178,8 @@ Foam::calculatedFaPatchField<Type>::gradientInternalCoeffs() const
<< "gradientInternalCoeffs cannot be called for a " << "gradientInternalCoeffs cannot be called for a "
"calculatedFaPatchField" "calculatedFaPatchField"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a " << "\n You are probably trying to solve for a field with a "
"default boundary condition." "default boundary condition."
<< exit(FatalError); << exit(FatalError);
@ -197,8 +197,8 @@ Foam::calculatedFaPatchField<Type>::gradientBoundaryCoeffs() const
"gradientBoundaryCoeffs cannot be called for a " "gradientBoundaryCoeffs cannot be called for a "
"calculatedFaPatchField" "calculatedFaPatchField"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a " << "\n You are probably trying to solve for a field with a "
"default boundary condition." "default boundary condition."
<< exit(FatalError); << exit(FatalError);

View File

@ -59,8 +59,8 @@ Foam::cyclicFaPatchField<Type>::cyclicFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
@ -83,8 +83,8 @@ Foam::cyclicFaPatchField<Type>::cyclicFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
@ -122,7 +122,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::tmp<Foam::Field<Type>>
Foam::cyclicFaPatchField<Type>::patchNeighbourField() const Foam::cyclicFaPatchField<Type>::patchNeighbourField() const
{ {
const Field<Type>& iField = this->internalField(); const Field<Type>& iField = this->primitiveField();
const labelUList& faceCells = cyclicPatch_.faceCells(); const labelUList& faceCells = cyclicPatch_.faceCells();
tmp<Field<Type>> tpnf(new Field<Type>(this->size())); tmp<Field<Type>> tpnf(new Field<Type>(this->size()));

View File

@ -59,8 +59,8 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
@ -82,8 +82,8 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
@ -98,7 +98,7 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
faPatchField<Type> faPatchField<Type>
( (
ptf.patch(), ptf.patch(),
ptf.dimensionedInternalField(), ptf.internalField(),
Field<Type>(0) Field<Type>(0)
) )
{} {}
@ -120,12 +120,12 @@ Foam::emptyFaPatchField<Type>::emptyFaPatchField
template<class Type> template<class Type>
void Foam::emptyFaPatchField<Type>::updateCoeffs() void Foam::emptyFaPatchField<Type>::updateCoeffs()
{ {
if (this->dimensionedInternalField().mesh().nFaces()) if (this->internalField().mesh().nFaces())
{ {
if if
( (
this->patch().faPatch::size() this->patch().faPatch::size()
% this->dimensionedInternalField().mesh().nFaces() % this->internalField().mesh().nFaces()
) )
{ {
FatalErrorInFunction FatalErrorInFunction

View File

@ -76,8 +76,8 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
@ -100,8 +100,8 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }

View File

@ -57,8 +57,8 @@ Foam::symmetryFaPatchField<Type>::symmetryFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
@ -80,8 +80,8 @@ Foam::symmetryFaPatchField<Type>::symmetryFaPatchField
<< "\n patch type '" << p.type() << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'" << "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name() << "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name() << " of field " << this->internalField().name()
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->internalField().objectPath()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }

View File

@ -270,14 +270,13 @@ public:
} }
//- Return dimensioned internal field reference //- Return dimensioned internal field reference
const DimensionedField<Type, areaMesh>& const DimensionedField<Type, areaMesh>& internalField() const
dimensionedInternalField() const
{ {
return internalField_; return internalField_;
} }
//- Return internal field reference //- Return internal field reference
const Field<Type>& internalField() const const Field<Type>& primitiveField() const
{ {
return internalField_; return internalField_;
} }

View File

@ -93,7 +93,7 @@ Foam::emptyFaePatchField<Type>::emptyFaePatchField
faePatchField<Type> faePatchField<Type>
( (
ptf.patch(), ptf.patch(),
ptf.dimensionedInternalField(), ptf.internalField(),
Field<Type>(0) Field<Type>(0)
) )
{} {}

View File

@ -270,14 +270,13 @@ public:
} }
//- Return dimensioned internal field reference //- Return dimensioned internal field reference
const DimensionedField<Type, edgeMesh>& const DimensionedField<Type, edgeMesh>& internalField() const
dimensionedInternalField() const
{ {
return internalField_; return internalField_;
} }
//- Return internal field reference //- Return internal field reference
const Field<Type>& internalField() const const Field<Type>& primitiveField() const
{ {
return internalField_; return internalField_;
} }

View File

@ -1,3 +1,4 @@
genericFaPatchField/genericFaPatchFields.C
genericFvPatchField/genericFvPatchFields.C genericFvPatchField/genericFvPatchFields.C
genericPointPatchField/genericPointPatchFields.C genericPointPatchField/genericPointPatchFields.C

View File

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

View File

@ -0,0 +1,828 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 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 "genericFaPatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::genericFaPatchField<Type>::genericFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF
)
:
calculatedFaPatchField<Type>(p, iF)
{
FatalErrorInFunction
<< "Trying to construct an genericFaPatchField on patch "
<< this->patch().name()
<< " of field " << this->internalField().name()
<< abort(FatalError);
}
template<class Type>
Foam::genericFaPatchField<Type>::genericFaPatchField
(
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const dictionary& dict
)
:
calculatedFaPatchField<Type>(p, iF, dict),
actualTypeName_(dict.lookup("type")),
dict_(dict)
{
if (!dict.found("value"))
{
FatalIOErrorInFunction
(
dict
) << "\n Cannot find 'value' entry"
<< " on patch " << this->patch().name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< nl
<< " which is required to set the"
" values of the generic patch field." << nl
<< " (Actual type " << actualTypeName_ << ")" << nl
<< "\n Please add the 'value' entry to the write function "
"of the user-defined boundary-condition\n"
<< exit(FatalIOError);
}
forAllConstIter(dictionary, dict_, iter)
{
if (iter().keyword() != "type" && iter().keyword() != "value")
{
if
(
iter().isStream()
&& iter().stream().size()
)
{
ITstream& is = iter().stream();
// Read first token
token firstToken(is);
if
(
firstToken.isWord()
&& firstToken.wordToken() == "nonuniform"
)
{
token fieldToken(is);
if (!fieldToken.isCompound())
{
if
(
fieldToken.isLabel()
&& fieldToken.labelToken() == 0
)
{
scalarFields_.insert
(
iter().keyword(),
new scalarField(0)
);
}
else
{
FatalIOErrorInFunction
(
dict
) << "\n token following 'nonuniform' "
"is not a compound"
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
}
else if
(
fieldToken.compoundToken().type()
== token::Compound<List<scalar>>::typeName
)
{
scalarField* fPtr = new scalarField;
fPtr->transfer
(
dynamicCast<token::Compound<List<scalar>>>
(
fieldToken.transferCompoundToken(is)
)
);
if (fPtr->size() != this->size())
{
FatalIOErrorInFunction
(
dict
) << "\n size of field " << iter().keyword()
<< " (" << fPtr->size() << ')'
<< " is not the same size as the patch ("
<< this->size() << ')'
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
scalarFields_.insert(iter().keyword(), fPtr);
}
else if
(
fieldToken.compoundToken().type()
== token::Compound<List<vector>>::typeName
)
{
vectorField* fPtr = new vectorField;
fPtr->transfer
(
dynamicCast<token::Compound<List<vector>>>
(
fieldToken.transferCompoundToken(is)
)
);
if (fPtr->size() != this->size())
{
FatalIOErrorInFunction
(
dict
) << "\n size of field " << iter().keyword()
<< " (" << fPtr->size() << ')'
<< " is not the same size as the patch ("
<< this->size() << ')'
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
vectorFields_.insert(iter().keyword(), fPtr);
}
else if
(
fieldToken.compoundToken().type()
== token::Compound<List<sphericalTensor>>::typeName
)
{
sphericalTensorField* fPtr = new sphericalTensorField;
fPtr->transfer
(
dynamicCast
<
token::Compound<List<sphericalTensor>>
>
(
fieldToken.transferCompoundToken(is)
)
);
if (fPtr->size() != this->size())
{
FatalIOErrorInFunction
(
dict
) << "\n size of field " << iter().keyword()
<< " (" << fPtr->size() << ')'
<< " is not the same size as the patch ("
<< this->size() << ')'
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
sphericalTensorFields_.insert(iter().keyword(), fPtr);
}
else if
(
fieldToken.compoundToken().type()
== token::Compound<List<symmTensor>>::typeName
)
{
symmTensorField* fPtr = new symmTensorField;
fPtr->transfer
(
dynamicCast
<
token::Compound<List<symmTensor>>
>
(
fieldToken.transferCompoundToken(is)
)
);
if (fPtr->size() != this->size())
{
FatalIOErrorInFunction
(
dict
) << "\n size of field " << iter().keyword()
<< " (" << fPtr->size() << ')'
<< " is not the same size as the patch ("
<< this->size() << ')'
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
symmTensorFields_.insert(iter().keyword(), fPtr);
}
else if
(
fieldToken.compoundToken().type()
== token::Compound<List<tensor>>::typeName
)
{
tensorField* fPtr = new tensorField;
fPtr->transfer
(
dynamicCast<token::Compound<List<tensor>>>
(
fieldToken.transferCompoundToken(is)
)
);
if (fPtr->size() != this->size())
{
FatalIOErrorInFunction
(
dict
) << "\n size of field " << iter().keyword()
<< " (" << fPtr->size() << ')'
<< " is not the same size as the patch ("
<< this->size() << ')'
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
tensorFields_.insert(iter().keyword(), fPtr);
}
else
{
FatalIOErrorInFunction
(
dict
) << "\n compound " << fieldToken.compoundToken()
<< " not supported"
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
}
else if
(
firstToken.isWord()
&& firstToken.wordToken() == "uniform"
)
{
token fieldToken(is);
if (!fieldToken.isPunctuation())
{
scalarFields_.insert
(
iter().keyword(),
new scalarField
(
this->size(),
fieldToken.number()
)
);
}
else
{
// Read as scalarList.
is.putBack(fieldToken);
scalarList l(is);
if (l.size() == vector::nComponents)
{
vector vs(l[0], l[1], l[2]);
vectorFields_.insert
(
iter().keyword(),
new vectorField(this->size(), vs)
);
}
else if (l.size() == sphericalTensor::nComponents)
{
sphericalTensor vs(l[0]);
sphericalTensorFields_.insert
(
iter().keyword(),
new sphericalTensorField(this->size(), vs)
);
}
else if (l.size() == symmTensor::nComponents)
{
symmTensor vs(l[0], l[1], l[2], l[3], l[4], l[5]);
symmTensorFields_.insert
(
iter().keyword(),
new symmTensorField(this->size(), vs)
);
}
else if (l.size() == tensor::nComponents)
{
tensor vs
(
l[0], l[1], l[2],
l[3], l[4], l[5],
l[6], l[7], l[8]
);
tensorFields_.insert
(
iter().keyword(),
new tensorField(this->size(), vs)
);
}
else
{
FatalIOErrorInFunction
(
dict
) << "\n unrecognised native type " << l
<< "\n on patch " << this->patch().name()
<< " of field "
<< this->internalField().name()
<< " in file "
<< this->internalField().objectPath()
<< exit(FatalIOError);
}
}
}
}
}
}
}
template<class Type>
Foam::genericFaPatchField<Type>::genericFaPatchField
(
const genericFaPatchField<Type>& ptf,
const faPatch& p,
const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper
)
:
calculatedFaPatchField<Type>(ptf, p, iF, mapper),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_)
{
forAllConstIter
(
HashPtrTable<scalarField>,
ptf.scalarFields_,
iter
)
{
scalarFields_.insert
(
iter.key(),
new scalarField(*iter(), mapper)
);
}
forAllConstIter
(
HashPtrTable<vectorField>,
ptf.vectorFields_,
iter
)
{
vectorFields_.insert
(
iter.key(),
new vectorField(*iter(), mapper)
);
}
forAllConstIter
(
HashPtrTable<sphericalTensorField>,
ptf.sphericalTensorFields_,
iter
)
{
sphericalTensorFields_.insert
(
iter.key(),
new sphericalTensorField(*iter(), mapper)
);
}
forAllConstIter
(
HashPtrTable<symmTensorField>,
ptf.symmTensorFields_,
iter
)
{
symmTensorFields_.insert
(
iter.key(),
new symmTensorField(*iter(), mapper)
);
}
forAllConstIter
(
HashPtrTable<tensorField>,
ptf.tensorFields_,
iter
)
{
tensorFields_.insert
(
iter.key(),
new tensorField(*iter(), mapper)
);
}
}
template<class Type>
Foam::genericFaPatchField<Type>::genericFaPatchField
(
const genericFaPatchField<Type>& ptf
)
:
calculatedFaPatchField<Type>(ptf),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_),
scalarFields_(ptf.scalarFields_),
vectorFields_(ptf.vectorFields_),
sphericalTensorFields_(ptf.sphericalTensorFields_),
symmTensorFields_(ptf.symmTensorFields_),
tensorFields_(ptf.tensorFields_)
{}
template<class Type>
Foam::genericFaPatchField<Type>::genericFaPatchField
(
const genericFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF
)
:
calculatedFaPatchField<Type>(ptf, iF),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_),
scalarFields_(ptf.scalarFields_),
vectorFields_(ptf.vectorFields_),
sphericalTensorFields_(ptf.sphericalTensorFields_),
symmTensorFields_(ptf.symmTensorFields_),
tensorFields_(ptf.tensorFields_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::genericFaPatchField<Type>::autoMap
(
const faPatchFieldMapper& m
)
{
calculatedFaPatchField<Type>::autoMap(m);
forAllIter
(
HashPtrTable<scalarField>,
scalarFields_,
iter
)
{
iter()->autoMap(m);
}
forAllIter
(
HashPtrTable<vectorField>,
vectorFields_,
iter
)
{
iter()->autoMap(m);
}
forAllIter
(
HashPtrTable<sphericalTensorField>,
sphericalTensorFields_,
iter
)
{
iter()->autoMap(m);
}
forAllIter
(
HashPtrTable<symmTensorField>,
symmTensorFields_,
iter
)
{
iter()->autoMap(m);
}
forAllIter
(
HashPtrTable<tensorField>,
tensorFields_,
iter
)
{
iter()->autoMap(m);
}
}
template<class Type>
void Foam::genericFaPatchField<Type>::rmap
(
const faPatchField<Type>& ptf,
const labelList& addr
)
{
calculatedFaPatchField<Type>::rmap(ptf, addr);
const genericFaPatchField<Type>& dptf =
refCast<const genericFaPatchField<Type>>(ptf);
forAllIter
(
HashPtrTable<scalarField>,
scalarFields_,
iter
)
{
HashPtrTable<scalarField>::const_iterator dptfIter =
dptf.scalarFields_.find(iter.key());
if (dptfIter != dptf.scalarFields_.end())
{
iter()->rmap(*dptfIter(), addr);
}
}
forAllIter
(
HashPtrTable<vectorField>,
vectorFields_,
iter
)
{
HashPtrTable<vectorField>::const_iterator dptfIter =
dptf.vectorFields_.find(iter.key());
if (dptfIter != dptf.vectorFields_.end())
{
iter()->rmap(*dptfIter(), addr);
}
}
forAllIter
(
HashPtrTable<sphericalTensorField>,
sphericalTensorFields_,
iter
)
{
HashPtrTable<sphericalTensorField>::const_iterator dptfIter =
dptf.sphericalTensorFields_.find(iter.key());
if (dptfIter != dptf.sphericalTensorFields_.end())
{
iter()->rmap(*dptfIter(), addr);
}
}
forAllIter
(
HashPtrTable<symmTensorField>,
symmTensorFields_,
iter
)
{
HashPtrTable<symmTensorField>::const_iterator dptfIter =
dptf.symmTensorFields_.find(iter.key());
if (dptfIter != dptf.symmTensorFields_.end())
{
iter()->rmap(*dptfIter(), addr);
}
}
forAllIter
(
HashPtrTable<tensorField>,
tensorFields_,
iter
)
{
HashPtrTable<tensorField>::const_iterator dptfIter =
dptf.tensorFields_.find(iter.key());
if (dptfIter != dptf.tensorFields_.end())
{
iter()->rmap(*dptfIter(), addr);
}
}
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::genericFaPatchField<Type>::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
FatalErrorInFunction
<< "cannot be called for a genericFaPatchField"
" (actual type " << actualTypeName_ << ")"
<< "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a "
"generic boundary condition."
<< abort(FatalError);
return *this;
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::genericFaPatchField<Type>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
FatalErrorInFunction
<< "cannot be called for a genericFaPatchField"
" (actual type " << actualTypeName_ << ")"
<< "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a "
"generic boundary condition."
<< abort(FatalError);
return *this;
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::genericFaPatchField<Type>::gradientInternalCoeffs() const
{
FatalErrorInFunction
<< "cannot be called for a genericFaPatchField"
" (actual type " << actualTypeName_ << ")"
<< "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a "
"generic boundary condition."
<< abort(FatalError);
return *this;
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::genericFaPatchField<Type>::gradientBoundaryCoeffs() const
{
FatalErrorInFunction
<< "cannot be called for a genericFaPatchField"
" (actual type " << actualTypeName_ << ")"
<< "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< "\n You are probably trying to solve for a field with a "
"generic boundary condition."
<< abort(FatalError);
return *this;
}
template<class Type>
const Foam::word& Foam::genericFaPatchField<Type>::actualType() const
{
return actualTypeName_;
}
template<class Type>
void Foam::genericFaPatchField<Type>::write(Ostream& os) const
{
os.writeEntry("type", actualTypeName_);
forAllConstIter(dictionary, dict_, iter)
{
if (iter().keyword() != "type" && iter().keyword() != "value")
{
if
(
iter().isStream()
&& iter().stream().size()
&& iter().stream()[0].isWord()
&& iter().stream()[0].wordToken() == "nonuniform"
)
{
if (scalarFields_.found(iter().keyword()))
{
scalarFields_.find(iter().keyword())()
->writeEntry(iter().keyword(), os);
}
else if (vectorFields_.found(iter().keyword()))
{
vectorFields_.find(iter().keyword())()
->writeEntry(iter().keyword(), os);
}
else if (sphericalTensorFields_.found(iter().keyword()))
{
sphericalTensorFields_.find(iter().keyword())()
->writeEntry(iter().keyword(), os);
}
else if (symmTensorFields_.found(iter().keyword()))
{
symmTensorFields_.find(iter().keyword())()
->writeEntry(iter().keyword(), os);
}
else if (tensorFields_.found(iter().keyword()))
{
tensorFields_.find(iter().keyword())()
->writeEntry(iter().keyword(), os);
}
}
else
{
iter().write(os);
}
}
}
this->writeEntry("value", os);
}
// ************************************************************************* //

View File

@ -0,0 +1,204 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 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::genericFaPatchField
Description
This boundary condition provides a generic version of the \c calculated
condition, useful as a fallback for handling unknown patch types. Not
generally applicable as a user-specified condition.
See also
Foam::calculatedFaPatchField
SourceFiles
genericFaPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef genericFaPatchField_H
#define genericFaPatchField_H
#include "calculatedFaPatchField.H"
#include "HashPtrTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class genericFaPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class genericFaPatchField
:
public calculatedFaPatchField<Type>
{
// Private data
const word actualTypeName_;
dictionary dict_;
HashPtrTable<scalarField> scalarFields_;
HashPtrTable<vectorField> vectorFields_;
HashPtrTable<sphericalTensorField> sphericalTensorFields_;
HashPtrTable<symmTensorField> symmTensorFields_;
HashPtrTable<tensorField> tensorFields_;
public:
//- Runtime type information
TypeName("generic");
// Constructors
//- Construct from patch and internal field
genericFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&
);
//- Construct from patch, internal field and dictionary
genericFaPatchField
(
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
genericFaPatchField
(
const genericFaPatchField<Type>&,
const faPatch&,
const DimensionedField<Type, areaMesh>&,
const faPatchFieldMapper&
);
//- Construct as copy
genericFaPatchField
(
const genericFaPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<faPatchField<Type>> clone() const
{
return tmp<faPatchField<Type>>
(
new genericFaPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
genericFaPatchField
(
const genericFaPatchField<Type>&,
const DimensionedField<Type, areaMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<faPatchField<Type>> clone
(
const DimensionedField<Type, areaMesh>& iF
) const
{
return tmp<faPatchField<Type>>
(
new genericFaPatchField<Type>(*this, iF)
);
}
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const faPatchFieldMapper&
);
//- Reverse map the given faPatchField onto this faPatchField
virtual void rmap
(
const faPatchField<Type>&,
const labelList&
);
// Evaluation functions
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<Field<Type>> valueInternalCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the value of this patchField with given weights
virtual tmp<Field<Type>> valueBoundaryCoeffs
(
const tmp<scalarField>&
) const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
tmp<Field<Type>> gradientInternalCoeffs() const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
tmp<Field<Type>> gradientBoundaryCoeffs() const;
//- Return the actual type
const word& actualType() const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "genericFaPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "genericFaPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "areaFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef genericFaPatchFields_H
#define genericFaPatchFields_H
#include "genericFaPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //