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.
This commit is contained in:
@ -257,6 +257,7 @@ $(derivedFvPatchFields)/PrghPressure/prghPressureFvPatchScalarFields.C
|
||||
$(derivedFvPatchFields)/prghTotalHydrostaticPressure/prghTotalHydrostaticPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/fixedValueInletOutlet/fixedValueInletOutletFvPatchFields.C
|
||||
$(derivedFvPatchFields)/transonicEntrainmentPressure/transonicEntrainmentPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/prghCyclicPressure/prghCyclicPressureFvPatchScalarField.C
|
||||
|
||||
fvsPatchFields = fields/fvsPatchFields
|
||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||
|
||||
@ -0,0 +1,207 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "prghCyclicPressureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvcSnGrad.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::prghCyclicPressureFvPatchScalarField::prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
jumpCyclicFvPatchScalarField(p, iF, dict),
|
||||
rhoName_
|
||||
(
|
||||
cyclicPatch().owner()
|
||||
? dict.lookupOrDefault<word>("rho", "rho")
|
||||
: word::null
|
||||
),
|
||||
rhoInf_(cyclicPatch().owner() ? dict.lookup<scalar>("rhoInf") : NaN),
|
||||
jump_(p.size(), Zero)
|
||||
{
|
||||
if (dict.found("jump"))
|
||||
{
|
||||
jump_ = scalarField("jump", dict, p.size());
|
||||
}
|
||||
|
||||
evaluateNoUpdateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
Foam::prghCyclicPressureFvPatchScalarField::prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
const prghCyclicPressureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fieldMapper& mapper
|
||||
)
|
||||
:
|
||||
jumpCyclicFvPatchScalarField(ptf, p, iF, mapper),
|
||||
rhoName_(ptf.rhoName_),
|
||||
rhoInf_(ptf.rhoInf_),
|
||||
jump_(mapper(ptf.jump_))
|
||||
{}
|
||||
|
||||
|
||||
Foam::prghCyclicPressureFvPatchScalarField::prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
const prghCyclicPressureFvPatchScalarField& ptf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
jumpCyclicFvPatchScalarField(ptf, iF),
|
||||
rhoName_(ptf.rhoName_),
|
||||
rhoInf_(ptf.rhoInf_),
|
||||
jump_(ptf.jump_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::prghCyclicPressureFvPatchScalarField::jump() const
|
||||
{
|
||||
return jump_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghCyclicPressureFvPatchScalarField::map
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const fieldMapper& mapper
|
||||
)
|
||||
{
|
||||
jumpCyclicFvPatchScalarField::map(ptf, mapper);
|
||||
|
||||
const prghCyclicPressureFvPatchScalarField& tiptf =
|
||||
refCast<const prghCyclicPressureFvPatchScalarField>(ptf);
|
||||
|
||||
mapper(jump_, tiptf.jump_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghCyclicPressureFvPatchScalarField::reset
|
||||
(
|
||||
const fvPatchScalarField& ptf
|
||||
)
|
||||
{
|
||||
jumpCyclicFvPatchScalarField::reset(ptf);
|
||||
|
||||
const prghCyclicPressureFvPatchScalarField& tiptf =
|
||||
refCast<const prghCyclicPressureFvPatchScalarField>(ptf);
|
||||
|
||||
jump_.reset(tiptf.jump_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghCyclicPressureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const volScalarField& vf =
|
||||
static_cast<const volScalarField&>(internalField());
|
||||
|
||||
const prghCyclicPressureFvPatchScalarField& nbrPf =
|
||||
refCast<const prghCyclicPressureFvPatchScalarField>(nbrPatchField());
|
||||
|
||||
const label patchi = patch().index(), nbrPatchi = nbrPf.patch().index();
|
||||
|
||||
// Buoyancy fields
|
||||
const volScalarField& rhoVf =
|
||||
db().lookupObject<volScalarField>
|
||||
(cyclicPatch().owner() ? rhoName_ : nbrPf.rhoName_);
|
||||
const volScalarField::Boundary& rhoBf = rhoVf.boundaryField();
|
||||
const surfaceScalarField::Boundary& ghfBf =
|
||||
db().lookupObject<surfaceScalarField>("ghf").boundaryField();
|
||||
|
||||
// Pressure solution fields
|
||||
const surfaceScalarField::Boundary& rAUfBf =
|
||||
db().lookupObject<surfaceScalarField>("rAUf").boundaryField();
|
||||
const surfaceScalarField::Boundary& phiHbyABf =
|
||||
db().lookupObject<surfaceScalarField>("phiHbyA").boundaryField();
|
||||
|
||||
// Delta coefficients for this field
|
||||
const tmp<surfaceScalarField> deltaCoeffsSf =
|
||||
fv::snGradScheme<scalar>::New
|
||||
(
|
||||
vf.mesh(),
|
||||
vf.mesh().schemes().snGrad(internalField().name())
|
||||
)->deltaCoeffs(vf);
|
||||
const scalarField& deltaCoeffsPf =
|
||||
deltaCoeffsSf->boundaryField()[patch().index()];
|
||||
|
||||
// Calculate the jump
|
||||
jump_ =
|
||||
(rhoBf[patchi] - (cyclicPatch().owner() ? rhoInf_ : nbrPf.rhoInf_))
|
||||
*(ghfBf[nbrPatchi] - ghfBf[patchi])
|
||||
+ (
|
||||
phiHbyABf[patchi]/rAUfBf[patchi]/patch().magSf()
|
||||
+ phiHbyABf[nbrPatchi]/rAUfBf[nbrPatchi]/nbrPf.patch().magSf()
|
||||
)*patch().weights()/deltaCoeffsPf;
|
||||
|
||||
jumpCyclicFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::prghCyclicPressureFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
|
||||
if (cyclicPatch().owner())
|
||||
{
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntry(os, "rhoInf", rhoInf_);
|
||||
}
|
||||
|
||||
writeEntry(os, "jump", jump_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
prghCyclicPressureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,217 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::prghCyclicPressureFvPatchScalarField
|
||||
|
||||
Description
|
||||
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.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
patchType | underlying patch type (should be \c cyclic) | yes |
|
||||
rhoInf | far-field density | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
<patchName>
|
||||
{
|
||||
type prghCyclicPressure;
|
||||
patchType cyclic;
|
||||
rhoInf 1;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
prghCyclicPressureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef prghCyclicPressureFvPatchScalarField_H
|
||||
#define prghCyclicPressureFvPatchScalarField_H
|
||||
|
||||
#include "jumpCyclicFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class prghCyclicPressureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class prghCyclicPressureFvPatchScalarField
|
||||
:
|
||||
public jumpCyclicFvPatchScalarField
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Name of the density field
|
||||
const word rhoName_;
|
||||
|
||||
//- Far-field density
|
||||
const scalar rhoInf_;
|
||||
|
||||
//- Jump in value from the other patch to this one
|
||||
scalarField jump_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Get the far-field density from the owner patch
|
||||
scalar rhoInf() const;
|
||||
|
||||
//- Update result field based on interface functionality
|
||||
template<class ... Cmpt>
|
||||
void updateInterfaceMatrix
|
||||
(
|
||||
scalarField& result,
|
||||
const scalarField& psiInternal,
|
||||
const scalarField& coeffs,
|
||||
const Pstream::commsTypes commsType,
|
||||
const Cmpt ... cmpt
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("prghCyclicPressure");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given fixedValueTypeFvPatchField
|
||||
// onto a new patch
|
||||
prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
const prghCyclicPressureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fieldMapper&
|
||||
);
|
||||
|
||||
//- Disallow copy without setting internal field reference
|
||||
prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
const prghCyclicPressureFvPatchScalarField&
|
||||
) = delete;
|
||||
|
||||
//- Copy constructor setting internal field reference
|
||||
prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
const prghCyclicPressureFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new prghCyclicPressureFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the "jump"
|
||||
virtual tmp<scalarField> jump() const;
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map the given fvPatchField onto this fvPatchField
|
||||
virtual void map(const fvPatchScalarField&, const fieldMapper&);
|
||||
|
||||
//- Reset the fvPatchField to the given fvPatchField
|
||||
// Used for mesh to mesh mapping
|
||||
virtual void reset(const fvPatchScalarField&);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the patch pressure gradient field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
32
tutorials/incompressibleVoF/trayedPipe/0/U
Normal file
32
tutorials/incompressibleVoF/trayedPipe/0/U
Normal file
@ -0,0 +1,32 @@
|
||||
/*--------------------------------*- 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 volVectorField;
|
||||
location "0";
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type noSlip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
32
tutorials/incompressibleVoF/trayedPipe/0/alpha.water.orig
Normal file
32
tutorials/incompressibleVoF/trayedPipe/0/alpha.water.orig
Normal file
@ -0,0 +1,32 @@
|
||||
/*--------------------------------*- 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 volScalarField;
|
||||
location "0";
|
||||
object alpha.water;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
44
tutorials/incompressibleVoF/trayedPipe/0/p_rgh
Normal file
44
tutorials/incompressibleVoF/trayedPipe/0/p_rgh
Normal file
@ -0,0 +1,44 @@
|
||||
/*--------------------------------*- 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 volScalarField;
|
||||
location "0";
|
||||
object p_rgh;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
wall
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
value $internalField;
|
||||
}
|
||||
bottom
|
||||
{
|
||||
type prghCyclicPressure;
|
||||
patchType cyclic;
|
||||
rhoInf 1;
|
||||
}
|
||||
top
|
||||
{
|
||||
type prghCyclicPressure;
|
||||
patchType cyclic;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
9
tutorials/incompressibleVoF/trayedPipe/Allclean
Executable file
9
tutorials/incompressibleVoF/trayedPipe/Allclean
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Source tutorial clean functions
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||
|
||||
cleanVoFCase
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
13
tutorials/incompressibleVoF/trayedPipe/Allrun
Executable file
13
tutorials/incompressibleVoF/trayedPipe/Allrun
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication topoSet
|
||||
runApplication createBaffles -overwrite
|
||||
runApplication setFields
|
||||
runApplication $(getApplication)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
21
tutorials/incompressibleVoF/trayedPipe/constant/g
Normal file
21
tutorials/incompressibleVoF/trayedPipe/constant/g
Normal file
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- 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 uniformDimensionedVectorField;
|
||||
location "constant";
|
||||
object g;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -2 0 0 0 0];
|
||||
value (0 -9.81 0);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
23
tutorials/incompressibleVoF/trayedPipe/constant/hRef
Normal file
23
tutorials/incompressibleVoF/trayedPipe/constant/hRef
Normal file
@ -0,0 +1,23 @@
|
||||
/*--------------------------------*- 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 uniformDimensionedScalarField;
|
||||
location "constant";
|
||||
object hRef;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "$FOAM_CASE/system/blockMeshDict"
|
||||
|
||||
dimensions [0 1 0 0 0 0 0];
|
||||
value #calc "$<scalar>{height}/2";
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,20 @@
|
||||
/*--------------------------------*- 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 "constant";
|
||||
object momentumTransport;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType laminar;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,22 @@
|
||||
/*--------------------------------*- 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 "constant";
|
||||
object phaseProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
phases (water air);
|
||||
|
||||
sigma 0.07;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- 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 "constant";
|
||||
object physicalProperties.air;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
viscosityModel constant;
|
||||
|
||||
nu 1.48e-05;
|
||||
|
||||
rho 1;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- 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 "constant";
|
||||
object physicalProperties.water;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
viscosityModel constant;
|
||||
|
||||
nu 1e-06;
|
||||
|
||||
rho 1000;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
89
tutorials/incompressibleVoF/trayedPipe/system/blockMeshDict
Normal file
89
tutorials/incompressibleVoF/trayedPipe/system/blockMeshDict
Normal file
@ -0,0 +1,89 @@
|
||||
/*--------------------------------*- 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 blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
height 0.045;
|
||||
radius 0.015;
|
||||
nCellsPerMetre 2666.67;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
halfThickness #calc "scalar(1)/$<scalar>nCellsPerMetre";
|
||||
|
||||
nCellsHeight #calc "round($<scalar>height*$<scalar>nCellsPerMetre)";
|
||||
nCellsRadius #calc "round($<scalar>radius*$<scalar>nCellsPerMetre)";
|
||||
|
||||
convertToMeters 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(0 0 0) (0 $height 0)
|
||||
($radius 0 #neg $halfThickness) ($radius $height #neg $halfThickness)
|
||||
($radius 0 $halfThickness) ($radius $height $halfThickness)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (1 0 2 3 1 0 4 5) ($nCellsHeight $nCellsRadius 1) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
walls
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(2 3 5 4)
|
||||
);
|
||||
}
|
||||
bottom
|
||||
{
|
||||
type cyclic;
|
||||
faces
|
||||
(
|
||||
(0 0 2 4)
|
||||
);
|
||||
neighbourPatch top;
|
||||
}
|
||||
top
|
||||
{
|
||||
type cyclic;
|
||||
faces
|
||||
(
|
||||
(1 1 3 5)
|
||||
);
|
||||
neighbourPatch bottom;
|
||||
}
|
||||
wedgeBack
|
||||
{
|
||||
type wedge;
|
||||
faces
|
||||
(
|
||||
(0 1 3 2)
|
||||
);
|
||||
}
|
||||
wedgeFront
|
||||
{
|
||||
type wedge;
|
||||
faces
|
||||
(
|
||||
(0 1 5 4)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
57
tutorials/incompressibleVoF/trayedPipe/system/controlDict
Normal file
57
tutorials/incompressibleVoF/trayedPipe/system/controlDict
Normal file
@ -0,0 +1,57 @@
|
||||
/*--------------------------------*- 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 controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application foamRun;
|
||||
|
||||
solver incompressibleVoF;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 2;
|
||||
|
||||
deltaT 0.0001;
|
||||
|
||||
writeControl adjustableRunTime;
|
||||
|
||||
writeInterval 0.005;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
adjustTimeStep yes;
|
||||
|
||||
maxCo 1;
|
||||
maxAlphaCo 1;
|
||||
|
||||
maxDeltaT 1;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,39 @@
|
||||
/*--------------------------------*- 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 createBafflesDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
internalFacesOnly true;
|
||||
|
||||
baffles
|
||||
{
|
||||
wall
|
||||
{
|
||||
type faceZone;
|
||||
zoneName baffles;
|
||||
|
||||
owner
|
||||
{
|
||||
name baffles;
|
||||
type wall;
|
||||
}
|
||||
neighbour
|
||||
{
|
||||
$owner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
50
tutorials/incompressibleVoF/trayedPipe/system/fvSchemes
Normal file
50
tutorials/incompressibleVoF/trayedPipe/system/fvSchemes
Normal file
@ -0,0 +1,50 @@
|
||||
/*--------------------------------*- 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 fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
|
||||
div(rhoPhi,U) Gauss linearUpwind grad(U);
|
||||
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear uncorrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default uncorrected;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
74
tutorials/incompressibleVoF/trayedPipe/system/fvSolution
Normal file
74
tutorials/incompressibleVoF/trayedPipe/system/fvSolution
Normal file
@ -0,0 +1,74 @@
|
||||
/*--------------------------------*- 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 fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
"alpha.water.*"
|
||||
{
|
||||
nAlphaCorr 2;
|
||||
nAlphaSubCycles 1;
|
||||
|
||||
MULESCorr yes;
|
||||
nLimiterIter 3;
|
||||
|
||||
solver smoothSolver;
|
||||
smoother symGaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
"pcorr.*"
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-5;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
p_rgh
|
||||
{
|
||||
$pcorr;
|
||||
tolerance 1e-7;
|
||||
relTol 0.05;
|
||||
}
|
||||
|
||||
p_rghFinal
|
||||
{
|
||||
$p_rgh;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PIMPLE
|
||||
{
|
||||
momentumPredictor no;
|
||||
nOuterCorrectors 1;
|
||||
nCorrectors 3;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
pRefPoint (0 0.015 0);
|
||||
pRefValue 0;
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
equations
|
||||
{
|
||||
".*" 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
43
tutorials/incompressibleVoF/trayedPipe/system/setFieldsDict
Normal file
43
tutorials/incompressibleVoF/trayedPipe/system/setFieldsDict
Normal file
@ -0,0 +1,43 @@
|
||||
/*--------------------------------*- 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 setFieldsDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
alphaMean 0.25;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "blockMeshDict"
|
||||
|
||||
defaultFieldValues
|
||||
(
|
||||
volScalarFieldValue alpha.water 0
|
||||
);
|
||||
|
||||
regions
|
||||
(
|
||||
cylinderToCell
|
||||
{
|
||||
point1 (0 0 0);
|
||||
point2 (0 $height 0);
|
||||
radius #calc "$<scalar>radius*sqrt($<scalar>alphaMean)";
|
||||
fieldValues
|
||||
(
|
||||
volScalarFieldValue alpha.water 1
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
128
tutorials/incompressibleVoF/trayedPipe/system/topoSetDict
Normal file
128
tutorials/incompressibleVoF/trayedPipe/system/topoSetDict
Normal file
@ -0,0 +1,128 @@
|
||||
/*--------------------------------*- 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;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user