Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2013-11-18 14:59:43 +00:00
41 changed files with 328 additions and 253 deletions

View File

@ -49,6 +49,8 @@
{
phi = phiHbyA - p_rghEqn.flux();
p_rgh.relax();
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions();
fvOptions.correct(U);

View File

@ -303,7 +303,9 @@ surfaces
// Sampling on triSurface
type sampledTriSurfaceMesh;
surface integrationPlane.stl;
source boundaryFaces; // sample cells or boundaryFaces
source boundaryFaces; // What to sample: cells (nearest cell)
// insideCells (only triangles inside cell)
// boundaryFaces (nearest boundary face)
interpolate true;
}
);

View File

@ -14,7 +14,13 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// List of pairs of source/target patches for mapping
// Specify how to map patches. There are three different options:
// - patch exists in the source case: specify mapping (patchMap)
// - patch should be interpolated from internal values in source case
// (cuttingPatches)
// - patch should not be mapped. Default if not in patchMap or cuttingPatches
// List of pairs of target/source patches for mapping
patchMap
(
lid movingWall

View File

@ -387,6 +387,7 @@ $(cellShape)/cellShapeIO.C
$(cellShape)/cellShapeIOList.C
meshes/Identifiers/patch/patchIdentifier.C
meshes/Identifiers/patch/coupleGroupIdentifier.C
meshes/MeshObject/meshObject.C

View File

@ -171,7 +171,7 @@ void Foam::cyclicPolyPatch::calcTransforms
"cyclicPolyPatch::calcTransforms()"
) << "Patch " << name()
<< " has transform type " << transformTypeNames[transform()]
<< ", neighbour patch " << neighbPatchName_
<< ", neighbour patch " << neighbPatchName()
<< " has transform type "
<< neighbPatch().transformTypeNames[neighbPatch().transform()]
<< exit(FatalError);
@ -350,7 +350,7 @@ void Foam::cyclicPolyPatch::calcTransforms
<< neighbPatch().separationVector_
<< " by more than tolerance " << avgTol << endl
<< "patch:" << name()
<< " neighbour:" << neighbPatchName_
<< " neighbour:" << neighbPatchName()
<< endl;
}
@ -374,7 +374,7 @@ void Foam::cyclicPolyPatch::calcTransforms
<< "Continuing with specified separation vector "
<< separationVector_ << endl
<< "patch:" << name()
<< " neighbour:" << neighbPatchName_
<< " neighbour:" << neighbPatchName()
<< endl;
}
@ -658,6 +658,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
:
coupledPolyPatch(name, dict, index, bm, patchType),
neighbPatchName_(dict.lookupOrDefault("neighbourPatch", word::null)),
coupleGroup_(dict),
neighbPatchID_(-1),
rotationAxis_(vector::zero),
rotationCentre_(point::zero),
@ -665,7 +666,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
coupledPointsPtr_(NULL),
coupledEdgesPtr_(NULL)
{
if (neighbPatchName_ == word::null)
if (neighbPatchName_ == word::null && !coupleGroup_.valid())
{
FatalIOErrorIn
(
@ -733,7 +734,8 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
)
:
coupledPolyPatch(pp, bm),
neighbPatchName_(pp.neighbPatchName()),
neighbPatchName_(pp.neighbPatchName_),
coupleGroup_(pp.coupleGroup_),
neighbPatchID_(-1),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
@ -753,11 +755,12 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
const label index,
const label newSize,
const label newStart,
const word& neighbPatchName
const word& neighbName
)
:
coupledPolyPatch(pp, bm, index, newSize, newStart),
neighbPatchName_(neighbPatchName),
neighbPatchName_(neighbName),
coupleGroup_(pp.coupleGroup_),
neighbPatchID_(-1),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
@ -765,10 +768,10 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
coupledPointsPtr_(NULL),
coupledEdgesPtr_(NULL)
{
if (neighbPatchName_ == name())
if (neighbName == name())
{
FatalErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)")
<< "Neighbour patch name " << neighbPatchName_
<< "Neighbour patch name " << neighbName
<< " cannot be the same as this patch " << name()
<< exit(FatalError);
}
@ -789,6 +792,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
:
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
neighbPatchName_(pp.neighbPatchName_),
coupleGroup_(pp.coupleGroup_),
neighbPatchID_(-1),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
@ -809,16 +813,29 @@ Foam::cyclicPolyPatch::~cyclicPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::word& Foam::cyclicPolyPatch::neighbPatchName() const
{
if (neighbPatchName_.empty())
{
// Try and use patchGroup to find samplePatch and sampleRegion
label patchID = coupleGroup_.findOtherPatchID(*this);
neighbPatchName_ = boundaryMesh()[patchID].name();
}
return neighbPatchName_;
}
Foam::label Foam::cyclicPolyPatch::neighbPatchID() const
{
if (neighbPatchID_ == -1)
{
neighbPatchID_ = this->boundaryMesh().findPatchID(neighbPatchName_);
neighbPatchID_ = this->boundaryMesh().findPatchID(neighbPatchName());
if (neighbPatchID_ == -1)
{
FatalErrorIn("cyclicPolyPatch::neighbPatchID() const")
<< "Illegal neighbourPatch name " << neighbPatchName_
<< "Illegal neighbourPatch name " << neighbPatchName()
<< endl << "Valid patch names are "
<< this->boundaryMesh().names()
<< exit(FatalError);
@ -1256,7 +1273,7 @@ bool Foam::cyclicPolyPatch::order
{
Pout<< "order : of " << pp.size()
<< " faces of patch:" << name()
<< " neighbour:" << neighbPatchName_
<< " neighbour:" << neighbPatchName()
<< endl;
}
faceMap.setSize(pp.size());
@ -1444,8 +1461,12 @@ bool Foam::cyclicPolyPatch::order
void Foam::cyclicPolyPatch::write(Ostream& os) const
{
coupledPolyPatch::write(os);
os.writeKeyword("neighbourPatch") << neighbPatchName_
<< token::END_STATEMENT << nl;
if (!neighbPatchName_.empty())
{
os.writeKeyword("neighbourPatch") << neighbPatchName_
<< token::END_STATEMENT << nl;
}
coupleGroup_.write(os);
switch (transform())
{
case ROTATIONAL:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,6 +50,7 @@ SourceFiles
#include "edgeList.H"
#include "polyBoundaryMesh.H"
#include "diagTensorField.H"
#include "coupleGroupIdentifier.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,7 +68,10 @@ class cyclicPolyPatch
// Private data
//- Name of other half
const word neighbPatchName_;
mutable word neighbPatchName_;
//- Optional patchGroup to find neighbPatch
const coupleGroupIdentifier coupleGroup_;
//- Index of other half
mutable label neighbPatchID_;
@ -306,12 +310,10 @@ public:
// Member Functions
const word& neighbPatchName() const
{
return neighbPatchName_;
}
//- Neighbour patch name
const word& neighbPatchName() const;
//- Neighbour patchID.
//- Neighbour patchID
virtual label neighbPatchID() const;
virtual bool owner() const

View File

@ -46,7 +46,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0),
phiName_("phi"),
kName_("k")
{
this->refValue() = 0.0;
@ -66,7 +65,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -81,9 +79,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
@ -100,7 +99,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -114,7 +112,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -147,7 +144,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(kName_);
const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_;
this->valueFraction() = 1.0 - pos(phip);
@ -164,7 +161,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
fvPatchScalarField::write(os);
os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -98,9 +98,6 @@ class turbulentMixingLengthDissipationRateInletFvPatchScalarField
//- turbulent length scale
scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;

View File

@ -46,7 +46,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0),
phiName_("undefined-phi"),
kName_("undefined-k")
{
this->refValue() = 0.0;
@ -65,7 +64,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -79,9 +77,10 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
@ -97,7 +96,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -110,7 +108,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -143,7 +140,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(kName_);
const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
this->valueFraction() = 1.0 - pos(phip);
@ -160,7 +157,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write
fvPatchScalarField::write(os);
os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -99,9 +99,6 @@ class turbulentMixingLengthFrequencyInletFvPatchScalarField
//- Turbulent length scale
scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;

View File

@ -73,6 +73,8 @@ SRFFreestreamVelocityFvPatchVectorField
relative_(dict.lookupOrDefault("relative", false)),
UInf_(dict.lookup("UInf"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi","phi");
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
}
@ -158,6 +160,7 @@ void Foam::SRFFreestreamVelocityFvPatchVectorField::write(Ostream& os) const
fvPatchVectorField::write(os);
os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl;
os.writeKeyword("UInf") << UInf_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -66,6 +66,8 @@ freestreamFvPatchField<Type>::freestreamFvPatchField
:
inletOutletFvPatchField<Type>(p, iF)
{
this->phiName_ = dict.lookupOrDefault<word>("phi","phi");
freestreamValue() = Field<Type>("freestreamValue", dict, p.size());
if (dict.found("value"))
@ -79,8 +81,6 @@ freestreamFvPatchField<Type>::freestreamFvPatchField
{
fvPatchField<Type>::operator=(freestreamValue());
}
dict.readIfPresent("phi", this->phiName_);
}

View File

@ -40,7 +40,6 @@ inletOutletTotalTemperatureFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
UName_("U"),
phiName_("phi"),
psiName_("psi"),
gamma_(0.0),
T0_(p.size(), 0.0)
@ -62,7 +61,6 @@ inletOutletTotalTemperatureFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
phiName_(ptf.phiName_),
psiName_(ptf.psiName_),
gamma_(ptf.gamma_),
T0_(ptf.T0_, mapper)
@ -79,11 +77,12 @@ inletOutletTotalTemperatureFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
gamma_(readScalar(dict.lookup("gamma"))),
T0_("T0", dict, p.size())
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
this->refValue() = pTraits<scalar>::zero;
if (dict.found("value"))
{
@ -110,7 +109,6 @@ inletOutletTotalTemperatureFvPatchScalarField
:
inletOutletFvPatchScalarField(tppsf),
UName_(tppsf.UName_),
phiName_(tppsf.phiName_),
psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_),
T0_(tppsf.T0_)
@ -126,7 +124,6 @@ inletOutletTotalTemperatureFvPatchScalarField
:
inletOutletFvPatchScalarField(tppsf, iF),
UName_(tppsf.UName_),
phiName_(tppsf.phiName_),
psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_),
T0_(tppsf.T0_)
@ -171,7 +168,7 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volVectorField, vector>(UName_);
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
const fvPatchField<scalar>& psip =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
@ -191,7 +188,7 @@ const
{
fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "phi", "phi", this->phiName_);
writeEntryIfDifferent<word>(os, "psi", "psi", psiName_);
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os);

View File

@ -90,9 +90,6 @@ class inletOutletTotalTemperatureFvPatchScalarField
//- Name of the velocity field
word UName_;
//- Name of the flux transporting the field
word phiName_;
//- Name of the compressibility field used to calculate the wave speed
word psiName_;

View File

@ -40,8 +40,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
intensity_(0.0),
UName_("U"),
phiName_("phi")
UName_("U")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
@ -59,8 +58,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
intensity_(ptf.intensity_),
UName_(ptf.UName_),
phiName_(ptf.phiName_)
UName_(ptf.UName_)
{}
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
@ -73,9 +71,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
intensity_(readScalar(dict.lookup("intensity"))),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
UName_(dict.lookupOrDefault<word>("U", "U"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
if (intensity_ < 0 || intensity_ > 1)
{
FatalErrorIn
@ -111,8 +110,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf),
intensity_(ptf.intensity_),
UName_(ptf.UName_),
phiName_(ptf.phiName_)
UName_(ptf.UName_)
{}
@ -125,8 +123,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, iF),
intensity_(ptf.intensity_),
UName_(ptf.UName_),
phiName_(ptf.phiName_)
UName_(ptf.UName_)
{}
@ -144,7 +141,7 @@ updateCoeffs()
patch().lookupPatchField<volVectorField, vector>(UName_);
const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
this->refValue() = 1.5*sqr(intensity_)*magSqr(Up);
this->valueFraction() = 1.0 - pos(phip);
@ -161,7 +158,7 @@ void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write
fvPatchScalarField::write(os);
os.writeKeyword("intensity") << intensity_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "phi", "phi", this->phiName_);
writeEntry("value", os);
}

View File

@ -99,9 +99,6 @@ class turbulentIntensityKineticEnergyInletFvPatchScalarField
//- Name of the velocity field
word UName_;
//- Name of the flux field
word phiName_;
public:

View File

@ -125,7 +125,7 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
FatalErrorIn("cyclicAMIPolyPatch::calcTransforms()")
<< "Patch " << name()
<< " has transform type " << transformTypeNames[transform()]
<< ", neighbour patch " << nbrPatchName_
<< ", neighbour patch " << neighbPatchName()
<< " has transform type "
<< neighbPatch().transformTypeNames[neighbPatch().transform()]
<< exit(FatalError);
@ -416,7 +416,8 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
)
:
coupledPolyPatch(name, dict, index, bm, patchType),
nbrPatchName_(dict.lookup("neighbourPatch")),
nbrPatchName_(dict.lookupOrDefault<word>("neighbourPatch", "")),
coupleGroup_(dict),
nbrPatchID_(-1),
rotationAxis_(vector::zero),
rotationCentre_(point::zero),
@ -426,6 +427,22 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
surfPtr_(NULL),
surfDict_(dict.subOrEmptyDict("surface"))
{
if (nbrPatchName_ == word::null && !coupleGroup_.valid())
{
FatalIOErrorIn
(
"cyclicAMIPolyPatch::cyclicAMIPolyPatch"
"("
"const word&, "
"const dictionary&, "
"const label, "
"const polyBoundaryMesh&"
")",
dict
) << "No \"neighbourPatch\" or \"coupleGroup\" provided."
<< exit(FatalIOError);
}
if (nbrPatchName_ == name)
{
FatalIOErrorIn
@ -495,6 +512,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
:
coupledPolyPatch(pp, bm),
nbrPatchName_(pp.nbrPatchName_),
coupleGroup_(pp.coupleGroup_),
nbrPatchID_(-1),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
@ -521,6 +539,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
:
coupledPolyPatch(pp, bm, index, newSize, newStart),
nbrPatchName_(nbrPatchName),
coupleGroup_(pp.coupleGroup_),
nbrPatchID_(-1),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
@ -561,6 +580,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
:
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
nbrPatchName_(pp.nbrPatchName_),
coupleGroup_(pp.coupleGroup_),
nbrPatchID_(-1),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
@ -584,12 +604,12 @@ Foam::label Foam::cyclicAMIPolyPatch::neighbPatchID() const
{
if (nbrPatchID_ == -1)
{
nbrPatchID_ = this->boundaryMesh().findPatchID(nbrPatchName_);
nbrPatchID_ = this->boundaryMesh().findPatchID(neighbPatchName());
if (nbrPatchID_ == -1)
{
FatalErrorIn("cyclicPolyAMIPatch::neighbPatchID() const")
<< "Illegal neighbourPatch name " << nbrPatchName_
<< "Illegal neighbourPatch name " << neighbPatchName()
<< nl << "Valid patch names are "
<< this->boundaryMesh().names()
<< exit(FatalError);
@ -832,8 +852,12 @@ Foam::label Foam::cyclicAMIPolyPatch::pointFace
void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
{
coupledPolyPatch::write(os);
os.writeKeyword("neighbourPatch") << nbrPatchName_
<< token::END_STATEMENT << nl;
if (!nbrPatchName_.empty())
{
os.writeKeyword("neighbourPatch") << nbrPatchName_
<< token::END_STATEMENT << nl;
}
coupleGroup_.write(os);
switch (transform())
{

View File

@ -38,6 +38,7 @@ SourceFiles
#include "coupledPolyPatch.H"
#include "AMIPatchToPatchInterpolation.H"
#include "polyBoundaryMesh.H"
#include "coupleGroupIdentifier.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +59,10 @@ private:
// Private data
//- Name of other half
const word nbrPatchName_;
mutable word nbrPatchName_;
//- Optional patchGroup to find neighbPatch
const coupleGroupIdentifier coupleGroup_;
//- Index of other half
mutable label nbrPatchID_;

View File

@ -27,6 +27,13 @@ License
inline const Foam::word& Foam::cyclicAMIPolyPatch::neighbPatchName() const
{
if (nbrPatchName_.empty())
{
// Try and use patchGroup to find samplePatch and sampleRegion
label patchID = coupleGroup_.findOtherPatchID(*this);
nbrPatchName_ = boundaryMesh()[patchID].name();
}
return nbrPatchName_;
}

View File

@ -199,7 +199,6 @@ mappedPatches/mappedPolyPatch/mappedPatchBase.C
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
mappedPatches/mappedPolyPatch/coupleGroupIdentifier.C
mappedPatches/mappedPointPatch/mappedPointPatch.C
mappedPatches/mappedPointPatch/mappedWallPointPatch.C

View File

@ -1402,10 +1402,16 @@ void Foam::mappedPatchBase::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;
if (!sampleRegion_.empty())
{
os.writeKeyword("sampleRegion") << sampleRegion_
<< token::END_STATEMENT << nl;
}
if (!samplePatch_.empty())
{
os.writeKeyword("samplePatch") << samplePatch_
<< token::END_STATEMENT << nl;
}
coupleGroup_.write(os);
if

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -326,7 +326,7 @@ void Foam::booleanSurface::propagateSide
{
side[faceI] = prevState;
const labelledTri& tri = surf[faceI];
const labelledTri& tri = surf.localFaces()[faceI];
// Get copy of face labels
label a = tri[0];

View File

@ -46,13 +46,14 @@ namespace Foam
);
template<>
const char* NamedEnum<sampledTriSurfaceMesh::samplingSource, 2>::names[] =
const char* NamedEnum<sampledTriSurfaceMesh::samplingSource, 3>::names[] =
{
"cells",
"insideCells",
"boundaryFaces"
};
const NamedEnum<sampledTriSurfaceMesh::samplingSource, 2>
const NamedEnum<sampledTriSurfaceMesh::samplingSource, 3>
sampledTriSurfaceMesh::samplingSourceNames_;
@ -147,7 +148,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
// elements
globalIndex globalCells
(
sampleSource_ == cells
(sampleSource_ == cells || sampleSource_ == insideCells)
? mesh().nCells()
: mesh().nFaces()
);
@ -178,6 +179,25 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
}
}
}
else if (sampleSource_ == insideCells)
{
// Search for cell containing point
const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
forAll(fc, triI)
{
if (cellTree.bb().contains(fc[triI]))
{
label index = cellTree.findInside(fc[triI]);
if (index != -1)
{
nearest[triI].first() = 0.0;
nearest[triI].second() = globalCells.toGlobal(index);
}
}
}
}
else
{
// Search for nearest boundaryFace
@ -364,6 +384,19 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
}
}
}
else if (sampleSource_ == insideCells)
{
// samplePoints_ : per surface point a location inside the cell
// sampleElements_ : per surface point the cell
forAll(points(), pointI)
{
const point& pt = points()[pointI];
label cellI = cellOrFaceLabels[pointToFace[pointI]];
sampleElements_[pointI] = cellI;
samplePoints_[pointI] = pt;
}
}
else
{
// samplePoints_ : per surface point a location on the boundary
@ -388,6 +421,9 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
// if sampleSource_ == cells:
// samplePoints_ : n/a
// sampleElements_ : per surface triangle the cell
// if sampleSource_ == insideCells:
// samplePoints_ : n/a
// sampleElements_ : -1 or per surface triangle the cell
// else:
// samplePoints_ : n/a
// sampleElements_ : per surface triangle the boundary face
@ -406,7 +442,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
if (sampledSurface::interpolate())
{
if (sampleSource_ == cells)
if (sampleSource_ == cells || sampleSource_ == insideCells)
{
forAll(samplePoints_, pointI)
{
@ -443,7 +479,7 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
}
else
{
if (sampleSource_ == cells)
if (sampleSource_ == cells || sampleSource_ == insideCells)
{
forAll(sampleElements_, triI)
{

View File

@ -30,7 +30,7 @@ Description
- it either samples cells or (non-coupled) boundary faces
- 4 different modes:
- 6 different modes:
- source=cells, interpolate=false:
finds per triangle centre the nearest cell centre and uses its value
- source=cells, interpolate=true
@ -40,6 +40,12 @@ Description
the boundary of the cell (to make sure interpolateCellPoint
gets a valid location)
- source=insideCells, interpolate=false:
finds per triangle centre the cell containing it and uses its value.
Trims triangles outside mesh.
- source=insideCells, interpolate=true
Per surface point interpolate cell containing it.
- source=boundaryFaces, interpolate=false:
finds per triangle centre the nearest point on the boundary
(uncoupled faces only) and uses the value (or 0 if the nearest
@ -88,7 +94,8 @@ public:
enum samplingSource
{
cells,
boundaryFaces
insideCells,
boundaryFaces,
};
private:
@ -99,7 +106,7 @@ private:
// Private data
static const NamedEnum<samplingSource, 2> samplingSourceNames_;
static const NamedEnum<samplingSource, 3> samplingSourceNames_;
//- Surface to sample on
const triSurfaceMesh surface_;

View File

@ -38,7 +38,7 @@ Foam::sampledTriSurfaceMesh::sampleField
tmp<Field<Type> > tvalues(new Field<Type>(sampleElements_.size()));
Field<Type>& values = tvalues();
if (sampleSource_ == cells)
if (sampleSource_ == cells || sampleSource_ == insideCells)
{
// Sample cells
@ -94,7 +94,7 @@ Foam::sampledTriSurfaceMesh::interpolateField
tmp<Field<Type> > tvalues(new Field<Type>(sampleElements_.size()));
Field<Type>& values = tvalues();
if (sampleSource_ == cells)
if (sampleSource_ == cells || sampleSource_ == insideCells)
{
// Sample cells.

View File

@ -48,7 +48,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0),
phiName_("phi"),
kName_("k")
{
this->refValue() = 0.0;
@ -68,7 +67,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -83,9 +81,9 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
@ -102,7 +100,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -116,7 +113,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -143,7 +139,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(kName_);
const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_;
this->valueFraction() = 1.0 - pos(phip);
@ -160,7 +156,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
fvPatchScalarField::write(os);
os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -101,9 +101,6 @@ class turbulentMixingLengthDissipationRateInletFvPatchScalarField
//- turbulent length scale
scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;

View File

@ -48,7 +48,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0),
phiName_("phi"),
kName_("k")
{
this->refValue() = 0.0;
@ -68,7 +67,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -83,9 +81,10 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
@ -102,7 +101,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -116,7 +114,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -143,7 +140,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(kName_);
const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
this->valueFraction() = 1.0 - pos(phip);
@ -160,7 +157,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write
fvPatchScalarField::write(os);
os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -100,9 +100,6 @@ class turbulentMixingLengthFrequencyInletFvPatchScalarField
//- Turbulent length scale
scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;

View File

@ -74,11 +74,11 @@ thermalBaffle1DFvPatchScalarField
mixedFvPatchScalarField(ptf, p, iF, mapper),
TName_(ptf.TName_),
baffleActivated_(ptf.baffleActivated_),
thickness_(ptf.thickness_),
Qs_(ptf.Qs_),
thickness_(ptf.thickness_, mapper),
Qs_(ptf.Qs_, mapper),
solidDict_(ptf.solidDict_),
solidPtr_(ptf.solidPtr_),
QrPrevious_(ptf.QrPrevious_),
QrPrevious_(ptf.QrPrevious_, mapper),
QrRelaxation_(ptf.QrRelaxation_),
QrName_(ptf.QrName_)
{}
@ -98,7 +98,7 @@ thermalBaffle1DFvPatchScalarField
TName_("T"),
baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)),
thickness_(),
Qs_(),
Qs_(p.size(), 0),
solidDict_(dict),
solidPtr_(),
QrPrevious_(p.size(), 0.0),
@ -107,6 +107,21 @@ thermalBaffle1DFvPatchScalarField
{
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("thickness"))
{
thickness_ = scalarField("thickness", dict, p.size());
}
if (dict.found("Qs"))
{
Qs_ = scalarField("Qs", dict, p.size());
}
if (dict.found("QrPrevious"))
{
QrPrevious_ = scalarField("QrPrevious", dict, p.size());
}
if (dict.found("refValue") && baffleActivated_)
{
// Full restart
@ -209,23 +224,30 @@ const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid() const
template<class solidType>
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::
tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::
baffleThickness() const
{
if (this->owner())
{
if (thickness_.size() > 0)
if (thickness_.size() != patch().size())
{
return thickness_;
}
else
{
thickness_ = scalarField("thickness", solidDict_, patch().size());
return thickness_;
FatalErrorIn
(
" template<class solidType>"
" tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>
" baffleThickness() const"
)<< " Field thickness has not been specified "
<< " for patch " << this->patch().name()
<< " in dictionary " << solidDict_
<< abort(FatalError);
}
return thickness_;
}
else
{
const mapDistribute& mapDist = this->mappedPatchBase::map();
const fvPatch& nbrPatch =
patch().boundaryMesh()[samplePolyPatch().index()];
const thermalBaffle1DFvPatchScalarField& nbrField =
@ -234,28 +256,28 @@ baffleThickness() const
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
);
return nbrField.thickness_;
tmp<scalarField> tthickness
(
new scalarField(nbrField.baffleThickness())
);
scalarField& thickness = tthickness();
mapDist.distribute(thickness);
return tthickness;
}
}
template<class solidType>
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
{
if (this->owner())
{
if (Qs_.size() > 0)
{
return Qs_;
}
else
{
Qs_ = scalarField("Qs", solidDict_, patch().size());
return Qs_;
}
return Qs_;
}
else
{
const mapDistribute& mapDist = this->mappedPatchBase::map();
const fvPatch& nbrPatch =
patch().boundaryMesh()[samplePolyPatch().index()];
@ -265,7 +287,10 @@ const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
);
return nbrField.Qs_;
tmp<scalarField> tQs(new scalarField(nbrField.Qs()));
scalarField& Qs = tQs();
mapDist.distribute(Qs);
return tQs;
}
}
@ -293,8 +318,11 @@ void thermalBaffle1DFvPatchScalarField<solidType>::rmap
const thermalBaffle1DFvPatchScalarField& tiptf =
refCast<const thermalBaffle1DFvPatchScalarField>(ptf);
thickness_.rmap(tiptf.thickness_, addr);
Qs_.rmap(tiptf.Qs_, addr);
if (this->owner())
{
thickness_.rmap(tiptf.thickness_, addr);
Qs_.rmap(tiptf.Qs_, addr);
}
}
@ -310,6 +338,8 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
const mapDistribute& mapDist = this->mappedPatchBase::map();
const label patchi = patch().index();
const label nbrPatchi = samplePolyPatch().index();
@ -347,8 +377,9 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
scalarField myKDelta(patch().deltaCoeffs()*kappaw);
// nrb properties
const fvPatchScalarField& nbrTp =
scalarField nbrTp =
turbModel.thermo().T().boundaryField()[nbrPatchi];
mapDist.distribute(nbrTp);
// solid properties
scalarField kappas(patch().size(), 0.0);
@ -396,11 +427,12 @@ void thermalBaffle1DFvPatchScalarField<solidType>::write(Ostream& os) const
if (this->owner())
{
baffleThickness().writeEntry("thickness", os);
Qs().writeEntry("Qs", os);
baffleThickness()().writeEntry("thickness", os);
Qs()().writeEntry("Qs", os);
solid().write(os);
}
QrPrevious_.writeEntry("QrPrevious", os);
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
os.writeKeyword("QrRelaxation")<< QrRelaxation_
<< token::END_STATEMENT << nl;

View File

@ -152,10 +152,10 @@ class thermalBaffle1DFvPatchScalarField
const solidType& solid() const;
//- Return Qs from master
const scalarField& Qs() const;
tmp<scalarField> Qs() const;
//- Return thickness from master
const scalarField& baffleThickness() const;
tmp<scalarField> baffleThickness() const;
//- Is Owner
bool owner() const;

View File

@ -48,7 +48,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0),
phiName_("phi"),
kName_("k")
{
this->refValue() = 0.0;
@ -68,7 +67,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -83,9 +81,9 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
@ -102,7 +100,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -116,7 +113,6 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -143,7 +139,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(kName_);
const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_;
this->valueFraction() = 1.0 - pos(phip);
@ -160,7 +156,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
fvPatchScalarField::write(os);
os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -101,9 +101,6 @@ class turbulentMixingLengthDissipationRateInletFvPatchScalarField
//- turbulent length scale
scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;

View File

@ -48,7 +48,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0),
phiName_("undefined-phi"),
kName_("undefined-k")
{
this->refValue() = 0.0;
@ -67,7 +66,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -81,9 +79,10 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
@ -99,7 +98,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -112,7 +110,6 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
:
inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{}
@ -139,7 +136,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volScalarField, scalar>(kName_);
const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
this->valueFraction() = 1.0 - pos(phip);
@ -156,7 +153,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write
fvPatchScalarField::write(os);
os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}

View File

@ -101,9 +101,6 @@ class turbulentMixingLengthFrequencyInletFvPatchScalarField
//- Turbulent length scale
scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;

View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0
# ----------------------------------------------------------------- end-of-file

View File

@ -11,6 +11,8 @@ runApplication blockMesh
# Create faceZones for baffles and fan
runApplication topoSet
cp -r 0.org 0
# Create wall and cyclic baffles and the fields on them
runApplication createBaffles -overwrite

View File

@ -29,60 +29,46 @@ baffles
type faceZone;
zoneName baffleFaces;
//- Optional flip
//flip false;
patches
patchPairs
{
master
{
//- Master side patch
name baffles;
type wall;
type wall;
patchFields
{
epsilon
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
k
{
type kqRWallFunction;
value uniform 0;
}
nut
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
nuTilda
{
type zeroGradient;
}
p
{
type zeroGradient;
}
U
{
type fixedValue;
value uniform (0 0 0);
}
}
}
slave
patchFields
{
// Reuse master data
${..master}
epsilon
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
k
{
type kqRWallFunction;
value uniform 0;
}
nut
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
nuTilda
{
type zeroGradient;
}
p
{
type zeroGradient;
}
U
{
type fixedValue;
value uniform (0 0 0);
}
}
}
}
@ -97,46 +83,21 @@ baffles
origin (0.099 -0.006 0.004);
span (0 0.012 0.012);
patches
patchPairs
{
master
type cyclic;
//- Optional override of added patchfields. If not specified
// any added patchfields are of type calculated.
patchFields
{
//- Master side patch
name fan_half0;
type cyclic;
neighbourPatch fan_half1;
//- Optional override of added patchfields. If not specified
// any added patchfields are of type calculated.
patchFields
p
{
p
{
type fan;
patchType cyclic;
jump uniform 0;
value uniform 0;
jumpTable polynomial 1((100 0));
}
}
}
slave
{
//- Slave side patch
name fan_half1;
type cyclic;
neighbourPatch fan_half0;
patchFields
{
p
{
type fan;
patchType cyclic;
value uniform 0;
}
type fan;
patchType cyclic;
jump uniform 0;
value uniform 0;
jumpTable polynomial 1((100 0));
}
}
}