Function1: Added "Ramp" to the names of the ramp functions to avoid conflict

with more general forms of those functions.
This commit is contained in:
Henry Weller
2017-03-18 17:10:48 +00:00
parent ad825903af
commit 04876abedb
12 changed files with 108 additions and 96 deletions

View File

@ -79,11 +79,11 @@ primitives/triad/triad.C
/* Run-time selectable functions */ /* Run-time selectable functions */
primitives/functions/Function1/makeDataEntries.C primitives/functions/Function1/makeDataEntries.C
primitives/functions/Function1/ramp/ramp.C primitives/functions/Function1/ramp/ramp.C
primitives/functions/Function1/linear/linear.C primitives/functions/Function1/linearRamp/linearRamp.C
primitives/functions/Function1/quadratic/quadratic.C primitives/functions/Function1/quadraticRamp/quadraticRamp.C
primitives/functions/Function1/quarterSine/quarterSine.C primitives/functions/Function1/quarterSineRamp/quarterSineRamp.C
primitives/functions/Function1/quarterCosine/quarterCosine.C primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.C
primitives/functions/Function1/halfCosine/halfCosine.C primitives/functions/Function1/halfCosineRamp/halfCosineRamp.C
primitives/functions/Polynomial/polynomialFunction.C primitives/functions/Polynomial/polynomialFunction.C
primitives/subModelBase/subModelBase.C primitives/subModelBase/subModelBase.C

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "halfCosine.H" #include "halfCosineRamp.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,14 +32,14 @@ namespace Foam
{ {
namespace Function1Types namespace Function1Types
{ {
makeScalarFunction1(halfCosine); makeScalarFunction1(halfCosineRamp);
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1Types::halfCosine::halfCosine Foam::Function1Types::halfCosineRamp::halfCosineRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -51,13 +51,13 @@ Foam::Function1Types::halfCosine::halfCosine
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Function1Types::halfCosine::~halfCosine() Foam::Function1Types::halfCosineRamp::~halfCosineRamp()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::Function1Types::halfCosine::value(const scalar t) const Foam::scalar Foam::Function1Types::halfCosineRamp::value(const scalar t) const
{ {
return 0.5*(1 - cos(constant::mathematical::pi*linearRamp(t))); return 0.5*(1 - cos(constant::mathematical::pi*linearRamp(t)));
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::Function1Types::halfCosine Foam::Function1Types::halfCosineRamp
Description Description
Half-cosine ramp function starting from 0 and increasing to 1 from \c start Half-cosine ramp function starting from 0 and increasing to 1 from \c start
@ -32,12 +32,12 @@ See also
Foam::Function1Types::ramp Foam::Function1Types::ramp
SourceFiles SourceFiles
halfCosine.C halfCosineRamp.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef halfCosine_H #ifndef halfCosineRamp_H
#define halfCosine_H #define halfCosineRamp_H
#include "ramp.H" #include "ramp.H"
@ -49,29 +49,29 @@ namespace Function1Types
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class halfCosine Declaration Class halfCosineRamp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class halfCosine class halfCosineRamp
: :
public ramp public ramp
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const halfCosine&); void operator=(const halfCosineRamp&);
public: public:
// Runtime type information // Runtime type information
TypeName("halfCosine"); TypeName("halfCosineRamp");
// Constructors // Constructors
//- Construct from entry name and dictionary //- Construct from entry name and dictionary
halfCosine halfCosineRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -79,7 +79,7 @@ public:
//- Destructor //- Destructor
virtual ~halfCosine(); virtual ~halfCosineRamp();
// Member Functions // Member Functions

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "linear.H" #include "linearRamp.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -31,14 +31,14 @@ namespace Foam
{ {
namespace Function1Types namespace Function1Types
{ {
makeScalarFunction1(linear); makeScalarFunction1(linearRamp);
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1Types::linear::linear Foam::Function1Types::linearRamp::linearRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -50,15 +50,15 @@ Foam::Function1Types::linear::linear
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Function1Types::linear::~linear() Foam::Function1Types::linearRamp::~linearRamp()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::Function1Types::linear::value(const scalar t) const Foam::scalar Foam::Function1Types::linearRamp::value(const scalar t) const
{ {
return linearRamp(t); return ramp::linearRamp(t);
} }

View File

@ -22,22 +22,22 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::Function1Types::linear Foam::Function1Types::linearRamp
Description Description
Linear ramp function starting from 0 and increasing linearly to 1 from \c Linear ramp function starting from 0 and increasing linearRamply to 1 from
start over the \c duration and remaining at 1 thereafter. \c start over the \c duration and remaining at 1 thereafter.
See also See also
Foam::Function1Types::ramp Foam::Function1Types::ramp
SourceFiles SourceFiles
linear.C linearRamp.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef linear_H #ifndef linearRamp_H
#define linear_H #define linearRamp_H
#include "ramp.H" #include "ramp.H"
@ -49,29 +49,29 @@ namespace Function1Types
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class linear Declaration Class linearRamp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class linear class linearRamp
: :
public ramp public ramp
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const linear&); void operator=(const linearRamp&);
public: public:
// Runtime type information // Runtime type information
TypeName("linear"); TypeName("linearRamp");
// Constructors // Constructors
//- Construct from entry name and dictionary //- Construct from entry name and dictionary
linear linearRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -79,7 +79,7 @@ public:
//- Destructor //- Destructor
virtual ~linear(); virtual ~linearRamp();
// Member Functions // Member Functions

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "quadratic.H" #include "quadraticRamp.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -31,14 +31,14 @@ namespace Foam
{ {
namespace Function1Types namespace Function1Types
{ {
makeScalarFunction1(quadratic); makeScalarFunction1(quadraticRamp);
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1Types::quadratic::quadratic Foam::Function1Types::quadraticRamp::quadraticRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -50,13 +50,13 @@ Foam::Function1Types::quadratic::quadratic
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Function1Types::quadratic::~quadratic() Foam::Function1Types::quadraticRamp::~quadraticRamp()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::Function1Types::quadratic::value(const scalar t) const Foam::scalar Foam::Function1Types::quadraticRamp::value(const scalar t) const
{ {
return sqr(linearRamp(t)); return sqr(linearRamp(t));
} }

View File

@ -22,22 +22,22 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::Function1Types::quadratic Foam::Function1Types::quadraticRamp
Description Description
Quadratic ramp function starting from 0 and increasing quadratically to 1 Quadratic ramp function starting from 0 and increasing quadraticRampally
from \c t_0 over the \c duration and remaining at 1 thereafter. to 1 from \c t_0 over the \c duration and remaining at 1 thereafter.
See also See also
Foam::Function1Types::ramp Foam::Function1Types::ramp
SourceFiles SourceFiles
quadratic.C quadraticRamp.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef quadratic_H #ifndef quadraticRamp_H
#define quadratic_H #define quadraticRamp_H
#include "ramp.H" #include "ramp.H"
@ -49,29 +49,29 @@ namespace Function1Types
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class quadratic Declaration Class quadraticRamp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class quadratic class quadraticRamp
: :
public ramp public ramp
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const quadratic&); void operator=(const quadraticRamp&);
public: public:
// Runtime type information // Runtime type information
TypeName("quadratic"); TypeName("quadraticRamp");
// Constructors // Constructors
//- Construct from entry name and dictionary //- Construct from entry name and dictionary
quadratic quadraticRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -79,7 +79,7 @@ public:
//- Destructor //- Destructor
virtual ~quadratic(); virtual ~quadraticRamp();
// Member Functions // Member Functions

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "quarterCosine.H" #include "quarterCosineRamp.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,14 +32,14 @@ namespace Foam
{ {
namespace Function1Types namespace Function1Types
{ {
makeScalarFunction1(quarterCosine); makeScalarFunction1(quarterCosineRamp);
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1Types::quarterCosine::quarterCosine Foam::Function1Types::quarterCosineRamp::quarterCosineRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -51,13 +51,16 @@ Foam::Function1Types::quarterCosine::quarterCosine
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Function1Types::quarterCosine::~quarterCosine() Foam::Function1Types::quarterCosineRamp::~quarterCosineRamp()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::Function1Types::quarterCosine::value(const scalar t) const Foam::scalar Foam::Function1Types::quarterCosineRamp::value
(
const scalar t
) const
{ {
return 1 - cos(0.5*constant::mathematical::pi*linearRamp(t)); return 1 - cos(0.5*constant::mathematical::pi*linearRamp(t));
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::Function1Types::quarterCosine Foam::Function1Types::quarterCosineRamp
Description Description
Quarter-cosine ramp function starting from 0 and increasing to 1 from \c Quarter-cosine ramp function starting from 0 and increasing to 1 from \c
@ -32,12 +32,12 @@ See also
Foam::Function1Types::ramp Foam::Function1Types::ramp
SourceFiles SourceFiles
quarterCosine.C quarterCosineRamp.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef quarterCosine_H #ifndef quarterCosineRamp_H
#define quarterCosine_H #define quarterCosineRamp_H
#include "ramp.H" #include "ramp.H"
@ -49,29 +49,29 @@ namespace Function1Types
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class quarterCosine Declaration Class quarterCosineRamp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class quarterCosine class quarterCosineRamp
: :
public ramp public ramp
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const quarterCosine&); void operator=(const quarterCosineRamp&);
public: public:
// Runtime type information // Runtime type information
TypeName("quarterCosine"); TypeName("quarterCosineRamp");
// Constructors // Constructors
//- Construct from entry name and dictionary //- Construct from entry name and dictionary
quarterCosine quarterCosineRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -79,7 +79,7 @@ public:
//- Destructor //- Destructor
virtual ~quarterCosine(); virtual ~quarterCosineRamp();
// Member Functions // Member Functions

View File

@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "quarterSine.H" #include "quarterSineRamp.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,14 +32,14 @@ namespace Foam
{ {
namespace Function1Types namespace Function1Types
{ {
makeScalarFunction1(quarterSine); makeScalarFunction1(quarterSineRamp);
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Function1Types::quarterSine::quarterSine Foam::Function1Types::quarterSineRamp::quarterSineRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -51,13 +51,13 @@ Foam::Function1Types::quarterSine::quarterSine
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Function1Types::quarterSine::~quarterSine() Foam::Function1Types::quarterSineRamp::~quarterSineRamp()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::Function1Types::quarterSine::value(const scalar t) const Foam::scalar Foam::Function1Types::quarterSineRamp::value(const scalar t) const
{ {
return sin(0.5*constant::mathematical::pi*linearRamp(t)); return sin(0.5*constant::mathematical::pi*linearRamp(t));
} }

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::Function1Types::quarterSine Foam::Function1Types::quarterSineRamp
Description Description
Quarter-sine ramp function starting from 0 and increasing to 1 from \c start Quarter-sine ramp function starting from 0 and increasing to 1 from \c start
@ -32,12 +32,12 @@ See also
Foam::Function1Types::ramp Foam::Function1Types::ramp
SourceFiles SourceFiles
quarterSine.C quarterSineRamp.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef quarterSine_H #ifndef quarterSineRamp_H
#define quarterSine_H #define quarterSineRamp_H
#include "ramp.H" #include "ramp.H"
@ -49,29 +49,29 @@ namespace Function1Types
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class quarterSine Declaration Class quarterSineRamp Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class quarterSine class quarterSineRamp
: :
public ramp public ramp
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const quarterSine&); void operator=(const quarterSineRamp&);
public: public:
// Runtime type information // Runtime type information
TypeName("quarterSine"); TypeName("quarterSineRamp");
// Constructors // Constructors
//- Construct from entry name and dictionary //- Construct from entry name and dictionary
quarterSine quarterSineRamp
( (
const word& entryName, const word& entryName,
const dictionary& dict const dictionary& dict
@ -79,7 +79,7 @@ public:
//- Destructor //- Destructor
virtual ~quarterSine(); virtual ~quarterSineRamp();
// Member Functions // Member Functions

View File

@ -41,18 +41,27 @@ boundaryField
normalVelocity normalVelocity
{ {
type uniformFixedValue; type uniformFixedValue;
uniformValue sine;
uniformValueCoeffs uniformValue
{ {
frequency 1; type scale;
amplitude table
( value
( 0 0) {
( 10 0.025) type sine;
(1000 0.025)
); frequency 1;
scale (0 1 0); amplitude 0.025;
level (0 0 0); scale (0 1 0);
level (0 0 0);
}
scale
{
type linearRamp;
duration 10;
}
} }
} }