32 void Foam::pressureGradientExplicitSource::writeGradP()
const
41 sourceName_ +
"Properties",
57 Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
59 const word& sourceName,
63 sourceName_(sourceName),
70 sourceName +
"Properties",
71 mesh_.time().constant(),
77 Ubar_(dict_.lookup(
"Ubar")),
78 gradPini_(dict_.lookup(
"gradPini")),
80 flowDir_(Ubar_/
mag(Ubar_)),
81 cellSource_(dict_.lookup(
"cellSource")),
88 dict_.subDict(cellSource_ +
"Coeffs")
94 sourceName_ +
"CellSet",
99 cellSelector_->applyToSet
113 mesh_.time().timeName()/
"uniform"/(sourceName_ +
"Properties")
116 if (propsFile.
good())
118 Info<<
" Reading pressure gradient from file" <<
endl;
120 propsDict.
lookup(
"gradient") >> gradP_;
123 Info<<
" Initial pressure gradient = " << gradP_ <<
nl <<
endl;
139 mesh_.time().timeName(),
153 label cellI = iter.key();
155 sourceField[cellI] = flowDir_*gradP_.value();
169 scalar magUbarAve = 0.0;
173 label cellI = iter.key();
175 scalar volCell = mesh_.V()[cellI];
178 magUbarAve += (flowDir_ & U_[cellI])*volCell;
179 rUAave += rUA[cellI]*volCell;
188 magUbarAve /= volTot;
193 scalar gradPplus = (
mag(Ubar_) - magUbarAve)/rUAave;
198 label cellI = iter.key();
199 U_[cellI] += flowDir_*rUA[cellI]*gradPplus;
203 gradP_.value() += gradPplus;
205 Info<<
"Uncorrected Ubar = " << magUbarAve <<
tab
206 <<
"Pressure gradient = " << gradP_.value() <<
endl;