3. Usage Reference¶
As ACCS is completely integrated within ANSYS Workbench, one simply needs to run Workbench to have access to it. For step-by-step tutorials, please refer to the Workshops section.
3.1. Workflow¶
A typical Workbench ACCS workflow for composite structures looks as follows:
The material properties are defined in the Engineering Data module. A shell model is generated in DesignModeler or in SpaceClaim or in any other CAD tool, then it is worked out in ACP (Pre) module to build a solid finite element model of the composite structure that will be transferred to the “Transient Thermal” module where the temperature distribution will be computed throughout the cure cycle for every element as well as the degree of cure, the state of the material, the glass transition temperature and the instantaneous heat of reaction. The temperature distribution is then transferred to the “Static Structural” module where the distortions will be computed using the previously computed temperature and the material properties.
3.2. Material Definition¶
The first task in the modeling of the cure process with ACCS is to correctly define the material properties. In the list of Materials (Fig. 3.2), the basic material properties that the user should start with are the Thermoset - Cure Kinetics Model [first five Properties ended with “Equation”]. The Resin properties, Total Heat of Reaction and the ACCS Common properties will be included automatically. The user can then include a diffusion limitation formulation (Proportional Diffusion Limitation or Parallel Diffusion Limitation). Now the user must choose one of the two ways to define the ply material. The first one is defining the ply material using separate fiber and matrix properties, which in this case all the properties enclosed by a black rectangle must be included (adding one will include the other relevant properties). The second way is to define the ply material using homogenized lamina properties. In this case the Isotropic or Orthotropic properties must be included (adding one will also include the other relevant properties). All the first four properties of the “ACCS-Thermoset-Thermal” list will also be included automatically. Optionally, the user may want to include visco-elastic effects. To do so, the user can include one of the available models in its Isotropic or Orthotropic formulation (in light green). Adding one will include the other relevant properties. Including the “Liquid Time Shift”, “Rubbery Time Shift” and “Glassy Time Shift” properties will allow to take into effect temperature and/or degree of cure time shifts.
For the PEEK Crystallization model, the user has to introduce all of the thermoplastics properties and all of the fibre properties. When the PEEK Crystallization Model is introduced in the Engineering Data, all the rest of the thermoplastic material properties (Thermal and Mechanical) will be automatically included into the material definition. For more detail about this crystallization model, please refer to its section in the theory documentation.
Note
The automatic inclusion of properties is only available for Engineering Data cells connected to an “ACP (Pre)” module, an ANSYS thermal module or an ANSYS structural module.
Warning
When opening in ANSYS 2021 R2 a project which was created with an earlier release of ACCS, the material properties must be updated. Simply click on the button .
Note
If in Engineering Data, the materials were introduced using the fibre/matrix formulation, the user can add equivalent glassy properties to fix some issues. Simply click on the button .
3.3. Adding the Cure Simulation Equations¶
The ACCS solution is also integrated within Mechanical and is therefore available in the Transient Thermal and Static Structural analysis systems in the form of an additional tab in the ribbon as show in the figure below.
Adding ACCS to the analysis invokes the ANSYS solver with chemical cure and cure shrinkage routines for materials with defined cure kinetics properties within the Engineering Data module. Once in Workbench Mechanical the user can initiate ACCS by clicking on the “Add Cure Simulation” button as shown in the figures below for the Transient Thermal and Static Structural modules.
3.4. Analysis Settings¶
When performing a Full Cure Simulation, the button “Copy Analysis Settings” allows the user to copy relevant analysis settings between two analyses easy and fast.
3.5. Support Remover¶
The lamination process usually involves the placing of composite layers over a mold. After the curing cycle is finished, the part is taken off the mold. Is in this phase of the process where the most relevant permanent deformations occur since the part is without the form constrictions. To simulate that step, ACCS has a boundary condition called “Support Remover” which delete every node that is scoped to it from it predefined displacement constraint. It is important to remark that the support remover is only needed for frictionless supports because you cannot enable/disable it per load step as other supports do.
3.6. Post-Processing Options¶
Including the ACCS feature into the analysis opens the possibility to add cure simulation specific post-processing options like Material State, Degree of Cure, Glass Transition Temperature and Cure Shrinkage in all cartesian directions. These options can be found by selecting the “Add Results” and the “Add Extra Results” buttons, as shown in the following image:
3.6.1. Material State¶
There are two main transitions that can be distinguished during the curing process of a thermosetting resin. The first one is gelation and the second one is vitrification occurring when the material Tg reaches the cure temperature
3.6.2. Degree of Cure¶
This result shows the develope of the curing reaction in the material domain. See Fig. 4.1 to see a the dependence of the degree of cure and the temperature in time.
3.6.3. Glass Transition Temperature¶
This result charecterizes the range of temepratures over chich the glass transition occurs.
3.6.4. Heat of Reaction¶
The Heat of Reaction is shown in the Thermoset domain and the plot shows the evolution of it in the time window.
Once the model is solved, the results can be reviewed by clicking on them. Here in the example, an exothermic reaction can be seen in the temperature profile. In many cases, the exothermic reaction a risk to the process. Excessive heat can cause inhomogeneous cure (check the Degree of Cure result) and can damage the structural materials (mainly the resin itself, but also polymeric sandwich cores; or heat-sensitive fibers, such as natural fibers), as well as the auxiliary materials (e.g. the vacuum bag).
3.7. Export Compensated Geometry¶
The export compensated geometry button adds an object which automatically compensates the process induced distortions for the selected faces. The process induced distortions (deformations) of the structural simulation are inverted and added to the nominal geometry. The compensated geometry can be exported as STL, RSO or point cloud. The options of the support remover are:
Output File Path: the file path where the file will be saved
Scoping Method and Geometry: the geometrical entities which will be exported
3.8. Scripting¶
The automatization suite of Mechanical also supports the scripting of the ACCS extension. The example below shows how the ACCS extension and module can be loaded into the scripting environment. Once loaded, the ACCS module can be used to activate the curing simulation, control the properties, add a support remover, add results plots etc.
An alternative is to use the recording to generate the script automatically.
3.8.1. Full cure simulation¶
Workbench journal script¶
# encoding: utf-8
Reset()
import os
directory = os.path.dirname(os.path.abspath(__file__))
cdb = os.path.join(directory,"C-shape.cdb")
script_full = os.path.join(directory,"test_scripting_full.py")
script_fast_MRCC = os.path.join(directory,"test_scripting_fast_MRCC.py")
script_fast_Tvst = os.path.join(directory,"test_scripting_fast_Tvst.py")
import ACCS_scripting
# Instantiating the project interface
ACCS_proj = ACCS_scripting.Project()
EngD_sys = GetTemplate(TemplateName="EngData").CreateSystem()
EngD_EngD = EngD_sys.GetContainer(ComponentName="Engineering Data")
for m in EngD_EngD.GetMaterials():
m.Delete()
EngD_fav = EngData.LoadFavoriteItems()
EngD_lib = EngData.OpenLibrary(Name="Cure Simulation",Source="ACCS_Library.xml")
AS4 = EngD_EngD.ImportMaterial(Name="AS4-8552",Source="ACCS_Library.xml")
AS4.SetAsDefaultSolidForModel()
AS4.SetAsDefaultFluidForModel()
EngD_engd = EngD_sys.GetComponent(Name="Engineering Data")
FEM_sys = GetTemplate(TemplateName="External Model").CreateSystem(Position="Below",RelativeTo=EngD_sys)
FEM_sys.GetContainer(ComponentName="Setup").AddDataFile(FilePath=cdb)
FEM_setup = FEM_sys.GetComponent(Name="Setup")
FEM_setup.Update(AllDependencies=True)
MaterialReleases = ACCS_proj.CheckMaterial()
if MaterialReleases!=None:
print("Materials need to be updated")
ACCS_proj.UpgradeMaterial()
ACCS_proj.HomogeneizeMaterial()
Th_tpl = GetTemplate(TemplateName="Transient Thermal",Solver="ANSYS")
Full_Th_sys = Th_tpl.CreateSystem(Position="Right",RelativeTo=FEM_sys)
Full_Th_sys.DisplayText = "Full - Transient Thermal"
Full_Th_engd = Full_Th_sys.GetComponent(Name="Engineering Data")
Full_Th_model = Full_Th_sys.GetComponent(Name="Model")
Full_Th_setup = Full_Th_sys.GetContainer(ComponentName="Setup")
Full_Th_solution = Full_Th_sys.GetComponent(Name="Solution")
Full_Th_engd.ReplaceWithShare(TargetSystem=Full_Th_sys,ComponentToShare=EngD_engd,SourceSystem=EngD_sys)
FEM_setup.TransferData(TargetComponent=Full_Th_model)
Transfer_tpl = GetComponentTemplate(Name="SimulationSetupCellTemplate_StructuralStaticANSYS")
St_tpl = GetTemplate(TemplateName="Static Structural",Solver="ANSYS")
Full_St_sys = St_tpl.CreateSystem(
ComponentsToShare=[Full_Th_engd, Full_Th_model],
DataTransferFrom=[Set(FromComponent=Full_Th_solution, TransferName=None, ToComponentTemplate=Transfer_tpl)],
Position="Right",
RelativeTo=Full_Th_sys)
Full_St_sys.DisplayText = "Full - Static Structural"
Full_St_setup = Full_Th_sys.GetContainer(ComponentName="Setup")
Full_Th_model.Update(AllDependencies=True)
Full_St_setup.Edit()
Full_St_setup.SendCommand(Command="WB.AppletList.Applet('DSApplet').App.Script.doToolsRunMacro(\""+re.escape(script_full)+"\")")
Mechanical journal script¶
directory = os.path.dirname(os.path.abspath(__file__))
RSO = os.path.join(directory,"C-shape.rso")
import ACCS_scripting
# Instantiating the mechanical interface
ACCS_mech = ACCS_scripting.Mechanical(ExtAPI)
LoadSteps = [15600, 20400, 20640]
CureCycle = [ [ 0., 20.],
[ 3000.,120.],
[ 6600.,120.],
[ 8400.,180.],
[15600.,180.],
[20400., 20.],
[23000., 20.]]
part = Model.Geometry.Children[0]
body = part.Children[0]
geoBody = body.GetGeoBody()
#Adding Named Selection: Body
NS_body = Model.AddNamedSelection()
NS_body.Name = r"Body"
NS_body.ScopingMethod = GeometryDefineByType.Worksheet
NS_body.GenerationCriteria.Add(None)
NS_body.GenerationCriteria[0].Action = SelectionActionType.Add
NS_body.GenerationCriteria[0].EntityType = SelectionType.GeoBody
NS_body.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_body.GenerationCriteria[0].Operator = SelectionOperatorType.Largest
NS_body.Generate()
#Adding Named Selection: Outer
NS_outer = Model.AddNamedSelection()
NS_outer.Name = r"Outer"
NS_outer.ScopingMethod = GeometryDefineByType.Worksheet
NS_outer.GenerationCriteria.Add(None)
NS_outer.GenerationCriteria[0].Action = SelectionActionType.Add
NS_outer.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_outer.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_outer.GenerationCriteria[0].Operator = SelectionOperatorType.Largest
NS_outer.Generate()
#Adding Named Selection: Inner
NS_inner = Model.AddNamedSelection()
NS_inner.Name = r"Inner"
NS_inner.ScopingMethod = GeometryDefineByType.Worksheet
NS_inner.GenerationCriteria.Add(None)
NS_inner.GenerationCriteria[0].Action = SelectionActionType.Add
NS_inner.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_inner.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_inner.GenerationCriteria[0].Operator = SelectionOperatorType.RangeInclude
NS_inner.GenerationCriteria[0].LowerBound = Quantity(0.001, 'm m')
NS_inner.GenerationCriteria[0].UpperBound = Quantity(0.0015, 'm m')
NS_inner.Generate()
#Adding Named Selection: Edge
NS_edge = Model.AddNamedSelection()
NS_edge.Name = r"Edge"
NS_edge.ScopingMethod = GeometryDefineByType.Worksheet
NS_edge.GenerationCriteria.Add(None)
NS_edge.GenerationCriteria[0].Action = SelectionActionType.Add
NS_edge.GenerationCriteria[0].EntityType = SelectionType.GeoEdge
NS_edge.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationZ
NS_edge.GenerationCriteria[0].Operator = SelectionOperatorType.LessThan
NS_edge.GenerationCriteria[0].Value = Quantity(0.001, 'm')
NS_edge.GenerationCriteria.Add(None)
NS_edge.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_edge.GenerationCriteria[1].EntityType = SelectionType.GeoEdge
NS_edge.GenerationCriteria[1].Criterion = SelectionCriterionType.Size
NS_edge.GenerationCriteria[1].Operator = SelectionOperatorType.RangeInclude
NS_edge.GenerationCriteria[1].LowerBound = Quantity(0.05, 'm')
NS_edge.GenerationCriteria[1].UpperBound = Quantity(0.06, 'm')
NS_edge.Generate()
#Adding Named Selection: DX
NS_DX = Model.AddNamedSelection()
NS_DX.Name = r"DX"
NS_DX.ScopingMethod = GeometryDefineByType.Worksheet
NS_DX.GenerationCriteria.Add(None)
NS_DX.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DX.GenerationCriteria[0].EntityType = SelectionType.GeoVertex
NS_DX.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationX
NS_DX.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DX.GenerationCriteria.Add(None)
NS_DX.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_DX.GenerationCriteria[1].EntityType = SelectionType.GeoVertex
NS_DX.GenerationCriteria[1].Criterion = SelectionCriterionType.LocationZ
NS_DX.GenerationCriteria[1].Operator = SelectionOperatorType.Smallest
NS_DX.Generate()
#Adding Named Selection: DY
NS_DY = Model.AddNamedSelection()
NS_DY.Name = r"DY"
NS_DY.ScopingMethod = GeometryDefineByType.Worksheet
NS_DY.GenerationCriteria.Add(None)
NS_DY.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DY.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_DY.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_DY.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DY.GenerationCriteria.Add(None)
NS_DY.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_DY.GenerationCriteria[1].EntityType = SelectionType.GeoFace
NS_DY.GenerationCriteria[1].Criterion = SelectionCriterionType.LocationX
NS_DY.GenerationCriteria[1].Operator = SelectionOperatorType.LessThan
NS_DY.GenerationCriteria[1].Value = Quantity(0.005, 'm')
NS_DY.Generate()
#Adding Named Selection: DZ
NS_DZ = Model.AddNamedSelection()
NS_DZ.Name = r"DZ"
NS_DZ.ScopingMethod = GeometryDefineByType.Worksheet
NS_DZ.GenerationCriteria.Add(None)
NS_DZ.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DZ.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_DZ.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationZ
NS_DZ.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DZ.Generate()
#Adding element orientation
EO = Model.Geometry.AddElementOrientation()
EO.BodyLocation = NS_body
EO.SurfaceLocation = NS_inner
EO.EdgeLocation = NS_edge
EO.AxisEdgeOrientation = EO.AxisEdgeOrientation.NegativeXAxis
###############################################################
#
# THERMAL ANALYSIS
#
###############################################################
TH_analysis = Model.Analyses[0]
TH_solution = TH_analysis.Solution
TH_analysis.InitialConditions[0].InitialTemperatureValue = Quantity(20,'C')
AS = TH_analysis.AnalysisSettings
AS.NumberOfSteps = len(LoadSteps)
for CSN in range(len(LoadSteps),0,-1):
AS.SetStepEndTime(CSN, Quantity(LoadSteps[CSN-1], "sec"))
AS.SetAutomaticTimeStepping(CSN, AutomaticTimeStepping.On)
AS.SetCarryOverTimeStep(CSN, AutomaticTimeStepping.On)
AS.SetInitialTimeStep(CSN, Quantity(120, "sec"))
AS.SetMinimumTimeStep(CSN, Quantity( 60, "sec"))
AS.SetMaximumTimeStep(CSN, Quantity(240, "sec"))
conv = TH_analysis.AddConvection()
conv.Location = NS_inner
conv.FilmCoefficient.Output.DiscreteValues = [Quantity(10, "W m^-1 m^-1 C^-1")]
conv.AmbientTemperature.Inputs[0].DiscreteValues = [Quantity(t[0], "s") for t in CureCycle]
conv.AmbientTemperature.Output.DiscreteValues = [Quantity(t[1], "C") for t in CureCycle]
TH_ACCS_ld = ACCS_mech.AddACCS(TH_analysis)
TH_temp = TH_solution.AddTemperature()
TH_ACCS_res_state = ACCS_mech.AddResultState(TH_analysis)
TH_ACCS_res_alpha = ACCS_mech.AddResultAlpha(TH_analysis)
TH_ACCS_res_Tg = ACCS_mech.AddResultTg(TH_analysis)
TH_ACCS_res_qdot = ACCS_mech.AddResultHeat(TH_analysis)
TH_solution.Solve(True)
###############################################################
#
# STRUCTURAL ANALYSIS
#
###############################################################
ST_analysis = Model.Analyses[1]
ST_solution = ST_analysis.Solution
ACCS_mech.CopyAnalysisSettings(TH_analysis, ST_analysis)
ST_importedload = ST_analysis.GetChildren(DataModelObjectCategory.ImportedBodyTemperature, True)[0]
ST_importedload.PropertyByName('PROPID_AnalysisTimeDefinition').InternalValue = 0
ST_frictionless = ST_analysis.AddFrictionlessSupport()
ST_frictionless.Location = NS_inner
ST_DX = ST_analysis.AddDisplacement()
ST_DX.Location = NS_DX
ST_DX.PropertyByName('ComponentX').InternalValue = 0
for CSN in range(0,len(LoadSteps)-1,+1):
ST_DX.SetActivateAtLoadStep(CSN+1,False)
for CSN in range(len(LoadSteps)-1,len(LoadSteps),+1):
ST_DX.SetActivateAtLoadStep(CSN+1,True)
ST_DX.Name = NS_DX.Name
ST_DY = ST_analysis.AddDisplacement()
ST_DY.Location = NS_DY
ST_DY.PropertyByName('ComponentY').InternalValue = 0
ST_DY.Name = NS_DY.Name
ST_DZ = ST_analysis.AddDisplacement()
ST_DZ.Location = NS_DZ
ST_DZ.PropertyByName('ComponentZ').InternalValue = 0
ST_DZ.Name = NS_DZ.Name
ST_ACCS_ld = ACCS_mech.AddACCS(ST_analysis)
ST_ACCS_ld.setAnalysisType('Full')
ST_ACCS_ld.setViscoElasticity('Disabled')
ST_ACCS_suprem = ACCS_mech.AddSupportRemover(ST_analysis)
ST_ACCS_suprem.setSurfacesByNamedSelection(NS_inner)
ST_ACCS_suprem.setStep(str(len(LoadSteps)))
ST_ACCS_surexp = ACCS_mech.AddSurfaceExporter(ST_analysis)
ST_ACCS_surexp.setSurfacesByNamedSelection(NS_outer)
ST_ACCS_surexp.setExportPath(RSO)
ST_TOTDEF = ST_solution.AddTotalDeformation()
ST_EPTHXX = ST_solution.AddThermalStrain()
ST_EPTHXX.NormalOrientation = NormalOrientationType.XAxis
ST_EPTHXX.Name = 'EPTHXX'
ST_EPTHYY = ST_solution.AddThermalStrain()
ST_EPTHYY.NormalOrientation = NormalOrientationType.YAxis
ST_EPTHYY.Name = 'EPTHYY'
ST_EPTHZZ = ST_solution.AddThermalStrain()
ST_EPTHZZ.NormalOrientation = NormalOrientationType.ZAxis
ST_EPTHZZ.Name = 'EPTHZZ'
ST_ACCS_res_state = ACCS_mech.AddResultState(ST_analysis)
ST_ACCS_res_alpha = ACCS_mech.AddResultAlpha(ST_analysis)
ST_ACCS_res_Tg = ACCS_mech.AddResultTg(ST_analysis)
ST_ACCS_res_qdot = ACCS_mech.AddResultHeat(ST_analysis)
ST_solution.Solve(wait=True)
3.8.2. Fast cure simulation via MRCC¶
Workbench journal script¶
# encoding: utf-8
Reset()
import os
directory = os.path.dirname(os.path.abspath(__file__))
cdb = os.path.join(directory,"C-shape.cdb")
script_full = os.path.join(directory,"test_scripting_full.py")
script_fast_MRCC = os.path.join(directory,"test_scripting_fast_MRCC.py")
script_fast_Tvst = os.path.join(directory,"test_scripting_fast_Tvst.py")
import ACCS_scripting
# Instantiating the project interface
ACCS_proj = ACCS_scripting.Project()
EngD_sys = GetTemplate(TemplateName="EngData").CreateSystem()
EngD_EngD = EngD_sys.GetContainer(ComponentName="Engineering Data")
for m in EngD_EngD.GetMaterials():
m.Delete()
EngD_fav = EngData.LoadFavoriteItems()
EngD_lib = EngData.OpenLibrary(Name="Cure Simulation",Source="ACCS_Library.xml")
AS4 = EngD_EngD.ImportMaterial(Name="AS4-8552",Source="ACCS_Library.xml")
AS4.SetAsDefaultSolidForModel()
AS4.SetAsDefaultFluidForModel()
EngD_engd = EngD_sys.GetComponent(Name="Engineering Data")
FEM_sys = GetTemplate(TemplateName="External Model").CreateSystem(Position="Below",RelativeTo=EngD_sys)
FEM_sys.GetContainer(ComponentName="Setup").AddDataFile(FilePath=cdb)
FEM_setup = FEM_sys.GetComponent(Name="Setup")
FEM_setup.Update(AllDependencies=True)
MaterialReleases = ACCS_proj.CheckMaterial()
if MaterialReleases!=None:
print("Materials need to be updated")
ACCS_proj.UpgradeMaterial()
ACCS_proj.HomogeneizeMaterial()
Fast_MRCC_sys = St_tpl.CreateSystem(Position="Right",RelativeTo=FEM_sys)
Fast_MRCC_sys.DisplayText = "Fast MRCC - Static Structural"
Fast_MRCC_engd = Fast_MRCC_sys.GetComponent(Name="Engineering Data")
Fast_MRCC_model = Fast_MRCC_sys.GetComponent(Name="Model")
Fast_MRCC_setup = Fast_MRCC_sys.GetContainer(ComponentName="Setup")
Fast_MRCC_engd.ReplaceWithShare(TargetSystem=Fast_MRCC_sys,ComponentToShare=EngD_engd,SourceSystem=EngD_sys)
FEM_setup.TransferData(TargetComponent=Fast_MRCC_model)
Fast_MRCC_model.Update(AllDependencies=True)
Fast_MRCC_setup.Edit()
Fast_MRCC_setup.SendCommand(Command="WB.AppletList.Applet('DSApplet').App.Script.doToolsRunMacro(\""+re.escape(script_fast_MRCC)+"\")")
Mechanical journal script¶
import ACCS_scripting
# Instantiating the mechanical interface
ACCS_mech = ACCS_scripting.Mechanical(ExtAPI)
LoadSteps = [15600, 20400, 20640]
MRCC = [ ['Heating Rate',2.,120.],
['Fixed Temperature',60.],
['Heating Rate',2.,180.],
['Fixed Temperature',120.],
['Heating Rate',2.,20.],
['Fixed Temperature',20.] ]
part = Model.Geometry.Children[0]
body = part.Children[0]
geoBody = body.GetGeoBody()
#Adding Named Selection: Body
NS_body = Model.AddNamedSelection()
NS_body.Name = r"Body"
NS_body.ScopingMethod = GeometryDefineByType.Worksheet
NS_body.GenerationCriteria.Add(None)
NS_body.GenerationCriteria[0].Action = SelectionActionType.Add
NS_body.GenerationCriteria[0].EntityType = SelectionType.GeoBody
NS_body.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_body.GenerationCriteria[0].Operator = SelectionOperatorType.Largest
NS_body.Generate()
#Adding Named Selection: Outer
NS_outer = Model.AddNamedSelection()
NS_outer.Name = r"Outer"
NS_outer.ScopingMethod = GeometryDefineByType.Worksheet
NS_outer.GenerationCriteria.Add(None)
NS_outer.GenerationCriteria[0].Action = SelectionActionType.Add
NS_outer.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_outer.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_outer.GenerationCriteria[0].Operator = SelectionOperatorType.Largest
NS_outer.Generate()
#Adding Named Selection: Inner
NS_inner = Model.AddNamedSelection()
NS_inner.Name = r"Inner"
NS_inner.ScopingMethod = GeometryDefineByType.Worksheet
NS_inner.GenerationCriteria.Add(None)
NS_inner.GenerationCriteria[0].Action = SelectionActionType.Add
NS_inner.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_inner.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_inner.GenerationCriteria[0].Operator = SelectionOperatorType.RangeInclude
NS_inner.GenerationCriteria[0].LowerBound = Quantity(0.001, 'm m')
NS_inner.GenerationCriteria[0].UpperBound = Quantity(0.0015, 'm m')
NS_inner.Generate()
#Adding Named Selection: Edge
NS_edge = Model.AddNamedSelection()
NS_edge.Name = r"Edge"
NS_edge.ScopingMethod = GeometryDefineByType.Worksheet
NS_edge.GenerationCriteria.Add(None)
NS_edge.GenerationCriteria[0].Action = SelectionActionType.Add
NS_edge.GenerationCriteria[0].EntityType = SelectionType.GeoEdge
NS_edge.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationZ
NS_edge.GenerationCriteria[0].Operator = SelectionOperatorType.LessThan
NS_edge.GenerationCriteria[0].Value = Quantity(0.001, 'm')
NS_edge.GenerationCriteria.Add(None)
NS_edge.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_edge.GenerationCriteria[1].EntityType = SelectionType.GeoEdge
NS_edge.GenerationCriteria[1].Criterion = SelectionCriterionType.Size
NS_edge.GenerationCriteria[1].Operator = SelectionOperatorType.RangeInclude
NS_edge.GenerationCriteria[1].LowerBound = Quantity(0.05, 'm')
NS_edge.GenerationCriteria[1].UpperBound = Quantity(0.06, 'm')
NS_edge.Generate()
#Adding Named Selection: DX
NS_DX = Model.AddNamedSelection()
NS_DX.Name = r"DX"
NS_DX.ScopingMethod = GeometryDefineByType.Worksheet
NS_DX.GenerationCriteria.Add(None)
NS_DX.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DX.GenerationCriteria[0].EntityType = SelectionType.GeoVertex
NS_DX.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationX
NS_DX.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DX.GenerationCriteria.Add(None)
NS_DX.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_DX.GenerationCriteria[1].EntityType = SelectionType.GeoVertex
NS_DX.GenerationCriteria[1].Criterion = SelectionCriterionType.LocationZ
NS_DX.GenerationCriteria[1].Operator = SelectionOperatorType.Smallest
NS_DX.Generate()
#Adding Named Selection: DY
NS_DY = Model.AddNamedSelection()
NS_DY.Name = r"DY"
NS_DY.ScopingMethod = GeometryDefineByType.Worksheet
NS_DY.GenerationCriteria.Add(None)
NS_DY.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DY.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_DY.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_DY.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DY.GenerationCriteria.Add(None)
NS_DY.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_DY.GenerationCriteria[1].EntityType = SelectionType.GeoFace
NS_DY.GenerationCriteria[1].Criterion = SelectionCriterionType.LocationX
NS_DY.GenerationCriteria[1].Operator = SelectionOperatorType.LessThan
NS_DY.GenerationCriteria[1].Value = Quantity(0.005, 'm')
NS_DY.Generate()
#Adding Named Selection: DZ
NS_DZ = Model.AddNamedSelection()
NS_DZ.Name = r"DZ"
NS_DZ.ScopingMethod = GeometryDefineByType.Worksheet
NS_DZ.GenerationCriteria.Add(None)
NS_DZ.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DZ.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_DZ.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationZ
NS_DZ.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DZ.Generate()
#Adding element orientation
EO = Model.Geometry.AddElementOrientation()
EO.BodyLocation = NS_body
EO.SurfaceLocation = NS_inner
EO.EdgeLocation = NS_edge
EO.AxisEdgeOrientation = EO.AxisEdgeOrientation.NegativeXAxis
###############################################################
#
# STRUCTURAL ANALYSIS
#
###############################################################
ST_analysis = Model.Analyses[0]
ST_solution = ST_analysis.Solution
AS = ST_analysis.AnalysisSettings
AS.NumberOfSteps = len(LoadSteps)
for CSN in range(len(LoadSteps),0,-1):
AS.SetStepEndTime(CSN, Quantity(LoadSteps[CSN-1], "sec"))
ST_frictionless = ST_analysis.AddFrictionlessSupport()
ST_frictionless.Location = NS_inner
ST_DX = ST_analysis.AddDisplacement()
ST_DX.Location = NS_DX
ST_DX.PropertyByName('ComponentX').InternalValue = 0
for CSN in range(0,len(LoadSteps)-1,+1):
ST_DX.SetActivateAtLoadStep(CSN+1,False)
for CSN in range(len(LoadSteps)-1,len(LoadSteps),+1):
ST_DX.SetActivateAtLoadStep(CSN+1,True)
ST_DX.Name = NS_DX.Name
ST_DY = ST_analysis.AddDisplacement()
ST_DY.Location = NS_DY
ST_DY.PropertyByName('ComponentY').InternalValue = 0
ST_DY.Name = NS_DY.Name
ST_DZ = ST_analysis.AddDisplacement()
ST_DZ.Location = NS_DZ
ST_DZ.PropertyByName('ComponentZ').InternalValue = 0
ST_DZ.Name = NS_DZ.Name
ST_ACCS_ld = ACCS_mech.AddACCS(ST_analysis)
ST_ACCS_ld.setAnalysisType('Fast')
ST_ACCS_ld.setMRCC(MRCC)
ST_ACCS_ld.setViscoElasticity('Disabled')
ST_ACCS_suprem = ACCS_mech.AddSupportRemover(ST_analysis)
ST_ACCS_suprem.setSurfacesByNamedSelection(NS_inner)
ST_ACCS_suprem.setStep(str(len(LoadSteps)))
ST_TOTDEF = ST_solution.AddTotalDeformation()
ST_EPTHXX = ST_solution.AddThermalStrain()
ST_EPTHXX.NormalOrientation = NormalOrientationType.XAxis
ST_EPTHXX.Name = 'EPTHXX'
ST_EPTHYY = ST_solution.AddThermalStrain()
ST_EPTHYY.NormalOrientation = NormalOrientationType.YAxis
ST_EPTHYY.Name = 'EPTHYY'
ST_EPTHZZ = ST_solution.AddThermalStrain()
ST_EPTHZZ.NormalOrientation = NormalOrientationType.ZAxis
ST_EPTHZZ.Name = 'EPTHZZ'
TH_ACCS_res_state = ACCS_mech.AddResultState(ST_analysis)
TH_ACCS_res_alpha = ACCS_mech.AddResultAlpha(ST_analysis)
TH_ACCS_res_Tg = ACCS_mech.AddResultTg(ST_analysis)
ST_solution.Solve(wait=True)
3.8.3. Fast cure simulation via T vs t¶
Workbench journal script¶
# encoding: utf-8
Reset()
import os
directory = os.path.dirname(os.path.abspath(__file__))
cdb = os.path.join(directory,"C-shape.cdb")
script_full = os.path.join(directory,"test_scripting_full.py")
script_fast_MRCC = os.path.join(directory,"test_scripting_fast_MRCC.py")
script_fast_Tvst = os.path.join(directory,"test_scripting_fast_Tvst.py")
import ACCS_scripting
# Instantiating the project interface
ACCS_proj = ACCS_scripting.Project()
EngD_sys = GetTemplate(TemplateName="EngData").CreateSystem()
EngD_EngD = EngD_sys.GetContainer(ComponentName="Engineering Data")
for m in EngD_EngD.GetMaterials():
m.Delete()
EngD_fav = EngData.LoadFavoriteItems()
EngD_lib = EngData.OpenLibrary(Name="Cure Simulation",Source="ACCS_Library.xml")
AS4 = EngD_EngD.ImportMaterial(Name="AS4-8552",Source="ACCS_Library.xml")
AS4.SetAsDefaultSolidForModel()
AS4.SetAsDefaultFluidForModel()
EngD_engd = EngD_sys.GetComponent(Name="Engineering Data")
FEM_sys = GetTemplate(TemplateName="External Model").CreateSystem(Position="Below",RelativeTo=EngD_sys)
FEM_sys.GetContainer(ComponentName="Setup").AddDataFile(FilePath=cdb)
FEM_setup = FEM_sys.GetComponent(Name="Setup")
FEM_setup.Update(AllDependencies=True)
MaterialReleases = ACCS_proj.CheckMaterial()
if MaterialReleases!=None:
print("Materials need to be updated")
ACCS_proj.UpgradeMaterial()
ACCS_proj.HomogeneizeMaterial()
Fast_Tvst_sys = St_tpl.CreateSystem(Position="Right",RelativeTo=FEM_sys)
Fast_Tvst_sys.DisplayText = "Fast T vs t - Static Structural"
Fast_Tvst_engd = Fast_Tvst_sys.GetComponent(Name="Engineering Data")
Fast_Tvst_model = Fast_Tvst_sys.GetComponent(Name="Model")
Fast_Tvst_setup = Fast_Tvst_sys.GetContainer(ComponentName="Setup")
Fast_Tvst_engd.ReplaceWithShare(TargetSystem=Fast_Tvst_sys,ComponentToShare=EngD_engd,SourceSystem=EngD_sys)
FEM_setup.TransferData(TargetComponent=Fast_Tvst_model)
Fast_Tvst_model.Update(AllDependencies=True)
Fast_Tvst_setup.Edit()
Fast_Tvst_setup.SendCommand(Command="WB.AppletList.Applet('DSApplet').App.Script.doToolsRunMacro(\""+re.escape(script_fast_Tvst)+"\")")
Mechanical journal script¶
import ACCS_scripting
# Instantiating the mechanical interface
ACCS_mech = ACCS_scripting.Mechanical(ExtAPI)
LoadSteps = [15600, 20400, 20640]
Tvst = [ [ 0., 20.],
[ 3000.,120.],
[ 6600.,120.],
[ 8400.,180.],
[15600.,180.],
[20400., 20.],
[23000., 20.]]
part = Model.Geometry.Children[0]
body = part.Children[0]
geoBody = body.GetGeoBody()
#Adding Named Selection: Body
NS_body = Model.AddNamedSelection()
NS_body.Name = r"Body"
NS_body.ScopingMethod = GeometryDefineByType.Worksheet
NS_body.GenerationCriteria.Add(None)
NS_body.GenerationCriteria[0].Action = SelectionActionType.Add
NS_body.GenerationCriteria[0].EntityType = SelectionType.GeoBody
NS_body.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_body.GenerationCriteria[0].Operator = SelectionOperatorType.Largest
NS_body.Generate()
#Adding Named Selection: Outer
NS_outer = Model.AddNamedSelection()
NS_outer.Name = r"Outer"
NS_outer.ScopingMethod = GeometryDefineByType.Worksheet
NS_outer.GenerationCriteria.Add(None)
NS_outer.GenerationCriteria[0].Action = SelectionActionType.Add
NS_outer.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_outer.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_outer.GenerationCriteria[0].Operator = SelectionOperatorType.Largest
NS_outer.Generate()
#Adding Named Selection: Inner
NS_inner = Model.AddNamedSelection()
NS_inner.Name = r"Inner"
NS_inner.ScopingMethod = GeometryDefineByType.Worksheet
NS_inner.GenerationCriteria.Add(None)
NS_inner.GenerationCriteria[0].Action = SelectionActionType.Add
NS_inner.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_inner.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_inner.GenerationCriteria[0].Operator = SelectionOperatorType.RangeInclude
NS_inner.GenerationCriteria[0].LowerBound = Quantity(0.001, 'm m')
NS_inner.GenerationCriteria[0].UpperBound = Quantity(0.0015, 'm m')
NS_inner.Generate()
#Adding Named Selection: Edge
NS_edge = Model.AddNamedSelection()
NS_edge.Name = r"Edge"
NS_edge.ScopingMethod = GeometryDefineByType.Worksheet
NS_edge.GenerationCriteria.Add(None)
NS_edge.GenerationCriteria[0].Action = SelectionActionType.Add
NS_edge.GenerationCriteria[0].EntityType = SelectionType.GeoEdge
NS_edge.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationZ
NS_edge.GenerationCriteria[0].Operator = SelectionOperatorType.LessThan
NS_edge.GenerationCriteria[0].Value = Quantity(0.001, 'm')
NS_edge.GenerationCriteria.Add(None)
NS_edge.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_edge.GenerationCriteria[1].EntityType = SelectionType.GeoEdge
NS_edge.GenerationCriteria[1].Criterion = SelectionCriterionType.Size
NS_edge.GenerationCriteria[1].Operator = SelectionOperatorType.RangeInclude
NS_edge.GenerationCriteria[1].LowerBound = Quantity(0.05, 'm')
NS_edge.GenerationCriteria[1].UpperBound = Quantity(0.06, 'm')
NS_edge.Generate()
#Adding Named Selection: DX
NS_DX = Model.AddNamedSelection()
NS_DX.Name = r"DX"
NS_DX.ScopingMethod = GeometryDefineByType.Worksheet
NS_DX.GenerationCriteria.Add(None)
NS_DX.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DX.GenerationCriteria[0].EntityType = SelectionType.GeoVertex
NS_DX.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationX
NS_DX.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DX.GenerationCriteria.Add(None)
NS_DX.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_DX.GenerationCriteria[1].EntityType = SelectionType.GeoVertex
NS_DX.GenerationCriteria[1].Criterion = SelectionCriterionType.LocationZ
NS_DX.GenerationCriteria[1].Operator = SelectionOperatorType.Smallest
NS_DX.Generate()
#Adding Named Selection: DY
NS_DY = Model.AddNamedSelection()
NS_DY.Name = r"DY"
NS_DY.ScopingMethod = GeometryDefineByType.Worksheet
NS_DY.GenerationCriteria.Add(None)
NS_DY.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DY.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_DY.GenerationCriteria[0].Criterion = SelectionCriterionType.Size
NS_DY.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DY.GenerationCriteria.Add(None)
NS_DY.GenerationCriteria[1].Action = SelectionActionType.Filter
NS_DY.GenerationCriteria[1].EntityType = SelectionType.GeoFace
NS_DY.GenerationCriteria[1].Criterion = SelectionCriterionType.LocationX
NS_DY.GenerationCriteria[1].Operator = SelectionOperatorType.LessThan
NS_DY.GenerationCriteria[1].Value = Quantity(0.005, 'm')
NS_DY.Generate()
#Adding Named Selection: DZ
NS_DZ = Model.AddNamedSelection()
NS_DZ.Name = r"DZ"
NS_DZ.ScopingMethod = GeometryDefineByType.Worksheet
NS_DZ.GenerationCriteria.Add(None)
NS_DZ.GenerationCriteria[0].Action = SelectionActionType.Add
NS_DZ.GenerationCriteria[0].EntityType = SelectionType.GeoFace
NS_DZ.GenerationCriteria[0].Criterion = SelectionCriterionType.LocationZ
NS_DZ.GenerationCriteria[0].Operator = SelectionOperatorType.Smallest
NS_DZ.Generate()
#Adding element orientation
EO = Model.Geometry.AddElementOrientation()
EO.BodyLocation = NS_body
EO.SurfaceLocation = NS_inner
EO.EdgeLocation = NS_edge
EO.AxisEdgeOrientation = EO.AxisEdgeOrientation.NegativeXAxis
###############################################################
#
# STRUCTURAL ANALYSIS
#
###############################################################
ST_analysis = Model.Analyses[0]
ST_solution = ST_analysis.Solution
AS = ST_analysis.AnalysisSettings
AS.NumberOfSteps = len(LoadSteps)
for CSN in range(len(LoadSteps),0,-1):
AS.SetStepEndTime(CSN, Quantity(LoadSteps[CSN-1], "sec"))
ST_frictionless = ST_analysis.AddFrictionlessSupport()
ST_frictionless.Location = NS_inner
ST_DX = ST_analysis.AddDisplacement()
ST_DX.Location = NS_DX
ST_DX.PropertyByName('ComponentX').InternalValue = 0
for CSN in range(0,len(LoadSteps)-1,+1):
ST_DX.SetActivateAtLoadStep(CSN+1,False)
for CSN in range(len(LoadSteps)-1,len(LoadSteps),+1):
ST_DX.SetActivateAtLoadStep(CSN+1,True)
ST_DX.Name = NS_DX.Name
ST_DY = ST_analysis.AddDisplacement()
ST_DY.Location = NS_DY
ST_DY.PropertyByName('ComponentY').InternalValue = 0
ST_DY.Name = NS_DY.Name
ST_DZ = ST_analysis.AddDisplacement()
ST_DZ.Location = NS_DZ
ST_DZ.PropertyByName('ComponentZ').InternalValue = 0
ST_DZ.Name = NS_DZ.Name
ST_ACCS_ld = ACCS_mech.AddACCS(ST_analysis)
ST_ACCS_ld.setAnalysisType('Fast')
ST_ACCS_ld.setTvst(Tvst)
ST_ACCS_ld.setViscoElasticity('Disabled')
ST_ACCS_suprem = ACCS_mech.AddSupportRemover(ST_analysis)
ST_ACCS_suprem.setSurfacesByNamedSelection(NS_inner)
ST_ACCS_suprem.setStep(str(len(LoadSteps)))
ST_TOTDEF = ST_solution.AddTotalDeformation()
ST_EPTHXX = ST_solution.AddThermalStrain()
ST_EPTHXX.NormalOrientation = NormalOrientationType.XAxis
ST_EPTHXX.Name = 'EPTHXX'
ST_EPTHYY = ST_solution.AddThermalStrain()
ST_EPTHYY.NormalOrientation = NormalOrientationType.YAxis
ST_EPTHYY.Name = 'EPTHYY'
ST_EPTHZZ = ST_solution.AddThermalStrain()
ST_EPTHZZ.NormalOrientation = NormalOrientationType.ZAxis
ST_EPTHZZ.Name = 'EPTHZZ'
ST_ACCS_res_state = ACCS_mech.AddResultState(ST_analysis)
ST_ACCS_res_alpha = ACCS_mech.AddResultAlpha(ST_analysis)
ST_ACCS_res_Tg = ACCS_mech.AddResultTg(ST_analysis)
ST_solution.Solve(wait=True)