Changeset 3094
- Timestamp:
- Oct 22, 2023, 1:42:30 PM (14 months ago)
- Location:
- trunk/LMDZ.MARS
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/changelog.txt
r3092 r3094 4266 4266 - Addition of the file "start1D.txt" as an example in the directory deftank/; 4267 4267 - Some "cosmetic" modifications in "improvedclouds_mod.F", "write_output_mod.F90" and "testphys1d.F90". 4268 4269 == 22/10/2023 == EM 4270 Fix issues with dates when in parallel with OpenMP (missing copyin 4271 statement when opening parallel section in iniphysiq). Added some threadprivate 4272 clauses in saved module variables in comcstfi_h.F90 and planete_h.F90. 4273 Prettyfied solarlong.F and made it a module. Likewise for conf_phys.F -
trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/iniphysiq_mod.F90
r2511 r3094 10 10 prad,pg,pr,pcpp,iflag_phys) 11 11 12 ! Modules from the dynamics: 12 13 use infotrac, only : nqtot, & ! number of advected tracers 13 14 tname, & ! tracer names 14 15 nqperes,nqfils! MVals: variables isotopes 16 use temps_mod, only: day_ini, day_end, hour_ini 17 18 ! Modules from the dynamics-physics interface: 19 use inigeomphy_mod, only: inigeomphy 20 21 ! Modules from the physics: 15 22 use comgeomfi_h, only: ini_fillgeom 16 use temps_mod, only: day_ini, day_end, hour_ini17 use phys_state_var_init_mod, only: phys_state_var_init18 use inigeomphy_mod, only: inigeomphy19 23 use geometry_mod, only: cell_area, & ! physics grid area (m2) 20 24 longitude, & ! longitudes (rad) 21 25 latitude ! latitudes (rad) 22 ! necessary to get klon_omp 23 USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid)24 USE dimphy, ONLY: init_dimphy 26 use phys_state_var_init_mod, only: phys_state_var_init 27 use mod_phys_lmdz_para, only: klon_omp ! number of columns (on local omp grid) 28 use conf_phys_mod, only: conf_phys 25 29 26 30 implicit none … … 62 66 !------------------------------------------ 63 67 64 !$OMP PARALLEL65 66 68 ! copy some fundamental parameters to physics 67 69 ! and do some initializations 68 69 ! Initialize dimphy module => Now done in physics_distribution_mod 70 !call init_dimphy(klon_omp,nlayer) 70 ! Note that for OpenMP threadprivate variables a COPYIN clause is required 71 !$OMP PARALLEL COPYIN(day_ini,day_end,hour_ini) 71 72 72 73 call phys_state_var_init(klon_omp,nlayer,nqtot,tname, & … … 80 81 call conf_phys(klon_omp,nlayer,nqtot) 81 82 82 ! Initialize some "temporal and calendar" related variables83 !CALL init_time(day_ini,hour_ini,punjours,ptimestep)84 85 83 !$OMP END PARALLEL 86 84 -
trunk/LMDZ.MARS/libf/phymars/comcstfi_h.F90
r1524 r3094 2 2 IMPLICIT NONE 3 3 4 REAL pi ! something like 3.14159 5 REAL rad ! radius of the planet (m) 6 REAL g ! gravity (m/s2) 7 REAL r ! reduced gas constant (r=8.314511/(mugaz/1000.0)) 8 REAL cpp ! Cp of the atmosphere 9 REAL rcp ! r/cpp 10 REAL mugaz ! molar mass of the atmosphere (g/mol) 11 REAL omeg ! planet rotation rate (rad/s) 12 4 REAL,SAVE :: pi ! something like 3.14159 5 REAL,SAVE :: rad ! radius of the planet (m) 6 REAL,SAVE :: g ! gravity (m/s2) 7 !$OMP THREADPRIVATE(pi,rad,g) 8 REAL,SAVE :: r ! reduced gas constant (r=8.314511/(mugaz/1000.0)) 9 REAL,SAVE :: cpp ! Cp of the atmosphere 10 REAL,SAVE :: rcp ! r/cpp 11 !$OMP THREADPRIVATE(r,cpp,rcp) 12 REAL,SAVE :: mugaz ! molar mass of the atmosphere (g/mol) 13 REAL,SAVE :: omeg ! planet rotation rate (rad/s) 14 !$OMP THREADPRIVATE(mugaz,omeg) 15 13 16 END MODULE comcstfi_h -
trunk/LMDZ.MARS/libf/phymars/conf_phys.F
r3064 r3094 1 MODULE conf_phys_mod 2 3 IMPLICIT NONE 4 5 CONTAINS 6 1 7 SUBROUTINE conf_phys(ngrid,nlayer,nq) 2 8 … … 6 12 ! ------- 7 13 ! 8 ! Initialisation for the physical parametrisations of the LMD 9 ! martian atmospheric general circulation modele. 10 ! 11 ! author: Frederic Hourdin 15 / 10 /93 12 ! ------- 13 ! modified: Sebastien Lebonnois 11/06/2003 (new callphys.def) 14 ! Ehouarn Millour (oct. 2008) tracers are now identified 15 ! by their names and may not be contiguously 16 ! stored in the q(:,:,:,:) array 17 ! E.M. (june 2009) use getin routine to load parameters 18 ! adapted to the mesoscale use - Aymeric Spiga - 01/2007-07/2011 19 ! separated inifis into conf_phys and phys_state_var_init (A. Spiga) 20 ! 21 ! 22 ! arguments: 23 ! ---------- 24 ! 25 ! input: 26 ! ------ 27 ! 28 ! nq Number of tracers 29 ! 30 !======================================================================= 31 ! 14 ! Initialisation for the physical parametrisations 15 ! flags (i.e. run-time options) of the Mars PCM 32 16 !----------------------------------------------------------------------- 33 ! declarations: 34 ! ------------- 17 35 18 USE ioipsl_getin_p_mod, ONLY : getin_p 36 19 use tracer_mod, only : nuice_sed, ccn_factor, nuiceco2_sed, … … 61 44 include "callkeys.h" 62 45 63 INTEGER,INTENT(IN) :: ngrid,nlayer,nq 46 INTEGER,INTENT(IN) :: ngrid ! number of atmospheric columns 47 INTEGER,INTENT(IN) :: nlayer ! number of atmospheric layers 48 INTEGER,INTENT(IN) :: nq ! number of tracers 64 49 65 50 INTEGER ierr,j … … 1226 1211 call bcast(semi) 1227 1212 1228 END 1213 END SUBROUTINE conf_phys 1214 1215 END MODULE conf_phys_mod -
trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90
r3080 r3094 39 39 use turb_mod, only: q2 40 40 use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd 41 use conf_phys_mod, only: conf_phys 41 42 ! Mostly for XIOS outputs: 42 43 use mod_const_mpi, only: COMM_LMDZ -
trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
r3078 r3094 61 61 use comsaison_h, only: dist_sol, declin, zls, 62 62 & mu0, fract, local_time 63 use solarlong_mod, only: solarlong 63 64 use nirdata_mod, only: NIR_leedat 64 65 use nirco2abs_mod, only: nirco2abs … … 2605 2606 ELSE ! IF LMDZ 2606 2607 2607 if (ecritstart.GT.0) then !IF MULTIPLE RESTARTS nothing change2608 ztime_fin = pday - day_ini + ptime2609 .+ ptimestep/(float(iphysiq)*daysec)2610 else !IF ONE RESTART final time in top of day_end2611 ztime_fin = pday - day_ini-(day_end-day_ini)2612 .+ ptime + ptimestep/(float(iphysiq)*daysec)2613 2608 if (ecritstart.GT.0) then !IF MULTIPLE RESTARTS nothing change 2609 ztime_fin = pday - day_ini + ptime 2610 & + ptimestep/(float(iphysiq)*daysec) 2611 else !IF ONE RESTART final time in top of day_end 2612 ztime_fin = pday - day_ini-(day_end-day_ini) 2613 & + ptime + ptimestep/(float(iphysiq)*daysec) 2614 endif 2614 2615 2615 2616 ENDIF ! of IF (grid_type==unstructured) -
trunk/LMDZ.MARS/libf/phymars/planete_h.F90
r3040 r3094 2 2 IMPLICIT NONE 3 3 4 REAL aphelie ! Aphelion, in Mkm 5 REAL periheli ! Perihelion, in Mkm 6 REAL year_day ! Number of days in the year 7 REAL peri_day ! Date of perihelion, in days 8 REAL obliquit ! Obliquity of the planet, in degrees 9 REAL lmixmin 10 REAL emin_turb 11 REAL coefvis 12 REAL coefir 13 REAL lsperi ! Solar longitude of the perihelion, angle in rad 14 REAL e_elips ! Orbit eccentricity 15 REAL p_elips ! Ellipse semi-latus rectum 16 REAL unitastr ! Astronomical unit AU, in Mkm 4 REAL,SAVE :: aphelie ! Aphelion, in Mkm 5 REAL,SAVE :: periheli ! Perihelion, in Mkm 6 REAL,SAVE :: year_day ! Number of days in the year 7 !$OMP THREADPRIVATE(aphelie,periheli,year_day) 8 REAL,SAVE :: peri_day ! Date of perihelion, in days 9 REAL,SAVE :: obliquit ! Obliquity of the planet, in degrees 10 REAL,SAVE :: lmixmin 11 !$OMP THREADPRIVATE(peri_day,obliquit,lmixmin) 12 REAL,SAVE :: emin_turb 13 REAL,SAVE :: coefvis 14 REAL,SAVE :: coefir 15 !$OMP THREADPRIVATE(emin_turb,coefvis,coefir) 16 REAL,SAVE :: lsperi ! Solar longitude of the perihelion, angle in rad 17 REAL,SAVE :: e_elips ! Orbit eccentricity 18 REAL,SAVE :: p_elips ! Ellipse semi-latus rectum 19 REAL,SAVE :: unitastr ! Astronomical unit AU, in Mkm 20 !$OMP THREADPRIVATE(lsperi,e_elips,p_elips,unitastr) 17 21 18 22 END MODULE planete_h -
trunk/LMDZ.MARS/libf/phymars/solarlong.F
r3040 r3094 1 MODULE solarlong_mod 2 3 IMPLICIT NONE 4 5 CONTAINS 6 1 7 SUBROUTINE solarlong(pday,psollong) 2 use planete_h 3 USE comcstfi_h8 use planete_h, only: lsperi, peri_day, year_day, e_elips 9 use comcstfi_h, only: pi 4 10 IMPLICIT NONE 5 11 6 12 c======================================================================= 7 c 8 c Objet: 9 c ------ 10 c 11 c Calcul de la distance soleil-planete et de la declinaison 12 c en fonction du jour de l'annee. 13 c 14 c 15 c Methode: 16 c -------- 17 c 18 c Calcul complet de l'elipse 19 c 20 c Interface: 21 c ---------- 22 c 23 c Uncommon comprenant les parametres orbitaux. 24 c 25 c Arguments: 26 c ---------- 27 c 28 c Input: 29 c ------ 30 c pday jour de l'annee (le jour 0 correspondant a l'equinoxe) 31 c lwrite clef logique pour sorties de controle 32 c 33 c Output: 34 c ------- 35 c pdist_sol distance entre le soleil et la planete 36 c ( en unite astronomique pour utiliser la constante 37 c solaire terrestre 1370 Wm-2 ) 38 c pdecli declinaison ( en radians ) 39 c 13 c Compute solar longitude psollong (in radians) for a given Mars date 14 c pday (where pday==0 at northern Spring Equinox and pday in sols 15 c and fractions thereof) 40 16 c======================================================================= 41 c-----------------------------------------------------------------------42 c Declarations:43 c -------------44 17 45 18 c arguments: 46 19 c ---------- 47 20 48 REAL pday,pdist_sol,pdecli,psollong 49 LOGICAL lwrite 21 REAL,INTENT(IN) :: pday 22 REAL,INTENT(OUT) :: psollong 23 24 c Local variables: 25 c ---------------- 50 26 51 c Local: 52 c ------ 53 54 REAL zanom,xref,zx0,zdx,zteta,zz55 INTEGER iter27 REAL :: xref ! mean anomaly 28 REAL :: zx0 ! eccentric anomaly 29 REAL :: zteta ! true anomaly 30 REAL :: zanom,zdx,zz 31 INTEGER :: iter 56 32 57 33 58 c----------------------------------------------------------------------- 59 c calcul de l'angle polaire et de la distance au soleil : 60 c ------------------------------------------------------- 61 62 c calcul de l'zanomalie moyenne 34 c compute mean anomaly 63 35 64 36 zz=(pday-peri_day)/year_day … … 67 39 xref=abs(zanom) 68 40 69 c resolution de l'equation horairezx0 - e * sin (zx0) = xref70 c methode de Newton41 c solve equation zx0 - e * sin (zx0) = xref 42 c using Newton method 71 43 72 44 zx0=xref+e_elips*sin(xref) 73 DO 110 iter=1,1045 DO iter=1,10 ! 10 is overkill, typically converges in 1-3 iterations 74 46 zdx=-(zx0-e_elips*sin(zx0)-xref)/(1.-e_elips*cos(zx0)) 75 if(abs(zdx).le.(1.e-7)) goto 12047 if(abs(zdx).le.(1.e-7)) exit 76 48 zx0=zx0+zdx 77 110 continue 78 120 continue 49 ENDDO 50 79 51 zx0=zx0+zdx 80 52 if(zanom.lt.0.) zx0=-zx0 81 53 82 c zteta est la longitude solaire54 c compute true anomaly zteta, now that eccentric anomaly zx0 is known 83 55 84 56 zteta=2.*atan(sqrt((1.+e_elips)/(1.-e_elips))*tan(zx0/2.)) 85 57 58 c compute solar longitude from zteta 86 59 psollong=zteta+lsperi 87 60 61 c handle limit cases where psollong lands outside [0:2*pi] 88 62 IF(psollong.LT.0.) psollong=psollong+2.*pi 89 63 IF(psollong.GT.2.*pi) psollong=psollong-2.*pi 90 c-----------------------------------------------------------------------91 c sorties eventuelles:92 c ---------------------93 64 94 c IF (lwrite) THEN 95 c PRINT*,'jour de l"annee :',pday 96 c PRINT*,'distance au soleil (en unite astronomique) :',pdist_sol 97 c PRINT*,'declinaison (en degres) :',pdecli*180./pi 98 c ENDIF 65 END SUBROUTINE solarlong 99 66 100 RETURN 101 END 67 END MODULE solarlong_mod
Note: See TracChangeset
for help on using the changeset viewer.