WaveBEM: Unsteady Nonlinear Potential Flow Solver for Ship-Wave Interaction.
bem_fma.h
Go to the documentation of this file.
1 //---------------------------- step-34.cc ---------------------------
2 // $Id: step-34.cc 18734 2009-04-25 13:36:48Z heltai $
3 // Version: $Name$
4 //
5 // Copyright (C) 2009 by the deal.II authors
6 //
7 // This file is subject to QPL and may not be distributed
8 // without copyright and license information. Please refer
9 // to the file deal.II/doc/license.html for the text and
10 // further information on this license.
11 //
12 // Authors: Luca Heltai, Cataldo Manigrasso
13 //
14 //---------------------------- step-34.cc ---------------------------
15 
16 // This class contains all the methods
17 // of the Fast Multipole Algorithm
18 // applied to the Boundary Element
19 // Method
20 
21 
22 
23 
24 #ifndef bem_fma_h
25 #define bem_fma_h
26 
27 #include "../include/octree_block.h"
28 #include "../include/local_expansion.h"
29 #include "../include/multipole_expansion.h"
30 #include "../include/ass_leg_function.h"
31 #include "../include/computational_domain.h"
32 
33 
34 #include <cmath>
35 #include <iostream>
36 #include <fstream>
37 #include <string>
38 #include <set>
39 #include <map>
40 
41 
42 using namespace dealii;
43 
44 template <int dim>
45 class BEMFMA
46 {
47 public:
48  // Just renaming the cell iterator type
49 
50  typedef typename DoFHandler<dim-1,dim>::active_cell_iterator cell_it;
51 
52  // Contructor: needs a reference to a
53  // the ComputationalDomain class,
54  // containnig geometry of the problem,
55  // quadrature methods and octree
56  // partitioning methods
57 
59 
60  // Parameters declaration
61 
62  void declare_parameters(ParameterHandler &prm);
63 
64  // Parametersparsing from input file
65 
66  void parse_parameters(ParameterHandler &prm);
67 
68  // Method computing the parts of the
69  // BEM system matrices in which the
70  // integrals have to be performed
71  // directly
72 
73  void direct_integrals();
74 
75  // Method computing the multipole
76  // expansion containing the integrals
77  // values for each bottom level block.
78  // It is called once for each
79  // GMRES solved.
80 
81  void multipole_integrals();
82 
83  // Ascending phase of the FMA method.
84  // Multipole expansions are genarated
85  // at the bottom level blocks, and then
86  // translated to their parent blocks up
87  // to the highest level. It is
88  // called once per GMRES iteration.
89 
90  void generate_multipole_expansions(const Vector<double> &phi_values, const Vector<double> &dphi_dn_values) const;
91 
92  // Descending phase of the FMA method. Local
93  // Expansions are obtained for each block
94  // starting from the top level and down
95  // to the bottom ones, where they are used
96  // to approximete the values of the
97  // integrals, i.e. the BEM matrix-vector
98  // product values
99 
100  void multipole_matr_vect_products(const Vector<double> &phi_values, const Vector<double> &dphi_dn_values,
101  Vector<double> &matrVectProdN, Vector<double> &matrVectProdD) const;
102 
103  // Method for the assembling of the
104  // sparse preconitioning matrix for FMA
105 
106  SparseDirectUMFPACK &FMA_preconditioner(const Vector<double> &alpha);
107 
108 private:
109 
110  // Reference to the ComputationalDomain
111  // class
112 
114 
115  // Truncation order for the multipole
116  // and local expansion series: it is
117  // read from the parameters input file.
118 
119  unsigned int trunc_order;
120 
121  // Sparsity pattern for the
122  // preconditioning matrix
123 
125 
126  // Sparse Neumann matrix containing
127  // only direct integrals contributions
128 
130 
131  // Sparse Dirichlet matrix containing
132  // only direct integrals contributions
133 
134 
136 
137  // Sparse preconditioning matrix
138 
140 
141  // Structures where the Dirichlet
142  // matrix multipole
143  // integrals are stored: for each cell
144  // there are as many multipole
145  // expansions as the lowest level
146  // blocks in which element's quad
147  // points lie.
148 
149  mutable std::map <unsigned int, std::map <cell_it, std::vector <MultipoleExpansion > > > elemMultipoleExpansionsKer1;
150 
151  // Structures where the Neumann
152  // matrix multipole
153  // integrals are stored: for each cell
154  // there are as many multipole
155  // expansions as the lowest level
156  // blocks in which element's quad
157  // points lie.
158 
159 
160  mutable std::map <unsigned int, std::map <cell_it, std::vector <MultipoleExpansion > > > elemMultipoleExpansionsKer2;
161 
162  // Vector storing the Dirichlet
163  // integrals multipole expansions
164  // for each block
165 
166  mutable std::vector <MultipoleExpansion > blockMultipoleExpansionsKer1;
167 
168  // Vector storing the Neumann
169  // integrals multipole expansions
170  // for each block
171 
172  mutable std::vector <MultipoleExpansion > blockMultipoleExpansionsKer2;
173 
174  // Vector storing the Dirichlet
175  // integrals local expansions
176  // for each block
177 
178  mutable std::vector <LocalExpansion > blockLocalExpansionsKer1;
179 
180  // Vector storing the Neumann
181  // integrals local expansions
182  // for each block
183 
184  mutable std::vector <LocalExpansion > blockLocalExpansionsKer2;
185 
186  // Associated Legendre functions class
187 
189 
190 
192 
193 
194 };
195 
196 #endif
std::vector< LocalExpansion > blockLocalExpansionsKer2
Definition: bem_fma.h:184
std::vector< MultipoleExpansion > blockMultipoleExpansionsKer1
Definition: bem_fma.h:166
ComputationalDomain< dim > & comp_dom
Definition: bem_fma.h:113
std::map< unsigned int, std::map< cell_it, std::vector< MultipoleExpansion > > > elemMultipoleExpansionsKer2
Definition: bem_fma.h:160
std::vector< LocalExpansion > blockLocalExpansionsKer1
Definition: bem_fma.h:178
SparseMatrix< double > prec_neumann_matrix
Definition: bem_fma.h:129
SparsityPattern prec_sparsity_pattern
Definition: bem_fma.h:124
SparseMatrix< double > preconditioner
Definition: bem_fma.h:139
DoFHandler< dim-1, dim >::active_cell_iterator cell_it
Definition: bem_fma.h:50
AssLegFunction assLegFunction
Definition: bem_fma.h:188
SparseDirectUMFPACK inv
Definition: bem_fma.h:191
SparseMatrix< double > prec_dirichlet_matrix
Definition: bem_fma.h:135
std::vector< MultipoleExpansion > blockMultipoleExpansionsKer2
Definition: bem_fma.h:172
unsigned int trunc_order
Definition: bem_fma.h:119
std::map< unsigned int, std::map< cell_it, std::vector< MultipoleExpansion > > > elemMultipoleExpansionsKer1
Definition: bem_fma.h:149
Definition: bem_fma.h:45