60void Foam::fv::MapFieldConstraint<Type>::setSourceMesh
62 refPtr<fvMesh>& meshRef,
67 const word meshName(polyMesh::defaultRegion);
72 runTime.cfindObject<fvMesh>(meshName)
98void Foam::fv::MapFieldConstraint<Type>::createInterpolation
100 const fvMesh& srcMesh,
101 const fvMesh& tgtMesh
136template<
class VolFieldType>
137VolFieldType& Foam::fv::MapFieldConstraint<Type>::getOrReadField
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;
197Foam::fv::MapFieldConstraint<Type>::transform::transform()
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);
252bool Foam::fv::MapFieldConstraint<Type>::transform::initialize
254 const fvMesh& srcMesh,
289 subDictPtr->readIfPresent(
"origin", origin_);
294 subDictPtr->readIfPresent(
"normal", normal_);
298 points_ = srcMesh.points();
307void Foam::fv::MapFieldConstraint<Type>::transform::translate
309 refPtr<fvMesh>& srcMeshPtr,
320 points_ + (positionPtr_->value(t) - origin_)
323 fvMesh& srcMesh = srcMeshPtr.ref();
324 srcMesh.movePoints(translate);
329void Foam::fv::MapFieldConstraint<Type>::transform::rotate
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);
426 typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
428 const word& fldName = fieldNames_[0];
430 const fvMesh& srcMesh = srcMeshPtr_();
431 const fvMesh& tgtMesh = mesh_;
434 const VolFieldType& srcFld = getOrReadField<VolFieldType>(srcMesh, fldName);
435 VolFieldType& tgtFld = tgtMesh.lookupObjectRef<VolFieldType>(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_));
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr)
An optional selector, with fallback redirection.
Generic GeometricField class.
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())
@ NO_REGISTER
Do not request registration (bool: false).
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A List with indirect addressing. Like IndirectList but does not store addressing.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
A class for handling file names.
static bool clean(std::string &str)
Cleanup filename string, possibly applies other transformations such as changing the path separator e...
A special matrix type and solver, designed for finite volume solutions of scalar equations....
void setValues(const labelUList &cellLabels, const Type &value)
Set solution in given cells to the specified value and eliminate the corresponding equations from the...
Mesh data needed to do the Finite Volume discretisation.
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
MapFieldConstraint(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual void constrain(fvMatrix< Type > &eqn, const label)
Set value on field.
virtual bool read(const dictionary &dict)
Read source dictionary.
Base abstract class for handling finite volume options (i.e. fvOption).
bool active_
Source active flag.
const word & name() const noexcept
Return const access to the source name.
const fvMesh & mesh_
Reference to the mesh database.
wordList fieldNames_
Field names to apply source to - populated by derived models.
option(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
virtual bool read(const dictionary &dict)
Read source dictionary.
dictionary coeffs_
Dictionary containing source coefficients.
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
const word name_
Source name.
interpolationMethod
Enumeration specifying interpolation method.
static word interpolationMethodAMI(const interpolationMethod method)
Conversion between mesh and patch interpolation methods.
static const Enum< interpolationMethod > interpolationMethodNames_
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 traits class, which is primarily used for primitives and vector-space.
static word defaultRegion
Return the default region name.
virtual const pointField & points() const
Return raw points.
bool changing() const noexcept
Is mesh changing (topology changing and/or moving).
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
string & expand(const bool allowEmpty=false)
Inplace expand initial tags, tildes, and all occurrences of environment variables as per stringOps::e...
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
Info<< "Create engine time\n"<< endl;autoPtr< engineTime > runTimePtr(engineTime::New(Time::controlDictName, args.rootPath(), args.caseName()))
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for finite-volume.
const dimensionSet dimless
Dimensionless.
List< label > labelList
A List of labels.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static tmp< volScalarField > createField(const fvMesh &mesh, const scalar val)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.