读取sph参数
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sph_configuration), | intent(inout) | :: | self |
subroutine spc_read(self)
class(sph_configuration), intent(inout) :: self
integer :: iunit
character(64) :: eos_water !! 水的状态方程
character(64) :: eos_air !! 空气的状态方程
logical :: has_gravity !! 是否有重力
logical :: has_viscosity !! 是否有粘性
logical :: has_surface_tension!! 是否有表面张力
logical :: has_artificial_viscosity!! 是否有人工粘性
character(64) :: smoothed_kernel_function !! 平滑核函数
character(64) :: density_summation_method !! 密度求和方法
real(rk) :: c0 !! 人工声速, m/s
real(rk) :: k !! 求解域系数
namelist /sph/ eos_water, eos_air, has_gravity, has_viscosity, has_surface_tension, &
has_artificial_viscosity, smoothed_kernel_function, density_summation_method, c0, k
! 默认值
eos_water = 'tait'
eos_air = 'ideal'
has_gravity = .true.
has_viscosity = .true.
has_surface_tension = .true.
has_artificial_viscosity = .true.
smoothed_kernel_function = 'cubic-spline'
density_summation_method = 'denormalized'
k = 3.0_rk
! 读取配置文件
open (newunit=iunit, file=cli_obj%working_directory.join.cli_obj%file, &
status='old', action='read')
read (iunit, nml=sph)
close (iunit)
! 赋值
self%eos_water = eos_water
self%eos_air = eos_air
self%has_gravity = has_gravity
self%has_viscosity = has_viscosity
self%has_surface_tension = has_surface_tension
self%has_artificial_viscosity = has_artificial_viscosity
self%smoothed_kernel_function = smoothed_kernel_function
self%density_summation_method = density_summation_method
self%c0 = c0
self%k = k
if (cli_obj%debug_mode) call self%print()
end subroutine spc_read