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>
127 repeat_(
dict.lookupOrDefault<scalar>(
"repeat", units::
none, 0)),
128 cycle_(
dict.lookupOrDefault<scalar>(
"cycle", units::
none, 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_));
162 ||
time.userTimeValue() + timeDelta_ < times_.last()
165 const scalar meshTime = this->meshTime();
167 if (cycle_ == 0 ||
int((
time.userTimeValue() - begin_)/cycle_) % 2 == 0)
171 if (times_[i] > meshTime + timeDelta_)
173 return time.userTimeToTime(times_[i] - meshTime);
181 if (times_[i] < meshTime - timeDelta_)
183 return time.userTimeToTime(meshTime - times_[i]);
209 time.functionObjects().findObjectID(
"meshToMeshAdjustTimeStep")
213 const_cast<Time&
>(
time).functionObjects().append
217 "meshToMeshAdjustTimeStep",
224 if (timeIndex_ !=
time.timeIndex())
226 timeIndex_ =
time.timeIndex();
235 scalar meshTime = this->meshTime();
236 const int64_t
timeIndex = int64_t((meshTime + timeDelta_/2)/timeDelta_);
244 const word meshTimeName(
time.timeName(meshTime));
246 Info<<
"Mapping to mesh time " << meshTimeName <<
endl;
254 "meshes"/meshTimeName,
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...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
Dummy fvMeshTopoChanger which does not move the mesh points.
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.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
errorManipArg< error, int > exit(error &err, const int errNo=1)
VolField< vector > volVectorField
Ostream & endl(Ostream &os)
Add newline and flush stream.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
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.