The oscillation equations field.
It is a FOODIE integrand class concrete extension.
The (inertial) Oscillation equations system is a non linear system of pure ODEs and it can be written as:
$$\begin{matrix} U_t = R(U) \\ U = \begin{bmatrix} v_1 \\ v_2 \end{bmatrix}\;\;\; R(U) = \begin{bmatrix} -f v_2 \\ f v_1 \end{bmatrix} \end{matrix}$$
The frequency f is constant and it is here selected as f=10^-4.
In the space v1-v2 the path of the oscillation must be a circle, but for the frequency selected some ODE solvers are not stable leading to a wrong path, see [1].
[1] Numerical Methods for Fluid Dynamics With Applications to Geophysics, Dale R. Durran, Springer, 2010.
State variables are organized as an array (rank 1) of reals of n=2 elements.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=R_P), | private | :: | U(1:2) | = | [0._R_P, 0._R_P] | Integrand (state) variables. | |
| real(kind=R_P), | private | :: | U0(1:2) | = | [0._R_P, 0._R_P] | Initial state. | |
| real(kind=R_P), | private | :: | f | = | 0._R_P | Oscillation frequency (Hz). | 
Overloading add_fast method.
+ fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Return amplitude and phase of the oscillation.
Compute amplitude and phase of the oscillation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | Advection field. | 
Amplitude and phase.
= operator.
= operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
= real operator.
= real operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Overloading = assignament.
= operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
= real operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Return an informative description of the test.
Return informative integrator description.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | Integrand. | ||
| character(len=*), | intent(in), | optional | :: | prefix | Prefixing string. | 
Description.
Return error.
Return error.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | Integrand. | ||
| real(kind=R_P), | intent(in) | :: | t | Time. | ||
| real(kind=R_P), | intent(in), | optional | :: | t0 | Initial time. | |
| class(integrand_object), | intent(in), | optional | :: | U0 | Initial conditions. | 
Error.
Return exact solution.
Return exact solution.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | Integrand. | ||
| real(kind=R_P), | intent(in) | :: | t | Time. | ||
| real(kind=R_P), | intent(in), | optional | :: | t0 | Initial time. | |
| class(integrand_object), | intent(in), | optional | :: | U0 | Initial conditions. | 
Exact solution.
Export integrand to Tecplot file.
Export integrand to Tecplot file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | Advection field. | ||
| character(len=*), | intent(in), | optional | :: | file_name | File name. | |
| real(kind=R_P), | intent(in), | optional | :: | t | Time. | |
| character(len=*), | intent(in), | optional | :: | scheme | Scheme used to integrate integrand. | |
| logical, | intent(in), | optional | :: | close_file | Flag for closing file. | |
| logical, | intent(in), | optional | :: | with_exact_solution | Flag for export also exact solution. | |
| class(integrand_object), | intent(in), | optional | :: | U0 | Initial conditions. | 
Initialize field.
Initialize integrand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | self | Integrand. | ||
| real(kind=R_P), | intent(in) | :: | Dt | Time step. | 
+ operator.
+ operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
+ fast operator.
+ fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
+ real operator.
+ real operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Operator result.
Return integrand dimension.
return integrand dimension.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | integrand. | 
integrand dimension.
* operator.
* operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
* fast operator.
* fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
* real operator.
* real_scalar operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Operator result.
* real_scalar operator.
* real_scalar operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
* real_scalar fast operator.
* real_scalar fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs | Right hand side. | 
- operator.
- operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
- real operator.
- real operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Operator result.
- fast operator.
- fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
||integrand_oscillation - integrand_oscillation|| operator.
Estimate local truncation error between 2 oscillation approximations.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Error estimation.
Overloading multiply_fast method.
* fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
* real_scalar fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs | Right hand side. | 
Overloading * operator.
* operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
* real_scalar operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Operator result.
real_scalar * operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs(1:) | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
* real_scalar operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
real_scalar * operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
Overloading + operator.
+ operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
+ real operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Operator result.
real + operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs(1:) | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Left hand side. | 
Operator result.
Overloading - operator.
- operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
- real operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| real(kind=R_P), | intent(in) | :: | rhs(1:) | Right hand side. | 
Operator result.
real - operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs(1:) | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Left hand side. | 
Operator result.
Estimate local truncation error.
Estimate local truncation error between 2 oscillation approximations.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Error estimation.
Extract integrand state field.
Extract integrand state field.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | Integrand. | 
State.
Initialize from command line interface.
Initialize from command line interface.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | self | Advection field. | ||
| type(command_line_interface), | intent(inout) | :: | cli | Command line interface handler. | 
real + operator.
real + operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs(1:) | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Left hand side. | 
Operator result.
real * operator.
real_scalar * operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs(1:) | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
real_scalar * operator.
real_scalar * operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Right hand side. | 
Operator result.
real - operator.
real - operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=R_P), | intent(in) | :: | lhs(1:) | Left hand side. | ||
| class(integrand_oscillation), | intent(in) | :: | rhs | Left hand side. | 
Operator result.
Set command line interface.
Set command line interface.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(command_line_interface), | intent(inout) | :: | cli | Command line interface handler. | 
Overloading subtract_fast method.
- fast operator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | opr | Operator result. | ||
| class(integrand_object), | intent(in) | :: | lhs | Left hand side. | ||
| class(integrand_object), | intent(in) | :: | rhs | Right hand side. | 
Time derivative, residuals.
Time derivative of integrand_oscillation field.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(in) | :: | self | Integrand. | ||
| real(kind=R_P), | intent(in), | optional | :: | t | Time. | 
Integrand time derivative.
Time derivative, residuals, fast mode.
Time derivative function of integrand class, i.e. the residuals function. Fast mode acting directly on self.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(integrand_oscillation), | intent(inout) | :: | self | Oscillation field. | ||
| real(kind=R_P), | intent(in), | optional | :: | t | Time. | 
type, extends(integrand_tester_object) :: integrand_oscillation
   !< The oscillation equations field.
   !<
   !< It is a FOODIE integrand class concrete extension.
   !<
   !<### Oscillation ODEs system
   !<The (inertial) Oscillation equations system is a non linear system of pure ODEs and it can be written as:
   !<
   !<$$\begin{matrix}
   !< U_t = R(U)  \\
   !< U = \begin{bmatrix}
   !< v_1 \\
   !< v_2
   !< \end{bmatrix}\;\;\;
   !< R(U) = \begin{bmatrix}
   !< -f v_2 \\
   !< f v_1
   !< \end{bmatrix}
   !<\end{matrix}$$
   !<
   !<The frequency *f* is constant and it is here selected as *f=10^-4*.
   !<
   !<In the space *v1-v2* the path of the oscillation must be a circle, but for the frequency selected some ODE solvers are not
   !<stable leading to a wrong path, see [1].
   !<
   !<#### Bibliography
   !<
   !<[1] *Numerical Methods for Fluid Dynamics With Applications to Geophysics*, Dale R. Durran, Springer, 2010.
   !<
   !<#### State variables organization
   !< State variables are organized as an array (rank 1) of reals of *n=2* elements.
   private
   real(R_P) :: f=0._R_P                 !< Oscillation frequency (Hz).
   real(R_P) :: U0(1:2)=[0._R_P, 0._R_P] !< Initial state.
   real(R_P) :: U(1:2)=[0._R_P, 0._R_P]  !< Integrand (state) variables.
   contains
      ! auxiliary methods
      procedure, pass(self), public :: amplitude_phase !< Return amplitude and phase of the oscillation.
      procedure, pass(self), public :: output          !< Extract integrand state field.
      ! integrand_tester_object deferred methods
      procedure, pass(self), public :: description    !< Return an informative description of the test.
      procedure, pass(self), public :: error          !< Return error.
      procedure, pass(self), public :: exact_solution !< Return exact solution.
      procedure, pass(self), public :: export_tecplot !< Export integrand to Tecplot file.
      procedure, pass(self), public :: initialize     !< Initialize field.
      procedure, pass(self), public :: parse_cli      !< Initialize from command line interface.
      procedure, nopass,     public :: set_cli        !< Set command line interface.
      ! integrand_object deferred methods
      procedure, pass(self), public :: integrand_dimension !< Return integrand dimension.
      procedure, pass(self), public :: t => dU_dt          !< Time derivative, residuals.
      ! operators
      procedure, pass(lhs), public :: local_error !<`||integrand_oscillation - integrand_oscillation||` operator.
      ! +
      procedure, pass(lhs), public :: integrand_add_integrand !< `+` operator.
      procedure, pass(lhs), public :: integrand_add_real      !< `+ real` operator.
      procedure, pass(rhs), public :: real_add_integrand      !< `real +` operator.
      ! *
      procedure, pass(lhs), public :: integrand_multiply_integrand   !< `*` operator.
      procedure, pass(lhs), public :: integrand_multiply_real        !< `* real` operator.
      procedure, pass(rhs), public :: real_multiply_integrand        !< `real *` operator.
      procedure, pass(lhs), public :: integrand_multiply_real_scalar !< `* real_scalar` operator.
      procedure, pass(rhs), public :: real_scalar_multiply_integrand !< `real_scalar *` operator.
      ! -
      procedure, pass(lhs), public :: integrand_sub_integrand !< `-` operator.
      procedure, pass(lhs), public :: integrand_sub_real      !< `- real` operator.
      procedure, pass(rhs), public :: real_sub_integrand      !< `real -` operator.
      ! =
      procedure, pass(lhs), public :: assign_integrand !< `=` operator.
      procedure, pass(lhs), public :: assign_real      !< `= real` operator.
      ! override fast operators
      procedure, pass(self), public :: t_fast                              !< Time derivative, residuals, fast mode.
      procedure, pass(opr),  public :: integrand_add_integrand_fast        !< `+` fast operator.
      procedure, pass(opr),  public :: integrand_multiply_integrand_fast   !< `*` fast operator.
      procedure, pass(opr),  public :: integrand_multiply_real_scalar_fast !< `* real_scalar` fast operator.
      procedure, pass(opr),  public :: integrand_subtract_integrand_fast   !< `-` fast operator.
endtype integrand_oscillation