Skip to content

Commit

Permalink
Bug fix: diffusion approximation with new opacity arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
cpinte committed Nov 23, 2023
1 parent 619a7a1 commit 1bd5206
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/diffusion.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ subroutine setDiffusion_coeff(i)
integer, intent(in) :: i

real(kind=dp) :: cst_Dcoeff, wl, delta_wl, cst, cst_wl, coeff_exp, dB_dT, Temp, somme
integer :: j, k, lambda, icell
integer :: j, k, lambda, icell, p_icell

real(kind=dp), parameter :: precision = 1.0e-1_dp ! Variation de temperature au dela de laquelle le coeff de diff et mis a jour
! le mettre a 0, evite le drole de BUG

cst_Dcoeff = c_light*pi/(12.*sigma)
cst_Dcoeff = pi/(12.*sigma)

p_icell = icell_ref

do k=1,n_az
do j=j_start, nz
if (j==0) cycle
icell = cell_map(i,j,k)
if (lvariable_dust) p_icell = icell
!Temp=Tdust(i,j,k)
if (abs(DensE(i,j,k) - DensE_m1(i,j,k)) > precision * DensE_m1(i,j,k)) then
! On met a jour le coeff
Expand All @@ -54,7 +57,7 @@ subroutine setDiffusion_coeff(i)
else
dB_dT = 0.0_dp
endif
somme = somme + dB_dT/kappa(icell,lambda) * delta_wl
somme = somme + dB_dT/(kappa(p_icell,lambda) * kappa_factor(icell)) * delta_wl
enddo
! kappa_R = 4.*sigma * Temp**3 / (pi * somme)
! Dcoeff = c_light/(3kappa_R) car kappa volumique
Expand Down Expand Up @@ -83,14 +86,17 @@ subroutine setDiffusion_coeff0(i)
integer, intent(in) :: i

real(kind=dp) :: cst_Dcoeff, wl, delta_wl, cst, cst_wl, coeff_exp, dB_dT, Temp, somme
integer :: j, k, lambda, icell
integer :: j, k, lambda, icell, p_icell

cst_Dcoeff = pi/(12.*sigma)

cst_Dcoeff = c_light*pi/(12.*sigma)
p_icell = icell_ref

do k=1,n_az
do j=j_start,nz
if (j==0) cycle
icell = cell_map(i,j,k)
if (lvariable_dust) p_icell = icell
Temp=Tdust(icell)
cst=cst_th/Temp
somme=0.0_dp
Expand All @@ -105,7 +111,7 @@ subroutine setDiffusion_coeff0(i)
else
dB_dT = 0.0_dp
endif
somme = somme + dB_dT/kappa(icell,lambda) * delta_wl
somme = somme + dB_dT/(kappa(p_icell,lambda)*kappa_factor(icell)) * delta_wl
enddo
! kappa_R = 4.*sigma * Temp**3 / (pi * somme)
! Dcoeff = c_light/(3kappa_R) car kappa volumique
Expand Down

0 comments on commit 1bd5206

Please sign in to comment.