Add blast diagnostics output boundary
This commit is contained in:
@@ -1,18 +1,23 @@
|
||||
module sph_blast_load
|
||||
use sph_precision, only: rk, SPH_NDIM
|
||||
use sph_error, only: SPH_SUCCESS, SPH_ERROR_DATABASE, sph_error_set
|
||||
use sph_error, only: SPH_SUCCESS, SPH_ERROR_ARGUMENT, SPH_ERROR_DATABASE, &
|
||||
sph_error_set
|
||||
use sph_database, only: SPH_MAX_REGIONS, npart, particle_phase, x, v, a, &
|
||||
mass, volume, SPH_PHASE_SOLID, SPH_PHASE_SHELL
|
||||
use sph_blast, only: blast_region_count, blast_region_enabled, &
|
||||
blast_center, blast_load_scale, blast_time_window, &
|
||||
blast_source_count, blast_target_count, blast_candidate_pair_count, &
|
||||
blast_source_pressure_mean, blast_source_energy, blast_water_count, &
|
||||
blast_water_pressure_min, blast_water_pressure_max, &
|
||||
blast_skipped_source_count, blast_skipped_target_count, &
|
||||
blast_source_mass, blast_source_pressure_mean, blast_source_energy, &
|
||||
blast_water_count, blast_gas_count, blast_explosive_count, &
|
||||
blast_gas_volume, blast_water_pressure_min, blast_water_pressure_max, &
|
||||
blast_explosive_progress_mean, sph_blast_refresh_snapshot, &
|
||||
sph_blast_target_accepts
|
||||
implicit none
|
||||
|
||||
real(rk), parameter :: SPH_BLAST_LOAD_EPS = 1.0e-12_rk
|
||||
integer, parameter :: SPH_BLAST_SUMMARY_COUNT_SIZE = 12
|
||||
integer, parameter :: SPH_BLAST_SUMMARY_VALUE_SIZE = 26
|
||||
real(rk), allocatable :: blast_solid_external_force(:,:)
|
||||
real(rk), allocatable :: blast_shell_external_force(:,:)
|
||||
real(rk), allocatable :: blast_shell_external_moment(:,:)
|
||||
@@ -150,6 +155,50 @@ contains
|
||||
end do
|
||||
end subroutine sph_blast_load_apply_to_acceleration
|
||||
|
||||
subroutine sph_blast_load_get_summary(region, counts, values, ierr)
|
||||
integer, intent(in) :: region
|
||||
integer, intent(out) :: counts(SPH_BLAST_SUMMARY_COUNT_SIZE)
|
||||
real(rk), intent(out) :: values(SPH_BLAST_SUMMARY_VALUE_SIZE)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
counts = 0
|
||||
values = 0.0_rk
|
||||
ierr = SPH_SUCCESS
|
||||
if (region < 1 .or. region > SPH_MAX_REGIONS) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Blast summary region is out of range')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
counts(1) = blast_source_count(region)
|
||||
counts(2) = blast_target_count(region)
|
||||
counts(3) = blast_candidate_pair_count(region)
|
||||
counts(4) = blast_skipped_source_count(region)
|
||||
counts(5) = blast_skipped_target_count(region)
|
||||
counts(6) = blast_load_target_count(region)
|
||||
counts(7) = blast_load_pair_count(region)
|
||||
counts(8) = blast_load_zero_weight_count(region)
|
||||
counts(9) = blast_load_nonfinite_count(region)
|
||||
counts(10) = blast_water_count(region)
|
||||
counts(11) = blast_gas_count(region)
|
||||
counts(12) = blast_explosive_count(region)
|
||||
values(1) = blast_source_mass(region)
|
||||
values(2) = blast_source_energy(region)
|
||||
values(3) = blast_source_pressure_mean(region)
|
||||
values(4) = blast_gas_volume(region)
|
||||
values(5) = blast_explosive_progress_mean(region)
|
||||
values(6) = blast_water_pressure_min(region)
|
||||
values(7) = blast_water_pressure_max(region)
|
||||
values(8:10) = blast_solid_total_force(:,region)
|
||||
values(11:13) = blast_shell_total_force(:,region)
|
||||
values(14:16) = blast_load_total_force(:,region)
|
||||
values(17:19) = blast_load_impulse(:,region)
|
||||
values(20:22) = blast_load_momentum_input(:,region)
|
||||
values(23) = blast_load_work(region)
|
||||
values(24) = blast_load_energy_input(region)
|
||||
values(25) = blast_load_max_particle_force(region)
|
||||
values(26) = blast_load_max_acceleration(region)
|
||||
end subroutine sph_blast_load_get_summary
|
||||
|
||||
subroutine sph_blast_load_project_region(region)
|
||||
integer, intent(in) :: region
|
||||
real(rk) :: pressure_value
|
||||
|
||||
@@ -28,7 +28,9 @@ module sph_api
|
||||
sph_explosive_get_summary, sph_explosive_get_release_balance, &
|
||||
sph_explosive_set_default_ignition_point
|
||||
use sph_blast, only: sph_blast_initialize, sph_blast_reset
|
||||
use sph_blast_load, only: sph_blast_load_initialize, sph_blast_load_reset
|
||||
use sph_blast_load, only: sph_blast_load_initialize, sph_blast_load_reset, &
|
||||
sph_blast_load_get_summary, SPH_BLAST_SUMMARY_COUNT_SIZE, &
|
||||
SPH_BLAST_SUMMARY_VALUE_SIZE
|
||||
use sph_solid, only: sph_solid_initialize, sph_solid_reset
|
||||
use sph_solid_dynamics, only: sph_solid_get_counts, sph_solid_get_summary
|
||||
use sph_solid_api, only: sph_solid_get_state, sph_solid_get_diagnostics, &
|
||||
@@ -504,6 +506,21 @@ contains
|
||||
momentum_values, ierr)
|
||||
end subroutine sph_get_explosive_release_balance
|
||||
|
||||
subroutine sph_get_blast_summary(region, counts, values, ierr)
|
||||
integer, intent(in) :: region
|
||||
integer, intent(out) :: counts(SPH_BLAST_SUMMARY_COUNT_SIZE)
|
||||
real(rk), intent(out) :: values(SPH_BLAST_SUMMARY_VALUE_SIZE)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
counts = 0
|
||||
values = 0.0_rk
|
||||
call sph_api_require_initialized(ierr)
|
||||
if (ierr /= SPH_SUCCESS) return
|
||||
call sph_api_require_model_built(ierr)
|
||||
if (ierr /= SPH_SUCCESS) return
|
||||
call sph_blast_load_get_summary(region, counts, values, ierr)
|
||||
end subroutine sph_get_blast_summary
|
||||
|
||||
subroutine sph_get_solid_counts(active_count, failed_count, ierr)
|
||||
integer, intent(out) :: active_count
|
||||
integer, intent(out) :: failed_count
|
||||
|
||||
@@ -27,6 +27,21 @@ module sph_output_csv
|
||||
explosive_source_momentum_total
|
||||
use sph_explosive, only: sph_explosive_get_summary, &
|
||||
sph_explosive_get_release_balance
|
||||
use sph_blast, only: blast_region_count, blast_source_count, &
|
||||
blast_target_count, blast_candidate_pair_count, blast_water_count, &
|
||||
blast_gas_count, blast_explosive_count, blast_skipped_source_count, &
|
||||
blast_skipped_target_count, blast_source_mass, blast_source_energy, &
|
||||
blast_source_pressure_mean, blast_gas_volume, &
|
||||
blast_explosive_progress_mean, blast_water_pressure_min, &
|
||||
blast_water_pressure_max
|
||||
use sph_blast_load, only: blast_solid_external_force, &
|
||||
blast_shell_external_force, blast_shell_external_moment, &
|
||||
blast_load_target_count, blast_load_pair_count, &
|
||||
blast_load_zero_weight_count, blast_load_nonfinite_count, &
|
||||
blast_load_total_force, blast_solid_total_force, &
|
||||
blast_shell_total_force, blast_load_impulse, &
|
||||
blast_load_momentum_input, blast_load_work, blast_load_energy_input, &
|
||||
blast_load_max_particle_force, blast_load_max_acceleration
|
||||
use sph_solid_state, only: solid_stress, solid_plastic_strain, solid_damage, &
|
||||
solid_softening, solid_strain_rate_eq, solid_reference_neighbor_count, &
|
||||
solid_correction_status, solid_failure_status
|
||||
@@ -80,6 +95,9 @@ contains
|
||||
real(rk) :: solid_softening_value
|
||||
real(rk) :: solid_strain_rate_value
|
||||
real(rk) :: solid_acceleration_norm
|
||||
real(rk) :: blast_solid_force(3)
|
||||
real(rk) :: blast_shell_force(3)
|
||||
real(rk) :: blast_shell_moment(3)
|
||||
integer :: solid_reference_neighbors
|
||||
integer :: solid_correction_state
|
||||
integer :: solid_failure
|
||||
@@ -100,6 +118,9 @@ contains
|
||||
'solid_stress_xx,solid_stress_yy,solid_stress_zz,solid_stress_xy,' // &
|
||||
'solid_stress_yz,solid_stress_zx,solid_plastic_strain,solid_damage,' // &
|
||||
'solid_softening,solid_strain_rate_eq,solid_acceleration_norm,' // &
|
||||
'blast_solid_fx,blast_solid_fy,blast_solid_fz,' // &
|
||||
'blast_shell_fx,blast_shell_fy,blast_shell_fz,' // &
|
||||
'blast_shell_mx,blast_shell_my,blast_shell_mz,' // &
|
||||
'solid_failure_status,solid_reference_neighbor_count,' // &
|
||||
'solid_correction_status'
|
||||
do i = 1, npart
|
||||
@@ -115,6 +136,9 @@ contains
|
||||
solid_softening_value = 0.0_rk
|
||||
solid_strain_rate_value = 0.0_rk
|
||||
solid_acceleration_norm = sqrt(sum(a(:,i) * a(:,i)))
|
||||
blast_solid_force = 0.0_rk
|
||||
blast_shell_force = 0.0_rk
|
||||
blast_shell_moment = 0.0_rk
|
||||
solid_reference_neighbors = 0
|
||||
solid_correction_state = 0
|
||||
solid_failure = 0
|
||||
@@ -139,7 +163,16 @@ contains
|
||||
if (allocated(solid_correction_status)) solid_correction_state = &
|
||||
solid_correction_status(i)
|
||||
if (allocated(solid_failure_status)) solid_failure = solid_failure_status(i)
|
||||
write(SPH_OUTPUT_UNIT, '(5(I0,","),27(ES24.16,","),2(I0,","),I0)') &
|
||||
if (allocated(blast_solid_external_force)) then
|
||||
blast_solid_force = blast_solid_external_force(:,i)
|
||||
end if
|
||||
if (allocated(blast_shell_external_force)) then
|
||||
blast_shell_force = blast_shell_external_force(:,i)
|
||||
end if
|
||||
if (allocated(blast_shell_external_moment)) then
|
||||
blast_shell_moment = blast_shell_external_moment(:,i)
|
||||
end if
|
||||
write(SPH_OUTPUT_UNIT, '(5(I0,","),36(ES24.16,","),2(I0,","),I0)') &
|
||||
particle_id_ext(i), particle_phase(i), particle_status(i), &
|
||||
material_id(i), section_id(i), x(1,i), x(2,i), x(3,i), &
|
||||
v(1,i), v(2,i), v(3,i), rho(i), pressure(i), temperature(i), h(i), &
|
||||
@@ -147,7 +180,8 @@ contains
|
||||
explosive_remaining, explosive_mass, explosive_energy, &
|
||||
solid_stress_value(:), solid_plastic, solid_damage_value, &
|
||||
solid_softening_value, solid_strain_rate_value, &
|
||||
solid_acceleration_norm, solid_failure, solid_reference_neighbors, &
|
||||
solid_acceleration_norm, blast_solid_force, blast_shell_force, &
|
||||
blast_shell_moment, solid_failure, solid_reference_neighbors, &
|
||||
solid_correction_state
|
||||
end do
|
||||
close(unit=SPH_OUTPUT_UNIT)
|
||||
@@ -287,6 +321,7 @@ contains
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",ES24.16)') 'explosive_source_momentum_z', &
|
||||
explosive_source_momentum_total(3)
|
||||
call sph_output_write_solid_summary()
|
||||
call sph_output_write_blast_summary()
|
||||
close(unit=SPH_OUTPUT_UNIT)
|
||||
end subroutine sph_output_write_summary
|
||||
|
||||
@@ -326,4 +361,109 @@ contains
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",ES24.16)') 'solid_dtcrit', solid_dtcrit
|
||||
end subroutine sph_output_write_solid_summary
|
||||
|
||||
subroutine sph_output_write_blast_summary()
|
||||
integer :: region
|
||||
character(len=128) :: metric
|
||||
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') 'blast_regions', blast_region_count
|
||||
do region = 1, blast_region_count
|
||||
call sph_output_blast_metric_name('blast_source_count', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), blast_source_count(region)
|
||||
call sph_output_blast_metric_name('blast_target_count', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), blast_target_count(region)
|
||||
call sph_output_blast_metric_name('blast_pair_count', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), &
|
||||
blast_candidate_pair_count(region)
|
||||
call sph_output_blast_metric_name('blast_water_count', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), blast_water_count(region)
|
||||
call sph_output_blast_metric_name('blast_gas_count', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), blast_gas_count(region)
|
||||
call sph_output_blast_metric_name('blast_explosive_count', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), &
|
||||
blast_explosive_count(region)
|
||||
call sph_output_blast_metric_name('blast_skipped_sources', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), &
|
||||
blast_skipped_source_count(region)
|
||||
call sph_output_blast_metric_name('blast_skipped_targets', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), &
|
||||
blast_skipped_target_count(region)
|
||||
call sph_output_blast_metric_name('blast_load_targets', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), &
|
||||
blast_load_target_count(region)
|
||||
call sph_output_blast_metric_name('blast_load_pairs', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), blast_load_pair_count(region)
|
||||
call sph_output_blast_metric_name('blast_zero_weight', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), &
|
||||
blast_load_zero_weight_count(region)
|
||||
call sph_output_blast_metric_name('blast_nonfinite_loads', region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",I0)') trim(metric), &
|
||||
blast_load_nonfinite_count(region)
|
||||
call sph_output_write_blast_reals(region)
|
||||
end do
|
||||
end subroutine sph_output_write_blast_summary
|
||||
|
||||
subroutine sph_output_write_blast_reals(region)
|
||||
integer, intent(in) :: region
|
||||
|
||||
call sph_output_write_blast_real('blast_source_mass', region, &
|
||||
blast_source_mass(region))
|
||||
call sph_output_write_blast_real('blast_source_energy', region, &
|
||||
blast_source_energy(region))
|
||||
call sph_output_write_blast_real('blast_source_pressure_mean', region, &
|
||||
blast_source_pressure_mean(region))
|
||||
call sph_output_write_blast_real('blast_gas_volume', region, &
|
||||
blast_gas_volume(region))
|
||||
call sph_output_write_blast_real('blast_explosive_progress_mean', region, &
|
||||
blast_explosive_progress_mean(region))
|
||||
call sph_output_write_blast_real('blast_water_pressure_min', region, &
|
||||
blast_water_pressure_min(region))
|
||||
call sph_output_write_blast_real('blast_water_pressure_max', region, &
|
||||
blast_water_pressure_max(region))
|
||||
call sph_output_write_blast_vector('blast_solid_force', region, &
|
||||
blast_solid_total_force(:,region))
|
||||
call sph_output_write_blast_vector('blast_shell_force', region, &
|
||||
blast_shell_total_force(:,region))
|
||||
call sph_output_write_blast_vector('blast_total_force', region, &
|
||||
blast_load_total_force(:,region))
|
||||
call sph_output_write_blast_vector('blast_impulse', region, &
|
||||
blast_load_impulse(:,region))
|
||||
call sph_output_write_blast_vector('blast_momentum_input', region, &
|
||||
blast_load_momentum_input(:,region))
|
||||
call sph_output_write_blast_real('blast_work', region, blast_load_work(region))
|
||||
call sph_output_write_blast_real('blast_energy_input', region, &
|
||||
blast_load_energy_input(region))
|
||||
call sph_output_write_blast_real('blast_max_particle_force', region, &
|
||||
blast_load_max_particle_force(region))
|
||||
call sph_output_write_blast_real('blast_max_acceleration', region, &
|
||||
blast_load_max_acceleration(region))
|
||||
end subroutine sph_output_write_blast_reals
|
||||
|
||||
subroutine sph_output_write_blast_vector(base_name, region, values)
|
||||
character(len=*), intent(in) :: base_name
|
||||
integer, intent(in) :: region
|
||||
real(rk), intent(in) :: values(3)
|
||||
|
||||
call sph_output_write_blast_real(trim(base_name) // '_x', region, values(1))
|
||||
call sph_output_write_blast_real(trim(base_name) // '_y', region, values(2))
|
||||
call sph_output_write_blast_real(trim(base_name) // '_z', region, values(3))
|
||||
end subroutine sph_output_write_blast_vector
|
||||
|
||||
subroutine sph_output_write_blast_real(base_name, region, value)
|
||||
character(len=*), intent(in) :: base_name
|
||||
integer, intent(in) :: region
|
||||
real(rk), intent(in) :: value
|
||||
character(len=128) :: metric
|
||||
|
||||
call sph_output_blast_metric_name(base_name, region, metric)
|
||||
write(SPH_OUTPUT_UNIT, '(A,",",ES24.16)') trim(metric), value
|
||||
end subroutine sph_output_write_blast_real
|
||||
|
||||
subroutine sph_output_blast_metric_name(base_name, region, metric)
|
||||
character(len=*), intent(in) :: base_name
|
||||
integer, intent(in) :: region
|
||||
character(len=*), intent(out) :: metric
|
||||
|
||||
write(metric, '(A,"_",I0)') trim(base_name), region
|
||||
end subroutine sph_output_blast_metric_name
|
||||
|
||||
end module sph_output_csv
|
||||
|
||||
Reference in New Issue
Block a user