Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "staticPressure.H"
00027 #include <finiteVolume/volFields.H>
00028 #include <OpenFOAM/dictionary.H>
00029
00030
00031
00032 namespace Foam
00033 {
00034 defineTypeNameAndDebug(staticPressure, 0);
00035 }
00036
00037
00038
00039 bool Foam::staticPressure::isKinematicPressure()
00040 {
00041 const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
00042
00043 return p.dimensions() == sqr(dimLength)/sqr(dimTime);
00044 }
00045
00046
00047
00048
00049 Foam::staticPressure::staticPressure
00050 (
00051 const word& name,
00052 const objectRegistry& obr,
00053 const dictionary& dict,
00054 const bool loadFromFiles
00055 )
00056 :
00057 name_(name),
00058 obr_(obr),
00059 active_(true),
00060 pName_(dict.lookupOrDefault<word>("p", "p")),
00061 rho_(readScalar(dict.lookup("rho")))
00062 {
00063
00064 if (!isA<fvMesh>(obr_))
00065 {
00066 active_ = false;
00067 WarningIn
00068 (
00069 "staticPressure::staticPressure"
00070 "(const objectRegistry&, const dictionary&)"
00071 ) << "No fvMesh available, deactivating." << nl
00072 << endl;
00073 }
00074 else
00075 {
00076
00077 if (!isKinematicPressure())
00078 {
00079 active_ = false;
00080 WarningIn
00081 (
00082 "staticPressure::staticPressure"
00083 "(const objectRegistry&, const dictionary&)"
00084 ) << "Pressure is not kinematic pressure, deactivating." << nl
00085 << endl;
00086 }
00087 }
00088
00089 read(dict);
00090 }
00091
00092
00093
00094
00095 Foam::staticPressure::~staticPressure()
00096 {}
00097
00098
00099
00100
00101 void Foam::staticPressure::read(const dictionary& dict)
00102 {
00103 if (active_)
00104 {
00105 dict.readIfPresent("p", pName_);
00106 dict.lookup("rho") >> rho_;
00107 }
00108 }
00109
00110
00111 void Foam::staticPressure::execute()
00112 {
00113
00114 }
00115
00116
00117 void Foam::staticPressure::end()
00118 {
00119
00120 }
00121
00122
00123 void Foam::staticPressure::write()
00124 {
00125 if (active_)
00126 {
00127 const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
00128
00129 volScalarField pStatic
00130 (
00131 IOobject
00132 (
00133 "pStatic",
00134 obr_.time().timeName(),
00135 obr_,
00136 IOobject::NO_READ
00137 ),
00138 dimensionedScalar("rho", dimDensity, rho_)*p
00139 );
00140
00141 pStatic.write();
00142 }
00143 }
00144
00145
00146