Dear all,
I am trying to find the gradient in both x and y directions of a variable on a 2D mesh. For variables that are defined per node, it is relatively easy. For instance, for Vx I do the following:
index = md.mesh.elements;
summation = ;
= GetNodalFunctionsCoeff(index,md.mesh.x,md.mesh.y);
ux = (Vx.*alpha)*summation;
uy = (Vx.*beta )*summation;
And that gives me d/dx (Vx) and d/dy (Vx) -- (correct me if I am wrong).
However, if I do the same thing for a variable that is already defined on the elements (e.g. driving stress obtained from = drivingstress(md) ), I get strange unstable patterns of very high and low values that don't make any sense.
I wonder if there is anyway that I can get the gradient of variables that are defined on the element, instead of the nodes.
One thought would be to interpolate/project the variables from elements to nodes and then execute the code above, but I couldn't figure that out either.
Any advice is greatly appreciated,
regards,
Soroush