This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/
FieldModel.py
247 lines (225 loc) · 10 KB
/
FieldModel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
from abaqusConstants import *
from .DataTableArray import DataTableArray
from .DiscreteField import DiscreteField
from .ExpressionField import ExpressionField
from .MappedField import MappedField
from ..Model.ModelBase import ModelBase
class FieldModel(ModelBase):
def DiscreteField(
self,
name: str,
defaultValues: tuple,
fieldType: SymbolicConstant,
location: SymbolicConstant = NODES,
dataWidth: int = 1,
data: DataTableArray = None,
description: str = "",
orientationType: SymbolicConstant = CARTESIAN,
partLevelOrientation: Boolean = OFF,
) -> DiscreteField:
"""This method creates a DiscreteField object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].DiscreteField
Parameters
----------
name
A String specifying the repository key.
defaultValues
A sequence of Floats specifying a sequence of floats specifying the default values.
fieldType
A SymbolicConstant or an Int specifying the type of data represented by this discrete
field. Possible values are SCALAR, ORIENTATION, and PRESCRIBEDCONDITION_DOF.
location
A SymbolicConstant or an Int specifying the location of the domain data. Possible values
are NODES and ELEMENTS. The default value is NODES.
dataWidth
An Int specifying the width of the supplied data. The default value is 1.
data
A DataTableArray object.
description
A String specifying the description of the field. The default value is an empty string.
orientationType
A SymbolicConstant specifying the type of the system being described by a discrete field
used for an orientation. Possible values are CARTESIAN, CYLINDRICAL, and SPHERICAL. The
default value is CARTESIAN.
partLevelOrientation
A Boolean specifying whether or not the orientations are described in terms of part
level coordinates. The default value is OFF.
Returns
-------
A DiscreteField object.
Raises
------
AbaqusException.
"""
self.discreteFields[name] = discreteField = DiscreteField(
name,
defaultValues,
fieldType,
location,
dataWidth,
data,
description,
orientationType,
partLevelOrientation,
)
return discreteField
def ExpressionField(
self, name: str, expression: str, localCsys: str = None, description: str = ""
) -> ExpressionField:
"""This method creates an ExpressionField object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].ExpressionField
Parameters
----------
name
A String specifying the repository key.
expression
A String specifying the Python expression to evaluate in space. Variables are X, Y, and
Z; R, Th, and Z; or R, Th, and P based on the selected coordinate system.
localCsys
None or a DatumCsys object specifying the local coordinate system of the field. If
*localCsys*=None, the field is defined in the global coordinate system. The default
value is None.
description
A String specifying the description of the field. The default value is an empty string.
Returns
-------
An ExpressionField object.
Raises
------
TextException.
"""
self.analyticalFields[name] = expressionField = ExpressionField(
name, expression, localCsys, description
)
return expressionField
def MappedField(
self,
name: str,
regionType: SymbolicConstant = POINT,
partLevelData: Boolean = OFF,
pointDataFormat: SymbolicConstant = XYZ,
gridPointPlane: SymbolicConstant = XYPLANE,
defaultUnMappedValue: float = 0,
mappingAlgorithm: SymbolicConstant = SURFACE,
searchTolType: SymbolicConstant = RELATIVE,
boundarySearchTol: float = 0,
neighborhoodSearchTol: float = 1000000,
negativeNormalSearchTol: float = 0,
positiveNormalSearchTol: float = 0,
scaleCoordinates: Boolean = OFF,
gridPointData: tuple = (),
xyzPointData: tuple = (),
coordinateScalingFactors: tuple = (),
localCsys: str = None,
description: str = "",
) -> MappedField:
"""This method creates an MappedField object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].MappedField
Parameters
----------
name
A String specifying the repository key.
regionType
A SymbolicConstant specifying the data source region type. It can be either an ODB mesh
or a cloud of points. Possible values are MESH and POINT. The default value is POINT.
partLevelData
A Boolean specifying whether or not the point cloud source data are described in terms
of part level coordinates. If part level coordinates is employed, the local coordinate
system defined in *localCsys* will be ignored. The default value is OFF.
pointDataFormat
A SymbolicConstant specifying point cloud source data format. Possible values are GRID
and XYZ. The default value is XYZ.
gridPointPlane
A SymbolicConstant specifying the plane on which the point cloud source data of grid
format are described. Possible values are XYPLANE, YZPLANE, and XZPLANE. The default
value is XYPLANE.
defaultUnMappedValue
A Float specifying the parameter (field) value reported when a value cannot be
calculated from the data source. The default value is 0.0.
mappingAlgorithm
A SymbolicConstant specifying the mapping algorithm for target surface, or on mesh
target model when the parameter value are located at nodes, for example nodal
temperatures. Possible values are SURFACE and VOLUMETRIC. The default value is SURFACE.
searchTolType
A SymbolicConstant specifying searching tolerance type in terms of absolute value or a
fraction of the average of all element characteristic length in target model region.
Possible values are ABSOLUTE and RELATIVE. The default value is RELATIVE.
boundarySearchTol
A Float specifying the search distance tolerance value on the exterior boundary of
target model region. Source points within this distance will be included in computing
the parameter value of target region. This tolerance applies to both surface and
volumetric mapping. The default value is 0.01.
neighborhoodSearchTol
A Float specifying the search distance tolerance value used for distance weighting
algorithm. Source points within this distance will be included in computing the
parameter value of target region. This tolerance only applies to surface mapping. The
default value is 1000000.0.
negativeNormalSearchTol
A Float specifying the search distance tolerance value in the negative normal of target
surface region. Source points within this distance will be included in computing the
parameter value of target region. This tolerance only applies to surface mapping. The
default value is 0.15.
positiveNormalSearchTol
A Float specifying the search distance tolerance value in the positive normal of target
surface region. Source points within this distance will be included in computing the
parameter value of target region. This tolerance only applies to surface mapping. The
default value is 0.05.
scaleCoordinates
A Boolean specifying whether or not to scale the user-supplied coordinate values from
the point cloud or indicated ODB. The default value is OFF.
gridPointData
A sequence of sequences of Floats specifying the point cloud source data of grid format.
The default value is an empty sequence.
xyzPointData
A sequence of sequences of Floats specifying the point cloud source data of XYZ format.
Each data item is defining the XYZ coordinates of a point and its field value. The
default value is an empty sequence.
coordinateScalingFactors
A sequence of Floats specifying the scaling factors for the global 1, 2 and 3
directions. The default value is (1.0, 1.0, 1.0).
localCsys
None or a DatumCsys object specifying the local coordinate system of the field. If
*localCsys*=None, the field is defined in the global coordinate system. The default
value is None.
description
A String specifying the description of the field. The default value is an empty string.
Returns
-------
A MappedField object.
Raises
------
AbaqusException.
"""
self.analyticalFields[name] = mappedField = MappedField(
name,
regionType,
partLevelData,
pointDataFormat,
gridPointPlane,
defaultUnMappedValue,
mappingAlgorithm,
searchTolType,
boundarySearchTol,
neighborhoodSearchTol,
negativeNormalSearchTol,
positiveNormalSearchTol,
scaleCoordinates,
gridPointData,
xyzPointData,
coordinateScalingFactors,
localCsys,
description,
)
return mappedField