Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
commit
a4234529cc
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -134,17 +134,17 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
|
||||
int dir = 2*direction_ - 1;
|
||||
|
||||
// Average volumetric flow rate
|
||||
scalar aveFlowRate = 0;
|
||||
scalar volFlowRate = 0;
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
{
|
||||
aveFlowRate = dir*gSum(phip)/gSum(patch().magSf());
|
||||
volFlowRate = dir*gSum(phip);
|
||||
}
|
||||
else if (phi.dimensions() == dimVelocity*dimArea*dimDensity)
|
||||
{
|
||||
const scalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName());
|
||||
aveFlowRate = dir*gSum(phip/rhop)/gSum(patch().magSf());
|
||||
volFlowRate = dir*gSum(phip/rhop);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -157,7 +157,7 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
|
||||
}
|
||||
|
||||
// Pressure drop for this flow rate
|
||||
const scalar pdFan = fanCurve_(max(aveFlowRate, 0.0));
|
||||
const scalar pdFan = fanCurve_(max(volFlowRate, 0.0));
|
||||
|
||||
totalPressureFvPatchScalarField::updateCoeffs
|
||||
(
|
||||
|
@ -79,14 +79,6 @@ void Foam::removeRegisteredObject::execute()
|
||||
delete &obj;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn("Foam::removeRegisteredObject::write()")
|
||||
<< "Object " << objectNames_[i] << " not found in "
|
||||
<< "database. Available objects:" << nl << obr_.sortedToc()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,20 +85,6 @@ bool Foam::turbulenceFields::compressible()
|
||||
}
|
||||
|
||||
|
||||
Foam::IOobject Foam::turbulenceFields::io(const word& fieldName) const
|
||||
{
|
||||
return
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
obr_.time().timeName(),
|
||||
obr_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::turbulenceFields::turbulenceFields
|
||||
@ -147,7 +133,22 @@ void Foam::turbulenceFields::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
fieldSet_.insert(wordList(dict.lookup("fields")));
|
||||
|
||||
Info<< type() << ": ";
|
||||
if (fieldSet_.size())
|
||||
{
|
||||
Info<< "storing fields:" << nl;
|
||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||
{
|
||||
Info<< " " << modelName << "::" << iter.key() << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "no fields requested to be stored" << nl << endl;
|
||||
}
|
||||
|
||||
execute();
|
||||
}
|
||||
@ -168,9 +169,9 @@ void Foam::turbulenceFields::execute()
|
||||
const compressible::turbulenceModel& model =
|
||||
obr_.lookupObject<compressible::turbulenceModel>(modelName);
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||
{
|
||||
const word& f = fieldSet_[fieldI];
|
||||
const word& f = iter.key();
|
||||
switch (compressibleFieldNames_[f])
|
||||
{
|
||||
case cfR:
|
||||
@ -216,9 +217,9 @@ void Foam::turbulenceFields::execute()
|
||||
const incompressible::turbulenceModel& model =
|
||||
obr_.lookupObject<incompressible::turbulenceModel>(modelName);
|
||||
|
||||
forAll(fieldSet_, fieldI)
|
||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||
{
|
||||
const word& f = fieldSet_[fieldI];
|
||||
const word& f = iter.key();
|
||||
switch (incompressibleFieldNames_[f])
|
||||
{
|
||||
case ifR:
|
||||
|
@ -27,16 +27,20 @@ Class
|
||||
Description
|
||||
Stores turbulence fields on the mesh database for further manipulation.
|
||||
|
||||
Fields are stored as copies of the original, with the prefix
|
||||
"tubulenceModel::", e.g.
|
||||
|
||||
turbulenceModel::R
|
||||
|
||||
SourceFiles
|
||||
turbulenceFields.C
|
||||
IOturbulenceFields.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulenceFields_H
|
||||
#define turbulenceFields_H
|
||||
|
||||
#include "wordList.H"
|
||||
#include "HashSet.H"
|
||||
#include "IOobject.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "pointField.H"
|
||||
@ -96,7 +100,7 @@ protected:
|
||||
bool active_;
|
||||
|
||||
//- Fields to load
|
||||
wordList fieldSet_;
|
||||
wordHashSet fieldSet_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
@ -110,15 +114,12 @@ protected:
|
||||
//- Return true if compressible turbulence model is identified
|
||||
bool compressible();
|
||||
|
||||
//- Helper function to return IOobject
|
||||
IOobject io(const word& fieldName) const;
|
||||
|
||||
//- Process the turbulence field
|
||||
template<class Type>
|
||||
void processField
|
||||
(
|
||||
const word& fieldName,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& value
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvalue
|
||||
);
|
||||
|
||||
|
||||
|
@ -31,19 +31,49 @@ template<class Type>
|
||||
void Foam::turbulenceFields::processField
|
||||
(
|
||||
const word& fieldName,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& value
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvalue
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||
if (obr_.foundObject<FieldType>(fieldName))
|
||||
|
||||
const word scopedName = modelName + "::" + fieldName;
|
||||
|
||||
if (obr_.foundObject<FieldType>(scopedName))
|
||||
{
|
||||
FieldType& fld =
|
||||
const_cast<FieldType&>(obr_.lookupObject<FieldType>(fieldName));
|
||||
fld == value;
|
||||
const_cast<FieldType&>(obr_.lookupObject<FieldType>(scopedName));
|
||||
fld == tvalue();
|
||||
}
|
||||
else if (obr_.found(scopedName))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"void Foam::turbulenceFields::processField"
|
||||
"("
|
||||
"const word&, "
|
||||
"const tmp<GeometricField<Type, fvPatchField, volMesh> >&"
|
||||
")"
|
||||
) << "Cannot store turbulence field " << scopedName
|
||||
<< " since an object with that name already exists"
|
||||
<< nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
obr_.store(new FieldType(io(fieldName), value));
|
||||
obr_.store
|
||||
(
|
||||
new FieldType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
scopedName,
|
||||
obr_.time().timeName(),
|
||||
obr_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
tvalue
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user