burgers Derived Type

type, public, extends(integrand) :: burgers

type~~burgers~~InheritsGraph type~burgers burgers integrand integrand integrand->type~burgers
Help


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.


Source Code


Components

TypeVisibility AttributesNameInitial
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.


Type-Bound Procedures

procedure, public, pass(lhs) :: add => add_burgers

Burgers + Burgers operator.

  • private function add_burgers(lhs, rhs) result(opr)

    Add two Burgers fields.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: lhs

    Left hand side.

    class(integrand), intent(in) :: rhs

    Right hand side.

    Return Value class(integrand), allocatable

    Operator result.

procedure, public, pass(lhs) :: assign_integrand => burgers_assign_burgers

Burgers = Burgers.

  • private subroutine burgers_assign_burgers(lhs, rhs)

    Assign one Burgers field to another.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(inout) :: lhs

    Left hand side.

    class(integrand), intent(in) :: rhs

    Right hand side.

procedure, public, pass(lhs) :: assign_real => burgers_assign_real

Burgers = real.

  • private subroutine burgers_assign_real(lhs, rhs)

    Assign one real to a Burgers field.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(inout) :: lhs

    Left hand side.

    real(kind=R_P), intent(in) :: rhs

    Right hand side.

procedure, public, pass(self) :: dt => compute_dt

Compute the current time step, by means of CFL condition.

  • private pure function compute_dt(self, CFL) result(dt)

    Compute the current time step, by means of CFL condition.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: self

    Burgers field.

    real(kind=R_P), intent(in) :: CFL

    Courant-Friedricks-Lewi stability coefficient.

    Return Value real(kind=R_P)

    Current time step.

procedure, public, pass(self) :: init

Init field.

  • private subroutine init(self, initial_state, Ni, h, nu, steps)

    Construct an initialized Burgers field.

    Arguments

    Type IntentOptional AttributesName
    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.

procedure, public, pass(lhs) :: integrand_multiply_integrand => burgers_multiply_burgers

Burgers * burgers operator.

  • private function burgers_multiply_burgers(lhs, rhs) result(opr)

    Multiply a Burgers field by another one.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: lhs

    Left hand side.

    class(integrand), intent(in) :: rhs

    Right hand side.

    Return Value class(integrand), allocatable

    Operator result.

procedure, public, pass(lhs) :: integrand_multiply_real => burgers_multiply_real

Burgers * real operator.

  • private function burgers_multiply_real(lhs, rhs) result(opr)

    Multiply a Burgers field by a real scalar.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: lhs

    Left hand side.

    real(kind=R_P), intent(in) :: rhs

    Right hand side.

    Return Value class(integrand), allocatable

    Operator result.

procedure, public, pass(lhs) :: local_error => burgers_local_error

Local error.

  • private function burgers_local_error(lhs, rhs) result(error)

    Estimate local truncation error between 2 burgers approximations.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: lhs

    Left hand side.

    class(integrand), intent(in) :: rhs

    Right hand side.

    Return Value real(kind=R_P)

    Error estimation.

procedure, public, pass(self) :: output

Extract Burgers field.

  • private pure function output(self) result(state)

    Output the Burgers field state.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: self

    Burgers field.

    Return Value real(kind=R_P), dimension(:), allocatable

    Burgers state variable.

procedure, public, pass(self) :: previous_step

Get a previous time step.

  • private function previous_step(self, n) result(previous)

    Extract previous time solution of Burgers field.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: self

    Burgers field.

    integer(kind=I_P), intent(in) :: n

    Time level.

    Return Value class(integrand), allocatable

    Previous time solution of Burgers field.

procedure, public, pass(rhs) :: real_multiply_integrand => real_multiply_burgers

Real * Burgers operator.

  • private function real_multiply_burgers(lhs, rhs) result(opr)

    Multiply a real scalar by a Burgers field.

    Arguments

    Type IntentOptional AttributesName
    real(kind=R_P), intent(in) :: lhs

    Left hand side.

    class(burgers), intent(in) :: rhs

    Right hand side.

    Return Value class(integrand), allocatable

    Operator result.

procedure, public, pass(lhs) :: sub => sub_burgers

Burgers - Burgers operator.

  • private function sub_burgers(lhs, rhs) result(opr)

    Subtract two Burgers fields.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: lhs

    Left hand side.

    class(integrand), intent(in) :: rhs

    Right hand side.

    Return Value class(integrand), allocatable

    Operator result.

procedure, public, pass(self) :: t => dBurgers_dt

Time derivative, residuals func.

  • private function dBurgers_dt(self, t) result(dState_dt)

    Time derivative of Burgers field, residuals function.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: self

    Burgers field.

    real(kind=R_P), intent(in), optional :: t

    Time.

    Return Value class(integrand), allocatable

    Burgers field time derivative.

procedure, public, pass(self) :: update_previous_steps

Update previous time steps.

  • private subroutine update_previous_steps(self, filter, weights)

    Update previous time steps.

    Arguments

    Type IntentOptional AttributesName
    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.

procedure, private, pass(self) :: x => dBurgers_dx

1st derivative.

  • private function dBurgers_dx(self) result(derivative)

    Compute the first order spatial derivative of Burgers field.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: self

    Burgers field.

    Return Value type(burgers)

    Burgers field derivative.

procedure, private, pass(self) :: xx => d2Burgers_dx2

2nd derivative.

  • private function d2Burgers_dx2(self) result(derivative)

    Compute the second order spatial derivative of Burgers field.

    Arguments

    Type IntentOptional AttributesName
    class(burgers), intent(in) :: self

    Burgers field.

    Return Value type(burgers)

    Burgers field derivative.

Source Code

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