mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Removed staticPressure and pressureCoefficient function objects - replaced by pressureTools
This commit is contained in:
@ -6,15 +6,9 @@ CourantNo/CourantNoFunctionObject.C
|
|||||||
dsmcFields/dsmcFields.C
|
dsmcFields/dsmcFields.C
|
||||||
dsmcFields/dsmcFieldsFunctionObject.C
|
dsmcFields/dsmcFieldsFunctionObject.C
|
||||||
|
|
||||||
pressureCoefficient/pressureCoefficient.C
|
|
||||||
pressureCoefficient/pressureCoefficientFunctionObject.C
|
|
||||||
|
|
||||||
pressureTools/pressureTools.C
|
pressureTools/pressureTools.C
|
||||||
pressureTools/pressureToolsFunctionObject.C
|
pressureTools/pressureToolsFunctionObject.C
|
||||||
|
|
||||||
staticPressure/staticPressure.C
|
|
||||||
staticPressure/staticPressureFunctionObject.C
|
|
||||||
|
|
||||||
timeActivatedFileUpdate/timeActivatedFileUpdate.C
|
timeActivatedFileUpdate/timeActivatedFileUpdate.C
|
||||||
timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
|
timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
|
||||||
|
|
||||||
|
|||||||
@ -1,49 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Typedef
|
|
||||||
Foam::IOpressureCoefficient
|
|
||||||
|
|
||||||
Description
|
|
||||||
Instance of the generic IOOutputFilter for pressureCoefficient.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef IOpressureCoefficient_H
|
|
||||||
#define IOpressureCoefficient_H
|
|
||||||
|
|
||||||
#include "pressureCoefficient.H"
|
|
||||||
#include "IOOutputFilter.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
typedef IOOutputFilter<pressureCoefficient> IOpressureCoefficient;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,161 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "pressureCoefficient.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::pressureCoefficient, 0);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField> Foam::pressureCoefficient::rho
|
|
||||||
(
|
|
||||||
const volScalarField& p
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (p.dimensions() == dimPressure)
|
|
||||||
{
|
|
||||||
return(obr_.lookupObject<volScalarField>(rhoName_));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
|
||||||
|
|
||||||
return tmp<volScalarField>
|
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rho",
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh
|
|
||||||
),
|
|
||||||
mesh,
|
|
||||||
dimensionedScalar("rho", dimless, 1.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::pressureCoefficient::pressureCoefficient
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const dictionary& dict,
|
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
|
||||||
active_(true),
|
|
||||||
pName_("p"),
|
|
||||||
rhoName_("rho"),
|
|
||||||
magUinf_(0.0)
|
|
||||||
{
|
|
||||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
active_ = false;
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"pressureCoefficient::pressureCoefficient"
|
|
||||||
"("
|
|
||||||
"const word&, "
|
|
||||||
"const objectRegistry&, "
|
|
||||||
"const dictionary&, "
|
|
||||||
"const bool"
|
|
||||||
")"
|
|
||||||
) << "No fvMesh available, deactivating." << nl
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::pressureCoefficient::~pressureCoefficient()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::pressureCoefficient::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
if (active_)
|
|
||||||
{
|
|
||||||
pName_ = dict.lookupOrDefault<word>("pName", "p");
|
|
||||||
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
|
|
||||||
|
|
||||||
dict.lookup("magUinf") >> magUinf_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::pressureCoefficient::execute()
|
|
||||||
{
|
|
||||||
// Do nothing - only valid on write
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::pressureCoefficient::end()
|
|
||||||
{
|
|
||||||
// Do nothing - only valid on write
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::pressureCoefficient::write()
|
|
||||||
{
|
|
||||||
if (active_)
|
|
||||||
{
|
|
||||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
|
||||||
|
|
||||||
volScalarField pressureCoefficient
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"pressureCoefficient",
|
|
||||||
obr_.time().timeName(),
|
|
||||||
obr_,
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
p/(0.5*rho(p)*sqr(magUinf_))
|
|
||||||
);
|
|
||||||
|
|
||||||
pressureCoefficient.write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,158 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::pressureCoefficient
|
|
||||||
|
|
||||||
Description
|
|
||||||
Calculates pressure coefficient, c_p
|
|
||||||
|
|
||||||
c_p = p/p_dyn,inf
|
|
||||||
|
|
||||||
where:
|
|
||||||
|
|
||||||
p_dyn,inf = 0.5*rho*mag(U_inf)^2
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
pressureCoefficient.C
|
|
||||||
IOpressureCoefficient.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef pressureCoefficient_H
|
|
||||||
#define pressureCoefficient_H
|
|
||||||
|
|
||||||
#include "volFieldsFwd.H"
|
|
||||||
#include "pointFieldFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
class dictionary;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class pressureCoefficient Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class pressureCoefficient
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Name of this set of pressureCoefficient objects
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- on/off switch
|
|
||||||
bool active_;
|
|
||||||
|
|
||||||
//- Name of pressure field, default is "p"
|
|
||||||
word pName_;
|
|
||||||
|
|
||||||
//- Name of density field (optional)
|
|
||||||
word rhoName_;
|
|
||||||
|
|
||||||
//- Free stream velocity magnitude [m/s]
|
|
||||||
scalar magUinf_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Return 1 if the pressure field is kinematic, i.e. p/rho
|
|
||||||
// otherwise return rho from database
|
|
||||||
tmp<volScalarField> rho(const volScalarField& p) const;
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
pressureCoefficient(const pressureCoefficient&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const pressureCoefficient&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("pressureCoefficient");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
pressureCoefficient
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry&,
|
|
||||||
const dictionary&,
|
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~pressureCoefficient();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
//- Return name of the set of pressureCoefficient
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the pressureCoefficient data
|
|
||||||
virtual void read(const dictionary&);
|
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
|
||||||
virtual void execute();
|
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
|
||||||
virtual void end();
|
|
||||||
|
|
||||||
//- Calculate the pressureCoefficient and write
|
|
||||||
virtual void write();
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const pointField&)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "pressureCoefficientFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineNamedTemplateTypeNameAndDebug(pressureCoefficientFunctionObject, 0);
|
|
||||||
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
functionObject,
|
|
||||||
pressureCoefficientFunctionObject,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Typedef
|
|
||||||
Foam::pressureCoefficientFunctionObject
|
|
||||||
|
|
||||||
Description
|
|
||||||
FunctionObject wrapper around pressureCoefficient to allow it to be created
|
|
||||||
via the functions entry within controlDict.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
pressureCoefficientFunctionObject.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef pressureCoefficientFunctionObject_H
|
|
||||||
#define pressureCoefficientFunctionObject_H
|
|
||||||
|
|
||||||
#include "pressureCoefficient.H"
|
|
||||||
#include "OutputFilterFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
typedef OutputFilterFunctionObject<pressureCoefficient>
|
|
||||||
pressureCoefficientFunctionObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Typedef
|
|
||||||
Foam::IOstaticPressure
|
|
||||||
|
|
||||||
Description
|
|
||||||
Instance of the generic IOOutputFilter for staticPressure.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef IOstaticPressure_H
|
|
||||||
#define IOstaticPressure_H
|
|
||||||
|
|
||||||
#include "staticPressure.H"
|
|
||||||
#include "IOOutputFilter.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
typedef IOOutputFilter<staticPressure> IOstaticPressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,154 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "staticPressure.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::staticPressure, 0);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::staticPressure::isKinematicPressure()
|
|
||||||
{
|
|
||||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
|
||||||
|
|
||||||
return p.dimensions() == sqr(dimLength)/sqr(dimTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::staticPressure::staticPressure
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const dictionary& dict,
|
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
|
||||||
active_(true),
|
|
||||||
pName_(dict.lookupOrDefault<word>("p", "p")),
|
|
||||||
rho_(readScalar(dict.lookup("rho")))
|
|
||||||
{
|
|
||||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
active_ = false;
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"staticPressure::staticPressure"
|
|
||||||
"("
|
|
||||||
"const word&, "
|
|
||||||
"const objectRegistry&, "
|
|
||||||
"const dictionary&, "
|
|
||||||
"const bool"
|
|
||||||
")"
|
|
||||||
) << "No fvMesh available, deactivating." << nl
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Check if the pressure is kinematic pressure, otherwise deactivate
|
|
||||||
if (!isKinematicPressure())
|
|
||||||
{
|
|
||||||
active_ = false;
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"staticPressure::staticPressure"
|
|
||||||
"("
|
|
||||||
"const word&, "
|
|
||||||
"const objectRegistry&, "
|
|
||||||
"const dictionary&, "
|
|
||||||
"const bool"
|
|
||||||
")"
|
|
||||||
) << "Pressure is not kinematic pressure, deactivating." << nl
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::staticPressure::~staticPressure()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::staticPressure::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
if (active_)
|
|
||||||
{
|
|
||||||
dict.readIfPresent("p", pName_);
|
|
||||||
dict.lookup("rho") >> rho_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::staticPressure::execute()
|
|
||||||
{
|
|
||||||
// Do nothing - only valid on write
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::staticPressure::end()
|
|
||||||
{
|
|
||||||
// Do nothing - only valid on write
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::staticPressure::write()
|
|
||||||
{
|
|
||||||
if (active_)
|
|
||||||
{
|
|
||||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
|
||||||
|
|
||||||
volScalarField pStatic
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"pStatic",
|
|
||||||
obr_.time().timeName(),
|
|
||||||
obr_,
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
dimensionedScalar("rho", dimDensity, rho_)*p
|
|
||||||
);
|
|
||||||
|
|
||||||
pStatic.write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,150 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::staticPressure
|
|
||||||
|
|
||||||
Description
|
|
||||||
Converts kinematic pressure to static pressure, from the name of the
|
|
||||||
pressure field, and density, i.e.
|
|
||||||
|
|
||||||
p_static = density*p_kinematic
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
staticPressure.C
|
|
||||||
IOstaticPressure.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef staticPressure_H
|
|
||||||
#define staticPressure_H
|
|
||||||
|
|
||||||
#include "pointFieldFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
class dictionary;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class staticPressure Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class staticPressure
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Name of this set of staticPressure objects
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- on/off switch
|
|
||||||
bool active_;
|
|
||||||
|
|
||||||
//- Name of pressure field, default is "p"
|
|
||||||
word pName_;
|
|
||||||
|
|
||||||
//- Density value
|
|
||||||
scalar rho_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Return true if the pressure field corresponds to kinematic pressure
|
|
||||||
bool isKinematicPressure();
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
staticPressure(const staticPressure&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const staticPressure&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("staticPressure");
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
staticPressure
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry&,
|
|
||||||
const dictionary&,
|
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~staticPressure();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
//- Return name of the set of staticPressure
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the staticPressure data
|
|
||||||
virtual void read(const dictionary&);
|
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
|
||||||
virtual void execute();
|
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
|
||||||
virtual void end();
|
|
||||||
|
|
||||||
//- Calculate the staticPressure and write
|
|
||||||
virtual void write();
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const pointField&)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "staticPressureFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineNamedTemplateTypeNameAndDebug(staticPressureFunctionObject, 0);
|
|
||||||
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
functionObject,
|
|
||||||
staticPressureFunctionObject,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Typedef
|
|
||||||
Foam::staticPressureFunctionObject
|
|
||||||
|
|
||||||
Description
|
|
||||||
FunctionObject wrapper around staticPressure to allow it to be created via
|
|
||||||
the functions entry within controlDict.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
staticPressureFunctionObject.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef staticPressureFunctionObject_H
|
|
||||||
#define staticPressureFunctionObject_H
|
|
||||||
|
|
||||||
#include "staticPressure.H"
|
|
||||||
#include "OutputFilterFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
typedef OutputFilterFunctionObject<staticPressure>
|
|
||||||
staticPressureFunctionObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Reference in New Issue
Block a user