36 template<
unsigned DIM>
45 unsigned n_node = nnode();
48 unsigned u_nodal_index = this->u_index_cons_adv_diff();
51 Shape psi(n_node), test(n_node);
52 DShape dpsidx(n_node, DIM), dtestdx(n_node, DIM);
55 unsigned n_intpt = integral_pt()->nweight();
61 double peclet = this->pe();
64 double peclet_st = this->pe_st();
68 int local_eqn = 0, local_unknown = 0;
71 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
74 bool ALE_is_disabled_flag = this->ALE_is_disabled;
77 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
80 for (
unsigned i = 0;
i < DIM;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
83 double w = integral_pt()->weight(ipt);
86 double J = this->dshape_and_dtest_eulerian_at_knot_cons_adv_diff(
87 ipt, psi, dpsidx, test, dtestdx);
94 double interpolated_u = 0.0;
105 for (
unsigned l = 0; l < n_node; l++)
108 double u_value = this->nodal_value(l, u_nodal_index);
109 interpolated_u += u_value * psi(l);
110 dudt += this->du_dt_cons_adv_diff(l) * psi(l);
112 for (
unsigned j = 0; j < DIM; j++)
114 interpolated_x[j] += nodal_position(l, j) * psi(l);
115 interpolated_dudx[j] += u_value * dpsidx(l, j);
120 if (!ALE_is_disabled_flag)
122 for (
unsigned l = 0; l < n_node; l++)
125 for (
unsigned j = 0; j < DIM; j++)
127 mesh_velocity[j] += dnodal_position_dt(l, j) * psi(l);
135 this->get_source_cons_adv_diff(ipt, interpolated_x, source);
141 this->get_wind_cons_adv_diff(ipt,
s, interpolated_x, wind);
145 this->get_conserved_wind_cons_adv_diff(
146 ipt,
s, interpolated_x, conserved_wind);
150 this->get_diff_cons_adv_diff(ipt,
s, interpolated_x,
D);
156 for (
unsigned l = 0; l < n_node; l++)
160 unsigned n_master = 1;
161 double hang_weight = 1.0;
163 bool is_node_hanging = this->node_pt(l)->is_hanging();
168 hang_info_pt = this->node_pt(l)->hanging_pt();
169 n_master = hang_info_pt->
nmaster();
178 for (
unsigned m = 0; m < n_master; m++)
194 local_eqn = this->nodal_local_eqn(l, u_nodal_index);
203 residuals[local_eqn] -=
204 (peclet_st * dudt + source) * test(l) *
W * hang_weight;
207 for (
unsigned k = 0; k < DIM; k++)
210 double tmp = peclet * wind[k];
212 if (!ALE_is_disabled_flag)
214 tmp -= peclet_st * mesh_velocity[k];
216 tmp *= interpolated_dudx[k];
220 double tmp2 = -conserved_wind[k] * interpolated_u;
222 for (
unsigned j = 0; j < DIM; j++)
224 tmp2 +=
D(k, j) * interpolated_dudx[j];
227 residuals[local_eqn] -=
228 (tmp * test(l) + tmp2 * dtestdx(l, k)) *
W * hang_weight;
236 unsigned n_master2 = 1;
237 double hang_weight2 = 1.0;
239 for (
unsigned l2 = 0; l2 < n_node; l2++)
242 bool is_node2_hanging = this->node_pt(l2)->is_hanging();
244 if (is_node2_hanging)
246 hang_info2_pt = this->node_pt(l2)->hanging_pt();
247 n_master2 = hang_info2_pt->nmaster();
256 for (
unsigned m2 = 0; m2 < n_master2; m2++)
260 if (is_node2_hanging)
263 local_unknown = this->local_hang_eqn(
264 hang_info2_pt->master_node_pt(m2), u_nodal_index);
266 hang_weight2 = hang_info2_pt->master_weight(m2);
272 local_unknown = this->nodal_local_eqn(l2, u_nodal_index);
278 if (local_unknown >= 0)
282 jacobian(local_eqn, local_unknown) -=
283 peclet_st * test(l) * psi(l2) *
284 this->node_pt(l2)->time_stepper_pt()->weight(1, 0) *
W *
285 hang_weight * hang_weight2;
290 mass_matrix(local_eqn, local_unknown) +=
291 peclet_st * test(l) * psi(l2) *
W * hang_weight *
296 for (
unsigned k = 0; k < DIM; k++)
299 double tmp = peclet * wind[k];
300 if (!ALE_is_disabled_flag)
302 tmp -= peclet_st * mesh_velocity[k];
304 tmp *= dpsidx(l2, k);
306 double tmp2 = -conserved_wind[k] * psi(l2);
308 for (
unsigned j = 0; j < DIM; j++)
310 tmp2 +=
D(k, j) * dpsidx(l2, j);
314 jacobian(local_eqn, local_unknown) -=
315 (tmp * test(l) + tmp2 * dtestdx(l, k)) *
W *
316 hang_weight * hang_weight2;
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
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.
void fill_in_generic_residual_contribution_cons_adv_diff(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add the element's contribution to the elemental residual vector and/or Jacobian matrix flag=1: comput...
Refineable version of QGeneralisedAdvectionDiffusionElement. Inherit from the standard QGeneralisedAd...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...