compute_dt Function

private pure function compute_dt(self, steps_max, t_max, t, CFL) result(Dt)

Compute the current time step by means of CFL condition.

Arguments

Type IntentOptional AttributesName
class(euler_1d), intent(in) :: self

Euler field.

integer(kind=I4P), intent(in) :: steps_max

Maximun number of time steps.

real(kind=R8P), intent(in) :: t_max

Maximum integration time.

real(kind=R8P), intent(in) :: t

Time.

real(kind=R8P), intent(in) :: CFL

CFL value.

Return Value real(kind=R8P)

Time step.


Source Code


Source Code

   pure function compute_dt(self, steps_max, t_max, t, CFL) result(Dt)
   !< Compute the current time step by means of CFL condition.
   class(euler_1d), intent(in) :: self      !< Euler field.
   integer(I4P),    intent(in) :: steps_max !< Maximun number of time steps.
   real(R8P),       intent(in) :: t_max     !< Maximum integration time.
   real(R8P),       intent(in) :: t         !< Time.
   real(R8P),       intent(in) :: CFL       !< CFL value.
   real(R8P)                   :: Dt        !< Time step.
   type(vector)                :: u         !< Velocity vector.
   real(R8P)                   :: a         !< Speed of sound.
   real(R8P)                   :: vmax      !< Maximum propagation speed of signals.
   integer(I4P)                :: i         !< Counter.

   associate(Ni=>self%Ni, Dx=>self%Dx)
      vmax = 0._R8P
      do i=1, Ni
         u = self%U(i)%velocity()
         a = self%eos%speed_of_sound(density=self%U(i)%density, pressure=self%U(i)%pressure(eos=self%eos))
         vmax = max(vmax, u%normL2() + a)
      enddo
      Dt = Dx * CFL / vmax
      if (steps_max <= 0 .and. t_max > 0._R8P) then
         if ((t + Dt) > t_max) Dt = t_max - t
      endif
   endassociate
   endfunction compute_dt


add add add_euler array array compute_derivate compute_dt compute_fluxes compute_fluxes compute_fluxes_from_primitive compute_post_rarefaction compute_post_shock compute_roe_state compute_states23_from_u23 compute_u23 compute_up23 compute_waves compute_waves_u23 compute_waves_up23 cons_assign_cons cons_divide_real cons_multiply_cons cons_multiply_real conservative_compressible conservative_compressible_instance conservative_compressible_pointer conservative_to_primitive_compressible cp cv delta density description description description description destroy destroy destroy dEuler_dt energy energy eos_assign_eos eos_compressible eos_compressible_instance eos_compressible_pointer eta euler_assign_euler euler_assign_real euler_local_error euler_multiply_euler euler_multiply_real g gm1 gp1 impose_boundary_conditions initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize left_eigenvectors momentum negative negative output parse_command_line_interface positive positive pressure pressure prim_assign_prim prim_divide_real prim_multiply_prim prim_multiply_real primitive_compressible primitive_compressible_instance primitive_compressible_pointer primitive_to_conservative_compressible R real_multiply_cons real_multiply_euler real_multiply_prim reconstruct_interfaces_characteristic reconstruct_interfaces_conservative reconstruct_interfaces_primitive right_eigenvectors rpat_assign_rpat save_time_serie solve solve solve solve solve speed_of_sound sub sub sub_euler temperature velocity