/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "hydrostaticPressure.H" #include "basicThermo.H" #include "uniformDimensionedFields.H" #include "volFields.H" #include "surfaceInterpolate.H" #include "fvcDiv.H" #include "fvmLaplacian.H" #include "fvcSnGrad.H" #include "constrainPressure.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { namespace functionObjects { defineTypeNameAndDebug(hydrostaticPressure, 0); addToRunTimeSelectionTable ( functionObject, hydrostaticPressure, dictionary ); } } Foam::dimensionedScalar Foam::functionObjects::hydrostaticPressure::pRef() const { if (pRefName_ == "none") { return dimensionedScalar(dimPressure, Zero); } else if (pRefName_ == "pInf") { return dimensionedScalar("pRef", dimPressure, pRefValue_); } else { return mesh_.lookupObject(pRefName_); } } void Foam::functionObjects::hydrostaticPressure::calculateAndWrite() { const auto& pRef = this->pRef(); const auto& U = mesh_.lookupObject(UName_); const auto& gh = mesh_.lookupObject(ghName_); const auto& ghf = mesh_.lookupObject(ghfName_); auto& rho = mesh_.lookupObjectRef(rhoName_); auto& thermo = mesh_.lookupObjectRef(basicThermo::dictName); auto& p_rgh = mesh_.lookupObjectRef(p_rghName_); auto& ph_rgh = mesh_.lookupObjectRef(ph_rghName_); auto& p = thermo.p(); Info<< "Performing hydrostatic pressure initialisation"; if (!mesh_.regionName().empty()) { Info<< " region=" << mesh_.name(); } if (thermo.incompressible()) { Info<< ": incompressible" << endl; // Constant density and temperature thermo.correct(); rho = thermo.rho(); p = ph_rgh + rho*gh + pRef; p_rgh = ph_rgh; } else { Info<< ": compressible" << endl; p = ph_rgh + rho*gh + pRef; thermo.correct(); rho = thermo.rho(); for (label i=0; i("pRefValue"); } return true; } return false; } bool Foam::functionObjects::hydrostaticPressure::execute() { return true; } bool Foam::functionObjects::hydrostaticPressure::write() { return true; } // ************************************************************************* //