37 template<
unsigned DIM>
43 unsigned n_node = nnode();
46 double time = node_pt(0)->time_stepper_pt()->time_pt()->time();
49 unsigned u_nodal_index = this->u_index_lin_wave();
52 Shape psi(n_node), test(n_node);
53 DShape dpsidx(n_node, DIM), dtestdx(n_node, DIM);
56 unsigned n_intpt = integral_pt()->nweight();
63 int local_eqn = 0, local_unknown = 0;
66 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
69 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
72 for (
unsigned i = 0;
i < DIM;
i++)
s[
i] = integral_pt()->knot(ipt,
i);
75 double w = integral_pt()->weight(ipt);
78 double J = this->dshape_and_dtest_eulerian_at_knot_lin_wave(
79 ipt, psi, dpsidx, test, dtestdx);
86 double interpolated_u = 0.0;
96 for (
unsigned l = 0; l < n_node; l++)
99 double u_value = this->nodal_value(l, u_nodal_index);
100 interpolated_u += u_value * psi(l);
101 ddudt += this->d2u_dt2_lin_wave(l) * psi(l);
103 for (
unsigned j = 0; j < DIM; j++)
105 interpolated_x[j] += nodal_position(l, j) * psi(l);
106 interpolated_dudx[j] += u_value * dpsidx(l, j);
112 this->get_source_lin_wave(time, ipt, interpolated_x, source);
120 for (
unsigned l = 0; l < n_node; l++)
124 unsigned n_master = 1;
125 double hang_weight = 1.0;
127 bool is_node_hanging = this->node_pt(l)->is_hanging();
133 hang_info_pt = this->node_pt(l)->hanging_pt();
134 n_master = hang_info_pt->
nmaster();
143 for (
unsigned m = 0; m < n_master; m++)
159 local_eqn = this->nodal_local_eqn(l, u_nodal_index);
168 residuals[local_eqn] +=
169 (ddudt + source) * test(l) *
W * hang_weight;
172 for (
unsigned k = 0; k < DIM; k++)
174 residuals[local_eqn] +=
175 interpolated_dudx[k] * dtestdx(l, k) *
W * hang_weight;
183 unsigned n_master2 = 1;
184 double hang_weight2 = 1.0;
186 for (
unsigned l2 = 0; l2 < n_node; l2++)
189 bool is_node2_hanging = this->node_pt(l2)->is_hanging();
191 if (is_node2_hanging)
193 hang_info2_pt = this->node_pt(l2)->hanging_pt();
194 n_master2 = hang_info2_pt->nmaster();
203 for (
unsigned m2 = 0; m2 < n_master2; m2++)
207 if (is_node2_hanging)
210 local_unknown = this->local_hang_eqn(
211 hang_info2_pt->master_node_pt(m2), u_nodal_index);
213 hang_weight2 = hang_info2_pt->master_weight(m2);
219 local_unknown = this->nodal_local_eqn(l2, u_nodal_index);
225 if (local_unknown >= 0)
229 jacobian(local_eqn, local_unknown) +=
231 this->node_pt(l2)->time_stepper_pt()->weight(2, 0) *
W *
232 hang_weight * hang_weight2;
235 for (
unsigned k = 0; k < DIM; k++)
237 jacobian(local_eqn, local_unknown) +=
238 dpsidx(l2, k) * dtestdx(l, k) *
W * hang_weight *
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_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...
Refineable version of 2D QLinearWaveElement elements.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...