read_conditions_time_control_boundary_time_points Subroutine

subroutine read_conditions_time_control_boundary_time_points(self, json)

Load the boundary condition time points from the JSON file

Arguments

Type IntentOptional Attributes Name
class(type_input) :: self
type(json_file), intent(inout) :: json

JSON parser


Calls

proc~~read_conditions_time_control_boundary_time_points~~CallsGraph proc~read_conditions_time_control_boundary_time_points read_conditions_time_control_boundary_time_points destroy destroy proc~read_conditions_time_control_boundary_time_points->destroy get get proc~read_conditions_time_control_boundary_time_points->get proc~error_message error_message proc~read_conditions_time_control_boundary_time_points->proc~error_message proc~join join proc~read_conditions_time_control_boundary_time_points->proc~join log_error log_error proc~error_message->log_error

Called by

proc~~read_conditions_time_control_boundary_time_points~~CalledByGraph proc~read_conditions_time_control_boundary_time_points read_conditions_time_control_boundary_time_points proc~read_conditions_time_control read_conditions_time_control proc~read_conditions_time_control->proc~read_conditions_time_control_boundary_time_points proc~inout_read_conditions inout_read_conditions proc~inout_read_conditions->proc~read_conditions_time_control interface~inout_read_conditions type_input%inout_read_conditions interface~inout_read_conditions->proc~inout_read_conditions proc~initialize_type_input type_input%initialize_type_input proc~initialize_type_input->interface~inout_read_conditions

Source Code

    subroutine read_conditions_time_control_boundary_time_points(self, json)
        !> Load the boundary condition time points from the JSON file
        implicit none
        class(type_input) :: self
        type(json_file), intent(inout) :: json !! JSON parser

        character(:), allocatable :: key
        logical :: found
        integer(int32) :: i
        real(real64), parameter :: machine_epsilon = 1.0d-9

        key = join([time_control, boundary_condition_time_points])
        call json%get(key, self%conditions%time_control%boundary_time_points, found=found)
        if (.not. found) then
            call json%destroy()
            call error_message(904, c_opt=key)
        end if

        ! --- Check if the time points array is sorted ---
        if (size(self%conditions%time_control%boundary_time_points) > 1) then
            do i = 1, size(self%conditions%time_control%boundary_time_points) - 1
                if (self%conditions%time_control%boundary_time_points(i) >= &
                    self%conditions%time_control%boundary_time_points(i + 1)) then
                    ! The array is not sorted in strictly ascending order.
                    call json%destroy()
                    call error_message(905, c_opt=key)
                end if
            end do
        end if

        if (size(self%conditions%time_control%boundary_time_points) < 2) then
            ! At least two time points are required.
            call json%destroy()
            call error_message(905, c_opt=key)
        end if

        ! --- Check if the time points are within the simulation period ---
        if (size(self%conditions%time_control%boundary_time_points) > 0) then
            ! 開始時刻のチェック
            if (abs(self%conditions%time_control%boundary_time_points(1) - &
                    self%conditions%time_control%simulation_period%start) > machine_epsilon) then
                call json%destroy()
                call error_message(905, c_opt=key)
            end if

            ! 終了時刻のチェック
            if (abs(self%conditions%time_control%boundary_time_points(size(self%conditions%time_control%boundary_time_points)) - &
                    self%conditions%time_control%simulation_period%end) > machine_epsilon) then
                call json%destroy()
                call error_message(905, c_opt=key)
            end if
        end if

    end subroutine read_conditions_time_control_boundary_time_points