LORENE
et_rot_mag_mag.C
1 /*
2  * Computes magnetic fields and derived quantities for rotating equilibrium
3  *
4  * (see file et_rot_mag.h for documentation)
5  *
6  */
7 
8 /*
9  * Copyright (c) 2002 Emmanuel Marcq
10  * Copyright (c) 2002 Jerome Novak
11  *
12  * This file is part of LORENE.
13  *
14  * LORENE is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * LORENE is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with LORENE; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27  *
28  */
29 
30 
31 
32 /*
33  * $Id: et_rot_mag_mag.C,v 1.19 2022/06/30 16:24:16 j_novak Exp $
34  * $Log: et_rot_mag_mag.C,v $
35  * Revision 1.19 2022/06/30 16:24:16 j_novak
36  * Corrected a bug in the matching of A_t potential in the case np>1 (loops were not correctly set).
37  *
38  * Revision 1.18 2016/12/05 16:17:54 j_novak
39  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
40  *
41  * Revision 1.17 2014/10/13 08:52:58 j_novak
42  * Lorene classes and functions now belong to the namespace Lorene.
43  *
44  * Revision 1.16 2014/09/03 15:33:42 j_novak
45  * Filtering of Maxwell sources is now optional.
46  *
47  * Revision 1.15 2014/07/04 12:15:12 j_novak
48  * Added filtering.
49  *
50  * Revision 1.14 2005/06/03 15:31:56 j_novak
51  * Better computation when more than one point in phi.
52  *
53  * Revision 1.13 2003/10/03 15:58:47 j_novak
54  * Cleaning of some headers
55  *
56  * Revision 1.12 2002/09/09 13:00:39 e_gourgoulhon
57  * Modification of declaration of Fortran 77 prototypes for
58  * a better portability (in particular on IBM AIX systems):
59  * All Fortran subroutine names are now written F77_* and are
60  * defined in the new file C++/Include/proto_f77.h.
61  *
62  * Revision 1.11 2002/06/05 15:15:59 j_novak
63  * The case of non-adapted mapping is treated.
64  * parmag.d and parrot.d have been merged.
65  *
66  * Revision 1.10 2002/06/03 13:23:16 j_novak
67  * The case when the mapping is not adapted is now treated
68  *
69  * Revision 1.9 2002/06/03 13:00:45 e_marcq
70  *
71  * conduc parameter read in parmag.d
72  *
73  * Revision 1.7 2002/05/20 10:31:59 j_novak
74  * *** empty log message ***
75  *
76  * Revision 1.6 2002/05/17 15:08:01 e_marcq
77  *
78  * Rotation progressive plug-in, units corrected, Q and a_j new member data
79  *
80  * Revision 1.5 2002/05/16 10:02:09 j_novak
81  * Errors in stress energy tensor corrected
82  *
83  * Revision 1.4 2002/05/15 09:54:00 j_novak
84  * First operational version
85  *
86  * Revision 1.3 2002/05/14 13:38:36 e_marcq
87  *
88  *
89  * Unit update, new outputs
90  *
91  * Revision 1.1 2002/05/10 09:26:52 j_novak
92  * Added new class Et_rot_mag for magnetized rotating neutron stars (under development)
93  *
94  *
95  * $Header: /cvsroot/Lorene/C++/Source/Etoile/et_rot_mag_mag.C,v 1.19 2022/06/30 16:24:16 j_novak Exp $
96  *
97  */
98 
99 // Headers C
100 #include <cstdlib>
101 #include <cmath>
102 
103 // Headers Lorene
104 #include "et_rot_mag.h"
105 #include "utilitaires.h"
106 #include "param.h"
107 #include "proto_f77.h"
108 #include "graphique.h"
109 #include "tensor.h"
110 
111 namespace Lorene {
112 // Local prototype (for drawings only)
113 Cmp raccord_c1(const Cmp& uu, int l1) ;
114 
115 // Algo du papier de 1995
116 
117 void Et_rot_mag::magnet_comput(const int adapt_flag,
118  Cmp (*f_j)(const Cmp&, const double),
119  Param& par_poisson_At,
120  Param& par_poisson_Avect){
121  double relax_mag = 0.5 ;
122 
123  int mag_filter = 0 ;
124  if (par_poisson_At.get_n_int() > 1)
125  mag_filter = par_poisson_At.get_int(1) ;
126 
127  int Z = mp.get_mg()->get_nzone();
128 
129  if(is_conduct()) {
130  bool adapt(adapt_flag) ;
131  /****************************************************************
132  * Assertion that all zones have same number of points in theta
133  ****************************************************************/
134  int nt = mp.get_mg()->get_nt(nzet-1) ;
135  int np = mp.get_mg()->get_np(nzet-1) ;
136  for (int l=0; l<Z; l++) assert(mp.get_mg()->get_nt(l) == nt) ;
137 
138  Tbl Rsurf(nt) ;
139  Rsurf.set_etat_qcq() ;
140  mp.r.fait() ;
141  mp.tet.fait() ;
142  Mtbl* theta = mp.tet.c ;
143  const Map_radial* mpr = dynamic_cast<const Map_radial*>(&mp) ;
144  assert (mpr != 0x0) ;
145  for (int j=0; j<nt; j++)
146  Rsurf.set(j) = mpr->val_r_jk(l_surf()(0,j), xi_surf()(0,j), j, 0) ;
147 
148 
149  // Calcul de A_0t dans l'etoile (conducteur parfait)
150 
151  Cmp A_0t(- omega * A_phi) ;
152  //A_0t.annule(nzet,Z-1) ;
153 
154  Tenseur ATTENS(A_t) ;
155  Tenseur APTENS(A_phi) ;
156  Tenseur BMN(-logn) ;
157  BMN = BMN + log(bbb) ;
158  BMN.set_std_base() ;
159 
160 
162  nphi.gradient_spher())());
164  nphi.gradient_spher())()) ;
166  BMN.gradient_spher())()
168  BMN.gradient_spher())()) ;
169 
170  Cmp ATANT(A_phi.srdsdt()); // Constrction par copie pour mapping
171 
172  ATANT.va = ATANT.va.mult_ct().ssint() ;
173 
174  Cmp ttnphi(tnphi()) ;
175  ttnphi.mult_rsint() ;
176  Cmp BLAH(- b_car()/(nnn()*nnn())*ttnphi*grad1) ;
177  BLAH -= (1+b_car()/(nnn()*nnn())*tnphi()*tnphi())*grad2 ;
178  Cmp nphisr(nphi()) ;
179  nphisr.div_r() ;
180  Cmp npgrada(2*nphisr*(A_phi.dsdr()+ATANT )) ;
181  npgrada.inc2_dzpuis() ;
182  BLAH -= grad3 + npgrada ;
183  Cmp gtt(-nnn()*nnn()+b_car()*tnphi()*tnphi()) ;
184  Cmp gtphi( - b_car()*ttnphi) ;
185 
186  // Calcul de j_t grace a Maxwell-Gauss
187  Cmp tmp(((BLAH - A_0t.laplacien())/a_car() - gtphi*j_phi)
188  / gtt);
189  tmp.annule(nzet, Z-1) ;
190  if (adapt) {
191  j_t = tmp ;
192  }
193  else {
194  j_t.allocate_all() ;
195  for (int k=0; k<np; k++)
196  for (int j=0; j<nt; j++)
197  for (int l=0; l<nzet; l++)
198  for (int i=0; i<mp.get_mg()->get_nr(l); i++)
199  j_t.set(l,k,j,i) = ( (*mp.r.c)(l,k,j,i) > Rsurf(j) ?
200  0. : tmp(l,k,j,i) ) ;
201  j_t.annule(nzet,Z-1) ;
202  }
203  j_t.std_base_scal() ;
204 
205 
206  // Calcul du courant j_phi
207  j_phi = omega * j_t + (ener() + press())*f_j(A_phi, a_j) ;
208  j_phi.std_base_scal() ;
209 
210  // Resolution de Maxwell Ampere (-> A_phi)
211  // Calcul des termes sources avec A-t du pas precedent.
212 
214  BMN.gradient_spher())());
215 
216  Tenseur source_tAphi(mp, 1, CON, mp.get_bvect_spher()) ;
217 
218  source_tAphi.set_etat_qcq() ;
219  Cmp tjphi(j_phi) ;
220  tjphi.mult_rsint() ;
221  Cmp tgrad1(grad1) ;
222  tgrad1.mult_rsint() ;
223  Cmp d_grad4(grad4) ;
224  d_grad4.div_rsint() ;
225  source_tAphi.set(0)=0 ;
226  source_tAphi.set(1)=0 ;
227  source_tAphi.set(2)= -b_car()*a_car()*(tjphi-tnphi()*j_t)
228  + b_car()/(nnn()*nnn())*(tgrad1+tnphi()*grad2)+d_grad4 ;
229 
230  source_tAphi.change_triad(mp.get_bvect_cart());
231  if (mag_filter == 1) {
232  for (int i=0; i<3; i++) {
233  Scalar tmp_filter = source_tAphi(i) ;
234  tmp_filter.exponential_filter_r(0, 2, 1) ;
235  tmp_filter.exponential_filter_ylm(0, 2, 1) ;
236  source_tAphi.set(i) = tmp_filter ;
237  }
238  }
239 
240 
241  Tenseur WORK_VECT(mp, 1, CON, mp.get_bvect_cart()) ;
242  WORK_VECT.set_etat_qcq() ;
243  for (int i=0; i<3; i++) {
244  WORK_VECT.set(i) = 0 ;
245  }
246  Tenseur WORK_SCAL(mp) ;
247  WORK_SCAL.set_etat_qcq() ;
248  WORK_SCAL.set() = 0 ;
249 
250  double lambda_mag = 0. ; // No 3D version !
251 
252  Tenseur AVECT(source_tAphi) ;
253  if (source_tAphi.get_etat() != ETATZERO) {
254 
255  for (int i=0; i<3; i++) {
256  if(source_tAphi(i).dz_nonzero()) {
257  assert( source_tAphi(i).get_dzpuis() == 4 ) ;
258  }
259  else{
260  (source_tAphi.set(i)).set_dzpuis(4) ;
261  }
262  }
263 
264  }
265  source_tAphi.poisson_vect(lambda_mag, par_poisson_Avect, AVECT, WORK_VECT,
266  WORK_SCAL) ;
268  Cmp A_phi_n(AVECT(2));
269  A_phi_n.mult_rsint() ;
270 
271  // Resolution de Maxwell-Ampere : A_1
272 
273  Cmp source_A_1t(-a_car()*(j_t*gtt + j_phi*gtphi) + BLAH);
274  if (mag_filter == 1) {
275  Scalar tmp_filter = source_A_1t ;
276  tmp_filter.exponential_filter_r(0, 2, 1) ;
277  tmp_filter.exponential_filter_ylm(0, 2, 1) ;
278  source_A_1t = tmp_filter ;
279  }
280 
281  Cmp A_1t(mp);
282  A_1t = 0 ;
283 
284  source_A_1t.poisson(par_poisson_At, A_1t) ;
285 
286  int L = mp.get_mg()->get_nt(0) ;
287 
288  Tbl MAT(L,L) ;
289  Tbl MAT_PHI(L,L);
290  Tbl VEC(L) ;
291 
292  MAT.set_etat_qcq() ;
293  VEC.set_etat_qcq() ;
294  MAT_PHI.set_etat_qcq() ;
295 
296  Tbl leg(L,2*L) ;
297  leg.set_etat_qcq() ;
298 
299  Cmp psi(mp);
300  Cmp psi2(mp);
301  Cmp psi3(mp);
302  psi.allocate_all() ;
303  psi2.allocate_all() ;
304  psi3.allocate_all() ;
305 
306  Tbl VEC3(L) ;
307  VEC3.set_etat_qcq() ;
308  for (int i=0; i<L; i++)
309  VEC3.set(i) = 1. / double(i+1) ;
310 
311  for (int p=0; p<np; p++) {
312  // leg[k,l] : legendre_l(cos(theta_k))
313  // Construction par recurrence de degre 2
314  for(int k=0;k<L;k++){
315  for(int l=0;l<2*L;l++){
316 
317  if(l==0) leg.set(k,l)=1. ;
318  if(l==1) leg.set(k,l)=cos((*theta)(l_surf()(p,k),p,k,0)) ;
319  if(l>=2) leg.set(k,l) = double(2*l-1)/double(l)
320  * cos((*theta)(l_surf()(p,k),p,k,0))
321  * leg(k,l-1)-double(l-1)/double(l)*leg(k,l-2) ;
322  }
323  }
324 
325  for(int k=0;k<L;k++){
326 
327  // Valeurs a la surface trouvees via va.val_point_jk(l,xisurf,k,p)
328 
329  VEC.set(k) = A_0t.va.val_point_jk(l_surf()(p,k), xi_surf()(p,k), k, p)
330  -A_1t.va.val_point_jk(l_surf()(p,k), xi_surf()(p,k), k, p);
331 
332  for(int l=0;l<L;l++) MAT.set(l,k) = leg(k,2*l)/pow(Rsurf(k),2*l+1);
333 
334  }
335  // appel fortran :
336 
337  int* IPIV=new int[L] ;
338  int INFO ;
339 
340  Tbl MAT_SAVE(MAT) ;
341  Tbl VEC2(L) ;
342  VEC2.set_etat_qcq() ;
343  int un = 1 ;
344 
345  F77_dgesv(&L, &un, MAT.t, &L, IPIV, VEC.t, &L, &INFO) ;
346 
347  // coeffs a_l dans VEC
348 
349  for(int k=0;k<L;k++) {VEC2.set(k)=1. ; }
350 
351  F77_dgesv(&L, &un, MAT_SAVE.t, &L, IPIV, VEC2.t, &L, &INFO) ;
352 
353  delete [] IPIV ;
354 
355  for(int nz=0;nz < Z; nz++){
356  for(int i=0;i< mp.get_mg()->get_nr(nz);i++){
357  for(int k=0;k<L;k++){
358  psi.set(nz,p,k,i) = 0. ;
359  psi2.set(nz,p,k,i) = 0. ;
360  psi3.set(nz,p,k,i) = 0. ;
361  for(int l=0;l<L;l++){
362  psi.set(nz,p,k,i) += VEC(l)*leg(k,2*l) /
363  pow((*mp.r.c)(nz,p,k,i),2*l+1);
364  psi2.set(nz,p,k,i) += VEC2(l)*leg(k,2*l)/
365  pow((*mp.r.c)(nz, p, k,i),2*l+1);
366  psi3.set(nz,p,k,i) += VEC3(l)*leg(k,2*l)/
367  (pow((*mp.r.c)(nz, p, k,i),2*l+1)) ;
368  }
369  }
370  }
371  }
372  }
373  psi.std_base_scal() ;
374  psi2.std_base_scal() ;
375 
376  assert(psi.get_dzpuis() == 0) ;
377  int dif = A_1t.get_dzpuis() ;
378  if (dif > 0) {
379  for (int d=0; d<dif; d++) A_1t.dec_dzpuis() ;
380  }
381 
382  if (adapt) {
383  Cmp A_t_ext(A_1t + psi) ;
384  A_t_ext.annule(0,nzet-1) ;
385  A_0t += A_t_ext ;
386  }
387  else {
388  tmp = A_0t ;
389  A_0t.allocate_all() ;
390  for (int k=0; k<np; k++)
391  for (int j=0; j<nt; j++)
392  for (int l=0; l<Z; l++)
393  for (int i=0; i<mp.get_mg()->get_nr(l); i++)
394  A_0t.set(l,k,j,i) = ( (*mp.r.c)(l,k,j,i) > Rsurf(j) ?
395  A_1t(l,k,j,i) + psi(l,k,j,i) : tmp(l,k,j,i) ) ;
396  }
397  A_0t.std_base_scal() ;
398 
399  if (mag_filter == 1) {
400  Scalar tmp_filter = A_0t ;
401  tmp_filter.exponential_filter_r(0, 2, 1) ;
402  tmp_filter.exponential_filter_ylm(0, 2, 1) ;
403  A_0t = tmp_filter ;
404  }
405 
406  Valeur** asymp = A_0t.asymptot(1) ;
407 
408  double Q_0 = -4*M_PI*(*asymp[1])(Z-1,0,0,0) ; // utilise A_0t plutot que E
409  delete asymp[0] ;
410  delete asymp[1] ;
411 
412  delete [] asymp ;
413 
414  asymp = psi2.asymptot(1) ;
415 
416  double Q_2 = -4*M_PI*(*asymp[1])(Z-1,0,0,0) ; // A_2t = psi2 a l'infini
417  delete asymp[0] ;
418  delete asymp[1] ;
419 
420  delete [] asymp ;
421 
422  // solution definitive de A_t:
423 
424  double C = (Q-Q_0)/Q_2 ;
425 
426  assert(psi2.get_dzpuis() == 0) ;
427  dif = A_0t.get_dzpuis() ;
428  if (dif > 0) {
429  for (int d=0; d<dif; d++) A_0t.dec_dzpuis() ;
430  }
431  Cmp A_t_n(mp) ;
432  if (adapt) {
433  A_t_n = A_0t + C ;
434  Cmp A_t_ext(A_0t + C*psi2) ;
435  A_t_ext.annule(0,nzet-1) ;
436  A_t_n.annule(nzet,Z-1) ;
437  A_t_n += A_t_ext ;
438  }
439  else {
440  A_t_n.allocate_all() ;
441  for (int k=0; k<np; k++)
442  for (int j=0; j<nt; j++)
443  for (int l=0; l<Z; l++)
444  for (int i=0; i<mp.get_mg()->get_nr(l); i++) {
445  A_t_n.set(l,k,j,i) = ( (*mp.r.c)(l,k,j,i) > Rsurf(j) ?
446  A_0t(l,k,j,i) + C*psi2(l,k,j,i) :
447  A_0t(l,k,j,i) + C ) ;
448  }
449  }
450  A_t_n.std_base_scal() ;
451  if (mag_filter == 1) {
452  Scalar tmp_filter = A_t_n ;
453  tmp_filter.exponential_filter_r(0, 2, 1) ;
454  tmp_filter.exponential_filter_ylm(0, 2, 1) ;
455  A_t_n = tmp_filter ;
456  }
457 
458  asymp = A_t_n.asymptot(1) ;
459 
460  delete asymp[0] ;
461  delete asymp[1] ;
462 
463  delete [] asymp ;
464  A_t = relax_mag*A_t_n + (1.-relax_mag)*A_t ;
465  A_phi = relax_mag*A_phi_n + (1. - relax_mag)*A_phi ;
466 
467  } // End of perfect conductor case
468 
469  else
470  {
471 
472  /***************
473  * CAS ISOLANT *
474  ***************/
475 
476  // Calcul de j_t
477  j_t = Q*nbar() + (ener()+press())*f_j(omega* A_phi - A_t,a_j) ;
478  j_t.annule(nzet,Z-1) ;
479  j_t.std_base_scal() ;
480 
481  // Calcul de j_phi
482  j_phi = omega * j_t ;
483  j_phi.std_base_scal() ;
484 
485  // Resolution de A_t
486 
487  Tenseur ATTENS(A_t) ;
488  Tenseur APTENS(A_phi) ;
489  Tenseur BMN(-logn) ;
490  BMN = BMN + log(bbb) ;
491  BMN.set_std_base() ;
492 
493 
495  nphi.gradient_spher())());
497  nphi.gradient_spher())()) ;
499  BMN.gradient_spher())()
501  BMN.gradient_spher())()) ;
502 
503  Cmp ATANT(A_phi.srdsdt());
504 
505  ATANT.va = ATANT.va.mult_ct().ssint() ;
506 
507  Cmp ttnphi(tnphi()) ;
508  ttnphi.mult_rsint() ;
509  Cmp BLAH(- b_car()/(nnn()*nnn())*ttnphi*grad1) ;
510  BLAH -= (1+b_car()/(nnn()*nnn())*tnphi()*tnphi())*grad2 ;
511  Cmp nphisr(nphi()) ;
512  nphisr.div_r() ;
513  Cmp npgrada(2*nphisr*(A_phi.dsdr()+ATANT )) ;
514  npgrada.inc2_dzpuis() ;
515  BLAH -= grad3 + npgrada ;
516  Cmp gtt(-nnn()*nnn()+b_car()*tnphi()*tnphi()) ;
517  Cmp gtphi( - b_car()*ttnphi) ;
518 
519  Cmp source_A_t_n(mp);
520  if (relativistic) {
521  source_A_t_n = (-a_car()*(j_t*gtt + j_phi*gtphi) + BLAH);
522  source_A_t_n.std_base_scal();}
523  else{
524  source_A_t_n = j_t;}
525 
526  Cmp A_t_n(A_t) ;
527  A_t_n = 0 ;
528  A_t_n.std_base_scal() ;
529 
530  source_A_t_n.poisson(par_poisson_At, A_t_n) ;
531 
532  // Resolution de A_phi
533 
535  BMN.gradient_spher())());
536 
537  Tenseur source_tAphi(mp, 1, CON, mp.get_bvect_spher()) ;
538 
539  source_tAphi.set_etat_qcq() ;
540 
541  Cmp tjphi(j_phi) ;
542  tjphi.mult_rsint() ;
543  Cmp tgrad1(grad1) ;
544  tgrad1.mult_rsint() ;
545  Cmp d_grad4(grad4) ;
546  d_grad4.div_rsint() ;
547  source_tAphi.set(0)=0 ;
548  source_tAphi.set(1)=0 ;
549 
550  if (relativistic) {
551  source_tAphi.set(2)= -b_car()*a_car()*(tjphi-tnphi()*j_t)
552  + b_car()/(nnn()*nnn())*(tgrad1+tnphi()*grad2)+d_grad4 ;}
553  else{
554  source_tAphi.set(2)= - tjphi ;}
555 
556  source_tAphi.change_triad(mp.get_bvect_cart());
557 
558  Tenseur WORK_VECT(mp, 1, CON, mp.get_bvect_cart()) ;
559  WORK_VECT.set_etat_qcq() ;
560  for (int i=0; i<3; i++) {
561  WORK_VECT.set(i) = 0 ;
562  }
563  Tenseur WORK_SCAL(mp) ;
564  WORK_SCAL.set_etat_qcq() ;
565  WORK_SCAL.set() = 0 ;
566 
567  double lambda_mag = 0. ; // No 3D version !
568 
569  Tenseur AVECT(source_tAphi) ;
570  if (source_tAphi.get_etat() != ETATZERO) {
571 
572  for (int i=0; i<3; i++) {
573  if(source_tAphi(i).dz_nonzero()) {
574  assert( source_tAphi(i).get_dzpuis() == 4 ) ;
575  }
576  else{
577  (source_tAphi.set(i)).set_dzpuis(4) ;
578  }
579  }
580 
581  }
582  source_tAphi.poisson_vect(lambda_mag, par_poisson_Avect, AVECT, WORK_VECT,
583  WORK_SCAL) ;
585  Cmp A_phi_n(AVECT(2));
586  A_phi_n.mult_rsint() ;
587 
588  // Relaxation
589 
590  A_t = relax_mag*A_t_n + (1.-relax_mag)*A_t ;
591  A_phi = relax_mag*A_phi_n + (1. - relax_mag)*A_phi ;
592 
593  }
594 
595 
596 }
597 
598 
599 
600 
601 
602 
603 
604 
605 
606 
607 
608 
609 
610 }
const Cmp & dsdr() const
Returns of *this .
Definition: cmp_deriv.C:87
const Tbl & xi_surf() const
Description of the stellar surface: returns a 2-D Tbl containing the values of the radial coordinate...
Cmp log(const Cmp &)
Neperian logarithm.
Definition: cmp_math.C:299
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
Tenseur tnphi
Component of the shift vector.
Definition: etoile.h:1518
const Tenseur & gradient_spher() const
Returns the gradient of *this (Spherical coordinates) (scalar field only).
Definition: tenseur.C:1564
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:479
void dec_dzpuis()
Decreases by 1 the value of dzpuis and changes accordingly the values of the Cmp in the external comp...
Definition: cmp_r_manip.C:157
void annule(int l)
Sets the Cmp to zero in a given domain.
Definition: cmp.C:351
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Definition: tenseur.C:1186
Multi-domain array.
Definition: mtbl.h:118
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
Definition: map.h:801
double Q
In the case of a perfect conductor, the requated baryonic charge.
Definition: et_rot_mag.h:179
Lorene prototypes.
Definition: app_hor.h:67
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:783
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
Tenseur nnn
Total lapse function.
Definition: etoile.h:512
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
Tenseur nphi
Metric coefficient .
Definition: etoile.h:1513
const Cmp & srdsdt() const
Returns of *this .
Definition: cmp_deriv.C:108
Tenseur b_car
Square of the metric factor B.
Definition: etoile.h:1510
Mtbl * c
The coordinate values at each grid point.
Definition: coord.h:97
virtual void exponential_filter_r(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the radial direction.
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
Tenseur press
Fluid pressure.
Definition: etoile.h:464
virtual const Itbl & l_surf() const
Description of the stellar surface: returns a 2-D Itbl containing the values of the domain index l on...
Cmp cos(const Cmp &)
Cosine.
Definition: cmp_math.C:97
void div_r()
Division by r everywhere.
Definition: cmp_r_manip.C:81
Coord tet
coordinate centered on the grid
Definition: map.h:737
Cmp A_phi
-component of the electromagnetic potential 1-form divided by .
Definition: et_rot_mag.h:155
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
int get_n_int() const
Returns the number of stored int &#39;s addresses.
Definition: param.C:242
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
Definition: tenseur.C:840
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
Definition: param.C:295
void magnet_comput(const int adapt_flag, Cmp(*f_j)(const Cmp &x, const double), Param &par_poisson_At, Param &par_poisson_Avect)
Computes the electromagnetic quantities solving the Maxwell equations (6) and (7) of [Bocquet...
void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Definition: tenseur.C:684
double a_j
Amplitude of the curent/charge function.
Definition: et_rot_mag.h:180
Tenseur flat_scalar_prod_desal(const Tenseur &t1, const Tenseur &t2)
Same as flat_scalar_prod but with desaliasing.
bool is_conduct() const
Tells if the star is made of conducting or isolating material.
Definition: et_rot_mag.h:241
const Valeur & ssint() const
Returns of *this.
Definition: valeur_ssint.C:115
Tenseur nbar
Baryon density in the fluid frame.
Definition: etoile.h:462
double * t
The array of double.
Definition: tbl.h:176
Parameter storage.
Definition: param.h:125
Base class for pure radial mappings.
Definition: map.h:1557
void mult_rsint()
Multiplication by .
Definition: cmp_r_manip.C:119
Map & mp
Mapping associated with the star.
Definition: etoile.h:432
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
virtual double val_r_jk(int l, double xi, int j, int k) const =0
Returns the value of the radial coordinate r for a given and a given collocation point in in a give...
double val_point_jk(int l, double x, int j, int k) const
Computes the value of the field represented by *this at an arbitrary point in , but collocation point...
Definition: valeur.C:903
Tenseur bbb
Metric factor B.
Definition: etoile.h:1507
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
void inc2_dzpuis()
Increases by 2 the value of dzpuis and changes accordingly the values of the Cmp in the external comp...
Definition: cmp_r_manip.C:195
double omega
Rotation angular velocity ([f_unit] )
Definition: etoile.h:1504
void fait() const
Computes, at each point of the grid, the value of the coordinate or mapping derivative represented by...
Definition: coord.C:119
Cmp j_phi
-component of the current 4-vector
Definition: et_rot_mag.h:159
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Definition: cmp.C:647
int nzet
Number of domains of *mp occupied by the star.
Definition: etoile.h:435
Cmp poisson() const
Solves the scalar Poisson equation with *this as a source.
Definition: cmp_pde.C:97
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:469
Tenseur a_car
Total conformal factor .
Definition: etoile.h:518
Cmp j_t
t-component of the current 4-vector
Definition: et_rot_mag.h:158
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Definition: cmp.C:326
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one. ...
Definition: etoile.h:440
Tbl & set(int l)
Read/write of the value in a given domain.
Definition: cmp.h:724
Tenseur ener
Total energy density in the fluid frame.
Definition: etoile.h:463
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
Definition: map.h:809
int get_dzpuis() const
Returns dzpuis.
Definition: cmp.h:903
Valeur ** asymptot(int n, const int flag=0) const
Asymptotic expansion at r = infinity.
Definition: cmp_asymptot.C:74
const Valeur & mult_ct() const
Returns applied to *this.
Cmp A_t
t-component of the elecctromagnetic potential 1-form, divided by .
Definition: et_rot_mag.h:150
Tenseur & logn
Metric potential = logn_auto.
Definition: etoile.h:1524
Basic array class.
Definition: tbl.h:164
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:474
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tenseur.C:652
virtual void exponential_filter_ylm(int lzmin, int lzmax, int p, double alpha=-16.)
Applies an exponential filter to the spectral coefficients in the angular directions.
const Cmp & laplacien(int zec_mult_r=4) const
Returns the Laplacian of *this.
Definition: cmp_deriv.C:245
Valeur va
The numerical value of the Cmp.
Definition: cmp.h:464
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:304
Coord r
r coordinate centered on the grid
Definition: map.h:736