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