solvers::isothermalFluid: Updated for mesh-motion with NCC and mesh-to-mesh mapping
This commit is contained in:
@ -302,16 +302,13 @@ void Foam::solvers::isothermalFluid::preSolve()
|
||||
|
||||
fvModels().preUpdateMesh();
|
||||
|
||||
//- Pointer to the vol momentum field
|
||||
// used for mesh-change to set rhoUf for introduced faces
|
||||
autoPtr<volVectorField> rhoU;
|
||||
autoPtr<volVectorField> rhoU0;
|
||||
|
||||
// Store momentum to set rhoUf for introduced faces
|
||||
if (mesh.topoChanging())
|
||||
{
|
||||
rhoU = new volVectorField("rhoU", rho*U);
|
||||
|
||||
InfoInFunction << "rhoUf().nOldTimes() " << rhoUf().nOldTimes() << endl;
|
||||
|
||||
if (rhoUf().nOldTimes() > 1)
|
||||
{
|
||||
rhoU0 = new volVectorField("rhoU_0", rho.oldTime()*U.oldTime());
|
||||
@ -321,8 +318,7 @@ void Foam::solvers::isothermalFluid::preSolve()
|
||||
// Update the mesh for topology change, mesh to mesh mapping
|
||||
mesh.update();
|
||||
|
||||
rhoU.clear();
|
||||
rhoU0.clear();
|
||||
InfoInFunction << "rhoUf().nOldTimes() " << rhoUf().nOldTimes() << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -151,6 +151,14 @@ protected:
|
||||
// Used for buoyant simulations only
|
||||
tmp<volVectorField> netForce;
|
||||
|
||||
//- Pointer to the vol momentum field
|
||||
// used for mesh-change to set rhoUf for introduced faces
|
||||
autoPtr<volVectorField> rhoU;
|
||||
|
||||
//- Pointer to the old-time vol momentum field
|
||||
// used for mesh-change to set rhoUf.oldTime() for introduced faces
|
||||
autoPtr<volVectorField> rhoU0;
|
||||
|
||||
//- Pointer to the surface momentum field
|
||||
// used to recreate the flux after mesh-change
|
||||
autoPtr<surfaceVectorField> rhoUf;
|
||||
|
||||
@ -35,6 +35,11 @@ bool Foam::solvers::isothermalFluid::moveMesh()
|
||||
// Move the mesh
|
||||
mesh.move();
|
||||
|
||||
// The rhoU and rhoU0 fields can be cleared following mesh-motion
|
||||
// now the mesh has been re-stitched as necessary
|
||||
rhoU.clear();
|
||||
rhoU0.clear();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
if (buoyancy.valid())
|
||||
|
||||
@ -418,7 +418,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
<< "Constructing as copy" << endl << this->info() << endl;
|
||||
}
|
||||
|
||||
if (gf.field0Ptr_)
|
||||
if (gf.field0Ptr_ && notNull(gf.field0Ptr_))
|
||||
{
|
||||
field0Ptr_ = new GeometricField<Type, PatchField, GeoMesh>
|
||||
(
|
||||
@ -448,7 +448,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
<< "Constructing by moving" << endl << this->info() << endl;
|
||||
}
|
||||
|
||||
if (gf.field0Ptr_)
|
||||
if (gf.field0Ptr_ && notNull(gf.field0Ptr_))
|
||||
{
|
||||
field0Ptr_ = gf.field0Ptr_;
|
||||
gf.field0Ptr_ = nullptr;
|
||||
@ -506,7 +506,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
<< endl << this->info() << endl;
|
||||
}
|
||||
|
||||
if (!readIfPresent() && gf.field0Ptr_)
|
||||
if (!readIfPresent() && gf.field0Ptr_ && notNull(gf.field0Ptr_))
|
||||
{
|
||||
field0Ptr_ = new GeometricField<Type, PatchField, GeoMesh>
|
||||
(
|
||||
@ -568,7 +568,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
<< endl << this->info() << endl;
|
||||
}
|
||||
|
||||
if (!readIfPresent() && gf.field0Ptr_)
|
||||
if (!readIfPresent() && gf.field0Ptr_ && notNull(gf.field0Ptr_))
|
||||
{
|
||||
field0Ptr_ = new GeometricField<Type, PatchField, GeoMesh>
|
||||
(
|
||||
@ -631,7 +631,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
|
||||
boundaryField_ == gf.boundaryField_;
|
||||
|
||||
if (!readIfPresent() && gf.field0Ptr_)
|
||||
if (!readIfPresent() && gf.field0Ptr_ && notNull(gf.field0Ptr_))
|
||||
{
|
||||
field0Ptr_ = new GeometricField<Type, PatchField, GeoMesh>
|
||||
(
|
||||
@ -673,7 +673,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
|
||||
boundaryField_ == gf.boundaryField_;
|
||||
|
||||
if (!readIfPresent() && gf.field0Ptr_)
|
||||
if (!readIfPresent() && gf.field0Ptr_ && notNull(gf.field0Ptr_))
|
||||
{
|
||||
field0Ptr_ = new GeometricField<Type, PatchField, GeoMesh>
|
||||
(
|
||||
|
||||
@ -645,8 +645,6 @@ bool Foam::fvMesh::dynamic() const
|
||||
|
||||
bool Foam::fvMesh::update()
|
||||
{
|
||||
if (!conformal()) stitcher_->disconnect(true, true);
|
||||
|
||||
if
|
||||
(
|
||||
stitcher_->stitches()
|
||||
@ -657,6 +655,8 @@ bool Foam::fvMesh::update()
|
||||
nullOldestTimeFields();
|
||||
}
|
||||
|
||||
if (!conformal()) stitcher_->disconnect(true, true);
|
||||
|
||||
const bool hasV00 = V00Ptr_;
|
||||
deleteDemandDrivenData(V00Ptr_);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user