diff --git a/doc/source/api/example_helpers.rst b/doc/source/api/example_helpers.rst new file mode 100644 index 0000000000..7ddab31ee5 --- /dev/null +++ b/doc/source/api/example_helpers.rst @@ -0,0 +1,10 @@ +Example helpers +--------------- + +.. currentmodule:: ansys.acp.core.example_helpers + +.. autosummary:: + :toctree: _autosummary + + ExampleKeys + get_example_file diff --git a/doc/source/api/index.rst b/doc/source/api/index.rst index 3d51403677..56c2f42f40 100644 --- a/doc/source/api/index.rst +++ b/doc/source/api/index.rst @@ -17,3 +17,4 @@ and attributes. other_types plot_utils workflow + example_helpers diff --git a/doc/source/api/material_property_sets.rst b/doc/source/api/material_property_sets.rst index 63fe73c4ae..dbf786d620 100644 --- a/doc/source/api/material_property_sets.rst +++ b/doc/source/api/material_property_sets.rst @@ -1,9 +1,7 @@ Material property sets ---------------------- -.. TODO: move these to a public module - -.. currentmodule:: ansys.acp.core +.. currentmodule:: ansys.acp.core.material_property_sets .. autosummary:: :toctree: _autosummary @@ -20,6 +18,7 @@ Material property sets ConstantWovenStressLimits FieldVariable InterpolationOptions + PuckMaterialType VariableDensity VariableEngineeringConstants VariableFabricFiberAngle diff --git a/doc/source/api/other_types.rst b/doc/source/api/other_types.rst index a529ecdb49..da0bae6dc2 100644 --- a/doc/source/api/other_types.rst +++ b/doc/source/api/other_types.rst @@ -17,16 +17,13 @@ Other data types EdgeSetType ElementalDataType FeFormat - FieldVariable GeometricalRuleType IgnorableEntity - InterpolationOptions LookUpTable3DInterpolationAlgorithm LookUpTableColumnValueType NodalDataType PlyCutoffType PlyType - PuckMaterialType RosetteSelectionMethod SensorType StatusType diff --git a/examples/001_basic_flat_plate.py b/examples/001_basic_flat_plate.py index 249692b6ca..313326c3ce 100644 --- a/examples/001_basic_flat_plate.py +++ b/examples/001_basic_flat_plate.py @@ -24,15 +24,13 @@ # Import pyACP dependencies from ansys.acp.core import ( ACPWorkflow, - ConstantEngineeringConstants, - ConstantStrainLimits, - ExampleKeys, PlyType, + example_helpers, get_composite_post_processing_files, get_directions_plotter, get_dpf_unit_system, - get_example_file, launch_acp, + material_property_sets, print_model, ) @@ -44,7 +42,9 @@ # Get example file from server tempdir = tempfile.TemporaryDirectory() WORKING_DIR = pathlib.Path(tempdir.name) -input_file = get_example_file(ExampleKeys.BASIC_FLAT_PLATE_CDB, WORKING_DIR) +input_file = example_helpers.get_example_file( + example_helpers.ExampleKeys.BASIC_FLAT_PLATE_CDB, WORKING_DIR +) # %% # Launch the PyACP server and connect to it. @@ -74,12 +74,12 @@ # %% # Create an orthotropic material and fabric including strain limits, which are later # used to post-process the simulation. -engineering_constants = ConstantEngineeringConstants( +engineering_constants = material_property_sets.ConstantEngineeringConstants( E1=5e10, E2=1e10, E3=1e10, nu12=0.28, nu13=0.28, nu23=0.3, G12=5e9, G23=4e9, G31=4e9 ) strain_limit = 0.01 -strain_limits = ConstantStrainLimits( +strain_limits = material_property_sets.ConstantStrainLimits( eXc=-strain_limit, eYc=-strain_limit, eZc=-strain_limit, diff --git a/examples/002_start_from_existing_project.py b/examples/002_start_from_existing_project.py index b05330e1ab..892798cb5a 100644 --- a/examples/002_start_from_existing_project.py +++ b/examples/002_start_from_existing_project.py @@ -11,13 +11,15 @@ import tempfile import ansys.acp.core as pyacp -from ansys.acp.core import ACPWorkflow, ExampleKeys, get_example_file, print_model +from ansys.acp.core import ACPWorkflow, example_helpers, print_model # %% # Get example file from server tempdir = tempfile.TemporaryDirectory() WORKING_DIR = pathlib.Path(tempdir.name) -input_acph5_file = get_example_file(ExampleKeys.BASIC_FLAT_PLATE_ACPH5, WORKING_DIR) +input_acph5_file = example_helpers.get_example_file( + example_helpers.ExampleKeys.BASIC_FLAT_PLATE_ACPH5, WORKING_DIR +) # Launch the PyACP server and connect to it. acp = pyacp.launch_acp() diff --git a/src/ansys/acp/core/__init__.py b/src/ansys/acp/core/__init__.py index 9587e8bf26..9a52027d01 100644 --- a/src/ansys/acp/core/__init__.py +++ b/src/ansys/acp/core/__init__.py @@ -5,6 +5,7 @@ import importlib.metadata +from . import example_helpers, material_property_sets from ._model_printer import get_model_tree, print_model from ._plotter import get_directions_plotter from ._server import ACP, DirectLaunchConfig, DockerComposeLaunchConfig, LaunchMode, launch_acp @@ -18,16 +19,6 @@ BooleanSelectionRuleNodalData, CADComponent, CADGeometry, - ConstantDensity, - ConstantEngineeringConstants, - ConstantFabricFiberAngle, - ConstantLaRCConstants, - ConstantPuckConstants, - ConstantStrainLimits, - ConstantStressLimits, - ConstantTsaiWuConstants, - ConstantWovenCharacterization, - ConstantWovenStressLimits, CutoffMaterialType, CutoffRuleType, CutoffSelectionRule, @@ -49,13 +40,11 @@ Fabric, FabricWithAngle, FeFormat, - FieldVariable, GeometricalRuleType, GeometricalSelectionRule, GeometricalSelectionRuleElementalData, GeometricalSelectionRuleNodalData, IgnorableEntity, - InterpolationOptions, Lamina, LinkedSelectionRule, LookUpTable1D, @@ -84,7 +73,6 @@ ProductionPly, ProductionPlyElementalData, ProductionPlyNodalData, - PuckMaterialType, Rosette, RosetteSelectionMethod, ScalarData, @@ -105,24 +93,13 @@ TubeSelectionRuleElementalData, TubeSelectionRuleNodalData, UnitSystemType, - VariableDensity, - VariableEngineeringConstants, - VariableFabricFiberAngle, - VariableLaRCConstants, VariableOffsetSelectionRule, VariableOffsetSelectionRuleElementalData, VariableOffsetSelectionRuleNodalData, - VariablePuckConstants, - VariableStrainLimits, - VariableStressLimits, - VariableTsaiWuConstants, - VariableWovenCharacterization, - VariableWovenStressLimits, VectorData, VirtualGeometry, VirtualGeometryDimension, ) -from ._utils.example_helpers import ExampleKeys, get_example_file from ._workflow import ACPWorkflow, get_composite_post_processing_files, get_dpf_unit_system __version__ = importlib.metadata.version(__name__.replace(".", "-")) @@ -141,16 +118,6 @@ "BooleanSelectionRuleNodalData", "CADComponent", "CADGeometry", - "ConstantDensity", - "ConstantEngineeringConstants", - "ConstantFabricFiberAngle", - "ConstantLaRCConstants", - "ConstantPuckConstants", - "ConstantStrainLimits", - "ConstantStressLimits", - "ConstantTsaiWuConstants", - "ConstantWovenCharacterization", - "ConstantWovenStressLimits", "CutoffMaterialType", "CutoffRuleType", "CutoffSelectionRule", @@ -171,21 +138,18 @@ "ElementSet", "ElementSetElementalData", "ElementSetNodalData", - "ExampleKeys", + "example_helpers", "Fabric", "FabricWithAngle", "FeFormat", - "FieldVariable", "GeometricalRuleType", "GeometricalSelectionRule", "GeometricalSelectionRuleElementalData", "GeometricalSelectionRuleNodalData", "get_composite_post_processing_files", "get_dpf_unit_system", - "get_example_file", "get_model_tree", "IgnorableEntity", - "InterpolationOptions", "Lamina", "launch_acp", "LaunchMode", @@ -197,6 +161,7 @@ "LookUpTable3DInterpolationAlgorithm", "LookUpTableColumnValueType", "Material", + "material_property_sets", "Model", "ModelElementalData", "ModelingGroup", @@ -217,7 +182,6 @@ "ProductionPly", "ProductionPlyElementalData", "ProductionPlyNodalData", - "PuckMaterialType", "Rosette", "RosetteSelectionMethod", "ScalarData", @@ -238,19 +202,9 @@ "TubeSelectionRuleElementalData", "TubeSelectionRuleNodalData", "UnitSystemType", - "VariableDensity", - "VariableEngineeringConstants", - "VariableFabricFiberAngle", - "VariableLaRCConstants", "VariableOffsetSelectionRule", "VariableOffsetSelectionRuleElementalData", "VariableOffsetSelectionRuleNodalData", - "VariablePuckConstants", - "VariableStrainLimits", - "VariableStressLimits", - "VariableTsaiWuConstants", - "VariableWovenCharacterization", - "VariableWovenStressLimits", "VectorData", "VirtualGeometry", "VirtualGeometryDimension", diff --git a/src/ansys/acp/core/_tree_objects/__init__.py b/src/ansys/acp/core/_tree_objects/__init__.py index 37d9a760ee..c67953da10 100644 --- a/src/ansys/acp/core/_tree_objects/__init__.py +++ b/src/ansys/acp/core/_tree_objects/__init__.py @@ -55,32 +55,7 @@ from .lookup_table_1d_column import LookUpTable1DColumn from .lookup_table_3d import LookUpTable3D from .lookup_table_3d_column import LookUpTable3DColumn -from .material import ( - ConstantDensity, - ConstantEngineeringConstants, - ConstantFabricFiberAngle, - ConstantLaRCConstants, - ConstantPuckConstants, - ConstantStrainLimits, - ConstantStressLimits, - ConstantTsaiWuConstants, - ConstantWovenCharacterization, - ConstantWovenStressLimits, - FieldVariable, - InterpolationOptions, - Material, - PuckMaterialType, - VariableDensity, - VariableEngineeringConstants, - VariableFabricFiberAngle, - VariableLaRCConstants, - VariablePuckConstants, - VariableStrainLimits, - VariableStressLimits, - VariableTsaiWuConstants, - VariableWovenCharacterization, - VariableWovenStressLimits, -) +from .material import Material from .model import FeFormat, IgnorableEntity, Model, ModelElementalData, ModelNodalData from .modeling_group import ModelingGroup from .modeling_ply import ModelingPly, ModelingPlyElementalData, ModelingPlyNodalData, TaperEdge @@ -126,16 +101,6 @@ "BooleanSelectionRuleNodalData", "CADComponent", "CADGeometry", - "ConstantDensity", - "ConstantEngineeringConstants", - "ConstantFabricFiberAngle", - "ConstantLaRCConstants", - "ConstantPuckConstants", - "ConstantStrainLimits", - "ConstantStressLimits", - "ConstantTsaiWuConstants", - "ConstantWovenCharacterization", - "ConstantWovenStressLimits", "CutoffMaterialType", "CutoffRuleType", "CutoffSelectionRule", @@ -213,19 +178,9 @@ "TubeSelectionRuleElementalData", "TubeSelectionRuleNodalData", "UnitSystemType", - "VariableDensity", - "VariableEngineeringConstants", - "VariableFabricFiberAngle", - "VariableLaRCConstants", "VariableOffsetSelectionRule", "VariableOffsetSelectionRuleElementalData", "VariableOffsetSelectionRuleNodalData", - "VariablePuckConstants", - "VariableStrainLimits", - "VariableStressLimits", - "VariableTsaiWuConstants", - "VariableWovenCharacterization", - "VariableWovenStressLimits", "VectorData", "VirtualGeometry", "VirtualGeometryDimension", diff --git a/src/ansys/acp/core/_tree_objects/material/__init__.py b/src/ansys/acp/core/_tree_objects/material/__init__.py index 23a676462f..b0d8fa6c23 100644 --- a/src/ansys/acp/core/_tree_objects/material/__init__.py +++ b/src/ansys/acp/core/_tree_objects/material/__init__.py @@ -1,54 +1,3 @@ from .material import Material -from .property_sets import ( - ConstantDensity, - ConstantEngineeringConstants, - ConstantFabricFiberAngle, - ConstantLaRCConstants, - ConstantPuckConstants, - ConstantStrainLimits, - ConstantStressLimits, - ConstantTsaiWuConstants, - ConstantWovenCharacterization, - ConstantWovenStressLimits, - FieldVariable, - InterpolationOptions, - PuckMaterialType, - VariableDensity, - VariableEngineeringConstants, - VariableFabricFiberAngle, - VariableLaRCConstants, - VariablePuckConstants, - VariableStrainLimits, - VariableStressLimits, - VariableTsaiWuConstants, - VariableWovenCharacterization, - VariableWovenStressLimits, -) -__all__ = [ - "ConstantDensity", - "ConstantEngineeringConstants", - "ConstantFabricFiberAngle", - "ConstantLaRCConstants", - "ConstantPuckConstants", - "ConstantStrainLimits", - "ConstantStressLimits", - "ConstantTsaiWuConstants", - "ConstantWovenCharacterization", - "ConstantWovenStressLimits", - "FieldVariable", - "InterpolationOptions", - "Material", - "property_sets", - "PuckMaterialType", - "VariableDensity", - "VariableEngineeringConstants", - "VariableFabricFiberAngle", - "VariableLaRCConstants", - "VariablePuckConstants", - "VariableStrainLimits", - "VariableStressLimits", - "VariableTsaiWuConstants", - "VariableWovenCharacterization", - "VariableWovenStressLimits", -] +__all__ = ["Material"] diff --git a/src/ansys/acp/core/_utils/example_helpers.py b/src/ansys/acp/core/example_helpers.py similarity index 93% rename from src/ansys/acp/core/_utils/example_helpers.py rename to src/ansys/acp/core/example_helpers.py index bc18617704..7865c7c004 100644 --- a/src/ansys/acp/core/_utils/example_helpers.py +++ b/src/ansys/acp/core/example_helpers.py @@ -1,3 +1,9 @@ +"""Helpers used in the PyACP examples. + +These utilities can download the input files used in the PyACP examples. +""" + + import dataclasses from enum import Enum, auto import pathlib diff --git a/src/ansys/acp/core/material_property_sets.py b/src/ansys/acp/core/material_property_sets.py new file mode 100644 index 0000000000..360cd2f55c --- /dev/null +++ b/src/ansys/acp/core/material_property_sets.py @@ -0,0 +1,54 @@ +"""Defines the property sets for materials.""" + +from ._tree_objects.material.property_sets import ( + ConstantDensity, + ConstantEngineeringConstants, + ConstantFabricFiberAngle, + ConstantLaRCConstants, + ConstantPuckConstants, + ConstantStrainLimits, + ConstantStressLimits, + ConstantTsaiWuConstants, + ConstantWovenCharacterization, + ConstantWovenStressLimits, + FieldVariable, + InterpolationOptions, + PuckMaterialType, + VariableDensity, + VariableEngineeringConstants, + VariableFabricFiberAngle, + VariableLaRCConstants, + VariablePuckConstants, + VariableStrainLimits, + VariableStressLimits, + VariableTsaiWuConstants, + VariableWovenCharacterization, + VariableWovenStressLimits, +) + +__all__ = [ + "ConstantDensity", + "ConstantEngineeringConstants", + "ConstantFabricFiberAngle", + "ConstantLaRCConstants", + "ConstantPuckConstants", + "ConstantStrainLimits", + "ConstantStressLimits", + "ConstantTsaiWuConstants", + "ConstantWovenCharacterization", + "ConstantWovenStressLimits", + "FieldVariable", + "InterpolationOptions", + "PuckMaterialType", + "VariableDensity", + "VariableEngineeringConstants", + "VariableFabricFiberAngle", + "VariableLaRCConstants", + "VariablePuckConstants", + "VariableStrainLimits", + "VariableStressLimits", + "VariableTsaiWuConstants", + "VariableWovenCharacterization", + "VariableWovenStressLimits", + "wrap_property_set", +] diff --git a/tests/unittests/test_material.py b/tests/unittests/test_material.py index 820c77e149..061c3c713a 100644 --- a/tests/unittests/test_material.py +++ b/tests/unittests/test_material.py @@ -5,7 +5,8 @@ import numpy.testing as npt import pytest -from ansys.acp.core import ( +from ansys.acp.core import PlyType +from ansys.acp.core.material_property_sets import ( ConstantDensity, ConstantEngineeringConstants, ConstantFabricFiberAngle, @@ -18,7 +19,6 @@ ConstantWovenStressLimits, FieldVariable, InterpolationOptions, - PlyType, VariableDensity, VariableEngineeringConstants, VariableStrainLimits,