62 refPtr<fvMesh>& meshRef,
67 const word meshName(polyMesh::defaultRegion);
72 runTime.cfindObject<fvMesh>(meshName)
100 const fvMesh& srcMesh,
101 const fvMesh& tgtMesh
136 template<
class VolFieldType>
139 const fvMesh& thisMesh,
140 const word& fieldName
143 auto* ptr = thisMesh.getObjectPtr<VolFieldType>(fieldName);
147 ptr =
new VolFieldType
152 thisMesh.time().timeName(),
160 regIOobject::store(ptr);
170 const fvMesh& srcMesh = srcMeshPtr_();
171 const fvMesh& tgtMesh = mesh_;
178 interpPtr_->mapSrcToTgt(srcFld, plusEqOp<scalar>(), tgtFld);
181 DynamicList<label>
cells;
212 const word& modelType,
226 patchMapMethodName_(),
231 setSourceMesh(srcMeshPtr_, srcTimePtr_);
233 const fvMesh& srcMesh = srcMeshPtr_();
235 createInterpolation(srcMesh, tgtMesh);
237 cells_ = tgtCellIDs();
242 <<
"No cells selected!" <<
endl;
245 transform_.initialize(srcMesh,
dict);
254 const fvMesh& srcMesh,
255 const dictionary&
dict 289 subDictPtr->readIfPresent(
"origin", origin_);
294 subDictPtr->readIfPresent(
"normal", normal_);
298 points_ = srcMesh.points();
309 refPtr<fvMesh>& srcMeshPtr,
320 points_ + (positionPtr_->value(t) - origin_)
323 fvMesh& srcMesh = srcMeshPtr.ref();
324 srcMesh.movePoints(translate);
331 refPtr<fvMesh>& srcMeshPtr,
348 fvMesh& srcMesh = srcMeshPtr.ref();
361 fieldNames_.resize(1, coeffs_.getWord(
"field"));
374 srcTimePtr_().setDeltaT(1.0);
377 coeffs_.readEntry(
"mapMethod", mapMethodName_);
381 <<
type() <<
" " <<
name() <<
": unknown map method " 382 << mapMethodName_ <<
nl 383 <<
"Available methods include: " 388 coeffs_.readIfPresent(
"consistent", consistent_);
389 coeffs_.readIfPresent(
"patchMap", patchMap_);
390 coeffs_.readIfPresent(
"cuttingPatches", cuttingPatches_);
392 if (!coeffs_.readIfPresent(
"patchMapMethod", patchMapMethodName_))
413 <<
"MapFieldConstraint<" 415 <<
">::constrain for source " << name_ <<
endl;
418 if (transform_.isActive())
421 const scalar t = mesh_.time().timeOutputValue();
422 transform_.translate(srcMeshPtr_, t);
423 transform_.rotate(srcMeshPtr_, t);
428 const word& fldName = fieldNames_[0];
430 const fvMesh& srcMesh = srcMeshPtr_();
431 const fvMesh& tgtMesh = mesh_;
434 const VolFieldType& srcFld = getOrReadField<VolFieldType>(srcMesh, fldName);
438 if (tgtMesh.
changing() || transform_.isActive())
440 createInterpolation(srcMesh, tgtMesh);
441 cells_ = tgtCellIDs();
445 interpPtr_->mapSrcToTgt(srcFld, plusEqOp<Type>(), tgtFld);
448 eqn.
setValues(cells_, UIndirectList<Type>(tgtFld, cells_));
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type & lookupObjectRef(const word &name, const bool recursive=false) const
Lookup and return non-const reference to the object of the given Type. Fatal if not found or the wron...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const fvMesh & mesh_
Reference to the mesh database.
static const Enum< interpolationMethod > interpolationMethodNames_
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static tmp< volScalarField > createField(const fvMesh &mesh, const scalar val)
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
A traits class, which is primarily used for primitives and vector-space.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Generic GeometricField class.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionSet dimless
Dimensionless.
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Info<< "Create engine time\"<< endl;autoPtr< engineTime > runTimePtr(engineTime::New(Time::controlDictName, args.rootPath(), args.caseName()))
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
bool returnReduceAnd(const bool value, const label comm=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
static word defaultRegion
Return the default region name.
static const word null
An empty word.
virtual bool read(const dictionary &dict)
Read source dictionary.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
#define DebugInfo
Report an information message using Foam::Info.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
static word interpolationMethodAMI(const interpolationMethod method)
Conversion between mesh and patch interpolation methods.
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr)
An optional selector, with fallback redirection.
bool changing() const noexcept
Is mesh changing (topology changing and/or moving)
The MapFieldConstraint constrains values of given fields of Type with a source field from an external...
#define WarningInFunction
Report a warning using Foam::Warning.
string & expand(const bool allowEmpty=false)
Inplace expand initial tags, tildes, and all occurrences of environment variables as per stringOps::e...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Mesh data needed to do the Finite Volume discretisation.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
MapFieldConstraint(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
interpolationMethod
Enumeration specifying interpolation method.
A class for managing temporary objects.
virtual bool read(const dictionary &dict)
Read source dictionary.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
virtual void constrain(fvMatrix< Type > &eqn, const label)
Set value on field.
Do not request registration (bool: false)
Base abstract class for handling finite volume options (i.e. fvOption).
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...