104 #include "et_rot_mag.h" 105 #include "utilitaires.h" 107 #include "proto_f77.h" 108 #include "graphique.h" 113 Cmp raccord_c1(
const Cmp& uu,
int l1) ;
118 Cmp (*f_j)(
const Cmp&,
const double),
119 Param& par_poisson_At,
120 Param& par_poisson_Avect){
121 double relax_mag = 0.5 ;
125 mag_filter = par_poisson_At.
get_int(1) ;
130 bool adapt(adapt_flag) ;
144 assert (mpr != 0x0) ;
145 for (
int j=0; j<nt; j++)
182 BLAH -= grad3 + npgrada ;
195 for (
int k=0; k<np; k++)
196 for (
int j=0; j<nt; j++)
197 for (
int l=0; l<
nzet; l++)
199 j_t.
set(l,k,j,i) = ( (*
mp.
r.
c)(l,k,j,i) > Rsurf(j) ?
200 0. : tmp(l,k,j,i) ) ;
224 d_grad4.div_rsint() ;
225 source_tAphi.set(0)=0 ;
226 source_tAphi.set(1)=0 ;
231 if (mag_filter == 1) {
232 for (
int i=0; i<3; i++) {
233 Scalar tmp_filter = source_tAphi(i) ;
236 source_tAphi.set(i) = tmp_filter ;
243 for (
int i=0; i<3; i++) {
244 WORK_VECT.set(i) = 0 ;
248 WORK_SCAL.
set() = 0 ;
250 double lambda_mag = 0. ;
253 if (source_tAphi.get_etat() != ETATZERO) {
255 for (
int i=0; i<3; i++) {
256 if(source_tAphi(i).dz_nonzero()) {
257 assert( source_tAphi(i).get_dzpuis() == 4 ) ;
260 (source_tAphi.set(i)).set_dzpuis(4) ;
265 source_tAphi.poisson_vect(lambda_mag, par_poisson_Avect, AVECT, WORK_VECT,
268 Cmp A_phi_n(AVECT(2));
274 if (mag_filter == 1) {
275 Scalar tmp_filter = source_A_1t ;
278 source_A_1t = tmp_filter ;
284 source_A_1t.
poisson(par_poisson_At, A_1t) ;
308 for (
int i=0; i<L; i++)
309 VEC3.
set(i) = 1. / double(i+1) ;
311 for (
int p=0; p<np; p++) {
314 for(
int k=0;k<L;k++){
315 for(
int l=0;l<2*L;l++){
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)
321 * leg(k,l-1)-double(l-1)/double(l)*leg(k,l-2) ;
325 for(
int k=0;k<L;k++){
332 for(
int l=0;l<L;l++) MAT.
set(l,k) = leg(k,2*l)/
pow(Rsurf(k),2*l+1);
337 int* IPIV=
new int[L] ;
345 F77_dgesv(&L, &un, MAT.
t, &L, IPIV, VEC.
t, &L, &INFO) ;
349 for(
int k=0;k<L;k++) {VEC2.
set(k)=1. ; }
351 F77_dgesv(&L, &un, MAT_SAVE.
t, &L, IPIV, VEC2.
t, &L, &INFO) ;
355 for(
int nz=0;nz < Z; nz++){
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)) ;
383 Cmp A_t_ext(A_1t + psi) ;
390 for (
int k=0; k<np; k++)
391 for (
int j=0; j<nt; j++)
392 for (
int l=0; l<Z; l++)
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) ) ;
399 if (mag_filter == 1) {
400 Scalar tmp_filter = A_0t ;
408 double Q_0 = -4*M_PI*(*asymp[1])(Z-1,0,0,0) ;
416 double Q_2 = -4*M_PI*(*asymp[1])(Z-1,0,0,0) ;
424 double C = (
Q-Q_0)/Q_2 ;
434 Cmp A_t_ext(A_0t + C*psi2) ;
441 for (
int k=0; k<np; k++)
442 for (
int j=0; j<nt; j++)
443 for (
int l=0; l<Z; l++)
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 ) ;
451 if (mag_filter == 1) {
452 Scalar tmp_filter = A_t_n ;
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 ;
515 BLAH -= grad3 + npgrada ;
519 Cmp source_A_t_n(
mp);
530 source_A_t_n.
poisson(par_poisson_At, A_t_n) ;
546 d_grad4.div_rsint() ;
547 source_tAphi.set(0)=0 ;
548 source_tAphi.set(1)=0 ;
554 source_tAphi.
set(2)= - tjphi ;}
560 for (
int i=0; i<3; i++) {
561 WORK_VECT.set(i) = 0 ;
565 WORK_SCAL.
set() = 0 ;
567 double lambda_mag = 0. ;
570 if (source_tAphi.get_etat() != ETATZERO) {
572 for (
int i=0; i<3; i++) {
573 if(source_tAphi(i).dz_nonzero()) {
574 assert( source_tAphi(i).get_dzpuis() == 4 ) ;
577 (source_tAphi.set(i)).set_dzpuis(4) ;
582 source_tAphi.poisson_vect(lambda_mag, par_poisson_Avect, AVECT, WORK_VECT,
585 Cmp A_phi_n(AVECT(2));
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 ;
const Cmp & dsdr() const
Returns of *this .
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.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Tenseur tnphi
Component of the shift vector.
const Tenseur & gradient_spher() const
Returns the gradient of *this (Spherical coordinates) (scalar field only).
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
void dec_dzpuis()
Decreases by 1 the value of dzpuis and changes accordingly the values of the Cmp in the external comp...
void annule(int l)
Sets the Cmp to zero in a given domain.
void set_std_base()
Set the standard spectal basis of decomposition for each component.
const Base_vect_spher & get_bvect_spher() const
Returns the orthonormal vectorial basis associated with the coordinates of the mapping.
double Q
In the case of a perfect conductor, the requated baryonic charge.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Tenseur nnn
Total lapse function.
Tensor field of valence 0 (or component of a tensorial field).
Tenseur nphi
Metric coefficient .
const Cmp & srdsdt() const
Returns of *this .
Tenseur b_car
Square of the metric factor B.
Mtbl * c
The coordinate values at each grid point.
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.
Tenseur press
Fluid pressure.
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.
void div_r()
Division by r everywhere.
Coord tet
coordinate centered on the grid
Cmp A_phi
-component of the electromagnetic potential 1-form divided by .
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_n_int() const
Returns the number of stored int 's addresses.
Cmp & set()
Read/write for a scalar (see also operator=(const Cmp&) ).
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
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.
double a_j
Amplitude of the curent/charge function.
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.
const Valeur & ssint() const
Returns of *this.
Tenseur nbar
Baryon density in the fluid frame.
double * t
The array of double.
Base class for pure radial mappings.
void mult_rsint()
Multiplication by .
Map & mp
Mapping associated with the star.
int get_nzone() const
Returns the number of domains.
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...
Tenseur bbb
Metric factor B.
Cmp pow(const Cmp &, int)
Power .
void inc2_dzpuis()
Increases by 2 the value of dzpuis and changes accordingly the values of the Cmp in the external comp...
double omega
Rotation angular velocity ([f_unit] )
void fait() const
Computes, at each point of the grid, the value of the coordinate or mapping derivative represented by...
Cmp j_phi
-component of the current 4-vector
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
int nzet
Number of domains of *mp occupied by the star.
Cmp poisson() const
Solves the scalar Poisson equation with *this as a source.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Tenseur a_car
Total conformal factor .
Cmp j_t
t-component of the current 4-vector
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
bool relativistic
Indicator of relativity: true for a relativistic star, false for a Newtonian one. ...
Tbl & set(int l)
Read/write of the value in a given domain.
Tenseur ener
Total energy density in the fluid frame.
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping, i.e.
int get_dzpuis() const
Returns dzpuis.
Valeur ** asymptot(int n, const int flag=0) const
Asymptotic expansion at r = infinity.
const Valeur & mult_ct() const
Returns applied to *this.
Cmp A_t
t-component of the elecctromagnetic potential 1-form, divided by .
Tenseur & logn
Metric potential = logn_auto.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
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.
Valeur va
The numerical value of the Cmp.
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Coord r
r coordinate centered on the grid