functionObjects: Added patchCutLayerAverage

This function object writes graphs of patch face values, area-averaged in
planes perpendicular to a given direction. It adaptively grades the
distribution of graph points to match the resolution of the mesh.

Example of function object specification:

    patchCutLayerAverage1
    {
        type            patchCutLayerAverage;
        libs            ("libpatchCutLayerAverageFunctionObject.so");

        writeControl    writeTime;
        writeInterval   1;

        patch           lowerWall;
        direction       (1 0 0);
        nPoints         100;
        interpolate     no;

        fields          (p U);

        axis            x;
        setFormat       raw;
    }

A packaged function object is also included, which permits the following
syntax to be used, either with #includeFunc in the system/controlDict,
or with the -func option to foamPostProcess:

    graphPatchCutLayerAverage
    (
        funcName=aerofoilLowerPressure,
        patch=aerofoilLower,
        direction=(0.15 -0.016 0),
        nPoints=100,
        p
    )
This commit is contained in:
Will Bainbridge
2022-12-02 21:56:01 +00:00
parent 2b9cfc1902
commit 8208ca6cc7
9 changed files with 1202 additions and 157 deletions

View File

@ -220,13 +220,30 @@ boundary
(27 28 57 56)
);
}
hydrofoil
hydrofoilTip
{
type wall;
inGroups (hydrofoil);
faces
(
(12 13 42 41)
);
}
hydrofoilLower
{
type wall;
inGroups (hydrofoil);
faces
(
(12 16 45 41)
);
}
hydrofoilUpper
{
type wall;
inGroups (hydrofoil);
faces
(
(13 16 45 42)
);
}

View File

@ -54,9 +54,50 @@ maxDeltaT 1e-4;
functions
{
#includeFunc yPlus(phase=liquid)
#includeFunc cellMin(funcName=min, alpha.liquid, alpha.gas, p, p_rgh, U.liquid, U.gas, T.gas, T.liquid)
#includeFunc cellMax(funcName=max, alpha.liquid, alpha.gas, p, p_rgh, U.liquid, U.gas, T.gas, T.liquid)
#includeFunc hydrofoilPressure
#includeFunc cellMin
(
funcName=min,
alpha.liquid,
alpha.gas,
p,
p_rgh,
U.liquid,
U.gas,
T.gas,
T.liquid
)
#includeFunc cellMax
(
funcName=max,
alpha.liquid,
alpha.gas,
p,
p_rgh,
U.liquid,
U.gas,
T.gas,
T.liquid
)
#includeFunc graphPatchCutLayerAverage
(
funcName=hydrofoilLowerPressure,
patch=hydrofoilLower,
direction=(0.15 -0.016 0),
nPoints=100,
p
)
#includeFunc graphPatchCutLayerAverage
(
funcName=hydrofoilUpperPressure,
patch=hydrofoilUpper,
direction=(0.15 -0.016 0),
nPoints=100,
p
)
}

View File

@ -1,149 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
type sets;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
setFormat raw;
fields (p);
axis xyz;
sets
(
lower
{
type boundaryPoints;
axis xyz;
points
(
(0 0 0)
(0.003 -0.0003 0)
(0.006 -0.0006 0)
(0.009 -0.0009 0)
(0.012 -0.0012 0)
(0.015 -0.0015 0)
(0.018 -0.0018 0)
(0.021 -0.0021 0)
(0.024 -0.0024 0)
(0.027 -0.0027 0)
(0.03 -0.003 0)
(0.033 -0.0033 0)
(0.036 -0.0036 0)
(0.039 -0.0039 0)
(0.042 -0.0042 0)
(0.045 -0.0045 0)
(0.048 -0.0048 0)
(0.051 -0.0051 0)
(0.054 -0.0054 0)
(0.057 -0.0057 0)
(0.06 -0.006 0)
(0.063 -0.0063 0)
(0.066 -0.0066 0)
(0.069 -0.0069 0)
(0.072 -0.0072 0)
(0.075 -0.0075 0)
(0.078 -0.0078 0)
(0.081 -0.0081 0)
(0.084 -0.0084 0)
(0.087 -0.0087 0)
(0.09 -0.009 0)
(0.093 -0.0093 0)
(0.096 -0.0096 0)
(0.099 -0.0099 0)
(0.102 -0.0102 0)
(0.105 -0.0105 0)
(0.108 -0.0108 0)
(0.111 -0.0111 0)
(0.114 -0.0114 0)
(0.117 -0.0117 0)
(0.12 -0.012 0)
(0.123 -0.0123 0)
(0.126 -0.0126 0)
(0.129 -0.0129 0)
(0.132 -0.0132 0)
(0.135 -0.0135 0)
(0.138 -0.0138 0)
(0.141 -0.0141 0)
(0.144 -0.0144 0)
(0.147 -0.0147 0)
(0.15 -0.015 0)
);
patches (hydrofoil);
maxDistance 1;
}
upper
{
type boundaryPoints;
axis xyz;
points
(
(0 0.015 0)
(0.003 0.0147 0)
(0.006 0.0144 0)
(0.009 0.0141 0)
(0.012 0.0138 0)
(0.015 0.0135 0)
(0.018 0.0132 0)
(0.021 0.0129 0)
(0.024 0.0126 0)
(0.027 0.0123 0)
(0.03 0.012 0)
(0.033 0.0117 0)
(0.036 0.0114 0)
(0.039 0.0111 0)
(0.042 0.0108 0)
(0.045 0.0105 0)
(0.048 0.0102 0)
(0.051 0.0099 0)
(0.054 0.0096 0)
(0.057 0.0093 0)
(0.06 0.009 0)
(0.063 0.0087 0)
(0.066 0.0084 0)
(0.069 0.0081 0)
(0.072 0.0078 0)
(0.075 0.0075 0)
(0.078 0.0072 0)
(0.081 0.0069 0)
(0.084 0.0066 0)
(0.087 0.0063 0)
(0.09 0.006 0)
(0.093 0.0057 0)
(0.096 0.0054 0)
(0.099 0.0051 0)
(0.102 0.0048 0)
(0.105 0.0045 0)
(0.108 0.0042 0)
(0.111 0.0039 0)
(0.114 0.0036 0)
(0.117 0.0033 0)
(0.12 0.003 0)
(0.123 0.0027 0)
(0.126 0.0024 0)
(0.129 0.0021 0)
(0.132 0.0018 0)
(0.135 0.0015 0)
(0.138 0.0012 0)
(0.141 0.0009 0)
(0.144 0.0006 0)
(0.147 0.0003 0)
(0.15 0 0)
);
patches (hydrofoil);
maxDistance 1;
}
);
// ************************************************************************* //

View File

@ -6,8 +6,8 @@ then
exit 1
fi
lowerFile=postProcessing/hydrofoilPressure/$(foamListTimes -latestTime)/lower.xy
upperFile=postProcessing/hydrofoilPressure/$(foamListTimes -latestTime)/upper.xy
lowerFile=postProcessing/hydrofoilLowerPressure/$(foamListTimes -latestTime)/patchCutLayerAverage.xy
upperFile=postProcessing/hydrofoilUpperPressure/$(foamListTimes -latestTime)/patchCutLayerAverage.xy
gnuplot<<EOF
@ -38,8 +38,8 @@ rhoInf = 998.4
set xlabel 'x/L'
set ylabel 'Cp'
plot [0:1] \
'$lowerFile' u (\$1/0.15):(2*(\$4-pInf)/(rhoInf*UInf*UInf)) w l lt 1 t 'Simulation Lower', \
'$upperFile' u (\$1/0.15):(2*(\$4-pInf)/(rhoInf*UInf*UInf)) w l lt 2 t 'Simulation Upper', \
'$lowerFile' u (\$2/0.15):(2*(\$6-pInf)/(rhoInf*UInf*UInf)) w l lt 1 t 'Simulation Lower', \
'$upperFile' u (\$2/0.15):(2*(\$6-pInf)/(rhoInf*UInf*UInf)) w l lt 2 t 'Simulation Upper', \
'\$experiment' u 1:2 w p lt rgb "black" pt 4 t 'Experiment'
EOF