Files
OpenFOAM-12/tutorials/modules/incompressibleFluid/blockedChannel/system/generateAlphas
Henry Weller ca89189ecd solvers::incompressibleFluid: New solver module for incompressible fluid flow
executed with foamRun for single region simulations of foamMultiRun for
multi-region simulations.  Replaces pimpleFoam, pisoFoam and simpleFoam and all
the corresponding tutorials have been updated and moved to
tutorials/modules/incompressibleFluid.

Class
    Foam::solvers::incompressibleFluid

Description
    Solver module for steady or transient turbulent flow of incompressible
    isothermal fluids with optional mesh motion and change.

    Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
    pseudo-transient and steady simulations.

    Optional fvModels and fvConstraints are provided to enhance the simulation
    in many ways including adding various sources, constraining or limiting
    the solution.

    Reference:
    \verbatim
        Greenshields, C. J., & Weller, H. G. (2022).
        Notes on Computational Fluid Dynamics: General Principles.
        CFD Direct Ltd.: Reading, UK.
    \endverbatim

SourceFiles
    incompressibleFluid.C

See also
    Foam::solvers::fluidSolver
    Foam::solvers::isothermalFluid
2022-08-08 22:46:51 +01:00

43 lines
1.2 KiB
C++

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
type coded;
libs ("libutilityFunctionObjects.so");
name generateAlpha;
codeWrite
#{
const dimensionedVector dx(dimless/dimLength, vector(1, 0, 0));
const dimensionedVector dy(dimless/dimLength, vector(0, 1, 0));
const volScalarField x(mesh().C() & dx), y(mesh().C() & dy);
const scalar x0 = 0.032, x1 = 0.064, x2 = 0.128, x3 = 0.224;
const volScalarField f
(
pos(x - x0)*pos(x1 - x)*(x - x0)/(x1 - x0)
+ pos(x - x1)*pos(x2 - x)
+ pos(x - x2)*pos(x3 - x)*(x3 - x)/(x3 - x2)
);
volScalarField
(
IOobject
(
IOobject::groupName("alpha", "volume"),
mesh().time().constant(),
mesh()
),
0.5*pos(y - (-0.088))*pos((-0.056) - y)*f
).write();
#};
// ************************************************************************* //