On 10/15/24 01:19, Yann Jobic wrote:
My next step is to compute that way (static condensation of the
pressure) the navier-stokes equations with a Newton non linear solver,
as in step-57, but i do it on a simpler problem first (stokes).
Thus if i define
{R(u,p)} = {-2*div u + \nabla p -f},
I want to compute ||R(u,p)||.
Yann,
so the residual for you is a function of x, and what you're looking to compute
is an integral (for the norm). Integrals in deal.II are always computed using
FEValues, and what you want here is going to look something like the following:
double integral = 0;
for (cell=...)
{
fe_values.reinit(cell);
fe_values[velocities].get_function_divergences(solution, div_u);
fe_values[pressure].get_function_gradients(solution, grad_p);
rhs.value_list(fe_values.quadrature_points(), f_values);
for(q=...)
integral += std::pow(-2*div_u[q] + grad_p[q] - f_values[q], 2) *
fe_values.JxW(q);
}
double norm = std::sqrt(integral);
(Your formula for the residual isn't correct because div u is a scalar and
you're adding grad p to it, which is a vector. This can't be right. I'll let
you fix this, and just wrote the code matching your formula.)
You might want to take a look at step-15 to see some of the parts I left out
above.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email: bange...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/19861833-037b-4ea3-8f2c-915d573ab946%40colostate.edu.