27 #include "surfaceInterpolate.H"
40 namespace fvMeshTopoChangers
50 bool Foam::fvMeshTopoChangers::meshToMesh::forward()
const
54 || int((
mesh().time().userTimeValue() - begin_)/cycle_) % 2 == 0;
58 Foam::scalar Foam::fvMeshTopoChangers::meshToMesh::meshTime()
const
64 return begin_ + fmod(time.userTimeValue() - begin_, repeat_);
72 + fmod(time.userTimeValue() - begin_, cycle_);
78 - fmod(time.userTimeValue() - begin_, cycle_);
83 return time.userTimeValue();
88 void Foam::fvMeshTopoChangers::meshToMesh::interpolateUfs()
91 UPtrList<surfaceVectorField> Ufs(
mesh().curFields<surfaceVectorField>());
120 dict.lookupOrDefault<scalar>
124 mesh().time().beginTime().value()
127 repeat_(
dict.lookupOrDefault<scalar>(
"repeat",
unitNone, 0)),
128 cycle_(
dict.lookupOrDefault<scalar>(
"cycle",
unitNone, 0)),
132 if (repeat_ > 0 && cycle_ > 0)
135 <<
"Both 'repeat' and 'cycle' options specified"
141 timeIndices_.insert(int64_t((times_[i] + timeDelta_/2.0)/timeDelta_));
165 const scalar meshTime = this->meshTime();
167 if (cycle_ == 0 ||
int((time.
userTimeValue() - begin_)/cycle_) % 2 == 0)
171 if (times_[i] > meshTime + timeDelta_)
181 if (times_[i] < meshTime - timeDelta_)
213 const_cast<Time&
>(time).functionObjects().append
217 "meshToMeshAdjustTimeStep",
235 scalar meshTime = this->meshTime();
236 const int64_t
timeIndex = int64_t((meshTime + timeDelta_/2)/timeDelta_);
246 Info<<
"Mapping to mesh time " << meshTimeName <<
endl;
254 "meshes"/meshTimeName,
269 cellsToCellss::intersection::typeName
276 #define mapVolFieldType(Type, nullArg) \
277 MeshToMeshMapVolFields<Type>(mesh(), mapper);
281 #define mapVolInternalFieldType(Type, nullArg) \
282 MeshToMeshMapVolInternalFields<Type>(mesh(), mapper);
286 #define NaNSurfaceFieldType(Type, nullArg) \
287 NaNGeometricFields<Type, surfaceMesh>(mesh());
291 #define NaNPointFieldType(Type, nullArg) \
292 NaNGeometricFields<Type, pointMesh>(mesh());
#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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
bool mapped() const
Return true if the mesh has been mapped this time-step,.
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 the top-level database.
void preChange()
Prepare for a mesh change.
void swap(fvMesh &)
Swap mesh.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
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.
const surfaceScalarField & deltaCoeffs() const
Return reference to cell-centre difference coefficients.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#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.