Fracture Analysis: SMART Crack Growth

In this example, using the support files, you will insert a Static Structural analysis object into an undefined Mechanical session and execute a sequence of python journal commands that will define and solve the analysis.

This example begins in the Mechanical application. It requires you to download the following files.

  • SMART Crack Growth_Example_033.cdb

  • SMART Crack Growth_Example_033.py

  • SMART Crack Growth_Example_033.xml

These files are available here.

Procedure

  1. Open Workbench and insert a External Model system from the Component System category of the Toolbox and place it in the Project Schematic.

  2. Double-click the Setup cell to open the workspace.

  3. Select the option in the Location column to open a dialog. Navigate to the proper folder location and select SMART Crack Growth_Example_033.cdb.

     

  4. Set the Unit System property to Consistent NMM.

     

  5. Return to the Project tab and insert a Static Structural system into the Project Schematic.

  6. Double-click the Engineering Data cell to open the workspace.

  7. Select File > Import Engineering Data, navigate to the proper folder location and select SMART Crack Growth_Example_033.xml.

  8. Return to the Project tab. Link the Setup cell of the External Model system to the Model cell of the static analysis.

     

  9. Select the Model cell of the static system and display the properties. Set the following properties:

    • Unit Length = mm

    • Object Renaming = Based on Cell ID

     

  10. Right-click the Model cell and first select Update Upstream Components option and then select Refresh option.

  11. Open Mechanical. Right-click the Model cell and select Edit.

  12. Select the Automation tab and select the Scripting option to open the Mechanical Scripting pane.

  13. Select the Open Script option ( ) from the Editor toolbar. Navigate to the proper folder location and select SMART Crack Growth_Example_033.py.

  14. Select the Run Script option ( ) from the Editor toolbar.

Scripts Illustrated

In this example, the python file automatically performs the following actions:

# Scenario 1 Store main Tree Object items
MODEL = Model
GEOMETRY = Model.Geometry
BODY = [x for x in ExtAPI.DataModel.Tree.AllObjects if x.Name == 'Solid Body 1(A2)'][0]

MAT_GRP = MODEL.Materials
MAT_BODY = [i for i in MAT_GRP.GetChildren[Ansys.ACT.Automation.Mechanical.Material](True) if i.Name == 'MAT1'][0]

COORDINATE_SYSTEMS = Model.CoordinateSystems
GLOBAL_COORDINATE_SYSTEM = [i for i in COORDINATE_SYSTEMS.GetChildren[Ansys.ACT.Automation.Mechanical.CoordinateSystem](True) if i.Name == 'Global Coordinate System'][0]

MESH = Model.Mesh

NAMED_SELECTIONS = ExtAPI.DataModel.Project.Model.NamedSelections
NS_CRACK = [i for i in NAMED_SELECTIONS.GetChildren[Ansys.ACT.Automation.Mechanical.NamedSelection](True) if i.Name == 'CRACK1(A2)'][0]
NS_CRACK_SUR01 = [i for i in NAMED_SELECTIONS.GetChildren[Ansys.ACT.Automation.Mechanical.NamedSelection](True) if i.Name == 'CRACKT_SUR_01(A2)'][0]
NS_CRACK_SUR02 = [i for i in NAMED_SELECTIONS.GetChildren[Ansys.ACT.Automation.Mechanical.NamedSelection](True) if i.Name == 'CRACKT_SUR_02(A2)'][0]
NS_LOAD01 = [i for i in NAMED_SELECTIONS.GetChildren[Ansys.ACT.Automation.Mechanical.NamedSelection](True) if i.Name == 'LOAD1(A2)'][0]
NS_LOAD02 = [i for i in NAMED_SELECTIONS.GetChildren[Ansys.ACT.Automation.Mechanical.NamedSelection](True) if i.Name == 'LOAD2(A2)'][0]
NS_SUPPORT01 = [i for i in NAMED_SELECTIONS.GetChildren[Ansys.ACT.Automation.Mechanical.NamedSelection](True) if i.Name == 'SUPPORT1(A2)'][0]
NS_SUPPORT02 = [i for i in NAMED_SELECTIONS.GetChildren[Ansys.ACT.Automation.Mechanical.NamedSelection](True) if i.Name == 'SUPPORT2(A2)'][0]

STATIC_STRUCTURAL = ExtAPI.DataModel.AnalysisByName("Static Structural")
ANALYSIS_SETTINGS = STATIC_STRUCTURAL.AnalysisSettings
SOLUTION= STATIC_STRUCTURAL.Solution

# Scenario 2 Set Display Unit
ExtAPI.Application.ActiveUnitSystem = MechanicalUnitSystem.StandardNMM

# Scenario 3 Assign Material
BODY.Activate()
BODY.Material = MAT_BODY.Name

# Scenario 4 Rename imported Named Selections
NS_CRACK.Activate()
NS_CRACK.ReadOnly = False
NS_CRACK.Name= "Crack_Front_Nodes"

NS_CRACK_SUR01.Activate()
NS_CRACK_SUR01.ReadOnly = False
NS_CRACK_SUR01.Name= "Crack_TF_Nodes"

NS_CRACK_SUR02.Activate()
NS_CRACK_SUR02.ReadOnly = False
NS_CRACK_SUR02.Name= "Crack_BF_Nodes"

NS_LOAD01.Activate()
NS_LOAD01.ReadOnly = False
NS_LOAD01.Name= "Load_Nodes"

NS_LOAD02.Activate()
NS_LOAD02.ReadOnly = False
NS_LOAD02.Name= "Load2_Nodes"

NS_SUPPORT01.Activate()
NS_SUPPORT01.ReadOnly = False
NS_SUPPORT01.Name= "Support_Nodes"

NS_SUPPORT02.Activate()
NS_SUPPORT02.ReadOnly = False
NS_SUPPORT02.Name= "Support2_Nodes"

# Scenario 5 Add worksheet based Nodal Named Selection
NAMED_SELECTIONS.Activate()
NS_SUPPORT03 = NAMED_SELECTIONS.AddNamedSelection()
NS_SUPPORT03.ScopingMethod=GeometryDefineByType.Worksheet
NS_SUPPORT03.Name = "Support3_Nodes"

GEN_CRT1 = NS_SUPPORT03.GenerationCriteria
CRT1 = Ansys.ACT.Automation.Mechanical.NamedSelectionCriterion()
CRT1.Active=True
CRT1.Action=SelectionActionType.Add
CRT1.EntityType=SelectionType.MeshNode
CRT1.Criterion=SelectionCriterionType.LocationZ
CRT1.Operator=SelectionOperatorType.Equal
CRT1.Value=Quantity('0 [mm]')
GEN_CRT1.Add(CRT1)

CRT2 = Ansys.ACT.Automation.Mechanical.NamedSelectionCriterion()
CRT2.Active=True
CRT2.Action=SelectionActionType.Add
CRT2.EntityType=SelectionType.MeshNode
CRT2.Criterion=SelectionCriterionType.LocationZ
CRT2.Operator=SelectionOperatorType.Equal
CRT2.Value=Quantity('-12 [mm]')
GEN_CRT1.Add(CRT2)

NS_SUPPORT03.Activate()
NS_SUPPORT03.Generate()

# Scenario 6 Add Pre-Meshed Crack object
MODEL.Activate()
FRACTURE = MODEL.AddFracture()

FRACTURE.Activate()
PRE_MESHED_CRACK = FRACTURE.AddPreMeshedCrack()
PRE_MESHED_CRACK.CrackFront=NS_CRACK
PRE_MESHED_CRACK.CrackFacesNodes= True
PRE_MESHED_CRACK.TopFaceNodes=NS_CRACK_SUR01
PRE_MESHED_CRACK.BottomFaceNodes=NS_CRACK_SUR02
PRE_MESHED_CRACK.CoordinateSystem = GLOBAL_COORDINATE_SYSTEM
PRE_MESHED_CRACK.SolutionContours = 5
PRE_MESHED_CRACK.CrackSymmetry = False
  
# Scenario 7 Add SMART Crack Growth object
FRACTURE.Activate()
SMART_CRACK_GROWTH = FRACTURE.AddSMARTCrackGrowth()
SMART_CRACK_GROWTH.InitialCrack = PRE_MESHED_CRACK
SMART_CRACK_GROWTH.CrackGrowthOption = CrackGrowthOption.Fatigue
SMART_CRACK_GROWTH.Material = MAT_BODY.Name
SMART_CRACK_GROWTH.CrackGrowthMethodology = CrackGrowthMethodology.LifeCyclePrediction
SMART_CRACK_GROWTH.MaxIncrementOfCrackExtension = CrackGrowthIncrementType.Manual
SMART_CRACK_GROWTH.MaxIncrementValue = Quantity('0.5 [mm]')
SMART_CRACK_GROWTH.StressRatio = 0

# Scenario 8 Define Analysis Settings
ANALYSIS_SETTINGS.Activate()
ANALYSIS_SETTINGS.AutomaticTimeStepping=AutomaticTimeStepping.Off
ANALYSIS_SETTINGS.DefineBy=TimeStepDefineByType.Substeps
ANALYSIS_SETTINGS.NumberOfSubSteps = 6
ANALYSIS_SETTINGS.JIntegral = False

# Scenario 9 Define boundary conditions
STATIC_STRUCTURAL.Activate()
NODAL_DISPLACEMENT01 = STATIC_STRUCTURAL.AddNodalDisplacement()
NODAL_DISPLACEMENT01.Location = NS_SUPPORT01
NODAL_DISPLACEMENT01.YComponent.Output.DiscreteValues = [Quantity('0 [mm]')]

STATIC_STRUCTURAL.Activate()
NODAL_DISPLACEMENT02 = STATIC_STRUCTURAL.AddNodalDisplacement()
NODAL_DISPLACEMENT02.Location = NS_SUPPORT02
NODAL_DISPLACEMENT02.XComponent.Output.DiscreteValues = [Quantity('0 [mm]')]

STATIC_STRUCTURAL.Activate()
NODAL_DISPLACEMENT03 = STATIC_STRUCTURAL.AddNodalDisplacement()
NODAL_DISPLACEMENT03.Location = NS_SUPPORT03
NODAL_DISPLACEMENT03.ZComponent.Output.DiscreteValues = [Quantity('0 [mm]')]

STATIC_STRUCTURAL.Activate()
NODAL_FORCE01 = STATIC_STRUCTURAL.AddNodalForce()
NODAL_FORCE01.Location = NS_LOAD01
NODAL_FORCE01.YComponent.Output.DiscreteValues = [Quantity('450 [N]')]

STATIC_STRUCTURAL.Activate()
NODAL_FORCE02 = STATIC_STRUCTURAL.AddNodalForce()
NODAL_FORCE02.Location = NS_LOAD02
NODAL_FORCE02.YComponent.Output.DiscreteValues = [Quantity('-450 [N]')]

# Scenario 10 Add Deformation and Fracture specific results
SOLUTION.Activate()
TOTAL_DEFORMATION = SOLUTION.AddTotalDeformation()

SOLUTION.Activate()
FRACTURE_TOOL = SOLUTION.AddFractureTool()
FRACTURE_TOOL.CrackSelection = PRE_MESHED_CRACK

SIFS_K1 = [i for i in FRACTURE_TOOL.GetChildren[Ansys.ACT.Automation.Mechanical.Results.FractureToolResults.FractureToolResult](True) if i.Name == 'SIFS (K1)'][0]

SIFS_K1.Activate()
SIFS_K1.ActiveContourEnd = 5

FRACTURE_TOOL.Activate()
CRACK_EXTENSION_PROBE01 = FRACTURE_TOOL.AddCrackExtensionProbe()
CRACK_EXTENSION_PROBE01.CrackLengthPercentage = 0

CRACK_EXTENSION_PROBE02 = CRACK_EXTENSION_PROBE01.Duplicate()
CRACK_EXTENSION_PROBE02.CrackLengthPercentage = 100

FRACTURE_TOOL.Activate()
NUM_OF_CYCLES_PROBE01 = FRACTURE_TOOL.AddNumberOfCyclesProbe()
NUM_OF_CYCLES_PROBE01.CrackLengthPercentage = 0

NUM_OF_CYCLES_PROBE02 = NUM_OF_CYCLES_PROBE01.Duplicate()
NUM_OF_CYCLES_PROBE02.CrackLengthPercentage = 100

FRACTURE_TOOL.Activate()
EQV_SIFS_RANGE_PROBE01 = FRACTURE_TOOL.AddEquivalentSIFSRangeProbe()
EQV_SIFS_RANGE_PROBE01.CrackLengthPercentage = 0

EQV_SIFS_RANGE_PROBE02 = EQV_SIFS_RANGE_PROBE01.Duplicate()
EQV_SIFS_RANGE_PROBE02.CrackLengthPercentage = 100

# Scenario 11 Solve and review Results
STATIC_STRUCTURAL.Activate()
STATIC_STRUCTURAL.Solve(True)

TOTAL_DEFORMATION.Activate()
MAX_TOTAL_DEFORMATION = TOTAL_DEFORMATION.Maximum.Value

CRACK_EXTENSION_PROBE01.Activate()
MIN_VOT_CRACK_EXT_P01 = CRACK_EXTENSION_PROBE01.MinimumValueOverTime.Value
MAX_VOT_CRACK_EXT_P01 = CRACK_EXTENSION_PROBE01.MaximumValueOverTime.Value

CRACK_EXTENSION_PROBE02.Activate()
MIN_VOT_CRACK_EXT_P02 = CRACK_EXTENSION_PROBE02.MinimumValueOverTime.Value
MAX_VOT_CRACK_EXT_P02 = CRACK_EXTENSION_PROBE02.MaximumValueOverTime.Value

NUM_OF_CYCLES_PROBE01.Activate()
MIN_VOT_NUM_CYC_P01 = NUM_OF_CYCLES_PROBE01.MinimumValueOverTime
MAX_VOT_NUM_CYC_P01 = NUM_OF_CYCLES_PROBE01.MaximumValueOverTime

NUM_OF_CYCLES_PROBE02.Activate()
MIN_VOT_NUM_CYC_P02 = NUM_OF_CYCLES_PROBE02.MinimumValueOverTime
MAX_VOT_NUM_CYC_P02 = NUM_OF_CYCLES_PROBE02.MaximumValueOverTime

EQV_SIFS_RANGE_PROBE01.Activate()
MIN_VOT_EQV_SIFS_RANGE_P01 = EQV_SIFS_RANGE_PROBE01.MinimumValueOverTime.Value
MAX_VOT_EQV_SIFS_RANGE_P01 = EQV_SIFS_RANGE_PROBE01.MaximumValueOverTime.Value

EQV_SIFS_RANGE_PROBE02.Activate()
MIN_VOT_EQV_SIFS_RANGE_P02 = EQV_SIFS_RANGE_PROBE02.MinimumValueOverTime.Value
MAX_VOT_EQV_SIFS_RANGE_P02 = EQV_SIFS_RANGE_PROBE02.MaximumValueOverTime.Value

Summary

This example demonstrates how scripting in Mechanical can be used to automate your actions.