33 #ifndef OOMPH_LINEAR_ELASTICITY_TRACTION_ELEMENTS_HEADER 34 #define OOMPH_LINEAR_ELASTICITY_TRACTION_ELEMENTS_HEADER 38 #include <oomph-lib-config.h> 43 #include "../generic/Qelements.h" 54 namespace LinearElasticityTractionElementHelper
65 unsigned n_dim=load.size();
66 for (
unsigned i=0;
i<n_dim;
i++) {load[
i]=0.0;}
79 template <
class ELEMENT>
93 void (*Traction_fct_pt)(
const double& time,
106 const unsigned& intpt,
111 Traction_fct_pt(time,x,n,traction);
119 void fill_in_contribution_to_residuals_linear_elasticity_traction(
128 const int &face_index) :
138 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(element_pt);
140 if(elem_pt->dim()==3)
146 if (this->has_hanging_nodes())
149 "This flux element will not work correctly if nodes are hanging\n",
150 OOMPH_CURRENT_FUNCTION,
151 OOMPH_EXCEPTION_LOCATION);
162 ELEMENT* cast_element_pt =
dynamic_cast<ELEMENT*
>(element_pt);
163 this->U_index_linear_elasticity_traction.resize(n_dim);
164 for(
unsigned i=0;
i<n_dim;
i++)
166 this->U_index_linear_elasticity_traction[
i] =
167 cast_element_pt->u_index_linear_elasticity(
i);
180 {
return Traction_fct_pt;}
186 fill_in_contribution_to_residuals_linear_elasticity_traction(residuals);
196 fill_in_contribution_to_residuals_linear_elasticity_traction(residuals);
205 const unsigned &
i)
const 213 void output(std::ostream &outfile,
const unsigned &n_plot)
221 void output(FILE* file_pt,
const unsigned &n_plot)
228 void traction(
const double& time,
243 template<
class ELEMENT>
247 unsigned n_dim = this->nodal_dimension();
255 outer_unit_normal(s,unit_normal);
261 get_traction(time,ipt,x,unit_normal,traction);
269 template<
class ELEMENT>
276 unsigned n_node = nnode();
279 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
283 unsigned n_position_type = this->nnodal_position_type();
284 if(n_position_type != 1)
287 "LinearElasticity is not yet implemented for more than one position type",
288 OOMPH_CURRENT_FUNCTION,
289 OOMPH_EXCEPTION_LOCATION);
294 unsigned n_dim = this->nodal_dimension();
297 unsigned u_nodal_index[n_dim];
298 for(
unsigned i=0;
i<n_dim;
i++)
300 u_nodal_index[
i] = this->U_index_linear_elasticity_traction[
i];
310 DShape dpsids(n_node,n_dim-1);
313 unsigned n_intpt = integral_pt()->nweight();
316 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
319 double w = integral_pt()->weight(ipt);
322 dshape_local_at_knot(ipt,psi,dpsids);
331 for(
unsigned l=0;l<n_node;l++)
334 for(
unsigned i=0;
i<n_dim;
i++)
337 const double x_local = nodal_position(l,
i);
338 interpolated_x[
i] += x_local*psi(l);
341 for(
unsigned j=0;j<n_dim-1;j++)
343 interpolated_A(j,
i) += x_local*dpsids(l,j);
350 for(
unsigned i=0;
i<n_dim-1;
i++)
352 for(
unsigned j=0;j<n_dim-1;j++)
358 for(
unsigned k=0;k<n_dim;k++)
360 A(
i,j) += interpolated_A(
i,k)*interpolated_A(j,k);
367 outer_unit_normal(ipt,interpolated_normal);
377 Adet = A(0,0)*A(1,1) - A(0,1)*A(1,0);
382 "Wrong dimension in LinearElasticityTractionElement",
383 "LinearElasticityTractionElement::fill_in_contribution_to_residuals()",
384 OOMPH_EXCEPTION_LOCATION);
389 double W = w*sqrt(Adet);
400 for(
unsigned l=0;l<n_node;l++)
403 for(
unsigned i=0;
i<n_dim;
i++)
405 local_eqn = this->nodal_local_eqn(l,u_nodal_index[
i]);
410 residuals[local_eqn] -= traction[
i]*psi(l)*
W;
Vector< unsigned > U_index_linear_elasticity_traction
Index at which the i-th displacement component is stored.
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing...
LinearElasticityTractionElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the value of the index and its limit.
A general Finite Element class.
virtual void get_traction(const double &time, const unsigned &intpt, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction)
Get the traction vector: Pass number of integration point (dummy), Eulerlian coordinate and normal ve...
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
In a FaceElement, the "global" intrinsic coordinate of the element along the boundary, when viewed as part of a compound geometric object is specified using the boundary coordinate defined by the mesh. Note: Boundary coordinates will have been set up when creating the underlying mesh, and their values will have been stored at the nodes.
void Zero_traction_fct(const double &time, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
Default load function (zero traction)
void output(std::ostream &outfile)
Output function.
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in contribution from Jacobian.
void fill_in_contribution_to_residuals_linear_elasticity_traction(Vector< double > &residuals)
Helper function that actually calculates the residuals.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function.
void(*&)(const double &time, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction) traction_fct_pt()
Reference to the traction function pointer.
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Function for building a lower dimensional FaceElement on the specified face of the FiniteElement...
void traction(const double &time, const Vector< double > &s, Vector< double > &traction)
Compute traction vector at specified local coordinate Should only be used for post-processing; ignore...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Return the residuals.
void output(FILE *file_pt)
C_style output function.