mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
MRF: Added support for mesh refinement/unrefinement and other topology changes
This commit is contained in:
@ -108,7 +108,11 @@ int main(int argc, char *argv[])
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf;
|
||||
@ -118,12 +122,13 @@ int main(int argc, char *argv[])
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
Info<< "rhoEqn max/min : " << max(rho).value()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,7 +93,11 @@ int main(int argc, char *argv[])
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf;
|
||||
@ -105,10 +109,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
Info<< "rhoEqn max/min : " << max(rho).value()
|
||||
|
||||
@ -75,21 +75,26 @@ int main(int argc, char *argv[])
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
|
||||
@ -94,7 +94,11 @@ int main(int argc, char *argv[])
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf;
|
||||
@ -104,12 +108,13 @@ int main(int argc, char *argv[])
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parcels.evolve();
|
||||
|
||||
|
||||
@ -116,17 +116,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
|
||||
MRF.update();
|
||||
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
@ -137,11 +140,12 @@ int main(int argc, char *argv[])
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
#include "compressibleAlphaEqnSubCycle.H"
|
||||
|
||||
@ -134,11 +134,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
@ -149,11 +151,12 @@ int main(int argc, char *argv[])
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
#include "alphaEqnSubCycle.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -109,11 +109,13 @@ int main(int argc, char *argv[])
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
@ -122,11 +124,12 @@ int main(int argc, char *argv[])
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -601,4 +601,13 @@ bool Foam::MRFZone::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::update()
|
||||
{
|
||||
if (mesh_.topoChanging())
|
||||
{
|
||||
setMRFFaces();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -180,8 +180,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the MRF region name
|
||||
inline const word& name() const;
|
||||
|
||||
@ -191,9 +189,6 @@ public:
|
||||
//- Return the current Omega vector
|
||||
vector Omega() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Update the mesh corresponding to given map
|
||||
void updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
@ -262,6 +257,9 @@ public:
|
||||
//- Correct the boundary velocity for the rotation of the MRF region
|
||||
void correctBoundaryVelocity(volVectorField& U) const;
|
||||
|
||||
//- Update MRFZone faces if the mesh topology changes
|
||||
void update();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -414,6 +414,18 @@ void Foam::MRFZoneList::correctBoundaryFlux
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZoneList::update()
|
||||
{
|
||||
if (mesh_.topoChanging())
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
operator[](i).update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,10 +55,8 @@ Ostream& operator<<(Ostream& os, const MRFZoneList& models);
|
||||
|
||||
class MRFZoneList
|
||||
:
|
||||
PtrList<MRFZone>
|
||||
public PtrList<MRFZone>
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -186,6 +184,9 @@ public:
|
||||
surfaceScalarField& phi
|
||||
) const;
|
||||
|
||||
//- Update MRFZone faces if the mesh topology changes
|
||||
void update();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
|
||||
Reference in New Issue
Block a user