Merge branch 'master' of /home/noisy2/OpenFOAM/OpenFOAM-dev/

This commit is contained in:
mattijs
2008-05-20 18:31:26 +01:00
26 changed files with 233 additions and 191 deletions

View File

@ -71,8 +71,8 @@ frictionalPressure
const dimensionedScalar& eta, const dimensionedScalar& eta,
const dimensionedScalar& p const dimensionedScalar& p
) const ) const
{ {
return return
dimensionedScalar("1e24", dimensionSet(1, -1, -2, 0, 0), 1e24) dimensionedScalar("1e24", dimensionSet(1, -1, -2, 0, 0), 1e24)
*pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0); *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0);
} }
@ -89,7 +89,7 @@ frictionalPressurePrime
const dimensionedScalar& p const dimensionedScalar& p
) const ) const
{ {
return return
dimensionedScalar("1e25", dimensionSet(1, -1, -2, 0, 0), 1e25) dimensionedScalar("1e25", dimensionSet(1, -1, -2, 0, 0), 1e25)
*pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 9.0); *pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 9.0);
} }
@ -129,8 +129,8 @@ Foam::tmp<Foam::volScalarField> Foam::SchaefferFrictionalStress::muf
{ {
if (alpha[celli] > alphaMax.value()-5e-2) if (alpha[celli] > alphaMax.value()-5e-2)
{ {
muf_[celli] = muf_[celli] =
0.5*alpha[celli]*pf[celli]*sin(phi.value()) 0.5*pf[celli]*sin(phi.value())
/( /(
sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy()) sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy())
+ sqr(D[celli].yy() - D[celli].zz()) + sqr(D[celli].yy() - D[celli].zz())

View File

@ -0,0 +1,3 @@
components.C
EXE = $(FOAM_APPBIN)/components

View File

@ -23,11 +23,11 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application Application
magU components
Description Description
Calculates and writes the scalar magnitude of the gradient of the velocity Writes scalar fields corresponding to each component of the supplied
field U for each time field (name) for each time.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -35,12 +35,54 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template <class Type>
void writeComponents
(
const IOobject& header,
const fvMesh& mesh,
bool& processed
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (header.headerClassName() == fieldType::typeName)
{
Info<< " Reading " << header.name() << endl;
fieldType field(header, mesh);
for (direction i=0; i<Type::nComponents; i++)
{
Info<< " Calculating " << header.name()
<< Type::componentNames[i] << endl;
volScalarField componentField
(
IOobject
(
header.name() + word(Type::componentNames[i]),
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
field.component(i)
);
componentField.write();
}
processed = true;
}
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::validArgs.append("fieldName");
# include "addTimeOptions.H" # include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
word fieldName(args.additionalArgs()[0]);
# include "createTime.H" # include "createTime.H"
// Get times list // Get times list
@ -59,50 +101,41 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
IOobject Uheader IOobject fieldHeader
( (
"U", fieldName,
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ IOobject::MUST_READ
); );
// Check U exists // Check U exists
if (Uheader.headerOk()) if (fieldHeader.headerOk())
{ {
mesh.readUpdate(); mesh.readUpdate();
Info<< " Reading U" << endl; bool processed = false;
volVectorField U(Uheader, mesh); writeComponents<vector>(fieldHeader, mesh, processed);
writeComponents<sphericalTensor>(fieldHeader, mesh, processed);
Info<< " Calculating magU" << endl; writeComponents<symmTensor>(fieldHeader, mesh, processed);
volScalarField magU writeComponents<tensor>(fieldHeader, mesh, processed);
( if (!processed)
IOobject {
( FatalError
"magU", << "Unable to process " << fieldName << nl
runTime.timeName(), << "No call to components for fields of type "
mesh, << fieldHeader.headerClassName() << nl << nl
IOobject::NO_READ << exit(FatalError);
), }
mag(U)
);
Info << "mag(U): max: " << max(magU.internalField())
<< " min: " << min(magU.internalField()) << endl;
magU.write();
} }
else else
{ {
Info<< " No U" << endl; Info<< " No " << fieldName << endl;
} }
Info<< endl; Info<< endl;
} }
Info<< "End\n" << endl;
return(0); return(0);
} }

View File

@ -0,0 +1,3 @@
mag.C
EXE = $(FOAM_APPBIN)/mag

View File

@ -23,11 +23,10 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application Application
Ucomponents mag
Description Description
Writes the three scalar fields, Ux, Uy and Uz, for each component of the Calculates and writes the magnitude of a field for each time
velocity field U for each time
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -35,12 +34,49 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void writeMagField
(
const IOobject& header,
const fvMesh& mesh,
bool& processed
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (header.headerClassName() == fieldType::typeName)
{
Info<< " Reading " << header.name() << endl;
fieldType field(header, mesh);
Info<< " Calculating mag" << header.name() << endl;
volScalarField magField
(
IOobject
(
"mag" + header.name(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
mag(field)
);
magField.write();
processed = true;
}
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::validArgs.append("fieldName");
# include "addTimeOptions.H" # include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
word fieldName(args.additionalArgs()[0]);
# include "createTime.H" # include "createTime.H"
// Get times list // Get times list
@ -59,48 +95,44 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
IOobject Uheader IOobject fieldHeader
( (
"U", fieldName,
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ IOobject::MUST_READ
); );
// Check U exists // Check field "fieldName" exists
if (Uheader.headerOk()) if (fieldHeader.headerOk())
{ {
mesh.readUpdate(); mesh.readUpdate();
Info<< " Reading U" << endl; bool processed = false;
volVectorField U(Uheader, mesh); writeMagField<scalar>(fieldHeader, mesh, processed);
writeMagField<vector>(fieldHeader, mesh, processed);
for (direction i=0; i<vector::nComponents; i++) writeMagField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagField<symmTensor>(fieldHeader, mesh, processed);
writeMagField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{ {
Info<< " Calculating U" << vector::componentNames[i] << endl; FatalError
<< "Unable to process " << fieldName << nl
volScalarField Ui << "No call to mag for fields of type "
( << fieldHeader.headerClassName() << nl << nl
IOobject << exit(FatalError);
(
"U" + word(vector::componentNames[i]),
runTime.timeName(),
mesh,
IOobject::NO_READ
),
U.component(i)
);
Ui.write();
} }
} }
else else
{ {
Info<< " No U" << endl; Info<< " No " << fieldName << endl;
} }
Info<< endl; Info<< endl;
} }
Info<< "End\n" << endl;
return(0); return(0);
} }

View File

@ -0,0 +1,3 @@
magSqr.C
EXE = $(FOAM_APPBIN)/magSqr

View File

@ -2,4 +2,5 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude -I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume -lfiniteVolume \

View File

@ -23,11 +23,10 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application Application
Rcomponents mag
Description Description
Calculates and writes the scalar fields of the six components of the Calculates and writes the magnitude-squared of a field for each time
stress sigma for each time.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -35,12 +34,49 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void writeMagSqrField
(
const IOobject& header,
const fvMesh& mesh,
bool& processed
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (header.headerClassName() == fieldType::typeName)
{
Info<< " Reading " << header.name() << endl;
fieldType field(header, mesh);
Info<< " Calculating magSqr" << header.name() << endl;
volScalarField magSqrField
(
IOobject
(
"magSqr" + header.name(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
magSqr(field)
);
magSqrField.write();
processed = true;
}
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::validArgs.append("fieldName");
# include "addTimeOptions.H" # include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
word fieldName(args.additionalArgs()[0]);
# include "createTime.H" # include "createTime.H"
// Get times list // Get times list
@ -59,48 +95,44 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
IOobject sigmaHeader IOobject fieldHeader
( (
"sigma", fieldName,
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ IOobject::MUST_READ
); );
// Check sigma exists // Check field "fieldName" exists
if (sigmaHeader.headerOk()) if (fieldHeader.headerOk())
{ {
mesh.readUpdate(); mesh.readUpdate();
Info<< " Reading sigma" << endl; bool processed = false;
volSymmTensorField sigma(sigmaHeader, mesh); writeMagSqrField<scalar>(fieldHeader, mesh, processed);
writeMagSqrField<vector>(fieldHeader, mesh, processed);
for (direction i=0; i<tensor::nComponents; i++) writeMagSqrField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagSqrField<symmTensor>(fieldHeader, mesh, processed);
writeMagSqrField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{ {
Info<< " Calculating sigma" << tensor::componentNames[i] << endl; FatalError
<< "Unable to process " << fieldName << nl
volScalarField sigmai << "No call to mag for fields of type "
( << fieldHeader.headerClassName() << nl << nl
IOobject << exit(FatalError);
(
"sigma" + word(tensor::componentNames[i]),
runTime.timeName(),
mesh,
IOobject::NO_READ
),
sigma.component(i)
);
sigmai.write();
} }
} }
else else
{ {
Info<< " No sigma" << endl; Info<< " No " << fieldName << endl;
} }
Info<< endl; Info<< endl;
} }
Info<< "End\n" << endl;
return(0); return(0);
} }

View File

@ -1,27 +0,0 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// stressComponents tool definition
description "Decompose general stress tensor into individual components";
sigmaComponentsDict
{
type dictionary;
description "sigmaComponents control dictionary";
dictionaryPath "system";
entries
{
arguments
{
type rootCaseTimeArguments;
}
}
}
// ************************************************************************* //

View File

@ -1,3 +0,0 @@
sigmaComponents.C
EXE = $(FOAM_APPBIN)/sigmaComponents

View File

@ -1,27 +0,0 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// Ucomponents tool definition
description "U velocity components";
UcomponentsDict
{
type dictionary;
description "Ucomponents control dictionary";
dictionaryPath "system";
entries
{
arguments
{
type rootCaseTimeArguments;
}
}
}
// ************************************************************************* //

View File

@ -1,3 +0,0 @@
Ucomponents.C
EXE = $(FOAM_APPBIN)/Ucomponents

View File

@ -1,27 +0,0 @@
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.0 |
| \\ / A nd | Web: http://www.openfoam.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
// magU tool definition
description "Magnitude of U components";
magUDict
{
type dictionary;
description "magU control dictionary";
dictionaryPath "system";
entries
{
arguments
{
type rootCaseTimeArguments;
}
}
}
// ************************************************************************* //

View File

@ -1,3 +0,0 @@
magU.C
EXE = $(FOAM_APPBIN)/magU

View File

@ -32,7 +32,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
export WM_PROJECT=OpenFOAM export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=dev #export WM_PROJECT_VERSION=dev
#!!User: #!!User:
# either set $FOAM_INST_DIR before sourcing this file or set # either set $FOAM_INST_DIR before sourcing this file or set

View File

@ -32,7 +32,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
setenv WM_PROJECT OpenFOAM setenv WM_PROJECT OpenFOAM
setenv WM_PROJECT_VERSION dev #setenv WM_PROJECT_VERSION dev
#!!User: #!!User:
# either setenv FOAM_INST_DIR before sourcing this file or set # either setenv FOAM_INST_DIR before sourcing this file or set

View File

@ -31,12 +31,19 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::word Foam::functionEntries::includeEntry::typeName
(
Foam::functionEntries::includeEntry::typeName_()
);
// Don't lookup the debug switch here as the debug switch dictionary
// might include includeEntry
int Foam::functionEntries::includeEntry::debug(0);
namespace Foam namespace Foam
{ {
namespace functionEntries namespace functionEntries
{ {
defineTypeNameAndDebug(includeEntry, 0);
addToMemberFunctionSelectionTable addToMemberFunctionSelectionTable
( (
functionEntry, functionEntry,

View File

@ -30,12 +30,19 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::word Foam::functionEntries::inputModeEntry::typeName
(
Foam::functionEntries::inputModeEntry::typeName_()
);
// Don't lookup the debug switch here as the debug switch dictionary
// might include inputModeEntries
int Foam::functionEntries::inputModeEntry::debug(0);
namespace Foam namespace Foam
{ {
namespace functionEntries namespace functionEntries
{ {
defineTypeNameAndDebug(inputModeEntry, 0);
addToMemberFunctionSelectionTable addToMemberFunctionSelectionTable
( (
functionEntry, functionEntry,

View File

@ -54,11 +54,14 @@ void Foam::fieldAverage::resetLists(const label nItems)
meanVectorFields_.clear(); meanVectorFields_.clear();
meanVectorFields_.setSize(nItems); meanVectorFields_.setSize(nItems);
meanSphericalTensorFields_.clear();
meanSphericalTensorFields_.setSize(nItems);
meanSymmTensorFields_.clear(); meanSymmTensorFields_.clear();
meanSymmTensorFields_.setSize(nItems); meanSymmTensorFields_.setSize(nItems);
meanSphericalTensorFields_.clear(); meanTensorFields_.clear();
meanSphericalTensorFields_.setSize(nItems); meanTensorFields_.setSize(nItems);
prime2MeanScalarFields_.clear(); prime2MeanScalarFields_.clear();
prime2MeanScalarFields_.setSize(nItems); prime2MeanScalarFields_.setSize(nItems);
@ -88,13 +91,17 @@ void Foam::fieldAverage::initialise()
{ {
addMeanFields<vector>(i, meanVectorFields_); addMeanFields<vector>(i, meanVectorFields_);
} }
else if (obr_.foundObject<volSphericalTensorField>(fieldName))
{
addMeanFields<sphericalTensor>(i, meanSphericalTensorFields_);
}
else if (obr_.foundObject<volSymmTensorField>(fieldName)) else if (obr_.foundObject<volSymmTensorField>(fieldName))
{ {
addMeanFields<symmTensor>(i, meanSymmTensorFields_); addMeanFields<symmTensor>(i, meanSymmTensorFields_);
} }
else if (obr_.foundObject<volSphericalTensorField>(fieldName)) else if (obr_.foundObject<volTensorField>(fieldName))
{ {
addMeanFields<sphericalTensor>(i, meanSphericalTensorFields_); addMeanFields<tensor>(i, meanTensorFields_);
} }
else else
{ {
@ -166,8 +173,9 @@ Foam::fieldAverage::fieldAverage
faItems_(dict.lookup("fields")), faItems_(dict.lookup("fields")),
meanScalarFields_(faItems_.size()), meanScalarFields_(faItems_.size()),
meanVectorFields_(faItems_.size()), meanVectorFields_(faItems_.size()),
meanSymmTensorFields_(faItems_.size()),
meanSphericalTensorFields_(faItems_.size()), meanSphericalTensorFields_(faItems_.size()),
meanSymmTensorFields_(faItems_.size()),
meanTensorFields_(faItems_.size()),
prime2MeanScalarFields_(faItems_.size()), prime2MeanScalarFields_(faItems_.size()),
prime2MeanSymmTensorFields_(faItems_.size()), prime2MeanSymmTensorFields_(faItems_.size()),
totalIter_(faItems_.size(), 1), totalIter_(faItems_.size(), 1),
@ -248,8 +256,9 @@ void Foam::fieldAverage::calcAverages()
calculateMeanFields<scalar>(meanScalarFields_); calculateMeanFields<scalar>(meanScalarFields_);
calculateMeanFields<vector>(meanVectorFields_); calculateMeanFields<vector>(meanVectorFields_);
calculateMeanFields<symmTensor>(meanSymmTensorFields_);
calculateMeanFields<sphericalTensor>(meanSphericalTensorFields_); calculateMeanFields<sphericalTensor>(meanSphericalTensorFields_);
calculateMeanFields<symmTensor>(meanSymmTensorFields_);
calculateMeanFields<tensor>(meanTensorFields_);
calculatePrime2MeanFields<scalar>(prime2MeanScalarFields_); calculatePrime2MeanFields<scalar>(prime2MeanScalarFields_);
calculatePrime2MeanFields<vector>(prime2MeanSymmTensorFields_); calculatePrime2MeanFields<vector>(prime2MeanSymmTensorFields_);
@ -260,8 +269,9 @@ void Foam::fieldAverage::writeAverages() const
{ {
writeFieldList<scalar>(meanScalarFields_); writeFieldList<scalar>(meanScalarFields_);
writeFieldList<vector>(meanVectorFields_); writeFieldList<vector>(meanVectorFields_);
writeFieldList<symmTensor>(meanSymmTensorFields_);
writeFieldList<sphericalTensor>(meanSphericalTensorFields_); writeFieldList<sphericalTensor>(meanSphericalTensorFields_);
writeFieldList<symmTensor>(meanSymmTensorFields_);
writeFieldList<tensor>(meanTensorFields_);
writeFieldList<scalar>(prime2MeanScalarFields_); writeFieldList<scalar>(prime2MeanScalarFields_);
writeFieldList<symmTensor>(prime2MeanSymmTensorFields_); writeFieldList<symmTensor>(prime2MeanSymmTensorFields_);

View File

@ -132,8 +132,9 @@ protected:
// Arithmetic mean fields // Arithmetic mean fields
PtrList<volScalarField> meanScalarFields_; PtrList<volScalarField> meanScalarFields_;
PtrList<volVectorField> meanVectorFields_; PtrList<volVectorField> meanVectorFields_;
PtrList<volSymmTensorField> meanSymmTensorFields_;
PtrList<volSphericalTensorField> meanSphericalTensorFields_; PtrList<volSphericalTensorField> meanSphericalTensorFields_;
PtrList<volSymmTensorField> meanSymmTensorFields_;
PtrList<volTensorField> meanTensorFields_;
// Prime-squared fields - applicable to volVectorFields only // Prime-squared fields - applicable to volVectorFields only
PtrList<volScalarField> prime2MeanScalarFields_; PtrList<volScalarField> prime2MeanScalarFields_;