-
Notifications
You must be signed in to change notification settings - Fork 10
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
Average per body #690
Average per body #690
Conversation
…h_selection' into jvonrick/fix_skin_extraction_with_selection
@@ -254,6 +254,7 @@ def _get_result_workflow( | |||
|
|||
_connect_initial_results_inputs( | |||
initial_result_workflow=initial_result_workflow, | |||
split_by_body_workflow=None, |
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.
not supported for fluid simulations
): | ||
res = _result_properties[base_name] if base_name in _result_properties else None | ||
native_location = res["location"] if res is not None else None | ||
|
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 need to force elemental nodal if average_across_bodies is False
names_field.get_entity_data_by_id(value)[0] + f" ({value})" | ||
for value in values | ||
] | ||
if label == "mat": |
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.
I'm not sure this is the right way to do this. Using the code currently in the else block was not working for the "mat" label.
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.
@janvonrickenbach here the logic is to expose names whenever available instead of IDs. I think this is going to need a rework.
I do not think we have access to material names, so what you did is ok for me.
I think in your case the prrevious code was supposed to end-up in the except.
…into jvonrick/average_per_body_impl
Split the mesh with a (currently hardcoded) list of properties
@@ -66,14 +68,9 @@ def _get_result_workflow( | |||
mesh=self.mesh._meshed_region, | |||
location=location, | |||
force_elemental_nodal=result_workflows.force_elemental_nodal, | |||
averaging_config=averaging_config, | |||
) | |||
|
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.
Not needed anymore, the mesh is already available on the simulation object.
|
||
|
||
default_per_body_averaging_config = AveragingConfig( | ||
body_defining_properties=[ |
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.
to prevent string duplications, could you please use ansys.dpf.core.common.elemental_properties?
"apdl_element_type", | ||
"elshape", | ||
"apdl_real_id", | ||
], |
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.
By default do we split over all combinations of these properties?
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.
This configuration is currently only used in the tests. We are still evaluating what are the best properties to split so we get the bodies the user expects. Once we have consolidated that a bit more we can define a default.
selection_wf.connect(_WfNames.initial_mesh, mesh) | ||
|
||
if averaging_config.average_per_body: | ||
_enrich_mesh_with_property_fields( |
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.
I thought that the Operator splitting the mesh with a scoping had an option for that?
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.
I don't see anything related in the docs: https://dpf.docs.pyansys.com/version/stable/operator_reference_load.html split on property type Note: We split the scoping, not the mesh.
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.
You don't use "meshes::by_scopings" ?
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.
No its scoping::by_property. We split the scoping and average the results separately. But all the results have still the original mesh as a support.
default_per_body_averaging_config = AveragingConfig( | ||
body_defining_properties=[ | ||
elemental_properties.material, | ||
"mapdl_element_type_id", |
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.
@janvonrickenbach is this one specific to your use-case or is it the same as apdl_element_type
?
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.
As discussed: moved this default config which is not very generic to the tests
average_per_body: bool = False | ||
|
||
|
||
default_per_body_averaging_config = AveragingConfig( |
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.
@janvonrickenbach the default averaging config is then dedicated to MAPDL results. Should this be dependent on the type of analysis?
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.
As discussed: moved this default config which is not very generic to the tests
…into jvonrick/average_per_body_impl
Adds an averaging_config to the _get_results and _get_results_workflow functions of
By default the averaging happens across bodies, which is the current behavior. If average_per_body is activated, the results are averaged per body and the resulting Dataframe/FieldsContainer contains separate fields for each body (with the a tuple of the selected properties with which a body is identified). The properties by which bodies are identified are configurable. The tests use the properties "mat", "apdl_element_type", "elshape" and "apdl_real_id". The flag is currently not exposed for the results functions (stress, stress_nodal etc). The mesh support of the fields is always the full mesh.