From d7d2673bb086da7b9dd9fac6ec2a451a95f2a665 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 20 Nov 2025 16:53:48 +0100 Subject: [PATCH] Fix class40 example units The class40 CDB file is in MKS units, not MPA. Update the advanced PyMAPDL workflow example to use the correct units. --- examples/workflows/02-advanced-pymapdl-workflow.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/workflows/02-advanced-pymapdl-workflow.py b/examples/workflows/02-advanced-pymapdl-workflow.py index 0b13f77c13..5780425959 100644 --- a/examples/workflows/02-advanced-pymapdl-workflow.py +++ b/examples/workflows/02-advanced-pymapdl-workflow.py @@ -85,7 +85,7 @@ # %% # Load the CDB file into PyACP and set the unit system. -model = acp.import_model(path=input_file, format="ansys:cdb", unit_system=pyacp.UnitSystemType.MPA) +model = acp.import_model(path=input_file, format="ansys:cdb", unit_system=pyacp.UnitSystemType.MKS) model @@ -99,7 +99,7 @@ # Build Composite Lay-up # ---------------------- # -# Create the model (MPA unit system). +# Create the model (MKS unit system). # %% # Materials @@ -341,6 +341,8 @@ def add_ply(mg, name, ply_material, angle, oss): # To postprocess the results, you must configure the imports, connect to the # PyDPF - Composites server, and load its plugin. + +from ansys.acp.core.dpf_integration_helpers import get_dpf_unit_system from ansys.dpf.composites.composite_model import CompositeModel from ansys.dpf.composites.constants import FailureOutput from ansys.dpf.composites.data_sources import ( @@ -354,7 +356,6 @@ def add_ply(mg, name, ply_material, angle, oss): MaxStressCriterion, ) from ansys.dpf.composites.server_helpers import connect_to_or_start_server -from ansys.dpf.core.unit_system import unit_systems # %% # Connect to the server. The ``connect_to_or_start_server`` function @@ -384,7 +385,7 @@ def add_ply(mg, name, ply_material, angle, oss): }, engineering_data=working_dir_path / matml_filename, ), - default_unit_system=unit_systems.solver_nmm, + default_unit_system=get_dpf_unit_system(model.unit_system), server=dpf_server, )