42 template<
unsigned NREAGENT,
unsigned DIM>
48 &mass_matrix,
unsigned flag)
52 const unsigned n_node = nnode();
55 unsigned c_nodal_index[NREAGENT];
56 for(
unsigned r=0;r<NREAGENT;r++)
57 {c_nodal_index[r]= this->c_index_adv_diff_react(r);}
60 Shape psi(n_node), test(n_node);
61 DShape dpsidx(n_node,DIM), dtestdx(n_node,DIM);
64 const unsigned n_intpt = integral_pt()->nweight();
77 int local_eqn=0, local_unknown=0;
80 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
86 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
90 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
93 double w = integral_pt()->weight(ipt);
97 this->dshape_and_dtest_eulerian_at_knot_adv_diff_react(ipt,psi,dpsidx,
114 for(
unsigned l=0;l<n_node;l++)
117 for(
unsigned j=0;j<DIM;j++)
119 interpolated_x[j] += nodal_position(l,j)*psi(l);
123 for(
unsigned r=0;r<NREAGENT;r++)
126 const double c_value = nodal_value(l,c_nodal_index[r]);
129 interpolated_c[r] += c_value*psi(l);
130 dcdt[r] += this->dc_dt_adv_diff_react(l,r)*psi(l);
133 for(
unsigned j=0;j<DIM;j++)
135 interpolated_dcdx(r,j) += c_value*dpsidx(l,j);
141 if (!ALE_is_disabled_flag)
143 for(
unsigned l=0;l<n_node;l++)
145 for(
unsigned j=0;j<DIM;j++)
147 mesh_velocity[j] += dnodal_position_dt(l,j)*psi(l);
154 this->get_source_adv_diff_react(ipt,interpolated_x,source);
159 this->get_wind_adv_diff_react(ipt,s,interpolated_x,wind);
163 this->get_reaction_adv_diff_react(ipt,interpolated_c,R);
169 this->get_reaction_deriv_adv_diff_react(ipt,interpolated_c,dRdC);
176 for(
unsigned l=0;l<n_node;l++)
180 unsigned n_master=1;
double hang_weight=1.0;
182 bool is_node_hanging = this->node_pt(l)->is_hanging();
187 hang_info_pt = this->node_pt(l)->hanging_pt();
188 n_master = hang_info_pt->
nmaster();
197 for(
unsigned m=0;m<n_master;m++)
200 for(
unsigned r=0;r<NREAGENT;r++)
216 local_eqn = this->nodal_local_eqn(l,c_nodal_index[r]);
225 residuals[local_eqn] -=
226 (T[r]*dcdt[r] + source[r] + R[r])*test(l)*W*hang_weight;
229 for(
unsigned k=0;k<DIM;k++)
232 double tmp = wind[k];
234 if(!ALE_is_disabled_flag) {tmp -= T[r]*mesh_velocity[k];}
236 residuals[local_eqn] -=
237 interpolated_dcdx(r,k)*(tmp*test(l) +
238 D[r]*dtestdx(l,k))*W*hang_weight;
246 unsigned n_master2=1;
double hang_weight2=1.0;
248 for(
unsigned l2=0;l2<n_node;l2++)
251 bool is_node2_hanging = this->node_pt(l2)->is_hanging();
255 hang_info2_pt = this->node_pt(l2)->hanging_pt();
256 n_master2 = hang_info2_pt->nmaster();
265 for(
unsigned m2=0;m2<n_master2;m2++)
268 for(
unsigned r2=0;r2<NREAGENT;r2++)
276 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
279 hang_weight2 = hang_info2_pt->master_weight(m2);
286 this->nodal_local_eqn(l2,c_nodal_index[r2]);
292 if(local_unknown >= 0)
298 jacobian(local_eqn,local_unknown)
299 -= T[r]*test(l)*psi(l2)*
300 node_pt(l2)->time_stepper_pt()->weight(1,0)*
301 W*hang_weight*hang_weight2;
306 mass_matrix(local_eqn,local_unknown)
307 += T[r]*test(l)*psi(l2)*W*hang_weight*hang_weight2;
311 for(
unsigned i=0;
i<DIM;
i++)
314 double tmp = wind[
i];
315 if(!ALE_is_disabled_flag)
316 {tmp -= T[r]*mesh_velocity[
i];}
318 jacobian(local_eqn,local_unknown)
320 dpsidx(l2,
i)*(tmp*test(l)+D[r]*dtestdx(l,
i))*
321 W*hang_weight*hang_weight2;
327 jacobian(local_eqn,local_unknown) -=
328 dRdC(r,r2)*psi(l2)*test(l)*W*hang_weight*hang_weight2;
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
void fill_in_generic_residual_contribution_adv_diff_react(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add the element's contribution to the elemental residual vector.
Refineable version of QAdvectionDiffusionReactionElement. Inherit from the standard QAdvectionDiffusi...
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
unsigned nmaster() const
Return the number of master nodes.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
Class that contains data for hanging nodes.