36 template<
unsigned DIM>
45 unsigned n_node = nnode();
48 unsigned u_nodal_index = this->u_index_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_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_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_adv_diff(ipt, interpolated_x, source);
141 this->get_wind_adv_diff(ipt,
s, interpolated_x, wind);
147 for (
unsigned l = 0; l < n_node; l++)
151 unsigned n_master = 1;
152 double hang_weight = 1.0;
154 bool is_node_hanging = this->node_pt(l)->is_hanging();
159 hang_info_pt = this->node_pt(l)->hanging_pt();
160 n_master = hang_info_pt->
nmaster();
169 for (
unsigned m = 0; m < n_master; m++)
185 local_eqn = this->nodal_local_eqn(l, u_nodal_index);
194 residuals[local_eqn] -=
195 (peclet_st * dudt + source) * test(l) *
W * hang_weight;
198 for (
unsigned k = 0; k < DIM; k++)
201 double tmp = peclet * wind[k];
203 if (!ALE_is_disabled_flag) tmp -= peclet_st * mesh_velocity[k];
205 residuals[local_eqn] -= interpolated_dudx[k] *
206 (tmp * test(l) + dtestdx(l, k)) *
W *
215 unsigned n_master2 = 1;
216 double hang_weight2 = 1.0;
218 for (
unsigned l2 = 0; l2 < n_node; l2++)
221 bool is_node2_hanging = this->node_pt(l2)->is_hanging();
223 if (is_node2_hanging)
225 hang_info2_pt = this->node_pt(l2)->hanging_pt();
226 n_master2 = hang_info2_pt->nmaster();
235 for (
unsigned m2 = 0; m2 < n_master2; m2++)
239 if (is_node2_hanging)
242 local_unknown = this->local_hang_eqn(
243 hang_info2_pt->master_node_pt(m2), u_nodal_index);
245 hang_weight2 = hang_info2_pt->master_weight(m2);
251 local_unknown = this->nodal_local_eqn(l2, u_nodal_index);
257 if (local_unknown >= 0)
261 jacobian(local_eqn, local_unknown) -=
262 peclet_st * test(l) * psi(l2) *
263 this->node_pt(l2)->time_stepper_pt()->weight(1, 0) *
W *
264 hang_weight * hang_weight2;
269 mass_matrix(local_eqn, local_unknown) +=
270 peclet_st * test(l) * psi(l2) *
W * hang_weight *
275 for (
unsigned k = 0; k < DIM; k++)
278 double tmp = peclet * wind[k];
280 if (!ALE_is_disabled_flag)
282 tmp -= peclet_st * mesh_velocity[k];
285 jacobian(local_eqn, local_unknown) -=
286 dpsidx(l2, k) * (tmp * test(l) + dtestdx(l, k)) *
W *
287 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_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 QAdvectionDiffusionElement. Inherit from the standard QAdvectionDiffusionElemen...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...