Add Solid 0.5.1 input validation
This commit is contained in:
@@ -5,6 +5,7 @@ module sph_solid
|
||||
use sph_database, only: SPH_MAX_MATERIALS, SPH_NAME_LEN, material_count, &
|
||||
material_name, material_type, material_density, npart, particle_phase, &
|
||||
particle_status, material_id, rho, temperature, internal_energy, &
|
||||
section_count, section_id, section_type, section_material_id, &
|
||||
SPH_PHASE_SOLID, SPH_PHASE_SOLID_FAILED, SPH_STATUS_ACTIVE, &
|
||||
SPH_STATUS_FAILED
|
||||
use sph_solid_state
|
||||
@@ -100,6 +101,11 @@ contains
|
||||
integer :: solid_index
|
||||
|
||||
ierr = SPH_SUCCESS
|
||||
if (.not. sph_solid_vector_is_finite((/ e_value, nu_value /))) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid elastic parameter is not finite')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
if (e_value <= 0.0_rk) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid elastic modulus must be positive')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
@@ -130,8 +136,17 @@ contains
|
||||
real(rk), intent(in) :: tmelt_value
|
||||
integer, intent(out) :: ierr
|
||||
integer :: solid_index
|
||||
real(rk) :: jc_values(8)
|
||||
|
||||
ierr = SPH_SUCCESS
|
||||
jc_values = (/ a_value, b_value, n_value, c_value, m_value, &
|
||||
epsdot0_value, troom_value, tmelt_value /)
|
||||
if (.not. sph_solid_vector_is_finite(jc_values)) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, &
|
||||
'Solid Johnson-Cook flow parameter is not finite')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
if (a_value < 0.0_rk .or. b_value < 0.0_rk .or. n_value < 0.0_rk) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid Johnson-Cook strength is invalid')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
@@ -200,6 +215,11 @@ contains
|
||||
ierr = SPH_ERROR_INPUT
|
||||
return
|
||||
end if
|
||||
if (.not. sph_solid_vector_is_finite((/ softening_width_value /))) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid softening WIDTH is not finite')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
if (softening_width_value <= 0.0_rk) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid softening WIDTH must be positive')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
@@ -239,8 +259,40 @@ contains
|
||||
return
|
||||
end if
|
||||
end do
|
||||
call sph_solid_validate_particle_sections(ierr)
|
||||
end subroutine sph_solid_validate_input
|
||||
|
||||
subroutine sph_solid_validate_particle_sections(ierr)
|
||||
integer, intent(out) :: ierr
|
||||
integer :: i
|
||||
integer :: sec
|
||||
|
||||
ierr = SPH_SUCCESS
|
||||
do i = 1, npart
|
||||
if (particle_status(i) /= SPH_STATUS_ACTIVE) cycle
|
||||
if (particle_phase(i) /= SPH_PHASE_SOLID) cycle
|
||||
sec = section_id(i)
|
||||
if (sec < 1 .or. sec > section_count) then
|
||||
call sph_error_set(SPH_ERROR_INPUT, &
|
||||
'active Solid particle is missing Solid section')
|
||||
ierr = SPH_ERROR_INPUT
|
||||
return
|
||||
end if
|
||||
if (index(sph_solid_upper(section_type(sec)), 'SOLID') <= 0) then
|
||||
call sph_error_set(SPH_ERROR_INPUT, &
|
||||
'active Solid particle is not bound to Solid section')
|
||||
ierr = SPH_ERROR_INPUT
|
||||
return
|
||||
end if
|
||||
if (section_material_id(sec) /= material_id(i)) then
|
||||
call sph_error_set(SPH_ERROR_INPUT, &
|
||||
'active Solid particle section material mismatch')
|
||||
ierr = SPH_ERROR_INPUT
|
||||
return
|
||||
end if
|
||||
end do
|
||||
end subroutine sph_solid_validate_particle_sections
|
||||
|
||||
subroutine sph_solid_count_unbound_materials(count)
|
||||
integer, intent(out) :: count
|
||||
integer :: solid_index
|
||||
|
||||
Reference in New Issue
Block a user