Merge branch 'feature-potentialFoam' into 'develop'
ENH: potentialFoam updates migrated from internal development line Added: - header documentation - pressure reference cell and value for -writep option - removed unused createControls.H file - now uses pisoControl control structure See merge request !14
This commit is contained in:
commit
3ab09ea9d7
@ -1,9 +0,0 @@
|
|||||||
const dictionary& potentialFlow
|
|
||||||
(
|
|
||||||
mesh.solutionDict().subDict("potentialFlow")
|
|
||||||
);
|
|
||||||
|
|
||||||
const int nNonOrthCorr
|
|
||||||
(
|
|
||||||
potentialFlow.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0)
|
|
||||||
);
|
|
@ -12,6 +12,7 @@ volVectorField U
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Initialise the velocity internal field to zero
|
||||||
U = dimensionedVector("0", U.dimensions(), vector::zero);
|
U = dimensionedVector("0", U.dimensions(), vector::zero);
|
||||||
|
|
||||||
surfaceScalarField phi
|
surfaceScalarField phi
|
||||||
@ -34,7 +35,9 @@ if (args.optionFound("initialiseUBCs"))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Default name for the pressure field
|
// Construct a pressure field
|
||||||
|
// If it is available read it otherwise construct from the velocity BCs
|
||||||
|
// converting fixed-value BCs to zero-gradient and vice versa.
|
||||||
word pName("p");
|
word pName("p");
|
||||||
|
|
||||||
// Update name of the pressure field from the command-line option
|
// Update name of the pressure field from the command-line option
|
||||||
@ -55,6 +58,9 @@ forAll(U.boundaryField(), patchi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note that registerObject is false for the pressure field. The pressure
|
||||||
|
// field in this solver doesn't have a physical value during the solution.
|
||||||
|
// It shouldn't be looked up and used by sub models or boundary conditions.
|
||||||
Info<< "Constructing pressure field " << pName << nl << endl;
|
Info<< "Constructing pressure field " << pName << nl << endl;
|
||||||
volScalarField p
|
volScalarField p
|
||||||
(
|
(
|
||||||
@ -64,13 +70,28 @@ volScalarField p
|
|||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::READ_IF_PRESENT,
|
IOobject::READ_IF_PRESENT,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dimensionedScalar(pName, sqr(dimVelocity), 0),
|
dimensionedScalar(pName, sqr(dimVelocity), 0),
|
||||||
pBCTypes
|
pBCTypes
|
||||||
);
|
);
|
||||||
|
|
||||||
|
label pRefCell = 0;
|
||||||
|
scalar pRefValue = 0.0;
|
||||||
|
if (args.optionFound("writep"))
|
||||||
|
{
|
||||||
|
setRefCell
|
||||||
|
(
|
||||||
|
p,
|
||||||
|
potentialFlow.dict(),
|
||||||
|
pRefCell,
|
||||||
|
pRefValue
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Info<< "Constructing velocity potential field Phi\n" << endl;
|
Info<< "Constructing velocity potential field Phi\n" << endl;
|
||||||
volScalarField Phi
|
volScalarField Phi
|
||||||
(
|
(
|
||||||
|
@ -24,13 +24,64 @@ License
|
|||||||
Application
|
Application
|
||||||
potentialFoam
|
potentialFoam
|
||||||
|
|
||||||
Description
|
Group
|
||||||
Potential flow solver which solves for the velocity potential
|
grpBasicSolvers
|
||||||
from which the flux-field is obtained and velocity field by reconstructing
|
|
||||||
the flux.
|
|
||||||
|
|
||||||
This application is particularly useful to generate starting fields for
|
Description
|
||||||
Navier-Stokes codes.
|
Potential flow solver.
|
||||||
|
|
||||||
|
\heading Solver details
|
||||||
|
The potential flow solution is typically employed to generate initial fields
|
||||||
|
for full Navier-Stokes codes. The flow is evolved using the equation:
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\laplacian \Phi = \div(\vec{U})
|
||||||
|
\f]
|
||||||
|
|
||||||
|
Where:
|
||||||
|
\vartable
|
||||||
|
\Phi | Velocity potential [m2/s]
|
||||||
|
\vec{U} | Velocity [m/s]
|
||||||
|
\endvartable
|
||||||
|
|
||||||
|
The corresponding pressure field could be calculated from the divergence
|
||||||
|
of the Euler equation:
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\laplacian p + \div(\div(\vec{U}\otimes\vec{U})) = 0
|
||||||
|
\f]
|
||||||
|
|
||||||
|
but this generates excessive pressure variation in regions of large
|
||||||
|
velocity gradient normal to the flow direction. A better option is to
|
||||||
|
calculate the pressure field corresponding to velocity variation along the
|
||||||
|
stream-lines:
|
||||||
|
|
||||||
|
\f[
|
||||||
|
\laplacian p + \div(\vec{F}\cdot\div(\vec{U}\otimes\vec{U})) = 0
|
||||||
|
\f]
|
||||||
|
where the flow direction tensor \f$\vec{F}\f$ is obtained from
|
||||||
|
\f[
|
||||||
|
\vec{F} = \hat{\vec{U}}\otimes\hat{\vec{U}}
|
||||||
|
\f]
|
||||||
|
|
||||||
|
\heading Required fields
|
||||||
|
\plaintable
|
||||||
|
U | Velocity [m/s]
|
||||||
|
\endplaintable
|
||||||
|
|
||||||
|
\heading Optional fields
|
||||||
|
\plaintable
|
||||||
|
p | Kinematic pressure [m2/s2]
|
||||||
|
Phi | Velocity potential [m2/s]
|
||||||
|
| Generated from p (if present) or U if not present
|
||||||
|
\endplaintable
|
||||||
|
|
||||||
|
\heading Options
|
||||||
|
\plaintable
|
||||||
|
-writep | write the Euler pressure
|
||||||
|
-writePhi | Write the final velocity potential
|
||||||
|
-initialiseUBCs | Update the velocity boundaries before solving for Phi
|
||||||
|
\endplaintable
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -58,19 +109,13 @@ int main(int argc, char *argv[])
|
|||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"writePhi",
|
"writePhi",
|
||||||
"Write the velocity potential field"
|
"Write the final velocity potential field"
|
||||||
);
|
);
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"writep",
|
"writep",
|
||||||
"Calculate and write the pressure field"
|
"Calculate and write the Euler pressure field"
|
||||||
);
|
|
||||||
|
|
||||||
argList::addBoolOption
|
|
||||||
(
|
|
||||||
"withFunctionObjects",
|
|
||||||
"execute functionObjects"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
@ -137,7 +182,7 @@ int main(int argc, char *argv[])
|
|||||||
Phi.write();
|
Phi.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the pressure field
|
// Calculate the pressure field from the Euler equation
|
||||||
if (args.optionFound("writep"))
|
if (args.optionFound("writep"))
|
||||||
{
|
{
|
||||||
Info<< nl << "Calculating approximate pressure field" << endl;
|
Info<< nl << "Calculating approximate pressure field" << endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user