Add node-based surface parsing

This commit is contained in:
shenw
2026-06-24 18:20:17 +08:00
parent e17c04736b
commit aff82622f0
9 changed files with 182 additions and 22 deletions
@@ -22,7 +22,7 @@ FemLite S4 unsupported surface type parser test
0.1
*SHELL SECTION, ELSET=SLAVE, MATERIAL=MAT
0.1
*SURFACE, NAME=MASTER_SURF, TYPE=NODE
*SURFACE, NAME=MASTER_SURF, TYPE=ANALYTICAL
MASTER, SPOS
*SURFACE, NAME=SLAVE_SURF, TYPE=ELEMENT
SLAVE, SNEG
+25
View File
@@ -0,0 +1,25 @@
*HEADING
FemLite S4 node-based surface parser test
*NODE
1, 0.0, 0.0, 0.0
2, 1.0, 0.0, 0.0
3, 1.0, 1.0, 0.0
4, 0.0, 1.0, 0.0
*ELEMENT, TYPE=S4, ELSET=PLATE
1, 1, 2, 3, 4
*NSET, NSET=TOP_NODES
3, 4
*MATERIAL, NAME=MAT
*DENSITY
1.0
*ELASTIC
30.0, 0.25
*SHELL SECTION, ELSET=PLATE, MATERIAL=MAT
0.1
*SURFACE, NAME=NODE_SURF, TYPE=NODE
TOP_NODES
1
*STEP
*DYNAMIC
0.1, 0.1
*END STEP
+1 -1
View File
@@ -56,7 +56,7 @@ int main(void)
ierr = femlite_get_version(&major, &minor, &patch);
if (ierr != 0) return check_ierr(ierr, 2);
if (major != 0 || minor != 3 || patch != 3) return 3;
if (major != 0 || minor != 4 || patch != 0) return 3;
ierr = femlite_read_inp("examples/c3d4_one_element.inp");
if (ierr != 0) return check_ierr(ierr, 4);
+31 -2
View File
@@ -7,7 +7,7 @@ program test_implicit_inp
contact_pair_damping, contact_pair_search, &
contact_pair_friction, n_surface, surface_name, &
surface_start, surface_count, surface_target, &
surface_face, surface_owner
surface_face, surface_owner, surface_type
use fem_database_surface, only: db_contact_facet_match, &
db_contact_facet_normal_sign, &
db_contact_facet_has_side
@@ -456,12 +456,41 @@ contains
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(478)
call check_node_surface_inp()
call check_contact_pair_input_errors()
end subroutine check_contact_pair_inp
subroutine check_contact_pair_input_errors()
call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_slave.inp', 401)
call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_master.inp', 404)
call check_contact_pair_inp_error('tests/data/s4_contact_pair_missing_penalty.inp', 407)
call check_contact_pair_build_error('tests/data/s4_contact_pair_surface_bad_face.inp', 415)
call check_contact_pair_inp_error('tests/data/s4_contact_pair_surface_bad_type.inp', 445)
end subroutine check_contact_pair_inp
end subroutine check_contact_pair_input_errors
subroutine check_node_surface_inp()
integer :: ierr
call fem_initialize(ierr)
if (ierr .ne. 0) call fail(480)
call fem_read_inp('tests/data/s4_node_surface.inp', ierr)
if (ierr .ne. 0) call fail(481)
if (n_surface .ne. 1) call fail(482)
if (trim(surface_name(1)) .ne. 'NODE_SURF') call fail(483)
if (trim(surface_type(1)) .ne. 'NODE') call fail(484)
if (surface_start(1) .ne. 1) call fail(485)
if (surface_count(1) .ne. 2) call fail(486)
if (trim(surface_target(1)) .ne. 'TOP_NODES') call fail(487)
if (trim(surface_target(2)) .ne. '1') call fail(488)
if (db_contact_facet_match(1, 1, 'NODE_SURF')) call fail(489)
call fem_build_model(ierr)
if (ierr .ne. 0) call fail(490)
call fem_finalize(ierr)
if (ierr .ne. 0) call fail(491)
end subroutine check_node_surface_inp
subroutine check_contact_pair_inp_error(path, code_base)
character(len=*), intent(in) :: path