-
Notifications
You must be signed in to change notification settings - Fork 23
Example/example re assembling fields #1726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
840bac9
4216984
d014fa4
06dee83
ca976ce
cbf8bf6
d62c54c
1d9937c
e616bf0
96f9357
4679b9b
ac78d86
993ee2c
c9f3aa5
354b8ca
e64a31c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,95 @@ | ||||||||||||||
| """ | ||||||||||||||
| .. _ref_matrix-operations: | ||||||||||||||
|
|
||||||||||||||
| Matrix Operations | ||||||||||||||
| ~~~~~~~~~~~~~~~~~ | ||||||||||||||
|
|
||||||||||||||
| This example shows how to do some matrix operations, including basic mathematical operations (power, add and multiply by | ||||||||||||||
| a constant, add field containers and invert) and separating and assembling fields and fields containers. | ||||||||||||||
|
|
||||||||||||||
| """ | ||||||||||||||
|
|
||||||||||||||
| ############################################################################### | ||||||||||||||
| # Import the ``ansys.dpf.core`` module, included examples file, and the ``DpfPlotter`` | ||||||||||||||
| # module. | ||||||||||||||
| from ansys.dpf import core as dpf | ||||||||||||||
| from ansys.dpf.core import examples | ||||||||||||||
| import ansys.dpf.core.operators.math as maths | ||||||||||||||
|
|
||||||||||||||
| ############################################################################### | ||||||||||||||
| # Open an example and print the ``Model`` object. Here a result file from a crankshaft | ||||||||||||||
|
||||||||||||||
| # Open an example and print the ``Model`` object. Here a result file from a crankshaft | |
| # Load an example and print the ``Model`` object. Here a result file from a crankshaft |
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| my_stress = my_model.results.stress(mesh_scoping=my_nodes_scoping).eval() | |
| # Here we need to average the result from 'elemental_nodal' to an 'elemental' location to | |
| # facilitate the visualisation of the plot | |
| my_avg_stress = dpf.operators.averaging.to_elemental_fc(fields_container=my_stress, mesh=my_mesh).eval() | |
| my_avg_stress = my_model.results.stress(mesh_scoping=my_nodes_scoping).on_location(dpf.locations.elemental).eval() |
You can also directly request the result as "elemental" like shown above
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably lack an operator to do this in one go, which would return a FieldsContainer labeled by 'component'.
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
luisaFelixSalles marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now there is only one
Uh oh!
There was an error while loading. Please reload this page.