Burgers equations field.
It is a FOODIE integrand class concrete extension.
The Burgers PDE equation is a non linear PDE widely used as numerical benchmark that can be applied to describe a wide range of different problems, from fluid dynamics to traffic flows, see [1].
$$ \begin{matrix} U_t = R(U) \Leftrightarrow U_t = F(U)_x \\ U = [u]\;\;\; F(U) = [-\frac{1}{2}u^2+\nu u_x] \end{matrix} $$
This is the viscous Burgers' equation, \(\nu\) being the viscosity. This equation is of paramount relevance because it retains complex aspects such as the hyperbolic nature of the convection term (allowing discontinuous solutions) and the diffusive nature of the viscous term.
[1] The partial differential equation ut + uux = nuxx, Hopf, Eberhard, Communications on Pure and Applied Mathematics, vol 3, issue 3, doi 10.1002/cpa.3160030302, pp. 201–230, 1950.
State variable is organized as an array (rank 1) for whole physical domain.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=I_P), | private | :: | Ni | = | 0 | Number of grid nodes. |
|
real(kind=R_P), | private, | dimension(:), allocatable | :: | U | Integrand (state) variables, whole physical domain, [1:Ni]. |
||
integer(kind=I_P), | private | :: | dims | = | 0 | Space dimensions. |
|
real(kind=R_P), | private | :: | h | = | 0._R_P | Space step discretization. |
|
real(kind=R_P), | private | :: | nu | = | 0._R_P | Viscosity. |
|
real(kind=R_P), | private, | dimension(:,:), allocatable | :: | previous | Previous time steps states, [1:Ni,1:steps]. |
||
integer(kind=I_P), | private | :: | steps | = | 0 | Number of time steps stored. |
Burgers + Burgers operator.
Add two Burgers fields.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | lhs | Left hand side. |
||
class(integrand), | intent(in) | :: | rhs | Right hand side. |
Operator result.
Burgers = Burgers.
Assign one Burgers field to another.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(inout) | :: | lhs | Left hand side. |
||
class(integrand), | intent(in) | :: | rhs | Right hand side. |
Burgers = real.
Assign one real to a Burgers field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(inout) | :: | lhs | Left hand side. |
||
real(kind=R_P), | intent(in) | :: | rhs | Right hand side. |
Compute the current time step, by means of CFL condition.
Compute the current time step, by means of CFL condition.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | self | Burgers field. |
||
real(kind=R_P), | intent(in) | :: | CFL | Courant-Friedricks-Lewi stability coefficient. |
Current time step.
Init field.
Construct an initialized Burgers field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(inout) | :: | self | Burgers field. |
||
real(kind=R_P), | intent(in), | dimension(1:Ni) | :: | initial_state | Initial state of Burgers field domain. |
|
integer(kind=I_P), | intent(in) | :: | Ni | Number of grid nodes. |
||
real(kind=R_P), | intent(in) | :: | h | Space step discretization. |
||
real(kind=R_P), | intent(in) | :: | nu | Viscosity. |
||
integer(kind=I_P), | intent(in), | optional | :: | steps | Time steps stored. |
Burgers * burgers operator.
Multiply a Burgers field by another one.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | lhs | Left hand side. |
||
class(integrand), | intent(in) | :: | rhs | Right hand side. |
Operator result.
Burgers * real operator.
Multiply a Burgers field by a real scalar.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | lhs | Left hand side. |
||
real(kind=R_P), | intent(in) | :: | rhs | Right hand side. |
Operator result.
Local error.
Estimate local truncation error between 2 burgers approximations.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | lhs | Left hand side. |
||
class(integrand), | intent(in) | :: | rhs | Right hand side. |
Error estimation.
Extract Burgers field.
Get a previous time step.
Extract previous time solution of Burgers field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | self | Burgers field. |
||
integer(kind=I_P), | intent(in) | :: | n | Time level. |
Previous time solution of Burgers field.
Real * Burgers operator.
Multiply a real scalar by a Burgers field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R_P), | intent(in) | :: | lhs | Left hand side. |
||
class(burgers), | intent(in) | :: | rhs | Right hand side. |
Operator result.
Burgers - Burgers operator.
Subtract two Burgers fields.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | lhs | Left hand side. |
||
class(integrand), | intent(in) | :: | rhs | Right hand side. |
Operator result.
Time derivative, residuals func.
Time derivative of Burgers field, residuals function.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | self | Burgers field. |
||
real(kind=R_P), | intent(in), | optional | :: | t | Time. |
Burgers field time derivative.
Update previous time steps.
Update previous time steps.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(inout) | :: | self | Burgers field. |
||
class(integrand), | intent(in), | optional | :: | filter | Filter field displacement. |
|
real(kind=R_P), | intent(in), | optional | :: | weights(:) | Weights for filtering the steps. |
1st derivative.
Compute the first order spatial derivative of Burgers field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | self | Burgers field. |
Burgers field derivative.
2nd derivative.
Compute the second order spatial derivative of Burgers field.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(burgers), | intent(in) | :: | self | Burgers field. |
Burgers field derivative.
type, extends(integrand) :: burgers
!< Burgers equations field.
!<
!< It is a FOODIE integrand class concrete extension.
!<
!<### Burgers PDE equation
!<The Burgers PDE equation is a non linear PDE widely used as numerical benchmark that can be applied to describe
!<a wide range of different problems, from fluid dynamics to traffic flows, see [1].
!<
!<$$
!<\begin{matrix}
!<U_t = R(U) \Leftrightarrow U_t = F(U)_x \\
!<U = [u]\;\;\;
!<F(U) = [-\frac{1}{2}u^2+\nu u_x]
!<\end{matrix}
!<$$
!<
!<This is the viscous Burgers' equation, \(\nu\) being the viscosity. This equation is of paramount relevance because it retains
!<complex aspects such as the hyperbolic nature of the convection term (allowing discontinuous solutions) and the diffusive nature
!<of the viscous term.
!<
!<#### Bibliography
!<
!<[1] *The partial differential equation ut + uux = nuxx*, Hopf, Eberhard, Communications on Pure and Applied Mathematics,
!< vol 3, issue 3, doi 10.1002/cpa.3160030302, pp. 201--230, 1950.
!<
!<#### State variables organization
!< State variable is organized as an array (rank 1) for whole physical domain.
private
integer(I_P) :: dims=0 !< Space dimensions.
integer(I_P) :: Ni=0 !< Number of grid nodes.
integer(I_P) :: steps=0 !< Number of time steps stored.
real(R_P) :: h=0._R_P !< Space step discretization.
real(R_P) :: nu=0._R_P !< Viscosity.
real(R_P), dimension(:), allocatable :: U !< Integrand (state) variables, whole physical domain, [1:Ni].
real(R_P), dimension(:,:), allocatable :: previous !< Previous time steps states, [1:Ni,1:steps].
contains
! auxiliary methods
procedure, pass(self), public :: init !< Init field.
procedure, pass(self), public :: output !< Extract Burgers field.
procedure, pass(self), public :: dt => compute_dt !< Compute the current time step, by means of CFL condition.
! ADT integrand deferred methods
procedure, pass(self), public :: t => dBurgers_dt !< Time derivative, residuals func.
procedure, pass(self), public :: update_previous_steps !< Update previous time steps.
procedure, pass(self), public :: previous_step !< Get a previous time step.
procedure, pass(lhs), public :: local_error => burgers_local_error !< Local error.
procedure, pass(lhs), public :: integrand_multiply_integrand => burgers_multiply_burgers !< Burgers * burgers operator.
procedure, pass(lhs), public :: integrand_multiply_real => burgers_multiply_real !< Burgers * real operator.
procedure, pass(rhs), public :: real_multiply_integrand => real_multiply_burgers !< Real * Burgers operator.
procedure, pass(lhs), public :: add => add_burgers !< Burgers + Burgers operator.
procedure, pass(lhs), public :: sub => sub_burgers !< Burgers - Burgers operator.
procedure, pass(lhs), public :: assign_integrand => burgers_assign_burgers !< Burgers = Burgers.
procedure, pass(lhs), public :: assign_real => burgers_assign_real !< Burgers = real.
! private methods
procedure, pass(self), private :: x => dBurgers_dx !< 1st derivative.
procedure, pass(self), private :: xx => d2Burgers_dx2 !< 2nd derivative.
endtype burgers