mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
Conflicts: src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
This commit is contained in:
@ -1,30 +1,30 @@
|
||||
if (mesh.changing())
|
||||
{
|
||||
if (mesh.changing())
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
forAll(U.boundaryField(), patchi)
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].initEvaluate();
|
||||
}
|
||||
}
|
||||
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].evaluate();
|
||||
|
||||
phi.boundaryField()[patchi] =
|
||||
rho.boundaryField()[patchi]
|
||||
*(
|
||||
U.boundaryField()[patchi]
|
||||
& mesh.Sf().boundaryField()[patchi]
|
||||
);
|
||||
}
|
||||
U.boundaryField()[patchi].initEvaluate();
|
||||
}
|
||||
}
|
||||
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].evaluate();
|
||||
|
||||
phi.boundaryField()[patchi] =
|
||||
rho.boundaryField()[patchi]
|
||||
*(
|
||||
U.boundaryField()[patchi]
|
||||
& mesh.Sf().boundaryField()[patchi]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
@ -40,13 +40,13 @@
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
dimensionedScalar Dp("Dp", dimTime, 1.0);
|
||||
dimensionedScalar rAUf("rAUf", dimTime, 1.0);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(Dp, pcorr) == fvc::div(phi) - divrhoU
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divrhoU
|
||||
);
|
||||
|
||||
pcorrEqn.solve();
|
||||
|
||||
@ -22,7 +22,7 @@ if (pimple.transonic())
|
||||
fvc::interpolate(psi)
|
||||
*(
|
||||
(fvc::interpolate(rho*HbyA) & mesh.Sf())
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, phiAbs)
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
|
||||
)/fvc::interpolate(rho)
|
||||
);
|
||||
|
||||
@ -55,7 +55,7 @@ else
|
||||
(
|
||||
"phiHbyA",
|
||||
(fvc::interpolate(rho*HbyA) & mesh.Sf())
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, phiAbs)
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
|
||||
);
|
||||
|
||||
fvOptions.makeRelative(fvc::interpolate(rho), phiHbyA);
|
||||
|
||||
@ -56,13 +56,10 @@ int main(int argc, char *argv[])
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createPcorrTypes.H"
|
||||
#include "createRhoUf.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
// Create old-time absolute flux for ddtCorr
|
||||
surfaceScalarField phiAbs("phiAbs", phi);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
@ -72,12 +69,6 @@ int main(int argc, char *argv[])
|
||||
#include "readControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
|
||||
// Make the fluxes absolute before mesh-motion
|
||||
fvc::makeAbsolute(phi, rho, U);
|
||||
|
||||
// Update absolute flux for ddtCorr
|
||||
phiAbs = phi;
|
||||
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
@ -86,20 +77,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
// Store divrhoU from the previous time-step/mesh for the correctPhi
|
||||
volScalarField divrhoU(fvc::div(phi));
|
||||
volScalarField divrhoU(fvc::div(fvc::absolute(phi, rho, U)));
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
}
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
|
||||
@ -37,13 +37,13 @@ if (mesh.changing())
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
dimensionedScalar Dp("Dp", dimTime, 1.0);
|
||||
dimensionedScalar rAUf("rAUf", dimTime, 1.0);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(Dp, pcorr) == fvc::div(phi)
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pcorrEqn.setReference(pRefCell, pRefValue);
|
||||
@ -54,6 +54,6 @@ if (mesh.changing())
|
||||
phi -= pcorrEqn.flux();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
#include "continuityErrs.H"
|
||||
}
|
||||
|
||||
@ -47,16 +47,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "readThermodynamicProperties.H"
|
||||
#include "readControls.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
surfaceScalarField phivAbs("phivAbs", phiv);
|
||||
fvc::makeAbsolute(phivAbs, U);
|
||||
|
||||
#include "readThermodynamicProperties.H"
|
||||
#include "readControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createUf.H"
|
||||
#include "createPcorrTypes.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
@ -75,18 +74,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
{
|
||||
// Calculate the relative velocity used to map relative flux phiv
|
||||
volVectorField Urel("Urel", U);
|
||||
|
||||
if (mesh.moving())
|
||||
{
|
||||
Urel -= fvc::reconstruct(fvc::meshPhi(U));
|
||||
}
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
}
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
@ -94,7 +83,16 @@ int main(int argc, char *argv[])
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
#include "correctPhi.H"
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phiv = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phiv, U);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
|
||||
@ -1,18 +1,27 @@
|
||||
if (mesh.changing())
|
||||
{
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
forAll (p.boundaryField(), i)
|
||||
forAll(U.boundaryField(), patchI)
|
||||
{
|
||||
if (p.boundaryField()[i].fixesValue())
|
||||
if (U.boundaryField()[patchI].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
U.boundaryField()[patchI].initEvaluate();
|
||||
}
|
||||
}
|
||||
|
||||
forAll(U.boundaryField(), patchI)
|
||||
{
|
||||
if (U.boundaryField()[patchI].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchI].evaluate();
|
||||
|
||||
phiv.boundaryField()[patchI] =
|
||||
U.boundaryField()[patchI]
|
||||
& mesh.Sf().boundaryField()[patchI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
@ -29,7 +38,7 @@
|
||||
);
|
||||
|
||||
surfaceScalarField rhof(fvc::interpolate(rho, "div(phiv,rho)"));
|
||||
dimensionedScalar rAUf("(1|A(U))", dimTime, 1.0);
|
||||
dimensionedScalar rAUf("rAUf", dimTime, 1.0);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
phiv = (fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ rhorAUf*fvc::ddtCorr(U, phivAbs);
|
||||
+ rhorAUf*fvc::ddtCorr(U, Uf);
|
||||
fvc::makeRelative(phiv, U);
|
||||
|
||||
surfaceScalarField phiGradp(rhorAUf*mesh.magSf()*fvc::snGrad(p));
|
||||
@ -43,7 +43,6 @@
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phiv += (phiGradp + pEqn.flux())/rhof;
|
||||
phivAbs = fvc::absolute(phiv, U);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,4 +81,10 @@
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += mesh.Sf()*(phiv - (mesh.Sf() & Uf))/sqr(mesh.magSf());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
scalar maxAcousticCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
|
||||
);
|
||||
|
||||
bool correctPhi =
|
||||
pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
|
||||
@ -1,28 +1,26 @@
|
||||
if (mesh.changing())
|
||||
{
|
||||
if (mesh.changing())
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
forAll(U.boundaryField(), patchi)
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].initEvaluate();
|
||||
}
|
||||
}
|
||||
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].evaluate();
|
||||
|
||||
phi.boundaryField()[patchi] =
|
||||
U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
|
||||
}
|
||||
U.boundaryField()[patchi].initEvaluate();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].evaluate();
|
||||
|
||||
phi.boundaryField()[patchi] =
|
||||
U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
@ -38,13 +36,13 @@
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
dimensionedScalar Dp("Dp", dimTime/rho.dimensions(), 1.0);
|
||||
dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(Dp, pcorr) == fvc::div(phi) - divU
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU
|
||||
);
|
||||
|
||||
pcorrEqn.solve();
|
||||
@ -54,8 +52,8 @@
|
||||
phi -= pcorrEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
phi.oldTime() = phi;
|
||||
|
||||
#include "continuityErrs.H"
|
||||
}
|
||||
|
||||
phi.oldTime() = phi;
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -1,20 +1,6 @@
|
||||
{
|
||||
#include "continuityErrs.H"
|
||||
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
forAll (p.boundaryField(), i)
|
||||
{
|
||||
if (p.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
@ -30,9 +16,7 @@
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
dimensionedScalar rAUf("(1|A(U))", dimTime/rho.dimensions(), 1.0);
|
||||
|
||||
//adjustPhi(phi, U, pcorr);
|
||||
dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,6 +57,7 @@ int main(int argc, char *argv[])
|
||||
#include "createMRFZones.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "createPcorrTypes.H"
|
||||
#include "correctPhi.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
Reference in New Issue
Block a user