50 mesh.time().timeName(),
74 const word meshName(polyMesh::defaultRegion);
107 const fvMesh& srcMesh,
108 const fvMesh& tgtMesh
143 template<
class VolFieldType>
146 const fvMesh& thisMesh,
147 const word& fieldName
150 auto* ptr = thisMesh.getObjectPtr<VolFieldType>(fieldName);
154 ptr =
new VolFieldType
159 thisMesh.time().timeName(),
167 thisMesh.objectRegistry::store(ptr);
177 const fvMesh& srcMesh = srcMeshPtr_();
178 const fvMesh& tgtMesh = mesh_;
185 interpPtr_->mapSrcToTgt(srcFld, plusEqOp<scalar>(), tgtFld);
188 DynamicList<label>
cells;
219 const word& modelType,
233 patchMapMethodName_(),
238 setSourceMesh(srcMeshPtr_, srcTimePtr_);
240 const fvMesh& srcMesh = srcMeshPtr_();
242 createInterpolation(srcMesh, tgtMesh);
244 cells_ = tgtCellIDs();
249 <<
"No cells selected!" <<
endl;
252 transform_.initialize(srcMesh,
dict);
261 const fvMesh& srcMesh,
262 const dictionary&
dict 296 subDictPtr->readIfPresent(
"origin", origin_);
301 subDictPtr->readIfPresent(
"normal", normal_);
305 points_ = srcMesh.points();
316 refPtr<fvMesh>& srcMeshPtr,
327 points_ + (positionPtr_->value(t) - origin_)
330 fvMesh& srcMesh = srcMeshPtr.ref();
331 srcMesh.movePoints(translate);
338 refPtr<fvMesh>& srcMeshPtr,
355 fvMesh& srcMesh = srcMeshPtr.ref();
368 fieldNames_.resize(1, coeffs_.getWord(
"field"));
381 srcTimePtr_().setDeltaT(1.0);
384 coeffs_.readEntry(
"mapMethod", mapMethodName_);
388 <<
type() <<
" " <<
name() <<
": unknown map method " 389 << mapMethodName_ <<
nl 390 <<
"Available methods include: " 395 coeffs_.readIfPresent(
"consistent", consistent_);
396 coeffs_.readIfPresent(
"patchMap", patchMap_);
397 coeffs_.readIfPresent(
"cuttingPatches", cuttingPatches_);
399 if (!coeffs_.readIfPresent(
"patchMapMethod", patchMapMethodName_))
420 <<
"MapFieldConstraint<" 422 <<
">::constrain for source " << name_ <<
endl;
425 if (transform_.isActive())
428 const scalar t = mesh_.time().timeOutputValue();
429 transform_.translate(srcMeshPtr_, t);
430 transform_.rotate(srcMeshPtr_, t);
435 const word& fldName = fieldNames_[0];
437 const fvMesh& srcMesh = srcMeshPtr_();
438 const fvMesh& tgtMesh = mesh_;
441 const VolFieldType& srcFld = getOrReadField<VolFieldType>(srcMesh, fldName);
445 if (tgtMesh.
changing() || transform_.isActive())
447 createInterpolation(srcMesh, tgtMesh);
448 cells_ = tgtCellIDs();
452 interpPtr_->mapSrcToTgt(srcFld, plusEqOp<Type>(), tgtFld);
455 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.
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.
Ignore writing from objectRegistry::writeObject()
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
const dimensionSet dimless
Dimensionless.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for managing references or pointers (no reference counting)
#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.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
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.
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.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
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.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
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.
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual void constrain(fvMatrix< Type > &eqn, const label)
Set value on field.
Do not request registration (bool: false)
static tmp< volScalarField > createField(const fvMesh &mesh, const scalar val)
void reset(T *p=nullptr) noexcept
Delete managed pointer and set to new given pointer.
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 ...