fvModels::waveForcing: New fvModel to generate VoF surface by region forcing

With waveForcing waves can be generated with a domain by applying forcing to
both the phase-fraction and velocity fields rather than requiring that the waves
are introduced at an inlet.  This provides much greater flexibility as waves can
be generated in any direction relative to the mean flow, obliquely or even
against the flow.  isotropicDamping or verticalDamping can be used in
conjunction with waveForcing to damp the waves before they reach an outlet,
alternatively waveForcing can be used in regions surrounding a hull for example
to maintain far-field waves everywhere.

The tutorials/multiphase/interFoam/laminar/forcedWave tutorial case is provided
to demonstrate the waveForcing fvModel as an alternative to the wave inlet
boundary conditions used in the tutorials/multiphase/interFoam/laminar/wave
case.

Class
    Foam::fv::waveForcing

Description
    This fvModel applies forcing to the liquid phase-fraction field and all
    components of the vector field to relax the fields towards those
    calculated from the current wave distribution.

    The forcing force coefficient \f$\lambda\f$ should be set based on the
    desired level of forcing and the residence time the waves through the
    forcing zone.  For example, if waves moving at 2 [m/s] are travelling
    through a forcing zone 8 [m] in length, then the residence time is 4 [s]. If
    it is deemed necessary to force for 5 time-scales, then \f$\lambda\f$ should
    be set to equal 5/(4 [s]) = 1.2 [1/s].

Usage
    Example usage:
    \verbatim
    waveForcing1
    {
        type            waveForcing;

        libs            ("libwaves.so");

        liquidPhase     water;

        // Define the line along which to apply the graduation
        origin          (600 0 0);
        direction       (-1 0 0);

        // // Or, define multiple lines
        // origins         ((600 0 0) (600 -300 0) (600 300 0));
        // directions      ((-1 0 0) (0 1 0) (0 -1 0));

        scale
        {
            type        halfCosineRamp;
            start       0;
            duration    300;
        }

        lambda          0.5; // Forcing coefficient
    }
    \endverbatim
This commit is contained in:
Henry Weller
2022-10-03 20:30:02 +01:00
parent 9dc91eb479
commit 562925476b
38 changed files with 1512 additions and 59 deletions

View File

@ -19,9 +19,6 @@ derived/solidificationMeltingSource/solidificationMeltingSource.C
derived/sixDoFAccelerationSource/sixDoFAccelerationSource.C
derived/buoyancyForce/buoyancyForce.C
derived/buoyancyEnergy/buoyancyEnergy.C
derived/damping/damping/damping.C
derived/damping/isotropicDamping/isotropicDamping.C
derived/damping/verticalDamping/verticalDamping.C
derived/phaseLimitStabilisation/phaseLimitStabilisation.C
derived/accelerationSource/accelerationSource.C
derived/volumeFractionSource/volumeFractionSource.C

View File

@ -13,4 +13,9 @@ derivedFvPatchFields/waveAlpha/waveAlphaFvPatchScalarField.C
derivedFvPatchFields/waveInletOutlet/waveInletOutletFvPatchFields.C
derivedFvPatchFields/waveVelocity/waveVelocityFvPatchVectorField.C
fvModels/forcing/forcing.C
fvModels/isotropicDamping/isotropicDamping.C
fvModels/verticalDamping/verticalDamping.C
fvModels/waveForcing/waveForcing.C
LIB = $(FOAM_LIBBIN)/libwaves

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "damping.H"
#include "forcing.H"
#include "fvMatrix.H"
#include "zeroGradientFvPatchField.H"
@ -33,17 +33,15 @@ namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(damping, 0);
defineTypeNameAndDebug(forcing, 0);
}
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::fv::damping::readCoeffs()
void Foam::fv::forcing::readCoeffs()
{
UName_ = coeffs().lookupOrDefault<word>("U", "U");
lambda_ =
dimensionedScalar
(
@ -112,13 +110,13 @@ void Foam::fv::damping::readCoeffs()
<< "The scaling specification is incomplete. \"scale\", "
<< "\"origin\" and \"direction\" (or \"origins\" and "
<< "\"directions\"), must all be specified in order to scale "
<< "the damping. The damping will be applied uniformly across "
<< "the forcing. The forcing will be applied uniformly across "
<< "the cell set." << endl << endl;
}
}
Foam::tmp<Foam::volScalarField::Internal> Foam::fv::damping::forceCoeff() const
Foam::tmp<Foam::volScalarField::Internal> Foam::fv::forcing::forceCoeff() const
{
tmp<volScalarField::Internal> tforceCoeff
(
@ -171,7 +169,7 @@ Foam::tmp<Foam::volScalarField::Internal> Foam::fv::damping::forceCoeff() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::damping::damping
Foam::fv::forcing::forcing
(
const word& name,
const word& modelType,
@ -180,7 +178,6 @@ Foam::fv::damping::damping
)
:
fvModel(name, modelType, dict, mesh),
UName_(word::null),
lambda_("lambda", dimless/dimTime, NaN),
scale_(nullptr),
origins_(),
@ -192,13 +189,7 @@ Foam::fv::damping::damping
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fv::damping::addSupFields() const
{
return wordList(1, UName_);
}
bool Foam::fv::damping::read(const dictionary& dict)
bool Foam::fv::forcing::read(const dictionary& dict)
{
if (fvModel::read(dict))
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,22 +22,22 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fv::damping
Foam::fv::forcing
Description
Base fvModel for damping functions.
Base fvModel for forcing functions.
See also
Foam::fv::isotropicDamping
Foam::fv::verticalDamping
SourceFiles
damping.C
forcing.C
\*---------------------------------------------------------------------------*/
#ifndef damping_H
#define damping_H
#ifndef forcing_H
#define forcing_H
#include "fvModel.H"
#include "Function1.H"
@ -51,10 +51,10 @@ namespace fv
{
/*---------------------------------------------------------------------------*\
Class damping Declaration
Class forcing Declaration
\*---------------------------------------------------------------------------*/
class damping
class forcing
:
public fvModel
{
@ -62,9 +62,6 @@ protected:
// Protected Data
//- Name of the velocity field
word UName_;
//- Damping coefficient [1/s]
dimensionedScalar lambda_;
@ -90,13 +87,13 @@ protected:
public:
//- Runtime type information
TypeName("damping");
TypeName("forcing");
// Constructors
//- Construct from components
damping
forcing
(
const word& name,
const word& modelType,
@ -106,19 +103,12 @@ public:
//- Destructor
virtual ~damping()
virtual ~forcing()
{}
// Member Functions
// Checks
//- Return the list of fields for which the fvModel adds source term
// to the transport equation
virtual wordList addSupFields() const;
// IO
//- Read dictionary

View File

@ -75,7 +75,8 @@ Foam::fv::isotropicDamping::isotropicDamping
const fvMesh& mesh
)
:
damping(name, modelType, dict, mesh),
forcing(name, modelType, dict, mesh),
UName_(coeffs().lookupOrDefault<word>("U", "U")),
value_("value", dimVelocity, vector::uniform(NaN))
{
readCoeffs();
@ -84,6 +85,12 @@ Foam::fv::isotropicDamping::isotropicDamping
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fv::isotropicDamping::addSupFields() const
{
return wordList(1, UName_);
}
void Foam::fv::isotropicDamping::addSup
(
fvMatrix<vector>& eqn,
@ -137,7 +144,7 @@ void Foam::fv::isotropicDamping::distribute(const polyDistributionMap&)
bool Foam::fv::isotropicDamping::read(const dictionary& dict)
{
if (damping::read(dict))
if (forcing::read(dict))
{
readCoeffs();
return true;

View File

@ -25,15 +25,15 @@ Class
Foam::fv::isotropicDamping
Description
This fvModel applies an implicit damping force to all components of the
This fvModel applies an implicit forcing force to all components of the
vector field to relax the field towards a specified uniform value. Its
intended purpose is to damp the motions of an interface in the region
approaching an outlet so that no reflections are generated.
The damping force coefficient \f$\lambda\f$ should be set based on the
desired level of damping and the residence time of a perturbation through
the damping zone. For example, if waves moving at 2 [m/s] are travelling
through a damping zone 8 [m] in length, then the residence time is 4 [s]. If
The forcing force coefficient \f$\lambda\f$ should be set based on the
desired level of forcing and the residence time of a perturbation through
the forcing zone. For example, if waves moving at 2 [m/s] are travelling
through a forcing zone 8 [m] in length, then the residence time is 4 [s]. If
it is deemed necessary to damp for 5 time-scales, then \f$\lambda\f$ should
be set to equal 5/(4 [s]) = 1.2 [1/s].
@ -44,6 +44,8 @@ Usage
{
type isotropicDamping;
libs ("libwaves.so");
// Define the line along which to apply the graduation
origin (1200 0 0);
direction (1 0 0);
@ -66,7 +68,7 @@ Usage
\endverbatim
See also
Foam::fv::damping
Foam::fv::forcing
Foam::fv::verticalDamping
SourceFiles
@ -77,7 +79,7 @@ SourceFiles
#ifndef isotropicDamping_H
#define isotropicDamping_H
#include "damping.H"
#include "forcing.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,10 +94,13 @@ namespace fv
class isotropicDamping
:
public damping
public forcing
{
// Private Data
//- Name of the velocity field
word UName_;
//- Reference value
dimensionedVector value_;
@ -138,7 +143,14 @@ public:
// Member Functions
// Add explicit and implicit contributions
// Checks
//- Return the list of fields for which the fvModel adds source term
// to the transport equation
virtual wordList addSupFields() const;
// Add explicit and implicit contributions
//- Source term to momentum equation
virtual void addSup

View File

@ -67,12 +67,19 @@ Foam::fv::verticalDamping::verticalDamping
const fvMesh& mesh
)
:
damping(name, modelType, dict, mesh)
forcing(name, modelType, dict, mesh),
UName_(coeffs().lookupOrDefault<word>("U", "U"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fv::verticalDamping::addSupFields() const
{
return wordList(1, UName_);
}
void Foam::fv::verticalDamping::addSup
(
fvMatrix<vector>& eqn,

View File

@ -25,7 +25,7 @@ Class
Foam::fv::verticalDamping
Description
This fvModel applies an explicit damping force to components of the vector
This fvModel applies an explicit forcing force to components of the vector
field in the direction of gravity. Its intended purpose is to damp the
vertical motions of an interface in the region approaching an outlet so that
no reflections are generated.
@ -44,8 +44,8 @@ Description
\f]
The coefficient \f$\lambda\f$ should be set based on the desired level of
damping and the residence time of a perturbation through the damping zone.
For example, if waves moving at 2 [m/s] are travelling through a damping
forcing and the residence time of a perturbation through the forcing zone.
For example, if waves moving at 2 [m/s] are travelling through a forcing
zone 8 [m] in length, then the residence time is 4 [s]. If it is deemed
necessary to damp for 5 time-scales, then \f$\lambda\f$ should be set to
equal 5/(4 [s]) = 1.2 [1/s].
@ -57,6 +57,8 @@ Usage
{
type verticalDamping;
libs ("libwaves.so");
// Define the line along which to apply the graduation
origin (1200 0 0);
direction (1 0 0);
@ -80,7 +82,7 @@ Usage
\endverbatim
See also
Foam::fv::damping
Foam::fv::forcing
Foam::fv::isotropicDamping
SourceFiles
@ -91,7 +93,7 @@ SourceFiles
#ifndef verticalDamping_H
#define verticalDamping_H
#include "damping.H"
#include "forcing.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -106,8 +108,14 @@ namespace fv
class verticalDamping
:
public damping
public forcing
{
// Private Data
//- Name of the velocity field
word UName_;
// Private Member Functions
//- Source term to momentum equation
@ -143,7 +151,14 @@ public:
// Member Functions
// Add explicit and implicit contributions
// Checks
//- Return the list of fields for which the fvModel adds source term
// to the transport equation
virtual wordList addSupFields() const;
// Add explicit and implicit contributions
//- Source term to momentum equation
virtual void addSup

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 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 "waveForcing.H"
#include "levelSet.H"
#include "fvMatrix.H"
#include "fvmSup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(waveForcing, 0);
addToRunTimeSelectionTable(fvModel, waveForcing, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::waveForcing::waveForcing
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
forcing(name, modelType, dict, mesh),
waves_(waveSuperposition::New(mesh)),
liquidPhaseName_(coeffs().lookup<word>("liquidPhase")),
alphaName_(IOobject::groupName("alpha", liquidPhaseName_)),
UName_(coeffs().lookupOrDefault<word>("U", "U")),
forceCoeff_(this->forceCoeff())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fv::waveForcing::addSupFields() const
{
return {alphaName_, UName_};
}
void Foam::fv::waveForcing::addSup
(
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (fieldName == alphaName_)
{
eqn -= fvm::Sp(forceCoeff_(), eqn.psi());
eqn += forceCoeff_()*alphaWaves_();
}
}
void Foam::fv::waveForcing::addSup
(
const volScalarField& rho,
fvMatrix<vector>& eqn,
const word& fieldName
) const
{
if (fieldName == UName_)
{
eqn -= fvm::Sp(rho*forceCoeff_(), eqn.psi());
eqn += rho*forceCoeff_()*Uwaves_();
}
}
bool Foam::fv::waveForcing::movePoints()
{
forceCoeff_ = this->forceCoeff();
return true;
}
void Foam::fv::waveForcing::topoChange(const polyTopoChangeMap&)
{
forceCoeff_ = this->forceCoeff();
}
void Foam::fv::waveForcing::mapMesh(const polyMeshMap& map)
{
forceCoeff_ = this->forceCoeff();
}
void Foam::fv::waveForcing::distribute(const polyDistributionMap&)
{
forceCoeff_ = this->forceCoeff();
}
void Foam::fv::waveForcing::correct()
{
const scalar t = mesh().time().value();
// Cell centres and points
const pointField& ccs = mesh().cellCentres();
const pointField& pts = mesh().points();
const scalarField h(waves_.height(t, ccs));
const scalarField hp(waves_.height(t, pts));
const vectorField uGas(waves_.UGas(t, ccs));
const vectorField uGasp(waves_.UGas(t, pts));
const vectorField uLiq(waves_.ULiquid(t, ccs));
const vectorField uLiqp(waves_.ULiquid(t, pts));
alphaWaves_ = volScalarField::Internal::New
(
"alphaWaves",
mesh(),
dimless,
levelSetFraction(mesh(), h, hp, false)
);
Uwaves_ = volVectorField::Internal::New
(
"Uwaves",
mesh(),
dimVelocity,
levelSetAverage(mesh(), h, hp, uGas, uGasp, uLiq, uLiqp)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 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::fv::waveForcing
Description
This fvModel applies forcing to the liquid phase-fraction field and all
components of the vector field to relax the fields towards those
calculated from the current wave distribution.
The forcing force coefficient \f$\lambda\f$ should be set based on the
desired level of forcing and the residence time the waves through the
forcing zone. For example, if waves moving at 2 [m/s] are travelling
through a forcing zone 8 [m] in length, then the residence time is 4 [s]. If
it is deemed necessary to force for 5 time-scales, then \f$\lambda\f$ should
be set to equal 5/(4 [s]) = 1.2 [1/s].
Usage
Example usage:
\verbatim
waveForcing1
{
type waveForcing;
libs ("libwaves.so");
liquidPhase water;
// Define the line along which to apply the graduation
origin (600 0 0);
direction (-1 0 0);
// // Or, define multiple lines
// origins ((600 0 0) (600 -300 0) (600 300 0));
// directions ((-1 0 0) (0 1 0) (0 -1 0));
scale
{
type halfCosineRamp;
start 0;
duration 300;
}
lambda 0.5; // Forcing coefficient
}
\endverbatim
See also
Foam::fv::forcing
SourceFiles
waveForcing.C
\*---------------------------------------------------------------------------*/
#ifndef waveForcing_H
#define waveForcing_H
#include "forcing.H"
#include "waveSuperposition.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
/*---------------------------------------------------------------------------*\
Class waveForcing Declaration
\*---------------------------------------------------------------------------*/
class waveForcing
:
public forcing
{
// Private Data
//- Reference to the waves
const waveSuperposition& waves_;
//- Name of the liquid phase
const word liquidPhaseName_;
//- Name of the liquid phase-fraction field
const word alphaName_;
//- Name of the velocity field
const word UName_;
//- Phase-fraction field calculated from the current wave form
tmp<volScalarField::Internal> alphaWaves_;
//- Velocity field calculated from the current wave form
tmp<volVectorField::Internal> Uwaves_;
//- Forcing coefficient field
tmp<volScalarField::Internal> forceCoeff_;
public:
//- Runtime type information
TypeName("waveForcing");
// Constructors
//- Construct from components
waveForcing
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~waveForcing()
{}
// Member Functions
// Checks
//- Return the list of fields for which the fvModel adds source term
// to the transport equation
virtual wordList addSupFields() const;
// Add explicit and implicit contributions
//- Source term to VoF phase-fraction equation
virtual void addSup
(
fvMatrix<scalar>& eqn,
const word& fieldName
) const;
//- Source term to momentum equation
virtual void addSup
(
const volScalarField& rho,
fvMatrix<vector>& eqn,
const word& fieldName
) const;
// Mesh changes
//- Update for mesh motion
virtual bool movePoints();
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
//- Correct the wave forcing coefficients
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*--------------------------------*- 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 (2 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
left
{
type fixedValue;
value $internalField;
}
right
{
type outletPhaseMeanVelocity;
UnMean 2;
alpha alpha.water;
}
top
{
type pressureInletOutletVelocity;
tangentialVelocity $internalField;
value $internalField;
}
bottom
{
type noSlip;
}
}
// ************************************************************************* //

View 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 volScalarField;
location "0";
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(right|bottom)"
{
type zeroGradient;
}
left
{
type fixedValue;
value $internalField;
}
top
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- 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"
"(left|right|bottom)"
{
type fixedFluxPressure;
value uniform 0;
}
top
{
type prghTotalPressure;
p0 uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
#!/bin/sh
cd ${0%/*} || exit 1
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication extrudeMesh
for i in 1 2
do
runApplication -s $i topoSet -dict topoSetDict$i
runApplication -s $i refineMesh -dict refineMeshDictX -overwrite
done
for i in 3 4 5 6
do
runApplication -s $i topoSet -dict topoSetDict$i
runApplication -s $i refineMesh -dict refineMeshDictY -overwrite
done
runApplication setFields
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar

View File

@ -0,0 +1,60 @@
/*--------------------------------*- 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 fvModels;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
forcing
{
type waveForcing;
libs ("libwaves.so");
liquidPhase water;
origin (600 0 0);
direction (-1 0 0);
scale
{
type halfCosineRamp;
start 0;
duration 300;
}
lambda 0.5;
}
damping
{
type isotropicDamping;
libs ("libwaves.so");
origin (1200 0 0);
direction (1 0 0);
scale
{
type halfCosineRamp;
start 0;
duration 600;
}
lambda 0.5;
value (2 0 0);
}
//************************************************************************* //

View File

@ -0,0 +1,34 @@
/*--------------------------------*- 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 fvModels;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
option1
{
type verticalDamping;
origin (1200 0 0);
direction (1 0 0);
scale
{
type halfCosineRamp;
start 0;
duration 600;
}
lambda 0.5;
}
//************************************************************************* //

View 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);
// ************************************************************************* //

View File

@ -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;
// ************************************************************************* //

View File

@ -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;
// ************************************************************************* //

View File

@ -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;
// ************************************************************************* //

View File

@ -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;
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- 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 waveProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
origin (0 0 0);
direction (1 0 0);
waves
(
Airy
{
length 300;
amplitude 2.5;
phase 0;
angle 0;
}
);
UMean (2 0 0);
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 -300 -10)
(1200 -300 -10)
(1200 300 -10)
(0 300 -10)
(0 -300 10)
(1200 -300 10)
(1200 300 10)
(0 300 10)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (67 40 1) simpleGrading (1 1 1)
);
defaultPatch
{
name frontAndBack;
type empty;
}
boundary
(
left
{
type patch;
faces
(
(0 4 7 3)
);
}
right
{
type patch;
faces
(
(2 6 5 1)
);
}
bottom
{
type wall;
faces
(
(0 1 5 4)
);
}
top
{
type patch;
faces
(
(2 3 7 6)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*--------------------------------*- 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 interFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 200;
deltaT 0.05;
writeControl adjustableRunTime;
writeInterval 1;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep no;
maxCo 1;
maxAlphaCo 1;
maxDeltaT 1;
functions
{
interfaceHeight1
{
type interfaceHeight;
libs ("libfieldFunctionObjects.so");
locations ((300 0 0) (450 0 0) (600 0 0));
alpha alpha.water;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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 decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 6;
method simple;
simpleCoeffs
{
n (3 2 1);
}
// ************************************************************************* //

View File

@ -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 extrudeMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
constructFrom mesh;
sourceCase ".";
sourcePatches (right);
flipNormals false;
nLayers 25;
expansionRatio 1.09;
extrudeModel linearNormal;
linearNormalCoeffs
{
thickness 1500;
}
mergeFaces false;
// ************************************************************************* //

View 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default CrankNicolson ocCoeff
{
type scale;
scale linearRamp;
duration 1.0;
value 0.9;
};
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss linearUpwindV grad(U);
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- 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;
alphaApplyPrevCorr yes;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
minIter 1;
}
pcorr
{
solver GAMG;
smoother DIC;
tolerance 1e-4;
relTol 0.01;
}
pcorrFinal
{
$pcorr;
relTol 0;
};
p_rgh
{
solver GAMG;
smoother DIC;
tolerance 1e-7;
relTol 0.001;
}
p_rghFinal
{
$p_rgh;
relTol 0;
}
"U.*"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-7;
relTol 0;
}
}
PIMPLE
{
momentumPredictor yes;
nOuterCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -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 refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
set box;
coordinateSystem global;
globalCoeffs
{
e1 (1 0 0);
e2 (0 1 0);
}
directions
(
e1
);
useHexTopology true;
geometricCut false;
writeMesh false;
// ************************************************************************* //

View File

@ -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 refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
set box;
coordinateSystem global;
globalCoeffs
{
e1 (1 0 0);
e2 (0 1 0);
}
directions
(
e2
);
useHexTopology true;
geometricCut false;
writeMesh false;
// ************************************************************************* //

View File

@ -0,0 +1,47 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (-10000 -10000 -10000) (10000 0 10000);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
// Set patch values (using ==)
boxToFace
{
box (-10000 -10000 -10000) (10000 0 10000);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- 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;
object setWavesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
alpha alpha.water;
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -40 -1e6) (1300 40 1e6);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -30 -1e6) (1200 30 1e6);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -40 -1e6) (1e6 40 1e6);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -30 -1e6) (1e6 30 1e6);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -20 -1e6) (1e6 20 1e6);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name box;
type cellSet;
action new;
source boxToCell;
box (-1e6 -10 -1e6) (1e6 10 1e6);
}
);
// ************************************************************************* //