Skip to content
Snippets Groups Projects
Commit 0ad4f7be authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

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

parents 1e7c9ae8 316160d9
Branches
Tags
No related merge requests found
Showing
with 194 additions and 177 deletions
......@@ -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())
......
components.C
EXE = $(FOAM_APPBIN)/components
......@@ -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);
}
......
mag.C
EXE = $(FOAM_APPBIN)/mag
......@@ -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);
}
......
magSqr.C
EXE = $(FOAM_APPBIN)/magSqr
......@@ -2,4 +2,5 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume
-lfiniteVolume \
......@@ -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);
}
......
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / 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;
}
}
}
// ************************************************************************* //
sigmaComponents.C
EXE = $(FOAM_APPBIN)/sigmaComponents
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / 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;
}
}
}
// ************************************************************************* //
Ucomponents.C
EXE = $(FOAM_APPBIN)/Ucomponents
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / 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;
}
}
}
// ************************************************************************* //
magU.C
EXE = $(FOAM_APPBIN)/magU
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment