29 #include "surfaceInterpolate.H"
45 namespace fvMeshTopoChangers
55 bool Foam::fvMeshTopoChangers::meshToMesh::forward()
const
59 || int((
mesh().time().userTimeValue() - begin_)/cycle_) % 2 == 0;
63 Foam::scalar Foam::fvMeshTopoChangers::meshToMesh::meshTime()
const
65 const Time& time = mesh().time();
69 return begin_ + fmod(time.userTimeValue() - begin_, repeat_);
77 + fmod(time.userTimeValue() - begin_, cycle_);
83 - fmod(time.userTimeValue() - begin_, cycle_);
88 return time.userTimeValue();
93 void Foam::fvMeshTopoChangers::meshToMesh::interpolateUfs()
96 UPtrList<surfaceVectorField> Ufs(mesh().curFields<surfaceVectorField>());
126 dict.lookupOrDefault<scalar>
130 mesh().time().beginTime().value()
133 repeat_(
dict.lookupOrDefault<scalar>(
"repeat",
unitNone, 0)),
134 cycle_(
dict.lookupOrDefault<scalar>(
"cycle",
unitNone, 0)),
137 if (repeat_ > 0 && cycle_ > 0)
140 <<
"Both 'repeat' and 'cycle' options specified"
146 timeIndices_.insert(int64_t((times_[i] + timeDelta_/2.0)/timeDelta_));
170 const scalar meshTime = this->meshTime();
172 if (cycle_ == 0 ||
int((time.
userTimeValue() - begin_)/cycle_) % 2 == 0)
176 if (times_[i] > meshTime + timeDelta_)
186 if (times_[i] < meshTime - timeDelta_)
210 const_cast<Time&
>(time).functionObjects().append
214 "meshToMeshAdjustTimeStep",
233 scalar meshTime = this->meshTime();
234 const int64_t
timeIndex = int64_t((meshTime + timeDelta_/2)/timeDelta_);
242 const word otherMeshDir =
"meshToMesh_" + time.
timeName(meshTime);
244 Info <<
"Mapping to mesh " << otherMeshDir <<
endl;
259 mesh().swap(otherMesh);
265 cellsToCellss::intersection::typeName
269 mesh().deltaCoeffs();
272 #define mapVolFieldType(Type, nullArg) \
273 MeshToMeshMapVolFields<Type>(mesh(), mapper);
277 #define mapVolInternalFieldType(Type, nullArg) \
278 MeshToMeshMapVolInternalFields<Type>(mesh(), mapper);
282 #define NaNSurfaceFieldType(Type, nullArg) \
284 <Type, fvsPatchField, surfaceMesh> \
289 #define NaNPointFieldType(Type, nullArg) \
291 <Type, pointPatchField, pointMesh> \
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Macros for easy insertion into run-time selection tables.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static const word & constant()
Return constant name.
label timeIndex() const
Return current time index.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
scalar userTimeToTime(const scalar tau) const
Convert the user-time (e.g. CA deg) to real-time (s).
scalar userTimeValue() const
Return current user time value.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
const functionObjectList & functionObjects() const
Return the list of function objects.
A list of keyword definitions, which are a keyword followed by any number of values (e....
label findObjectID(const word &name) const
Find the ID of a given function object by name.
Adjusts time-step for meshToMesh mapping.
Abstract base class for fvMesh topology changers.
fvMesh & mesh()
Return the fvMesh.
fvMeshTopoChanger which maps the fields to a new mesh or sequence of meshes
virtual ~meshToMesh()
Destructor.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
scalar timeToNextMesh() const
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool update()
Update the mesh for both mesh motion and topology change.
meshToMesh(fvMesh &, const dictionary &dict)
Construct from fvMesh and dictionary.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return time.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define NaNPointFieldType(Type, nullArg)
#define mapVolInternalFieldType(Type, nullArg)
#define NaNSurfaceFieldType(Type, nullArg)
#define mapVolFieldType(Type, nullArg)
defineTypeNameAndDebug(list, 0)
addToRunTimeSelectionTable(fvMeshTopoChanger, list, fvMesh)
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
VolField< vector > volVectorField
Ostream & endl(Ostream &os)
Add newline and flush stream.
const unitConversion unitNone
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
SurfaceField< vector > surfaceVectorField
const volVectorField & surfaceToVolVelocity(const surfaceVectorField &Uf)
Get the cell velocity field corresponding to a given face velocity, or a.
Return the vol-field velocity corresponding to a given surface-field velocity.