ENH: Multiple commits - lumped due to git index file corruption

- Re-located mapped point patches
- Updated mapped patch write
- deprecated directMapped in favour of mapped
- updated resulting dependancies - apps/libs/tuts
This commit is contained in:
andy
2011-09-09 12:05:12 +01:00
parent 531b721d4b
commit 8ae9569085
106 changed files with 558 additions and 5444 deletions

View File

@ -3,8 +3,8 @@ cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso phaseModel
wmake libso interfacialModels
wmake libso multiphaseSystem
wmake libso interfacialModels
wmake libso kineticTheoryModels
wmake

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -ggdb3 \
-IphaseModel/lnInclude \
-ImultiphaseSystem/lnInclude \
/*-IkineticTheoryModels/lnInclude*/ \

View File

@ -33,7 +33,7 @@ forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
+ (alpha/phase.rho())*fluid.Svm(phase)
)
);
mrfZones.addCoriolis(alpha, UEqns[phasei]);
mrfZones.addCoriolis(UEqns[phasei]);
UEqns[phasei].relax();
phasei++;

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -ggdb3 \
-I../phaseModel/lnInclude \
-I../interfacialModels/lnInclude \
-IalphaContactAngle \

View File

@ -56,6 +56,9 @@ void Foam::multiphaseSystem::calcAlphas()
void Foam::multiphaseSystem::solveAlphas()
{
word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)");
surfaceScalarField phic(mag(phi_/mesh_.magSf()));
PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size());
@ -64,7 +67,6 @@ void Foam::multiphaseSystem::solveAlphas()
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
{
phaseModel& phase1 = iter();
volScalarField& alpha1 = phase1;
phase1.phiAlpha() =
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0);
@ -78,7 +80,7 @@ void Foam::multiphaseSystem::solveAlphas()
(
phi_,
phase1,
"div(phi," + alpha1.name() + ')'
alphaScheme
)
)
);
@ -88,7 +90,6 @@ void Foam::multiphaseSystem::solveAlphas()
forAllIter(PtrDictionary<phaseModel>, phases_, iter2)
{
phaseModel& phase2 = iter2();
volScalarField& alpha2 = phase2;
if (&phase2 == &phase1) continue;
@ -99,16 +100,11 @@ void Foam::multiphaseSystem::solveAlphas()
*nHatf(phase1, phase2)
);
word phirScheme
(
"div(phir," + alpha2.name() + ',' + alpha1.name() + ')'
);
phiAlphaCorr += fvc::flux
(
-fvc::flux(-phir, phase2, phirScheme),
-fvc::flux(-phir, phase2, alpharScheme),
phase1,
phirScheme
alpharScheme
);
}

View File

@ -1,3 +0,0 @@
Test-DirectMappedPatch.C
EXE = $(FOAM_USER_APPBIN)/Test-DirectMappedPatch

View File

@ -0,0 +1,3 @@
Test-MappedPatch.C
EXE = $(FOAM_USER_APPBIN)/Test-MappedPatch

View File

@ -22,10 +22,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
testDirectMappedPatch
testMappedPatch
Description
Test direct mapped b.c. by mapping face centres (mesh.C().boundaryField()).
Test mapped b.c. by mapping face centres (mesh.C().boundaryField()).
\*---------------------------------------------------------------------------*/
@ -37,7 +37,8 @@ Description
#include "Time.H"
#include "OFstream.H"
#include "volFields.H"
#include "directMappedFixedValueFvPatchFields.H"
#include "mappedPolyPatch.H"
#include "mappedFixedValueFvPatchFields.H"
using namespace Foam;
@ -48,10 +49,10 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
#include "addTimeOptions.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
wordList patchFieldTypes
(
@ -61,10 +62,10 @@ int main(int argc, char *argv[])
forAll(mesh.boundaryMesh(), patchI)
{
if (isA<directMappedPolyPatch>(mesh.boundaryMesh()[patchI]))
if (isA<mappedPolyPatch>(mesh.boundaryMesh()[patchI]))
{
patchFieldTypes[patchI] =
directMappedFixedValueFvPatchVectorField::typeName;
mappedFixedValueFvPatchVectorField::typeName;
}
}
@ -92,13 +93,13 @@ int main(int argc, char *argv[])
{
if
(
isA<directMappedFixedValueFvPatchVectorField>
isA<mappedFixedValueFvPatchVectorField>
(
cc.boundaryField()[patchI]
)
)
{
Pout<< "Detected a directMapped patch:" << patchI << endl;
Pout<< "Detected a mapped patch:" << patchI << endl;
OFstream str(mesh.boundaryMesh()[patchI].name() + ".obj");
Pout<< "Writing mapped values to " << str.name() << endl;

View File

@ -27,9 +27,9 @@ Description
- used to e.g. extrude baffles (extrude internal faces) or create
liquid film regions.
- if extruding internal faces:
- create baffles in original mesh with directMappedWall patches
- create baffles in original mesh with mappedWall patches
- if extruding boundary faces:
- convert boundary faces to directMappedWall patches
- convert boundary faces to mappedWall patches
- extrude edges of faceZone as a \<zone\>_sidePatch
- extrude edges inbetween different faceZones as a
(nonuniformTransform)cyclic \<zoneA\>_\<zoneB\>
@ -68,9 +68,9 @@ into the space of the neighbour:
| |
+-------------+
BBB=directMapped between owner on original mesh and new extrusion.
BBB=mapped between owner on original mesh and new extrusion.
(zero offset)
CCC=directMapped between neighbour on original mesh and new extrusion
CCC=mapped between neighbour on original mesh and new extrusion
(offset due to the thickness of the extruded mesh)
For the case of flipMap the extrusion is the other way around: from the
@ -98,7 +98,7 @@ becomes
| |
+-----------+
BBB=directMapped between original mesh and new extrusion
BBB=mapped between original mesh and new extrusion
CCC=polypatch
@ -126,7 +126,7 @@ Usage
#include "patchPointEdgeCirculator.H"
#include "OFstream.H"
#include "meshTools.H"
#include "directMappedWallPolyPatch.H"
#include "mappedWallPolyPatch.H"
#include "createShellMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -1122,7 +1122,7 @@ int main(int argc, char *argv[])
// Check whether the zone is internal or external faces to determine
// what patch type to insert. Cannot be mixed
// since then how to couple? - directMapped only valid for a whole patch.
// since then how to couple? - mapped only valid for a whole patch.
boolList isInternal(zoneIDs.size(), false);
forAll(zoneIDs, i)
{
@ -1174,7 +1174,7 @@ int main(int argc, char *argv[])
if (isInternal[i])
{
interRegionTopPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionTopPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName + "_top"
@ -1185,7 +1185,7 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName + "_bottom"
@ -1209,7 +1209,7 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName
@ -1222,7 +1222,7 @@ int main(int argc, char *argv[])
}
else if (zoneShadowNames.size() > 0) //patch using shadow face zones.
{
interRegionTopPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionTopPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
zoneShadowNames[i] + "_top"
@ -1233,7 +1233,7 @@ int main(int argc, char *argv[])
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
(
mesh,
interName
@ -1661,7 +1661,7 @@ int main(int argc, char *argv[])
if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionTopPatch, patchI) != -1)
)
{
@ -1669,14 +1669,14 @@ int main(int argc, char *argv[])
topOffsets[index] = calcOffset(extrudePatch, extruder, pp);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
regionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
mappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch
topOffsets[index], // offset
patches
@ -1684,7 +1684,7 @@ int main(int argc, char *argv[])
}
else if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionBottomPatch, patchI) != -1)
)
{
@ -1692,14 +1692,14 @@ int main(int argc, char *argv[])
bottomOffsets[index] = calcOffset(extrudePatch, extruder, pp);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
regionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
mappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch
bottomOffsets[index], // offset
patches
@ -1985,19 +1985,19 @@ int main(int argc, char *argv[])
if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionTopPatch, patchI) != -1)
)
{
label index = findIndex(interRegionTopPatch, patchI);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
shellRegionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
mappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch
-topOffsets[index], // offset
patches
@ -2005,20 +2005,20 @@ int main(int argc, char *argv[])
}
else if
(
isA<directMappedWallPolyPatch>(pp)
isA<mappedWallPolyPatch>(pp)
&& (findIndex(interRegionBottomPatch, patchI) != -1)
)
{
label index = findIndex(interRegionBottomPatch, patchI);
newPatches[patchI] = new directMappedWallPolyPatch
newPatches[patchI] = new mappedWallPolyPatch
(
pp.name(),
pp.size(),
pp.start(),
patchI,
shellRegionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
mappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch
-bottomOffsets[index], // offset
patches

View File

@ -23,13 +23,13 @@ faceZones (f0);
// FaceZone shadow
//faceZonesShadow (fBaffleShadow);
// Adapt the original mesh to have directMapped patches at where the
// Adapt the original mesh to have mapped patches at where the
// faceZones are?
// If true:
// - extruding internal faces: become baffles on directMapped patches
// - extruding boundary faces: repatched to be on directMapped patches
// - extruding internal faces: become baffles on mapped patches
// - extruding boundary faces: repatched to be on mapped patches
// If false: leave original mesh intact. Extruded mesh will still have
// directMapped patch which might need to be adapted.
// mapped patch which might need to be adapted.
adaptMesh true;
// Extrude 1D-columns of cells?

View File

@ -36,7 +36,7 @@ Description
Output is:
- volScalarField with regions as different scalars (-detectOnly)
or
- mesh with multiple regions and directMapped patches. These patches
- mesh with multiple regions and mapped patches. These patches
either cover the whole interface between two region (default) or
only part according to faceZones (-useFaceZones)
or
@ -57,7 +57,7 @@ Description
- Should work in parallel.
cellZones can differ on either side of processor boundaries in which case
the faces get moved from processor patch to directMapped patch. Not
the faces get moved from processor patch to mapped patch. Not
very well tested.
- If a cell zone gets split into more than one region it can detect
@ -94,7 +94,7 @@ Description
#include "EdgeMap.H"
#include "syncTools.H"
#include "ReadFields.H"
#include "directMappedWallPolyPatch.H"
#include "mappedWallPolyPatch.H"
#include "zeroGradientFvPatchFields.H"
using namespace Foam;
@ -1260,14 +1260,14 @@ labelList addRegionPatches
// << " trying to add patches " << names << endl;
directMappedWallPolyPatch patch1
mappedWallPolyPatch patch1
(
names[0],
0, // overridden
0, // overridden
0, // overridden
regionNames[e[1]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
mappedPatchBase::NEARESTPATCHFACE,
names[1], // samplePatch
point::zero, // offset
mesh.boundaryMesh()
@ -1275,14 +1275,14 @@ labelList addRegionPatches
interfacePatches[interI] = addPatch(mesh, patch1);
directMappedWallPolyPatch patch2
mappedWallPolyPatch patch2
(
names[1],
0,
0,
0,
regionNames[e[0]], // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE,
mappedPatchBase::NEARESTPATCHFACE,
names[0],
point::zero, // offset
mesh.boundaryMesh()

View File

@ -20,7 +20,7 @@ dictionaryReplacement
{
".*"
{
type directMappedPatch;
type mappedPatch;
}
}

View File

@ -393,9 +393,9 @@ DebugSwitches
diagonal 0;
dictionary 0;
dimensionSet 1;
directMappedBase 0;
directMappedPatch 0;
directMappedVelocityFlux 0;
mappedBase 0;
mappedPatch 0;
mappedVelocityFlux 0;
directionMixed 0;
directional 0;
disallowGenericFvPatchField 0;

View File

@ -30,8 +30,6 @@ derivedFvPatches = $(fvPatches)/derived
$(derivedFvPatches)/wall/wallFvPatch.C
$(derivedFvPatches)/mapped/mappedFvPatch.C
$(derivedFvPatches)/mapped/mappedWallFvPatch.C
$(derivedFvPatches)/directMapped/directMappedFvPatch.C
$(derivedFvPatches)/directMapped/directMappedWallFvPatch.C
wallDist = fvMesh/wallDist
$(wallDist)/wallPointYPlus/wallPointYPlus.C
@ -123,16 +121,13 @@ $(derivedFvPatchFields)/mappedField/mappedFieldFvPatchFields.C
$(derivedFvPatchFields)/mappedFixedInternalValue/mappedFixedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedField/directMappedFieldFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C
$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
$(derivedFvPatchFields)/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
$(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C
@ -156,7 +151,7 @@ $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocit
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C
$(derivedFvPatchFields)/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/slip/slipFvPatchFields.C
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C

View File

@ -1,321 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "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;
// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
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;
}
// Restore tag
UPstream::msgType() = oldTag;
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

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

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

View File

@ -1,161 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directMappedFixedInternalValueFvPatchField.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(p, iF)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedFixedValueFvPatchField<Type>(p, iF, dict)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf
)
:
directMappedFixedValueFvPatchField<Type>(ptf)
{}
template<class Type>
Foam::directMappedFixedInternalValueFvPatchField<Type>::
directMappedFixedInternalValueFvPatchField
(
const directMappedFixedInternalValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
if (this->updated())
{
return;
}
// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Retrieve the neighbour values and assign to this patch boundary field
directMappedFixedValueFvPatchField<Type>::updateCoeffs();
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>(this->patch().patch());
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.template lookupPatchField<FieldType, Type>
(
this->dimensionedInternalField().name()
);
// Retrieve the neighbour patch internal field
Field<Type> nbrIntFld(nbrField.patchInternalField());
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Restore tag
UPstream::msgType() = oldTag;
// Assign (this) patch internal field to its neighbour values
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
UIndirectList<Type>(intFld, this->patch().faceCells()) = nbrIntFld;
}
template<class Type>
void Foam::directMappedFixedInternalValueFvPatchField<Type>::write
(
Ostream& os
) const
{
directMappedFixedValueFvPatchField<Type>::write(os);
}
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

@ -1,125 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directMappedFixedPushedInternalValueFvPatchField.H"
#include "UIndirectList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(p, iF)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedFixedValueFvPatchField<Type>(p, iF, dict)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf
)
:
directMappedFixedValueFvPatchField<Type>(ptf)
{}
template<class Type>
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedFixedValueFvPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void
Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs()
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
if (this->updated())
{
return;
}
// Retrieve the neighbour values and assign to this patch boundary field
directMappedFixedValueFvPatchField<Type>::updateCoeffs();
// Assign the patch internal field to its boundary value
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
UIndirectList<Type>(intFld, this->patch().faceCells()) = *this;
}
template<class Type>
void Foam::directMappedFixedPushedInternalValueFvPatchField<Type>::write
(
Ostream& os
) const
{
directMappedFixedValueFvPatchField<Type>::write(os);
}
// ************************************************************************* //

View File

@ -1,157 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedFixedPushedInternalValueFvPatchField
Description
Recycles the boundary values of a neighbour patch field to the boundary
and internal values of *this.
SourceFiles
directMappedFixedPushedInternalValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedPushedInternalValueFvPatchField_H
#define directMappedFixedPushedInternalValueFvPatchField_H
#include "directMappedFixedValueFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFixedPushedInternalValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedFixedPushedInternalValueFvPatchField
:
public directMappedFixedValueFvPatchField<Type>
{
public:
//- Runtime type information
TypeName("directMappedFixedPushedInternalValue");
// Constructors
//- Construct from patch and internal field
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFixedPushedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given a
// directMappedFixedPushedInternalValueFvPatchField onto a new patch
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedFixedPushedInternalValueFvPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
directMappedFixedPushedInternalValueFvPatchField
(
const directMappedFixedPushedInternalValueFvPatchField<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 directMappedFixedPushedInternalValueFvPatchField<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 "directMappedFixedPushedInternalValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

@ -1,396 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directMappedFixedValueFvPatchField.H"
#include "directMappedPatchBase.H"
#include "volFields.H"
#include "interpolationCell.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF),
fieldName_(iF.name()),
setAverage_(false),
average_(pTraits<Type>::zero),
interpolationScheme_(interpolationCell<Type>::typeName)
{}
template<class Type>
directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
(
const directMappedFixedValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_),
interpolationScheme_(ptf.interpolationScheme_)
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedFixedValueFvPatchField<Type>::"
"directMappedFixedValueFvPatchField\n"
"(\n"
" const directMappedFixedValueFvPatchField<Type>&,\n"
" const fvPatch&,\n"
" const Field<Type>&,\n"
" const fvPatchFieldMapper&\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
}
template<class Type>
directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict),
fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
setAverage_(readBool(dict.lookup("setAverage"))),
average_(pTraits<Type>(dict.lookup("average"))),
interpolationScheme_(interpolationCell<Type>::typeName)
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedFixedValueFvPatchField<Type>::"
"directMappedFixedValueFvPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, volMesh>& iF,\n"
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
directMappedFixedValueFvPatchField<Type>::patch().patch()
);
if (mpp.mode() == directMappedPatchBase::NEARESTCELL)
{
dict.lookup("interpolationScheme") >> interpolationScheme_;
}
}
template<class Type>
directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
(
const directMappedFixedValueFvPatchField<Type>& ptf
)
:
fixedValueFvPatchField<Type>(ptf),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_),
interpolationScheme_(ptf.interpolationScheme_)
{}
template<class Type>
directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
(
const directMappedFixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(ptf, iF),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_),
interpolationScheme_(ptf.interpolationScheme_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const GeometricField<Type, fvPatchField, volMesh>&
directMappedFixedValueFvPatchField<Type>::sampleField() const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
directMappedFixedValueFvPatchField<Type>::patch().patch()
);
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
if (mpp.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.lookupObject<fieldType>(fieldName_);
}
}
else
{
return nbrMesh.lookupObject<fieldType>(fieldName_);
}
}
template<class Type>
const interpolation<Type>&
directMappedFixedValueFvPatchField<Type>::interpolator() const
{
if (!interpolator_.valid())
{
interpolator_ = interpolation<Type>::New
(
interpolationScheme_,
sampleField()
);
}
return interpolator_();
}
template<class Type>
void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the scheduling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
directMappedFixedValueFvPatchField<Type>::patch().patch()
);
const mapDistribute& distMap = mpp.map();
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
// Result of obtaining remote values
Field<Type> newValues;
switch (mpp.mode())
{
case directMappedPatchBase::NEARESTCELL:
{
if (interpolationScheme_ != interpolationCell<Type>::typeName)
{
// Send back sample points to the processor that holds the cell
vectorField samples(mpp.samplePoints());
distMap.reverseDistribute
(
(mpp.sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()),
point::max,
samples
);
const interpolation<Type>& interp = interpolator();
newValues.setSize(samples.size(), pTraits<Type>::max);
forAll(samples, cellI)
{
if (samples[cellI] != point::max)
{
newValues[cellI] = interp.interpolate
(
samples[cellI],
cellI
);
}
}
}
else
{
newValues = sampleField();
}
distMap.distribute(newValues);
break;
}
case directMappedPatchBase::NEARESTPATCHFACE:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
mpp.samplePatch()
);
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void directMappedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
)<< "Unable to find sample patch " << mpp.samplePatch()
<< " in region " << mpp.sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case directMappedPatchBase::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().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pf[faceI];
}
}
distMap.distribute(allValues);
newValues.transfer(allValues);
break;
}
default:
{
FatalErrorIn
(
"directMappedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unknown sampling mode: " << mpp.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<< "directMapped on field:"
<< this->dimensionedInternalField().name()
<< " patch:" << this->patch().name()
<< " avg:" << gAverage(*this)
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< endl;
}
// Restore tag
UPstream::msgType() = oldTag;
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void directMappedFixedValueFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::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;
os.writeKeyword("interpolationScheme") << interpolationScheme_
<< token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,193 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedFixedValueFvPatchField
Description
Recycles the value at a set of cells or patch faces back to *this. Can not
sample internal faces (since volField not defined on faces).
mode = NEARESTCELL : sample nearest cell
mode = NEARESTPATCHFACE : sample nearest face on selected patch
mode = NEARESTFACE : sample nearest face on any patch. Note: does not
warn if nearest actually is on internal face!
For NEARESTCELL you have to provide an 'interpolationScheme' entry
which can be any one of the interpolation schemes (cell, cellPoint, etc.)
In case of interpolation (so scheme != cell) the limitation is that
there is only one value per cell. So e.g. if you have a cell with two
boundary faces and both faces sample into the cell both faces will get
the same value.
See directMappedPatchBase for options on sampling.
Optional 'fieldName' entry to supply a different filename
SourceFiles
directMappedFixedValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedValueFvPatchField_H
#define directMappedFixedValueFvPatchField_H
#include "fixedValueFvPatchFields.H"
#include "directMappedFvPatch.H"
#include "interpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFixedValueFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedFixedValueFvPatchField
:
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_;
//- Interpolation scheme to use for nearestcell mode
word interpolationScheme_;
mutable autoPtr<interpolation<Type> > interpolator_;
// Private Member Functions
//- Field to sample. Either on my or nbr mesh
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
//- Access the interpolation method
const interpolation<Type>& interpolator() const;
public:
//- Runtime type information
TypeName("directMapped");
// Constructors
//- Construct from patch and internal field
directMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given directMappedFixedValueFvPatchField
// onto a new patch
directMappedFixedValueFvPatchField
(
const directMappedFixedValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFixedValueFvPatchField
(
const directMappedFixedValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedFixedValueFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
directMappedFixedValueFvPatchField
(
const directMappedFixedValueFvPatchField<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 directMappedFixedValueFvPatchField<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 "directMappedFixedValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

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

View File

@ -42,7 +42,7 @@ Description
boundary faces and both faces sample into the cell both faces will get
the same value.
See directMappedPatchBase for options on sampling.
See mappedPatchBase for options on sampling.
Optional 'fieldName' entry to supply a different filename

View File

@ -23,18 +23,17 @@ License
\*---------------------------------------------------------------------------*/
#include "directMappedFlowRateFvPatchVectorField.H"
#include "mappedFlowRateFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
#include "mapDistribute.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
Foam::mappedFlowRateFvPatchVectorField::mappedFlowRateFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
@ -47,10 +46,9 @@ directMappedFlowRateFvPatchVectorField
{}
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
Foam::mappedFlowRateFvPatchVectorField::mappedFlowRateFvPatchVectorField
(
const directMappedFlowRateFvPatchVectorField& ptf,
const mappedFlowRateFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -63,8 +61,7 @@ directMappedFlowRateFvPatchVectorField
{}
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
Foam::mappedFlowRateFvPatchVectorField::mappedFlowRateFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
@ -78,10 +75,9 @@ directMappedFlowRateFvPatchVectorField
{}
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
Foam::mappedFlowRateFvPatchVectorField::mappedFlowRateFvPatchVectorField
(
const directMappedFlowRateFvPatchVectorField& ptf
const mappedFlowRateFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
@ -91,10 +87,9 @@ directMappedFlowRateFvPatchVectorField
{}
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
Foam::mappedFlowRateFvPatchVectorField::mappedFlowRateFvPatchVectorField
(
const directMappedFlowRateFvPatchVectorField& ptf,
const mappedFlowRateFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
@ -107,7 +102,7 @@ directMappedFlowRateFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::directMappedFlowRateFvPatchVectorField::updateCoeffs()
void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs()
{
if (updated())
{
@ -119,8 +114,8 @@ void Foam::directMappedFlowRateFvPatchVectorField::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
// Get the coupling information from the mappedPatchBase
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
(
patch().patch()
);
@ -173,7 +168,7 @@ void Foam::directMappedFlowRateFvPatchVectorField::updateCoeffs()
{
FatalErrorIn
(
"directMappedFlowRateFvPatchVectorField::updateCoeffs()"
"mappedFlowRateFvPatchVectorField::updateCoeffs()"
) << "dimensions of " << phiName_ << " are incorrect" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
@ -188,7 +183,7 @@ void Foam::directMappedFlowRateFvPatchVectorField::updateCoeffs()
}
void Foam::directMappedFlowRateFvPatchVectorField::write
void Foam::mappedFlowRateFvPatchVectorField::write
(
Ostream& os
) const
@ -208,7 +203,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
directMappedFlowRateFvPatchVectorField
mappedFlowRateFvPatchVectorField
);
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedFlowRateFvPatchVectorField
Foam::mappedFlowRateFvPatchVectorField
Description
Describes a volumetric/mass flow normal vector boundary condition by its
@ -41,7 +41,7 @@ Description
@verbatim
inlet
{
type directMappedFlowRate;
type mappedFlowRate;
phi phi;
rho rho;
neigPhi neigPhiName_; // Volumetric/mass flow rate
@ -51,12 +51,12 @@ Description
@endverbatim
SourceFiles
directMappedFlowRateFvPatchVectorField.C
mappedFlowRateFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFlowRateFvPatchVectorField_H
#define directMappedFlowRateFvPatchVectorField_H
#ifndef mappedFlowRateFvPatchVectorField_H
#define mappedFlowRateFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
@ -68,7 +68,7 @@ namespace Foam
Class flowRateInletVelocityFvPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedFlowRateFvPatchVectorField
class mappedFlowRateFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
@ -87,20 +87,20 @@ class directMappedFlowRateFvPatchVectorField
public:
//- Runtime type information
TypeName("directMappedFlowRate");
TypeName("mappedFlowRate");
// Constructors
//- Construct from patch and internal field
directMappedFlowRateFvPatchVectorField
mappedFlowRateFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFlowRateFvPatchVectorField
mappedFlowRateFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
@ -108,20 +108,20 @@ public:
);
//- Construct by mapping given
// directMappedFlowRateFvPatchVectorField
// mappedFlowRateFvPatchVectorField
// onto a new patch
directMappedFlowRateFvPatchVectorField
mappedFlowRateFvPatchVectorField
(
const directMappedFlowRateFvPatchVectorField&,
const mappedFlowRateFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFlowRateFvPatchVectorField
mappedFlowRateFvPatchVectorField
(
const directMappedFlowRateFvPatchVectorField&
const mappedFlowRateFvPatchVectorField&
);
//- Construct and return a clone
@ -129,14 +129,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new directMappedFlowRateFvPatchVectorField(*this)
new mappedFlowRateFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
directMappedFlowRateFvPatchVectorField
mappedFlowRateFvPatchVectorField
(
const directMappedFlowRateFvPatchVectorField&,
const mappedFlowRateFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -148,7 +148,7 @@ public:
{
return tmp<fvPatchVectorField>
(
new directMappedFlowRateFvPatchVectorField(*this, iF)
new mappedFlowRateFvPatchVectorField(*this, iF)
);
}

View File

@ -23,9 +23,9 @@ License
\*---------------------------------------------------------------------------*/
#include "directMappedVelocityFluxFixedValueFvPatchField.H"
#include "mappedVelocityFluxFixedValueFvPatchField.H"
#include "fvPatchFieldMapper.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
@ -33,8 +33,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::directMappedVelocityFluxFixedValueFvPatchField::
directMappedVelocityFluxFixedValueFvPatchField
Foam::mappedVelocityFluxFixedValueFvPatchField::
mappedVelocityFluxFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
@ -45,10 +45,10 @@ directMappedVelocityFluxFixedValueFvPatchField
{}
Foam::directMappedVelocityFluxFixedValueFvPatchField::
directMappedVelocityFluxFixedValueFvPatchField
Foam::mappedVelocityFluxFixedValueFvPatchField::
mappedVelocityFluxFixedValueFvPatchField
(
const directMappedVelocityFluxFixedValueFvPatchField& ptf,
const mappedVelocityFluxFixedValueFvPatchField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -57,20 +57,20 @@ directMappedVelocityFluxFixedValueFvPatchField
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
phiName_(ptf.phiName_)
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
if (!isA<mappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedVelocityFluxFixedValueFvPatchField::"
"directMappedVelocityFluxFixedValueFvPatchField"
"mappedVelocityFluxFixedValueFvPatchField::"
"mappedVelocityFluxFixedValueFvPatchField"
"("
"const directMappedVelocityFluxFixedValueFvPatchField&, "
"const mappedVelocityFluxFixedValueFvPatchField&, "
"const fvPatch&, "
"const DimensionedField<vector, volMesh>&, "
"const fvPatchFieldMapper&"
")"
) << "Patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "' not type '" << mappedPatchBase::typeName << "'"
<< " for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
@ -79,8 +79,8 @@ directMappedVelocityFluxFixedValueFvPatchField
}
Foam::directMappedVelocityFluxFixedValueFvPatchField::
directMappedVelocityFluxFixedValueFvPatchField
Foam::mappedVelocityFluxFixedValueFvPatchField::
mappedVelocityFluxFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
@ -90,35 +90,35 @@ directMappedVelocityFluxFixedValueFvPatchField
fixedValueFvPatchVectorField(p, iF, dict),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
if (!isA<mappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedVelocityFluxFixedValueFvPatchField::"
"directMappedVelocityFluxFixedValueFvPatchField"
"mappedVelocityFluxFixedValueFvPatchField::"
"mappedVelocityFluxFixedValueFvPatchField"
"("
"const fvPatch&, "
"const DimensionedField<vector, volMesh>&, "
"const dictionary&"
")"
) << "Patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "' not type '" << mappedPatchBase::typeName << "'"
<< " for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
<< exit(FatalError);
}
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
(
this->patch().patch()
);
if (mpp.mode() == directMappedPolyPatch::NEARESTCELL)
if (mpp.mode() == mappedPolyPatch::NEARESTCELL)
{
FatalErrorIn
(
"directMappedVelocityFluxFixedValueFvPatchField::"
"directMappedVelocityFluxFixedValueFvPatchField"
"mappedVelocityFluxFixedValueFvPatchField::"
"mappedVelocityFluxFixedValueFvPatchField"
"("
"const fvPatch&, "
"const DimensionedField<vector, volMesh>&, "
@ -134,10 +134,10 @@ directMappedVelocityFluxFixedValueFvPatchField
}
Foam::directMappedVelocityFluxFixedValueFvPatchField::
directMappedVelocityFluxFixedValueFvPatchField
Foam::mappedVelocityFluxFixedValueFvPatchField::
mappedVelocityFluxFixedValueFvPatchField
(
const directMappedVelocityFluxFixedValueFvPatchField& ptf
const mappedVelocityFluxFixedValueFvPatchField& ptf
)
:
fixedValueFvPatchVectorField(ptf),
@ -145,10 +145,10 @@ directMappedVelocityFluxFixedValueFvPatchField
{}
Foam::directMappedVelocityFluxFixedValueFvPatchField::
directMappedVelocityFluxFixedValueFvPatchField
Foam::mappedVelocityFluxFixedValueFvPatchField::
mappedVelocityFluxFixedValueFvPatchField
(
const directMappedVelocityFluxFixedValueFvPatchField& ptf,
const mappedVelocityFluxFixedValueFvPatchField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
@ -159,7 +159,7 @@ directMappedVelocityFluxFixedValueFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
{
if (updated())
{
@ -171,10 +171,10 @@ void Foam::directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
// Get the mappedPatchBase
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
(
directMappedVelocityFluxFixedValueFvPatchField::patch().patch()
mappedVelocityFluxFixedValueFvPatchField::patch().patch()
);
const mapDistribute& distMap = mpp.map();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
@ -194,7 +194,7 @@ void Foam::directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
switch (mpp.mode())
{
case directMappedPolyPatch::NEARESTFACE:
case mappedPolyPatch::NEARESTFACE:
{
vectorField allUValues(nbrMesh.nFaces(), vector::zero);
scalarField allPhiValues(nbrMesh.nFaces(), 0.0);
@ -221,7 +221,7 @@ void Foam::directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
break;
}
case directMappedPolyPatch::NEARESTPATCHFACE:
case mappedPolyPatch::NEARESTPATCHFACE:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
@ -240,7 +240,7 @@ void Foam::directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
{
FatalErrorIn
(
"directMappedVelocityFluxFixedValueFvPatchField::"
"mappedVelocityFluxFixedValueFvPatchField::"
"updateCoeffs()"
) << "patch can only be used in NEARESTPATCHFACE or NEARESTFACE "
<< "mode" << nl << abort(FatalError);
@ -257,7 +257,7 @@ void Foam::directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
}
void Foam::directMappedVelocityFluxFixedValueFvPatchField::write
void Foam::mappedVelocityFluxFixedValueFvPatchField::write
(
Ostream& os
) const
@ -275,7 +275,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
directMappedVelocityFluxFixedValueFvPatchField
mappedVelocityFluxFixedValueFvPatchField
);
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedVelocityFluxFixedValueFvPatchField
Foam::mappedVelocityFluxFixedValueFvPatchField
Description
Recycles the velocity and flux at a patch to this patch
@ -32,15 +32,15 @@ Description
warn if nearest actually is on internal face!
SourceFiles
directMappedVelocityFluxFixedValueFvPatchField.C
mappedVelocityFluxFixedValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedVelocityFluxFixedValueFvPatchField_H
#define directMappedVelocityFluxFixedValueFvPatchField_H
#ifndef mappedVelocityFluxFixedValueFvPatchField_H
#define mappedVelocityFluxFixedValueFvPatchField_H
#include "fixedValueFvPatchFields.H"
#include "directMappedFvPatch.H"
#include "mappedFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,10 +48,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedVelocityFluxFixedValueFvPatch Declaration
Class mappedVelocityFluxFixedValueFvPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedVelocityFluxFixedValueFvPatchField
class mappedVelocityFluxFixedValueFvPatchField
:
public fixedValueFvPatchVectorField
{
@ -63,20 +63,20 @@ class directMappedVelocityFluxFixedValueFvPatchField
public:
//- Runtime type information
TypeName("directMappedVelocityFlux");
TypeName("mappedVelocityFlux");
// Constructors
//- Construct from patch and internal field
directMappedVelocityFluxFixedValueFvPatchField
mappedVelocityFluxFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedVelocityFluxFixedValueFvPatchField
mappedVelocityFluxFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
@ -84,20 +84,20 @@ public:
);
//- Construct by mapping given
// directMappedVelocityFluxFixedValueFvPatchField
// mappedVelocityFluxFixedValueFvPatchField
// onto a new patch
directMappedVelocityFluxFixedValueFvPatchField
mappedVelocityFluxFixedValueFvPatchField
(
const directMappedVelocityFluxFixedValueFvPatchField&,
const mappedVelocityFluxFixedValueFvPatchField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedVelocityFluxFixedValueFvPatchField
mappedVelocityFluxFixedValueFvPatchField
(
const directMappedVelocityFluxFixedValueFvPatchField&
const mappedVelocityFluxFixedValueFvPatchField&
);
//- Construct and return a clone
@ -105,14 +105,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new directMappedVelocityFluxFixedValueFvPatchField(*this)
new mappedVelocityFluxFixedValueFvPatchField(*this)
);
}
//- Construct as copy setting internal field reference
directMappedVelocityFluxFixedValueFvPatchField
mappedVelocityFluxFixedValueFvPatchField
(
const directMappedVelocityFluxFixedValueFvPatchField&,
const mappedVelocityFluxFixedValueFvPatchField&,
const DimensionedField<vector, volMesh>&
);
@ -124,7 +124,7 @@ public:
{
return tmp<fvPatchVectorField>
(
new directMappedVelocityFluxFixedValueFvPatchField(*this, iF)
new mappedVelocityFluxFixedValueFvPatchField(*this, iF)
);
}

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "multiphaseFixedFluxPressureFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_("U"),
phiName_("phi"),
rhoName_("rho")
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
if (dict.found("gradient"))
{
gradient() = scalarField("gradient", dict, p.size());
fixedGradientFvPatchScalarField::updateCoeffs();
fixedGradientFvPatchScalarField::evaluate();
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
}
}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf
)
:
fixedGradientFvPatchScalarField(wbppsf),
UName_(wbppsf.UName_),
phiName_(wbppsf.phiName_),
rhoName_(wbppsf.rhoName_)
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(wbppsf, iF),
UName_(wbppsf.UName_),
phiName_(wbppsf.phiName_),
rhoName_(wbppsf.rhoName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>(UName_);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip =
patch().patchField<surfaceScalarField, scalar>(phi);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
phip /= rhop;
}
const fvsPatchField<scalar>& Dpp =
patch().lookupPatchField<surfaceScalarField, scalar>("Dp");
gradient() = (phip - (patch().Sf() & Up))/patch().magSf()/Dpp;
fixedGradientFvPatchScalarField::updateCoeffs();
}
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
gradient().writeEntry("gradient", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
multiphaseFixedFluxPressureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -22,21 +22,22 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedFixedInternalValueFvPatchField
Foam::multiphaseFixedFluxPressureFvPatchScalarField
Description
Recycles the boundary and internal values of a neighbour patch field to
the boundary and internal values of *this.
Foam::multiphaseFixedFluxPressureFvPatchScalarField
SourceFiles
directMappedFixedInternalValueFvPatchField.C
multiphaseFixedFluxPressureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedInternalValueFvPatchField_H
#define directMappedFixedInternalValueFvPatchField_H
#ifndef multiphaseFixedFluxPressureFvPatchScalarFields_H
#define multiphaseFixedFluxPressureFvPatchScalarFields_H
#include "directMappedFixedValueFvPatchField.H"
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,89 +45,98 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFixedInternalValueFvPatchField Declaration
Class multiphaseFixedFluxPressureFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedFixedInternalValueFvPatchField
class multiphaseFixedFluxPressureFvPatchScalarField
:
public directMappedFixedValueFvPatchField<Type>
public fixedGradientFvPatchScalarField
{
// Private data
//- Name of the velocity field
word UName_;
//- Name of the flux transporting the field
word phiName_;
//- Name of the density field used to normalise the mass flux
// if neccessary
word rhoName_;
public:
//- Runtime type information
TypeName("directMappedFixedInternalValue");
TypeName("multiphaseFixedFluxPressure");
// Constructors
//- Construct from patch and internal field
directMappedFixedInternalValueFvPatchField
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedFixedInternalValueFvPatchField
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// directMappedFixedInternalValueFvPatchField onto a new patch
directMappedFixedInternalValueFvPatchField
// multiphaseFixedFluxPressureFvPatchScalarField onto a new patch
multiphaseFixedFluxPressureFvPatchScalarField
(
const directMappedFixedInternalValueFvPatchField<Type>&,
const multiphaseFixedFluxPressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedFixedInternalValueFvPatchField
multiphaseFixedFluxPressureFvPatchScalarField
(
const directMappedFixedInternalValueFvPatchField<Type>&
const multiphaseFixedFluxPressureFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchField<Type> >
return tmp<fvPatchScalarField>
(
new directMappedFixedInternalValueFvPatchField<Type>(*this)
new multiphaseFixedFluxPressureFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
directMappedFixedInternalValueFvPatchField
multiphaseFixedFluxPressureFvPatchScalarField
(
const directMappedFixedInternalValueFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
const multiphaseFixedFluxPressureFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<Type, volMesh>& iF
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
return tmp<fvPatchScalarField>
(
new directMappedFixedInternalValueFvPatchField<Type>(*this, iF)
new multiphaseFixedFluxPressureFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
@ -139,12 +149,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "directMappedFixedInternalValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "selfContainedDirectMappedFixedValueFvPatchField.H"
#include "selfContainedMappedFixedValueFvPatchField.H"
#include "volFields.H"
#include "interpolationCell.H"
@ -35,14 +35,14 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField<Type>::
selfContainedMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(p.patch()),
mappedPatchBase(p.patch()),
fixedValueFvPatchField<Type>(p, iF),
fieldName_(iF.name()),
setAverage_(false),
@ -52,16 +52,16 @@ selfContainedDirectMappedFixedValueFvPatchField
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField<Type>::
selfContainedMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf,
const selfContainedMappedFixedValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedPatchBase(p.patch(), ptf),
mappedPatchBase(p.patch(), ptf),
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
@ -71,22 +71,22 @@ selfContainedDirectMappedFixedValueFvPatchField
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField<Type>::
selfContainedMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedPatchBase(p.patch(), dict),
mappedPatchBase(p.patch(), dict),
fixedValueFvPatchField<Type>(p, iF, dict),
fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
setAverage_(readBool(dict.lookup("setAverage"))),
average_(pTraits<Type>(dict.lookup("average"))),
interpolationScheme_(interpolationCell<Type>::typeName)
{
if (mode() == directMappedPatchBase::NEARESTCELL)
if (mode() == mappedPatchBase::NEARESTCELL)
{
dict.lookup("interpolationScheme") >> interpolationScheme_;
}
@ -94,13 +94,13 @@ selfContainedDirectMappedFixedValueFvPatchField
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField<Type>::
selfContainedMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
// directMappedPatchBase
// mappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
@ -113,7 +113,7 @@ selfContainedDirectMappedFixedValueFvPatchField
const word& interpolationScheme
)
:
directMappedPatchBase
mappedPatchBase
(
p.patch(),
sampleRegion,
@ -130,13 +130,13 @@ selfContainedDirectMappedFixedValueFvPatchField
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField<Type>::
selfContainedMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf
const selfContainedMappedFixedValueFvPatchField<Type>& ptf
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
mappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
@ -146,14 +146,14 @@ selfContainedDirectMappedFixedValueFvPatchField
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField<Type>::
selfContainedMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf,
const selfContainedMappedFixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
mappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf, iF),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
@ -166,7 +166,7 @@ selfContainedDirectMappedFixedValueFvPatchField
template<class Type>
const GeometricField<Type, fvPatchField, volMesh>&
selfContainedDirectMappedFixedValueFvPatchField<Type>::sampleField() const
selfContainedMappedFixedValueFvPatchField<Type>::sampleField() const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
@ -198,7 +198,7 @@ selfContainedDirectMappedFixedValueFvPatchField<Type>::sampleField() const
template<class Type>
const interpolation<Type>&
selfContainedDirectMappedFixedValueFvPatchField<Type>::interpolator() const
selfContainedMappedFixedValueFvPatchField<Type>::interpolator() const
{
if (!interpolator_.valid())
{
@ -213,7 +213,7 @@ selfContainedDirectMappedFixedValueFvPatchField<Type>::interpolator() const
template<class Type>
void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
@ -229,7 +229,7 @@ void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
const mapDistribute& distMap = directMappedPatchBase::map();
const mapDistribute& distMap = mappedPatchBase::map();
// Result of obtaining remote values
Field<Type> newValues;
@ -286,7 +286,7 @@ void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
FatalErrorIn
(
"void "
"selfContainedDirectMappedFixedValueFvPatchField<Type>::"
"selfContainedMappedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
)<< "Unable to find sample patch " << samplePatch()
<< " in region " << sampleRegion()
@ -329,7 +329,7 @@ void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
{
FatalErrorIn
(
"selfContainedDirectMappedFixedValueFvPatchField<Type>::"
"selfContainedMappedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
) << "Unknown sampling mode: " << mode()
<< nl << abort(FatalError);
@ -356,7 +356,7 @@ void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
if (debug)
{
Info<< "selfContainedDirectMapped on field:"
Info<< "selfContainedMapped on field:"
<< this->dimensionedInternalField().name()
<< " patch:" << this->patch().name()
<< " avg:" << gAverage(*this)
@ -373,11 +373,11 @@ void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
template<class Type>
void selfContainedDirectMappedFixedValueFvPatchField<Type>::write(Ostream& os)
void selfContainedMappedFixedValueFvPatchField<Type>::write(Ostream& os)
const
{
fvPatchField<Type>::write(os);
directMappedPatchBase::write(os);
mappedPatchBase::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;

View File

@ -22,23 +22,23 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::selfContainedDirectMappedFixedValueFvPatchField
Foam::selfContainedMappedFixedValueFvPatchField
Description
Self-contained version of directMapped. Does not use information on
Self-contained version of mapped. 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.
normal mapped in preference and only use this if you cannot
change the underlying patch type to mapped.
SourceFiles
selfContainedDirectMappedFixedValueFvPatchField.C
selfContainedMappedFixedValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef selfContainedDirectMappedFixedValueFvPatchField_H
#define selfContainedDirectMappedFixedValueFvPatchField_H
#ifndef selfContainedMappedFixedValueFvPatchField_H
#define selfContainedMappedFixedValueFvPatchField_H
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
#include "fixedValueFvPatchFields.H"
#include "interpolation.H"
@ -48,13 +48,13 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class selfContainedDirectMappedFixedValueFvPatchField Declaration
Class selfContainedMappedFixedValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class selfContainedDirectMappedFixedValueFvPatchField
class selfContainedMappedFixedValueFvPatchField
:
public directMappedPatchBase,
public mappedPatchBase,
public fixedValueFvPatchField<Type>
{
// Private data
@ -88,20 +88,20 @@ class selfContainedDirectMappedFixedValueFvPatchField
public:
//- Runtime type information
TypeName("selfContainedDirectMapped");
TypeName("selfContainedMapped");
// Constructors
//- Construct from patch and internal field
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
@ -110,12 +110,12 @@ public:
//- Construct from patch, internal field and distance for normal type
// sampling
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
// directMappedPatchBase
// mappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
@ -129,20 +129,20 @@ public:
);
//- Construct by mapping given
// selfContainedDirectMappedFixedValueFvPatchField
// selfContainedMappedFixedValueFvPatchField
// onto a new patch
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>&,
const selfContainedMappedFixedValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>&
const selfContainedMappedFixedValueFvPatchField<Type>&
);
//- Construct and return a clone
@ -150,7 +150,7 @@ public:
{
return tmp<fvPatchField<Type> >
(
new selfContainedDirectMappedFixedValueFvPatchField<Type>
new selfContainedMappedFixedValueFvPatchField<Type>
(
*this
)
@ -158,9 +158,9 @@ public:
}
//- Construct as copy setting internal field reference
selfContainedDirectMappedFixedValueFvPatchField
selfContainedMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>&,
const selfContainedMappedFixedValueFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
@ -172,7 +172,7 @@ public:
{
return tmp<fvPatchField<Type> >
(
new selfContainedDirectMappedFixedValueFvPatchField<Type>
new selfContainedMappedFixedValueFvPatchField<Type>
(
*this,
iF
@ -201,7 +201,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "selfContainedDirectMappedFixedValueFvPatchField.C"
# include "selfContainedMappedFixedValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "directMappedFieldFvPatchFields.H"
#include "selfContainedMappedFixedValueFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
@ -34,7 +34,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(directMappedField);
makePatchFields(selfContainedMappedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,9 +23,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef directMappedFixedValueFvPatchFieldsFwd_H
#define directMappedFixedValueFvPatchFieldsFwd_H
#ifndef selfContainedMappedFixedValueFvPatchFields_H
#define selfContainedMappedFixedValueFvPatchFields_H
#include "selfContainedMappedFixedValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -35,9 +36,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class directMappedFixedValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedFixedValue);
makePatchTypeFieldTypedefs(selfContainedMappedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#ifndef directMappedFieldFvPatchFieldsFwd_H
#define directMappedFieldFvPatchFieldsFwd_H
#ifndef selfContainedMappedFixedValueFvPatchFieldsFwd_H
#define selfContainedMappedFixedValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
@ -35,9 +35,9 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class directMappedFieldFvPatchField;
template<class Type> class selfContainedMappedFixedValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedField)
makePatchTypeFieldTypedefs(selfContainedMappedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

@ -1,79 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedFvPatch
Description
Foam::directMappedFvPatch
SourceFiles
directMappedFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedFvPatch_H
#define directMappedFvPatch_H
#include "fvPatch.H"
#include "directMappedPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedFvPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedFvPatch
:
public fvPatch
{
public:
//- Runtime type information
TypeName(directMappedPolyPatch::typeName_());
// Constructors
//- Construct from components
directMappedFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
:
fvPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

@ -1,83 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedWallFvPatch
Description
Foam::directMappedWallFvPatch
SourceFiles
directMappedWallFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedWallFvPatch_H
#define directMappedWallFvPatch_H
#include "wallFvPatch.H"
#include "directMappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedWallFvPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedWallFvPatch
:
public wallFvPatch
{
public:
//- Runtime type information
TypeName(directMappedWallPolyPatch::typeName_());
// Constructors
//- Construct from components
directMappedWallFvPatch
(
const polyPatch& patch,
const fvBoundaryMesh& bm
)
:
wallFvPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -157,13 +157,6 @@ triSurface/triSurfaceTools/geompack/geompack.C
twoDPointCorrector/twoDPointCorrector.C
directMapped/directMappedPolyPatch/directMappedPatchBase.C
directMapped/directMappedPolyPatch/directMappedPolyPatch.C
directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C
directMapped/directMappedPolyPatch/directMappedVariableThicknessWallPolyPatch.C
directMapped/directMappedPointPatch/directMappedPointPatch.C
directMapped/directMappedPointPatch/directMappedWallPointPatch.C
AMI=AMIInterpolation
$(AMI)/AMIInterpolation/AMIInterpolationName.C
$(AMI)/faceAreaIntersect/faceAreaIntersect.C
@ -178,7 +171,9 @@ mappedPatches/mappedPolyPatch/mappedPatchBase.C
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
mappedPatches/mappedPolyPatch/mappedWallPointPatch.C
mappedPatches/mappedPointPatch/mappedPointPatch.C
mappedPatches/mappedPointPatch/mappedWallPointPatch.C
LIB = $(FOAM_LIBBIN)/libmeshTools

View File

@ -1,83 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedPointPatch
Description
DirectMapped patch.
SourceFiles
directMappedPointPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedPointPatch_H
#define directMappedPointPatch_H
#include "facePointPatch.H"
#include "directMappedPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedPointPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedPointPatch
:
public facePointPatch
{
public:
//- Runtime type information
TypeName(directMappedPolyPatch::typeName_());
// Constructors
//- Construct from polyPatch
directMappedPointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
)
:
facePointPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

@ -1,882 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directMappedPatchBase.H"
#include "addToRunTimeSelectionTable.H"
#include "ListListOps.H"
#include "meshSearch.H"
#include "meshTools.H"
#include "OFstream.H"
#include "Random.H"
#include "treeDataFace.H"
#include "indexedOctree.H"
#include "polyMesh.H"
#include "polyPatch.H"
#include "Time.H"
#include "mapDistribute.H"
#include "SubField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directMappedPatchBase, 0);
template<>
const char* Foam::NamedEnum
<
Foam::directMappedPatchBase::sampleMode,
3
>::names[] =
{
"nearestCell",
"nearestPatchFace",
"nearestFace"
};
template<>
const char* Foam::NamedEnum
<
Foam::directMappedPatchBase::offsetMode,
3
>::names[] =
{
"uniform",
"nonuniform",
"normal"
};
}
const Foam::NamedEnum<Foam::directMappedPatchBase::sampleMode, 3>
Foam::directMappedPatchBase::sampleModeNames_;
const Foam::NamedEnum<Foam::directMappedPatchBase::offsetMode, 3>
Foam::directMappedPatchBase::offsetModeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::directMappedPatchBase::collectSamples
(
pointField& samples,
labelList& patchFaceProcs,
labelList& patchFaces,
pointField& patchFc
) const
{
// Collect all sample points and the faces they come from.
List<pointField> globalFc(Pstream::nProcs());
List<pointField> globalSamples(Pstream::nProcs());
labelListList globalFaces(Pstream::nProcs());
globalFc[Pstream::myProcNo()] = patch_.faceCentres();
globalSamples[Pstream::myProcNo()] = samplePoints();
globalFaces[Pstream::myProcNo()] = identity(patch_.size());
// Distribute to all processors
Pstream::gatherList(globalSamples);
Pstream::scatterList(globalSamples);
Pstream::gatherList(globalFaces);
Pstream::scatterList(globalFaces);
Pstream::gatherList(globalFc);
Pstream::scatterList(globalFc);
// Rework into straight list
samples = ListListOps::combine<pointField>
(
globalSamples,
accessOp<pointField>()
);
patchFaces = ListListOps::combine<labelList>
(
globalFaces,
accessOp<labelList>()
);
patchFc = ListListOps::combine<pointField>
(
globalFc,
accessOp<pointField>()
);
patchFaceProcs.setSize(patchFaces.size());
labelList nPerProc
(
ListListOps::subSizes
(
globalFaces,
accessOp<labelList>()
)
);
label sampleI = 0;
forAll(nPerProc, procI)
{
for (label i = 0; i < nPerProc[procI]; i++)
{
patchFaceProcs[sampleI++] = procI;
}
}
}
// Find the processor/cell containing the samples. Does not account
// for samples being found in two processors.
void Foam::directMappedPatchBase::findSamples
(
const pointField& samples,
labelList& sampleProcs,
labelList& sampleIndices,
pointField& sampleLocations
) const
{
// Lookup the correct region
const polyMesh& mesh = sampleMesh();
// All the info for nearest. Construct to miss
List<nearInfo> nearest(samples.size());
switch (mode_)
{
case NEARESTCELL:
{
if (samplePatch_.size() && samplePatch_ != "none")
{
FatalErrorIn
(
"directMappedPatchBase::findSamples(const pointField&,"
" labelList&, labelList&, pointField&) const"
) << "No need to supply a patch name when in "
<< sampleModeNames_[mode_] << " mode." << exit(FatalError);
}
// Octree based search engine
meshSearch meshSearchEngine(mesh, false);
forAll(samples, sampleI)
{
const point& sample = samples[sampleI];
label cellI = meshSearchEngine.findCell(sample);
if (cellI == -1)
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
else
{
const point& cc = mesh.cellCentres()[cellI];
nearest[sampleI].first() = pointIndexHit
(
true,
cc,
cellI
);
nearest[sampleI].second().first() = magSqr(cc-sample);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
}
break;
}
case NEARESTPATCHFACE:
{
Random rndGen(123456);
const polyPatch& pp = samplePolyPatch();
if (pp.empty())
{
forAll(samples, sampleI)
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
}
else
{
// patch faces
const labelList patchFaces(identity(pp.size()) + pp.start());
treeBoundBox patchBb
(
treeBoundBox(pp.points(), pp.meshPoints()).extend
(
rndGen,
1E-4
)
);
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
indexedOctree<treeDataFace> boundaryTree
(
treeDataFace // all information needed to search faces
(
false, // do not cache bb
mesh,
patchFaces // boundary faces only
),
patchBb, // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
);
forAll(samples, sampleI)
{
const point& sample = samples[sampleI];
pointIndexHit& nearInfo = nearest[sampleI].first();
nearInfo = boundaryTree.findNearest
(
sample,
magSqr(patchBb.span())
);
if (!nearInfo.hit())
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() =
Pstream::myProcNo();
}
else
{
point fc(pp[nearInfo.index()].centre(pp.points()));
nearInfo.setPoint(fc);
nearest[sampleI].second().first() = magSqr(fc-sample);
nearest[sampleI].second().second() =
Pstream::myProcNo();
}
}
}
break;
}
case NEARESTFACE:
{
if (samplePatch_.size() && samplePatch_ != "none")
{
FatalErrorIn
(
"directMappedPatchBase::findSamples(const pointField&,"
" labelList&, labelList&, pointField&) const"
) << "No need to supply a patch name when in "
<< sampleModeNames_[mode_] << " mode." << exit(FatalError);
}
// Octree based search engine
meshSearch meshSearchEngine(mesh, false);
forAll(samples, sampleI)
{
const point& sample = samples[sampleI];
label faceI = meshSearchEngine.findNearestFace(sample);
if (faceI == -1)
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
else
{
const point& fc = mesh.faceCentres()[faceI];
nearest[sampleI].first() = pointIndexHit
(
true,
fc,
faceI
);
nearest[sampleI].second().first() = magSqr(fc-sample);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
}
break;
}
default:
{
FatalErrorIn("directMappedPatchBase::findSamples(..)")
<< "problem." << abort(FatalError);
}
}
// Find nearest.
Pstream::listCombineGather(nearest, nearestEqOp());
Pstream::listCombineScatter(nearest);
if (debug)
{
Info<< "directMappedPatchBase::findSamples on mesh " << sampleRegion_
<< " : " << endl;
forAll(nearest, sampleI)
{
label procI = nearest[sampleI].second().second();
label localI = nearest[sampleI].first().index();
Info<< " " << sampleI << " coord:"<< samples[sampleI]
<< " found on processor:" << procI
<< " in local cell/face:" << localI
<< " with cc:" << nearest[sampleI].first().rawPoint() << endl;
}
}
// Check for samples not being found
forAll(nearest, sampleI)
{
if (!nearest[sampleI].first().hit())
{
FatalErrorIn
(
"directMappedPatchBase::findSamples"
"(const pointField&, labelList&"
", labelList&, pointField&)"
) << "Did not find sample " << samples[sampleI]
<< " on any processor of region " << sampleRegion_
<< exit(FatalError);
}
}
// Convert back into proc+local index
sampleProcs.setSize(samples.size());
sampleIndices.setSize(samples.size());
sampleLocations.setSize(samples.size());
forAll(nearest, sampleI)
{
sampleProcs[sampleI] = nearest[sampleI].second().second();
sampleIndices[sampleI] = nearest[sampleI].first().index();
sampleLocations[sampleI] = nearest[sampleI].first().hitPoint();
}
}
void Foam::directMappedPatchBase::calcMapping() const
{
if (mapPtr_.valid())
{
FatalErrorIn("directMappedPatchBase::calcMapping() const")
<< "Mapping already calculated" << exit(FatalError);
}
// Do a sanity check
// Am I sampling my own patch? This only makes sense for a non-zero
// offset.
bool sampleMyself =
(
mode_ == NEARESTPATCHFACE
&& sampleRegion_ == patch_.boundaryMesh().mesh().name()
&& samplePatch_ == patch_.name()
);
// Check offset
vectorField d(samplePoints()-patch_.faceCentres());
if (sampleMyself && gAverage(mag(d)) <= ROOTVSMALL)
{
WarningIn
(
"directMappedPatchBase::directMappedPatchBase\n"
"(\n"
" const polyPatch& pp,\n"
" const word& sampleRegion,\n"
" const sampleMode mode,\n"
" const word& samplePatch,\n"
" const vector& offset\n"
")\n"
) << "Invalid offset " << d << endl
<< "Offset is the vector added to the patch face centres to"
<< " find the patch face supplying the data." << endl
<< "Setting it to " << d
<< " on the same patch, on the same region"
<< " will find the faces themselves which does not make sense"
<< " for anything but testing." << endl
<< "patch_:" << patch_.name() << endl
<< "sampleRegion_:" << sampleRegion_ << endl
<< "mode_:" << sampleModeNames_[mode_] << endl
<< "samplePatch_:" << samplePatch_ << endl
<< "offsetMode_:" << offsetModeNames_[offsetMode_] << endl;
}
// Get global list of all samples and the processor and face they come from.
pointField samples;
labelList patchFaceProcs;
labelList patchFaces;
pointField patchFc;
collectSamples(samples, patchFaceProcs, patchFaces, patchFc);
// Find processor and cell/face samples are in and actual location.
labelList sampleProcs;
labelList sampleIndices;
pointField sampleLocations;
findSamples(samples, sampleProcs, sampleIndices, sampleLocations);
// Now we have all the data we need:
// - where sample originates from (so destination when mapping):
// patchFaces, patchFaceProcs.
// - cell/face sample is in (so source when mapping)
// sampleIndices, sampleProcs.
//forAll(samples, i)
//{
// Info<< i << " need data in region "
// << patch_.boundaryMesh().mesh().name()
// << " for proc:" << patchFaceProcs[i]
// << " face:" << patchFaces[i]
// << " at:" << patchFc[i] << endl
// << "Found data in region " << sampleRegion_
// << " at proc:" << sampleProcs[i]
// << " face:" << sampleIndices[i]
// << " at:" << sampleLocations[i]
// << nl << endl;
//}
if (debug && Pstream::master())
{
OFstream str
(
patch_.boundaryMesh().mesh().time().path()
/ patch_.name()
+ "_directMapped.obj"
);
Pout<< "Dumping mapping as lines from patch faceCentres to"
<< " sampled cell/faceCentres to file " << str.name() << endl;
label vertI = 0;
forAll(patchFc, i)
{
meshTools::writeOBJ(str, patchFc[i]);
vertI++;
meshTools::writeOBJ(str, sampleLocations[i]);
vertI++;
str << "l " << vertI-1 << ' ' << vertI << nl;
}
}
// Determine schedule.
mapPtr_.reset(new mapDistribute(sampleProcs, patchFaceProcs));
// Rework the schedule from indices into samples to cell data to send,
// face data to receive.
labelListList& subMap = mapPtr_().subMap();
labelListList& constructMap = mapPtr_().constructMap();
forAll(subMap, procI)
{
subMap[procI] = UIndirectList<label>
(
sampleIndices,
subMap[procI]
);
constructMap[procI] = UIndirectList<label>
(
patchFaces,
constructMap[procI]
);
//if (debug)
//{
// Pout<< "To proc:" << procI << " sending values of cells/faces:"
// << subMap[procI] << endl;
// Pout<< "From proc:" << procI
// << " receiving values of patch faces:"
// << constructMap[procI] << endl;
//}
}
// Redo constructSize
mapPtr_().constructSize() = patch_.size();
if (debug)
{
// Check that all elements get a value.
PackedBoolList used(patch_.size());
forAll(constructMap, procI)
{
const labelList& map = constructMap[procI];
forAll(map, i)
{
label faceI = map[i];
if (used[faceI] == 0)
{
used[faceI] = 1;
}
else
{
FatalErrorIn("directMappedPatchBase::calcMapping() const")
<< "On patch " << patch_.name()
<< " patchface " << faceI
<< " is assigned to more than once."
<< abort(FatalError);
}
}
}
forAll(used, faceI)
{
if (used[faceI] == 0)
{
FatalErrorIn("directMappedPatchBase::calcMapping() const")
<< "On patch " << patch_.name()
<< " patchface " << faceI
<< " is never assigned to."
<< abort(FatalError);
}
}
}
}
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp
)
:
patch_(pp),
sampleRegion_(patch_.boundaryMesh().mesh().name()),
mode_(NEARESTPATCHFACE),
samplePatch_("none"),
offsetMode_(UNIFORM),
offset_(vector::zero),
offsets_(pp.size(), offset_),
distance_(0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode mode,
const word& samplePatch,
const vectorField& offsets
)
:
patch_(pp),
sampleRegion_(sampleRegion),
mode_(mode),
samplePatch_(samplePatch),
offsetMode_(NONUNIFORM),
offset_(vector::zero),
offsets_(offsets),
distance_(0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode mode,
const word& samplePatch,
const vector& offset
)
:
patch_(pp),
sampleRegion_(sampleRegion),
mode_(mode),
samplePatch_(samplePatch),
offsetMode_(UNIFORM),
offset_(offset),
offsets_(0),
distance_(0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode mode,
const word& samplePatch,
const scalar distance
)
:
patch_(pp),
sampleRegion_(sampleRegion),
mode_(mode),
samplePatch_(samplePatch),
offsetMode_(NORMAL),
offset_(vector::zero),
offsets_(0),
distance_(distance),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const dictionary& dict
)
:
patch_(pp),
sampleRegion_
(
dict.lookupOrDefault
(
"sampleRegion",
patch_.boundaryMesh().mesh().name()
)
),
mode_(sampleModeNames_.read(dict.lookup("sampleMode"))),
samplePatch_(dict.lookup("samplePatch")),
offsetMode_(UNIFORM),
offset_(vector::zero),
offsets_(0),
distance_(0.0),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{
if (dict.found("offsetMode"))
{
offsetMode_ = offsetModeNames_.read(dict.lookup("offsetMode"));
switch(offsetMode_)
{
case UNIFORM:
{
offset_ = point(dict.lookup("offset"));
}
break;
case NONUNIFORM:
{
offsets_ = pointField(dict.lookup("offsets"));
}
break;
case NORMAL:
{
distance_ = readScalar(dict.lookup("distance"));
}
break;
}
}
else if (dict.found("offset"))
{
offsetMode_ = UNIFORM;
offset_ = point(dict.lookup("offset"));
}
else if (dict.found("offsets"))
{
offsetMode_ = NONUNIFORM;
offsets_ = pointField(dict.lookup("offsets"));
}
else
{
FatalIOErrorIn
(
"directMappedPatchBase::directMappedPatchBase\n"
"(\n"
" const polyPatch& pp,\n"
" const dictionary& dict\n"
")\n",
dict
) << "Please supply the offsetMode as one of "
<< NamedEnum<offsetMode, 3>::words()
<< exit(FatalIOError);
}
}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const directMappedPatchBase& dmp
)
:
patch_(pp),
sampleRegion_(dmp.sampleRegion_),
mode_(dmp.mode_),
samplePatch_(dmp.samplePatch_),
offsetMode_(dmp.offsetMode_),
offset_(dmp.offset_),
offsets_(dmp.offsets_),
distance_(dmp.distance_),
sameRegion_(dmp.sameRegion_),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const directMappedPatchBase& dmp,
const labelUList& mapAddressing
)
:
patch_(pp),
sampleRegion_(dmp.sampleRegion_),
mode_(dmp.mode_),
samplePatch_(dmp.samplePatch_),
offsetMode_(dmp.offsetMode_),
offset_(dmp.offset_),
offsets_(dmp.offsets_, mapAddressing),
distance_(dmp.distance_),
sameRegion_(dmp.sameRegion_),
mapPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directMappedPatchBase::~directMappedPatchBase()
{
clearOut();
}
void Foam::directMappedPatchBase::clearOut()
{
mapPtr_.clear();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::polyMesh& Foam::directMappedPatchBase::sampleMesh() const
{
return patch_.boundaryMesh().mesh().time().lookupObject<polyMesh>
(
sampleRegion_
);
}
const Foam::polyPatch& Foam::directMappedPatchBase::samplePolyPatch() const
{
const polyMesh& nbrMesh = sampleMesh();
const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_);
if (patchI == -1)
{
FatalErrorIn("directMappedPatchBase::samplePolyPatch() ")
<< "Cannot find patch " << samplePatch_
<< " in region " << sampleRegion_ << endl
<< "Valid patches are " << nbrMesh.boundaryMesh().names()
<< exit(FatalError);
}
return nbrMesh.boundaryMesh()[patchI];
}
Foam::tmp<Foam::pointField> Foam::directMappedPatchBase::samplePoints() const
{
tmp<pointField> tfld(new pointField(patch_.faceCentres()));
pointField& fld = tfld();
switch(offsetMode_)
{
case UNIFORM:
{
fld += offset_;
}
break;
case NONUNIFORM:
{
fld += offsets_;
}
break;
case NORMAL:
{
// Get outwards pointing normal
vectorField n(patch_.faceAreas());
n /= mag(n);
fld += distance_*n;
}
break;
}
return tfld;
}
void Foam::directMappedPatchBase::write(Ostream& os) const
{
os.writeKeyword("sampleMode") << sampleModeNames_[mode_]
<< token::END_STATEMENT << nl;
os.writeKeyword("sampleRegion") << sampleRegion_
<< token::END_STATEMENT << nl;
os.writeKeyword("samplePatch") << samplePatch_
<< token::END_STATEMENT << nl;
os.writeKeyword("offsetMode") << offsetModeNames_[offsetMode_]
<< token::END_STATEMENT << nl;
switch(offsetMode_)
{
case UNIFORM:
{
os.writeKeyword("offset") << offset_ << token::END_STATEMENT << nl;
}
break;
case NONUNIFORM:
{
os.writeKeyword("offsets") << offsets_ << token::END_STATEMENT
<< nl;
}
break;
case NORMAL:
{
os.writeKeyword("distance") << distance_ << token::END_STATEMENT
<< nl;
}
break;
}
}
// ************************************************************************* //

View File

@ -1,338 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedPatchBase
Description
Determines a mapping between patch face centres and mesh cell or face
centres and processors they're on.
If constructed from dictionary:
// Region to sample (default is region0)
sampleRegion region0;
// What to sample:
// - nearestCell : sample nearest cell
// - nearestPatchFace : nearest face on selected patch
// - nearestFace : nearest boundary face on any patch
sampleMode nearestCell;
// If sampleMod is nearestPatchFace : patch to find faces of
samplePatch movingWall;
// How to supply offset (w.r.t. my patch face centres):
// - uniform : single offset vector
// - nonuniform : per-face offset vector
// - normal : using supplied distance and face normal
offsetMode uniform;
// According to offsetMode (see above) supply one of
// offset, offsets or distance
offset (1 0 0);
Note: if offsetMode is 'normal' it uses outwards pointing normals. So
supply a negative distance if sampling inside the domain.
Note
Storage is not optimal. It temporary collects all (patch)face centres
on all processors to keep the addressing calculation simple.
SourceFiles
directMappedPatchBase.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedPatchBase_H
#define directMappedPatchBase_H
#include "pointField.H"
#include "Tuple2.H"
#include "pointIndexHit.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyPatch;
class polyMesh;
class mapDistribute;
/*---------------------------------------------------------------------------*\
Class directMappedPatchBase Declaration
\*---------------------------------------------------------------------------*/
class directMappedPatchBase
{
public:
//- Mesh items to sample
enum sampleMode
{
NEARESTCELL, // nearest cell
NEARESTPATCHFACE, // faces on selected patch
NEARESTFACE // nearest face
};
//- How to project face centres
enum offsetMode
{
UNIFORM, // single offset vector
NONUNIFORM, // per-face offset vector
NORMAL // use face normal + distance
};
//- Helper class for finding nearest
// Nearest:
// - point+local index
// - sqr(distance)
// - processor
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().first() < x.second().first())
{
x = y;
}
}
}
};
private:
// Private data
static const NamedEnum<sampleMode, 3> sampleModeNames_;
static const NamedEnum<offsetMode, 3> offsetModeNames_;
//- Patch to sample
const polyPatch& patch_;
//- Region to sample
const word sampleRegion_;
//- What to sample
const sampleMode mode_;
//- Patch (only if NEARESTPATCHFACE)
const word samplePatch_;
//- How to obtain samples
offsetMode offsetMode_;
//- Offset vector (uniform)
vector offset_;
//- Offset vector (nonuniform)
vectorField offsets_;
//- Offset distance (normal)
scalar distance_;
//- Same region
const bool sameRegion_;
// Derived information
//- Communication schedule:
// - Cells/faces to sample per processor
// - Patch faces to receive per processor
// - schedule
mutable autoPtr<mapDistribute> mapPtr_;
// Private Member Functions
//- Collect single list of samples and originating processor+face.
void collectSamples
(
pointField&,
labelList& patchFaceProcs,
labelList& patchFaces,
pointField& patchFc
) const;
//- Find cells/faces containing samples
void findSamples
(
const pointField&,
labelList& sampleProcs, // processor containing sample
labelList& sampleIndices, // local index of cell/face
pointField& sampleLocations // actual representative location
) const;
//- Calculate matching
void calcMapping() const;
public:
//- Runtime type information
TypeName("directMappedPatchBase");
// Constructors
//- Construct from patch
directMappedPatchBase(const polyPatch&);
//- Construct with offsetMode=non-uniform
directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const vectorField& offsets
);
//- Construct from offsetMode=uniform
directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const vector& offset
);
//- Construct from offsetMode=normal and distance
directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const scalar distance
);
//- Construct from dictionary
directMappedPatchBase(const polyPatch&, const dictionary&);
//- Construct as copy, resetting patch
directMappedPatchBase(const polyPatch&, const directMappedPatchBase&);
//- Construct as copy, resetting patch, map original data
directMappedPatchBase
(
const polyPatch&,
const directMappedPatchBase&,
const labelUList& mapAddressing
);
//- Destructor
virtual ~directMappedPatchBase();
// Member functions
void clearOut();
//- What to sample
const sampleMode& mode() const
{
return mode_;
}
//- Region to sample
const word& sampleRegion() const
{
return sampleRegion_;
}
//- Patch (only if NEARESTPATCHFACE)
const word& samplePatch() const
{
return samplePatch_;
}
//- Offset vector (from patch faces to destination mesh objects)
const vector& offset() const
{
return offset_;
}
//- Offset vector (from patch faces to destination mesh objects)
const vectorField& offsets() const
{
return offsets_;
}
//- Return reference to the parallel distribution map
const mapDistribute& map() const
{
if (mapPtr_.empty())
{
calcMapping();
}
return mapPtr_();
}
//- Cached sampleRegion != mesh.name()
bool sameRegion() const
{
return sameRegion_;
}
//- Get the region mesh
const polyMesh& sampleMesh() const;
//- Get the patch on the region
const polyPatch& samplePolyPatch() const;
//- Get the sample points
tmp<pointField> samplePoints() const;
//- Write as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,226 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directMappedPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directMappedPolyPatch, 0);
addToRunTimeSelectionTable(polyPatch, directMappedPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, directMappedPolyPatch, dictionary);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
)
:
polyPatch(name, size, start, index, bm),
directMappedPatchBase(static_cast<const polyPatch&>(*this))
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
)
:
polyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
)
:
polyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
)
:
polyPatch(name, dict, index, bm),
directMappedPatchBase(*this, dict)
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const directMappedPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
polyPatch(pp, bm),
directMappedPatchBase(*this, pp)
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const directMappedPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
)
:
polyPatch(pp, bm, index, newSize, newStart),
directMappedPatchBase(*this, pp)
{}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const directMappedPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart),
directMappedPatchBase(*this, pp, mapAddressing)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directMappedPolyPatch::~directMappedPolyPatch()
{
directMappedPatchBase::clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Initialise the calculation of the patch geometry
void Foam::directMappedPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
polyPatch::initGeometry(pBufs);
}
//- Calculate the patch geometry
void Foam::directMappedPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
polyPatch::calcGeometry(pBufs);
directMappedPatchBase::clearOut();
}
//- Initialise the patches for moving points
void Foam::directMappedPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
polyPatch::initMovePoints(pBufs, p);
}
//- Correct patches after moving points
void Foam::directMappedPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
polyPatch::movePoints(pBufs, p);
directMappedPatchBase::clearOut();
}
//- Initialise the update of the patch topology
void Foam::directMappedPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
polyPatch::initUpdateMesh(pBufs);
}
//- Update of the patch topology
void Foam::directMappedPolyPatch::updateMesh(PstreamBuffers& pBufs)
{
polyPatch::updateMesh(pBufs);
directMappedPatchBase::clearOut();
}
void Foam::directMappedPolyPatch::write(Ostream& os) const
{
polyPatch::write(os);
directMappedPatchBase::write(os);
}
// ************************************************************************* //

View File

@ -1,233 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedPolyPatch
Description
Determines a mapping between patch face centres and mesh cell or face
centres and processors they're on.
Note
Storage is not optimal. It stores all face centres and cells on all
processors to keep the addressing calculation simple.
SourceFiles
directMappedPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedPolyPatch_H
#define directMappedPolyPatch_H
#include "polyPatch.H"
#include "directMappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class directMappedPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedPolyPatch
:
public polyPatch,
public directMappedPatchBase
{
protected:
//- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology
virtual void updateMesh(PstreamBuffers&);
public:
//- Runtime type information
TypeName("directMappedPatch");
// Constructors
//- Construct from components
directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
);
//- Construct from components
directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
);
//- Construct from components. Uniform offset.
directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
directMappedPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
);
//- Construct as copy, resetting the boundary mesh
directMappedPolyPatch
(
const directMappedPolyPatch&,
const polyBoundaryMesh&
);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
directMappedPolyPatch
(
const directMappedPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
);
//- Construct given the original patch and a map
directMappedPolyPatch
(
const directMappedPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new directMappedPolyPatch(*this, bm));
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedPolyPatch(*this, bm, index, newSize, newStart)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
//- Destructor
virtual ~directMappedPolyPatch();
// Member functions
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,178 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directMappedVariableThicknessWallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directMappedVariableThicknessWallPolyPatch, 0);
addToRunTimeSelectionTable
(
polyPatch,
directMappedVariableThicknessWallPolyPatch,
word
);
addToRunTimeSelectionTable
(
polyPatch,
directMappedVariableThicknessWallPolyPatch,
dictionary
);
}
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(name, size, start, index, bm),
thickness_(size)
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(name, size, start, index, bm),
thickness_(size)
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(name, size, start, index, bm),
thickness_(size)
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(name, dict, index, bm),
thickness_(scalarField("thickness", dict, this->size()))
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const directMappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
directMappedWallPolyPatch(pp, bm),
thickness_(pp.thickness_)
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const directMappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
)
:
directMappedWallPolyPatch(pp, bm, index, newSize, newStart),
thickness_(newSize)
{}
Foam::directMappedVariableThicknessWallPolyPatch::
directMappedVariableThicknessWallPolyPatch
(
const directMappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
)
:
directMappedWallPolyPatch(pp, bm, index, mapAddressing, newStart),
thickness_(pp.size())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directMappedVariableThicknessWallPolyPatch::
~directMappedVariableThicknessWallPolyPatch()
{
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::directMappedVariableThicknessWallPolyPatch::
write(Foam::Ostream& os) const
{
os.writeKeyword("thickness") << thickness_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -1,236 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedVariableThicknessWallPolyPatch
Description
Foam::directMappedVariableThicknessWallPolyPatch
SourceFiles
directMappedVariableThicknessWallPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedVariableThicknessWallPolyPatch_H
#define directMappedVariableThicknessWallPolyPatch_H
#include "wallPolyPatch.H"
#include "directMappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class directMappedVariableThicknessWallPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedVariableThicknessWallPolyPatch
:
public directMappedWallPolyPatch
{
// Private data
//- Thickness
scalarList thickness_;
public:
//- Runtime type information
TypeName("directMappedWallVariableThickness");
// Constructors
//- Construct from components
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
);
//- Construct from components
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
);
//- Construct from components. Uniform offset.
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
directMappedVariableThicknessWallPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
);
//- Construct as copy, resetting the boundary mesh
directMappedVariableThicknessWallPolyPatch
(
const directMappedVariableThicknessWallPolyPatch&,
const polyBoundaryMesh&
);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
directMappedVariableThicknessWallPolyPatch
(
const directMappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
);
//- Construct given the original patch and a map
directMappedVariableThicknessWallPolyPatch
(
const directMappedVariableThicknessWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>
(
new directMappedVariableThicknessWallPolyPatch(*this, bm)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedVariableThicknessWallPolyPatch
(
*this,
bm,
index,
newSize,
newStart
)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedVariableThicknessWallPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
//- Destructor
virtual ~directMappedVariableThicknessWallPolyPatch();
// Member functions
//- Return non const thickness
scalarList& thickness()
{
return thickness_;
}
//- Return const thickness
const scalarList& thickness() const
{
return thickness_;
}
//- Write the polyPatch data as a dictionary
void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,231 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directMappedWallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directMappedWallPolyPatch, 0);
addToRunTimeSelectionTable(polyPatch, directMappedWallPolyPatch, word);
addToRunTimeSelectionTable
(
polyPatch,
directMappedWallPolyPatch,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(name, size, start, index, bm),
directMappedPatchBase(static_cast<const polyPatch&>(*this))
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(name, dict, index, bm),
directMappedPatchBase(*this, dict)
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const directMappedWallPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(pp, bm),
directMappedPatchBase(*this, pp)
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const directMappedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
)
:
wallPolyPatch(pp, bm, index, newSize, newStart),
directMappedPatchBase(*this, pp)
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const directMappedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
)
:
wallPolyPatch(pp, bm, index, mapAddressing, newStart),
directMappedPatchBase(*this, pp, mapAddressing)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directMappedWallPolyPatch::~directMappedWallPolyPatch()
{
directMappedPatchBase::clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Initialise the calculation of the patch geometry
void Foam::directMappedWallPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
wallPolyPatch::initGeometry(pBufs);
}
//- Calculate the patch geometry
void Foam::directMappedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
wallPolyPatch::calcGeometry(pBufs);
directMappedPatchBase::clearOut();
}
//- Initialise the patches for moving points
void Foam::directMappedWallPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
wallPolyPatch::initMovePoints(pBufs, p);
}
//- Correct patches after moving points
void Foam::directMappedWallPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
wallPolyPatch::movePoints(pBufs, p);
directMappedPatchBase::clearOut();
}
//- Initialise the update of the patch topology
void Foam::directMappedWallPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
wallPolyPatch::initUpdateMesh(pBufs);
}
//- Update of the patch topology
void Foam::directMappedWallPolyPatch::updateMesh(PstreamBuffers& pBufs)
{
wallPolyPatch::updateMesh(pBufs);
directMappedPatchBase::clearOut();
}
void Foam::directMappedWallPolyPatch::write(Ostream& os) const
{
wallPolyPatch::write(os);
directMappedPatchBase::write(os);
}
// ************************************************************************* //

View File

@ -1,240 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedWallPolyPatch
Description
Determines a mapping between patch face centres and mesh cell or face
centres and processors they're on.
Note
Storage is not optimal. It stores all face centres and cells on all
processors to keep the addressing calculation simple.
SourceFiles
directMappedWallPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedWallPolyPatch_H
#define directMappedWallPolyPatch_H
#include "wallPolyPatch.H"
#include "directMappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
/*---------------------------------------------------------------------------*\
Class directMappedWallPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedWallPolyPatch
:
public wallPolyPatch,
public directMappedPatchBase
{
protected:
//- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology
virtual void updateMesh(PstreamBuffers&);
public:
//- Runtime type information
TypeName("directMappedWall");
// Constructors
//- Construct from components
directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
);
//- Construct from components
directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
);
//- Construct from components. Uniform offset.
directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vector& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary
directMappedWallPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
);
//- Construct as copy, resetting the boundary mesh
directMappedWallPolyPatch
(
const directMappedWallPolyPatch&,
const polyBoundaryMesh&
);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
directMappedWallPolyPatch
(
const directMappedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
);
//- Construct given the original patch and a map
directMappedWallPolyPatch
(
const directMappedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new directMappedWallPolyPatch(*this, bm));
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedWallPolyPatch
(
*this,
bm,
index,
newSize,
newStart
)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedWallPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
//- Destructor
virtual ~directMappedWallPolyPatch();
// Member functions
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "directMappedPointPatch.H"
#include "mappedPointPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -33,13 +33,13 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(directMappedPointPatch, 0);
defineTypeNameAndDebug(mappedPointPatch, 0);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
directMappedPointPatch,
mappedPointPatch,
polyPatch
);

View File

@ -22,21 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directMappedWallPointPatch
Foam::mappedPointPatch
Description
DirectMapped patch.
mappedPointPatch patch.
SourceFiles
directMappedWallPointPatch.C
mappedPointPatch.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedWallPointPatch_H
#define directMappedWallPointPatch_H
#ifndef mappedPointPatch_H
#define mappedPointPatch_H
#include "wallPointPatch.H"
#include "directMappedWallPolyPatch.H"
#include "mappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,10 +44,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedWallPointPatch Declaration
Class mappedPointPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedWallPointPatch
class mappedPointPatch
:
public wallPointPatch
{
@ -55,13 +55,13 @@ class directMappedWallPointPatch
public:
//- Runtime type information
TypeName(directMappedWallPolyPatch::typeName_());
TypeName(mappedWallPolyPatch::typeName_());
// Constructors
//- Construct from polyPatch
directMappedWallPointPatch
mappedPointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm

View File

@ -889,6 +889,8 @@ Foam::mappedPatchBase::~mappedPatchBase()
void Foam::mappedPatchBase::clearOut()
{
mapPtr_.clear();
AMIPtr_.clear();
surfPtr_.clear();
}
@ -986,6 +988,12 @@ void Foam::mappedPatchBase::write(Ostream& os) const
break;
}
}
if (mode_ == NEARESTPATCHFACEAMI)
{
os.writeKeyword(surfDict_.dictName());
os << surfDict_;
}
}

View File

@ -26,7 +26,7 @@ License
#include "nearWallFields.H"
#include "wordReList.H"
//#include "volFields.H"
//#include "selfContainedDirectMappedFixedValueFvPatchFields.H"
//#include "selfContainedMappedFixedValueFvPatchFields.H"
//#include "interpolationCellPoint.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -102,7 +102,7 @@ void Foam::nearWallFields::read(const dictionary& dict)
reverseFieldMap_.clear();
// Generate fields with selfContainedDirectMapped bc.
// Generate fields with selfContainedMapped bc.
// Convert field to map
fieldMap_.resize(2*fieldSet_.size());

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "nearWallFields.H"
#include "selfContainedDirectMappedFixedValueFvPatchFields.H"
#include "selfContainedMappedFixedValueFvPatchFields.H"
#include "interpolationCellPoint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,7 +65,7 @@ void Foam::nearWallFields::createFields
sflds.set(sz, new vfType(io, fld));
vfType& sampleFld = sflds[sz];
// Reset the bcs to be directMapped
// Reset the bcs to be mapped
forAllConstIter(labelHashSet, patchSet_, iter)
{
label patchI = iter.key();
@ -73,14 +73,13 @@ void Foam::nearWallFields::createFields
sampleFld.boundaryField().set
(
patchI,
new selfContainedDirectMappedFixedValueFvPatchField
<Type>
new selfContainedMappedFixedValueFvPatchField<Type>
(
sampleFld.mesh().boundary()[patchI],
sampleFld.dimensionedInternalField(),
sampleFld.mesh().name(),
directMappedPatchBase::NEARESTCELL,
mappedPatchBase::NEARESTCELL,
word::null, // samplePatch
-distance_,
@ -115,7 +114,7 @@ void Foam::nearWallFields::sampleFields
// Take over internal and boundary values
sflds[i] == fld;
// Evaluate to update the directMapped
// Evaluate to update the mapped
sflds[i].correctBoundaryConditions();
}
}

View File

@ -27,7 +27,7 @@ License
#include "volFields.H"
#include "IOmanip.H"
// For 'nearInfo' helper class only
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
//#include "meshSearch.H"
#include "treeBoundBox.H"
#include "treeDataFace.H"
@ -59,7 +59,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
}
// All the info for nearest. Construct to miss
List<directMappedPatchBase::nearInfo> nearest(this->size());
List<mappedPatchBase::nearInfo> nearest(this->size());
const polyPatch& pp = bm[patchI];
@ -133,7 +133,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
{
const point& fc = mesh.faceCentres()[faceI];
directMappedPatchBase::nearInfo sampleInfo;
mappedPatchBase::nearInfo sampleInfo;
sampleInfo.first() = pointIndexHit
(
@ -152,7 +152,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
// Find nearest.
Pstream::listCombineGather(nearest, directMappedPatchBase::nearestEqOp());
Pstream::listCombineGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineScatter(nearest);
if (debug)

View File

@ -31,7 +31,7 @@ License
#include "Time.H"
#include "meshTools.H"
// For 'nearInfo' helper class only
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -118,7 +118,7 @@ void Foam::patchCloudSet::calcSamples
// All the info for nearest. Construct to miss
List<directMappedPatchBase::nearInfo> nearest(sampleCoords_.size());
List<mappedPatchBase::nearInfo> nearest(sampleCoords_.size());
forAll(sampleCoords_, sampleI)
{
@ -159,7 +159,7 @@ void Foam::patchCloudSet::calcSamples
// Find nearest.
Pstream::listCombineGather(nearest, directMappedPatchBase::nearestEqOp());
Pstream::listCombineGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineScatter(nearest);

View File

@ -66,11 +66,11 @@ Foam::sampledPatchInternalField::sampledPatchInternalField
mappers_.set
(
i,
new directMappedPatchBase
new mappedPatchBase
(
mesh.boundaryMesh()[patchI],
mesh.name(), // sampleRegion
directMappedPatchBase::NEARESTCELL, // sampleMode
mappedPatchBase::NEARESTCELL, // sampleMode
word::null, // samplePatch
-distance // sample inside my domain
)

View File

@ -41,7 +41,7 @@ SourceFiles
#define sampledPatchInternalField_H
#include "sampledPatch.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,7 +59,7 @@ class sampledPatchInternalField
// Private data
//- Mapping engines
PtrList<directMappedPatchBase> mappers_;
PtrList<mappedPatchBase> mappers_;
// Private Member Functions

View File

@ -82,7 +82,7 @@ Foam::sampledPatchInternalField::interpolateField
forAll(patchIDs(), i)
{
// See directMappedFixedValueFvPatchField
// See mappedFixedValueFvPatchField
const mapDistribute& distMap = mappers_[i].map();
// Send back sample points to processor that holds the cell.

View File

@ -27,7 +27,7 @@ License
#include "volFields.H"
#include "basicSolidThermo.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
@ -79,7 +79,7 @@ Foam::radiationCoupledBase::radiationCoupledBase
{
case SOLIDTHERMO:
{
if (!isA<directMappedPatchBase>(patch_.patch()))
if (!isA<mappedPatchBase>(patch_.patch()))
{
FatalIOErrorIn
(
@ -90,7 +90,7 @@ Foam::radiationCoupledBase::radiationCoupledBase
")\n",
dict
) << "\n patch type '" << patch_.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << patch_.name()
<< exit(FatalIOError);
}
@ -133,9 +133,9 @@ Foam::scalarField Foam::radiationCoupledBase::emissivity() const
{
case SOLIDTHERMO:
{
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>
// Get the coupling information from the mappedPatchBase
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>
(
patch_.patch()
);

View File

@ -27,7 +27,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -25,7 +25,7 @@ License
#include "volFields.H"
#include "surfaceFields.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
#include "turbulenceModel.H"
#include "mapDistribute.H"
@ -90,7 +90,7 @@ temperatureThermoBaffle1DFvPatchScalarField
Qs_(scalarField("Qs", dict, p.size())),
solid_(new solidThermoData(dict))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
if (!isA<mappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
@ -102,7 +102,7 @@ temperatureThermoBaffle1DFvPatchScalarField
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << patch().type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << patch().name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
@ -197,7 +197,7 @@ void temperatureThermoBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
(
patch().patch()
);

View File

@ -27,7 +27,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
#include "regionProperties.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -141,7 +141,7 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
temperatureCoupledBase(patch(), dict),
neighbourFieldName_(dict.lookup("neighbourFieldName"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
if (!isA<mappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
@ -153,7 +153,7 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
@ -189,8 +189,8 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
// Get the coupling information from the mappedPatchBase
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
(
this->patch().patch()
);

View File

@ -42,11 +42,11 @@ Description
value uniform 300;
}
Needs to be on underlying directMapped(Wall)FvPatch.
Needs to be on underlying mapped(Wall)FvPatch.
Note: see temperatureCoupledBase on ways to specify K.
Note: runs in parallel with arbitrary decomposition. Uses directMapped
Note: runs in parallel with arbitrary decomposition. Uses mapped
functionality to calculate exchange.
Note: lags interface data so both sides use same data.

View File

@ -27,7 +27,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,7 +85,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
temperatureCoupledBase(patch(), dict),
neighbourFieldName_(dict.lookup("neighbourFieldName"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
if (!isA<mappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
@ -97,7 +97,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
@ -150,8 +150,8 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
// Get the coupling information from the mappedPatchBase
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
(
patch().patch()
);

View File

@ -46,7 +46,7 @@ Description
value uniform 300;
}
Needs to be on underlying directMapped(Wall)FvPatch.
Needs to be on underlying mapped(Wall)FvPatch.
Note: K : heat conduction at patch. Gets supplied how to lookup/calculate K:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
@ -54,7 +54,7 @@ Description
- 'solidThermo' : use basicSolidThermo K()
- 'directionalSolidThermo' directionalK()
Note: runs in parallel with arbitrary decomposition. Uses directMapped
Note: runs in parallel with arbitrary decomposition. Uses mapped
functionality to calculate exchange.
SourceFiles

View File

@ -27,7 +27,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -88,7 +88,7 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
QrNbrName_(dict.lookup("QrNbr")),
QrName_(dict.lookup("Qr"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
if (!isA<mappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
@ -100,7 +100,7 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
@ -155,9 +155,9 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>(patch().patch());
// Get the coupling information from the mappedPatchBase
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(patch().patch());
const polyMesh& nbrMesh = mpp.sampleMesh();
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatch& nbrPatch =

View File

@ -42,7 +42,7 @@ Description
value uniform 300;
}
Needs to be on underlying directMapped(Wall)FvPatch.
Needs to be on underlying mapped(Wall)FvPatch.
Note: K : heat conduction at patch. Gets supplied how to lookup/calculate
K:
@ -51,7 +51,7 @@ Description
- 'solidThermo' : use basicSolidThermo K()
- 'directionalSolidThermo' directionalK()
Note: runs in parallel with arbitrary decomposition. Uses directMapped
Note: runs in parallel with arbitrary decomposition. Uses mapped
functionality to calculate exchange.
SourceFiles

View File

@ -50,7 +50,7 @@ boundaryField
"(region0_to.*)"
{
type directMappedFlowRate;
type mappedFlowRate;
phi phi;
nbrPhi phiGas;
rho rho;

View File

@ -38,7 +38,7 @@ boundaryField
region0_to_panelRegion_left_face
{
type directMappedField;
type mappedField;
sampleRegion region0;
sampleMode nearestPatchFace;
samplePatch region0_to_panelRegion_left_face;
@ -51,7 +51,7 @@ boundaryField
region0_to_panelRegion_right_face
{
type directMappedField;
type mappedField;
sampleRegion region0;
sampleMode nearestPatchFace;
samplePatch region0_to_panelRegion_right_face;

View File

@ -28,7 +28,7 @@ nLayers 5;
expansionRatio 1;
adaptMesh true; // directMapped for both
adaptMesh true; // mapped for both
linearNormalCoeffs
{

View File

@ -87,7 +87,7 @@ boundary
baffle1Wall_0
{
type directMappedWall;
type mappedWall;
sampleMode nearestPatchFace;
sampleRegion region0;
samplePatch baffle1Wall_1;
@ -98,7 +98,7 @@ boundary
baffle1Wall_1
{
type directMappedWall;
type mappedWall;
sampleMode nearestPatchFace;
sampleRegion region0;
samplePatch baffle1Wall_0;
@ -109,7 +109,7 @@ boundary
baffle2Wall_0
{
type directMappedWall;
type mappedWall;
sampleMode nearestPatchFace;
sampleRegion region0;
samplePatch baffle2Wall_1;
@ -120,7 +120,7 @@ boundary
baffle2Wall_1
{
type directMappedWall;
type mappedWall;
sampleMode nearestPatchFace;
sampleRegion region0;
samplePatch baffle2Wall_0;

View File

@ -49,7 +49,7 @@ FoamFile
}
baffle1Wall_0
{
type directMappedWall;
type mappedWall;
nFaces 7;
startFace 3246;
sampleMode nearestPatchFace;
@ -60,7 +60,7 @@ FoamFile
}
baffle1Wall_1
{
type directMappedWall;
type mappedWall;
nFaces 7;
startFace 3253;
sampleMode nearestPatchFace;
@ -71,7 +71,7 @@ FoamFile
}
baffle2Wall_0
{
type directMappedWall;
type mappedWall;
nFaces 7;
startFace 3260;
sampleMode nearestPatchFace;
@ -82,7 +82,7 @@ FoamFile
}
baffle2Wall_1
{
type directMappedWall;
type mappedWall;
nFaces 7;
startFace 3267;
sampleMode nearestPatchFace;

View File

@ -22,7 +22,7 @@ boundaryField
{
inlet
{
type directMapped;
type mapped;
value uniform (0 0 0 0 0 0 0 0 0);
interpolationScheme cell;
setAverage false;

View File

@ -22,7 +22,7 @@ boundaryField
{
inlet
{
type directMapped;
type mapped;
value uniform (10 0 0);
interpolationScheme cell;
setAverage true;

View File

@ -22,7 +22,7 @@ boundaryField
{
inlet
{
type directMapped;
type mapped;
value uniform 2e-05;
interpolationScheme cell;
setAverage false;

View File

@ -22,7 +22,7 @@ boundaryField
{
inlet
{
type directMapped;
type mapped;
value uniform 0;
interpolationScheme cell;
setAverage false;

View File

@ -89,7 +89,7 @@ boundary
(
inlet
{
type directMappedPatch;
type mappedPatch;
offset ( 0.0495 0 0 );
sampleRegion region0;
sampleMode nearestCell;

View File

@ -19,7 +19,7 @@ FoamFile
(
inlet
{
type directMappedPatch;
type mappedPatch;
nFaces 30;
startFace 27238;
sampleMode nearestCell;

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