Prepares object for use in solvers.
| Type | Intent | Optional | 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 |
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