tem_load_miescatter Subroutine

private subroutine tem_load_miescatter(conf, thandle, me)

load gauss pulse variables to set initial condition

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: conf

lua state type

integer, intent(in) :: thandle

aotus parent handle

type(tem_miescatter_field_type), intent(out) :: me

Global gauss pulse data type


Source Code

  subroutine tem_load_miescatter(conf, thandle, me)
    ! ---------------------------------------------------------------------------
    !> lua state type
    type(flu_State) :: conf
    !> aotus parent handle
    integer, intent(in) :: thandle
    !> Global gauss pulse data type
    type(tem_miescatter_field_type), intent(out) :: me
    ! ---------------------------------------------------------------------------
    integer :: iError, iPos, cent_handle, back_handle, circ_handle
    real(kind=rk) :: frequency
    ! ---------------------------------------------------------------------------

    ! Read center cooridnates
    call aot_table_open( L       = conf,                                       &
      &                  parent  = thandle,                                    &
      &                  thandle = cent_handle,                                &
      &                  key     = 'center' )
    if ( cent_handle.eq.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*)'Not able to read center-table for Mie-Scatter '//    &
        &                'solution from lua, stopping ...'
      call tem_abort()
    end if
    do iPos = 1, 2
      call aot_get_val( L       = conf,                                        &
        &               thandle = cent_handle,                                 &
        &               pos     = iPos,                                        &
        &               val     = me%miescatter%center(iPos),                  &
        &               ErrCode = iError )
      if ( iError.ne.0 ) then
        write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
        write(logUnit(1),*)'Not able to read center for Mie-Scatter '//        &
          &                'solution from lua, stopping ...'
        call tem_abort()
      end if
    end do
    call aot_table_close(conf, cent_handle)


    ! Read radius of the cylinder
    call aot_get_val( L       = conf,                                          &
      &               thandle = thandle,                                       &
      &               key     = 'radius',                                      &
      &               val     = me%miescatter%radius,                          &
      &               ErrCode = iError )
    if ( iError.ne.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*)'Not able to read radius for Mie-Scatter '//          &
         &                'solution from lua, stopping ...'
      call tem_abort()
    end if


    ! Read background permeability and permitivity
    call aot_table_open( L       = conf,                                       &
      &                  parent  = thandle,                                    &
      &                  thandle = back_handle,                                &
      &                  key     = 'permeaPermit_background' )
    if ( back_handle.eq.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*) 'Not able to open permeaPermit_background-table for '&
                    & // 'Mie-Scatter solution from lua, stopping ...'
      call tem_abort()
    end if
    call aot_get_val( L       = conf,                                          &
      &               thandle = back_handle,                                   &
      &               pos     = 1,                                             &
      &               val     = me%miescatter%permeability_background,         &
      &               ErrCode = iError )
    if ( iError.ne.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*) 'Not able to read background permeability for ' //   &
                    & 'Mie-Scatter solution from lua, stopping ...'
      call tem_abort()
    end if
    call aot_get_val( L       = conf,                                          &
      &               thandle = back_handle,                                   &
      &               pos     = 2,                                             &
      &               val     = me%miescatter%permitivity_background,          &
      &               ErrCode = iError )
    if ( iError.ne.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*) 'Not able to read background permitivity for ' //    &
                    & 'Mie-Scatter solution from lua, stopping ...'
      call tem_abort()
    end if
    call aot_table_close(conf, back_handle)


    ! Read background permeability and permitivity
    call aot_table_open( L       = conf,                                       &
      &                  parent  = thandle,                                    &
      &                  thandle = circ_handle,                                &
      &                  key     = 'permeaPermit_cylinder' )
    if ( back_handle.eq.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*) 'Not able to open permeaPermit_cylinder-table for '//&
                    & 'Mie-Scatter solution from lua, stopping ...'
      call tem_abort()
    end if
    call aot_get_val( L       = conf,                                          &
      &               thandle = circ_handle,                                   &
      &               pos     = 1,                                             &
      &               val     = me%miescatter%permeability_cylinder,           &
      &               ErrCode = iError )
    if ( iError.ne.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*) 'Not able to read cylinder permeability for ' // &
                    & 'Mie-Scatter solution from lua, stopping ...'
      call tem_abort()
    end if
    call aot_get_val( L       = conf,                                          &
      &               thandle = circ_handle,                                   &
      &               pos     = 2,                                             &
      &               val     = me%miescatter%permitivity_cylinder,            &
      &               ErrCode = iError )
    if ( iError.ne.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*) 'Not able to read cylinder permitivity for ' // &
                    & 'Mie-Scatter solution from lua, stopping ...'
      call tem_abort()
    end if
    call aot_table_close(conf, circ_handle)


    ! Read the frequency
    call aot_get_val( L       = conf,                                          &
      &               thandle = thandle,                                       &
      &               key     = 'frequency',                                   &
      &               val     = frequency,                                     &
      &               ErrCode = iError )
    if ( iError.ne.0 ) then
      write(logUnit(1),*)'ERROR in tem_load_miescatter_displacementfieldz: '
      write(logUnit(1),*)'Not able to read frequency for Mie-Scatter '//       &
        &                'solution from lua, stopping ...'
      call tem_abort()
    end if
    me%miescatter%omega = 2.0_rk * PI * frequency

    ! Calculate the wave numbers inside and outside of the cylinder
    me%miescatter%wavenumber_cylinder = me%miescatter%omega &
    & * sqrt(me%miescatter%permeability_cylinder *          &
    &        me%miescatter%permitivity_cylinder             )
    me%miescatter%wavenumber_background = me%miescatter%omega &
    & * sqrt(me%miescatter%permeability_background *          &
    &        me%miescatter%permitivity_background             )

    ! Setup the parameters for the solution inside and outside the
    ! dielectric cylinder...
    call tem_init_data( conf, thandle, me%miescatter, me%mieexpansion )

  end subroutine tem_load_miescatter