29 #ifndef OOMPH_LINEAR_ELASTICITY_TRACTION_ELEMENTS_HEADER
30 #define OOMPH_LINEAR_ELASTICITY_TRACTION_ELEMENTS_HEADER
34 #include <oomph-lib-config.h>
39 #include "../generic/Qelements.h"
47 namespace TimeHarmonicLinearElasticityTractionElementHelper
54 Vector<std::complex<double>>& load)
56 unsigned n_dim = load.size();
57 for (
unsigned i = 0;
i < n_dim;
i++)
59 load[
i] = std::complex<double>(0.0, 0.0);
73 template<
class ELEMENT>
130 ELEMENT* cast_element_pt =
dynamic_cast<ELEMENT*
>(element_pt);
132 for (
unsigned i = 0;
i < n_dim;
i++)
135 cast_element_pt->u_index_time_harmonic_linear_elasticity(
i);
145 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(element_pt);
147 if (elem_pt->dim() == 3)
156 throw OomphLibError(
"This flux element will not work correctly "
157 "if nodes are hanging\n",
158 OOMPH_CURRENT_FUNCTION,
159 OOMPH_EXCEPTION_LOCATION);
201 const unsigned&
i)
const
214 void output(std::ostream& outfile,
const unsigned& nplot)
226 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
236 for (
unsigned i = 0;
i <
ndim + 1;
i++)
238 outfile << x[
i] <<
" ";
242 for (
unsigned i = 0;
i <
ndim + 1;
i++)
248 for (
unsigned i = 0;
i <
ndim + 1;
i++)
253 outfile << std::endl;
267 void output(FILE* file_pt,
const unsigned& n_plot)
289 template<
class ELEMENT>
293 unsigned n_dim = this->nodal_dimension();
297 interpolated_x(
s, x);
301 outer_unit_normal(
s, unit_normal);
307 get_traction(ipt, x, unit_normal, traction);
315 template<
class ELEMENT>
321 unsigned n_node = nnode();
325 unsigned n_position_type = this->nnodal_position_type();
326 if (n_position_type != 1)
328 throw OomphLibError(
"TimeHarmonicLinearElasticity is not yet implemented "
329 "for more than one position type",
330 OOMPH_CURRENT_FUNCTION,
331 OOMPH_EXCEPTION_LOCATION);
336 const unsigned n_dim = this->nodal_dimension();
339 std::vector<std::complex<unsigned>> u_nodal_index(n_dim);
340 for (
unsigned i = 0;
i < n_dim;
i++)
349 this->U_index_time_harmonic_linear_elasticity_traction[
i];
359 DShape dpsids(n_node, n_dim - 1);
362 unsigned n_intpt = integral_pt()->nweight();
365 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
368 double w = integral_pt()->weight(ipt);
371 dshape_local_at_knot(ipt, psi, dpsids);
380 for (
unsigned l = 0; l < n_node; l++)
383 for (
unsigned i = 0;
i < n_dim;
i++)
386 const double x_local = nodal_position(l,
i);
387 interpolated_x[
i] += x_local * psi(l);
390 for (
unsigned j = 0; j < n_dim - 1; j++)
392 interpolated_A(j,
i) += x_local * dpsids(l, j);
399 for (
unsigned i = 0;
i < n_dim - 1;
i++)
401 for (
unsigned j = 0; j < n_dim - 1; j++)
407 for (
unsigned k = 0; k < n_dim; k++)
409 A(
i, j) += interpolated_A(
i, k) * interpolated_A(j, k);
416 outer_unit_normal(ipt, interpolated_normal);
426 Adet = A(0, 0) * A(1, 1) - A(0, 1) * A(1, 0);
430 "Wrong dimension in TimeHarmonicLinearElasticityTractionElement",
431 "TimeHarmonicLinearElasticityTractionElement::fill_in_contribution_"
433 OOMPH_EXCEPTION_LOCATION);
438 double W = w * sqrt(Adet);
442 get_traction(ipt, interpolated_x, interpolated_normal, traction);
445 for (
unsigned l = 0; l < n_node; l++)
448 for (
unsigned i = 0;
i < n_dim;
i++)
451 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i].real());
456 residuals[local_eqn] -= traction[
i].real() * psi(l) *
W;
460 local_eqn = this->nodal_local_eqn(l, u_nodal_index[
i].imag());
465 residuals[local_eqn] -= traction[
i].imag() * psi(l) *
W;
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
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,...
double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s. Overloaded to get information from bulk...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A general Finite Element class.
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
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....
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
bool has_hanging_nodes() const
Return boolean to indicate if any of the element's nodes are geometrically hanging.
unsigned ndim() const
Access function to # of Eulerian coordinates.
An OomphLibError object which should be thrown when an run-time error is encountered....
RefineableElements are FiniteElements that may be subdivided into children to provide a better local ...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
A class for elements that allow the imposition of an applied traction in the equations of time-harmon...
void fill_in_contribution_to_residuals_time_harmonic_linear_elasticity_traction(Vector< double > &residuals)
Helper function that actually calculates the residuals.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
virtual void get_traction(const unsigned &intpt, const Vector< double > &x, const Vector< double > &n, Vector< std::complex< double >> &traction)
Get the traction vector: Pass number of integration point (dummy), Eulerian coordinate and normal vec...
void(*&)(const Vector< double > &x, const Vector< double > &n, Vector< std::complex< double >> &traction) traction_fct_pt()
Reference to the traction function pointer.
TimeHarmonicLinearElasticityTractionElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the value of the index and its limit.
void(* Traction_fct_pt)(const Vector< double > &x, const Vector< double > &n, Vector< std::complex< double >> &result)
Pointer to an imposed traction function. Arguments: Eulerian coordinate; outer unit normal; applied t...
void output(std::ostream &outfile, const unsigned &nplot)
Output function.
void output(std::ostream &outfile)
Output function.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Specify the value of nodal zeta from the face geometry The "global" intrinsic coordinate of the eleme...
Vector< std::complex< unsigned > > U_index_time_harmonic_linear_elasticity_traction
Index at which the i-th displacement component is stored.
void traction(const Vector< double > &s, Vector< std::complex< double >> &traction)
Compute traction vector at specified local coordinate Should only be used for post-processing; ignore...
void output(FILE *file_pt)
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(Vector< double > &residuals)
Return the residuals.
void Zero_traction_fct(const Vector< double > &x, const Vector< double > &N, Vector< std::complex< double >> &load)
Default load function (zero traction)
//////////////////////////////////////////////////////////////////// ////////////////////////////////...