Shrediquette / PIVlab

Particle Image Velocimetry for Matlab, official repository
https://shrediquette.github.io/PIVlab/
MIT License
140 stars 34 forks source link

Wrong implementation equation for strain rate in postprocessing #82

Open mgvisakh opened 2 years ago

mgvisakh commented 2 years ago

The equation for strain rate given in PIVLab is ∂u/∂x - ∂v/∂y and is referred to in the paper "Stamhuis, E. J. (2006), Aquatic Ecology, 40(4), pp. 463–479.". However, this equation seems inconsistent with the classical definition in the literature (kindly refer to section 3.4 in Fluid Mechanics by Cohen and Kundu (edition 5) or section 2.4 of Viscous Fluid Flow by Papanastasiou or even Wikipedia https://en.wikipedia.org/wiki/Strain-rate_tensor). Strain rate is a tensor quantity, and cannot be described by a single scalar, to begin with. Strain rate tensor is defined as S = 1/2 (∇u + ∇u^T). It is a symmetric tensor, the off-diagonal elements are the same for 2D case, and is equal to 1/2(∂v/∂x + ∂u/∂y) which is the shear strain. The trace (sum of the diagonal elements) is the bulk /volumetric strain rate ∇.u = ∂u/∂x + ∂v/∂y for 2D case and is equal to the divergence of the velocity field, which is also the first invariant of the strain rate tensor. The diagonal components of the strain rate tensor are the linear (or extensional) strain rates i.e, for x-direction ∂u/∂x and for y-direction, ∂v/∂y separately. Their sum for 2D flows is the volumetric strain rate for compressible flows and is 0 for 2D incompressible flows. For 3D incompressible flows, this sum is -∂w/∂z which is the extensional rate in the out-of-plane direction. To summarize, the post-processing variables could be renamed as components of the strain rate tensor and could be as follows: Shear strain rate = (∂v/∂x + ∂u/∂y) Linear (extensional) strain rate in x-direction: ∂u/∂x; for y-direction: ∂v/∂y . Divergence of 2D field = ∇.u = ∂u/∂x + ∂v/∂y Linear (extensional) strain rate in out-of-plane direction (z) (only for incompressible flows): = -∇.u = -(∂u/∂x + ∂v/∂y) One can look up these definitions in the above-mentioned references or in section 7.5 of the book on Particle Image Velocimetry by Raffel et. al (3rd edition)

Shrediquette commented 2 years ago

You are suggesting to use the following variables:

However, I only have space for three of these (otherwise I need to do some more major changes).

1: AFAIK divergence should be ok in PIVlab (it uses Matlabs built-in function), and I would keep it as it is. 2: Then I would modify the currently named "simple strain rate" to the shear strain rate. 3: Which of the remaining parameters is most useful to users?

How would you code this in Matlab? The current implementation is as follows:

function out=strain(x,y,u,v) hx = x(1,:); hy = y(:,1); [px, junk] = gradient(u, hx, hy); [junk, qy] = gradient(v, hx, hy); %#ok<*ASGLU> out = px-qy;

function out=shear(x,y,u,v) hx = x(1,:); hy = y(:,1); [junk, py] = gradient(u, hx, hy); [qx, junk] = gradient(v, hx, hy); out= qx+py;

Thanks for your help and all the best, William