read_parameters_materials_basic Subroutine

subroutine read_parameters_materials_basic(self, json, i)

Load the basic material parameters from the JSON file

Arguments

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

JSON parser

integer(kind=int32), intent(in) :: i

Material index


Calls

proc~~read_parameters_materials_basic~~CallsGraph proc~read_parameters_materials_basic read_parameters_materials_basic destroy destroy proc~read_parameters_materials_basic->destroy get get proc~read_parameters_materials_basic->get interface~value_in_range value_in_range proc~read_parameters_materials_basic->interface~value_in_range print_error_message print_error_message proc~read_parameters_materials_basic->print_error_message proc~error_message error_message proc~read_parameters_materials_basic->proc~error_message proc~join join proc~read_parameters_materials_basic->proc~join to_string to_string proc~read_parameters_materials_basic->to_string proc~value_in_range_int16 value_in_range_int16 interface~value_in_range->proc~value_in_range_int16 proc~value_in_range_int32 value_in_range_int32 interface~value_in_range->proc~value_in_range_int32 proc~value_in_range_int64 value_in_range_int64 interface~value_in_range->proc~value_in_range_int64 proc~value_in_range_int8 value_in_range_int8 interface~value_in_range->proc~value_in_range_int8 proc~value_in_range_real128 value_in_range_real128 interface~value_in_range->proc~value_in_range_real128 proc~value_in_range_real32 value_in_range_real32 interface~value_in_range->proc~value_in_range_real32 proc~value_in_range_real64 value_in_range_real64 interface~value_in_range->proc~value_in_range_real64 log_error log_error proc~error_message->log_error

Called by

proc~~read_parameters_materials_basic~~CalledByGraph proc~read_parameters_materials_basic read_parameters_materials_basic proc~read_parameters_materials read_parameters_materials proc~read_parameters_materials->proc~read_parameters_materials_basic proc~inout_read_basic_parameters inout_read_basic_parameters proc~inout_read_basic_parameters->proc~read_parameters_materials interface~inout_read_basic_parameters type_input%inout_read_basic_parameters interface~inout_read_basic_parameters->proc~inout_read_basic_parameters proc~initialize_type_input type_input%initialize_type_input proc~initialize_type_input->interface~inout_read_basic_parameters

Source Code

    subroutine read_parameters_materials_basic(self, json, i)
        !> Load the basic material parameters from the JSON file
        implicit none
        class(type_input) :: self
        type(json_file), intent(inout) :: json !! JSON parser
        integer(int32), intent(in) :: i !! Material index

        logical :: found
        character(:), allocatable :: key
        character(:), allocatable :: key_material

        key_material = join([materials//"("//to_string(i)//")"])

        key = join([key_material, id])
        call json%get(key, self%basic%materials(i)%id, found)
        call json%print_error_message(output_unit)
        if (.not. found) then
            call json%destroy()
            call error_message(904, c_opt=key)
        end if

        key = join([key_material, name])
        call json%get(key, self%basic%materials(i)%name, found)
        call json%print_error_message(output_unit)
        if (.not. found) self%basic%materials(i)%name = "Material_"//to_string(i)
        self%basic%materials(i)%name = trim(adjustl(self%basic%materials(i)%name))

        key = join([key_material, phase])
        call json%get(key, self%basic%materials(i)%phase, found)
        call json%print_error_message(output_unit)
        if (.not. found) then
            call json%destroy()
            call error_message(904, c_opt=key)
        else if (.not. value_in_range(self%basic%materials(i)%phase, 1, 4)) then
            call json%destroy()
            call error_message(905, c_opt=key)
        end if

        key = join([key_material, is_frozen])
        call json%get(key, self%basic%materials(i)%is_frozen, found)
        call json%print_error_message(output_unit)
        if (.not. found) self%basic%materials(i)%is_frozen = .false.

        key = join([key_material, is_dispersed])
        call json%get(key, self%basic%materials(i)%is_dispersed, found)
        call json%print_error_message(output_unit)
        if (.not. found) self%basic%materials(i)%is_dispersed = .false.

    end subroutine read_parameters_materials_basic