mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: execFlowFunctionObjects: added -region option. Added -noFlow option.
This commit is contained in:
@ -43,6 +43,7 @@ Description
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Foam::timeSelector::addOptions();
|
Foam::timeSelector::addOptions();
|
||||||
|
# include "addRegionOption.H"
|
||||||
Foam::argList::addBoolOption
|
Foam::argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noWrite",
|
"noWrite",
|
||||||
@ -74,7 +75,7 @@ int main(int argc, char *argv[])
|
|||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
||||||
# include "createMesh.H"
|
# include "createNamedMesh.H"
|
||||||
|
|
||||||
utility().tryPreCalc(args, runTime, mesh);
|
utility().tryPreCalc(args, runTime, mesh);
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,11 @@ Description
|
|||||||
|
|
||||||
#include "calc.H"
|
#include "calc.H"
|
||||||
|
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "pointFields.H"
|
||||||
|
#include "ReadFields.H"
|
||||||
|
|
||||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||||
|
|
||||||
#include "incompressible/RAS/RASModel/RASModel.H"
|
#include "incompressible/RAS/RASModel/RASModel.H"
|
||||||
@ -84,203 +89,268 @@ namespace Foam
|
|||||||
|
|
||||||
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||||
{
|
{
|
||||||
Info<< " Reading phi" << endl;
|
if (args.optionFound("noFlow"))
|
||||||
surfaceScalarField phi
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"phi",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< " Reading U" << endl;
|
|
||||||
volVectorField U
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"U",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< " Reading p" << endl;
|
|
||||||
volScalarField p
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"p",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
|
|
||||||
{
|
{
|
||||||
IOobject RASPropertiesHeader
|
Info<< " Operating in no-flow mode; no models will be loaded."
|
||||||
(
|
<< " All vol, surface and point fields will be loaded." << endl;
|
||||||
"RASProperties",
|
|
||||||
runTime.constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
IOobject LESPropertiesHeader
|
// Read objects in time directory
|
||||||
(
|
IOobjectList objects(mesh, runTime.timeName());
|
||||||
"LESProperties",
|
|
||||||
runTime.constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (RASPropertiesHeader.headerOk())
|
// Read vol fields.
|
||||||
{
|
|
||||||
IOdictionary RASProperties(RASPropertiesHeader);
|
|
||||||
|
|
||||||
singlePhaseTransportModel laminarTransport(U, phi);
|
PtrList<volScalarField> vsFlds;
|
||||||
|
ReadFields(mesh, objects, vsFlds);
|
||||||
|
|
||||||
autoPtr<incompressible::RASModel> RASModel
|
PtrList<volVectorField> vvFlds;
|
||||||
(
|
ReadFields(mesh, objects, vvFlds);
|
||||||
incompressible::RASModel::New
|
|
||||||
(
|
|
||||||
U,
|
|
||||||
phi,
|
|
||||||
laminarTransport
|
|
||||||
)
|
|
||||||
);
|
|
||||||
execFlowFunctionObjects(args, runTime);
|
|
||||||
}
|
|
||||||
else if (LESPropertiesHeader.headerOk())
|
|
||||||
{
|
|
||||||
IOdictionary LESProperties(LESPropertiesHeader);
|
|
||||||
|
|
||||||
singlePhaseTransportModel laminarTransport(U, phi);
|
PtrList<volSphericalTensorField> vstFlds;
|
||||||
|
ReadFields(mesh, objects, vstFlds);
|
||||||
|
|
||||||
autoPtr<incompressible::LESModel> sgsModel
|
PtrList<volSymmTensorField> vsymtFlds;
|
||||||
(
|
ReadFields(mesh, objects, vsymtFlds);
|
||||||
incompressible::LESModel::New(U, phi, laminarTransport)
|
|
||||||
);
|
|
||||||
|
|
||||||
execFlowFunctionObjects(args, runTime);
|
PtrList<volTensorField> vtFlds;
|
||||||
}
|
ReadFields(mesh, objects, vtFlds);
|
||||||
else
|
|
||||||
{
|
|
||||||
IOdictionary transportProperties
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"transportProperties",
|
|
||||||
runTime.constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
dimensionedScalar nu(transportProperties.lookup("nu"));
|
// Read surface fields.
|
||||||
|
|
||||||
execFlowFunctionObjects(args, runTime);
|
PtrList<surfaceScalarField> ssFlds;
|
||||||
}
|
ReadFields(mesh, objects, ssFlds);
|
||||||
}
|
|
||||||
else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
|
|
||||||
{
|
|
||||||
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
|
|
||||||
|
|
||||||
volScalarField rho
|
PtrList<surfaceVectorField> svFlds;
|
||||||
(
|
ReadFields(mesh, objects, svFlds);
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rho",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh
|
|
||||||
),
|
|
||||||
thermo->rho()
|
|
||||||
);
|
|
||||||
|
|
||||||
IOobject RASPropertiesHeader
|
PtrList<surfaceSphericalTensorField> sstFlds;
|
||||||
(
|
ReadFields(mesh, objects, sstFlds);
|
||||||
"RASProperties",
|
|
||||||
runTime.constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
IOobject LESPropertiesHeader
|
PtrList<surfaceSymmTensorField> ssymtFlds;
|
||||||
(
|
ReadFields(mesh, objects, ssymtFlds);
|
||||||
"LESProperties",
|
|
||||||
runTime.constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (RASPropertiesHeader.headerOk())
|
PtrList<surfaceTensorField> stFlds;
|
||||||
{
|
ReadFields(mesh, objects, stFlds);
|
||||||
IOdictionary RASProperties(RASPropertiesHeader);
|
|
||||||
|
|
||||||
autoPtr<compressible::RASModel> RASModel
|
// Read point fields.
|
||||||
(
|
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||||
compressible::RASModel::New
|
|
||||||
(
|
|
||||||
rho,
|
|
||||||
U,
|
|
||||||
phi,
|
|
||||||
thermo()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
execFlowFunctionObjects(args, runTime);
|
PtrList<pointScalarField> psFlds;
|
||||||
}
|
ReadFields(pMesh, objects, psFlds);
|
||||||
else if (LESPropertiesHeader.headerOk())
|
|
||||||
{
|
|
||||||
IOdictionary LESProperties(LESPropertiesHeader);
|
|
||||||
|
|
||||||
autoPtr<compressible::LESModel> sgsModel
|
PtrList<pointVectorField> pvFlds;
|
||||||
(
|
ReadFields(pMesh, objects, pvFlds);
|
||||||
compressible::LESModel::New(rho, U, phi, thermo())
|
|
||||||
);
|
|
||||||
|
|
||||||
execFlowFunctionObjects(args, runTime);
|
PtrList<pointSphericalTensorField> pstFlds;
|
||||||
}
|
ReadFields(pMesh, objects, pstFlds);
|
||||||
else
|
|
||||||
{
|
|
||||||
IOdictionary transportProperties
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"transportProperties",
|
|
||||||
runTime.constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
dimensionedScalar mu(transportProperties.lookup("mu"));
|
PtrList<pointSymmTensorField> psymtFlds;
|
||||||
|
ReadFields(pMesh, objects, psymtFlds);
|
||||||
|
|
||||||
execFlowFunctionObjects(args, runTime);
|
PtrList<pointTensorField> ptFlds;
|
||||||
}
|
ReadFields(pMesh, objects, ptFlds);
|
||||||
|
|
||||||
|
execFlowFunctionObjects(args, runTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
Info<< " Reading phi" << endl;
|
||||||
<< "Incorrect dimensions of phi: " << phi.dimensions()
|
surfaceScalarField phi
|
||||||
<< nl << exit(FatalError);
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phi",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Reading U" << endl;
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Reading p" << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
|
||||||
|
{
|
||||||
|
IOobject RASPropertiesHeader
|
||||||
|
(
|
||||||
|
"RASProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
IOobject LESPropertiesHeader
|
||||||
|
(
|
||||||
|
"LESProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (RASPropertiesHeader.headerOk())
|
||||||
|
{
|
||||||
|
IOdictionary RASProperties(RASPropertiesHeader);
|
||||||
|
|
||||||
|
singlePhaseTransportModel laminarTransport(U, phi);
|
||||||
|
|
||||||
|
autoPtr<incompressible::RASModel> RASModel
|
||||||
|
(
|
||||||
|
incompressible::RASModel::New
|
||||||
|
(
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
laminarTransport
|
||||||
|
)
|
||||||
|
);
|
||||||
|
execFlowFunctionObjects(args, runTime);
|
||||||
|
}
|
||||||
|
else if (LESPropertiesHeader.headerOk())
|
||||||
|
{
|
||||||
|
IOdictionary LESProperties(LESPropertiesHeader);
|
||||||
|
|
||||||
|
singlePhaseTransportModel laminarTransport(U, phi);
|
||||||
|
|
||||||
|
autoPtr<incompressible::LESModel> sgsModel
|
||||||
|
(
|
||||||
|
incompressible::LESModel::New(U, phi, laminarTransport)
|
||||||
|
);
|
||||||
|
|
||||||
|
execFlowFunctionObjects(args, runTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IOdictionary transportProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar nu(transportProperties.lookup("nu"));
|
||||||
|
|
||||||
|
execFlowFunctionObjects(args, runTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
|
||||||
|
{
|
||||||
|
autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
|
||||||
|
|
||||||
|
volScalarField rho
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
thermo->rho()
|
||||||
|
);
|
||||||
|
|
||||||
|
IOobject RASPropertiesHeader
|
||||||
|
(
|
||||||
|
"RASProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
IOobject LESPropertiesHeader
|
||||||
|
(
|
||||||
|
"LESProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (RASPropertiesHeader.headerOk())
|
||||||
|
{
|
||||||
|
IOdictionary RASProperties(RASPropertiesHeader);
|
||||||
|
|
||||||
|
autoPtr<compressible::RASModel> RASModel
|
||||||
|
(
|
||||||
|
compressible::RASModel::New
|
||||||
|
(
|
||||||
|
rho,
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
thermo()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
execFlowFunctionObjects(args, runTime);
|
||||||
|
}
|
||||||
|
else if (LESPropertiesHeader.headerOk())
|
||||||
|
{
|
||||||
|
IOdictionary LESProperties(LESPropertiesHeader);
|
||||||
|
|
||||||
|
autoPtr<compressible::LESModel> sgsModel
|
||||||
|
(
|
||||||
|
compressible::LESModel::New(rho, U, phi, thermo())
|
||||||
|
);
|
||||||
|
|
||||||
|
execFlowFunctionObjects(args, runTime);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IOdictionary transportProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar mu(transportProperties.lookup("mu"));
|
||||||
|
|
||||||
|
execFlowFunctionObjects(args, runTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn(args.executable())
|
||||||
|
<< "Incorrect dimensions of phi: " << phi.dimensions()
|
||||||
|
<< nl << exit(FatalError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,11 +57,17 @@ namespace Foam
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Foam::timeSelector::addOptions();
|
Foam::timeSelector::addOptions();
|
||||||
|
# include "addRegionOption.H"
|
||||||
Foam::argList::addBoolOption
|
Foam::argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noWrite",
|
"noWrite",
|
||||||
"suppress writing results"
|
"suppress writing results"
|
||||||
);
|
);
|
||||||
|
Foam::argList::addBoolOption
|
||||||
|
(
|
||||||
|
"noFlow",
|
||||||
|
"suppress creating flow models (execFlowFunctionObjects only)"
|
||||||
|
);
|
||||||
Foam::argList::addOption
|
Foam::argList::addOption
|
||||||
(
|
(
|
||||||
"dict",
|
"dict",
|
||||||
@ -72,7 +78,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
||||||
#include "createMesh.H"
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
forAll(timeDirs, timeI)
|
forAll(timeDirs, timeI)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user