t_sBase Derived Type

type, public, extends(c_sbase) :: t_sBase


Inherits

type~~t_sbase~~InheritsGraph type~t_sbase t_sBase type~c_sbase c_sbase type~t_sbase->type~c_sbase type~t_sgrid t_sGrid type~t_sbase->type~t_sgrid grid type~sll_c_spline_matrix sll_c_spline_matrix type~c_sbase->type~sll_c_spline_matrix mass type~c_sgrid c_sgrid type~t_sgrid->type~c_sgrid

Inherited by

type~~t_sbase~~InheritedByGraph type~t_sbase t_sBase type~t_base t_base type~t_base->type~t_sbase s type~t_sbase_disc t_sBase_disc type~t_sbase_disc->type~t_sbase type~t_sbase_spl t_sBase_spl type~t_sbase_spl->type~t_sbase type~t_transform_sfl t_transform_sfl type~t_transform_sfl->type~t_base X1sfl_base, X2sfl_base, GZ_base, GZsfl_base

Components

Type Visibility Attributes Name Initial
integer, public :: deg

input parameter: degree of Spline/polynomial

integer, public :: degGP

number of Gauss-points (degGP+1) per element >= deg

integer, public :: continuity

input parameter: full spline (=deg-1) or discontinuous (=-1)

integer, public :: nGP

global number of gausspoints = (degGP+1)*nElems

integer, public :: nGP_str

local number of gausspoints = (degGP+1)*nElems per MPI subdomain

integer, public :: nGP_end

local number of gausspoints = (degGP+1)*nElems per MPI subdomain

integer, public :: nbase

total number of degree of freedom / global basis functions

class(sll_c_spline_matrix), public, ALLOCATABLE :: mass
logical, public :: initialized = .FALSE.

set to true in init, set to false in free

class(t_sGrid), public, POINTER :: grid

pointer to grid

real(kind=wp), public, ALLOCATABLE :: xi_GP(:)

element local gauss point positions for interval [-1,1], size(0:degGP)

real(kind=wp), public, ALLOCATABLE :: w_GPloc(:)

element local gauss weights for interval [-1,1], size(0:degGP)

real(kind=wp), public, ALLOCATABLE :: w_GP(:)

global radial integration weight size((degGP+1)*nElems)

real(kind=wp), public, ALLOCATABLE :: s_GP(:)

global position of gauss points in s [0,1] , size((degGP+1)*nElems)

real(kind=wp), public, ALLOCATABLE :: s_IP(:)

position of interpolation points for initialization, size(nBase)

integer, public, ALLOCATABLE :: base_offset(:)

offset of 0:deg element local basis functions to global index of degree of freedom, allocated (1:nElems). iBase = offset(iElem)+j, j=0...deg

real(kind=wp), public, ALLOCATABLE :: base_GP(:,:,:)

basis functions, (0:degGP,0:deg,1:nElems),

real(kind=wp), public, ALLOCATABLE :: base_ds_GP(:,:,:)

s derivative of basis functions, (0:degGP,0:deg,1:nElems)

real(kind=wp), public, ALLOCATABLE :: base_dsAxis(:,:)

all derivatives 1..deg of all basis functions at axis size(1:deg+1,0:deg)

real(kind=wp), public, ALLOCATABLE :: base_dsEdge(:,:)

all derivatives 1..deg of all basis functions at edge size(nBase-deg:nBase,0:deg)

integer, public, ALLOCATABLE :: nDOF_BC(:)

number of boundary dofs involved in bc of BC_TYPE, size(-(deg+1):6)

real(kind=wp), public, ALLOCATABLE :: A_Axis(:,:,:)

matrix to apply boundary conditions after interpolation (direct)

real(kind=wp), public, ALLOCATABLE :: invA_Axis(:,:,:)

inverse of A_Axis

real(kind=wp), public, ALLOCATABLE :: R_Axis(:,:,:)

matrix to apply boundary conditions for RHS (testfunction) size(1:deg+1,1:deg+1,-(deg+1):6)

real(kind=wp), public, ALLOCATABLE :: AR_Axis(:,:,:)

matrix to apply boundary conditions via LGM with identity size(1:deg+1,1:deg+1,-(deg+1):6)

real(kind=wp), public, ALLOCATABLE :: A_Edge(:,:,:)

matrix to apply boundary conditions after interpolation (direct)

real(kind=wp), public, ALLOCATABLE :: invA_Edge(:,:,:)

inverse of A_Edge

real(kind=wp), public, ALLOCATABLE :: R_Edge(:,:,:)

matrix to apply boundary conditions for RHS size(nBase-deg:nBase,nBase-deg:nBase,6)

real(kind=wp), public, ALLOCATABLE :: AR_Edge(:,:,:)

matrix to apply boundary conditions via LGM with identity size(nBase-deg:nBase,nBase-deg:nBase,6) possible Boundary conditions 1=1 : boundary left open 2=2 : 1st deriv fixed 3=3 : sol fixed (typically used at edge) 4=4 : all odd derivs = 0 5=5 : all even derivs & sol = 0 6=6 : all odd derivs & sol = 0 <=0: m-dependent BC: 0, m=0: 4 -1, m=1: 6 -2, m=2: 5 ... odd m<=deg: ANTISYMM + all derivatives 1,...,m-1 =0 ...even m<=deg: SYMMZERO + all derivatives 1,...,m-1 =0


Type-Bound Procedures

procedure, public :: init => sBase_init

  • private subroutine sBase_init(sf, deg_in, continuity_in, grid_in, degGP_in)

    initialize the type sbase with polynomial degree, continuity ( -1: disc, 1: full) and number of gauss points per element

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(inout) :: sf

    self

    integer, intent(in) :: deg_in

    polynomial degree

    integer, intent(in) :: continuity_in
    class(t_sGrid), intent(in), TARGET :: grid_in

    grid information

    integer, intent(in) :: degGP_in

    gauss quadrature points: nGP=degGP+1 per elements

procedure, public :: free => sBase_free

  • private subroutine sBase_free(sf)

    finalize the type sBase

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(inout) :: sf

    self

procedure, public :: copy => sBase_copy

  • private subroutine sBase_copy(sf, tocopy)

    copy onto sf <-- tocopy

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(inout) :: sf

    self

    class(c_sbase), intent(in) :: tocopy

procedure, public :: compare => sBase_compare

  • private subroutine sBase_compare(sf, tocompare, is_same, cond_out)

    compare sf with input sbase

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    class(c_sbase), intent(in) :: tocompare
    logical, intent(out), optional :: is_same
    logical, intent(out), optional :: cond_out(:)

procedure, public :: change_base => sBase_change_base

  • private subroutine sBase_change_base(sf, old_sBase, iterDim, old_data, sf_data)

    change data from old_sBase to self. using interpolations of the old data at the new interpolation points

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    class(c_sbase), intent(in) :: old_sBase

    base of old_data

    integer, intent(in) :: iterDim

    iterate on first or second dimension or old_data/sf_data

    real(kind=wp), intent(in) :: old_data(:,:)
    real(kind=wp), intent(out) :: sf_data(:,:)

procedure, public :: eval => sBase_eval

  • private subroutine sBase_eval(sf, x, deriv, iElem, base_x)

    evaluate sbase at position x [0,1], NOT EFFICIENT!!

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    real(kind=wp), intent(in) :: x

    position [0,1] where to evaluate

    integer, intent(in) :: deriv
    integer, intent(out) :: iElem
    real(kind=wp), intent(out) :: base_x(:)

    all basis functions (0:deg) evaluated

procedure, public :: evalDOF_s => sBase_evalDOF_s

  • private function sBase_evalDOF_s(sf, x, deriv, DOFs) result(y)

    simply evaluate function or derivative at point x

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    real(kind=wp), intent(in) :: x

    point positions in [0,1]

    integer, intent(in) :: deriv

    derivative (=0: solution)

    real(kind=wp), intent(in) :: DOFs(:)

    array of all degrees of freedom

    Return Value real(kind=wp)

procedure, public :: evalDOF2D_s => sBase_evalDOF2D_s

  • private function sBase_evalDOF2D_s(sf, x, nd, deriv, DOFs) result(y)

    simply evaluate function or derivative at point x, for multiple DOF vectors

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    real(kind=wp), intent(in) :: x

    point positions in [0,1]

    integer, intent(in) :: nd

    number of DOF vectors

    integer, intent(in) :: deriv

    derivative (=0: solution)

    real(kind=wp), intent(in) :: DOFs(1:sf%nBase,1:nd)

    Return Value real(kind=wp), (1:nd)

procedure, public :: evalDOF_base => sBase_evalDOF_base

  • private function sBase_evalDOF_base(sf, iElem, base_x, DOFs) result(y)

    simply evaluate function with a base or base derivative evaluated at a point and its corresponding iElem use together with sBase_eval(x) => iElem,base

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    integer, intent(in) :: iElem

    element where evaluation point

    real(kind=wp), intent(in) :: base_x(0:sf%deg)

    evaluation of base or its derivative in element iElem at a point position

    real(kind=wp), intent(in) :: DOFs(:)

    degrees of freedom

    Return Value real(kind=wp)

procedure, public :: evalDOF_GP => sBase_evalDOF_GP

  • private function sBase_evalDOF_GP(sf, deriv, DOFs) result(y_GP)

    evaluate all degrees of freedom at all Gauss Points (deriv=0 solution, deriv=1 first derivative d/ds)

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    integer, intent(in) :: deriv

    only 0 or 1

    real(kind=wp), intent(in) :: DOFs(:)

    array of all degrees of freedom

    Return Value real(kind=wp), (1:sf%nGP)

procedure, public :: initDOF => sBase_initDOF

  • private function sBase_initDOF(sf, g_IP) result(DOFs)

    take values interpolated at sf%s_IP positions and give back the degrees of freedom

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    real(kind=wp), intent(in) :: g_IP(:)

    interpolation values at s_IP positions [0,1]

    Return Value real(kind=wp), (1:sf%nBase)

    result of interpolation

procedure, public :: applyBCtoDOF => sBase_applyBCtoDOF_LGM

  • private subroutine sBase_applyBCtoDOF_LGM(sf, DOFs, BC_Type, BC_Val)

    apply boundary conditions at axis and edge, via solving the Lagrange multiplier problem: x_new=x_old & A*x_new = d

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    real(kind=wp), intent(inout) :: DOFs(1:sf%nBase)

    DOFs with boundary conditions applied

    integer, intent(in) :: BC_Type(2)

    bc type on axis (1) and edge (2)

    real(kind=wp), intent(in) :: BC_Val(2)

    for dirichlet BC : value

procedure, public :: applyBCtoRHS => sBase_applyBCtoRHS

  • private subroutine sBase_applyBCtoRHS(sf, RHS, BC_Type)

    apply strong boundary conditions at axis and edge for solution update

    Arguments

    Type IntentOptional Attributes Name
    class(t_sBase), intent(in) :: sf

    self

    real(kind=wp), intent(inout) :: RHS(sf%nBase)

    DOFs with boundary conditions applied

    integer, intent(in) :: BC_Type(2)

    bc type on axis (1) and edge (2)

Source Code

TYPE,EXTENDS(c_sbase) :: t_sBase
  !---------------------------------------------------------------------------------------------------------------------------------
  LOGICAL              :: initialized=.FALSE.      !! set to true in init, set to false in free
  !---------------------------------------------------------------------------------------------------------------------------------
  !input parameters
  CLASS(t_sgrid),POINTER :: grid                   !! pointer to grid
  !---------------------------------------------------------------------------------------------------------------------------------
  REAL(wp),ALLOCATABLE :: xi_GP(:)                  !! element local gauss point positions for interval [-1,1], size(0:degGP)
  REAL(wp),ALLOCATABLE :: w_GPloc(:)                !! element local gauss weights for interval [-1,1], size(0:degGP)
  REAL(wp),ALLOCATABLE :: w_GP(:)                   !! global radial integration weight size((degGP+1)*nElems)
  REAL(wp),ALLOCATABLE :: s_GP(:)                  !! global position of gauss points  in s [0,1] , size((degGP+1)*nElems)
  REAL(wp),ALLOCATABLE :: s_IP(:)                  !! position of interpolation points for initialization, size(nBase)
  INTEGER ,ALLOCATABLE :: base_offset(:)           !! offset of 0:deg element local basis functions to global index of
                                                   !! degree of freedom, allocated (1:nElems). iBase = offset(iElem)+j, j=0...deg
  REAL(wp),ALLOCATABLE :: base_GP(:,:,:)            !! basis functions, (0:degGP,0:deg,1:nElems),
  REAL(wp),ALLOCATABLE :: base_ds_GP(:,:,:)         !! s derivative of basis functions, (0:degGP,0:deg,1:nElems)
  REAL(wp),ALLOCATABLE :: base_dsAxis(:,:)         !! all derivatives 1..deg of all basis functions at axis size(1:deg+1,0:deg)
  REAL(wp),ALLOCATABLE :: base_dsEdge(:,:)         !! all derivatives 1..deg of all basis functions at edge size(nBase-deg:nBase,0:deg)
  INTEGER ,ALLOCATABLE :: nDOF_BC(:)               !! number of boundary dofs involved in bc of BC_TYPE, size(-(deg+1):NBC_TYPES)
  REAL(wp),ALLOCATABLE :: A_Axis(:,:,:)            !! matrix to apply boundary conditions after interpolation (direct)
  REAL(wp),ALLOCATABLE :: invA_Axis(:,:,:)         !! inverse of A_Axis
  REAL(wp),ALLOCATABLE :: R_Axis(:,:,:)            !! matrix to apply boundary conditions for RHS (testfunction)
                                                   !! size(1:deg+1,1:deg+1,-(deg+1):NBC_TYPES)
  REAL(wp),ALLOCATABLE :: AR_Axis(:,:,:)           !! matrix to apply boundary conditions via LGM with identity
                                                   !! size(1:deg+1,1:deg+1,-(deg+1):NBC_TYPES)
  REAL(wp),ALLOCATABLE :: A_Edge(:,:,:)            !! matrix to apply boundary conditions after interpolation (direct)
  REAL(wp),ALLOCATABLE :: invA_Edge(:,:,:)         !! inverse of A_Edge
  REAL(wp),ALLOCATABLE :: R_Edge(:,:,:)            !! matrix to apply boundary conditions for RHS
                                                   !! size(nBase-deg:nBase,nBase-deg:nBase,NBC_TYPES)
  REAL(wp),ALLOCATABLE :: AR_Edge(:,:,:)           !! matrix to apply boundary conditions via LGM with identity
                                                   !! size(nBase-deg:nBase,nBase-deg:nBase,NBC_TYPES)
                                                   !! possible Boundary conditions
                                                   !! 1=BC_TYPE_OPEN      : boundary left open
                                                   !! 2=BC_TYPE_NEUMANN   : 1st deriv fixed
                                                   !! 3=BC_TYPE_DIRICHLET : sol fixed          (typically used at edge)
                                                   !! 4=BC_TYPE_SYMM      : all odd derivs = 0
                                                   !! 5=BC_TYPE_SYMMZERO  : all even derivs & sol = 0
                                                   !! 6=BC_TYPE_ANTISYMM  : all odd derivs & sol = 0
                                                   !! <=0: m-dependent BC:
                                                   !!  0, m=0:  BC_TYPE_SYMM
                                                   !! -1, m=1:  BC_TYPE_ANTISYMM
                                                   !! -2, m=2:  BC_TYPE_SYMMZERO
                                                   !! ... odd m<=deg: ANTISYMM + all derivatives 1,...,m-1 =0
                                                   !! ...even m<=deg: SYMMZERO + all derivatives 1,...,m-1 =0

  CONTAINS

  PROCEDURE :: init          => sBase_init
  PROCEDURE :: free          => sBase_free
  PROCEDURE :: copy          => sBase_copy
  PROCEDURE :: compare       => sBase_compare
  PROCEDURE :: change_base   => sBase_change_base
  PROCEDURE :: eval          => sBase_eval
  PROCEDURE :: evalDOF_s     => sBase_evalDOF_s
  PROCEDURE :: evalDOF2D_s   => sBase_evalDOF2D_s
  PROCEDURE :: evalDOF_base  => sBase_evalDOF_base
  PROCEDURE :: evalDOF_GP    => sBase_evalDOF_GP
  PROCEDURE :: initDOF       => sBase_initDOF
  PROCEDURE :: applyBCtoDOF  => sBase_applyBCtoDOF_LGM
  PROCEDURE :: applyBCtoRHS  => sBase_applyBCtoRHS

END TYPE t_sBase