/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ 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 . \*---------------------------------------------------------------------------*/ #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, volVectorField& U ) : sourceName_(sourceName), mesh_(U.mesh()), U_(U), dict_ ( IOobject ( sourceName + "Properties", mesh_.time().constant(), mesh_, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ), Ubar_(dict_.lookup("Ubar")), gradPini_(dict_.lookup("gradPini")), gradP_(gradPini_), flowDir_(Ubar_/mag(Ubar_)), cellSource_(dict_.lookup("cellSource")), cellSelector_ ( topoSetSource::New ( cellSource_, mesh_, dict_.subDict(cellSource_ + "Coeffs") ) ), selectedCellSet_ ( mesh_, sourceName_ + "CellSet", mesh_.nCells()/10 + 1 // Reasonable size estimate. ) { // Create the cell set cellSelector_->applyToSet ( topoSetSource::NEW, selectedCellSet_ ); // Give some feedback Info<< " Selected " << returnReduce(selectedCellSet_.size(), sumOp