Re: How to get the value with specific coordinate.
On 5/2/23 15:02, 潘梁柱 wrote:
Thanks a lot, I have some question about post-process and export data file. I've noticed that I can get "Mises_stress" by "get_von_mises_stress", but I don't know how to get the von_mises_strain. Since .vtk file stored a tensor, how can I get the specific component of the cauchy strain. Sfepy-view only shows the picture of the magnitude of cauchy strain.
Have a look at the beginning of post_process() function in [1]. The von Mises stress (= a scalar in each point) is obtained from the Cauchy stress tensor.
> -----原始邮件----- > 发件人: "Robert Cimrman" <cimrman3@ntc.zcu.cz> > 发送时间: 2023-04-25 16:01:08 (星期二) > 收件人: sfepy@python.org > 抄送: > 主题: [sfepy] Re: How to get the value with specific coordinate. > > Hello 潘梁柱, > > On 4/22/23 05:04, 潘梁柱 wrote: > > I have got the vtk file, which contains cauchy-strain, after runing 'sfepy-run sf.py'in command line. But I want to get the strain at the point (0, 0),(0.5, 0.5). And it will be better if i can export a data file that contains strain with its corresponding coordinates. > > Try something like > > vu = pb.get_variables()['u'] > vu.evaluate_at(nm.array([[0, 0], [0.5, 0.5]]), mode='cauchy_strain') > > in your postproc(). >
I still don't know how to get the strain value of the point [0.5, 0.5], after trying the above code and runing Sfepy-view command, I didn't see the strain value that I need appear in the Pyvista. Is the Sfepy-veiw step wrong? I just don't know where to see the "vu" defined in the code, is there any method I can save the value of "vu" in a text file?
sfepy-view is just a simple results viewer. You need to put the above code into a post-process hook function, see again [1], where the function is called post_process(). This function is called after the primary variables (= those in 'variables') are computed, and it is meant for user-defined post-processing. In your case that would be computing the von Mises stress, evaluating data in given points, saving those into a file, etc. This is not done automatically - a user must write such a function explicitly.
r.
[1] http://sfepy.org/doc-devel/examples/linear_elasticity-nodal_lcbcs.html
participants (1)
-
Robert Cimrman