|
| 1 | +""" |
| 2 | +compute_stress_1_1 |
| 3 | +================== |
| 4 | +""" |
| 5 | +from ansys.dpf.core.dpf_operator import Operator |
| 6 | +from ansys.dpf.core.inputs import Input, _Inputs |
| 7 | +from ansys.dpf.core.outputs import Output, _Outputs, _modify_output_spec_with_one_type |
| 8 | +from ansys.dpf.core.operators.specification import PinSpecification, Specification |
| 9 | + |
| 10 | +"""Operators from "result" category |
| 11 | +""" |
| 12 | + |
| 13 | +class compute_stress_1_1(Operator): |
| 14 | + """Computes the stress from an elastic strain field.Only some 3-D elements (only hexa, tetra, pyramid and wedge) and integration schemes are supported. |
| 15 | +Only isotropic materials are supported. Material nonlinearity is not supported. |
| 16 | +Only constant materials are supported. |
| 17 | +All coordinates are global coordinates. |
| 18 | +All units need to be consistent.Get the 1st principal component.Get the 1st principal component. |
| 19 | +
|
| 20 | + available inputs: |
| 21 | + - scoping (Scoping) (optional) |
| 22 | + - streams_container (StreamsContainer) (optional) |
| 23 | + - data_sources (DataSources) (optional) |
| 24 | + - requested_location (str) (optional) |
| 25 | + - strain (FieldsContainer, Field) |
| 26 | +
|
| 27 | + available outputs: |
| 28 | + - fields_container (FieldsContainer) |
| 29 | +
|
| 30 | + Examples |
| 31 | + -------- |
| 32 | + >>> from ansys.dpf import core as dpf |
| 33 | +
|
| 34 | + >>> # Instantiate operator |
| 35 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 36 | +
|
| 37 | + >>> # Make input connections |
| 38 | + >>> my_scoping = dpf.Scoping() |
| 39 | + >>> op.inputs.scoping.connect(my_scoping) |
| 40 | + >>> my_streams_container = dpf.StreamsContainer() |
| 41 | + >>> op.inputs.streams_container.connect(my_streams_container) |
| 42 | + >>> my_data_sources = dpf.DataSources() |
| 43 | + >>> op.inputs.data_sources.connect(my_data_sources) |
| 44 | + >>> my_requested_location = str() |
| 45 | + >>> op.inputs.requested_location.connect(my_requested_location) |
| 46 | + >>> my_strain = dpf.FieldsContainer() |
| 47 | + >>> op.inputs.strain.connect(my_strain) |
| 48 | +
|
| 49 | + >>> # Instantiate operator and connect inputs in one line |
| 50 | + >>> op = dpf.operators.result.compute_stress_1_1(scoping=my_scoping,streams_container=my_streams_container,data_sources=my_data_sources,requested_location=my_requested_location,strain=my_strain) |
| 51 | +
|
| 52 | + >>> # Get output data |
| 53 | + >>> result_fields_container = op.outputs.fields_container()""" |
| 54 | + def __init__(self, scoping=None, streams_container=None, data_sources=None, requested_location=None, strain=None, config=None, server=None): |
| 55 | + super().__init__(name="compute_stress_1", config = config, server = server) |
| 56 | + self._inputs = InputsComputeStress11(self) |
| 57 | + self._outputs = OutputsComputeStress11(self) |
| 58 | + if scoping !=None: |
| 59 | + self.inputs.scoping.connect(scoping) |
| 60 | + if streams_container !=None: |
| 61 | + self.inputs.streams_container.connect(streams_container) |
| 62 | + if data_sources !=None: |
| 63 | + self.inputs.data_sources.connect(data_sources) |
| 64 | + if requested_location !=None: |
| 65 | + self.inputs.requested_location.connect(requested_location) |
| 66 | + if strain !=None: |
| 67 | + self.inputs.strain.connect(strain) |
| 68 | + |
| 69 | + @staticmethod |
| 70 | + def _spec(): |
| 71 | + spec = Specification(description="""Computes the stress from an elastic strain field.Only some 3-D elements (only hexa, tetra, pyramid and wedge) and integration schemes are supported. |
| 72 | +Only isotropic materials are supported. Material nonlinearity is not supported. |
| 73 | +Only constant materials are supported. |
| 74 | +All coordinates are global coordinates. |
| 75 | +All units need to be consistent.Get the 1st principal component.Get the 1st principal component.""", |
| 76 | + map_input_pin_spec={ |
| 77 | + 1 : PinSpecification(name = "scoping", type_names=["scoping"], optional=True, document="""The element scoping on which the result is computed."""), |
| 78 | + 3 : PinSpecification(name = "streams_container", type_names=["streams_container"], optional=True, document="""Needed to get mesh and material ids. Optional if a data_sources have been connected."""), |
| 79 | + 4 : PinSpecification(name = "data_sources", type_names=["data_sources"], optional=True, document="""Needed to get mesh and material ids. Optional if a streams_container have been connected."""), |
| 80 | + 9 : PinSpecification(name = "requested_location", type_names=["string"], optional=True, document="""Average the Elemental Nodal result to the requested location."""), |
| 81 | + 10 : PinSpecification(name = "strain", type_names=["fields_container","field"], optional=False, document="""Field/or fields container containing only the elastic strain field (element nodal).""")}, |
| 82 | + map_output_pin_spec={ |
| 83 | + 0 : PinSpecification(name = "fields_container", type_names=["fields_container"], optional=False, document="""The computed result fields container (elemental nodal).""")}) |
| 84 | + return spec |
| 85 | + |
| 86 | + |
| 87 | + @staticmethod |
| 88 | + def default_config(): |
| 89 | + return Operator.default_config(name = "compute_stress_1") |
| 90 | + |
| 91 | + @property |
| 92 | + def inputs(self): |
| 93 | + """Enables to connect inputs to the operator |
| 94 | +
|
| 95 | + Returns |
| 96 | + -------- |
| 97 | + inputs : InputsComputeStress11 |
| 98 | + """ |
| 99 | + return super().inputs |
| 100 | + |
| 101 | + |
| 102 | + @property |
| 103 | + def outputs(self): |
| 104 | + """Enables to get outputs of the operator by evaluationg it |
| 105 | +
|
| 106 | + Returns |
| 107 | + -------- |
| 108 | + outputs : OutputsComputeStress11 |
| 109 | + """ |
| 110 | + return super().outputs |
| 111 | + |
| 112 | + |
| 113 | +#internal name: compute_stress_1 |
| 114 | +#scripting name: compute_stress_1_1 |
| 115 | +class InputsComputeStress11(_Inputs): |
| 116 | + """Intermediate class used to connect user inputs to compute_stress_1_1 operator |
| 117 | +
|
| 118 | + Examples |
| 119 | + -------- |
| 120 | + >>> from ansys.dpf import core as dpf |
| 121 | +
|
| 122 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 123 | + >>> my_scoping = dpf.Scoping() |
| 124 | + >>> op.inputs.scoping.connect(my_scoping) |
| 125 | + >>> my_streams_container = dpf.StreamsContainer() |
| 126 | + >>> op.inputs.streams_container.connect(my_streams_container) |
| 127 | + >>> my_data_sources = dpf.DataSources() |
| 128 | + >>> op.inputs.data_sources.connect(my_data_sources) |
| 129 | + >>> my_requested_location = str() |
| 130 | + >>> op.inputs.requested_location.connect(my_requested_location) |
| 131 | + >>> my_strain = dpf.FieldsContainer() |
| 132 | + >>> op.inputs.strain.connect(my_strain) |
| 133 | + """ |
| 134 | + def __init__(self, op: Operator): |
| 135 | + super().__init__(compute_stress_1_1._spec().inputs, op) |
| 136 | + self._scoping = Input(compute_stress_1_1._spec().input_pin(1), 1, op, -1) |
| 137 | + self._inputs.append(self._scoping) |
| 138 | + self._streams_container = Input(compute_stress_1_1._spec().input_pin(3), 3, op, -1) |
| 139 | + self._inputs.append(self._streams_container) |
| 140 | + self._data_sources = Input(compute_stress_1_1._spec().input_pin(4), 4, op, -1) |
| 141 | + self._inputs.append(self._data_sources) |
| 142 | + self._requested_location = Input(compute_stress_1_1._spec().input_pin(9), 9, op, -1) |
| 143 | + self._inputs.append(self._requested_location) |
| 144 | + self._strain = Input(compute_stress_1_1._spec().input_pin(10), 10, op, -1) |
| 145 | + self._inputs.append(self._strain) |
| 146 | + |
| 147 | + @property |
| 148 | + def scoping(self): |
| 149 | + """Allows to connect scoping input to the operator |
| 150 | +
|
| 151 | + - pindoc: The element scoping on which the result is computed. |
| 152 | +
|
| 153 | + Parameters |
| 154 | + ---------- |
| 155 | + my_scoping : Scoping, |
| 156 | +
|
| 157 | + Examples |
| 158 | + -------- |
| 159 | + >>> from ansys.dpf import core as dpf |
| 160 | +
|
| 161 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 162 | + >>> op.inputs.scoping.connect(my_scoping) |
| 163 | + >>> #or |
| 164 | + >>> op.inputs.scoping(my_scoping) |
| 165 | +
|
| 166 | + """ |
| 167 | + return self._scoping |
| 168 | + |
| 169 | + @property |
| 170 | + def streams_container(self): |
| 171 | + """Allows to connect streams_container input to the operator |
| 172 | +
|
| 173 | + - pindoc: Needed to get mesh and material ids. Optional if a data_sources have been connected. |
| 174 | +
|
| 175 | + Parameters |
| 176 | + ---------- |
| 177 | + my_streams_container : StreamsContainer, |
| 178 | +
|
| 179 | + Examples |
| 180 | + -------- |
| 181 | + >>> from ansys.dpf import core as dpf |
| 182 | +
|
| 183 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 184 | + >>> op.inputs.streams_container.connect(my_streams_container) |
| 185 | + >>> #or |
| 186 | + >>> op.inputs.streams_container(my_streams_container) |
| 187 | +
|
| 188 | + """ |
| 189 | + return self._streams_container |
| 190 | + |
| 191 | + @property |
| 192 | + def data_sources(self): |
| 193 | + """Allows to connect data_sources input to the operator |
| 194 | +
|
| 195 | + - pindoc: Needed to get mesh and material ids. Optional if a streams_container have been connected. |
| 196 | +
|
| 197 | + Parameters |
| 198 | + ---------- |
| 199 | + my_data_sources : DataSources, |
| 200 | +
|
| 201 | + Examples |
| 202 | + -------- |
| 203 | + >>> from ansys.dpf import core as dpf |
| 204 | +
|
| 205 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 206 | + >>> op.inputs.data_sources.connect(my_data_sources) |
| 207 | + >>> #or |
| 208 | + >>> op.inputs.data_sources(my_data_sources) |
| 209 | +
|
| 210 | + """ |
| 211 | + return self._data_sources |
| 212 | + |
| 213 | + @property |
| 214 | + def requested_location(self): |
| 215 | + """Allows to connect requested_location input to the operator |
| 216 | +
|
| 217 | + - pindoc: Average the Elemental Nodal result to the requested location. |
| 218 | +
|
| 219 | + Parameters |
| 220 | + ---------- |
| 221 | + my_requested_location : str, |
| 222 | +
|
| 223 | + Examples |
| 224 | + -------- |
| 225 | + >>> from ansys.dpf import core as dpf |
| 226 | +
|
| 227 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 228 | + >>> op.inputs.requested_location.connect(my_requested_location) |
| 229 | + >>> #or |
| 230 | + >>> op.inputs.requested_location(my_requested_location) |
| 231 | +
|
| 232 | + """ |
| 233 | + return self._requested_location |
| 234 | + |
| 235 | + @property |
| 236 | + def strain(self): |
| 237 | + """Allows to connect strain input to the operator |
| 238 | +
|
| 239 | + - pindoc: Field/or fields container containing only the elastic strain field (element nodal). |
| 240 | +
|
| 241 | + Parameters |
| 242 | + ---------- |
| 243 | + my_strain : FieldsContainer, Field, |
| 244 | +
|
| 245 | + Examples |
| 246 | + -------- |
| 247 | + >>> from ansys.dpf import core as dpf |
| 248 | +
|
| 249 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 250 | + >>> op.inputs.strain.connect(my_strain) |
| 251 | + >>> #or |
| 252 | + >>> op.inputs.strain(my_strain) |
| 253 | +
|
| 254 | + """ |
| 255 | + return self._strain |
| 256 | + |
| 257 | +class OutputsComputeStress11(_Outputs): |
| 258 | + """Intermediate class used to get outputs from compute_stress_1_1 operator |
| 259 | + Examples |
| 260 | + -------- |
| 261 | + >>> from ansys.dpf import core as dpf |
| 262 | +
|
| 263 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 264 | + >>> # Connect inputs : op.inputs. ... |
| 265 | + >>> result_fields_container = op.outputs.fields_container() |
| 266 | + """ |
| 267 | + def __init__(self, op: Operator): |
| 268 | + super().__init__(compute_stress_1_1._spec().outputs, op) |
| 269 | + self._fields_container = Output(compute_stress_1_1._spec().output_pin(0), 0, op) |
| 270 | + self._outputs.append(self._fields_container) |
| 271 | + |
| 272 | + @property |
| 273 | + def fields_container(self): |
| 274 | + """Allows to get fields_container output of the operator |
| 275 | +
|
| 276 | +
|
| 277 | + - pindoc: The computed result fields container (elemental nodal). |
| 278 | +
|
| 279 | + Returns |
| 280 | + ---------- |
| 281 | + my_fields_container : FieldsContainer, |
| 282 | +
|
| 283 | + Examples |
| 284 | + -------- |
| 285 | + >>> from ansys.dpf import core as dpf |
| 286 | +
|
| 287 | + >>> op = dpf.operators.result.compute_stress_1_1() |
| 288 | + >>> # Connect inputs : op.inputs. ... |
| 289 | + >>> result_fields_container = op.outputs.fields_container() |
| 290 | + """ |
| 291 | + return self._fields_container |
| 292 | + |
0 commit comments