| 1 | ! |
|---|
| 2 | ! $Id: $ |
|---|
| 3 | ! |
|---|
| 4 | SUBROUTINE phyredem (fichnom) |
|---|
| 5 | |
|---|
| 6 | USE dimphy |
|---|
| 7 | USE mod_grid_phy_lmdz |
|---|
| 8 | USE mod_phys_lmdz_para |
|---|
| 9 | USE iophy |
|---|
| 10 | USE phys_state_var_mod |
|---|
| 11 | USE iostart, only : open_restartphy,close_restartphy, & |
|---|
| 12 | enddef_restartphy,put_var,put_field |
|---|
| 13 | use geometry_mod, only: longitude_deg, latitude_deg |
|---|
| 14 | USE time_phylmdz_mod, only: day_end, annee_ref, itau_phy, raz_date |
|---|
| 15 | use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd, & |
|---|
| 16 | east_gwstress, west_gwstress |
|---|
| 17 | use age_of_air_mod, only: ok_aoa |
|---|
| 18 | use tabcontrol_mod, only: dtime, radpas, length |
|---|
| 19 | use soil_mod, only: nsoilmx |
|---|
| 20 | use clesphys_mod |
|---|
| 21 | |
|---|
| 22 | implicit none |
|---|
| 23 | |
|---|
| 24 | character(len=*),intent(in) :: fichnom |
|---|
| 25 | REAL :: tab_cntrl(length) |
|---|
| 26 | integer :: isoil |
|---|
| 27 | CHARACTER(len=2) :: str2 |
|---|
| 28 | integer :: pass |
|---|
| 29 | |
|---|
| 30 | ! open file |
|---|
| 31 | |
|---|
| 32 | CALL open_restartphy(fichnom) |
|---|
| 33 | |
|---|
| 34 | ! tab_cntrl() contains run parameters |
|---|
| 35 | |
|---|
| 36 | tab_cntrl(:)=0.0 |
|---|
| 37 | |
|---|
| 38 | tab_cntrl(1) = dtime |
|---|
| 39 | tab_cntrl(2) = radpas |
|---|
| 40 | tab_cntrl(3) = 0.0 |
|---|
| 41 | tab_cntrl(4) = 0 |
|---|
| 42 | tab_cntrl(5) = 0 |
|---|
| 43 | tab_cntrl(6) = nbapp_rad |
|---|
| 44 | |
|---|
| 45 | IF( cycle_diurne ) tab_cntrl( 7 ) = 1. |
|---|
| 46 | IF( soil_model ) tab_cntrl( 8 ) = 1. |
|---|
| 47 | IF( ok_orodr ) tab_cntrl(10 ) = 1. |
|---|
| 48 | IF( ok_orolf ) tab_cntrl(11 ) = 1. |
|---|
| 49 | IF( ok_gw_nonoro ) tab_cntrl(12 ) = 1. |
|---|
| 50 | |
|---|
| 51 | tab_cntrl(13) = day_end |
|---|
| 52 | tab_cntrl(14) = annee_ref |
|---|
| 53 | tab_cntrl(15) = itau_phy |
|---|
| 54 | |
|---|
| 55 | ! write data to file |
|---|
| 56 | DO pass=1,2 ! pass=1 netcdf definition ; pass=2 netcdf write |
|---|
| 57 | |
|---|
| 58 | CALL put_var(pass,"controle","Parametres de controle",tab_cntrl) |
|---|
| 59 | |
|---|
| 60 | ! coordinates |
|---|
| 61 | |
|---|
| 62 | CALL put_field(pass,"longitude", & |
|---|
| 63 | "Longitudes de la grille physique",longitude_deg) |
|---|
| 64 | |
|---|
| 65 | CALL put_field(pass,"latitude", & |
|---|
| 66 | "Latitudes de la grille physique",latitude_deg) |
|---|
| 67 | |
|---|
| 68 | ! variables |
|---|
| 69 | |
|---|
| 70 | CALL put_field(pass,"TS","Temperature de surface",ftsol) |
|---|
| 71 | |
|---|
| 72 | DO isoil=1, nsoilmx |
|---|
| 73 | IF (isoil.LE.99) THEN |
|---|
| 74 | WRITE(str2,'(i2.2)') isoil |
|---|
| 75 | CALL put_field(pass,"Tsoil"//str2, & |
|---|
| 76 | "Temperature du sol No."//str2,ftsoil(:,isoil)) |
|---|
| 77 | ELSE |
|---|
| 78 | PRINT*, "Too many soil layers" |
|---|
| 79 | CALL abort |
|---|
| 80 | ENDIF |
|---|
| 81 | ENDDO |
|---|
| 82 | |
|---|
| 83 | CALL put_field(pass,"ALBE","albedo de surface",falbe) |
|---|
| 84 | CALL put_field(pass,"solsw","Rayonnement solaire a la surface",solsw) |
|---|
| 85 | CALL put_field(pass,"sollw","Rayonnement IR a la surface",sollw) |
|---|
| 86 | CALL put_field(pass,"fder","Derive de flux",fder) |
|---|
| 87 | CALL put_field(pass,"dlw","Derivee flux IR",dlw) |
|---|
| 88 | CALL put_field(pass,"sollwdown","Flux IR vers le bas a la surface",sollwdown) |
|---|
| 89 | CALL put_field(pass,"RADS","Rayonnement net a la surface",radsol) |
|---|
| 90 | CALL put_field(pass,"ZMEA","zmea Orographie sous-maille",zmea) |
|---|
| 91 | CALL put_field(pass,"ZSTD","zstd Orographie sous-maille",zstd) |
|---|
| 92 | CALL put_field(pass,"ZSIG","zsig Orographie sous-maille",zsig) |
|---|
| 93 | CALL put_field(pass,"ZGAM","zgam Orographie sous-maille",zgam) |
|---|
| 94 | CALL put_field(pass,"ZTHE","zthe Orographie sous-maille",zthe) |
|---|
| 95 | CALL put_field(pass,"ZPIC","zpic Orographie sous-maille",zpic) |
|---|
| 96 | CALL put_field(pass,"ZVAL","zval Orographie sous-maille",zval) |
|---|
| 97 | CALL put_field(pass,"Q2","Turbulent Kinetic Energy",q2) |
|---|
| 98 | |
|---|
| 99 | CALL put_field(pass,"TANCIEN","T Previous iteration",t_ancien) |
|---|
| 100 | |
|---|
| 101 | ! Non-orographic gavity waves |
|---|
| 102 | if (ok_gw_nonoro) then |
|---|
| 103 | call put_field(pass,"du_nonoro_gwd","Zonal wind tendency due to GW",du_nonoro_gwd) |
|---|
| 104 | call put_field(pass,"dv_nonoro_gwd","Meridional wind tendency due to GW",dv_nonoro_gwd) |
|---|
| 105 | call put_field(pass,"east_gwstress","Eastward stress profile due to GW",east_gwstress) |
|---|
| 106 | call put_field(pass,"west_gwstress","Westward stress profile due to GW",west_gwstress) |
|---|
| 107 | endif |
|---|
| 108 | |
|---|
| 109 | if (ok_aoa) then |
|---|
| 110 | call put_field(pass,"age","Age of air",age) |
|---|
| 111 | endif |
|---|
| 112 | |
|---|
| 113 | ! end definition mode or close file |
|---|
| 114 | IF (pass==1) CALL enddef_restartphy |
|---|
| 115 | IF (pass==2) CALL close_restartphy |
|---|
| 116 | ENDDO ! DO pass=1,2 ! pass=1 netcdf definition ; pass=2 netcdf write |
|---|
| 117 | |
|---|
| 118 | !$OMP BARRIER |
|---|
| 119 | |
|---|
| 120 | END SUBROUTINE phyredem |
|---|