Merge branch 'master' into cvm

This commit is contained in:
graham
2011-03-18 15:13:40 +00:00
432 changed files with 9368 additions and 2619558 deletions

View File

@ -60,7 +60,7 @@ wmake $makeType randomProcesses
thermophysicalModels/Allwmake $*
transportModels/Allwmake $*
turbulenceModels/Allwmake $*
wmake $makeType surfaceFilmModels
regionModels/Allwmake $*
lagrangian/Allwmake $*
postProcessing/Allwmake $*
mesh/Allwmake $*

View File

@ -253,19 +253,20 @@ bool Foam::chDir(const fileName& dir)
Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
{
// Search user files:
// ~~~~~~~~~~~~~~~~~~
//
// search for user files in
// * ~/.OpenFOAM/VERSION
// * ~/.OpenFOAM
//
fileName searchDir = home()/".OpenFOAM";
if (isDir(searchDir))
{
// Check for user file in ~/.OpenFOAM/VERSION
fileName fullName = searchDir/FOAMversion/name;
if (isFile(fullName))
{
return fullName;
}
// Check for version-independent user file in ~/.OpenFOAM
fullName = searchDir/name;
if (isFile(fullName))
{
@ -274,32 +275,61 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
}
// Search site files:
// ~~~~~~~~~~~~~~~~~~
searchDir = getEnv("WM_PROJECT_INST_DIR");
if (isDir(searchDir))
//
// search for group (site) files in
// * $WM_PROJECT_SITE/VERSION
// * $WM_PROJECT_SITE
//
searchDir = getEnv("WM_PROJECT_SITE");
if (searchDir.size())
{
// Check for site file in $WM_PROJECT_INST_DIR/site/VERSION
fileName fullName = searchDir/"site"/FOAMversion/name;
if (isFile(fullName))
if (isDir(searchDir))
{
return fullName;
}
fileName fullName = searchDir/FOAMversion/name;
if (isFile(fullName))
{
return fullName;
}
// Check for version-independent site file in $WM_PROJECT_INST_DIR/site
fullName = searchDir/"site"/name;
if (isFile(fullName))
fullName = searchDir/name;
if (isFile(fullName))
{
return fullName;
}
}
}
else
{
//
// OR search for group (site) files in
// * $WM_PROJECT_INST_DIR/site/VERSION
// * $WM_PROJECT_INST_DIR/site
//
searchDir = getEnv("WM_PROJECT_INST_DIR");
if (isDir(searchDir))
{
return fullName;
fileName fullName = searchDir/"site"/FOAMversion/name;
if (isFile(fullName))
{
return fullName;
}
fullName = searchDir/"site"/name;
if (isFile(fullName))
{
return fullName;
}
}
}
// Search installation files:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// search for other (shipped) files in
// * $WM_PROJECT_DIR/etc
//
searchDir = getEnv("WM_PROJECT_DIR");
if (isDir(searchDir))
{
// Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
fileName fullName = searchDir/"etc"/name;
if (isFile(fullName))
{
@ -311,7 +341,8 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
// abort if the file is mandatory, otherwise return null
if (mandatory)
{
std::cerr<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
std::cerr
<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
" could not find mandatory file\n '"
<< name.c_str() << "'\n\n" << std::endl;
::exit(1);

View File

@ -97,18 +97,16 @@ struct HashTableCore
{}
};
static const iteratorEnd endIter;
//- iteratorEnd set to beyond the end of any HashTable
inline static const iteratorEnd& cend()
inline static iteratorEnd cend()
{
return endIter;
return iteratorEnd();
}
//- iteratorEnd set to beyond the end of any HashTable
inline static const iteratorEnd& end()
inline static iteratorEnd end()
{
return endIter;
return iteratorEnd();
}
};
@ -451,9 +449,6 @@ public:
// Member operators
//- Conversion to a const_iterator
inline operator const_iterator() const;
//- Return referenced hash value
inline T& operator*();
inline T& operator()();
@ -503,6 +498,9 @@ public:
//- Construct null (end iterator)
inline const_iterator();
//- Construct from iterator
inline const_iterator(const iterator&);
//- Construct end iterator
inline const_iterator(const iteratorEnd& unused);

View File

@ -37,9 +37,6 @@ const Foam::label Foam::HashTableCore::maxTableSize
)
);
const Foam::HashTableCore::iteratorEnd Foam::HashTableCore::endIter;
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::label Foam::HashTableCore::canonicalSize(const label size)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -362,17 +362,6 @@ inline Foam::HashTable<T, Key, Hash>::iterator::iterator
{}
template<class T, class Key, class Hash>
inline Foam::HashTable<T, Key, Hash>::iterator::operator
typename Foam::HashTable<T, Key, Hash>::const_iterator() const
{
return *reinterpret_cast
<
const typename Foam::HashTable<T, Key, Hash>::const_iterator*
>(this);
}
template<class T, class Key, class Hash>
inline T&
Foam::HashTable<T, Key, Hash>::iterator::operator*()
@ -442,6 +431,16 @@ inline Foam::HashTable<T, Key, Hash>::const_iterator::const_iterator()
{}
template<class T, class Key, class Hash>
inline Foam::HashTable<T, Key, Hash>::const_iterator::const_iterator
(
const HashTable<T, Key, Hash>::iterator& iter
)
:
iteratorBase(iter)
{}
template<class T, class Key, class Hash>
inline Foam::HashTable<T, Key, Hash>::const_iterator::const_iterator
(

View File

@ -70,6 +70,9 @@ bool Foam::functionEntries::codeStream::execute
Istream& is
)
{
Info<< "Using #codeStream at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity
(
"functionEntries::codeStream::execute(..)",

View File

@ -48,10 +48,10 @@ const Foam::word Foam::dynamicCode::codeTemplateEnvName
const Foam::fileName Foam::dynamicCode::codeTemplateDirName
= "codeTemplates/dynamicCode";
const char* Foam::dynamicCode::libTargetRoot =
const char* const Foam::dynamicCode::libTargetRoot =
"LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib";
const char* Foam::dynamicCode::topDirName = "dynamicCode";
const char* const Foam::dynamicCode::topDirName = "dynamicCode";
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //

View File

@ -106,10 +106,10 @@ protected:
// Static data members
//- Root of the LIB target for Make/files
static const char* libTargetRoot;
static const char* const libTargetRoot;
//- Top-level directory name for copy/compiling
static const char* topDirName;
static const char* const topDirName;
// Protected Member Functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::atomic::group = "atomic";
const char* const Foam::constant::atomic::group = "atomic";
const Foam::dimensionedScalar Foam::constant::atomic::alpha
@ -129,6 +129,3 @@ const Foam::dimensionedScalar Foam::constant::atomic::Eh
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ namespace atomic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for atomic constants
extern const char* group;
extern const char* const group;
//- Fine-structure constant: default SI units: []
extern const dimensionedScalar alpha;
@ -75,6 +75,3 @@ namespace atomic
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::electromagnetic::group = "electromagnetic";
const char* const Foam::constant::electromagnetic::group = "electromagnetic";
const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
@ -164,5 +164,3 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::RK
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ namespace electromagnetic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for electromagnetic constants
extern const char* group;
extern const char* const group;
//- Magnetic constant/permeability of free space: default SI units: [H/m]
extern const dimensionedScalar mu0;
@ -84,5 +84,3 @@ namespace electromagnetic
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ namespace mathematical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static word group = "mathematical";
static const char* const group = "mathematical";
const scalar e(M_E);
const scalar pi(M_PI);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::physicoChemical::group = "physicoChemical";
const char* const Foam::constant::physicoChemical::group = "physicoChemical";
const Foam::dimensionedScalar Foam::constant::physicoChemical::R

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ namespace physicoChemical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for physico-chemical constants
extern const char* group;
extern const char* const group;
//- Universal gas constant: default SI units: [J/mol/K]
extern const dimensionedScalar R;
@ -78,7 +78,3 @@ namespace physicoChemical
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::universal::group = "universal";
const char* const Foam::constant::universal::group = "universal";
const Foam::dimensionedScalar Foam::constant::universal::hr
@ -49,4 +49,3 @@ const Foam::dimensionedScalar Foam::constant::universal::hr
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,7 +46,7 @@ namespace universal
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for universal constants
extern const char* group;
extern const char* const group;
//- Reduced Planck constant: default SI units: [J/s]
extern const dimensionedScalar hr;
@ -62,4 +62,3 @@ namespace universal
#endif
// ************************************************************************* //

View File

@ -93,22 +93,22 @@ fileName cwd();
// else return false
bool chDir(const fileName& dir);
//- Search for \em name
// in the following hierarchy:
// -# personal settings:
// - ~/.OpenFOAM/\<VERSION\>/
// <em>for version-specific files</em>
//- Search for a file from user/group/shipped directories.
// The search scheme allows for version-specific and
// version-independent files using the following hierarchy:
// - \b user settings:
// - ~/.OpenFOAM/\<VERSION\>
// - ~/.OpenFOAM/
// <em>for version-independent files</em>
// -# site-wide settings:
// - \b group (site) settings (when $WM_PROJECT_SITE is set):
// - $WM_PROJECT_SITE/\<VERSION\>
// - $WM_PROJECT_SITE
// - \b group (site) settings (when $WM_PROJECT_SITE is not set):
// - $WM_PROJECT_INST_DIR/site/\<VERSION\>
// <em>for version-specific files</em>
// - $WM_PROJECT_INST_DIR/site/
// <em>for version-independent files</em>
// -# shipped settings:
// - \b other (shipped) settings:
// - $WM_PROJECT_DIR/etc/
//
// \return the full path name or fileName() if the name cannot be found
// \return The full path name or fileName() if the name cannot be found
// Optionally abort if the file cannot be found
fileName findEtcFile(const fileName&, bool mandatory=false);

View File

@ -254,7 +254,10 @@ public:
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const = 0;
virtual void transformPosition(pointField&) const = 0;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const = 0;
//- Are the planes separated.
virtual bool separated() const
@ -297,12 +300,12 @@ public:
virtual void calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
) = 0;
//- Initialize ordering for primitivePatch. Does not

View File

@ -77,7 +77,6 @@ void Foam::cyclicPolyPatch::calcTransforms()
if (size())
{
// Half0
const cyclicPolyPatch& half0 = *this;
vectorField half0Areas(half0.size());
forAll(half0, facei)
@ -108,10 +107,10 @@ void Foam::cyclicPolyPatch::calcTransforms()
void Foam::cyclicPolyPatch::calcTransforms
(
const primitivePatch& half0,
const UList<point>& half0Ctrs,
const UList<point>& half0Areas,
const UList<point>& half1Ctrs,
const UList<point>& half1Areas
const pointField& half0Ctrs,
const vectorField& half0Areas,
const pointField& half1Ctrs,
const vectorField& half1Areas
)
{
if (debug && owner())
@ -165,23 +164,9 @@ void Foam::cyclicPolyPatch::calcTransforms
if (half0Ctrs.size() > 0)
{
scalarField half0Tols
(
calcFaceTol
(
half0,
half0.points(),
static_cast<const pointField&>(half0Ctrs)
)
);
vectorField half0Normals(half0Areas.size());
vectorField half1Normals(half1Areas.size());
//- Additional warning about faces non-aligned with rotation axis
//scalar maxCos = -GREAT;
//label maxFacei = -1;
forAll(half0, facei)
{
scalar magSf = mag(half0Areas[facei]);
@ -221,75 +206,74 @@ void Foam::cyclicPolyPatch::calcTransforms
{
half0Normals[facei] = half0Areas[facei] / magSf;
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
//if (transform_ == ROTATIONAL)
//{
// scalar cos = mag(half0Normals[facei] & rotationAxis_);
// if (cos > maxCos)
// {
// maxCos = cos;
// maxFacei = facei;
// }
//}
}
}
//if (maxCos > sqrt(SMALL))
//{
// WarningIn
// (
// "cyclicPolyPatch::calcTransforms()"
// ) << "on patch " << name()
// << " face:" << maxFacei << " fc:" << half0Ctrs[maxFacei]
// << " is not perpendicular to the rotationAxis." << endl
// << "This will cause problems with topology changes." << endl
// << "rotation axis : " << rotationAxis_ << endl
// << "face normal : " << half0Normals[maxFacei] << endl
// << "cosine of angle : " << maxCos << endl;
//}
// Calculate transformation tensors
calcTransformTensors
(
static_cast<const pointField&>(half0Ctrs),
static_cast<const pointField&>(half1Ctrs),
half0Normals,
half1Normals,
half0Tols,
matchTol,
transform_
);
if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1)
if (transform_ == ROTATIONAL)
{
// Get index of maximum area face to minimise truncation errors.
label max0I = findMaxArea(half0.points(), half0);
// Calculate using the given rotation axis and centre. Do not
// use calculated normals.
label face0 = getConsistentRotationFace(half0Ctrs);
label face1 = face0;
const tensor fwdT = forwardT()[max0I];
const_cast<tensorField&>(forwardT()) = tensorField(1, fwdT);
const tensor revT = reverseT()[max0I];
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
const bool coll = collocated()[max0I];
const_cast<boolList&>(collocated()).setSize(1);
const_cast<boolList&>(collocated())[0] = coll;
vector n0 = ((half0Ctrs[face0] - rotationCentre_) ^ rotationAxis_);
vector n1 = ((half1Ctrs[face1] - rotationCentre_) ^ -rotationAxis_);
n0 /= mag(n0) + VSMALL;
n1 /= mag(n1) + VSMALL;
WarningIn
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " Specified rotation :"
<< " n0:" << n0 << " n1:" << n1 << endl;
}
// Extended tensor from two local coordinate systems calculated
// using normal and rotation axis
const tensor E0
(
"cyclicPolyPatch::calcTransforms\n"
" (\n"
" const primitivePatch&,\n"
" const UList<point>&,\n"
" const UList<point>&,\n"
" const UList<point>&,\n"
" const UList<point>&\n"
" )"
) << "For patch " << name()
<< " calculated non-uniform transform tensor even though"
<< " the transform type is " << transformTypeNames[transform_]
<< "." << nl
<< " Setting the transformation tensor to be a uniform"
<< " rotation calculated from face " << max0I
<< endl;
rotationAxis_,
(n0 ^ rotationAxis_),
n0
);
const tensor E1
(
rotationAxis_,
(-n1 ^ rotationAxis_),
-n1
);
const tensor revT(E1.T() & E0);
const_cast<tensorField&>(forwardT()) = tensorField(1, revT.T());
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
const_cast<vectorField&>(separation()).setSize(0);
const_cast<boolList&>(collocated()) = boolList(1, false);
}
else
{
scalarField half0Tols
(
calcFaceTol
(
half0,
half0.points(),
static_cast<const pointField&>(half0Ctrs)
)
);
calcTransformTensors
(
static_cast<const pointField&>(half0Ctrs),
static_cast<const pointField&>(half1Ctrs),
half0Normals,
half1Normals,
half0Tols,
matchTol,
transform_
);
}
}
}
@ -333,14 +317,39 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
<< " n0:" << n0 << " n1:" << n1 << endl;
}
// Rotation (around origin)
const tensor reverseT(rotationTensor(n0, -n1));
// Extended tensor from two local coordinate systems calculated
// using normal and rotation axis
const tensor E0
(
rotationAxis_,
(n0 ^ rotationAxis_),
n0
);
const tensor E1
(
rotationAxis_,
(-n1 ^ rotationAxis_),
-n1
);
const tensor revT(E1.T() & E0);
// Rotation
forAll(half0Ctrs, faceI)
{
half0Ctrs[faceI] = Foam::transform(reverseT, half0Ctrs[faceI]);
anchors0[faceI] = Foam::transform(reverseT, anchors0[faceI]);
half0Ctrs[faceI] =
Foam::transform
(
revT,
half0Ctrs[faceI] - rotationCentre_
)
+ rotationCentre_;
anchors0[faceI] =
Foam::transform
(
revT,
anchors0[faceI] - rotationCentre_
)
+ rotationCentre_;
}
break;
@ -387,19 +396,19 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
}
// Rotation (around origin)
const tensor reverseT(rotationTensor(n0, -n1));
const tensor revT(rotationTensor(n0, -n1));
// Rotation
forAll(half0Ctrs, faceI)
{
half0Ctrs[faceI] = Foam::transform
(
reverseT,
revT,
half0Ctrs[faceI]
);
anchors0[faceI] = Foam::transform
(
reverseT,
revT,
anchors0[faceI]
);
}
@ -437,41 +446,20 @@ Foam::label Foam::cyclicPolyPatch::getConsistentRotationFace
const pointField& faceCentres
) const
{
const scalarField magRadSqr
(
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_)
);
scalarField axisLen
(
(faceCentres - rotationCentre_) & rotationAxis_
);
axisLen -= min(axisLen);
const scalarField magLenSqr
(
magRadSqr + axisLen*axisLen
);
// Determine a face furthest away from the axis
label rotFace = -1;
scalar maxMagLenSqr = -GREAT;
scalar maxMagRadSqr = -GREAT;
forAll(faceCentres, i)
{
if (magLenSqr[i] >= maxMagLenSqr)
{
if (magRadSqr[i] > maxMagRadSqr)
{
rotFace = i;
maxMagLenSqr = magLenSqr[i];
maxMagRadSqr = magRadSqr[i];
}
}
}
const scalarField magRadSqr =
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_);
label rotFace = findMax(magRadSqr);
if (debug)
{
Pout<< "getConsistentRotationFace(const pointField&)" << nl
<< " rotFace = " << rotFace << nl
<< " point = " << faceCentres[rotFace] << endl;
Info<< "getConsistentRotationFace(const pointField&)" << nl
<< " rotFace = " << rotFace << nl
<< " point = " << faceCentres[rotFace] << nl
<< " distance = " << Foam::sqrt(magRadSqr[rotFace])
<< endl;
}
return rotFace;
@ -586,6 +574,17 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
{
dict.lookup("rotationAxis") >> rotationAxis_;
dict.lookup("rotationCentre") >> rotationCentre_;
scalar magRot = mag(rotationAxis_);
if (magRot < SMALL)
{
FatalIOErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)", dict)
<< "Illegal rotationAxis " << rotationAxis_ << endl
<< "Please supply a non-zero vector."
<< exit(FatalIOError);
}
rotationAxis_ /= magRot;
break;
}
case TRANSLATIONAL:
@ -730,7 +729,16 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
{
if (!parallel())
{
l = Foam::transform(forwardT(), l);
if (transform_ == ROTATIONAL)
{
l =
Foam::transform(forwardT(), l-rotationCentre_)
+ rotationCentre_;
}
else
{
l = Foam::transform(forwardT(), l);
}
}
else if (separated())
{
@ -750,6 +758,40 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
}
void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const
{
if (!parallel())
{
const tensor& T =
(
forwardT().size() == 1
? forwardT()[0]
: forwardT()[facei]
);
if (transform_ == ROTATIONAL)
{
l = Foam::transform(T, l-rotationCentre_) + rotationCentre_;
}
else
{
l = Foam::transform(T, l);
}
}
else if (separated())
{
const vector& s =
(
separation().size() == 1
? separation()[0]
: separation()[facei]
);
l -= s;
}
}
void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
polyPatch::initGeometry(pBufs);
@ -759,9 +801,9 @@ void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
void Foam::cyclicPolyPatch::initGeometry
(
const primitivePatch& referPatch,
UList<point>& nbrCtrs,
UList<point>& nbrAreas,
UList<point>& nbrCc
pointField& nbrCtrs,
vectorField& nbrAreas,
pointField& nbrCc
)
{}
@ -769,12 +811,12 @@ void Foam::cyclicPolyPatch::initGeometry
void Foam::cyclicPolyPatch::calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
)
{
calcTransforms

View File

@ -110,10 +110,10 @@ class cyclicPolyPatch
void calcTransforms
(
const primitivePatch& half0,
const UList<point>& half0Ctrs,
const UList<point>& half0Areas,
const UList<point>& half1Ctrs,
const UList<point>& half1Areas
const pointField& half0Ctrs,
const vectorField& half0Areas,
const pointField& half1Ctrs,
const vectorField& half1Areas
);
// Face ordering
@ -149,9 +149,9 @@ protected:
virtual void initGeometry
(
const primitivePatch& referPatch,
UList<point>& nbrCtrs,
UList<point>& nbrAreas,
UList<point>& nbrCc
pointField& nbrCtrs,
vectorField& nbrAreas,
pointField& nbrCc
);
//- Calculate the patch geometry
@ -161,12 +161,12 @@ protected:
virtual void calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
);
//- Initialise the patches for moving points
@ -342,6 +342,9 @@ public:
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const;
// Transformation

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -711,12 +711,12 @@ void Foam::oldCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
void Foam::oldCyclicPolyPatch::calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
)
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -269,16 +269,22 @@ public:
notImplemented("transformPosition(pointField&)");
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const
{
notImplemented("transformPosition(point&, const label)");
}
//- Calculate the patch geometry
virtual void calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
);
//- Initialize ordering for primitivePatch. Does not

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -93,12 +93,12 @@ protected:
virtual void calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
)
{
notImplemented("processorPolyPatch::calcGeometry(..)");
@ -300,6 +300,10 @@ public:
virtual void transformPosition(pointField& l) const
{}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const
{}
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;

View File

@ -81,12 +81,12 @@ protected:
virtual void calcGeometry
(
const primitivePatch& referPatch,
const UList<point>& thisCtrs,
const UList<point>& thisAreas,
const UList<point>& thisCc,
const UList<point>& nbrCtrs,
const UList<point>& nbrAreas,
const UList<point>& nbrCc
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
)
{
notImplemented("processorCyclicPolyPatch::calcGeometry(..)");
@ -279,6 +279,12 @@ public:
referPatch().transformPosition(l);
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point& l, const label facei) const
{
referPatch().transformPosition(l, facei);
}
//- Are the planes separated.
virtual bool separated() const
{

View File

@ -42,6 +42,7 @@ SourceFiles
#include "point.H"
#include "primitiveFieldsFwd.H"
#include "pointHit.H"
#include "cachedRandom.H"
#include "Random.H"
#include "FixedList.H"
#include "UList.H"
@ -164,6 +165,10 @@ public:
// uniform distribution
inline Point randomPoint(Random& rndGen) const;
//- Return a random point in the tetrahedron from a
// uniform distribution
inline Point randomPoint(cachedRandom& rndGen) const;
//- Calculate the barycentric coordinates of the given
// point, in the same order as a, b, c, d. Returns the
// determinant of the solution.

View File

@ -240,6 +240,42 @@ inline Point Foam::tetrahedron<Point, PointRef>::randomPoint
}
template<class Point, class PointRef>
inline Point Foam::tetrahedron<Point, PointRef>::randomPoint
(
cachedRandom& rndGen
) const
{
// Adapted from
// http://vcg.isti.cnr.it/activities/geometryegraphics/pointintetraedro.html
scalar s = rndGen.sample01<scalar>();
scalar t = rndGen.sample01<scalar>();
scalar u = rndGen.sample01<scalar>();
if (s + t > 1.0)
{
s = 1.0 - s;
t = 1.0 - t;
}
if (t + u > 1.0)
{
scalar tmp = u;
u = 1.0 - s - t;
t = 1.0 - tmp;
}
else if (s + t + u > 1.0)
{
scalar tmp = u;
u = s + t + u - 1.0;
s = 1.0 - t - tmp;
}
return (1 - s - t - u)*a_ + s*b_ + t*c_ + u*d_;
}
template<class Point, class PointRef>
Foam::scalar Foam::tetrahedron<Point, PointRef>::barycentric
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,10 +35,10 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* Foam::meshReaders::STARCD::defaultBoundaryName =
const char* const Foam::meshReaders::STARCD::defaultBoundaryName =
"Default_Boundary_Region";
const char* Foam::meshReaders::STARCD::defaultSolidBoundaryName =
const char* const Foam::meshReaders::STARCD::defaultSolidBoundaryName =
"Default_Boundary_Solid";
bool Foam::meshReaders::STARCD::keepSolids = false;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,8 +68,8 @@ protected:
// Protected Data
static const char* defaultBoundaryName;
static const char* defaultSolidBoundaryName;
static const char* const defaultBoundaryName;
static const char* const defaultSolidBoundaryName;
//- Face addressing from pro-STAR faces -> OpenFOAM faces
static const int starToFoamFaceAddr[4][6];

View File

@ -9,7 +9,8 @@
(
engineMesh::defaultRegion,
runTime.timeName(),
runTime
runTime,
Foam::IOobject::MUST_READ
)
)
);

View File

@ -114,8 +114,10 @@ derivedFvPatchFields = $(fvPatchFields)/derived
$(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
$(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchScalarField.C
$(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedField/directMappedFieldFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
@ -217,6 +219,7 @@ $(surfaceInterpolation)/surfaceInterpolationScheme/surfaceInterpolationSchemes.C
schemes = $(surfaceInterpolation)/schemes
$(schemes)/linear/linear.C
$(schemes)/pointLinear/pointLinear.C
$(schemes)/midPoint/midPoint.C
$(schemes)/downwind/downwind.C
$(schemes)/weighted/weighted.C

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 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 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
@ -19,12 +19,11 @@ 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
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "codedFixedValueFvPatchScalarField.H"
#include "codedFixedValueFvPatchField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
@ -36,19 +35,23 @@ License
#include "dynamicCode.H"
#include "dynamicCodeContext.H"
#include "stringOps.H"
#include "IOdictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateC
= "fixedValueFvPatchScalarFieldTemplate.C";
template<class Type>
const Foam::word Foam::codedFixedValueFvPatchField<Type>::codeTemplateC
= "fixedValueFvPatchFieldTemplate.C";
const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateH
= "fixedValueFvPatchScalarFieldTemplate.H";
template<class Type>
const Foam::word Foam::codedFixedValueFvPatchField<Type>::codeTemplateH
= "fixedValueFvPatchFieldTemplate.H";
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
void* Foam::codedFixedValueFvPatchScalarField::loadLibrary
template<class Type>
void* Foam::codedFixedValueFvPatchField<Type>::loadLibrary
(
const fileName& libPath,
const string& globalFuncName,
@ -82,7 +85,7 @@ void* Foam::codedFixedValueFvPatchScalarField::loadLibrary
{
FatalIOErrorIn
(
"codedFixedValueFvPatchScalarField::updateLibrary()",
"codedFixedValueFvPatchField<Type>::updateLibrary()",
contextDict
) << "Failed looking up symbol " << globalFuncName << nl
<< "from " << libPath << exit(FatalIOError);
@ -92,7 +95,7 @@ void* Foam::codedFixedValueFvPatchScalarField::loadLibrary
{
FatalIOErrorIn
(
"codedFixedValueFvPatchScalarField::loadLibrary()",
"codedFixedValueFvPatchField<Type>::loadLibrary()",
contextDict
) << "Failed looking up symbol " << globalFuncName << nl
<< "from " << libPath << exit(FatalIOError);
@ -102,7 +105,7 @@ void* Foam::codedFixedValueFvPatchScalarField::loadLibrary
{
FatalIOErrorIn
(
"codedFixedValueFvPatchScalarField::loadLibrary()",
"codedFixedValueFvPatchField<Type>::loadLibrary()",
contextDict
) << "Failed unloading library "
<< libPath
@ -116,7 +119,8 @@ void* Foam::codedFixedValueFvPatchScalarField::loadLibrary
}
void Foam::codedFixedValueFvPatchScalarField::unloadLibrary
template<class Type>
void Foam::codedFixedValueFvPatchField<Type>::unloadLibrary
(
const fileName& libPath,
const string& globalFuncName,
@ -152,7 +156,7 @@ void Foam::codedFixedValueFvPatchScalarField::unloadLibrary
{
FatalIOErrorIn
(
"codedFixedValueFvPatchScalarField::unloadLibrary()",
"codedFixedValueFvPatchField<Type>::unloadLibrary()",
contextDict
) << "Failed looking up symbol " << globalFuncName << nl
<< "from " << libPath << exit(FatalIOError);
@ -163,7 +167,7 @@ void Foam::codedFixedValueFvPatchScalarField::unloadLibrary
{
FatalIOErrorIn
(
"codedFixedValueFvPatchScalarField::"
"codedFixedValueFvPatchField<Type>::"
"updateLibrary()",
contextDict
) << "Failed unloading library " << libPath
@ -172,25 +176,45 @@ void Foam::codedFixedValueFvPatchScalarField::unloadLibrary
}
template<class Type>
void Foam::codedFixedValueFvPatchField<Type>::setFieldTemplates
(
dynamicCode& dynCode
)
{
word fieldType(pTraits<Type>::typeName);
// template type for fvPatchField
dynCode.setFilterVariable("TemplateType", fieldType);
// Name for fvPatchField - eg, ScalarField, VectorField, ...
fieldType[0] = toupper(fieldType[0]);
dynCode.setFilterVariable("FieldType", fieldType + "Field");
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::IOdictionary& Foam::codedFixedValueFvPatchScalarField::dict() const
template<class Type>
const Foam::IOdictionary& Foam::codedFixedValueFvPatchField<Type>::dict() const
{
if (db().foundObject<IOdictionary>("codeDict"))
const objectRegistry& obr = this->db();
if (obr.foundObject<IOdictionary>("codeDict"))
{
return db().lookupObject<IOdictionary>("codeDict");
return obr.lookupObject<IOdictionary>("codeDict");
}
else
{
return db().store
return obr.store
(
new IOdictionary
(
IOobject
(
"codeDict",
db().time().system(),
db(),
this->db().time().system(),
this->db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
@ -200,7 +224,8 @@ const Foam::IOdictionary& Foam::codedFixedValueFvPatchScalarField::dict() const
}
void Foam::codedFixedValueFvPatchScalarField::createLibrary
template<class Type>
void Foam::codedFixedValueFvPatchField<Type>::createLibrary
(
dynamicCode& dynCode,
const dynamicCodeContext& context
@ -213,22 +238,31 @@ void Foam::codedFixedValueFvPatchScalarField::createLibrary
// Write files for new library
if (!dynCode.upToDate(context))
{
Info<< "Using dynamicCode for patch " << this->patch().name()
<< " on field " << this->dimensionedInternalField().name()
<< endl;
// filter with this context
dynCode.reset(context);
// take no chances - typeName must be identical to redirectType_
dynCode.setFilterVariable("typeName", redirectType_);
// set TemplateType and FieldType filter variables
// (for fvPatchField)
setFieldTemplates(dynCode);
// compile filtered C template
dynCode.addCompileFile(codeTemplateC);
// copy filtered H template
dynCode.addCopyFile(codeTemplateH);
// take no chances - typeName must be identical to redirectType_
dynCode.setFilterVariable("typeName", redirectType_);
// debugging: make BC verbose
// dynCode.setFilterVariable("verbose", "true");
// Info<<"compile " << redirectType_ << " sha1: "
// << context.sha1() << endl;
// dynCode.setFilterVariable("verbose", "true");
// Info<<"compile " << redirectType_ << " sha1: "
// << context.sha1() << endl;
// define Make/options
dynCode.setMakeOptions
@ -243,7 +277,7 @@ void Foam::codedFixedValueFvPatchScalarField::createLibrary
{
FatalIOErrorIn
(
"codedFixedValueFvPatchScalarField::createLibrary(..)",
"codedFixedValueFvPatchField<Type>::createLibrary(..)",
context.dict()
) << "Failed writing files for" << nl
<< dynCode.libRelPath() << nl
@ -255,7 +289,7 @@ void Foam::codedFixedValueFvPatchScalarField::createLibrary
{
FatalIOErrorIn
(
"codedFixedValueFvPatchScalarField::createLibrary(..)",
"codedFixedValueFvPatchField<Type>::createLibrary(..)",
context.dict()
) << "Failed wmake " << dynCode.libRelPath() << nl
<< exit(FatalIOError);
@ -268,11 +302,12 @@ void Foam::codedFixedValueFvPatchScalarField::createLibrary
}
void Foam::codedFixedValueFvPatchScalarField::updateLibrary() const
template<class Type>
void Foam::codedFixedValueFvPatchField<Type>::updateLibrary() const
{
dynamicCode::checkSecurity
(
"codedFixedValueFvPatchScalarField::updateLibrary()",
"codedFixedValueFvPatchField<Type>::updateLibrary()",
dict_
);
@ -328,29 +363,29 @@ void Foam::codedFixedValueFvPatchScalarField::updateLibrary() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::codedFixedValueFvPatchScalarField::
codedFixedValueFvPatchScalarField
template<class Type>
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(p, iF),
fixedValueFvPatchField<Type>(p, iF),
oldLibPath_(),
redirectPatchFieldPtr_()
{}
Foam::codedFixedValueFvPatchScalarField::
codedFixedValueFvPatchScalarField
template<class Type>
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
(
const codedFixedValueFvPatchScalarField& ptf,
const codedFixedValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
dict_(ptf.dict_),
redirectType_(ptf.redirectType_),
oldLibPath_(ptf.oldLibPath_),
@ -358,15 +393,15 @@ codedFixedValueFvPatchScalarField
{}
Foam::codedFixedValueFvPatchScalarField::
codedFixedValueFvPatchScalarField
template<class Type>
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
fixedValueFvPatchField<Type>(p, iF, dict),
dict_(dict),
redirectType_(dict.lookup("redirectType")),
oldLibPath_(),
@ -376,13 +411,13 @@ codedFixedValueFvPatchScalarField
}
Foam::codedFixedValueFvPatchScalarField::
codedFixedValueFvPatchScalarField
template<class Type>
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
(
const codedFixedValueFvPatchScalarField& ptf
const codedFixedValueFvPatchField<Type>& ptf
)
:
fixedValueFvPatchField<scalar>(ptf),
fixedValueFvPatchField<Type>(ptf),
dict_(ptf.dict_),
redirectType_(ptf.redirectType_),
oldLibPath_(ptf.oldLibPath_),
@ -390,14 +425,14 @@ codedFixedValueFvPatchScalarField
{}
Foam::codedFixedValueFvPatchScalarField::
codedFixedValueFvPatchScalarField
template<class Type>
Foam::codedFixedValueFvPatchField<Type>::codedFixedValueFvPatchField
(
const codedFixedValueFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
const codedFixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(ptf, iF),
fixedValueFvPatchField<Type>(ptf, iF),
dict_(ptf.dict_),
redirectType_(ptf.redirectType_),
oldLibPath_(ptf.oldLibPath_),
@ -407,8 +442,9 @@ codedFixedValueFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvPatchScalarField&
Foam::codedFixedValueFvPatchScalarField::redirectPatchField() const
template<class Type>
const Foam::fvPatchField<Type>&
Foam::codedFixedValueFvPatchField<Type>::redirectPatchField() const
{
if (!redirectPatchFieldPtr_.valid())
{
@ -418,16 +454,16 @@ Foam::codedFixedValueFvPatchScalarField::redirectPatchField() const
OStringStream os;
os.writeKeyword("type") << redirectType_ << token::END_STATEMENT
<< nl;
static_cast<const scalarField&>(*this).writeEntry("value", os);
static_cast<const Field<Type>&>(*this).writeEntry("value", os);
IStringStream is(os.str());
dictionary dict(is);
redirectPatchFieldPtr_.set
(
fvPatchScalarField::New
fvPatchField<Type>::New
(
patch(),
dimensionedInternalField(),
this->patch(),
this->dimensionedInternalField(),
dict
).ptr()
);
@ -436,9 +472,10 @@ Foam::codedFixedValueFvPatchScalarField::redirectPatchField() const
}
void Foam::codedFixedValueFvPatchScalarField::updateCoeffs()
template<class Type>
void Foam::codedFixedValueFvPatchField<Type>::updateCoeffs()
{
if (updated())
if (this->updated())
{
return;
}
@ -446,18 +483,19 @@ void Foam::codedFixedValueFvPatchScalarField::updateCoeffs()
// Make sure library containing user-defined fvPatchField is up-to-date
updateLibrary();
const fvPatchScalarField& fvp = redirectPatchField();
const fvPatchField<Type>& fvp = redirectPatchField();
const_cast<fvPatchScalarField&>(fvp).updateCoeffs();
const_cast<fvPatchField<Type>&>(fvp).updateCoeffs();
// Copy through value
operator==(fvp);
this->operator==(fvp);
fixedValueFvPatchField<scalar>::updateCoeffs();
fixedValueFvPatchField<Type>::updateCoeffs();
}
void Foam::codedFixedValueFvPatchScalarField::evaluate
template<class Type>
void Foam::codedFixedValueFvPatchField<Type>::evaluate
(
const Pstream::commsTypes commsType
)
@ -465,17 +503,18 @@ void Foam::codedFixedValueFvPatchScalarField::evaluate
// Make sure library containing user-defined fvPatchField is up-to-date
updateLibrary();
const fvPatchScalarField& fvp = redirectPatchField();
const fvPatchField<Type>& fvp = redirectPatchField();
const_cast<fvPatchScalarField&>(fvp).evaluate(commsType);
const_cast<fvPatchField<Type>&>(fvp).evaluate(commsType);
fixedValueFvPatchField<scalar>::evaluate(commsType);
fixedValueFvPatchField<Type>::evaluate(commsType);
}
void Foam::codedFixedValueFvPatchScalarField::write(Ostream& os) const
template<class Type>
void Foam::codedFixedValueFvPatchField<Type>::write(Ostream& os) const
{
fixedValueFvPatchField<scalar>::write(os);
fixedValueFvPatchField<Type>::write(os);
os.writeKeyword("redirectType") << redirectType_
<< token::END_STATEMENT << nl;
@ -493,13 +532,5 @@ void Foam::codedFixedValueFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
codedFixedValueFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 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 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
@ -19,21 +19,20 @@ 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
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::codedFixedValueFvPatchScalarField
Foam::codedFixedValueFvPatchField
Description
Constructs on-the-fly a new boundary condition (derived from
fixedValueFvPatchScalarField) which is then used to evaluate.
fixedValueFvPatchField) which is then used to evaluate.
Example:
\verbatim
movingWall
{
type codedFixedValue<scalar>;
type codedFixedValue;
value uniform 0;
redirectType rampedFixedValue; // name of generated bc
@ -72,12 +71,12 @@ SeeAlso
Foam::dynamicCode and Foam::functionEntries::codeStream
SourceFiles
codedFixedValueFvPatchScalarField.C
codedFixedValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef codedFixedValueFvPatchScalarField_H
#define codedFixedValueFvPatchScalarField_H
#ifndef codedFixedValueFvPatchField_H
#define codedFixedValueFvPatchField_H
#include "fixedValueFvPatchFields.H"
@ -92,12 +91,13 @@ class dynamicCodeContext;
class IOdictionary;
/*---------------------------------------------------------------------------*\
Class codedFixedValueFvPatchScalarField Declaration
Class codedFixedValueFvPatch Declaration
\*---------------------------------------------------------------------------*/
class codedFixedValueFvPatchScalarField
template<class Type>
class codedFixedValueFvPatchField
:
public fixedValueFvPatchScalarField
public fixedValueFvPatchField<Type>
{
// Private data
@ -109,7 +109,7 @@ class codedFixedValueFvPatchScalarField
//- Previously loaded library
mutable fileName oldLibPath_;
mutable autoPtr<fvPatchScalarField> redirectPatchFieldPtr_;
mutable autoPtr<fvPatchField<Type> > redirectPatchFieldPtr_;
// Private Member Functions
@ -135,6 +135,8 @@ class codedFixedValueFvPatchScalarField
const dictionary& contextDict
);
//- Set the rewrite vars controlling the Type
static void setFieldTemplates(dynamicCode& dynCode);
//- Create library based on the dynamicCodeContext
void createLibrary(dynamicCode&, const dynamicCodeContext&) const;
@ -155,83 +157,77 @@ public:
//- Runtime type information
TypeName("codedFixedValue<scalar>");
TypeName("codedFixedValue");
// Constructors
//- Construct from patch and internal field
codedFixedValueFvPatchScalarField
codedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
codedFixedValueFvPatchScalarField
codedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// codedFixedValueFvPatchScalarField
//- Construct by mapping given codedFixedValueFvPatchField
// onto a new patch
codedFixedValueFvPatchScalarField
codedFixedValueFvPatchField
(
const codedFixedValueFvPatchScalarField&,
const codedFixedValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
codedFixedValueFvPatchScalarField
codedFixedValueFvPatchField
(
const codedFixedValueFvPatchScalarField&
const codedFixedValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchScalarField>
return tmp<fvPatchField<Type> >
(
new codedFixedValueFvPatchScalarField
(
*this
)
new codedFixedValueFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
codedFixedValueFvPatchScalarField
codedFixedValueFvPatchField
(
const codedFixedValueFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
const codedFixedValueFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<scalar, volMesh>& iF
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
return tmp<fvPatchField<Type> >
(
new codedFixedValueFvPatchScalarField
(
*this,
iF
)
new codedFixedValueFvPatchField<Type>(*this, iF)
);
}
// Member functions
//- Get reference to the underlying patch
const fvPatchScalarField& redirectPatchField() const;
const fvPatchField<Type>& redirectPatchField() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
@ -253,6 +249,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "codedFixedValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,22 +23,21 @@ License
\*---------------------------------------------------------------------------*/
#include "heatTransferModel.H"
#include "codedFixedValueFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::surfaceFilmModels::surfaceFilmModel&
Foam::surfaceFilmModels::heatTransferModel::owner() const
namespace Foam
{
return owner_;
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
inline const Foam::dictionary&
Foam::surfaceFilmModels::heatTransferModel::coeffs() const
{
return coeffs_;
}
makePatchFields(codedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,29 +23,27 @@ License
\*---------------------------------------------------------------------------*/
#include "injectionModel.H"
#ifndef codedFixedValueFvPatchFields_H
#define codedFixedValueFvPatchFields_H
#include "codedFixedValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::surfaceFilmModels::surfaceFilmModel&
Foam::surfaceFilmModels::injectionModel::owner() const
namespace Foam
{
return owner_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::dictionary&
Foam::surfaceFilmModels::injectionModel::coeffs() const
{
return coeffs_;
}
makePatchTypeFieldTypedefs(codedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::scalar Foam::surfaceFilmModels::injectionModel::injectedMass()
const
{
return injectedMass_;
}
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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/>.
\*---------------------------------------------------------------------------*/
#ifndef codedFixedValueFvPatchFieldsFwd_H
#define codedFixedValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class codedFixedValueFvPatchField;
makePatchTypeFieldTypedefs(codedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,313 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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 "directMappedFieldFvPatchField.H"
#include "volFields.H"
#include "interpolationCell.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(p.patch()),
fixedValueFvPatchField<Type>(p, iF),
fieldName_(iF.name()),
setAverage_(false),
average_(pTraits<Type>::zero)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedPatchBase(p.patch(), ptf),
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedPatchBase(p.patch(), dict),
fixedValueFvPatchField<Type>(p, iF, dict),
fieldName_(dict.template lookupOrDefault<word>("fieldName", iF.name())),
setAverage_(readBool(dict.lookup("setAverage"))),
average_(pTraits<Type>(dict.lookup("average")))
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
// directMappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const scalar distance,
// My settings
const word& fieldName,
const bool setAverage,
const Type average
)
:
directMappedPatchBase
(
p.patch(),
sampleRegion,
sampleMode,
samplePatch,
distance
),
fixedValueFvPatchField<Type>(p, iF),
fieldName_(fieldName),
setAverage_(setAverage),
average_(average)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>& ptf
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
template<class Type>
directMappedFieldFvPatchField<Type>::directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf, iF),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const GeometricField<Type, fvPatchField, volMesh>&
directMappedFieldFvPatchField<Type>::sampleField() const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
if (sameRegion())
{
if (fieldName_ == this->dimensionedInternalField().name())
{
// Optimisation: bypass field lookup
return
dynamic_cast<const fieldType&>
(
this->dimensionedInternalField()
);
}
else
{
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
return thisMesh.template lookupObject<fieldType>(fieldName_);
}
}
else
{
return nbrMesh.template lookupObject<fieldType>(fieldName_);
}
}
template<class Type>
void directMappedFieldFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
const mapDistribute& distMap = directMappedPatchBase::map();
// Result of obtaining remote values
Field<Type> newValues;
switch (mode())
{
case NEARESTCELL:
{
newValues = sampleField();
distMap.distribute(newValues);
break;
}
case NEARESTPATCHFACE:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
samplePatch()
);
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void directMappedFieldFvPatchField<Type>::updateCoeffs()"
)<< "Unable to find sample patch " << samplePatch()
<< " in region " << sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const fieldType& nbrField = sampleField();
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf =
nbrField.boundaryField()[patchI];
label faceStart = pf.patch().patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pf[faceI];
}
}
distMap.distribute(allValues);
newValues.transfer(allValues);
break;
}
default:
{
FatalErrorIn("directMappedFieldFvPatchField<Type>::updateCoeffs()")
<< "Unknown sampling mode: " << mode()
<< nl << abort(FatalError);
}
}
if (setAverage_)
{
Type averagePsi =
gSum(this->patch().magSf()*newValues)
/gSum(this->patch().magSf());
if (mag(averagePsi)/mag(average_) > 0.5)
{
newValues *= mag(average_)/mag(averagePsi);
}
else
{
newValues += (average_ - averagePsi);
}
}
this->operator==(newValues);
if (debug)
{
Info<< "operating on field:" << this->dimensionedInternalField().name()
<< " patch:" << this->patch().name()
<< " avg:" << gAverage(*this)
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< endl;
}
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void directMappedFieldFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
directMappedPatchBase::write(os);
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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::directMappedFieldFvPatchField
Description
Self-contained version of directMapped. Does not use information on
patch, instead holds it locally (and possibly duplicate) so use
normal directMapped in preference and only use this if you cannot
change the underlying patch type to directMapped.
SourceFiles
directMappedFieldFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFieldFvPatchField_H
#define directMappedFieldFvPatchField_H
#include "directMappedPatchBase.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFieldFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedFieldFvPatchField
:
public directMappedPatchBase,
public fixedValueFvPatchField<Type>
{
// Private data
//- Name of field to sample - defaults to field associated with this
// patchField if not specified
word fieldName_;
//- If true adjust the mapped field to maintain average value average_
const bool setAverage_;
//- Average value the mapped field is adjusted to maintain if
// setAverage_ is set true
const Type average_;
// Private Member Functions
//- Field to sample. Either on my or nbr mesh
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
public:
//- Runtime type information
TypeName("directMappedField");
// Constructors
//- Construct from patch and internal field
directMappedFieldFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFieldFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct from patch, internal field and distance for normal type
// sampling
directMappedFieldFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
// directMappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const scalar distance,
// My settings
const word& fieldName,
const bool setAverage,
const Type average
);
//- Construct by mapping given
// directMappedFieldFvPatchField
// onto a new patch
directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedFieldFvPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
directMappedFieldFvPatchField
(
const directMappedFieldFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new directMappedFieldFvPatchField<Type>
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "directMappedFieldFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,22 +23,21 @@ License
\*---------------------------------------------------------------------------*/
#include "phaseChangeModel.H"
#include "directMappedFieldFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::surfaceFilmModels::surfaceFilmModel&
Foam::surfaceFilmModels::phaseChangeModel::owner() const
namespace Foam
{
return owner_;
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
inline const Foam::dictionary&
Foam::surfaceFilmModels::phaseChangeModel::coeffs() const
{
return coeffs_;
}
makePatchFields(directMappedField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,29 +23,27 @@ License
\*---------------------------------------------------------------------------*/
#include "surfaceFilmModel.H"
#ifndef directMappedFieldFvPatchFields_H
#define directMappedFieldFvPatchFields_H
#include "directMappedFieldFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::Switch&
Foam::surfaceFilmModels::surfaceFilmModel::active() const
namespace Foam
{
return active_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::dictionary&
Foam::surfaceFilmModels::surfaceFilmModel::coeffs() const
{
return coeffs_;
}
makePatchTypeFieldTypedefs(directMappedField)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::surfaceFilmModels::surfaceFilmModel::thermoModelType&
Foam::surfaceFilmModels::surfaceFilmModel::thermoModel() const
{
return thermoModel_;
}
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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/>.
\*---------------------------------------------------------------------------*/
#ifndef directMappedFieldFvPatchFieldsFwd_H
#define directMappedFieldFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class directMappedFieldFvPatchField;
makePatchTypeFieldTypedefs(directMappedField)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,22 +19,18 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "directMappedFixedInternalValueFvPatchField.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directMappedFixedInternalValueFvPatchField<Type>::
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
@ -46,7 +42,7 @@ directMappedFixedInternalValueFvPatchField
template<class Type>
directMappedFixedInternalValueFvPatchField<Type>::
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf,
@ -60,7 +56,7 @@ directMappedFixedInternalValueFvPatchField
template<class Type>
directMappedFixedInternalValueFvPatchField<Type>::
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
@ -73,7 +69,7 @@ directMappedFixedInternalValueFvPatchField
template<class Type>
directMappedFixedInternalValueFvPatchField<Type>::
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf
@ -84,7 +80,7 @@ directMappedFixedInternalValueFvPatchField
template<class Type>
directMappedFixedInternalValueFvPatchField<Type>::
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf,
@ -98,7 +94,7 @@ directMappedFixedInternalValueFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
void Foam::directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
@ -113,26 +109,31 @@ void directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>(this->patch().patch());
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch =
refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatch& nbrPatch = nbrMesh.boundary()[samplePatchI];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
// Retrieve the neighbour field
const fvPatchField<Type>& nbrField =
nbrPatch.lookupPatchField<FieldType, Type>
nbrPatch.template lookupPatchField<FieldType, Type>
(
this->dimensionedInternalField().name()
);
// Retrieve the neighbour patch internal field
Field<Type> nbrIntFld(nbrField.patchInternalField());
distMap.distribute(nbrIntFld);
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Assign (this) patch internal field to its neighbour values
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
@ -141,14 +142,13 @@ void directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
template<class Type>
void directMappedFixedInternalValueFvPatchField<Type>::write(Ostream& os) const
void Foam::directMappedFixedInternalValueFvPatchField<Type>::write
(
Ostream& os
) const
{
directMappedFixedValueFvPatchField<Type>::write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::directMappedFixedInternalValueFvPatchField

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
@ -36,7 +37,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(directMappedFixedInternalValue);
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
@ -37,7 +38,7 @@ namespace Foam
template<class Type> class directMappedFixedInternalValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedFixedInternalValue);
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,22 +19,18 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "directMappedFixedPushedInternalValueFvPatchField.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directMappedFixedPushedInternalValueFvPatchField<Type>::
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch& p,
@ -46,7 +42,7 @@ directMappedFixedPushedInternalValueFvPatchField
template<class Type>
directMappedFixedPushedInternalValueFvPatchField<Type>::
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf,
@ -60,7 +56,7 @@ directMappedFixedPushedInternalValueFvPatchField
template<class Type>
directMappedFixedPushedInternalValueFvPatchField<Type>::
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch& p,
@ -73,7 +69,7 @@ directMappedFixedPushedInternalValueFvPatchField
template<class Type>
directMappedFixedPushedInternalValueFvPatchField<Type>::
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf
@ -84,7 +80,7 @@ directMappedFixedPushedInternalValueFvPatchField
template<class Type>
directMappedFixedPushedInternalValueFvPatchField<Type>::
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf,
@ -98,7 +94,8 @@ directMappedFixedPushedInternalValueFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void directMappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs()
void
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
@ -117,7 +114,7 @@ void directMappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs()
template<class Type>
void directMappedFixedPushedInternalValueFvPatchField<Type>::write
void Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::write
(
Ostream& os
) const
@ -126,8 +123,4 @@ void directMappedFixedPushedInternalValueFvPatchField<Type>::write
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::directMappedFixedPushedInternalValueFvPatchField

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
@ -36,7 +37,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(directMappedFixedPushedInternalValue);
makePatchTypeFieldTypedefs(directMappedFixedPushedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,16 +2,16 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011 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 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
@ -19,7 +19,8 @@ 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/>.
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
@ -37,7 +38,7 @@ namespace Foam
template<class Type> class directMappedFixedPushedInternalValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedFixedInternalValue);
makePatchTypeFieldTypedefs(directMappedFixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -457,12 +457,20 @@ void Foam::MULES::limiter
tmp<volScalarField::DimensionedInternalField> V0 = mesh.Vsc0();
psiMaxn =
V*((rho.field()/deltaT - Sp.field())*psiMaxn - Su.field())
V
*(
(rho.field()/deltaT - Sp.field())*psiMaxn
- Su.field()
)
- (V0().field()/deltaT)*rho.oldTime().field()*psi0
+ sumPhiBD;
psiMinn =
V*(Su.field() - (rho.field()/deltaT - Sp.field())*psiMinn)
V
*(
Su.field()
- (rho.field()/deltaT - Sp.field())*psiMinn
)
+ (V0().field()/deltaT)*rho.oldTime().field()*psi0
- sumPhiBD;
}
@ -472,16 +480,17 @@ void Foam::MULES::limiter
V
*(
(rho.field()/deltaT - Sp.field())*psiMaxn
- (rho.oldTime().field()/deltaT)*psi0
- Su.field()
- (rho.oldTime().field()/deltaT)*psi0
)
+ sumPhiBD;
psiMinn =
V
*(
(rho.field()/deltaT)*psi0
- (rho.oldTime().field()/deltaT - Sp.field())*psiMinn + Su.field()
Su.field()
- (rho.field()/deltaT - Sp.field())*psiMinn
+ (rho.oldTime().field()/deltaT)*psi0
)
- sumPhiBD;
}

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "pointLinear.H"
#include "fvMesh.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
Foam::pointLinear<Type>::
correction
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
const fvMesh& mesh = this->mesh();
GeometricField<Type, pointPatchField, pointMesh> pvf =
volPointInterpolation::New(mesh).interpolate(vf);
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr =
linearInterpolate(vf);
Field<Type>& sfCorr = tsfCorr().internalField();
const pointField& points = mesh.points();
const pointField& C = mesh.C().internalField();
const faceList& faces = mesh.faces();
const scalarField& w = mesh.weights().internalField();
const labelList& owner = mesh.owner();
const labelList& neighbour = mesh.neighbour();
forAll(sfCorr, facei)
{
point pi =
w[owner[facei]]*C[owner[facei]]
+ (1.0 - w[owner[facei]])*C[neighbour[facei]];
scalar at = triangle<point, const point&>
(
pi,
points[faces[facei][0]],
points[faces[facei][faces[facei].size()-1]]
).mag();
scalar sumAt = at;
Type sumPsip = at*(1.0/3.0)*
(
sfCorr[facei]
+ pvf[faces[facei][0]]
+ pvf[faces[facei][faces[facei].size()-1]]
);
for (label pointi=1; pointi<faces[facei].size(); pointi++)
{
at = triangle<point, const point&>
(
pi,
points[faces[facei][pointi]],
points[faces[facei][pointi-1]]
).mag();
sumAt += at;
sumPsip += at*(1.0/3.0)*
(
sfCorr[facei]
+ pvf[faces[facei][pointi]]
+ pvf[faces[facei][pointi-1]]
);
}
sfCorr[facei] = sumPsip/sumAt - sfCorr[facei];
}
tsfCorr().boundaryField() = pTraits<Type>::zero;
return tsfCorr;
}
namespace Foam
{
makeSurfaceInterpolationScheme(pointLinear);
}
// ************************************************************************* //

View File

@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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
pointLinear
Description
Face-point interpolation scheme class derived from linear and
returns linear weighting factors but also applies an explicit correction.
Uses volPointInterpolation to obtain the field values at the face-points.
SourceFiles
pointLinear.C
\*---------------------------------------------------------------------------*/
#ifndef pointLinear_H
#define pointLinear_H
#include "linear.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pointLinear Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class pointLinear
:
public linear<Type>
{
// Private Member Functions
//- Disallow default bitwise copy construct
pointLinear(const pointLinear&);
//- Disallow default bitwise assignment
void operator=(const pointLinear&);
public:
//- Runtime type information
TypeName("pointLinear");
// Constructors
//- Construct from mesh
pointLinear(const fvMesh& mesh)
:
linear<Type>(mesh)
{}
//- Construct from mesh and Istream
pointLinear
(
const fvMesh& mesh,
Istream&
)
:
linear<Type>(mesh)
{}
//- Construct from mesh, faceFlux and Istream
pointLinear
(
const fvMesh& mesh,
const surfaceScalarField&,
Istream&
)
:
linear<Type>(mesh)
{}
// Member Functions
//- Return true if this scheme uses an explicit correction
virtual bool corrected() const
{
return true;
}
//- Return the explicit correction to the face-interpolate
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correction
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -116,12 +116,6 @@ Foam::particle::particle(const particle& p, const polyMesh& mesh)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::particle::transformPosition(const tensor& T)
{
position_ = transform(T, position_);
}
void Foam::particle::transformProperties(const tensor&)
{}

View File

@ -491,10 +491,6 @@ public:
// Transformations
//- Transform the position the particle
// according to the given transformation tensor
virtual void transformPosition(const tensor& T);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);

View File

@ -52,11 +52,15 @@ void Foam::particle::correctAfterParallelTransfer
TrackData& td
)
{
const processorPolyPatch& ppp =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
const coupledPolyPatch& ppp =
refCast<const coupledPolyPatch>(mesh_.boundaryMesh()[patchI]);
cellI_ = ppp.faceCells()[faceI_];
// Have patch transform the position
ppp.transformPosition(position_, faceI_);
// Transform the properties
if (!ppp.parallel())
{
const tensor& T =
@ -65,8 +69,6 @@ void Foam::particle::correctAfterParallelTransfer
? ppp.forwardT()[0]
: ppp.forwardT()[faceI_]
);
transformPosition(T);
transformProperties(T);
}
else if (ppp.separated())
@ -77,7 +79,6 @@ void Foam::particle::correctAfterParallelTransfer
? ppp.separation()[0]
: ppp.separation()[faceI_]
);
position_ -= s;
transformProperties(-s);
}
@ -958,19 +959,22 @@ void Foam::particle::hitCyclicPatch
tetPtI_ = mesh_.faces()[tetFaceI_].size() - 1 - tetPtI_;
const cyclicPolyPatch& receiveCpp = cpp.neighbPatch();
label patchFacei = receiveCpp.whichFace(faceI_);
// Now the particle is on the receiving side
// Have patch transform the position
receiveCpp.transformPosition(position_, patchFacei);
// Transform the properties
if (!receiveCpp.parallel())
{
const tensor& T =
(
receiveCpp.forwardT().size() == 1
? receiveCpp.forwardT()[0]
: receiveCpp.forwardT()[receiveCpp.whichFace(faceI_)]
: receiveCpp.forwardT()[patchFacei]
);
transformPosition(T);
transformProperties(T);
}
else if (receiveCpp.separated())
@ -979,9 +983,8 @@ void Foam::particle::hitCyclicPatch
(
(receiveCpp.separation().size() == 1)
? receiveCpp.separation()[0]
: receiveCpp.separation()[receiveCpp.whichFace(faceI_)]
: receiveCpp.separation()[patchFacei]
);
position_ -= s;
transformProperties(-s);
}
}

View File

@ -18,7 +18,8 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude
LIB_LIBS = \
-lfiniteVolume \
@ -36,4 +37,5 @@ LIB_LIBS = \
-lSLGThermo \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lregionModels \
-lsurfaceFilmModels

View File

@ -281,7 +281,7 @@ bool Foam::parcel::move(trackingData& td, const scalar trackTime)
sDB.shs()[cellI] += oTotMass*(oH + oPE) - m()*(nH + nPE);
// Remove evaporated mass from stripped mass
ms() -= ms()*(oTotMass-m())/oTotMass;
ms() -= ms()*(oTotMass - m())/oTotMass;
// remove parcel if it is 'small'
if (m() < 1.0e-12)

View File

@ -48,6 +48,7 @@ $(RADIATION)/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.
$(RADIATION)/scatter/cloudScatter/cloudScatter.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionDataList.C
KINEMATICINJECTION=submodels/Kinematic/InjectionModel
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionData.C

View File

@ -17,7 +17,8 @@ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
LIB_LIBS = \

View File

@ -66,9 +66,15 @@ public:
// Public typedefs
//- Redefine particle type as parcel type
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef CollidingCloud<CloudType> collidingCloudType;
private:
@ -116,8 +122,6 @@ protected:
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields

View File

@ -99,9 +99,15 @@ public:
// Public typedefs
//- Redefine particle type as parcel type
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef KinematicCloud<CloudType> kinematicCloudType;
//- Force type
typedef ParticleForceList<KinematicCloud<CloudType> > forceType;
@ -244,8 +250,6 @@ protected:
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields

View File

@ -127,17 +127,19 @@ void Foam::cloudSolution::read()
schemes_.setSize(vars.size());
forAll(vars, i)
{
// read solution variable name
schemes_[i].first() = vars[i];
// set semi-implicit (1) explicit (0) flag
Istream& is = schemesDict.lookup(vars[i]);
const word scheme(is);
if (scheme == "semiImplicit")
{
is >> schemes_[i].second();
schemes_[i].second().first() = true;
}
else if (scheme == "explicit")
{
schemes_[i].second() = -1;
schemes_[i].second().first() = false;
}
else
{
@ -145,6 +147,9 @@ void Foam::cloudSolution::read()
<< "Invalid scheme " << scheme << ". Valid schemes are "
<< "explicit and semiImplicit" << exit(FatalError);
}
// read under-relaxation factor
is >> schemes_[i].second().second();
}
}
@ -155,7 +160,7 @@ Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const
{
if (fieldName == schemes_[i].first())
{
return schemes_[i].second();
return schemes_[i].second().second();
}
}
@ -173,7 +178,7 @@ bool Foam::cloudSolution::semiImplicit(const word& fieldName) const
{
if (fieldName == schemes_[i].first())
{
return schemes_[i].second() >= 0;
return schemes_[i].second().first();
}
}

View File

@ -25,7 +25,7 @@ Class
Foam::cloudSolution
Description
- Stores all relevant solution info
Stores all relevant solution info for cloud
SourceFiles
cloudSolutionI.H
@ -100,7 +100,7 @@ class cloudSolution
Switch resetSourcesOnStartup_;
//- List schemes, e.g. U semiImplicit 1
List<Tuple2<word, scalar> > schemes_;
List<Tuple2<word, Tuple2<bool, scalar> > > schemes_;
// Private Member Functions

View File

@ -67,8 +67,16 @@ class ReactingCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef ReactingCloud<CloudType> reactingCloudType;
private:
@ -146,8 +154,6 @@ protected:
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields

View File

@ -69,8 +69,16 @@ class ReactingMultiphaseCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef ReactingMultiphaseCloud<CloudType> reactingMultiphaseCloudType;
private:
@ -141,8 +149,6 @@ protected:
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields

View File

@ -65,8 +65,17 @@ class ThermoCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
// Public typedefs
//- Type of cloud this cloud was instantiated for
typedef CloudType cloudType;
//- Type of parcel the cloud was instantiated for
typedef typename CloudType::particleType parcelType;
//- Convenience typedef for this cloud type
typedef ThermoCloud<CloudType> thermoCloudType;
private:
@ -149,8 +158,6 @@ protected:
public:
typedef CloudType cloudType;
// Constructors
//- Construct given carrier gas fields

View File

@ -143,7 +143,7 @@ Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
return
hsTrans()/Vdt
- fvm::Sp(hsCoeff()/(Cp*Vdt), hs)
- fvm::SuSp(hsCoeff()/(Cp*Vdt), hs)
+ hsCoeff()/(Cp*Vdt)*hs;
}
else

View File

@ -28,6 +28,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CellZoneInjection.H"
#include "ConeInjection.H"
#include "FieldActivatedInjection.H"
#include "InflationInjection.H"
@ -43,6 +44,7 @@ License
\
makeInjectionModel(CloudType); \
\
makeInjectionModelType(CellZoneInjection, CloudType); \
makeInjectionModelType(ConeInjection, CloudType); \
makeInjectionModelType(FieldActivatedInjection, CloudType); \
makeInjectionModelType(InflationInjection, CloudType); \

View File

@ -28,6 +28,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CellZoneInjection.H"
#include "ConeInjection.H"
#include "FieldActivatedInjection.H"
#include "ManualInjection.H"
@ -40,6 +41,7 @@ License
#define makeReactingMultiphaseParcelInjectionModels(CloudType) \
\
makeInjectionModel(CloudType); \
makeInjectionModelType(CellZoneInjection, CloudType); \
makeInjectionModelType(ConeInjection, CloudType); \
makeInjectionModelType(FieldActivatedInjection, CloudType); \
makeInjectionModelType(ManualInjection, CloudType); \

View File

@ -28,6 +28,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CellZoneInjection.H"
#include "ConeInjection.H"
#include "FieldActivatedInjection.H"
#include "ManualInjection.H"
@ -40,6 +41,7 @@ License
#define makeReactingParcelInjectionModels(CloudType) \
\
makeInjectionModel(CloudType); \
makeInjectionModelType(CellZoneInjection, CloudType); \
makeInjectionModelType(ConeInjection, CloudType); \
makeInjectionModelType(FieldActivatedInjection, CloudType); \
makeInjectionModelType(ManualInjection, CloudType); \

View File

@ -0,0 +1,369 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "CellZoneInjection.H"
#include "mathematicalConstants.H"
#include "polyMeshTetDecomposition.H"
#include "globalIndex.H"
#include "Pstream.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class CloudType>
void Foam::CellZoneInjection<CloudType>::setPositions
(
const labelList& cellZoneCells
)
{
const fvMesh& mesh = this->owner().mesh();
const scalarField& V = mesh.V();
const label nCells = cellZoneCells.size();
cachedRandom& rnd = this->owner().rndGen();
DynamicList<vector> positions(nCells); // initial size only
DynamicList<label> injectorCells(nCells); // initial size only
DynamicList<label> injectorTetFaces(nCells); // initial size only
DynamicList<label> injectorTetPts(nCells); // initial size only
scalar newParticlesTotal = 0.0;
label addParticlesTotal = 0;
forAll(cellZoneCells, i)
{
const label cellI = cellZoneCells[i];
// Calc number of particles to add
const scalar newParticles = V[cellI]*numberDensity_;
newParticlesTotal += newParticles;
label addParticles = floor(newParticles);
addParticlesTotal += addParticles;
const scalar diff = newParticlesTotal - addParticlesTotal;
if (diff > 1)
{
label corr = floor(diff);
addParticles += corr;
addParticlesTotal += corr;
}
// Construct cell tet indices
const List<tetIndices> cellTetIs =
polyMeshTetDecomposition::cellTetIndices(mesh, cellI);
// Construct cell tet volume fractions
scalarList cTetVFrac(cellTetIs.size(), 0.0);
for (label tetI = 1; tetI < cellTetIs.size() - 1; tetI++)
{
cTetVFrac[tetI] =
(cTetVFrac[tetI-1] + cellTetIs[tetI].tet(mesh).mag())/V[cellI];
}
cTetVFrac.last() = 1.0;
// Set new particle position and cellId
for (label pI = 0; pI < addParticles; pI++)
{
const scalar volFrac = rnd.sample01<scalar>();
label tetI = 0;
forAll(cTetVFrac, vfI)
{
if (cTetVFrac[vfI] > volFrac)
{
tetI = vfI;
break;
}
}
positions.append(cellTetIs[tetI].tet(mesh).randomPoint(rnd));
injectorCells.append(cellI);
injectorTetFaces.append(cellTetIs[tetI].face());
injectorTetPts.append(cellTetIs[tetI].faceBasePt());
}
}
// Parallel operation manipulations
globalIndex globalPositions(positions.size());
List<vector> allPositions(globalPositions.size(), point::max);
List<label> allInjectorCells(globalPositions.size(), -1);
List<label> allInjectorTetFaces(globalPositions.size(), -1);
List<label> allInjectorTetPts(globalPositions.size(), -1);
// Gather all positions on to all processors
SubList<vector>
(
allPositions,
globalPositions.localSize(Pstream::myProcNo()),
globalPositions.offset(Pstream::myProcNo())
).assign(positions);
Pstream::listCombineGather(allPositions, minEqOp<point>());
Pstream::listCombineScatter(allPositions);
// Gather local cell tet and tet-point Ids, but leave non-local ids set -1
SubList<label>
(
allInjectorCells,
globalPositions.localSize(Pstream::myProcNo()),
globalPositions.offset(Pstream::myProcNo())
).assign(injectorCells);
SubList<label>
(
allInjectorTetFaces,
globalPositions.localSize(Pstream::myProcNo()),
globalPositions.offset(Pstream::myProcNo())
).assign(injectorTetFaces);
SubList<label>
(
allInjectorTetPts,
globalPositions.localSize(Pstream::myProcNo()),
globalPositions.offset(Pstream::myProcNo())
).assign(injectorTetPts);
// Transfer data
positions_.transfer(allPositions);
injectorCells_.transfer(allInjectorCells);
injectorTetFaces_.transfer(allInjectorTetFaces);
injectorTetPts_.transfer(allInjectorTetPts);
if (debug)
{
OFstream points("points.obj");
forAll(positions_, i)
{
meshTools::writeOBJ(points, positions_[i]);
}
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::CellZoneInjection<CloudType>::parcelsToInject
(
const scalar time0,
const scalar time1
)
{
if ((0.0 >= time0) && (0.0 < time1))
{
return positions_.size();
}
else
{
return 0;
}
}
template<class CloudType>
Foam::scalar Foam::CellZoneInjection<CloudType>::volumeToInject
(
const scalar time0,
const scalar time1
)
{
// All parcels introduced at SOI
if ((0.0 >= time0) && (0.0 < time1))
{
return this->volumeTotal_;
}
else
{
return 0.0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CellZoneInjection<CloudType>::CellZoneInjection
(
const dictionary& dict,
CloudType& owner
)
:
InjectionModel<CloudType>(dict, owner, typeName),
cellZoneName_(this->coeffDict().lookup("cellZone")),
numberDensity_(readScalar(this->coeffDict().lookup("numberDensity"))),
positions_(),
injectorCells_(),
injectorTetFaces_(),
injectorTetPts_(),
diameters_(),
U0_(this->coeffDict().lookup("U0")),
sizeDistribution_
(
distributionModels::distributionModel::New
(
this->coeffDict().subDict("sizeDistribution"), owner.rndGen()
)
)
{
const fvMesh& mesh = owner.mesh();
const label zoneI = mesh.cellZones().findZoneID(cellZoneName_);
if (zoneI < 0)
{
FatalErrorIn
(
"Foam::CellZoneInjection<CloudType>::CellZoneInjection"
"("
"const dictionary&, "
"CloudType&"
")"
) << "Unknown cell zone name: " << cellZoneName_
<< ". Valid cell zones are: " << mesh.cellZones().names()
<< nl << exit(FatalError);
}
const labelList& cellZoneCells = mesh.cellZones()[zoneI];
const label nCells = cellZoneCells.size();
const scalar nCellsTotal = returnReduce(nCells, sumOp<label>());
const scalar VCells = sum(scalarField(mesh.V(), cellZoneCells));
const scalar VCellsTotal = returnReduce(VCells, sumOp<scalar>());
Info<< " cell zone size = " << nCellsTotal << endl;
Info<< " cell zone volume = " << VCellsTotal << endl;
if ((nCells == 0) || (VCellsTotal*numberDensity_ < 1))
{
WarningIn
(
"Foam::CellZoneInjection<CloudType>::CellZoneInjection"
"("
"const dictionary&, "
"CloudType&"
")"
) << "Number of particles to be added to cellZone " << cellZoneName_
<< " is zero" << endl;
}
else
{
setPositions(cellZoneCells);
Info<< " number density = " << numberDensity_ << nl
<< " number of particles = " << positions_.size() << endl;
// Construct parcel diameters
diameters_.setSize(positions_.size());
forAll(diameters_, i)
{
diameters_[i] = sizeDistribution_->sample();
}
}
// Determine volume of particles to inject
this->volumeTotal_ = sum(pow3(diameters_))*constant::mathematical::pi/6.0;
}
template<class CloudType>
Foam::CellZoneInjection<CloudType>::CellZoneInjection
(
const CellZoneInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
cellZoneName_(im.cellZoneName_),
numberDensity_(im.numberDensity_),
positions_(im.positions_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_),
diameters_(im.diameters_),
U0_(im.U0_),
sizeDistribution_(im.sizeDistribution_().clone().ptr())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CellZoneInjection<CloudType>::~CellZoneInjection()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::CellZoneInjection<CloudType>::timeEnd() const
{
// Not used
return this->SOI_;
}
template<class CloudType>
void Foam::CellZoneInjection<CloudType>::setPositionAndCell
(
const label parcelI,
const label nParcels,
const scalar time,
vector& position,
label& cellOwner,
label& tetFaceI,
label& tetPtI
)
{
position = positions_[parcelI];
cellOwner = injectorCells_[parcelI];
tetFaceI = injectorTetFaces_[parcelI];
tetPtI = injectorTetPts_[parcelI];
}
template<class CloudType>
void Foam::CellZoneInjection<CloudType>::setProperties
(
const label parcelI,
const label,
const scalar,
typename CloudType::parcelType& parcel
)
{
// set particle velocity
parcel.U() = U0_;
// set particle diameter
parcel.d() = diameters_[parcelI];
}
template<class CloudType>
bool Foam::CellZoneInjection<CloudType>::fullyDescribed() const
{
return false;
}
template<class CloudType>
bool Foam::CellZoneInjection<CloudType>::validInjection(const label)
{
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,197 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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::CellZoneInjection
Description
Injection positions specified by a particle number density within a cell set
- User specifies
- Number density of particles in cell set (effective)
- Total mass to inject
- Initial parcel velocity
- Parcel diameters obtained by PDF model
- All parcels introduced at SOI
SourceFiles
CellZoneInjection.C
\*---------------------------------------------------------------------------*/
#ifndef CellZoneInjection_H
#define CellZoneInjection_H
#include "InjectionModel.H"
#include "distributionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class CellZoneInjection Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class CellZoneInjection
:
public InjectionModel<CloudType>
{
// Private data
//- Name of cell zone
const word& cellZoneName_;
//- Number density
const scalar numberDensity_;
//- Field of parcel positions
List<vector> positions_;
//- List of cell labels corresponding to injector positions
labelList injectorCells_;
//- List of tetFace labels corresponding to injector positions
labelList injectorTetFaces_;
//- List of tetPt labels corresponding to injector positions
labelList injectorTetPts_;
//- Field of parcel diameters
scalarList diameters_;
//- Initial parcel velocity
const vector U0_;
//- Parcel size distribution model
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
// Private Member Functions
//- Set the parcel injection positions
void setPositions(const labelList& cellZoneCells);
protected:
// Protected member functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
);
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
);
public:
//- Runtime type information
TypeName("cellZoneInjection");
// Constructors
//- Construct from dictionary
CellZoneInjection(const dictionary& dict, CloudType& owner);
//- Construct copy
CellZoneInjection(const CellZoneInjection<CloudType>& im);
//- Construct and return a clone
virtual autoPtr<InjectionModel<CloudType> > clone() const
{
return autoPtr<InjectionModel<CloudType> >
(
new CellZoneInjection<CloudType>(*this)
);
}
//- Destructor
virtual ~CellZoneInjection();
// Member Functions
//- Return the end-of-injection time
scalar timeEnd() const;
// Injection geometry
//- Set the injection position and owner cell, tetFace and tetPt
virtual void setPositionAndCell
(
const label parcelI,
const label nParcels,
const scalar time,
vector& position,
label& cellOwner,
label& tetFaceI,
label& tetPtI
);
//- Set the parcel properties
virtual void setProperties
(
const label parcelI,
const label nParcels,
const scalar time,
typename CloudType::parcelType& parcel
);
//- Flag to identify whether model fully describes the parcel
virtual bool fullyDescribed() const;
//- Return flag to identify whether or not injection of parcelI is
// permitted
virtual bool validInjection(const label parcelI);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CellZoneInjection.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ Description
- number of parcels to inject per injector
- parcel velocities
- inner and outer cone angles
- Parcel diameters obtained by distribution model model
- Parcel diameters obtained by distribution model
SourceFiles
ConeInjection.C
@ -97,7 +97,7 @@ class ConeInjection
//- Outer cone angle relative to SOI [deg]
const autoPtr<DataEntry<scalar> > thetaOuter_;
//- Parcel size distribution model model
//- Parcel size distribution model
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
//- Number of parcels per injector already injected

View File

@ -110,7 +110,7 @@ class FieldActivatedInjection
//- List of parcel diameters
scalarList diameters_;
//- Parcel size distribution model model
//- Parcel size distribution model
const autoPtr<distributionModels::distributionModel>
sizeDistribution_;

View File

@ -107,7 +107,7 @@ class InflationInjection
//- Diameter with which to create new seed particles
scalar dSeed_;
//- Parcel size distribution model model
//- Parcel size distribution model
const autoPtr<distributionModels::distributionModel> sizeDistribution_;

View File

@ -30,7 +30,7 @@ Description
- Total mass to inject
- Parcel positions in file \c positionsFile
- Initial parcel velocity
- Parcel diameters obtained by distribution model model
- Parcel diameters obtained by distribution model
- All parcels introduced at SOI
SourceFiles
@ -81,7 +81,7 @@ class ManualInjection
//- Initial parcel velocity
const vector U0_;
//- Parcel size distribution model model
//- Parcel size distribution model
const autoPtr<distributionModels::distributionModel> sizeDistribution_;

View File

@ -32,7 +32,7 @@ Description
- Injection duration
- Initial parcel velocity
- Injection volume flow rate
- Parcel diameters obtained by distribution model model
- Parcel diameters obtained by distribution model
- Parcels injected at cell centres adjacent to patch
SourceFiles
@ -84,7 +84,7 @@ class PatchInjection
//- Flow rate profile relative to SOI []
const autoPtr<DataEntry<scalar> > flowRateProfile_;
//- Parcel size distribution model model
//- Parcel size distribution model
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
//- List of cell labels corresponding to injector positions

View File

@ -33,9 +33,9 @@ Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
const label globalPatchI
) const
{
forAll(patchIds_, patchI)
forAll(patchIDs_, patchI)
{
if (patchIds_[patchI] == globalPatchI)
if (patchIDs_[patchI] == globalPatchI)
{
return patchI;
}
@ -130,8 +130,8 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
)
:
PatchInteractionModel<CloudType>(dict, cloud, typeName),
patchData_(this->coeffDict().lookup("patches")),
patchIds_(patchData_.size()),
patchData_(cloud.mesh(), this->coeffDict()),
patchIDs_(patchData_.size()),
nEscape0_(patchData_.size(), 0),
massEscape0_(patchData_.size(), 0.0),
nStick0_(patchData_.size(), 0),
@ -141,44 +141,6 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
nStick_(patchData_.size(), 0),
massStick_(patchData_.size(), 0.0)
{
const polyMesh& mesh = cloud.mesh();
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
// check that user patches are valid region patches
forAll(patchData_, patchI)
{
const word& patchName = patchData_[patchI].patchName();
patchIds_[patchI] = bMesh.findPatchID(patchName);
if (patchIds_[patchI] < 0)
{
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
<< "Patch " << patchName << " not found. Available patches "
<< "are: " << bMesh.names() << nl << exit(FatalError);
}
}
// check that all walls are specified
DynamicList<word> badWalls;
forAll(bMesh, patchI)
{
if
(
isA<wallPolyPatch>(bMesh[patchI])
&& applyToPatch(bMesh[patchI].index()) < 0
)
{
badWalls.append(bMesh[patchI].name());
}
}
if (badWalls.size() > 0)
{
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
<< "All wall patches must be specified when employing local patch "
<< "interaction. Please specify data for patches:" << nl
<< badWalls << nl << exit(FatalError);
}
// check that interactions are valid/specified
forAll(patchData_, patchI)
{
@ -211,7 +173,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
:
PatchInteractionModel<CloudType>(pim),
patchData_(pim.patchData_),
patchIds_(pim.patchIds_),
patchIDs_(pim.patchIDs_),
nEscape0_(pim.nEscape0_),
massEscape0_(pim.massEscape0_),
nStick0_(pim.nStick0_),

View File

@ -33,7 +33,7 @@ Description
#define LocalInteraction_H
#include "PatchInteractionModel.H"
#include "patchInteractionData.H"
#include "patchInteractionDataList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,10 +51,10 @@ class LocalInteraction
// Private data
//- List of participating patches
const List<patchInteractionData> patchData_;
const patchInteractionDataList patchData_;
//- List of participating patch ids
List<label> patchIds_;
List<label> patchIDs_;
// Counters for initial particle fates

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "patchInteractionDataList.H"
#include "stringListOps.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
Foam::patchInteractionDataList::patchInteractionDataList()
:
List<patchInteractionData>(),
patchGroupIDs_()
{}
Foam::patchInteractionDataList::patchInteractionDataList
(
const polyMesh& mesh,
const dictionary& dict
)
:
List<patchInteractionData>(dict.lookup("patches")),
patchGroupIDs_(this->size())
{
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
const wordList allPatchNames = bMesh.names();
const List<patchInteractionData>& items = *this;
forAllReverse(items, i)
{
const word& patchName = items[i].patchName();
labelList patchIDs = findStrings(patchName, allPatchNames);
if (patchIDs.empty())
{
WarningIn
(
"Foam::patchInteractionDataList::patchInteractionDataList"
"("
"const polyMesh&, "
"const dictionary&"
")"
) << "Cannot find any patch names matching " << patchName
<< endl;
}
patchGroupIDs_[i].transfer(patchIDs);
}
// check that all walls are specified
DynamicList<word> badWalls;
forAll(bMesh, patchI)
{
const polyPatch& pp = bMesh[patchI];
if (isA<wallPolyPatch>(pp) && applyToPatch(pp.index()) < 0)
{
badWalls.append(pp.name());
}
}
if (badWalls.size() > 0)
{
FatalErrorIn
(
"Foam::patchInteractionDataList::patchInteractionDataList"
"("
"const polyMesh&, "
"const dictionary&"
")"
) << "All wall patches must be specified when employing local patch "
<< "interaction. Please specify data for patches:" << nl
<< badWalls << nl << exit(FatalError);
}
}
Foam::patchInteractionDataList::patchInteractionDataList
(
const patchInteractionDataList& pidl
)
:
List<patchInteractionData>(pidl),
patchGroupIDs_(pidl.patchGroupIDs_)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::label Foam::patchInteractionDataList::applyToPatch(const label id) const
{
forAll(patchGroupIDs_, groupI)
{
const labelList& patchIDs = patchGroupIDs_[groupI];
forAll(patchIDs, patchI)
{
if (patchIDs[patchI] == id)
{
return groupI;
}
}
}
return -1;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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::patchInteractionDataList
Description
List container for patchInteractionData class
\*---------------------------------------------------------------------------*/
#ifndef patchInteractionDataList_H
#define patchInteractionDataList_H
#include "patchInteractionData.H"
#include "polyMesh.H"
#include "dictionary.H"
#include "labelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class patchInteractionDataList Declaration
\*---------------------------------------------------------------------------*/
class patchInteractionDataList
:
public List<patchInteractionData>
{
private:
// Private data
//- List of patch IDs for each patch group
labelListList patchGroupIDs_;
public:
// Constructor
//- Construct null
patchInteractionDataList();
//- Construct copy
patchInteractionDataList(const patchInteractionDataList& pidl);
//- Construct from Istream
patchInteractionDataList(const polyMesh& mesh, const dictionary& dict);
// Member functions
//- Return label of group containing patch id
// Returns -1 if patch id is not present
label applyToPatch(const label id) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ License
#include "PatchPostProcessing.H"
#include "Pstream.H"
#include "stringListOps.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -35,12 +36,15 @@ Foam::label Foam::PatchPostProcessing<CloudType>::applyToPatch
const label globalPatchI
) const
{
forAll(patchIds_, patchI)
label patchI = 0;
forAllConstIter(labelHashSet, patchIDs_, iter)
{
if (patchIds_[patchI] == globalPatchI)
if (iter.key() == globalPatchI)
{
return patchI;
}
patchI++;
}
return -1;
@ -52,16 +56,18 @@ Foam::label Foam::PatchPostProcessing<CloudType>::applyToPatch
template<class CloudType>
void Foam::PatchPostProcessing<CloudType>::write()
{
forAll(patchData_, patchI)
forAll(patchData_, i)
{
List<List<string> > procData(Pstream::nProcs());
procData[Pstream::myProcNo()] = patchData_[patchI];
procData[Pstream::myProcNo()] = patchData_[i];
Pstream::gatherList(procData);
if (Pstream::master())
{
fileName outputDir = this->owner().time().path();
const fvMesh& mesh = this->owner().mesh();
fileName outputDir = mesh.time().path();
if (Pstream::parRun())
{
@ -69,24 +75,26 @@ void Foam::PatchPostProcessing<CloudType>::write()
// distributed data running)
outputDir =
outputDir/".."/"postProcessing"/cloud::prefix/
this->owner().name()/this->owner().time().timeName();
this->owner().name()/mesh.time().timeName();
}
else
{
outputDir =
outputDir/"postProcessing"/cloud::prefix/
this->owner().name()/this->owner().time().timeName();
this->owner().name()/mesh.time().timeName();
}
// Create directory if it doesn't exist
mkDir(outputDir);
const word& patchName = mesh.boundaryMesh()[patchIDs_[i]].name();
OFstream patchOutFile
(
outputDir/patchNames_[patchI] + ".post",
outputDir/patchName + ".post",
IOstream::ASCII,
IOstream::currentVersion,
this->owner().time().writeCompression()
mesh.time().writeCompression()
);
List<string> globalData;
@ -99,13 +107,13 @@ void Foam::PatchPostProcessing<CloudType>::write()
patchOutFile<< "# Time " + parcelType::propHeader << nl;
forAll(globalData, i)
forAll(globalData, dataI)
{
patchOutFile<< globalData[i].c_str() << nl;
patchOutFile<< globalData[dataI].c_str() << nl;
}
}
patchData_[patchI].clearStorage();
patchData_[i].clearStorage();
}
}
@ -121,29 +129,36 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
:
PostProcessingModel<CloudType>(dict, owner, typeName),
maxStoredParcels_(readLabel(this->coeffDict().lookup("maxStoredParcels"))),
patchNames_(this->coeffDict().lookup("patches")),
patchData_(patchNames_.size()),
patchIds_(patchNames_.size())
patchIDs_(),
patchData_()
{
const polyBoundaryMesh& bMesh = this->owner().mesh().boundaryMesh();
forAll(patchNames_, patchI)
const wordList allPatchNames = owner.mesh().boundaryMesh().names();
wordList patchName(this->coeffDict().lookup("patches"));
forAllReverse(patchName, i)
{
const label id = bMesh.findPatchID(patchNames_[patchI]);
if (id < 0)
labelList patchIDs = findStrings(patchName[i], allPatchNames);
if (patchIDs.empty())
{
FatalErrorIn
WarningIn
(
"PatchPostProcessing<CloudType>::PatchPostProcessing"
"Foam::PatchPostProcessing<CloudType>::PatchPostProcessing"
"("
"const dictionary&, "
"CloudType& owner"
"CloudType& "
")"
)<< "Requested patch " << patchNames_[patchI] << " not found" << nl
<< "Available patches are: " << bMesh.names() << nl
<< exit(FatalError);
) << "Cannot find any patch names matching " << patchName[i]
<< endl;
}
forAll(patchIDs, j)
{
patchIDs_.insert(patchIDs[j]);
}
patchIds_[patchI] = id;
}
patchData_.setSize(patchIDs_.size());
}
@ -155,9 +170,8 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
:
PostProcessingModel<CloudType>(ppm),
maxStoredParcels_(ppm.maxStoredParcels_),
patchNames_(ppm.patchNames_),
patchData_(ppm.patchData_),
patchIds_(ppm.patchIds_)
patchIDs_(ppm.patchIDs_),
patchData_(ppm.patchData_)
{}
@ -177,8 +191,8 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
const label patchI
)
{
label localPatchI = applyToPatch(patchI);
if (localPatchI >= 0 && patchData_[localPatchI].size() < maxStoredParcels_)
const label localPatchI = applyToPatch(patchI);
if (localPatchI != -1 && patchData_[localPatchI].size() < maxStoredParcels_)
{
OStringStream data;
data<< this->owner().time().timeName() << ' ' << p;

View File

@ -58,15 +58,12 @@ class PatchPostProcessing
//- Maximum number of parcels to store
label maxStoredParcels_;
//- List of patch names
wordList patchNames_;
//- List of patch indices to post-process
labelHashSet patchIDs_;
//- List of output data per patch
List<DynamicList<string> > patchData_;
//- Mapping from local to global patch ids
labelList patchIds_;
// Private Member Functions
@ -117,11 +114,8 @@ public:
//- Return maximum number of parcels to store per patch
inline label maxStoredParcels() const;
//- Return const access to the list of patch names
inline const wordList& patchNames() const;
//- Return const mapping from local to global patch ids
inline const labelList& patchIds() const;
inline const labelList& patchIDs() const;
// Evaluation

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,17 +31,9 @@ Foam::label Foam::PatchPostProcessing<CloudType>::maxStoredParcels() const
template<class CloudType>
const Foam::wordList& Foam::PatchPostProcessing<CloudType>::patchNames() const
const Foam::labelList& Foam::PatchPostProcessing<CloudType>::patchIDs() const
{
return patchNames_;
}
template<class CloudType>
const Foam::labelList&
Foam::PatchPostProcessing<CloudType>::patchIds() const
{
return patchIds_;
return patchIDs_;
}

View File

@ -24,8 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "SurfaceFilmModel.H"
#include "mathematicalConstants.H"
#include "surfaceFilmModel.H"
#include "mathematicalConstants.H"
#include "directMappedWallPolyPatch.H"
using namespace Foam::constant;
@ -133,29 +133,34 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
}
// Retrieve the film model from the owner database
const surfaceFilmModels::surfaceFilmModel& filmModel =
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel =
this->owner().db().objectRegistry::template lookupObject
<surfaceFilmModels::surfaceFilmModel>
<regionModels::surfaceFilmModels::surfaceFilmModel>
(
"surfaceFilmProperties"
);
const labelList& filmPatches = filmModel.filmBottomPatchIDs();
if (!filmModel.active())
{
return;
}
const labelList& filmPatches = filmModel.intCoupledPatchIDs();
const labelList& primaryPatches = filmModel.primaryPatchIDs();
const polyBoundaryMesh& pbm = this->owner().mesh().boundaryMesh();
forAll(filmPatches, i)
{
const label primaryPatchI = primaryPatches[i];
const directMappedWallPolyPatch& wpp =
refCast<const directMappedWallPolyPatch>
(
this->owner().mesh().boundaryMesh()[primaryPatchI]
);
const labelList& injectorCellsPatch = wpp.faceCells();
const label filmPatchI = filmPatches[i];
const mapDistribute& distMap = wpp.map();
const label primaryPatchI = primaryPatches[i];
const directMappedPatchBase& mapPatch =
filmModel.mappedPatches()[filmPatchI];
const mapDistribute& distMap = mapPatch.map();
const labelList& injectorCellsPatch = pbm[primaryPatchI].faceCells();
cacheFilmFields(filmPatchI, primaryPatchI, distMap, filmModel);
forAll(injectorCellsPatch, j)
@ -209,7 +214,7 @@ void Foam::SurfaceFilmModel<CloudType>::cacheFilmFields
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
)
{
massParcelPatch_ = filmModel.massForPrimary().boundaryField()[filmPatchI];

View File

@ -47,9 +47,12 @@ namespace Foam
{
// Forward declaration of classes
namespace surfaceFilmModels
namespace regionModels
{
class surfaceFilmModel;
namespace surfaceFilmModels
{
class surfaceFilmModel;
}
}
class mapDistribute;
@ -114,7 +117,7 @@ protected:
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
);
//- Set the individual parcel properties

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -90,6 +90,9 @@ public:
//- Destructor
virtual ~SubModelBase();
//- Type of cloud this model was instantiated for
typedef CloudType cloudType;
// Member Functions

View File

@ -141,7 +141,7 @@ Foam::vector Foam::ThermoSurfaceFilm<CloudType>::splashDirection
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::absorbInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
@ -218,7 +218,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::bounceInteraction
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::drySplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
@ -274,7 +274,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::drySplashInteraction
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::wetSplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
parcelType& p,
const polyPatch& pp,
const label faceI,
@ -331,6 +331,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::wetSplashInteraction
U = -epsilon*(Un) + 5/7*(Ut);
keepParticle = true;
return;
}
else if ((We >= 20) && (We < Wec)) // spread - assume absorb
{
@ -350,7 +351,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::wetSplashInteraction
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
@ -390,8 +391,8 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
const scalar dBarSplash = 1/cbrt(6.0)*cbrt(mRatio/Ns)*d + ROOTVSMALL;
// cumulative diameter splash distribution
const scalar dMin = 0.01*d;
const scalar dMax = d;
const scalar dMax = cbrt(mRatio)*d;
const scalar dMin = 0.001*dMax;
const scalar K = exp(-dMin/dBarSplash) - exp(-dMax/dBarSplash);
// surface energy of secondary parcels [J]
@ -567,11 +568,11 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
)
{
// Retrieve the film model from the owner database
surfaceFilmModels::surfaceFilmModel& filmModel =
const_cast<surfaceFilmModels::surfaceFilmModel&>
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel =
const_cast<regionModels::surfaceFilmModels::surfaceFilmModel&>
(
this->owner().db().objectRegistry::template
lookupObject<surfaceFilmModels::surfaceFilmModel>
lookupObject<regionModels::surfaceFilmModels::surfaceFilmModel>
(
"surfaceFilmProperties"
)
@ -579,7 +580,7 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
const label patchI = pp.index();
if (filmModel.isFilmPatch(patchI))
if (filmModel.isRegionPatch(patchI))
{
const label faceI = pp.whichFace(p.face());
@ -627,10 +628,11 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
}
}
// transfer parcel/parcel interactions complete
return true;
}
// do not transfer parcel
// parcel not interacting with film
return false;
}
@ -641,7 +643,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
)
{
SurfaceFilmModel<CloudType>::cacheFilmFields

View File

@ -104,7 +104,7 @@ protected:
const SLGThermo& thermo_;
// Cached injector fields per film patch
// Cached injector fields per film patch
//- Film temperature / patch face
scalarList TFilmPatch_;
@ -168,7 +168,7 @@ protected:
//- Absorb parcel into film
void absorbInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
@ -188,7 +188,7 @@ protected:
//- Parcel interaction with dry surface
void drySplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
@ -198,7 +198,7 @@ protected:
//- Parcel interaction with wetted surface
void wetSplashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
parcelType& p,
const polyPatch& pp,
const label faceI,
@ -208,7 +208,7 @@ protected:
//- Bai parcel splash interaction model
void splashInteraction
(
surfaceFilmModels::surfaceFilmModel& filmModel,
regionModels::surfaceFilmModels::surfaceFilmModel& filmModel,
const parcelType& p,
const polyPatch& pp,
const label faceI,
@ -228,7 +228,8 @@ protected:
const label filmPatchI,
const label primaryPatchI,
const mapDistribute& distMap,
const surfaceFilmModels::surfaceFilmModel& filmModel
const regionModels::surfaceFilmModels::surfaceFilmModel&
filmModel
);
//- Set the individual parcel properties
@ -247,7 +248,7 @@ public:
// Constructors
//- Construct from components
//- Construct from components
ThermoSurfaceFilm
(
const dictionary& dict,

11
src/regionModels/Allwmake Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso regionModel
#wmake libso pyrolysisModels
wmake libso surfaceFilmModels
#wmake libso regionCoupling
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,7 @@
/* Region models */
regionModel/regionModel.C
singleLayerRegion/singleLayerRegion.C
regionModel1D/regionModel1D.C
LIB = $(FOAM_LIBBIN)/libregionModels

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,283 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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
\*---------------------------------------------------------------------------*/
#include "regionModel.H"
#include "fvMesh.H"
#include "Time.H"
#include "directMappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
defineTypeNameAndDebug(regionModel, 0);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::regionModels::regionModel::constructMeshObjects()
{
// construct region mesh
regionMeshPtr_.reset
(
new fvMesh
(
IOobject
(
lookup("regionName"),
time_.timeName(),
time_,
IOobject::MUST_READ
)
)
);
}
void Foam::regionModels::regionModel::initialise()
{
if (debug)
{
Pout<< "regionModel::initialise()" << endl;
}
label nBoundaryFaces = 0;
DynamicList<label> primaryPatchIDs;
DynamicList<label> intCoupledPatchIDs;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
const polyBoundaryMesh& pbm = primaryMesh().boundaryMesh();
mappedPatches_.setSize(rbm.size());
forAll(rbm, patchI)
{
const polyPatch& regionPatch = rbm[patchI];
if (isA<directMappedWallPolyPatch>(regionPatch))
{
if (debug)
{
Pout<< "found " << directMappedWallPolyPatch::typeName
<< " " << regionPatch.name() << endl;
}
intCoupledPatchIDs.append(patchI);
nBoundaryFaces += regionPatch.faceCells().size();
const directMappedWallPolyPatch& dmp =
refCast<const directMappedWallPolyPatch>(regionPatch);
const label primaryPatchI = dmp.samplePolyPatch().index();
primaryPatchIDs.append(primaryPatchI);
mappedPatches_.set
(
patchI,
new directMappedPatchBase
(
pbm[primaryPatchI],
regionMesh().name(),
directMappedPatchBase::NEARESTPATCHFACE,
regionPatch.name(),
vector::zero
)
);
}
}
primaryPatchIDs_.transfer(primaryPatchIDs);
intCoupledPatchIDs_.transfer(intCoupledPatchIDs);
// mappedPatches_.resize(nCoupledPatches);
if (nBoundaryFaces == 0)
{
WarningIn("regionModel::initialise()")
<< "Region model being applied without direct mapped boundary "
<< "conditions" << endl;
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::regionModels::regionModel::read()
{
if (regIOobject::read())
{
if (active_)
{
if (const dictionary* dictPtr = subDictPtr(modelName_ + "Coeffs"))
{
coeffs_ <<= *dictPtr;
}
infoOutput_.readIfPresent("infoOutput", *this);
}
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::regionModel::regionModel(const fvMesh& mesh)
:
IOdictionary
(
IOobject
(
"regionModelProperties",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
)
),
primaryMesh_(mesh),
time_(mesh.time()),
active_(false),
infoOutput_(false),
modelName_("none"),
regionMeshPtr_(NULL),
coeffs_(dictionary::null),
primaryPatchIDs_(),
intCoupledPatchIDs_(),
mappedPatches_()
{}
Foam::regionModels::regionModel::regionModel
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields
)
:
IOdictionary
(
IOobject
(
regionType + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
primaryMesh_(mesh),
time_(mesh.time()),
active_(lookup("active")),
infoOutput_(true),
modelName_(modelName),
regionMeshPtr_(NULL),
coeffs_(subOrEmptyDict(modelName + "Coeffs")),
primaryPatchIDs_(),
intCoupledPatchIDs_(),
mappedPatches_()
{
if (active_)
{
constructMeshObjects();
initialise();
if (readFields)
{
read();
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionModels::regionModel::~regionModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::regionModels::regionModel::preEvolveRegion()
{
// do nothing
}
void Foam::regionModels::regionModel::evolveRegion()
{
// do nothing
}
void Foam::regionModels::regionModel::evolve()
{
if (active_)
{
if (primaryMesh_.changing())
{
FatalErrorIn("regionModel::evolve()")
<< "Currently not possible to apply " << modelName_
<< " model to moving mesh cases" << nl << abort(FatalError);
}
Info<< "\nEvolving " << modelName_ << " for region "
<< regionMesh().name() << endl;
// Update any input information
read();
// Pre-evolve
preEvolveRegion();
// Increment the region equations up to the new time level
evolveRegion();
// Provide some feedback
if (infoOutput_)
{
Info<< incrIndent;
info();
Info<< endl << decrIndent;
}
}
}
void Foam::regionModels::regionModel::info() const
{
// do nothing
}
// ************************************************************************* //

View File

@ -0,0 +1,236 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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::regionModel
Description
Base class for region models
SourceFiles
regionModelI.H
regionModel.C
\*---------------------------------------------------------------------------*/
#ifndef regionModel_H
#define regionModel_H
#include "IOdictionary.H"
#include "Switch.H"
#include "labelList.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
//class fvMesh;
//class Time;
namespace regionModels
{
/*---------------------------------------------------------------------------*\
Class regionModel Declaration
\*---------------------------------------------------------------------------*/
class regionModel
:
public IOdictionary
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
regionModel(const regionModel&);
//- Disallow default bitwise assignment
void operator=(const regionModel&);
//- Construct region mesh and fields
void constructMeshObjects();
//- Initialise the region
void initialise();
protected:
// Protected data
//- Reference to the primary mesh database
const fvMesh& primaryMesh_;
//- Reference to the time database
const Time& time_;
//- Active flag
Switch active_;
//- Active information output
Switch infoOutput_;
//- Model name
const word modelName_;
//- Pointer to the region mesh database
autoPtr<fvMesh> regionMeshPtr_;
//- Model coefficients dictionary
dictionary coeffs_;
// Addressing
//- List of patch IDs on the primary region coupled to this region
labelList primaryPatchIDs_;
//- List of patch IDs internally coupled with the primary region
labelList intCoupledPatchIDs_;
//- List of patch map info
PtrList<directMappedPatchBase> mappedPatches_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
public:
//- Runtime type information
TypeName("regionModel");
// Constructors
//- Construct null
regionModel(const fvMesh& mesh);
//- Construct from mesh, region type and name
regionModel
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields = true
);
//- Destructor
virtual ~regionModel();
// Member Functions
// Access
//- Return the reference to the primary mesh database
inline const fvMesh& primaryMesh() const;
//- Return the reference to the time database
inline const Time& time() const;
//- Return the active flag
inline const Switch& active() const;
//- Return the model name
inline const word& modelName() const;
//- Return the region mesh database
inline const fvMesh& regionMesh() const;
//- Return the region mesh database for manipulation
inline fvMesh& regionMesh();
//- Return the model coefficients dictionary
inline const dictionary& coeffs() const;
//- Return the solution dictionary
inline const dictionary& solution() const;
// Addressing
//- Return true if patchI on the primary region is a coupled
// patch to the local region
inline bool isRegionPatch(const label patchI) const;
//- Return the list of patch IDs on the primary region coupled
// to this region
inline const labelList& primaryPatchIDs() const;
//- Return the list of patch IDs internally coupled with the
// primary region
inline const labelList& intCoupledPatchIDs() const;
//- Return the list of patch map info
inline const PtrList<directMappedPatchBase>&
mappedPatches() const;
//- Return region ID corresponding to primaryPatchID
inline label regionPatchID(const label primaryPatchID) const;
// Evolution
//- Pre-evolve region
virtual void preEvolveRegion();
//- Evolve the region
virtual void evolveRegion();
//- Evolve the film
virtual void evolve();
// I-O
//- Provide some feedback
virtual void info() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "regionModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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
\*---------------------------------------------------------------------------*/
#include "regionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::fvMesh&
Foam::regionModels::regionModel::primaryMesh() const
{
return primaryMesh_;
}
inline const Foam::Time& Foam::regionModels::regionModel::time() const
{
return time_;
}
inline const Foam::Switch& Foam::regionModels::regionModel::active() const
{
return active_;
}
inline const Foam::word& Foam::regionModels::regionModel::modelName() const
{
return modelName_;
}
inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
{
if (!regionMeshPtr_.valid())
{
FatalErrorIn
(
"inline const Foam::fvMesh&"
"Foam::regionModels::regionModel::regionMesh() const"
)<< "Region mesh not available" << abort(FatalError);
}
return regionMeshPtr_();
}
inline Foam::fvMesh& Foam::regionModels::regionModel::regionMesh()
{
if (!regionMeshPtr_.valid())
{
FatalErrorIn
(
"inline Foam::fvMesh&"
"Foam::regionModels::regionModel::regionMesh()"
)<< "Region mesh not available" << abort(FatalError);
}
return regionMeshPtr_();
}
inline const Foam::dictionary& Foam::regionModels::regionModel::coeffs() const
{
return coeffs_;
}
inline const Foam::dictionary&
Foam::regionModels::regionModel::solution() const
{
return regionMesh().solutionDict();
}
inline bool Foam::regionModels::regionModel::isRegionPatch
(
const label patchI
) const
{
forAll(primaryPatchIDs_, i)
{
if (primaryPatchIDs_[i] == patchI)
{
return true;
}
}
return false;
}
inline const Foam::labelList&
Foam::regionModels::regionModel::primaryPatchIDs() const
{
return primaryPatchIDs_;
}
inline const Foam::labelList&
Foam::regionModels::regionModel::intCoupledPatchIDs() const
{
return intCoupledPatchIDs_;
}
inline const Foam::PtrList<Foam::directMappedPatchBase>&
Foam::regionModels::regionModel::mappedPatches() const
{
return mappedPatches_;
}
inline Foam::label Foam::regionModels::regionModel::regionPatchID
(
const label primaryPatchID
) const
{
forAll(primaryPatchIDs_, i)
{
if (primaryPatchIDs_[i] == primaryPatchID)
{
return intCoupledPatchIDs_[i];
}
}
return -1;
}
// ************************************************************************* //

View File

@ -0,0 +1,308 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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
\*---------------------------------------------------------------------------*/
#include "regionModel1D.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
defineTypeNameAndDebug(regionModel1D, 0);
}
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::regionModels::regionModel1D::constructMeshObjects()
{
const fvMesh& regionMesh = regionMeshPtr_();
nMagSfPtr_.reset
(
new surfaceScalarField
(
IOobject
(
"nMagSf",
time().timeName(),
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
regionMesh,
dimensionedScalar("zero", dimArea, 0.0)
)
);
}
void Foam::regionModels::regionModel1D::initialise()
{
if (debug)
{
Pout<< "regionModel1D::initialise()" << endl;
}
// Calculate boundaryFaceFaces and boundaryFaceCells
DynamicList<label> faceIDs;
DynamicList<label> cellIDs;
label localPyrolysisFaceI = 0;
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
const polyPatch& ppCoupled = rbm[patchI];
forAll(ppCoupled, localFaceI)
{
label faceI = ppCoupled.start() + localFaceI;
label cellI = -1;
label nFaces = 0;
label nCells = 0;
do
{
label ownCellI = regionMesh().faceOwner()[faceI];
if (ownCellI != cellI)
{
cellI = ownCellI;
}
else
{
cellI = regionMesh().faceNeighbour()[faceI];
}
nCells++;
cellIDs.append(cellI);
const cell& cFaces = regionMesh().cells()[cellI];
faceI = cFaces.opposingFaceLabel(faceI, regionMesh().faces());
faceIDs.append(faceI);
nFaces++;
} while (regionMesh().isInternalFace(faceI));
boundaryFaceOppositeFace_[localPyrolysisFaceI] = faceI;
faceIDs.remove(); //remove boundary face.
nFaces--;
boundaryFaceFaces_[localPyrolysisFaceI].transfer(faceIDs);
boundaryFaceCells_[localPyrolysisFaceI].transfer(cellIDs);
localPyrolysisFaceI++;
}
}
boundaryFaceOppositeFace_.setSize(localPyrolysisFaceI);
surfaceScalarField& nMagSf = nMagSfPtr_();
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
const polyPatch& ppCoupled = rbm[patchI];
const vectorField& pNormals = ppCoupled.faceNormals();
nMagSf.boundaryField()[patchI] =
regionMesh().Sf().boundaryField()[patchI] & pNormals;
forAll(pNormals, localFaceI)
{
const vector& n = pNormals[localFaceI];
const labelList& faces = boundaryFaceFaces_[localFaceI];
forAll (faces, faceI)
{
const label faceID = faces[faceI];
nMagSf[faceID] = regionMesh().Sf()[faceID] & n;
}
}
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::regionModels::regionModel1D::read()
{
if (regionModel::read())
{
moveMesh_.readIfPresent("moveMesh", coeffs_);
return true;
}
else
{
return false;
}
}
Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
(
const scalarList& deltaV,
const scalar minDelta
)
{
tmp<labelField> tcellMoveMap(new labelField(regionMesh().nCells(), 0));
labelField& cellMoveMap = tcellMoveMap();
if (!moveMesh_)
{
return cellMoveMap;
}
pointField oldPoints = regionMesh().points();
pointField newPoints = oldPoints;
const polyBoundaryMesh& bm = regionMesh().boundaryMesh();
forAll(intCoupledPatchIDs_, localPatchI)
{
label patchI = intCoupledPatchIDs_[localPatchI];
const polyPatch pp = bm[patchI];
const vectorField& cf = regionMesh().Cf().boundaryField()[patchI];
forAll(pp, patchFaceI)
{
const labelList& faces = boundaryFaceFaces_[patchFaceI];
const labelList& cells = boundaryFaceCells_[patchFaceI];
const vector n = pp.faceNormals()[patchFaceI];
const vector sf = pp.faceAreas()[patchFaceI];
List<point> oldCf(faces.size() + 1);
oldCf[0] = cf[patchFaceI];
forAll(faces, i)
{
oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
}
vector newDelta = vector::zero;
point nbrCf = oldCf[0];
forAll(faces, i)
{
const label faceI = faces[i];
const label cellI = cells[i];
const face f = regionMesh().faces()[faceI];
newDelta += (deltaV[cellI]/mag(sf))*n;
vector localDelta = vector::zero;
forAll(f, pti)
{
const label pointI = f[pti];
if
(
((nbrCf - (oldPoints[pointI] + newDelta)) & n)
> minDelta
)
{
newPoints[pointI] = oldPoints[pointI] + newDelta;
localDelta = newDelta;
cellMoveMap[cellI] = 1;
}
}
nbrCf = oldCf[i + 1] + localDelta;
}
// Modify boundary
const label bFaceI = boundaryFaceOppositeFace_[patchFaceI];
const face f = regionMesh().faces()[bFaceI];
const label cellI = cells[cells.size() - 1];
newDelta += (deltaV[cellI]/mag(sf))*n;
forAll(f, pti)
{
const label pointI = f[pti];
if
(
((nbrCf - (oldPoints[pointI] + newDelta)) & n)
> minDelta
)
{
newPoints[pointI] = oldPoints[pointI] + newDelta;
cellMoveMap[cellI] = 1;
}
}
}
}
// Move points
regionMesh().movePoints(newPoints);
return tcellMoveMap;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionModels::regionModel1D::regionModel1D(const fvMesh& mesh)
:
regionModel(mesh),
boundaryFaceFaces_(),
boundaryFaceCells_(),
boundaryFaceOppositeFace_(),
nMagSfPtr_(NULL),
moveMesh_(false)
{}
Foam::regionModels::regionModel1D::regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields
)
:
regionModel(mesh, regionType, modelName, false),
boundaryFaceFaces_(regionMesh().nCells()),
boundaryFaceCells_(regionMesh().nCells()),
boundaryFaceOppositeFace_(regionMesh().nCells()),
nMagSfPtr_(NULL),
moveMesh_(true)
{
if (active_)
{
constructMeshObjects();
initialise();
if (readFields)
{
read();
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionModels::regionModel1D::~regionModel1D()
{}
// ************************************************************************* //

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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::regionModel1D
Description
Base class for 1-D region models
SourceFiles
regionModel1D.C
\*---------------------------------------------------------------------------*/
#ifndef regionModel1D_H
#define regionModel1D_H
#include "regionModel.H"
#include "surfaceFields.H"
#include "labelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
/*---------------------------------------------------------------------------*\
Class regionModel1D Declaration
\*---------------------------------------------------------------------------*/
class regionModel1D
:
public regionModel
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
regionModel1D(const regionModel1D&);
//- Disallow default bitwise assignment
void operator=(const regionModel1D&);
//- Construct region mesh and fields
void constructMeshObjects();
//- Initialise the region
void initialise();
protected:
// Protected data
// Region addressing - per internally coupled patch face walking out
//- Global face IDs
labelListList boundaryFaceFaces_;
//- Global cell IDs
labelListList boundaryFaceCells_;
//- Global boundary face IDs oppossite coupled patch
labelList boundaryFaceOppositeFace_;
// Geometry
//- Face area magnitude normal to patch
autoPtr<surfaceScalarField> nMagSfPtr_;
//- Flag to allow mesh movement
Switch moveMesh_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
//- Move mesh points according to change in cell volumes
// Returns map ordered by cell where 1 = cell moved, 0 = cell unchanged
tmp<labelField> moveMesh
(
const scalarList& deltaV,
const scalar minDelta = 0.0
);
public:
//- Runtime type information
TypeName("regionModel");
// Constructors
//- Construct null
regionModel1D(const fvMesh& mesh);
//- Construct from mesh, region type and name
regionModel1D
(
const fvMesh& mesh,
const word& regionType,
const word& modelName,
bool readFields = true
);
//- Destructor
virtual ~regionModel1D();
// Member Functions
// Access
// Addressing
//- Return the global face IDs
inline const labelListList& boundaryFaceFaces() const;
//- Return the global cell IDs
inline const labelListList& boundaryFaceCells() const;
//- Return the global boundary face IDs oppossite coupled patch
inline const labelList& boundaryFaceOppositeFace() const;
// Geometry
//- Return the face area magnitudes / [m2]
inline const surfaceScalarField& nMagSf() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "regionModel1DI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 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
\*---------------------------------------------------------------------------*/
#include "regionModel1D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::labelListList&
Foam::regionModels::regionModel1D::boundaryFaceFaces() const
{
return boundaryFaceFaces_;
}
inline const Foam::labelListList&
Foam::regionModels::regionModel1D::boundaryFaceCells() const
{
return boundaryFaceCells_;
}
inline const Foam::labelList&
Foam::regionModels::regionModel1D::boundaryFaceOppositeFace() const
{
return boundaryFaceOppositeFace_;
}
inline const Foam::surfaceScalarField&
Foam::regionModels::regionModel1D::nMagSf() const
{
if (!nMagSfPtr_.valid())
{
FatalErrorIn
(
"inline const Foam::surfaceScalarField&"
"Foam::regionModel1Ds::regionModel1D::nMagSf() const"
)<< "Face normal areas not available" << abort(FatalError);
}
return nMagSfPtr_();
}
// ************************************************************************* //

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