Init_Vector3D Subroutine

public subroutine Init_Vector3D(this, interp, nVar, nElem)

Arguments

TypeIntentOptionalAttributesName
class(Vector3D), intent(out) :: this
type(Lagrange), intent(in), target:: interp
integer, intent(in) :: nVar
integer, intent(in) :: nElem

Calls

proc~~init_vector3d~~CallsGraph proc~init_vector3d Init_Vector3D equationparser equationparser proc~init_vector3d->equationparser proc~hipblascheck hipblasCheck proc~init_vector3d->proc~hipblascheck interface~hipmalloc hipMalloc proc~init_vector3d->interface~hipmalloc proc~gpucheck gpuCheck proc~init_vector3d->proc~gpucheck interface~hipblascreate hipblasCreate proc~init_vector3d->interface~hipblascreate

Contents

Source Code


Source Code

  subroutine Init_Vector3D(this,interp,nVar,nElem)
    implicit none
    class(Vector3D),intent(out) :: this
    type(Lagrange),target,intent(in) :: interp
    integer,intent(in) :: nVar
    integer,intent(in) :: nElem
    ! local
    integer :: i
    integer(c_size_t) :: workSize

    this%interp => interp
    this%nVar = nVar
    this%nElem = nElem
    this%N = interp%N
    this%M = interp%M

    allocate(this%interior(1:interp%N+1,1:interp%N+1,1:interp%N+1,1:nelem,1:nvar,1:3), &
             this%boundary(1:interp%N+1,1:interp%N+1,1:6,1:nelem,1:nvar,1:3), &
             this%extBoundary(1:interp%N+1,1:interp%N+1,1:6,1:nelem,1:nvar,1:3), &
             this%avgBoundary(1:interp%N+1,1:interp%N+1,1:6,1:nelem,1:nvar,1:3), &
             this%boundaryNormal(1:interp%N+1,1:interp%N+1,1:6,1:nelem,1:nvar))

    allocate(this%meta(1:nVar))
    allocate(this%eqn(1:3*nVar))

    ! Initialize equation parser
    ! This is done to prevent segmentation faults that arise
    ! when building with amdflang that are traced back to
    ! feqparse_functions.f90 : finalize routine
    ! When the equation parser is not initialized, the
    ! functions are not allocated, which I think are the
    ! source of the segfault - joe@fluidnumerics.com
    do i = 1,3*nvar
      this%eqn(i) = EquationParser('f=0',(/'x','y','z','t'/))
    enddo

    this%interior = 0.0_prec
    this%boundary = 0.0_prec
    this%boundarynormal = 0.0_prec
    this%extBoundary = 0.0_prec
    this%avgBoundary = 0.0_prec

    call gpuCheck(hipMalloc(this%interior_gpu,sizeof(this%interior)))
    call gpuCheck(hipMalloc(this%boundary_gpu,sizeof(this%boundary)))
    call gpuCheck(hipMalloc(this%extBoundary_gpu,sizeof(this%extBoundary)))
    call gpuCheck(hipMalloc(this%avgBoundary_gpu,sizeof(this%avgBoundary)))
    call gpuCheck(hipMalloc(this%boundaryNormal_gpu,sizeof(this%boundaryNormal)))
    workSize = (interp%N+1)*(interp%N+1)*(interp%M+1)*nelem*nvar*3*prec
    call gpuCheck(hipMalloc(this%interpWork1,workSize))
    workSize = (interp%N+1)*(interp%M+1)*(interp%M+1)*nelem*nvar*3*prec
    call gpuCheck(hipMalloc(this%interpWork2,workSize))

    call this%UpdateDevice()

    call hipblasCheck(hipblasCreate(this%blas_handle))

  endsubroutine Init_Vector3D