Commit e48ad91f authored by Gwenaelle Gremion's avatar Gwenaelle Gremion

Clarification de la contrainte CFL

parent fc6c0182
......@@ -213,7 +213,8 @@
REALTYPE :: size_fp_up= 0.000050
REALTYPE :: size_msn = -0.5
REALTYPE :: dm_msn = 0.0
REALTYPE :: diam_msn_us = 0.01
REALTYPE :: diam_msn_us = 0.01
REALTYPE :: litt_msn_w = 0.01
!Parametres pour l'aggregation physique
REALTYPE :: dynvis = -0.5
REALTYPE :: kinvis = -0.5
......@@ -307,7 +308,7 @@ rho_p,rho_dph,rho_dzo,rho_fp,rho_msn,
sti_cst, &
stip_p,stip_dph,stip_dzo,stip_fp,stidph_dph,stidph_dzo,stidph_fp,stidzo_dzo,stidzo_fp,stifp_fp, &
CSF,size_rand,size_phy_us,size_phy_up,size_dph_us,size_dph_up,size_dzo_us,size_dzo_up,&
size_fp_us,size_fp_up,size_msn,dm_msn,diam_msn_us,&
size_fp_us,size_fp_up,size_msn,dm_msn,diam_msn_us,litt_msn_w,&
dynvis,kinvis,kB, &
Frag_meth,swim_brk, &
Floc_coef, &
......@@ -549,7 +550,8 @@ Floc_coef, &
write(*,900) ' size_msn = ',size_msn
write(10,901) size_msn
!dm_msn
!diam_msn_us
!diam_msn_us
!litt_msn_w
write(*,900) ' dynvis = ',dynvis
write(10,901) dynvis
write(*,900) ' kinvis = ',kinvis
......@@ -605,7 +607,7 @@ leak=leak/secs_pr_day
w_fp = w_fp /secs_pr_day
! w_msn = w_msn /secs_pr_day
litt_msn_w =litt_msn_w /secs_pr_day
!Phytoplankton
txloss_p = txloss_p /secs_pr_day
betap_p = betap_p /secs_pr_day ! GG-D
......@@ -1162,7 +1164,7 @@ end if
REALTYPE ::prob_break_msn,r_msn
REALTYPE :: diam_msn_max,RFV_msn,min_size_msn
! Sedimentation rate msn
REALTYPE :: w_msn_m,Re_msn,Rmsn,w_min_m
REALTYPE :: w_msn_m,Re_msn,Rmsn,w_min_m,CFL
!EOP
!-----------------------------------------------------------------------
......@@ -2507,8 +2509,6 @@ endif
!--» Taille_msn --> is the diameter after coag and frag
Rmsn = (rho_msn-densFlu)
write(*,*)'[msn]', cc(d4,ci)
if (cc(d4,ci) .le. cons_min) then
w_msn_m = 0.0
write(*,*)'[msn] lt Cons_min, settling velocity set to :',w_msn_m
......@@ -2577,17 +2577,35 @@ endif !#1
!! --- Convertion & Comparaison with the Stokes range
!-----------------------------------------------------------------------------------
!--» Now we put everything in /d not matter the scenario.
! w_msn_m = w_msn_m/secs_pr_day
!--» Comparaison with the Stokes range ! VanRijn 1993
Re_msn = abs(w_msn_m*(cc(taille_msn,ci)/kinvis))
if (Re_msn .lt. 1.0)then !#3
w_msn_m = w_msn_m
else !#3
w_msn_m = (cc(taille_msn,ci)**0.5)
write(*,*) 'Reynolds number for marine snow > 1'
write(*,*) 'Reynolds number for marine snow > 1'
if(cc(taille_msn,ci) .gt. 0.000001 .and. cc(taille_msn,ci) .le. 0.0001 )then
! If the diameter of Msn (d) --> 1< d <= 100 micrometers (VanRijn 1993)
w_msn_m = ((2.65-1)*g*(cc(taille_msn,ci)**2))/18*kinvis
write(*,*) 'Diameter of msn : 1< d <= 100 micrometers, settling =' ,w_msn_m
elseif(cc(taille_msn,ci) .gt. 0.0001 .and. cc(taille_msn,ci) .lt. 0.001 ) then
! If the diameter of Msn (d) --> 100< d <= 1000 micrometers (VanRijn 1993)
w_msn_m = ((10*kinvis)/cc(taille_msn,ci))*&
((1+((0.01*(2.65-1)*g*(cc(taille_msn,ci))**3.0) /kinvis**2.0)**0.5) -1)
write(*,*) 'Diameter of msn : 100< d <= 1000 micrometers, settling =' ,w_msn_m
elseif(cc(taille_msn,ci) .gt. 0.001) then
! If the diameter of Msn (d) --> d > 1000 micrometers (VanRijn 1993)
w_msn_m = 1.1*((2.65-1)*g*cc(taille_msn,ci))**0.5
write(*,*) 'Diameter of msn : d > 1000 micrometers, settling =' ,w_msn_m
else
write(*,*) 'Diameter of msn lower than 1 micrometers, and RE > 1 : Houston we have a problem ! '
w_msn_m = 0.0
endif
endif !#3
......@@ -2595,47 +2613,136 @@ endif !#3
! ADVECTION (WS) OF THE PARTICLES
!-----------------------------------------------------------------------------------
!-----------------------------------------------------------------------------------
!! ---Safety check
!-----------------------------------------------------------------------------------
!--» Does density difference with the fluid allow to go up ?
if (rho_p .gt. densFlu .AND. w_p_m .gt. 0.0) then
w_p_m = -w_p_m
endif
if (rho_dph .gt. densFlu .AND. w_dph_m .gt. 0.0) then
w_dph_m = -w_dph_m
endif
if (rho_dzo .gt. densFlu .AND. w_dzo_m .gt. 0.0) then
w_dzo_m = -w_dzo_m
endif
if (rho_fp .gt. densFlu .AND. w_fp_m .gt. 0.0) then
w_fp_m = -w_fp_m
endif
if (rho_msn .gt. densFlu .AND. w_msn_m .gt. 0.0) then
w_msn_m = -w_msn_m
endif
!--» let them settling(m/s)
!--» The ncdf output do ws(x,ci) *86400 to have the ouptut in m/j.
!--» The ncdf output(bio_save) do ws(x,ci) *86400 to have the ouptut in m/j.
if (rho_p .gt. densFlu .AND. w_p_m .gt. 0.0) then
w_p_m = -w_p_m
endif
!-----------------------------------------------------------------------------------
!! ---Safety check
!-----------------------------------------------------------------------------------
!--» Does CFL limit respected ?
CFL = (depth_bio/nlev)/dt_bio
if (rho_dph .gt. densFlu .AND. w_dph_m .gt. 0.0) then
w_dph_m = -w_dph_m
!--» Case of Phytoplankton
if (abs(w_p_m) .gt. (depth_bio/nlev)/dt_bio )then
ws(p,ci) = w_p
write(*,*) 'CFL Constrain is OVERPASS for W-Phy, ws(P,ci) = nml value', ws(p,ci)
if (abs(w_p) .gt. (depth_bio/nlev)/dt_bio )then
ws(p,ci) = 0.0
write(*,*) 'CFL Constrain is OVERPASS for W-Phy,from the nml value', ws(p,ci)
endif
else
ws(p,ci) = w_p_m
endif
if (rho_dzo .gt. densFlu .AND. w_dzo_m .gt. 0.0) then
w_dzo_m = -w_dzo_m
!--» Case of Dead_Phytoplankton
if (abs(w_dph_m) .gt. (depth_bio/nlev)/dt_bio )then
ws(d1,ci) = w_dph
write(*,*) 'CFL Constrain is OVERPASS for W-Dph, ws(D1,ci) = nml value', ws(d1,ci)
if (abs(w_dph) .gt. (depth_bio/nlev)/dt_bio )then
ws(d1,ci) = 0.0
write(*,*) 'CFL Constrain is OVERPASS for W-Dph,from the nml value', ws(d1,ci)
endif
else
ws(d1,ci) = w_dph_m
endif
if (rho_fp .gt. densFlu .AND. w_fp_m .gt. 0.0) then
w_fp_m = -w_fp_m
!--» Case of Dead Zooplankton
if (abs(w_dzo_m) .gt. (depth_bio/nlev)/dt_bio )then
ws(d2,ci) = w_dzo
write(*,*) 'CFL Constrain is OVERPASS for W-dzo, ws(d2,ci) = nml value', ws(d2,ci)
if (abs(w_dzo) .gt. (depth_bio/nlev)/dt_bio )then
ws(d2,ci) = 0.0
write(*,*) 'CFL Constrain is OVERPASS for W-dzo,from the nml value', ws(d2,ci)
endif
else
ws(d2,ci) = w_dzo_m
endif
ws(p,ci) = w_p_m
ws(d1,ci) = w_dph_m
ws(d2,ci) = w_dzo_m
ws(d3,ci) = w_fp_m
!--» Case of Fecal pellets
if (abs(w_fp_m) .gt. (depth_bio/nlev)/dt_bio )then
ws(d3,ci) = w_fp
write(*,*) 'CFL Constrain is OVERPASS for W-fp, ws(d3,ci) = nml value', ws(d3,ci)
if (abs(w_fp) .gt. (depth_bio/nlev)/dt_bio )then
ws(d3,ci) = 0.0
write(*,*) 'CFL Constrain is OVERPASS for W-fp,from the nml value', ws(d3,ci)
endif
else
ws(d3,ci) = w_fp_m
endif
!--» Case of marine snow
!--Concentration - Vs CFL limit
if (abs(w_msn_m) .gt. (depth_bio/nlev)/dt_bio )then
!--Concentration - Vs CFL limit
ws(d4,ci)= min(w_msn_m,(depth_bio/nlev)/dt_bio)
if (ws(d4,ci) .eq. w_msn_m) then
write(*,*) 'CFL limit is respected'
else
write(*,*) 'CFL Constrain is OVERPASS'
if (w_msnow .eq. 4.0) then !#2
if(CSF .ge. 0.0 .and. CSF.lt. 0.4) then !#2.3
CSF_msn = 2.18-(2.09*CSF)
else if (CSF .ge. 0.4 .and. CSF .lt. 0.8) then!#2.3
CSF_msn = 0.946*(CSF)**(-0.378)
else if (CSF .ge. 0.8 .and. CSF .le. 1.0) then!#2.3
CSF_msn = 1.0 ! consider as a sphere
else !#2.3
write (*,*) 'Error in CSF values for Marine snow : CSF .NE. [0-1]'
endif !#2.3
w_msn_m=(1/(18*(kinvis*densFlu)))*(1/CSF_msn)*(Rmsn)*g*(diam_msn_max)**2 ![m/s]
if (w_msn_m .gt. 0.0) then
ws(d4,ci) = -w_msn_m
else
ws(d4,ci) = w_msn_m
endif
else
! -- As settling velocity overpass the CFL constrain we will attribute to the msn
! the maximum settling velocity found in the litterature
ws(d4,ci) = litt_msn_w ![m/s]
write(*,*) 'CFL Constrain is OVERPASS, w_msn use from nml',ws(d4,ci)
if (abs(litt_msn_w) .gt. (depth_bio/nlev)/dt_bio )then
ws(d4,ci) = 0.0
write(*,*) 'CFL Constrain is OVERPASS for w_msn,from the nml value', ws(d4,ci)
endif
!--Size - Vs CFL limit
ws(taille_msn,ci) = min(w_msn_m,(depth_bio/nlev)/dt_bio)
!--Settling velocity trait - Vs CFL limit
cc(settl_msn,ci)= w_msn_m
ws(settl_msn,ci) = min(w_msn_m,(depth_bio/nlev)/dt_bio)
endif
else
ws(d4,ci) = w_msn_m
write(*,*) 'CFL limit is respected, ws(D4,ci) = ',ws(d4,ci)
endif
!--Size - Vs CFL limit
ws(taille_msn,ci) = ws(d4,ci)
!--Settling velocity trait - Vs CFL limit
cc(settl_msn,ci) = ws(d4,ci)
ws(settl_msn,ci) = ws(d4,ci)
!-----------------------------------------------------------------------------------
! NET PRIMARY PRODUCTION
!-----------------------------------------------------------------------------------
......@@ -3183,7 +3290,8 @@ endif !#A
! endif
! ws(d4,ci)= min(w_msn_m,(depth_bio/nlev)/dt_bio)
! write(*,*)'flux_msn(ci) ',flux_msn(ci)
......
......@@ -94,20 +94,17 @@
!Prepare the new variable for the NETCDF output file as well as informations
!-----------------------------------------------------------------------------------
!Density of the fluid at each level
iret = new_nc_variable(ncid,'rho',NF_REAL,4,dims,rho_id)
iret = set_attributes(ncid,rho_id,units='kg.m-3',long_name='Density')
! Sedimentation or swimming rate of particulate matter
! Living phytoplankton
iret = new_nc_variable(ncid,'wp',NF_REAL,4,dims,wp_id)
iret = set_attributes(ncid,wp_id,units='m/day', &
long_name='phytoplancton settling velocity')
long_name='Phytoplancton settling velocity')
! Living zooplankton
! Living zooplankton
!Nocera Model
if (bio_model .eq. 8) then
iret = new_nc_variable(ncid,'wz',NF_REAL,4,dims,wz_id)
......@@ -120,7 +117,7 @@
! Living zooplankton
iret = new_nc_variable(ncid,'wz',NF_REAL,4,dims,wz_id)
iret = set_attributes(ncid,wz_id,units='m/day', &
long_name='zooplancton swimming velocity')
long_name='Zooplancton swimming velocity')
! Dead Phytoplankton
iret = new_nc_variable(ncid,'wd1',NF_REAL,4,dims,wd1_id)
iret = set_attributes(ncid,wd1_id,units='m/day', &
......@@ -136,8 +133,7 @@
! Marine Snow
iret = new_nc_variable(ncid,'wd4',NF_REAL,4,dims,wd4_id)
iret = set_attributes(ncid,wd4_id,units='m/day', &
long_name='Marine snow settling velocity')
long_name='Marine snow settling velocity (Calc)')
! Stickiness
! 2 Living phytoplankton
......@@ -183,8 +179,6 @@
end if
!CHG4 Diagnostic du PAR
iret = new_nc_variable(ncid,'par',NF_REAL,4,dims,par_id)
iret = set_attributes(ncid,par_id,units='W/m2',long_name='PAR')
......@@ -207,25 +201,24 @@
iret = new_nc_variable(ncid,'ppnet',NF_REAL,4,dims,ppnet_id)
iret = set_attributes(ncid,ppnet_id,units='1/day',long_name='net primary production rate')
!Polynow model
if (bio_model .eq. 10) then
! Total flux of particle reaching msn
iret = new_nc_variable(ncid,'flux_msn',NF_REAL,4,dims,flux_msn_id)
iret = set_attributes(ncid,flux_msn_id,units='1/day',long_name='flux_msn')
! Flux of Phyto going to msn
iret = new_nc_variable(ncid,'Flux_P',NF_REAL,4,dims,Flux_P_id)
iret = set_attributes(ncid,Flux_P_id,units='1/day',long_name='Flux_P')
! Flux of DPH going to msn
iret = new_nc_variable(ncid,'Flux_D1',NF_REAL,4,dims,Flux_D1_id)
iret = set_attributes(ncid,Flux_D1_id,units='1/day',long_name='Flux_D1')
iret = new_nc_variable(ncid,'Flux_D2',NF_REAL,4,dims,Flux_D2_id)
! Flux of DZO going to msn
iret = new_nc_variable(ncid,'Flux_D2',NF_REAL,4,dims,Flux_D2_id)
iret = set_attributes(ncid,Flux_D2_id,units='1/day',long_name='Flux_D2')
iret = new_nc_variable(ncid,'Flux_D3',NF_REAL,4,dims,Flux_D3_id)
! Flux of FP going to msn
iret = new_nc_variable(ncid,'Flux_D3',NF_REAL,4,dims,Flux_D3_id)
iret = set_attributes(ncid,Flux_D3_id,units='1/day',long_name='Flux_D3')
iret = new_nc_variable(ncid,'size_msnow',NF_REAL,4,dims,size_msnow_id)
iret = set_attributes(ncid,size_msnow_id,units='m',long_name='size_msnow')
iret = new_nc_variable(ncid,'w_msn_lev',NF_REAL,4,dims,w_msn_lev_id)
iret = set_attributes(ncid,w_msn_lev_id,units='m/j',long_name='w_msn_lev')
endif
!DD Diagnostic de npar (nb de particules lagrangiennes) pour bebogage
!iret = new_nc_variable(ncid,'npar',NF_REAL,4,dims,npar_id)
......@@ -248,12 +241,12 @@
end do
!Density of the fluid at each level
iret = store_data(ncid,rho_id,XYZT_SHAPE,nlev,array=rho)
!Density of the fluid at each level
iret = store_data(ncid,rho_id,XYZT_SHAPE,nlev,array=rho)
! Sedimentation rate of phytoplankton
iret = store_data(ncid,wp_id,XYZT_SHAPE,nlev,array=secs_pr_day*ws(1,:))
iret = store_data(ncid,wp_id,XYZT_SHAPE,nlev,array=secs_pr_day*ws(1,:))
! Swimming velocity of zootoplankton
!Nocera model
......@@ -265,6 +258,8 @@
!As example : : p=1,z=2,b=3,d1(dph)=4,n=5,a=6,l=7,d2(dzo)=8,d3(fp)=9,d4(msn)=10
if (bio_model .eq. 10) then
! Here it is needed to multiply by 86400(secs_pr_day) in order to have the model ouptu (in s) convert in per day
! Living zooplankton
iret = store_data(ncid,wz_id,XYZT_SHAPE,nlev,array=secs_pr_day*ws(2,:))
! Dead Phytoplankton
......@@ -307,15 +302,6 @@
! 2 fecal pellets
iret = store_data(ncid,sti_2fp_id,XYZT_SHAPE,nlev,array=sti_2fp(:))
!
iret = store_data(ncid,size_msnow_id,XYZT_SHAPE,nlev,array=size_msnow(:))
!
iret = store_data(ncid,w_msn_lev_id,XYZT_SHAPE,nlev,array=w_msn_lev(:))
! Rho_F
! iret = store_data(ncid,rho_F_id,XYZT_SHAPE,nlev,array=)
......@@ -333,12 +319,13 @@
iret = store_data(ncid,ammlim2_id,XYZT_SHAPE,nlev,array=ammlim2(:))
iret = store_data(ncid,ppnet_id,XYZT_SHAPE,nlev,array=ppnet(:))
iret = store_data(ncid,flux_msn_id,XYZT_SHAPE,nlev,array=flux_msn(:))
iret = store_data(ncid,Flux_P_id,XYZT_SHAPE,nlev,array=Flux_P(:))
iret = store_data(ncid,Flux_D1_id,XYZT_SHAPE,nlev,array=Flux_D1(:))
iret = store_data(ncid,Flux_D2_id,XYZT_SHAPE,nlev,array=Flux_D2(:))
iret = store_data(ncid,Flux_D3_id,XYZT_SHAPE,nlev,array=Flux_D3(:))
if (bio_model .eq. 10) then
iret = store_data(ncid,flux_msn_id,XYZT_SHAPE,nlev,array=secs_pr_day*flux_msn(:))
iret = store_data(ncid,Flux_P_id,XYZT_SHAPE,nlev,array=secs_pr_day*Flux_P(:))
iret = store_data(ncid,Flux_D1_id,XYZT_SHAPE,nlev,array=secs_pr_day*Flux_D1(:))
iret = store_data(ncid,Flux_D2_id,XYZT_SHAPE,nlev,array=secs_pr_day*Flux_D2(:))
iret = store_data(ncid,Flux_D3_id,XYZT_SHAPE,nlev,array=secs_pr_day*Flux_D3(:))
endif
!DD
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment