collision_obj_Prepare Subroutine

private impure subroutine collision_obj_Prepare(this, timer, parser, monitors)

Prepares object for use in solvers.

Type Bound

collision_obj

Arguments

Type IntentOptional Attributes Name
class(collision_obj), intent(inout) :: this

Collision utility

type(timer_obj), intent(in), target :: timer

Timer utility

type(parser_obj), intent(in), target :: parser

Parser for input file

type(monitor_set), intent(in), target :: monitors

Monitors to print to stdout and files


Calls

proc~~collision_obj_prepare~~CallsGraph proc~collision_obj_prepare collision_obj%collision_obj_Prepare none~get parser_obj%Get proc~collision_obj_prepare->none~get proc~parser_obj_isdefined parser_obj%parser_obj_IsDefined proc~collision_obj_prepare->proc~parser_obj_isdefined proc~parser_obj_read0d parser_obj%parser_obj_read0D none~get->proc~parser_obj_read0d proc~parser_obj_read1d parser_obj%parser_obj_read1D none~get->proc~parser_obj_read1d proc~parser_obj_fetchlabelid parser_obj%parser_obj_FetchLabelID proc~parser_obj_isdefined->proc~parser_obj_fetchlabelid proc~parser_obj_read0d->proc~parser_obj_fetchlabelid none~assigndefault parser_obj%AssignDefault proc~parser_obj_read0d->none~assigndefault proc~parser_obj_read1d->proc~parser_obj_fetchlabelid proc~parser_obj_read1d->none~assigndefault proc~parser_obj_assigndefault0d parser_obj%parser_obj_AssignDefault0D none~assigndefault->proc~parser_obj_assigndefault0d proc~parser_obj_assigndefault1d parser_obj%parser_obj_AssignDefault1D none~assigndefault->proc~parser_obj_assigndefault1d

Called by

proc~~collision_obj_prepare~~CalledByGraph proc~collision_obj_prepare collision_obj%collision_obj_Prepare proc~grans_obj_preparesolvercollision grans_obj_PrepareSolverCollision proc~grans_obj_preparesolvercollision->proc~collision_obj_prepare proc~grans_obj_preparesolver grans_obj_PrepareSolver proc~grans_obj_preparesolver->proc~grans_obj_preparesolvercollision interface~grans_obj_preparesolver grans_obj%grans_obj_PrepareSolver interface~grans_obj_preparesolver->proc~grans_obj_preparesolver

Source Code

    impure subroutine collision_obj_Prepare(this,timer,parser,monitors)
      !> Prepares object for use in solvers.
      implicit none
      class(collision_obj), intent(inout) :: this                              !! Collision utility
      type(timer_obj),      intent(in),    &
                                   target :: timer                             !! Timer utility
      type(parser_obj),     intent(in),    &
                                   target :: parser                            !! Parser for input file
      type(monitor_set),    intent(in),    &
                                   target :: monitors                          !! Monitors to print to stdout and files

      character(len=str256) :: str
      integer :: n
      ! Associate pointers
      this%timer    => timer
      this%parser   => parser
      this%monitors => monitors

      ! Get parameters from input file
      call this%parser%Get('Collision time',              this%tcol)
      call this%parser%Get('Dry normal restitution coef', this%edry)
      call this%parser%Get('Coulomb friction coef',       this%muc)

      ! Collision will walls
      if (.not.this%parser%IsDefined('Wall normal direction')) then
        this%use_wall = .false.
        this%wall_count = 0
      else
        this%use_wall = .true.
        ! Determine number of planes for collisions
        call this%parser%Get('Wall normal direction',  str )
        this%wall_count = 0
        n     = 1
        do while (n.ne.0)
          this%wall_count = this%wall_count + 1
          str   = adjustl(str(n:len_trim(str)))
          n     = scan(trim(str),' ')
        end do

        ! Read the directions
        allocate(this%wall_dir(this%wall_count))
        allocate(this%wall_pos(this%wall_count))
        call this%parser%Get('Wall normal direction', this%wall_dir)

        ! This bit is for backward compatibility
        if ( (this%wall_count.eq.1).and. &
             (this%parser%IsDefined('Wall top position').or.this%parser%IsDefined('Wall bottom position'))) then
          this%wall_count = 2
          n = this%wall_dir(1)

          ! Reallocate arrays
          if (allocated(this%wall_dir)) deallocate(this%wall_dir)
          if (allocated(this%wall_pos)) deallocate(this%wall_pos)
          allocate(this%wall_dir(this%wall_count))
          allocate(this%wall_pos(this%wall_count))
          this%wall_dir(1:2) = n

          call this%parser%Get('Wall top position',    this%wall_pos(1), default = 1e-3_wp*huge(1.0_wp))
          call this%parser%Get('Wall bottom position', this%wall_pos(2), default =-1e-3_wp*huge(1.0_wp))
        else
          call this%parser%Get('Wall position',         this%wall_pos)
        end if
      end if

      return
    end subroutine collision_obj_Prepare