I’m trying to modify the cylinder2d example from the basic openLB install. I would like to modify the last ‘for loop’ to getStrainRate rather than getPressure. I see getPressure is related to scalarField2d while getStrainRate is related to TensorField2d but I can not figure out how to implement the additional argument associated with the functions of TensorFieldBase. Any help with this task would be greatly appreciated.

Ultimately I would like to implement a rheology curve in conjunction with multi-component flow around an obstruction. The upper fluid will have an initial velocity, at some critical point, the lower non-Newtonian fluid will begin to flow. I would like to calculate the strain rate of the lower fluid in order to update its viscosity.

These concepts are new to me and I am trying to practice with the examples by implementing single components of the code I will eventually write.

Here is the function I’ve modified. The calls associated with ScalarFieldBase work but I can’t get the call to getStrainRate (associated with tensorFieldBase to work.

In function void plotStatistics(olb::BlockStructure2D<T, olb::descriptors::ForcedShanChenD2Q9Descriptor> &, olb::BlockStructure2D<T, olb::descriptors::ForcedShanChenD2Q9Descriptor>&, int)': rayleighTaylor.cpp:165: error: no matching function for call toolb::graphics::ImageWriter::
writeScaledGif(std::string, const olb::TensorFieldBase2D<T, 3>&)’

Hello,
when you try to write a gif file, you have to write a scalarfield (gif images are 2D). Therefore you have to select a component of you tensor in order to write the file. Something like

A while back a needed some help creating a gif of strain rate. With the above help I was able to get the GIFs I wanted. I now need to capture the value of strain rate at each node. I’m trying to store the value as a double (gammaDot).

I’ve tried many things but the two below I feel are my best attempts.

I’ve tried
gammaDot = latticeOne.getDataAnalysis().getStrainRate().extractComponent(0);
It returns
error: cannot convert ‘const olb::ScalarFieldBase3D’ to ‘T’ in assignment.

I’ve tried
gammaDot = latticeOne.getDataAnalysis().getStrainRate().get().extractComponent(0);
It returns
error: no matching function for call to ‘olb::TensorFieldBase3D<T, 6>::get() const’

But you also can simplify that a bit. Get hte tensorfield, the get the tensor on the lattice node, and then get the value of the zeroth component of the tensor.