Changeset 155


Ignore:
Timestamp:
05/20/13 16:35:23 (11 years ago)
Author:
dubos
Message:

Schmidt transform in metric.f90

Location:
codes/icosagcm/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/trunk/src/geometry.f90

    r153 r155  
    5555  INTEGER, PARAMETER :: ne_ldown=1 
    5656  INTEGER, PARAMETER :: ne_rdown=-1 
    57  
    58   REAL(rstd),private :: schmidt_factor, schmidt_lon, schmidt_lat 
    5957 
    6058CONTAINS 
     
    248246  END SUBROUTINE optimize_geometry 
    249247 
    250   SUBROUTINE schmidt_transform(xyz,cc) 
    251     ! Based on formula (12) from Guo & Drake, JCP 2005 
    252     USE spherical_geom_mod 
    253     IMPLICIT NONE 
    254     REAL(rstd),INTENT(INOUT) :: xyz(3) 
    255     REAL(rstd), INTENT(IN) :: cc  ! stretching factor>0 
    256     REAL(rstd) :: lat,lon,mu 
    257     CALL xyz2lonlat_relative(xyz,schmidt_lon,schmidt_lat, lon,lat) 
    258     mu = sin(lat) 
    259     mu = ((cc-1)+mu*(cc+1)) / ((cc+1)+mu*(cc-1)) 
    260     lat = asin(mu) 
    261     CALL lonlat2xyz_relative(lon,lat,schmidt_lon, schmidt_lat, xyz) 
    262   END SUBROUTINE schmidt_transform 
    263        
    264248  SUBROUTINE set_geometry 
    265249  USE metric 
     
    287271       
    288272    CALL optimize_geometry 
    289  
    290     ! Schmidt transform 
    291     schmidt_factor = 1. 
    292     CALL getin('schmidt_factor', schmidt_factor) 
    293  
    294     schmidt_lon = 0. 
    295     CALL getin('schmidt_lon', schmidt_lon) 
    296     schmidt_lon = schmidt_lon * pi/180. 
    297  
    298     schmidt_lat = 45. 
    299     CALL getin('schmidt_lat', schmidt_lat) 
    300     schmidt_lat = schmidt_lat * pi/180. 
    301  
    302     DO ind=1,ndomain 
    303       CALL swap_dimensions(ind) 
    304       CALL swap_geometry(ind) 
    305       DO j=jj_begin-1,jj_end+1 
    306         DO i=ii_begin-1,ii_end+1 
    307           n=(j-1)*iim+i 
    308           vertex(:)=xyz_i(n,:) 
    309           CALL schmidt_transform(vertex, schmidt_factor**2.) 
    310           xyz_i(n,:)=vertex(:) 
    311        END DO 
    312      END DO 
    313    END DO 
    314  
    315     ! at this point the mesh is defined on the unit sphere by xyz_i 
    316     ! all other mesh quantities are now deduced from xyz_i 
    317  
    318     CALL update_circumcenters 
    319  
    320 !    DO ind=1,ndomain 
    321 !      d=>domain(ind) 
    322 !      CALL swap_dimensions(ind) 
    323 !      CALL swap_geometry(ind) 
    324 !      DO j=1,jjm 
    325 !        DO i=1,iim 
    326 !          n=(j-1)*iim+i 
    327 !          d%xyz(:,i,j)=xyz_i(n,:) 
    328 !        ENDDO 
    329 !      ENDDO 
    330 !    ENDDO 
    331 ! 
    332 !    CALL compute_boundary 
    333273  
    334274    DO ind=1,ndomain 
  • codes/icosagcm/trunk/src/metric.f90

    r146 r155  
    5252  INTEGER,PARAMETER :: vdown=5 
    5353  INTEGER,PARAMETER :: vrdown=6 
    54  
    5554   
    5655CONTAINS 
    57    
     56 
     57  SUBROUTINE remap_schmidt 
     58    USE spherical_geom_mod 
     59    USE ioipsl 
     60    IMPLICIT NONE 
     61    INTEGER :: nf,i,j 
     62    REAL(rstd) :: schmidt_factor, schmidt_lon, schmidt_lat 
     63 
     64    ! Schmidt transform parameters 
     65    schmidt_factor = 1. 
     66    CALL getin('schmidt_factor', schmidt_factor) 
     67    schmidt_factor =  schmidt_factor**2. 
     68     
     69    schmidt_lon = 0. 
     70    CALL getin('schmidt_lon', schmidt_lon) 
     71    schmidt_lon = schmidt_lon * pi/180. 
     72 
     73    schmidt_lat = 45. 
     74    CALL getin('schmidt_lat', schmidt_lat) 
     75    schmidt_lat = schmidt_lat * pi/180. 
     76 
     77    DO nf=1,nb_face 
     78       DO j=1,jjm_glo 
     79          DO i=1,iim_glo 
     80             CALL schmidt_transform(vertex_glo(i,j,nf)%xyz, schmidt_factor, schmidt_lon, schmidt_lat) 
     81          END DO 
     82       END DO 
     83    END DO 
     84  END SUBROUTINE remap_schmidt 
     85 
    5886  SUBROUTINE allocate_metric 
    5987  IMPLICIT NONE 
     
    830858!    CALL compute_face 
    831859    CALL compute_face_projection 
     860    CALL remap_schmidt 
     861 
    832862    CALL set_index 
    833863    CALL set_cell 
  • codes/icosagcm/trunk/src/spherical_geom.f90

    r153 r155  
    6767END SUBROUTINE xyz2lonlat_relative 
    6868 
    69  
     69SUBROUTINE schmidt_transform(xyz,cc, lon0, lat0) 
     70  ! Based on formula (12) from Guo & Drake, JCP 2005 
     71  IMPLICIT NONE 
     72  REAL(rstd),INTENT(INOUT) :: xyz(3) 
     73  REAL(rstd), INTENT(IN) :: cc, lon0, lat0  ! stretching factor>0, lon/lat of zoomed area 
     74  REAL(rstd) :: lat,lon,mu 
     75  CALL xyz2lonlat_relative(xyz,lon0,lat0, lon,lat) 
     76  mu = sin(lat) 
     77  mu = ((cc-1)+mu*(cc+1)) / ((cc+1)+mu*(cc-1)) 
     78  lat = asin(mu) 
     79  CALL lonlat2xyz_relative(lon,lat, lon0,lat0, xyz) 
     80END SUBROUTINE schmidt_transform 
    7081 
    7182SUBROUTINE dist_cart(A,B,d) 
Note: See TracChangeset for help on using the changeset viewer.