def setup_odb_files(odb_file_name, parts, element_set_name='tooth_root_volume_elements'): model_file = '../planetary_gear/input_files/gear_models/planet_gear/mesh_' + mesh + '/mesh_planet.inc' quarter_nodes, quarter_elements = create_quarter_model(model_file) model_data = [(quarter_nodes, quarter_elements)] quarter_nodes, quarter_elements = mirror_quarter_model( quarter_nodes, quarter_elements) model_data.append((quarter_nodes, quarter_elements)) part_names = ['left', 'right'] instances = [] for i in range(parts): instances.append( OdbInstance(name='tooth_' + part_names[i], nodes=model_data[i][0], elements=model_data[i][1])) create_odb(odb_file_name=odb_file_name, instance_data=instances) element_labels = get_list_from_set_file( '../planetary_gear/input_files/gear_models/planet_gear/mesh_' + mesh + '/' + element_set_name + '.inc') for i in range(parts): add_element_set(odb_file_name, element_set_name, element_labels, 'tooth_' + part_names[i])
input_file_name = '/scratch/users/erik/python_fatigue/fatigue_specimens/UTMIS/utmis_' + specimen + \ '/utmis_' + specimen + '.inc' nodes_pos, elements_pos = read_nodes_and_elements(input_file_name) nodes_neg, elements_neg = read_nodes_and_elements(input_file_name) nodes_neg[:, 2] *= -1 elements_neg[:, 1: 5], elements_neg[:, 5: 9] = elements_pos[:, 5: 9], elements_pos[:, 1: 5].copy( ) instances = [ OdbInstance(name='specimen_part_pos', nodes=nodes_pos, elements=elements_pos), OdbInstance(name='specimen_part_neg', nodes=nodes_neg, elements=elements_neg) ] odb_file_name = dante_odb_path + 'utmis_' + specimen + '_half.odb' create_odb(odb_file_name=odb_file_name, instance_data=instances) simulation_odb = os.path.expanduser( '~/scania_gear_analysis/utmis_specimens_U925062/utmis_' + specimen + '_tempering_2h_' + str(tempering[0]) + '_cooldown_80C/' + specimen_name + '_' + name + '/Toolbox_Mechanical_utmis_' + specimen + '.odb') create_dante_step(simulation_odb, odb_file_name,
if __name__ == '__main__': odb_directory = os.path.expanduser( '~/scania_gear_analysis/odb_files/planet_gear/mesh_1x/') torque = int(sys.argv[-1]) input_file_name = '/scratch/users/erik/python_fatigue/planetary_gear/' \ 'input_files/planet_sun/planet_dense_geom_xpos.inc' nodes_pos, elements_pos = read_nodes_and_elements(input_file_name) input_file_name = '/scratch/users/erik/python_fatigue/planetary_gear/' \ 'input_files/planet_sun/planet_dense_geom_xneg.inc' nodes_neg, elements_neg = read_nodes_and_elements(input_file_name) instances = [ OdbInstance(name='tooth_right', nodes=nodes_pos, elements=elements_pos), OdbInstance(name='tooth_left', nodes=nodes_neg, elements=elements_neg) ] tooth_odb_file_name = '/scratch/users/erik/scania_gear_analysis/odb_files/planet_gear/mesh_1x/' \ 'planet_gear_stresses_' + str(torque) + '_Nm.odb' create_odb(odb_file_name=tooth_odb_file_name, instance_data=instances) # Importing stress history from the planet-sun simulations simulation_odb_name = odb_directory + 'planet_sun_' + str( torque) + '_Nm.odb' transfer_gear_stresses(simulation_odb_name, tooth_odb_file_name) simulation_odb_name = odb_directory + 'planet_ring_' + str( torque) + '_Nm.odb'
for load in loads: step_name = 'Pamp_' + str(load).replace('.', '_') + 'kN' frames.append(Frame(step=step_name + '_min', number=-1, time=0)) frames.append(Frame(step=step_name + '_max', number=-1, time=1)) for frame in frames: process = Popen('abaqus viewer noGUI=_copy_pulsator_stress.py -- ' + from_odb_name + ' ' + to_odb_name + ' ' + frame.step + ' ' + str(frame.number) + ' ' + frame.step[:-4], cwd=os.getcwd(), shell=True) process.wait() if __name__ == '__main__': input_file_name = '/scratch/users/erik/python_fatigue/planetary_gear/' \ 'input_files/planet_sun/planet_dense_geom_xneg.inc' nodes_neg, elements_neg = read_nodes_and_elements(input_file_name) instances = [ OdbInstance(name='tooth_left', nodes=nodes_neg, elements=elements_neg) ] tooth_odb_file_name = '/scratch/users/erik/scania_gear_analysis/odb_files/pulsator/mesh_1x/pulsator_stresses.odb' create_odb(odb_file_name=tooth_odb_file_name, instance_data=instances) # Importing stress history from the planet-sun simulations simulation_odb_name = '/scratch/users/erik/scania_gear_analysis/odb_files/pulsator/mesh_1x/pulsator_simulation.odb' transfer_gear_stresses(simulation_odb_name, tooth_odb_file_name)
hv = HRC2HV(data_dict['SDV_HARDNESS']) write_field_to_odb(field_data=hv, field_id='HV', odb_file_name=to_odb_name, step_name=results_step_name, instance_name='specimen_part', frame_number=0) if __name__ == '__main__': dante_odb_path = '/scratch/users/erik/scania_gear_analysis/odb_files/heat_treatment/utmis_specimens/' if not os.path.isdir(dante_odb_path): os.makedirs(dante_odb_path) for specimen in ['smooth', 'notched']: input_file_name = '/scratch/users/erik/python_fatigue/fatigue_specimens/UTMIS/utmis_' + specimen + \ '/utmis_' + specimen + '.inc' nodes, elements = read_nodes_and_elements(input_file_name) instances = [ OdbInstance(name='specimen_part', nodes=nodes, elements=elements) ] odb_file_name = dante_odb_path + 'utmis_' + specimen + '_oil60.odb' create_odb(odb_file_name=odb_file_name, instance_data=instances) for carb, temp in [(0.75, 180), (0.8, 180), (0.8, 200)]: simulation_odb = '/scratch/users/erik/scania_gear_analysis/abaqus/utmis_' + specimen + \ '_tempering_2h_' + str(temp) + 'C/' 'utmis_' + specimen + '_oil60_' + \ str(carb).replace('.', '_') + 'C/Toolbox_Mechanical_utmis_' + specimen + '.odb' create_dante_step( simulation_odb, odb_file_name, 'dante_results_tempering_2h_' + str(temp) + '_' + str(carb).replace('.', '_') + 'C')
return dv / 300 if __name__ == '__main__': mesh = '1x' dante_odb_filename = '/scratch/users/erik/scania_gear_analysis/odb_files/heat_treatment/mesh_' + \ mesh + '/dante_results.odb' expansion_odb_filename = '/scratch/users/erik/scania_gear_analysis/odb_files/heat_treatment/mesh_' + \ mesh + '/expansion.odb' input_file_name = '/scratch/users/erik/python_fatigue/planetary_gear/' \ 'input_files/planet_sun/planet_dense_geom_xpos.inc' nodes_pos, elements_pos = read_nodes_and_elements(input_file_name) instances = [ OdbInstance(name='PART-1-1', nodes=nodes_pos, elements=elements_pos) ] create_odb(odb_file_name=expansion_odb_filename, instance_data=instances) fields_to_process = [ 'SDV_Q_MARTENSITE', 'SDV_CARBON', 'SDV_AUSTENITE', 'SDV_LBAINITE', 'SDV_UBAINITE' ] for cd in [0.5, 0.8, 1.1, 1.4]: dante_step_name = 'dante_results_' + str(cd).replace('.', '_') node_data = create_node_field_from_element_field( fields_to_process, dante_odb_filename, None, dante_step_name, 0, 'tooth_right') for field_id, data in node_data.iteritems(): write_field_to_odb(data,