How To: Simulation Scenarios¶
Simulation Setup¶
Scenario Setup using
ScenarioDescriptorLinear Elasticity scenario is created using
LinearElasticScenarioDescriptor. It takes the following inputs:boundary_conditions, a list of boundary conditionsinternal_conditions, a list of internal conditions (body loads)
Scenario Metadata,
metadata, a set of solver parameters to control the accuracy and speed of the simulation:resolutionis the target number of finite elements. An iterative process determines acell_sizethat achieves approximately the specified number of elements. You can directly specify thecell_sizeinstead ofresolution. Note that decreasingcell_sizecan quickly result in large numbers of finite elements and long solve times.resolutionis recommended for most cases.unitssets the unit of the scenario (geometry and results will be in this unit) for example, a geometry in ‘MKS’ that is 6 m long would be 6 mm long when set to ‘MMS’.basis_orderis the type of finite element used. The default is 1, which would be linear elements. 2 is for quadratic elements.solver_typeis the solver type used in the simulation with the following options:MKL_PardisoLDLT(default) is the direct solver and is typically faster for lower resolution (< 200K cells on 32 GB memory), but gets slower and consumes more memory at higher resolutionsAMGCL_amg_rigid_bodyis the iterative solver which is typically faster at high resolution.
scenario = LinearElasticScenarioDescriptor() scenario.materials = {"Aluminum 6061-T6": material} scenario.boundary_conditions = [fixed_boundary, vector_load, torque_load] scenario.internal_conditions = [body_load] scenario.metadata.resolution = 10000 scenario.metadata.units = UnitSystem.MeterKilogramSecond # Optional settings scenario.metadata.basis_order = 2 # 2 = quadratic elements scenario.metadata.solver_override = Solver.AMGCL_amg_rigid_body # iterative solver
Similarly, Modal scenario is created using
ModalScenarioDescriptorwhich takesboundary_conditions, a list of boundary conditions, as input.The
metadatais the same as for the linear elastic scenario except there is necessary inputmodal_metadata.desired_eigenvaluesthat takes in an integer for the number of eigenvalues.
# Setup the modal simulation scenario modal_scenario = ModalScenarioDescriptor() modal_scenario.materials = {"Aluminum 6061-T6": material} modal_scenario.boundary_conditions = [fixed_boundary] modal_scenario.metadata.resolution = 10000 modal_scenario.modal_metadata.desired_eigenvalues = 10 # Optional settings modal_scenario.metadata.basis_order = 2 # 2 = quadratic elements modal_scenario.metadata.solver_override = Solver.AMGCL_amg_rigid_body #iterative solver
Similarly, Linear Buckling scenario is created using
LinearBucklingScenarioDescriptorwhich takesboundary_conditions, a list of boundary conditions, as input. A linear buckling scenario first performs a linear elasticity simulation, and then solves a generalized eigenvalue problem to determine the critical load factors.The
metadatais the same as for the linear elastic scenario except there is necessary inputbuckling_metadata.desired_eigenvaluesthat takes in an integer for the number of eigenvalues.
# Setup the linear buckling simulation scenario buckling_scenario = LinearBucklingScenarioDescriptor() buckling_scenario.materials = {"Aluminum 6061-T6": material} buckling_scenario.boundary_conditions = [fixed_boundary] buckling_scenario.metadata.resolution = 10000 # Generally, the first critical load factor from a buckling analysis is most useful, # a small number of additional buckling modes may be useful to examine. buckling_scenario.buckling_metadata.desired_eigenvalues = 3 # Optional settings buckling_scenario.metadata.basis_order = 2 # 2 = quadratic elements # Use iterative solver for the linear elasticity simulation buckling_scenario.metadata.solver_override = Solver.AMGCL_amg_rigid_body
Similarly, a Thermal scenario is created using
StaticThermalScenarioDescriptorwhich takes a list ofboundary_conditionsand a list ofinternal_conditionsas input. Note that thematerialmust be a thermal material for this scenario type.The
metadatais the same as for the linear elastic scenario with additional inputthermal_metadata.environment_temperaturewhich specifies the temperature of the environment.
# Setup the thermal simulation scenario thermal_scenario = StaticThermalScenarioDescriptor() thermal_scenario.materials = {"Aluminum 6061-T6": material} thermal_scenario.boundary_conditions = [fixed_temp, convection] thermal_scenario.internal_conditions = [constant_heat] thermal_scenario.thermal_metadata.environment_temperature = 300.0 thermal_scenario.metadata.resolution = 10000 # Optional settings thermal_scenario.metadata.basis_order = 2 # 2 = quadratic elements thermal_scenario.metadata.solver_override = Solver.AMGCL_amg # iterative solver
A Thermoelasticity scenario is created by creating a thermal scenario, solving the thermal simulation, then creating a linear elasticity scenario, and solving it:
RESOLUTION = 10000 # Setup the thermal simulation scenario thermal_scenario = StaticThermalScenarioDescriptor() thermal_scenario.materials = {"Aluminum 6061-T6": material} thermal_scenario.boundary_conditions = [fixed_temp, convection] thermal_scenario.internal_conditions = [constant_heat] thermal_scenario.thermal_metadata.environment_temperature = 300.0 thermal_scenario.metadata.resolution = RESOLUTION # Solve the thermal scenario thermal_simulator = StaticThermalSimulator(assembly, thermal_scenario) thermal_simulator.solve() # Setup the linear elastic simulation scenario scenario = LinearElasticScenarioDescriptor() scenario.materials = {"Aluminum 6061-T6": material} scenario.boundary_conditions = [fixed_boundary, vector_load, torque_load] scenario.internal_conditions = [body_load] scenario.metadata.resolution = RESOLUTION # Solve the thermo linear elastic scenario simulator = StressSimulator(assembly, scenario, thermal_simulator) simulator.solve()
Note
For best results, the thermal scenario resolution should be the same or less than the stress scenario resolution. Using the same resolution ensures that the thermal fields are defined every where the stress simulation will be performed.
Note
Ensure that the material used for the thermal scenario has an expansion coefficient defined, so the calculated thermal field can be used in the linear elasticity scenario to determine the thermally induced strain.
Simulation Solution¶
Stress Simulation is created using
StressSimulator. It takes the following inputs:An
assemblyor the list ofMaterialDomainsLinearElasticScenarioDescriptorthat describes the simulation scenario
# Initialize and run the linear elastic scenario simulator = StressSimulator(assembly, scenario) simulator.solve()
Modal Simulation is created using
ModalSimulator. It takes the following inputs:An
assemblyor the list ofMaterialDomainsModalScenarioDescriptorthat describes the simulation scenario
# Initialize and run the modal scenario modal_simulator = ModalSimulator(assembly, modal_scenario) modal_simulator.solve()
Linear Buckling Simulation is created using
LinearBucklingSimulator. It takes the following inputs:An
assemblyor the list ofMaterialDomainsLinearBucklingScenarioDescriptorthat describes the simulation scenario
# Initialize and run the linear buckling scenario buckling_simulator = LinearBucklingSimulator(assembly, buckling_scenario) buckling_simulator.solve()
Static Thermal Simulation is created using
StaticThermalSimulator. It takes the following inputs:An
assemblyor the list ofMaterialDomainsStaticThermalScenarioDescriptorthat describes the simulation scenario
# Initialize and run the static thermal scenario thermal_simulator = StaticThermalSimulator(assembly, thermal_scenario) thermal_simulator.solve()