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