integrate Subroutine

private subroutine integrate(scheme, integrand_0, Dt, final_time, iterations, stages, is_fast, save_results, output_base_name, save_frequency, error)

Integrate integrand by means of the given scheme.

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: scheme

Selected scheme.

class(integrand_tester_object), intent(in) :: integrand_0

Initial conditions.

real(kind=R_P), intent(in) :: Dt

Time step.

real(kind=R_P), intent(in) :: final_time

Final integration time.

integer(kind=I_P), intent(in) :: iterations

Number of fixed point iterations.

integer(kind=I_P), intent(in) :: stages

Number of stages.

logical, intent(in) :: is_fast

Activate fast mode integration.

logical, intent(in) :: save_results

Save results.

character(len=*), intent(in) :: output_base_name

Base name of output results file.

integer(kind=I_P), intent(in) :: save_frequency

Save frequency.

real(kind=R_P), intent(out) :: error(:)

Error of integrand integration.

Calls

proc~~integrate~16~~CallsGraph proc~integrate~16 integrate proc~foodie_integrator_factory foodie_integrator_factory proc~integrate~16->proc~foodie_integrator_factory proc~check_scheme_has_fast_mode~3 check_scheme_has_fast_mode proc~integrate~16->proc~check_scheme_has_fast_mode~3 strz strz proc~integrate~16->strz
Help

Called By

proc~~integrate~16~~CalledByGraph proc~integrate~16 integrate proc~execute~3 execute proc~execute~3->proc~integrate~16
Help

Source Code


Source Code

   subroutine integrate(scheme, integrand_0, Dt, final_time, iterations, stages, is_fast, save_results, output_base_name, &
                        save_frequency, error)
   !< Integrate integrand by means of the given scheme.
   character(*),                   intent(in)   :: scheme           !< Selected scheme.
   class(integrand_tester_object), intent(in)   :: integrand_0      !< Initial conditions.
   real(R_P),                      intent(in)   :: Dt               !< Time step.
   real(R_P),                      intent(in)   :: final_time       !< Final integration time.
   integer(I_P),                   intent(in)   :: iterations       !< Number of fixed point iterations.
   integer(I_P),                   intent(in)   :: stages           !< Number of stages.
   logical,                        intent(in)   :: is_fast          !< Activate fast mode integration.
   logical,                        intent(in)   :: save_results     !< Save results.
   character(*),                   intent(in)   :: output_base_name !< Base name of output results file.
   integer(I_P),                   intent(in)   :: save_frequency   !< Save frequency.
   real(R_P),                      intent(out)  :: error(:)         !< Error of integrand integration.
   real(R_P), allocatable                       :: error_(:)        !< Error of integrand integration.
   class(integrand_tester_object) , allocatable :: integrand        !< Integrand.
   class(integrator_object), allocatable        :: integrator       !< The integrator.
   real(R_P)                                    :: time             !< Time.
   integer(I_P)                                 :: step             !< Time steps counter.

   allocate(integrand, mold=integrand_0) ; integrand = integrand_0

   call foodie_integrator_factory(scheme=scheme, integrator=integrator, stages=stages, &
                                  tolerance=1e2_R_P, iterations=iterations, autoupdate=.true., U=integrand_0)
   if (is_fast) call check_scheme_has_fast_mode(scheme=trim(adjustl(scheme)), integrator=integrator)

   step = 0
   time = 0._R_P
   if (save_results) call integrand%export_tecplot(file_name=output_base_name//                                     &
                                                             integrand%description(prefix='-')//                    &
                                                             integrator%description(prefix='-')//                   &
                                                             '-steps_'//trim(strz(int(final_time/Dt), 10))//'.dat', &
                                                    t=time,                                                         &
                                                    scheme=scheme,                                                  &
                                                    with_exact_solution=.true.,                                     &
                                                    U0=integrand_0)

   select type(integrator)
   class is(integrator_multistage_object)
      do
         step = step + 1
         if (is_fast) then
            call integrator%integrate_fast(U=integrand, Dt=Dt, t=time)
         else
            call integrator%integrate(U=integrand, Dt=Dt, t=time)
         endif
         time = time + Dt
         if ((time >= final_time)) exit
         call integrand_export_tecplot
      enddo

   class is(integrator_multistep_object)
      do
         step = step + 1
         if (integrator%steps_number() >= step) then
            time = time + Dt
            integrator%Dt(step) = Dt
            integrator%t(step) = time
            integrator%previous(step) = integrand%exact_solution(t=time, U0=integrand_0)
            integrand = integrator%previous(step)
         else
            if (is_fast) then
               call integrator%integrate_fast(U=integrand, Dt=Dt, t=time)
            else
               call integrator%integrate(U=integrand, Dt=Dt, t=time)
            endif
            time = time + Dt
         endif
         if ((time >= final_time)) exit
         call integrand_export_tecplot
      enddo

   class is(integrator_multistage_multistep_object)
      do
         step = step + 1
         if (integrator%steps_number() >= step) then
            time = time + Dt
            integrator%Dt(step) = Dt
            integrator%t(step) = time
            integrator%previous(step) = integrand%exact_solution(t=time, U0=integrand_0)
            integrand = integrator%previous(step)
         else
            if (is_fast) then
               call integrator%integrate_fast(U=integrand, Dt=Dt,t=time)
            else
               call integrator%integrate(U=integrand, Dt=Dt, t=time)
            endif
            time = time + Dt
         endif
         if ((time >= final_time)) exit
         call integrand_export_tecplot
      enddo
   endselect

   call integrand_close_tecplot

   error_ = integrand%error(t=time, U0=integrand_0)
   error(:) = error_(:)
   contains
      subroutine integrand_close_tecplot
      !< Close current integrand tecplot file.

      select type(integrand)
      type is(integrand_ladvection)
         if (save_results .and. mod(step, save_frequency)==0) call integrand%export_tecplot(t=time, scheme=scheme)
      type is(integrand_oscillation)
         if (save_results .and. mod(step, save_frequency)==0) call integrand%export_tecplot(t=time)
      endselect
      if (save_results) call integrand%export_tecplot(close_file=.true.)
      endsubroutine integrand_close_tecplot

      subroutine integrand_export_tecplot
      !< Export current integrand solution to tecplot file.

      select type(integrand)
      type is(integrand_lcce)
         if (save_results .and. mod(step, save_frequency)==0) call integrand%export_tecplot(t=time, with_exact_solution=.true.)
      type is(integrand_ladvection)
         if (save_results .and. mod(step, save_frequency)==0) call integrand%export_tecplot(t=time, scheme=scheme)
      type is(integrand_oscillation)
         if (save_results .and. mod(step, save_frequency)==0) call integrand%export_tecplot(t=time, with_exact_solution=.true.)
      endselect
      endsubroutine integrand_export_tecplot
   endsubroutine integrate


a a a a a add_burgers add_euler add_euler add_euler add_lorenz allocate_integrand_members allocate_integrand_members allocate_integrand_members allocate_integrand_members allocate_integrand_members amplitude_phase assign_abstract assign_integrand assign_integrand assign_integrand assign_multistage assign_multistage_multistep assign_multistep assign_real assign_real assign_real average_solution burgers_assign_burgers burgers_assign_real burgers_local_error burgers_multiply_burgers burgers_multiply_real check_error check_scheme_has_fast_mode check_scheme_has_fast_mode check_scheme_has_fast_mode class_name class_name class_name class_name class_name class_name class_name class_name class_name class_name class_name class_name class_name compute_dt compute_dt compute_dt compute_dt compute_dt compute_dt compute_dt compute_dx compute_inter_states compute_inter_states compute_inter_states compute_inter_states compute_inter_states conservative2primitive conservative2primitive conservative2primitive conservative2primitive conservative2primitive d2Burgers_dx2 dBurgers_dt dBurgers_dx description description description description destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy_abstract destroy_multistage destroy_multistage_multistep destroy_multistep destroy_rk destroy_rk dEuler_dt dEuler_dt dEuler_dt dEuler_dt dEuler_dt dLorenz_dt dt_ratio dU_dt dU_dt dU_dt E E E E E error error error euler_assign_euler euler_assign_euler euler_assign_euler euler_assign_euler euler_assign_euler euler_assign_real euler_assign_real euler_assign_real euler_local_error euler_local_error euler_local_error euler_multiply_euler euler_multiply_euler euler_multiply_euler euler_multiply_real euler_multiply_real euler_multiply_real exact_solution exact_solution exact_solution execute execute execute export_tecplot export_tecplot export_tecplot foodie_integrator_class_names foodie_integrator_factory foodie_integrator_schemes H H H H H has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode has_fast_mode impose_boundary_conditions impose_boundary_conditions impose_boundary_conditions impose_boundary_conditions impose_boundary_conditions impose_boundary_conditions init init init init init init init init init init init init init init_rk init_rk initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize_order_s initialize_order_s_1 integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integr_assign_integr integrand_add_integrand integrand_add_integrand integrand_add_integrand integrand_add_integrand_fast integrand_add_integrand_fast integrand_add_integrand_fast integrand_add_real integrand_add_real integrand_add_real integrand_dimension integrand_dimension integrand_dimension integrand_multiply_integrand integrand_multiply_integrand integrand_multiply_integrand integrand_multiply_integrand_fast integrand_multiply_integrand_fast integrand_multiply_integrand_fast integrand_multiply_real integrand_multiply_real integrand_multiply_real integrand_multiply_real_scalar integrand_multiply_real_scalar integrand_multiply_real_scalar integrand_multiply_real_scalar_fast integrand_multiply_real_scalar_fast integrand_multiply_real_scalar_fast integrand_sub_integrand integrand_sub_integrand integrand_sub_integrand integrand_sub_real integrand_sub_real integrand_sub_real integrand_subtract_integrand_fast integrand_subtract_integrand_fast integrand_subtract_integrand_fast integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_fast integrate_order_2 integrate_order_2_fast integrate_order_3 integrate_order_3_fast integrate_order_s integrate_order_s_1 integrate_order_s_1_fast integrate_order_s_fast integrate_rk integrate_rk is_admissible is_available is_class_available is_multistage is_multistage is_multistage is_multistep is_multistep is_multistep is_scheme_available is_supported is_supported is_supported is_supported is_supported is_supported is_supported is_supported is_supported is_supported is_supported is_supported is_supported local_error local_error local_error lorenz_assign_lorenz lorenz_assign_real lorenz_local_error lorenz_multiply_lorenz lorenz_multiply_real new_Dt observed_order observed_order observed_order omega output output output output output output output output output output p p p p p parse_cli parse_cli parse_cli previous_step previous_step previous_step primitive2conservative primitive2conservative primitive2conservative primitive2conservative primitive2conservative r r r r r real_add_integrand real_add_integrand real_add_integrand real_multiply_burgers real_multiply_euler real_multiply_euler real_multiply_euler real_multiply_integrand real_multiply_integrand real_multiply_integrand real_multiply_lorenz real_scalar_multiply_integrand real_scalar_multiply_integrand real_scalar_multiply_integrand real_sub_integrand real_sub_integrand real_sub_integrand reconstruct_interfaces reconstruct_interfaces_states reconstruct_interfaces_states reconstruct_interfaces_states reconstruct_interfaces_states reconstruct_interfaces_states registers_number riemann_solver riemann_solver riemann_solver riemann_solver riemann_solver save_results save_results save_results save_results save_results save_results save_results save_results save_results save_time_serie save_time_serie save_time_serie save_time_serie save_time_serie scheme_number set_cli set_cli set_cli set_sin_wave_initial_state set_square_wave_initial_state stages_number stages_number stages_number steps_number steps_number steps_number sub_burgers sub_euler sub_euler sub_euler sub_lorenz supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes supported_schemes synchronize synchronize synchronize synchronize t_fast t_fast t_fast test test test_ab test_ab test_ab test_euler test_euler test_euler test_leapfrog test_leapfrog test_leapfrog test_ls_rk test_ls_rk test_ls_rk test_tvd_rk test_tvd_rk test_tvd_rk tokenize trigger_error update_previous update_previous update_previous_steps update_previous_steps update_previous_steps