44 template<
unsigned DIM>
52 unsigned n_node = nnode();
55 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
58 unsigned u_nodal_index = this->u_index_lin_wave();
61 Shape psi(n_node), test(n_node);
62 DShape dpsidx(n_node,DIM), dtestdx(n_node,DIM);
65 unsigned n_intpt = integral_pt()->nweight();
72 int local_eqn=0, local_unknown=0;
75 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
78 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
82 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
85 double w = integral_pt()->weight(ipt);
90 dshape_and_dtest_eulerian_at_knot_lin_wave(ipt,psi,dpsidx,test,dtestdx);
97 double interpolated_u=0.0;
107 for(
unsigned l=0;l<n_node;l++)
110 double u_value = this->nodal_value(l,u_nodal_index);
111 interpolated_u += u_value*psi(l);
112 ddudt += this->d2u_dt2_lin_wave(l)*psi(l);
114 for(
unsigned j=0;j<DIM;j++)
116 interpolated_x[j] += nodal_position(l,j)*psi(l);
117 interpolated_dudx[j] += u_value*dpsidx(l,j);
123 this->get_source_lin_wave(time,ipt,interpolated_x,source);
131 for(
unsigned l=0;l<n_node;l++)
135 unsigned n_master=1;
double hang_weight=1.0;
137 bool is_node_hanging = this->node_pt(l)->is_hanging();
143 hang_info_pt = this->node_pt(l)->hanging_pt();
144 n_master = hang_info_pt->
nmaster();
153 for(
unsigned m=0;m<n_master;m++)
169 local_eqn = this->nodal_local_eqn(l,u_nodal_index);
178 residuals[local_eqn] += (ddudt + source)*test(l)*W*hang_weight;
181 for(
unsigned k=0;k<DIM;k++)
183 residuals[local_eqn] += interpolated_dudx[k]*
184 dtestdx(l,k)*W*hang_weight;
192 unsigned n_master2=1;
double hang_weight2=1.0;
194 for(
unsigned l2=0;l2<n_node;l2++)
197 bool is_node2_hanging = this->node_pt(l2)->is_hanging();
201 hang_info2_pt = this->node_pt(l2)->hanging_pt();
202 n_master2 = hang_info2_pt->nmaster();
211 for(
unsigned m2=0;m2<n_master2;m2++)
219 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
222 hang_weight2 = hang_info2_pt->master_weight(m2);
228 local_unknown = this->nodal_local_eqn(l2,u_nodal_index);
234 if(local_unknown >= 0)
238 jacobian(local_eqn,local_unknown)
240 this->node_pt(l2)->time_stepper_pt()->weight(2,0)
241 *W*hang_weight*hang_weight2;
244 for(
unsigned k=0;k<DIM;k++)
246 jacobian(local_eqn,local_unknown) +=
247 dpsidx(l2,k)*dtestdx(l,k)*W
248 *hang_weight*hang_weight2;
void fill_in_generic_residual_contribution_lin_wave(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Add element's contribution to elemental residual vector and/or Jacobian matrix flag=1: compute both f...
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.