Function1Types::Square: New square-wave Function1 with the same controls as Sine

with optional specification of the mark/space ratio

    Templated square-wave function with support for an offset level.

        \f[
            a square(f (t - t_0)) s + l
        \f]

    where

    \f$ square(t) \f$ is the square-wave function in range \f$ [-1, 1] \f$
    with a mark/space ratio of \f$ r \f$

    \vartable
        symbol  | Description       | Data type         | Default
        a       | Amplitude         | Function1<scalar> |
        f       | Frequency [1/s]   | Function1<scalar> |
        s       | Type scale factor | Function1<Type>   |
        l       | Type offset level | Function1<Type>   |
        t_0     | Start time [s]    | scalar            | 0
        r       | mark/space ratio  | scalar            | 1
        t       | Time [s]          | scalar
    \endvartable

    Example for a scalar:
    \verbatim
        <entryName> square;
        <entryName>Coeffs
        {
            frequency 10;
            amplitude 0.1;
            scale     2e-6;
            level     2e-6;
        }
    \endverbatim
This commit is contained in:
Henry Weller
2016-02-10 15:40:19 +00:00
parent 1193903d8d
commit 60281da466
5 changed files with 306 additions and 21 deletions

View File

@ -85,18 +85,6 @@ Type Foam::Function1Types::Sine<Type>::value(const scalar t) const
}
template<class Type>
Type Foam::Function1Types::Sine<Type>::integrate
(
const scalar t1,
const scalar t2
) const
{
NotImplemented;
return level_->value(t1);
}
template<class Type>
void Foam::Function1Types::Sine<Type>::writeData(Ostream& os) const
{

View File

@ -155,9 +155,6 @@ public:
//- Return value for time t
Type value(const scalar t) const;
//- Integrate between the two time values t1 and t2
Type integrate(const scalar t1, const scalar t2) const;
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};