Commit Graph

102 Commits

Author SHA1 Message Date
985ec93636 dragModels::segregated: Corrected the muAlphaI expression
Corrected according to the original reference:
    Marschall, H. (2011).
    Towards the numerical simulation of multi-scale two-phase flows.
    PhD Thesis, TU München.
2024-04-03 17:33:58 +01:00
24a3bfdd17 DimensionedField, GeometricField: Consistent field-access interface 2024-04-03 15:14:45 +01:00
d8df578920 solvers::functions: Prevent creation of a functions sub-solver 2024-03-15 14:49:47 +00:00
18504eef62 phaseTransferModels::reactionDriven: Corrected access to species names 2024-03-12 11:01:15 +00:00
2dd82773fc multiphaseEuler: phaseTransferModels::reactionDriven: Permit transfers in both directions
The syntax of this model has changed to permit transfers of species in
either direction. A list of transferring species is now given for each
phase, rather than identifying a single reacting phase. For example:

    phaseTransfer
    (
        vapour_particles
        {
            type reactionDriven;

            // TiO2 and TiO2_s are created by reactions in the vapour
            // and are then transferred to the particles
            species.vapour (TiO2 TiO2_s);

            // H2O is created by reactions in the particles and is then
            // transferred to the vapour
            species.particles (H2O);
        }
    );
2024-03-05 11:28:06 +00:00
c161539597 filmEjectionModels::BrunDripping: Removed unnecessary ejectionModel::correct() 2024-03-04 15:40:03 +00:00
4d3228d2f6 fvModels: Removed "Base" suffix from classes with no similarly named derivation 2024-02-20 21:48:57 +00:00
046680c4a8 multiphaseEuler: Added homogeneous nucleation models
These models represent a phase nucleating directly out of a
multi-component mixture into isolated particles (i.e., homogeneous),
rather than onto an existing surface or impurity (heterogeneous).

The homogeneousCondensation model can represent the initial stages of a
gas condensing into a liquid. Example usage, in constant/fvModels:

    homogeneousCondensation
    {
        type            homogeneousCondensation;
        libs            ("libmultiphaseEulerFvModels.so");

        // Phases between which the transfer occurs. The first phase is the
        // gas, and the second is the condensed liquid.
        phases          (gas water);

        // The specie that is condensing
        specie          H2O;

        // Linearise the latent heat contribution into the energy equation?
        energySemiImplicit no;

        // Saturation curve for the specie in the gaseous phase
        pSat            ArdenBuck;
    }

The homogeneousLiquidPhaseSeparation model can represent the initial
stages of a liquid solution precipitating out a solid or separating into
two immiscible liquid phases: Example usage, in constant/fvModels:

    homogeneousLiquidPhaseSeparation
    {
        type            homogeneousLiquidPhaseSeparation;
        libs            ("libmultiphaseEulerFvModels.so");

        // Phases between which the transfer occurs. The first phase is the
        // solution, and the second is the precipitate.
        phases          (liquid sugar);

        // The specie that is condensing
        specie          C2H12O6;

        // Linearise the latent heat contribution into the energy equation?
        energySemiImplicit no;

        // Solubility given in mass of solute per mass of solvent
        solubility      constant 0.9;
    }

If population balance is being used, then both of these models require a
source term to be applied to the size-group equations. This is achieved
by means of a new nucleationSizeGroup field source. Example usage, in
0/fDefault.water:

    sources
    {
        homogeneousCondensation
        {
            type            nucleationSizeGroup;
            libs            ("libmultiphaseEulerFvModels.so");
        }
    }
2024-02-09 12:57:00 +00:00
098f7f8e57 populationBalance: Volumetric allocation coefficient
Functions have been added to populationBalance to generate the
volumetric allocation coefficient etaV. This is needed if a volume or
mass source is to be conveniently distributed into the size groups. The
number-based allocation coefficient, eta, is still available and is
still used in all cases within populationBalance.

The allocation bounds handling has been removed. This, as it turns out,
was just an incomplete subset of having both number- and volume-based
allocation coefficients implemented.
2024-02-09 12:13:56 +00:00
b4b98c1e35 multiphaseEuler: Corrected file names in model construction error messages 2024-02-09 12:13:55 +00:00
a3e38977c6 nonConformalMappedWall: New patch type for connecting regions
A new nonConformalMappedWall patch type has been added which can couple
between different regions of a multi-region simulation. This patch type
uses the same intersection algorithm as the nonConformalCyclic patch,
which is used for coupling sections of a mesh within the same region.

The nonConformalMappedWall provides some advantages over the existing
mappedWall patches:

  - The connection it creates is not interpolative. It creates a pair of
    coupled finite-volume faces wherever two opposing faces overlap.
    There is therefore no interpolation error associated with mapping
    values across the coupling.

  - Faces (or parts of faces) which do not overlap are not normalised
    away by an interpolation or averaging process. Instead, they are
    assigned an alternative boundary condition; e.g., an external
    constraint, or even another non-conformal cyclic or mapped wall.
    This makes the system able to construct partially-overlapping
    couplings.

  - The direct non-interpolative transfer of values between the patches
    makes the method equivalent to a conformal coupling. Properties of
    the solution algorithm, such as conservation and boundedness, are
    retained regardless of the non-conformance of the boundary meshes.

  - All constructed finite volume faces have accurate centre points.
    This makes the method second order accurate in space.

Usage:

Non-conformal mapped wall couplings are constructed as the last stage of
a multi-region meshing process. First, a multi-region mesh is
constructed in one of the usual ways, but with the boundaries specified
as standard non-coupled walls instead of a special mapped type. Then,
createNonConformalCouples is called to construct non-conformal mapped
patches that couple overlapping parts of these non-coupled walls. This
process is very similar to the construction of non-conformal cyclics.

createNonConformalCouples requires a
system/createNonConformalCouplesDict in order to construct non-conformal
mapped walls. Each coupling is specified in its own sub-dictionary, and
a "regions" entry is used to specify the pair of regions that the
non-conformal mapped wall will couple. Non-conformal cyclics can also be
created using the same dictionary, and will be assumed if the two
specified regions are the same, or if a single "region" entry is
specified. For example:

    // Do not modify the fields
    fields  no;

    // List of non-conformal couplings
    nonConformalCouples
    {
        // Non-conformal cyclic interface. Only one region is specified.
        fluidFluid
        {
            region      fluid;
            originalPatches (nonCoupleRotating nonCoupleStationary);
        }

        // Non-conformal mapped wall interface. Two different regions
        // have been specified.
        fluidSolid
        {
            regions     (fluid solid);
            originalPatches (nonCoupleRotating nonCoupleStationary);
        }
    }

After this step, a case should execute with foamMultiRun and decompose
and reconstruct and post-process normally.

One additional restriction for parallelised workflows is that
decomposition and reconstruction must be done with the -allRegions
option, so that the both sides of the coupling are available to the
decomposition/reconstruction algorithm.

Tutorials:

Two tutorials have been added to demonstrate use of this new
functionality:

  - The multiRegion/CHT/misalignedDuct case provides a simple visual
    confirmation that the patches are working (the exposed corners of
    the solid will be hot if the non-conformal mapped walls are active),
    and it demonstrates createNonConformalCouples's ability to add
    boundary conditions to existing fields.

  - The multiRegion/CHT/notchedRoller case demonstrates use of
    non-conformal mapped walls with a moving mesh, and also provides an
    example of parallelised usage.

Notes for Developers:

A coupled boundary condition now uses a new class,
mappedFvPatchBaseBase, in order to perform a transfer of values to or
from the neighbouring patch. For example:

    // Cast the patch type to it's underlying mapping engine
    const mappedFvPatchBaseBase& mapper =
        mappedFvPatchBaseBase::getMap(patch());

    // Lookup a field on the neighbouring patch
    const fvPatchScalarField& nbrTn =
        mapper.nbrFvPatch().lookupPatchField<volScalarField, scalar>("T");

    // Map the values to this patch
    const scalarField Tn(mapper.fromNeighbour(nbrTn));

For this to work, the fvPatch should be of an appropriate mapped type
which derives from mappedFvPatchBaseBase. This mappedFvPatchBaseBase
class provides an interface to to both conformal/interpolative and
non-conformal mapping procedures. This means that a coupled boundary
condition implemented in the manner above will work with either
conformal/interpolative or non-conformal mapped patch types.

Previously, coupled boundary conditions would access a mappedPatchBase
base class of the associated polyPatch, and use that to transfer values
between the patches. This direct dependence on the polyPatch's mapping
engine meant that only conformal/interpolative fvPatch fields that
corresponded to the polyPatch's geometry could be mapped.
2024-01-30 11:21:58 +00:00
f1ab9882c7 solvers: Split moveMesh from motionCorrector
This is so that stitching is complete across all regions before any FV
operations are attempted.
2024-01-30 09:10:58 +00:00
87c8e5a7c7 VoFSolidificationMelting: Removed unused variable 2024-01-26 10:04:34 +00:00
9886fea313 BasicThermo::Cp: volScalarField reference optimisations
Now that BasicThermo::Cp returns a volScalarField reference because Cp is cached
in BasicThermo code calling Cp can hold a reference rather than a copy for
efficiency.
2024-01-25 13:55:57 +00:00
11b2951a79 Prevent warnings from Gcc 13.2.1 and Clang 17.0.6 2024-01-16 14:09:38 +00:00
2f724bdc91 multiphaseEuler::phaseModel: Changed the phase-fraction field construction to work around a problem with Clang
The Clang compiler does not use std::move to transfer the result of the ternary
operator into the phase-fraction field resulting in it not being registered to
the database.  To work around this limitation/bug the ternary operator is now
provided with tmp fields the result of which is passed with an IOobject to the
final field constructor to ensure it is registered and the IO options set
correctly.
2024-01-12 15:18:07 +00:00
20f5235ecf Renamed ID() -> Index()
Index is a better name to describe a label index than ID which may be an
integer, word or other means of identification.
2023-12-20 18:39:55 +00:00
a99155d0f0 Renamed IDs() -> Indices()
Indices is a better name to describe label indices than IDs which may be an
integers, words or other means of identification.
2023-12-20 14:29:23 +00:00
3c347ca566 solvers::solid::thermophysicalPredictor: Moved thermo correction into the non-orthogonality correction loop
Resolves bug-report https://bugs.openfoam.org/view.php?id=4043
2023-12-20 10:23:13 +00:00
621740e90b polyBoundaryMesh::findPatchID,findPatchIDs: renamed findIndex,findIndices
Index is a better name to describe a label index than ID which may be an
integer, word or other means of identification.
2023-12-16 13:27:12 +00:00
d5df0a96f1 populationBalance: Allocation coefficient bounds handling
An enumeration has been added to the arguments of the allocation
coefficient function, eta, to allow specification of how to allocate out
of bounds of the population balance size-groups. There are two options:

- "Clamp" will create an out-of-bounds allocation coefficient of exactly
  one. This partitions unity across all size-space.

- "Extrapolate" will create an out-of-bounds allocation coefficient in
  proportion to the ratio between the given size and the nearest
  size-group size. This does not partition unity outside the range of
  the size-groups.

The previous operation is equivalent to "Extrapolate".

It is not yet clear which method is preferable and under what
circumstances. More testing is required. The enumeration has been
created to facilitate this testing.
2023-12-15 10:05:43 +00:00
947dd44188 multicomponentThermo: Dimensioned constant specie properties
The specie molecular mass (Wi) and formation enthalpy (hfi) methods now
return dimensioned scalars. This permits their direct inclusion into
dimensioned field expressions. Non-dimensioned methods have been
retained with a "Value" suffix (i.e., WiValue and hfiValue).
2023-12-06 21:29:47 +00:00
e1d6448fcf twoPhaseSolver: Store the flux of the non-solved-for phase
This flux is needed for boundary conditions, post-processing and
Euler-Euler-like sub-models and functions
2023-12-06 12:09:31 +00:00
abe43a9532 thermo: Standardise property names and remove molar functions
All property functions in the low-level templated thermo property
implementations and the high-level virtual interfaces have been made
consistent. All energies and enthalpies are lower case to denote that
they are specific quantities. Molar functions have been removed as these
are no longer used anywhere.
2023-12-01 17:11:59 +00:00
5ab61c60de basicThermo: Make molar mass available to basic thermos 2023-12-01 16:54:08 +00:00
71493091de wallDist: Changed from TopoChangeableMeshObject to DeletableMeshObject
The nearWallDist MeshObject is now deleted on mesh-change rather than updated
which is more efficient for cases with multiple mesh changes, e.g. motion,
stitching and mapping by avoiding unnecessary updates.

As a consequence of this change the wallDist::y() volScalarField reference
should not be cached across mesh changes so the turbulence models now obtain the
y field as required from the new momentumTransportModel::y() function, the
original near-wall distance function is now named momentumTransportModel::yb()
to clarify that it is the wall distance of the boundary cells.
2023-12-01 16:30:01 +00:00
5659e372f3 modules/solid: Calculate DiNum before mesh update
This is consistent with the fluid solvers, and prevents failures
associated with using fields that haven't yet been updated or corrected
following mesh changes
2023-11-29 14:46:35 +00:00
f6f55caf02 Removed "<modelType>Type type" tautology in selection error messages 2023-11-28 16:40:42 +00:00
01d0af39be multiphaseEuler: Added Prandtl heat transfer model
This simple model creates a heat transfer coefficient in proportion with
the corresponding drag model's momentum transfer coefficient. A
user-defined Prandtl number and a harmonic average of the phases'
specific heats are used to specify the constant of proportionality.

This model has no physical basis. It exists primarily for testing
purposes. It has the advantage of being applicable to any interface,
including those representing segregated configurations.

Example usage:

    heatTransfer
    {
        gas_segregatedWith_liquid
        {
            type            Prandtl;
            Pr              0.7;
        }
    }
2023-11-28 12:39:34 +00:00
cef86f598a fieldMapper: Simplification
The patch-specific mapper interfaces, fvPatchFieldMapper and
pointPatchFieldMapper, have been removed as they did not do anything.
Patch mapping constructors and functions now take a basic fieldMapper
reference.

An fvPatchFieldMapper.H header has been provided to aid backwards
compatability so that existing custom boundary conditions continue to
compile.
2023-11-10 14:46:05 +00:00
42e71682cc modules/isothermalFluid: Consistent handling of rhoU_0 and rhoUf_0 2023-11-03 14:03:53 +00:00
0ed84ff137 compressibleVoF,multiphaseEuler: Renamed compressibility dilatation dgdt to vDot
Currently in compressibleVoF vDot contains only the compressibility dilatation
effect whereas in multiphaseEuler the effect of sources are also included but
this will be refactored shortly so that the handling of mass sources and
compressibility is consistent between VoF and Euler-Euler solvers.

The previously hard-coded 1e-4 division stabilisation used when linearising vDot
for bounded semi-implicit solution of the phase-fractions is now an optional
user-input with keyword vDotResidualAlpha, e.g. in multiphaseEuler:

solvers
{
    "alpha.*"
    {
        nAlphaCorr          1;
        nAlphaSubCycles     2;
        vDotResidualAlpha   1e-6;
    }
    .
    .
    .
2023-11-03 13:19:52 +00:00
7ec1e2f1a5 twoPhaseSolver::alphaPredictor: Ensure the Crank-Nicolson blended alpha1 has the same BCs as alpha1
so that compressive interpolations schemes such as PLIC and MPLIC can handle the
BCs appropriately.
2023-11-02 17:10:01 +00:00
95110422a2 multiphaseEuler: Only request pressure from moving phases 2023-10-16 19:42:57 +01:00
6dc6d3d089 phaseSystem::correctKinematics:: Ensure pressure is requested only for moving phase
The pressure field is not available from stationary solid phases.
2023-10-16 19:41:39 +01:00
1845584e09 multiphaseEuler::facePressureCorrector: Request velocity from the first moving phase 2023-10-16 19:38:30 +01:00
e0bdf2405e fvModels: Remove 'Source' from names
The fact that these names create sources in their associated transport
equations is clear in context, so the name does not need to contain
'Source'.

Having 'Source' in the name is a historic convention that dates back to
when fvModels and fvConstraints were combined in a single fvOptions
interface. In this interface, disambiguation between sources and
constraints was necessary.

The full set of name changes is as follows:

                   accelerationSource -> acceleration
                  actuationDiskSource -> actuationDisk
     effectivenessHeatExchangerSource -> effectivenessHeatExchanger
               explicitPorositySource -> porosityForce
            radialActuationDiskSource -> radialActuationDisk
                      rotorDiskSource -> rotorDisk
             sixDoFAccelerationSource -> sixDoFAcceleration
         solidEquilibriumEnergySource -> solidThermalEquilibrium
          solidificationMeltingSource -> solidificationMelting
                 volumeFractionSource -> volumeBlockage
    interRegionExplicitPorositySource -> interRegionPorosityForce
       VoFSolidificationMeltingSource -> VoFSolidificationMelting

The old names are still available for backwards compatibility.
2023-10-13 09:53:32 +01:00
ad3d25dc30 multiphaseEuler::IsothermalSolidPhaseModel: New phase model for isothermal stationary solid phases
IsothermalSolidPhaseModel does not update energy and density from pressure
whereas IsothermalPhaseModel does to allow compressible fluid phases to change
volume due to pressure changes.
2023-10-12 16:24:31 +01:00
5e03874bbb multiphaseEuler: Updated to us the new phaseSolidThermophysicalTransportModel class
for thermophysical transport within stationary solid phases.  This provides a
consistent interface to heat transport within solids for single and now
multiphase solvers so that for example the wallHeatFlux functionObject can now
be used with multiphaseEuler, see tutorials/multiphaseEuler/boilingBed.
Also this development supports anisotropic thermal conductivity within the
stationary solid regions which was not possible previously.

The tutorials/multiphaseEuler/bed and tutorials/multiphaseEuler/boilingBed
tutorial cases have been updated for phaseSolidThermophysicalTransportModel by
changing the thermo type in physicalProperties.solid to heSolidThermo.  This
change will need to be made to all multiphaseEuler cases involving stationary
phases.
2023-10-11 14:53:09 +01:00
0951029513 modules/twoPhaseSolver: Include divU into MULES corrector
This improves convergence in situations with substantial source-based
divergence, such as injections and phase changes.
2023-10-06 11:21:14 +01:00
084bd015f1 modules::shockFluid: Clear temporary fluxed if NCC interfaces are updated
Resolves bug-report https://bugs.openfoam.org/view.php?id=4020
2023-10-05 12:37:41 +01:00
a5ea0b41f1 fvModels: Improved interface for mass/volume sources
The interface for fvModels has been modified to improve its application
to "proxy" equations. That is, equations that are not straightforward
statements of conservation laws in OpenFOAM's usual convention.

A standard conservation law typically takes the following form:

    fvMatrix<scalar> psiEqn
    (
        fvm::ddt(alpha, rho, psi)
      + <fluxes>
     ==
        <sources>
    );

A proxy equation, on the other hand, may be a derivation or
rearrangement of a law like this, and may be linearised in terms of a
different variable.

The pressure equation is the most common example of a proxy equation. It
represents a statement of the conservation of volume or mass, but it is
a rearrangement of the original continuity equation, and it has been
linearised in terms of a different variable; the pressure. Another
example is that in the pre-predictor of a VoF solver the
phase-continuity equation is constructed, but it is linearised in terms
of volume fraction rather than density.

In these situations, fvModels sources are now applied by calling:

    fvModels().sourceProxy(<conserved-fields ...>, <equation-field>)

Where <conserved-fields ...> are (alpha, rho, psi), (rho, psi), just
(psi), or are omitted entirely (for volume continuity), and the
<equation-field> is the field associated with the proxy equation. This
produces a source term identical in value to the following call:

    fvModels().source(<conserved-fields ...>)

It is only the linearisation in terms of <equation-field> that differs
between these two calls.

This change permits much greater flexibility in the handling of mass and
volume sources than the previous name-based system did. All the relevant
fields are available, dimensions can be used in the logic to determine
what sources are being constructed, and sources relating to a given
conservation law all share the same function.

This commit adds the functionality for injection-type sources in the
compressibleVoF solver. A following commit will add a volume source
model for use in incompressible solvers.
2023-09-28 09:04:31 +01:00
da442e8eab multiphaseEuler: Replaced pPrime() with pPrimef()
to provide greater flexibility in the treatment of the face pPrime for particle
phase pressure models.
2023-09-22 16:16:49 +01:00
533421f91a multiphaseEuler: Removed redundant files 2023-09-21 13:09:01 +01:00
597121a4a7 multiphaseEuler: Library reorganisation
This change makes multiphaseEuler more consistent with other modules and
makes its sub-libraries less inter-dependent. Some left-over references
to multiphaseEulerFoam have also been removed.
2023-09-15 14:45:26 +01:00
0b321e3eea isothermalFilm: Corrected impingement pressure transfer
The previous implementation was dimensionally inconsistent and was
missing a factor of the VbyA field. This change will, in most cases,
reduce the total impingement pressure contribution.
2023-09-15 12:01:57 +01:00
9c3a404533 multiphaseEuler::cellPressureCorrector: Added p_rgh update before PISO loop
to ensure consistency between p_rgh, p and the current phase densities updated
after the phase energy solution.
2023-09-15 08:13:13 +01:00
6c24251a37 Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2023-09-14 20:53:36 +01:00
c8a63f2da3 multiphaseEuler::phaseSystemSolve: Corrected handling of dilatation effects
in the presence of stationary phases
2023-09-14 20:52:41 +01:00
69ec807f59 wmakeLnInclude: Don't link to files in sub-libraries 2023-09-14 17:21:05 +01:00