1111
1212
1313class elemental_to_nodal (Operator ):
14- """Transforms an Elemental Nodal field to a Nodal field. The result is
15- computed on a given node's scoping.
14+ """Transforms an Elemental field to a Nodal field. The result is computed
15+ on a given node's scoping. 1. For a finite element mesh, the
16+ value on a node is the average of the values of the neighbour
17+ elements. 2. For a volume finite volume mesh, the agorithm is :
18+ - For each node, compute interpolation weights for the cells
19+ connected to it based on the Frink's Laplacian method. -
20+ If the determinant of the I matrix is zero, switch to an inverse
21+ distance weighted average. - If not, compute the Frink
22+ weights and apply the Holmes' weight clip. - If the
23+ clipping produces a large overshoot, inverse volume weighted
24+ average is used.. 3. For a face finite volume mesh inverse
25+ distance weighted average is used.
1626
1727 Parameters
1828 ----------
@@ -24,6 +34,10 @@ class elemental_to_nodal(Operator):
2434 Averaging on nodes is used if this pin is set
2535 to 1 (default is 1 for integrated
2636 results and 0 for discrete ones).
37+ algorithm : int, optional
38+ Forces the usage of algorithm 1, 2 or 3
39+ (default is chosen based on the type
40+ of mesh).
2741
2842
2943 Examples
@@ -40,12 +54,15 @@ class elemental_to_nodal(Operator):
4054 >>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
4155 >>> my_force_averaging = int()
4256 >>> op.inputs.force_averaging.connect(my_force_averaging)
57+ >>> my_algorithm = int()
58+ >>> op.inputs.algorithm.connect(my_algorithm)
4359
4460 >>> # Instantiate operator and connect inputs in one line
4561 >>> op = dpf.operators.averaging.elemental_to_nodal(
4662 ... field=my_field,
4763 ... mesh_scoping=my_mesh_scoping,
4864 ... force_averaging=my_force_averaging,
65+ ... algorithm=my_algorithm,
4966 ... )
5067
5168 >>> # Get output data
@@ -57,6 +74,7 @@ def __init__(
5774 field = None ,
5875 mesh_scoping = None ,
5976 force_averaging = None ,
77+ algorithm = None ,
6078 config = None ,
6179 server = None ,
6280 ):
@@ -69,11 +87,24 @@ def __init__(
6987 self .inputs .mesh_scoping .connect (mesh_scoping )
7088 if force_averaging is not None :
7189 self .inputs .force_averaging .connect (force_averaging )
90+ if algorithm is not None :
91+ self .inputs .algorithm .connect (algorithm )
7292
7393 @staticmethod
7494 def _spec ():
75- description = """Transforms an Elemental Nodal field to a Nodal field. The result is
76- computed on a given node's scoping."""
95+ description = """Transforms an Elemental field to a Nodal field. The result is computed
96+ on a given node's scoping. 1. For a finite element mesh,
97+ the value on a node is the average of the values of the
98+ neighbour elements. 2. For a volume finite volume mesh,
99+ the agorithm is : - For each node, compute
100+ interpolation weights for the cells connected to it based
101+ on the Frink's Laplacian method. - If the
102+ determinant of the I matrix is zero, switch to an inverse
103+ distance weighted average. - If not, compute the
104+ Frink weights and apply the Holmes' weight clip. -
105+ If the clipping produces a large overshoot, inverse volume
106+ weighted average is used.. 3. For a face finite volume
107+ mesh inverse distance weighted average is used."""
77108 spec = Specification (
78109 description = description ,
79110 map_input_pin_spec = {
@@ -98,6 +129,14 @@ def _spec():
98129 to 1 (default is 1 for integrated
99130 results and 0 for discrete ones).""" ,
100131 ),
132+ 200 : PinSpecification (
133+ name = "algorithm" ,
134+ type_names = ["int32" ],
135+ optional = True ,
136+ document = """Forces the usage of algorithm 1, 2 or 3
137+ (default is chosen based on the type
138+ of mesh).""" ,
139+ ),
101140 },
102141 map_output_pin_spec = {
103142 0 : PinSpecification (
@@ -161,6 +200,8 @@ class InputsElementalToNodal(_Inputs):
161200 >>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
162201 >>> my_force_averaging = int()
163202 >>> op.inputs.force_averaging.connect(my_force_averaging)
203+ >>> my_algorithm = int()
204+ >>> op.inputs.algorithm.connect(my_algorithm)
164205 """
165206
166207 def __init__ (self , op : Operator ):
@@ -173,6 +214,8 @@ def __init__(self, op: Operator):
173214 elemental_to_nodal ._spec ().input_pin (2 ), 2 , op , - 1
174215 )
175216 self ._inputs .append (self ._force_averaging )
217+ self ._algorithm = Input (elemental_to_nodal ._spec ().input_pin (200 ), 200 , op , - 1 )
218+ self ._inputs .append (self ._algorithm )
176219
177220 @property
178221 def field (self ):
@@ -235,6 +278,28 @@ def force_averaging(self):
235278 """
236279 return self ._force_averaging
237280
281+ @property
282+ def algorithm (self ):
283+ """Allows to connect algorithm input to the operator.
284+
285+ Forces the usage of algorithm 1, 2 or 3
286+ (default is chosen based on the type
287+ of mesh).
288+
289+ Parameters
290+ ----------
291+ my_algorithm : int
292+
293+ Examples
294+ --------
295+ >>> from ansys.dpf import core as dpf
296+ >>> op = dpf.operators.averaging.elemental_to_nodal()
297+ >>> op.inputs.algorithm.connect(my_algorithm)
298+ >>> # or
299+ >>> op.inputs.algorithm(my_algorithm)
300+ """
301+ return self ._algorithm
302+
238303
239304class OutputsElementalToNodal (_Outputs ):
240305 """Intermediate class used to get outputs from
0 commit comments