mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updating overPimpleDyMFoam solver
This commit is contained in:
@ -39,19 +39,30 @@ mesh.setFluxRequired(p.name());
|
|||||||
|
|
||||||
// Add solver-specific interpolations
|
// Add solver-specific interpolations
|
||||||
{
|
{
|
||||||
dictionary oversetDict;
|
dictionary suppressDict;
|
||||||
oversetDict.add("U", true);
|
{
|
||||||
oversetDict.add("p", true);
|
const wordHashSet& nonInt = Stencil::New(mesh).nonInterpolatedFields();
|
||||||
oversetDict.add("HbyA", true);
|
for (auto fldName : nonInt)
|
||||||
oversetDict.add("grad(p)", true);
|
{
|
||||||
|
suppressDict.add(fldName, true);
|
||||||
|
}
|
||||||
|
suppressDict.add("HbyA", true);
|
||||||
|
suppressDict.add("grad(p)", true);
|
||||||
|
suppressDict.add("surfaceIntegrate(phi)", true);
|
||||||
|
suppressDict.add("surfaceIntegrate(phiHbyA)", true);
|
||||||
|
suppressDict.add("cellMask", true);
|
||||||
|
suppressDict.add("cellDisplacement", true);
|
||||||
|
suppressDict.add("interpolatedCells", true);
|
||||||
|
suppressDict.add("cellInterpolationWeight", true);
|
||||||
|
}
|
||||||
|
|
||||||
const_cast<dictionary&>
|
const_cast<dictionary&>
|
||||||
(
|
(
|
||||||
mesh.schemesDict()
|
mesh.schemesDict()
|
||||||
).add
|
).add
|
||||||
(
|
(
|
||||||
"oversetInterpolationRequired",
|
"oversetInterpolationSuppressed",
|
||||||
oversetDict,
|
suppressDict,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -68,3 +79,17 @@ autoPtr<incompressible::turbulenceModel> turbulence
|
|||||||
(
|
(
|
||||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phiHbyA",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
fvc::flux(U)
|
||||||
|
);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,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-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -94,13 +94,24 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "setCellMask.H"
|
#include "setCellMask.H"
|
||||||
#include "setInterpolatedCells.H"
|
#include "setInterpolatedCells.H"
|
||||||
|
|
||||||
|
surfaceScalarField faceMaskOld
|
||||||
|
(
|
||||||
|
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||||
|
);
|
||||||
|
|
||||||
|
// Zero Uf on old faceMask (H-I)
|
||||||
|
Uf *= faceMaskOld;
|
||||||
|
// Update Uf and phi on new C-I faces
|
||||||
|
Uf += (1-faceMaskOld)*fvc::interpolate(U);
|
||||||
|
|
||||||
|
phi = mesh.Sf() & Uf;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate absolute flux from the mapped surface velocity
|
|
||||||
phi = mesh.Sf() & Uf;
|
|
||||||
|
|
||||||
if (mesh.changing() && correctPhi)
|
if (mesh.changing() && correctPhi)
|
||||||
{
|
{
|
||||||
|
// Calculate absolute flux from the mapped surface velocity
|
||||||
#include "correctPhi.H"
|
#include "correctPhi.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
volScalarField rAU(1.0/UEqn.A());
|
|
||||||
|
|
||||||
// Option 1: interpolate rAU, do not block out rAU on blocked cells
|
// Option 1: interpolate rAU, do not block out rAU on blocked cells
|
||||||
//mesh.interpolate(rAU, false);
|
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||||
//surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
|
||||||
|
|
||||||
// Option 2: do not interpolate rAU but block out rAU
|
// Option 2: do not interpolate rAU but block out rAU
|
||||||
//surfaceScalarField rAUf("rAUf", fvc::interpolate(blockedCells*rAU));
|
//surfaceScalarField rAUf("rAUf", fvc::interpolate(blockedCells*rAU));
|
||||||
@ -15,14 +12,12 @@ volScalarField rAU(1.0/UEqn.A());
|
|||||||
// H I C C C C
|
// H I C C C C
|
||||||
// H
|
// H
|
||||||
//
|
//
|
||||||
|
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||||
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
|
volVectorField H("H", UEqn.H());
|
||||||
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
|
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
volVectorField HbyA("HbyA", U);
|
||||||
HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p);
|
HbyA = constrainHbyA(rAU*H, U, p);
|
||||||
|
|
||||||
//mesh.interpolate(HbyA);
|
|
||||||
if (massFluxInterpolation)
|
if (massFluxInterpolation)
|
||||||
{
|
{
|
||||||
#include "interpolatedFaces.H"
|
#include "interpolatedFaces.H"
|
||||||
@ -33,21 +28,28 @@ if (pimple.nCorrPISO() <= 1)
|
|||||||
tUEqn.clear();
|
tUEqn.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
|
phiHbyA = fvc::flux(HbyA);
|
||||||
|
|
||||||
if (ddtCorr)
|
if (ddtCorr)
|
||||||
{
|
{
|
||||||
phiHbyA += rAUf*fvc::ddtCorr(U, Uf);
|
surfaceScalarField faceMaskOld
|
||||||
|
(
|
||||||
|
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||||
|
);
|
||||||
|
phiHbyA += rAUf*faceMaskOld*fvc::ddtCorr(U, Uf);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRF.makeRelative(phiHbyA);
|
MRF.makeRelative(phiHbyA);
|
||||||
|
|
||||||
|
// WIP
|
||||||
|
/*
|
||||||
if (p.needReference())
|
if (p.needReference())
|
||||||
{
|
{
|
||||||
fvc::makeRelative(phiHbyA, U);
|
fvc::makeRelative(phiHbyA, U);
|
||||||
adjustPhi(phiHbyA, U, p);
|
adjustPhi(phiHbyA, U, p);
|
||||||
fvc::makeAbsolute(phiHbyA, U);
|
fvc::makeAbsolute(phiHbyA, U);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (adjustFringe)
|
if (adjustFringe)
|
||||||
{
|
{
|
||||||
@ -70,21 +72,20 @@ while (pimple.correctNonOrthogonal())
|
|||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi = phiHbyA - pEqn.flux();
|
phi = phiHbyA - pEqn.flux();
|
||||||
|
// option 2:
|
||||||
|
// rAUf*fvc::snGrad(p)*mesh.magSf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
// Explicitly relax pressure for momentum corrector
|
// Explicitly relax pressure for momentum corrector
|
||||||
p.relax();
|
p.relax();
|
||||||
volVectorField gradP(fvc::grad(p));
|
volVectorField gradP(fvc::grad(p));
|
||||||
//mesh.interpolate(gradP);
|
|
||||||
|
|
||||||
// Option 1: leave velocity intact on blocked out cells
|
|
||||||
//U = HbyA - rAU*gradP;
|
|
||||||
|
|
||||||
// Option 2: zero out velocity on blocked out cells
|
// Option 2: zero out velocity on blocked out cells
|
||||||
U = (HbyA - rAU*cellMask*gradP);
|
U = HbyA - rAU*cellMask*gradP;
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
|
|
||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
|
|||||||
@ -335,9 +335,10 @@ void Foam::dynamicOversetFvMesh::addInterpolation(fvMatrix<Type>& m) const
|
|||||||
lower[facei] = 0.0;
|
lower[facei] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For safety we make zero the HOLES
|
||||||
const scalar normalisation = V()[celli];
|
const scalar normalisation = V()[celli];
|
||||||
diag[celli] = normalisation;
|
diag[celli] = normalisation;
|
||||||
source[celli] = normalisation*m.psi()[celli];
|
source[celli] = pTraits<Type>::zero;//normalisation*m.psi()[celli];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user