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" 53 namespace TimeHarmonicLinearElasticityTractionElementHelper
61 Vector<std::complex<double> >& load)
63 unsigned n_dim=load.size();
64 for (
unsigned i=0;
i<n_dim;
i++) {load[
i]=std::complex<double>(0.0,0.0);}
77 template <
class ELEMENT>
107 Vector<std::complex<double> >& traction)
109 Traction_fct_pt(x,n,traction);
117 void fill_in_contribution_to_residuals_time_harmonic_linear_elasticity_traction(
126 const int &face_index) :
138 ELEMENT* cast_element_pt =
dynamic_cast<ELEMENT*
>(element_pt);
139 this->U_index_time_harmonic_linear_elasticity_traction.resize(n_dim);
140 for(
unsigned i=0;
i<n_dim;
i++)
142 this->U_index_time_harmonic_linear_elasticity_traction[
i] =
143 cast_element_pt->u_index_time_harmonic_linear_elasticity(
i);
153 ELEMENT* elem_pt =
dynamic_cast<ELEMENT*
>(element_pt);
155 if(elem_pt->dim()==3)
161 if (this->has_hanging_nodes())
164 "This flux element will not work correctly if nodes are hanging\n",
165 OOMPH_CURRENT_FUNCTION,
166 OOMPH_EXCEPTION_LOCATION);
179 {
return Traction_fct_pt;}
185 fill_in_contribution_to_residuals_time_harmonic_linear_elasticity_traction
196 fill_in_contribution_to_residuals_time_harmonic_linear_elasticity_traction
206 const unsigned &
i)
const 217 void output(std::ostream &outfile,
const unsigned &nplot)
225 outfile << this->tecplot_zone_string(nplot);
228 unsigned num_plot_points=this->nplot_points(nplot);
229 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
232 this->get_s_plot(iplot,nplot,s);
235 this->interpolated_x(s,x);
236 this->traction(s,traction);
239 for(
unsigned i=0;
i<ndim+1;
i++)
240 {outfile << x[
i] <<
" ";}
243 for(
unsigned i=0;
i<ndim+1;
i++)
244 {outfile << traction[
i].real() <<
" ";}
247 for(
unsigned i=0;
i<ndim+1;
i++)
248 {outfile << traction[
i].imag() <<
" ";}
250 outfile << std::endl;
254 this->write_tecplot_zone_footer(outfile,nplot);
262 void output(FILE* file_pt,
const unsigned &n_plot)
270 Vector<std::complex<double> >& traction);
283 template<
class ELEMENT>
287 unsigned n_dim = this->nodal_dimension();
295 outer_unit_normal(s,unit_normal);
301 get_traction(ipt,x,unit_normal,traction);
310 template<
class ELEMENT>
317 unsigned n_node = nnode();
321 unsigned n_position_type = this->nnodal_position_type();
322 if(n_position_type != 1)
325 "TimeHarmonicLinearElasticity is not yet implemented for more than one position type",
326 OOMPH_CURRENT_FUNCTION,
327 OOMPH_EXCEPTION_LOCATION);
332 const unsigned n_dim = this->nodal_dimension();
335 std::vector<std::complex<unsigned> > u_nodal_index(n_dim);
336 for(
unsigned i=0;
i<n_dim;
i++)
345 this->U_index_time_harmonic_linear_elasticity_traction[
i];
355 DShape dpsids(n_node,n_dim-1);
358 unsigned n_intpt = integral_pt()->nweight();
361 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
364 double w = integral_pt()->weight(ipt);
367 dshape_local_at_knot(ipt,psi,dpsids);
376 for(
unsigned l=0;l<n_node;l++)
379 for(
unsigned i=0;
i<n_dim;
i++)
382 const double x_local = nodal_position(l,
i);
383 interpolated_x[
i] += x_local*psi(l);
386 for(
unsigned j=0;j<n_dim-1;j++)
388 interpolated_A(j,
i) += x_local*dpsids(l,j);
395 for(
unsigned i=0;
i<n_dim-1;
i++)
397 for(
unsigned j=0;j<n_dim-1;j++)
403 for(
unsigned k=0;k<n_dim;k++)
405 A(
i,j) += interpolated_A(
i,k)*interpolated_A(j,k);
412 outer_unit_normal(ipt,interpolated_normal);
422 Adet = A(0,0)*A(1,1) - A(0,1)*A(1,0);
427 "Wrong dimension in TimeHarmonicLinearElasticityTractionElement",
428 "TimeHarmonicLinearElasticityTractionElement::fill_in_contribution_to_residuals()",
429 OOMPH_EXCEPTION_LOCATION);
434 double W = w*sqrt(Adet);
444 for(
unsigned l=0;l<n_node;l++)
447 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;
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...
Vector< std::complex< unsigned > > U_index_time_harmonic_linear_elasticity_traction
Index at which the i-th displacement component is stored.
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 ...
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in contribution from Jacobian.
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...
A general Finite Element class.
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.
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
void output(FILE *file_pt)
C_style output function.
void(*&)(const Vector< double > &x, const Vector< double > &n, Vector< std::complex< double > > &traction) traction_fct_pt()
Reference to the traction function pointer.
void output(std::ostream &outfile, const unsigned &nplot)
Output function.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
void output(std::ostream &outfile)
Output with default number of plot points.
void output(std::ostream &outfile)
Output function.
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 fill_in_contribution_to_residuals_time_harmonic_linear_elasticity_traction(Vector< double > &residuals)
Helper function that actually calculates the residuals.
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 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)