How To: Simulation Scenarios

Simulation Setup

  • Scenario Setup using ScenarioDescriptor

    • Linear Elasticity scenario is created using LinearElasticScenarioDescriptor. It takes the following inputs:

      • boundary_conditions, a list of boundary conditions

      • internal_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:

      • resolution is the target number of finite elements. An iterative process determines a cell_size that achieves approximately the specified number of elements. You can directly specify the cell_size instead of resolution. Note that decreasing cell_size can quickly result in large numbers of finite elements and long solve times. resolution is recommended for most cases.

      • units sets 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_order is the type of finite element used. The default is 1, which would be linear elements. 2 is for quadratic elements.

      • solver_type is 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 resolutions

        • AMGCL_amg_rigid_body is 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 ModalScenarioDescriptor which takes boundary_conditions, a list of boundary conditions, as input.

      • The metadata is the same as for the linear elastic scenario except there is necessary input modal_metadata.desired_eigenvalues that 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 LinearBucklingScenarioDescriptor which takes boundary_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 metadata is the same as for the linear elastic scenario except there is necessary input buckling_metadata.desired_eigenvalues that 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 StaticThermalScenarioDescriptor which takes a list of boundary_conditions and a list of internal_conditions as input. Note that the material must be a thermal material for this scenario type.

      • The metadata is the same as for the linear elastic scenario with additional input thermal_metadata.environment_temperature which 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 assembly or the list of MaterialDomains

    • LinearElasticScenarioDescriptor that 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 assembly or the list of MaterialDomains

    • ModalScenarioDescriptor that 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 assembly or the list of MaterialDomains

    • LinearBucklingScenarioDescriptor that 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 assembly or the list of MaterialDomains

    • StaticThermalScenarioDescriptor that describes the simulation scenario

    # Initialize and run the static thermal scenario
    thermal_simulator = StaticThermalSimulator(assembly, thermal_scenario)
    thermal_simulator.solve()