33 #ifndef OOMPH_AXISYM_FLUID_TRACTION_ELEMENTS_HEADER 34 #define OOMPH_AXISYM_FLUID_TRACTION_ELEMENTS_HEADER 38 #include <oomph-lib-config.h> 43 #include "../generic/shape.h" 44 #include "../generic/elements.h" 45 #include "../generic/element_with_external_element.h" 56 namespace AxisymmetricNavierStokesTractionElementHelper
63 const Vector<double> &x,
64 const Vector<double>&
N,
65 Vector<double>& load);
77 template <
class ELEMENT>
92 void (*Traction_fct_pt)(
const double& time,
105 const unsigned& intpt,
110 Traction_fct_pt(time,x,n,traction);
118 void fill_in_contribution_to_residuals_axisymmetric_nst_traction(
138 ELEMENT* cast_element_pt =
dynamic_cast<ELEMENT*
>(element_pt);
139 this->U_index_axisymmetric_nst_traction.resize(n_dim+1);
140 for(
unsigned i=0;
i<n_dim+1;
i++)
142 this->U_index_axisymmetric_nst_traction[
i] =
143 cast_element_pt->u_index_axi_nst(
i);
158 {
return Traction_fct_pt;}
164 fill_in_contribution_to_residuals_axisymmetric_nst_traction(residuals);
174 fill_in_contribution_to_residuals_axisymmetric_nst_traction(residuals);
183 const unsigned &
i)
const 198 unsigned n_dim = this->nodal_dimension();
207 const unsigned& nplot)
const 210 unsigned n_dim = this->nodal_dimension();
213 const unsigned n_node = nnode();
216 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
226 unsigned num_plot_points=this->nplot_points_paraview(nplot);
227 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
230 this->get_s_plot(iplot,nplot,s);
234 outer_unit_normal(s,unit_normal);
240 for(
unsigned i=0;
i<n_dim;
i++)
242 interpolated_x[
i] = 0.0;
246 for(
unsigned l=0;l<n_node;l++)
249 for(
unsigned i=0;
i<n_dim;
i++)
251 interpolated_x[
i] += this->nodal_position(l,
i)*psi[l];
260 get_traction(time,ipt,interpolated_x,unit_normal,traction);
265 file_out << traction[k] << std::endl;
268 else if (k<2*n_dim+1 && k>=n_dim+1)
270 file_out << unit_normal[k] << std::endl;
275 std::stringstream error_stream;
277 <<
"Axisymmetric Fluid Traction Navier-Stokes Elements only store " 278 << 2*(n_dim+1) <<
" fields " << std::endl;
281 OOMPH_CURRENT_FUNCTION,
282 OOMPH_EXCEPTION_LOCATION);
293 unsigned n_dim = this->nodal_dimension();
301 else if (i<2*n_dim+1 && i>=n_dim+1)
308 std::stringstream error_stream;
310 <<
"Axisymmetric Fluid Traction Navier-Stokes Elements only store " 311 << 2*(n_dim+1) <<
" fields " << std::endl;
314 OOMPH_CURRENT_FUNCTION,
315 OOMPH_EXCEPTION_LOCATION);
320 void output(std::ostream &outfile,
const unsigned &n_plot)
323 unsigned n_dim = this->nodal_dimension();
326 const unsigned n_node = nnode();
329 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
339 outfile << this->tecplot_zone_string(n_plot);
342 unsigned num_plot_points=this->nplot_points(n_plot);
343 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
346 this->get_s_plot(iplot,n_plot,s);
350 outer_unit_normal(s,unit_normal);
356 for(
unsigned i=0;
i<n_dim;
i++)
358 interpolated_x[
i] = 0.0;
362 for(
unsigned l=0;l<n_node;l++)
365 for(
unsigned i=0;
i<n_dim;
i++)
367 interpolated_x[
i] += this->nodal_position(l,
i)*psi[l];
376 get_traction(time,ipt,interpolated_x,unit_normal,traction);
379 for(
unsigned i=0;
i<n_dim;
i++)
381 outfile << interpolated_x[
i] <<
" ";
385 for(
unsigned i=0;
i<n_dim+1;
i++)
387 outfile << traction[
i] <<
" ";
391 for(
unsigned i=0;
i<n_dim;
i++)
393 outfile << unit_normal[
i] <<
" ";
395 outfile << std::endl;
405 void output(FILE* file_pt,
const unsigned &n_plot)
412 void traction(
const double &time,
427 template<
class ELEMENT>
431 unsigned n_dim = this->nodal_dimension();
439 outer_unit_normal(s,unit_normal);
445 get_traction(time,ipt,x,unit_normal,traction);
454 template<
class ELEMENT>
461 unsigned n_node = nnode();
464 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
468 unsigned n_position_type = this->nnodal_position_type();
469 if(n_position_type != 1)
472 "AxisymmetricNavierStokes is not yet implemented for more than one position type",
473 OOMPH_CURRENT_FUNCTION,
474 OOMPH_EXCEPTION_LOCATION);
479 unsigned n_dim = this->nodal_dimension();
482 unsigned u_nodal_index[n_dim+1];
483 for(
unsigned i=0;
i<n_dim+1;
i++)
485 u_nodal_index[
i] = this->U_index_axisymmetric_nst_traction[
i];
495 DShape dpsids(n_node,n_dim-1);
498 unsigned n_intpt = integral_pt()->nweight();
501 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
504 double w = integral_pt()->weight(ipt);
507 dshape_local_at_knot(ipt,psi,dpsids);
516 for(
unsigned l=0;l<n_node;l++)
519 for(
unsigned i=0;
i<n_dim;
i++)
522 const double x_local = nodal_position(l,
i);
523 interpolated_x[
i] += x_local*psi(l);
526 for(
unsigned j=0;j<n_dim-1;j++)
528 interpolated_A(j,
i) += x_local*dpsids(l,j);
535 for(
unsigned i=0;
i<n_dim-1;
i++)
537 for(
unsigned j=0;j<n_dim-1;j++)
543 for(
unsigned k=0;k<n_dim;k++)
545 A(
i,j) += interpolated_A(
i,k)*interpolated_A(j,k);
552 outer_unit_normal(ipt,interpolated_normal);
562 Adet = A(0,0)*A(1,1) - A(0,1)*A(1,0);
567 "Wrong dimension in AxisymmetricNavierStokesTractionElement",
568 "AxisymmetricNavierStokesTractionElement::fill_in_contribution_to_residuals()",
569 OOMPH_EXCEPTION_LOCATION);
574 double W = w*sqrt(Adet);
585 for(
unsigned l=0;l<n_node;l++)
588 for(
unsigned i=0;
i<n_dim+1;
i++)
591 local_eqn = this->nodal_local_eqn(l,u_nodal_index[
i]);
596 residuals[local_eqn] -= traction[
i]*psi(l)*interpolated_x[0]*
W;
616 namespace LinearisedFSIAxisymmetricNStNoSlipBCHelper
632 template <
class FLUID_BULK_ELEMENT,
class SOLID_BULK_ELEMENT>
649 const int& face_index,
650 const unsigned &
id=0);
657 "LinearisedFSIAxisymmetricNStNoSlipBCElementElement");
687 fill_in_generic_residual_contribution_fsi_no_slip_axisym(
698 fill_in_generic_residual_contribution_fsi_no_slip_axisym
699 (residuals,jacobian,1);
702 fill_in_jacobian_from_external_interaction_by_fd(residuals,jacobian);
714 void output(std::ostream &outfile,
const unsigned &n_plot)
719 const unsigned n_intpt = integral_pt()->nweight();
725 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
729 for(
unsigned i=0;
i<(
Dim-1);
i++)
731 s_int[
i] = integral_pt()->knot(ipt,
i);
736 interpolated_zeta(s_int,zeta);
739 SOLID_BULK_ELEMENT* ext_el_pt=
dynamic_cast<SOLID_BULK_ELEMENT*
>(
740 external_element_pt(0,ipt));
743 ext_el_pt->interpolated_du_dt_axisymmetric_linear_elasticity(s_ext,dudt);
746 outfile << ext_el_pt->interpolated_x(s_ext,0) <<
" " 747 << ext_el_pt->interpolated_x(s_ext,1) <<
" " 751 << zeta[0] << std::endl;
761 void output(FILE* file_pt,
const unsigned &n_plot)
775 unsigned n_node = nnode();
781 for(
unsigned i=0;
i<n_node;
i++) {test[
i] = psi[
i];}
784 return J_eulerian(s);
796 unsigned n_node = nnode();
799 shape_at_knot(ipt,psi);
802 for(
unsigned i=0;
i<n_node;
i++) {test[
i] = psi[
i];}
805 return J_eulerian_at_knot(ipt);
816 void fill_in_generic_residual_contribution_fsi_no_slip_axisym(
818 const unsigned& flag);
848 template <
class FLUID_BULK_ELEMENT,
class SOLID_BULK_ELEMENT>
850 SOLID_BULK_ELEMENT>::
851 LinearisedFSIAxisymmetricNStNoSlipBCElementElement(
853 const int &face_index,
854 const unsigned &
id) :
880 for (
unsigned i=0;
i<3;
i++)
883 dynamic_cast<FLUID_BULK_ELEMENT*
>(bulk_el_pt)->u_index_axi_nst(
i);
902 template <
class FLUID_BULK_ELEMENT,
class SOLID_BULK_ELEMENT>
906 const unsigned& flag)
909 const unsigned n_node =
nnode();
912 Shape psif(n_node), testf(n_node);
921 const double local_st=
st();
928 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
949 for(
unsigned j=0;j<n_node;j++)
958 unsigned first_index=
962 for(
unsigned i=0;
i<
Dim+1;
i++)
964 lambda[
i]+=nod_pt->
value(first_index+
i)*psif(j);
970 SOLID_BULK_ELEMENT* ext_el_pt=
dynamic_cast<SOLID_BULK_ELEMENT*
>(
974 ext_el_pt->interpolated_du_dt_axisymmetric_linear_elasticity(s_ext,dudt);
980 for(
unsigned l=0;l<n_node;l++)
984 for (
unsigned i=0;
i<
Dim+1;
i++)
997 residuals[local_eqn] -= lambda[
i]*testf[l]*
W;
1004 for(
unsigned l2=0;l2<n_node;l2++)
1013 index_of_first_value_assigned_by_face_element(
Id)+i);
1016 if (local_unknown>=0)
1018 jacobian(local_eqn,local_unknown) -=
1019 psif[l2]*testf[l]*
W;
1038 residuals[local_eqn]+=(local_st*dudt[
i]-fluid_veloc[
i])*testf(l)*
W;
1045 for(
unsigned l2=0;l2<n_node;l2++)
1051 if(local_unknown >= 0)
1053 jacobian(local_eqn,local_unknown) -=
1054 psif[l2]*testf[l]*
W;
virtual void get_traction(const double &time, const unsigned &intpt, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction) const
Get the traction vector: Pass number of integration point (dummy), Eulerian coordinate and normal vec...
double shape_and_test(const Vector< double > &s, Shape &psi, Shape &test) const
Function to compute the shape and test functions and to return the Jacobian of mapping between local ...
void Zero_traction_fct(const double &time, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
Default load function (zero traction)
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void fill_in_contribution_to_residuals_axisymmetric_nst_traction(Vector< double > &residuals)
Helper function that actually calculates the residuals.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Return the residuals.
Vector< double > & external_element_local_coord(const unsigned &interaction_index, const unsigned &ipt)
Access function to get source element's local coords for specified interaction index at specified int...
unsigned nscalar_paraview() const
Number of scalars/fields output by this element. Reimplements broken virtual function in base class...
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_generic_residual_contribution_fsi_no_slip_axisym(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Add the element's contribution to its residual vector. flag=1(or 0): do (or don't) compute the contri...
void output(std::ostream &outfile)
Output function.
LinearisedFSIAxisymmetricNStNoSlipBCElementElement(const LinearisedFSIAxisymmetricNStNoSlipBCElementElement &dummy)
Broken copy constructor.
double st() const
Access function for the fluid Strouhal number.
void output(FILE *file_pt)
C_style output function.
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.
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 ...
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
void set_ninteraction(const unsigned &n_interaction)
Set the number of interactions in the element This function is usually called in the specific element...
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
void(*&)(const double &time, const Vector< double > &x, const Vector< double > &n, Vector< double > &traction) traction_fct_pt()
Reference to the traction function pointer.
void add_additional_values(const Vector< unsigned > &nadditional_values, const unsigned &id)
Helper function adding additional values for the unknowns associated with the FaceElement. This function also sets the map containing the position of the first entry of this face element's additional values.The inputs are the number of additional values and the face element's ID. Note the same number of additonal values are allocated at ALL nodes.
unsigned Dim
Dimension of zeta tuples (set by get_dim_helper) – needed because we store the scalar coordinates in...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Add the element's contribution to its residual vector and its Jacobian matrix.
double * St_pt
Pointer to fluid Strouhal number.
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...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
unsigned nodal_dimension() const
Return the required Eulerian dimension of the nodes in this element.
Vector< unsigned > U_index_axisymmetric_nst_traction
Index at which the i-th velocity component is stored.
A class that contains the information required by Nodes that are located on Mesh boundaries. A BoundaryNode of a particular type is obtained by combining a given Node with this class. By differentiating between Nodes and BoundaryNodes we avoid a lot of un-necessary storage in the bulk Nodes.
unsigned Dim
The spatial dimension of the problem.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
double Default_strouhal_number
Default for fluid Strouhal number.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
void output(std::ostream &outfile)
Output function.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
void shape(const double &s, double *Psi)
Definition for 1D Lagrange shape functions. The value of all the shape functions at the local coordin...
void output(std::ostream &outfile)
Output with default number of plot points.
double shape_and_test_at_knot(const unsigned &ipt, Shape &psi, Shape &test) const
Function to compute the shape and test functions and to return.
unsigned index_of_first_value_assigned_by_face_element(const unsigned &face_id=0) const
Return the index of the first value associated with the i-th face element value. If no argument is sp...
Vector< unsigned > U_index_fsi_no_slip_axisym
The index at which the unknowns are stored at the nodes.
A class for elements that allow the imposition of the linearised FSI no slip condition from an adjace...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
FiniteElement *& external_element_pt(const unsigned &interaction_index, const unsigned &ipt)
Access function to source element for specified interaction index at specified integration point...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
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 scalar_value_paraview(std::ofstream &file_out, const unsigned &k, const unsigned &nplot) const
Write values of the k-th scalar field at the plot points. Needs to be implemented for each new specif...
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: Output at Gauss points; n_plot is ignored.
double *& st_pt()
Broken assignment operator.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in contribution from Jacobian.
std::string scalar_name_paraview(const unsigned &i) const
Name of the i-th scalar field. Default implementation.
unsigned nnode() const
Return the number of nodes.
void output(FILE *file_pt)
C-style output function.
double value(const unsigned &i) const
Return i-th value (dofs or pinned) at this node either directly or via hanging node representation...
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
std::string to_string(T object, unsigned float_precision=8)
Conversion function that should work for anything with operator<< defined (at least all basic types)...
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node...