37 template<
unsigned DIM>
45 unsigned n_position_type = this->nnodal_position_type();
46 if (n_position_type != 1)
48 throw OomphLibError(
"LinearElasticity is not yet implemented for more "
49 "than one position type",
50 OOMPH_CURRENT_FUNCTION,
51 OOMPH_EXCEPTION_LOCATION);
55 if (this->Elasticity_tensor_pt == 0)
58 OOMPH_CURRENT_FUNCTION,
59 OOMPH_EXCEPTION_LOCATION);
66 unsigned n_node = this->nnode();
69 unsigned u_nodal_index[DIM];
70 for (
unsigned i = 0;
i < DIM;
i++)
72 u_nodal_index[
i] = this->u_index_linear_elasticity(
i);
80 DShape dpsidx(n_node, DIM);
83 unsigned n_intpt = this->integral_pt()->nweight();
89 int local_eqn = 0, local_unknown = 0;
92 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
95 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
98 for (
unsigned i = 0;
i < DIM; ++
i)
100 s[
i] = this->integral_pt()->knot(ipt,
i);
104 double w = this->integral_pt()->weight(ipt);
107 double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
120 for (
unsigned l = 0; l < n_node; l++)
123 for (
unsigned i = 0;
i < DIM;
i++)
126 interpolated_x[
i] += this->nodal_position(l,
i) * psi(l);
137 const double u_value = nodal_value(l, u_nodal_index[
i]);
140 for (
unsigned j = 0; j < DIM; j++)
142 interpolated_dudx(
i, j) += u_value * dpsidx(l, j);
149 this->body_force(interpolated_x, b);
155 unsigned n_master = 1;
156 double hang_weight = 1.0;
159 for (
unsigned l = 0; l < n_node; l++)
162 bool is_node_hanging = node_pt(l)->is_hanging();
167 hang_info_pt = node_pt(l)->hanging_pt();
169 n_master = hang_info_pt->
nmaster();
178 for (
unsigned m = 0; m < n_master; m++)
181 for (
unsigned a = 0; a < DIM; a++)
195 local_eqn = this->nodal_local_eqn(l, u_nodal_index[a]);
203 residuals[local_eqn] += ( -b[a]) *
204 psi(l) *
W * hang_weight;
207 for (
unsigned b = 0; b < DIM; b++)
209 for (
unsigned c = 0; c < DIM; c++)
211 for (
unsigned d = 0; d < DIM; d++)
214 residuals[local_eqn] += this->
E(a, b, c, d) *
215 interpolated_dudx(c, d) *
216 dpsidx(l, b) *
W * hang_weight;
225 unsigned n_master2 = 1;
226 double hang_weight2 = 1.0;
228 for (
unsigned l2 = 0; l2 < n_node; l2++)
231 bool is_node2_hanging = node_pt(l2)->is_hanging();
234 if (is_node2_hanging)
236 hang_info2_pt = node_pt(l2)->hanging_pt();
238 n_master2 = hang_info2_pt->nmaster();
247 for (
unsigned m2 = 0; m2 < n_master2; m2++)
250 for (
unsigned c = 0; c < DIM; c++)
254 if (is_node2_hanging)
257 local_unknown = this->local_hang_eqn(
258 hang_info2_pt->master_node_pt(m2), u_nodal_index[c]);
260 hang_weight2 = hang_info2_pt->master_weight(m2);
265 this->nodal_local_eqn(l2, u_nodal_index[c]);
270 if (local_unknown >= 0)
272 for (
unsigned b = 0; b < DIM; b++)
274 for (
unsigned d = 0; d < DIM; d++)
277 jacobian(local_eqn, local_unknown) +=
278 this->
E(a, b, c, d) * dpsidx(l2, d) *
279 dpsidx(l, b) *
W * hang_weight * hang_weight2;
296 template<
unsigned DIM>
298 std::ostream& outfile,
314 unsigned n_intpt = this->integral_pt()->nweight();
324 nplot = unsigned(pow(n_intpt, 1.0 /
double(DIM)));
328 outfile << this->tecplot_zone_string(nplot);
334 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
337 for (
unsigned i = 0;
i < DIM;
i++)
339 s[
i] = this->integral_pt()->knot(ipt,
i);
343 double w = this->integral_pt()->weight(ipt);
346 double J = this->J_eulerian(
s);
352 this->interpolated_x(
s, x);
358 (*exact_grad_pt)(x, exact_grad);
361 for (
unsigned i = 0;
i < DIM;
i++)
363 outfile << x[
i] <<
" ";
365 for (
unsigned i = 0;
i < DIM;
i++)
367 outfile << exact_grad[
i] <<
" " << exact_grad[
i] - dudx_fe[
i]
372 for (
unsigned i = 0;
i < DIM;
i++)
375 norm += exact_grad[
i] * exact_grad[
i] *
W;
377 (exact_grad[
i] - dudx_fe[
i]) * (exact_grad[
i] - dudx_fe[
i]) *
W;
382 template<
unsigned DIM>
385 if (this->tree_pt()->father_pt() != 0)
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
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.
An OomphLibError object which should be thrown when an run-time error is encountered....
p-refineable version of 2D QLinearElasticityElement elements
void further_build()
Broken assignment operator.
void compute_energy_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_grad_pt, double &error, double &norm)
Get error against and norm of exact solution.
Class for Refineable LinearElasticity equations.
void further_build()
Further build function, pass the pointers down to the sons.
void fill_in_generic_contribution_to_residuals_linear_elasticity(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Overloaded helper function to take hanging nodes into account.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...