Compute Complex Results from Modal or Harmonic AnalysesΒΆ

This tutorial shows how to access complex results using the DPF-POST module API.

Get started

from ansys.dpf import post
from ansys.dpf.post import examples

Get the solution object

solution = post.load_solution(examples.complex_rst)
solution.has_complex_result()

Out:

True

Get displacement result

This result will contain a field for real values and a field for imaginary values)

disp_result = solution.displacement()

Check if the support has complex frequencies

disp_result.has_complex_frequencies()

Out:

True

Compute the result

disp = disp_result.vector
disp.num_fields

Out:

2

Deals with phase (phase unit is degree, phase must be a float)

phase = 39.0
disp_at_phase = disp_result.vector_at_phase(phase)
print(f'Maximum displacement at phase {phase}:', disp_at_phase.max_data)
print(f'There are {disp_at_phase.num_fields} fields')
real_field = disp_result.vector_at_phase(0.)
img_field = disp_result.vector_at_phase(90.)

real_field

Out:

Maximum displacement at phase 39.0: [[2.15187123e-09 2.15185939e-09 3.19282171e-10]]
There are 1 fields

<ansys.dpf.post.result_data.ResultData object at 0x000001D5379E1A30>

Get amplitude

disp_ampl = disp_result.vector_amplitude
disp_ampl.num_fields
disp_ampl.max_data

Out:

array([[2.76946052e-09, 2.76952555e-09, 4.10914321e-10]])

Total running time of the script: ( 0 minutes 0.251 seconds)

Gallery generated by Sphinx-Gallery