ENH: Updated construction/retrieval of gravity field. See #1094

This commit is contained in:
Andrew Heather
2018-11-14 21:49:32 +00:00
parent 1a4fceec20
commit d1bc53b77e
28 changed files with 116 additions and 165 deletions

View File

@ -3,7 +3,6 @@ PtrList<rhoThermo> thermoFluid(fluidRegions.size());
PtrList<volScalarField> rhoFluid(fluidRegions.size()); PtrList<volScalarField> rhoFluid(fluidRegions.size());
PtrList<volVectorField> UFluid(fluidRegions.size()); PtrList<volVectorField> UFluid(fluidRegions.size());
PtrList<surfaceScalarField> phiFluid(fluidRegions.size()); PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
PtrList<uniformDimensionedScalarField> hRefFluid(fluidRegions.size()); PtrList<uniformDimensionedScalarField> hRefFluid(fluidRegions.size());
PtrList<volScalarField> ghFluid(fluidRegions.size()); PtrList<volScalarField> ghFluid(fluidRegions.size());
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size()); PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
@ -22,6 +21,8 @@ PtrList<dimensionedScalar> rhoMin(fluidRegions.size());
PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size()); PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size());
PtrList<fv::options> fluidFvOptions(fluidRegions.size()); PtrList<fv::options> fluidFvOptions(fluidRegions.size());
const uniformDimensionedVectorField& g = meshObjects::gravity::New(runTime);
// Populate fluid field pointer lists // Populate fluid field pointer lists
forAll(fluidRegions, i) forAll(fluidRegions, i)
{ {
@ -91,23 +92,6 @@ forAll(fluidRegions, i)
) )
); );
Info<< " Adding to gFluid\n" << endl;
gFluid.set
(
i,
new uniformDimensionedVectorField
(
IOobject
(
"g",
runTime.constant(),
fluidRegions[i],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
Info<< " Adding to hRefFluid\n" << endl; Info<< " Adding to hRefFluid\n" << endl;
hRefFluid.set hRefFluid.set
( (
@ -128,10 +112,9 @@ forAll(fluidRegions, i)
dimensionedScalar ghRef dimensionedScalar ghRef
( (
mag(gFluid[i].value()) > SMALL mag(g.value()) > SMALL
? gFluid[i] ? g & (cmptMag(g.value())/mag(g.value()))*hRefFluid[i]
& (cmptMag(gFluid[i].value())/mag(gFluid[i].value()))*hRefFluid[i] : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
: dimensionedScalar("ghRef", gFluid[i].dimensions()*dimLength, 0)
); );
Info<< " Adding to ghFluid\n" << endl; Info<< " Adding to ghFluid\n" << endl;
@ -141,7 +124,7 @@ forAll(fluidRegions, i)
new volScalarField new volScalarField
( (
"gh", "gh",
(gFluid[i] & fluidRegions[i].C()) - ghRef (g & fluidRegions[i].C()) - ghRef
) )
); );
@ -152,7 +135,7 @@ forAll(fluidRegions, i)
new surfaceScalarField new surfaceScalarField
( (
"ghf", "ghf",
(gFluid[i] & fluidRegions[i].Cf()) - ghRef (g & fluidRegions[i].Cf()) - ghRef
) )
); );

View File

@ -14,7 +14,6 @@
volScalarField& p_rgh = p_rghFluid[i]; volScalarField& p_rgh = p_rghFluid[i];
const dimensionedVector& g = gFluid[i];
const volScalarField& gh = ghFluid[i]; const volScalarField& gh = ghFluid[i];
const surfaceScalarField& ghf = ghfFluid[i]; const surfaceScalarField& ghf = ghfFluid[i];

View File

@ -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) 2014-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,6 +25,7 @@ License
#include "phasePair.H" #include "phasePair.H"
#include "surfaceTensionModel.H" #include "surfaceTensionModel.H"
#include "gravityMeshObject.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -53,7 +54,7 @@ Foam::phasePair::phasePair
phasePairKey(phase1.name(), phase2.name(), ordered), phasePairKey(phase1.name(), phase2.name(), ordered),
phase1_(phase1), phase1_(phase1),
phase2_(phase2), phase2_(phase2),
g_(phase1.mesh().lookupObject<uniformDimensionedVectorField>("g")) g_(meshObjects::gravity::New(phase1.db().time()))
{} {}

View File

@ -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) 2016-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,7 @@ License
#include "KocamustafaogullariIshii.H" #include "KocamustafaogullariIshii.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
#include "compressibleTurbulenceModel.H" #include "compressibleTurbulenceModel.H"
#include "ThermalDiffusivity.H" #include "ThermalDiffusivity.H"
#include "PhaseCompressibleTurbulenceModel.H" #include "PhaseCompressibleTurbulenceModel.H"
@ -87,7 +87,7 @@ KocamustafaogullariIshii::dDeparture
{ {
// Gravitational acceleration // Gravitational acceleration
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
liquid.mesh().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(liquid.mesh().time());
const fvPatchScalarField& rhoLiquid = const fvPatchScalarField& rhoLiquid =
liquid.turbulence().rho().boundaryField()[patchi]; liquid.turbulence().rho().boundaryField()[patchi];

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,7 @@ License
#include "Cole.H" #include "Cole.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
#include "compressibleTurbulenceModel.H" #include "compressibleTurbulenceModel.H"
#include "ThermalDiffusivity.H" #include "ThermalDiffusivity.H"
#include "PhaseCompressibleTurbulenceModel.H" #include "PhaseCompressibleTurbulenceModel.H"
@ -52,8 +52,10 @@ namespace departureFrequencyModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureFrequencyModels:: Foam::wallBoilingModels::departureFrequencyModels::Cole::Cole
Cole::Cole(const dictionary& dict) (
const dictionary& dict
)
: :
departureFrequencyModel() departureFrequencyModel()
{} {}
@ -61,16 +63,14 @@ Cole::Cole(const dictionary& dict)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureFrequencyModels:: Foam::wallBoilingModels::departureFrequencyModels::Cole::~Cole()
Cole::~Cole()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::tmp<Foam::scalarField>
Foam::wallBoilingModels::departureFrequencyModels:: Foam::wallBoilingModels::departureFrequencyModels::Cole::fDeparture
Cole::fDeparture
( (
const phaseModel& liquid, const phaseModel& liquid,
const phaseModel& vapor, const phaseModel& vapor,
@ -80,7 +80,7 @@ Cole::fDeparture
{ {
// Gravitational acceleration // Gravitational acceleration
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
liquid.mesh().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(liquid.mesh().time());
const fvPatchScalarField& rhoLiquid = const fvPatchScalarField& rhoLiquid =
liquid.turbulence().rho().boundaryField()[patchi]; liquid.turbulence().rho().boundaryField()[patchi];

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,7 +26,7 @@ License
#include "IATEsource.H" #include "IATEsource.H"
#include "fvMatrix.H" #include "fvMatrix.H"
#include "phaseCompressibleTurbulenceModel.H" #include "phaseCompressibleTurbulenceModel.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -54,12 +54,12 @@ Foam::diameterModels::IATEsource::New
if (!cstrIter.found()) if (!cstrIter.found())
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict)
<< "Unknown IATE source type " << "Unknown IATE source type "
<< type << nl << nl << type << nl << nl
<< "Valid IATE source types :" << endl << "Valid IATE source types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalIOError);
} }
return autoPtr<IATEsource>(cstrIter()(iate, dict)); return autoPtr<IATEsource>(cstrIter()(iate, dict));
@ -71,7 +71,7 @@ Foam::diameterModels::IATEsource::New
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ur() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ur() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
phase().db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(phase().db().time());
return return
sqrt(2.0) sqrt(2.0)
@ -84,16 +84,19 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ur() const
*pow(max(1 - phase(), scalar(0)), 1.75); *pow(max(1 - phase(), scalar(0)), 1.75);
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ut() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ut() const
{ {
return sqrt(2*otherPhase().turbulence().k()); return sqrt(2*otherPhase().turbulence().k());
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Re() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Re() const
{ {
return max(Ur()*phase().d()/otherPhase().nu(), scalar(1.0e-3)); return max(Ur()*phase().d()/otherPhase().nu(), scalar(1.0e-3));
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::CD() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::CD() const
{ {
const volScalarField Eo(this->Eo()); const volScalarField Eo(this->Eo());
@ -111,10 +114,11 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::CD() const
); );
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Mo() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Mo() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
phase().db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(phase().db().time());
return return
mag(g)*pow4(otherPhase().nu())*sqr(otherPhase().rho()) mag(g)*pow4(otherPhase().nu())*sqr(otherPhase().rho())
@ -122,10 +126,11 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Mo() const
/pow3(fluid().sigma()); /pow3(fluid().sigma());
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Eo() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Eo() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
phase().db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(phase().db().time());
return return
mag(g)*sqr(phase().d()) mag(g)*sqr(phase().d())
@ -133,6 +138,7 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Eo() const
/fluid().sigma(); /fluid().sigma();
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::We() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::We() const
{ {
return return

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,7 +27,7 @@ License
#include "twoPhaseSystem.H" #include "twoPhaseSystem.H"
#include "fvMatrix.H" #include "fvMatrix.H"
#include "PhaseCompressibleTurbulenceModel.H" #include "PhaseCompressibleTurbulenceModel.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -55,12 +55,12 @@ Foam::diameterModels::IATEsource::New
if (!cstrIter.found()) if (!cstrIter.found())
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict)
<< "Unknown IATE source type " << "Unknown IATE source type "
<< type << nl << nl << type << nl << nl
<< "Valid IATE source types :" << endl << "Valid IATE source types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalIOError);
} }
return autoPtr<IATEsource>(cstrIter()(iate, dict)); return autoPtr<IATEsource>(cstrIter()(iate, dict));
@ -72,7 +72,7 @@ Foam::diameterModels::IATEsource::New
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ur() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ur() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
phase().U().db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(phase().U().time());
return return
sqrt(2.0) sqrt(2.0)
@ -85,16 +85,19 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ur() const
*pow(max(1 - phase(), scalar(0)), 1.75); *pow(max(1 - phase(), scalar(0)), 1.75);
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ut() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Ut() const
{ {
return sqrt(2*otherPhase().turbulence().k()); return sqrt(2*otherPhase().turbulence().k());
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Re() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Re() const
{ {
return max(Ur()*phase().d()/otherPhase().nu(), scalar(1.0e-3)); return max(Ur()*phase().d()/otherPhase().nu(), scalar(1.0e-3));
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::CD() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::CD() const
{ {
const volScalarField Eo(this->Eo()); const volScalarField Eo(this->Eo());
@ -112,10 +115,11 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::CD() const
); );
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Mo() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Mo() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
phase().U().db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(phase().U().time());
return return
mag(g)*pow4(otherPhase().nu())*sqr(otherPhase().rho()) mag(g)*pow4(otherPhase().nu())*sqr(otherPhase().rho())
@ -123,10 +127,11 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Mo() const
/pow3(fluid().sigma()); /pow3(fluid().sigma());
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Eo() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Eo() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
phase().U().db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(phase().U().time());
return return
mag(g)*sqr(phase().d()) mag(g)*sqr(phase().d())
@ -134,6 +139,7 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::Eo() const
/fluid().sigma(); /fluid().sigma();
} }
Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::We() const Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATEsource::We() const
{ {
return otherPhase().rho()*sqr(Ur())*phase().d()/fluid().sigma(); return otherPhase().rho()*sqr(Ur())*phase().d()/fluid().sigma();

View File

@ -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) 2014-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "buoyantKEpsilon.H" #include "buoyantKEpsilon.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
#include "fvcGrad.H" #include "fvcGrad.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
@ -102,8 +102,7 @@ tmp<volScalarField>
buoyantKEpsilon<BasicTurbulenceModel>::Gcoef() const buoyantKEpsilon<BasicTurbulenceModel>::Gcoef() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
this->mesh_.objectRegistry::template meshObjects::gravity::New(this->mesh_.time());
lookupObject<uniformDimensionedVectorField>("g");
return return
(Cg_*this->Cmu_)*this->alpha_*this->k_*(g & fvc::grad(this->rho_)) (Cg_*this->Cmu_)*this->alpha_*this->k_*(g & fvc::grad(this->rho_))
@ -116,8 +115,7 @@ tmp<fvScalarMatrix>
buoyantKEpsilon<BasicTurbulenceModel>::kSource() const buoyantKEpsilon<BasicTurbulenceModel>::kSource() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
this->mesh_.objectRegistry::template meshObjects::gravity::New(this->mesh_.time());
lookupObject<uniformDimensionedVectorField>("g");
if (mag(g.value()) > SMALL) if (mag(g.value()) > SMALL)
{ {
@ -135,8 +133,7 @@ tmp<fvScalarMatrix>
buoyantKEpsilon<BasicTurbulenceModel>::epsilonSource() const buoyantKEpsilon<BasicTurbulenceModel>::epsilonSource() const
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
this->mesh_.objectRegistry::template meshObjects::gravity::New(this->mesh_.time());
lookupObject<uniformDimensionedVectorField>("g");
if (mag(g.value()) > SMALL) if (mag(g.value()) > SMALL)
{ {

View File

@ -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) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,7 +28,7 @@ License
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -145,7 +145,7 @@ void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs()
); );
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(db().time());
// scalar rhor = 1000; // scalar rhor = 1000;
// scalarField alphap1 = max(min(alphap, scalar(1)), scalar(0)); // scalarField alphap1 = max(min(alphap, scalar(1)), scalar(0));

View File

@ -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) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,7 +27,7 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -150,7 +150,7 @@ void Foam::prghPressureFvPatchScalarField::updateCoeffs()
); );
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(db().time());
const uniformDimensionedScalarField& hRef = const uniformDimensionedScalarField& hRef =
db().lookupObject<uniformDimensionedScalarField>("hRef"); db().lookupObject<uniformDimensionedScalarField>("hRef");

View File

@ -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) 2015-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,12 +28,11 @@ License
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::prghTotalPressureFvPatchScalarField:: Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField
prghTotalPressureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -47,8 +46,7 @@ prghTotalPressureFvPatchScalarField
{} {}
Foam::prghTotalPressureFvPatchScalarField:: Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField
prghTotalPressureFvPatchScalarField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF, const DimensionedField<scalar, volMesh>& iF,
@ -75,8 +73,7 @@ prghTotalPressureFvPatchScalarField
} }
Foam::prghTotalPressureFvPatchScalarField:: Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField
prghTotalPressureFvPatchScalarField
( (
const prghTotalPressureFvPatchScalarField& ptf, const prghTotalPressureFvPatchScalarField& ptf,
const fvPatch& p, const fvPatch& p,
@ -92,8 +89,7 @@ prghTotalPressureFvPatchScalarField
{} {}
Foam::prghTotalPressureFvPatchScalarField:: Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField
prghTotalPressureFvPatchScalarField
( (
const prghTotalPressureFvPatchScalarField& ptf const prghTotalPressureFvPatchScalarField& ptf
) )
@ -106,8 +102,7 @@ prghTotalPressureFvPatchScalarField
{} {}
Foam::prghTotalPressureFvPatchScalarField:: Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField
prghTotalPressureFvPatchScalarField
( (
const prghTotalPressureFvPatchScalarField& ptf, const prghTotalPressureFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
@ -165,7 +160,7 @@ void Foam::prghTotalPressureFvPatchScalarField::updateCoeffs()
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField, vector>(UName_);
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(db().time());
const uniformDimensionedScalarField& hRef = const uniformDimensionedScalarField& hRef =
db().lookupObject<uniformDimensionedScalarField>("hRef"); db().lookupObject<uniformDimensionedScalarField>("hRef");

View File

@ -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 | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,8 +27,7 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "gravityMeshObject.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -126,7 +125,7 @@ void Foam::uniformDensityHydrostaticPressureFvPatchScalarField::updateCoeffs()
} }
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(db().time());
operator== operator==
( (

View File

@ -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 | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,7 +28,7 @@ License
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
#include "EulerDdtScheme.H" #include "EulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H" #include "CrankNicolsonDdtScheme.H"
#include "backwardDdtScheme.H" #include "backwardDdtScheme.H"
@ -143,22 +143,22 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
const scalar dt = db().time().deltaTValue(); const scalar dt = db().time().deltaTValue();
// retrieve non-const access to zeta field from the database // Retrieve non-const access to zeta field from the database
volVectorField& zeta = db().lookupObjectRef<volVectorField>(zetaName_); volVectorField& zeta = db().lookupObjectRef<volVectorField>(zetaName_);
vectorField& zetap = zeta.boundaryFieldRef()[patchi]; vectorField& zetap = zeta.boundaryFieldRef()[patchi];
// lookup d/dt scheme from database for zeta // Lookup d/dt scheme from database for zeta
const word ddtSchemeName(zeta.mesh().ddtScheme(zeta.name())); const word ddtSchemeName(zeta.mesh().ddtScheme(zeta.name()));
ddtSchemeType ddtScheme(ddtSchemeTypeNames_[ddtSchemeName]); ddtSchemeType ddtScheme(ddtSchemeTypeNames_[ddtSchemeName]);
// retrieve the flux field from the database // Retrieve the flux field from the database
const surfaceScalarField& phi = const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_); db().lookupObject<surfaceScalarField>(phiName_);
// cache the patch face-normal vectors // Cache the patch face-normal vectors
tmp<vectorField> nf(patch().nf()); tmp<vectorField> nf(patch().nf());
// change in zeta due to flux // Change in zeta due to flux
vectorField dZetap(dt*nf()*phi.boundaryField()[patchi]/patch().magSf()); vectorField dZetap(dt*nf()*phi.boundaryField()[patchi]/patch().magSf());
if (phi.dimensions() == dimDensity*dimVelocity*dimArea) if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
@ -212,9 +212,9 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
Info<< "min/max zetap = " << gMin(zetap & nf()) << ", " Info<< "min/max zetap = " << gMin(zetap & nf()) << ", "
<< gMax(zetap & nf()) << endl; << gMax(zetap & nf()) << endl;
// update the surface pressure // Update the surface pressure
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(db().time());
operator==(-g.value() & zetap); operator==(-g.value() & zetap);

View File

@ -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) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,6 +25,7 @@ License
#include "icoUncoupledKinematicCloud.H" #include "icoUncoupledKinematicCloud.H"
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "gravityMeshObject.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -54,18 +55,7 @@ Foam::functionObjects::icoUncoupledKinematicCloud::icoUncoupledKinematicCloud
) )
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
g_ g_(meshObjects::gravity::New(time_)),
(
IOobject
(
"g",
time_.constant(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
dimensionedVector("g", dimAcceleration, Zero) // Needs name
),
laminarTransport_ laminarTransport_
( (
mesh_.lookupObject<singlePhaseTransportModel>("transportProperties") mesh_.lookupObject<singlePhaseTransportModel>("transportProperties")

View File

@ -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) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,6 +25,7 @@ License
#include "buoyancyEnergy.H" #include "buoyancyEnergy.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "gravityMeshObject.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -80,7 +81,7 @@ void Foam::fv::buoyancyEnergy::addSup
) )
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
mesh_.lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(mesh_.time());
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_); const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);

View File

@ -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) 2015-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,6 +26,7 @@ License
#include "buoyancyForce.H" #include "buoyancyForce.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "gravityMeshObject.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
@ -56,17 +57,7 @@ Foam::fv::buoyancyForce::buoyancyForce
) )
: :
option(sourceName, modelType, dict, mesh), option(sourceName, modelType, dict, mesh),
g_ g_(meshObjects::gravity::New(mesh.time()))
(
IOobject
(
"g",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
{ {
coeffs_.readEntry("fields", fieldNames_); coeffs_.readEntry("fields", fieldNames_);

View File

@ -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) 2014-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,7 +26,7 @@ License
#include "solidificationMeltingSource.H" #include "solidificationMeltingSource.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "basicThermo.H" #include "basicThermo.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "extrapolatedCalculatedFvPatchFields.H" #include "extrapolatedCalculatedFvPatchFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
@ -120,19 +120,6 @@ Foam::fv::solidificationMeltingSource::Cp() const
} }
Foam::vector Foam::fv::solidificationMeltingSource::g() const
{
if (mesh_.foundObject<uniformDimensionedVectorField>("g"))
{
const uniformDimensionedVectorField& value =
mesh_.lookupObject<uniformDimensionedVectorField>("g");
return value.value();
}
return coeffs_.get<vector>("g");
}
void Foam::fv::solidificationMeltingSource::update(const volScalarField& Cp) void Foam::fv::solidificationMeltingSource::update(const volScalarField& Cp)
{ {
if (curTimeIndex_ == mesh_.time().timeIndex()) if (curTimeIndex_ == mesh_.time().timeIndex())
@ -276,7 +263,7 @@ void Foam::fv::solidificationMeltingSource::addSup
update(Cp); update(Cp);
vector g = this->g(); const vector& g = meshObjects::gravity::New(mesh_.time()).value();
scalarField& Sp = eqn.diag(); scalarField& Sp = eqn.diag();
vectorField& Su = eqn.source(); vectorField& Su = eqn.source();

View File

@ -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) 2014-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -180,9 +180,6 @@ private:
//- Return the specific heat capacity field //- Return the specific heat capacity field
tmp<volScalarField> Cp() const; tmp<volScalarField> Cp() const;
//- Return the gravity vector
vector g() const;
//- Update the model //- Update the model
void update(const volScalarField& Cp); void update(const volScalarField& Cp);

View File

@ -64,9 +64,9 @@ Foam::fv::tabulatedAccelerationSource::tabulatedAccelerationSource
fieldNames_.setSize(1, UName_); fieldNames_.setSize(1, UName_);
applied_.setSize(1, false); applied_.setSize(1, false);
if (mesh.foundObject<uniformDimensionedVectorField>("g")) if (mesh.time().foundObject<uniformDimensionedVectorField>("g"))
{ {
g0_ = mesh.lookupObject<uniformDimensionedVectorField>("g"); g0_ = mesh.time().lookupObject<uniformDimensionedVectorField>("g");
} }
} }

View File

@ -41,10 +41,10 @@ void Foam::fv::tabulatedAccelerationSource::addSup
Vector<vector> acceleration(motion_.acceleration()); Vector<vector> acceleration(motion_.acceleration());
// If gravitational force is present combine with the linear acceleration // If gravitational force is present combine with the linear acceleration
if (mesh_.foundObject<uniformDimensionedVectorField>("g")) if (mesh_.time().foundObject<uniformDimensionedVectorField>("g"))
{ {
uniformDimensionedVectorField& g = uniformDimensionedVectorField& g =
mesh_.lookupObjectRef<uniformDimensionedVectorField>("g"); mesh_.time().lookupObjectRef<uniformDimensionedVectorField>("g");
const uniformDimensionedScalarField& hRef = const uniformDimensionedScalarField& hRef =
mesh_.lookupObject<uniformDimensionedScalarField>("hRef"); mesh_.lookupObject<uniformDimensionedScalarField>("hRef");

View File

@ -241,10 +241,10 @@ void Foam::rigidBodyMeshMotion::solve()
const scalar ramp = ramp_->value(t.value()); const scalar ramp = ramp_->value(t.value());
if (db().foundObject<uniformDimensionedVectorField>("g")) if (t.foundObject<uniformDimensionedVectorField>("g"))
{ {
model_.g() = model_.g() =
ramp*db().lookupObject<uniformDimensionedVectorField>("g").value(); ramp*t.lookupObject<uniformDimensionedVectorField>("g").value();
} }
if (test_) if (test_)

View File

@ -189,10 +189,9 @@ void Foam::rigidBodyMeshMotionSolver::solve()
curTimeIndex_ = this->db().time().timeIndex(); curTimeIndex_ = this->db().time().timeIndex();
} }
if (db().foundObject<uniformDimensionedVectorField>("g")) if (t.foundObject<uniformDimensionedVectorField>("g"))
{ {
model_.g() = model_.g() = t.lookupObject<uniformDimensionedVectorField>("g").value();
db().lookupObject<uniformDimensionedVectorField>("g").value();
} }
if (test_) if (test_)

View File

@ -174,7 +174,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
if (lookupGravity_ < 0) if (lookupGravity_ < 0)
{ {
if (db().foundObject<uniformDimensionedVectorField>("g")) if (db().time().foundObject<uniformDimensionedVectorField>("g"))
{ {
if (lookupGravity_ == -2) if (lookupGravity_ == -2)
{ {
@ -225,7 +225,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
if (lookupGravity_ == 1) if (lookupGravity_ == 1)
{ {
uniformDimensionedVectorField g = uniformDimensionedVectorField g =
db().lookupObject<uniformDimensionedVectorField>("g"); db().time().lookupObject<uniformDimensionedVectorField>("g");
g_ = g.value(); g_ = g.value();
} }

View File

@ -162,10 +162,10 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
vector gravity = Zero; vector gravity = Zero;
if (db().foundObject<uniformDimensionedVectorField>("g")) if (db().time().foundObject<uniformDimensionedVectorField>("g"))
{ {
uniformDimensionedVectorField g = uniformDimensionedVectorField g =
db().lookupObject<uniformDimensionedVectorField>("g"); db().time().lookupObject<uniformDimensionedVectorField>("g");
gravity = g.value(); gravity = g.value();
} }

View File

@ -189,9 +189,9 @@ void Foam::sixDoFRigidBodyMotionSolver::solve()
dimensionedVector g("g", dimAcceleration, Zero); dimensionedVector g("g", dimAcceleration, Zero);
if (db().foundObject<uniformDimensionedVectorField>("g")) if (db().time().foundObject<uniformDimensionedVectorField>("g"))
{ {
g = db().lookupObject<uniformDimensionedVectorField>("g"); g = db().time().lookupObject<uniformDimensionedVectorField>("g");
} }
else else
{ {

View File

@ -28,7 +28,7 @@ License
#include "vectorList.H" #include "vectorList.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "boundaryRadiationProperties.H" #include "boundaryRadiationProperties.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
#include "cyclicAMIPolyPatch.H" #include "cyclicAMIPolyPatch.H"
#include "mappedPatchBase.H" #include "mappedPatchBase.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
@ -298,10 +298,10 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
{ {
verticalDir_.normalise(); verticalDir_.normalise();
} }
else if (mesh_.foundObject<uniformDimensionedVectorField>("g")) else
{ {
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
mesh_.lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(mesh_.time());
verticalDir_ = (-g/mag(g)).value(); verticalDir_ = (-g/mag(g)).value();
} }

View File

@ -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 | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -28,7 +28,7 @@ License
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -141,7 +141,7 @@ void Foam::alphaFixedPressureFvPatchScalarField::updateCoeffs()
} }
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
db().lookupObject<uniformDimensionedVectorField>("g"); meshObjects::gravity::New(db().time());
const fvPatchField<scalar>& rho = const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>("rho"); patch().lookupPatchField<volScalarField, scalar>("rho");

View File

@ -26,7 +26,7 @@ License
#include "waveModel.H" #include "waveModel.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "polyPatch.H" #include "polyPatch.H"
#include "uniformDimensionedFields.H" #include "gravityMeshObject.H"
#include "volFields.H" #include "volFields.H"
#include "fvPatchFields.H" #include "fvPatchFields.H"
@ -261,7 +261,7 @@ Foam::waveModel::waveModel
), ),
mesh_(mesh), mesh_(mesh),
patch_(patch), patch_(patch),
g_(mesh.lookupObject<uniformDimensionedVectorField>("g").value()), g_(meshObjects::gravity::New(mesh.time()).value()),
UName_("U"), UName_("U"),
alphaName_("alpha"), alphaName_("alpha"),
Rgl_(tensor::I), Rgl_(tensor::I),