source: codes/icosagcm/devel/src/output/write_etat0.f90 @ 992

Last change on this file since 992 was 992, checked in by rpennel, 5 years ago

devel : add reading metrics from file at init (folllowing revs @882, @887, @888)

[ !! needs to rewrite new subroutine in xios_mod using cellset strcuture ]

File size: 2.3 KB
RevLine 
[266]1MODULE write_etat0_mod
2
3CONTAINS
4
[569]5  SUBROUTINE write_etat0(it,f_ps,f_phis,f_theta_rhodz,f_u, f_q, f_geopot, f_W)
[266]6  USE icosa
7  USE restart_mod
8  USE wind_mod
[347]9  USE write_field_mod
[476]10  USE domain_mod
11  USE omp_para
[483]12  USE xios_mod
[732]13  USE caldyn_vars_mod
[868]14  USE grid_param
[266]15  IMPLICIT NONE
16    INTEGER,INTENT(IN)    :: it
17    TYPE(t_field),POINTER :: f_ps(:)
18    TYPE(t_field),POINTER :: f_phis(:)
19    TYPE(t_field),POINTER :: f_theta_rhodz(:)
20    TYPE(t_field),POINTER :: f_u(:)
21    TYPE(t_field),POINTER :: f_q(:)
[569]22    TYPE(t_field),POINTER, OPTIONAL :: f_geopot(:)
23    TYPE(t_field),POINTER, OPTIONAL :: f_W(:)
[266]24 
25    TYPE(t_field),POINTER,SAVE :: f_ulon(:)
26    TYPE(t_field),POINTER,SAVE :: f_ulat(:)
[476]27    TYPE(t_field),POINTER,SAVE :: f_theta_rhodz_1d(:)
[992]28    TYPE(t_field),POINTER,SAVE :: f_xcell(:),f_ycell(:),f_zcell(:)
[476]29    REAL(rstd), POINTER :: theta_rhodz(:,:,:),theta_rhodz_1d(:,:)
[992]30    REAL(rstd), POINTER :: xcell(:), ycell(:), zcell(:)
[476]31    INTEGER :: ind
[266]32   
[868]33    IF(grid_type == grid_unst) RETURN
34
[266]35    CALL allocate_field(f_ulon,field_t,type_real,llm,name='ulon')
36    CALL allocate_field(f_ulat,field_t,type_real,llm,name='ulat')
[476]37    CALL allocate_field(f_theta_rhodz_1d,field_t,type_real,llm,name='theta_rhodz')
[992]38    CALL allocate_field(f_xcell,field_t,type_real,name='xcell')
39    CALL allocate_field(f_ycell,field_t,type_real,name='ycell')
40    CALL allocate_field(f_zcell,field_t,type_real,name='zcell')
[266]41
[476]42!$OMP BARRIER   
43    DO ind=1, ndomain
[496]44       IF (.NOT. assigned_domain(ind) .OR. .NOT. is_omp_level_master) CYCLE
[992]45       CALL swap_dimensions(ind)
46       CALL swap_geometry(ind)
[476]47       theta_rhodz=f_theta_rhodz(ind) ; theta_rhodz_1d=f_theta_rhodz_1d(ind)
48       theta_rhodz_1d(:,:)=theta_rhodz(:,:,1)
[992]49       xcell=f_xcell(ind) ; xcell=xyz_i(:,1)/radius
50       ycell=f_ycell(ind) ; ycell=xyz_i(:,2)/radius
51       zcell=f_zcell(ind) ; zcell=xyz_i(:,3)/radius
[476]52    ENDDO
53   
[266]54    CALL transfert_request(f_u,req_e1_vect)
55    CALL un2ulonlat(f_u, f_ulon, f_ulat)
56
[569]57    IF(hydrostatic) THEN
[992]58       CALL write_restart(it,f_ps,f_phis,f_theta_rhodz_1d,f_u, f_ulon, f_ulat, f_q, f_xcell, f_ycell, f_zcell )
[569]59    ELSE
[992]60       CALL write_restart(it,f_ps,f_phis,f_theta_rhodz_1d,f_u, f_ulon, f_ulat, f_q, f_geopot, f_W, f_xcell, f_ycell, f_zcell)
[569]61    END IF
[266]62    CALL deallocate_field(f_ulon)
63    CALL deallocate_field(f_ulat)
64   
65  END SUBROUTINE write_etat0
66   
67END MODULE write_etat0_mod
Note: See TracBrowser for help on using the repository browser.