Files
openfoam/tutorials/incompressible/simpleFoam/squareBend/system/sampling
Mark Olesen 5b29ff0e42 ENH: consolidate 'formatOptions' handling for coordSetWriter/surfaceWriter
- replaced ad hoc handling of formatOptions with coordSetWriter and
  surfaceWriter helpers.

  Accompanying this change, it is now possible to specify "default"
  settings to be inherited, format-specific settings and have a
  similar layering with surface-specific overrides.

- snappyHexMesh now conforms to setFormats

  Eg,

      formatOptions
      {
          default
          {
              verbose     true;
              format      binary;
          }
          vtk
          {
              precision   10;
          }
     }

     surfaces
     {
         surf1
         {
             ...

             formatOptions
             {
                 ensight
                 {
                     scale   1000;
                 }
             }
         }
     }
2022-11-08 16:48:08 +00:00

257 lines
5.3 KiB
C++

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2206 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object sampling;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Setup for surfaceFieldValue
//
// 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 (fieldFunctionObjects);
log on;
enabled true;
writeControl timeStep;
writeInterval 1;
writeFields false;
surfaceFormat vtk;
formatOptions
{
default
{
verbose true;
}
}
// writeArea true;
// resetOnStartUp true;
// resetOnOutput false;
// periodicRestart true;
// restartPeriod 0.0005;
}
// * * * * * * * * * * * * * * * * Sampling * * * * * * * * * * * * * * * * //
// Sample volume fields to surfaces and hold on registry.
sampled
{
type surfaces;
libs (sampling);
log true;
executeControl timeStep;
executeInterval 1;
writeControl none;
sampleOnExecute true;
surfaceFormat none;
fields (p U rhoU pTotal);
// Remove derived fields we created prior
removeFieldsOnExecute (rhoU pTotal);
_plane
{
type plane;
source cells;
store true;
point (-0.04 0 0);
normal (-1 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;
store true;
surfaceType triSurfaceMesh;
surfaceName angledPlane.obj;
}
}
}
// * * * * * * * * * * * * * * * Calculations * * * * * * * * * * * * * * * //
massflow
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane1;
operation areaNormalIntegrate;
fields ( rhoU );
}
areaAverage
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane1;
operation weightedAreaAverage;
weightField rhoU;
fields ( p pTotal );
}
areaIntegrate
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane1;
operation weightedAreaIntegrate;
weightField rhoU;
fields ( p pTotal );
}
nonWeightedAreaAverage
{
${__surfaceFieldValue}
enabled false;
regionType sampledSurface;
name sampledTriSurf;
sampledSurfaceDict
{
type meshedSurface;
surface angledPlane.obj;
source insideCells;
interpolate true;
}
operation areaAverage;
fields ( U );
}
// Inflow uniformity
UI1
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane1;
operation uniformity;
fields ( U p );
}
// Uniformity after the bend
UI2
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane2;
operation uniformity;
fields ( U p );
}
// Uniformity on sampled surface
UI3
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane3;
operation uniformity;
fields ( U p );
}
// rhoU-weighted uniformity, including weighting U too (weird but possible)
rhoU_UI1
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane1;
operation weightedUniformity;
weightField rhoU;
fields ( p U rhoU );
}
// rhoU-weighted uniformity
rhoU_UI2
{
${__surfaceFieldValue}
regionType functionObjectSurface;
name sampled.plane2;
operation weightedUniformity;
weightField rhoU;
fields ( p U rhoU );
}
// * * * * * * * * * * * * * * * * * Cleanup * * * * * * * * * * * * * * * * //
#remove "__.*"
// ************************************************************************* //