linearised_navier_stokes_eigenvalue_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// Version 1.0; svn revision $LastChangedRevision: 1097 $
7 //LIC//
8 //LIC// $LastChangedDate: 2015-12-17 11:53:17 +0000 (Thu, 17 Dec 2015) $
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 // Header file for elements that allow the imposition of a "constant volume"
31 // constraint in free surface problems.
32 
33 //Include guards, to prevent multiple includes
34 #ifndef LINEARISED_NAVIER_STOKES_EIGENVALUE_ELEMENTS_HEADER
35 #define LINEARISED_NAVIER_STOKES_EIGENVALUE_ELEMENTS_HEADER
36 
37 
38 // Config header generated by autoconfig
39 #ifdef HAVE_CONFIG_H
40  #include <oomph-lib-config.h>
41 #endif
42 
43 //OOMPH-LIB headers
44 #include "../generic/elements.h"
45 
46 
47 namespace oomph
48 {
49 
50 //==========================================================================
51 /// A class that is used to implement the constraint that the eigenfunction
52 /// has a particular normalisation. This element stores the two components
53 /// of the eigenvalue.
54 //=========================================================================
56  {
57  private:
58 
59  /// Pointer to the desired normalisation
60  std::complex<double> *Normalisation_pt;
61 
62  ///Storage for the initial index of the eigenvalue
64 
65  ///Storage for the offset index of the eigenvalue
67 
68 
69  /// \short The local eqn number for the traded pressure
70  inline int eigenvalue_local_eqn(const unsigned &i)
71  {
72  return this->internal_local_eqn(
73  External_or_internal_data_index_of_eigenvalue,
74  Index_of_eigenvalue+i);
75  }
76 
77  /// \short Fill in the residuals for the volume constraint
79  Vector<double> &residuals);
80 
81  public:
82 
83  /// \short Constructor: Pass pointer to target volume. "Pressure" value that
84  /// "traded" for the volume contraint is created internally (as a Data
85  /// item with a single pressure value)
87  std::complex<double>* const &normalisation_pt);
88 
89  /// \short Constructor: Pass pointer to target volume, pointer to Data
90  /// item whose value specified by index_of_traded_pressure represents
91  /// the "Pressure" value that "traded" for the volume contraint.
92  /// The Data is stored as external Data for this element.
93  /*LinearisedNavierStokesEigenfunctionNormalisationElement(double* prescribed_volume_pt,
94  Data* p_traded_data_pt,
95  const unsigned& index_of_traded_pressure);*/
96 
97  /// \short Empty destructor
99 
100  /// Access to Data that contains the traded pressure
102  {
103  return internal_data_pt(
104  External_or_internal_data_index_of_eigenvalue);
105  }
106 
107  /// Return the traded pressure value
108  inline double eigenvalue(const unsigned &i)
109  {return eigenvalue_data_pt()->value(Index_of_eigenvalue+i);}
110 
111  /// Return the index of Data object at which the traded pressure is stored
112  inline unsigned index_of_eigenvalue() {return Index_of_eigenvalue;}
113 
114 
115  /// \short Fill in the residuals for the volume constraint
117  {
119  residuals);
120  }
121 
122  /// \short Fill in the residuals and jacobian for the volume constraint
124  DenseMatrix<double> &jacobian)
125  {
126  //One contribution to jacobian; see comment in that function
128  residuals);
129 
130  const int local_eqn = this->eigenvalue_local_eqn(2);
131  if(local_eqn >= 0)
132  {
133  const int local_unknown = this->eigenvalue_local_eqn(0);
134  jacobian(local_eqn,local_unknown) += 1.0;
135  }
136  }
137 
138  /// \short Fill in the residuals, jacobian and mass matrix for the volume
139  /// constraint.
141  Vector<double> &residuals,
142  DenseMatrix<double> &jacobian,
143  DenseMatrix<double> &mass_matrix)
144  {
145  //No contribution to jacobian or mass matrix; see comment in that function
147  residuals);
148  }
149 
150 };
151 
152 }
153 #endif
154 
155 
156 
157 
158 
159 
A Generalised Element class.
Definition: elements.h:76
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
Definition: nodes.h:291
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
Fill in the residuals, jacobian and mass matrix for the volume constraint.
Data * eigenvalue_data_pt()
Access to Data that contains the traded pressure.
~LinearisedNavierStokesEigenfunctionNormalisationElement()
Constructor: Pass pointer to target volume, pointer to Data item whose value specified by index_of_tr...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Fill in the residuals for the volume constraint.
cstr elem_len * i
Definition: cfortran.h:607
int eigenvalue_local_eqn(const unsigned &i)
The local eqn number for the traded pressure.
unsigned Index_of_eigenvalue
Storage for the offset index of the eigenvalue.
unsigned index_of_eigenvalue()
Return the index of Data object at which the traded pressure is stored.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:623
A class that represents a collection of data; each Data object may contain many different individual ...
Definition: nodes.h:89
std::complex< double > * Normalisation_pt
Pointer to the desired normalisation.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in the residuals and jacobian for the volume constraint.
void fill_in_generic_contribution_to_residuals_normalisation(Vector< double > &residuals)
Fill in the residuals for the volume constraint.
LinearisedNavierStokesEigenfunctionNormalisationElement(std::complex< double > *const &normalisation_pt)
Constructor: Pass pointer to target volume. "Pressure" value that "traded" for the volume contraint i...
unsigned External_or_internal_data_index_of_eigenvalue
Storage for the initial index of the eigenvalue.
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Return the local equation number corresponding to the j-th value stored at the i-th internal data...
Definition: elements.h:268