@@ -29,20 +29,22 @@ Basic maths
29
29
.. |norm | replace :: :class: `norm<ansys.dpf.core.operators.math.norm.norm> `
30
30
.. |norm_fc | replace :: :class: `norm_fc<ansys.dpf.core.operators.math.norm_fc.norm_fc> `
31
31
32
- This tutorial demonstrate how to do some basic mathematical operations with PyDPF-Core.
32
+ This tutorial demonstrates how to do some basic mathematical operations with PyDPF-Core.
33
33
34
- We use |Field | and |FieldsContainer | created from scratch to facilitate the understanding on how the mathematical operators works.
35
- For more information on creating a field from scratch check :ref: `ref_tutorials_data_structures `.
34
+ Here, we use |Fields | and |FieldsContainers | created from scratch to facilitate the understanding on how the
35
+ mathematical operators works.
36
+ For more information on creating a |Field | from scratch check :ref: `ref_tutorials_data_structures `.
36
37
37
38
Define the |Field | and |FieldsContainer |
38
39
----------------------------------------
39
40
40
- Define the |Fields | and |FieldsContainers | by choosing the number of entities, defining their ids, location and adding data.
41
+ Define the |Fields | and |FieldsContainers | by choosing the number of entities, defining their ids,
42
+ defining their location and adding data.
41
43
42
- If not specified the location is nodal by default.
44
+ If not specified the location is `` nodal `` by default.
43
45
44
46
We need to provide information about the scoping. DPF needs to know the IDs of the data we provide,
45
- so that it can apply an operator on the correspondent entities. For more detailed explanation see `Scoping handling `_
47
+ so that it can apply an operator on the corresponding entities. For more detailed explanation see `Scoping handling `_
46
48
47
49
.. code-block :: python
48
50
@@ -108,7 +110,7 @@ so that it can apply an operator on the correspondent entities. For more detaile
108
110
fc1 = dpf.fields_container_factory.over_time_freq_fields_container(fields = [field1, field2])
109
111
fc2 = dpf.fields_container_factory.over_time_freq_fields_container(fields = [field3, field4])
110
112
111
- # Check the Fields and FieldsContainer
113
+ # Check the Fields and FieldsContainers
112
114
print (" Field 1" ," \n " , field1 , " \n " )
113
115
print (" Field 2" ," \n " , field2 , " \n " )
114
116
print (" Field 3" ," \n " , field3 , " \n " )
@@ -139,7 +141,7 @@ so that it can apply an operator on the correspondent entities. For more detaile
139
141
print("FieldsContainer1", "\n ",fc1 , "\n ")
140
142
print("FieldsContainer2", "\n ",fc2 , "\n ")
141
143
142
- To make the mathematics operations, instantiate the operator and use ``eval() `` to compute and retrieve the result
144
+ To make the mathematics operations, instantiate the operators and use ``eval() `` to compute and retrieve the results.
143
145
144
146
Addition and Subtraction
145
147
------------------------
@@ -157,7 +159,7 @@ b) |accumulate| and |accumulate_fc| operators for the total sum of each componen
157
159
a) |add | and |add_fc | operators
158
160
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159
161
160
- - |add |: Sum between the data vectors for the correspondent entity id
162
+ - |add |: Sum between the data vectors for the corresponding entity id.
161
163
162
164
.. code-block :: python
163
165
@@ -176,7 +178,7 @@ a) |add| and |add_fc| operators
176
178
add_field = maths.add(fieldA=field1, fieldB=field2).eval()
177
179
print("Addition Fields",add_field , "\n ")
178
180
179
- - |add_fc |: Selects all fields with the same label space in the input |FieldsContainers | and add those together
181
+ - |add_fc |: Selects all fields with the same label space in the input |FieldsContainers | and add those together.
180
182
181
183
.. code-block :: python
182
184
@@ -211,9 +213,9 @@ b) |accumulate| and |accumulate_fc| operators
211
213
- |accumulate | : Sums all the elementary data of a field to produce one elementary data for each vector component.
212
214
You can give a scale ("ponderation") argument.
213
215
214
- Mind the |Fields | dimension: Our |Fields | represent 3D vectors so one elementary data is a 3D vector.
215
- The optional "ponderation" field is a field which attributes one value to multiply each data component per entity,
216
- so we need to change its dimensionality (1D).
216
+ Mind the |Fields | dimension: Our |Fields | represents 3D vectors, so one elementary data is a 3D vector.
217
+ The optional "ponderation" | Field | is a | Field | that attributes the values to be multiplied by each data
218
+ component of the entities. Thus, we need to change its dimensionality (1D).
217
219
218
220
.. code-block :: python
219
221
@@ -309,7 +311,7 @@ Subtraction
309
311
310
312
Here we use:
311
313
312
- a) |minus | operator to compute the difference between the data vectors for the correspondent entity id of |Fields |
314
+ a) |minus | operator to compute the difference between the data vectors of the corresponding entities of |Fields |;
313
315
b) |minus_fc | operator that selects all fields with the same label space in the input |FieldsContainers |
314
316
and compute their difference.
315
317
@@ -370,7 +372,7 @@ This section shows how the basic product and division operators works.
370
372
Component-wise division
371
373
^^^^^^^^^^^^^^^^^^^^^^^
372
374
373
- These operators computes the component-wise division between two |Fields | (with the |component_wise_divide | operator)
375
+ These operators compute the component-wise division between two |Fields | (with the |component_wise_divide | operator)
374
376
or between two |FieldsContainers|(with the |component_wise_divide_fc | operator) with same dimensionality.
375
377
376
378
.. code-block :: python
@@ -420,7 +422,7 @@ or between two |FieldsContainers|(with the |component_wise_divide_fc| operator)
420
422
Cross product
421
423
^^^^^^^^^^^^^
422
424
423
- These operators computes the cross product between two vector |Fields | (with the |cross_product | operator)
425
+ These operators compute the cross product between two vector |Fields | (with the |cross_product | operator)
424
426
or between two |FieldsContainers|(with the |cross_product_fc | operator and with |Fields | with same label space).
425
427
The |Fields | can have the same location or Elemental Nodal and Nodal locations.
426
428
@@ -470,7 +472,7 @@ The |Fields| can have the same location or Elemental Nodal and Nodal locations.
470
472
Dot product
471
473
^^^^^^^^^^^
472
474
473
- These operators computes a general notion of inner product between between two vector |Fields |
475
+ These operators compute a general notion of inner product between between two vector |Fields |
474
476
(with the |generalized_inner_product | operator) or between two |FieldsContainers |
475
477
(with the |generalized_inner_product_fc | operator and with |Fields | with same label space).
476
478
The |Fields | may have different dimensionality.
@@ -522,7 +524,7 @@ Overall dot
522
524
^^^^^^^^^^^
523
525
524
526
The |overall_dot | operator computes a dot product between the entities of same ID of two |Fields | and then adds
525
- all the entities data to return a scalar
527
+ all the entities data to return a scalar.
526
528
527
529
.. code-block :: python
528
530
@@ -571,7 +573,7 @@ This section shows how the basic power operators works.
571
573
Squared
572
574
^^^^^^^
573
575
574
- These operators computes the element-wise data squared of a |Field | (with the |sqr | operator) and of |Fields | from a
576
+ These operators compute the element-wise data to the power of two of a |Field | (with the |sqr | operator) and of |Fields | from a
575
577
|FieldsContainer | (with the |sqr_fc | operator).
576
578
577
579
.. code-block :: python
@@ -620,8 +622,8 @@ These operators computes the element-wise data squared of a |Field| (with the |s
620
622
Power
621
623
^^^^^
622
624
623
- These operators computes the element-wise data power a factor of a |Field | (with the |pow | operator) and of | Fields | from a
624
- |FieldsContainer | (with the |pow_fc | operator).
625
+ These operators compute the element-wise data to the power of a given factor of a |Field | (with the |pow | operator)
626
+ and of | Fields | from a |FieldsContainer | (with the |pow_fc | operator).
625
627
626
628
.. code-block :: python
627
629
@@ -672,7 +674,7 @@ These operators computes the element-wise data power a factor of a |Field| (with
672
674
Norm
673
675
----
674
676
675
- These operators computes the element-wise Lp norm (Default Lp=L2 ) of a |Field | elementary data (with the |norm |
677
+ These operators compute the element-wise Lp norm (Default Lp=L2 ) of a |Field | elementary data (with the |norm |
676
678
operator) and of |Fields | elementary data from a |FieldsContainer | (with the |norm_fc | operator).
677
679
678
680
.. code-block :: python
@@ -722,9 +724,8 @@ operator) and of |Fields| elementary data from a |FieldsContainer| (with the |no
722
724
Scoping handling
723
725
----------------
724
726
725
- DPF needs to know the IDs of the data on the fields, so that it can apply an operator on on the correspondent entities.
726
-
727
- By providing these integers we only select the data with an ID in common.
727
+ DPF needs to know the IDs of the data on the fields. By providing these integers we only select
728
+ the data with an ID in common when using an operator
728
729
729
730
Here we will use two different fields to understand this functioning:
730
731
@@ -769,7 +770,7 @@ Here we will use two different fields to understand this functioning:
769
770
print(field6.data,"\n ")
770
771
771
772
772
- Here the only entities with matching ids the third one of the first field, and the first one of the
773
+ Here the only entities with matching ids are the third one of the first field, and the first one of the
773
774
second field. Other entities elementary data is not taken into account when using an operator that needs two operands.
774
775
775
776
For example the |add | operator:
0 commit comments