Extend database and density input for water state
This commit is contained in:
@@ -8,10 +8,11 @@ module sph_input_reader
|
||||
sph_db_allocate, sph_db_free, sph_db_set_node, sph_db_add_material, &
|
||||
sph_db_add_section, sph_db_add_nset, sph_db_add_elset, &
|
||||
sph_db_add_element, sph_db_add_coupling_region
|
||||
use sph_database, only: sph_db_set_material_density
|
||||
use sph_inp_defs, only: SPH_INPUT_LINE_LEN, SPH_INPUT_FIELD_LEN, &
|
||||
SPH_INPUT_MAX_FIELDS, SPH_KEY_NODE, SPH_KEY_ELEMENT, SPH_KEY_NSET, &
|
||||
SPH_KEY_ELSET, SPH_KEY_MATERIAL, SPH_KEY_SECTION, SPH_KEY_SPHLITE, &
|
||||
SPH_KEY_UNKNOWN
|
||||
SPH_KEY_DENSITY, SPH_KEY_UNKNOWN
|
||||
use sph_inp_helpers, only: sph_inp_clean_line, sph_inp_split_csv, &
|
||||
sph_inp_keyword_id, sph_inp_upper
|
||||
implicit none
|
||||
@@ -26,6 +27,7 @@ module sph_input_reader
|
||||
character(len=SPH_INPUT_FIELD_LEN) :: active_element_type = 'UNKNOWN'
|
||||
character(len=SPH_INPUT_FIELD_LEN) :: active_nset_name = 'NSET'
|
||||
character(len=SPH_INPUT_FIELD_LEN) :: active_elset_name = 'ELSET'
|
||||
character(len=SPH_INPUT_FIELD_LEN) :: active_material_name = 'MATERIAL'
|
||||
|
||||
contains
|
||||
|
||||
@@ -39,6 +41,7 @@ contains
|
||||
active_element_type = 'UNKNOWN'
|
||||
active_nset_name = 'NSET'
|
||||
active_elset_name = 'ELSET'
|
||||
active_material_name = 'MATERIAL'
|
||||
end subroutine sph_input_reset
|
||||
|
||||
subroutine sph_input_get_warning_count(count)
|
||||
@@ -198,6 +201,12 @@ contains
|
||||
close(unit=SPH_INPUT_UNIT)
|
||||
return
|
||||
end if
|
||||
else if (active_key == SPH_KEY_DENSITY) then
|
||||
call sph_input_parse_density(line, ierr)
|
||||
if (ierr /= SPH_SUCCESS) then
|
||||
close(unit=SPH_INPUT_UNIT)
|
||||
return
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
@@ -222,6 +231,7 @@ contains
|
||||
input_has_material = .true.
|
||||
call sph_input_get_option(line, 'NAME', value)
|
||||
if (len_trim(value) == 0) value = 'MATERIAL'
|
||||
active_material_name = value
|
||||
call sph_input_get_option(line, 'TYPE', type_value)
|
||||
if (len_trim(type_value) == 0) type_value = 'UNSPECIFIED'
|
||||
call sph_db_add_material(value, type_value, ierr)
|
||||
@@ -263,6 +273,30 @@ contains
|
||||
end if
|
||||
end subroutine sph_input_record_keyword
|
||||
|
||||
subroutine sph_input_parse_density(line, ierr)
|
||||
character(len=*), intent(in) :: line
|
||||
integer, intent(out) :: ierr
|
||||
character(len=SPH_INPUT_FIELD_LEN) :: fields(SPH_INPUT_MAX_FIELDS)
|
||||
integer :: nfields
|
||||
integer :: ios
|
||||
real(rk) :: density_value
|
||||
|
||||
ierr = SPH_SUCCESS
|
||||
call sph_inp_split_csv(line, fields, nfields)
|
||||
if (nfields < 1) then
|
||||
call sph_input_set_error('invalid *DENSITY record')
|
||||
ierr = SPH_ERROR_INPUT
|
||||
return
|
||||
end if
|
||||
read(fields(1), *, iostat=ios) density_value
|
||||
if (ios /= 0) then
|
||||
call sph_input_set_error('invalid density value')
|
||||
ierr = SPH_ERROR_INPUT
|
||||
return
|
||||
end if
|
||||
call sph_db_set_material_density(active_material_name, density_value, ierr)
|
||||
end subroutine sph_input_parse_density
|
||||
|
||||
subroutine sph_input_parse_output_control(line, ierr)
|
||||
character(len=*), intent(in) :: line
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
Reference in New Issue
Block a user