@@ -796,6 +796,9 @@ def convert_materials(input_lines, nset_counter):
796796 # Default value for Poisson's ratio in case one is not defined in data
797797 poissrat = 0.1
798798
799+ # Default value for long-term moduli in case one is not defined in data
800+ longterm = 1
801+
799802 # Use regular expressions to extract relevant information
800803 matchpr = re .search (
801804 r'POISSON\s*=\s*([-+]?\d*\.\d+|\d+(?:[eE][-+]?\d+)?)' , hyperfoam_line , re .IGNORECASE
@@ -813,10 +816,18 @@ def convert_materials(input_lines, nset_counter):
813816 r'testdata\s*,?' , hyperfoam_line , re .IGNORECASE
814817 )
815818
819+ matchlt = re .search (
820+ r'moduli\s*=\s*long\s*term' , hyperfoam_line , re .IGNORECASE
821+ )
822+
816823 if matchpr :
817824 poissrat = float (matchpr .group (1 ))
818825 material_names [current_material_name ]['poissrat' ] = poissrat
819826
827+ if matchlt :
828+ longterm = 2
829+ material_names [current_material_name ]['longterm' ] = longterm
830+
820831 if matchtdi or matchtd :
821832 material_names [current_material_name ]['poissrat' ] = poissrat
822833
@@ -1306,13 +1317,13 @@ def check_if_se(properties):
13061317 )
13071318# checks variables for hyperfoam uniaxial material and returns them to the material write section
13081319def check_if_hypfua (properties ):
1309- desired_mps = ['material_id' , 'rho' , 'poissrat' , 'uniaxial_data' ]
1320+ desired_mps = ['material_id' , 'rho' , 'poissrat' , 'longterm' , ' uniaxial_data' ]
13101321 return all (
13111322 prop in properties for prop in desired_mps ) and len (properties ) == len (desired_mps
13121323 )
13131324# checks variables for hyperfoam mu alpha material and returns them to the material write section
13141325def check_if_hypfmua (properties ):
1315- desired_mps = ['material_id' , 'rho' , 'n' ]
1326+ desired_mps = ['material_id' , 'rho' , 'n' , 'longterm' ]
13161327 n = properties .get ('n' , 0 )
13171328 for i in range (1 , n + 1 ):
13181329 desired_mps .extend ([f'mu{ i } ' , f'alpha{ i } ' , f'pr{ i } ' ])
@@ -1469,7 +1480,7 @@ def write_coh_material(
14691480
14701481# MAT LAW62
14711482# writes law62 foam material
1472- def write_hypfmua_material (material_id , material_name , rho , n , mu_values ,
1483+ def write_hypfmua_material (material_id , material_name , rho , n , longterm , mu_values ,
14731484 alpha_values , pr_values , output_file ):
14741485
14751486 output_file .write ("#---1----|----2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|---10----|\n " )
@@ -1480,7 +1491,7 @@ def write_hypfmua_material(material_id, material_name, rho, n, mu_values,
14801491 output_file .write ("# Nu N M mu_max Flag_Visc form\n " )
14811492 # Use the first value from pr_values
14821493 pr1 = pr_values [0 ]
1483- output_file .write (f"{ pr1 :>20.15g} { n :>10} 0\n " )
1494+ output_file .write (f"{ pr1 :>20.15g} { n :>10} 0 { longterm } \n " )
14841495 # Write mu values, 5 per line
14851496 output_file .write ("# mu_i\n " )
14861497 for i in range (0 , len (mu_values ), 5 ):
@@ -1527,7 +1538,7 @@ def write_ogden_c_material(
15271538# MAT LAW70
15281539# writes law70 foam material
15291540def write_hypfua_material (
1530- material_id , material_name , rho , poissrat , uniaxial_data , output_file
1541+ material_id , material_name , rho , poissrat , longterm , uniaxial_data , output_file
15311542 ):
15321543 output_file .write ("#---1----|----2----|----3----|----4----|----5----|----6----|----7----|----8----|----9----|---10----|\n " )
15331544 output_file .write (f"/MAT/LAW70/{ material_id } \n " )
@@ -2297,9 +2308,11 @@ def parse_element_data(input_lines, elset_dicts, property_names, non_numeric_ref
22972308 current_element_dicts .append (
22982309 {"ELSET" : elset , "PROP_ID" : 0 , "elements" : element_dict }
22992310 )
2300- print ("### WARNING ###: No Property Found for Element," )
2311+ print (f"### WARNING ###: No Property Found for Elements in Elset: { elset } " )
2312+ print (" Property may not have been recognised, or:" )
23012313 print (" if using PrePoMax, please use PART NAME as Region Type" )
23022314 print (" for shell parts Section assignment, not 'Selection'" )
2315+ print ("" )
23032316 ppmselect = True
23042317 element_dicts [current_element_type ] = current_element_dicts
23052318 if current_element_type .lower () == 'sc8r' :
@@ -2373,9 +2386,11 @@ def parse_element_data(input_lines, elset_dicts, property_names, non_numeric_ref
23732386 current_element_dicts .append (
23742387 {"ELSET" : elset , "PROP_ID" : 0 , "elements" : element_dict }
23752388 )
2376- print ("### WARNING ###: No Property Found for Element," )
2389+ print (f"### WARNING ###: No Property Found for Elements in Elset: { elset } " )
2390+ print (" Property may not have been recognised, or:" )
23772391 print (" if using PrePoMax, please use PART NAME as Region Type" )
23782392 print (" for shell parts Section assignment, not 'Selection'" )
2393+ print ("" )
23792394 ppmselect = True
23802395 element_dicts [current_element_type ] = current_element_dicts
23812396 if current_element_type .lower () == 'sc8r' :
@@ -2434,7 +2449,7 @@ def process_element_block(current_element_block, current_element_type, max_elem_
24342449 'C3D8I' : 8 , 'COH3D8' : 8 ,'C3D8R' : 8 , 'C3D10' : 10 , 'C3D10M' : 10
24352450 }
24362451
2437- num_nodes = element_type_nodes .get (current_element_type , 0 )
2452+ num_nodes = element_type_nodes .get (current_element_type . upper () , 0 )
24382453
24392454 if num_nodes == 0 :
24402455 print ("" )
@@ -4089,7 +4104,6 @@ def convert_boundary(input_lines, nset_counter, nsets, functs_dict, fct_id):
40894104 for impd_dir , impd_val , amplitude_name in impd_entries :
40904105 # Increment nset_counter for each subsequent entry
40914106 if not impd_first_entry :
4092- grnod_nset_counter = ref_nset_counter
40934107 nset_counter += 1
40944108 ref_nset_counter = nset_counter
40954109 impd_grnod = None
@@ -5621,14 +5635,15 @@ def write_output(transform_lines, transform_data, node_lines, nset_blocks, mater
56215635 material_id = properties ['material_id' ]
56225636 rho = properties ['rho' ]
56235637 n = properties ['n' ]
5638+ longterm = properties ['longterm' ]
56245639 # Collect all mu, alpha, and pr values
56255640 mu_values = [properties [key ] for key in properties if key .startswith ('mu' )]
56265641 alpha_values = [properties [key ] for key in properties if key .startswith ('alpha' )]
56275642 pr_values = [properties [key ] for key in properties if key .startswith ('pr' )]
56285643
56295644 # Write the card format for materials with foam mu a properties
5630- write_hypfmua_material (material_id , material_name , rho , n , mu_values , alpha_values ,
5631- pr_values , output_file )
5645+ write_hypfmua_material (material_id , material_name , rho , n , longterm , mu_values ,
5646+ alpha_values , pr_values , output_file )
56325647
56335648 #MAT LAW69
56345649 for material_name , properties in material_names .items ():
@@ -5650,9 +5665,10 @@ def write_output(transform_lines, transform_data, node_lines, nset_blocks, mater
56505665 rho = properties ['rho' ]
56515666 poissrat = properties ['poissrat' ]
56525667 uniaxial_data = properties ['uniaxial_data' ]
5668+ longterm = properties ['longterm' ]
56535669 # Write the card format for materials with foam uniaxial properties
5654- write_hypfua_material (material_id , material_name , rho , poissrat , uniaxial_data ,
5655- output_file
5670+ write_hypfua_material (material_id , material_name , rho , poissrat , longterm ,
5671+ uniaxial_data , output_file
56565672 )
56575673
56585674 #MAT LAW71
@@ -5946,7 +5962,8 @@ def write_output(transform_lines, transform_data, node_lines, nset_blocks, mater
59465962 print (f"Total Processing time: { elapsed_time :8.3f} seconds" )
59475963
59485964 if ppmselect :
5949- print ("INFO: PrePoMax Internal Select detected, part/prop assignment incomplete" )
5965+ print ("INFO: Some properties not recognised or assigned, part/prop assignment incomplete" )
5966+ print (" If using PrePoMax 'Internal Select':" )
59505967 print (" please correct PART IDs for elements in rad file or return to PPM" )
59515968 print (" and assign properties by Part instead of 'Selection'" )
59525969
0 commit comments