mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: replace surfMesh/fields support with polySurface/fields support (#1206)
- fits better into the general sampling framework, improves flexibilty and allows code reduction. ENH: include surface fields on sampledSurfaces that support it
This commit is contained in:
committed by
Andrew Heather
parent
181c974b11
commit
03e6aa1a6d
@ -3,20 +3,20 @@
|
||||
// Averaging of volume fields or fields on an externally loaded surface.
|
||||
avg-tracer0-0.25
|
||||
{
|
||||
${settings_avg}
|
||||
subRegion plane-0.25;
|
||||
${__settings_avg}
|
||||
subRegion sampled.plane-0.25;
|
||||
}
|
||||
|
||||
avg-tracer0-0.45
|
||||
{
|
||||
${settings_avg}
|
||||
subRegion plane-0.45;
|
||||
${__settings_avg}
|
||||
subRegion sampled.plane-0.45;
|
||||
}
|
||||
|
||||
avg-tracer0-0.55
|
||||
{
|
||||
${settings_avg}
|
||||
subRegion plane-0.55;
|
||||
${__settings_avg}
|
||||
subRegion sampled.plane-0.55;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -55,8 +55,6 @@ endTime 1200;
|
||||
deltaT 1;
|
||||
writeInterval 100;
|
||||
|
||||
#include "sampleControls"
|
||||
|
||||
functions
|
||||
{
|
||||
#include "abort"
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
// Transcribe volume fields to surfaces.
|
||||
fieldTransfer
|
||||
// Sample volume fields to surfaces and hold on registry.
|
||||
sampled
|
||||
{
|
||||
type surfMeshes;
|
||||
type surfaces;
|
||||
libs ("libsampling.so");
|
||||
log true;
|
||||
writeControl none;
|
||||
createOnRead true;
|
||||
verbose true;
|
||||
|
||||
executeControl timeStep;
|
||||
executeInterval 1;
|
||||
writeControl none;
|
||||
surfaceFormat none;
|
||||
|
||||
sampleOnExecute true;
|
||||
|
||||
// Includes a rhoU derived field
|
||||
fields (rho U tracer0 rhoU);
|
||||
@ -19,31 +21,31 @@ fieldTransfer
|
||||
// Remove derived fields we created prior
|
||||
removeFieldsOnExecute (pTotal);
|
||||
|
||||
|
||||
baseCfg
|
||||
_sampleMesh
|
||||
{
|
||||
type sampledTriSurfaceMesh;
|
||||
source cells;
|
||||
type sampledTriSurfaceMesh;
|
||||
source cells;
|
||||
store true;
|
||||
}
|
||||
|
||||
surfaces
|
||||
(
|
||||
{
|
||||
plane-0.25
|
||||
{
|
||||
$baseCfg
|
||||
${_sampleMesh}
|
||||
surface plane-0.25.stl;
|
||||
}
|
||||
plane-0.45
|
||||
{
|
||||
$baseCfg
|
||||
${_sampleMesh}
|
||||
surface plane-0.45.stl;
|
||||
}
|
||||
plane-0.55
|
||||
{
|
||||
$baseCfg
|
||||
${_sampleMesh}
|
||||
surface plane-0.55.stl;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Summary of fluxes
|
||||
|
||||
flux
|
||||
{
|
||||
type fluxSummary;
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
log on;
|
||||
enabled true;
|
||||
|
||||
executeControl none;
|
||||
writeControl timeStep;
|
||||
writeInterval 4;
|
||||
|
||||
mode functionObjectSurface;
|
||||
|
||||
phi rhoU;
|
||||
|
||||
surfaces
|
||||
(
|
||||
sampled.plane-0.25
|
||||
sampled.plane-0.45
|
||||
sampled.plane-0.55
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -4,12 +4,20 @@
|
||||
|
||||
#include "derivedFields"
|
||||
#include "fieldTransfer"
|
||||
#include "fluxSummary"
|
||||
|
||||
#include "surfaceFieldValue.cfg"
|
||||
|
||||
#include "avg-tracer0"
|
||||
#include "sum-tracer0"
|
||||
// #include "sum-tracer0Mean"
|
||||
|
||||
|
||||
// #include "averaging.1612" // generate time-averaged fields
|
||||
// #include "spatialDeviation.1612" // spatial deviation compared to a mean field
|
||||
// #include "statistics.1612" // transcribe volume fields -> surface
|
||||
|
||||
// Cleanup
|
||||
#remove "__.*"
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
|
||||
sum-tracer0-0.25
|
||||
{
|
||||
$settings_stats
|
||||
${__settings_stats}
|
||||
|
||||
regionType surface;
|
||||
name plane-0.25;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane-0.25;
|
||||
|
||||
operation weightedAreaIntegrate;
|
||||
// postOperation sqrt;
|
||||
@ -19,10 +19,10 @@ sum-tracer0-0.25
|
||||
|
||||
sum-tracer0-0.45
|
||||
{
|
||||
$settings_stats
|
||||
${__settings_stats}
|
||||
|
||||
regionType surface;
|
||||
name plane-0.45;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane-0.45;
|
||||
|
||||
operation weightedAreaIntegrate;
|
||||
// postOperation sqrt;
|
||||
@ -33,10 +33,10 @@ sum-tracer0-0.45
|
||||
|
||||
sum-tracer0-0.55
|
||||
{
|
||||
$settings_stats
|
||||
${__settings_stats}
|
||||
|
||||
regionType surface;
|
||||
name plane-0.55;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane-0.55;
|
||||
|
||||
operation weightedAreaIntegrate;
|
||||
// postOperation sqrt;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
// restartTime:
|
||||
// - a 'one-shot' reset at a particular time
|
||||
//
|
||||
settings_avg
|
||||
__settings_avg
|
||||
{
|
||||
type fieldAverage;
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
@ -77,7 +77,7 @@ settings_avg
|
||||
// The sqrt operation is useful when determining RMS values.
|
||||
//
|
||||
// The 'output/write' control triggers the calculation.
|
||||
settings_stats
|
||||
__settings_stats
|
||||
{
|
||||
type surfaceFieldValue;
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
@ -47,10 +47,9 @@ graphFormat raw;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
#include "sampleControls"
|
||||
|
||||
functions
|
||||
{
|
||||
#include "derivedFields"
|
||||
#include "sampling"
|
||||
// #include "samplingDebug"
|
||||
// #include "sampleCellCentres"
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
// Transcribe volume fields to surfaces.
|
||||
fieldTransfer
|
||||
{
|
||||
type surfMeshes;
|
||||
libs ("libsampling.so");
|
||||
log true;
|
||||
writeControl none;
|
||||
createOnRead true;
|
||||
executeControl timeStep;
|
||||
executeInterval 1;
|
||||
|
||||
fields (p rho U T rhoU pTotal);
|
||||
|
||||
// Remove derived fields we created prior
|
||||
removeFieldsOnExecute (rhoU pTotal);
|
||||
|
||||
_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;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,40 +0,0 @@
|
||||
// -*- 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,16 +1,134 @@
|
||||
// -*- C++ -*-
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1812 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
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 ("libfieldFunctionObjects.so");
|
||||
log on;
|
||||
enabled true;
|
||||
|
||||
#include "derivedFields"
|
||||
#include "fieldTransfer"
|
||||
writeControl timeStep;
|
||||
writeInterval 1;
|
||||
|
||||
writeFields false;
|
||||
surfaceFormat vtk;
|
||||
// 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 ("libsampling.so");
|
||||
log true;
|
||||
|
||||
executeControl timeStep;
|
||||
executeInterval 1;
|
||||
writeControl none;
|
||||
sampleOnExecute true;
|
||||
|
||||
surfaceFormat none;
|
||||
|
||||
fields (p rho U T rhoU pTotal);
|
||||
|
||||
// Remove derived fields we created prior
|
||||
removeFieldsOnExecute (rhoU pTotal);
|
||||
|
||||
_plane
|
||||
{
|
||||
type plane;
|
||||
source cells;
|
||||
store true;
|
||||
|
||||
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;
|
||||
store true;
|
||||
|
||||
surfaceType triSurfaceMesh;
|
||||
surfaceName angledPlane.obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Calculations * * * * * * * * * * * * * * * //
|
||||
|
||||
massflow
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane1;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane1;
|
||||
|
||||
operation areaNormalIntegrate;
|
||||
|
||||
@ -21,8 +139,8 @@ areaAverage
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane1;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane1;
|
||||
|
||||
operation weightedAreaAverage;
|
||||
weightField rhoU;
|
||||
@ -33,8 +151,8 @@ areaIntegrate
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane1;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane1;
|
||||
|
||||
operation weightedAreaIntegrate;
|
||||
weightField rhoU;
|
||||
@ -46,8 +164,8 @@ UI1
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane1;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane1;
|
||||
|
||||
operation uniformity;
|
||||
fields ( U T );
|
||||
@ -59,8 +177,8 @@ UI2
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane2;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane2;
|
||||
|
||||
operation uniformity;
|
||||
fields ( U T );
|
||||
@ -72,8 +190,8 @@ UI3
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane3;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane3;
|
||||
|
||||
operation uniformity;
|
||||
fields ( U T );
|
||||
@ -86,8 +204,8 @@ T_UI1
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane1;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane1;
|
||||
|
||||
operation weightedUniformity;
|
||||
weightField T;
|
||||
@ -100,8 +218,8 @@ rhoU_UI1
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane1;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane1;
|
||||
|
||||
operation weightedUniformity;
|
||||
weightField rhoU;
|
||||
@ -114,8 +232,8 @@ rhoU_UI2
|
||||
{
|
||||
${__surfaceFieldValue}
|
||||
|
||||
regionType surface;
|
||||
name plane2;
|
||||
regionType functionObjectSurface;
|
||||
name sampled.plane2;
|
||||
|
||||
operation weightedUniformity;
|
||||
weightField rhoU;
|
||||
@ -123,4 +241,9 @@ rhoU_UI2
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Cleanup * * * * * * * * * * * * * * * * //
|
||||
|
||||
#remove "__.*"
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user