Parent Directory | Revision Log
Sticky Revision: |
Created procedure phyetat0_new to avoid side effects on variables of module phyetat0_m. Had then to change test_ozonecm: read rlat from netCDF file instead of specifying it in test_ozonecm.
Move fxhyp and fyhyp to module dynetat0_m to avoid side effect on variables of module dynetat0_m. A downside is that we need to link heavyside, coefpoly and tanh_cautious into the gcm and test_fxhyp executables. We must move invert_zoom_x and principal_cshift to module dynetat0_m to avoid circular dependency. Move definition of rlatu(1) and rlatu(jjm + 1) inside fyhyp to avoid side effect on rlatu.
Merge procedures clcdrag and coefcdrag into procedure cdrag (following LMDZ revision 2232).
Remove procedure calbeta. Was only useful for the case is_ter. Just inline it in this case.
Rename procedure clmain to pbl_surface (following LMDZ). Remove choice soil_model = f. This choice made the algorithm unclear in interfsurf_hq. Also soil_model = f is never used in LMDZ. radsol was intent inout in clqh because of its possible modification in interfsurf_hq, but the corresponding actual argument yrads is not used in pbl_surface. The modification of radsol in interfsurf_hq was a bad idea. Now we can more clearly make radsol an intent in argument of clqh and interfsurf_hq.
Define macros of the preprocessor CPP_IIM, CPP_JJM, CPP_LLM so we can control the resolution from the compilation command, and automate compilation for several resolutions. In module yoethf_m, transform variables into named constants. So we do not need procedure yoethf any longer. Bug fix in program test_inter_barxy, missing calls to fyhyp and fxhyp, and definition of rlatu. Remove variable iecri of module conf_gcm_m. The files dyn_hist*.nc are written every time step. We are simplifying the output system, pending replacement by a whole new system. Modify possible value of vert_sampling from "param" to "strato_custom", following LMDZ. Default values of corresponding namelist variables are now the values used for LMDZ CMIP6.
Rename module dimens_m to dimensions.
Remove output file dynhist_ave.nc. As in physics, keep only one output file for instantaneous output, pending replacement by a more powerful solution like XIOS.
Try to clarify the logic. Remove module ener. Move variables from module ener to module dynetat0_m, where they are defined in program gcm. In sortvarc, I do not see how ptot0 could be 0, discard this possibility. Remove dummy argument resetvarc of procedure sortvarc. The difference is that sortvarc is called by caldyn or caldyn0 so just do different processing in caldyn and caldyn0 instead of inside sortvarc. No need for variables ang, etot, ptot, rmsdpdt, rmsv, stot, ztot to be at module level in module sortvarc_m, downgrade them to arguments of sortvarc. Instead of modyfying the meaning of ang, etot, ptot, rmsdpdt, rmsv, stot, ztot from absolute quantities to variations of these quantities, print the ratio in caldyn.
Extract part of clmain into a new procedure coef_diff_turb (following LMDZ).
Bug fix in dynetat0: phisinit to phis. gcm explodes (stops in hgardfou) in less than one day with iflag_pbl = 7 (Mellor and Yamada 2.0 Fournier) and 11 (corresponding to iflag_pbl = 31 in LMDZ, call to vdif_kcay). So remove those choices. Not much used in LMDZ either. Remaining useful choices are iflag = 0, 1, 6, 8, 9. Remove procedure yamada, which was not used.
LMDZE is now in Fortran 2003 (use of allocatable arguments). gradsdef was not used. Change names: [uv]10m to [uv]10m_srf in clmain, y[uv]1 to [uv]1lay. Remove useless complication: zx_alf[12]. Do not modify [uv]1lay after initial definition from [uv]. Add [uv]10m_srf to output. Change names in physiq: [uv]10m to [uv]10m_srf, z[uv]10m to [uv]10m, corresponding to NetCDF output names. Remove unused complication couchelimite and useless variable inirnpb in phytrac.
offline allows to save variables for another run with offline transport, but there is no provision for this other run with offline transport in LMDZE. The procedures read_pstoke and read_pstoke0 in LMDZ are never called. So removed the possibility offline = T.
clcdrag is no longer used in LMDZ. Replaced by cdrag in LMDZ. In cdrag in LMDZ, zxli is a symbolic constant, false. So removed case zxli true in LMDZE. read_sst is called zero (if no ocean point on the whole planet) time or once per call of physiq. If mod(itap - 1, lmt_pas) == 0 then we have advanced in time of lmt_pas and deja_lu is necessarily false. qsat[sl] and dqsat[sl] were never called. Added output of qsurf in histins, following LMDZ. Last dummy argument dtime of phystokenc is always the same as first dummy argument pdtphys, removed dtime. Removed make rules for nag_xref95, since it does not exist any longer.
Removed module conema3_m. Moved variables epmax and iflag_clw of conema3_m to conf_phys_m, where they are defined. Removed unused variable ok_adj_ema of conema3_m. Added variables d_t_ec, dtsw0 and dtlw0 to histins.nc (following LMDZ). Removed case not lessivage in phytrac. (Not used in LMDZ without INCA either.)
Moved variables from module com_io_dyn to module inithist_m, where they are defined. Split grid_atob.f into grille_m.f and dist_sphe.f. Extracted ASCCI art to documentation. In grille_m, use automatic arrays instead of maximum size. In grille_m, instead of printing data for every problematic point, print a single diagnostic message. Removed variables top_height, overlap, lev_histhf, lev_histday, lev_histmth, type_run, ok_isccp, ok_regdyn, lonmin_ins, lonmax_ins, latmin_ins, latmax_ins of module clesphys, not used. Removed variable itap of module histwrite_phy_m, not used. There is a variable itap in module time_phylmdz. Added output of tro3. In physiq, no need to compute wo at every time-step, since we only use it in radlwsw.
The program did not work with cycle_diurne set to false. mu0 in physiq, which is supposed to be a cosine, was set to -999.999. So prmu in swu had a value of the order of 1e3. So zrmum1 in sw2s had a value of the order of 1e3. So zrayl in sw2s had a value of the order of 1e15. So ztray and ptauaz in swclr also had a large value. So zcorae at line 138 in swclr had a large negative value, which resulted in overflow at line 138. This assignment of -999.999 to mu0 dates from somewhere between revisions 348 and 524 of LMDZ. It was corrected in revision 1068 of LMDZ with a call to angle which was present in revision 348. However, procedure angle was removed from LMDZE in revision 22 because it was not used. Hesitated to bring back angle but, finally, just removed the option of having no diurnal cycle.
Module academic was not used. Useful values for iflag_phys were only 0 and 1 so changed type to logical. Definition of fmagic was duplicated in procedures alboc and alboc_cd so moved it up to interfsurf_hq and also moved multiplication by fmagic (following LMDZ).
dnwd0 is just - mp. Compute it simply in concvl. da, phi and mp were set to 0 in physiq before the call to concvl. Clearer to set da1, phi1 and mp1 to 0 in cv_driver so they are intent out. qcheck was debugging, printed to standard output and was called several times per time step of physics. zxtsol was a duplicate of ztsol.
Removed calls to diagphy and diagetpq. Those were debugging procedures, which printed to standard output and were called several times per time step of physics.
Promoted lmt_pas from local variable of physiq to variable of module conf_gcm_m. Removed variable run_off of module interface_surf. Was not used. Called run_off_ter in LMDZ, but not used nor printed there either. Simplified logic in interfoce_lim. The way it was convoluted with interfsurf_hq and clmain was quite a mess. Extracted reading of SST into a separate procedure: read_sst. We do not need SST and pctsrf_new at the same time: SST is not needed for sea-ice surface. I did not like this programming: going through the procedure repeatedly for different purposes and testing inside whether there was something to do or it was already done. Reading is now only controlled by itap and lmt_pas, instead of debut, jour, jour_lu and deja_lu. Now we do not copy from pct_tmp to pctsrf_new every time step. Simplified processing of pctsrf in clmain and below. It was quite troubling: pctsrf_new was intent out in interfoce_lim but only defined for ocean and sea-ice. Also the idea of having arrays for all surfaces, pcsrf and pctsrf_new, in interfsurf_hq, which is called for a particular surface, was troubling. pctsrf_new for all surfaces was intent out in intefsurf_hq, but not defined for all surfaces at each call. Removed argument pctsrf_new of clmain: was a duplicate of pctsrf on output, and not used in physiq. Replaced pctsrf_new in clmain by pctsrf_new_oce and pctsrf_new_sic, which were the only ones modified.
Removed the possibility to read aerosol fields. This was not operational. It required fields already regridded in the three dimensions. It seems quite weird to me not to have online vertical regridding, since the surface pressure varies. There was the possibility of adding vertical regridding. But development is not in the spirit of LMDZE. Furthermore, the treatment of aerosols that was in LMDZE is completely obsolete in LMDZ. We could try importing the up-to-date treatment of aerosols of LMDZ, but that carries LMDZE quite far: there is the problem of the calendar and the problem of updated radiative transfer required for updated aerosols.
Extracted the call to read_comdissnew out of conf_gcm. Made ok_instan a variable of module clesphys, itau_phy a variable of module phyetat0_m, nid_ins a variable of module ini_histins_m, itap a variable of new module time_phylmdz, so that histwrite_phy can be called from any procedure without the need to cascade those variables into that procedure. Made itau_w a variable of module time_phylmdz so that it is computed only once per time step of physics. Extracted variables of module clesphys which were in namelist conf_phys_nml into their own namelist, clesphys_nml, and created procedure read_clesphys reading clesphys_nml, to avoid side effect. No need for double precision in procedure getso4fromfile. Assume there is a single variable for the whole year in the NetCDF file instead of one variable per month. Created generic procedure histwrite_phy and removed procedure write_histins, following LMDZ. histwrite_phy has only two arguments, can be called from anywhere, and should manage the logic of writing or not writing into various history files with various operations. So the test on ok_instan goes inside histwrite_phy. Test for raz_date in phyetat0 instead of physiq to avoid side effect. Created procedure increment_itap to avoid side effect. Removed unnecessary differences between procedures readsulfate and readsulfate_pi.
Created module cv_thermo_m around procedure cv_thermo. Moved variables from module cvthermo to module cv_thermo_m, where they are defined. In ini_histins and initphysto, using part of rlon and rlat from phyetat0_m is pretending that we do not know about the dynamical grid, while the way we extract zx_lon(:, 1) and zx_lat(1, :) depends on ordering inside rlon and rlat. So we might as well simplify and clarify by using directly rlonv and rlatu. Removed intermediary variables in write_histins and phystokenc.
There was a function gr_phy_write_3d in dyn3d and a function gr_phy_write_2d in module grid_change. Moved them into a new module gr_phy_write_m under a generic interface gr_phy_write. Replaced calls to gr_fi_ecrit by calls to gr_phy_write. Removed arguments len, nloc and nd of cv30_compress. Removed arguments wd and wd1 of cv30_uncompress, wd of cv30_yield, wd of concvl, wd1 of cv_driver. Was just filled with 0. Removed option ok_gust in physiq, never used. In cv30_unsat, cv30_yield and cv_driver, we only need to define b to level nl - 1.
Removed argument ncum of cv30_unsat, arguments nloc, ncum, nd, na of cv30_yield.
Removed variables nlm and nlp of module cv30_param_m. We do not believe much in the benefit of these intermediary variables so we go for clarity. Removed variable noff of module cv30_param_m. Never used anywhere else. Just set the value of nl explicitly in cv30_param. Removed argument nd of cv30_param. Only called with nd = klev. Replaced calls to zilch by array assignments. There was a strange double call to zilch with the same arguments in cv30_mixing. Removed procedure cv_flag. Just set the value of variable cvflag_grav of module cvflag at declaration.
CV3 to CV30 (following LMDZ) (continued).
Removed the option iflag_con == 4. This seems to be a coding of the Emanuel scheme equivalent to and older than the coding for iflag_con == 3.
Moved variables date0, deltat, datasz_max, ncvar_ids, point, buff_pos, buffer, regular from module histcom_var to modules where they are defined. Removed procedure ioipslmpp, useless for a sequential program. Added argument datasz_max to histwrite_real (to avoid circular dependency with histwrite). Removed useless variables and computations everywhere. Changed real litteral constants from default kind to double precision in lwb, lwu, lwvn, sw1s, swtt, swtt1, swu. Removed unused arguments: paer of sw, sw1s, sw2s, swclr; pcldsw of sw1s, sw2s; pdsig, prayl of swr; co2_ppm of clmain, clqh; tsol of transp_lay; nsrf of screenp; kcrit and kknu of gwstress; pstd of orosetup. Added output of relative humidity.
correctbid did nothing. (Not used either in LMDZ since revision 1170.) Avoid aliasing in arguments of nat2gcm: use a single set of arguments with intent inout. Argument q of nat2gcm was not used. pres2lev now accepts po in any monotonic order. So the input files for nudging can now have the pressure coordinate in any order. Also, we read the latitude coordinate from the input files for nudging and we invert order if necessary so the input files for nudging can now have the latitude coordinate in any order. In pre2lev, no need for lmomx: use automatic arrays. Removed variable ncep of module conf_guide_m. Instead, we find out what the pressure coordinate is with find_coord.
Eignvectors computed by procedure jacobi are already normalized. No need to call acc.
Split ppm3d.f into files containing a single procedure. Factorized computations of filtering matrices into a procedure inifilr_hemisph. Had then to change the matrices from allocatable to pointer and from customized lower bound to lower bound 1. The change in lower bounds does not matter because the matrices are only used as a whole as actual arguments. Also, in infilr, instead of finding jfilt[ns][uv] from approximately jjm /2, start at index j1 that corresponds to the equator. This is not the same if there is a zoom in latitude. Also, the test (rlamda(modfrst[ns][uv](j)) * cos(rlat[uv](j)) < 1) in the loops on filtered latitudes is not useful now that we start from j1: it is necessarily true. See notes. Just encapsulated lwvn into a module and removed unused argument ktraer.
Variable pls of module pressure_var was only modified by calfis but I could not move it to module calfis_m because it was used by a procedure called by calfis (it would have been a cyclic dependency). In the same way, variable p3d of module pressure_var was only modified by leapfrog but I could not move it to module leapfrog_m. So removed module pressure_var. p3d becomes a local variable of leapfrog and an argument of calfis. Use paprs and play in regr_pr_int and regr_pr_av (following LMDZ). The idea in regr_pr_int and regr_pr_av is to spread and pack before the regridding instead of packing afterward. The cost in memory should only be a two-dimensional temporary array created by spread. The cost in clarity is only the transiting of paprs and pplay through regr_pr_comb_coefoz, but this is more than compensated by removing the side effect on module variables.
Write variables from phytrac to "histins.nc" instead of "histrac.nc". The idea is to have different output files only if they have different coordinates, and not according to content (following LMDZ).
Subroutine sugwd sets variables of module yoegwd. Better to put it into module yoegwd. Variables of module yoegwd other than NKTOPG, NSTRA can be symbolic constants. sugwd now only sets NKTOPG, NSTRA. Simplified the computation of NKTOPG, NSTRA by making the local variable zpm1r an array instead of a scalar and calling ifirstloc.
Just encapsulated SUBROUTINE vlsplt in a module and cleaned it. In procedure vlx, local variables dxqu and adxqu only need indices iip2:ip1jm. Otherwise, just cleaned vlx. Procedures dynredem0 and dynredem1 no longer have argument fichnom, they just operate on a file named "restart.nc". The programming guideline here is that gcm should not be more complex than it needs by itself, other programs (ce0l etc.) just have to adapt to gcm. So ce0l now creates files "restart.nc" and "restartphy.nc". In order to facilitate decentralizing the writing of "restartphy.nc", created a procedure phyredem0 out of phyredem. phyredem0 creates the NetCDF header of "restartphy.nc" while phyredem writes the NetCDF variables. As the global attribute itau_phy needs to be filled in phyredem0, at the beginnig of the run, we must compute its value instead of just using itap. So we have a dummy argument lmt_pas of phyredem0. Also, the ncid of "startphy.nc" is upgraded from local variable of phyetat0 to dummy argument. phyetat0 no longer closes "startphy.nc". Following the same decentralizing objective, the ncid of "restart.nc" is upgraded from local variable of dynredem0 to module variable of dynredem0_m. "restart.nc" is not closed at the end of dynredem0 nor opened at the beginning of dynredem1. In procedure etat0, instead of creating many vectors of size klon which will be filled with zeroes, just create one array null_array. In procedure phytrac, instead of writing trs(: 1) to a text file, write it to "restartphy.nc" (following LMDZ). This is better because now trs(: 1) is next to its coordinates. We can write to "restartphy.nc" from phytrac directly, and not add trs(: 1) to the long list of variables in physiq, thanks to the decentralizing of "restartphy.nc". In procedure phyetat0, we no longer write to standard output the minimum and maximum values of read arrays. It is ok to check input and abort on invalid values but just printing statistics on input seems too much useless computation and out of place clutter.
Removed argument d of procedure acc. Was probably here just because automatic arrays were unknown. eigen_sort was eigsrt from Numerical Recipes. In procedure inifilr, create file "eignvl.txt" instead of writing to standard output.
Changed unit of variables lat_min_guide and lat_max_guide from module conf_guide_m from degrees to rad. Then we do not have to convert the whole array rlat from rad to degrees in SUBROUTINE tau2alpha. Removed some useless computations in inigeom. Removed module coefils. Moved variables sddv, unsddv, sddu, unsddu, eignfnu, eignfnv of module coefils to module inifgn_m. Downgraded variables coefilu, coefilu2, coefilv, coefilv2, modfrstu, modfrstv of module coefils to local variables of SUBROUTINE inifilr. Write and read a 3-dimensional variable Tsoil in restartphy.nc and startphy.nc instead of multiple variables for the different subs-urfaces and soil layers. This does not allow any longer to provide only the surface value in startphy.nc and spread it to other layers. Instead, if necessary, pre-process the file startphy.nc to spread the surface value.
dynetat0 read rlonu, rlatu, rlonv, rlatv, cu_2d, cv_2d, aire_2d from "start.nc" and then these variables were overwritten by inigeom. Corrected this. Now, inigeom does not compute rlonu, rlatu, rlonv and rlatv. Moreover, cu_2d, cv_2d, aire_2d are not written to "restart.nc". Since xprimu, xprimv, xprimm025, xprimp025, rlatu1, rlatu2, yprimu1, yprimu2 are computed at the same time as rlonu, rlatu, rlonv, rlatv, and since it would not be convenient to separate those computations, we decide to write xprimu, xprimv, xprimm025, xprimp025, rlatu1, rlatu2, yprimu1, yprimu2 into "restart.nc", read them from "start.nc" and not compute them in inigeom. So, in summary, "start.nc" contains all the coordinates and their derivatives, and inigeom only computes the 2D-variables. Technical details: Moved variables rlatu, rlonv, rlonu, rlatv, xprimu, xprimv from module comgeom to module dynetat0_m. Upgraded local variables rlatu1, yprimu1, rlatu2, yprimu2, xprimm025, xprimp025 of procedure inigeom to variables of module dynetat0_m. Removed unused local variable yprimu of procedure inigeom and corresponding argument yyprimu of fyhyp. Moved variables clat, clon, grossismx, grossismy, dzoomx, dzoomy, taux, tauy from module serre to module dynetat0_m (since they are read from "start.nc"). The default values are now defined in read_serre instead of in the declarations. Changed name of module serre to read_serre_m, no more module variable here. The calls to fxhyp and fyhyp are moved from inigeom to etat0. Side effects in programs other than gcm: etat0 and read_serre write variables of module dynetat0; the programs test_fxyp and test_inter_barxy need more source files. Removed unused arguments len and nd of cv3_tracer. Removed unused argument PPSOL of LWU. Bug fix in test_inter_barxy: forgotten call to read_serre.
Removed unused argument missval in ma_fucoll_r[1-3]1, ma_fufill_r[1-3]1. Split filtreg into two procedures: filtreg_scal and filtreg_v. I did not like the test on the extent of the argument and there was no common code between the two cases: jjm and jjm + 1. Also, it is simpler now to just remove the argument "direct" from filtreg_v instead of allowing it and then stopping the program if it is false. Removed the computation of pkf in reanalyse2nat, was not used. As a consequence of the split of filtreg, had to extract the computation of pkf out of exner_hyb. This is clearer anyway because we want to be able to call exner_hyb with any size in the first two dimensions (as in test_disvert). But at the same time exner_hyb required particular sizes for the computation of pkf. It was awkward. The only computation of pkf is now in leapfrog.
Clarified the logic in filtreg by creating a procedure filtreg_hemisph. It was terrible with a loop on hemispheres and tests on hemisphere inside the loop, plus maddening indirections on latitude bounds, plus repeated code. Went from 126 lines to much clearer 74 + 32 = 106 lines. In module inifilr_m, finally made the arrays matrice[uv][ns], matrinv[ns] dynamic (following LMDZ). Changed the lower bound of matriceun and matrinvn in the 3rd dimension: 2 instead of 1, the index 1 was not defined (nor used). In module inifilr_m, changed the bounds of matriceus and matrinvs in the 3rd dimension: jfiltsu:jjm instead of 1:jjm - jfiltsu + 1. Changed the bounds of matricevs in the 3rd dimension: jfiltsv:jjm instead of 1:jjm - jfiltsv + 1. It is a little simpler and clearer this way in procedure inifilr.
Sources inside, compilation outside.
Removed procedure jacobi, which was a copy of the file from Numerical Recipes in Fortran 77. Refer to the Numer_Rec_95 library instead. There was a strange line in procedure coordij: j cannot be equal to 0 after the loop on j.
Renamed procedure fxhyp_loop_ik to invert_zoom_x. Bug fix. clat is now in rad so there should be no conversion in fyhyp. (This bug had an effect only if clat was /= 0.) No need for heavyside to be double precision. Removed variable tnom of module iniadvtrac_m. Was redundant with tname.
Moved some processing from fxhyp_loop_ik to fxhyp. Now fxhyp_loop_ik does not necessarily give longitudes near [-pi, pi]. In fxhyp, we look in rlonm025 whether we need to move the array toward [-pi, pi]. If so, we apply the same move to all grids: rlonm025, rlonv, rlonp025, rlonu and the corresponding derivatives. The move itself is done by the new procedure principal_cshift. This revision makes the logic clearer. (For example, we do not have a saved variable is2 in fxhyp_loop_ik any longer and we remove a test on ik in fxhyp_loop_ik.) Fixed a bad error message in fxhyp_loop_ik: talked about rlonu when xvrai is not always rlonu.
Added some test programs. In fxhyp_loop_ik, changed precision from 1e-3 to 1e-6. Reset initial value of xo1 to first guess of xi instead of final value of xi for previous i (better logic).
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.
ViewVC Help | |
Powered by ViewVC 1.1.21 |