37 template<
unsigned DIM>
42 const unsigned& which_one)
45 unsigned n_dof = ndof();
47 if ((which_one == 0) || (which_one == 1))
48 press_mass_diag.assign(n_dof, 0.0);
49 if ((which_one == 0) || (which_one == 2))
50 veloc_mass_diag.assign(n_dof, 0.0);
56 unsigned n_master = 1;
57 double hang_weight = 1.0;
60 unsigned n_node = nnode();
66 unsigned n_pres = this->npres_nst();
76 for (
unsigned i = 0;
i < DIM;
i++)
78 u_nodal_index[
i] = this->u_index_nst(
i);
83 int p_index = this->p_nodal_index_nst();
87 bool pressure_dof_is_hanging[n_pres];
93 for (
unsigned l = 0; l < n_pres; ++l)
95 pressure_dof_is_hanging[l] = pressure_node_pt(l)->is_hanging(p_index);
101 for (
unsigned l = 0; l < n_pres; ++l)
103 pressure_dof_is_hanging[l] =
false;
109 unsigned n_intpt = integral_pt()->nweight();
115 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
118 double w = integral_pt()->weight(ipt);
121 double J = J_eulerian_at_knot(ipt);
124 for (
unsigned i = 0;
i < DIM;
i++)
126 s[
i] = integral_pt()->knot(ipt,
i);
134 if ((which_one == 0) || (which_one == 2))
137 shape_at_knot(ipt, psi);
142 unsigned n_master = 1;
143 double hang_weight = 1.0;
147 for (
unsigned l = 0; l < n_node; l++)
150 bool is_node_hanging = node_pt(l)->is_hanging();
155 hang_info_pt = node_pt(l)->hanging_pt();
158 n_master = hang_info_pt->
nmaster();
167 for (
unsigned m = 0; m < n_master; m++)
170 for (
unsigned i = 0;
i < DIM;
i++)
177 local_eqn = this->local_hang_eqn(
186 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i]);
209 veloc_mass_diag[local_eqn] += pow(psi[l] * hang_weight, 2) *
W;
217 if ((which_one == 0) || (which_one == 1))
220 this->pshape_nst(
s, psi_p);
223 for (
unsigned l = 0; l < n_pres; l++)
226 if (pressure_dof_is_hanging[l])
230 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
233 n_master = hang_info_pt->
nmaster();
242 for (
unsigned m = 0; m < n_master; m++)
246 if (pressure_dof_is_hanging[l])
256 local_eqn = this->p_local_eqn(l);
275 press_mass_diag[local_eqn] += pow(psi_p[l] * hang_weight, 2) *
W;
289 template<
unsigned DIM>
295 if (ndof() == 0)
return;
298 unsigned n_node = nnode();
301 unsigned n_pres = this->npres_nst();
304 unsigned u_nodal_index[DIM];
305 for (
unsigned i = 0;
i < DIM;
i++)
307 u_nodal_index[
i] = this->u_index_nst(
i);
313 int p_index = this->p_nodal_index_nst();
317 bool pressure_dof_is_hanging[n_pres];
322 for (
unsigned l = 0; l < n_pres; ++l)
324 pressure_dof_is_hanging[l] = pressure_node_pt(l)->is_hanging(p_index);
332 "Pressure advection diffusion does not work in this case\n",
333 OOMPH_CURRENT_FUNCTION,
334 OOMPH_EXCEPTION_LOCATION);
336 for (
unsigned l = 0; l < n_pres; ++l)
338 pressure_dof_is_hanging[l] =
false;
344 DShape dpsidx(n_node, DIM);
347 Shape psip(n_pres), testp(n_pres);
348 DShape dpsip(n_pres, DIM);
349 DShape dtestp(n_pres, DIM);
352 unsigned n_intpt = integral_pt()->nweight();
359 double scaled_re = this->re() * this->density_ratio();
362 int local_eqn = 0, local_unknown = 0;
365 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
368 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
371 for (
unsigned i = 0;
i < DIM;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
374 double w = integral_pt()->weight(ipt);
378 double J = this->dshape_eulerian_at_knot(ipt, psif, dpsidx);
381 this->dpshape_and_dptest_eulerian_nst(
s, psip, dpsip, testp, dtestp);
393 for (
unsigned l = 0; l < n_pres; l++)
395 for (
unsigned i = 0;
i < DIM;
i++)
397 interpolated_dpdx[
i] += this->p_nst(l) * dpsip(l,
i);
404 for (
unsigned l = 0; l < n_node; l++)
407 for (
unsigned i = 0;
i < DIM;
i++)
410 double u_value = nodal_value(l, u_nodal_index[
i]);
411 interpolated_u[
i] += u_value * psif[l];
412 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
418 if (this->Press_adv_diff_source_fct_pt != 0)
420 source = this->Press_adv_diff_source_fct_pt(interpolated_x);
425 unsigned n_master = 1;
426 double hang_weight = 1.0;
430 for (
unsigned l = 0; l < n_pres; l++)
433 if (pressure_dof_is_hanging[l])
437 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
440 n_master = hang_info_pt->
nmaster();
449 for (
unsigned m = 0; m < n_master; m++)
453 if (pressure_dof_is_hanging[l])
463 local_eqn = this->p_local_eqn(l);
470 residuals[local_eqn] -= source * testp[l] *
W * hang_weight;
471 for (
unsigned k = 0; k < DIM; k++)
473 residuals[local_eqn] +=
474 interpolated_dpdx[k] *
475 (scaled_re * interpolated_u[k] * testp[l] + dtestp(l, k)) *
W *
483 unsigned n_master2 = 1;
484 double hang_weight2 = 1.0;
487 for (
unsigned l2 = 0; l2 < n_pres; l2++)
490 if (pressure_dof_is_hanging[l2])
493 this->pressure_node_pt(l2)->hanging_pt(p_index);
496 n_master2 = hang_info2_pt->nmaster();
505 for (
unsigned m2 = 0; m2 < n_master2; m2++)
509 if (pressure_dof_is_hanging[l2])
512 local_unknown = this->local_hang_eqn(
513 hang_info2_pt->master_node_pt(m2), p_index);
515 hang_weight2 = hang_info2_pt->master_weight(m2);
519 local_unknown = this->p_local_eqn(l2);
524 if (local_unknown >= 0)
526 if ((
int(eqn_number(local_eqn)) !=
527 this->Pinned_fp_pressure_eqn) &&
528 (
int(eqn_number(local_unknown)) !=
529 this->Pinned_fp_pressure_eqn))
531 for (
unsigned k = 0; k < DIM; k++)
533 jacobian(local_eqn, local_unknown) +=
535 (scaled_re * interpolated_u[k] * testp[l] +
537 W * hang_weight * hang_weight2;
542 if ((
int(eqn_number(local_eqn)) ==
543 this->Pinned_fp_pressure_eqn) &&
544 (int(eqn_number(local_unknown)) ==
545 this->Pinned_fp_pressure_eqn))
547 jacobian(local_eqn, local_unknown) = 1.0;
561 this->Pressure_advection_diffusion_robin_element_pt.size();
562 for (
unsigned e = 0;
e < nrobin;
e++)
564 this->Pressure_advection_diffusion_robin_element_pt[
e]
565 ->fill_in_generic_residual_contribution_fp_press_adv_diff_robin_bc(
566 residuals, jacobian, flag);
577 template<
unsigned DIM>
585 unsigned n_node = nnode();
588 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
591 unsigned n_pres = this->npres_nst();
594 unsigned u_nodal_index[DIM];
595 for (
unsigned i = 0;
i < DIM;
i++)
597 u_nodal_index[
i] = this->u_index_nst(
i);
602 int p_index = this->p_nodal_index_nst();
606 bool pressure_dof_is_hanging[n_pres];
611 for (
unsigned l = 0; l < n_pres; ++l)
613 pressure_dof_is_hanging[l] = pressure_node_pt(l)->is_hanging(p_index);
619 for (
unsigned l = 0; l < n_pres; ++l)
621 pressure_dof_is_hanging[l] =
false;
626 Shape psif(n_node), testf(n_node);
627 DShape dpsifdx(n_node, DIM), dtestfdx(n_node, DIM);
631 Shape psip(n_pres), testp(n_pres);
634 unsigned n_intpt = integral_pt()->nweight();
641 double scaled_re = this->re() * this->density_ratio();
642 double scaled_re_st = this->re_st() * this->density_ratio();
643 double scaled_re_inv_fr = this->re_invfr() * this->density_ratio();
644 double visc_ratio = this->viscosity_ratio();
648 int local_eqn = 0, local_unknown = 0;
651 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
654 bool ALE_is_disabled_flag = this->ALE_is_disabled;
657 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
660 for (
unsigned i = 0;
i < DIM;
i++)
662 s[
i] = integral_pt()->knot(ipt,
i);
666 double w = integral_pt()->weight(ipt);
669 double J = this->dshape_and_dtest_eulerian_at_knot_nst(
670 ipt, psif, dpsifdx, testf, dtestfdx);
673 this->pshape_nst(
s, psip, testp);
680 double interpolated_p = 0.0;
688 for (
unsigned l = 0; l < n_pres; l++)
690 interpolated_p += this->p_nst(l) * psip[l];
697 for (
unsigned l = 0; l < n_node; l++)
700 for (
unsigned i = 0;
i < DIM;
i++)
703 double u_value = this->nodal_value(l, u_nodal_index[
i]);
704 interpolated_u[
i] += u_value * psif[l];
705 interpolated_x[
i] += this->nodal_position(l,
i) * psif[l];
706 dudt[
i] += this->du_dt_nst(l,
i) * psif[l];
709 for (
unsigned j = 0; j < DIM; j++)
711 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
716 if (!ALE_is_disabled_flag)
719 for (
unsigned l = 0; l < n_node; l++)
722 for (
unsigned i = 0;
i < DIM;
i++)
724 mesh_veloc[
i] += this->dnodal_position_dt(l,
i) * psif[l];
731 this->get_body_force_nst(time, ipt,
s, interpolated_x, body_force);
734 double source = this->get_source_nst(time, ipt, interpolated_x);
740 unsigned n_master = 1;
741 double hang_weight = 1.0;
745 for (
unsigned l = 0; l < n_node; l++)
748 bool is_node_hanging = node_pt(l)->is_hanging();
753 hang_info_pt = node_pt(l)->hanging_pt();
756 n_master = hang_info_pt->
nmaster();
765 for (
unsigned m = 0; m < n_master; m++)
768 for (
unsigned i = 0;
i < DIM;
i++)
784 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i]);
797 sum += body_force[
i];
800 sum += scaled_re_inv_fr * G[
i];
803 sum -= scaled_re_st * dudt[
i];
806 for (
unsigned k = 0; k < DIM; k++)
808 double tmp = scaled_re * interpolated_u[k];
809 if (!ALE_is_disabled_flag)
811 tmp -= scaled_re_st * mesh_veloc[k];
813 sum -= tmp * interpolated_dudx(
i, k);
817 sum = (sum * testf[l] + interpolated_p * dtestfdx(l,
i)) *
W *
824 for (
unsigned k = 0; k < DIM; k++)
827 (interpolated_dudx(
i, k) +
828 this->Gamma[
i] * interpolated_dudx(k,
i)) *
829 dtestfdx(l, k) *
W * hang_weight;
833 residuals[local_eqn] += sum;
839 unsigned n_master2 = 1;
840 double hang_weight2 = 1.0;
842 for (
unsigned l2 = 0; l2 < n_node; l2++)
845 bool is_node2_hanging = node_pt(l2)->is_hanging();
848 if (is_node2_hanging)
850 hang_info2_pt = node_pt(l2)->hanging_pt();
852 n_master2 = hang_info2_pt->nmaster();
861 for (
unsigned m2 = 0; m2 < n_master2; m2++)
864 for (
unsigned i2 = 0; i2 < DIM; i2++)
868 if (is_node2_hanging)
871 local_unknown = this->local_hang_eqn(
872 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
874 hang_weight2 = hang_info2_pt->master_weight(m2);
879 this->nodal_local_eqn(l2, u_nodal_index[i2]);
884 if (local_unknown >= 0)
887 jacobian(local_eqn, local_unknown) -=
888 visc_ratio * this->Gamma[
i] * dpsifdx(l2,
i) *
889 dtestfdx(l, i2) *
W * hang_weight * hang_weight2;
892 jacobian(local_eqn, local_unknown) -=
893 scaled_re * psif[l2] * interpolated_dudx(
i, i2) *
894 testf[l] *
W * hang_weight * hang_weight2;
904 mass_matrix(local_eqn, local_unknown) +=
905 scaled_re_st * psif[l2] * testf[l] *
W *
906 hang_weight * hang_weight2;
910 jacobian(local_eqn, local_unknown) -=
912 node_pt(l2)->time_stepper_pt()->weight(1, 0) *
913 psif[l2] * testf[l] *
W * hang_weight *
917 for (
unsigned k = 0; k < DIM; k++)
919 double tmp = scaled_re * interpolated_u[k];
920 if (!ALE_is_disabled_flag)
922 tmp -= scaled_re_st * mesh_veloc[k];
925 jacobian(local_eqn, local_unknown) -=
926 tmp * dpsifdx(l2, k) * testf[l] *
W *
927 hang_weight * hang_weight2;
931 for (
unsigned k = 0; k < DIM; k++)
933 jacobian(local_eqn, local_unknown) -=
934 visc_ratio * dpsifdx(l2, k) * dtestfdx(l, k) *
W *
935 hang_weight * hang_weight2;
944 for (
unsigned l2 = 0; l2 < n_pres; l2++)
947 if (pressure_dof_is_hanging[l2])
950 this->pressure_node_pt(l2)->hanging_pt(p_index);
953 n_master2 = hang_info2_pt->nmaster();
962 for (
unsigned m2 = 0; m2 < n_master2; m2++)
966 if (pressure_dof_is_hanging[l2])
969 local_unknown = this->local_hang_eqn(
970 hang_info2_pt->master_node_pt(m2), p_index);
972 hang_weight2 = hang_info2_pt->master_weight(m2);
976 local_unknown = this->p_local_eqn(l2);
981 if (local_unknown >= 0)
983 jacobian(local_eqn, local_unknown) +=
984 psip[l2] * dtestfdx(l,
i) *
W * hang_weight *
1005 for (
unsigned l = 0; l < n_pres; l++)
1008 if (pressure_dof_is_hanging[l])
1012 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
1015 n_master = hang_info_pt->
nmaster();
1024 for (
unsigned m = 0; m < n_master; m++)
1028 if (pressure_dof_is_hanging[l])
1038 local_eqn = this->p_local_eqn(l);
1046 residuals[local_eqn] -= source * testp[l] *
W * hang_weight;
1049 for (
unsigned k = 0; k < DIM; k++)
1051 residuals[local_eqn] +=
1052 interpolated_dudx(k, k) * testp[l] *
W * hang_weight;
1058 unsigned n_master2 = 1;
1059 double hang_weight2 = 1.0;
1061 for (
unsigned l2 = 0; l2 < n_node; l2++)
1064 bool is_node2_hanging = node_pt(l2)->is_hanging();
1067 if (is_node2_hanging)
1069 hang_info2_pt = node_pt(l2)->hanging_pt();
1071 n_master2 = hang_info2_pt->nmaster();
1080 for (
unsigned m2 = 0; m2 < n_master2; m2++)
1083 for (
unsigned i2 = 0; i2 < DIM; i2++)
1087 if (is_node2_hanging)
1090 local_unknown = this->local_hang_eqn(
1091 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
1092 hang_weight2 = hang_info2_pt->master_weight(m2);
1097 this->nodal_local_eqn(l2, u_nodal_index[i2]);
1102 if (local_unknown >= 0)
1104 jacobian(local_eqn, local_unknown) +=
1105 dpsifdx(l2, i2) * testp[l] *
W * hang_weight *
1129 template<
unsigned DIM>
1140 const unsigned n_node = nnode();
1143 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
1146 const unsigned n_pres = this->npres_nst();
1149 unsigned u_nodal_index[DIM];
1150 for (
unsigned i = 0;
i < DIM;
i++)
1152 u_nodal_index[
i] = this->u_index_nst(
i);
1157 const int p_index = this->p_nodal_index_nst();
1161 bool pressure_dof_is_hanging[n_pres];
1167 for (
unsigned l = 0; l < n_pres; ++l)
1169 pressure_dof_is_hanging[l] = pressure_node_pt(l)->is_hanging(p_index);
1175 for (
unsigned l = 0; l < n_pres; ++l)
1177 pressure_dof_is_hanging[l] =
false;
1182 Shape psif(n_node), testf(n_node);
1183 DShape dpsifdx(n_node, DIM), dtestfdx(n_node, DIM);
1186 Shape psip(n_pres), testp(n_pres);
1189 const unsigned n_shape_controlling_node = nshape_controlling_nodes();
1193 DIM, n_shape_controlling_node, n_node, DIM);
1195 DIM, n_shape_controlling_node, n_node, DIM);
1209 const unsigned n_intpt = integral_pt()->nweight();
1216 double scaled_re = this->re() * this->density_ratio();
1217 double scaled_re_st = this->re_st() * this->density_ratio();
1218 double scaled_re_inv_fr = this->re_invfr() * this->density_ratio();
1219 double visc_ratio = this->viscosity_ratio();
1228 bool element_has_node_with_aux_node_update_fct =
false;
1230 std::map<Node*, unsigned> local_shape_controlling_node_lookup =
1231 shape_controlling_node_lookup();
1234 for (std::map<Node*, unsigned>::iterator it =
1235 local_shape_controlling_node_lookup.begin();
1236 it != local_shape_controlling_node_lookup.end();
1240 Node* nod_pt = it->first;
1243 unsigned q = it->second;
1248 element_has_node_with_aux_node_update_fct =
true;
1252 for (
unsigned i = 0;
i < DIM;
i++)
1254 u_ref[
i] = *(nod_pt->
value_pt(u_nodal_index[
i]));
1258 for (
unsigned p = 0; p < DIM; p++)
1261 double backup = nod_pt->
x(p);
1265 nod_pt->
x(p) += eps_fd;
1272 (*(nod_pt->
value_pt(u_nodal_index[p])) - u_ref[p]) / eps_fd;
1275 nod_pt->
x(p) = backup;
1290 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1293 for (
unsigned i = 0;
i < DIM;
i++)
1295 s[
i] = integral_pt()->knot(ipt,
i);
1299 const double w = integral_pt()->weight(ipt);
1303 this->dshape_and_dtest_eulerian_at_knot_nst(ipt,
1313 this->pshape_nst(
s, psip, testp);
1317 double interpolated_p = 0.0;
1325 for (
unsigned l = 0; l < n_pres; l++)
1327 interpolated_p += this->p_nst(l) * psip[l];
1333 for (
unsigned l = 0; l < n_node; l++)
1336 for (
unsigned i = 0;
i < DIM;
i++)
1339 const double u_value = nodal_value(l, u_nodal_index[
i]);
1340 interpolated_u[
i] += u_value * psif[l];
1341 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
1342 dudt[
i] += this->du_dt_nst(l,
i) * psif[l];
1345 for (
unsigned j = 0; j < DIM; j++)
1347 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
1352 if (!this->ALE_is_disabled)
1355 for (
unsigned l = 0; l < n_node; l++)
1358 for (
unsigned i = 0;
i < DIM;
i++)
1360 mesh_velocity[
i] += this->dnodal_position_dt(l,
i) * psif[l];
1368 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1371 for (
unsigned p = 0; p < DIM; p++)
1373 for (
unsigned i = 0;
i < DIM;
i++)
1375 for (
unsigned k = 0; k < DIM; k++)
1378 for (
unsigned j = 0; j < n_node; j++)
1381 nodal_value(j, u_nodal_index[
i]) * d_dpsifdx_dX(p, q, j, k);
1383 d_dudx_dX(p, q,
i, k) = aux;
1391 const double pos_time_weight =
1392 node_pt(0)->position_time_stepper_pt()->weight(1, 0);
1393 const double val_time_weight =
1394 node_pt(0)->time_stepper_pt()->weight(1, 0);
1398 this->get_body_force_nst(time, ipt,
s, interpolated_x, body_force);
1401 const double source = this->get_source_nst(time, ipt, interpolated_x);
1405 this->get_body_force_gradient_nst(
1406 time, ipt,
s, interpolated_x, d_body_force_dx);
1410 this->get_source_gradient_nst(time, ipt, interpolated_x, source_gradient);
1420 unsigned n_master = 1;
1421 double hang_weight = 1.0;
1424 for (
unsigned l = 0; l < n_node; l++)
1427 bool is_node_hanging = node_pt(l)->is_hanging();
1430 if (is_node_hanging)
1432 hang_info_pt = node_pt(l)->hanging_pt();
1435 n_master = hang_info_pt->
nmaster();
1444 for (
unsigned m = 0; m < n_master; m++)
1447 for (
unsigned i = 0;
i < DIM;
i++)
1451 if (is_node_hanging)
1454 local_eqn = this->local_hang_eqn(hang_info_pt->
master_node_pt(m),
1463 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i]);
1473 for (
unsigned p = 0; p < DIM; p++)
1476 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1482 double sum = body_force[
i] * testf[l];
1485 sum += scaled_re_inv_fr * testf[l] * G[
i];
1488 sum += interpolated_p * dtestfdx(l,
i);
1494 for (
unsigned k = 0; k < DIM; k++)
1497 (interpolated_dudx(
i, k) +
1498 this->Gamma[
i] * interpolated_dudx(k,
i)) *
1505 sum -= scaled_re_st * dudt[
i] * testf[l];
1508 for (
unsigned k = 0; k < DIM; k++)
1510 double tmp = scaled_re * interpolated_u[k];
1511 if (!this->ALE_is_disabled)
1513 tmp -= scaled_re_st * mesh_velocity[k];
1515 sum -= tmp * interpolated_dudx(
i, k) * testf[l];
1520 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1521 sum * dJ_dX(p, q) * w * hang_weight;
1527 sum = d_body_force_dx(
i, p) * psif(q) * testf(l);
1530 sum += interpolated_p * d_dtestfdx_dX(p, q, l,
i);
1533 for (
unsigned k = 0; k < DIM; k++)
1536 visc_ratio * ((interpolated_dudx(
i, k) +
1537 this->Gamma[
i] * interpolated_dudx(k,
i)) *
1538 d_dtestfdx_dX(p, q, l, k) +
1539 (d_dudx_dX(p, q,
i, k) +
1540 this->Gamma[
i] * d_dudx_dX(p, q, k,
i)) *
1545 for (
unsigned k = 0; k < DIM; k++)
1547 double tmp = scaled_re * interpolated_u[k];
1548 if (!this->ALE_is_disabled)
1550 tmp -= scaled_re_st * mesh_velocity[k];
1552 sum -= tmp * d_dudx_dX(p, q,
i, k) * testf(l);
1554 if (!this->ALE_is_disabled)
1556 sum += scaled_re_st * pos_time_weight * psif(q) *
1557 interpolated_dudx(
i, p) * testf(l);
1561 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1562 sum * J * w * hang_weight;
1570 if (element_has_node_with_aux_node_update_fct)
1573 for (
unsigned q_local = 0; q_local < n_node; q_local++)
1577 unsigned n_master2 = 1;
1578 double hang_weight2 = 1.0;
1582 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1584 Node* actual_shape_controlling_node_pt = node_pt(q_local);
1587 if (is_node_hanging2)
1589 hang_info2_pt = node_pt(q_local)->hanging_pt();
1592 n_master2 = hang_info2_pt->
nmaster();
1601 for (
unsigned mm = 0; mm < n_master2; mm++)
1603 if (is_node_hanging2)
1605 actual_shape_controlling_node_pt =
1611 unsigned q = local_shape_controlling_node_lookup
1612 [actual_shape_controlling_node_pt];
1615 for (
unsigned p = 0; p < DIM; p++)
1617 double sum = -visc_ratio * this->Gamma[
i] *
1618 dpsifdx(q_local,
i) * dtestfdx(l, p) -
1619 scaled_re * psif(q_local) *
1620 interpolated_dudx(
i, p) * testf(l);
1623 sum -= scaled_re_st * val_time_weight * psif(q_local) *
1625 for (
unsigned k = 0; k < DIM; k++)
1628 visc_ratio * dpsifdx(q_local, k) * dtestfdx(l, k);
1629 double tmp = scaled_re * interpolated_u[k];
1630 if (!this->ALE_is_disabled)
1632 tmp -= scaled_re_st * mesh_velocity[k];
1634 sum -= tmp * dpsifdx(q_local, k) * testf(l);
1638 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1639 sum * d_U_dX(p, q) * J * w * hang_weight * hang_weight2;
1656 for (
unsigned l = 0; l < n_pres; l++)
1659 if (pressure_dof_is_hanging[l])
1663 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
1666 n_master = hang_info_pt->
nmaster();
1675 for (
unsigned m = 0; m < n_master; m++)
1679 if (pressure_dof_is_hanging[l])
1689 local_eqn = this->p_local_eqn(l);
1697 for (
unsigned p = 0; p < DIM; p++)
1700 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1706 double aux = -source;
1709 for (
unsigned k = 0; k < DIM; k++)
1711 aux += interpolated_dudx(k, k);
1715 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1716 aux * dJ_dX(p, q) * testp[l] * w * hang_weight;
1723 aux = -source_gradient[p] * psif(q);
1724 for (
unsigned k = 0; k < DIM; k++)
1726 aux += d_dudx_dX(p, q, k, k);
1729 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1730 aux * testp[l] * J * w * hang_weight;
1737 if (element_has_node_with_aux_node_update_fct)
1740 for (
unsigned q_local = 0; q_local < n_node; q_local++)
1744 unsigned n_master2 = 1;
1745 double hang_weight2 = 1.0;
1749 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1751 Node* actual_shape_controlling_node_pt = node_pt(q_local);
1754 if (is_node_hanging2)
1756 hang_info2_pt = node_pt(q_local)->hanging_pt();
1759 n_master2 = hang_info2_pt->
nmaster();
1768 for (
unsigned mm = 0; mm < n_master2; mm++)
1770 if (is_node_hanging2)
1772 actual_shape_controlling_node_pt =
1778 unsigned q = local_shape_controlling_node_lookup
1779 [actual_shape_controlling_node_pt];
1782 for (
unsigned p = 0; p < DIM; p++)
1784 double aux = dpsifdx(q_local, p) * testp(l);
1785 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1786 aux * d_U_dX(p, q) * J * w * hang_weight * hang_weight2;
1807 if (this->tree_pt()->father_pt() != 0)
1816 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue() <=
1819 this->internal_data_pt(this->P_nst_internal_index)
1820 ->resize(this->npres_nst());
1824 Data* new_data_pt =
new Data(this->npres_nst());
1825 delete internal_data_pt(this->P_nst_internal_index);
1826 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1829 if (this->tree_pt()->father_pt() != 0)
1834 quadtree_pt()->father_pt()->object_pt());
1838 if (father_element_pt->p_order() == this->p_order())
1840 using namespace QuadTreeNames;
1843 int son_type = quadtree_pt()->son_type();
1873 OOMPH_CURRENT_FUNCTION,
1874 OOMPH_EXCEPTION_LOCATION);
1882 for (
unsigned p = 0; p < this->npres_nst(); p++)
1884 internal_data_pt(this->P_nst_internal_index)->set_value(p, 0.0);
1888 if (this->npres_nst() == 1)
1890 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1892 else if (this->npres_nst() == 3)
1894 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1895 internal_data_pt(this->P_nst_internal_index)->set_value(1, press);
1896 internal_data_pt(this->P_nst_internal_index)->set_value(2, press);
1900 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1901 internal_data_pt(this->P_nst_internal_index)->set_value(1, press);
1902 internal_data_pt(this->P_nst_internal_index)->set_value(2, press);
1903 internal_data_pt(this->P_nst_internal_index)->set_value(3, press);
1918 if (this->tree_pt()->father_pt() != 0)
1927 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue() <=
1930 this->internal_data_pt(this->P_nst_internal_index)
1931 ->resize(this->npres_nst());
1935 Data* new_data_pt =
new Data(this->npres_nst());
1936 delete internal_data_pt(this->P_nst_internal_index);
1937 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1940 if (this->tree_pt()->father_pt() != 0)
1945 octree_pt()->father_pt()->object_pt());
1949 if (father_element_pt->p_order() == this->p_order())
1951 using namespace OcTreeNames;
1954 int son_type = octree_pt()->son_type();
1961 for (
unsigned i = 0;
i < 3;
i++)
1970 for (
unsigned p = 0; p < this->npres_nst(); p++)
1972 internal_data_pt(this->P_nst_internal_index)->set_value(p, 0.0);
1976 if (this->npres_nst() == 1)
1978 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1982 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1983 internal_data_pt(this->P_nst_internal_index)->set_value(1, press);
1984 internal_data_pt(this->P_nst_internal_index)->set_value(2, press);
1985 internal_data_pt(this->P_nst_internal_index)->set_value(3, press);
1986 internal_data_pt(this->P_nst_internal_index)->set_value(4, press);
1987 internal_data_pt(this->P_nst_internal_index)->set_value(5, press);
1988 internal_data_pt(this->P_nst_internal_index)->set_value(6, press);
1989 internal_data_pt(this->P_nst_internal_index)->set_value(7, press);
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
A class that represents a collection of data; each Data object may contain many different individual ...
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.
Class that contains data for hanging nodes.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
unsigned nmaster() const
Return the number of master nodes.
virtual double interpolated_p_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
void perform_auxiliary_node_update_fct()
Execute auxiliary update function (if any) – this can be used to update any nodal values following th...
bool has_auxiliary_node_update_fct_pt()
Boolean to indicate if node has a pointer to and auxiliary update function.
static Vector< Vector< int > > Direction_to_vector
For each direction, i.e. a son_type (vertex), a face or an edge, this defines a vector that indicates...
An OomphLibError object which should be thrown when an run-time error is encountered....
p-refineable version of Crouzeix Raviart elements. Generic class definitions
void further_build()
Further build for Crouzeix_Raviart interpolates the internal pressure dofs from father element: Make ...
A class that is used to template the p-refineable Q elements by dimension. It's really nothing more t...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void fill_in_generic_residual_contribution_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add element's contribution to elemental residual vector and/or Jacobian matrix flag=1: compute both f...
void further_build()
Further build, pass the pointers down to the sons.
void get_pressure_and_velocity_mass_matrix_diagonal(Vector< double > &press_mass_diag, Vector< double > &veloc_mass_diag, const unsigned &which_one=0)
Compute the diagonal of the velocity/pressure mass matrices. If which one=0, both are computed,...
void fill_in_generic_pressure_advection_diffusion_contribution_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Compute the residuals for the associated pressure advection diffusion problem. Used by the Fp precond...
virtual void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates....
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
Refineable version of Taylor Hood elements. These classes can be written in total generality.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...