Prepare SPHLite 0.2.0 development baseline
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
*NODE
|
||||
1, 0.0, 0.0, 0.0
|
||||
2, 1.0, 0.0, 0.0
|
||||
*NSET, NSET=COUPLED
|
||||
1, 2
|
||||
*MATERIAL, NAME=SOLID_PLACEHOLDER, TYPE=SOLID
|
||||
*SOLID SECTION, NSET=COUPLED, MATERIAL=SOLID_PLACEHOLDER
|
||||
*SPHLITE TIME CONTROL, DT=1.0E-6, TIME=1.0E-6, STEPS=1
|
||||
*SPHLITE COUPLING REGION, NAME=CONTINUUM_SIDE, SET=COUPLED, TYPE=CONTINUUM
|
||||
@@ -0,0 +1,16 @@
|
||||
*NODE
|
||||
1, 0.0, 0.0, 0.0
|
||||
2, 1.0, 0.0, 0.0
|
||||
3, 0.0, 1.0, 0.0
|
||||
4, 0.0, 0.0, 1.0
|
||||
*ELEMENT, TYPE=SPH4
|
||||
1, 1, 2, 3, 4
|
||||
*NSET, NSET=ALLNODES
|
||||
1, 2, 3, 4
|
||||
*ELSET, ELSET=ALLELEMENTS
|
||||
1
|
||||
*MATERIAL, NAME=WATER_PLACEHOLDER, TYPE=WATER
|
||||
*SOLID SECTION, ELSET=ALLELEMENTS, MATERIAL=WATER_PLACEHOLDER, THICKNESS=0.0, POINTS=3
|
||||
*SPHLITE TIME CONTROL, DT=1.0E-6, TIME=1.0E-6, STEPS=1, SAFETY=0.8
|
||||
*SPHLITE OUTPUT, DIRECTORY=., INTERVAL=1
|
||||
*SPHLITE COUPLING REGION, NAME=CONTACT_SIDE, SET=ALLNODES, TYPE=CONTACT
|
||||
@@ -0,0 +1,4 @@
|
||||
*NODE
|
||||
1, 0.0, 0.0, 0.0
|
||||
*SOLID SECTION, ELSET=ALL, MATERIAL=MISSING
|
||||
*SPHLITE TIME CONTROL, DT=1.0E-6, TIME=1.0E-6, STEPS=1
|
||||
@@ -0,0 +1,4 @@
|
||||
*NODE
|
||||
1, 0.0, 0.0, 0.0
|
||||
*MATERIAL, NAME=SOLID_PLACEHOLDER, TYPE=SOLID
|
||||
*SPHLITE TIME CONTROL, DT=1.0E-6, TIME=1.0E-6, STEPS=1
|
||||
@@ -0,0 +1,4 @@
|
||||
*NODE
|
||||
1, 0.0, 0.0, 0.0
|
||||
*MATERIAL, NAME=SOLID_PLACEHOLDER, TYPE=SOLID
|
||||
*SOLID SECTION, ELSET=ALL, MATERIAL=SOLID_PLACEHOLDER
|
||||
@@ -0,0 +1,15 @@
|
||||
** leading comment
|
||||
|
||||
*Node
|
||||
1, 0.0, 0.0, 0.0
|
||||
2, 1.0, 0.0, 0.0
|
||||
*Element, Type=SPH2
|
||||
1, 1, 2
|
||||
*Nset, Nset=MixedNodes
|
||||
1, 2
|
||||
*Elset, Elset=MixedElements
|
||||
1
|
||||
*Material, Name=MixedMaterial, Type=Solid
|
||||
*Solid Section, Elset=MixedElements, Material=MixedMaterial
|
||||
*SphLite Time Control, DT=1.0E-6, TIME=1.0E-6, STEPS=1
|
||||
*SphLite Output, Directory=., Interval=1
|
||||
@@ -0,0 +1,7 @@
|
||||
*NODE
|
||||
1, 0.0, 0.0, 0.0
|
||||
2, 1.0, 0.0, 0.0
|
||||
*MATERIAL, NAME=SOLID_PLACEHOLDER, TYPE=SOLID
|
||||
*SOLID SECTION, ELSET=ALL, MATERIAL=SOLID_PLACEHOLDER
|
||||
*SPHLITE TIME CONTROL, DT=1.0E-6, TIME=1.0E-6, STEPS=1
|
||||
*SPHLITE OUTPUT, DIRECTORY=., INTERVAL=1
|
||||
@@ -17,24 +17,44 @@ int main(void)
|
||||
int minor = 0;
|
||||
int patch = 0;
|
||||
int count = 0;
|
||||
int warnings = 0;
|
||||
int step = 0;
|
||||
int ids[4];
|
||||
int phase[4];
|
||||
int status[4];
|
||||
int material_id[4];
|
||||
int section_id[4];
|
||||
double x[12];
|
||||
double v[12];
|
||||
double a[12];
|
||||
double rho[4];
|
||||
double pressure[4];
|
||||
double internal_energy[4];
|
||||
double temperature[4];
|
||||
double h[4];
|
||||
double time = 0.0;
|
||||
|
||||
if (SPHLITE_PHASE_SOLID != 4 || SPHLITE_STATUS_ACTIVE != 0) {
|
||||
return fail("C constants are not locked");
|
||||
}
|
||||
if (sphlite_get_particle_count(NULL) != -1) {
|
||||
return fail("null particle count pointer did not return -1");
|
||||
}
|
||||
if (sphlite_get_last_error(NULL, path, (int)sizeof(path)) != -1) {
|
||||
return fail("null last-error code pointer did not return -1");
|
||||
}
|
||||
if (sphlite_set_output_interval(0) != -1) {
|
||||
return fail("non-positive output interval did not return -1");
|
||||
}
|
||||
|
||||
ierr = sphlite_initialize();
|
||||
if (ierr != 0) return fail("initialize failed");
|
||||
|
||||
ierr = sphlite_get_version(&major, &minor, &patch);
|
||||
if (ierr != 0) return fail("get_version failed");
|
||||
if (major != 0 || minor != 1 || patch != 0) return fail("unexpected version");
|
||||
if (major != 0 || minor != 1 || patch != 1) return fail("unexpected version");
|
||||
|
||||
snprintf(path, sizeof(path), "%s/minimal_particles.inp", SPHLITE_TEST_DATA_DIR);
|
||||
snprintf(path, sizeof(path), "%s/minimal_particles_011.inp", SPHLITE_TEST_DATA_DIR);
|
||||
ierr = sphlite_read_inp(path);
|
||||
if (ierr != 0) return fail("read_inp failed");
|
||||
|
||||
@@ -43,12 +63,43 @@ int main(void)
|
||||
|
||||
ierr = sphlite_get_particle_count(&count);
|
||||
if (ierr != 0 || count != 4) return fail("particle count mismatch");
|
||||
ierr = sphlite_get_input_warning_count(&warnings);
|
||||
if (ierr != 0 || warnings != 0) return fail("warning count mismatch");
|
||||
|
||||
if (sphlite_get_particle_state(1, ids, phase, status, material_id, section_id,
|
||||
x, v, a, rho, pressure, internal_energy, temperature, h, &count) == 0) {
|
||||
return fail("small particle-state buffer did not fail");
|
||||
}
|
||||
|
||||
ierr = sphlite_get_particle_state(4, ids, phase, status, material_id, section_id,
|
||||
x, v, a, rho, pressure, internal_energy, temperature, h, &count);
|
||||
if (ierr != 0 || count != 4) return fail("particle state query failed");
|
||||
if (ids[0] != 1 || phase[0] != SPHLITE_PHASE_SOLID ||
|
||||
status[0] != SPHLITE_STATUS_ACTIVE) {
|
||||
return fail("particle state content mismatch");
|
||||
}
|
||||
|
||||
if (sphlite_get_particle_state(4, NULL, phase, status, material_id, section_id,
|
||||
x, v, a, rho, pressure, internal_energy, temperature, h, &count) != -1) {
|
||||
return fail("null particle-state array did not return -1");
|
||||
}
|
||||
|
||||
ierr = sphlite_advance_explicit(1.0e-6);
|
||||
if (ierr != 0) return fail("advance explicit failed");
|
||||
ierr = sphlite_get_current_time(&time, &step);
|
||||
if (ierr != 0 || step != 1 || time <= 0.0) return fail("time query failed");
|
||||
|
||||
ierr = sphlite_set_output_directory(SPHLITE_TEST_WORK_DIR);
|
||||
if (ierr != 0) return fail("set output directory failed");
|
||||
ierr = sphlite_write_output(step, time);
|
||||
if (ierr != 0) return fail("write output failed");
|
||||
|
||||
snprintf(path, sizeof(path), "%s/restart_c_api.tmp", SPHLITE_TEST_WORK_DIR);
|
||||
ierr = sphlite_write_restart(path);
|
||||
if (ierr != 0) return fail("write restart failed");
|
||||
ierr = sphlite_read_restart(path);
|
||||
if (ierr != 0) return fail("read restart failed");
|
||||
|
||||
ierr = sphlite_finalize();
|
||||
if (ierr != 0) return fail("finalize failed");
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "sphlite.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
int main()
|
||||
{
|
||||
if (sphlite::PhaseSolid != SPHLITE_PHASE_SOLID ||
|
||||
sphlite::StatusActive != SPHLITE_STATUS_ACTIVE) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
sphlite::Session session;
|
||||
sphlite::Version version = sphlite::version();
|
||||
if (version.major != 0 || version.minor != 1 || version.patch != 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string input = std::string(SPHLITE_TEST_DATA_DIR) + "/minimal_particles_011.inp";
|
||||
sphlite::read_inp(input);
|
||||
sphlite::build_model();
|
||||
if (sphlite::particle_count() != 4) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
sphlite::ParticleState state = sphlite::particle_state();
|
||||
if (state.particle_id_ext.size() != 4 || state.phase[0] != sphlite::PhaseSolid) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
session.close();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
program test_coupling_interface
|
||||
use sph_precision, only: rk
|
||||
use sph_error, only: SPH_SUCCESS
|
||||
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, sph_build_model
|
||||
use sph_coupling_interface, only: sph_coupling_get_particle_count, &
|
||||
sph_coupling_export_particle, sph_coupling_get_facet_count, &
|
||||
sph_coupling_export_facet, sph_coupling_import_particle_force, &
|
||||
sph_coupling_import_facet_load, sph_coupling_get_diagnostics, &
|
||||
coupling_type
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
integer :: count
|
||||
integer :: ext_id
|
||||
integer :: nodes(3)
|
||||
real(rk) :: position(3)
|
||||
real(rk) :: velocity(3)
|
||||
real(rk) :: force(3)
|
||||
real(rk) :: work
|
||||
real(rk) :: energy
|
||||
real(rk) :: momentum(3)
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed')
|
||||
call sph_read_inp('tests/data/coupling_region_011.inp', ierr)
|
||||
call assert_ok(ierr, 'read input failed')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build model failed')
|
||||
|
||||
call sph_coupling_get_particle_count(count, ierr)
|
||||
call assert_ok(ierr, 'coupling particle count failed')
|
||||
if (count /= 2) call fail('coupling particle count mismatch')
|
||||
call sph_coupling_export_particle(1, ext_id, position, velocity, ierr)
|
||||
call assert_ok(ierr, 'coupling particle export failed')
|
||||
if (ext_id /= 1) call fail('coupling particle export id mismatch')
|
||||
|
||||
call sph_coupling_get_facet_count(count, ierr)
|
||||
call assert_ok(ierr, 'coupling facet count failed')
|
||||
if (count /= 0) call fail('0.1.1 should not export real facets')
|
||||
call sph_coupling_export_facet(2, nodes, ierr)
|
||||
if (ierr == SPH_SUCCESS) call fail('facet export error path did not fail')
|
||||
|
||||
force = 1.0_rk
|
||||
call sph_coupling_import_particle_force(1, force, ierr)
|
||||
call assert_ok(ierr, 'coupling particle force import failed')
|
||||
call sph_coupling_import_facet_load(1, force, ierr)
|
||||
call assert_ok(ierr, 'coupling facet load import failed')
|
||||
call sph_coupling_get_diagnostics(work, energy, momentum)
|
||||
if (work <= 0.0_rk .or. energy <= 0.0_rk) call fail('coupling diagnostics not updated')
|
||||
if (coupling_type /= 0) call fail('default coupling type should remain neutral')
|
||||
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed')
|
||||
|
||||
contains
|
||||
|
||||
subroutine assert_ok(ierr_value, message)
|
||||
integer, intent(in) :: ierr_value
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
if (ierr_value /= SPH_SUCCESS) call fail(message)
|
||||
end subroutine assert_ok
|
||||
|
||||
subroutine fail(message)
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
write(*, '(A)') trim(message)
|
||||
stop 1
|
||||
end subroutine fail
|
||||
|
||||
end program test_coupling_interface
|
||||
+55
-19
@@ -1,25 +1,30 @@
|
||||
program test_input
|
||||
use sph_error, only: SPH_SUCCESS
|
||||
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, &
|
||||
sph_build_model, sph_get_particle_count
|
||||
sph_build_model, sph_get_particle_count, sph_get_input_warning_count
|
||||
use sph_input_reader, only: sph_input_get_warning_count
|
||||
use sph_database, only: material_count, section_count, nset_count, &
|
||||
elset_count, element_count, coupling_region_count
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
integer :: count
|
||||
integer :: warnings
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for minimal input')
|
||||
call sph_read_inp('tests/data/minimal_particles.inp', ierr)
|
||||
call assert_ok(ierr, 'minimal input read failed')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'minimal model build failed')
|
||||
call sph_get_particle_count(count, ierr)
|
||||
call assert_ok(ierr, 'minimal particle count failed')
|
||||
if (count /= 4) call fail('minimal input particle count mismatch')
|
||||
call check_good_input('tests/data/minimal_particles_011.inp', 4, .true.)
|
||||
if (material_count /= 1) call fail('material metadata was not saved')
|
||||
if (section_count /= 1) call fail('section metadata was not saved')
|
||||
if (nset_count <= 0) call fail('node set metadata was not saved')
|
||||
if (elset_count <= 0) call fail('element set metadata was not saved')
|
||||
if (element_count <= 0) call fail('element metadata was not saved')
|
||||
if (coupling_region_count <= 0) call fail('coupling region metadata was not saved')
|
||||
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed after minimal input')
|
||||
call assert_ok(ierr, 'finalize failed after metadata check')
|
||||
|
||||
call check_good_input('tests/data/mixed_case_011.inp', 2, .false.)
|
||||
call check_good_input('tests/data/output_control_011.inp', 2, .false.)
|
||||
call check_good_input('tests/data/coupling_region_011.inp', 2, .false.)
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for unknown keyword input')
|
||||
@@ -27,22 +32,53 @@ program test_input
|
||||
call assert_ok(ierr, 'unknown keyword input read failed')
|
||||
call sph_input_get_warning_count(warnings)
|
||||
if (warnings <= 0) call fail('unknown keyword warning was not recorded')
|
||||
call sph_get_input_warning_count(warnings, ierr)
|
||||
call assert_ok(ierr, 'warning count API failed')
|
||||
if (warnings <= 0) call fail('warning count API did not report warning')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'unknown keyword input build failed')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed after unknown keyword input')
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for missing required input')
|
||||
call sph_read_inp('tests/data/missing_required.inp', ierr)
|
||||
call assert_ok(ierr, 'missing required input read failed')
|
||||
call sph_build_model(ierr)
|
||||
if (ierr == SPH_SUCCESS) call fail('missing required input did not fail')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed after missing required input')
|
||||
call check_bad_input('tests/data/missing_material_011.inp')
|
||||
call check_bad_input('tests/data/missing_section_011.inp')
|
||||
call check_bad_input('tests/data/missing_time_control_011.inp')
|
||||
|
||||
contains
|
||||
|
||||
subroutine check_good_input(filename, expected_count, leave_open)
|
||||
character(len=*), intent(in) :: filename
|
||||
integer, intent(in) :: expected_count
|
||||
logical, intent(in) :: leave_open
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for good input')
|
||||
call sph_read_inp(filename, ierr)
|
||||
call assert_ok(ierr, 'good input read failed')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'good model build failed')
|
||||
call sph_get_particle_count(count, ierr)
|
||||
call assert_ok(ierr, 'good particle count failed')
|
||||
if (count /= expected_count) call fail('good input particle count mismatch')
|
||||
if (.not. leave_open) then
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed after good input')
|
||||
end if
|
||||
end subroutine check_good_input
|
||||
|
||||
subroutine check_bad_input(filename)
|
||||
character(len=*), intent(in) :: filename
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed for bad input')
|
||||
call sph_read_inp(filename, ierr)
|
||||
call assert_ok(ierr, 'bad input read should still parse nodes')
|
||||
call sph_build_model(ierr)
|
||||
if (ierr == SPH_SUCCESS) call fail('bad input did not fail model build')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed after bad input')
|
||||
end subroutine check_bad_input
|
||||
|
||||
subroutine assert_ok(ierr_value, message)
|
||||
integer, intent(in) :: ierr_value
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
program test_output
|
||||
use sph_precision, only: rk
|
||||
use sph_error, only: SPH_SUCCESS
|
||||
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, sph_build_model, &
|
||||
sph_set_output_directory, sph_set_output_interval, sph_write_output
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed')
|
||||
call sph_read_inp('tests/data/output_control_011.inp', ierr)
|
||||
call assert_ok(ierr, 'read input failed')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build model failed')
|
||||
call sph_set_output_directory('build-codex-unix', ierr)
|
||||
call assert_ok(ierr, 'set output directory failed')
|
||||
call sph_set_output_interval(1, ierr)
|
||||
call assert_ok(ierr, 'set output interval failed')
|
||||
call sph_write_output(0, 0.0_rk, ierr)
|
||||
call assert_ok(ierr, 'write output failed')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed')
|
||||
|
||||
contains
|
||||
|
||||
subroutine assert_ok(ierr_value, message)
|
||||
integer, intent(in) :: ierr_value
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
if (ierr_value /= SPH_SUCCESS) call fail(message)
|
||||
end subroutine assert_ok
|
||||
|
||||
subroutine fail(message)
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
write(*, '(A)') trim(message)
|
||||
stop 1
|
||||
end subroutine fail
|
||||
|
||||
end program test_output
|
||||
@@ -0,0 +1,49 @@
|
||||
program test_restart
|
||||
use sph_precision, only: rk
|
||||
use sph_error, only: SPH_SUCCESS
|
||||
use sph_api, only: sph_initialize, sph_finalize, sph_read_inp, sph_build_model, &
|
||||
sph_run_explicit, sph_get_current_time, sph_write_restart, sph_read_restart, &
|
||||
sph_advance_explicit
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
integer :: step
|
||||
real(rk) :: time
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed')
|
||||
call sph_read_inp('tests/data/minimal_particles_011.inp', ierr)
|
||||
call assert_ok(ierr, 'read input failed')
|
||||
call sph_build_model(ierr)
|
||||
call assert_ok(ierr, 'build model failed')
|
||||
call sph_run_explicit(ierr)
|
||||
call assert_ok(ierr, 'run explicit failed')
|
||||
call sph_write_restart('build-codex-unix/restart_test.tmp', ierr)
|
||||
call assert_ok(ierr, 'write restart failed')
|
||||
call sph_read_restart('build-codex-unix/restart_test.tmp', ierr)
|
||||
call assert_ok(ierr, 'read restart failed')
|
||||
call sph_get_current_time(time, step, ierr)
|
||||
call assert_ok(ierr, 'time after restart failed')
|
||||
if (step /= 1) call fail('restart did not restore step')
|
||||
call sph_advance_explicit(1.0e-6_rk, ierr)
|
||||
call assert_ok(ierr, 'advance after restart failed')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed')
|
||||
|
||||
contains
|
||||
|
||||
subroutine assert_ok(ierr_value, message)
|
||||
integer, intent(in) :: ierr_value
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
if (ierr_value /= SPH_SUCCESS) call fail(message)
|
||||
end subroutine assert_ok
|
||||
|
||||
subroutine fail(message)
|
||||
character(len=*), intent(in) :: message
|
||||
|
||||
write(*, '(A)') trim(message)
|
||||
stop 1
|
||||
end subroutine fail
|
||||
|
||||
end program test_restart
|
||||
@@ -2,8 +2,9 @@ program test_smoke
|
||||
use sph_precision, only: rk
|
||||
use sph_error, only: SPH_SUCCESS
|
||||
use sph_api, only: sph_initialize, sph_finalize, sph_get_version, &
|
||||
sph_get_particle_count, sph_get_current_time, sph_advance_explicit
|
||||
use sph_database, only: sph_db_allocate
|
||||
sph_get_particle_count, sph_get_current_time, sph_advance_explicit, &
|
||||
sph_get_particle_state_capacity, sph_get_particle_state
|
||||
use sph_database, only: sph_db_allocate, SPH_PHASE_SOLID, SPH_STATUS_ACTIVE
|
||||
implicit none
|
||||
|
||||
integer :: ierr
|
||||
@@ -11,15 +12,31 @@ program test_smoke
|
||||
integer :: minor
|
||||
integer :: patch
|
||||
integer :: count
|
||||
integer :: ndim
|
||||
integer :: step
|
||||
integer :: particle_id_ext(2)
|
||||
integer :: phase(2)
|
||||
integer :: status(2)
|
||||
integer :: material_id(2)
|
||||
integer :: section_id(2)
|
||||
real(rk) :: x(3,2)
|
||||
real(rk) :: v(3,2)
|
||||
real(rk) :: a(3,2)
|
||||
real(rk) :: rho(2)
|
||||
real(rk) :: pressure(2)
|
||||
real(rk) :: internal_energy(2)
|
||||
real(rk) :: temperature(2)
|
||||
real(rk) :: h(2)
|
||||
real(rk) :: time
|
||||
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'initialize failed')
|
||||
call sph_initialize(ierr)
|
||||
call assert_ok(ierr, 'reinitialize failed')
|
||||
|
||||
call sph_get_version(major, minor, patch, ierr)
|
||||
call assert_ok(ierr, 'version failed')
|
||||
if (major /= 0 .or. minor /= 1 .or. patch /= 0) call fail('unexpected version')
|
||||
if (major /= 0 .or. minor /= 1 .or. patch /= 1) call fail('unexpected version')
|
||||
|
||||
call sph_db_allocate(2, ierr)
|
||||
call assert_ok(ierr, 'database allocation failed')
|
||||
@@ -27,6 +44,22 @@ program test_smoke
|
||||
call assert_ok(ierr, 'particle count failed')
|
||||
if (count /= 2) call fail('unexpected particle count')
|
||||
|
||||
call sph_get_particle_state_capacity(count, ndim, ierr)
|
||||
call assert_ok(ierr, 'state capacity failed')
|
||||
if (count /= 2 .or. ndim /= 3) call fail('unexpected state capacity')
|
||||
|
||||
call sph_get_particle_state(2, particle_id_ext, phase, status, material_id, &
|
||||
section_id, x, v, a, rho, pressure, internal_energy, temperature, h, &
|
||||
count, ierr)
|
||||
call assert_ok(ierr, 'particle state failed')
|
||||
if (phase(1) /= SPH_PHASE_SOLID) call fail('unexpected default phase')
|
||||
if (status(1) /= SPH_STATUS_ACTIVE) call fail('unexpected default status')
|
||||
|
||||
call sph_advance_explicit(-1.0e-6_rk, ierr)
|
||||
if (ierr == SPH_SUCCESS) call fail('negative time step did not fail')
|
||||
call sph_advance_explicit(0.0_rk, ierr)
|
||||
if (ierr == SPH_SUCCESS) call fail('zero time step did not fail')
|
||||
|
||||
call sph_advance_explicit(1.0e-6_rk, ierr)
|
||||
call assert_ok(ierr, 'explicit advance failed')
|
||||
call sph_get_current_time(time, step, ierr)
|
||||
@@ -36,6 +69,8 @@ program test_smoke
|
||||
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'finalize failed')
|
||||
call sph_finalize(ierr)
|
||||
call assert_ok(ierr, 'repeat finalize failed')
|
||||
|
||||
contains
|
||||
|
||||
|
||||
Reference in New Issue
Block a user