On 12/12/22 05:41, Abbas wrote:
>
> I am solving a vector problem similar to step-8. I have
> aVector<double> solution with u_x and u_y at each dof. I would like to have
> another Vector<double> magnitude which stores the magnitude \sqrt(u_x^2+u_y^2)
> at each dof. Now it is clear that solution has double the size of magnitude. I
> need to extract the values of the magnitude vector for my weak form within the
> assembly loop not for post-processing.
>
> Why do I need this? Well I don't actually want the magnitude exactly, but what
> I need is the maximum value of my magnitude when I iterate in time.
That sounds very much like you want to solve a nonlinear system -- for which
step-15 shows you how to access this sort of information.
The point to note regarding step-15, though, is that it never actually creates
a vector that stores what in your case is the magnitude. That's because the
magnitude you show above is not actually a finite element field even though
u_x and u_y are: Even though the latter are bilinear functions (assuming you
are using a Q1 element), the magnitude is not a binlinear function. As a
consequence, you don't want to compute it at each node and then interpolate it
at quadrature points; rather, you want to compute it at each quadrature point
from the original solutions u_x and u_y.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/