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& p
) const
{
return
{
return
dimensionedScalar("1e24", dimensionSet(1, -1, -2, 0, 0), 1e24)
*pow(Foam::max(alpha - alphaMinFriction, scalar(0)), 10.0);
}
@ -89,7 +89,7 @@ frictionalPressurePrime
const dimensionedScalar& p
) const
{
return
return
dimensionedScalar("1e25", dimensionSet(1, -1, -2, 0, 0), 1e25)
*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)
{
muf_[celli] =
0.5*alpha[celli]*pf[celli]*sin(phi.value())
muf_[celli] =
0.5*pf[celli]*sin(phi.value())
/(
sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy())
+ 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
Application
magU
components
Description
Calculates and writes the scalar magnitude of the gradient of the velocity
field U for each time
Writes scalar fields corresponding to each component of the supplied
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[])
{
argList::validArgs.append("fieldName");
# include "addTimeOptions.H"
# include "setRootCase.H"
word fieldName(args.additionalArgs()[0]);
# include "createTime.H"
// Get times list
@ -59,50 +101,41 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl;
IOobject Uheader
IOobject fieldHeader
(
"U",
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check U exists
if (Uheader.headerOk())
if (fieldHeader.headerOk())
{
mesh.readUpdate();
Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh);
Info<< " Calculating magU" << endl;
volScalarField magU
(
IOobject
(
"magU",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
mag(U)
);
Info << "mag(U): max: " << max(magU.internalField())
<< " min: " << min(magU.internalField()) << endl;
magU.write();
bool processed = false;
writeComponents<vector>(fieldHeader, mesh, processed);
writeComponents<sphericalTensor>(fieldHeader, mesh, processed);
writeComponents<symmTensor>(fieldHeader, mesh, processed);
writeComponents<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to components for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No U" << endl;
Info<< " No " << fieldName << endl;
}
Info<< endl;
}
Info<< "End\n" << endl;
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
Application
Ucomponents
mag
Description
Writes the three scalar fields, Ux, Uy and Uz, for each component of the
velocity field U for each time
Calculates and writes the magnitude of a field 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[])
{
argList::validArgs.append("fieldName");
# include "addTimeOptions.H"
# include "setRootCase.H"
word fieldName(args.additionalArgs()[0]);
# include "createTime.H"
// Get times list
@ -59,48 +95,44 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl;
IOobject Uheader
IOobject fieldHeader
(
"U",
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check U exists
if (Uheader.headerOk())
// Check field "fieldName" exists
if (fieldHeader.headerOk())
{
mesh.readUpdate();
Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh);
for (direction i=0; i<vector::nComponents; i++)
bool processed = false;
writeMagField<scalar>(fieldHeader, mesh, processed);
writeMagField<vector>(fieldHeader, mesh, processed);
writeMagField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagField<symmTensor>(fieldHeader, mesh, processed);
writeMagField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " Calculating U" << vector::componentNames[i] << endl;
volScalarField Ui
(
IOobject
(
"U" + word(vector::componentNames[i]),
runTime.timeName(),
mesh,
IOobject::NO_READ
),
U.component(i)
);
Ui.write();
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to mag for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No U" << endl;
Info<< " No " << fieldName << endl;
}
Info<< endl;
}
Info<< "End\n" << endl;
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
EXE_LIBS = \
-lfiniteVolume
-lfiniteVolume \

View File

@ -23,11 +23,10 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
Rcomponents
mag
Description
Calculates and writes the scalar fields of the six components of the
stress sigma for each time.
Calculates and writes the magnitude-squared of a field 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[])
{
argList::validArgs.append("fieldName");
# include "addTimeOptions.H"
# include "setRootCase.H"
word fieldName(args.additionalArgs()[0]);
# include "createTime.H"
// Get times list
@ -59,48 +95,44 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl;
IOobject sigmaHeader
IOobject fieldHeader
(
"sigma",
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check sigma exists
if (sigmaHeader.headerOk())
// Check field "fieldName" exists
if (fieldHeader.headerOk())
{
mesh.readUpdate();
Info<< " Reading sigma" << endl;
volSymmTensorField sigma(sigmaHeader, mesh);
for (direction i=0; i<tensor::nComponents; i++)
bool processed = false;
writeMagSqrField<scalar>(fieldHeader, mesh, processed);
writeMagSqrField<vector>(fieldHeader, mesh, processed);
writeMagSqrField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagSqrField<symmTensor>(fieldHeader, mesh, processed);
writeMagSqrField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " Calculating sigma" << tensor::componentNames[i] << endl;
volScalarField sigmai
(
IOobject
(
"sigma" + word(tensor::componentNames[i]),
runTime.timeName(),
mesh,
IOobject::NO_READ
),
sigma.component(i)
);
sigmai.write();
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to mag for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No sigma" << endl;
Info<< " No " << fieldName << endl;
}
Info<< endl;
}
Info<< "End\n" << endl;
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_VERSION=dev
#export WM_PROJECT_VERSION=dev
#!!User:
# either set $FOAM_INST_DIR before sourcing this file or set

View File

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

View File

@ -31,12 +31,19 @@ License
// * * * * * * * * * * * * * * 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 functionEntries
{
defineTypeNameAndDebug(includeEntry, 0);
addToMemberFunctionSelectionTable
(
functionEntry,

View File

@ -30,12 +30,19 @@ License
// * * * * * * * * * * * * * * 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 functionEntries
{
defineTypeNameAndDebug(inputModeEntry, 0);
addToMemberFunctionSelectionTable
(
functionEntry,

View File

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

View File

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