source: trunk/LMDZ.MARS/libf/phymars/write_output_mod.F90 @ 2947

Last change on this file since 2947 was 2934, checked in by emillour, 21 months ago

Mars PCM:
A first step in cleaning up outputs and adding field definitions for XIOS.
EM

File size: 2.3 KB
Line 
1MODULE write_output_mod
2    IMPLICIT NONE
3PRIVATE
4   
5    INTERFACE write_output
6      MODULE PROCEDURE write_output_d0,write_output_d1,write_output_d2
7    END INTERFACE write_output
8
9    PUBLIC write_output
10   
11CONTAINS
12
13  SUBROUTINE write_output_d0(field_name,title,units,field)
14  ! For a surface field
15#ifdef CPP_XIOS
16  use xios_output_mod, only: send_xios_field
17#endif
18  IMPLICIT NONE
19  include "dimensions.h"
20  INTEGER ngrid
21  PARAMETER( ngrid = 2+(jjm-1)*iim - 1/jjm   )
22  CHARACTER(LEN=*),INTENT(IN)    :: field_name
23  CHARACTER(LEN=*),INTENT(IN)    :: title
24  CHARACTER(LEN=*),INTENT(IN)    :: units
25  REAL,INTENT(IN)                :: field
26 
27  call writediagfi(ngrid,field_name,title,units,0,field)
28#ifdef CPP_XIOS
29  call send_xios_field(field_name,field)
30#endif
31 
32  END SUBROUTINE write_output_d0
33
34  SUBROUTINE write_output_d1(field_name,title,units,field)
35  ! For a surface field
36#ifdef CPP_XIOS
37  use xios_output_mod, only: send_xios_field
38#endif
39  use comsoil_h, only: nsoilmx
40  use writediagsoil_mod, only: writediagsoil
41  IMPLICIT NONE
42  include "dimensions.h"
43  INTEGER ngrid
44  PARAMETER( ngrid = 2+(jjm-1)*iim - 1/jjm   )
45  CHARACTER(LEN=*),INTENT(IN)    :: field_name
46  CHARACTER(LEN=*),INTENT(IN)    :: title
47  CHARACTER(LEN=*),INTENT(IN)    :: units
48  REAL,INTENT(IN)                :: field(:)
49 
50  call writediagfi(ngrid,field_name,title,units,2,field)
51#ifdef CPP_XIOS
52  call send_xios_field(field_name,field)
53#endif
54 
55  END SUBROUTINE write_output_d1
56
57  SUBROUTINE write_output_d2(field_name,title,units,field)
58  ! For a "3D" horizontal-vertical field
59#ifdef CPP_XIOS
60  use xios_output_mod, only: send_xios_field
61#endif
62  use comsoil_h, only: nsoilmx
63  use writediagsoil_mod, only: writediagsoil
64  IMPLICIT NONE
65  include "dimensions.h"
66  INTEGER ngrid
67  PARAMETER( ngrid = 2+(jjm-1)*iim - 1/jjm   )
68  CHARACTER(LEN=*),INTENT(IN)    :: field_name
69  CHARACTER(LEN=*),INTENT(IN)    :: title
70  CHARACTER(LEN=*),INTENT(IN)    :: units
71  REAL,INTENT(IN)                :: field(:,:)
72
73  if(size(field(:,:),2).eq.nsoilmx) then
74    call writediagsoil(ngrid,field_name,title,units,3,field)
75  else
76    call writediagfi(ngrid,field_name,title,units,3,field(:,:))
77  endif
78#ifdef CPP_XIOS
79  call send_xios_field(field_name,field)
80#endif
81 
82  END SUBROUTINE write_output_d2
83
84END MODULE write_output_mod
Note: See TracBrowser for help on using the repository browser.