Files
openfoam/tutorials/incompressible/simpleFoam/squareBend/system/sampling
Mark Olesen 4b92bb6533 ENH: update globalIndex::mpiGather to use MPI intrinsic/user types
- add provisional support for selecting MPI_Gatherv
  when merging fields in the surface writers.
  Uses the 'gatherv' keyword [experimental]

BUG: gatherv/scatterv wrappers used the incorrect data type

- incorrectly checked against UPstream_basic_dataType trait instead of
  UPstream_dataType, which resulted in a count mismatch for
  user-defined types (eg, vector, tensor,...).

  This was not visibly active bug, since previous internal uses of
  gatherv were restricted to primitive types.

COMP: make UPstream dataType traits size(...) constexpr

- allows static asserts and/or compile-time selection
  of code based on size(1)
2025-10-10 08:51:20 +02:00

258 lines
5.4 KiB
C++

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2506 |
| \\ / 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;
//gatherv 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 "__.*"
// ************************************************************************* //