@@ -265,9 +265,12 @@ energies_and_residuals(const typename DoFHandler<dim,spacedim>::active_cell_iter
265265// variables:
266266// velocity:
267267 const ResidualType &div_u = div_us[quad];
268+ const Tensor<1 , dim, ResidualType> &u = us[quad];
268269 const Tensor<1 , dim, ResidualType> &u_dot = us_dot[quad];
269270 const Tensor<2 , dim, ResidualType> &grad_u = grad_us[quad];
270271 const Tensor <2 , dim, ResidualType> &sym_grad_u = sym_grad_us[quad];
272+
273+
271274// displacement
272275 const Tensor<1 , dim, ResidualType> &d_dot = ds_dot[quad];
273276 const Tensor<2 , dim, ResidualType> &grad_d = grad_ds[quad];
@@ -308,7 +311,7 @@ energies_and_residuals(const typename DoFHandler<dim,spacedim>::active_cell_iter
308311// pressure:
309312 auto p_test = fev[pressure].value (i,quad);
310313 auto grad_p_test = fev[pressure].gradient (i,quad);
311-
314+
312315 // Preconditioner:
313316 residual[1 ][i] +=
314317 (
@@ -321,22 +324,22 @@ energies_and_residuals(const typename DoFHandler<dim,spacedim>::active_cell_iter
321324 )*JxW[quad];
322325
323326 // Navier Stokes:
324- res_u =
327+ res_u = J_ale * (
325328// time derivative term
326- rho*scalar_product ( u_dot , u_test )
327- //
328- + scalar_product ( grad_u * ( F_inv * ( u_old - d_dot ) ) , u_test )
329+ + rho * scalar_product (
330+ u_dot + grad_u * ( F_inv * ( u_old - d_dot ) ), u_test )
329331//
330- + scalar_product (sigma * Ft_inv, grad_u_test )
332+ + scalar_product (sigma * Ft_inv, grad_u_test ))
331333// divergence free constriant
332- - div_u * p_test;
334+ - div_u * p_test;
335+ // - scalar_product(J_ale * F_inv * u, grad_p_test); // TODO: muovere la divergenza a sinistra! se no c'é anche l'integrale sul bordo.
333336
334337 // ALE:
335338 res_d =
336339// Impose armonicity of d
337340 scalar_product ( grad_d , grad_d_test );
338341
339- residual[0 ][i] += (res_u * J_ale + res_d)*JxW[quad];
342+ residual[0 ][i] += (res_u + res_d)*JxW[quad];
340343 }
341344 }
342345
0 commit comments