From a367abb756eadff027d71853193d3990322e14dc Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 10 Nov 2008 11:55:16 +0000 Subject: [PATCH 01/59] write gradP to time/uniform for restarts --- .../pressureGradientExplicitSource.C | 69 +++++++++++++++---- .../pressureGradientExplicitSource.H | 11 ++- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C index 3783df0723..f7a1eee8e8 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C @@ -26,29 +26,55 @@ License #include "pressureGradientExplicitSource.H" #include "volFields.H" +#include "IFstream.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::pressureGradientExplicitSource::writeGradP() const +{ + // Only write on output time + if (mesh_.time().outputTime()) + { + IOdictionary propsDict + ( + IOobject + ( + sourceName_ + "Properties", + mesh_.time().timeName(), + "uniform", + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ) + ); + propsDict.add("gradient", gradP_); + propsDict.regIOobject::write(); + } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::pressureGradientExplicitSource::pressureGradientExplicitSource ( const word& sourceName, - const fvMesh& mesh, volVectorField& U ) : + sourceName_(sourceName), + mesh_(U.mesh()), + U_(U), dict_ ( IOobject ( sourceName + "Properties", - mesh.time().constant(), - mesh, + mesh_.time().constant(), + mesh_, IOobject::MUST_READ, IOobject::NO_WRITE ) ), - mesh_(mesh), - U_(U), Ubar_(dict_.lookup("Ubar")), gradPini_(readScalar(dict_.lookup("gradPini"))), gradP_(gradPini_), @@ -59,15 +85,15 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource topoSetSource::New ( cellSource_, - mesh, + mesh_, dict_.subDict(cellSource_ + "Coeffs") ) ), selectedCellSet_ ( - mesh, - "pressureGradientExplicitSourceCellSet", - mesh.nCells()/10 + 1 // Reasonable size estimate. + mesh_, + sourceName_ + "CellSet", + mesh_.nCells()/10 + 1 // Reasonable size estimate. ) { // Create the cell set @@ -78,9 +104,24 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource ); // Give some feedback - Info<< "pressureGradientExplicitSource(" << sourceName << ")" << nl - << "Selected " << returnReduce(selectedCellSet_.size(), sumOp