67 type(json_file),
intent(inout) :: params
69 this%dt_last_change = 0
71 this%if_variable_dt, .false.)
75 this%max_dt, huge(0.0_rp))
77 this%max_update_frequency, 0)
81 this%max_dt_increase_factor, 1.2_rp)
83 this%min_dt_decrease_factor, 0.5_rp)
100 real(kind=
rp),
intent(inout) :: dt
101 real(kind=
rp),
intent(in) :: cfl
102 real(kind=
rp),
intent(inout) :: cfl_avrg
103 real(kind=
rp) :: dt_old, scaling_factor
104 character(len=LOG_SIZE) :: log_buf
105 integer,
intent(in):: tstep
107 if (this%if_variable_dt .eqv. .true.)
then
108 if (tstep .eq. 1)
then
110 dt = min(this%set_cfl/cfl*dt, this%max_dt)
113 cfl_avrg = this%alpha * cfl + (1-this%alpha) * cfl_avrg
115 if (abs(cfl_avrg - this%set_cfl) .ge. &
116 this%dev_tol * this%set_cfl .and. &
117 this%dt_last_change .ge. this%max_update_frequency)
then
119 if (this%set_cfl/cfl .ge. 1)
then
121 scaling_factor = min(this%max_dt_increase_factor, this%set_cfl/cfl)
124 scaling_factor =
max(this%min_dt_decrease_factor, this%set_cfl/cfl)
128 dt = scaling_factor * dt_old
129 dt = min(dt, this%max_dt)
131 write(log_buf,
'(A,E15.7,1x,A,E15.7)')
'Avrg CFL:', cfl_avrg, &
132 'set_cfl:', this%set_cfl
135 write(log_buf,
'(A,E15.7,1x,A,E15.7)')
'old dt:', dt_old, &
139 this%dt_last_change = 0
142 this%dt_last_change = this%dt_last_change + 1