68    type(json_file), 
intent(inout) :: params
 
   70    this%dt_last_change = -1
 
   72         this%is_variable_dt, .false.)
 
   76         this%max_dt, huge(0.0_rp))
 
   80         this%max_update_frequency, 0)
 
   82         this%min_update_frequency, huge(0))
 
   86         this%max_dt_increase_factor, 1.2_rp)
 
   88         this%min_dt_decrease_factor, 0.5_rp)
 
 
  104    real(kind=
rp), 
intent(in) :: cfl
 
  105    real(kind=
rp) :: dt_old, scaling_factor
 
  106    character(len=LOG_SIZE) :: log_buf
 
  109    if (.not. this%is_variable_dt) 
return 
  112    if (this%dt_last_change .eq. 0) 
then 
  116    if (this%dt_last_change .eq. -1) 
then 
  119       time%dt = 
max(min(this%cfl_trg / cfl * time%dt, &
 
  120            this%max_dt), this%min_dt)
 
  121       this%dt_last_change = 0
 
  126       this%cfl_avg = this%alpha * cfl + (1 - this%alpha) * this%cfl_avg
 
  128       if (abs(this%cfl_avg - this%cfl_trg) .ge. this%dev_tol * this%cfl_trg &
 
  129            .and. this%dt_last_change .ge. this%max_update_frequency &
 
  130            .or. this%dt_last_change .ge. this%min_update_frequency) 
then 
  132          if (this%cfl_trg/cfl .ge. 1) 
then 
  134             scaling_factor = min(this%max_dt_increase_factor, this%cfl_trg/cfl)
 
  137             scaling_factor = 
max(this%min_dt_decrease_factor, this%cfl_trg/cfl)
 
  141          time%dt = scaling_factor * dt_old
 
  142          time%dt = 
max(min(time%dt, this%max_dt), this%min_dt)
 
  144          write(log_buf, 
'(A,E15.7,1x,A,E15.7)') &
 
  145               'Average CFL:', this%cfl_avg, &
 
  146               'Target  CFL:', this%cfl_trg
 
  149          write(log_buf, 
'(A,E15.7,1x,A,E15.7)') 
'Old dt:', dt_old, &
 
  153          this%dt_last_change = 0
 
  156          this%dt_last_change = this%dt_last_change + 1