Ignore:
Timestamp:
05/06/19 01:49:12 (5 years ago)
Author:
dubos
Message:

devel : towards Fortran driver for unstructured/LAM meshes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/src/unstructured/init_unstructured.f90

    r830 r856  
    9696    USE ioipsl 
    9797    USE field_mod 
     98    USE geometry, ONLY : lon_i, lat_i, lon_e, lat_e, ep_e 
    9899    IMPLICIT NONE 
    99100 
    100101    !!-------------Declare local variables------------------- 
    101     CHARACTER(LEN=*),PARAMETER :: f="mesh_information.nc" 
    102     INTEGER :: id_nc, ierr, status, descriptionLength 
     102    CHARACTER(LEN=*),PARAMETER :: f="input/mesh_information.nc" 
     103    INTEGER :: id_nc, ierr, status, descriptionLength, ij 
    103104    CHARACTER(LEN= 80) :: description 
    104  
     105    REAL(rstd), ALLOCATABLE :: angle_e(:) 
     106    REAL(rstd) :: clon, slon, clat, slat, & ! COS/SIN of lon/lat 
     107         elon(3), elat(3) ! lon/lat unit vectors 
    105108    print *,"------------------ READING FILE " , f, "----------------------- " 
    106109    !open and read the input file 
     
    167170    ALLOCATE(dual_vertex, source = Idata_read2) 
    168171 
     172    CALL read_from_gridfile(id_nc, 'float', 'lon_i') 
     173    ALLOCATE(lon_i, source = Ddata_read1) 
     174    CALL read_from_gridfile(id_nc, 'float', 'lat_i') 
     175    ALLOCATE(lat_i, source = Ddata_read1) 
     176    CALL read_from_gridfile(id_nc, 'float', 'lon_e') 
     177    ALLOCATE(lon_e, source = Ddata_read1) 
     178    CALL read_from_gridfile(id_nc, 'float', 'lat_e') 
     179    ALLOCATE(lat_e, source = Ddata_read1) 
     180    CALL read_from_gridfile(id_nc, 'float', 'angle_e') 
     181    ALLOCATE(angle_e, source = Ddata_read1) 
     182 
    169183    CALL free_data_read ! free buffers after reading all data from grid file 
    170184 
     
    176190    max_trisk_deg = SIZE(trisk,1) 
    177191 
     192    ! now post-process some of the data we just read 
     193    ALLOCATE(ep_e(edge_num,3)) 
     194    DO ij=1,edge_num 
     195       clon = COS(lon_e(ij)) 
     196       slon = SIN(lon_e(ij)) 
     197       clat = COS(lat_e(ij)) 
     198       slat = SIN(lat_e(ij)) 
     199       ! x,y,z = clat*clon, clat*slon, slat 
     200       elon = (/ -slon, clon, 0. /) 
     201       elat = (/ -slat*clon, -slat*slon, clat /) 
     202       ep_e(ij,:) = COS(angle_e(ij))*elon + SIN(angle_e(ij))*elat 
     203    END DO 
     204     
     205    DEALLOCATE(angle_e) 
    178206  END SUBROUTINE read_dump_partition 
    179207 
Note: See TracChangeset for help on using the changeset viewer.