ENH: support rhoRef for derived surfMesh sampled fields (issue #898)

This commit is contained in:
Mark Olesen
2018-06-22 16:57:30 +02:00
parent 4fe6ed3c6a
commit e0db37f043
21 changed files with 1088 additions and 70 deletions

View File

@ -49,7 +49,6 @@ Description
// Scheme to obtain node values // Scheme to obtain node values
// (only used if interpolate=true for the surfaces below) // (only used if interpolate=true for the surfaces below)
interpolationScheme cell; interpolationScheme cell;
// Output surface format // Output surface format
@ -74,6 +73,22 @@ Description
} }
\endverbatim \endverbatim
Entries:
\table
Property | Description | Required | Default
type | surfaces | yes |
surfaces | the list of sample surfaces | recommended |
fields | word/regex list of fields to sampled | yes |
sampleScheme | scheme to obtain face centre value | no | cell
interpolationScheme | scheme to obtain node values | yes |
surfaceFormat | output surface format | yes |
formatOptions | dictionary of format options | no |
\endtable
Note
The interpolationScheme is only used if interpolate=true is used by any
of the surfaces.
See also See also
Foam::surfMeshSamplers Foam::surfMeshSamplers

View File

@ -95,6 +95,93 @@ void Foam::surfMeshSamplers::checkOutNames
// return tmpRegistry().subRegistry(subName, true, false); // return tmpRegistry().subRegistry(subName, true, false);
// } // }
bool Foam::surfMeshSamplers::add_rhoU(const word& derivedName)
{
const objectRegistry& db = mesh_.thisDb();
const bool existed = db.foundObject<volVectorField>(derivedName);
if (existed)
{
return false; // Volume field already existed - not added.
}
// rhoU = rho * U
const auto* rhoPtr = mesh_.lookupObjectPtr<volScalarField>("rho");
const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
tmp<volVectorField> tresult;
if (rhoPtr)
{
const auto& rho = *rhoPtr;
tresult = tmp<volVectorField>::New
(
derivedName, (rho * U)
);
}
else
{
const dimensionedScalar rho("rho", dimDensity, rhoRef_);
tresult = tmp<volVectorField>::New
(
derivedName, (rho * U)
);
}
db.store(tresult.ptr());
return !existed;
}
bool Foam::surfMeshSamplers::add_pTotal(const word& derivedName)
{
const objectRegistry& db = mesh_.thisDb();
const bool existed = db.foundObject<volVectorField>(derivedName);
if (existed)
{
return false; // Volume field already existed - not added.
}
// pTotal = p + rho * U^2 / 2
const auto* rhoPtr = mesh_.lookupObjectPtr<volScalarField>("rho");
const volScalarField& p = mesh_.lookupObject<volScalarField>("p");
const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
tmp<volScalarField> tresult;
if (rhoPtr)
{
const auto& rho = *rhoPtr;
tresult = tmp<volScalarField>::New
(
derivedName, (p + 0.5 * rho * magSqr(U))
);
}
else
{
const dimensionedScalar rho("rho", dimDensity, rhoRef_);
tresult = tmp<volScalarField>::New
(
derivedName, (rho * (p + 0.5 * magSqr(U)))
);
}
db.store(tresult.ptr());
return !existed;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -110,7 +197,8 @@ Foam::surfMeshSamplers::surfMeshSamplers
mesh_(refCast<const fvMesh>(obr_)), mesh_(refCast<const fvMesh>(obr_)),
fieldSelection_(), fieldSelection_(),
derivedNames_(), derivedNames_(),
sampleScheme_(word::null) sampleScheme_(word::null),
rhoRef_(1.0)
{ {
read(dict); read(dict);
} }
@ -128,7 +216,8 @@ Foam::surfMeshSamplers::surfMeshSamplers
mesh_(refCast<const fvMesh>(obr)), mesh_(refCast<const fvMesh>(obr)),
fieldSelection_(), fieldSelection_(),
derivedNames_(), derivedNames_(),
sampleScheme_(word::null) sampleScheme_(word::null),
rhoRef_(1.0)
{ {
read(dict); read(dict);
} }
@ -157,79 +246,23 @@ bool Foam::surfMeshSamplers::execute()
for (const word& derivedName : derivedNames_) for (const word& derivedName : derivedNames_)
{ {
// This is a fairly ugly dispatch mechanism
if (derivedName == "rhoU") if (derivedName == "rhoU")
{ {
added.append(derivedName); if (add_rhoU(derivedName))
if (!db.foundObject<volVectorField>(derivedName))
{ {
cleanup.append(derivedName); cleanup.append(derivedName);
db.store
(
new volVectorField
(
derivedName,
// rhoU = rho * U
(
mesh_.lookupObject<volScalarField>("rho")
* mesh_.lookupObject<volVectorField>("U")
)
)
);
} }
added.append(derivedName);
} }
else if (derivedName == "pTotal") else if (derivedName == "pTotal")
{ {
added.append(derivedName); if (add_pTotal(derivedName))
if (!db.foundObject<volScalarField>(derivedName))
{ {
cleanup.append(derivedName); cleanup.append(derivedName);
const volScalarField& p =
mesh_.lookupObject<volScalarField>("p");
if (p.dimensions() == dimPressure)
{
db.store
(
new volScalarField
(
derivedName,
// pTotal = p + rho U^2 / 2
(
p
+ 0.5
* mesh_.lookupObject<volScalarField>("rho")
* magSqr
(
mesh_.lookupObject<volVectorField>("U")
)
)
)
);
}
else
{
db.store
(
new volScalarField
(
derivedName,
// pTotal = p + U^2 / 2
(
p
+ 0.5
* magSqr
(
mesh_.lookupObject<volVectorField>("U")
)
)
)
);
}
} }
added.append(derivedName);
} }
else else
{ {
@ -307,6 +340,8 @@ bool Foam::surfMeshSamplers::read(const dictionary& dict)
fieldSelection_.clear(); fieldSelection_.clear();
derivedNames_.clear(); derivedNames_.clear();
rhoRef_ = dict.lookupOrDefault<scalar>("rhoRef", 1);
const bool createOnRead = dict.lookupOrDefault("createOnRead", false); const bool createOnRead = dict.lookupOrDefault("createOnRead", false);
if (dict.found("surfaces")) if (dict.found("surfaces"))

View File

@ -25,7 +25,8 @@ Class
Foam::surfMeshSamplers Foam::surfMeshSamplers
Description Description
Set of surfaces to sample into a surfMesh/surfField. Set of surfaces to sample from a volume field onto surfField that resides
on a surfMesh object.
The execute() method is used to sample, and the write() method to write. The execute() method is used to sample, and the write() method to write.
It is fairly common to use for sampling only and have the write disabled. It is fairly common to use for sampling only and have the write disabled.
@ -53,6 +54,9 @@ Description
// Optional: pre-defined derived fields to be sampled // Optional: pre-defined derived fields to be sampled
derived (rhoU pTotal); derived (rhoU pTotal);
// Reference density for incompressible
rhoRef 1.25;
// Optional: create surface immediately on read // Optional: create surface immediately on read
// The default is to create a placeholder without any faces. // The default is to create a placeholder without any faces.
createOnRead false; createOnRead false;
@ -69,6 +73,23 @@ Description
} }
\endverbatim \endverbatim
Entries:
\table
Property | Description | Required | Default
type | surfMeshes | yes |
surfaces | the list of sample surfaces | recommended |
fields | word/regex list of fields to sampled | yes |
derived | additional derived fields pTotal/rhoU | no |
rhoRef | reference density for derived fields (incompressible) | no | 1
sampleScheme | scheme to obtain face centre value | no | cell
createOnRead | Create surface immediately on read | no | false;
\endtable
Note
The default is to create a placeholder surMesh without any faces on
construction. This behaviour can be changed by the createOnRead option.
For incompressible cases, \c rhoRef can be specified for use in the
derived quantities. The default is 1.
See also See also
Foam::sampledSurfaces Foam::sampledSurfaces
@ -93,7 +114,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes // Forward declarations
class Time; class Time;
class fvMesh; class fvMesh;
class dictionary; class dictionary;
@ -119,7 +140,7 @@ class surfMeshSamplers
const fvMesh& mesh_; const fvMesh& mesh_;
// Read from dictonary // Read from dictionary
//- Names of fields to sample //- Names of fields to sample
wordRes fieldSelection_; wordRes fieldSelection_;
@ -130,6 +151,9 @@ class surfMeshSamplers
//- Sample scheme to obtain face values //- Sample scheme to obtain face values
word sampleScheme_; word sampleScheme_;
//- Reference density (to convert from kinematic to static pressure)
scalar rhoRef_;
// Private Member Functions // Private Member Functions
@ -140,6 +164,16 @@ class surfMeshSamplers
const UList<word>& names const UList<word>& names
); );
//- Hard-coded derived field (rho * U)
// \return true if field did not previously exist
bool add_rhoU(const word& derivedName);
//- Hard-coded derived field (p + 1/2 * rho * U)
// \return true if field did not previously exist
bool add_pTotal(const word& derivedName);
//- Access the sampling surfaces //- Access the sampling surfaces
inline const PtrList<surfMeshSample>& surfaces() const inline const PtrList<surfMeshSample>& surfaces() const
{ {

View File

@ -14,7 +14,7 @@ fieldTransfer
executeInterval 1; executeInterval 1;
fields (p rho U T); fields (p rho U T);
derived (rhoU); derived (rhoU pTotal);
_plane _plane
{ {

View File

@ -16,6 +16,18 @@ massflow
fields ( rhoU ); fields ( rhoU );
} }
areaAverage
{
${__surfaceFieldValue}
regionType surface;
name plane1;
operation weightedAreaAverage;
weightField rhoU;
fields ( p pTotal );
}
areaIntegrate areaIntegrate
{ {
${__surfaceFieldValue} ${__surfaceFieldValue}

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
Default_Boundary_Region
{
type noSlip;
}
inlet
{
type fixedValue;
value uniform (10 0 0);
}
outlet
{
type inletOutlet;
value $internalField;
inletValue $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 200;
boundaryField
{
Default_Boundary_Region
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value $internalField;
}
inlet
{
type turbulentMixingLengthDissipationRateInlet;
mixingLength 0.005;
value $internalField;
}
outlet
{
type inletOutlet;
value $internalField;
inletValue $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1;
boundaryField
{
Default_Boundary_Region
{
type kqRWallFunction;
value $internalField;
}
inlet
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.05;
value $internalField;
}
outlet
{
type inletOutlet;
value $internalField;
inletValue $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
Default_Boundary_Region
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value $internalField;
}
inlet
{
type calculated;
value $internalField;
}
outlet
{
type calculated;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
Default_Boundary_Region
{
type zeroGradient;
}
inlet
{
type zeroGradient;
refValue $internalField;
refGradient uniform 0;
valueFraction uniform 0.3;
}
outlet
{
type fixedValue;
value $internalField;
}
".*"
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1.5e-05;
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.001;
vertices
(
// front-plane: z = +25mm
// inlet region
( -50 25 25) // pt 0
( 0 25 25) // pt 1
( -50 75 25) // pt 2
( 0 75 25) // pt 3
// outlet region
( -500 -75 25) // pt 4
( 0 -75 25) // pt 5
( -500 -25 25) // pt 6
( 0 -25 25) // pt 7
// bend mid-points
( 25 0 25) // pt 8
( 75 0 25) // pt 9
// back-plane: z = -25mm
// inlet region
( -50 25 -25) // pt 0 + 10
( 0 25 -25) // pt 1 + 10
( -50 75 -25) // pt 2 + 10
( 0 75 -25) // pt 3 + 10
// outlet region
( -500 -75 -25) // pt 4 + 10
( 0 -75 -25) // pt 5 + 10
( -500 -25 -25) // pt 7 + 10
( 0 -25 -25) // pt 8 + 10
// bend mid-points
( 25 0 -25) // pt 8 + 10
( 75 0 -25) // pt 9 + 10
);
blocks
(
hex (0 1 11 10 2 3 13 12) inlet ( 20 20 20) simpleGrading (1 1 1)
hex (4 5 15 14 6 7 17 16) outlet (200 20 20) simpleGrading (1 1 1)
hex (1 8 18 11 3 9 19 13) bend1 ( 30 20 20) simpleGrading (1 1 1)
hex (5 9 19 15 7 8 18 17) bend2 ( 30 20 20) simpleGrading (1 1 1)
);
edges
(
// block 2
arc 1 8 ( 17.678 17.678 25)
arc 11 18 ( 17.678 17.678 -25)
arc 3 9 ( 53.033 53.033 25)
arc 13 19 ( 53.033 53.033 -25)
// block 3
arc 7 8 ( 17.678 -17.678 25)
arc 17 18 ( 17.678 -17.678 -25)
arc 5 9 ( 53.033 -53.033 25)
arc 15 19 ( 53.033 -53.033 -25)
);
boundary
(
// is there no way of defining all my 'defaultFaces' to be 'wall'?
Default_Boundary_Region
{
type wall;
faces
(
// block0
( 0 1 3 2 )
( 11 10 12 13 )
( 0 10 11 1 )
( 2 3 13 12 )
// block1
( 4 5 7 6 )
( 15 14 16 17 )
( 4 14 15 5 )
( 6 7 17 16 )
// block2
( 1 8 9 3 )
( 18 11 13 19 )
( 3 9 19 13 )
( 1 11 18 8 )
// block3
( 5 9 8 7 )
( 19 15 17 18 )
( 5 15 19 9 )
( 7 8 18 17 )
);
}
inlet
{
type patch;
faces
(
(0 2 12 10)
);
}
outlet
{
type patch;
faces
(
(4 6 16 14)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 500;
deltaT 1;
writeControl timeStep;
writeInterval 50;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
graphFormat raw;
runTimeModifiable true;
#include "sampleControls"
functions
{
#include "sampling"
#include "samplingDebug"
}
// ************************************************************************* //

View File

@ -0,0 +1,34 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8;
method hierarchical;
simpleCoeffs
{
n (8 1 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (4 2 1);
delta 0.001;
order xyz;
}
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
// -*- C++ -*-
// ************************************************************************* //
// Transcribe volume fields to surfaces.
fieldTransfer
{
type surfMeshes;
libs ("libsampling.so");
log true;
writeControl none;
createOnRead true;
executeControl timeStep;
executeInterval 1;
fields (p U);
derived (rhoU pTotal);
rhoRef 1.25;
_plane
{
type plane;
source cells;
planeType pointAndNormal;
pointAndNormalDict
{
normal (-1 0 0);
point (-0.04 0 0);
}
}
surfaces
(
// Top channel
plane1
{
${_plane}
bounds (-1 0 -1) (0 1 1);
}
// Bottom channel
plane2
{
${_plane}
bounds (-1 -1 -1) (0 0 1);
}
// Angled plane - for general testing
plane3
{
type distanceSurface;
distance 0;
signed true;
surfaceType triSurfaceMesh;
surfaceName angledPlane.obj;
}
);
}
// ************************************************************************* //

View File

@ -0,0 +1,72 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss limitedLinearV 1;
div(phi,k) Gauss limitedLinear 1;;
div(phi,epsilon) Gauss limitedLinear 1;;
div(phi,R) Gauss limitedLinear 1;;
div(R) Gauss limitedLinear 1;;
div(phi,omega) Gauss limitedLinear 1;
div(phid,p) Gauss limitedLinear 1;
div(phi,K) Gauss limitedLinear 1;
div(phi,e) Gauss limitedLinear 1;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected ;
}
oversetInterpolation
{
method inverseDistance;
}
fluxRequired
{
default no;
pcorr ;
p ;
}
// ************************************************************************* //

View File

@ -0,0 +1,86 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother GaussSeidel;
tolerance 1e-7;
relTol 0.01;
}
Phi
{
$p;
}
U
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-8;
relTol 0.1;
nSweeps 1;
}
k
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-8;
relTol 0.1;
nSweeps 1;
}
"(epsilon|omega)"
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-8;
relTol 0.1;
nSweeps 1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
consistent yes;
}
potentialFlow
{
nNonOrthogonalCorrectors 10;
}
relaxationFactors
{
equations
{
U 0.9;
k 0.7;
"(epsilon|omega)" 0.7;
}
}
cache
{
grad(U);
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
// -*- C++ -*-
// restartTime:
// - a 'one-shot' reset at a particular time
//
// fields [required]
// Pairs of fields to use for calculating the deviation.
// The fields must already exist on the surfaces.
//
// weightField [optional]
// A scalar or vector field for weighting.
//
// postOperation [optional]
// Modify the results by particular operations.
// (none | sqrt)
// The sqrt operation is useful when determining RMS values.
//
// The 'output/write' control triggers the calculation.
__surfaceFieldValue
{
type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");
log on;
enabled true;
writeControl timeStep;
writeInterval 1;
writeFields false;
surfaceFormat vtk;
// writeArea true;
// resetOnStartUp true;
// resetOnOutput false;
// periodicRestart true;
// restartPeriod 0.0005;
}
// ************************************************************************* //

View File

@ -0,0 +1,110 @@
// -*- C++ -*-
// ************************************************************************* //
#include "fieldTransfer"
massflow
{
${__surfaceFieldValue}
regionType surface;
name plane1;
operation areaNormalIntegrate;
fields ( rhoU );
}
areaAverage
{
${__surfaceFieldValue}
regionType surface;
name plane1;
operation weightedAreaAverage;
weightField rhoU;
fields ( p pTotal );
}
areaIntegrate
{
${__surfaceFieldValue}
regionType surface;
name plane1;
operation weightedAreaIntegrate;
weightField rhoU;
fields ( p pTotal );
}
// Inflow uniformity
UI1
{
${__surfaceFieldValue}
regionType surface;
name plane1;
operation uniformity;
fields ( U p );
}
// Uniformity after the bend
UI2
{
${__surfaceFieldValue}
regionType surface;
name plane2;
operation uniformity;
fields ( U p );
}
// Uniformity on sampled surface
UI3
{
${__surfaceFieldValue}
regionType surface;
name plane3;
operation uniformity;
fields ( U p );
}
// rhoU-weighted uniformity, including weighting U too (weird but possible)
rhoU_UI1
{
${__surfaceFieldValue}
regionType surface;
name plane1;
operation weightedUniformity;
weightField rhoU;
fields ( p U rhoU );
}
// rhoU-weighted uniformity
rhoU_UI2
{
${__surfaceFieldValue}
regionType surface;
name plane2;
operation weightedUniformity;
weightField rhoU;
fields ( p U rhoU );
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
// -*- C++ -*-
// ************************************************************************* //
debug
{
type surfaces;
libs ("libsampling.so");
log true;
writeControl timeStep;
writeInterval 1;
fields (U);
sampleScheme cellPoint;
interpolationScheme cellPoint;
// surfaceFormat ensight;
surfaceFormat vtk;
formatOptions
{
ensight
{
collateTimes true;
// collateTimes false;
}
}
surfaces
(
angledPlane
{
type distanceSurface;
distance 0;
signed true;
regularise true;
surfaceType triSurfaceMesh;
surfaceName angledPlane.obj;
}
iso
{
type isoSurface;
isoField p;
isoValue 1e5;
regularise true;
interpolate true;
}
);
}
// ************************************************************************* //