Extract stress data

Hello Experts,
Is there any any way to get stress tensor, velocity on the flap wrt to displacement for perpendicular flap or turek-hron fsi3 tutorial ?


I am not sure if it exactly what you are looking for, but maybe the VTK export feature would help you. It was also mentioned in a recent thread.

Thanks @ajaust, your reply was helpful. Just a quick doubt can you tell me what are these files that are created in different timesteps?

Eg: take a look at timestep 0.02

I think these are output directories of OpenFOAM. Maybe you could check the OpenFOAM documentation to find more information about that. Maybe also someone else can comment on that because I am not an expert in OpenFOAM.

Just for better understanding. Do you want to extract the information about stress, velocity etc. extract from the coupling surface or from the whole fluid domain?

Thanks for your reply. However that is not what I need. I need the code to write different quantities than what it is doing now.
Right now the output of solid-dealli code writes only dispalcemnt and strain tensor in the vtk files for every time step. But I want the code to write displacement vector, velocity vector and stress tensor. How should I do?
The write command in the code is at:
line 1214 of nonlinear_elasticity.cc
data_out.add_data_vector(total_displacement, postprocessor);
I think that I need to change this line. Howvever I am not getting how to change this line.
Also I searched some variables representing stress, I found 3 different types

  1. external_stress
  2. referential_stress
  3. local_stress
    which one should I write. I need the stress to calculate the force vector and velocity, in order to calculate the kinetic energy of the flap.

Hi @daniel,

as @ajaust pointed out, the files created on your system are results files created by OpenFOAM for individual time steps. In principle, you can configure the output tick in the system/controlDict file for OpenFOAM.

It depends on which stress you need. Globally, there is only the external stress defined, which is also what OpenFOAM and preCICE delivers you. This quantity refers to the deformed configuration. The local_stress is only used during assembly and no worth mentioning here. The referential stress refers, as the name suggest to the reference configuration of your solid body. It is not globally defined though.

Note that there is an option in preCICE called watch-integral which would in theory calculate the force for you by integrating the force over the interface. Since preCICE does not take the deformation of the body into account, the result will be wrong in your case.
However, OpenFOAM has capabilities in order to compute the forces, which are also enabled by default in our FSI3 tutorial (note that the force is computed by default on the flap and the cylinder). The force data you are looking for is stored in thefluid-openfoam/postProcessing/forces/0 directory and you can define the settings for this feature in fluid-openfoam/system/controlDict. Unfortunately, the force is stored there for each coupling iteration, so that you need to clean up the file before you can actually plot it. I created once a shell script for this purpose, maybe I can dig it out if there is further interest in this.
If you still want to compute the force in deal.II and add it later to the vtk file: the Neumann assembly function creates essentially the force vector you are looking for.

Regarding the kinetic energy: I would recommend to compute it directly inside the deal.II solver, this is probably the easiest and cleanest way at all. If you still want to use the vtk files you can simply add the velocity to the DataOut object. Something like data_out.add_data_vector(velocity, "velocity"); should already do the job.

1 Like