Renamed pressureGradientExplicitSource to meanVelocityForce

as it is the applied the force necessary to maintain the specified mean velocity
This commit is contained in:
Henry Weller
2015-06-30 19:13:16 +01:00
parent 1f7b3883ff
commit 256be2641f
5 changed files with 39 additions and 30 deletions

View File

@ -20,8 +20,8 @@ derivedSources=sources/derived
$(derivedSources)/actuationDiskSource/actuationDiskSource.C $(derivedSources)/actuationDiskSource/actuationDiskSource.C
$(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C $(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
$(derivedSources)/explicitPorositySource/explicitPorositySource.C $(derivedSources)/explicitPorositySource/explicitPorositySource.C
$(derivedSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C $(derivedSources)/meanVelocityForce/meanVelocityForce.C
$(derivedSources)/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C $(derivedSources)/meanVelocityForce/meanVelocityForceIO.C
$(derivedSources)/radialActuationDiskSource/radialActuationDiskSource.C $(derivedSources)/radialActuationDiskSource/radialActuationDiskSource.C
$(derivedSources)/rotorDiskSource/rotorDiskSource.C $(derivedSources)/rotorDiskSource/rotorDiskSource.C
$(derivedSources)/rotorDiskSource/bladeModel/bladeModel.C $(derivedSources)/rotorDiskSource/bladeModel/bladeModel.C

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pressureGradientExplicitSource.H" #include "meanVelocityForce.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "DimensionedField.H" #include "DimensionedField.H"
#include "IFstream.H" #include "IFstream.H"
@ -35,12 +35,12 @@ namespace Foam
{ {
namespace fv namespace fv
{ {
defineTypeNameAndDebug(pressureGradientExplicitSource, 0); defineTypeNameAndDebug(meanVelocityForce, 0);
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
option, option,
pressureGradientExplicitSource, meanVelocityForce,
dictionary dictionary
); );
} }
@ -49,7 +49,7 @@ namespace fv
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::fv::pressureGradientExplicitSource::writeProps void Foam::fv::meanVelocityForce::writeProps
( (
const scalar gradP const scalar gradP
) const ) const
@ -77,7 +77,7 @@ void Foam::fv::pressureGradientExplicitSource::writeProps
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::pressureGradientExplicitSource::pressureGradientExplicitSource Foam::fv::meanVelocityForce::meanVelocityForce
( (
const word& sourceName, const word& sourceName,
const word& modelType, const word& modelType,
@ -90,6 +90,7 @@ Foam::fv::pressureGradientExplicitSource::pressureGradientExplicitSource
gradP0_(0.0), gradP0_(0.0),
dGradP_(0.0), dGradP_(0.0),
flowDir_(Ubar_/mag(Ubar_)), flowDir_(Ubar_/mag(Ubar_)),
relaxation_(coeffs_.lookupOrDefault<scalar>("relaxation", 1.0)),
invAPtr_(NULL) invAPtr_(NULL)
{ {
coeffs_.lookup("fieldNames") >> fieldNames_; coeffs_.lookup("fieldNames") >> fieldNames_;
@ -98,8 +99,8 @@ Foam::fv::pressureGradientExplicitSource::pressureGradientExplicitSource
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::fv::pressureGradientExplicitSource::" "Foam::fv::meanVelocityForce::"
"pressureGradientExplicitSource" "meanVelocityForce"
"(" "("
"const word&, " "const word&, "
"const word&, " "const word&, "
@ -131,7 +132,7 @@ Foam::fv::pressureGradientExplicitSource::pressureGradientExplicitSource
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fv::pressureGradientExplicitSource::correct(volVectorField& U) void Foam::fv::meanVelocityForce::correct(volVectorField& U)
{ {
const scalarField& rAU = invAPtr_().internalField(); const scalarField& rAU = invAPtr_().internalField();
@ -155,9 +156,13 @@ void Foam::fv::pressureGradientExplicitSource::correct(volVectorField& U)
magUbarAve /= V_; magUbarAve /= V_;
rAUave /= V_; rAUave /= V_;
// magUbarAve =
// gSum((flowDir_ & U.boundaryField()[0])*mesh_.boundary()[0].magSf())
// /gSum(mesh_.boundary()[0].magSf());
// Calculate the pressure gradient increment needed to adjust the average // Calculate the pressure gradient increment needed to adjust the average
// flow-rate to the desired value // flow-rate to the desired value
dGradP_ = (mag(Ubar_) - magUbarAve)/rAUave; dGradP_ = relaxation_*(mag(Ubar_) - magUbarAve)/rAUave;
// Apply correction to velocity field // Apply correction to velocity field
forAll(cells_, i) forAll(cells_, i)
@ -175,7 +180,7 @@ void Foam::fv::pressureGradientExplicitSource::correct(volVectorField& U)
} }
void Foam::fv::pressureGradientExplicitSource::addSup void Foam::fv::meanVelocityForce::addSup
( (
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label fieldI const label fieldI
@ -203,7 +208,7 @@ void Foam::fv::pressureGradientExplicitSource::addSup
} }
void Foam::fv::pressureGradientExplicitSource::addSup void Foam::fv::meanVelocityForce::addSup
( (
const volScalarField& rho, const volScalarField& rho,
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
@ -214,7 +219,7 @@ void Foam::fv::pressureGradientExplicitSource::addSup
} }
void Foam::fv::pressureGradientExplicitSource::constrain void Foam::fv::meanVelocityForce::constrain
( (
fvMatrix<vector>& eqn, fvMatrix<vector>& eqn,
const label const label

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::fv::pressureGradientExplicitSource Foam::fv::meanVelocityForce
Description Description
Creates a pressure gradient source Creates a pressure gradient source
@ -32,23 +32,24 @@ Description
\heading Source usage \heading Source usage
Example usage: Example usage:
\verbatim \verbatim
pressureGradientExplicitSourceCoeffs meanVelocityForceCoeffs
{ {
fieldNames (U); // name of velocity field fieldNames (U); // name of velocity field
Ubar (10.0 0 0); // desired average velocity Ubar (10.0 0 0); // desired average velocity
gradPini gradPini [0 2 -2 0 0] 0; // initial pressure gradient gradPini gradPini [0 2 -2 0 0] 0; // initial pressure gradient
flowDir (1 0 0); // flow direction flowDir (1 0 0); // flow direction
relaxation 0.2; // Optional relaxation factor
} }
\endverbatim \endverbatim
SourceFiles SourceFiles
pressureGradientExplicitSource.C meanVelocityForce.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef pressureGradientExplicitSource_H #ifndef meanVelocityForce_H
#define pressureGradientExplicitSource_H #define meanVelocityForce_H
#include "autoPtr.H" #include "autoPtr.H"
#include "topoSetSource.H" #include "topoSetSource.H"
@ -65,10 +66,10 @@ namespace fv
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pressureGradientExplicitSource Declaration Class meanVelocityForce Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class pressureGradientExplicitSource class meanVelocityForce
: :
public cellSetOption public cellSetOption
{ {
@ -86,6 +87,9 @@ class pressureGradientExplicitSource
//- Flow direction //- Flow direction
vector flowDir_; vector flowDir_;
//- Relaxation factor
scalar relaxation_;
//- Matrix 1/A coefficients field pointer //- Matrix 1/A coefficients field pointer
autoPtr<volScalarField> invAPtr_; autoPtr<volScalarField> invAPtr_;
@ -99,22 +103,22 @@ class pressureGradientExplicitSource
void update(fvMatrix<vector>& eqn); void update(fvMatrix<vector>& eqn);
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
pressureGradientExplicitSource(const pressureGradientExplicitSource&); meanVelocityForce(const meanVelocityForce&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const pressureGradientExplicitSource&); void operator=(const meanVelocityForce&);
public: public:
//- Runtime type information //- Runtime type information
TypeName("pressureGradientExplicitSource"); TypeName("meanVelocityForce");
// Constructors // Constructors
//- Construct from explicit source name and mesh //- Construct from explicit source name and mesh
pressureGradientExplicitSource meanVelocityForce
( (
const word& sourceName, const word& sourceName,
const word& modelType, const word& modelType,

View File

@ -23,15 +23,15 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pressureGradientExplicitSource.H" #include "meanVelocityForce.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::fv::pressureGradientExplicitSource::read(const dictionary& dict) bool Foam::fv::meanVelocityForce::read(const dictionary& dict)
{ {
notImplemented notImplemented
( (
"bool Foam::fv::pressureGradientExplicitSource::read" "bool Foam::fv::meanVelocityForce::read"
"(" "("
"const dictionary&" "const dictionary&"
") const" ") const"

View File

@ -17,10 +17,10 @@ FoamFile
momentumSource momentumSource
{ {
type pressureGradientExplicitSource; type meanVelocityForce;
active yes; active yes;
pressureGradientExplicitSourceCoeffs meanVelocityForceCoeffs
{ {
selectionMode all; selectionMode all;