From 39620fb986d5c2b17226e37f8f0eea70145b5643 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Wed, 22 Feb 2023 10:18:39 +0100 Subject: [PATCH 1/3] Add material properties API Extend material.proto with definitions for property sets. Make order of data / shape consistent in the array data types. Remove unused import in unit_system.proto. --- .gitignore | 1 + src/ansys/api/acp/v0/array_types.proto | 6 +- src/ansys/api/acp/v0/material.proto | 212 ++++++++++++++++++++++++- src/ansys/api/acp/v0/unit_system.proto | 2 - 4 files changed, 215 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 71feede..8ba5fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ __pycache__/ # Virtual environment venv +.venv # Distribution / packaging .Python diff --git a/src/ansys/api/acp/v0/array_types.proto b/src/ansys/api/acp/v0/array_types.proto index 83b9849..4357e92 100644 --- a/src/ansys/api/acp/v0/array_types.proto +++ b/src/ansys/api/acp/v0/array_types.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package ansys.api.acp.v0.array_types; message DoubleArray { - repeated int64 shape = 1 [packed=true]; - repeated double data = 2 [packed=true]; + repeated double data = 1 [packed=true]; + repeated int64 shape = 2 [packed=true]; } message IntArray { repeated int64 data = 1 [packed=true]; repeated int64 shape = 2 [packed=true]; -} \ No newline at end of file +} diff --git a/src/ansys/api/acp/v0/material.proto b/src/ansys/api/acp/v0/material.proto index 7188492..e3f97c5 100644 --- a/src/ansys/api/acp/v0/material.proto +++ b/src/ansys/api/acp/v0/material.proto @@ -6,11 +6,221 @@ import "ansys/api/acp/v0/enum_types.proto"; // Default CRUD messages +message FieldVariable { + string name = 1; + repeated double values = 2; + double default = 3; + double lower_limit = 4; + double upper_limit = 5; +} + +message InterpolationOptions { + string algorithm = 1; + bool cached = 2; + bool normalized = 3; +} + +message DensityPropertySet { + int64 num_values = 1; + message Data { + double rho = 1; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message IsotropicEngineeringConstantsPropertySet { + int64 num_values = 1; + message Data { + double E = 1; + double nu = 2; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message OrthotropicEngineeringConstantsPropertySet { + int64 num_values = 1; + message Data { + double E1 = 1; + double E2 = 2; + double E3 = 3; + double G12 = 4; + double G23 = 5; + double G31 = 6; + double nu12 = 7; + double nu23 = 8; + double nu13 = 9; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message IsotropicStressLimitsPropertySet { + int64 num_values = 1; + message Data { + double effective_stress = 1; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} +message OrthotropicStressLimitsPropertySet { + int64 num_values = 1; + message Data { + double Xc = 1; + double Yc = 2; + double Zc = 3; + double Xt = 4; + double Yt = 5; + double Zt = 6; + double Sxy = 7; + double Syz = 8; + double Sxz = 9; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message IsotropicStrainLimitsPropertySet { + int64 num_values = 1; + message Data { + double effective_strain = 1; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} +message OrthotropicStrainLimitsPropertySet { + int64 num_values = 1; + message Data { + double eXc = 1; + double eYc = 2; + double eZc = 3; + double eXt = 4; + double eYt = 5; + double eZt = 6; + double eSxy = 7; + double eSyz = 8; + double eSxz = 9; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message PuckConstantsPropertySet { + int64 num_values = 1; + message Data { + double p_21_pos = 1; + double p_21_neg = 2; + double p_22_pos = 3; + double p_22_neg = 4; + double s = 5; + double M = 6; + double interface_weakening_factor = 7; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; + string mat_type = 5; +} + +message WovenCharacterizationPropertySet { + int64 num_values = 1; + message Data { + double orientation_1 = 1; + double E1_1 = 2; + double E2_1 = 3; + double G12_1 = 4; + double G23_1 = 5; + double nu12_1 = 6; + double orientation_2 = 7; + double E1_2 = 8; + double E2_2 = 9; + double G12_2 = 10; + double G23_2 = 11; + double nu12_2 = 12; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message TsaiWuConstantsPropertySet { + int64 num_values = 1; + message Data { + double XY = 1; + double XZ = 2; + double YZ = 3; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message LaRCConstantsPropertySet { + int64 num_values = 1; + message Data { + double fracture_angle_under_compression = 1; + double fracture_toughness_ratio = 2; + double fracture_toughness_mode_1 = 3; + double fracture_toughness_mode_2 = 4; + double thin_ply_thickness_limit = 5; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + +message FabricFiberAnglePropertySet { + int64 num_values = 1; + message Data { + double fabric_fiber_angle = 1; + } + repeated Data values = 2; + repeated FieldVariable field_variables = 3; + InterpolationOptions interpolation_options = 4; +} + message Properties { - //This is only a minimal set. List is not complete yet enum_types.StatusType status = 1; bool locked = 2; enum_types.PlyType ply_type = 3; + + message PropertySets { + DensityPropertySet density = 1; + oneof engineering_constants { + IsotropicEngineeringConstantsPropertySet engineering_constants_isotropic = 2; + OrthotropicEngineeringConstantsPropertySet engineering_constants_orthotropic = 3; + } + oneof stress_limits { + IsotropicStressLimitsPropertySet stress_limits_isotropic = 4; + OrthotropicStressLimitsPropertySet stress_limits_orthotropic = 5; + } + oneof strain_limits { + IsotropicStrainLimitsPropertySet strain_limits_isotropic = 6; + OrthotropicStrainLimitsPropertySet strain_limits_orthotropic = 7; + } + PuckConstantsPropertySet puck_constants = 8; + + // intentionally left out for now: + // thermal_expansion_coefficients = 9; + + WovenCharacterizationPropertySet woven_characterization = 10; + PuckConstantsPropertySet woven_puck_constants_1 = 11; + PuckConstantsPropertySet woven_puck_constants_2 = 12; + OrthotropicStressLimitsPropertySet woven_stress_limits_1 = 13; + OrthotropicStressLimitsPropertySet woven_stress_limits_2 = 14; + TsaiWuConstantsPropertySet tsai_wu_constants = 15; + LaRCConstantsPropertySet larc_constants = 16; + FabricFiberAnglePropertySet fabric_fiber_angle = 17; + } + PropertySets property_sets = 4; } message ObjectInfo { diff --git a/src/ansys/api/acp/v0/unit_system.proto b/src/ansys/api/acp/v0/unit_system.proto index 5570069..5d4818c 100644 --- a/src/ansys/api/acp/v0/unit_system.proto +++ b/src/ansys/api/acp/v0/unit_system.proto @@ -1,8 +1,6 @@ syntax = "proto3"; package ansys.api.acp.v0.unit_system; -import "ansys/api/acp/v0/base.proto"; - // only the unit system type is exposed at the moment. enum UnitSystemType { UNDEFINED = 0; From fed7c76469cc9cfb6dd2381300cee01d31c1b20d Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Wed, 22 Feb 2023 16:18:55 +0100 Subject: [PATCH 2/3] Remove num_values --- src/ansys/api/acp/v0/material.proto | 86 +++++++++++++---------------- 1 file changed, 37 insertions(+), 49 deletions(-) diff --git a/src/ansys/api/acp/v0/material.proto b/src/ansys/api/acp/v0/material.proto index e3f97c5..c021c33 100644 --- a/src/ansys/api/acp/v0/material.proto +++ b/src/ansys/api/acp/v0/material.proto @@ -21,28 +21,25 @@ message InterpolationOptions { } message DensityPropertySet { - int64 num_values = 1; message Data { double rho = 1; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message IsotropicEngineeringConstantsPropertySet { - int64 num_values = 1; message Data { double E = 1; double nu = 2; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message OrthotropicEngineeringConstantsPropertySet { - int64 num_values = 1; message Data { double E1 = 1; double E2 = 2; @@ -54,22 +51,20 @@ message OrthotropicEngineeringConstantsPropertySet { double nu23 = 8; double nu13 = 9; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message IsotropicStressLimitsPropertySet { - int64 num_values = 1; message Data { double effective_stress = 1; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message OrthotropicStressLimitsPropertySet { - int64 num_values = 1; message Data { double Xc = 1; double Yc = 2; @@ -81,22 +76,20 @@ message OrthotropicStressLimitsPropertySet { double Syz = 8; double Sxz = 9; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message IsotropicStrainLimitsPropertySet { - int64 num_values = 1; message Data { double effective_strain = 1; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message OrthotropicStrainLimitsPropertySet { - int64 num_values = 1; message Data { double eXc = 1; double eYc = 2; @@ -108,13 +101,12 @@ message OrthotropicStrainLimitsPropertySet { double eSyz = 8; double eSxz = 9; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message PuckConstantsPropertySet { - int64 num_values = 1; message Data { double p_21_pos = 1; double p_21_neg = 2; @@ -124,14 +116,13 @@ message PuckConstantsPropertySet { double M = 6; double interface_weakening_factor = 7; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; - string mat_type = 5; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; + string mat_type = 4; } message WovenCharacterizationPropertySet { - int64 num_values = 1; message Data { double orientation_1 = 1; double E1_1 = 2; @@ -146,25 +137,23 @@ message WovenCharacterizationPropertySet { double G23_2 = 11; double nu12_2 = 12; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message TsaiWuConstantsPropertySet { - int64 num_values = 1; message Data { double XY = 1; double XZ = 2; double YZ = 3; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message LaRCConstantsPropertySet { - int64 num_values = 1; message Data { double fracture_angle_under_compression = 1; double fracture_toughness_ratio = 2; @@ -172,19 +161,18 @@ message LaRCConstantsPropertySet { double fracture_toughness_mode_2 = 4; double thin_ply_thickness_limit = 5; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message FabricFiberAnglePropertySet { - int64 num_values = 1; message Data { double fabric_fiber_angle = 1; } - repeated Data values = 2; - repeated FieldVariable field_variables = 3; - InterpolationOptions interpolation_options = 4; + repeated Data values = 1; + repeated FieldVariable field_variables = 2; + InterpolationOptions interpolation_options = 3; } message Properties { From a2e0a79df4ac7dcf907099e1413b152475d140a0 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 23 Feb 2023 14:08:51 +0100 Subject: [PATCH 3/3] Add comment to material property sets --- src/ansys/api/acp/v0/material.proto | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ansys/api/acp/v0/material.proto b/src/ansys/api/acp/v0/material.proto index c021c33..3530c79 100644 --- a/src/ansys/api/acp/v0/material.proto +++ b/src/ansys/api/acp/v0/material.proto @@ -180,6 +180,22 @@ message Properties { bool locked = 2; enum_types.PlyType ply_type = 3; + /** + * The material property sets are dependent on the 'ply_type': + * - In read APIs (Get, List), only the material properties which + * match the 'ply_type' will be provided. For property sets which + * have orthotropic and isotropic variants, the appropriate one is + * provided. + * - In write APIs (Put, Create) all property sets _except engineering + * constants_ can be specified independently of the ply type. They + * will be stored in the back-end, but may be ignored by further + * processing if they do not match the ply type. + * For engineering constants, if an isotropic ply type is given, the + * constants need to be isotropic. Two forms are accepted: + * - specifying 'engineering_constants_isotropic' + * - specifying 'engineering_constants_orthotropic' where the + * values are consistent with an isotropic material. + **/ message PropertySets { DensityPropertySet density = 1; oneof engineering_constants {