differentiate Module

This module implements differentiation over a one dimensional pencil. It exports concrete derived types

  • differentiator_type :: periodic differentiation
  • nonperiodic_differentiator_type :: non periodic differentiation

Both types provide access to a single type-procedure diff that performs the differentiation and return the derivative evaluated over the input pencil.

Instances of differentiator derived types are created on the client side via constructor procedures <method>_<order> (e.g. sixth_order_compact_1). These constructor procedures are implemented as a generic interface to concrete constructors for the periodic case (no boundary conditions are specified) or the noneriodic case (boundary conditions are specified). See module boundary_schemes.

use boundary_schemes, only:: get_dirichlet_4th
real :: f(:), df(:), dx
! ...
! ...
differentiatior = sixth_order_compact_1( &
     & east = get_dirichlet_4th(), &
     & west = get_dirichlet_4th(), &
     & )
df = differentiatior%diff(f, dx)


Contents


Interfaces

public interface sixth_order_compact_1

public interface sixth_order_compact_2


Derived Types

type, public ::  differentiator_type

Implements differentiation over a periodic stencil. differentiator_type provides access a a unique type-bound procedure diff

Type-Bound Procedures

procedure , public :: diff => diff_periodic Function

Components

Type Visibility Attributes Name Initial
type(stencil_type), public :: east_stencils(2)
type(stencil_type), public :: west_stencils(2)

Type-Bound Procedures

procedure , public :: diff => diff_nonperiodic Function

Functions

public pure function sixth_order_compact_1_nonperiodic(east, west)

Arguments

Type IntentOptional Attributes Name
type(boundary_type), intent(in) :: east
type(boundary_type), intent(in) :: west

Return Value type(nonperiodic_differentiator_type)

public pure function sixth_order_compact_1_periodic()

Arguments

None

Return Value type(differentiator_type)

public pure function sixth_order_compact_2_nonperiodic(east, west)

Arguments

Type IntentOptional Attributes Name
type(boundary_type), intent(in) :: east
type(boundary_type), intent(in) :: west

Return Value type(nonperiodic_differentiator_type)

public pure function sixth_order_compact_2_periodic()

Arguments

None

Return Value type(differentiator_type)

public pure function diff_nonperiodic(self, f, dx) result(df)

Apply a differentiation stencil along a one dimensional pencil, then apply boundary conditions on both ends. Boundary conditions are applied as arrays of type stencil_type

Arguments

Type IntentOptional Attributes Name
class(nonperiodic_differentiator_type), intent(in) :: self
real, intent(in) :: f(:)
real, intent(in) :: dx

Return Value real, allocatable, (:)

public pure function diff_periodic(self, f, dx) result(df)

Apply a differentiation stencil along a one dimensional pencil, assuming periodic boundaries. For instance, with a four point stencil and weights

Read more…

Arguments

Type IntentOptional Attributes Name
class(differentiator_type), intent(in) :: self
real, intent(in) :: f(:)

Function to be derive, evaluated on pencil

real, intent(in) :: dx

Step size

Return Value real, allocatable, (:)

Derivative, evaluated on pencil

public pure function reverse(x)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x(:)

Return Value real, (size(x))