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

This commit is contained in:
Henry
2011-09-16 19:18:23 +01:00
28 changed files with 768 additions and 420 deletions

View File

@ -924,6 +924,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H"
#include "addOverwriteOption.H"
argList::addOption("dict", "name", "specify alternative dictionary");
argList::addBoolOption("AMI", "apply mapped AMI boundary type");
#include "setRootCase.H"
@ -932,6 +933,8 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite");
const word dictName
(args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict"));
mappedPatchBase::sampleMode sampleMode = mappedPatchBase::NEARESTPATCHFACE;
if (args.optionFound("AMI"))
@ -943,7 +946,7 @@ int main(int argc, char *argv[])
(
IOobject
(
"extrudeToRegionMeshDict",
dictName,
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED

View File

@ -43,6 +43,7 @@ Description
int main(int argc, char *argv[])
{
Foam::timeSelector::addOptions();
# include "addRegionOption.H"
Foam::argList::addBoolOption
(
"noWrite",
@ -74,7 +75,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
# include "createMesh.H"
# include "createNamedMesh.H"
utility().tryPreCalc(args, runTime, mesh);

View File

@ -37,6 +37,11 @@ Description
#include "calc.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "pointFields.H"
#include "ReadFields.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
@ -84,6 +89,70 @@ namespace Foam
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
if (args.optionFound("noFlow"))
{
Info<< " Operating in no-flow mode; no models will be loaded."
<< " All vol, surface and point fields will be loaded." << endl;
// Read objects in time directory
IOobjectList objects(mesh, runTime.timeName());
// Read vol fields.
PtrList<volScalarField> vsFlds;
ReadFields(mesh, objects, vsFlds);
PtrList<volVectorField> vvFlds;
ReadFields(mesh, objects, vvFlds);
PtrList<volSphericalTensorField> vstFlds;
ReadFields(mesh, objects, vstFlds);
PtrList<volSymmTensorField> vsymtFlds;
ReadFields(mesh, objects, vsymtFlds);
PtrList<volTensorField> vtFlds;
ReadFields(mesh, objects, vtFlds);
// Read surface fields.
PtrList<surfaceScalarField> ssFlds;
ReadFields(mesh, objects, ssFlds);
PtrList<surfaceVectorField> svFlds;
ReadFields(mesh, objects, svFlds);
PtrList<surfaceSphericalTensorField> sstFlds;
ReadFields(mesh, objects, sstFlds);
PtrList<surfaceSymmTensorField> ssymtFlds;
ReadFields(mesh, objects, ssymtFlds);
PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds);
// Read point fields.
const pointMesh& pMesh = pointMesh::New(mesh);
PtrList<pointScalarField> psFlds;
ReadFields(pMesh, objects, psFlds);
PtrList<pointVectorField> pvFlds;
ReadFields(pMesh, objects, pvFlds);
PtrList<pointSphericalTensorField> pstFlds;
ReadFields(pMesh, objects, pstFlds);
PtrList<pointSymmTensorField> psymtFlds;
ReadFields(pMesh, objects, psymtFlds);
PtrList<pointTensorField> ptFlds;
ReadFields(pMesh, objects, ptFlds);
execFlowFunctionObjects(args, runTime);
}
else
{
Info<< " Reading phi" << endl;
surfaceScalarField phi
(
@ -282,6 +351,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
<< "Incorrect dimensions of phi: " << phi.dimensions()
<< nl << exit(FatalError);
}
}
}

View File

@ -42,13 +42,14 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addRegionOption.H"
# include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMeshNoClear.H"
# include "createNamedMesh.H"
pointMesh pMesh(mesh);

View File

@ -37,6 +37,18 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
dict_.readIfPresent("dictionary", dictName_);
dict_.readIfPresent("enabled", enabled_);
dict_.readIfPresent("storeFilter", storeFilter_);
dict_.readIfPresent("timeStart", timeStart_);
dict_.readIfPresent("timeEnd", timeEnd_);
}
template<class OutputFilter>
bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
{
return
enabled_
&& time_.value() >= timeStart_
&& time_.value() <= timeEnd_;
}
@ -94,6 +106,8 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
dictName_(),
enabled_(true),
storeFilter_(true),
timeStart_(-VGREAT),
timeEnd_(VGREAT),
outputControl_(t, dict)
{
readDict();
@ -121,7 +135,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
{
readDict();
if (enabled_&&storeFilter_)
if (enabled_ && storeFilter_)
{
allocateFilter();
}
@ -136,7 +150,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
const bool forceWrite
)
{
if (enabled_)
if (active())
{
if (!storeFilter_)
{
@ -163,7 +177,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
template<class OutputFilter>
bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
{
if (enabled_)
if (active())
{
if (!storeFilter_)
{

View File

@ -68,19 +68,29 @@ class OutputFilterFunctionObject
//- Input dictionary
dictionary dict_;
//- Name of region
// Optional user inputs
//- Name of region - defaults to name of polyMesh::defaultRegion
word regionName_;
//- Optional dictionary name to supply required inputs
//- Dictionary name to supply required inputs
word dictName_;
//- Switch for the execution of the functionObject
//- Switch for the execution - defaults to 'yes/on'
bool enabled_;
//- Switch to store filter in between writes or use on-the-fly
// construction
// construction - defaults to true
bool storeFilter_;
//- Activation time - defaults to -VGREAT
scalar timeStart_;
//- De-activation time - defaults to VGREAT
scalar timeEnd_;
//- Output controls
outputFilterOutputControl outputControl_;
@ -99,6 +109,9 @@ class OutputFilterFunctionObject
//- Destroys most of the data associated with this object.
void destroyFilter();
//- Returns true if active (enabled and within time bounds)
bool active() const;
//- Disallow default bitwise copy construct
OutputFilterFunctionObject(const OutputFilterFunctionObject&);

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "STARCDMeshReader.H"
#include "cyclicPolyPatch.H"
#include "oldCyclicPolyPatch.H"
#include "emptyPolyPatch.H"
#include "wallPolyPatch.H"
#include "symmetryPolyPatch.H"
@ -950,7 +950,7 @@ void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
{
// incorrect. should be cyclicPatch but this
// requires info on connected faces.
patchTypes_[patchI] = cyclicPolyPatch::typeName;
patchTypes_[patchI] = oldCyclicPolyPatch::typeName;
patchPhysicalTypes_[patchI] = patchTypes_[patchI];
}
else if (origType == "baffle")

View File

@ -386,6 +386,7 @@ $(basicSource)/basicSource/basicSourceIO.C
$(basicSource)/basicSource/basicSourceList.C
$(basicSource)/basicSource/IObasicSourceList.C
$(basicSource)/actuationDiskSource/actuationDiskSource.C
$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C
$(basicSource)/explicitSource/explicitSource.C

View File

@ -69,12 +69,13 @@ void Foam::actuationDiskSource::checkData() const
Foam::actuationDiskSource::actuationDiskSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, dict, mesh),
dict_(dict.subDict(typeName + "Coeffs")),
basicSource(name, modelType, dict, mesh),
dict_(dict.subDict(modelType + "Coeffs")),
diskDir_(dict_.lookup("diskDir")),
Cp_(readScalar(dict_.lookup("Cp"))),
Ct_(readScalar(dict_.lookup("Ct"))),
@ -97,17 +98,19 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
compressible = true;
}
const scalarField& V = this->mesh().V();
const scalarField& cellsV = this->mesh().V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
if (V() > VSMALL)
{
if (compressible)
{
addActuationDiskAxialInertialResistance
(
Usource,
cells_,
V,
cellsV,
this->mesh().lookupObject<volScalarField>("rho"),
U
);
@ -118,11 +121,12 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
(
Usource,
cells_,
V,
cellsV,
geometricOneField(),
U
);
}
}
}

View File

@ -69,7 +69,10 @@ class actuationDiskSource
:
public basicSource
{
// Private data
protected:
// Protected data
//- Sub dictionary with actuationDisk information
const dictionary& dict_;
@ -87,6 +90,8 @@ class actuationDiskSource
scalar diskArea_;
private:
// Private Member Functions
//- Check data
@ -122,6 +127,7 @@ public:
actuationDiskSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);

View File

@ -36,13 +36,12 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
(
vectorField& Usource,
const labelList& cells,
const scalarField& V,
const scalarField& Vcells,
const RhoFieldType& rho,
const vectorField& U
) const
{
scalar a = 1.0 - Cp_/Ct_;
scalar totVol = 0.0;
scalarField T(cells.size());
vector uniDiskDir = diskDir_/mag(diskDir_);
tensor E(tensor::zero);
@ -52,12 +51,11 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
const vectorField U1((1.0 - a)*U);
forAll(cells, i)
{
totVol += V[cells[i]];
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
}
forAll(cells, i)
{
Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]];
Usource[cells[i]] += ((Vcells[cells[i]]/V())*T[i]*E) & U1[cells[i]];
}
}

View File

@ -188,6 +188,7 @@ void Foam::basicSource::setCellSet()
Foam::basicSource::basicSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
@ -198,7 +199,10 @@ Foam::basicSource::basicSource
active_(readBool(dict_.lookup("active"))),
timeStart_(readScalar(dict_.lookup("timeStart"))),
duration_(readScalar(dict_.lookup("duration"))),
selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))),
selectionMode_
(
selectionModeTypeNames_.read(dict_.lookup("selectionMode"))
),
cellSetName_("none"),
V_(0.0)
{
@ -237,7 +241,7 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
<< exit(FatalError);
}
return autoPtr<basicSource>(cstrIter()(name, dict, mesh));
return autoPtr<basicSource>(cstrIter()(name, modelType, dict, mesh));
}

View File

@ -180,10 +180,11 @@ public:
dictionary,
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
),
(name, dict, mesh)
(name, modelType, dict, mesh)
);
@ -193,6 +194,7 @@ public:
basicSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);

View File

@ -106,12 +106,13 @@ void Foam::explicitSource::setFieldData(const dictionary& dict)
Foam::explicitSource::explicitSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
basicSource(name, dict, mesh),
dict_(dict.subDict(typeName + "Coeffs")),
basicSource(name, modelType, dict, mesh),
dict_(dict.subDict(modelType + "Coeffs")),
volumeMode_(volumeModeTypeNames_.read(dict_.lookup("volumeMode")))
{
setFieldData(dict_.subDict("fieldData"));

View File

@ -135,6 +135,7 @@ public:
explicitSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "radialActuationDiskSource.H"
#include "geometricOneField.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(radialActuationDiskSource, 0);
addToRunTimeSelectionTable
(
basicSource,
radialActuationDiskSource,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radialActuationDiskSource::radialActuationDiskSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
actuationDiskSource(name, modelType, dict, mesh),
dict_(dict.subDict(modelType + "Coeffs")),
coeffs_()
{
dict_.lookup("coeffs") >> coeffs_;
Info<< " - creating radial actuation disk zone: "
<< this->name() << endl;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::radialActuationDiskSource::addSu(fvMatrix<vector>& UEqn)
{
bool compressible = false;
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
{
compressible = true;
}
const scalarField& cellsV = this->mesh().V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
if (V() > VSMALL)
{
if (compressible)
{
addRadialActuationDiskAxialInertialResistance
(
Usource,
cells_,
cellsV,
this->mesh().lookupObject<volScalarField>("rho"),
U
);
}
else
{
addRadialActuationDiskAxialInertialResistance
(
Usource,
cells_,
cellsV,
geometricOneField(),
U
);
}
}
}
void Foam::radialActuationDiskSource::writeData(Ostream& os) const
{
actuationDiskSource::writeData(os);
}
bool Foam::radialActuationDiskSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs =
sourceDict.subDict(typeName + "Coeffs");
subDictCoeffs.readIfPresent("diskDir", diskDir_);
subDictCoeffs.readIfPresent("Cp", Cp_);
subDictCoeffs.readIfPresent("Ct", Ct_);
subDictCoeffs.readIfPresent("diskArea", diskArea_);
subDictCoeffs.lookup("coeffs") >> coeffs_;
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::radialActuationDiskSource
Description
Actuation disk zone definition.
Constant values for momentum source for actuation disk
T = 2*rho*A*sqr(Uo)*a*(1-a)
U1 = (1 -a)Uo
where:
A: disk area
Uo: upstream velocity
a: 1 - Cp/Ct
U1: velocity at the disk
The thrust is distributed by a radial function:
thrust(r) = T*(C0 + C1*r^2 + C2*r^4)
SourceFiles
radialActuationDiskSource.C
radialActuationDiskSourceTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef radialActuationDiskSource_H
#define radialActuationDiskSource_H
#include "DimensionedField.H"
#include "volFieldsFwd.H"
#include "FixedList.H"
#include "actuationDiskSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class radialActuationDiskSource Declaration
\*---------------------------------------------------------------------------*/
class radialActuationDiskSource
:
public actuationDiskSource
{
// Private data
//- Sub dictionary with model information
const dictionary& dict_;
//- Coeffcients for the radial distribution
FixedList<scalar, 3> coeffs_;
// Private Member Functions
//- Add resistance to the UEqn
template<class RhoFieldType>
void addRadialActuationDiskAxialInertialResistance
(
vectorField& Usource,
const labelList& cells,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const;
//- Disallow default bitwise copy construct
radialActuationDiskSource(const radialActuationDiskSource&);
//- Disallow default bitwise assignment
void operator=(const radialActuationDiskSource&);
public:
//- Runtime type information
TypeName("radialActuationDiskSource");
// Constructors
//- Construct from components
radialActuationDiskSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~radialActuationDiskSource()
{}
// Public Functions
//-Source term to fvMatrix<vector>
virtual void addSu(fvMatrix<vector>& UEqn);
// I-O
//- Write data
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "radialActuationDiskSourceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,94 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
#include "radialActuationDiskSource.H"
#include "volFields.H"
#include "fvMatrix.H"
#include "fvm.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class RhoFieldType>
void Foam::radialActuationDiskSource::
addRadialActuationDiskAxialInertialResistance
(
vectorField& Usource,
const labelList& cells,
const scalarField& Vcells,
const RhoFieldType& rho,
const vectorField& U
) const
{
scalar a = 1.0 - Cp_/Ct_;
scalarField T(cells.size());
scalarField Tr(cells.size());
const vector uniDiskDir = diskDir_/mag(diskDir_);
tensor E(tensor::zero);
E.xx() = uniDiskDir.x();
E.yy() = uniDiskDir.y();
E.zz() = uniDiskDir.z();
const vectorField U1((1.0 - a)*U);
const Field<vector> zoneCellCentres(mesh().cellCentres(), cells);
const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells);
const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V();
const scalar maxR = gMax(mag(zoneCellCentres - avgCentre));
scalar intCoeffs =
coeffs_[0]
+ coeffs_[1]*sqr(maxR)/2.0
+ coeffs_[2]*pow4(maxR)/3.0;
forAll(cells, i)
{
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
scalar r = mag(mesh().cellCentres()[cells[i]] - avgCentre);
Tr[i] =
T[i]*(coeffs_[0] + coeffs_[1]*sqr(r) + coeffs_[2]*pow4(r))
/intCoeffs;
}
forAll(cells, i)
{
Usource[cells[i]] += ((Vcells[cells[i]]/V())*Tr[i]*E) & U1[cells[i]];
}
if (debug)
{
Info<< "Source name: " << name() << nl
<< "Average centre: " << avgCentre << nl
<< "Maximum radius: " << maxR << endl;
}
}
// ************************************************************************* //

View File

@ -204,14 +204,13 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
{
case NEARESTCELL:
{
const mapDistribute& distMap = mappedPatchBase::map();
newValues = sampleField();
distMap.distribute(newValues);
this->distribute(newValues);
break;
}
case NEARESTPATCHFACE:
case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI:
{
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch());
@ -230,34 +229,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
const mapDistribute& distMap = mappedPatchBase::map();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case mappedPatchBase::NEARESTPATCHFACEAMI:
{
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unable to find sample patch " << samplePatch()
<< " in region " << sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
// const fieldType& nbrField = sampleField();
// newValues = mpp.AMI().interpolateToSource(nbrField);
notImplemented
(
"void mappedFieldFvPatchField<Type>::updateCoeffs() "
"with mappedPatchBase::NEARESTPATCHFACEAMI"
);
this->distribute(newValues);
break;
}
@ -279,9 +251,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
}
}
const mapDistribute& distMap = mappedPatchBase::map();
distMap.distribute(allValues);
this->distribute(allValues);
newValues.transfer(allValues);
break;

View File

@ -127,31 +127,7 @@ void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
// Retrieve the neighbour patch internal field
Field<Type> nbrIntFld(nbrField.patchInternalField());
switch (mpp.mode())
{
case (mappedPatchBase::NEARESTPATCHFACEAMI):
{
// Retrieve the neighbour patch internal field
nbrIntFld = mpp.AMI().interpolateToSource(nbrIntFld);
break;
}
default:
{
const mapDistribute& distMap = mpp.map();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
break;
}
}
mpp.distribute(nbrIntFld);
// Restore tag
UPstream::msgType() = oldTag;

View File

@ -283,30 +283,6 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
break;
}
case mappedPatchBase::NEARESTPATCHFACE:
{
const mapDistribute& distMap = mpp.map();
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void mappedFixedValueFvPatchField<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 mappedPatchBase::NEARESTPATCHFACEAMI:
{
const label nbrPatchID =
@ -324,9 +300,9 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
newValues = mpp.AMI().interpolateToSource(newValues);
newValues = nbrField.boundaryField()[nbrPatchID];
mpp.distribute(newValues);
break;
}

View File

@ -28,7 +28,6 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "mappedPatchBase.H"
#include "mapDistribute.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -128,7 +127,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs()
scalarList phi =
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_);
mpp.map().distribute(phi);
mpp.distribute(phi);
const surfaceScalarField& phiName =

View File

@ -176,13 +176,10 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
(
mappedVelocityFluxFixedValueFvPatchField::patch().patch()
);
const mapDistribute& distMap = mpp.map();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
const word& fieldName = dimensionedInternalField().name();
const volVectorField& UField = nbrMesh.lookupObject<volVectorField>
(
fieldName
);
const volVectorField& UField =
nbrMesh.lookupObject<volVectorField>(fieldName);
surfaceScalarField& phiField = const_cast<surfaceScalarField&>
(
@ -213,26 +210,25 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
}
}
distMap.distribute(allUValues);
mpp.distribute(allUValues);
newUValues.transfer(allUValues);
distMap.distribute(allPhiValues);
mpp.distribute(allPhiValues);
newPhiValues.transfer(allPhiValues);
break;
}
case mappedPolyPatch::NEARESTPATCHFACE:
case mappedPolyPatch::NEARESTPATCHFACEAMI:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
mpp.samplePatch()
);
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
newUValues = UField.boundaryField()[nbrPatchID];
distMap.distribute(newUValues);
mpp.distribute(newUValues);
newPhiValues = phiField.boundaryField()[nbrPatchID];
distMap.distribute(newPhiValues);
mpp.distribute(newPhiValues);
break;
}
@ -242,8 +238,9 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
(
"mappedVelocityFluxFixedValueFvPatchField::"
"updateCoeffs()"
) << "patch can only be used in NEARESTPATCHFACE or NEARESTFACE "
<< "mode" << nl << abort(FatalError);
) << "patch can only be used in NEARESTPATCHFACE, "
<< "NEARESTPATCHFACEAMI or NEARESTFACE mode" << nl
<< abort(FatalError);
}
}

View File

@ -229,7 +229,6 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
const mapDistribute& distMap = mappedPatchBase::map();
// Result of obtaining remote values
Field<Type> newValues;
@ -238,6 +237,8 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
{
case NEARESTCELL:
{
const mapDistribute& distMap = mappedPatchBase::map();
if (interpolationScheme_ != interpolationCell<Type>::typeName)
{
// Need to do interpolation so need cells to sample.
@ -275,12 +276,10 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
break;
}
case NEARESTPATCHFACE:
case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
samplePatch()
);
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
@ -297,7 +296,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
this->distribute(newValues);
break;
}
@ -319,7 +318,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
}
}
distMap.distribute(allValues);
this->distribute(allValues);
newValues.transfer(allValues);

View File

@ -97,9 +97,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
boundBox bbSrc(srcPatch.points(), srcPatch.meshPoints());
boundBox bbTgt(tgtPatch.points(), tgtPatch.meshPoints());
bbTgt.inflate(maxBoundsError);
boundBox bbTgtInf(bbTgt);
bbTgtInf.inflate(maxBoundsError);
if (!bbTgt.contains(bbSrc))
if (!bbTgtInf.contains(bbSrc))
{
WarningIn
(
@ -109,10 +110,11 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
"const primitivePatch&"
")"
) << "Source and target patch bounding boxes are not similar" << nl
<< " src span : " << bbSrc.span() << nl
<< " tgt span : " << bbTgt.span() << nl
<< " source: " << bbSrc << nl
<< " target: " << bbTgt << endl;
<< " source box span : " << bbSrc.span() << nl
<< " target box span : " << bbTgt.span() << nl
<< " source box : " << bbSrc << nl
<< " target box : " << bbTgt << nl
<< " inflated target box : " << bbTgtInf << endl;
}
}

View File

@ -57,11 +57,17 @@ namespace Foam
int main(int argc, char *argv[])
{
Foam::timeSelector::addOptions();
# include "addRegionOption.H"
Foam::argList::addBoolOption
(
"noWrite",
"suppress writing results"
);
Foam::argList::addBoolOption
(
"noFlow",
"suppress creating flow models (execFlowFunctionObjects only)"
);
Foam::argList::addOption
(
"dict",
@ -72,7 +78,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
#include "createMesh.H"
#include "createNamedMesh.H"
forAll(timeDirs, timeI)
{

View File

@ -25,7 +25,7 @@ Class
Foam::temperatureThermoBaffle1DFvPatchScalarField
Description
Bounday which solves the 1D steady state heat transfer equation
Boundary which solves the 1D steady state heat transfer equation
through a baffle.
SourceFiles

View File

@ -1,78 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6
(
rotor
{
type wall;
nFaces 192;
startFace 5856;
}
stator
{
type wall;
nFaces 192;
startFace 6048;
}
AMI1
{
type cyclicAMI;
nFaces 96;
startFace 6240;
matchTolerance 0.0001;
neighbourPatch AMI2;
transform noOrdering;
surface
{
type searchableCylinder;
point1 ( 0 0 -1 );
point2 ( 0 0 1 );
radius 0.5;
}
}
AMI2
{
type cyclicAMI;
nFaces 96;
startFace 6336;
matchTolerance 0.0001;
neighbourPatch AMI1;
transform noOrdering;
surface
{
type searchableCylinder;
point1 ( 0 0 -1 );
point2 ( 0 0 1 );
radius 0.5;
}
}
front
{
type empty;
nFaces 3072;
startFace 6432;
}
back
{
type empty;
nFaces 3072;
startFace 9504;
}
)
// ************************************************************************* //