Files
OpenFOAM-12/tutorials/incompressibleVoF/trayedPipe/system/topoSetDict
Will Bainbridge fbfd35dfc4 prghCyclicPressure: New cyclic boundary condition for p_rgh
This boundary condition provides a cyclic condition for p_rgh. It applies
corrections to the value and gradient on both sides of the cyclic to
account for the non-cylicity of the gravitational force.

This condition is only needed when the cyclic patches have a transformation
and a normal component in the direction of gravity. If the cyclic patches
are orthogonal to the direction gravity, then a normal cyclic boundary
condition can be used instead.

Care must be taken when using this boundary condition that the simulation
is actually cyclic. The following constraints apply:

- Both cyclic patches must be oriented in the same way with respect to
  gravity. In practice this means that applicability is limited to cyclics
  with translational transformations.

- The model cannot have any dependence on the absolute value of the
  pressure field. The absolute value of the pressure, in reality, varies
  between each repetition of the geometry; it is not actually formally
  cyclic. Only the gradient of the pressure field can be truly cyclic. This
  model is therefore only valid if the absolute value of the pressure is
  arbitrary, and only the gradient has an effect on the solution. This is
  the case for incompressible multiphase solutions or incompressible
  Boussinesq-like models of density variation. It is not true if (for
  example) a compressible thermodynamic model is being used.

Specification is as follows. A "patchType" entry must be provided to
indicate that this condition overrides the underlying cyclic constraint,
and a "rhoInf" entry is needed (by the owner patch only) to specify the
density of the far-field environment. For example:

    cyclicA
    {
        type            prghCyclicPressure;
        patchType       cyclic;
        rhoInf          1; // [kg/m^3]
    }

    cyclicB
    {
        type            prghCyclicPressure;
        patchType       cyclic;
    }

A tutorial, incompressibleVoF/trayedPipe, has been added to demonstrate
usage of this boundary condition.
2024-03-08 14:43:52 +00:00

129 lines
3.3 KiB
C++

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nBaffles 6;
baffleOverlap 0.4;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "blockMeshDict"
innerBaffleOuterRadius #calc "$<scalar>{radius}/(2 - $<scalar>baffleOverlap)";
outerBaffleInnerRadius #calc "$radius - $innerBaffleOuterRadius";
actions
(
// Create baffles along the length of the pipe, alternating the zone
// between "innerBaffles" and "outerBaffles"
#codeStream
{
code
#{
for (label i = 0; i < $<label>nBaffles; ++ i)
{
const scalar y =
scalar(2*i + 1)/(2*$<label>nBaffles)*$<scalar>height;
os <<
dictionary
(
"action", i<2 ? "new" : "add",
"type", "faceZoneSet",
"name", word(i%2 ? "inner" : "outer") + "Baffles",
"source", "planeToFaceZone",
"point", vector(0, y, 0),
"normal", vector(0, 1, 0)
);
}
#};
}
// Cut away the outer portion of the inner baffles
{
action new;
type faceSet;
name innerBaffles;
source zoneToFace;
zone innerBaffles;
}
{
action delete;
type faceSet;
name innerBaffles;
source cylinderAnnulusToFace;
point1 (0 0 0);
point2 (0 $height 0);
innerRadius $innerBaffleOuterRadius;
outerRadius $radius;
}
// Cut away the inner portion of the outer baffles
{
action new;
type faceSet;
name outerBaffles;
source zoneToFace;
zone outerBaffles;
}
{
action delete;
type faceSet;
name outerBaffles;
source cylinderToFace;
point1 (0 0 0);
point2 (0 $height 0);
radius $outerBaffleInnerRadius;
}
// Combine inner and outer baffles into a single zone
{
action new;
type faceZoneSet;
name baffles;
source setAndNormalToFaceZone;
set innerBaffles;
normal (0 1 0);
}
{
action add;
type faceZoneSet;
name baffles;
source setAndNormalToFaceZone;
set outerBaffles;
normal (0 1 0);
}
// Clean up
{
action remove;
type faceSet;
name innerBaffles;
}
{
action remove;
type faceSet;
name outerBaffles;
}
{
action remove;
type faceSet;
name baffles;
}
);
// ************************************************************************* //