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;
290 template<
unsigned DIM>
298 unsigned n_node = nnode();
301 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
304 unsigned n_pres = this->npres_nst();
307 unsigned u_nodal_index[DIM];
308 for (
unsigned i = 0;
i < DIM;
i++)
310 u_nodal_index[
i] = this->u_index_nst(
i);
315 int p_index = this->p_nodal_index_nst();
319 bool pressure_dof_is_hanging[n_pres];
324 for (
unsigned l = 0; l < n_pres; ++l)
326 pressure_dof_is_hanging[l] = pressure_node_pt(l)->is_hanging(p_index);
332 for (
unsigned l = 0; l < n_pres; ++l)
334 pressure_dof_is_hanging[l] =
false;
339 Shape psif(n_node), testf(n_node);
340 DShape dpsifdx(n_node, DIM), dtestfdx(n_node, DIM);
344 Shape psip(n_pres), testp(n_pres);
347 unsigned n_intpt = integral_pt()->nweight();
354 double scaled_re = this->re() * this->density_ratio();
355 double scaled_re_st = this->re_st() * this->density_ratio();
356 double scaled_re_inv_fr = this->re_invfr() * this->density_ratio();
357 double visc_ratio = this->viscosity_ratio();
361 int local_eqn = 0, local_unknown = 0;
364 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
367 bool ALE_is_disabled_flag = this->ALE_is_disabled;
370 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
373 for (
unsigned i = 0;
i < DIM;
i++)
375 s[
i] = integral_pt()->knot(ipt,
i);
379 double w = integral_pt()->weight(ipt);
382 double J = this->dshape_and_dtest_eulerian_at_knot_nst(
383 ipt, psif, dpsifdx, testf, dtestfdx);
386 this->pshape_nst(
s, psip, testp);
393 double interpolated_p = 0.0;
401 for (
unsigned l = 0; l < n_pres; l++)
403 interpolated_p += this->p_nst(l) * psip[l];
410 for (
unsigned l = 0; l < n_node; l++)
413 for (
unsigned i = 0;
i < DIM;
i++)
416 double u_value = this->nodal_value(l, u_nodal_index[
i]);
417 interpolated_u[
i] += u_value * psif[l];
418 interpolated_x[
i] += this->nodal_position(l,
i) * psif[l];
419 dudt[
i] += this->du_dt_nst(l,
i) * psif[l];
422 for (
unsigned j = 0; j < DIM; j++)
424 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
429 if (!ALE_is_disabled_flag)
432 for (
unsigned l = 0; l < n_node; l++)
435 for (
unsigned i = 0;
i < DIM;
i++)
437 mesh_veloc[
i] += this->dnodal_position_dt(l,
i) * psif[l];
448 if (!this->Use_extrapolated_strainrate_to_compute_second_invariant)
450 this->strain_rate(
s, strainrate_to_compute_second_invariant);
454 this->extrapolated_strain_rate(ipt,
455 strainrate_to_compute_second_invariant);
460 strainrate_to_compute_second_invariant);
467 this->get_body_force_nst(time, ipt,
s, interpolated_x, body_force);
470 double source = this->get_source_nst(time, ipt, interpolated_x);
476 if (!this->Use_extrapolated_strainrate_to_compute_second_invariant)
479 double dviscosity_dsecond_invariant =
484 this->strain_rate(
s, strainrate);
494 for (
unsigned i = 0;
i < DIM;
i++)
496 for (
unsigned j = 0; j < DIM; j++)
501 kroneckerdelta(
i,
i) = 1.0;
504 for (
unsigned k = 0; k < DIM; k++)
508 tmp += strainrate(k, k);
511 dinvariant_dstrainrate(
i,
i) = tmp;
515 dinvariant_dstrainrate(
i, j) = -strainrate(j,
i);
525 for (
unsigned l = 0; l < n_node; l++)
528 for (
unsigned k = 0; k < DIM; k++)
531 for (
unsigned i = 0;
i < DIM;
i++)
533 for (
unsigned j = 0; j < DIM; j++)
536 dstrainrate_dunknown(
i, j, k, l) = 0.0;
539 for (
unsigned m = 0; m < DIM; m++)
541 for (
unsigned n = 0; n < DIM; n++)
543 dstrainrate_dunknown(
i, j, k, l) +=
545 (kroneckerdelta(
i, m) * kroneckerdelta(j, n) +
546 kroneckerdelta(
i, n) * kroneckerdelta(j, m)) *
547 kroneckerdelta(m, k) * dpsifdx(l, n);
557 for (
unsigned l = 0; l < n_node; l++)
560 for (
unsigned k = 0; k < DIM; k++)
563 for (
unsigned i = 0;
i < DIM;
i++)
565 for (
unsigned j = 0; j < DIM; j++)
567 dviscosity_dunknown(k, l) += dviscosity_dsecond_invariant *
568 dinvariant_dstrainrate(
i, j) *
569 dstrainrate_dunknown(
i, j, k, l);
581 unsigned n_master = 1;
582 double hang_weight = 1.0;
586 for (
unsigned l = 0; l < n_node; l++)
589 bool is_node_hanging = node_pt(l)->is_hanging();
594 hang_info_pt = node_pt(l)->hanging_pt();
597 n_master = hang_info_pt->
nmaster();
606 for (
unsigned m = 0; m < n_master; m++)
609 for (
unsigned i = 0;
i < DIM;
i++)
625 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i]);
638 sum += body_force[
i];
641 sum += scaled_re_inv_fr * G[
i];
644 sum -= scaled_re_st * dudt[
i];
647 for (
unsigned k = 0; k < DIM; k++)
649 double tmp = scaled_re * interpolated_u[k];
650 if (!ALE_is_disabled_flag)
652 tmp -= scaled_re_st * mesh_veloc[k];
654 sum -= tmp * interpolated_dudx(
i, k);
659 if (this->Pre_multiply_by_viscosity_ratio)
661 sum = visc_ratio * viscosity *
662 (sum * testf[l] + interpolated_p * dtestfdx(l,
i)) *
W *
667 sum = (sum * testf[l] + interpolated_p * dtestfdx(l,
i)) *
W *
675 for (
unsigned k = 0; k < DIM; k++)
677 sum -= visc_ratio * viscosity *
678 (interpolated_dudx(
i, k) +
679 this->Gamma[
i] * interpolated_dudx(k,
i)) *
680 dtestfdx(l, k) *
W * hang_weight;
684 residuals[local_eqn] += sum;
690 unsigned n_master2 = 1;
691 double hang_weight2 = 1.0;
693 for (
unsigned l2 = 0; l2 < n_node; l2++)
696 bool is_node2_hanging = node_pt(l2)->is_hanging();
699 if (is_node2_hanging)
701 hang_info2_pt = node_pt(l2)->hanging_pt();
703 n_master2 = hang_info2_pt->nmaster();
712 for (
unsigned m2 = 0; m2 < n_master2; m2++)
715 for (
unsigned i2 = 0; i2 < DIM; i2++)
719 if (is_node2_hanging)
722 local_unknown = this->local_hang_eqn(
723 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
725 hang_weight2 = hang_info2_pt->master_weight(m2);
730 this->nodal_local_eqn(l2, u_nodal_index[i2]);
735 if (local_unknown >= 0)
738 jacobian(local_eqn, local_unknown) -=
739 visc_ratio * viscosity * this->Gamma[
i] *
740 dpsifdx(l2,
i) * dtestfdx(l, i2) *
W * hang_weight *
744 jacobian(local_eqn, local_unknown) -=
745 scaled_re * psif[l2] * interpolated_dudx(
i, i2) *
746 testf[l] *
W * hang_weight * hang_weight2;
750 ->Use_extrapolated_strainrate_to_compute_second_invariant)
752 for (
unsigned k = 0; k < DIM; k++)
754 jacobian(local_eqn, local_unknown) -=
755 visc_ratio * dviscosity_dunknown(i2, l2) *
756 (interpolated_dudx(
i, k) +
757 this->Gamma[
i] * interpolated_dudx(k,
i)) *
758 dtestfdx(l, k) *
W * hang_weight * hang_weight2;
770 mass_matrix(local_eqn, local_unknown) +=
771 scaled_re_st * psif[l2] * testf[l] *
W *
772 hang_weight * hang_weight2;
776 jacobian(local_eqn, local_unknown) -=
778 node_pt(l2)->time_stepper_pt()->weight(1, 0) *
779 psif[l2] * testf[l] *
W * hang_weight *
783 for (
unsigned k = 0; k < DIM; k++)
785 double tmp = scaled_re * interpolated_u[k];
786 if (!ALE_is_disabled_flag)
788 tmp -= scaled_re_st * mesh_veloc[k];
791 jacobian(local_eqn, local_unknown) -=
792 tmp * dpsifdx(l2, k) * testf[l] *
W *
793 hang_weight * hang_weight2;
797 for (
unsigned k = 0; k < DIM; k++)
799 jacobian(local_eqn, local_unknown) -=
800 visc_ratio * viscosity * dpsifdx(l2, k) *
801 dtestfdx(l, k) *
W * hang_weight * hang_weight2;
810 for (
unsigned l2 = 0; l2 < n_pres; l2++)
813 if (pressure_dof_is_hanging[l2])
816 this->pressure_node_pt(l2)->hanging_pt(p_index);
819 n_master2 = hang_info2_pt->nmaster();
828 for (
unsigned m2 = 0; m2 < n_master2; m2++)
832 if (pressure_dof_is_hanging[l2])
835 local_unknown = this->local_hang_eqn(
836 hang_info2_pt->master_node_pt(m2), p_index);
838 hang_weight2 = hang_info2_pt->master_weight(m2);
842 local_unknown = this->p_local_eqn(l2);
847 if (local_unknown >= 0)
849 if (this->Pre_multiply_by_viscosity_ratio)
851 jacobian(local_eqn, local_unknown) +=
852 visc_ratio * viscosity * psip[l2] * dtestfdx(l,
i) *
853 W * hang_weight * hang_weight2;
857 jacobian(local_eqn, local_unknown) +=
858 psip[l2] * dtestfdx(l,
i) *
W * hang_weight *
880 for (
unsigned l = 0; l < n_pres; l++)
883 if (pressure_dof_is_hanging[l])
887 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
890 n_master = hang_info_pt->
nmaster();
899 for (
unsigned m = 0; m < n_master; m++)
903 if (pressure_dof_is_hanging[l])
913 local_eqn = this->p_local_eqn(l);
921 residuals[local_eqn] -= source * testp[l] *
W * hang_weight;
924 for (
unsigned k = 0; k < DIM; k++)
927 if (this->Pre_multiply_by_viscosity_ratio)
929 residuals[local_eqn] += visc_ratio * viscosity *
930 interpolated_dudx(k, k) * testp[l] *
W *
935 residuals[local_eqn] +=
936 interpolated_dudx(k, k) * testp[l] *
W * hang_weight;
943 unsigned n_master2 = 1;
944 double hang_weight2 = 1.0;
946 for (
unsigned l2 = 0; l2 < n_node; l2++)
949 bool is_node2_hanging = node_pt(l2)->is_hanging();
952 if (is_node2_hanging)
954 hang_info2_pt = node_pt(l2)->hanging_pt();
956 n_master2 = hang_info2_pt->nmaster();
965 for (
unsigned m2 = 0; m2 < n_master2; m2++)
968 for (
unsigned i2 = 0; i2 < DIM; i2++)
972 if (is_node2_hanging)
975 local_unknown = this->local_hang_eqn(
976 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
977 hang_weight2 = hang_info2_pt->master_weight(m2);
982 this->nodal_local_eqn(l2, u_nodal_index[i2]);
987 if (local_unknown >= 0)
989 if (this->Pre_multiply_by_viscosity_ratio)
991 jacobian(local_eqn, local_unknown) +=
992 visc_ratio * viscosity * dpsifdx(l2, i2) * testp[l] *
993 W * hang_weight * hang_weight2;
997 jacobian(local_eqn, local_unknown) +=
998 dpsifdx(l2, i2) * testp[l] *
W * hang_weight *
1023 template<
unsigned DIM>
1026 dresidual_dnodal_coordinates)
1035 const unsigned n_node = nnode();
1038 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
1041 const unsigned n_pres = this->npres_nst();
1044 unsigned u_nodal_index[DIM];
1045 for (
unsigned i = 0;
i < DIM;
i++)
1047 u_nodal_index[
i] = this->u_index_nst(
i);
1052 const int p_index = this->p_nodal_index_nst();
1056 bool pressure_dof_is_hanging[n_pres];
1062 for (
unsigned l = 0; l < n_pres; ++l)
1064 pressure_dof_is_hanging[l] = pressure_node_pt(l)->is_hanging(p_index);
1070 for (
unsigned l = 0; l < n_pres; ++l)
1072 pressure_dof_is_hanging[l] =
false;
1077 Shape psif(n_node), testf(n_node);
1078 DShape dpsifdx(n_node, DIM), dtestfdx(n_node, DIM);
1081 Shape psip(n_pres), testp(n_pres);
1084 const unsigned n_shape_controlling_node = nshape_controlling_nodes();
1088 DIM, n_shape_controlling_node, n_node, DIM);
1090 DIM, n_shape_controlling_node, n_node, DIM);
1104 const unsigned n_intpt = integral_pt()->nweight();
1111 double scaled_re = this->re() * this->density_ratio();
1112 double scaled_re_st = this->re_st() * this->density_ratio();
1113 double scaled_re_inv_fr = this->re_invfr() * this->density_ratio();
1114 double visc_ratio = this->viscosity_ratio();
1123 bool element_has_node_with_aux_node_update_fct =
false;
1125 std::map<Node*, unsigned> local_shape_controlling_node_lookup =
1126 shape_controlling_node_lookup();
1129 for (std::map<Node*, unsigned>::iterator it =
1130 local_shape_controlling_node_lookup.begin();
1131 it != local_shape_controlling_node_lookup.end();
1135 Node* nod_pt = it->first;
1138 unsigned q = it->second;
1143 element_has_node_with_aux_node_update_fct =
true;
1147 for (
unsigned i = 0;
i < DIM;
i++)
1149 u_ref[
i] = *(nod_pt->
value_pt(u_nodal_index[
i]));
1153 for (
unsigned p = 0; p < DIM; p++)
1156 double backup = nod_pt->
x(p);
1160 nod_pt->
x(p) += eps_fd;
1167 (*(nod_pt->
value_pt(u_nodal_index[p])) - u_ref[p]) / eps_fd;
1170 nod_pt->
x(p) = backup;
1185 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1188 for (
unsigned i = 0;
i < DIM;
i++)
1190 s[
i] = integral_pt()->knot(ipt,
i);
1194 const double w = integral_pt()->weight(ipt);
1198 this->dshape_and_dtest_eulerian_at_knot_nst(ipt,
1208 this->pshape_nst(
s, psip, testp);
1212 double interpolated_p = 0.0;
1220 for (
unsigned l = 0; l < n_pres; l++)
1222 interpolated_p += this->p_nst(l) * psip[l];
1228 for (
unsigned l = 0; l < n_node; l++)
1231 for (
unsigned i = 0;
i < DIM;
i++)
1234 const double u_value = nodal_value(l, u_nodal_index[
i]);
1235 interpolated_u[
i] += u_value * psif[l];
1236 interpolated_x[
i] += nodal_position(l,
i) * psif[l];
1237 dudt[
i] += this->du_dt_nst(l,
i) * psif[l];
1240 for (
unsigned j = 0; j < DIM; j++)
1242 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
1247 if (!this->ALE_is_disabled)
1250 for (
unsigned l = 0; l < n_node; l++)
1253 for (
unsigned i = 0;
i < DIM;
i++)
1255 mesh_velocity[
i] += this->dnodal_position_dt(l,
i) * psif[l];
1263 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1266 for (
unsigned p = 0; p < DIM; p++)
1268 for (
unsigned i = 0;
i < DIM;
i++)
1270 for (
unsigned k = 0; k < DIM; k++)
1273 for (
unsigned j = 0; j < n_node; j++)
1276 nodal_value(j, u_nodal_index[
i]) * d_dpsifdx_dX(p, q, j, k);
1278 d_dudx_dX(p, q,
i, k) = aux;
1286 const double pos_time_weight =
1287 node_pt(0)->position_time_stepper_pt()->weight(1, 0);
1288 const double val_time_weight =
1289 node_pt(0)->time_stepper_pt()->weight(1, 0);
1293 this->get_body_force_nst(time, ipt,
s, interpolated_x, body_force);
1296 const double source = this->get_source_nst(time, ipt, interpolated_x);
1300 this->get_body_force_gradient_nst(
1301 time, ipt,
s, interpolated_x, d_body_force_dx);
1305 this->get_source_gradient_nst(time, ipt, interpolated_x, source_gradient);
1315 unsigned n_master = 1;
1316 double hang_weight = 1.0;
1319 for (
unsigned l = 0; l < n_node; l++)
1322 bool is_node_hanging = node_pt(l)->is_hanging();
1325 if (is_node_hanging)
1327 hang_info_pt = node_pt(l)->hanging_pt();
1330 n_master = hang_info_pt->
nmaster();
1339 for (
unsigned m = 0; m < n_master; m++)
1342 for (
unsigned i = 0;
i < DIM;
i++)
1346 if (is_node_hanging)
1349 local_eqn = this->local_hang_eqn(hang_info_pt->
master_node_pt(m),
1358 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i]);
1368 for (
unsigned p = 0; p < DIM; p++)
1371 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1377 double sum = body_force[
i] * testf[l];
1380 sum += scaled_re_inv_fr * testf[l] * G[
i];
1383 sum += interpolated_p * dtestfdx(l,
i);
1389 for (
unsigned k = 0; k < DIM; k++)
1392 (interpolated_dudx(
i, k) +
1393 this->Gamma[
i] * interpolated_dudx(k,
i)) *
1400 sum -= scaled_re_st * dudt[
i] * testf[l];
1403 for (
unsigned k = 0; k < DIM; k++)
1405 double tmp = scaled_re * interpolated_u[k];
1406 if (!this->ALE_is_disabled)
1408 tmp -= scaled_re_st * mesh_velocity[k];
1410 sum -= tmp * interpolated_dudx(
i, k) * testf[l];
1415 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1416 sum * dJ_dX(p, q) * w * hang_weight;
1422 sum = d_body_force_dx(
i, p) * psif(q) * testf(l);
1425 sum += interpolated_p * d_dtestfdx_dX(p, q, l,
i);
1428 for (
unsigned k = 0; k < DIM; k++)
1431 visc_ratio * ((interpolated_dudx(
i, k) +
1432 this->Gamma[
i] * interpolated_dudx(k,
i)) *
1433 d_dtestfdx_dX(p, q, l, k) +
1434 (d_dudx_dX(p, q,
i, k) +
1435 this->Gamma[
i] * d_dudx_dX(p, q, k,
i)) *
1440 for (
unsigned k = 0; k < DIM; k++)
1442 double tmp = scaled_re * interpolated_u[k];
1443 if (!this->ALE_is_disabled)
1445 tmp -= scaled_re_st * mesh_velocity[k];
1447 sum -= tmp * d_dudx_dX(p, q,
i, k) * testf(l);
1449 if (!this->ALE_is_disabled)
1451 sum += scaled_re_st * pos_time_weight * psif(q) *
1452 interpolated_dudx(
i, p) * testf(l);
1456 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1457 sum * J * w * hang_weight;
1465 if (element_has_node_with_aux_node_update_fct)
1468 for (
unsigned q_local = 0; q_local < n_node; q_local++)
1472 unsigned n_master2 = 1;
1473 double hang_weight2 = 1.0;
1477 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1479 Node* actual_shape_controlling_node_pt = node_pt(q_local);
1482 if (is_node_hanging2)
1484 hang_info2_pt = node_pt(q_local)->hanging_pt();
1487 n_master2 = hang_info2_pt->
nmaster();
1496 for (
unsigned mm = 0; mm < n_master2; mm++)
1498 if (is_node_hanging2)
1500 actual_shape_controlling_node_pt =
1506 unsigned q = local_shape_controlling_node_lookup
1507 [actual_shape_controlling_node_pt];
1510 for (
unsigned p = 0; p < DIM; p++)
1512 double sum = -visc_ratio * this->Gamma[
i] *
1513 dpsifdx(q_local,
i) * dtestfdx(l, p) -
1514 scaled_re * psif(q_local) *
1515 interpolated_dudx(
i, p) * testf(l);
1518 sum -= scaled_re_st * val_time_weight * psif(q_local) *
1520 for (
unsigned k = 0; k < DIM; k++)
1523 visc_ratio * dpsifdx(q_local, k) * dtestfdx(l, k);
1524 double tmp = scaled_re * interpolated_u[k];
1525 if (!this->ALE_is_disabled)
1527 tmp -= scaled_re_st * mesh_velocity[k];
1529 sum -= tmp * dpsifdx(q_local, k) * testf(l);
1533 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1534 sum * d_U_dX(p, q) * J * w * hang_weight * hang_weight2;
1551 for (
unsigned l = 0; l < n_pres; l++)
1554 if (pressure_dof_is_hanging[l])
1558 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
1561 n_master = hang_info_pt->
nmaster();
1570 for (
unsigned m = 0; m < n_master; m++)
1574 if (pressure_dof_is_hanging[l])
1584 local_eqn = this->p_local_eqn(l);
1592 for (
unsigned p = 0; p < DIM; p++)
1595 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1601 double aux = -source;
1604 for (
unsigned k = 0; k < DIM; k++)
1606 aux += interpolated_dudx(k, k);
1610 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1611 aux * dJ_dX(p, q) * testp[l] * w * hang_weight;
1618 aux = -source_gradient[p] * psif(q);
1619 for (
unsigned k = 0; k < DIM; k++)
1621 aux += d_dudx_dX(p, q, k, k);
1624 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1625 aux * testp[l] * J * w * hang_weight;
1632 if (element_has_node_with_aux_node_update_fct)
1635 for (
unsigned q_local = 0; q_local < n_node; q_local++)
1639 unsigned n_master2 = 1;
1640 double hang_weight2 = 1.0;
1644 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1646 Node* actual_shape_controlling_node_pt = node_pt(q_local);
1649 if (is_node_hanging2)
1651 hang_info2_pt = node_pt(q_local)->hanging_pt();
1654 n_master2 = hang_info2_pt->
nmaster();
1663 for (
unsigned mm = 0; mm < n_master2; mm++)
1665 if (is_node_hanging2)
1667 actual_shape_controlling_node_pt =
1673 unsigned q = local_shape_controlling_node_lookup
1674 [actual_shape_controlling_node_pt];
1677 for (
unsigned p = 0; p < DIM; p++)
1679 double aux = dpsifdx(q_local, p) * testp(l);
1680 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1681 aux * d_U_dX(p, q) * J * w * hang_weight * hang_weight2;
1703 if (this->tree_pt()->father_pt() != 0)
1712 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue() <=
1715 this->internal_data_pt(this->P_nst_internal_index)
1716 ->resize(this->npres_nst());
1720 Data* new_data_pt =
new Data(this->npres_nst());
1721 delete internal_data_pt(this->P_nst_internal_index);
1722 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1725 if (this->tree_pt()->father_pt() != 0)
1729 father_element_pt =
dynamic_cast<
1731 quadtree_pt()->father_pt()->object_pt());
1735 if (father_element_pt->p_order() == this->p_order())
1737 using namespace QuadTreeNames;
1740 int son_type = quadtree_pt()->son_type();
1770 OOMPH_CURRENT_FUNCTION,
1771 OOMPH_EXCEPTION_LOCATION);
1779 for (
unsigned p = 0; p < this->npres_nst(); p++)
1781 internal_data_pt(this->P_nst_internal_index)->set_value(p, 0.0);
1785 if (this->npres_nst() == 1)
1787 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1789 else if (this->npres_nst() == 3)
1791 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1792 internal_data_pt(this->P_nst_internal_index)->set_value(1, press);
1793 internal_data_pt(this->P_nst_internal_index)->set_value(2, press);
1797 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1798 internal_data_pt(this->P_nst_internal_index)->set_value(1, press);
1799 internal_data_pt(this->P_nst_internal_index)->set_value(2, press);
1800 internal_data_pt(this->P_nst_internal_index)->set_value(3, press);
1816 if (this->tree_pt()->father_pt() != 0)
1825 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue() <=
1828 this->internal_data_pt(this->P_nst_internal_index)
1829 ->resize(this->npres_nst());
1833 Data* new_data_pt =
new Data(this->npres_nst());
1834 delete internal_data_pt(this->P_nst_internal_index);
1835 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1838 if (this->tree_pt()->father_pt() != 0)
1842 father_element_pt =
dynamic_cast<
1844 octree_pt()->father_pt()->object_pt());
1848 if (father_element_pt->p_order() == this->p_order())
1850 using namespace OcTreeNames;
1853 int son_type = octree_pt()->son_type();
1860 for (
unsigned i = 0;
i < 3;
i++)
1869 for (
unsigned p = 0; p < this->npres_nst(); p++)
1871 internal_data_pt(this->P_nst_internal_index)->set_value(p, 0.0);
1875 if (this->npres_nst() == 1)
1877 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1881 internal_data_pt(this->P_nst_internal_index)->set_value(0, press);
1882 internal_data_pt(this->P_nst_internal_index)->set_value(1, press);
1883 internal_data_pt(this->P_nst_internal_index)->set_value(2, press);
1884 internal_data_pt(this->P_nst_internal_index)->set_value(3, press);
1885 internal_data_pt(this->P_nst_internal_index)->set_value(4, press);
1886 internal_data_pt(this->P_nst_internal_index)->set_value(5, press);
1887 internal_data_pt(this->P_nst_internal_index)->set_value(6, press);
1888 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.
virtual double interpolated_p_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
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.
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
A class that is used to template the p-refineable Q elements by dimension. It's really nothing more t...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void further_build()
Further build, pass the pointers down to the sons.
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 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,...
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
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...
double second_invariant(const DenseMatrix< double > &tensor)
Compute second invariant of tensor.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...