Debian Codegraph @

C++/Include/param_elliptic.h

raw symbols SCIP
1 /*
2 * Definition of Lorene class Param_elliptic
3 *
4 */
5
6 /*
7 * Copyright (c) 2003 Philippe Grandclement
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 #ifndef __PARAM_ELLIPTIC_H_
27 #define __PARAM_ELLIPTIC_H_
28
29 /*
30 * $Id: param_elliptic.h,v 1.21 2014/10/13 08:52:36 j_novak Exp $
31 * $Log: param_elliptic.h,v $
32 * Revision 1.21 2014/10/13 08:52:36 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.20 2007/05/06 10:48:08 p_grandclement
36 * Modification of a few operators for the vorton project
37 *
38 * Revision 1.19 2007/04/24 09:04:11 p_grandclement
39 * Addition of an operator for the vortons
40 *
41 * Revision 1.18 2007/01/16 15:05:59 n_vasset
42 * New constructor (taking a Scalar in mono-domain angular grid for
43 * boundary) for function sol_elliptic_boundary
44 *
45 * Revision 1.17 2005/11/30 11:09:03 p_grandclement
46 * Changes for the Bin_ns_bh project
47 *
48 * Revision 1.16 2005/08/26 14:02:38 p_grandclement
49 * Modification of the elliptic solver that matches with an oscillatory exterior solution
50 * small correction in Poisson tau also...
51 *
52 * Revision 1.15 2005/06/09 07:56:25 f_limousin
53 * Implement a new function sol_elliptic_boundary() and
54 * Vector::poisson_boundary(...) which solve the vectorial poisson
55 * equation (method 6) with an inner boundary condition.
56 *
57 * Revision 1.14 2005/02/15 15:43:16 j_novak
58 * First version of the block inversion for the vector Poisson equation (method 6).
59 *
60 * Revision 1.13 2004/12/23 16:30:14 j_novak
61 * New files and class for the solution of the rr component of the tensor Poisson
62 * equation.
63 *
64 * Revision 1.12 2004/08/24 09:14:40 p_grandclement
65 * Addition of some new operators, like Poisson in 2d... It now requieres the
66 * GSL library to work.
67 *
68 * Also, the way a variable change is stored by a Param_elliptic is changed and
69 * no longer uses Change_var but rather 2 Scalars. The codes using that feature
70 * will requiere some modification. (It should concern only the ones about monopoles)
71 *
72 * Revision 1.11 2004/06/22 08:49:57 p_grandclement
73 * Addition of everything needed for using the logarithmic mapping
74 *
75 * Revision 1.10 2004/06/14 15:23:07 j_novak
76 * Modif. comments.
77 *
78 * Revision 1.9 2004/06/14 15:07:10 j_novak
79 * New methods for the construction of the elliptic operator appearing in
80 * the vector Poisson equation (acting on eta).
81 *
82 * Revision 1.8 2004/05/14 08:51:00 p_grandclement
83 * *** empty log message ***
84 *
85 * Revision 1.7 2004/05/10 15:28:21 j_novak
86 * First version of functions for the solution of the r-component of the
87 * vector Poisson equation.
88 *
89 * Revision 1.6 2004/03/23 14:54:45 j_novak
90 * More documentation
91 *
92 * Revision 1.5 2004/03/17 15:58:47 p_grandclement
93 * Slight modification of sol_elliptic_no_zec
94 *
95 * Revision 1.4 2004/03/05 09:18:48 p_grandclement
96 * Addition of operator sec_order_r2
97 *
98 * Revision 1.3 2004/02/11 09:47:44 p_grandclement
99 * Addition of a new elliptic solver, matching with the homogeneous solution
100 * at the outer shell and not solving in the external domain (more details
101 * coming soon ; check your local Lorene dealer...)
102 *
103 * Revision 1.2 2004/01/28 16:46:22 p_grandclement
104 * Addition of the sol_elliptic_fixe_der_zero stuff
105 *
106 * Revision 1.1 2003/12/11 14:57:00 p_grandclement
107 * I had forgotten the .h (sorry folks...)
108 *
109 * Revision 1.2 2001/12/11 06:44:41 e_gourgoulhon
110 *
111 * $Header: /cvsroot/Lorene/C++/Include/param_elliptic.h,v 1.21 2014/10/13 08:52:36 j_novak Exp $
112 *
113 */
114
115 #include "map.h"
116 #include "ope_elementary.h"
117 #include "scalar.h"
118
119 #define MAP_AFF 0
120 #define MAP_LOG 1
121
122 namespace Lorene {
123 /**
124 * This class contains the parameters needed to call the general
125 * elliptic solver.
126 *
127 * For every domain and every spherical harmonics, it contains the
128 * appropriate operator of type \c Ope_elementary and the appropriate
129 * variable given by a \c Change_var . \ingroup (ellip)
130 *
131 * This class is only defined on an affine mapping \c Map_af or
132 * a logarithmic one \c Map_log
133 *
134 **/
135 class Param_elliptic {
136
137 protected:
138 int type_map ; ///< Type of mapping either MAP_AFF or MAP_LOG
139 const Map_af* mp_af ; ///< The mapping, if affine.
140 const Map_log* mp_log ; ///< The mapping if log type.
141
142 Ope_elementary** operateurs ; ///< Array on the elementary operators.
143
144 Scalar var_F ; ///< Additive variable change function.
145 Scalar var_G ; ///< Multiplicative variable change that must be sphericaly symetric !
146
147 mutable Itbl done_F ; ///< Stores what has been computed for \c F
148 mutable Itbl done_G ; ///< Stores what has been computed for \c G
149 mutable Tbl val_F_plus ; ///< Values of F at the outer boundaries of the various domains.
150 mutable Tbl val_F_minus ; ///< Values of F at the inner boundaries of the various domains.
151 mutable Tbl val_dF_plus ; ///< Values of the derivative of F at the outer boundaries of the various domains.
152 mutable Tbl val_dF_minus ; ///< Values of the derivative of F at the inner boundaries of the various domains.
153 mutable Tbl val_G_plus ; ///< Values of G at the outer boundaries of the various domains.
154 mutable Tbl val_G_minus ; ///< Values of G at the inner boundaries of the various domains.
155 mutable Tbl val_dG_plus ; ///< Values of the derivative of G at the outer boundaries of the various domains.
156 mutable Tbl val_dG_minus ; ///< Values of the derivative of G at the inner boundaries of the various domains.
157
158 private:
159 void compute_val_F(int, int, int) const ; ///< Computes the various values of \c F
160 void compute_val_G(int) const ; ///< Computes the various values of \c G
161
162 public:
163 /**
164 * Standard constructor from a \c Scalar
165 * @param so [parameter] type
166 * of the source of the elliptic equation. The actual values are not
167 * used but \c *this will be constructed using the same number of
168 * points, domains and symetry than \c so .
169 *
170 * This constructor initializes everything to solve a Poisson
171 * equation with non variable changes from domains to another.
172 **/
173 Param_elliptic (const Scalar&) ;
174 ~Param_elliptic() ; ///< Destructor.
175
176 /// Returns the mapping.
177 const Map_radial& get_mp() const ;
178 double get_alpha (int) const ;
179 double get_beta (int) const ;
180 int get_type (int) const ;
181
182 public:
183 /**
184 * Set the operator to \f$\left(\Delta - m^2\right)\f$ in one domain
185 * (not in the nucleus).
186 *
187 * @param zone [input] : the domain.
188 * @param mas [input] : the masse \f$m\f$.
189 * @param so [input] : the source (used only to get the right basis).
190 **/
191 void set_helmholtz_minus (int zone, double mas, Scalar& so) ;
192 /**
193 * Set the operator to \f$\left(\Delta - 2 \partial_r / r\right)\f$
194 * everywhere but in the compactified domain.
195 *
196 * @param so [input] : the source (used only to get the right basis).
197 **/
198 void set_poisson_pseudo_1d (Scalar& so) ;
199 /**
200 * Set the operator to \f$\left(\Delta - 2 \partial_r / r - m^2\right)\f$ in one domain
201 *
202 * @param zone [input] : the domain.
203 * @param mas [input] : the masse \f$m\f$.
204 * @param so [input] : the source (used only to get the right basis).
205 **/
206 void set_helmholtz_minus_pseudo_1d (int zone, double mas, Scalar& so) ;
207
208 /**
209 * Set the operator to \f$\left(\Delta + m^2\right)\f$ in one
210 * domain (only in the shells).
211 *
212 * @param zone [input] : the domain.
213 * @param mas [input] : the masse \f$m\f$.
214 * @param so [input] : the source (used only to get the right basis).
215 **/
216 void set_helmholtz_plus (int zone, double mas, Scalar& so) ;
217
218 /**
219 * Set everything to do a 2d-Poisson, with or without l=0 (not put by default...)
220 **/
221 void set_poisson_2d (const Scalar &, bool indic = false) ;
222
223 /**
224 * Set the 2D Helmholtz operator (with minus sign)
225 *
226 * @param zone [input] : the domain.
227 * @param mas [input] : the masse parameter.
228 **/
229 void set_helmholtz_minus_2d (int zone, double mas, const Scalar&) ;
230
231 /**
232 * Set the operator to \f$a r^2 \partial^2/\partial r^2 +
233 * b r \partial /\partial r + c\f$ in one domain (only in the shells).
234 *
235 * @param zone [input] : the domain.
236 * @param a [input] : the parameter \f$a\f$.
237 * @param b [input] : the parameter \f$b\f$.
238 * @param c [input] : the parameter \f$c\f$.
239 **/
240 void set_sec_order_r2 (int zone, double a, double b, double c) ;
241
242 /**
243 * Set the operator to \f$a \partial^2/\partial r^2 +
244 * b \partial /\partial r + c\f$ in one domain (only in the shells).
245 *
246 * @param zone [input] : the domain.
247 * @param a [input] : the parameter \f$a\f$.
248 * @param b [input] : the parameter \f$b\f$.
249 * @param c [input] : the parameter \f$c\f$.
250 **/
251 void set_sec_order (int zone, double a, double b, double c) ;
252
253 /**
254 * Set the operator to \f$\Delta - 2\partial /\partial r\f$ in one domain (not implemented in the nucleus).
255 *
256 * @param zone [input] : the domain.
257 * @param so [input] : the source (used only to get the right basis).
258 **/
259 void set_ope_vorton (int zone, Scalar& so) ;
260 /**
261 * Sets the operator to \f$\Delta + \frac{2}{r} \frac{\partial}{\partial r}
262 * + \frac{2 - l(l+1)}{r^2} \f$ in all domains, for \f$ l \not= 0 \f$;
263 * and to \f$\frac{\partial^2}{\partial r^2} + \frac{2}{r}
264 * \frac{\partial}{\partial r} - \frac{2}{r^2} \f$ in all domains otherwise.
265 *
266 * @param zone [input] : the domain.
267 * @param only_l_zero [input] : the operator in built only for l=0
268 **/
269 void set_poisson_vect_r(int zone, bool only_l_zero = false) ;
270
271 /**
272 * Sets the operator to be a regular elliptic operator to solve for the
273 * \f$\eta \f$ component of the vector Poisson equation. The operator is
274 * \f$\frac{\partial^2}{\partial r^2} +
275 * \frac{2}{r} \frac{\partial}{\partial r} - \frac{l(l-1)}{r^2} \f$
276 * (Poisson with the decrease of \e l by one unit)
277 * in all domains but the CED, for \f$ l \not= 0 \f$; it is not defined
278 * for \e l = 0. In the CED, the operator is also the Laplace one, but
279 * with \e l increased by one unit: \f$\frac{\partial^2}{\partial r^2} +
280 * \frac{2}{r} \frac{\partial}{\partial r} - \frac{(l+1)(l+2)}{r^2} \f$.
281 * This is intended to solve the equation for \f$ \eta \f$ arising in
282 * the decomposition of the vector Poisson equation.
283 *
284 * @param zone [input] : the domain.
285 **/
286 void set_poisson_vect_eta(int zone) ;
287
288 /**
289 * Sets the operator to \f$\Delta + \frac{4}{r} \frac{\partial}{\partial r}
290 * + \frac{6 - l(l+1)}{r^2} \f$ in all domains, for \f$l \geq 2\f$ only.
291 *
292 * @param zone [input] : the domain.
293 **/
294 void set_poisson_tens_rr(int zone) ;
295
296 /**
297 * Increases the quantum number \e l in the domain \c zone .
298 **/
299 void inc_l_quant (int zone) ;
300
301 /**
302 * Changes the variable function F
303 **/
304 void set_variable_F (const Scalar&) ;
305
306 /**
307 * Changes the variable function G
308 **/
309 void set_variable_G (const Scalar&) ;
310
311 /**
312 * Returns the value of F, for a given angular point, at the outer boundary of
313 * the domain \c zone ;
314 **/
315 double F_plus (int zone, int k, int j) const ;
316
317 /**
318 * Returns the value of F, for a given angular point, at the inner boundary of
319 * the domain \c zone ;
320 **/
321 double F_minus (int zone, int k, int j) const ;
322
323 /**
324 * Returns the value of the radial derivative of F,
325 * for a given angular point, at the outer boundary of
326 * the domain \c zone ;
327 **/
328 double dF_plus (int zone, int k, int j) const ;
329
330 /**
331 * Returns the value of the radial derivative of F,
332 * for a given angular point, at the inner boundary of
333 * the domain \c zone ;
334 **/
335 double dF_minus (int zone, int k, int j) const ;
336
337 /**
338 * Returns the value of G, for a given angular point, at the outer boundary of
339 * the domain \c zone ;
340 **/
341 double G_plus (int zone) const ;
342
343 /**
344 * Returns the value of G, for a given angular point, at the inner boundary of
345 * the domain \c zone ;
346 **/
347 double G_minus (int zone) const ;
348
349 /**
350 * Returns the value of the radial derivative of G,
351 * for a given angular point, at the outer boundary of
352 * the domain \c zone ;
353 **/
354 double dG_plus (int zone) const ;
355
356 /**
357 * Returns the value of the radial derivative of G,
358 * for a given angular point, at the inner boundary of
359 * the domain \c zone ;
360 **/
361 double dG_minus (int zone) const ;
362
363 // A lot of friend functions... Possiblement pas toutes utiles...
364 friend Mtbl_cf elliptic_solver (const Param_elliptic&, const Mtbl_cf&) ;
365 friend Mtbl_cf elliptic_solver_boundary (const Param_elliptic&, const Mtbl_cf&, const Mtbl_cf& bound, double fact_dir, double fact_neu ) ;
366 friend Mtbl_cf elliptic_solver_no_zec
367 (const Param_elliptic&, const Mtbl_cf&, double) ;
368 friend Mtbl_cf elliptic_solver_only_zec
369 (const Param_elliptic&, const Mtbl_cf&, double) ;
370 friend Mtbl_cf elliptic_solver_sin_zec
371 (const Param_elliptic&, const Mtbl_cf&, double*, double*) ;
372 friend Mtbl_cf elliptic_solver_fixe_der_zero
373 (double, const Param_elliptic&, const Mtbl_cf&) ;
374
375 friend void Map_af::sol_elliptic(Param_elliptic&, const Scalar&, Scalar&) const ;
376 friend void Map_af::sol_elliptic_boundary(Param_elliptic&, const Scalar&, Scalar&, const Mtbl_cf& ,
377 double , double ) const ;
378 friend void Map_af::sol_elliptic_boundary(Param_elliptic&, const Scalar&, Scalar&, const Scalar& ,
379 double , double ) const ;
380
381
382 friend void Map_af::sol_elliptic_no_zec(Param_elliptic&, const Scalar&, Scalar&, double) const ;
383 friend void Map_af::sol_elliptic_only_zec(Param_elliptic&, const Scalar&, Scalar&, double) const ;
384 friend void Map_af::sol_elliptic_sin_zec(Param_elliptic&, const Scalar&, Scalar&, double*, double*) const ;
385 friend void Map_af::sol_elliptic_fixe_der_zero(double, Param_elliptic&, const Scalar&, Scalar&) const ;
386
387 friend void Map_af::sol_elliptic_2d(Param_elliptic&, const Scalar&, Scalar&) const ;
388 friend void Map_af::sol_elliptic_pseudo_1d(Param_elliptic&, const Scalar&, Scalar&) const ;
389
390 friend void Map_log::sol_elliptic(Param_elliptic&, const Scalar&, Scalar&) const ;
391 friend void Map_log::sol_elliptic_boundary(Param_elliptic&, const Scalar&, Scalar&, const Mtbl_cf&,
392 double, double) const ;
393
394 friend void Map_log::sol_elliptic_boundary(Param_elliptic&, const Scalar&, Scalar&, const Scalar&,
395 double, double) const ;
396
397
398 friend void Map_log::sol_elliptic_no_zec(Param_elliptic&, const Scalar&, Scalar&, double) const ;
399 } ;
400
401 }
402 #endif