29 #include "surfaceInterpolate.H"
46 namespace fvMeshTopoChangers
56 bool Foam::fvMeshTopoChangers::meshToMesh::forward()
const
60 || int((
mesh().time().userTimeValue() - begin_)/cycle_) % 2 == 0;
64 Foam::scalar Foam::fvMeshTopoChangers::meshToMesh::meshTime()
const
66 const Time& time = mesh().time();
70 return begin_ + fmod(time.userTimeValue() - begin_, repeat_);
78 + fmod(time.userTimeValue() - begin_, cycle_);
84 - fmod(time.userTimeValue() - begin_, cycle_);
89 return time.userTimeValue();
94 void Foam::fvMeshTopoChangers::meshToMesh::interpolateUfs()
98 HashTable<surfaceVectorField*> Ufs
100 mesh().lookupClass<surfaceVectorField>()
103 forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
127 times_(
dict.lookup(
"times")),
128 timeDelta_(
dict.lookup<scalar>(
"timeDelta")),
129 begin_(
dict.lookupOrDefault(
"begin", mesh().time().beginTime().value())),
130 repeat_(
dict.lookupOrDefault(
"repeat", 0.0)),
131 cycle_(
dict.lookupOrDefault(
"cycle", 0.0)),
134 if (repeat_ > 0 && cycle_ > 0)
137 <<
"Both 'repeat' and 'cycle' options specified"
143 timeIndices_.insert(int64_t((times_[i] + timeDelta_/2.0)/timeDelta_));
167 const scalar meshTime = this->meshTime();
169 if (cycle_ == 0 ||
int((time.
userTimeValue() - begin_)/cycle_) % 2 == 0)
173 if (times_[i] > meshTime + timeDelta_)
183 if (times_[i] < meshTime - timeDelta_)
207 const_cast<Time&
>(time).functionObjects().append
211 "meshToMeshAdjustTimeStep",
231 const scalar meshTime = this->meshTime();
233 if (timeIndices_.found((meshTime + timeDelta_/2)/timeDelta_))
235 const word otherMeshDir =
236 "meshToMesh_" + time.
timeName(meshTime);
238 Info <<
"Mapping to mesh " << otherMeshDir <<
endl;
253 mesh().swap(otherMesh);
259 cellsToCellss::intersection::typeName
263 #define mapVolFieldType(Type, nullArg) \
264 MeshToMeshMapVolFields<Type>(mesh(), mapper);
268 #define mapVolInternalFieldType(Type, nullArg) \
269 MeshToMeshMapVolInternalFields<Type>(mesh(), mapper);
273 #define NaNSurfaceFieldType(Type, nullArg) \
275 <Type, fvsPatchField, surfaceMesh, setSizeFvPatchFieldMapper> \
280 #define NaNPointFieldType(Type, nullArg) \
282 <Type, pointPatchField, pointMesh, setSizePointPatchFieldMapper> \
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#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.
FOR_ALL_FIELD_TYPES(DefineContiguousFvWallLocationDataType)
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
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.