linearised_axisymmetric_fluid_interface_elements.h
Go to the documentation of this file.
1 //LIC// ====================================================================
2 //LIC// This file forms part of oomph-lib, the object-oriented,
3 //LIC// multi-physics finite-element library, available
4 //LIC// at http://www.oomph-lib.org.
5 //LIC//
6 //LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 //LIC//
8 //LIC// This library is free software; you can redistribute it and/or
9 //LIC// modify it under the terms of the GNU Lesser General Public
10 //LIC// License as published by the Free Software Foundation; either
11 //LIC// version 2.1 of the License, or (at your option) any later version.
12 //LIC//
13 //LIC// This library is distributed in the hope that it will be useful,
14 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 //LIC// Lesser General Public License for more details.
17 //LIC//
18 //LIC// You should have received a copy of the GNU Lesser General Public
19 //LIC// License along with this library; if not, write to the Free Software
20 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 //LIC// 02110-1301 USA.
22 //LIC//
23 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 //LIC//
25 //LIC//====================================================================
26 //Header file for (one-dimensional) free surface elements
27 //Include guards, to prevent multiple includes
28 #ifndef OOMPH_PATRICKLINEARISED_INTERFACE_ELEMENTS_HEADER
29 #define OOMPH_PATRICKLINEARISED_INTERFACE_ELEMENTS_HEADER
30 
31 // Config header generated by autoconfig
32 #ifdef HAVE_CONFIG_H
33  #include <oomph-lib-config.h>
34 #endif
35 
36 // oomph-lib includes
37 #include "generic.h"
38 #include "perturbed_spines.h"
39 
40 namespace oomph
41 {
42 
43  //========================================================================
46  //========================================================================
48  : public virtual FaceElement
49  {
50  private:
51 
53  double *Ca_pt;
54 
56  double *St_pt;
57 
60 
63 
66 
67 
68  protected:
69 
72 
76 
81  virtual int kinematic_local_eqn(const unsigned &n,const unsigned &i)=0;
82 
83  public:
84 
89  &bulk_node_number)=0;
90 
91 
92  protected:
93 
97  Vector<double> &residuals,
98  DenseMatrix<double> &jacobian,
99  unsigned flag);
100 
109  Vector<double> &residuals, DenseMatrix<double> &jacobian,
110  const unsigned &flag,
111  const Shape &psif, const DShape &dpsifds,
112  const Vector<double> &interpolated_n,
113  const double &r, const double &W,
114  const double &J) {}
115 
118  double dXhat_dt(const unsigned &n, const unsigned &i) const
119  {
120  // Get the data's positional timestepper
121  TimeStepper* position_time_stepper_pt
122  = this->node_pt(n)->position_time_stepper_pt();
123 
124  // Get the value
125  const double xhat_value = this->node_pt(n)->value(Xhat_index_interface[i]);
126 
127  // Initialise dXhat/dt
128  double dXhatdt = 0.0;
129 
130  // Loop over the timesteps, if there is a non Steady timestepper
131  if(!position_time_stepper_pt->is_steady())
132  {
133  // Number of timsteps (past & present)
134  const unsigned n_time = position_time_stepper_pt->ntstorage();
135 
136  // Add the contributions to the time derivative
137  for(unsigned t=0;t<n_time;t++)
138  {
139  dXhatdt += position_time_stepper_pt->weight(1,t)*xhat_value;
140  }
141  }
142 
143  return dXhatdt;
144  }
145 
146 
147  public:
148 
151  {
152  // Set all the physical parameter pointers to the default value of zero
155 
156  // Set the azimuthal mode number to default (zero)
158  }
159 
165  virtual double sigma(const Vector<double> &s_local) { return 1.0; }
166 
169  {
170  // Add the residual contributions
173  }
174 
176  const double &ca() const { return *Ca_pt; }
177 
179  double* &ca_pt() { return Ca_pt; }
180 
182  const double &st() const { return *St_pt; }
183 
185  double* &st_pt() { return St_pt; }
186 
188  const int &azimuthal_mode_number() const
189  { return *Azimuthal_Mode_Number_pt; }
190 
193 
197  double u(const unsigned &n, const unsigned &i)
198  {
199  return node_pt(n)->value(U_index_interface[i]);
200  }
201 
203  double interpolated_u(const Vector<double> &s, const unsigned &i)
204  {
205  // Find number of nodes
206  const unsigned n_node = nnode();
207 
208  // Storage for the local shape function
209  Shape psi(n_node);
210 
211  // Get values of shape function at local coordinate s
212  this->shape(s,psi);
213 
214  // Initialise value of u
215  double interpolated_u = 0.0;
216 
217  // Loop over the local nodes and sum
218  for(unsigned l=0;l<n_node;l++) { interpolated_u += u(l,i)*psi(l); }
219 
220  return(interpolated_u);
221  }
222 
224  void output(std::ostream &outfile) { FiniteElement::output(outfile); }
225 
227  void output(std::ostream &outfile, const unsigned &n_plot);
228 
230  void output(FILE* file_pt) { FiniteElement::output(file_pt); }
231 
233  void output(FILE* file_pt, const unsigned &n_plot);
234 
235 };
236 
237 
238  //========================================================================
255  //========================================================================
256  template<class ELEMENT>
258  public virtual Hijacked<PerturbedSpineElement<FaceGeometry<ELEMENT> > >,
260  {
261  private:
262 
267  int kinematic_local_eqn(const unsigned &n, const unsigned &i)
268  {
269  return this->spine_local_eqn(n,i);
270  }
271 
272 
276  {
277  // Loop over all the passed nodes
279  it!=bulk_node_number.end();++it)
280  {
281  // Hijack the spine heights and delete the returned data objects
282  delete this->hijack_nodal_spine_value(*it,0);
283  }
284  }
285 
288  double dH_dt(const unsigned &n, const unsigned &i) const
289  {
290  // Get the data's timestepper
292 
293  // Upcast from general node to PerturbedSpineNode
294  PerturbedSpineNode* perturbed_spine_node_pt =
295  dynamic_cast<PerturbedSpineNode*>(this->node_pt(n));
296 
297  // Initialise dH/dt
298  double dHdt = 0.0;
299 
300  // Loop over the timesteps, if there is a non Steady timestepper
301  if(!time_stepper_pt->is_steady())
302  {
303  // Number of timsteps (past & present)
304  const unsigned n_time = time_stepper_pt->ntstorage();
305 
306  // Add the contributions to the time derivative
307  for(unsigned t=0;t<n_time;t++)
308  {
309  dHdt += time_stepper_pt->weight(1,t)*
310  perturbed_spine_node_pt->perturbed_spine_pt()->height(t,i);
311  }
312  }
313 
314  return dHdt;
315  }
316 
317  public:
318 
323  FiniteElement* const &bulk_element_pt, const int &face_index) :
326  {
327  // Attach the geometrical information to the element
329 
330  // Find the index at which the velocity unknowns are stored
331  // from the bulk element
332  ELEMENT* cast_element_pt = dynamic_cast<ELEMENT*>(bulk_element_pt);
333 
334  // We must have six velocity components
335  this->U_index_interface.resize(6);
336  for(unsigned i=0;i<6;i++)
337  {
338  this->U_index_interface[i]=cast_element_pt->u_index_lin_axi_nst(i);
339  }
340 
341  // We must have four components of the perturbations to the
342  // nodal positions
343  this->Xhat_index_interface.resize(4);
344  for(unsigned i=0;i<4;i++)
345  {
346  this->Xhat_index_interface[i] =
347  cast_element_pt->xhat_index_lin_axi_nst(i);
348  }
349  }
350 
353  DenseMatrix<double> &jacobian)
354  {
355  // Call the generic residuals routine with the flag set to 1
357  // Call the generic routine to handle the spine variables
358  // PerturbedSpineElement<FaceGeometry<ELEMENT> >::
359  this->fill_in_jacobian_from_geometric_data(jacobian);
360  }
361 
371  Vector<double> &residuals,
372  DenseMatrix<double> &jacobian,
373  unsigned flag);
374 
376  void output(std::ostream &outfile) {FiniteElement::output(outfile);}
377 
379  void output(std::ostream &outfile, const unsigned &n_plot)
381 
383  void output(FILE* file_pt) {FiniteElement::output(file_pt);}
384 
386  void output(FILE* file_pt, const unsigned &n_plot)
388 
390  void output_interface_position(std::ostream &outfile,
391  const unsigned &nplot);
392 
394  void output_perturbation_to_interface(std::ostream &outfile,
395  const unsigned &nplot);
396 
401  const unsigned &i) const
402  {
403  // Determine number of nodes in the element
404  const unsigned n_node = nnode();
405 
406  // Provide storage for local shape functions
407  Shape psi(n_node);
408 
409  // Find values of shape functions
410  shape(s,psi);
411 
412  // Initialise value of H
413  double interpolated_H = 0.0;
414 
415  // Loop over the shape functions and sum
416  for(unsigned l=0;l<n_node;l++)
417  {
418  // Upcast from general node to PerturbedSpineNode
419  PerturbedSpineNode* perturbed_spine_node_pt =
420  dynamic_cast<PerturbedSpineNode*>(this->node_pt(l));
421 
422  // Calculate interpolated i-th component of perturbed spine "heights"
423  interpolated_H +=
424  perturbed_spine_node_pt->perturbed_spine_pt()->height(i)*psi[l];
425  }
426 
427  return(interpolated_H);
428  }
429 
430  };
431 
432 
433 
434 
435 }
436 
437 #endif
438 
439 
440 
441 
442 
443 
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
Definition: shape.h:278
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
void fill_in_jacobian_from_geometric_data(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: element_with_moving_nodes.cc:323
Definition: elements.h:4338
int & face_index()
Definition: elements.h:4626
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
Definition: elements.h:4735
unsigned & bulk_node_number(const unsigned &n)
Definition: elements.h:4825
Definition: elements.h:4998
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
virtual void output(std::ostream &outfile)
Definition: elements.h:3050
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Definition: elements.cc:5132
virtual void shape(const Vector< double > &s, Shape &psi) const =0
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
Definition: hijacked_elements.h:132
Data * hijack_nodal_spine_value(const unsigned &n, const unsigned &i, const bool &return_data=true)
Definition: hijacked_elements.h:279
Definition: linearised_axisymmetric_fluid_interface_elements.h:49
virtual double sigma(const Vector< double > &s_local)
Definition: linearised_axisymmetric_fluid_interface_elements.h:165
int *& azimuthal_mode_number_pt()
Pointer to azimuthal mode number k in e^ik(theta) decomposition.
Definition: linearised_axisymmetric_fluid_interface_elements.h:192
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Calculate the residuals by calling the generic residual contribution.
Definition: linearised_axisymmetric_fluid_interface_elements.h:168
virtual int kinematic_local_eqn(const unsigned &n, const unsigned &i)=0
static int Default_Azimuthal_Mode_Number_Value
Static default value for the azimuthal mode number (zero)
Definition: linearised_axisymmetric_fluid_interface_elements.h:65
double *& st_pt()
Return a pointer to the Strouhal number.
Definition: linearised_axisymmetric_fluid_interface_elements.h:185
virtual void fill_in_generic_residual_contribution_interface(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: linearised_axisymmetric_fluid_interface_elements.cc:52
double * Ca_pt
Pointer to the Capillary number.
Definition: linearised_axisymmetric_fluid_interface_elements.h:53
const double & ca() const
Return the value of the Capillary number.
Definition: linearised_axisymmetric_fluid_interface_elements.h:176
virtual void add_additional_residual_contributions(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag, const Shape &psif, const DShape &dpsifds, const Vector< double > &interpolated_n, const double &r, const double &W, const double &J)
Definition: linearised_axisymmetric_fluid_interface_elements.h:108
double *& ca_pt()
Return a pointer to the Capillary number.
Definition: linearised_axisymmetric_fluid_interface_elements.h:179
Vector< unsigned > Xhat_index_interface
Definition: linearised_axisymmetric_fluid_interface_elements.h:75
const double & st() const
Return the value of the Strouhal number.
Definition: linearised_axisymmetric_fluid_interface_elements.h:182
virtual void hijack_kinematic_conditions(const Vector< unsigned > &bulk_node_number)=0
static double Default_Physical_Constant_Value
Static default value for the physical constants (zero)
Definition: linearised_axisymmetric_fluid_interface_elements.h:62
double * St_pt
Pointer to the Strouhal number.
Definition: linearised_axisymmetric_fluid_interface_elements.h:56
const int & azimuthal_mode_number() const
Azimuthal mode number k in e^ik(theta) decomposition.
Definition: linearised_axisymmetric_fluid_interface_elements.h:188
Vector< unsigned > U_index_interface
Index at which the i-th velocity component is stored.
Definition: linearised_axisymmetric_fluid_interface_elements.h:71
double dXhat_dt(const unsigned &n, const unsigned &i) const
Definition: linearised_axisymmetric_fluid_interface_elements.h:118
void output(std::ostream &outfile)
Overload the output functions.
Definition: linearised_axisymmetric_fluid_interface_elements.h:224
double u(const unsigned &n, const unsigned &i)
Definition: linearised_axisymmetric_fluid_interface_elements.h:197
double interpolated_u(const Vector< double > &s, const unsigned &i)
Calculate the i-th velocity component at the local coordinate s.
Definition: linearised_axisymmetric_fluid_interface_elements.h:203
int * Azimuthal_Mode_Number_pt
Pointer to azimuthal mode number k in e^ik(theta) decomposition.
Definition: linearised_axisymmetric_fluid_interface_elements.h:59
LinearisedAxisymmetricFluidInterfaceElement()
Constructor, set the default values of the booleans and pointers (null)
Definition: linearised_axisymmetric_fluid_interface_elements.h:150
void output(FILE *file_pt)
Overload the C-style output function.
Definition: linearised_axisymmetric_fluid_interface_elements.h:230
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
Definition: nodes.h:1022
double value(const unsigned &i) const
Definition: nodes.cc:2408
Definition: perturbed_spines.h:395
int spine_local_eqn(const unsigned &n, const unsigned &i)
Definition: perturbed_spines.h:438
Definition: linearised_axisymmetric_fluid_interface_elements.h:260
void output(std::ostream &outfile)
Overload the output function.
Definition: linearised_axisymmetric_fluid_interface_elements.h:376
void output(std::ostream &outfile, const unsigned &n_plot)
Output the element.
Definition: linearised_axisymmetric_fluid_interface_elements.h:379
void output_perturbation_to_interface(std::ostream &outfile, const unsigned &nplot)
Output the perturbation to the interface position.
Definition: linearised_axisymmetric_fluid_interface_elements.cc:129
void hijack_kinematic_conditions(const Vector< unsigned > &bulk_node_number)
Definition: linearised_axisymmetric_fluid_interface_elements.h:275
void output(FILE *file_pt)
Overload the C-style output function.
Definition: linearised_axisymmetric_fluid_interface_elements.h:383
void output(FILE *file_pt, const unsigned &n_plot)
C-style Output function: x,y,[z],u,v,[w],p in tecplot format.
Definition: linearised_axisymmetric_fluid_interface_elements.h:386
double dH_dt(const unsigned &n, const unsigned &i) const
Definition: linearised_axisymmetric_fluid_interface_elements.h:288
void fill_in_generic_residual_contribution_interface(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: linearised_axisymmetric_fluid_interface_elements.cc:216
void output_interface_position(std::ostream &outfile, const unsigned &nplot)
Output just the interface position (base + perturbation)
Definition: linearised_axisymmetric_fluid_interface_elements.cc:171
int kinematic_local_eqn(const unsigned &n, const unsigned &i)
Definition: linearised_axisymmetric_fluid_interface_elements.h:267
PerturbedSpineLinearisedAxisymmetricFluidInterfaceElement(FiniteElement *const &bulk_element_pt, const int &face_index)
Definition: linearised_axisymmetric_fluid_interface_elements.h:322
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Return the jacobian.
Definition: linearised_axisymmetric_fluid_interface_elements.h:352
double interpolated_H(const Vector< double > &s, const unsigned &i) const
Definition: linearised_axisymmetric_fluid_interface_elements.h:400
Class for nodes that ‘live’ on perturbed spines.
Definition: perturbed_spines.h:276
PerturbedSpine *& perturbed_spine_pt()
Access function to perturbed spine.
Definition: perturbed_spines.h:314
double & height(const unsigned &i)
Access function to i-th component of spine "height".
Definition: perturbed_spines.h:101
Definition: shape.h:76
Definition: timesteppers.h:231
unsigned ntstorage() const
Definition: timesteppers.h:601
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
Definition: timesteppers.h:594
bool is_steady() const
Definition: timesteppers.h:389
RealScalar s
Definition: level1_cplx_impl.h:130
r
Definition: UniformPSDSelfTest.py:20
@ W
Definition: quadtree.h:63
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
t
Definition: plotPSD.py:36