Prepare Solid 0.5.1 release gate
This commit is contained in:
@@ -28,8 +28,8 @@ module sph_api
|
||||
sph_explosive_get_summary, sph_explosive_get_release_balance, &
|
||||
sph_explosive_set_default_ignition_point
|
||||
use sph_solid, only: sph_solid_initialize, sph_solid_reset
|
||||
use sph_solid_dynamics, only: sph_solid_get_counts, sph_solid_get_summary, &
|
||||
sph_solid_get_state, sph_solid_get_diagnostics, &
|
||||
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, &
|
||||
sph_solid_get_reference_quality
|
||||
use sph_shell, only: sph_shell_initialize, sph_shell_reset
|
||||
use sph_api_state, only: sph_api_initialized, sph_api_model_built, &
|
||||
|
||||
@@ -101,20 +101,6 @@ extern void SPHLITE_FC_sphft_get_explosive_release_balance(
|
||||
double *energy_values,
|
||||
double *momentum_values,
|
||||
int *ierr);
|
||||
extern void SPHLITE_FC_sphft_get_solid_summary(int *active_count,
|
||||
int *failed_count, double *mass, double *momentum, double *energy,
|
||||
double *max_von_mises, double *plastic_range, double *damage_range,
|
||||
double *softening_range, double *dt_limits, int *ierr);
|
||||
extern void SPHLITE_FC_sphft_get_solid_state(const int *max_particles,
|
||||
const int *value_capacity, double *values, int *failure_status,
|
||||
int *reference_neighbor_count, int *reference_degenerate,
|
||||
int *correction_status, int *count, int *ierr);
|
||||
extern void SPHLITE_FC_sphft_get_solid_diagnostics(
|
||||
const int *value_capacity, double *values, int *ierr);
|
||||
extern void SPHLITE_FC_sphft_get_solid_reference_quality(
|
||||
int *reference_neighbor_min, double *correction_det_min,
|
||||
int *correction_status, int *ierr);
|
||||
|
||||
static int sphlite_call_path(
|
||||
const char *path,
|
||||
void (*fortran_call)(const int *chars, const int *count, int *ierr))
|
||||
@@ -467,94 +453,3 @@ int sphlite_get_explosive_release_balance(double *mass_values,
|
||||
energy_values, momentum_values, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int sphlite_get_solid_summary(int *active_count, int *failed_count,
|
||||
double *values,
|
||||
int value_capacity)
|
||||
{
|
||||
int ierr = 0;
|
||||
double mass = 0.0;
|
||||
double momentum[3] = {0.0, 0.0, 0.0};
|
||||
double energy[2] = {0.0, 0.0};
|
||||
double max_von_mises = 0.0;
|
||||
double plastic_range[2] = {0.0, 0.0};
|
||||
double damage_range[2] = {0.0, 0.0};
|
||||
double softening_range[2] = {0.0, 0.0};
|
||||
double dt_limits[3] = {0.0, 0.0, 0.0};
|
||||
int i;
|
||||
|
||||
if (active_count == NULL || failed_count == NULL || values == NULL ||
|
||||
value_capacity < SPHLITE_SOLID_SUMMARY_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_summary(active_count, failed_count, &mass,
|
||||
momentum, energy, &max_von_mises, plastic_range, damage_range,
|
||||
softening_range, dt_limits, &ierr);
|
||||
if (ierr != 0) {
|
||||
return ierr;
|
||||
}
|
||||
values[0] = mass;
|
||||
values[6] = max_von_mises;
|
||||
for (i = 0; i < 3; ++i) {
|
||||
values[1 + i] = momentum[i];
|
||||
values[13 + i] = dt_limits[i];
|
||||
}
|
||||
for (i = 0; i < 2; ++i) {
|
||||
values[4 + i] = energy[i];
|
||||
values[7 + i] = plastic_range[i];
|
||||
values[9 + i] = damage_range[i];
|
||||
values[11 + i] = softening_range[i];
|
||||
}
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int sphlite_get_solid_particle_state(int max_particles,
|
||||
double *values,
|
||||
int value_capacity,
|
||||
int *failure_status,
|
||||
int *reference_neighbor_count,
|
||||
int *reference_degenerate,
|
||||
int *correction_status,
|
||||
int *count)
|
||||
{
|
||||
int ierr = 0;
|
||||
int per_particle = SPHLITE_SOLID_PARTICLE_VALUE_COUNT;
|
||||
|
||||
if (max_particles <= 0 || values == NULL || failure_status == NULL ||
|
||||
reference_neighbor_count == NULL || reference_degenerate == NULL ||
|
||||
correction_status == NULL || count == NULL ||
|
||||
value_capacity < max_particles * SPHLITE_SOLID_PARTICLE_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_state(&max_particles, &per_particle, values,
|
||||
failure_status, reference_neighbor_count, reference_degenerate,
|
||||
correction_status, count, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int sphlite_get_solid_diagnostics(double *values, int value_capacity)
|
||||
{
|
||||
int ierr = 0;
|
||||
|
||||
if (values == NULL || value_capacity < SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_diagnostics(&value_capacity, values, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int sphlite_get_solid_reference_quality(int *reference_neighbor_min,
|
||||
int *correction_status,
|
||||
double *values,
|
||||
int value_capacity)
|
||||
{
|
||||
int ierr = 0;
|
||||
|
||||
if (reference_neighbor_min == NULL || correction_status == NULL ||
|
||||
values == NULL || value_capacity < SPHLITE_SOLID_REFERENCE_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_reference_quality(reference_neighbor_min,
|
||||
&values[0], correction_status, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
#include "sphlite_c_api.h"
|
||||
#include "sphlite_fortran_mangle.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern void SPHLITE_FC_sphft_get_solid_summary(int *active_count,
|
||||
int *failed_count, double *mass, double *momentum, double *energy,
|
||||
double *max_von_mises, double *plastic_range, double *damage_range,
|
||||
double *softening_range, double *dt_limits, int *ierr);
|
||||
extern void SPHLITE_FC_sphft_get_solid_state(const int *max_particles,
|
||||
const int *value_capacity, double *values, int *failure_status,
|
||||
int *reference_neighbor_count, int *reference_degenerate,
|
||||
int *correction_status, int *count, int *ierr);
|
||||
extern void SPHLITE_FC_sphft_get_solid_diagnostics(
|
||||
const int *value_capacity, double *values, int *ierr);
|
||||
extern void SPHLITE_FC_sphft_get_solid_reference_quality(
|
||||
int *reference_neighbor_min, double *correction_det_min,
|
||||
int *correction_status, int *ierr);
|
||||
|
||||
int sphlite_get_solid_summary(int *active_count, int *failed_count,
|
||||
double *values,
|
||||
int value_capacity)
|
||||
{
|
||||
int ierr = 0;
|
||||
double mass = 0.0;
|
||||
double momentum[3] = {0.0, 0.0, 0.0};
|
||||
double energy[2] = {0.0, 0.0};
|
||||
double max_von_mises = 0.0;
|
||||
double plastic_range[2] = {0.0, 0.0};
|
||||
double damage_range[2] = {0.0, 0.0};
|
||||
double softening_range[2] = {0.0, 0.0};
|
||||
double dt_limits[3] = {0.0, 0.0, 0.0};
|
||||
int i;
|
||||
|
||||
if (active_count == NULL || failed_count == NULL || values == NULL ||
|
||||
value_capacity < SPHLITE_SOLID_SUMMARY_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_summary(active_count, failed_count, &mass,
|
||||
momentum, energy, &max_von_mises, plastic_range, damage_range,
|
||||
softening_range, dt_limits, &ierr);
|
||||
if (ierr != 0) {
|
||||
return ierr;
|
||||
}
|
||||
values[0] = mass;
|
||||
values[6] = max_von_mises;
|
||||
for (i = 0; i < 3; ++i) {
|
||||
values[1 + i] = momentum[i];
|
||||
values[13 + i] = dt_limits[i];
|
||||
}
|
||||
for (i = 0; i < 2; ++i) {
|
||||
values[4 + i] = energy[i];
|
||||
values[7 + i] = plastic_range[i];
|
||||
values[9 + i] = damage_range[i];
|
||||
values[11 + i] = softening_range[i];
|
||||
}
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int sphlite_get_solid_particle_state(int max_particles,
|
||||
double *values,
|
||||
int value_capacity,
|
||||
int *failure_status,
|
||||
int *reference_neighbor_count,
|
||||
int *reference_degenerate,
|
||||
int *correction_status,
|
||||
int *count)
|
||||
{
|
||||
int ierr = 0;
|
||||
int per_particle = SPHLITE_SOLID_PARTICLE_VALUE_COUNT;
|
||||
|
||||
if (max_particles <= 0 || values == NULL || failure_status == NULL ||
|
||||
reference_neighbor_count == NULL || reference_degenerate == NULL ||
|
||||
correction_status == NULL || count == NULL ||
|
||||
value_capacity < max_particles * SPHLITE_SOLID_PARTICLE_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_state(&max_particles, &per_particle, values,
|
||||
failure_status, reference_neighbor_count, reference_degenerate,
|
||||
correction_status, count, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int sphlite_get_solid_diagnostics(double *values, int value_capacity)
|
||||
{
|
||||
int ierr = 0;
|
||||
|
||||
if (values == NULL || value_capacity < SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_diagnostics(&value_capacity, values, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
|
||||
int sphlite_get_solid_reference_quality(int *reference_neighbor_min,
|
||||
int *correction_status,
|
||||
double *values,
|
||||
int value_capacity)
|
||||
{
|
||||
int ierr = 0;
|
||||
|
||||
if (reference_neighbor_min == NULL || correction_status == NULL ||
|
||||
values == NULL || value_capacity < SPHLITE_SOLID_REFERENCE_VALUE_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
SPHLITE_FC_sphft_get_solid_reference_quality(reference_neighbor_min,
|
||||
&values[0], correction_status, &ierr);
|
||||
return ierr;
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
module sph_solid_api
|
||||
use sph_precision, only: rk
|
||||
use sph_error, only: SPH_SUCCESS, SPH_ERROR_ARGUMENT, sph_error_set
|
||||
use sph_database, only: npart, solid_reference_neighbor_min, &
|
||||
solid_correction_det_min, solid_correction_status_max, &
|
||||
solid_max_strain_rate, solid_max_acceleration, &
|
||||
solid_internal_force_residual
|
||||
use sph_solid_state
|
||||
use sph_solid_dynamics, only: sph_solid_update_diagnostics
|
||||
implicit none
|
||||
|
||||
integer, parameter :: SPH_SOLID_STATE_VALUE_COUNT = 22
|
||||
integer, parameter :: SPH_SOLID_DIAGNOSTIC_VALUE_COUNT = 3
|
||||
|
||||
contains
|
||||
|
||||
subroutine sph_solid_get_state(max_particles, value_capacity, values, &
|
||||
failure_status_out, reference_neighbor_count_out, &
|
||||
reference_degenerate_out, correction_status_out, count, ierr)
|
||||
integer, intent(in) :: max_particles
|
||||
integer, intent(in) :: value_capacity
|
||||
real(rk), intent(out) :: values(value_capacity,max_particles)
|
||||
integer, intent(out) :: failure_status_out(max_particles)
|
||||
integer, intent(out) :: reference_neighbor_count_out(max_particles)
|
||||
integer, intent(out) :: reference_degenerate_out(max_particles)
|
||||
integer, intent(out) :: correction_status_out(max_particles)
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ierr
|
||||
integer :: i
|
||||
|
||||
count = 0
|
||||
ierr = SPH_SUCCESS
|
||||
if (max_particles <= 0 .or. value_capacity < SPH_SOLID_STATE_VALUE_COUNT) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid state buffer is too small')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
values = 0.0_rk
|
||||
failure_status_out = 0
|
||||
reference_neighbor_count_out = 0
|
||||
reference_degenerate_out = 0
|
||||
correction_status_out = 0
|
||||
if (npart > max_particles) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid state particle buffer is too small')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
count = npart
|
||||
if (.not. allocated(solid_stress)) return
|
||||
do i = 1, npart
|
||||
values(1:6,i) = solid_stress(:,i)
|
||||
values(7:12,i) = solid_strain(:,i)
|
||||
if (allocated(solid_strain_rate)) values(13:18,i) = solid_strain_rate(:,i)
|
||||
if (allocated(solid_plastic_strain)) values(19,i) = solid_plastic_strain(i)
|
||||
if (allocated(solid_damage)) values(20,i) = solid_damage(i)
|
||||
if (allocated(solid_softening)) values(21,i) = solid_softening(i)
|
||||
if (allocated(solid_strain_rate_eq)) values(22,i) = solid_strain_rate_eq(i)
|
||||
if (allocated(solid_failure_status)) failure_status_out(i) = &
|
||||
solid_failure_status(i)
|
||||
if (allocated(solid_reference_neighbor_count)) then
|
||||
reference_neighbor_count_out(i) = solid_reference_neighbor_count(i)
|
||||
end if
|
||||
if (allocated(solid_reference_degenerate)) then
|
||||
reference_degenerate_out(i) = solid_reference_degenerate(i)
|
||||
end if
|
||||
if (allocated(solid_correction_status)) then
|
||||
correction_status_out(i) = solid_correction_status(i)
|
||||
end if
|
||||
end do
|
||||
end subroutine sph_solid_get_state
|
||||
|
||||
subroutine sph_solid_get_diagnostics(value_capacity, values, ierr)
|
||||
integer, intent(in) :: value_capacity
|
||||
real(rk), intent(out) :: values(value_capacity)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
ierr = SPH_SUCCESS
|
||||
if (value_capacity < SPH_SOLID_DIAGNOSTIC_VALUE_COUNT) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid diagnostic buffer is too small')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
values = 0.0_rk
|
||||
call sph_solid_update_diagnostics(ierr)
|
||||
if (ierr /= SPH_SUCCESS) return
|
||||
values(1) = solid_max_strain_rate
|
||||
values(2) = solid_max_acceleration
|
||||
values(3) = solid_internal_force_residual
|
||||
end subroutine sph_solid_get_diagnostics
|
||||
|
||||
subroutine sph_solid_get_reference_quality(reference_neighbor_min_out, &
|
||||
correction_det_min_out, correction_status_out, ierr)
|
||||
integer, intent(out) :: reference_neighbor_min_out
|
||||
real(rk), intent(out) :: correction_det_min_out
|
||||
integer, intent(out) :: correction_status_out
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
reference_neighbor_min_out = 0
|
||||
correction_det_min_out = 0.0_rk
|
||||
correction_status_out = 0
|
||||
call sph_solid_update_diagnostics(ierr)
|
||||
if (ierr /= SPH_SUCCESS) return
|
||||
reference_neighbor_min_out = solid_reference_neighbor_min
|
||||
correction_det_min_out = solid_correction_det_min
|
||||
correction_status_out = solid_correction_status_max
|
||||
end subroutine sph_solid_get_reference_quality
|
||||
|
||||
end module sph_solid_api
|
||||
@@ -21,9 +21,6 @@ module sph_solid_dynamics
|
||||
use sph_solid_material, only: sph_solid_von_mises
|
||||
implicit none
|
||||
|
||||
integer, parameter :: SPH_SOLID_STATE_VALUE_COUNT = 22
|
||||
integer, parameter :: SPH_SOLID_DIAGNOSTIC_VALUE_COUNT = 3
|
||||
|
||||
contains
|
||||
|
||||
subroutine sph_solid_set_body_force(force, ierr)
|
||||
@@ -89,97 +86,6 @@ contains
|
||||
softening_range_out = (/solid_min_softening, solid_max_softening/)
|
||||
end subroutine sph_solid_get_summary
|
||||
|
||||
subroutine sph_solid_get_state(max_particles, value_capacity, values, &
|
||||
failure_status_out, reference_neighbor_count_out, &
|
||||
reference_degenerate_out, correction_status_out, count, ierr)
|
||||
integer, intent(in) :: max_particles
|
||||
integer, intent(in) :: value_capacity
|
||||
real(rk), intent(out) :: values(value_capacity,max_particles)
|
||||
integer, intent(out) :: failure_status_out(max_particles)
|
||||
integer, intent(out) :: reference_neighbor_count_out(max_particles)
|
||||
integer, intent(out) :: reference_degenerate_out(max_particles)
|
||||
integer, intent(out) :: correction_status_out(max_particles)
|
||||
integer, intent(out) :: count
|
||||
integer, intent(out) :: ierr
|
||||
integer :: i
|
||||
|
||||
count = 0
|
||||
ierr = SPH_SUCCESS
|
||||
if (max_particles <= 0 .or. value_capacity < SPH_SOLID_STATE_VALUE_COUNT) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid state buffer is too small')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
values = 0.0_rk
|
||||
failure_status_out = 0
|
||||
reference_neighbor_count_out = 0
|
||||
reference_degenerate_out = 0
|
||||
correction_status_out = 0
|
||||
if (npart > max_particles) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid state particle buffer is too small')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
count = npart
|
||||
if (.not. allocated(solid_stress)) return
|
||||
do i = 1, npart
|
||||
values(1:6,i) = solid_stress(:,i)
|
||||
values(7:12,i) = solid_strain(:,i)
|
||||
if (allocated(solid_strain_rate)) values(13:18,i) = solid_strain_rate(:,i)
|
||||
if (allocated(solid_plastic_strain)) values(19,i) = solid_plastic_strain(i)
|
||||
if (allocated(solid_damage)) values(20,i) = solid_damage(i)
|
||||
if (allocated(solid_softening)) values(21,i) = solid_softening(i)
|
||||
if (allocated(solid_strain_rate_eq)) values(22,i) = solid_strain_rate_eq(i)
|
||||
if (allocated(solid_failure_status)) failure_status_out(i) = &
|
||||
solid_failure_status(i)
|
||||
if (allocated(solid_reference_neighbor_count)) then
|
||||
reference_neighbor_count_out(i) = solid_reference_neighbor_count(i)
|
||||
end if
|
||||
if (allocated(solid_reference_degenerate)) then
|
||||
reference_degenerate_out(i) = solid_reference_degenerate(i)
|
||||
end if
|
||||
if (allocated(solid_correction_status)) then
|
||||
correction_status_out(i) = solid_correction_status(i)
|
||||
end if
|
||||
end do
|
||||
end subroutine sph_solid_get_state
|
||||
|
||||
subroutine sph_solid_get_diagnostics(value_capacity, values, ierr)
|
||||
integer, intent(in) :: value_capacity
|
||||
real(rk), intent(out) :: values(value_capacity)
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
ierr = SPH_SUCCESS
|
||||
if (value_capacity < SPH_SOLID_DIAGNOSTIC_VALUE_COUNT) then
|
||||
call sph_error_set(SPH_ERROR_ARGUMENT, 'Solid diagnostic buffer is too small')
|
||||
ierr = SPH_ERROR_ARGUMENT
|
||||
return
|
||||
end if
|
||||
values = 0.0_rk
|
||||
call sph_solid_update_diagnostics(ierr)
|
||||
if (ierr /= SPH_SUCCESS) return
|
||||
values(1) = solid_max_strain_rate
|
||||
values(2) = solid_max_acceleration
|
||||
values(3) = solid_internal_force_residual
|
||||
end subroutine sph_solid_get_diagnostics
|
||||
|
||||
subroutine sph_solid_get_reference_quality(reference_neighbor_min_out, &
|
||||
correction_det_min_out, correction_status_out, ierr)
|
||||
integer, intent(out) :: reference_neighbor_min_out
|
||||
real(rk), intent(out) :: correction_det_min_out
|
||||
integer, intent(out) :: correction_status_out
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
reference_neighbor_min_out = 0
|
||||
correction_det_min_out = 0.0_rk
|
||||
correction_status_out = 0
|
||||
call sph_solid_update_diagnostics(ierr)
|
||||
if (ierr /= SPH_SUCCESS) return
|
||||
reference_neighbor_min_out = solid_reference_neighbor_min
|
||||
correction_det_min_out = solid_correction_det_min
|
||||
correction_status_out = solid_correction_status_max
|
||||
end subroutine sph_solid_get_reference_quality
|
||||
|
||||
subroutine sph_solid_build_reference_state(ierr)
|
||||
integer, intent(out) :: ierr
|
||||
integer :: i
|
||||
|
||||
Reference in New Issue
Block a user