| 1 |
/* |
| 2 |
* Methods of the class Star_QI to compute global quantities |
| 3 |
* |
| 4 |
* (see file compobj.h for documentation). |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
/* |
| 9 |
* Copyright (c) 2012 Claire Some, Eric Gourgoulhon |
| 10 |
* |
| 11 |
* This file is part of LORENE. |
| 12 |
* |
| 13 |
* LORENE is free software; you can redistribute it and/or modify |
| 14 |
* it under the terms of the GNU General Public License version 2 |
| 15 |
* as published by the Free Software Foundation. |
| 16 |
* |
| 17 |
* LORENE is distributed in the hope that it will be useful, |
| 18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
* GNU General Public License for more details. |
| 21 |
* |
| 22 |
* You should have received a copy of the GNU General Public License |
| 23 |
* along with LORENE; if not, write to the Free Software |
| 24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 |
* |
| 26 |
*/ |
| 27 |
|
| 28 |
char star_QI_global_C[] = "$Header: /cvsroot/Lorene/C++/Source/Compobj/star_QI_global.C,v 1.3 2014/10/13 08:52:49 j_novak Exp $" ; |
| 29 |
|
| 30 |
/* |
| 31 |
* $Id: star_QI_global.C,v 1.3 2014/10/13 08:52:49 j_novak Exp $ |
| 32 |
* $Log: star_QI_global.C,v $ |
| 33 |
* Revision 1.3 2014/10/13 08:52:49 j_novak |
| 34 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 35 |
* |
| 36 |
* Revision 1.2 2013/06/05 15:10:41 j_novak |
| 37 |
* Suppression of FINJAC sampling in r. This Jacobi(0,2) base is now |
| 38 |
* available by setting colloc_r to BASE_JAC02 in the Mg3d constructor. |
| 39 |
* |
| 40 |
* Revision 1.1 2012/11/21 14:54:13 c_some |
| 41 |
* First version |
| 42 |
* |
| 43 |
* |
| 44 |
* |
| 45 |
* $Header: /cvsroot/Lorene/C++/Source/Compobj/star_QI_global.C,v 1.3 2014/10/13 08:52:49 j_novak Exp $ |
| 46 |
* |
| 47 |
*/ |
| 48 |
|
| 49 |
|
| 50 |
// C headers |
| 51 |
#include <cassert> |
| 52 |
#include <cstdlib> |
| 53 |
|
| 54 |
// Lorene headers |
| 55 |
#include "compobj.h" |
| 56 |
#include "unites.h" |
| 57 |
#include "proto_f77.h" |
| 58 |
|
| 59 |
//------------------------// |
| 60 |
// Gravitational mass // |
| 61 |
//------------------------// |
| 62 |
|
| 63 |
namespace Lorene { |
| 64 |
double Star_QI::mass_g() const { |
| 65 |
|
| 66 |
if (p_mass_g == 0x0) { // a new computation is required |
| 67 |
|
| 68 |
Scalar s_euler = stress_euler.trace(gamma) ; |
| 69 |
|
| 70 |
//## alternative: |
| 71 |
// assert(*(stress_euler.get_triad()) == mp.get_bvect_spher()) ; |
| 72 |
// Scalar s_euler = ( stress_euler(1,1) + stress_euler(2,2) ) / a_car |
| 73 |
// + stress_euler(3,3) / b_car ; |
| 74 |
|
| 75 |
// Cf. Eq. (4.18) of arXiv:1003.5015v2 with (E+p) U = B * mom_euler(3) |
| 76 |
|
| 77 |
Scalar source = nn * (ener_euler + s_euler) |
| 78 |
+ 2 * b_car * mom_euler(3) |
| 79 |
* tnphi ; |
| 80 |
source = a_car * bbb * source ; |
| 81 |
source.std_spectral_base() ; |
| 82 |
|
| 83 |
p_mass_g = new double( source.integrale() ) ; |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
return *p_mass_g ; |
| 88 |
|
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
//------------------------// |
| 93 |
// Angular momentum // |
| 94 |
//------------------------// |
| 95 |
|
| 96 |
double Star_QI::angu_mom() const { |
| 97 |
|
| 98 |
if (p_angu_mom == 0x0) { // a new computation is required |
| 99 |
|
| 100 |
// Cf. Eq. (4.39) of arXiv:1003.5015v2 with (E+p) U = B * mom_euler(3) |
| 101 |
|
| 102 |
assert(*(mom_euler.get_triad()) == mp.get_bvect_spher()) ; |
| 103 |
|
| 104 |
Scalar dens = mom_euler(3) ; |
| 105 |
|
| 106 |
dens.mult_r() ; // Multiplication by |
| 107 |
dens.set_spectral_va() = (dens.get_spectral_va()).mult_st() ; // r sin(theta) |
| 108 |
|
| 109 |
dens = a_car * b_car * bbb * dens ; |
| 110 |
|
| 111 |
p_angu_mom = new double( dens.integrale() ) ; |
| 112 |
|
| 113 |
} |
| 114 |
|
| 115 |
return *p_angu_mom ; |
| 116 |
|
| 117 |
} |
| 118 |
|
| 119 |
//--------------------// |
| 120 |
// GRV2 // |
| 121 |
//--------------------// |
| 122 |
|
| 123 |
double Star_QI::grv2() const { |
| 124 |
|
| 125 |
using namespace Unites ; |
| 126 |
if (p_grv2 == 0x0) { // a new computation is required |
| 127 |
|
| 128 |
assert( *(stress_euler.get_triad()) == mp.get_bvect_spher() ) ; |
| 129 |
Scalar sou_m = 2 * qpig * a_car * b_car * stress_euler(3,3) ; |
| 130 |
|
| 131 |
Vector dlogn = logn.derive_cov( mp.flat_met_spher() ) ; |
| 132 |
Scalar sou_q = 1.5 * ak_car |
| 133 |
- dlogn(1)*dlogn(1) - dlogn(2)*dlogn(2) - dlogn(3)*dlogn(3) ; |
| 134 |
|
| 135 |
p_grv2 = new double( double(1) - lambda_grv2(sou_m, sou_q) ) ; |
| 136 |
|
| 137 |
} |
| 138 |
|
| 139 |
return *p_grv2 ; |
| 140 |
|
| 141 |
} |
| 142 |
|
| 143 |
|
| 144 |
//--------------------// |
| 145 |
// GRV3 // |
| 146 |
//--------------------// |
| 147 |
|
| 148 |
double Star_QI::grv3(ostream* ost) const { |
| 149 |
|
| 150 |
using namespace Unites ; |
| 151 |
|
| 152 |
if (p_grv3 == 0x0) { // a new computation is required |
| 153 |
|
| 154 |
Scalar source(mp) ; |
| 155 |
|
| 156 |
// Gravitational term [cf. Eq. (43) of Gourgoulhon & Bonazzola |
| 157 |
// ------------------ Class. Quantum Grav. 11, 443 (1994)] |
| 158 |
|
| 159 |
Vector dlogn = logn.derive_cov( mp.flat_met_spher() ) ; |
| 160 |
|
| 161 |
Scalar alpha = dzeta - logn ; |
| 162 |
Scalar bet = log( bbb ) ; |
| 163 |
bet.std_spectral_base() ; |
| 164 |
|
| 165 |
Vector dalpha = alpha.derive_cov( mp.flat_met_spher() ) ; |
| 166 |
Vector dbet = bet.derive_cov( mp.flat_met_spher() ) ; |
| 167 |
|
| 168 |
source = 0.75 * ak_car |
| 169 |
- dlogn(1)*dlogn(1) - dlogn(2)*dlogn(2) - dlogn(3)*dlogn(3) |
| 170 |
+ 0.5 * ( dalpha(1)*dbet(1) + dalpha(2)*dbet(2) + dalpha(3)*dbet(3) ) ; |
| 171 |
|
| 172 |
Scalar aa = alpha - 0.5 * bet ; |
| 173 |
Scalar daadt = aa.srdsdt() ; // 1/r d/dth |
| 174 |
|
| 175 |
// What follows is valid only for a mapping of class Map_radial : |
| 176 |
const Map_radial* mpr = dynamic_cast<const Map_radial*>(&mp) ; |
| 177 |
if (mpr == 0x0) { |
| 178 |
cout << "Star_rot::grv3: the mapping does not belong" |
| 179 |
<< " to the class Map_radial !" << endl ; |
| 180 |
abort() ; |
| 181 |
} |
| 182 |
|
| 183 |
// Computation of 1/tan(theta) * 1/r daa/dtheta |
| 184 |
if (daadt.get_etat() == ETATQCQ) { |
| 185 |
Valeur& vdaadt = daadt.set_spectral_va() ; |
| 186 |
vdaadt = vdaadt.ssint() ; // division by sin(theta) |
| 187 |
vdaadt = vdaadt.mult_ct() ; // multiplication by cos(theta) |
| 188 |
} |
| 189 |
|
| 190 |
Scalar temp = aa.dsdr() + daadt ; |
| 191 |
temp = ( bbb - a_car/bbb ) * temp ; |
| 192 |
temp.std_spectral_base() ; |
| 193 |
|
| 194 |
// Division by r |
| 195 |
Valeur& vtemp = temp.set_spectral_va() ; |
| 196 |
vtemp = vtemp.sx() ; // division by xi in the nucleus |
| 197 |
// Id in the shells |
| 198 |
// division by xi-1 in the ZEC |
| 199 |
vtemp = (mpr->xsr) * vtemp ; // multiplication by xi/r in the nucleus |
| 200 |
// by 1/r in the shells |
| 201 |
// by r(xi-1) in the ZEC |
| 202 |
|
| 203 |
// In the ZEC, a multiplication by r has been performed instead |
| 204 |
// of the division: |
| 205 |
temp.set_dzpuis( temp.get_dzpuis() + 2 ) ; |
| 206 |
|
| 207 |
source = bbb * source + 0.5 * temp ; |
| 208 |
|
| 209 |
source.std_spectral_base() ; |
| 210 |
|
| 211 |
double int_grav = source.integrale() ; |
| 212 |
|
| 213 |
// Matter term |
| 214 |
// ----------- |
| 215 |
|
| 216 |
Scalar s_euler = stress_euler.trace(gamma) ; |
| 217 |
|
| 218 |
//## alternative: |
| 219 |
// assert(*(stress_euler.get_triad()) == mp.get_bvect_spher()) ; |
| 220 |
// Scalar s_euler = ( stress_euler(1,1) + stress_euler(2,2) ) / a_car |
| 221 |
// + stress_euler(3,3) / b_car ; |
| 222 |
|
| 223 |
source = qpig * a_car * bbb * s_euler ; |
| 224 |
|
| 225 |
source.std_spectral_base() ; |
| 226 |
|
| 227 |
double int_mat = source.integrale() ; |
| 228 |
|
| 229 |
// Virial error |
| 230 |
// ------------ |
| 231 |
if (ost != 0x0) { |
| 232 |
*ost << "Star_rot::grv3 : gravitational term : " << int_grav |
| 233 |
<< endl ; |
| 234 |
*ost << "Star_rot::grv3 : matter term : " << int_mat |
| 235 |
<< endl ; |
| 236 |
} |
| 237 |
|
| 238 |
p_grv3 = new double( (int_grav + int_mat) / int_mat ) ; |
| 239 |
|
| 240 |
} |
| 241 |
|
| 242 |
return *p_grv3 ; |
| 243 |
|
| 244 |
} |
| 245 |
|
| 246 |
//----------------------------// |
| 247 |
// Quadrupole moment // |
| 248 |
//----------------------------// |
| 249 |
|
| 250 |
double Star_QI::mom_quad() const { |
| 251 |
|
| 252 |
using namespace Unites ; |
| 253 |
if (p_mom_quad == 0x0) { // a new computation is required |
| 254 |
|
| 255 |
// Source for of the Poisson equation for nu |
| 256 |
// ----------------------------------------- |
| 257 |
|
| 258 |
Scalar source(mp) ; |
| 259 |
|
| 260 |
Scalar s_euler = stress_euler.trace(gamma) ; |
| 261 |
|
| 262 |
//## alternative: |
| 263 |
// assert(*(stress_euler.get_triad()) == mp.get_bvect_spher()) ; |
| 264 |
// Scalar s_euler = ( stress_euler(1,1) + stress_euler(2,2) ) / a_car |
| 265 |
// + stress_euler(3,3) / b_car ; |
| 266 |
|
| 267 |
Scalar bet = log(bbb) ; |
| 268 |
bet.std_spectral_base() ; |
| 269 |
|
| 270 |
Vector dlogn = logn.derive_cov( mp.flat_met_spher() ) ; |
| 271 |
Vector dlogn_bet = dlogn + bet.derive_cov( mp.flat_met_spher() ) ; |
| 272 |
|
| 273 |
source = qpig * a_car *( ener_euler + s_euler ) + ak_car |
| 274 |
- dlogn(1)*dlogn_bet(1) - dlogn(2)*dlogn_bet(2) - dlogn(3)*dlogn_bet(3) ; |
| 275 |
|
| 276 |
source.std_spectral_base() ; |
| 277 |
|
| 278 |
// Multiplication by -r^2 P_2(cos(theta)) |
| 279 |
// [cf Eq.(7) of Salgado et al. Astron. Astrophys. 291, 155 (1994) ] |
| 280 |
// ------------------------------------------------------------------ |
| 281 |
|
| 282 |
// Multiplication by r^2 : |
| 283 |
// ---------------------- |
| 284 |
source.mult_r() ; |
| 285 |
source.mult_r() ; |
| 286 |
if (source.check_dzpuis(2)) { |
| 287 |
source.inc_dzpuis(2) ; |
| 288 |
} |
| 289 |
|
| 290 |
// Muliplication by cos^2(theta) : |
| 291 |
// ----------------------------- |
| 292 |
Scalar temp = source ; |
| 293 |
|
| 294 |
// What follows is valid only for a mapping of class Map_radial : |
| 295 |
assert( dynamic_cast<const Map_radial*>(&mp) != 0x0 ) ; |
| 296 |
|
| 297 |
if (temp.get_etat() == ETATQCQ) { |
| 298 |
Valeur& vtemp = temp.set_spectral_va() ; |
| 299 |
vtemp = vtemp.mult_ct() ; // multiplication by cos(theta) |
| 300 |
vtemp = vtemp.mult_ct() ; // multiplication by cos(theta) |
| 301 |
} |
| 302 |
|
| 303 |
// Muliplication by -P_2(cos(theta)) : |
| 304 |
// ---------------------------------- |
| 305 |
source = 0.5 * source - 1.5 * temp ; |
| 306 |
|
| 307 |
// Final result |
| 308 |
// ------------ |
| 309 |
|
| 310 |
p_mom_quad = new double( source.integrale() / qpig ) ; |
| 311 |
|
| 312 |
} |
| 313 |
|
| 314 |
return *p_mom_quad ; |
| 315 |
|
| 316 |
} |
| 317 |
|
| 318 |
|
| 319 |
// Function Star_QI::lambda_grv2 |
| 320 |
|
| 321 |
double Star_QI::lambda_grv2(const Scalar& sou_m, const Scalar& sou_q) { |
| 322 |
|
| 323 |
const Map_radial* mprad = dynamic_cast<const Map_radial*>( &sou_m.get_mp() ) ; |
| 324 |
|
| 325 |
if (mprad == 0x0) { |
| 326 |
cout << "Star_rot::lambda_grv2: the mapping of sou_m does not" |
| 327 |
<< endl << " belong to the class Map_radial !" << endl ; |
| 328 |
abort() ; |
| 329 |
} |
| 330 |
|
| 331 |
assert( &sou_q.get_mp() == mprad ) ; |
| 332 |
|
| 333 |
sou_q.check_dzpuis(4) ; |
| 334 |
|
| 335 |
const Mg3d* mg = mprad->get_mg() ; |
| 336 |
int nz = mg->get_nzone() ; |
| 337 |
|
| 338 |
// Construction of a Map_af which coincides with *mp on the equator |
| 339 |
// ---------------------------------------------------------------- |
| 340 |
|
| 341 |
double theta0 = M_PI / 2 ; // Equator |
| 342 |
double phi0 = 0 ; |
| 343 |
|
| 344 |
Map_af mpaff(*mprad) ; |
| 345 |
|
| 346 |
for (int l=0 ; l<nz ; l++) { |
| 347 |
double rmax = mprad->val_r(l, double(1), theta0, phi0) ; |
| 348 |
switch ( mg->get_type_r(l) ) { |
| 349 |
case RARE: { |
| 350 |
double rmin = mprad->val_r(l, double(0), theta0, phi0) ; |
| 351 |
mpaff.set_alpha(rmax - rmin, l) ; |
| 352 |
mpaff.set_beta(rmin, l) ; |
| 353 |
break ; |
| 354 |
} |
| 355 |
|
| 356 |
case FIN: { |
| 357 |
double rmin = mprad->val_r(l, double(-1), theta0, phi0) ; |
| 358 |
mpaff.set_alpha( double(.5) * (rmax - rmin), l ) ; |
| 359 |
mpaff.set_beta( double(.5) * (rmax + rmin), l) ; |
| 360 |
break ; |
| 361 |
} |
| 362 |
|
| 363 |
case UNSURR: { |
| 364 |
double rmin = mprad->val_r(l, double(-1), theta0, phi0) ; |
| 365 |
double umax = double(1) / rmin ; |
| 366 |
double umin = double(1) / rmax ; |
| 367 |
mpaff.set_alpha( double(.5) * (umin - umax), l) ; |
| 368 |
mpaff.set_beta( double(.5) * (umin + umax), l) ; |
| 369 |
break ; |
| 370 |
} |
| 371 |
|
| 372 |
default: { |
| 373 |
cout << "Star_rot::lambda_grv2: unknown type_r ! " << endl ; |
| 374 |
abort () ; |
| 375 |
break ; |
| 376 |
} |
| 377 |
|
| 378 |
} |
| 379 |
} |
| 380 |
|
| 381 |
|
| 382 |
// Reduced Jacobian of |
| 383 |
// the transformation (r,theta,phi) <-> (dzeta,theta',phi') |
| 384 |
// ------------------------------------------------------------ |
| 385 |
|
| 386 |
Mtbl jac = 1 / ( (mprad->xsr) * (mprad->dxdr) ) ; |
| 387 |
// R/x dR/dx in the nucleus |
| 388 |
// R dR/dx in the shells |
| 389 |
// - U/(x-1) dU/dx in the ZEC |
| 390 |
for (int l=0; l<nz; l++) { |
| 391 |
switch ( mg->get_type_r(l) ) { |
| 392 |
case RARE: { |
| 393 |
double a1 = mpaff.get_alpha()[l] ; |
| 394 |
*(jac.t[l]) = *(jac.t[l]) / (a1*a1) ; |
| 395 |
break ; |
| 396 |
} |
| 397 |
|
| 398 |
case FIN: { |
| 399 |
double a1 = mpaff.get_alpha()[l] ; |
| 400 |
double b1 = mpaff.get_beta()[l] ; |
| 401 |
assert( jac.t[l]->get_etat() == ETATQCQ ) ; |
| 402 |
double* tjac = jac.t[l]->t ; |
| 403 |
double* const xi = mg->get_grille3d(l)->x ; |
| 404 |
for (int k=0; k<mg->get_np(l); k++) { |
| 405 |
for (int j=0; j<mg->get_nt(l); j++) { |
| 406 |
for (int i=0; i<mg->get_nr(l); i++) { |
| 407 |
*tjac = *tjac / |
| 408 |
(a1 * (a1 * xi[i] + b1) ) ; |
| 409 |
tjac++ ; |
| 410 |
} |
| 411 |
} |
| 412 |
} |
| 413 |
|
| 414 |
break ; |
| 415 |
} |
| 416 |
|
| 417 |
case UNSURR: { |
| 418 |
double a1 = mpaff.get_alpha()[l] ; |
| 419 |
*(jac.t[l]) = - *(jac.t[l]) / (a1*a1) ; |
| 420 |
break ; |
| 421 |
} |
| 422 |
|
| 423 |
default: { |
| 424 |
cout << "Star_rot::lambda_grv2: unknown type_r ! " << endl ; |
| 425 |
abort () ; |
| 426 |
break ; |
| 427 |
} |
| 428 |
|
| 429 |
} |
| 430 |
|
| 431 |
} |
| 432 |
|
| 433 |
|
| 434 |
// Multiplication of the sources by the reduced Jacobian: |
| 435 |
// ----------------------------------------------------- |
| 436 |
|
| 437 |
Mtbl s_m(mg) ; |
| 438 |
if ( sou_m.get_etat() == ETATZERO ) { |
| 439 |
s_m = 0 ; |
| 440 |
} |
| 441 |
else{ |
| 442 |
assert(sou_m.get_spectral_va().get_etat() == ETATQCQ) ; |
| 443 |
sou_m.get_spectral_va().coef_i() ; |
| 444 |
s_m = *(sou_m.get_spectral_va().c) ; |
| 445 |
} |
| 446 |
|
| 447 |
Mtbl s_q(mg) ; |
| 448 |
if ( sou_q.get_etat() == ETATZERO ) { |
| 449 |
s_q = 0 ; |
| 450 |
} |
| 451 |
else{ |
| 452 |
assert(sou_q.get_spectral_va().get_etat() == ETATQCQ) ; |
| 453 |
sou_q.get_spectral_va().coef_i() ; |
| 454 |
s_q = *(sou_q.get_spectral_va().c) ; |
| 455 |
} |
| 456 |
|
| 457 |
s_m *= jac ; |
| 458 |
s_q *= jac ; |
| 459 |
|
| 460 |
|
| 461 |
// Preparations for the call to the Fortran subroutine |
| 462 |
// --------------------------------------------------- |
| 463 |
|
| 464 |
int np1 = 1 ; // Axisymmetry enforced |
| 465 |
int nt = mg->get_nt(0) ; |
| 466 |
int nt2 = 2*nt - 1 ; // Number of points for the theta sampling |
| 467 |
// in [0,Pi], instead of [0,Pi/2] |
| 468 |
|
| 469 |
// Array NDL |
| 470 |
// --------- |
| 471 |
int* ndl = new int[nz+4] ; |
| 472 |
ndl[0] = nz ; |
| 473 |
for (int l=0; l<nz; l++) { |
| 474 |
ndl[1+l] = mg->get_nr(l) ; |
| 475 |
} |
| 476 |
ndl[1+nz] = nt2 ; |
| 477 |
ndl[2+nz] = np1 ; |
| 478 |
ndl[3+nz] = nz ; |
| 479 |
|
| 480 |
// Parameters NDR, NDT, NDP |
| 481 |
// ------------------------ |
| 482 |
int nrmax = 0 ; |
| 483 |
for (int l=0; l<nz ; l++) { |
| 484 |
nrmax = ( ndl[1+l] > nrmax ) ? ndl[1+l] : nrmax ; |
| 485 |
} |
| 486 |
int ndr = nrmax + 5 ; |
| 487 |
int ndt = nt2 + 2 ; |
| 488 |
int ndp = np1 + 2 ; |
| 489 |
|
| 490 |
// Array ERRE |
| 491 |
// ---------- |
| 492 |
|
| 493 |
double* erre = new double [nz*ndr] ; |
| 494 |
|
| 495 |
for (int l=0; l<nz; l++) { |
| 496 |
double a1 = mpaff.get_alpha()[l] ; |
| 497 |
double b1 = mpaff.get_beta()[l] ; |
| 498 |
for (int i=0; i<ndl[1+l]; i++) { |
| 499 |
double xi = mg->get_grille3d(l)->x[i] ; |
| 500 |
erre[ ndr*l + i ] = a1 * xi + b1 ; |
| 501 |
} |
| 502 |
} |
| 503 |
|
| 504 |
// Arrays containing the data |
| 505 |
// -------------------------- |
| 506 |
|
| 507 |
int ndrt = ndr*ndt ; |
| 508 |
int ndrtp = ndr*ndt*ndp ; |
| 509 |
int taille = ndrtp*nz ; |
| 510 |
|
| 511 |
double* tsou_m = new double[ taille ] ; |
| 512 |
double* tsou_q = new double[ taille ] ; |
| 513 |
|
| 514 |
// Initialisation to zero : |
| 515 |
for (int i=0; i<taille; i++) { |
| 516 |
tsou_m[i] = 0 ; |
| 517 |
tsou_q[i] = 0 ; |
| 518 |
} |
| 519 |
|
| 520 |
// Copy of s_m into tsou_m |
| 521 |
// ----------------------- |
| 522 |
|
| 523 |
for (int l=0; l<nz; l++) { |
| 524 |
for (int k=0; k<np1; k++) { |
| 525 |
for (int j=0; j<nt; j++) { |
| 526 |
for (int i=0; i<mg->get_nr(l); i++) { |
| 527 |
double xx = s_m(l, k, j, i) ; |
| 528 |
tsou_m[ndrtp*l + ndrt*k + ndr*j + i] = xx ; |
| 529 |
// point symetrique par rapport au plan theta = pi/2 : |
| 530 |
tsou_m[ndrtp*l + ndrt*k + ndr*(nt2-1-j) + i] = xx ; |
| 531 |
} |
| 532 |
} |
| 533 |
} |
| 534 |
} |
| 535 |
|
| 536 |
// Copy of s_q into tsou_q |
| 537 |
// ----------------------- |
| 538 |
|
| 539 |
for (int l=0; l<nz; l++) { |
| 540 |
for (int k=0; k<np1; k++) { |
| 541 |
for (int j=0; j<nt; j++) { |
| 542 |
for (int i=0; i<mg->get_nr(l); i++) { |
| 543 |
double xx = s_q(l, k, j, i) ; |
| 544 |
tsou_q[ndrtp*l + ndrt*k + ndr*j + i] = xx ; |
| 545 |
// point symetrique par rapport au plan theta = pi/2 : |
| 546 |
tsou_q[ndrtp*l + ndrt*k + ndr*(nt2-1-j) + i] = xx ; |
| 547 |
} |
| 548 |
} |
| 549 |
} |
| 550 |
} |
| 551 |
|
| 552 |
|
| 553 |
// Computation of the integrals |
| 554 |
// ---------------------------- |
| 555 |
|
| 556 |
double int_m, int_q ; |
| 557 |
F77_integrale2d(ndl, &ndr, &ndt, &ndp, erre, tsou_m, &int_m) ; |
| 558 |
F77_integrale2d(ndl, &ndr, &ndt, &ndp, erre, tsou_q, &int_q) ; |
| 559 |
|
| 560 |
// Cleaning |
| 561 |
// -------- |
| 562 |
|
| 563 |
delete [] ndl ; |
| 564 |
delete [] erre ; |
| 565 |
delete [] tsou_m ; |
| 566 |
delete [] tsou_q ; |
| 567 |
|
| 568 |
// Computation of lambda |
| 569 |
// --------------------- |
| 570 |
|
| 571 |
double lambda ; |
| 572 |
if ( int_q != double(0) ) { |
| 573 |
lambda = - int_m / int_q ; |
| 574 |
} |
| 575 |
else{ |
| 576 |
lambda = 0 ; |
| 577 |
} |
| 578 |
|
| 579 |
return lambda ; |
| 580 |
|
| 581 |
} |
| 582 |
|
| 583 |
} |