This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/multiphase/barotropicCavitatingFoam/createFields.H

79 lines
1.6 KiB
C++

Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field rho\n" << endl;
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "createPhi.H"
// Mass flux
// Initialisation does not matter because rhoPhi is reset after the
// gamma solution before it is used in the U equation.
surfaceScalarField rhoPhi = fvc::interpolate(rho)*phi;
volScalarField gamma
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0.0)
);
volScalarField psiByRho
(
IOobject
(
"psiByRho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
(gamma*psig + (1.0 - gamma)*psil)/rho
);
mesh.schemesDict().setFluxRequired(p.name());