reactingEulerFoam/interfacialModels/wallDampingModels: Added interpolatedWallDamping abstract base-class

To simplify linear, sine and cosine wall-damping implementation
This commit is contained in:
Henry Weller 2015-11-15 13:32:19 +00:00
parent 7197f68670
commit 17fdf51000
9 changed files with 232 additions and 180 deletions

View File

@ -65,6 +65,7 @@ wallDependentModel/wallDependentModel.C
wallDampingModels/wallDampingModel/wallDampingModel.C
wallDampingModels/wallDampingModel/newWallDampingModel.C
wallDampingModels/noWallDamping/noWallDamping.C
wallDampingModels/interpolated/interpolatedWallDamping.C
wallDampingModels/linear/linearWallDamping.C
wallDampingModels/cosine/cosineWallDamping.C
wallDampingModels/sine/sineWallDamping.C

View File

@ -25,7 +25,6 @@ License
#include "cosineWallDamping.H"
#include "phasePair.H"
#include "surfaceInterpolate.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -45,7 +44,7 @@ namespace wallDampingModels
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::wallDampingModels::cosine::limiter() const
@ -73,7 +72,7 @@ Foam::wallDampingModels::cosine::cosine
const phasePair& pair
)
:
wallDampingModel(dict, pair),
interpolated(dict, pair),
Cd_("Cd", dimless, dict)
{}
@ -84,36 +83,4 @@ Foam::wallDampingModels::cosine::~cosine()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::wallDampingModels::cosine::damp
(
const tmp<volScalarField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::volVectorField>
Foam::wallDampingModels::cosine::damp
(
const tmp<volVectorField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::surfaceScalarField>
Foam::wallDampingModels::cosine::damp
(
const tmp<surfaceScalarField>& Ff
) const
{
return fvc::interpolate(limiter())*Ff;
}
// ************************************************************************* //

View File

@ -34,7 +34,7 @@ SourceFiles
#ifndef cosineWallDamping_H
#define cosineWallDamping_H
#include "wallDampingModel.H"
#include "interpolatedWallDamping.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace wallDampingModels
class cosine
:
public wallDampingModel
public interpolated
{
// Private data
@ -60,10 +60,12 @@ class cosine
const dimensionedScalar Cd_;
// Private member functions
protected:
// Protected member functions
//- Return the force limiter field
tmp<volScalarField> limiter() const;
virtual tmp<volScalarField> limiter() const;
public:
@ -84,27 +86,6 @@ public:
//- Destructor
virtual ~cosine();
// Member Functions
//- Return damped coefficient
virtual tmp<volScalarField> damp
(
const tmp<volScalarField>&
) const;
//- Return damped force
virtual tmp<volVectorField> damp
(
const tmp<volVectorField>&
) const;
//- Return damped face force
virtual tmp<surfaceScalarField> damp
(
const tmp<surfaceScalarField>&
) const;
};

View File

@ -0,0 +1,91 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 "interpolatedWallDamping.H"
#include "phasePair.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace wallDampingModels
{
defineTypeNameAndDebug(interpolated, 0);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallDampingModels::interpolated::interpolated
(
const dictionary& dict,
const phasePair& pair
)
:
wallDampingModel(dict, pair)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallDampingModels::interpolated::~interpolated()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::wallDampingModels::interpolated::damp
(
const tmp<volScalarField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::volVectorField>
Foam::wallDampingModels::interpolated::damp
(
const tmp<volVectorField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::surfaceScalarField>
Foam::wallDampingModels::interpolated::damp
(
const tmp<surfaceScalarField>& Ff
) const
{
return fvc::interpolate(limiter())*Ff;
}
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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::wallDampingModels::interpolated
Description
SourceFiles
interpolatedWallDamping.C
\*---------------------------------------------------------------------------*/
#ifndef interpolatedWallDamping_H
#define interpolatedWallDamping_H
#include "wallDampingModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class phasePair;
namespace wallDampingModels
{
/*---------------------------------------------------------------------------*\
Class interpolated Declaration
\*---------------------------------------------------------------------------*/
class interpolated
:
public wallDampingModel
{
protected:
// Protected member functions
//- Return the force limiter field
virtual tmp<volScalarField> limiter() const = 0;
public:
//- Runtime type information
TypeName("interpolated");
// Constructors
//- Construct from components
interpolated
(
const dictionary& dict,
const phasePair& pair
);
//- Destructor
virtual ~interpolated();
// Member Functions
//- Return damped coefficient
virtual tmp<volScalarField> damp
(
const tmp<volScalarField>&
) const;
//- Return damped force
virtual tmp<volVectorField> damp
(
const tmp<volVectorField>&
) const;
//- Return damped face force
virtual tmp<surfaceScalarField> damp
(
const tmp<surfaceScalarField>&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace wallDampingModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,7 +25,6 @@ License
#include "linearWallDamping.H"
#include "phasePair.H"
#include "surfaceInterpolate.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -45,7 +44,7 @@ namespace wallDampingModels
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::wallDampingModels::linear::limiter() const
@ -62,7 +61,7 @@ Foam::wallDampingModels::linear::linear
const phasePair& pair
)
:
wallDampingModel(dict, pair),
interpolated(dict, pair),
Cd_("Cd", dimless, dict)
{}
@ -73,36 +72,4 @@ Foam::wallDampingModels::linear::~linear()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::wallDampingModels::linear::damp
(
const tmp<volScalarField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::volVectorField>
Foam::wallDampingModels::linear::damp
(
const tmp<volVectorField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::surfaceScalarField>
Foam::wallDampingModels::linear::damp
(
const tmp<surfaceScalarField>& Ff
) const
{
return fvc::interpolate(limiter())*Ff;
}
// ************************************************************************* //

View File

@ -34,7 +34,7 @@ SourceFiles
#ifndef linearWallDamping_H
#define linearWallDamping_H
#include "wallDampingModel.H"
#include "interpolatedWallDamping.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace wallDampingModels
class linear
:
public wallDampingModel
public interpolated
{
// Private data
@ -60,10 +60,12 @@ class linear
const dimensionedScalar Cd_;
// Private member functions
protected:
// Protected member functions
//- Return the force limiter field
tmp<volScalarField> limiter() const;
virtual tmp<volScalarField> limiter() const;
public:
@ -84,27 +86,6 @@ public:
//- Destructor
virtual ~linear();
// Member Functions
//- Return damped coefficient
virtual tmp<volScalarField> damp
(
const tmp<volScalarField>&
) const;
//- Return damped force
virtual tmp<volVectorField> damp
(
const tmp<volVectorField>&
) const;
//- Return damped face force
virtual tmp<surfaceScalarField> damp
(
const tmp<surfaceScalarField>&
) const;
};

View File

@ -25,7 +25,6 @@ License
#include "sineWallDamping.H"
#include "phasePair.H"
#include "surfaceInterpolate.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -45,7 +44,7 @@ namespace wallDampingModels
}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::wallDampingModels::sine::limiter() const
@ -66,7 +65,7 @@ Foam::wallDampingModels::sine::sine
const phasePair& pair
)
:
wallDampingModel(dict, pair),
interpolated(dict, pair),
Cd_("Cd", dimless, dict)
{}
@ -77,36 +76,4 @@ Foam::wallDampingModels::sine::~sine()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::wallDampingModels::sine::damp
(
const tmp<volScalarField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::volVectorField>
Foam::wallDampingModels::sine::damp
(
const tmp<volVectorField>& F
) const
{
return limiter()*F;
}
Foam::tmp<Foam::surfaceScalarField>
Foam::wallDampingModels::sine::damp
(
const tmp<surfaceScalarField>& Ff
) const
{
return fvc::interpolate(limiter())*Ff;
}
// ************************************************************************* //

View File

@ -34,7 +34,7 @@ SourceFiles
#ifndef sineWallDamping_H
#define sineWallDamping_H
#include "wallDampingModel.H"
#include "interpolatedWallDamping.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace wallDampingModels
class sine
:
public wallDampingModel
public interpolated
{
// Private data
@ -60,10 +60,12 @@ class sine
const dimensionedScalar Cd_;
// Private member functions
protected:
// Protected member functions
//- Return the force limiter field
tmp<volScalarField> limiter() const;
virtual tmp<volScalarField> limiter() const;
public:
@ -84,27 +86,6 @@ public:
//- Destructor
virtual ~sine();
// Member Functions
//- Return damped coefficient
virtual tmp<volScalarField> damp
(
const tmp<volScalarField>&
) const;
//- Return damped force
virtual tmp<volVectorField> damp
(
const tmp<volVectorField>&
) const;
//- Return damped face force
virtual tmp<surfaceScalarField> damp
(
const tmp<surfaceScalarField>&
) const;
};