Changeset 10251 for branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/create_restart.f90
- Timestamp:
- 2018-10-29T15:20:26+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/TOOLS/SIREN/src/create_restart.f90
r10248 r10251 25 25 !> @endcode 26 26 !> 27 !> @note28 !> you could find a template of the namelist in templates directory.29 !>30 27 !> create_restart.nam comprise 9 namelists:<br/> 31 28 !> - logger namelist (namlog) … … 46 43 !> - cn_logfile : log filename 47 44 !> - cn_verbosity : verbosity ('trace','debug','info', 48 !> 'warning','error','fatal' ,'none')45 !> 'warning','error','fatal') 49 46 !> - in_maxerror : maximum number of error allowed 50 47 !> … … 62 59 !> - cn_bathy1 : bathymetry file 63 60 !> - in_perio1 : NEMO periodicity index 61 !> - in_extrap : number of land point to be extrapolated 62 !> before writing file 64 63 !> 65 64 !> * _vertical grid namelist (namzgr)_:<br/> … … 84 83 !> - cn_varinfo : list of variable and extra information about request(s) 85 84 !> to be used.<br/> 86 !> each elements of *cn_varinfo* is a string character 87 !> (separated by ',').<br/> 85 !> each elements of *cn_varinfo* is a string character.<br/> 88 86 !> it is composed of the variable name follow by ':', 89 87 !> then request(s) to be used on this variable.<br/> 90 88 !> request could be: 91 !> - int = interpolation method 92 !> - ext = extrapolation method 93 !> - flt = filter method 94 !> - min = minimum value 95 !> - max = maximum value 96 !> - unt = new units 97 !> - unf = unit scale factor (linked to new units) 89 !> - interpolation method 90 !> - extrapolation method 91 !> - filter method 92 !> - > minimum value 93 !> - < maximum value 98 94 !> 99 95 !> requests must be separated by ';'.<br/> … … 102 98 !> informations about available method could be find in @ref interp, 103 99 !> @ref extrap and @ref filter.<br/> 104 !> Example: 'votemper: int=linear; flt=hann; ext=dist_weight','vosaline: int=cubic'100 !> Example: 'votemper: linear; hann; dist_weight','vosaline: cubic' 105 101 !> @note 106 102 !> If you do not specify a method which is required, … … 140 136 !> * _output namelist (namout)_:<br/> 141 137 !> - cn_fileout : output file 142 !> - ln_extrap : extrapolate land point or not138 !> - in_nproc : total number of processor to be used 143 139 !> - in_niproc : i-direction number of processor 144 140 !> - in_njproc : j-direction numebr of processor 145 !> - in_nproc : total number of processor to be used146 141 !> - cn_type : output format ('dimg', 'cdf') 147 142 !> … … 153 148 !> - offset computed considering grid point 154 149 !> - add attributes in output variable 155 !> @date June, 2015156 !> - extrapolate all land points, and add ln_extrap in namelist.157 !> - allow to change unit.158 150 !> 159 151 !> @note Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 173 165 USE iom ! I/O manager 174 166 USE grid ! grid manager 175 USE vgrid 167 USE vgrid ! vertical grid manager 176 168 USE extrap ! extrapolation manager 177 169 USE interp ! interpolation manager … … 257 249 CHARACTER(LEN=lc) :: cn_bathy1 = '' 258 250 INTEGER(i4) :: in_perio1 = -1 251 INTEGER(i4) :: in_extrap = 0 259 252 260 253 !namzgr … … 286 279 ! namout 287 280 CHARACTER(LEN=lc) :: cn_fileout = 'restart.nc' 288 LOGICAL :: ln_extrap = .FALSE.289 281 INTEGER(i4) :: in_nproc = 0 290 282 INTEGER(i4) :: in_niproc = 0 … … 309 301 & cn_coord1, & !< coordinate file 310 302 & cn_bathy1, & !< bathymetry file 311 & in_perio1 !< periodicity index 303 & in_perio1, & !< periodicity index 304 & in_extrap 312 305 313 306 NAMELIST /namzgr/ & … … 339 332 NAMELIST /namout/ & !< output namlist 340 333 & cn_fileout, & !< fine grid bathymetry file 341 & ln_extrap, & !< extrapolate or not334 & in_nproc, & !< number of processor to be used 342 335 & in_niproc, & !< i-direction number of processor 343 336 & in_njproc, & !< j-direction numebr of processor 344 & in_nproc, & !< number of processor to be used345 337 & cn_type !< output type format (dimg, cdf) 346 338 !------------------------------------------------------------------- … … 355 347 CALL GET_COMMAND_ARGUMENT(1,cl_namelist) !f03 intrinsec 356 348 ENDIF 357 349 358 350 ! read namelist 359 351 INQUIRE(FILE=TRIM(cl_namelist), EXIST=ll_exist) … … 442 434 ! check 443 435 ! check output file do not already exist 444 IF( in_nproc > 0 )THEN 445 cl_fileout=file_rename(cn_fileout,1) 446 ELSE 447 cl_fileout=file_rename(cn_fileout) 448 ENDIF 436 cl_fileout=file_rename(cn_fileout,1) 449 437 INQUIRE(FILE=TRIM(cl_fileout), EXIST=ll_exist) 450 438 IF( ll_exist )THEN … … 480 468 & il_rho(:) ) 481 469 482 ! fine grid ghost cell 470 ! compute level 471 ALLOCATE(tl_level(ip_npoint)) 472 tl_level(:)=vgrid_get_level(tl_bathy1, cl_namelist ) 473 474 ! remove ghost cell 483 475 il_xghost(:,:)=grid_get_ghost(tl_bathy1) 476 DO ji=1,ip_npoint 477 CALL grid_del_ghost(tl_level(ji), il_xghost(:,:)) 478 ENDDO 479 480 ! clean 481 CALL mpp_clean(tl_bathy1) 484 482 485 483 ! work on variables … … 516 514 tl_var(jvar) = create_restart_matrix( & 517 515 & tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj), tl_coord1, & 518 & in_nlevel, il_xghost(:,:) ) 519 520 ! add ghost cell 521 CALL grid_add_ghost(tl_var(jvar), il_xghost(:,:)) 516 & in_nlevel, tl_level(:) ) 522 517 523 518 ENDDO … … 540 535 ! open mpp file 541 536 CALL iom_mpp_open(tl_mpp) 542 543 537 544 538 ! get or check depth value … … 585 579 DO jj=1,tl_multi%t_mpp(ji)%t_proc(1)%i_nvar 586 580 587 WRITE(*,'(2x,a,a)') "work on (extract)variable "//&581 WRITE(*,'(2x,a,a)') "work on variable "//& 588 582 & TRIM(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_name) 589 583 … … 606 600 CALL att_clean(tl_att) 607 601 602 ! use mask 603 CALL create_restart_mask(tl_var(jvar), tl_level(:)) 604 608 605 ! add ghost cell 609 CALL grid_add_ghost( tl_var(jvar), tl_dom1%i_ghost(:,:))606 CALL grid_add_ghost( tl_var(jvar), tl_dom1%i_ghost(:,:) ) 610 607 611 608 ENDDO … … 634 631 DO jj=1,tl_multi%t_mpp(ji)%t_proc(1)%i_nvar 635 632 636 WRITE(*,'(2x,a,a)') "work on (interp)variable "//&633 WRITE(*,'(2x,a,a)') "work on variable "//& 637 634 & TRIM(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)%c_name) 638 635 … … 649 646 & id_rho=il_rho(:), & 650 647 & cd_point=TRIM(tl_var(jvar)%c_point)) 648 651 649 652 650 ! interpolate variable 653 CALL create_restart_interp(tl_var(jvar), &651 CALL create_restart_interp(tl_var(jvar), tl_level(:), & 654 652 & il_rho(:), & 655 653 & id_offset=il_offset(:,:)) … … 677 675 CALL att_clean(tl_att) 678 676 677 ! use mask 678 CALL create_restart_mask(tl_var(jvar), tl_level(:)) 679 679 680 ! add ghost cell 680 CALL grid_add_ghost(tl_var(jvar), il_xghost(:,:)) 681 CALL grid_add_ghost( tl_var(jvar), il_xghost(:,:) ) 682 683 681 684 ENDDO 682 685 … … 702 705 CALL mpp_clean(tl_coord0) 703 706 704 IF( .NOT. ln_extrap )THEN705 ! compute level706 ALLOCATE(tl_level(ip_npoint))707 tl_level(:)=vgrid_get_level(tl_bathy1, cl_namelist )708 ENDIF709 710 ! clean711 CALL mpp_clean(tl_bathy1)712 713 707 ! use additional request 714 708 DO jvar=1,il_nvar 715 709 716 ! change unit and apply factor717 CALL var_chg_unit(tl_var(jvar))718 719 710 ! forced min and max value 720 711 CALL var_limit_value(tl_var(jvar)) … … 723 714 CALL filter_fill_value(tl_var(jvar)) 724 715 725 IF( .NOT. ln_extrap )THEN726 ! use mask727 CALL create_restart_mask(tl_var(jvar), tl_level(:))728 ENDIF716 ! extrapolate 717 CALL extrap_fill_value(tl_var(jvar), id_iext=in_extrap, & 718 & id_jext=in_extrap, & 719 & id_kext=in_extrap) 729 720 730 721 ENDDO … … 733 724 IF( in_niproc == 0 .AND. & 734 725 & in_njproc == 0 .AND. & 735 & in_nproc == 0 )THEN726 & in_nproc == 0 )THEN 736 727 in_niproc = 1 737 728 in_njproc = 1 … … 791 782 CALL mpp_add_var(tl_mppout, tl_depth) 792 783 ELSE 793 CALL logger_ warn("CREATE RESTART: no value for depth variable.")784 CALL logger_error("CREATE RESTART: no value for depth variable.") 794 785 ENDIF 795 786 ENDIF … … 801 792 CALL mpp_add_var(tl_mppout, tl_time) 802 793 ELSE 803 CALL logger_ warn("CREATE RESTART: no value for time variable.")794 CALL logger_error("CREATE RESTART: no value for time variable.") 804 795 ENDIF 805 796 ENDIF … … 807 798 808 799 ! add other variable 809 DO jvar= il_nvar,1,-1800 DO jvar=1,il_nvar 810 801 ! check if variable already add 811 802 il_index=var_get_index(tl_mppout%t_proc(1)%t_var(:), tl_var(jvar)%c_name) … … 816 807 ENDDO 817 808 809 ! DO ji=1,4 810 ! CALL grid_add_ghost( tl_level(ji), il_xghost(:,:) ) 811 ! CALL var_clean(tl_level(ji)) 812 ! ENDDO 813 818 814 ! add some attribute 819 815 tl_att=att_init("Created_by","SIREN create_restart") … … 843 839 ENDIF 844 840 845 ! print846 CALL mpp_print(tl_mppout)847 848 841 ! create file 849 842 CALL iom_mpp_create(tl_mppout) … … 854 847 CALL iom_mpp_close(tl_mppout) 855 848 849 ! print 850 CALL mpp_print(tl_mppout) 851 856 852 ! clean 857 853 CALL att_clean(tl_att) 858 854 CALL var_clean(tl_var(:)) 859 855 DEALLOCATE(tl_var) 860 IF( .NOT. ln_extrap )THEN 861 CALL var_clean(tl_level(:)) 862 DEALLOCATE(tl_level) 863 ENDIF 856 CALL var_clean(tl_level(:)) 857 DEALLOCATE(tl_level) 864 858 865 859 CALL mpp_clean(tl_mppout) … … 882 876 !> 883 877 !> @author J.Paul 884 !> @date November, 2013 - Initial Version 885 !> @date June, 2015 886 !> - do not use level anymore 878 !> - November, 2013- Initial Version 887 879 !> 888 880 !> @param[in] td_var variable structure 889 881 !> @param[in] td_coord coordinate file structure 890 882 !> @param[in] id_nlevel number of vertical level 891 !> @param[in] id_xghost ghost cell array883 !> @param[in] td_level array of level on T,U,V,F point (variable structure) 892 884 !> @return variable structure 893 885 !------------------------------------------------------------------- 894 FUNCTION create_restart_matrix(td_var, td_coord, id_nlevel, id_xghost)886 FUNCTION create_restart_matrix(td_var, td_coord, id_nlevel, td_level) 895 887 IMPLICIT NONE 896 888 ! Argument 897 TYPE(TVAR) 898 TYPE(TMPP) 899 INTEGER(i4) 900 INTEGER(i4), DIMENSION(:,:), INTENT(IN) :: id_xghost889 TYPE(TVAR) , INTENT(IN) :: td_var 890 TYPE(TMPP) , INTENT(IN) :: td_coord 891 INTEGER(i4) , INTENT(IN) :: id_nlevel 892 TYPE(TVAR), DIMENSION(:), INTENT(IN) :: td_level 901 893 902 894 ! function … … 907 899 INTEGER(i4) , DIMENSION(3) :: il_size 908 900 INTEGER(i4) , DIMENSION(3) :: il_rest 901 INTEGER(i4) , DIMENSION(2,2) :: il_xghost 909 902 910 903 INTEGER(i4) , DIMENSION(:) , ALLOCATABLE :: il_ishape … … 922 915 !---------------------------------------------------------------- 923 916 917 ! look for ghost cell 918 il_xghost(:,:)=grid_get_ghost( td_coord ) 919 924 920 ! write value on grid 925 921 ! get matrix dimension … … 933 929 934 930 ! remove ghost cell 935 tl_dim(jp_I)%i_len=tl_dim(jp_I)%i_len - SUM(i d_xghost(jp_I,:))*ip_ghost936 tl_dim(jp_J)%i_len=tl_dim(jp_J)%i_len - SUM(i d_xghost(jp_J,:))*ip_ghost931 tl_dim(jp_I)%i_len=tl_dim(jp_I)%i_len - SUM(il_xghost(jp_I,:))*ip_ghost 932 tl_dim(jp_J)%i_len=tl_dim(jp_J)%i_len - SUM(il_xghost(jp_J,:))*ip_ghost 937 933 938 934 ! split output domain in N subdomain depending of matrix dimension … … 996 992 DEALLOCATE(dl_value) 997 993 994 ! use mask 995 CALL create_restart_mask(create_restart_matrix, td_level(:)) 996 997 ! add ghost cell 998 CALL grid_add_ghost( create_restart_matrix, il_xghost(:,:) ) 999 998 1000 ! clean 999 1001 DEALLOCATE(il_ishape) … … 1007 1009 !> 1008 1010 !> @author J.Paul 1009 !> @date November, 2013- Initial Version1011 !> - November, 2013- Initial Version 1010 1012 !> 1011 1013 !> @param[inout] td_var variable structure … … 1069 1071 !> 1070 1072 !> @author J.Paul 1071 !> @date November, 2013 - Initial Version 1072 !> @date June, 2015 1073 !> - do not use level anymore (for extrapolation) 1073 !> - Nov, 2013- Initial Version 1074 1074 !> 1075 1075 !> @param[inout] td_var variable structure 1076 !> @param[inout] td_level fine grid level, array of variable structure 1076 1077 !> @param[in] id_rho array of refinment factor 1077 1078 !> @param[in] id_offset array of offset between fine and coarse grid … … 1079 1080 !> @param[in] id_jext j-direction size of extra bands (default=im_minext) 1080 1081 !------------------------------------------------------------------- 1081 SUBROUTINE create_restart_interp( td_var, &1082 SUBROUTINE create_restart_interp( td_var, td_level,& 1082 1083 & id_rho, & 1083 1084 & id_offset, & … … 1088 1089 ! Argument 1089 1090 TYPE(TVAR) , INTENT(INOUT) :: td_var 1091 TYPE(TVAR) , DIMENSION(:) , INTENT(INOUT) :: td_level 1090 1092 INTEGER(i4), DIMENSION(:) , INTENT(IN ) :: id_rho 1091 1093 INTEGER(i4), DIMENSION(:,:), INTENT(IN ) :: id_offset … … 1117 1119 il_jext=2 1118 1120 ENDIF 1121 1119 1122 ! work on variable 1120 1123 ! add extraband … … 1122 1125 1123 1126 ! extrapolate variable 1124 CALL extrap_fill_value( td_var ) 1127 CALL extrap_fill_value( td_var, td_level(:), & 1128 & id_offset(:,:), & 1129 & id_rho(:), & 1130 & id_iext=il_iext, id_jext=il_jext ) 1125 1131 1126 1132 ! interpolate variable … … 1140 1146 !> 1141 1147 !> @author J.Paul 1142 !> @date November, 2014- Initial Version1148 !> - November, 2014- Initial Version 1143 1149 !> 1144 1150 !> @param[in] td_mpp mpp structure … … 1191 1197 !> 1192 1198 !> @author J.Paul 1193 !> @date November, 2014- Initial Version1199 !> - November, 2014- Initial Version 1194 1200 !> 1195 1201 !> @param[in] td_mpp mpp structure … … 1214 1220 1215 1221 ! get or check depth value 1216 1217 1222 IF( td_mpp%t_proc(1)%i_timeid /= 0 )THEN 1218 1223
Note: See TracChangeset
for help on using the changeset viewer.