Skip to content

Commit

Permalink
Renaming icell_ref to icell1
Browse files Browse the repository at this point in the history
  • Loading branch information
cpinte committed Sep 28, 2024
1 parent c95a105 commit db4a42d
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 98 deletions.
2 changes: 1 addition & 1 deletion src/SPH2mcfost.f90
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ subroutine SPH_to_Voronoi(n_SPH, ndusttypes, particle_id, x,y,z,h, vx,vy,vz, T_g

limit_threshold = (1.0 - SPH_keep_particles) * 0.5 ;

icell_ref = 1
icell1 = 1

write(*,*) "# Farthest particules :"
write(*,*) "x =", minval(x), maxval(x)
Expand Down
6 changes: 3 additions & 3 deletions src/benchmarks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ subroutine init_GG_Tau_mol()
Tcin(icell) = 30.0 * (r_grid(icell)/100.)**(-0.5)
enddo

icell = icell_ref
icell = icell1
write(*,*) "Density @ 100 AU", real(densite_gaz(icell) / 100.**3 * (sqrt(r_grid(icell)**2 + z_grid(icell)) / 100.)**2.75)

return
Expand Down Expand Up @@ -311,8 +311,8 @@ subroutine init_benchmark_vanZadelhoff1()

!tab_abundance = abundance

write(*,*) "Density", real(densite_gaz(icell_ref) * &
(r_grid(icell_ref)**2 + z_grid(icell_ref)**2)/rmin**2)
write(*,*) "Density", real(densite_gaz(icell1) * &
(r_grid(icell1)**2 + z_grid(icell1)**2)/rmin**2)

return

Expand Down
2 changes: 0 additions & 2 deletions src/cylindrical_grid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ subroutine build_cylindrical_cell_mapping() ! work also in spherical
integer :: i,j,k,icell, ntot, ntot2, alloc_status
integer :: istart,iend,jstart,jend,kstart,kend, istart2,iend2,jstart2,jend2,kstart2,kend2

icell_ref = 1

istart = 1
iend = n_rad

Expand Down
10 changes: 5 additions & 5 deletions src/diffusion.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subroutine setDiffusion_coeff(i)

cst_Dcoeff = pi/(12.*sigma)

p_icell = icell_ref
p_icell = icell1

do k=1,n_az
do j=j_start, nz
Expand Down Expand Up @@ -90,7 +90,7 @@ subroutine setDiffusion_coeff0(i)

cst_Dcoeff = pi/(12.*sigma)

p_icell = icell_ref
p_icell = icell1

do k=1,n_az
do j=j_start,nz
Expand Down Expand Up @@ -662,7 +662,7 @@ subroutine compute_Planck_opacities(icell, Planck_opacity,rec_Planck_opacity)
if (lvariable_dust) then
p_icell => icell0
else
p_icell => icell_ref
p_icell => icell1
endif

somme = 0.0_dp
Expand All @@ -686,8 +686,8 @@ subroutine compute_Planck_opacities(icell, Planck_opacity,rec_Planck_opacity)
somme2 = somme2 + B * kappa(p_icell,lambda)
norm = norm + B*delta_wl
enddo
rec_Planck_opacity = norm/somme * kappa_factor(icell0)
Planck_opacity = somme2/norm * kappa_factor(icell0)
rec_Planck_opacity = norm/somme * kappa_factor(icell)
Planck_opacity = somme2/norm * kappa_factor(icell)
else
rec_Planck_opacity = 1e-30
Planck_opacity = 1e-30
Expand Down
2 changes: 1 addition & 1 deletion src/disk_physics.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subroutine compute_othin_sublimation_radius()
cst=cst_th/dust_pop(1)%T_sub
cst=cst_th/1500.

icell = icell_ref
icell = icell1

do lambda=1, n_lambda
! longueur d'onde en metre
Expand Down
26 changes: 14 additions & 12 deletions src/dust_prop.f90
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,9 @@ subroutine opacite(lambda, p_lambda, no_scatt)
! c'est pour les prop de diffusion en relatif donc la veleur exacte n'a pas d'importante
ldens0 = .false.
if (.not.lvariable_dust) then
icell = icell_ref
if (maxval(densite_pouss(:,icell)) < tiny_real) then
if (icell_not_empty > icell1) then ! icell1==1
ldens0 = .true.
densite_pouss(:,icell) = densite_pouss(:,icell_not_empty)
densite_pouss(:,icell1) = densite_pouss(:,icell_not_empty)
endif
endif

Expand Down Expand Up @@ -1010,8 +1009,7 @@ subroutine opacite(lambda, p_lambda, no_scatt)

! On remet la densite à zéro si besoin
if (ldens0) then
icell = icell_ref
densite_pouss(:,icell) = 0.0_sp
densite_pouss(:,icell1) = 0.0_sp
endif

if ((ldust_prop).and.(lambda == n_lambda)) then
Expand Down Expand Up @@ -1055,10 +1053,9 @@ subroutine calc_local_scattering_matrices(lambda, p_lambda)
! c'est pour les prop de diffusion en relatif donc la veleur exacte n'a pas d'importante
ldens0 = .false.
if (.not.lvariable_dust) then
icell = icell_ref
if (maxval(densite_pouss(:,icell)) < tiny_real) then
if (icell_not_empty > icell1) then
ldens0 = .true.
densite_pouss(:,icell) = densite_pouss(:,icell_not_empty)
densite_pouss(:,icell1) = densite_pouss(:,icell_not_empty)
endif
endif

Expand Down Expand Up @@ -1216,8 +1213,7 @@ subroutine calc_local_scattering_matrices(lambda, p_lambda)
! see opacite()
! On remet la densite à zéro si besoin
if (ldens0) then
icell = icell_ref
densite_pouss(:,icell) = 0.0_sp
densite_pouss(:,icell1) = 0.0_sp
endif

return
Expand Down Expand Up @@ -1335,8 +1331,14 @@ subroutine write_dust_prop()
allocate(S11_lambda_theta(n_lambda,0:nang_scatt),pol_lambda_theta(n_lambda,0:nang_scatt))
allocate(kappa_grain(n_lambda,n_grains_tot))

icell = icell_not_empty
p_icell = icell_ref
if (lvariable_dust) then
write(*,*) "Warning: dust is not uniform, picking cell #", icell_not_empty
icell = icell_not_empty
p_icell = icell_not_empty
else
icell = icell_not_empty
p_icell = 1
endif

kappa_lambda=real((kappa(icell,:)*kappa_factor(icell)/AU_to_cm)/(masse(icell)/(volume(icell)*AU_to_cm**3))) ! cm^2/g
albedo_lambda=tab_albedo_pos(icell,:)
Expand Down
27 changes: 13 additions & 14 deletions src/dust_ray_tracing.f90
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ subroutine calc_xI_scatt(id,lambda,p_lambda,icell, phik,psup,l,stokes,flag_star)
if (lvariable_dust) then
p_icell = icell
else
p_icell = icell_ref
p_icell = icell1
endif

do ibin = 1, RT_n_incl
Expand Down Expand Up @@ -565,7 +565,7 @@ subroutine calc_xI_scatt_pola(id,lambda,p_lambda,icell,phik,psup,l,stokes,flag_s
if (lvariable_dust) then
p_icell = icell
else
p_icell = icell_ref
p_icell = icell1
endif

do ibin = 1, RT_n_incl
Expand Down Expand Up @@ -670,9 +670,9 @@ subroutine init_dust_source_fct1(lambda,ibin,iaz)
!$omp default(none) &
!$omp private(icell,p_icell,facteur,kappa_sca,kappa_ext,itype,I_scatt) &
!$omp shared(n_cells,energie_photon,volume,n_az_rt,n_theta_rt,kappa,kappa_factor,N_type_flux,lambda,iRT) &
!$omp shared(J_th,xI_scatt,eps_dust1,lsepar_pola,lsepar_contrib,n_Stokes,nb_proc,tab_albedo_pos,lvariable_dust,icell_ref)
!$omp shared(J_th,xI_scatt,eps_dust1,lsepar_pola,lsepar_contrib,n_Stokes,nb_proc,tab_albedo_pos,lvariable_dust,icell1)

p_icell = icell_ref
p_icell = icell1

!$omp do schedule(static,n_cells/nb_proc)
do icell=1, n_cells
Expand Down Expand Up @@ -750,9 +750,9 @@ subroutine init_dust_source_fct2(lambda,p_lambda,ibin)
!$omp parallel &
!$omp default(none) &
!$omp shared(lambda,n_cells,nang_ray_tracing,eps_dust2,I_sca2,J_th,kappa,kappa_factor,eps_dust2_star,lsepar_pola) &
!$omp shared(lsepar_contrib,n_Stokes,nang_ray_tracing_star,nb_proc,tab_albedo_pos,icell_ref,lvariable_dust) &
!$omp shared(lsepar_contrib,n_Stokes,nang_ray_tracing_star,nb_proc,tab_albedo_pos,icell1,lvariable_dust) &
!$omp private(icell,p_icell,dir,iscatt,Q,U,kappa_ext)
p_icell = icell_ref
p_icell = icell1
!$omp do schedule(static,n_cells/nb_proc)
do icell=1, n_cells
if (lvariable_dust) p_icell = icell
Expand Down Expand Up @@ -829,9 +829,9 @@ subroutine calc_Jth(lambda)
!$omp parallel &
!$omp default(none) &
!$omp shared(n_cells,Tdust,wl,lambda,kappa_abs_LTE,kappa_factor,cst_E,J_th) &
!$omp shared(lvariable_dust,icell_ref) &
!$omp shared(lvariable_dust,icell1) &
!$omp private(icell,p_icell,Temp,cst_wl,coeff_exp)
p_icell = icell_ref
p_icell = icell1
!$omp do
do icell=1, n_cells
if (lvariable_dust) p_icell = icell
Expand Down Expand Up @@ -1076,7 +1076,7 @@ subroutine calc_Isca_rt2(lambda,p_lambda,ibin)

!$omp parallel &
!$omp default(none) &
!$omp shared(lvariable_dust,Inu,I_sca2,n_cells,tab_s11_pos,uv0,w0,n_Stokes,icell_ref,energie_photon,volume) &
!$omp shared(lvariable_dust,Inu,I_sca2,n_cells,tab_s11_pos,uv0,w0,n_Stokes,icell1,energie_photon,volume) &
!$omp shared(tab_s12_o_s11_pos,tab_s22_o_s11_pos,tab_s33_o_s11_pos,tab_s34_o_s11_pos,tab_s44_o_s11_pos) &
!$omp shared(lsepar_pola,tab_k,tab_sin_scatt_norm,lambda,p_lambda,n_phi_I,n_theta_I,nang_ray_tracing,lsepar_contrib) &
!$omp shared(s11_save,tab_cosw,tab_sinw,nb_proc,kappa,kappa_factor,tab_albedo_pos) &
Expand All @@ -1098,8 +1098,7 @@ subroutine calc_Isca_rt2(lambda,p_lambda,ibin)
ROP(4,4) = 1.0_dp

if (.not.lvariable_dust) then ! we precalculate the s11 as they are all the same
icell = icell_ref

icell = icell1
do dir=0,1
do iscatt = 1, nang_ray_tracing
! Loop over the specific intensity bins
Expand All @@ -1122,7 +1121,7 @@ subroutine calc_Isca_rt2(lambda,p_lambda,ibin)
enddo ! dir
endif ! .not.lvariable_dust

p_icell = icell_ref
p_icell = icell1
!$omp do schedule(static, n_cells/nb_proc)
do icell = 1, n_cells
!$ id = omp_get_thread_num() + 1
Expand Down Expand Up @@ -1269,7 +1268,7 @@ subroutine calc_Isca_rt2_star(lambda,p_lambda,ibin)
!$omp parallel &
!$omp default(none) &
!$omp shared(n_cells,lambda,p_lambda,ibin,I_spec_star,nang_ray_tracing_star,cos_thet_ray_tracing_star) &
!$omp shared(lvariable_dust,r_grid,z_grid,icell_ref,omega_ray_tracing_star,lsepar_pola) &
!$omp shared(lvariable_dust,r_grid,z_grid,icell1,omega_ray_tracing_star,lsepar_pola) &
!$omp shared(tab_s11_pos,tab_s12_o_s11_pos,tab_s22_o_s11_pos,tab_s33_o_s11_pos,tab_s34_o_s11_pos,tab_s44_o_s11_pos) &
!$omp shared(energie_photon,volume,tab_albedo_pos,kappa,kappa_factor,eps_dust2_star) &
!$omp private(id,icell,p_icell,stokes,x,y,z,norme,u,v,w,dir,iscatt,cos_scatt,k,omega,cosw,sinw,RPO,ROP,S) &
Expand All @@ -1290,7 +1289,7 @@ subroutine calc_Isca_rt2_star(lambda,p_lambda,ibin)

stokes(:) = 0.0_dp

p_icell = icell_ref
p_icell = icell1

!$omp do
do icell=1, n_cells
Expand Down
6 changes: 3 additions & 3 deletions src/dust_transfer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ subroutine transfert_poussiere()
if (loptical_depth_to_cell) call write_optical_depth_to_cell(1)

write(*,*) ""
write(*,*) "Dust properties in cell #", icell_ref
p_icell = icell_ref
write(*,*) "Dust properties in cell #", icell_not_empty
p_icell = icell_not_empty
if (aniso_method==2) write(*,*) "g ", tab_g_pos(p_icell,1)
write(*,*) "albedo ", tab_albedo_pos(p_icell,1)
if (lsepar_pola.and.(scattering_method == 2)) write(*,*) "polarisability", maxval(-tab_s12_o_s11_pos(:,p_icell,1))
Expand Down Expand Up @@ -998,7 +998,7 @@ subroutine propagate_packet(id,lambda,p_lambda,icell,x,y,z,u,v,w,stokes,flag_sta
if (lvariable_dust) then
p_icell => icell
else
p_icell => icell_ref
p_icell => icell1
endif

! Boucle sur les interactions du paquets:
Expand Down
22 changes: 11 additions & 11 deletions src/gas/atom_transfer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ end subroutine io_write_convergence_maps

subroutine nlte_loop_mali()
! ------------------------------------------------------------------------------------ !
! Solve the set of statistical equilibrium equations (SEE) with the
! Solve the set of statistical equilibrium equations (SEE) with the
! Multi-level Accelerated Lambda Iterations method (Rybicki & Hummer 92, Apj 202 209).
!
! By default, the SEE are solved twice.
Expand Down Expand Up @@ -150,7 +150,7 @@ subroutine nlte_loop_mali()
logical :: l_iterate, l_iterate_ne
integer :: n_xc
real(kind=dp), dimension(:), pointer :: tab_xc

!Ng's acceleration
integer, parameter :: Ng_Ndelay_init = 5 !minimal number of iterations before starting the cycle.
!min is 1 (so that conv_speed can be evaluated)
Expand All @@ -159,7 +159,7 @@ subroutine nlte_loop_mali()
real(kind=dp) :: conv_speed_limit
integer :: iorder, i0_rest, n_iter_accel, iacc
integer :: Ng_Ndelay, ng_index
logical :: lng_turned_on, ng_rest, lconverging, accelerated
logical :: lng_turned_on, ng_rest, lconverging, accelerated
logical, parameter :: lextrapolate_electron = .false. !extrapolate electrons with populations
real(kind=dp), dimension(:,:), allocatable :: ngtmp

Expand Down Expand Up @@ -329,7 +329,7 @@ subroutine nlte_loop_mali()
ng_index = Neq_ng - mod(n_iter-1,Neq_ng) !overwritten if lng_acceleration.
! NOTE :: the index 1 is hard-coded within the non-LTE loop as it stores the actual (running) value
! of the populations and electronic density.
!
!
! goes with maxIter
write(*,'(" *** Iteration #"(1I4)"; step #"(1I1)"; threshold: "(1ES11.2E3)"; Nrays: "(1I5))') &
n_iter, etape, precision, n_rayons
Expand Down Expand Up @@ -522,7 +522,7 @@ subroutine nlte_loop_mali()
! reshape(ngpop(1:at%Nlevel,nact,:,:),shape=[n_cells,at%Nlevel,Neq_ng],order=[2,1,3]),&!then flatten
! (/n_cells*at%Nlevel,Neq_ng/))

call Accelerate(n_cells*at%Nlevel,Ng_Norder,ngtmp)
call Accelerate(n_cells*at%Nlevel,Ng_Norder,ngtmp)

!reform in (Nlevel,N_cells,Neq_ng)
ngpop(1:at%Nlevel,nact,:,:) = reshape(ngtmp,(/at%Nlevel,n_cells,Neq_ng/))
Expand Down Expand Up @@ -1175,7 +1175,7 @@ subroutine atom_line_transfer()

if (lany_init4) then
call nlte_loop_sobolev()
! MALI step after Sobolev step ?
! MALI step after Sobolev step ?
! if (.not.lescape_prob) then
! !to preserve ray-resolution ?
! istep_start = 2
Expand Down Expand Up @@ -1220,7 +1220,7 @@ subroutine atom_line_transfer()

if (laccretion_shock) then
!3 + lg(Facc) = lg(Facc) erg/cm2/s
if (max_Facc>0) write(*,'("max(lgFacc)="(1F7.3)" W/m^2; min(lgFacc)="(1F7.3)" W/m^2")') &
if (max_Facc>0) write(*,'("max(lgFacc)="(1F7.3)" W/m^2; min(lgFacc)="(1F7.3)" W/m^2")') &
log10(max_Facc), log10(min_Facc)
if (max_Tshock>0) write(*,'("max(Tshock)="(1I8)" K; min(Tshock)="(1I8)" K")') &
nint(max_Tshock), nint(min_Tshock)
Expand All @@ -1245,7 +1245,7 @@ subroutine atom_line_transfer()
end subroutine atom_line_transfer

subroutine init_dust_temperature()
!lowering too much the treshold might create some convergence issues in the non-LTE pops or in
!lowering too much the treshold might create some convergence issues in the non-LTE pops or in
! the electronic density calculations (0 division mainly for low values).
real(kind=dp), parameter :: T_formation = 2000.0 ! [K]
logical, dimension(:), allocatable :: ldust
Expand All @@ -1261,7 +1261,7 @@ subroutine init_dust_temperature()
where(ldust) T(:) = Tdust(:)
if (any(T < T_formation)) call warning('(atom_transfer) Setting the gas transparent where T < 2000 K.')
where (T < T_formation) icompute_atomRT = 0
!or set the atomic gas temperature to 0 in dust regions ?
!or set the atomic gas temperature to 0 in dust regions ?
if (any(icompute_atomRT>0)) then
write(*,*) "T:", real(maxval(T,icompute_atomRT>0)), real(minval(T,icompute_atomRT>0))
write(*,*) "T (rho_dust = 0):", real(maxval(T,(icompute_atomRT>0).and..not.ldust)), &
Expand Down Expand Up @@ -1297,7 +1297,7 @@ subroutine init_dust_atom()
if (lvariable_dust) then
p_icell => icell
else
p_icell => icell_ref
p_icell => icell1
endif

call realloc_dust_atom()
Expand Down Expand Up @@ -1692,7 +1692,7 @@ subroutine emission_line_tau_surface_map(tau,ibin,iaz)
do i = 1,npix_x
!$ id = omp_get_thread_num() + 1
do j = 1,npix_y

pixelcenter(:,id) = Icorner(:) + (i-0.5_dp) * dx(:) + (j-0.5_dp) * dy(:)

x0(:) = pixelcenter(1,id)
Expand Down
Loading

0 comments on commit db4a42d

Please sign in to comment.