Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion examples/workflows/03-pymechanical-shell-workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
# This script runs in the Mechanical Python environment, which uses IronPython 2.7.
textwrap.dedent(
f"""\
# Import the geometry
geometry_import = Model.GeometryImportGroup.AddGeometryImport()

import_format = Ansys.Mechanical.DataModel.Enums.GeometryImportPreference.Format.Automatic
Expand All @@ -119,6 +120,8 @@
import_preferences
)

# The thickness will be overridden by the ACP model, but is required
# for the model to be valid.
for body in Model.Geometry.GetChildren(
Ansys.Mechanical.DataModel.Enums.DataModelObjectCategory.Body, True
):
Expand All @@ -138,7 +141,7 @@
# definition file to output_path.

composite_definitions_h5 = "ACPCompositeDefinitions.h5"
matml_file = "materials.xml" # TODO: load an example materials XML file instead of defining the materials in ACP
matml_file = "materials.xml"


model = acp.import_model(mesh_path, format="ansys:h5")
Expand Down
2 changes: 1 addition & 1 deletion examples/workflows/04-pymechanical-solid-workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
# - Solid model composite definitions HDF5 file
# - Solid model CDB file

matml_file = "materials.xml" # TODO: load an example materials XML file instead of defining the materials in ACP
matml_file = "materials.xml"
solid_model_cdb_file = "SolidModel.cdb"
solid_model_composite_definitions_h5 = "SolidModel.h5"

Expand Down
7 changes: 7 additions & 0 deletions examples/workflows/05-pymechanical-to-cdb-workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@
):
body.Thickness = Quantity(1e-6, "m")

Model.Mesh.GenerateMesh()

# Define named selections at the front and back edges
front_edge = Model.AddNamedSelection()
front_edge.Name = "Front Edge"
Expand Down Expand Up @@ -303,6 +305,11 @@

# %%
# Query and plot the results.
#
# Note that the maximum IRF is different when compared to :ref:`pymechanical_shell_example`
# because ACP sets the ``ERESX,NO`` option in the CDB file. This option disables interpolation
# of the results from the integration point to the nodes.

irf_field = output_all_elements.get_field(
{"failure_label": pydpf_composites.constants.FailureOutput.FAILURE_VALUE}
)
Expand Down
5 changes: 3 additions & 2 deletions examples/workflows/06-cdb-to-pymechanical-workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@


model = acp.import_model(path=input_file, format="ansys:cdb")
model.unit_system

# %%
# Visualize the loaded mesh.
Expand Down Expand Up @@ -130,7 +131,7 @@
strain_limits=strain_limits,
)

fabric = model.create_fabric(name="UD", material=ud_material, thickness=0.1)
fabric = model.create_fabric(name="UD", material=ud_material, thickness=1e-4)


# %%
Expand Down Expand Up @@ -259,7 +260,7 @@

force = analysis.AddForce()
force.DefineBy = LoadDefineBy.Components
force.XComponent.Output.SetDiscreteValue(0, Quantity(1e6, "N"))
force.XComponent.Output.SetDiscreteValue(0, Quantity(100, "N"))
force.Location = front_edge

analysis.Solution.Solve(True)
Expand Down
Loading