42 template<
unsigned DIM>
53 unsigned n_node = nnode();
56 unsigned u_nodal_index = this->u_index_cons_adv_diff();
59 Shape psi(n_node), test(n_node);
60 DShape dpsidx(n_node,DIM), dtestdx(n_node,DIM);
63 unsigned n_intpt = integral_pt()->nweight();
69 double peclet = this->
pe();
72 double peclet_st = this->
pe_st();
76 int local_eqn=0, local_unknown=0;
79 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
85 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
89 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
92 double w = integral_pt()->weight(ipt);
96 this->dshape_and_dtest_eulerian_at_knot_cons_adv_diff(ipt,psi,dpsidx,
104 double interpolated_u=0.0;
115 for(
unsigned l=0;l<n_node;l++)
118 double u_value = this->nodal_value(l,u_nodal_index);
119 interpolated_u += u_value*psi(l);
120 dudt += this->du_dt_cons_adv_diff(l)*psi(l);
122 for(
unsigned j=0;j<DIM;j++)
124 interpolated_x[j] += nodal_position(l,j)*psi(l);
125 interpolated_dudx[j] += u_value*dpsidx(l,j);
130 if (!ALE_is_disabled_flag)
132 for(
unsigned l=0;l<n_node;l++)
135 for(
unsigned j=0;j<DIM;j++)
137 mesh_velocity[j] += dnodal_position_dt(l,j)*psi(l);
145 this->get_source_cons_adv_diff(ipt,interpolated_x,source);
151 this->get_wind_cons_adv_diff(ipt,s,interpolated_x,wind);
155 this->get_conserved_wind_cons_adv_diff(ipt,s,interpolated_x,conserved_wind);
159 this->get_diff_cons_adv_diff(ipt,s,interpolated_x,D);
165 for(
unsigned l=0;l<n_node;l++)
169 unsigned n_master=1;
double hang_weight=1.0;
171 bool is_node_hanging = this->node_pt(l)->is_hanging();
176 hang_info_pt = this->node_pt(l)->hanging_pt();
177 n_master = hang_info_pt->
nmaster();
186 for(
unsigned m=0;m<n_master;m++)
202 local_eqn = this->nodal_local_eqn(l,u_nodal_index);
211 residuals[local_eqn] -=
212 (peclet_st*dudt + source)*test(l)*W*hang_weight;
215 for(
unsigned k=0;k<DIM;k++)
218 double tmp = peclet*wind[k];
220 if(!ALE_is_disabled_flag)
221 {tmp -= peclet_st*mesh_velocity[k];}
222 tmp *= interpolated_dudx[k];
226 double tmp2 = - conserved_wind[k]*interpolated_u;
228 for(
unsigned j=0;j<DIM;j++)
230 tmp2 +=
D(k,j)*interpolated_dudx[j];
233 residuals[local_eqn] -= (tmp*test(l) + tmp2*dtestdx(l,k))*W*
242 unsigned n_master2=1;
double hang_weight2=1.0;
244 for(
unsigned l2=0;l2<n_node;l2++)
247 bool is_node2_hanging = this->node_pt(l2)->is_hanging();
251 hang_info2_pt = this->node_pt(l2)->hanging_pt();
252 n_master2 = hang_info2_pt->nmaster();
261 for(
unsigned m2=0;m2<n_master2;m2++)
269 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
272 hang_weight2 = hang_info2_pt->master_weight(m2);
278 local_unknown = this->nodal_local_eqn(l2,u_nodal_index);
284 if(local_unknown >= 0)
288 jacobian(local_eqn,local_unknown)
289 -= peclet_st*test(l)*psi(l2)*
290 this->node_pt(l2)->time_stepper_pt()->weight(1,0)
291 *W*hang_weight*hang_weight2;
296 mass_matrix(local_eqn,local_unknown) +=
297 peclet_st*test(l)*psi(l2)*W*hang_weight*hang_weight2;
301 for(
unsigned k=0;k<DIM;k++)
304 double tmp = peclet*wind[k];
305 if(!ALE_is_disabled_flag)
306 {tmp -= peclet_st*mesh_velocity[k];}
309 double tmp2 = - conserved_wind[k]*psi(l2);
311 for(
unsigned j=0;j<DIM;j++)
313 tmp2 +=
D(k,j)*dpsidx(l2,j);
317 jacobian(local_eqn,local_unknown)
318 -= (tmp*test(l) + tmp2*dtestdx(l,k))*W*
319 hang_weight*hang_weight2;
Refineable version of QGeneralisedAdvectionDiffusionElement. Inherit from the standard QGeneralisedAd...
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
const double & pe() const
Peclet number.
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.
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...
const double & pe_st() const
Peclet number multiplied by Strouhal number.
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.