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// Copyright (C) 2006-2023 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 elements that allow the imposition of a "constant volume"
27 // constraint in free surface problems.
28 
29 // Include guards, to prevent multiple includes
30 #ifndef LINEARISED_NAVIER_STOKES_EIGENVALUE_ELEMENTS_HEADER
31 #define LINEARISED_NAVIER_STOKES_EIGENVALUE_ELEMENTS_HEADER
32 
33 
34 // Config header generated by autoconfig
35 #ifdef HAVE_CONFIG_H
36 #include <oomph-lib-config.h>
37 #endif
38 
39 // OOMPH-LIB headers
40 #include "../generic/elements.h"
41 
42 
43 namespace oomph
44 {
45  //==========================================================================
46  /// A class that is used to implement the constraint that the eigenfunction
47  /// has a particular normalisation. This element stores the two components
48  /// of the eigenvalue.
49  //=========================================================================
51  : public GeneralisedElement
52  {
53  private:
54  /// Pointer to the desired normalisation
55  std::complex<double>* Normalisation_pt;
56 
57  /// Storage for the initial index of the eigenvalue
59 
60  /// Storage for the offset index of the eigenvalue
62 
63 
64  /// The local eqn number for the traded pressure
65  inline int eigenvalue_local_eqn(const unsigned& i)
66  {
67  return this->internal_local_eqn(
68  External_or_internal_data_index_of_eigenvalue, Index_of_eigenvalue + i);
69  }
70 
71  /// Fill in the residuals for the volume constraint
73  Vector<double>& residuals);
74 
75  public:
76  /// Constructor: Pass pointer to target volume. "Pressure" value that
77  /// "traded" for the volume contraint is created internally (as a Data
78  /// item with a single pressure value)
80  std::complex<double>* const& normalisation_pt);
81 
82  /// Constructor: Pass pointer to target volume, pointer to Data
83  /// item whose value specified by index_of_traded_pressure represents
84  /// the "Pressure" value that "traded" for the volume contraint.
85  /// The Data is stored as external Data for this element.
86  /*LinearisedNavierStokesEigenfunctionNormalisationElement(double*
87  prescribed_volume_pt, Data* p_traded_data_pt, const unsigned&
88  index_of_traded_pressure);*/
89 
90  /// Empty destructor
92 
93  /// Access to Data that contains the traded pressure
95  {
97  }
98 
99  /// Return the traded pressure value
100  inline double eigenvalue(const unsigned& i)
101  {
103  }
104 
105  /// Return the index of Data object at which the traded pressure is stored
106  inline unsigned index_of_eigenvalue()
107  {
108  return Index_of_eigenvalue;
109  }
110 
111 
112  /// Fill in the residuals for the volume constraint
114  {
116  }
117 
118  /// Fill in the residuals and jacobian for the volume constraint
120  DenseMatrix<double>& jacobian)
121  {
122  // One contribution to jacobian; see comment in that function
124 
125  const int local_eqn = this->eigenvalue_local_eqn(2);
126  if (local_eqn >= 0)
127  {
128  const int local_unknown = this->eigenvalue_local_eqn(0);
129  jacobian(local_eqn, local_unknown) += 1.0;
130  }
131  }
132 
133  /// Fill in the residuals, jacobian and mass matrix for the volume
134  /// constraint.
136  Vector<double>& residuals,
137  DenseMatrix<double>& jacobian,
138  DenseMatrix<double>& mass_matrix)
139  {
140  // No contribution to jacobian or mass matrix; see comment in that
141  // function
143  }
144  };
145 
146 } // namespace oomph
147 #endif
cstr elem_len * i
Definition: cfortran.h:603
A class that represents a collection of data; each Data object may contain many different individual ...
Definition: nodes.h:86
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:293
A Generalised Element class.
Definition: elements.h:73
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:622
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:267
A class that is used to implement the constraint that the eigenfunction has a particular normalisatio...
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.
LinearisedNavierStokesEigenfunctionNormalisationElement(std::complex< double > *const &normalisation_pt)
Constructor: Pass pointer to target volume. "Pressure" value that "traded" for the volume contraint i...
Data * eigenvalue_data_pt()
Access to Data that contains the traded pressure.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Fill in the residuals and jacobian for the volume constraint.
int eigenvalue_local_eqn(const unsigned &i)
The local eqn number for the traded pressure.
~LinearisedNavierStokesEigenfunctionNormalisationElement()
Constructor: Pass pointer to target volume, pointer to Data item whose value specified by index_of_tr...
unsigned External_or_internal_data_index_of_eigenvalue
Storage for the initial index of the eigenvalue.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Fill in the residuals for the volume constraint.
unsigned index_of_eigenvalue()
Return the index of Data object at which the traded pressure is stored.
std::complex< double > * Normalisation_pt
Pointer to the desired normalisation.
void fill_in_generic_contribution_to_residuals_normalisation(Vector< double > &residuals)
Fill in the residuals for the volume constraint.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...