Changeset 1425 for LMDZ4/trunk/libf/dyn3d/startvar.F90
- Timestamp:
- Sep 2, 2010, 3:45:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ4/trunk/libf/dyn3d/startvar.F90
r1323 r1425 643 643 !------------------------------------------------------------------------------- 644 644 ! 645 SUBROUTINE start_inter_3d(varname, iml, jml, lml, lon_in, lat_in, jml2,lon_in2,& 646 lat_in2, pls_in, var3d, ibar) 647 ! 648 !------------------------------------------------------------------------------- 645 SUBROUTINE start_inter_3d(varname, iml, jml, lml, lon_in, lat_in, jml2, & 646 lon_in2, lat_in2, pls_in, var3d, ibar) 647 648 use pchsp_95_m, only: pchsp_95 649 use pchfe_95_m, only: pchfe_95 650 649 651 ! Arguments: 650 652 CHARACTER(LEN=*), INTENT(IN) :: varname … … 655 657 REAL, DIMENSION(iml), INTENT(IN) :: lon_in2 656 658 REAL, DIMENSION(jml2), INTENT(IN) :: lat_in2 657 REAL, DIMENSION(iml, jml,lml), INTENT(IN) :: pls_in658 REAL, DIMENSION(iml, jml,lml), INTENT(OUT) :: var3d659 REAL, DIMENSION(iml, jml, lml), INTENT(IN) :: pls_in 660 REAL, DIMENSION(iml, jml, lml), INTENT(OUT) :: var3d 659 661 LOGICAL, INTENT(IN) :: ibar 660 !---------------------------------------------------------------------------- ---662 !---------------------------------------------------------------------------- 661 663 ! Local variables: 662 664 #include "iniprint.h" 663 LOGICAL :: check=.TRUE. 664 REAL :: bx, by, chmin, chmax 665 INTEGER :: ii, ij, il 666 REAL, DIMENSION(:,:,:), ALLOCATABLE :: var_tmp3d 665 LOGICAL:: check=.TRUE., skip 666 REAL chmin, chmax 667 INTEGER ii, ij, il, ierr 668 integer n_extrap ! number of extrapolated points 669 REAL, DIMENSION(iml, jml, llm_dyn):: var_tmp3d 667 670 REAL, DIMENSION(:), ALLOCATABLE :: lon_rad, lat_rad, lon_ini, lat_ini 668 REAL, DIMENSION(:), ALLOCATABLE :: lev_dyn, ax, ay, yder 669 INTEGER, DIMENSION(:), ALLOCATABLE :: lind 670 !------------------------------------------------------------------------------- 671 IF(check) WRITE(lunout,*)'Going into flinget to extract the 3D field.' 672 IF(check) WRITE(lunout,*)fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, ttm_dyn 673 IF(check) WRITE(lunout,*)'Allocating space for interpolation',iml,jml,llm_dyn 674 675 IF(.NOT.ALLOCATED(var_ana3d)) ALLOCATE(var_ana3d(iml_dyn,jml_dyn,llm_dyn)) 676 CALL flinget(fid_dyn,varname,iml_dyn,jml_dyn,llm_dyn,ttm_dyn,1,1,var_ana3d) 671 REAL, DIMENSION(llm_dyn):: lev_dyn, ax, ay, yder 672 673 !--------------------------------------------------------------------------- 674 IF(check) WRITE(lunout, *)'Going into flinget to extract the 3D field.' 675 IF(check) WRITE(lunout, *) fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, & 676 ttm_dyn 677 IF(check) WRITE(lunout, *) 'Allocating space for interpolation', iml, jml, & 678 llm_dyn 679 680 IF(.NOT.ALLOCATED(var_ana3d)) ALLOCATE(var_ana3d(iml_dyn, jml_dyn, llm_dyn)) 681 CALL flinget(fid_dyn, varname, iml_dyn, jml_dyn, llm_dyn, ttm_dyn, 1, 1, & 682 var_ana3d) 677 683 678 684 !--- IF ANGLES ARE IN DEGREES, THEY ARE CONVERTED INTO RADIANS 679 ALLOCATE(lon_ini(iml_dyn), lat_ini(jml_dyn))680 lon_ini(:)=lon_dyn(:, 1); IF(MAXVAL(lon_dyn)>pi) lon_ini=lon_ini*deg2rad681 lat_ini(:)=lat_dyn(1, :); IF(MAXVAL(lat_dyn)>pi) lat_ini=lat_ini*deg2rad685 ALLOCATE(lon_ini(iml_dyn), lat_ini(jml_dyn)) 686 lon_ini(:)=lon_dyn(:, 1); IF(MAXVAL(lon_dyn)>pi) lon_ini=lon_ini*deg2rad 687 lat_ini(:)=lat_dyn(1, :); IF(MAXVAL(lat_dyn)>pi) lat_ini=lat_ini*deg2rad 682 688 683 689 !--- FIELDS ARE PROCESSED TO BE ON STANDARD ANGULAR DOMAINS 684 ALLOCATE(lon_rad(iml_dyn), lat_rad(jml_dyn),lev_dyn(llm_dyn))685 CALL conf_dat3d (varname, iml_dyn, jml_dyn, llm_dyn, lon_ini, lat_ini, 690 ALLOCATE(lon_rad(iml_dyn), lat_rad(jml_dyn)) 691 CALL conf_dat3d (varname, iml_dyn, jml_dyn, llm_dyn, lon_ini, lat_ini, & 686 692 levdyn_ini, lon_rad, lat_rad, lev_dyn, var_ana3d, ibar) 687 DEALLOCATE(lon_ini, lat_ini)693 DEALLOCATE(lon_ini, lat_ini) 688 694 689 695 !--- COMPUTING THE REQUIRED FIELDS USING ROUTINE grid_noro 690 ALLOCATE(var_tmp3d(iml,jml,llm_dyn)) 691 DO il=1,llm_dyn 692 CALL interp_startvar(varname, ibar, il==1, & 693 iml_dyn, jml_dyn, lon_rad, lat_rad, var_ana3d(:,:,il), iml, jml, jml2, & 694 lon_in, lat_in, lon_in2, lat_in2, var_tmp3d(:,:,il)) 696 DO il=1, llm_dyn 697 CALL interp_startvar(varname, ibar, il==1, iml_dyn, jml_dyn, lon_rad, & 698 lat_rad, var_ana3d(:, :, il), iml, jml, jml2, lon_in, lat_in, & 699 lon_in2, lat_in2, var_tmp3d(:, :, il)) 695 700 END DO 696 DEALLOCATE(lon_rad,lat_rad) 697 698 ALLOCATE(lind(llm_dyn)) 699 DO il=1,llm_dyn 700 lind(il) = llm_dyn-il+1 701 DEALLOCATE(lon_rad, lat_rad) 702 703 !--- VERTICAL INTERPOLATION IS PERFORMED FROM TOP OF ATMOSPHERE TO GROUND 704 ax = lev_dyn(llm_dyn:1:-1) 705 skip = .false. 706 n_extrap = 0 707 DO ij=1, jml 708 DO ii=1, iml-1 709 ay = var_tmp3d(ii, ij, llm_dyn:1:-1) 710 yder = pchsp_95(ax, ay, ibeg=2, iend=2, vc_beg=0., vc_end=0.) 711 CALL pchfe_95(ax, ay, yder, skip, pls_in(ii, ij, lml:1:-1), & 712 var3d(ii, ij, lml:1:-1), ierr) 713 if (ierr < 0) stop 1 714 n_extrap = n_extrap + ierr 715 END DO 701 716 END DO 702 703 !--- VERTICAL INTERPOLATION IS PERFORMED FROM TOP OF ATMOSPHERE TO GROUND 704 ALLOCATE(ax(llm_dyn),ay(llm_dyn),yder(llm_dyn)) 705 DO ij=1,jml 706 DO ii=1,iml-1 707 ax(:)=lev_dyn(lind(:)) 708 ay(:)=var_tmp3d(ii,ij,lind(:)) 709 CALL SPLINE(ax, ay, llm_dyn, 1.e30, 1.e30, yder) 710 DO il=1,lml 711 bx=pls_in(ii,ij,il) 712 CALL SPLINT(ax, ay, yder, llm_dyn, bx, by) 713 var3d(ii,ij,il) = by 714 END DO 715 END DO 716 var3d(iml,ij,:) = var3d(1,ij,:) 717 if (n_extrap /= 0) then 718 print *, "start_inter_3d pchfe_95: n_extrap = ", n_extrap 719 end if 720 var3d(iml, :, :) = var3d(1, :, :) 721 722 DO il=1, lml 723 CALL minmax(iml*jml, var3d(1, 1, il), chmin, chmax) 724 WRITE(lunout, *)' '//TRIM(varname)//' min max l ', il, chmin, chmax 717 725 END DO 718 DEALLOCATE(var_tmp3d,lev_dyn,ax,ay,yder,lind)719 720 DO il=1,lml721 CALL minmax(iml*jml,var3d(1,1,il),chmin,chmax)722 WRITE(lunout,*)' '//TRIM(varname)//' min max l ',il,chmin,chmax723 END DO724 725 RETURN726 726 727 727 END SUBROUTINE start_inter_3d
Note: See TracChangeset
for help on using the changeset viewer.