| 1 | /* |
| 2 | * Definition of Lorene classes Map |
| 3 | * Map_radial |
| 4 | * Map_af |
| 5 | * Map_et |
| 6 | * Map_log |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * Copyright (c) 1999-2000 Jean-Alain Marck |
| 12 | * Copyright (c) 1999-2003 Eric Gourgoulhon |
| 13 | * Copyright (c) 1999-2001 Philippe Grandclement |
| 14 | * Copyright (c) 2000-2001 Jerome Novak |
| 15 | * Copyright (c) 2000-2001 Keisuke Taniguchi |
| 16 | * |
| 17 | * This file is part of LORENE. |
| 18 | * |
| 19 | * LORENE is free software; you can redistribute it and/or modify |
| 20 | * it under the terms of the GNU General Public License as published by |
| 21 | * the Free Software Foundation; either version 2 of the License, or |
| 22 | * (at your option) any later version. |
| 23 | * |
| 24 | * LORENE is distributed in the hope that it will be useful, |
| 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 27 | * GNU General Public License for more details. |
| 28 | * |
| 29 | * You should have received a copy of the GNU General Public License |
| 30 | * along with LORENE; if not, write to the Free Software |
| 31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | |
| 36 | #ifndef __MAP_H_ |
| 37 | #define __MAP_H_ |
| 38 | |
| 39 | /* |
| 40 | * $Id: map.h,v 1.59 2014/10/13 08:52:35 j_novak Exp $ |
| 41 | * $Log: map.h,v $ |
| 42 | * Revision 1.59 2014/10/13 08:52:35 j_novak |
| 43 | * Lorene classes and functions now belong to the namespace Lorene. |
| 44 | * |
| 45 | * Revision 1.58 2014/10/06 15:09:40 j_novak |
| 46 | * Modified #include directives to use c++ syntax. |
| 47 | * |
| 48 | * Revision 1.57 2014/01/14 13:24:02 b_peres |
| 49 | * *** empty log message *** |
| 50 | * |
| 51 | * Revision 1.56 2012/01/24 14:58:54 j_novak |
| 52 | * Removed functions XXX_fait_xi() |
| 53 | * |
| 54 | * Revision 1.55 2012/01/17 15:34:20 j_penner |
| 55 | * *** empty log message *** |
| 56 | * |
| 57 | * Revision 1.54 2012/01/17 10:20:07 j_penner |
| 58 | * added a member cxi that allows for direct access to the computational coordinates in each domain |
| 59 | * |
| 60 | * Revision 1.53 2008/09/29 13:23:51 j_novak |
| 61 | * Implementation of the angular mapping associated with an affine |
| 62 | * mapping. Things must be improved to take into account the domain index. |
| 63 | * |
| 64 | * Revision 1.52 2007/10/16 21:52:10 e_gourgoulhon |
| 65 | * Added method poisson_compact for multi-domains. |
| 66 | * |
| 67 | * Revision 1.51 2007/05/15 12:44:18 p_grandclement |
| 68 | * Scalar version of reevaluate |
| 69 | * |
| 70 | * Revision 1.50 2007/05/06 10:48:08 p_grandclement |
| 71 | * Modification of a few operators for the vorton project |
| 72 | * |
| 73 | * Revision 1.49 2007/01/16 15:05:59 n_vasset |
| 74 | * New constructor (taking a Scalar in mono-domain angular grid for |
| 75 | * boundary) for function sol_elliptic_boundary |
| 76 | * |
| 77 | * Revision 1.48 2006/08/31 12:10:51 j_novak |
| 78 | * More comments for Map_af::avance_dalembert(). |
| 79 | * |
| 80 | * Revision 1.47 2006/05/26 09:00:09 j_novak |
| 81 | * New members for multiplication or division by cos(theta). |
| 82 | * |
| 83 | * Revision 1.46 2006/04/25 07:21:54 p_grandclement |
| 84 | * Various changes for the NS_BH project |
| 85 | * |
| 86 | * Revision 1.45 2005/11/30 11:09:03 p_grandclement |
| 87 | * Changes for the Bin_ns_bh project |
| 88 | * |
| 89 | * Revision 1.44 2005/11/24 09:25:06 j_novak |
| 90 | * Added the Scalar version for the Laplacian |
| 91 | * |
| 92 | * Revision 1.43 2005/09/15 15:51:25 j_novak |
| 93 | * The "rotation" (change of triad) methods take now Scalars as default |
| 94 | * arguments. |
| 95 | * |
| 96 | * Revision 1.42 2005/08/26 14:02:38 p_grandclement |
| 97 | * Modification of the elliptic solver that matches with an oscillatory exterior solution |
| 98 | * small correction in Poisson tau also... |
| 99 | * |
| 100 | * Revision 1.41 2005/08/25 12:14:07 p_grandclement |
| 101 | * Addition of a new method to solve the scalar Poisson equation, based on a multi-domain Tau-method |
| 102 | * |
| 103 | * Revision 1.40 2005/06/09 07:56:24 f_limousin |
| 104 | * Implement a new function sol_elliptic_boundary() and |
| 105 | * Vector::poisson_boundary(...) which solve the vectorial poisson |
| 106 | * equation (method 6) with an inner boundary condition. |
| 107 | * |
| 108 | * Revision 1.39 2005/04/04 21:30:41 e_gourgoulhon |
| 109 | * Added argument lambda to method poisson_angu |
| 110 | * to treat the generalized angular Poisson equation: |
| 111 | * Lap_ang u + lambda u = source. |
| 112 | * |
| 113 | * Revision 1.38 2004/12/29 16:37:22 k_taniguchi |
| 114 | * Addition of some functions with the multipole falloff condition. |
| 115 | * |
| 116 | * Revision 1.37 2004/12/02 09:33:04 p_grandclement |
| 117 | * *** empty log message *** |
| 118 | * |
| 119 | * Revision 1.36 2004/11/30 20:42:05 k_taniguchi |
| 120 | * Addition of some functions with the falloff condition and a method |
| 121 | * to resize the external shell. |
| 122 | * |
| 123 | * Revision 1.35 2004/11/23 12:39:12 f_limousin |
| 124 | * Intoduce function poisson_dir_neu(...) to solve a scalar poisson |
| 125 | * equation with a mixed boundary condition (Dirichlet + Neumann). |
| 126 | * |
| 127 | * Revision 1.34 2004/10/11 15:08:59 j_novak |
| 128 | * The radial manipulation functions take Scalar as arguments, instead of Cmp. |
| 129 | * Added a conversion operator from Scalar to Cmp. |
| 130 | * The Cmp radial manipulation function make conversion to Scalar, call to the |
| 131 | * Map_radial version with a Scalar argument and back. |
| 132 | * |
| 133 | * Revision 1.33 2004/10/08 13:34:35 j_novak |
| 134 | * Scalar::div_r() does not need to pass through Cmp version anymore. |
| 135 | * |
| 136 | * Revision 1.32 2004/08/24 09:14:40 p_grandclement |
| 137 | * Addition of some new operators, like Poisson in 2d... It now requieres the |
| 138 | * GSL library to work. |
| 139 | * |
| 140 | * Also, the way a variable change is stored by a Param_elliptic is changed and |
| 141 | * no longer uses Change_var but rather 2 Scalars. The codes using that feature |
| 142 | * will requiere some modification. (It should concern only the ones about monopoles) |
| 143 | * |
| 144 | * Revision 1.31 2004/07/27 08:24:26 j_novak |
| 145 | * Modif. comments |
| 146 | * |
| 147 | * Revision 1.30 2004/07/26 16:02:21 j_novak |
| 148 | * Added a flag to specify whether the primitive should be zero either at r=0 |
| 149 | * or at r going to infinity. |
| 150 | * |
| 151 | * Revision 1.29 2004/06/22 08:49:57 p_grandclement |
| 152 | * Addition of everything needed for using the logarithmic mapping |
| 153 | * |
| 154 | * Revision 1.28 2004/06/14 15:23:53 e_gourgoulhon |
| 155 | * Added virtual function primr for computation of radial primitives. |
| 156 | * |
| 157 | * Revision 1.27 2004/03/31 11:22:23 f_limousin |
| 158 | * Methods Map_et::poisson_interne and Map_af::poisson_interne have been |
| 159 | * implemented to solve the continuity equation for strange stars. |
| 160 | * |
| 161 | * Revision 1.26 2004/03/22 13:12:41 j_novak |
| 162 | * Modification of comments to use doxygen instead of doc++ |
| 163 | * |
| 164 | * Revision 1.24 2004/03/01 09:57:02 j_novak |
| 165 | * the wave equation is solved with Scalars. It now accepts a grid with a |
| 166 | * compactified external domain, which the solver ignores and where it copies |
| 167 | * the values of the field from one time-step to the next. |
| 168 | * |
| 169 | * Revision 1.23 2004/02/11 09:47:44 p_grandclement |
| 170 | * Addition of a new elliptic solver, matching with the homogeneous solution |
| 171 | * at the outer shell and not solving in the external domain (more details |
| 172 | * coming soon ; check your local Lorene dealer...) |
| 173 | * |
| 174 | * Revision 1.22 2004/01/29 08:50:01 p_grandclement |
| 175 | * Modification of Map::operator==(const Map&) and addition of the surface |
| 176 | * integrales using Scalar. |
| 177 | * |
| 178 | * Revision 1.21 2004/01/28 16:46:22 p_grandclement |
| 179 | * Addition of the sol_elliptic_fixe_der_zero stuff |
| 180 | * |
| 181 | * Revision 1.20 2004/01/28 10:35:52 j_novak |
| 182 | * Added new methods mult_r() for Scalars. These do not change the dzpuis flag. |
| 183 | * |
| 184 | * Revision 1.19 2004/01/27 09:33:46 j_novak |
| 185 | * New method Map_radial::div_r_zec |
| 186 | * |
| 187 | * Revision 1.18 2004/01/26 16:16:15 j_novak |
| 188 | * Methods of gradient for Scalar s. The input can have any dzpuis. |
| 189 | * |
| 190 | * Revision 1.17 2004/01/19 21:38:21 e_gourgoulhon |
| 191 | * Corrected sign error in comments of Map_radial::dxdr. |
| 192 | * |
| 193 | * Revision 1.16 2003/12/30 22:52:47 e_gourgoulhon |
| 194 | * Class Map: added methods flat_met_spher() and flat_met_cart() to get |
| 195 | * flat metric associated with the coordinates described by the mapping. |
| 196 | * |
| 197 | * Revision 1.15 2003/12/11 14:48:47 p_grandclement |
| 198 | * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT... |
| 199 | * |
| 200 | * Revision 1.14 2003/11/06 14:43:37 e_gourgoulhon |
| 201 | * Gave a name to const arguments in certain method prototypes (e.g. |
| 202 | * constructors) to correct a bug of DOC++. |
| 203 | * |
| 204 | * Revision 1.13 2003/11/04 22:54:49 e_gourgoulhon |
| 205 | * Added new virtual methods mult_cost, mult_sint and div_sint. |
| 206 | * |
| 207 | * Revision 1.12 2003/10/16 08:49:21 j_novak |
| 208 | * Added a flag to decide wether the output is in the Ylm or in the standard base. |
| 209 | * |
| 210 | * Revision 1.11 2003/10/15 21:08:22 e_gourgoulhon |
| 211 | * Added method poisson_angu. |
| 212 | * |
| 213 | * Revision 1.10 2003/10/15 16:03:35 j_novak |
| 214 | * Added the angular Laplace operator for Scalar. |
| 215 | * |
| 216 | * Revision 1.9 2003/10/15 10:27:33 e_gourgoulhon |
| 217 | * Classes Map, Map_af and Map_et: added new methods dsdt, stdsdp and div_tant. |
| 218 | * Class Map_radial: added new Coord's : drdt and stdrdp. |
| 219 | * |
| 220 | * Revision 1.8 2003/06/20 14:14:53 f_limousin |
| 221 | * Add the operator== to compare two Cmp. |
| 222 | * |
| 223 | * Revision 1.7 2003/06/20 09:27:09 j_novak |
| 224 | * Modif commentaires. |
| 225 | * |
| 226 | * Revision 1.6 2002/10/16 14:36:29 j_novak |
| 227 | * Reorganization of #include instructions of standard C++, in order to |
| 228 | * use experimental version 3 of gcc. |
| 229 | * |
| 230 | * Revision 1.5 2002/09/13 09:17:33 j_novak |
| 231 | * Modif. commentaires |
| 232 | * |
| 233 | * Revision 1.4 2002/06/17 14:05:16 j_novak |
| 234 | * friend functions are now also declared outside the class definition |
| 235 | * |
| 236 | * Revision 1.3 2002/05/07 07:06:37 e_gourgoulhon |
| 237 | * Compatibily with xlC compiler on IBM SP2: |
| 238 | * added declaration of functions map_af_fait_* and map_et_fait_* |
| 239 | * outside the classes declarations. |
| 240 | * |
| 241 | * Revision 1.2 2002/01/15 15:53:06 p_grandclement |
| 242 | * I have had a constructor fot map_et using the equation of the surface |
| 243 | * of the star. |
| 244 | * |
| 245 | * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon |
| 246 | * LORENE |
| 247 | * |
| 248 | * Revision 2.110 2001/10/29 15:31:55 novak |
| 249 | * Ajout de Map_radial::div_r |
| 250 | * |
| 251 | * Revision 2.109 2001/10/16 10:02:49 novak |
| 252 | * *** empty log message *** |
| 253 | * |
| 254 | * Revision 2.108 2001/07/19 14:01:00 novak |
| 255 | * new arguments for Map_af::dalembert |
| 256 | * |
| 257 | * Revision 2.107 2001/02/26 17:28:31 eric |
| 258 | * Ajout de la fonction virtuelle resize. |
| 259 | * |
| 260 | * Revision 2.106 2001/01/10 11:03:00 phil |
| 261 | * ajout de homothetie interne |
| 262 | * |
| 263 | * Revision 2.105 2001/01/02 10:51:55 phil |
| 264 | * ajout integrale de surface a l'infini |
| 265 | * |
| 266 | * Revision 2.104 2000/10/23 13:59:48 eric |
| 267 | * Map_et::adapt: changement des arguments (en autre, ajout de nz_search). |
| 268 | * |
| 269 | * Revision 2.103 2000/10/20 09:39:19 phil |
| 270 | * changement commentaires |
| 271 | * |
| 272 | * Revision 2.102 2000/10/19 14:33:23 novak |
| 273 | * corrige oubli pour Map_et? |
| 274 | * |
| 275 | * Revision 2.101 2000/10/19 14:11:20 novak |
| 276 | * Ajout des fonctions membres Map::dalembert et Map_af::dalembert |
| 277 | * (etat experimental) |
| 278 | * |
| 279 | * Revision 2.100 2000/10/09 13:46:39 eric |
| 280 | * Ajout de la fonction virtuelle poisson2d. |
| 281 | * |
| 282 | * Revision 2.99 2000/09/19 15:28:55 phil |
| 283 | * *** empty log message *** |
| 284 | * |
| 285 | * Revision 2.98 2000/09/19 15:24:19 phil |
| 286 | * ajout du passage de cartesienne en spheriques |
| 287 | * |
| 288 | * Revision 2.97 2000/09/19 13:05:38 phil |
| 289 | * ajout integrale_surface |
| 290 | * |
| 291 | * Revision 2.96 2000/09/11 15:54:03 eric |
| 292 | * Suppression des methodes deriv_x, deriv_y et deriv_z. |
| 293 | * Introduction des methodes comp_x_from_spherical, etc... |
| 294 | * |
| 295 | * Revision 2.95 2000/09/07 15:27:58 keisuke |
| 296 | * Add a new argument Cmp& uu in Map_af::poisson_regular and Map_et::poisson_regular. |
| 297 | * |
| 298 | * Revision 2.94 2000/09/04 15:30:56 keisuke |
| 299 | * Modify the arguments of Map_af::poisson_regular and Map_et::poisson_regular. |
| 300 | * |
| 301 | * Revision 2.93 2000/09/04 13:36:19 keisuke |
| 302 | * Modify the explanation for "uu_div" in Map_et::poisson_regular. |
| 303 | * |
| 304 | * Revision 2.92 2000/08/31 15:50:12 keisuke |
| 305 | * Modify Map_af::poisson_regular. |
| 306 | * Add Map_et::poisson_regular and Map::poisson_regular. |
| 307 | * |
| 308 | * Revision 2.91 2000/08/31 13:03:22 eric |
| 309 | * Ajout de la fonction virtuelle mult_rsint. |
| 310 | * |
| 311 | * Revision 2.90 2000/08/28 16:17:37 keisuke |
| 312 | * Add "int nzet" in the argumant of Map_af::poisson_regular. |
| 313 | * |
| 314 | * Revision 2.89 2000/08/18 11:10:12 eric |
| 315 | * Classe Map_et: ajout de l'operateur d'affectation a un autre Map_et. |
| 316 | * |
| 317 | * Revision 2.88 2000/08/11 08:50:18 keisuke |
| 318 | * Modif Map_af::poisson_regular |
| 319 | * |
| 320 | * Revision 2.87 2000/08/10 12:54:00 keisuke |
| 321 | * Ajout de Map_af::poisson_regular |
| 322 | * |
| 323 | * Revision 2.86 2000/07/20 14:21:07 eric |
| 324 | * Ajout de la fonction div_rsint. |
| 325 | * |
| 326 | * Revision 2.85 2000/05/25 13:54:41 eric |
| 327 | * Modif commentaires |
| 328 | * |
| 329 | * Revision 2.84 2000/05/22 14:38:51 phil |
| 330 | * ajout de inc_dzpuis et dec_dzpuis |
| 331 | * |
| 332 | * Revision 2.83 2000/04/27 15:18:54 phil |
| 333 | * *** empty log message *** |
| 334 | * |
| 335 | * Revision 2.82 2000/03/20 13:33:23 phil |
| 336 | * commentaires |
| 337 | * |
| 338 | * Revision 2.81 2000/03/17 17:32:48 phil |
| 339 | * *** empty log message *** |
| 340 | * |
| 341 | * Revision 2.80 2000/03/17 17:01:54 phil |
| 342 | * *** empty log message *** |
| 343 | * |
| 344 | * Revision 2.79 2000/03/17 16:58:48 phil |
| 345 | * ajout de poisson_frontiere |
| 346 | * |
| 347 | * Revision 2.78 2000/03/06 11:29:51 eric |
| 348 | * Ajout du membre reeavaluate_symy. |
| 349 | * |
| 350 | * Revision 2.77 2000/02/15 15:08:21 eric |
| 351 | * Changement du Param dans Map_et::adapt : fact_echelle est desormais |
| 352 | * passe en double_mod. |
| 353 | * |
| 354 | * Revision 2.76 2000/02/15 10:26:25 phil |
| 355 | * commentaire + |
| 356 | * suppression de poisson_vect et poisson_vect_oohara |
| 357 | * |
| 358 | * Revision 2.75 2000/02/11 13:37:43 eric |
| 359 | * Ajout de la fonction convert_absolute. |
| 360 | * |
| 361 | * Revision 2.74 2000/02/09 09:53:37 phil |
| 362 | * ajout de poisson_vect_oohara |
| 363 | * |
| 364 | * Revision 2.73 2000/01/26 13:07:02 eric |
| 365 | * Reprototypage complet des routines de derivation: |
| 366 | * le resultat est desormais suppose alloue a l'exterieur de la routine |
| 367 | * et est passe en argument (Cmp& resu), si bien que le prototypage |
| 368 | * complet devient: |
| 369 | * void DERIV(const Cmp& ci, Cmp& resu) |
| 370 | * |
| 371 | * Revision 2.72 2000/01/24 17:08:21 eric |
| 372 | * Class Map_af : suppression de la fonction convert. |
| 373 | * suppression du constructeur par convertion d'un Map_et. |
| 374 | * ajout du constructeur par conversion d'un Map. |
| 375 | * |
| 376 | * Revision 2.71 2000/01/24 16:41:43 eric |
| 377 | * Ajout de la fonction virtuelle operator=(const Map_af& ). |
| 378 | * Classe Map_af : ajout de la fonction convert(const Map& ). |
| 379 | * |
| 380 | * Revision 2.70 2000/01/21 12:48:34 phil |
| 381 | * changement prototypage de Map::poisson_vect |
| 382 | * |
| 383 | * Revision 2.69 2000/01/20 16:35:05 phil |
| 384 | * *** empty log message *** |
| 385 | * |
| 386 | * Revision 2.68 2000/01/20 15:44:42 phil |
| 387 | * *** empty log message *** |
| 388 | * |
| 389 | * Revision 2.67 2000/01/20 15:31:56 phil |
| 390 | * *** empty log message *** |
| 391 | * |
| 392 | * Revision 2.66 2000/01/20 14:18:06 phil |
| 393 | * *** empty log message *** |
| 394 | * |
| 395 | * Revision 2.65 2000/01/20 13:16:34 phil |
| 396 | * *** empty log message *** |
| 397 | * |
| 398 | * Revision 2.64 2000/01/20 12:51:24 phil |
| 399 | * *** empty log message *** |
| 400 | * |
| 401 | * Revision 2.63 2000/01/20 12:45:28 phil |
| 402 | * *** empty log message *** |
| 403 | * |
| 404 | * Revision 2.62 2000/01/20 12:40:27 phil |
| 405 | * *** empty log message *** |
| 406 | * |
| 407 | * Revision 2.61 2000/01/20 11:27:54 phil |
| 408 | * ajout de poisson_vect |
| 409 | * |
| 410 | * Revision 2.60 2000/01/13 15:31:55 eric |
| 411 | * Modif commentaires/ |
| 412 | * |
| 413 | * Revision 2.59 2000/01/12 16:02:57 eric |
| 414 | * Modif commentaires poisson_compact. |
| 415 | * |
| 416 | * Revision 2.58 2000/01/12 12:54:23 eric |
| 417 | * Ajout du Cmp null, *p_cmp_zero, et de la methode associee cmp_zero(). |
| 418 | * |
| 419 | * Revision 2.57 2000/01/10 13:27:43 eric |
| 420 | * Ajout des bases vectorielles associees aux coordonnees : |
| 421 | * membres bvect_spher et bvect_cart. |
| 422 | * |
| 423 | * Revision 2.56 2000/01/10 09:12:47 eric |
| 424 | * Reprototypage de poisson_compact : Valeur -> Cmp, Tenseur. |
| 425 | * Suppression de poisson_compact_boucle. |
| 426 | * poisson_compact est desormais implementee au niveau Map_radial. |
| 427 | * |
| 428 | * Revision 2.55 2000/01/04 15:23:11 eric |
| 429 | * Classe Map_radial : les data sont listees en premier |
| 430 | * Introduction de la fonction reevalutate. |
| 431 | * |
| 432 | * Revision 2.54 2000/01/03 13:30:32 eric |
| 433 | * Ajout de la fonction adapt. |
| 434 | * |
| 435 | * Revision 2.53 1999/12/22 17:09:52 eric |
| 436 | * Modif commentaires. |
| 437 | * |
| 438 | * Revision 2.52 1999/12/21 16:26:25 eric |
| 439 | * Ajout du constructeur par conversion Map_af::Map_af(const Map_et&). |
| 440 | * Ajout des fonctions Map_af::set_alpha et Map_af::set_beta. |
| 441 | * |
| 442 | * Revision 2.51 1999/12/21 13:01:29 eric |
| 443 | * Changement de prototype de la routine poisson : la solution est |
| 444 | * desormais passee en argument (et non plus en valeur de retour) |
| 445 | * pour permettre l'initialisation de methodes de resolution iterative. |
| 446 | * |
| 447 | * Revision 2.50 1999/12/21 10:12:09 eric |
| 448 | * Modif commentaires. |
| 449 | * |
| 450 | * Revision 2.49 1999/12/21 10:06:05 eric |
| 451 | * Ajout de l'argument Param& a poisson. |
| 452 | * |
| 453 | * Revision 2.48 1999/12/20 15:44:35 eric |
| 454 | * Modif commentaires. |
| 455 | * |
| 456 | * Revision 2.47 1999/12/20 10:47:45 eric |
| 457 | * Modif commentaires. |
| 458 | * |
| 459 | * Revision 2.46 1999/12/20 10:24:12 eric |
| 460 | * Ajout des fonctions de lecture des parametres de Map_et: |
| 461 | * get_alpha(), get_beta(), get_ff(), get_gg(). |
| 462 | * |
| 463 | * Revision 2.45 1999/12/16 14:50:08 eric |
| 464 | * Modif commentaires. |
| 465 | * |
| 466 | * Revision 2.44 1999/12/16 14:17:54 eric |
| 467 | * Introduction de l'argument const Param& par dans val_lx et val_lx_jk. |
| 468 | * (en remplacement de l'argument Tbl& param). |
| 469 | * |
| 470 | * Revision 2.43 1999/12/09 10:45:24 eric |
| 471 | * Ajout de la fonction virtuelle integrale. |
| 472 | * |
| 473 | * Revision 2.42 1999/12/07 14:50:47 eric |
| 474 | * Changement ordre des arguments val_r, val_lx |
| 475 | * val_r_kj --> val_r_jk |
| 476 | * val_lx_kj -->val_lx_jk |
| 477 | * |
| 478 | * Revision 2.41 1999/12/06 16:45:20 eric |
| 479 | * Surcharge de val_lx avec la version sans param. |
| 480 | * |
| 481 | * Revision 2.40 1999/12/06 15:33:44 eric |
| 482 | * Ajout des fonctions val_r_kj et val_lx_kj. |
| 483 | * |
| 484 | * Revision 2.39 1999/12/06 13:11:54 eric |
| 485 | * Introduction des fonctions val_r, val_lx et homothetie. |
| 486 | * |
| 487 | * Revision 2.38 1999/12/02 14:28:22 eric |
| 488 | * Reprototypage de la fonction poisson: Valeur -> Cmp. |
| 489 | * |
| 490 | * Revision 2.37 1999/11/30 14:19:33 eric |
| 491 | * Reprototypage complet des fonctions membres mult_r, mult_r_zec, |
| 492 | * dec2_dzpuis et inc2_dzpuis : Valeur --> Cmp |
| 493 | * |
| 494 | * Revision 2.36 1999/11/29 13:17:57 eric |
| 495 | * Modif commentaires. |
| 496 | * |
| 497 | * Revision 2.35 1999/11/29 12:55:42 eric |
| 498 | * Changement prototype de la fonction laplacien : Valeur --> Cmp. |
| 499 | * |
| 500 | * Revision 2.34 1999/11/25 16:27:27 eric |
| 501 | * Reorganisation complete du calcul des derivees partielles. |
| 502 | * |
| 503 | * Revision 2.33 1999/11/24 16:31:17 eric |
| 504 | * Map_et: ajout des fonctions set_ff et set_gg. |
| 505 | * |
| 506 | * Revision 2.32 1999/11/24 14:31:48 eric |
| 507 | * Map_af: les membres alpha et beta deviennent prives. |
| 508 | * Map_af: introduction des fonctions get_alpha() et get_beta(). |
| 509 | * |
| 510 | * Revision 2.31 1999/11/24 11:22:09 eric |
| 511 | * Map_et : Coords rendus publics |
| 512 | * Map_et : fonctions de constructions amies. |
| 513 | * |
| 514 | * Revision 2.30 1999/11/22 10:32:39 eric |
| 515 | * Introduction de la classe Map_et. |
| 516 | * Constructeurs de Map rendus protected. |
| 517 | * Fonction del_coord() rebaptisee reset_coord(). |
| 518 | * |
| 519 | * Revision 2.29 1999/10/27 16:44:41 phil |
| 520 | * ajout de mult_r_zec |
| 521 | * |
| 522 | * Revision 2.28 1999/10/19 14:40:37 phil |
| 523 | * ajout de inc2_dzpuis() |
| 524 | * |
| 525 | * Revision 2.27 1999/10/15 14:12:20 eric |
| 526 | * *** empty log message *** |
| 527 | * |
| 528 | * Revision 2.26 1999/10/14 14:26:06 eric |
| 529 | * Depoussierage. |
| 530 | * Documentation. |
| 531 | * |
| 532 | * Revision 2.25 1999/10/11 11:16:29 phil |
| 533 | * changement prototypage de poisson_compact_boucle |
| 534 | * |
| 535 | * Revision 2.24 1999/10/11 10:48:51 phil |
| 536 | * changement de nom pour poisson a support compact |
| 537 | * |
| 538 | * Revision 2.23 1999/10/04 09:20:58 phil |
| 539 | * changement de prototypage de void Map_af::poisson_nul |
| 540 | * |
| 541 | * Revision 2.22 1999/09/30 18:38:32 phil |
| 542 | * *** empty log message *** |
| 543 | * |
| 544 | * Revision 2.21 1999/09/30 18:33:10 phil |
| 545 | * ajout de poisson_nul et poisson_nul_boucle |
| 546 | * |
| 547 | * Revision 2.20 1999/09/30 16:45:54 phil |
| 548 | * ajout de Map_af::poisson_nul(const Valeur&, int, int) |
| 549 | * |
| 550 | * Revision 2.19 1999/09/16 13:15:40 phil |
| 551 | * ajout de Valeur mult_r (const Valeur &) |
| 552 | * |
| 553 | * Revision 2.18 1999/09/15 10:42:11 phil |
| 554 | * ajout de Valeur dec2_dzpuis(const Valeur&) |
| 555 | * |
| 556 | * Revision 2.17 1999/09/14 13:45:45 phil |
| 557 | * suppression de la divergence |
| 558 | * |
| 559 | * Revision 2.16 1999/09/13 15:09:07 phil |
| 560 | * ajout de Map_af::divergence |
| 561 | * |
| 562 | * Revision 2.15 1999/09/13 13:52:23 phil |
| 563 | * ajout des derivations partielles par rapport a x,y et z. |
| 564 | * |
| 565 | * Revision 2.14 1999/09/07 14:35:20 phil |
| 566 | * ajout de la fonction Valeur** gradient(const Valeur&) |
| 567 | * |
| 568 | * Revision 2.13 1999/04/26 16:37:43 phil |
| 569 | * *** empty log message *** |
| 570 | * |
| 571 | * Revision 2.12 1999/04/26 16:33:28 phil |
| 572 | * *** empty log message *** |
| 573 | * |
| 574 | * Revision 2.11 1999/04/26 13:53:04 phil |
| 575 | * *** empty log message *** |
| 576 | * |
| 577 | * Revision 2.10 1999/04/26 13:51:19 phil |
| 578 | * ajout de Map_af::laplacien (2versions) |
| 579 | * |
| 580 | * Revision 2.9 1999/04/14 09:04:01 phil |
| 581 | * *** empty log message *** |
| 582 | * |
| 583 | * Revision 2.8 1999/04/14 08:53:27 phil |
| 584 | * *** empty log message *** |
| 585 | * |
| 586 | * Revision 2.7 1999/04/13 17:45:25 phil |
| 587 | * *** empty log message *** |
| 588 | * |
| 589 | * Revision 2.6 1999/04/13 17:02:41 phil |
| 590 | * , |
| 591 | * |
| 592 | * Revision 2.5 1999/04/13 17:00:41 phil |
| 593 | * ajout de la resolution de poisson affine |
| 594 | * |
| 595 | * Revision 2.4 1999/03/04 13:10:53 eric |
| 596 | * Ajout des Coord representant les derivees du changement de variable |
| 597 | * dans la classe Map_radial. |
| 598 | * |
| 599 | * Revision 2.3 1999/03/01 17:00:38 eric |
| 600 | * *** empty log message *** |
| 601 | * |
| 602 | * Revision 2.2 1999/03/01 16:44:41 eric |
| 603 | * Operateurs << et >> sur les ostream. |
| 604 | * L'operateur >> est virtuel. |
| 605 | * |
| 606 | * Revision 2.1 1999/02/22 15:21:45 hyc |
| 607 | * *** empty log message *** |
| 608 | * |
| 609 | * |
| 610 | * Revision 2.0 1999/01/15 09:10:39 hyc |
| 611 | * *** empty log message *** |
| 612 | * |
| 613 | * $Header: /cvsroot/Lorene/C++/Include/map.h,v 1.59 2014/10/13 08:52:35 j_novak Exp $ |
| 614 | * |
| 615 | */ |
| 616 | |
| 617 | #include <cstdio> |
| 618 | |
| 619 | #include "coord.h" |
| 620 | #include "base_vect.h" |
| 621 | #include "valeur.h" |
| 622 | #include "tbl.h" |
| 623 | #include "itbl.h" |
| 624 | |
| 625 | namespace Lorene { |
| 626 | class Scalar ; |
| 627 | class Cmp ; |
| 628 | class Param ; |
| 629 | class Map_af ; |
| 630 | class Map_et ; |
| 631 | class Tenseur ; |
| 632 | class Param_elliptic ; |
| 633 | class Metric_flat ; |
| 634 | class Tbl ; |
| 635 | class Itbl ; |
| 636 | |
| 637 | //------------------------------------// |
| 638 | // class Map // |
| 639 | //------------------------------------// |
| 640 | |
| 641 | /** |
| 642 | * Base class for coordinate mappings. \ingroup (map) |
| 643 | * |
| 644 | * This class is the basic class for describing the mapping between the |
| 645 | * grid coordinates \f$(\xi, \theta', \phi')\f$ and the physical coordinates |
| 646 | * \f$(r, \theta, \phi)\f$ [cf. Bonazzola, Gourgoulhon & Marck, \e Phys. |
| 647 | * \e Rev. \e D \b 58, 104020 (1998)]. |
| 648 | * The class \c Map is an abstract one: it cannot be instanciated. |
| 649 | * Specific implementation of coordinate mappings will be performed by derived |
| 650 | * classes of \c Map. |
| 651 | * |
| 652 | * The class \c Map and its derived classes determine the methods for |
| 653 | * partial derivatives with respect to the physical coordinates, as well |
| 654 | * as resolution of basic partial differential equations (e.g. Poisson |
| 655 | * equations). |
| 656 | * |
| 657 | * The mapping is defined with respect to some ``absolute'' reference frame, |
| 658 | * whose Cartesian coordinates are denoted by \e (X,Y,Z). The coordinates |
| 659 | * (X, Y, Z) of center of the mapping (i.e. the point \e r =0) are given by the data |
| 660 | * members \c (ori_x,ori_y,ori_z). |
| 661 | * The Cartesian coordinate relative to the mapping (i.e. defined from |
| 662 | * \f$(r, \theta, \phi)\f$ by the usual formul\ae \f$x=r\sin\theta\cos\phi, \ldots\f$) |
| 663 | * are denoted by \e (x,y,z). The planes \e (x,y) and \e (X,Y) are supposed to |
| 664 | * coincide, so that the relative orientation of the mapping with respect to |
| 665 | * the absolute reference frame is described by only one angle (the data member |
| 666 | * \c rot_phi). |
| 667 | * |
| 668 | * |
| 669 | */ |
| 670 | class Map { |
| 671 | |
| 672 | // Data : |
| 673 | // ---- |
| 674 | protected: |
| 675 | /// Pointer on the multi-grid \c Mgd3 on which \c this is defined |
| 676 | const Mg3d* mg ; |
| 677 | |
| 678 | double ori_x ; ///< Absolute coordinate \e x of the origin |
| 679 | double ori_y ; ///< Absolute coordinate \e y of the origin |
| 680 | double ori_z ; ///< Absolute coordinate \e z of the origin |
| 681 | double rot_phi ; ///< Angle between the \e x --axis and \e X --axis |
| 682 | |
| 683 | /** Orthonormal vectorial basis |
| 684 | * \f$(\partial/\partial r,1/r\partial/\partial \theta, |
| 685 | * 1/(r\sin\theta)\partial/\partial \phi)\f$ |
| 686 | * associated with the coordinates \f$(r, \theta, \phi)\f$ of the |
| 687 | * mapping. |
| 688 | */ |
| 689 | Base_vect_spher bvect_spher ; |
| 690 | |
| 691 | /** Cartesian basis |
| 692 | * \f$(\partial/\partial x,\partial/\partial y,\partial/\partial z)\f$ |
| 693 | * associated with the coordinates \e (x,y,z) of the |
| 694 | * mapping, i.e. the Cartesian coordinates related to |
| 695 | * \f$(r, \theta, \phi)\f$ by means of usual formulae. |
| 696 | */ |
| 697 | Base_vect_cart bvect_cart ; |
| 698 | |
| 699 | /** Pointer onto the flat metric associated with the spherical coordinates |
| 700 | * and with components expressed in the triad \c bvect_spher |
| 701 | */ |
| 702 | mutable Metric_flat* p_flat_met_spher ; |
| 703 | |
| 704 | /** Pointer onto the flat metric associated with the Cartesian coordinates |
| 705 | * and with components expressed in the triad \c bvect_cart |
| 706 | */ |
| 707 | mutable Metric_flat* p_flat_met_cart ; |
| 708 | |
| 709 | /** The null Cmp. |
| 710 | * To be used by the \c Tenseur class when necessary to |
| 711 | * return a null \c Cmp . |
| 712 | */ |
| 713 | Cmp* p_cmp_zero ; |
| 714 | |
| 715 | mutable Map_af* p_mp_angu ; ///< Pointer on the "angular" mapping. |
| 716 | |
| 717 | public: |
| 718 | Coord r ; ///< \e r coordinate centered on the grid |
| 719 | Coord tet ; ///< \f$\theta\f$ coordinate centered on the grid |
| 720 | Coord phi ; ///< \f$\phi\f$ coordinate centered on the grid |
| 721 | Coord sint ; ///< \f$\sin\theta\f$ |
| 722 | Coord cost ; ///< \f$\cos\theta\f$ |
| 723 | Coord sinp ; ///< \f$\sin\phi\f$ |
| 724 | Coord cosp ; ///< \f$\cos\phi\f$ |
| 725 | |
| 726 | Coord x ; ///< \e x coordinate centered on the grid |
| 727 | Coord y ; ///< \e y coordinate centered on the grid |
| 728 | Coord z ; ///< \e z coordinate centered on the grid |
| 729 | |
| 730 | Coord xa ; ///< Absolute \e x coordinate |
| 731 | Coord ya ; ///< Absolute \e y coordinate |
| 732 | Coord za ; ///< Absolute \e z coordinate |
| 733 | |
| 734 | |
| 735 | // Constructors, destructor : |
| 736 | // ------------------------ |
| 737 | |
| 738 | protected: |
| 739 | explicit Map(const Mg3d& ) ; ///< Constructor from a multi-domain 3D grid |
| 740 | Map(const Map &) ; ///< Copy constructor |
| 741 | Map(const Mg3d&, FILE* ) ; ///< Constructor from a file (see \c sauve(FILE* ) ) |
| 742 | |
| 743 | public: |
| 744 | virtual ~Map() ; ///< Destructor |
| 745 | |
| 746 | // Memory management |
| 747 | // ----------------- |
| 748 | protected: |
| 749 | virtual void reset_coord() ; ///< Resets all the member \c Coords |
| 750 | |
| 751 | // Outputs |
| 752 | // ------- |
| 753 | private: |
| 754 | virtual ostream& operator>>(ostream &) const = 0 ; ///< Operator >> |
| 755 | |
| 756 | public: |
| 757 | virtual void sauve(FILE* ) const ; ///< Save in a file |
| 758 | |
| 759 | |
| 760 | // Extraction of information |
| 761 | // ------------------------- |
| 762 | |
| 763 | public: |
| 764 | /// Gives the \c Mg3d on which the mapping is defined |
| 765 | const Mg3d* get_mg() const {return mg; }; |
| 766 | |
| 767 | /// Returns the \e x coordinate of the origin |
| 768 | double get_ori_x() const {return ori_x;} ; |
| 769 | /// Returns the \e y coordinate of the origin |
| 770 | double get_ori_y() const {return ori_y;} ; |
| 771 | /// Returns the \e z coordinate of the origin |
| 772 | double get_ori_z() const {return ori_z;} ; |
| 773 | |
| 774 | /// Returns the angle between the \e x --axis and \e X --axis |
| 775 | double get_rot_phi() const {return rot_phi;} ; |
| 776 | |
| 777 | /** Returns the orthonormal vectorial basis |
| 778 | * \f$(\partial/\partial r,1/r\partial/\partial \theta, |
| 779 | * 1/(r\sin\theta)\partial/\partial \phi)\f$ |
| 780 | * associated with the coordinates \f$(r, \theta, \phi)\f$ of the |
| 781 | * mapping. |
| 782 | */ |
| 783 | const Base_vect_spher& get_bvect_spher() const {return bvect_spher;} ; |
| 784 | |
| 785 | /** Returns the Cartesian basis |
| 786 | * \f$(\partial/\partial x,\partial/\partial y,\partial/\partial z)\f$ |
| 787 | * associated with the coordinates \e (x,y,z) of the |
| 788 | * mapping, i.e. the Cartesian coordinates related to |
| 789 | * \f$(r, \theta, \phi)\f$ by means of usual formulae. |
| 790 | */ |
| 791 | const Base_vect_cart& get_bvect_cart() const {return bvect_cart;} ; |
| 792 | |
| 793 | /** Returns the flat metric associated with the spherical coordinates |
| 794 | * and with components expressed in the triad \c bvect_spher |
| 795 | */ |
| 796 | const Metric_flat& flat_met_spher() const ; |
| 797 | |
| 798 | /** Returns the flat metric associated with the Cartesian coordinates |
| 799 | * and with components expressed in the triad \c bvect_cart |
| 800 | */ |
| 801 | const Metric_flat& flat_met_cart() const ; |
| 802 | |
| 803 | /** Returns the null \c Cmp defined on \c *this. |
| 804 | * To be used by the \c Tenseur class when necessary to |
| 805 | * return a null \c Cmp . |
| 806 | */ |
| 807 | const Cmp& cmp_zero() const {return *p_cmp_zero;} ; |
| 808 | |
| 809 | /** Returns the "angular" mapping for the outside of domain \c l_zone. |
| 810 | * Valid only for the class \c Map_af. |
| 811 | */ |
| 812 | virtual const Map_af& mp_angu(int) const = 0 ; |
| 813 | |
| 814 | /** Determines the coordinates \f$(r,\theta,\phi)\f$ |
| 815 | * corresponding to given absolute Cartesian coordinates |
| 816 | * \e (X,Y,Z). |
| 817 | * @param xx [input] value of the coordinate \e x (absolute frame) |
| 818 | * @param yy [input] value of the coordinate \e y (absolute frame) |
| 819 | * @param zz [input] value of the coordinate \e z (absolute frame) |
| 820 | * @param rr [output] value of \e r |
| 821 | * @param theta [output] value of \f$\theta\f$ |
| 822 | * @param pphi [output] value of \f$\phi\f$ |
| 823 | */ |
| 824 | void convert_absolute(double xx, double yy, double zz, |
| 825 | double& rr, double& theta, double& pphi) const ; |
| 826 | |
| 827 | /** Returns the value of the radial coordinate \e r for a given |
| 828 | * \f$(\xi, \theta', \phi')\f$ in a given domain. |
| 829 | * @param l [input] index of the domain |
| 830 | * @param xi [input] value of \f$\xi\f$ |
| 831 | * @param theta [input] value of \f$\theta'\f$ |
| 832 | * @param pphi [input] value of \f$\phi'\f$ |
| 833 | * @return value of \f$r=R_l(\xi, \theta', \phi')\f$ |
| 834 | */ |
| 835 | virtual double val_r(int l, double xi, double theta, double pphi) |
| 836 | const = 0 ; |
| 837 | |
| 838 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 839 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 840 | * @param rr [input] value of \e r |
| 841 | * @param theta [input] value of \f$\theta\f$ |
| 842 | * @param pphi [input] value of \f$\phi\f$ |
| 843 | * @param l [output] value of the domain index |
| 844 | * @param xi [output] value of \f$\xi\f$ |
| 845 | */ |
| 846 | virtual void val_lx(double rr, double theta, double pphi, |
| 847 | int& l, double& xi) const = 0 ; |
| 848 | |
| 849 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 850 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 851 | * This version enables to pass some parameters to control the |
| 852 | * accuracy of the computation. |
| 853 | * @param rr [input] value of \e r |
| 854 | * @param theta [input] value of \f$\theta\f$ |
| 855 | * @param pphi [input] value of \f$\phi\f$ |
| 856 | * @param par [input/output] parameters to control the |
| 857 | * accuracy of the computation |
| 858 | * @param l [output] value of the domain index |
| 859 | * @param xi [output] value of \f$\xi\f$ |
| 860 | */ |
| 861 | virtual void val_lx(double rr, double theta, double pphi, |
| 862 | const Param& par, int& l, double& xi) const = 0 ; |
| 863 | |
| 864 | |
| 865 | /// Comparison operator (egality) |
| 866 | virtual bool operator==(const Map& ) const = 0; |
| 867 | |
| 868 | |
| 869 | |
| 870 | // Modification of the origin, the orientation and the radial scale: |
| 871 | // ---------------------------------------------------------------- |
| 872 | public: |
| 873 | void set_ori(double xa0, double ya0, double za0) ; ///< Sets a new origin |
| 874 | void set_rot_phi(double phi0) ; ///< Sets a new rotation angle |
| 875 | |
| 876 | /** Sets a new radial scale. |
| 877 | * @param lambda [input] factor by which the value of \e r is to |
| 878 | * be multiplied |
| 879 | */ |
| 880 | virtual void homothetie(double lambda) = 0 ; |
| 881 | |
| 882 | /** Rescales the outer boundary of one domain. |
| 883 | * The inner boundary is unchanged. The inner boundary |
| 884 | * of the next domain is changed to match the new outer |
| 885 | * boundary. |
| 886 | * @param l [input] index of the domain |
| 887 | * @param lambda [input] factor by which the value of |
| 888 | * \f$R(\theta, \varphi)\f$ defining the outer boundary |
| 889 | * of the domain is to be multiplied. |
| 890 | */ |
| 891 | virtual void resize(int l, double lambda) = 0 ; |
| 892 | |
| 893 | // Modification of the mapping |
| 894 | // --------------------------- |
| 895 | public: |
| 896 | /// Assignment to an affine mapping. |
| 897 | virtual void operator=(const Map_af& ) = 0 ; |
| 898 | |
| 899 | /** Adaptation of the mapping to a given scalar field. |
| 900 | * This is a virtual function: see the actual implementations |
| 901 | * in the derived classes for the meaning of the various |
| 902 | * parameters. |
| 903 | */ |
| 904 | virtual void adapt(const Cmp& ent, const Param& par, int nbr=0) = 0 ; |
| 905 | |
| 906 | // Values of a Cmp at the new grid points |
| 907 | // -------------------------------------- |
| 908 | |
| 909 | /** Recomputes the values of a \c Cmp at the collocation points |
| 910 | * after a change in the mapping. |
| 911 | * @param mp_prev [input] Previous value of the mapping. |
| 912 | * @param nzet [input] Number of domains where the computation |
| 913 | * must be done: the computation is performed for the domains |
| 914 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 915 | * to zero in the other domains. |
| 916 | * @param uu [input/output] input : \c Cmp previously computed on |
| 917 | * the mapping \c *mp_prev ; ouput : |
| 918 | * values of (logically) the same \c Cmp |
| 919 | * at the grid points defined by \c *this. |
| 920 | */ |
| 921 | virtual void reevaluate(const Map* mp_prev, int nzet, |
| 922 | Cmp& uu) const = 0 ; |
| 923 | |
| 924 | /** Recomputes the values of a \c Cmp at the collocation points |
| 925 | * after a change in the mapping. |
| 926 | * Case where the \c Cmp is symmetric with respect the plane y=0. |
| 927 | * @param mp_prev [input] Previous value of the mapping. |
| 928 | * @param nzet [input] Number of domains where the computation |
| 929 | * must be done: the computation is performed for the domains |
| 930 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 931 | * to zero in the other domains. |
| 932 | * @param uu [input/output] input : \c Cmp previously computed on |
| 933 | * the mapping \c *mp_prev ; ouput : |
| 934 | * values of (logically) the same \c Cmp |
| 935 | * at the grid points defined by \c *this. |
| 936 | */ |
| 937 | virtual void reevaluate_symy(const Map* mp_prev, int nzet, |
| 938 | Cmp& uu) const = 0 ; |
| 939 | |
| 940 | /** Recomputes the values of a \c Scalar at the collocation points |
| 941 | * after a change in the mapping. |
| 942 | * @param mp_prev [input] Previous value of the mapping. |
| 943 | * @param nzet [input] Number of domains where the computation |
| 944 | * must be done: the computation is performed for the domains |
| 945 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 946 | * to zero in the other domains. |
| 947 | * @param uu [input/output] input : \c Scalar previously computed on |
| 948 | * the mapping \c *mp_prev ; ouput : |
| 949 | * values of (logically) the same \c Scalae |
| 950 | * at the grid points defined by \c *this. |
| 951 | */ |
| 952 | virtual void reevaluate(const Map* mp_prev, int nzet, |
| 953 | Scalar& uu) const = 0 ; |
| 954 | |
| 955 | /** Recomputes the values of a \c Scalar at the collocation points |
| 956 | * after a change in the mapping. |
| 957 | * Case where the \c Scalar is symmetric with respect the plane y=0. |
| 958 | * @param mp_prev [input] Previous value of the mapping. |
| 959 | * @param nzet [input] Number of domains where the computation |
| 960 | * must be done: the computation is performed for the domains |
| 961 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 962 | * to zero in the other domains. |
| 963 | * @param uu [input/output] input : \c Scalar previously computed on |
| 964 | * the mapping \c *mp_prev ; ouput : |
| 965 | * values of (logically) the same \c Scalar |
| 966 | * at the grid points defined by \c *this. |
| 967 | */ |
| 968 | virtual void reevaluate_symy(const Map* mp_prev, int nzet, |
| 969 | Scalar& uu) const = 0 ; |
| 970 | |
| 971 | // Differential operators: |
| 972 | // ---------------------- |
| 973 | public: |
| 974 | /** Computes \f$\partial/ \partial \xi\f$ of a \c Cmp . |
| 975 | * Note that in the compactified external domain (CED), it computes |
| 976 | * \f$-\partial/ \partial u = \xi^2 \partial/ \partial \xi\f$. |
| 977 | * @param ci [input] field to consider |
| 978 | * @param resu [output] derivative of \c ci |
| 979 | */ |
| 980 | virtual void dsdxi(const Cmp& ci, Cmp& resu) const = 0 ; |
| 981 | |
| 982 | /** Computes \f$\partial/ \partial r\f$ of a \c Cmp . |
| 983 | * Note that in the compactified external domain (CED), it computes |
| 984 | * \f$-\partial/ \partial u = r^2 \partial/ \partial r\f$. |
| 985 | * @param ci [input] field to consider |
| 986 | * @param resu [output] derivative of \c ci |
| 987 | */ |
| 988 | virtual void dsdr(const Cmp& ci, Cmp& resu) const = 0 ; |
| 989 | |
| 990 | /** Computes \f$1/r \partial/ \partial \theta\f$ of a \c Cmp . |
| 991 | * Note that in the compactified external domain (CED), it computes |
| 992 | * \f$1/u \partial/ \partial \theta = r \partial/ \partial \theta\f$. |
| 993 | * @param ci [input] field to consider |
| 994 | * @param resu [output] derivative of \c ci |
| 995 | */ |
| 996 | virtual void srdsdt(const Cmp& ci, Cmp& resu) const = 0 ; |
| 997 | |
| 998 | /** Computes \f$1/(r\sin\theta) \partial/ \partial \phi\f$ of a \c Cmp . |
| 999 | * Note that in the compactified external domain (CED), it computes |
| 1000 | * \f$1/(u\sin\theta) \partial/ \partial \phi = |
| 1001 | * r/\sin\theta \partial/ \partial \phi\f$. |
| 1002 | * @param ci [input] field to consider |
| 1003 | * @param resu [output] derivative of \c ci |
| 1004 | */ |
| 1005 | virtual void srstdsdp(const Cmp& ci, Cmp& resu) const = 0 ; |
| 1006 | |
| 1007 | /** Computes \f$\partial/ \partial xi\f$ of a \c Scalar . |
| 1008 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 1009 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 1010 | * is increased by 1 in other cases. |
| 1011 | * @param uu [input] field to consider |
| 1012 | * @param resu [output] derivative of \c uu |
| 1013 | */ |
| 1014 | virtual void dsdxi(const Scalar& uu, Scalar& resu) const = 0 ; |
| 1015 | |
| 1016 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar . |
| 1017 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 1018 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 1019 | * is increased by 1 in other cases. |
| 1020 | * @param uu [input] field to consider |
| 1021 | * @param resu [output] derivative of \c uu |
| 1022 | */ |
| 1023 | virtual void dsdr(const Scalar& uu, Scalar& resu) const = 0 ; |
| 1024 | |
| 1025 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar if the description is affine and |
| 1026 | * \f$\partial/ \partial \ln r\f$ if it is logarithmic. |
| 1027 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 1028 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 1029 | * is increased by 1 in other cases. |
| 1030 | * @param uu [input] field to consider |
| 1031 | * @param resu [output] derivative of \c uu |
| 1032 | */ |
| 1033 | virtual void dsdradial(const Scalar& uu, Scalar& resu) const = 0 ; |
| 1034 | |
| 1035 | /** Computes \f$1/r \partial/ \partial \theta\f$ of a \c Scalar . |
| 1036 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 1037 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 1038 | * is increased by 1 in other cases. |
| 1039 | * @param uu [input] field to consider |
| 1040 | * @param resu [output] derivative of \c uu |
| 1041 | */ |
| 1042 | virtual void srdsdt(const Scalar& uu, Scalar& resu) const = 0 ; |
| 1043 | |
| 1044 | /** Computes \f$1/(r\sin\theta) \partial/ \partial \phi\f$ of a \c Scalar . |
| 1045 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 1046 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 1047 | * is increased by 1 in other cases. |
| 1048 | * @param uu [input] field to consider |
| 1049 | * @param resu [output] derivative of \c uu |
| 1050 | */ |
| 1051 | virtual void srstdsdp(const Scalar& uu, Scalar& resu) const = 0 ; |
| 1052 | |
| 1053 | /** Computes \f$\partial/ \partial \theta\f$ of a \c Scalar . |
| 1054 | * @param uu [input] scalar field |
| 1055 | * @param resu [output] derivative of \c uu |
| 1056 | */ |
| 1057 | virtual void dsdt(const Scalar& uu, Scalar& resu) const = 0 ; |
| 1058 | |
| 1059 | /** Computes \f$1/\sin\theta \partial/ \partial \varphi\f$ of a \c Scalar . |
| 1060 | * @param uu [input] scalar field |
| 1061 | * @param resu [output] derivative of \c uu |
| 1062 | */ |
| 1063 | virtual void stdsdp(const Scalar& uu, Scalar& resu) const = 0 ; |
| 1064 | |
| 1065 | /** Computes the Laplacian of a scalar field. |
| 1066 | * @param uu [input] Scalar field \e u (represented as a \c Scalar ) |
| 1067 | * the Laplacian \f$\Delta u\f$ of which is to be computed |
| 1068 | * @param zec_mult_r [input] Determines the quantity computed in |
| 1069 | * the compactified external domain (CED) : \\ |
| 1070 | * zec_mult_r = 0 : \f$\Delta u\f$ \\ |
| 1071 | * zec_mult_r = 2 : \f$r^2 \, \Delta u\f$ \\ |
| 1072 | * zec_mult_r = 4 (default) : \f$r^4 \, \Delta u\f$ |
| 1073 | * @param lap [output] Laplacian of \e u |
| 1074 | */ |
| 1075 | virtual void laplacien(const Scalar& uu, int zec_mult_r, |
| 1076 | Scalar& lap) const = 0 ; |
| 1077 | |
| 1078 | /// Computes the Laplacian of a scalar field (\c Cmp version). |
| 1079 | virtual void laplacien(const Cmp& uu, int zec_mult_r, |
| 1080 | Cmp& lap) const = 0 ; |
| 1081 | |
| 1082 | /** Computes the angular Laplacian of a scalar field. |
| 1083 | * @param uu [input] Scalar field \e u (represented as a \c Scalar ) |
| 1084 | * the Laplacian \f$\Delta u\f$ of which is to be computed |
| 1085 | * @param lap [output] Angular Laplacian of \e u (see documentation |
| 1086 | * of \c Scalar |
| 1087 | */ |
| 1088 | virtual void lapang(const Scalar& uu, Scalar& lap) const = 0 ; |
| 1089 | |
| 1090 | |
| 1091 | /** Computes the radial primitive which vanishes for \f$r\to \infty\f$. |
| 1092 | * i.e. the function |
| 1093 | * \f$ F(r,\theta,\varphi) = \int_r^\infty f(r',\theta,\varphi) \, dr' \f$ |
| 1094 | * |
| 1095 | * @param uu [input] function \e f (must have a \c dzpuis = 2) |
| 1096 | * @param resu [input] function \e F |
| 1097 | * @param null_infty if true (default), the primitive is null |
| 1098 | * at infinity (or on the grid boundary). \e F is null at the |
| 1099 | * center otherwise |
| 1100 | */ |
| 1101 | virtual void primr(const Scalar& uu, Scalar& resu, |
| 1102 | bool null_infty) const = 0 ; |
| 1103 | |
| 1104 | |
| 1105 | // Various linear operators |
| 1106 | // ------------------------ |
| 1107 | public: |
| 1108 | /** Multiplication by \e r of a \c Scalar , the \c dzpuis |
| 1109 | * of \c uu is not changed. |
| 1110 | */ |
| 1111 | virtual void mult_r(Scalar& uu) const = 0 ; |
| 1112 | |
| 1113 | /** Multiplication by \e r of a \c Cmp . In the CED, |
| 1114 | * there is only a decrement of \c dzpuis |
| 1115 | */ |
| 1116 | virtual void mult_r(Cmp& ci) const = 0 ; |
| 1117 | |
| 1118 | /** Multiplication by \e r (in the compactified external domain only) |
| 1119 | * of a \c Scalar |
| 1120 | */ |
| 1121 | virtual void mult_r_zec(Scalar& ) const = 0 ; |
| 1122 | |
| 1123 | /** Multiplication by \f$r\sin\theta\f$ of a \c Scalar |
| 1124 | */ |
| 1125 | virtual void mult_rsint(Scalar& ) const = 0 ; |
| 1126 | |
| 1127 | /** Division by \f$r\sin\theta\f$ of a \c Scalar |
| 1128 | */ |
| 1129 | virtual void div_rsint(Scalar& ) const = 0 ; |
| 1130 | |
| 1131 | /** Division by \e r of a \c Scalar |
| 1132 | */ |
| 1133 | virtual void div_r(Scalar& ) const = 0 ; |
| 1134 | |
| 1135 | /** Division by \e r (in the compactified external domain only) |
| 1136 | * of a \c Scalar |
| 1137 | */ |
| 1138 | virtual void div_r_zec(Scalar& ) const = 0 ; |
| 1139 | |
| 1140 | /** Multiplication by \f$\cos\theta\f$ of a \c Scalar |
| 1141 | */ |
| 1142 | virtual void mult_cost(Scalar& ) const = 0 ; |
| 1143 | |
| 1144 | /** Division by \f$\cos\theta\f$ of a \c Scalar |
| 1145 | */ |
| 1146 | virtual void div_cost(Scalar& ) const = 0 ; |
| 1147 | |
| 1148 | /** Multiplication by \f$\sin\theta\f$ of a \c Scalar |
| 1149 | */ |
| 1150 | virtual void mult_sint(Scalar& ) const = 0 ; |
| 1151 | |
| 1152 | /** Division by \f$\sin\theta\f$ of a \c Scalar |
| 1153 | */ |
| 1154 | virtual void div_sint(Scalar& ) const = 0 ; |
| 1155 | |
| 1156 | /** Division by \f$\tan\theta\f$ of a \c Scalar |
| 1157 | */ |
| 1158 | virtual void div_tant(Scalar& ) const = 0 ; |
| 1159 | |
| 1160 | /** Computes the Cartesian x component (with respect to |
| 1161 | * \c bvect_cart ) of a vector given |
| 1162 | * by its spherical components with respect to \c bvect_spher . |
| 1163 | * |
| 1164 | * @param v_r [input] \e r -component of the vector |
| 1165 | * @param v_theta [input] \f$\theta\f$-component of the vector |
| 1166 | * @param v_phi [input] \f$\phi\f$-component of the vector |
| 1167 | * @param v_x [output] x-component of the vector |
| 1168 | */ |
| 1169 | virtual void comp_x_from_spherical(const Scalar& v_r, const Scalar& v_theta, |
| 1170 | const Scalar& v_phi, Scalar& v_x) const = 0 ; |
| 1171 | /// \c Cmp version |
| 1172 | virtual void comp_x_from_spherical(const Cmp& v_r, const Cmp& v_theta, |
| 1173 | const Cmp& v_phi, Cmp& v_x) const = 0 ; |
| 1174 | |
| 1175 | /** Computes the Cartesian y component (with respect to |
| 1176 | * \c bvect_cart ) of a vector given |
| 1177 | * by its spherical components with respect to \c bvect_spher . |
| 1178 | * |
| 1179 | * @param v_r [input] \e r -component of the vector |
| 1180 | * @param v_theta [input] \f$\theta\f$-component of the vector |
| 1181 | * @param v_phi [input] \f$\phi\f$-component of the vector |
| 1182 | * @param v_y [output] y-component of the vector |
| 1183 | */ |
| 1184 | virtual void comp_y_from_spherical(const Scalar& v_r, const Scalar& v_theta, |
| 1185 | const Scalar& v_phi, Scalar& v_y) const = 0 ; |
| 1186 | |
| 1187 | /// \c Cmp version |
| 1188 | virtual void comp_y_from_spherical(const Cmp& v_r, const Cmp& v_theta, |
| 1189 | const Cmp& v_phi, Cmp& v_y) const = 0 ; |
| 1190 | |
| 1191 | /** Computes the Cartesian z component (with respect to |
| 1192 | * \c bvect_cart ) of a vector given |
| 1193 | * by its spherical components with respect to \c bvect_spher . |
| 1194 | * |
| 1195 | * @param v_r [input] \e r -component of the vector |
| 1196 | * @param v_theta [input] \f$\theta\f$-component of the vector |
| 1197 | * @param v_z [output] z-component of the vector |
| 1198 | */ |
| 1199 | virtual void comp_z_from_spherical(const Scalar& v_r, const Scalar& v_theta, |
| 1200 | Scalar& v_z) const = 0 ; |
| 1201 | |
| 1202 | /// \c Cmp version |
| 1203 | virtual void comp_z_from_spherical(const Cmp& v_r, const Cmp& v_theta, |
| 1204 | Cmp& v_z) const = 0 ; |
| 1205 | |
| 1206 | /** Computes the Spherical r component (with respect to |
| 1207 | * \c bvect_spher ) of a vector given |
| 1208 | * by its cartesian components with respect to \c bvect_cart . |
| 1209 | * |
| 1210 | * @param v_x [input] x-component of the vector |
| 1211 | * @param v_y [input] y-component of the vector |
| 1212 | * @param v_z [input] z-component of the vector |
| 1213 | * @param v_r [output] \e r -component of the vector |
| 1214 | */ |
| 1215 | virtual void comp_r_from_cartesian(const Scalar& v_x, const Scalar& v_y, |
| 1216 | const Scalar& v_z, Scalar& v_r) const = 0 ; |
| 1217 | /// \c Cmp version |
| 1218 | virtual void comp_r_from_cartesian(const Cmp& v_x, const Cmp& v_y, |
| 1219 | const Cmp& v_z, Cmp& v_r) const = 0 ; |
| 1220 | |
| 1221 | /** Computes the Spherical \f$\theta\f$ component (with respect to |
| 1222 | * \c bvect_spher ) of a vector given |
| 1223 | * by its cartesian components with respect to \c bvect_cart . |
| 1224 | * |
| 1225 | * @param v_x [input] x-component of the vector |
| 1226 | * @param v_y [input] y-component of the vector |
| 1227 | * @param v_z [input] z-component of the vector |
| 1228 | * @param v_t [output] \f$\theta\f$-component of the vector |
| 1229 | */ |
| 1230 | virtual void comp_t_from_cartesian(const Scalar& v_x, const Scalar& v_y, |
| 1231 | const Scalar& v_z, Scalar& v_t) const = 0 ; |
| 1232 | |
| 1233 | /// \c Cmp version |
| 1234 | virtual void comp_t_from_cartesian(const Cmp& v_x, const Cmp& v_y, |
| 1235 | const Cmp& v_z, Cmp& v_t) const = 0 ; |
| 1236 | |
| 1237 | /** Computes the Spherical \f$\phi\f$ component (with respect to |
| 1238 | * \c bvect_spher ) of a vector given |
| 1239 | * by its cartesian components with respect to \c bvect_cart . |
| 1240 | * |
| 1241 | * @param v_x [input] x-component of the vector |
| 1242 | * @param v_y [input] y-component of the vector |
| 1243 | * @param v_p [output] \f$\phi\f$-component of the vector |
| 1244 | */ |
| 1245 | virtual void comp_p_from_cartesian(const Scalar& v_x, const Scalar& v_y, |
| 1246 | Scalar& v_p) const = 0 ; |
| 1247 | |
| 1248 | /// \c Cmp version |
| 1249 | virtual void comp_p_from_cartesian(const Cmp& v_x, const Cmp& v_y, |
| 1250 | Cmp& v_p) const = 0 ; |
| 1251 | |
| 1252 | /** Decreases by 1 the value of \c dzpuis of a \c Scalar |
| 1253 | * and changes accordingly its values in the |
| 1254 | * compactified external domain (CED). |
| 1255 | */ |
| 1256 | virtual void dec_dzpuis(Scalar& ) const = 0 ; |
| 1257 | |
| 1258 | /** Decreases by 2 the value of \c dzpuis of a \c Scalar |
| 1259 | * and changes accordingly its values in the |
| 1260 | * compactified external domain (CED). |
| 1261 | */ |
| 1262 | virtual void dec2_dzpuis(Scalar& ) const = 0 ; |
| 1263 | |
| 1264 | /** Increases by 1 the value of \c dzpuis of a \c Scalar |
| 1265 | * and changes accordingly its values in the |
| 1266 | * compactified external domain (CED). |
| 1267 | */ |
| 1268 | virtual void inc_dzpuis(Scalar& ) const = 0 ; |
| 1269 | |
| 1270 | /** Increases by 2 the value of \c dzpuis of a \c Scalar |
| 1271 | * and changes accordingly its values in the |
| 1272 | * compactified external domain (CED). |
| 1273 | */ |
| 1274 | virtual void inc2_dzpuis(Scalar& ) const = 0 ; |
| 1275 | |
| 1276 | /** Computes the integral over all space of a \c Cmp . |
| 1277 | * The computed quantity is |
| 1278 | * \f$\int u \, r^2 \sin\theta \, dr\, d\theta \, d\phi\f$. |
| 1279 | * The routine allocates a \c Tbl (size: \c mg->nzone ) to store |
| 1280 | * the result (partial integral) in each domain and returns a pointer |
| 1281 | * to it. |
| 1282 | */ |
| 1283 | virtual Tbl* integrale(const Cmp&) const = 0 ; |
| 1284 | |
| 1285 | // PDE resolution : |
| 1286 | // -------------- |
| 1287 | public: |
| 1288 | /** Computes the solution of a scalar Poisson equation. |
| 1289 | * |
| 1290 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 1291 | * \f$\Delta u = \sigma\f$. |
| 1292 | * @param par [input/output] possible parameters to control the |
| 1293 | * resolution of the Poisson equation. See the actual implementation |
| 1294 | * in the derived class of \c Map for documentation. |
| 1295 | * @param uu [input/output] solution \e u with the boundary condition |
| 1296 | * \e u =0 at spatial infinity. |
| 1297 | */ |
| 1298 | virtual void poisson(const Cmp& source, Param& par, Cmp& uu) const = 0 ; |
| 1299 | |
| 1300 | /** Computes the solution of a scalar Poisson equationwith a Tau method. |
| 1301 | * |
| 1302 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 1303 | * \f$\Delta u = \sigma\f$. |
| 1304 | * @param par [input/output] possible parameters to control the |
| 1305 | * resolution of the Poisson equation. See the actual implementation |
| 1306 | * in the derived class of \c Map for documentation. |
| 1307 | * @param uu [input/output] solution \e u with the boundary condition |
| 1308 | * \e u =0 at spatial infinity. |
| 1309 | */ |
| 1310 | virtual void poisson_tau(const Cmp& source, Param& par, Cmp& uu) const = 0 ; |
| 1311 | |
| 1312 | virtual void poisson_falloff(const Cmp& source, Param& par, Cmp& uu, |
| 1313 | int k_falloff) const = 0 ; |
| 1314 | |
| 1315 | virtual void poisson_ylm(const Cmp& source, Param& par, Cmp& pot, |
| 1316 | int nylm, double* intvec) const = 0 ; |
| 1317 | |
| 1318 | /** Computes the solution of a scalar Poisson equation. |
| 1319 | * The regularized source |
| 1320 | * |
| 1321 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 1322 | * \f$\Delta u = \sigma\f$. |
| 1323 | * @param k_div [input] regularization degree of the procedure |
| 1324 | * @param nzet [input] number of domains covering the star |
| 1325 | * @param unsgam1 [input] parameter \f$1/(\gamma-1)\f$ where \f$\gamma\f$ |
| 1326 | * denotes the adiabatic index. |
| 1327 | * @param par [input/output] possible parameters to control the |
| 1328 | * resolution of the Poisson equation. See the actual implementation |
| 1329 | * in the derived class of \c Map for documentation. |
| 1330 | * @param uu [input/output] solution \e u with the boundary condition |
| 1331 | * \e u =0 at spatial infinity. |
| 1332 | * @param uu_regu [output] solution of the regular part of |
| 1333 | * the source. |
| 1334 | * @param uu_div [output] solution of the diverging part of |
| 1335 | * the source. |
| 1336 | * @param duu_div [output] derivative of the diverging potential |
| 1337 | * @param source_regu [output] regularized source |
| 1338 | * @param source_div [output] diverging part of the source |
| 1339 | */ |
| 1340 | virtual void poisson_regular(const Cmp& source, int k_div, int nzet, |
| 1341 | double unsgam1, Param& par, Cmp& uu, |
| 1342 | Cmp& uu_regu, Cmp& uu_div, |
| 1343 | Tenseur& duu_div, Cmp& source_regu, |
| 1344 | Cmp& source_div) const = 0 ; |
| 1345 | |
| 1346 | /** Resolution of the elliptic equation |
| 1347 | * \f$ a \Delta\psi + {\bf b} \cdot \nabla \psi = \sigma\f$ |
| 1348 | * in the case where the stellar interior is covered by a single domain. |
| 1349 | * |
| 1350 | * @param source [input] source \f$\sigma\f$ of the above equation |
| 1351 | * @param aa [input] factor \e a in the above equation |
| 1352 | * @param bb [input] vector \e \b b in the above equation |
| 1353 | * @param par [input/output] possible parameters to control the |
| 1354 | * resolution of the equation. See the actual implementation |
| 1355 | * in the derived class of \c Map for documentation. |
| 1356 | * @param psi [input/output] solution \f$\psi\f$ which satisfies |
| 1357 | * \f$\psi(0)=0\f$. |
| 1358 | */ |
| 1359 | virtual void poisson_compact(const Cmp& source, const Cmp& aa, |
| 1360 | const Tenseur& bb, const Param& par, |
| 1361 | Cmp& psi) const = 0 ; |
| 1362 | |
| 1363 | /** Resolution of the elliptic equation |
| 1364 | * \f$ a \Delta\psi + {\bf b} \cdot \nabla \psi = \sigma\f$ |
| 1365 | * in the case of a multidomain stellar interior. |
| 1366 | * |
| 1367 | * @param nzet [input] number of domains covering the stellar interior |
| 1368 | * @param source [input] source \f$\sigma\f$ of the above equation |
| 1369 | * @param aa [input] factor \e a in the above equation |
| 1370 | * @param bb [input] vector \e \b b in the above equation |
| 1371 | * @param par [input/output] possible parameters to control the |
| 1372 | * resolution of the equation. See the actual implementation |
| 1373 | * in the derived class of \c Map for documentation. |
| 1374 | * @param psi [input/output] solution \f$\psi\f$ which satisfies |
| 1375 | * \f$\psi(0)=0\f$. |
| 1376 | */ |
| 1377 | virtual void poisson_compact(int nzet, const Cmp& source, const Cmp& aa, |
| 1378 | const Tenseur& bb, const Param& par, |
| 1379 | Cmp& psi) const = 0 ; |
| 1380 | |
| 1381 | /** Computes the solution of the generalized angular Poisson equation. |
| 1382 | * The generalized angular Poisson equation is |
| 1383 | * \f$\Delta_{\theta\varphi} u + \lambda u = \sigma\f$, |
| 1384 | * where \f$\Delta_{\theta\varphi} u := \frac{\partial^2 u} |
| 1385 | * {\partial \theta^2} + \frac{1}{\tan \theta} \frac{\partial u} |
| 1386 | * {\partial \theta} +\frac{1}{\sin^2 \theta}\frac{\partial^2 u} |
| 1387 | * {\partial \varphi^2}\f$. |
| 1388 | * |
| 1389 | * @param source [input] source \f$\sigma\f$ of the equation |
| 1390 | * \f$\Delta_{\theta\varphi} u + \lambda u = \sigma\f$. |
| 1391 | * @param par [input/output] possible parameters to control the |
| 1392 | * resolution of the Poisson equation. See the actual implementation |
| 1393 | * in the derived class of \c Map for documentation. |
| 1394 | * @param uu [input/output] solution \e u |
| 1395 | * @param lambda [input] coefficient \f$\lambda\f$ in the above equation |
| 1396 | * (default value = 0) |
| 1397 | */ |
| 1398 | virtual void poisson_angu(const Scalar& source, Param& par, |
| 1399 | Scalar& uu, double lambda=0) const = 0 ; |
| 1400 | |
| 1401 | |
| 1402 | public: |
| 1403 | /** |
| 1404 | * Function intended to be used by \c Map::poisson_vect |
| 1405 | * and \c Map::poisson_vect_oohara . It constructs the sets of |
| 1406 | * parameters used for each scalar Poisson equation from the one for |
| 1407 | * the vectorial one. |
| 1408 | * |
| 1409 | * @param para [input] : the \c Param used for the resolution of |
| 1410 | * the vectorial Poisson equation : \\ |
| 1411 | * \c para.int() maximum number of iteration.\\ |
| 1412 | * \c para.double(0) relaxation parameter.\\ |
| 1413 | * \c para.double(1) required precision. \\ |
| 1414 | * \c para.tenseur_mod() source of the vectorial part at the previous |
| 1415 | * step.\\ |
| 1416 | * \c para.cmp_mod() source of the scalar part at the previous |
| 1417 | * step. |
| 1418 | * |
| 1419 | * @param i [input] number of the scalar Poisson equation that is being |
| 1420 | * solved (values from 0 to 2 for the componants of the vectorial part |
| 1421 | * and 3 for the scalar one). |
| 1422 | * |
| 1423 | * @return the pointer on the parameter set used for solving the |
| 1424 | * scalar Poisson equation labelled by \e i . |
| 1425 | */ |
| 1426 | virtual Param* donne_para_poisson_vect (Param& para, int i) const = 0; |
| 1427 | |
| 1428 | /** |
| 1429 | * Computes the solution of a Poisson equation from the domain |
| 1430 | * \c num_front+1 . |
| 1431 | * imposing a boundary condition at the boundary between the domains |
| 1432 | * \c num_front and \c num_front+1 . |
| 1433 | * |
| 1434 | * @param source [input] : source of the equation. |
| 1435 | * @param limite [input] : \c limite[num_front] contains the angular |
| 1436 | * function being the boudary condition. |
| 1437 | * @param raccord [input] : 1 for the Dirichlet problem and 2 for |
| 1438 | * the Neumann one and 3 for Dirichlet-Neumann. |
| 1439 | * @param num_front [input] : index of the boudary at which the boundary |
| 1440 | * condition has to be imposed. |
| 1441 | * @param pot [output] : result. |
| 1442 | * @param fact_dir [input] : Valeur by which we multiply the quantity |
| 1443 | * we solve. (in the case of Dirichlet-Neumann boundary condition.) |
| 1444 | * @param fact_neu [input] : Valeur by which we multiply the radial |
| 1445 | * derivative of the quantity we solve. (in the case of |
| 1446 | * Dirichlet-Neumann boundary condition.) |
| 1447 | */ |
| 1448 | virtual void poisson_frontiere (const Cmp& source,const Valeur& limite, |
| 1449 | int raccord, int num_front, Cmp& pot, |
| 1450 | double = 0., double = 0.) const = 0 ; |
| 1451 | |
| 1452 | virtual void poisson_frontiere_double (const Cmp& source, const Valeur& lim_func, |
| 1453 | const Valeur& lim_der, int num_zone, Cmp& pot) const = 0 ; |
| 1454 | |
| 1455 | |
| 1456 | /** |
| 1457 | * Computes the solution of a Poisson equation in the shell, |
| 1458 | * imposing a boundary condition at the surface of the star |
| 1459 | * |
| 1460 | * @param source [input] : source of the equation. |
| 1461 | * @param limite [input] : \c limite[num_front] contains the angular |
| 1462 | * function being the boudary condition. |
| 1463 | * @param par [input] : parameters of the computation. |
| 1464 | * @param pot [output] : result. |
| 1465 | */ |
| 1466 | virtual void poisson_interne (const Cmp& source, const Valeur& limite, |
| 1467 | Param& par, Cmp& pot) const = 0 ; |
| 1468 | |
| 1469 | |
| 1470 | /** Computes the solution of a 2-D Poisson equation. |
| 1471 | * The 2-D Poisson equation writes |
| 1472 | * \f[ |
| 1473 | * {\partial^2 u\over\partial r^2} + |
| 1474 | * {1\over r} {\partial u \over \partial r} + |
| 1475 | * {1\over r^2} {\partial^2 u\over\partial \theta^2} = |
| 1476 | * \sigma \ . |
| 1477 | * \f] |
| 1478 | * |
| 1479 | * @param source_mat [input] Compactly supported part of |
| 1480 | * the source \f$\sigma\f$ of the 2-D Poisson equation (typically |
| 1481 | * matter terms) |
| 1482 | * @param source_quad [input] Non-compactly supported part of |
| 1483 | * the source \f$\sigma\f$ of the 2-D Poisson equation (typically |
| 1484 | * quadratic terms) |
| 1485 | * @param par [input/output] possible parameters to control the |
| 1486 | * resolution of the Poisson equation. See the actual implementation |
| 1487 | * in the derived class of \c Map for documentation. |
| 1488 | * @param uu [input/output] solution \e u with the boundary condition |
| 1489 | * \e u =0 at spatial infinity. |
| 1490 | */ |
| 1491 | virtual void poisson2d(const Cmp& source_mat, const Cmp& source_quad, |
| 1492 | Param& par, Cmp& uu) const = 0 ; |
| 1493 | |
| 1494 | /** Performs one time-step integration of the d'Alembert scalar equation |
| 1495 | * @param par [input/output] possible parameters to control the |
| 1496 | * resolution of the wave equation. See the actual implementation |
| 1497 | * in the derived class of \c Map for documentation. Note that, |
| 1498 | * at least, param must contain the time step as first \c double |
| 1499 | * parameter. |
| 1500 | * @param fJp1 [output] solution \f$f^{J+1}\f$ at time \e J+1 |
| 1501 | * with boundary conditions of outgoing radiation (not exact!) |
| 1502 | * @param fJ [input] solution \f$f^J\f$ at time \e J |
| 1503 | * @param fJm1 [input] solution \f$f^{J-1}\f$ at time \e J-1 |
| 1504 | * @param source [input] source \f$\sigma\f$ of the d'Alembert equation |
| 1505 | * \f$\diamond u = \sigma\f$. |
| 1506 | */ |
| 1507 | virtual void dalembert(Param& par, Scalar& fJp1, const Scalar& fJ, |
| 1508 | const Scalar& fJm1, const Scalar& source) const = 0 ; |
| 1509 | |
| 1510 | // Friend functions : |
| 1511 | // ---------------- |
| 1512 | friend ostream& operator<<(ostream& , const Map& ) ; ///< Operator << |
| 1513 | }; |
| 1514 | ostream& operator<<(ostream& , const Map& ) ; |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | //------------------------------------// |
| 1519 | // class Map_radial // |
| 1520 | //------------------------------------// |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | /** |
| 1525 | * Base class for pure radial mappings. \ingroup (map) |
| 1526 | * |
| 1527 | * A pure radial mapping is a mapping of the type \f$r=R(\xi, \theta', \phi')\f$, |
| 1528 | * \f$\theta=\theta'\f$, \f$\phi=\phi'\f$. |
| 1529 | * The class \c Map_radial is an abstract class. Effective implementations |
| 1530 | * of radial mapping are performed by the derived class \c Map_af and |
| 1531 | * \c Map_et . |
| 1532 | * |
| 1533 | * |
| 1534 | */ |
| 1535 | |
| 1536 | class Map_radial : public Map { |
| 1537 | |
| 1538 | // Data : |
| 1539 | // ---- |
| 1540 | |
| 1541 | // 0th order derivatives of the mapping |
| 1542 | // - - - - - - - - - - - - - - - - - - |
| 1543 | public: |
| 1544 | /** |
| 1545 | * \f$\xi/R\f$ in the nucleus; \\ |
| 1546 | * \e 1/R in the non-compactified shells; \\ |
| 1547 | * \f$(\xi-1)/U\f$ in the compactified outer domain. |
| 1548 | */ |
| 1549 | Coord xsr ; |
| 1550 | |
| 1551 | // 1st order derivatives of the mapping |
| 1552 | // - - - - - - - - - - - - - - - - - - |
| 1553 | public: |
| 1554 | /** |
| 1555 | * \f$1/(\partial R/\partial\xi) = \partial \xi /\partial r\f$ in the nucleus |
| 1556 | * and in the non-compactified shells; \\ |
| 1557 | * \f$-1/(\partial U/\partial\xi) = - \partial \xi /\partial u\f$ in the |
| 1558 | * compactified outer domain. |
| 1559 | */ |
| 1560 | Coord dxdr ; |
| 1561 | |
| 1562 | /** |
| 1563 | * \f$\partial R/\partial\theta'\f$ in the nucleus |
| 1564 | * and in the non-compactified shells; \\ |
| 1565 | * \f$-\partial U/\partial\theta'\f$ in the |
| 1566 | * compactified external domain (CED). |
| 1567 | */ |
| 1568 | Coord drdt ; |
| 1569 | |
| 1570 | /** |
| 1571 | * \f${1\over\sin\theta} \partial R/\partial\varphi'\f$ in the nucleus |
| 1572 | * and in the non-compactified shells; \\ |
| 1573 | * \f$-{1\over\sin\theta}\partial U/\partial\varphi'\f$ in the |
| 1574 | * compactified external domain (CED). |
| 1575 | */ |
| 1576 | Coord stdrdp ; |
| 1577 | |
| 1578 | /** |
| 1579 | * \f$1/R \times (\partial R/\partial\theta')\f$ in the nucleus |
| 1580 | * and in the non-compactified shells; \\ |
| 1581 | * \f$-1/U \times (\partial U/\partial\theta)\f$ in the |
| 1582 | * compactified outer domain. |
| 1583 | */ |
| 1584 | Coord srdrdt ; |
| 1585 | |
| 1586 | /** |
| 1587 | * \f$1/(R\sin\theta) \times (\partial R/\partial\varphi')\f$ in the nucleus |
| 1588 | * and in the non-compactified shells; \\ |
| 1589 | * \f$-1/(U\sin\theta) \times (\partial U/\partial\varphi')\f$ in the |
| 1590 | * compactified outer domain. |
| 1591 | */ |
| 1592 | Coord srstdrdp ; |
| 1593 | |
| 1594 | /** |
| 1595 | * \f$1/R^2 \times (\partial R/\partial\theta')\f$ in the nucleus |
| 1596 | * and in the non-compactified shells; \\ |
| 1597 | * \f$-1/U^2 \times (\partial U/\partial\theta')\f$ in the |
| 1598 | * compactified outer domain. |
| 1599 | */ |
| 1600 | Coord sr2drdt ; |
| 1601 | |
| 1602 | /** |
| 1603 | * \f$1/(R^2\sin\theta) \times (\partial R/\partial\varphi')\f$ in the nucleus |
| 1604 | * and in the non-compactified shells; \\ |
| 1605 | * \f$-1/(U^2\sin\theta) \times (\partial U/\partial\varphi')\f$ in the |
| 1606 | * compactified outer domain. |
| 1607 | */ |
| 1608 | Coord sr2stdrdp ; |
| 1609 | |
| 1610 | // 2nd order derivatives of the mapping |
| 1611 | // - - - - - - - - - - - - - - - - - - |
| 1612 | public: |
| 1613 | /** |
| 1614 | * \f$\partial^2 R/\partial\xi^2\f$ in the nucleus |
| 1615 | * and in the non-compactified shells; \\ |
| 1616 | * \f$-\partial^2 U/\partial\xi^2 \f$ in the |
| 1617 | * compactified outer domain. |
| 1618 | */ |
| 1619 | Coord d2rdx2 ; |
| 1620 | |
| 1621 | /** |
| 1622 | * \f$1/R^2 \times [ 1/\sin(\theta)\times \partial /\partial\theta' |
| 1623 | * (\sin\theta \partial R /\partial\theta') + 1/\sin^2\theta |
| 1624 | * \partial^2 R /\partial{\varphi'}^2] \f$ in the nucleus |
| 1625 | * and in the non-compactified shells; \\ |
| 1626 | * \f$- 1/U^2 \times [ 1/\sin(\theta)\times \partial /\partial\theta' |
| 1627 | * (\sin\theta \partial U /\partial\theta') + 1/\sin^2\theta |
| 1628 | * \partial^2 U /\partial{\varphi'}^2] \f$ in the |
| 1629 | * compactified outer domain. |
| 1630 | */ |
| 1631 | Coord lapr_tp ; |
| 1632 | |
| 1633 | |
| 1634 | /** |
| 1635 | * \f$\partial^2 R/\partial\xi\partial\theta'\f$ in the nucleus |
| 1636 | * and in the non-compactified shells; \\ |
| 1637 | * \f$-\partial^2 U/\partial\xi\partial\theta'\f$ in the |
| 1638 | * compactified outer domain. |
| 1639 | */ |
| 1640 | Coord d2rdtdx ; |
| 1641 | |
| 1642 | /** |
| 1643 | * \f$1/\sin\theta \times \partial^2 R/\partial\xi\partial\varphi'\f$ |
| 1644 | * in the nucleus and in the non-compactified shells; \\ |
| 1645 | * \f$-1/\sin\theta \times \partial^2 U/\partial\xi\partial\varphi' \f$ |
| 1646 | * in the compactified outer domain. |
| 1647 | */ |
| 1648 | Coord sstd2rdpdx ; |
| 1649 | |
| 1650 | |
| 1651 | /** |
| 1652 | * \f$1/R^2 \partial^2 R/\partial{\theta'}^2\f$ in the nucleus |
| 1653 | * and in the non-compactified shells; \\ |
| 1654 | * \f$-1/U^2 \partial^2 U/\partial{\theta'}^2\f$ in the |
| 1655 | * compactified outer domain. |
| 1656 | */ |
| 1657 | Coord sr2d2rdt2 ; |
| 1658 | |
| 1659 | |
| 1660 | // Constructors, destructor : |
| 1661 | // ------------------------ |
| 1662 | |
| 1663 | protected: |
| 1664 | /// Constructor from a grid (protected to make \c Map_radial an abstract class) |
| 1665 | Map_radial(const Mg3d& mgrid ) ; |
| 1666 | Map_radial(const Map_radial& mp) ; ///< Copy constructor |
| 1667 | Map_radial (const Mg3d&, FILE* ) ; ///< Constructor from a file (see \c sauve(FILE* ) ) |
| 1668 | |
| 1669 | public: |
| 1670 | virtual ~Map_radial() ; ///< Destructor |
| 1671 | |
| 1672 | // Memory management |
| 1673 | // ----------------- |
| 1674 | protected: |
| 1675 | virtual void reset_coord() ; ///< Resets all the member \c Coords |
| 1676 | // Modification of the mapping |
| 1677 | // --------------------------- |
| 1678 | public: |
| 1679 | /// Assignment to an affine mapping. |
| 1680 | virtual void operator=(const Map_af& ) = 0 ; |
| 1681 | |
| 1682 | // Outputs |
| 1683 | // ------- |
| 1684 | public: |
| 1685 | virtual void sauve(FILE* ) const ; ///< Save in a file |
| 1686 | |
| 1687 | // Extraction of information |
| 1688 | // ------------------------- |
| 1689 | /** Returns the value of the radial coordinate \e r for a given |
| 1690 | * \f$\xi\f$ and a given collocation point in \f$(\theta', \phi')\f$ |
| 1691 | * in a given domain. |
| 1692 | * @param l [input] index of the domain |
| 1693 | * @param xi [input] value of \f$\xi\f$ |
| 1694 | * @param j [input] index of the collocation point in \f$\theta'\f$ |
| 1695 | * @param k [input] index of the collocation point in \f$\phi'\f$ |
| 1696 | * @return value of \f$r=R_l(\xi, {\theta'}_j, {\phi'}_k)\f$ |
| 1697 | */ |
| 1698 | virtual double val_r_jk(int l, double xi, int j, int k) const = 0 ; |
| 1699 | |
| 1700 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 1701 | * to a point of arbitrary \e r but collocation values of \f$(\theta, \phi)\f$ |
| 1702 | * @param rr [input] value of \e r |
| 1703 | * @param j [input] index of the collocation point in \f$\theta\f$ |
| 1704 | * @param k [input] index of the collocation point in \f$\phi\f$ |
| 1705 | * @param par [input/output] parameters to control the |
| 1706 | * accuracy of the computation |
| 1707 | * @param l [output] value of the domain index |
| 1708 | * @param xi [output] value of \f$\xi\f$ |
| 1709 | */ |
| 1710 | virtual void val_lx_jk(double rr, int j, int k, const Param& par, |
| 1711 | int& l, double& xi) const = 0 ; |
| 1712 | |
| 1713 | /// Comparison operator (egality) |
| 1714 | virtual bool operator==(const Map& ) const = 0; |
| 1715 | |
| 1716 | // Values of a Cmp at the new grid points |
| 1717 | // -------------------------------------- |
| 1718 | /** Recomputes the values of a \c Cmp at the collocation points |
| 1719 | * after a change in the mapping. |
| 1720 | * @param mp_prev [input] Previous value of the mapping. |
| 1721 | * @param nzet [input] Number of domains where the computation |
| 1722 | * must be done: the computation is performed for the domains |
| 1723 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 1724 | * to zero in the other domains. |
| 1725 | * @param uu [input/output] input : \c Cmp previously computed on |
| 1726 | * the mapping \c *mp_prev ; ouput : |
| 1727 | * values of (logically) the same \c Cmp |
| 1728 | * at the grid points defined by \c *this. |
| 1729 | */ |
| 1730 | virtual void reevaluate(const Map* mp_prev, int nzet, Cmp& uu) const ; |
| 1731 | |
| 1732 | /** Recomputes the values of a \c Cmp at the collocation points |
| 1733 | * after a change in the mapping. |
| 1734 | * Case where the \c Cmp is symmetric with respect to the plane y=0. |
| 1735 | * @param mp_prev [input] Previous value of the mapping. |
| 1736 | * @param nzet [input] Number of domains where the computation |
| 1737 | * must be done: the computation is performed for the domains |
| 1738 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 1739 | * to zero in the other domains. |
| 1740 | * @param uu [input/output] input : \c Cmp previously computed on |
| 1741 | * the mapping \c *mp_prev ; ouput : |
| 1742 | * values of (logically) the same \c Cmp |
| 1743 | * at the grid points defined by \c *this. |
| 1744 | */ |
| 1745 | virtual void reevaluate_symy(const Map* mp_prev, int nzet, Cmp& uu) |
| 1746 | const ; |
| 1747 | |
| 1748 | /** Recomputes the values of a \c Scalar at the collocation points |
| 1749 | * after a change in the mapping. |
| 1750 | * @param mp_prev [input] Previous value of the mapping. |
| 1751 | * @param nzet [input] Number of domains where the computation |
| 1752 | * must be done: the computation is performed for the domains |
| 1753 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 1754 | * to zero in the other domains. |
| 1755 | * @param uu [input/output] input : \c Scalar previously computed on |
| 1756 | * the mapping \c *mp_prev ; ouput : |
| 1757 | * values of (logically) the same \c Scalar |
| 1758 | * at the grid points defined by \c *this. |
| 1759 | */ |
| 1760 | virtual void reevaluate(const Map* mp_prev, int nzet, Scalar& uu) const ; |
| 1761 | |
| 1762 | /** Recomputes the values of a \c Scalar at the collocation points |
| 1763 | * after a change in the mapping. |
| 1764 | * Case where the \c Scalar is symmetric with respect to the plane y=0. |
| 1765 | * @param mp_prev [input] Previous value of the mapping. |
| 1766 | * @param nzet [input] Number of domains where the computation |
| 1767 | * must be done: the computation is performed for the domains |
| 1768 | * of index \f$0\le {\tt l} \le {\tt nzet-1}\f$; \c uu is set |
| 1769 | * to zero in the other domains. |
| 1770 | * @param uu [input/output] input : \c Scalar previously computed on |
| 1771 | * the mapping \c *mp_prev ; ouput : |
| 1772 | * values of (logically) the same \c Scalar |
| 1773 | * at the grid points defined by \c *this. |
| 1774 | */ |
| 1775 | virtual void reevaluate_symy(const Map* mp_prev, int nzet, Scalar& uu) |
| 1776 | const ; |
| 1777 | |
| 1778 | // Various linear operators |
| 1779 | // ------------------------ |
| 1780 | public: |
| 1781 | /** Multiplication by \e r of a \c Scalar, the \c dzpuis |
| 1782 | * of \c uu is not changed. |
| 1783 | */ |
| 1784 | virtual void mult_r(Scalar& uu) const ; |
| 1785 | |
| 1786 | /** Multiplication by \e r of a \c Cmp. In the CED, |
| 1787 | * there is only a decrement of \c dzpuis |
| 1788 | */ |
| 1789 | virtual void mult_r(Cmp& ci) const ; |
| 1790 | |
| 1791 | /** |
| 1792 | * Multiplication by \e r (in the compactified external domain only) |
| 1793 | * of a \c Scalar |
| 1794 | */ |
| 1795 | virtual void mult_r_zec(Scalar& ) const ; |
| 1796 | |
| 1797 | /** Multiplication by \f$r\sin\theta\f$ of a \c Scalar |
| 1798 | */ |
| 1799 | virtual void mult_rsint(Scalar& ) const ; |
| 1800 | |
| 1801 | /** Division by \f$r\sin\theta\f$ of a \c Scalar |
| 1802 | */ |
| 1803 | virtual void div_rsint(Scalar& ) const ; |
| 1804 | |
| 1805 | /** Division by \e r of a \c Scalar |
| 1806 | */ |
| 1807 | virtual void div_r(Scalar& ) const ; |
| 1808 | |
| 1809 | /** Division by \e r (in the compactified external domain only) |
| 1810 | * of a \c Scalar |
| 1811 | */ |
| 1812 | virtual void div_r_zec(Scalar& ) const ; |
| 1813 | |
| 1814 | /** Multiplication by \f$\cos\theta\f$ of a \c Scalar |
| 1815 | */ |
| 1816 | virtual void mult_cost(Scalar& ) const ; |
| 1817 | |
| 1818 | /** Division by \f$\cos\theta\f$ of a \c Scalar |
| 1819 | */ |
| 1820 | virtual void div_cost(Scalar& ) const ; |
| 1821 | |
| 1822 | /** Multiplication by \f$\sin\theta\f$ of a \c Scalar |
| 1823 | */ |
| 1824 | virtual void mult_sint(Scalar& ) const ; |
| 1825 | |
| 1826 | /** Division by \f$\sin\theta\f$ of a \c Scalar |
| 1827 | */ |
| 1828 | virtual void div_sint(Scalar& ) const ; |
| 1829 | |
| 1830 | /** Division by \f$\tan\theta\f$ of a \c Scalar |
| 1831 | */ |
| 1832 | virtual void div_tant(Scalar& ) const ; |
| 1833 | |
| 1834 | /** Computes the Cartesian x component (with respect to |
| 1835 | * \c bvect_cart) of a vector given |
| 1836 | * by its spherical components with respect to \c bvect_spher. |
| 1837 | * |
| 1838 | * @param v_r [input] \e r -component of the vector |
| 1839 | * @param v_theta [input] \f$\theta\f$-component of the vector |
| 1840 | * @param v_phi [input] \f$\phi\f$-component of the vector |
| 1841 | * @param v_x [output] x-component of the vector |
| 1842 | */ |
| 1843 | virtual void comp_x_from_spherical(const Scalar& v_r, const Scalar& v_theta, |
| 1844 | const Scalar& v_phi, Scalar& v_x) const ; |
| 1845 | |
| 1846 | /// \c Cmp version |
| 1847 | virtual void comp_x_from_spherical(const Cmp& v_r, const Cmp& v_theta, |
| 1848 | const Cmp& v_phi, Cmp& v_x) const ; |
| 1849 | |
| 1850 | /** Computes the Cartesian y component (with respect to |
| 1851 | * \c bvect_cart ) of a vector given |
| 1852 | * by its spherical components with respect to \c bvect_spher . |
| 1853 | * |
| 1854 | * @param v_r [input] \e r -component of the vector |
| 1855 | * @param v_theta [input] \f$\theta\f$-component of the vector |
| 1856 | * @param v_phi [input] \f$\phi\f$-component of the vector |
| 1857 | * @param v_y [output] y-component of the vector |
| 1858 | */ |
| 1859 | virtual void comp_y_from_spherical(const Scalar& v_r, const Scalar& v_theta, |
| 1860 | const Scalar& v_phi, Scalar& v_y) const ; |
| 1861 | |
| 1862 | /// \c Cmp version |
| 1863 | virtual void comp_y_from_spherical(const Cmp& v_r, const Cmp& v_theta, |
| 1864 | const Cmp& v_phi, Cmp& v_y) const ; |
| 1865 | |
| 1866 | /** Computes the Cartesian z component (with respect to |
| 1867 | * \c bvect_cart ) of a vector given |
| 1868 | * by its spherical components with respect to \c bvect_spher . |
| 1869 | * |
| 1870 | * @param v_r [input] \e r -component of the vector |
| 1871 | * @param v_theta [input] \f$\theta\f$-component of the vector |
| 1872 | * @param v_z [output] z-component of the vector |
| 1873 | */ |
| 1874 | virtual void comp_z_from_spherical(const Scalar& v_r, const Scalar& v_theta, |
| 1875 | Scalar& v_z) const ; |
| 1876 | |
| 1877 | /// \c Cmp version |
| 1878 | virtual void comp_z_from_spherical(const Cmp& v_r, const Cmp& v_theta, |
| 1879 | Cmp& v_z) const ; |
| 1880 | |
| 1881 | /** Computes the Spherical r component (with respect to |
| 1882 | * \c bvect_spher ) of a vector given |
| 1883 | * by its cartesian components with respect to \c bvect_cart . |
| 1884 | * |
| 1885 | * @param v_x [input] x-component of the vector |
| 1886 | * @param v_y [input] y-component of the vector |
| 1887 | * @param v_z [input] z-component of the vector |
| 1888 | * @param v_r [output] \e r -component of the vector |
| 1889 | */ |
| 1890 | virtual void comp_r_from_cartesian(const Scalar& v_x, const Scalar& v_y, |
| 1891 | const Scalar& v_z, Scalar& v_r) const ; |
| 1892 | |
| 1893 | /// \c Cmp version |
| 1894 | virtual void comp_r_from_cartesian(const Cmp& v_x, const Cmp& v_y, |
| 1895 | const Cmp& v_z, Cmp& v_r) const ; |
| 1896 | |
| 1897 | /** Computes the Spherical \f$\theta\f$ component (with respect to |
| 1898 | * \c bvect_spher ) of a vector given |
| 1899 | * by its cartesian components with respect to \c bvect_cart . |
| 1900 | * |
| 1901 | * @param v_x [input] x-component of the vector |
| 1902 | * @param v_y [input] y-component of the vector |
| 1903 | * @param v_z [input] z-component of the vector |
| 1904 | * @param v_t [output] \f$\theta\f$-component of the vector |
| 1905 | */ |
| 1906 | virtual void comp_t_from_cartesian(const Scalar& v_x, const Scalar& v_y, |
| 1907 | const Scalar& v_z, Scalar& v_t) const ; |
| 1908 | |
| 1909 | /// \c Cmp version |
| 1910 | virtual void comp_t_from_cartesian(const Cmp& v_x, const Cmp& v_y, |
| 1911 | const Cmp& v_z, Cmp& v_t) const ; |
| 1912 | |
| 1913 | /** Computes the Spherical \f$\phi\f$ component (with respect to |
| 1914 | * \c bvect_spher ) of a vector given |
| 1915 | * by its cartesian components with respect to \c bvect_cart . |
| 1916 | * |
| 1917 | * @param v_x [input] x-component of the vector |
| 1918 | * @param v_y [input] y-component of the vector |
| 1919 | * @param v_p [output] \f$\phi\f$-component of the vector |
| 1920 | */ |
| 1921 | virtual void comp_p_from_cartesian(const Scalar& v_x, const Scalar& v_y, |
| 1922 | Scalar& v_p) const ; |
| 1923 | |
| 1924 | /// \c Cmp version |
| 1925 | virtual void comp_p_from_cartesian(const Cmp& v_x, const Cmp& v_y, |
| 1926 | Cmp& v_p) const ; |
| 1927 | |
| 1928 | /** |
| 1929 | * Decreases by 1 the value of \c dzpuis of a \c Scalar |
| 1930 | * and changes accordingly its values in the |
| 1931 | * compactified external domain (CED). |
| 1932 | */ |
| 1933 | virtual void dec_dzpuis(Scalar& ) const ; |
| 1934 | |
| 1935 | /** |
| 1936 | * Decreases by 2 the value of \c dzpuis of a \c Scalar |
| 1937 | * and changes accordingly its values in the |
| 1938 | * compactified external domain (CED). |
| 1939 | */ |
| 1940 | virtual void dec2_dzpuis(Scalar& ) const ; |
| 1941 | |
| 1942 | /** |
| 1943 | * Increases by 1 the value of \c dzpuis of a \c Scalar |
| 1944 | * and changes accordingly its values in the |
| 1945 | * compactified external domain (CED). |
| 1946 | */ |
| 1947 | virtual void inc_dzpuis(Scalar& ) const ; |
| 1948 | |
| 1949 | /** |
| 1950 | * Increases by 2 the value of \c dzpuis of a \c Scalar |
| 1951 | * and changes accordingly its values in the |
| 1952 | * compactified external domain (CED). |
| 1953 | */ |
| 1954 | virtual void inc2_dzpuis(Scalar& ) const ; |
| 1955 | |
| 1956 | |
| 1957 | // PDE resolution : |
| 1958 | // -------------- |
| 1959 | public: |
| 1960 | /** Resolution of the elliptic equation |
| 1961 | * \f$ a \Delta\psi + {\bf b} \cdot \nabla \psi = \sigma\f$ |
| 1962 | * in the case where the stellar interior is covered by a single domain. |
| 1963 | * |
| 1964 | * @param source [input] source \f$\sigma\f$ of the above equation |
| 1965 | * @param aa [input] factor \e a in the above equation |
| 1966 | * @param bb [input] vector \e \b b in the above equation |
| 1967 | * @param par [input/output] parameters of the iterative method of |
| 1968 | * resolution : \\ |
| 1969 | * \c par.get_int(0) : [input] maximum number of iterations \\ |
| 1970 | * \c par.get_double(0) : [input] required precision: the iterative |
| 1971 | * method is stopped as soon as the relative difference between |
| 1972 | * \f$\psi^J\f$ and \f$\psi^{J-1}\f$ is greater than |
| 1973 | * \c par.get_double(0) \\ |
| 1974 | * \c par.get_double(1) : [input] relaxation parameter \f$\lambda\f$ \\ |
| 1975 | * \c par.get_int_mod(0) : [output] number of iterations |
| 1976 | * actually used to get the solution. |
| 1977 | * @param psi [input/output]: input : previously computed value of \f$\psi\f$ |
| 1978 | * to start the iteration (if nothing is known a priori, |
| 1979 | * \c psi must be set to zero); |
| 1980 | * output: solution \f$\psi\f$ which satisfies \f$\psi(0)=0\f$. |
| 1981 | */ |
| 1982 | virtual void poisson_compact(const Cmp& source, const Cmp& aa, |
| 1983 | const Tenseur& bb, const Param& par, |
| 1984 | Cmp& psi) const ; |
| 1985 | |
| 1986 | /** Resolution of the elliptic equation |
| 1987 | * \f$ a \Delta\psi + {\bf b} \cdot \nabla \psi = \sigma\f$ |
| 1988 | * in the case of a multidomain stellar interior. |
| 1989 | * |
| 1990 | * @param nzet [input] number of domains covering the stellar interior |
| 1991 | * @param source [input] source \f$\sigma\f$ of the above equation |
| 1992 | * @param aa [input] factor \e a in the above equation |
| 1993 | * @param bb [input] vector \e \b b in the above equation |
| 1994 | * @param par [input/output] possible parameters to control the |
| 1995 | * resolution of the equation. See the actual implementation |
| 1996 | * in the derived class of \c Map for documentation. |
| 1997 | * @param psi [input/output] solution \f$\psi\f$ which satisfies |
| 1998 | * \f$\psi(0)=0\f$. |
| 1999 | */ |
| 2000 | virtual void poisson_compact(int nzet, const Cmp& source, const Cmp& aa, |
| 2001 | const Tenseur& bb, const Param& par, |
| 2002 | Cmp& psi) const ; |
| 2003 | |
| 2004 | }; |
| 2005 | |
| 2006 | |
| 2007 | //------------------------------------// |
| 2008 | // class Map_af // |
| 2009 | //------------------------------------// |
| 2010 | |
| 2011 | |
| 2012 | |
| 2013 | /** |
| 2014 | * Affine radial mapping. \ingroup (map) |
| 2015 | * |
| 2016 | * The affine radial mapping is the simplest one between the grid coordinates |
| 2017 | * \f$(\xi, \theta', \phi')\f$ and the physical coordinates \f$(r, \theta, \phi)\f$. |
| 2018 | * It is defined by \f$\theta=\theta'\f$, \f$\phi=\phi'\f$ and |
| 2019 | * \li \f$r=\alpha \xi + \beta\f$, in non-compactified domains, |
| 2020 | * \li \f$ u={1\over r} = \alpha \xi + \beta\f$ in the (usually outermost) compactified |
| 2021 | * domain, |
| 2022 | * where \f$\alpha\f$ and \f$\beta\f$ are constant in each domain. |
| 2023 | * |
| 2024 | * |
| 2025 | */ |
| 2026 | |
| 2027 | class Map_af : public Map_radial { |
| 2028 | |
| 2029 | // Data : |
| 2030 | // ---- |
| 2031 | private: |
| 2032 | /// Array (size: \c mg->nzone ) of the values of \f$\alpha\f$ in each domain |
| 2033 | double* alpha ; |
| 2034 | /// Array (size: \c mg->nzone ) of the values of \f$\beta\f$ in each domain |
| 2035 | double* beta ; |
| 2036 | |
| 2037 | // Constructors, destructor : |
| 2038 | // ------------------------ |
| 2039 | public: |
| 2040 | /** |
| 2041 | * Standard Constructor |
| 2042 | * @param mgrille [input] Multi-domain grid on which the mapping is defined |
| 2043 | * @param r_limits [input] Array (size: number of domains + 1) of the |
| 2044 | * value of \e r at the boundaries of the various |
| 2045 | * domains : |
| 2046 | * \li \c r_limits[l] : inner boundary of the |
| 2047 | * domain no. \c l |
| 2048 | * \li \c r_limits[l+1] : outer boundary of the |
| 2049 | * domain no. \c l |
| 2050 | */ |
| 2051 | Map_af(const Mg3d& mgrille, const double* r_limits) ; |
| 2052 | /** |
| 2053 | * Standard Constructor with Tbl |
| 2054 | * @param mgrille [input] Multi-domain grid on which the mapping is defined |
| 2055 | * @param r_limits [input] Array (size: number of domains) of the |
| 2056 | * value of \e r at the boundaries of the various |
| 2057 | * domains : |
| 2058 | * \li \c r_limits[l] : inner boundary of the |
| 2059 | * domain no. \c l |
| 2060 | * \li \c r_limits[l+1] : outer boundary of the |
| 2061 | * domain no. \c l except in the last domain |
| 2062 | * The last boundary is set to inifnity if the grid contains a compactified domain. |
| 2063 | */ |
| 2064 | Map_af(const Mg3d& mgrille, const Tbl& r_limits) ; |
| 2065 | |
| 2066 | Map_af(const Map_af& ) ; ///< Copy constructor |
| 2067 | Map_af(const Mg3d&, FILE* ) ; ///< Constructor from a file (see \c sauve(FILE*) ) |
| 2068 | |
| 2069 | /** Constructor from a general mapping. |
| 2070 | * |
| 2071 | * If the input mapping belongs to the class \c Map_af , this |
| 2072 | * constructor does the same job as the copy constructor |
| 2073 | * \c Map_af(const \c Map_af& \c ) . |
| 2074 | * |
| 2075 | * If the input mapping belongs to the class \c Map_et , this |
| 2076 | * constructor sets in each domain, the values of |
| 2077 | * \f$\alpha\f$ and \f$\beta\f$ to those of the \c Map_et . |
| 2078 | * |
| 2079 | */ |
| 2080 | explicit Map_af(const Map& ) ; |
| 2081 | |
| 2082 | virtual ~Map_af() ; ///< Destructor |
| 2083 | |
| 2084 | // Assignment |
| 2085 | // ---------- |
| 2086 | public: |
| 2087 | /// Assignment to another affine mapping. |
| 2088 | virtual void operator=(const Map_af& ) ; |
| 2089 | |
| 2090 | // Memory management |
| 2091 | // ----------------- |
| 2092 | private: |
| 2093 | /// Assignment of the building functions to the member \c Coords |
| 2094 | void set_coord() ; |
| 2095 | |
| 2096 | // Extraction of information |
| 2097 | // ------------------------- |
| 2098 | public: |
| 2099 | /// Returns the pointer on the array \c alpha |
| 2100 | const double* get_alpha() const ; |
| 2101 | |
| 2102 | /// Returns the pointer on the array \c beta |
| 2103 | const double* get_beta() const ; |
| 2104 | |
| 2105 | /** Returns the "angular" mapping for the outside of domain \c l_zone. |
| 2106 | * Valid only for the class \c Map_af. |
| 2107 | */ |
| 2108 | virtual const Map_af& mp_angu(int) const ; |
| 2109 | |
| 2110 | /** |
| 2111 | * Returns the value of the radial coordinate \e r for a given |
| 2112 | * \f$(\xi, \theta', \phi')\f$ in a given domain. |
| 2113 | * @param l [input] index of the domain |
| 2114 | * @param xi [input] value of \f$\xi\f$ |
| 2115 | * @param theta [input] value of \f$\theta'\f$ |
| 2116 | * @param pphi [input] value of \f$\phi'\f$ |
| 2117 | * @return value of \f$r=R_l(\xi, \theta', \phi')\f$ |
| 2118 | */ |
| 2119 | virtual double val_r(int l, double xi, double theta, double pphi) const ; |
| 2120 | |
| 2121 | /** |
| 2122 | * Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 2123 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 2124 | * @param rr [input] value of \e r |
| 2125 | * @param theta [input] value of \f$\theta\f$ |
| 2126 | * @param pphi [input] value of \f$\phi\f$ |
| 2127 | * @param l [output] value of the domain index |
| 2128 | * @param xi [output] value of \f$\xi\f$ |
| 2129 | */ |
| 2130 | virtual void val_lx(double rr, double theta, double pphi, |
| 2131 | int& l, double& xi) const ; |
| 2132 | |
| 2133 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 2134 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 2135 | * @param rr [input] value of \e r |
| 2136 | * @param theta [input] value of \f$\theta\f$ |
| 2137 | * @param pphi [input] value of \f$\phi\f$ |
| 2138 | * @param par [] unused by the \c Map_af version |
| 2139 | * @param l [output] value of the domain index |
| 2140 | * @param xi [output] value of \f$\xi\f$ |
| 2141 | */ |
| 2142 | virtual void val_lx(double rr, double theta, double pphi, |
| 2143 | const Param& par, int& l, double& xi) const ; |
| 2144 | |
| 2145 | /** Returns the value of the radial coordinate \e r for a given |
| 2146 | * \f$\xi\f$ and a given collocation point in \f$(\theta', \phi')\f$ |
| 2147 | * in a given domain. |
| 2148 | * @param l [input] index of the domain |
| 2149 | * @param xi [input] value of \f$\xi\f$ |
| 2150 | * @param j [input] index of the collocation point in \f$\theta'\f$ |
| 2151 | * @param k [input] index of the collocation point in \f$\phi'\f$ |
| 2152 | * @return value of \f$r=R_l(\xi, {\theta'}_j, {\phi'}_k)\f$ |
| 2153 | */ |
| 2154 | virtual double val_r_jk(int l, double xi, int j, int k) const ; |
| 2155 | |
| 2156 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 2157 | * to a point of arbitrary \e r but collocation values of \f$(\theta, \phi)\f$ |
| 2158 | * @param rr [input] value of \e r |
| 2159 | * @param j [input] index of the collocation point in \f$\theta\f$ |
| 2160 | * @param k [input] index of the collocation point in \f$\phi\f$ |
| 2161 | * @param par [] unused by the \c Map_af version |
| 2162 | * @param l [output] value of the domain index |
| 2163 | * @param xi [output] value of \f$\xi\f$ |
| 2164 | */ |
| 2165 | virtual void val_lx_jk(double rr, int j, int k, const Param& par, |
| 2166 | int& l, double& xi) const ; |
| 2167 | |
| 2168 | /// Comparison operator (egality) |
| 2169 | virtual bool operator==(const Map& ) const ; |
| 2170 | |
| 2171 | |
| 2172 | // Outputs |
| 2173 | // ------- |
| 2174 | public: |
| 2175 | virtual void sauve(FILE* ) const ; ///< Save in a file |
| 2176 | |
| 2177 | private: |
| 2178 | virtual ostream& operator>>(ostream &) const ; ///< Operator >> |
| 2179 | |
| 2180 | // Modification of the mapping |
| 2181 | // --------------------------- |
| 2182 | public: |
| 2183 | /** Sets a new radial scale. |
| 2184 | * @param lambda [input] factor by which the value of \e r is to |
| 2185 | * be multiplied |
| 2186 | */ |
| 2187 | virtual void homothetie(double lambda) ; |
| 2188 | |
| 2189 | /** Rescales the outer boundary of one domain. |
| 2190 | * The inner boundary is unchanged. The inner boundary |
| 2191 | * of the next domain is changed to match the new outer |
| 2192 | * boundary. |
| 2193 | * @param l [input] index of the domain |
| 2194 | * @param lambda [input] factor by which the value of |
| 2195 | * \f$R(\theta, \varphi)\f$ defining the outer boundary |
| 2196 | * of the domain is to be multiplied. |
| 2197 | */ |
| 2198 | virtual void resize(int l, double lambda) ; |
| 2199 | |
| 2200 | /** Sets a new radial scale at the bondary between the nucleus and the |
| 2201 | * first shell. |
| 2202 | * @param lambda [input] factor by which the value of \e r is to |
| 2203 | * be multiplied |
| 2204 | */ |
| 2205 | void homothetie_interne(double lambda) ; |
| 2206 | |
| 2207 | /** Adaptation of the mapping to a given scalar field. |
| 2208 | */ |
| 2209 | virtual void adapt(const Cmp& ent, const Param& par, int nbr=0) ; |
| 2210 | |
| 2211 | /// Modifies the value of \f$\alpha\f$ in domain no. \e l |
| 2212 | void set_alpha(double alpha0, int l) ; |
| 2213 | |
| 2214 | /// Modifies the value of \f$\beta\f$ in domain no. \e l |
| 2215 | void set_beta(double beta0, int l) ; |
| 2216 | |
| 2217 | // Differential operators: |
| 2218 | // ---------------------- |
| 2219 | public: |
| 2220 | /** Computes \f$\partial/ \partial \xi\f$ of a \c Cmp. |
| 2221 | * Note that in the compactified external domain (CED), it computes |
| 2222 | * \f$-\partial/ \partial u = \xi^2 \partial/ \partial \xi\f$. |
| 2223 | * @param ci [input] field to consider |
| 2224 | * @param resu [output] derivative of \c ci |
| 2225 | */ |
| 2226 | virtual void dsdxi(const Cmp& ci, Cmp& resu) const ; |
| 2227 | |
| 2228 | /** Computes \f$\partial/ \partial r\f$ of a \c Cmp. |
| 2229 | * Note that in the compactified external domain (CED), it computes |
| 2230 | * \f$-\partial/ \partial u = r^2 \partial/ \partial r\f$. |
| 2231 | * @param ci [input] field to consider |
| 2232 | * @param resu [output] derivative of \c ci |
| 2233 | */ |
| 2234 | virtual void dsdr(const Cmp& ci, Cmp& resu) const ; |
| 2235 | |
| 2236 | /** Computes \f$1/r \partial/ \partial \theta\f$ of a \c Cmp. |
| 2237 | * Note that in the compactified external domain (CED), it computes |
| 2238 | * \f$1/u \partial/ \partial \theta = r \partial/ \partial \theta\f$. |
| 2239 | * @param ci [input] field to consider |
| 2240 | * @param resu [output] derivative of \c ci |
| 2241 | */ |
| 2242 | virtual void srdsdt(const Cmp& ci, Cmp& resu) const ; |
| 2243 | |
| 2244 | /** Computes \f$1/(r\sin\theta) \partial/ \partial \phi\f$ of a \c Cmp. |
| 2245 | * Note that in the compactified external domain (CED), it computes |
| 2246 | * \f$1/(u\sin\theta) \partial/ \partial \phi = |
| 2247 | * r/\sin\theta \partial/ \partial \phi\f$. |
| 2248 | * @param ci [input] field to consider |
| 2249 | * @param resu [output] derivative of \c ci |
| 2250 | */ |
| 2251 | virtual void srstdsdp(const Cmp& ci, Cmp& resu) const ; |
| 2252 | |
| 2253 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar. |
| 2254 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 2255 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 2256 | * is increased by 1 in other cases. |
| 2257 | * @param uu [input] field to consider |
| 2258 | * @param resu [output] derivative of \c uu |
| 2259 | */ |
| 2260 | virtual void dsdr(const Scalar& uu, Scalar& resu) const ; |
| 2261 | |
| 2262 | /** Computes \f$\partial/ \partial \xi\f$ of a \c Scalar. |
| 2263 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 2264 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 2265 | * is increased by 1 in other cases. |
| 2266 | * @param uu [input] field to consider |
| 2267 | * @param resu [output] derivative of \c uu |
| 2268 | */ |
| 2269 | virtual void dsdxi(const Scalar& uu, Scalar& resu) const ; |
| 2270 | |
| 2271 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar. |
| 2272 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 2273 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 2274 | * is increased by 1 in other cases. |
| 2275 | * @param uu [input] field to consider |
| 2276 | * @param resu [output] derivative of \c uu |
| 2277 | */ |
| 2278 | virtual void dsdradial(const Scalar&, Scalar&) const ; |
| 2279 | |
| 2280 | /** Computes \f$1/r \partial/ \partial \theta\f$ of a \c Scalar. |
| 2281 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 2282 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 2283 | * is increased by 1 in other cases. |
| 2284 | * @param uu [input] field to consider |
| 2285 | * @param resu [output] derivative of \c uu |
| 2286 | */ |
| 2287 | virtual void srdsdt(const Scalar& uu, Scalar& resu) const ; |
| 2288 | |
| 2289 | /** Computes \f$1/(r\sin\theta) \partial/ \partial \phi\f$ of a \c Scalar. |
| 2290 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 2291 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 2292 | * is increased by 1 in other cases. |
| 2293 | * @param uu [input] field to consider |
| 2294 | * @param resu [output] derivative of \c uu |
| 2295 | */ |
| 2296 | virtual void srstdsdp(const Scalar& uu, Scalar& resu) const ; |
| 2297 | |
| 2298 | /** Computes \f$\partial/ \partial \theta\f$ of a \c Scalar. |
| 2299 | * @param uu [input] scalar field |
| 2300 | * @param resu [output] derivative of \c uu |
| 2301 | */ |
| 2302 | virtual void dsdt(const Scalar& uu, Scalar& resu) const ; |
| 2303 | |
| 2304 | /** Computes \f$1/\sin\theta \partial/ \partial \varphi\f$ of a \c Scalar. |
| 2305 | * @param uu [input] scalar field |
| 2306 | * @param resu [output] derivative of \c uu |
| 2307 | */ |
| 2308 | virtual void stdsdp(const Scalar& uu, Scalar& resu) const ; |
| 2309 | |
| 2310 | /** Computes the Laplacian of a scalar field. |
| 2311 | * @param uu [input] Scalar field \e u (represented as a \c Scalar ) |
| 2312 | * the Laplacian \f$\Delta u\f$ of which is to be computed |
| 2313 | * @param zec_mult_r [input] Determines the quantity computed in |
| 2314 | * the compactified external domain (CED) : \\ |
| 2315 | * zec_mult_r = 0 : \f$\Delta u\f$ \\ |
| 2316 | * zec_mult_r = 2 : \f$r^2 \, \Delta u\f$ \\ |
| 2317 | * zec_mult_r = 4 (default) : \f$r^4 \, \Delta u\f$ |
| 2318 | * @param lap [output] Laplacian of \e u |
| 2319 | */ |
| 2320 | virtual void laplacien(const Scalar& uu, int zec_mult_r, |
| 2321 | Scalar& lap) const ; |
| 2322 | |
| 2323 | /// Computes the Laplacian of a scalar field (\c Cmp version). |
| 2324 | virtual void laplacien(const Cmp& uu, int zec_mult_r, |
| 2325 | Cmp& lap) const ; |
| 2326 | |
| 2327 | /** Computes the angular Laplacian of a scalar field. |
| 2328 | * @param uu [input] Scalar field \e u (represented as a \c Scalar) |
| 2329 | * the Laplacian \f$\Delta u\f$ of which is to be computed |
| 2330 | * @param lap [output] Angular Laplacian of \e u (see documentation |
| 2331 | * of \c Scalar |
| 2332 | */ |
| 2333 | virtual void lapang(const Scalar& uu, Scalar& lap) const ; |
| 2334 | |
| 2335 | |
| 2336 | /** Computes the radial primitive which vanishes for \f$r\to \infty\f$. |
| 2337 | * i.e. the function |
| 2338 | * \f$ F(r,\theta,\varphi) = \int_r^\infty f(r',\theta,\varphi) \, dr' \f$ |
| 2339 | * |
| 2340 | * @param uu [input] function \e f (must have a \c dzpuis = 2) |
| 2341 | * @param resu [input] function \e F |
| 2342 | * @param null_infty if true (default), the primitive is null |
| 2343 | * at infinity (or on the grid boundary). \e F is null at the |
| 2344 | * center otherwise |
| 2345 | */ |
| 2346 | virtual void primr(const Scalar& uu, Scalar& resu, |
| 2347 | bool null_infty) const ; |
| 2348 | |
| 2349 | |
| 2350 | /** Computes the integral over all space of a \c Cmp. |
| 2351 | * The computed quantity is |
| 2352 | * \f$\int u \, r^2 \sin\theta \, dr\, d\theta \, d\phi\f$. |
| 2353 | * The routine allocates a \c Tbl (size: \c mg->nzone ) to store |
| 2354 | * the result (partial integral) in each domain and returns a pointer |
| 2355 | * to it. |
| 2356 | */ |
| 2357 | virtual Tbl* integrale(const Cmp&) const ; |
| 2358 | |
| 2359 | |
| 2360 | // PDE resolution : |
| 2361 | // -------------- |
| 2362 | public: |
| 2363 | /** Computes the solution of a scalar Poisson equation. |
| 2364 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 2365 | * \f$\Delta u = \sigma\f$. |
| 2366 | * @param par [] not used by this \c Map_af version. |
| 2367 | * @param uu [output] solution \e u with the boundary condition |
| 2368 | * \e u =0 at spatial infinity. |
| 2369 | */ |
| 2370 | virtual void poisson(const Cmp& source, Param& par, Cmp& uu) const ; |
| 2371 | |
| 2372 | /** Computes the solution of a scalar Poisson equation using a Tau method. |
| 2373 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 2374 | * \f$\Delta u = \sigma\f$. |
| 2375 | * @param par [] not used by this \c Map_af version. |
| 2376 | * @param uu [output] solution \e u with the boundary condition |
| 2377 | * \e u =0 at spatial infinity. |
| 2378 | */ |
| 2379 | virtual void poisson_tau(const Cmp& source, Param& par, Cmp& uu) const ; |
| 2380 | |
| 2381 | virtual void poisson_falloff(const Cmp& source, Param& par, Cmp& uu, |
| 2382 | int k_falloff) const ; |
| 2383 | |
| 2384 | virtual void poisson_ylm(const Cmp& source, Param& par, Cmp& pot, |
| 2385 | int nylm, double* intvec) const ; |
| 2386 | |
| 2387 | /** Computes the solution of a scalar Poisson equation. |
| 2388 | * The regularized source |
| 2389 | * \f$\sigma_{\rm regu} = \sigma - \sigma_{\rm div}\f$ |
| 2390 | * is constructed and solved. |
| 2391 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 2392 | * \f$\Delta u = \sigma\f$. |
| 2393 | * @param k_div [input] regularization degree of the procedure |
| 2394 | * @param nzet [input] number of domains covering the star |
| 2395 | * @param unsgam1 [input] parameter \f$1/(\gamma-1)\f$ where \f$\gamma\f$ |
| 2396 | * denotes the adiabatic index. |
| 2397 | * @param par [] not used by this \c Map_af version. |
| 2398 | * @param uu [output] solution \e u with the boundary condition |
| 2399 | * \e u =0 at spatial infinity. |
| 2400 | * @param uu_regu [output] solution of the regular part of |
| 2401 | * the source. |
| 2402 | * @param uu_div [output] solution of the diverging part of |
| 2403 | * the source. |
| 2404 | * @param duu_div [output] derivative of the diverging potential |
| 2405 | * @param source_regu [output] regularized source |
| 2406 | * @param source_div [output] diverging part of the source |
| 2407 | */ |
| 2408 | virtual void poisson_regular(const Cmp& source, int k_div, int nzet, |
| 2409 | double unsgam1, Param& par, Cmp& uu, |
| 2410 | Cmp& uu_regu, Cmp& uu_div, |
| 2411 | Tenseur& duu_div, Cmp& source_regu, |
| 2412 | Cmp& source_div) const ; |
| 2413 | |
| 2414 | /** Computes the solution of the generalized angular Poisson equation. |
| 2415 | * The generalized angular Poisson equation is |
| 2416 | * \f$\Delta_{\theta\varphi} u + \lambda u = \sigma\f$, |
| 2417 | * where \f$\Delta_{\theta\varphi} u := \frac{\partial^2 u} |
| 2418 | * {\partial \theta^2} + \frac{1}{\tan \theta} \frac{\partial u} |
| 2419 | * {\partial \theta} +\frac{1}{\sin^2 \theta}\frac{\partial^2 u} |
| 2420 | * {\partial \varphi^2}\f$. |
| 2421 | * |
| 2422 | * @param source [input] source \f$\sigma\f$ of the equation |
| 2423 | * \f$\Delta_{\theta\varphi} u + \lambda u = \sigma\f$. |
| 2424 | * @param par [input/output] possible parameters to control the |
| 2425 | * resolution of the Poisson equation. See the actual implementation |
| 2426 | * in the derived class of \c Map for documentation. |
| 2427 | * @param uu [input/output] solution \e u |
| 2428 | * @param lambda [input] coefficient \f$\lambda\f$ in the above equation |
| 2429 | * (default value = 0) |
| 2430 | */ |
| 2431 | virtual void poisson_angu(const Scalar& source, Param& par, |
| 2432 | Scalar& uu, double lambda=0) const ; |
| 2433 | |
| 2434 | /** |
| 2435 | * Internal function intended to be used by \c Map::poisson_vect |
| 2436 | * and \c Map::poisson_vect_oohara . It constructs the sets of |
| 2437 | * parameters used for each scalar Poisson equation from the one for |
| 2438 | * the vectorial one. |
| 2439 | * |
| 2440 | * In the case of a \c Map_af the result is not used and the function |
| 2441 | * only returns \c & \c par . |
| 2442 | */ |
| 2443 | virtual Param* donne_para_poisson_vect (Param& par, int i) const ; |
| 2444 | |
| 2445 | /** |
| 2446 | * Solver of the Poisson equation with boundary condition for the |
| 2447 | * affine mapping case. |
| 2448 | */ |
| 2449 | virtual void poisson_frontiere (const Cmp&, const Valeur&, int, int, Cmp&, double = 0., double = 0.) const ; |
| 2450 | |
| 2451 | /** |
| 2452 | * Solver of the Poisson equation with boundary condition for the |
| 2453 | * affine mapping case, cases with boundary conditions of both |
| 2454 | * Dirichlet and Neumann type (no condition imposed at infinity). |
| 2455 | */ |
| 2456 | virtual void poisson_frontiere_double (const Cmp& source, const Valeur& lim_func, |
| 2457 | const Valeur& lim_der, int num_zone, Cmp& pot) const ; |
| 2458 | |
| 2459 | /** |
| 2460 | * Computes the solution of a Poisson equation in the shell, |
| 2461 | * imposing a boundary condition at the surface of the star |
| 2462 | * |
| 2463 | * @param source [input] : source of the equation. |
| 2464 | * @param limite [input] : \c limite[num_front] contains the angular |
| 2465 | * function being the boudary condition. |
| 2466 | * @param par [input] : parameters of the computation. |
| 2467 | * @param pot [output] : result. |
| 2468 | */ |
| 2469 | virtual void poisson_interne (const Cmp& source, const Valeur& limite, |
| 2470 | Param& par, Cmp& pot) const ; |
| 2471 | |
| 2472 | /** |
| 2473 | * Performs the surface integration of \c ci on the sphere of |
| 2474 | * radius \c rayon . |
| 2475 | */ |
| 2476 | double integrale_surface (const Cmp& ci, double rayon) const ; |
| 2477 | |
| 2478 | /** |
| 2479 | * Performs the surface integration of \c ci on the sphere of |
| 2480 | * radius \c rayon . |
| 2481 | */ |
| 2482 | double integrale_surface (const Scalar& ci, double rayon) const ; |
| 2483 | |
| 2484 | double integrale_surface_falloff (const Cmp& ci) const ; |
| 2485 | |
| 2486 | /** |
| 2487 | * Performs the surface integration of \c ci at infinity. |
| 2488 | * \c ci must have \c dzpuis =2. |
| 2489 | */ |
| 2490 | double integrale_surface_infini (const Cmp& ci) const ; |
| 2491 | |
| 2492 | /** |
| 2493 | * Performs the surface integration of \c ci at infinity. |
| 2494 | * \c ci must have \c dzpuis =2. |
| 2495 | */ |
| 2496 | double integrale_surface_infini (const Scalar& ci) const ; |
| 2497 | |
| 2498 | /** |
| 2499 | * General elliptic solver. The field is zero at infinity. |
| 2500 | * |
| 2501 | * @param params [input] : the operators and variables to be uses. |
| 2502 | * @param so [input] : the source. |
| 2503 | * @param uu [output] : the solution. |
| 2504 | **/ |
| 2505 | void sol_elliptic (Param_elliptic& params, |
| 2506 | const Scalar& so, Scalar& uu) const ; |
| 2507 | |
| 2508 | |
| 2509 | /** |
| 2510 | * General elliptic solver including inner boundary conditions. |
| 2511 | * The field is zero at infinity. |
| 2512 | * |
| 2513 | * @param params [input] : the operators and variables to be uses. |
| 2514 | * @param so [input] : the source. |
| 2515 | * @param uu [output] : the solution. |
| 2516 | * @param bound [input] : the boundary condition |
| 2517 | * @param fact_dir : 1 Dirchlet condition, 0 Neumann condition |
| 2518 | * @param fact_neu : 0 Dirchlet condition, 1 Neumann condition |
| 2519 | **/ |
| 2520 | void sol_elliptic_boundary (Param_elliptic& params, |
| 2521 | const Scalar& so, Scalar& uu, const Mtbl_cf& bound, |
| 2522 | double fact_dir, double fact_neu ) const ; |
| 2523 | |
| 2524 | /** |
| 2525 | * General elliptic solver including inner boundary conditions, with |
| 2526 | * boundary given as a Scalar on mono-domain angular grid |
| 2527 | **/ |
| 2528 | void sol_elliptic_boundary (Param_elliptic& params, |
| 2529 | const Scalar& so, Scalar& uu, const Scalar& bound, |
| 2530 | double fact_dir, double fact_neu ) const ; |
| 2531 | |
| 2532 | /** |
| 2533 | * General elliptic solver. |
| 2534 | * The equation is not solved in the compactified domain. |
| 2535 | * |
| 2536 | * @param params [input] : the operators and variables to be uses. |
| 2537 | * @param so [input] : the source. |
| 2538 | * @param uu [output] : the solution. |
| 2539 | * @param val [input] : value at the last shell. |
| 2540 | **/ |
| 2541 | void sol_elliptic_no_zec (Param_elliptic& params, |
| 2542 | const Scalar& so, Scalar& uu, double val) const ; |
| 2543 | |
| 2544 | /** |
| 2545 | * General elliptic solver. |
| 2546 | * The equation is solved only in the compactified domain. |
| 2547 | * |
| 2548 | * @param params [input] : the operators and variables to be uses. |
| 2549 | * @param so [input] : the source. |
| 2550 | * @param uu [output] : the solution. |
| 2551 | * @param val [input] : value at the inner boundary. |
| 2552 | **/ |
| 2553 | void sol_elliptic_only_zec (Param_elliptic& params, |
| 2554 | const Scalar& so, Scalar& uu, double val) const ; |
| 2555 | |
| 2556 | /** |
| 2557 | * General elliptic solver. |
| 2558 | * The equation is not solved in the compactified domain and the |
| 2559 | * matching is done with an homogeneous solution. |
| 2560 | **/ |
| 2561 | void sol_elliptic_sin_zec (Param_elliptic& params, |
| 2562 | const Scalar& so, Scalar& uu, |
| 2563 | double* coefs, double*) const ; |
| 2564 | /** |
| 2565 | * General elliptic solver fixing the derivative at the origin |
| 2566 | * and relaxing the continuity of the first derivative at the |
| 2567 | * boundary between the nucleus and the first shell. |
| 2568 | * |
| 2569 | * @param val [input] : valeur of the derivative. |
| 2570 | * @param params [input] : the operators and variables to be uses. |
| 2571 | * @param so [input] : the source. |
| 2572 | * @param uu [output] : the solution. |
| 2573 | **/ |
| 2574 | void sol_elliptic_fixe_der_zero (double val, |
| 2575 | Param_elliptic& params, |
| 2576 | const Scalar& so, Scalar& uu) const ; |
| 2577 | |
| 2578 | /** Computes the solution of a 2-D Poisson equation. |
| 2579 | * The 2-D Poisson equation writes |
| 2580 | * \f[ |
| 2581 | * {\partial^2 u\over\partial r^2} + |
| 2582 | * {1\over r} {\partial u \over \partial r} + |
| 2583 | * {1\over r^2} {\partial^2 u\over\partial \theta^2} = |
| 2584 | * \sigma \ . |
| 2585 | * \f] |
| 2586 | * |
| 2587 | * @param source_mat [input] Compactly supported part of |
| 2588 | * the source \f$\sigma\f$ of the 2-D Poisson equation (typically |
| 2589 | * matter terms) |
| 2590 | * @param source_quad [input] Non-compactly supported part of |
| 2591 | * the source \f$\sigma\f$ of the 2-D Poisson equation (typically |
| 2592 | * quadratic terms) |
| 2593 | * @param par [output] Parameter which contains the constant |
| 2594 | * \f$\lambda\f$ used to fulfill the virial |
| 2595 | * identity GRV2 : \\ |
| 2596 | * \c par.get_double_mod(0) : [output] constant \c lambda |
| 2597 | * such that the source of the equation effectively solved |
| 2598 | * is \c source_mat + \c lambda * \c source_quad . |
| 2599 | * @param uu [input/output] solution \e u with the boundary condition |
| 2600 | * \e u =0 at spatial infinity. |
| 2601 | */ |
| 2602 | virtual void poisson2d(const Cmp& source_mat, const Cmp& source_quad, |
| 2603 | Param& par, Cmp& uu) const ; |
| 2604 | /** |
| 2605 | * General elliptic solver in a 2D case. The field is zero at infinity. |
| 2606 | * |
| 2607 | * @param params [input] : the operators and variables to be uses. |
| 2608 | * @param so [input] : the source. |
| 2609 | * @param uu [output] : the solution. |
| 2610 | **/ |
| 2611 | void sol_elliptic_2d(Param_elliptic&, |
| 2612 | const Scalar&, Scalar&) const ; |
| 2613 | /** |
| 2614 | * General elliptic solver in a pseudo 1d case. The field is zero at infinity. |
| 2615 | * |
| 2616 | * @param params [input] : the operators and variables to be uses. |
| 2617 | * @param so [input] : the source. |
| 2618 | * @param uu [output] : the solution. |
| 2619 | **/ |
| 2620 | void sol_elliptic_pseudo_1d(Param_elliptic&, |
| 2621 | const Scalar&, Scalar&) const ; |
| 2622 | |
| 2623 | /** Performs one time-step integration of the d'Alembert scalar equation |
| 2624 | * @param par [input/output] possible parameters to control the |
| 2625 | * resolution of the d'Alembert equation: \\ |
| 2626 | * \c par.get_double(0) : [input] the time step \e dt ,\\ |
| 2627 | * \c par.get_int(0) : [input] the type of boundary conditions |
| 2628 | * set at the outer boundary (0 : reflexion, 1 : Sommerfeld |
| 2629 | * outgoing wave, valid only for \e l=0 components, 2 : Bayliss |
| 2630 | * & Turkel outgoing wave, valid for \e l=0, 1, 2 components)\\ |
| 2631 | * \c par.get_int_mod(0) : [input/output] set to 0 at first |
| 2632 | * call, is used as a working flag after (must not be modified after |
| 2633 | * first call)\\ |
| 2634 | * \c par.get_int(1) : [input] (optional) if present, a shift of |
| 2635 | * -1 is done in the multipolar spectrum in terms of \f$\ell\f$. |
| 2636 | * The value of this variable gives the minimal value of (the shifted) |
| 2637 | * \f$\ell\f$ for which the wave equation is solved.\\ |
| 2638 | * \c par.get_tensor_mod(0) : [input] (optional) if the wave |
| 2639 | * equation is on a curved space-time, this is the potential in front |
| 2640 | * of the Laplace operator. It has to be updated at every time-step |
| 2641 | * (for a potential depending on time).\\ |
| 2642 | * Note: there are many other working objects attached to this |
| 2643 | * \c Param , so one should not modify it. |
| 2644 | * @param fJp1 [output] solution \f$f^{J+1}\f$ at time \e J+1 |
| 2645 | * with boundary conditions defined by \c par.get_int(0) |
| 2646 | * @param fJ [input] solution \f$f^J\f$ at time \e J |
| 2647 | * @param fJm1 [input] solution \f$f^{J-1}\f$ at time \e J-1 |
| 2648 | * @param source [input] source \f$\sigma\f$ of the d'Alembert equation |
| 2649 | * \f$\diamond u = \sigma\f$. |
| 2650 | */ |
| 2651 | virtual void dalembert(Param& par, Scalar& fJp1, const Scalar& fJ, |
| 2652 | const Scalar& fJm1, const Scalar& source) const ; |
| 2653 | |
| 2654 | // Building functions for the Coord's |
| 2655 | // ---------------------------------- |
| 2656 | friend Mtbl* map_af_fait_r(const Map* ) ; |
| 2657 | friend Mtbl* map_af_fait_tet(const Map* ) ; |
| 2658 | friend Mtbl* map_af_fait_phi(const Map* ) ; |
| 2659 | friend Mtbl* map_af_fait_sint(const Map* ) ; |
| 2660 | friend Mtbl* map_af_fait_cost(const Map* ) ; |
| 2661 | friend Mtbl* map_af_fait_sinp(const Map* ) ; |
| 2662 | friend Mtbl* map_af_fait_cosp(const Map* ) ; |
| 2663 | |
| 2664 | friend Mtbl* map_af_fait_x(const Map* ) ; |
| 2665 | friend Mtbl* map_af_fait_y(const Map* ) ; |
| 2666 | friend Mtbl* map_af_fait_z(const Map* ) ; |
| 2667 | |
| 2668 | friend Mtbl* map_af_fait_xa(const Map* ) ; |
| 2669 | friend Mtbl* map_af_fait_ya(const Map* ) ; |
| 2670 | friend Mtbl* map_af_fait_za(const Map* ) ; |
| 2671 | |
| 2672 | friend Mtbl* map_af_fait_xsr(const Map* ) ; |
| 2673 | friend Mtbl* map_af_fait_dxdr(const Map* ) ; |
| 2674 | friend Mtbl* map_af_fait_drdt(const Map* ) ; |
| 2675 | friend Mtbl* map_af_fait_stdrdp(const Map* ) ; |
| 2676 | friend Mtbl* map_af_fait_srdrdt(const Map* ) ; |
| 2677 | friend Mtbl* map_af_fait_srstdrdp(const Map* ) ; |
| 2678 | friend Mtbl* map_af_fait_sr2drdt(const Map* ) ; |
| 2679 | friend Mtbl* map_af_fait_sr2stdrdp(const Map* ) ; |
| 2680 | friend Mtbl* map_af_fait_d2rdx2(const Map* ) ; |
| 2681 | friend Mtbl* map_af_fait_lapr_tp(const Map* ) ; |
| 2682 | friend Mtbl* map_af_fait_d2rdtdx(const Map* ) ; |
| 2683 | friend Mtbl* map_af_fait_sstd2rdpdx(const Map* ) ; |
| 2684 | friend Mtbl* map_af_fait_sr2d2rdt2(const Map* ) ; |
| 2685 | |
| 2686 | }; |
| 2687 | |
| 2688 | Mtbl* map_af_fait_r(const Map* ) ; |
| 2689 | Mtbl* map_af_fait_tet(const Map* ) ; |
| 2690 | Mtbl* map_af_fait_phi(const Map* ) ; |
| 2691 | Mtbl* map_af_fait_sint(const Map* ) ; |
| 2692 | Mtbl* map_af_fait_cost(const Map* ) ; |
| 2693 | Mtbl* map_af_fait_sinp(const Map* ) ; |
| 2694 | Mtbl* map_af_fait_cosp(const Map* ) ; |
| 2695 | |
| 2696 | Mtbl* map_af_fait_x(const Map* ) ; |
| 2697 | Mtbl* map_af_fait_y(const Map* ) ; |
| 2698 | Mtbl* map_af_fait_z(const Map* ) ; |
| 2699 | |
| 2700 | Mtbl* map_af_fait_xa(const Map* ) ; |
| 2701 | Mtbl* map_af_fait_ya(const Map* ) ; |
| 2702 | Mtbl* map_af_fait_za(const Map* ) ; |
| 2703 | |
| 2704 | Mtbl* map_af_fait_xsr(const Map* ) ; |
| 2705 | Mtbl* map_af_fait_dxdr(const Map* ) ; |
| 2706 | Mtbl* map_af_fait_drdt(const Map* ) ; |
| 2707 | Mtbl* map_af_fait_stdrdp(const Map* ) ; |
| 2708 | Mtbl* map_af_fait_srdrdt(const Map* ) ; |
| 2709 | Mtbl* map_af_fait_srstdrdp(const Map* ) ; |
| 2710 | Mtbl* map_af_fait_sr2drdt(const Map* ) ; |
| 2711 | Mtbl* map_af_fait_sr2stdrdp(const Map* ) ; |
| 2712 | Mtbl* map_af_fait_d2rdx2(const Map* ) ; |
| 2713 | Mtbl* map_af_fait_lapr_tp(const Map* ) ; |
| 2714 | Mtbl* map_af_fait_d2rdtdx(const Map* ) ; |
| 2715 | Mtbl* map_af_fait_sstd2rdpdx(const Map* ) ; |
| 2716 | Mtbl* map_af_fait_sr2d2rdt2(const Map* ) ; |
| 2717 | |
| 2718 | |
| 2719 | |
| 2720 | |
| 2721 | //------------------------------------// |
| 2722 | // class Map_et // |
| 2723 | //------------------------------------// |
| 2724 | |
| 2725 | |
| 2726 | |
| 2727 | /** |
| 2728 | * Radial mapping of rather general form. \ingroup (map) |
| 2729 | * |
| 2730 | * This mapping relates the grid coordinates |
| 2731 | * \f$(\xi, \theta', \phi')\f$ and the physical coordinates \f$(r, \theta, \phi)\f$ |
| 2732 | * in the following manner [see Bonazzola, Gourgoulhon & Marck, |
| 2733 | * \e Phys. \e Rev. \e D \b 58 , 104020 (1998) for details]: |
| 2734 | * \f$\theta=\theta'\f$, \f$\phi=\phi'\f$ and |
| 2735 | * \li \f$r = \alpha [\xi + A(\xi) F(\theta', \phi') + B(\xi) G(\theta', \phi')] |
| 2736 | * + \beta\f$ in non-compactified domains, |
| 2737 | * \li \f$ u={1\over r} = \alpha [\xi + A(\xi) F(\theta', \phi')] + \beta\f$ in |
| 2738 | * the (usually outermost) compactified domain, |
| 2739 | * where \f$\alpha\f$ and \f$\beta\f$ are constant in each domain, \f$A(\xi)\f$ and |
| 2740 | * \f$B(\xi)\f$ are constant polynomials defined by |
| 2741 | * \li \f$A(\xi) = 3 \xi^4 - 2 \xi^6\f$ and |
| 2742 | * \f$B(\xi) = (5\xi^3 - 3\xi^5)/2\f$ in the nucleus (innermost domain |
| 2743 | * which contains \e r =0); |
| 2744 | * \li \f$A(\xi) = (\xi^3 - 3\xi + 2)/4\f$ and |
| 2745 | * \f$B(\xi) = (-\xi^3 + 3\xi +2)/4\f$ in the other domains. |
| 2746 | * The functions \f$F(\theta', \phi')\f$ and \f$G(\theta', \phi')\f$ depend on the |
| 2747 | * domain under consideration and define the boundaries of this domain. |
| 2748 | * |
| 2749 | * |
| 2750 | */ |
| 2751 | |
| 2752 | class Map_et : public Map_radial { |
| 2753 | |
| 2754 | // Data : |
| 2755 | // ---- |
| 2756 | private: |
| 2757 | /// Array (size: \c mg->nzone ) of the values of \f$\alpha\f$ in each domain |
| 2758 | double* alpha ; |
| 2759 | /// Array (size: \c mg->nzone ) of the values of \f$\beta\f$ in each domain |
| 2760 | double* beta ; |
| 2761 | |
| 2762 | /** Array (size: \c mg->nzone ) of \c Tbl which stores the |
| 2763 | * values of \f$A(\xi)\f$ in each domain |
| 2764 | */ |
| 2765 | Tbl** aa ; |
| 2766 | |
| 2767 | /** Array (size: \c mg->nzone ) of \c Tbl which stores the |
| 2768 | * values of \f$A'(\xi)\f$ in each domain |
| 2769 | */ |
| 2770 | Tbl** daa ; |
| 2771 | |
| 2772 | /** Array (size: \c mg->nzone ) of \c Tbl which stores the |
| 2773 | * values of \f$A''(\xi)\f$ in each domain |
| 2774 | */ |
| 2775 | Tbl** ddaa ; |
| 2776 | |
| 2777 | /// Values at the \c nr collocation points of \f$A(\xi)/\xi\f$ in the nucleus |
| 2778 | Tbl aasx ; |
| 2779 | |
| 2780 | /// Values at the \c nr collocation points of \f$A(\xi)/\xi^2\f$ in the nucleus |
| 2781 | Tbl aasx2 ; |
| 2782 | |
| 2783 | /** Values at the \c nr collocation points of \f$A(\xi)/(\xi-1)\f$ |
| 2784 | * in the outermost compactified domain |
| 2785 | */ |
| 2786 | Tbl zaasx ; |
| 2787 | |
| 2788 | /** Values at the \c nr collocation points of \f$A(\xi)/(\xi-1)^2\f$ |
| 2789 | * in the outermost compactified domain |
| 2790 | */ |
| 2791 | Tbl zaasx2 ; |
| 2792 | |
| 2793 | /** Array (size: \c mg->nzone ) of \c Tbl which stores the |
| 2794 | * values of \f$B(\xi)\f$ in each domain |
| 2795 | */ |
| 2796 | Tbl** bb ; |
| 2797 | |
| 2798 | /** Array (size: \c mg->nzone ) of \c Tbl which stores the |
| 2799 | * values of \f$B'(\xi)\f$ in each domain |
| 2800 | */ |
| 2801 | Tbl** dbb ; |
| 2802 | |
| 2803 | /** Array (size: \c mg->nzone ) of \c Tbl which stores the |
| 2804 | * values of \f$B''(\xi)\f$ in each domain |
| 2805 | */ |
| 2806 | Tbl** ddbb ; |
| 2807 | |
| 2808 | /// Values at the \c nr collocation points of \f$B(\xi)/\xi\f$ in the nucleus |
| 2809 | Tbl bbsx ; |
| 2810 | |
| 2811 | /// Values at the \c nr collocation points of \f$B(\xi)/\xi^2\f$ in the nucleus |
| 2812 | Tbl bbsx2 ; |
| 2813 | |
| 2814 | /** Values of the function \f$F(\theta', \phi')\f$ at the \c nt*np |
| 2815 | * angular collocation points in each domain. |
| 2816 | * The \c Valeur \c ff is defined on the multi-grid \c mg->g_angu |
| 2817 | * (cf. class \c Mg3d ). |
| 2818 | */ |
| 2819 | Valeur ff ; |
| 2820 | |
| 2821 | /** Values of the function \f$G(\theta', \phi')\f$ at the \c nt*np |
| 2822 | * angular collocation points in each domain. |
| 2823 | * The \c Valeur \c gg is defined on the multi-grid \c mg->g_angu |
| 2824 | * (cf. class \c Mg3d ). |
| 2825 | */ |
| 2826 | Valeur gg ; |
| 2827 | |
| 2828 | public: |
| 2829 | /** \f$1/(\partial R/\partial \xi) R/\xi\f$ in the nucleus; \\ |
| 2830 | * \f$1/(\partial R/\partial \xi) R/(\xi + \beta/\alpha)\f$ in the shells; \\ |
| 2831 | * \f$1/(\partial U/\partial \xi) U/(\xi-1)\f$ in the outermost |
| 2832 | * compactified domain. |
| 2833 | */ |
| 2834 | Coord rsxdxdr ; |
| 2835 | |
| 2836 | /** \f$[ R/ (\alpha \xi + \beta) ]^2 (\partial R/\partial \xi) / \alpha\f$ |
| 2837 | * in the nucleus and the shells; \\ |
| 2838 | * \f$\partial U/\partial \xi / \alpha\f$ in the outermost compactified |
| 2839 | * domain. |
| 2840 | */ |
| 2841 | Coord rsx2drdx ; |
| 2842 | |
| 2843 | // Constructors, destructor : |
| 2844 | // ------------------------ |
| 2845 | public: |
| 2846 | /** |
| 2847 | * Standard Constructor |
| 2848 | * @param mgrille [input] Multi-domain grid on which the mapping is defined |
| 2849 | * @param r_limits [input] Array (size: number of domains + 1) of the |
| 2850 | * value of \e r at the boundaries of the various |
| 2851 | * domains : |
| 2852 | * \li \c r_limits[l] : inner boundary of the |
| 2853 | * domain no. \c l |
| 2854 | * \li \c r_limits[l+1] : outer boundary of the |
| 2855 | * domain no. \c l |
| 2856 | */ |
| 2857 | Map_et(const Mg3d& mgrille, const double* r_limits) ; |
| 2858 | |
| 2859 | /** |
| 2860 | * Constructor using the equation of the surface of the star. |
| 2861 | * @param mgrille [input] Multi-domain grid on which the mapping is defined |
| 2862 | * It must contains at least one shell. |
| 2863 | * @param r_limits [input] Array (size: number of domains + 1) of the |
| 2864 | * value of \e r at the boundaries of the various |
| 2865 | * domains : |
| 2866 | * \li \c r_limits[l] : inner boundary of the |
| 2867 | * domain no. \c l |
| 2868 | * \li \c r_limits[l+1] : outer boundary of the |
| 2869 | * domain no. \c l |
| 2870 | * The first value is not used. |
| 2871 | * @param tab [input] equation of the surface between the nucleus and the first |
| 2872 | * shell in the form : \f${\rm tab}(k,j) = r(\phi_k,\theta_j)\f$, where |
| 2873 | * \f$\phi_k\f$ and \f$\theta_j\f$ are the values of the angular colocation points. |
| 2874 | */ |
| 2875 | |
| 2876 | Map_et(const Mg3d& mgrille, const double* r_limits,const Tbl& tab); |
| 2877 | Map_et(const Map_et& ) ; ///< Copy constructor |
| 2878 | Map_et(const Mg3d&, FILE* ) ; ///< Constructor from a file (see \c sauve(FILE*) ) |
| 2879 | |
| 2880 | virtual ~Map_et() ; ///< Destructor |
| 2881 | |
| 2882 | // Assignment |
| 2883 | // ---------- |
| 2884 | public: |
| 2885 | /// Assignment to another \c Map_et |
| 2886 | virtual void operator=(const Map_et& mp) ; |
| 2887 | |
| 2888 | /// Assignment to an affine mapping. |
| 2889 | virtual void operator=(const Map_af& mpa) ; |
| 2890 | |
| 2891 | /// Assigns a given value to the function \f$F(\theta',\phi')\f$ |
| 2892 | void set_ff(const Valeur& ) ; |
| 2893 | /// Assigns a given value to the function \f$G(\theta',\phi')\f$ |
| 2894 | void set_gg(const Valeur& ) ; |
| 2895 | |
| 2896 | // Memory management |
| 2897 | // ----------------- |
| 2898 | private: |
| 2899 | /// Assignement of the building functions to the member \c Coords |
| 2900 | void set_coord() ; |
| 2901 | protected: |
| 2902 | /// Resets all the member \c Coords |
| 2903 | virtual void reset_coord() ; |
| 2904 | |
| 2905 | private: |
| 2906 | /// Construction of the polynomials \f$A(\xi)\f$ and \f$B(\xi)\f$ |
| 2907 | void fait_poly() ; |
| 2908 | |
| 2909 | // Extraction of information |
| 2910 | // ------------------------- |
| 2911 | public: |
| 2912 | /** Returns the "angular" mapping for the outside of domain \c l_zone. |
| 2913 | * Valid only for the class \c Map_af. |
| 2914 | */ |
| 2915 | virtual const Map_af& mp_angu(int) const ; |
| 2916 | |
| 2917 | /** Returns a pointer on the array \c alpha (values of \f$\alpha\f$ |
| 2918 | * in each domain) |
| 2919 | */ |
| 2920 | const double* get_alpha() const ; |
| 2921 | |
| 2922 | /** Returns a pointer on the array \c beta (values of \f$\beta\f$ |
| 2923 | * in each domain) |
| 2924 | */ |
| 2925 | const double* get_beta() const ; |
| 2926 | |
| 2927 | /// Returns a (constant) reference to the function \f$F(\theta',\phi')\f$ |
| 2928 | const Valeur& get_ff() const ; |
| 2929 | |
| 2930 | /// Returns a (constant) reference to the function \f$G(\theta',\phi')\f$ |
| 2931 | const Valeur& get_gg() const ; |
| 2932 | |
| 2933 | /** |
| 2934 | * Returns the value of the radial coordinate \e r for a given |
| 2935 | * \f$(\xi, \theta', \phi')\f$ in a given domain. |
| 2936 | * @param l [input] index of the domain |
| 2937 | * @param xi [input] value of \f$\xi\f$ |
| 2938 | * @param theta [input] value of \f$\theta'\f$ |
| 2939 | * @param pphi [input] value of \f$\phi'\f$ |
| 2940 | * @return value of \f$r=R_l(\xi, \theta', \phi')\f$ |
| 2941 | */ |
| 2942 | virtual double val_r(int l, double xi, double theta, double pphi) const ; |
| 2943 | |
| 2944 | /** |
| 2945 | * Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 2946 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 2947 | * @param rr [input] value of \e r |
| 2948 | * @param theta [input] value of \f$\theta\f$ |
| 2949 | * @param pphi [input] value of \f$\phi\f$ |
| 2950 | * @param l [output] value of the domain index |
| 2951 | * @param xi [output] value of \f$\xi\f$ |
| 2952 | */ |
| 2953 | virtual void val_lx(double rr, double theta, double pphi, |
| 2954 | int& l, double& xi) const ; |
| 2955 | |
| 2956 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 2957 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 2958 | * This version enables to pass some parameters to control the |
| 2959 | * accuracy of the computation. |
| 2960 | * @param rr [input] value of \e r |
| 2961 | * @param theta [input] value of \f$\theta\f$ |
| 2962 | * @param pphi [input] value of \f$\phi\f$ |
| 2963 | * @param par [input/output] parameters to control the |
| 2964 | * accuracy of the computation: \\ |
| 2965 | * \c par.get_int(0) : [input] maximum number of iterations in the |
| 2966 | * secant method to locate \f$\xi\f$ \\ |
| 2967 | * \c par.get_int_mod(0) : [output] effective number of iterations |
| 2968 | * used \\ |
| 2969 | * \c par.get_double(0) : [input] absolute precision in the secant |
| 2970 | * method to locate \f$\xi\f$ |
| 2971 | * @param l [output] value of the domain index |
| 2972 | * @param xi [output] value of \f$\xi\f$ |
| 2973 | */ |
| 2974 | virtual void val_lx(double rr, double theta, double pphi, |
| 2975 | const Param& par, int& l, double& xi) const ; |
| 2976 | |
| 2977 | /// Comparison operator (egality) |
| 2978 | virtual bool operator==(const Map& ) const ; |
| 2979 | |
| 2980 | /** Returns the value of the radial coordinate \e r for a given |
| 2981 | * \f$\xi\f$ and a given collocation point in \f$(\theta', \phi')\f$ |
| 2982 | * in a given domain. |
| 2983 | * @param l [input] index of the domain |
| 2984 | * @param xi [input] value of \f$\xi\f$ |
| 2985 | * @param j [input] index of the collocation point in \f$\theta'\f$ |
| 2986 | * @param k [input] index of the collocation point in \f$\phi'\f$ |
| 2987 | * @return value of \f$r=R_l(\xi, {\theta'}_j, {\phi'}_k)\f$ |
| 2988 | */ |
| 2989 | virtual double val_r_jk(int l, double xi, int j, int k) const ; |
| 2990 | |
| 2991 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 2992 | * to a point of arbitrary \e r but collocation values of \f$(\theta, \phi)\f$ |
| 2993 | * @param rr [input] value of \e r |
| 2994 | * @param j [input] index of the collocation point in \f$\theta\f$ |
| 2995 | * @param k [input] index of the collocation point in \f$\phi\f$ |
| 2996 | * @param par [input/output] parameters to control the |
| 2997 | * accuracy of the computation: \\ |
| 2998 | * \c par.get_int(0) : [input] maximum number of iterations in the |
| 2999 | * secant method to locate \f$\xi\f$ \\ |
| 3000 | * \c par.get_int_mod(0) : [output] effective number of iterations |
| 3001 | * used \\ |
| 3002 | * \c par.get_double(0) : [input] absolute precision in the secant |
| 3003 | * method to locate \f$\xi\f$ |
| 3004 | * @param l [output] value of the domain index |
| 3005 | * @param xi [output] value of \f$\xi\f$ |
| 3006 | */ |
| 3007 | virtual void val_lx_jk(double rr, int j, int k, const Param& par, |
| 3008 | int& l, double& xi) const ; |
| 3009 | |
| 3010 | |
| 3011 | |
| 3012 | // Outputs |
| 3013 | // ------- |
| 3014 | public: |
| 3015 | virtual void sauve(FILE* ) const ; ///< Save in a file |
| 3016 | |
| 3017 | private: |
| 3018 | virtual ostream& operator>>(ostream &) const ; ///< Operator >> |
| 3019 | |
| 3020 | // Modification of the radial scale |
| 3021 | // -------------------------------- |
| 3022 | public: |
| 3023 | /** Sets a new radial scale. |
| 3024 | * @param lambda [input] factor by which the value of \e r is to |
| 3025 | * be multiplied |
| 3026 | */ |
| 3027 | virtual void homothetie(double lambda) ; |
| 3028 | |
| 3029 | /** Rescales the outer boundary of one domain. |
| 3030 | * The inner boundary is unchanged. The inner boundary |
| 3031 | * of the next domain is changed to match the new outer |
| 3032 | * boundary. |
| 3033 | * @param l [input] index of the domain |
| 3034 | * @param lambda [input] factor by which the value of |
| 3035 | * \f$R(\theta, \varphi)\f$ defining the outer boundary |
| 3036 | * of the domain is to be multiplied. |
| 3037 | */ |
| 3038 | virtual void resize(int l, double lambda) ; |
| 3039 | |
| 3040 | /** Rescales the outer boundary of the outermost domain |
| 3041 | * in the case of non-compactified external domain. |
| 3042 | * The inner boundary is unchanged. |
| 3043 | * @param lambda [input] factor by which the value of the radius |
| 3044 | * of the outermost domain is to be multiplied. |
| 3045 | */ |
| 3046 | void resize_extr(double lambda) ; |
| 3047 | |
| 3048 | /// Modifies the value of \f$\alpha\f$ in domain no. \e l |
| 3049 | void set_alpha(double alpha0, int l) ; |
| 3050 | |
| 3051 | /// Modifies the value of \f$\beta\f$ in domain no. \e l |
| 3052 | void set_beta(double beta0, int l) ; |
| 3053 | |
| 3054 | // Modification of the mapping |
| 3055 | // --------------------------- |
| 3056 | /** Adaptation of the mapping to a given scalar field. |
| 3057 | * Computes the functions \f$F(\theta',\phi')\f$ and \f$G(\theta',\phi')\f$ |
| 3058 | * as well as the factors \f$\alpha\f$ and \f$\beta\f$, so that the |
| 3059 | * boundaries of some domains coincide with isosurfaces of the |
| 3060 | * scalar field \c ent . |
| 3061 | * @param ent [input] scalar field, the isosurfaces of which are |
| 3062 | * used to determine the mapping |
| 3063 | * @param par [input/output] parameters of the computation: \\ |
| 3064 | * \c par.get_int(0) : maximum number of iterations to locate |
| 3065 | * zeros by the secant method \\ |
| 3066 | * \c par.get_int(1) : number of domains where the adjustment |
| 3067 | * to the isosurfaces of \c ent is to be performed \\ |
| 3068 | * \c par.get_int(2) : number of domains \c nz_search where |
| 3069 | * the isosurfaces will be searched : the routine scans the |
| 3070 | * \c nz_search innermost domains, starting from the domain |
| 3071 | * of index \c nz_search-1 . NB: the field \c ent must |
| 3072 | * be continuous over these domains \\ |
| 3073 | * \c par.get_int(3) : 1 = performs the full computation, |
| 3074 | * 0 = performs only the rescaling |
| 3075 | * by the factor |
| 3076 | * \c par.get_double_mod(0) \\ |
| 3077 | * \c par.get_int(4) : theta index of the collocation point |
| 3078 | * \f$(\theta_*, \phi_*)\f$ [using the notations |
| 3079 | * of Bonazzola, Gourgoulhon & Marck, \e Phys. \e Rev. \e D \b 58 , |
| 3080 | * 104020 (1998)] defining an isosurface of \c ent \\ |
| 3081 | * \c par.get_int(5) : phi index of the collocation point |
| 3082 | * \f$(\theta_*, \phi_*)\f$ [using the notations |
| 3083 | * of Bonazzola, Gourgoulhon & Marck, \e Phys. \e Rev. \e D \b 58 , |
| 3084 | * 104020 (1998)] defining an isosurface of \c ent \\ |
| 3085 | * \c par.get_int_mod(0) [output] : number of iterations |
| 3086 | * actually used in the secant method \\ |
| 3087 | * \c par.get_double(0) : required absolute precision in the |
| 3088 | * determination of zeros by the secant method \\ |
| 3089 | * \c par.get_double(1) : factor by which the values of \f$\lambda\f$ |
| 3090 | * and \f$\mu\f$ [using the notations |
| 3091 | * of Bonazzola, Gourgoulhon & Marck, \e Phys. \e Rev. \e D \b 58 , |
| 3092 | * 104020 (1998)] will be multiplied : 1 = regular mapping, |
| 3093 | * 0 = contracting mapping \\ |
| 3094 | * \c par.get_double(2) : factor by which all the radial distances |
| 3095 | * will be multiplied \\ |
| 3096 | * \c par.get_tbl(0) : array of values of the field \c ent to |
| 3097 | * define the isosurfaces. |
| 3098 | * @param nbr\_filtre [input] Number of the last coefficients in \f$\varphi\f$ set to zero. |
| 3099 | */ |
| 3100 | virtual void adapt(const Cmp& ent, const Param& par, int nbr_filtre = 0) ; |
| 3101 | |
| 3102 | // Differential operators: |
| 3103 | // ---------------------- |
| 3104 | public: |
| 3105 | /** Computes \f$\partial/ \partial \xi\f$ of a \c Cmp. |
| 3106 | * Note that in the compactified external domain (CED), it computes |
| 3107 | * \f$-\partial/ \partial u = \xi^2 \partial/ \partial \xi\f$. |
| 3108 | * @param ci [input] field to consider |
| 3109 | * @param resu [output] derivative of \c ci |
| 3110 | */ |
| 3111 | virtual void dsdxi(const Cmp& ci, Cmp& resu) const ; |
| 3112 | |
| 3113 | /** Computes \f$\partial/ \partial r\f$ of a \c Cmp. |
| 3114 | * Note that in the compactified external domain (CED), it computes |
| 3115 | * \f$-\partial/ \partial u = r^2 \partial/ \partial r\f$. |
| 3116 | * @param ci [input] field to consider |
| 3117 | * @param resu [output] derivative of \c ci |
| 3118 | */ |
| 3119 | virtual void dsdr(const Cmp& ci, Cmp& resu) const ; |
| 3120 | |
| 3121 | /** Computes \f$1/r \partial/ \partial \theta\f$ of a \c Cmp. |
| 3122 | * Note that in the compactified external domain (CED), it computes |
| 3123 | * \f$1/u \partial/ \partial \theta = r \partial/ \partial \theta\f$. |
| 3124 | * @param ci [input] field to consider |
| 3125 | * @param resu [output] derivative of \c ci |
| 3126 | */ |
| 3127 | virtual void srdsdt(const Cmp& ci, Cmp& resu) const ; |
| 3128 | |
| 3129 | /** Computes \f$1/(r\sin\theta) \partial/ \partial \phi\f$ of a \c Cmp. |
| 3130 | * Note that in the compactified external domain (CED), it computes |
| 3131 | * \f$1/(u\sin\theta) \partial/ \partial \phi = |
| 3132 | * r/\sin\theta \partial/ \partial \phi\f$. |
| 3133 | * @param ci [input] field to consider |
| 3134 | * @param resu [output] derivative of \c ci |
| 3135 | */ |
| 3136 | virtual void srstdsdp(const Cmp& ci, Cmp& resu) const ; |
| 3137 | |
| 3138 | /** Computes \f$\partial/ \partial \xi\f$ of a \c Scalar. |
| 3139 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 3140 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 3141 | * is increased by 1 in other cases. |
| 3142 | * @param uu [input] field to consider |
| 3143 | * @param resu [output] derivative of \c uu |
| 3144 | */ |
| 3145 | virtual void dsdxi(const Scalar& uu, Scalar& resu) const ; |
| 3146 | |
| 3147 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar. |
| 3148 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 3149 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 3150 | * is increased by 1 in other cases. |
| 3151 | * @param uu [input] field to consider |
| 3152 | * @param resu [output] derivative of \c uu |
| 3153 | */ |
| 3154 | virtual void dsdr(const Scalar& uu, Scalar& resu) const ; |
| 3155 | |
| 3156 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar if the description is affine and |
| 3157 | * \f$\partial/ \partial \ln r\f$ if it is logarithmic. |
| 3158 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 3159 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 3160 | * is increased by 1 in other cases. |
| 3161 | * @param uu [input] field to consider |
| 3162 | * @param resu [output] derivative of \c uu |
| 3163 | */ |
| 3164 | virtual void dsdradial(const Scalar& uu, Scalar& resu) const ; |
| 3165 | |
| 3166 | /** Computes \f$1/r \partial/ \partial \theta\f$ of a \c Scalar. |
| 3167 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 3168 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 3169 | * is increased by 1 in other cases. |
| 3170 | * @param uu [input] field to consider |
| 3171 | * @param resu [output] derivative of \c uu |
| 3172 | */ |
| 3173 | virtual void srdsdt(const Scalar& uu, Scalar& resu) const ; |
| 3174 | |
| 3175 | /** Computes \f$1/(r\sin\theta) \partial/ \partial \phi\f$ of a \c Scalar. |
| 3176 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 3177 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 3178 | * is increased by 1 in other cases. |
| 3179 | * @param uu [input] field to consider |
| 3180 | * @param resu [output] derivative of \c uu |
| 3181 | */ |
| 3182 | virtual void srstdsdp(const Scalar& uu, Scalar& resu) const ; |
| 3183 | |
| 3184 | /** Computes \f$\partial/ \partial \theta\f$ of a \c Scalar. |
| 3185 | * @param uu [input] scalar field |
| 3186 | * @param resu [output] derivative of \c uu |
| 3187 | */ |
| 3188 | virtual void dsdt(const Scalar& uu, Scalar& resu) const ; |
| 3189 | |
| 3190 | /** Computes \f$1/\sin\theta \partial/ \partial \varphi\f$ of a \c Scalar. |
| 3191 | * @param uu [input] scalar field |
| 3192 | * @param resu [output] derivative of \c uu |
| 3193 | */ |
| 3194 | virtual void stdsdp(const Scalar& uu, Scalar& resu) const ; |
| 3195 | |
| 3196 | /** Computes the Laplacian of a scalar field. |
| 3197 | * @param uu [input] Scalar field \e u (represented as a \c Scalar ) |
| 3198 | * the Laplacian \f$\Delta u\f$ of which is to be computed |
| 3199 | * @param zec_mult_r [input] Determines the quantity computed in |
| 3200 | * the compactified external domain (CED) : \\ |
| 3201 | * zec_mult_r = 0 : \f$\Delta u\f$ \\ |
| 3202 | * zec_mult_r = 2 : \f$r^2 \, \Delta u\f$ \\ |
| 3203 | * zec_mult_r = 4 (default) : \f$r^4 \, \Delta u\f$ |
| 3204 | * @param lap [output] Laplacian of \e u |
| 3205 | */ |
| 3206 | virtual void laplacien(const Scalar& uu, int zec_mult_r, |
| 3207 | Scalar& lap) const ; |
| 3208 | |
| 3209 | /// Computes the Laplacian of a scalar field (\c Cmp version). |
| 3210 | virtual void laplacien(const Cmp& uu, int zec_mult_r, |
| 3211 | Cmp& lap) const ; |
| 3212 | |
| 3213 | /** Computes the angular Laplacian of a scalar field. |
| 3214 | * @param uu [input] Scalar field \e u (represented as a \c Scalar) |
| 3215 | * the Laplacian \f$\Delta u\f$ of which is to be computed |
| 3216 | * @param lap [output] Angular Laplacian of \e u (see documentation |
| 3217 | * of \c Scalar |
| 3218 | */ |
| 3219 | virtual void lapang(const Scalar& uu, Scalar& lap) const ; |
| 3220 | |
| 3221 | |
| 3222 | /** Computes the radial primitive which vanishes for \f$r\to \infty\f$. |
| 3223 | * i.e. the function |
| 3224 | * \f$ F(r,\theta,\varphi) = \int_r^\infty f(r',\theta,\varphi) \, dr' \f$ |
| 3225 | * |
| 3226 | * @param uu [input] function \e f (must have a \c dzpuis = 2) |
| 3227 | * @param resu [input] function \e F |
| 3228 | * @param null_infty if true (default), the primitive is null |
| 3229 | * at infinity (or on the grid boundary). \e F is null at the |
| 3230 | * center otherwise |
| 3231 | */ |
| 3232 | virtual void primr(const Scalar& uu, Scalar& resu, |
| 3233 | bool null_infty) const ; |
| 3234 | |
| 3235 | |
| 3236 | /** Computes the integral over all space of a \c Cmp. |
| 3237 | * The computed quantity is |
| 3238 | * \f$\int u \, r^2 \sin\theta \, dr\, d\theta \, d\phi\f$. |
| 3239 | * The routine allocates a \c Tbl (size: \c mg->nzone ) to store |
| 3240 | * the result (partial integral) in each domain and returns a pointer |
| 3241 | * to it. |
| 3242 | */ |
| 3243 | virtual Tbl* integrale(const Cmp&) const ; |
| 3244 | |
| 3245 | |
| 3246 | // PDE resolution : |
| 3247 | // -------------- |
| 3248 | public: |
| 3249 | /** Computes the solution of a scalar Poisson equation. |
| 3250 | * |
| 3251 | * Following the method explained in Sect. III.C of Bonazzola, |
| 3252 | * Gourgoulhon & Marck, \e Phys. \e Rev. \e D \b 58 , 104020 (1998), |
| 3253 | * the Poisson equation \f$\Delta u = \sigma\f$ is re-written |
| 3254 | * as \f$a \tilde\Delta u = \sigma + R(u)\f$, where \f$\tilde\Delta\f$ |
| 3255 | * is the Laplacian in an affine mapping and \e R(u) contains the |
| 3256 | * terms generated by the deviation of the mapping \c *this |
| 3257 | * from spherical symmetry. This equation is solved by iterations. |
| 3258 | * At each step \e J the equation effectively solved is |
| 3259 | * \f$\tilde\Delta u^{J+1} = s^J\f$ where |
| 3260 | * \f[ |
| 3261 | * s^J = 1/a_l^{\rm max} \{ {\tt source} + R(u^J) + (a_l^{\rm max}-a) |
| 3262 | * [ \lambda s^{J-1} + (1-\lambda) s^{J-2} ] \} \ , |
| 3263 | * \f] |
| 3264 | * with \f$a_l^{\rm max} := \max(a)\f$ in domain no. \e l and \f$\lambda\f$ |
| 3265 | * is a relaxation parameter. |
| 3266 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 3267 | * @param par [input/output] parameters for the iterative method: \\ |
| 3268 | * \c par.get_int(0) : [input] maximum number of iterations \\ |
| 3269 | * \c par.get_double(0) : [input] relaxation parameter \f$\lambda\f$ \\ |
| 3270 | * \c par.get_double(1) : [input] required precision: the iterative |
| 3271 | * method is stopped as soon as the relative difference between |
| 3272 | * \f$u^J\f$ and \f$u^{J-1}\f$ is greater than \c par.get_double(1) \\ |
| 3273 | * \c par.get_cmp_mod(0) : [input/output] input : \c Cmp |
| 3274 | * containing \f$s^{J-1}\f$ (cf. the above equation) to |
| 3275 | * start the iteration (if nothing is known a priori, |
| 3276 | * this \c Cmp must be set to zero); output: value |
| 3277 | * of \f$s^{J-1}\f$, to used in a next call to the routine \\ |
| 3278 | * \c par.get_int_mod(0) : [output] number of iterations |
| 3279 | * actually used to get the solution. |
| 3280 | * |
| 3281 | * @param uu [input/output] input : previously computed value of \e u |
| 3282 | * to start the iteration (term \e R(u) ) (if nothing is known a |
| 3283 | * priori, \c uu must be set to zero); output: solution \e u |
| 3284 | * with the boundary condition \e u =0 at spatial infinity. |
| 3285 | */ |
| 3286 | virtual void poisson(const Cmp& source, Param& par, Cmp& uu) const ; |
| 3287 | |
| 3288 | /** Computes the solution of a scalar Poisson equation with a Tau method. |
| 3289 | * |
| 3290 | * Following the method explained in Sect. III.C of Bonazzola, |
| 3291 | * Gourgoulhon & Marck, \e Phys. \e Rev. \e D \b 58 , 104020 (1998), |
| 3292 | * the Poisson equation \f$\Delta u = \sigma\f$ is re-written |
| 3293 | * as \f$a \tilde\Delta u = \sigma + R(u)\f$, where \f$\tilde\Delta\f$ |
| 3294 | * is the Laplacian in an affine mapping and \e R(u) contains the |
| 3295 | * terms generated by the deviation of the mapping \c *this |
| 3296 | * from spherical symmetry. This equation is solved by iterations. |
| 3297 | * At each step \e J the equation effectively solved is |
| 3298 | * \f$\tilde\Delta u^{J+1} = s^J\f$ where |
| 3299 | * \f[ |
| 3300 | * s^J = 1/a_l^{\rm max} \{ {\tt source} + R(u^J) + (a_l^{\rm max}-a) |
| 3301 | * [ \lambda s^{J-1} + (1-\lambda) s^{J-2} ] \} \ , |
| 3302 | * \f] |
| 3303 | * with \f$a_l^{\rm max} := \max(a)\f$ in domain no. \e l and \f$\lambda\f$ |
| 3304 | * is a relaxation parameter. |
| 3305 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 3306 | * @param par [input/output] parameters for the iterative method: \\ |
| 3307 | * \c par.get_int(0) : [input] maximum number of iterations \\ |
| 3308 | * \c par.get_double(0) : [input] relaxation parameter \f$\lambda\f$ \\ |
| 3309 | * \c par.get_double(1) : [input] required precision: the iterative |
| 3310 | * method is stopped as soon as the relative difference between |
| 3311 | * \f$u^J\f$ and \f$u^{J-1}\f$ is greater than \c par.get_double(1) \\ |
| 3312 | * \c par.get_cmp_mod(0) : [input/output] input : \c Cmp |
| 3313 | * containing \f$s^{J-1}\f$ (cf. the above equation) to |
| 3314 | * start the iteration (if nothing is known a priori, |
| 3315 | * this \c Cmp must be set to zero); output: value |
| 3316 | * of \f$s^{J-1}\f$, to used in a next call to the routine \\ |
| 3317 | * \c par.get_int_mod(0) : [output] number of iterations |
| 3318 | * actually used to get the solution. |
| 3319 | * |
| 3320 | * @param uu [input/output] input : previously computed value of \e u |
| 3321 | * to start the iteration (term \e R(u) ) (if nothing is known a |
| 3322 | * priori, \c uu must be set to zero); output: solution \e u |
| 3323 | * with the boundary condition \e u =0 at spatial infinity. |
| 3324 | */ |
| 3325 | virtual void poisson_tau(const Cmp& source, Param& par, Cmp& uu) const ; |
| 3326 | |
| 3327 | virtual void poisson_falloff(const Cmp& source, Param& par, Cmp& uu, |
| 3328 | int k_falloff) const ; |
| 3329 | |
| 3330 | virtual void poisson_ylm(const Cmp& source, Param& par, Cmp& uu, |
| 3331 | int nylm, double* intvec) const ; |
| 3332 | |
| 3333 | /** Computes the solution of a scalar Poisson equation. |
| 3334 | * The regularized source |
| 3335 | * @param source [input] source \f$\sigma\f$ of the Poisson equation |
| 3336 | * \f$\Delta u = \sigma\f$. |
| 3337 | * @param k_div [input] regularization degree of the procedure |
| 3338 | * @param nzet [input] number of domains covering the star |
| 3339 | * @param unsgam1 [input] parameter \f$1/(\gamma-1)\f$ where \f$\gamma\f$ |
| 3340 | * denotes the adiabatic index. |
| 3341 | * @param par [input/output] parameters for the iterative method: \\ |
| 3342 | * \c par.get_int(0) : [input] maximum number of iterations \\ |
| 3343 | * \c par.get_double(0) : [input] relaxation parameter |
| 3344 | * \f$\lambda\f$ \\ |
| 3345 | * \c par.get_double(1) : [input] required precision: the |
| 3346 | * iterative method is stopped as soon as the relative |
| 3347 | * difference between \f$u^J\f$ and \f$u^{J-1}\f$ is greater than |
| 3348 | * \c par.get_double(1) \\ |
| 3349 | * \c par.get_cmp_mod(0) : [input/output] input : \c Cmp |
| 3350 | * containing \f$s^{J-1}\f$ (cf. the above equation) to |
| 3351 | * start the iteration (if nothing is known a priori, |
| 3352 | * this \c Cmp must be set to zero); output: value |
| 3353 | * of \f$s^{J-1}\f$, to used in a next call to the routine \\ |
| 3354 | * \c par.get_int_mod(0) : [output] number of iterations |
| 3355 | * actually used to get the solution. |
| 3356 | * @param uu [input/output] input : previously computed value of \e u |
| 3357 | * to start the iteration (term \e R(u) ) (if nothing is known a |
| 3358 | * priori, \c uu must be set to zero); output: solution \e u |
| 3359 | * with the boundary condition \e u =0 at spatial infinity. |
| 3360 | * @param uu_regu [output] solution of the regular part of |
| 3361 | * the source. |
| 3362 | * @param uu_div [output] solution of the diverging part of |
| 3363 | * the source. |
| 3364 | * @param duu_div [output] derivative of the diverging potential |
| 3365 | * @param source_regu [output] regularized source |
| 3366 | * @param source_div [output] diverging part of the source |
| 3367 | */ |
| 3368 | virtual void poisson_regular(const Cmp& source, int k_div, int nzet, |
| 3369 | double unsgam1, Param& par, Cmp& uu, |
| 3370 | Cmp& uu_regu, Cmp& uu_div, |
| 3371 | Tenseur& duu_div, Cmp& source_regu, |
| 3372 | Cmp& source_div) const ; |
| 3373 | |
| 3374 | /** Computes the solution of the generalized angular Poisson equation. |
| 3375 | * The generalized angular Poisson equation is |
| 3376 | * \f$\Delta_{\theta\varphi} u + \lambda u = \sigma\f$, |
| 3377 | * where \f$\Delta_{\theta\varphi} u := \frac{\partial^2 u} |
| 3378 | * {\partial \theta^2} + \frac{1}{\tan \theta} \frac{\partial u} |
| 3379 | * {\partial \theta} +\frac{1}{\sin^2 \theta}\frac{\partial^2 u} |
| 3380 | * {\partial \varphi^2}\f$. |
| 3381 | * |
| 3382 | * @param source [input] source \f$\sigma\f$ of the equation |
| 3383 | * \f$\Delta_{\theta\varphi} u + \lambda u = \sigma\f$. |
| 3384 | * @param par [input/output] possible parameters to control the |
| 3385 | * resolution of the Poisson equation. See the actual implementation |
| 3386 | * in the derived class of \c Map for documentation. |
| 3387 | * @param uu [input/output] solution \e u |
| 3388 | * @param lambda [input] coefficient \f$\lambda\f$ in the above equation |
| 3389 | * (default value = 0) |
| 3390 | */ |
| 3391 | virtual void poisson_angu(const Scalar& source, Param& par, |
| 3392 | Scalar& uu, double lambda=0) const ; |
| 3393 | |
| 3394 | /** |
| 3395 | * Internal function intended to be used by \c Map::poisson_vect |
| 3396 | * and \c Map::poisson_vect_oohara . It constructs the sets of |
| 3397 | * parameters used for each scalar Poisson equation from the one for |
| 3398 | * the vectorial one. |
| 3399 | * |
| 3400 | * @param para [input] : the \c Param used for the resolution of |
| 3401 | * the vectorial Poisson equation : \\ |
| 3402 | * \c para.int() maximum number of iteration.\\ |
| 3403 | * \c para.double(0) relaxation parameter.\\ |
| 3404 | * \c para.double(1) required precision. \\ |
| 3405 | * \c para.tenseur_mod() source of the vectorial part at the previous |
| 3406 | * step.\\ |
| 3407 | * \c para.cmp_mod() source of the scalar part at the previous |
| 3408 | * step. |
| 3409 | * |
| 3410 | * @param i [input] number of the scalar Poisson equation that is being |
| 3411 | * solved (values from 0 to 2 for the componants of the vectorial part |
| 3412 | * and 3 for the scalar one). |
| 3413 | * |
| 3414 | * @return the pointer on the parameter set used for solving the scalar |
| 3415 | * Poisson equation labelled by \e i . |
| 3416 | */ |
| 3417 | virtual Param* donne_para_poisson_vect (Param& para, int i) const ; |
| 3418 | |
| 3419 | /** |
| 3420 | * Not yet implemented. |
| 3421 | */ |
| 3422 | virtual void poisson_frontiere (const Cmp&, const Valeur&, int, int, |
| 3423 | Cmp&, double = 0., double = 0.) const ; |
| 3424 | virtual void poisson_frontiere_double (const Cmp& source, |
| 3425 | const Valeur& lim_func, const Valeur& lim_der, |
| 3426 | int num_zone, Cmp& pot) const ; |
| 3427 | |
| 3428 | /** |
| 3429 | * Computes the solution of a Poisson equation in the shell . |
| 3430 | * imposing a boundary condition at the surface of the star |
| 3431 | * |
| 3432 | * @param source [input] : source of the equation. |
| 3433 | * @param limite [input] : \c limite[num_front] contains the angular |
| 3434 | * function being the boudary condition. |
| 3435 | * @param par [input] : parameters of the computation. |
| 3436 | * @param pot [output] : result. |
| 3437 | */ |
| 3438 | virtual void poisson_interne (const Cmp& source, const Valeur& limite, |
| 3439 | Param& par, Cmp& pot) const ; |
| 3440 | |
| 3441 | |
| 3442 | /** Computes the solution of a 2-D Poisson equation. |
| 3443 | * The 2-D Poisson equation writes |
| 3444 | * \f[ |
| 3445 | * {\partial^2 u\over\partial r^2} + |
| 3446 | * {1\over r} {\partial u \over \partial r} + |
| 3447 | * {1\over r^2} {\partial^2 u\over\partial \theta^2} = |
| 3448 | * \sigma \ . |
| 3449 | * \f] |
| 3450 | * |
| 3451 | * @param source_mat [input] Compactly supported part of |
| 3452 | * the source \f$\sigma\f$ of the 2-D Poisson equation (typically |
| 3453 | * matter terms) |
| 3454 | * @param source_quad [input] Non-compactly supported part of |
| 3455 | * the source \f$\sigma\f$ of the 2-D Poisson equation (typically |
| 3456 | * quadratic terms) |
| 3457 | * @param par [input/output] Parameters to control the resolution : \\ |
| 3458 | * \c par.get_double_mod(0) : [output] constant \c lambda |
| 3459 | * such that the source of the equation effectively solved |
| 3460 | * is \c source_mat + lambda * source_quad , in order to |
| 3461 | * fulfill the virial identity GRV2. \\ |
| 3462 | * If the theta basis is \c T_SIN_I , the following arguments |
| 3463 | * are required: \\ |
| 3464 | * \c par.get_int(0) : [input] maximum number of iterations \\ |
| 3465 | * \c par.get_double(0) : [input] relaxation parameter \\ |
| 3466 | * \c par.get_double(1) : [input] required precision: the iterative |
| 3467 | * method is stopped as soon as the relative difference between |
| 3468 | * \f$u^J\f$ and \f$u^{J-1}\f$ is greater than \c par.get_double(1) \\ |
| 3469 | * \c par.get_cmp_mod(0) : [input/output] input : \c Cmp |
| 3470 | * containing \f$s^{J-1}\f$ to |
| 3471 | * start the iteration (if nothing is known a priori, |
| 3472 | * this \c Cmp must be set to zero); output: value |
| 3473 | * of \f$s^{J-1}\f$, to used in a next call to the routine \\ |
| 3474 | * \c par.get_int_mod(0) : [output] number of iterations |
| 3475 | * actually used to get the solution. |
| 3476 | * |
| 3477 | * @param uu [input/output] solution \e u with the boundary condition |
| 3478 | * \e u =0 at spatial infinity. |
| 3479 | */ |
| 3480 | virtual void poisson2d(const Cmp& source_mat, const Cmp& source_quad, |
| 3481 | Param& par, Cmp& uu) const ; |
| 3482 | |
| 3483 | /** |
| 3484 | * Not yet implemented. |
| 3485 | */ |
| 3486 | virtual void dalembert(Param& par, Scalar& fJp1, const Scalar& fJ, |
| 3487 | const Scalar& fJm1, const Scalar& source) const ; |
| 3488 | |
| 3489 | |
| 3490 | |
| 3491 | |
| 3492 | // Building functions for the Coord's |
| 3493 | // ---------------------------------- |
| 3494 | friend Mtbl* map_et_fait_r(const Map* ) ; |
| 3495 | friend Mtbl* map_et_fait_tet(const Map* ) ; |
| 3496 | friend Mtbl* map_et_fait_phi(const Map* ) ; |
| 3497 | friend Mtbl* map_et_fait_sint(const Map* ) ; |
| 3498 | friend Mtbl* map_et_fait_cost(const Map* ) ; |
| 3499 | friend Mtbl* map_et_fait_sinp(const Map* ) ; |
| 3500 | friend Mtbl* map_et_fait_cosp(const Map* ) ; |
| 3501 | |
| 3502 | friend Mtbl* map_et_fait_x(const Map* ) ; |
| 3503 | friend Mtbl* map_et_fait_y(const Map* ) ; |
| 3504 | friend Mtbl* map_et_fait_z(const Map* ) ; |
| 3505 | |
| 3506 | friend Mtbl* map_et_fait_xa(const Map* ) ; |
| 3507 | friend Mtbl* map_et_fait_ya(const Map* ) ; |
| 3508 | friend Mtbl* map_et_fait_za(const Map* ) ; |
| 3509 | |
| 3510 | friend Mtbl* map_et_fait_xsr(const Map* ) ; |
| 3511 | friend Mtbl* map_et_fait_dxdr(const Map* ) ; |
| 3512 | friend Mtbl* map_et_fait_drdt(const Map* ) ; |
| 3513 | friend Mtbl* map_et_fait_stdrdp(const Map* ) ; |
| 3514 | friend Mtbl* map_et_fait_srdrdt(const Map* ) ; |
| 3515 | friend Mtbl* map_et_fait_srstdrdp(const Map* ) ; |
| 3516 | friend Mtbl* map_et_fait_sr2drdt(const Map* ) ; |
| 3517 | friend Mtbl* map_et_fait_sr2stdrdp(const Map* ) ; |
| 3518 | friend Mtbl* map_et_fait_d2rdx2(const Map* ) ; |
| 3519 | friend Mtbl* map_et_fait_lapr_tp(const Map* ) ; |
| 3520 | friend Mtbl* map_et_fait_d2rdtdx(const Map* ) ; |
| 3521 | friend Mtbl* map_et_fait_sstd2rdpdx(const Map* ) ; |
| 3522 | friend Mtbl* map_et_fait_sr2d2rdt2(const Map* ) ; |
| 3523 | |
| 3524 | friend Mtbl* map_et_fait_rsxdxdr(const Map* ) ; |
| 3525 | friend Mtbl* map_et_fait_rsx2drdx(const Map* ) ; |
| 3526 | |
| 3527 | }; |
| 3528 | |
| 3529 | Mtbl* map_et_fait_r(const Map* ) ; |
| 3530 | Mtbl* map_et_fait_tet(const Map* ) ; |
| 3531 | Mtbl* map_et_fait_phi(const Map* ) ; |
| 3532 | Mtbl* map_et_fait_sint(const Map* ) ; |
| 3533 | Mtbl* map_et_fait_cost(const Map* ) ; |
| 3534 | Mtbl* map_et_fait_sinp(const Map* ) ; |
| 3535 | Mtbl* map_et_fait_cosp(const Map* ) ; |
| 3536 | |
| 3537 | Mtbl* map_et_fait_x(const Map* ) ; |
| 3538 | Mtbl* map_et_fait_y(const Map* ) ; |
| 3539 | Mtbl* map_et_fait_z(const Map* ) ; |
| 3540 | |
| 3541 | Mtbl* map_et_fait_xa(const Map* ) ; |
| 3542 | Mtbl* map_et_fait_ya(const Map* ) ; |
| 3543 | Mtbl* map_et_fait_za(const Map* ) ; |
| 3544 | |
| 3545 | Mtbl* map_et_fait_xsr(const Map* ) ; |
| 3546 | Mtbl* map_et_fait_dxdr(const Map* ) ; |
| 3547 | Mtbl* map_et_fait_drdt(const Map* ) ; |
| 3548 | Mtbl* map_et_fait_stdrdp(const Map* ) ; |
| 3549 | Mtbl* map_et_fait_srdrdt(const Map* ) ; |
| 3550 | Mtbl* map_et_fait_srstdrdp(const Map* ) ; |
| 3551 | Mtbl* map_et_fait_sr2drdt(const Map* ) ; |
| 3552 | Mtbl* map_et_fait_sr2stdrdp(const Map* ) ; |
| 3553 | Mtbl* map_et_fait_d2rdx2(const Map* ) ; |
| 3554 | Mtbl* map_et_fait_lapr_tp(const Map* ) ; |
| 3555 | Mtbl* map_et_fait_d2rdtdx(const Map* ) ; |
| 3556 | Mtbl* map_et_fait_sstd2rdpdx(const Map* ) ; |
| 3557 | Mtbl* map_et_fait_sr2d2rdt2(const Map* ) ; |
| 3558 | |
| 3559 | Mtbl* map_et_fait_rsxdxdr(const Map* ) ; |
| 3560 | Mtbl* map_et_fait_rsx2drdx(const Map* ) ; |
| 3561 | |
| 3562 | //------------------------------------// |
| 3563 | // class Map_log // |
| 3564 | //------------------------------------// |
| 3565 | |
| 3566 | #define AFFINE 0 |
| 3567 | #define LOG 1 |
| 3568 | |
| 3569 | /** |
| 3570 | * Logarithmic radial mapping. \ingroup (map) |
| 3571 | * |
| 3572 | * This mapping is a variation of the affine one. |
| 3573 | * |
| 3574 | * In each domain the description can be either affine (cf. Map_af documentation) or |
| 3575 | * logarithmic. In that case (implemented only in the shells) we have |
| 3576 | * |
| 3577 | * \li \f$\ln r=\alpha \xi + \beta\f$, |
| 3578 | * where \f$\alpha\f$ and \f$\beta\f$ are constant in each domain. |
| 3579 | * |
| 3580 | * |
| 3581 | */ |
| 3582 | |
| 3583 | class Map_log : public Map_radial { |
| 3584 | |
| 3585 | // Data : |
| 3586 | // ---- |
| 3587 | private: |
| 3588 | /// Array (size: \c mg->nzone ) of the values of \f$\alpha\f$ in each domain |
| 3589 | Tbl alpha ; |
| 3590 | /// Array (size: \c mg->nzone ) of the values of \f$\beta\f$ in each domain |
| 3591 | Tbl beta ; |
| 3592 | /** Array (size: \c mg->nzone ) of the type of variable in each domain. |
| 3593 | * The possibles types are AFFINE and LOG. |
| 3594 | **/ |
| 3595 | Itbl type_var ; |
| 3596 | |
| 3597 | public: |
| 3598 | /** |
| 3599 | * Same as dxdr if the domains where the description is affine and |
| 3600 | * \f$ \partial x / \partial \ln r\f$ where it is logarithmic. |
| 3601 | */ |
| 3602 | |
| 3603 | Coord dxdlnr ; |
| 3604 | |
| 3605 | private: |
| 3606 | void set_coord() ; |
| 3607 | |
| 3608 | // Constructors, destructor : |
| 3609 | // ------------------------ |
| 3610 | public: |
| 3611 | /** |
| 3612 | * Standard Constructor |
| 3613 | * @param mgrille [input] Multi-domain grid on which the mapping is defined |
| 3614 | * @param r_limits [input] Tbl (size: number of domains + 1) of the |
| 3615 | * value of \e r at the boundaries of the various |
| 3616 | * domains : |
| 3617 | * \li \c r_limits[l] : inner boundary of the |
| 3618 | * domain no. \c l |
| 3619 | * \li \c r_limits[l+1] : outer boundary of the |
| 3620 | * domain no. \c l |
| 3621 | * @param type_var [input] Array (size: number of domains) defining the type f mapping in each domain. |
| 3622 | */ |
| 3623 | Map_log (const Mg3d& mgrille, const Tbl& r_limits, const Itbl& typevar) ; |
| 3624 | |
| 3625 | |
| 3626 | Map_log (const Map_log& ) ; ///< Copy constructor |
| 3627 | Map_log (const Mg3d&, FILE* ) ; ///< Constructor from a file (see \c sauve(FILE*) |
| 3628 | |
| 3629 | virtual ~Map_log() ; ///< Destructor |
| 3630 | |
| 3631 | /** Returns the "angular" mapping for the outside of domain \c l_zone. |
| 3632 | * Valid only for the class \c Map_af. |
| 3633 | */ |
| 3634 | virtual const Map_af& mp_angu(int) const ; |
| 3635 | |
| 3636 | /// Returns \f$\alpha\f$ in the domain \c l |
| 3637 | double get_alpha (int l) const {return alpha(l) ;} ; |
| 3638 | /// Returns \f$\beta\f$ in the domain \c l |
| 3639 | double get_beta (int l) const {return beta(l) ;} ; |
| 3640 | /// Returns the type of description in the domain \c l |
| 3641 | int get_type (int l) const {return type_var(l) ;} ; |
| 3642 | |
| 3643 | /** |
| 3644 | * General elliptic solver. The field is zero at infinity. |
| 3645 | * |
| 3646 | * @param params [input] : the operators and variables to be uses. |
| 3647 | * @param so [input] : the source. |
| 3648 | * @param uu [output] : the solution. |
| 3649 | **/ |
| 3650 | void sol_elliptic (Param_elliptic& params, |
| 3651 | const Scalar& so, Scalar& uu) const ; |
| 3652 | |
| 3653 | |
| 3654 | /** |
| 3655 | * General elliptic solver including inner boundary conditions. |
| 3656 | * The field is zero at infinity. |
| 3657 | * |
| 3658 | * @param params [input] : the operators and variables to be uses. |
| 3659 | * @param so [input] : the source. |
| 3660 | * @param uu [output] : the solution. |
| 3661 | * @param bound [input] : the boundary condition |
| 3662 | * @param fact_dir : 1 Dirchlet condition, 0 Neumann condition |
| 3663 | * @param fact_neu : 0 Dirchlet condition, 1 Neumann condition |
| 3664 | **/ |
| 3665 | void sol_elliptic_boundary (Param_elliptic& params, |
| 3666 | const Scalar& so, Scalar& uu, const Mtbl_cf& bound, |
| 3667 | double fact_dir, double fact_neu ) const ; |
| 3668 | |
| 3669 | /** General elliptic solver including inner boundary conditions, the bound being |
| 3670 | * given as a Scalar on a mono-domain angular grid. |
| 3671 | **/ |
| 3672 | void sol_elliptic_boundary (Param_elliptic& params, |
| 3673 | const Scalar& so, Scalar& uu, const Scalar& bound, |
| 3674 | double fact_dir, double fact_neu ) const ; |
| 3675 | |
| 3676 | |
| 3677 | /** |
| 3678 | * General elliptic solver. |
| 3679 | * The equation is not solved in the compactified domain. |
| 3680 | * |
| 3681 | * @param params [input] : the operators and variables to be uses. |
| 3682 | * @param so [input] : the source. |
| 3683 | * @param uu [output] : the solution. |
| 3684 | * @param val [input] : value at the last shell. |
| 3685 | **/ |
| 3686 | void sol_elliptic_no_zec (Param_elliptic& params, |
| 3687 | const Scalar& so, Scalar& uu, double) const ; |
| 3688 | |
| 3689 | |
| 3690 | virtual void sauve(FILE*) const ; ///< Save in a file |
| 3691 | |
| 3692 | /// Assignment to an affine mapping. |
| 3693 | virtual void operator=(const Map_af& mpa) ; |
| 3694 | |
| 3695 | |
| 3696 | virtual ostream& operator>> (ostream&) const ; ///< Operator >> |
| 3697 | |
| 3698 | /** |
| 3699 | * Returns the value of the radial coordinate \e r for a given |
| 3700 | * \f$(\xi, \theta', \phi')\f$ in a given domain. |
| 3701 | * @param l [input] index of the domain |
| 3702 | * @param xi [input] value of \f$\xi\f$ |
| 3703 | * @param theta [input] value of \f$\theta'\f$ |
| 3704 | * @param pphi [input] value of \f$\phi'\f$ |
| 3705 | * @return value of \f$r=R_l(\xi, \theta', \phi')\f$ |
| 3706 | */ |
| 3707 | virtual double val_r (int l, double xi, double theta, double pphi) const ; |
| 3708 | |
| 3709 | /** |
| 3710 | * Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 3711 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 3712 | * @param rr [input] value of \e r |
| 3713 | * @param theta [input] value of \f$\theta\f$ |
| 3714 | * @param pphi [input] value of \f$\phi\f$ |
| 3715 | * @param l [output] value of the domain index |
| 3716 | * @param xi [output] value of \f$\xi\f$ |
| 3717 | */ |
| 3718 | virtual void val_lx (double rr, double theta, double pphi, int& l, double& xi) const ; |
| 3719 | |
| 3720 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 3721 | * to a point given by its physical coordinates \f$(r, \theta, \phi)\f$. |
| 3722 | * @param rr [input] value of \e r |
| 3723 | * @param theta [input] value of \f$\theta\f$ |
| 3724 | * @param pphi [input] value of \f$\phi\f$ |
| 3725 | * @param par [] unused by the \c Map_af version |
| 3726 | * @param l [output] value of the domain index |
| 3727 | * @param xi [output] value of \f$\xi\f$ |
| 3728 | */ |
| 3729 | virtual void val_lx (double rr, double theta, double pphi, const Param& par, int& l, double& xi) const ; |
| 3730 | |
| 3731 | |
| 3732 | virtual bool operator== (const Map&) const ; /// < Comparison operator |
| 3733 | |
| 3734 | /** Returns the value of the radial coordinate \e r for a given |
| 3735 | * \f$\xi\f$ and a given collocation point in \f$(\theta', \phi')\f$ |
| 3736 | * in a given domain. |
| 3737 | * @param l [input] index of the domain |
| 3738 | * @param xi [input] value of \f$\xi\f$ |
| 3739 | * @param j [input] index of the collocation point in \f$\theta'\f$ |
| 3740 | * @param k [input] index of the collocation point in \f$\phi'\f$ |
| 3741 | * @return value of \f$r=R_l(\xi, {\theta'}_j, {\phi'}_k)\f$ |
| 3742 | */ |
| 3743 | virtual double val_r_jk (int l, double xi, int j, int k) const ; |
| 3744 | |
| 3745 | /** Computes the domain index \e l and the value of \f$\xi\f$ corresponding |
| 3746 | * to a point of arbitrary \e r but collocation values of \f$(\theta, \phi)\f$ |
| 3747 | * @param rr [input] value of \e r |
| 3748 | * @param j [input] index of the collocation point in \f$\theta\f$ |
| 3749 | * @param k [input] index of the collocation point in \f$\phi\f$ |
| 3750 | * @param par [] unused by the \c Map_af version |
| 3751 | * @param l [output] value of the domain index |
| 3752 | * @param xi [output] value of \f$\xi\f$ |
| 3753 | */ |
| 3754 | virtual void val_lx_jk (double rr, int j, int k, const Param& par, int& l, double& xi) const ; |
| 3755 | |
| 3756 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar. |
| 3757 | * Note that in the compactified external domain (CED), it computes |
| 3758 | * \f$-\partial/ \partial u = r^2 \partial/ \partial r\f$. |
| 3759 | * @param ci [input] field to consider |
| 3760 | * @param resu [output] derivative of \c ci |
| 3761 | */ |
| 3762 | virtual void dsdr (const Scalar& ci, Scalar& resu) const ; |
| 3763 | |
| 3764 | /** Computes \f$\partial/ \partial \xi\f$ of a \c Scalar. |
| 3765 | * Note that in the compactified external domain (CED), it computes |
| 3766 | * \f$-\partial/ \partial u = \xi^2 \partial/ \partial \xi\f$. |
| 3767 | * @param ci [input] field to consider |
| 3768 | * @param resu [output] derivative of \c ci |
| 3769 | */ |
| 3770 | virtual void dsdxi (const Scalar& ci, Scalar& resu) const ; |
| 3771 | |
| 3772 | /** Computes \f$\partial/ \partial r\f$ of a \c Scalar if the description is affine and |
| 3773 | * \f$\partial/ \partial \ln r\f$ if it is logarithmic. |
| 3774 | * Note that in the compactified external domain (CED), the \c dzpuis |
| 3775 | * flag of the output is 2 if the input has \c dzpuis = 0, and |
| 3776 | * is increased by 1 in other cases. |
| 3777 | * @param uu [input] field to consider |
| 3778 | * @param resu [output] derivative of \c uu |
| 3779 | */ |
| 3780 | virtual void dsdradial (const Scalar& uu, Scalar& resu) const ; |
| 3781 | |
| 3782 | virtual void homothetie (double) ; /// < Not implemented |
| 3783 | virtual void resize (int, double) ;/// < Not implemented |
| 3784 | virtual void adapt (const Cmp&, const Param&, int) ;/// < Not implemented |
| 3785 | virtual void dsdr (const Cmp&, Cmp&) const ;/// < Not implemented |
| 3786 | virtual void dsdxi (const Cmp&, Cmp&) const ;/// < Not implemented |
| 3787 | virtual void srdsdt (const Cmp&, Cmp&) const ;/// < Not implemented |
| 3788 | virtual void srstdsdp (const Cmp&, Cmp&) const ;/// < Not implemented |
| 3789 | virtual void srdsdt (const Scalar&, Scalar&) const ;/// < Not implemented |
| 3790 | virtual void srstdsdp (const Scalar&, Scalar&) const ;/// < Not implemented |
| 3791 | virtual void dsdt (const Scalar&, Scalar&) const ;/// < Not implemented |
| 3792 | virtual void stdsdp (const Scalar&, Scalar&) const ;/// < Not implemented |
| 3793 | virtual void laplacien (const Scalar&, int, Scalar&) const ;/// < Not implemented |
| 3794 | virtual void laplacien (const Cmp&, int, Cmp&) const ;/// < Not implemented |
| 3795 | virtual void lapang (const Scalar&, Scalar&) const ;/// < Not implemented |
| 3796 | virtual void primr(const Scalar&, Scalar&, bool) const ;/// < Not implemented |
| 3797 | virtual Tbl* integrale (const Cmp&) const ;/// < Not implemented |
| 3798 | virtual void poisson (const Cmp&, Param&, Cmp&) const ;/// < Not implemented |
| 3799 | virtual void poisson_tau (const Cmp&, Param&, Cmp&) const ;/// < Not implemented |
| 3800 | virtual void poisson_falloff(const Cmp&, Param&, Cmp&, int) const ;/// < Not implemented |
| 3801 | virtual void poisson_ylm(const Cmp&, Param&, Cmp&, int, double*) const ;/// < Not implemented |
| 3802 | virtual void poisson_regular (const Cmp&, int, int, double, Param&, Cmp&, Cmp&, Cmp&, |
| 3803 | Tenseur&, Cmp&, Cmp&) const ;/// < Not implemented |
| 3804 | virtual void poisson_angu (const Scalar&, Param&, Scalar&, double=0) const ;/// < Not implemented |
| 3805 | virtual Param* donne_para_poisson_vect (Param&, int) const ;/// < Not implemented |
| 3806 | virtual void poisson_frontiere (const Cmp&, const Valeur&, int, int, Cmp&, double = 0., double = 0.) const ;/// < Not implemented |
| 3807 | virtual void poisson_frontiere_double (const Cmp&, const Valeur&, const Valeur&, int, Cmp&) const ;/// < Not implemented |
| 3808 | virtual void poisson_interne (const Cmp&, const Valeur&, Param&, Cmp&) const ;/// < Not implemented |
| 3809 | virtual void poisson2d (const Cmp&, const Cmp&, Param&, Cmp&) const ;/// < Not implemented |
| 3810 | virtual void dalembert (Param&, Scalar&, const Scalar&, const Scalar&, const Scalar&) const ;/// < Not implemented |
| 3811 | |
| 3812 | |
| 3813 | // Building functions for the Coord's |
| 3814 | // ---------------------------------- |
| 3815 | friend Mtbl* map_log_fait_r(const Map* ) ; |
| 3816 | friend Mtbl* map_log_fait_tet(const Map* ) ; |
| 3817 | friend Mtbl* map_log_fait_phi(const Map* ) ; |
| 3818 | friend Mtbl* map_log_fait_sint(const Map* ) ; |
| 3819 | friend Mtbl* map_log_fait_cost(const Map* ) ; |
| 3820 | friend Mtbl* map_log_fait_sinp(const Map* ) ; |
| 3821 | friend Mtbl* map_log_fait_cosp(const Map* ) ; |
| 3822 | |
| 3823 | friend Mtbl* map_log_fait_x(const Map* ) ; |
| 3824 | friend Mtbl* map_log_fait_y(const Map* ) ; |
| 3825 | friend Mtbl* map_log_fait_z(const Map* ) ; |
| 3826 | |
| 3827 | friend Mtbl* map_log_fait_xa(const Map* ) ; |
| 3828 | friend Mtbl* map_log_fait_ya(const Map* ) ; |
| 3829 | friend Mtbl* map_log_fait_za(const Map* ) ; |
| 3830 | |
| 3831 | friend Mtbl* map_log_fait_xsr(const Map* ) ; |
| 3832 | friend Mtbl* map_log_fait_dxdr(const Map* ) ; |
| 3833 | friend Mtbl* map_log_fait_drdt(const Map* ) ; |
| 3834 | friend Mtbl* map_log_fait_stdrdp(const Map* ) ; |
| 3835 | friend Mtbl* map_log_fait_srdrdt(const Map* ) ; |
| 3836 | friend Mtbl* map_log_fait_srstdrdp(const Map* ) ; |
| 3837 | friend Mtbl* map_log_fait_sr2drdt(const Map* ) ; |
| 3838 | friend Mtbl* map_log_fait_sr2stdrdp(const Map* ) ; |
| 3839 | friend Mtbl* map_log_fait_d2rdx2(const Map* ) ; |
| 3840 | friend Mtbl* map_log_fait_lapr_tp(const Map* ) ; |
| 3841 | friend Mtbl* map_log_fait_d2rdtdx(const Map* ) ; |
| 3842 | friend Mtbl* map_log_fait_sstd2rdpdx(const Map* ) ; |
| 3843 | friend Mtbl* map_log_fait_sr2d2rdt2(const Map* ) ; |
| 3844 | friend Mtbl* map_log_fait_dxdlnr(const Map* ) ; |
| 3845 | |
| 3846 | }; |
| 3847 | |
| 3848 | Mtbl* map_log_fait_r(const Map* ) ; |
| 3849 | Mtbl* map_log_fait_tet(const Map* ) ; |
| 3850 | Mtbl* map_log_fait_phi(const Map* ) ; |
| 3851 | Mtbl* map_log_fait_sint(const Map* ) ; |
| 3852 | Mtbl* map_log_fait_cost(const Map* ) ; |
| 3853 | Mtbl* map_log_fait_sinp(const Map* ) ; |
| 3854 | Mtbl* map_log_fait_cosp(const Map* ) ; |
| 3855 | |
| 3856 | Mtbl* map_log_fait_x(const Map* ) ; |
| 3857 | Mtbl* map_log_fait_y(const Map* ) ; |
| 3858 | Mtbl* map_log_fait_z(const Map* ) ; |
| 3859 | |
| 3860 | Mtbl* map_log_fait_xa(const Map* ) ; |
| 3861 | Mtbl* map_log_fait_ya(const Map* ) ; |
| 3862 | Mtbl* map_log_fait_za(const Map* ) ; |
| 3863 | |
| 3864 | Mtbl* map_log_fait_xsr(const Map* ) ; |
| 3865 | Mtbl* map_log_fait_dxdr(const Map* ) ; |
| 3866 | Mtbl* map_log_fait_drdt(const Map* ) ; |
| 3867 | Mtbl* map_log_fait_stdrdp(const Map* ) ; |
| 3868 | Mtbl* map_log_fait_srdrdt(const Map* ) ; |
| 3869 | Mtbl* map_log_fait_srstdrdp(const Map* ) ; |
| 3870 | Mtbl* map_log_fait_sr2drdt(const Map* ) ; |
| 3871 | Mtbl* map_log_fait_sr2stdrdp(const Map* ) ; |
| 3872 | Mtbl* map_log_fait_d2rdx2(const Map* ) ; |
| 3873 | Mtbl* map_log_fait_lapr_tp(const Map* ) ; |
| 3874 | Mtbl* map_log_fait_d2rdtdx(const Map* ) ; |
| 3875 | Mtbl* map_log_fait_sstd2rdpdx(const Map* ) ; |
| 3876 | Mtbl* map_log_fait_sr2d2rdt2(const Map* ) ; |
| 3877 | |
| 3878 | Mtbl* map_log_fait_dxdlnr (const Map*) ; |
| 3879 | |
| 3880 | } |
| 3881 | #endif |