1 | module write_field_loc |
---|
2 | IMPLICIT NONE |
---|
3 | |
---|
4 | interface WriteField_u |
---|
5 | module procedure Write_field1d_u,Write_Field2d_u |
---|
6 | end interface WriteField_u |
---|
7 | |
---|
8 | interface WriteField_v |
---|
9 | module procedure Write_field1d_v,Write_Field2d_v |
---|
10 | end interface WriteField_v |
---|
11 | |
---|
12 | CONTAINS |
---|
13 | |
---|
14 | SUBROUTINE write_field1D_u(name,Field) |
---|
15 | CHARACTER(LEN=*) :: name |
---|
16 | REAL, DIMENSION(:) :: Field |
---|
17 | |
---|
18 | CALL write_field_u_gen(name,Field,1) |
---|
19 | |
---|
20 | END SUBROUTINE write_field1D_u |
---|
21 | |
---|
22 | SUBROUTINE write_field2D_u(name,Field) |
---|
23 | IMPLICIT NONE |
---|
24 | |
---|
25 | CHARACTER(LEN=*) :: name |
---|
26 | REAL, DIMENSION(:,:) :: Field |
---|
27 | INTEGER :: ll |
---|
28 | |
---|
29 | ll=size(field,2) |
---|
30 | CALL write_field_u_gen(name,Field,ll) |
---|
31 | |
---|
32 | END SUBROUTINE write_field2D_u |
---|
33 | |
---|
34 | |
---|
35 | SUBROUTINE write_field_u_gen(name,Field,ll) |
---|
36 | USE parallel_lmdz |
---|
37 | USE lmdz_write_field |
---|
38 | USE mod_hallo |
---|
39 | IMPLICIT NONE |
---|
40 | INCLUDE 'dimensions.h' |
---|
41 | INCLUDE 'paramet.h' |
---|
42 | |
---|
43 | CHARACTER(LEN=*) :: name |
---|
44 | REAL, DIMENSION(ijb_u:ije_u,ll) :: Field |
---|
45 | REAL, ALLOCATABLE,SAVE :: New_Field(:,:,:) |
---|
46 | INTEGER,DIMENSION(0:mpi_size-1) :: jj_nb_master |
---|
47 | type(Request),SAVE :: Request_write |
---|
48 | !$OMP THREADPRIVATE(Request_write) |
---|
49 | INTEGER :: ll,i |
---|
50 | |
---|
51 | |
---|
52 | jj_nb_master(:)=0 |
---|
53 | jj_nb_master(0)=jjp1 |
---|
54 | !$OMP BARRIER |
---|
55 | !$OMP MASTER |
---|
56 | allocate(New_Field(iip1,jjp1,ll)) |
---|
57 | !$OMP END MASTER |
---|
58 | !$OMP BARRIER |
---|
59 | |
---|
60 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
61 | DO i=1,ll |
---|
62 | New_Field(:,jj_begin:jj_end,i)=reshape(Field(ij_begin:ij_end,i),(/iip1,jj_nb/)) |
---|
63 | ENDDO |
---|
64 | !$OMP BARRIER |
---|
65 | CALL Register_SwapField(new_field,new_field,ip1jmp1,ll,jj_Nb_master,Request_write) |
---|
66 | CALL SendRequest(Request_write) |
---|
67 | !$OMP BARRIER |
---|
68 | CALL WaitRequest(Request_write) |
---|
69 | !$OMP BARRIER |
---|
70 | |
---|
71 | !$OMP MASTER |
---|
72 | IF (MPI_Rank==0) CALL WriteField(name,New_Field) |
---|
73 | DEALLOCATE(New_Field) |
---|
74 | !$OMP END MASTER |
---|
75 | !$OMP BARRIER |
---|
76 | END SUBROUTINE write_field_u_gen |
---|
77 | |
---|
78 | |
---|
79 | SUBROUTINE write_field1D_v(name,Field) |
---|
80 | CHARACTER(LEN=*) :: name |
---|
81 | REAL, DIMENSION(:) :: Field |
---|
82 | |
---|
83 | CALL write_field_v_gen(name,Field,1) |
---|
84 | |
---|
85 | END SUBROUTINE write_field1D_v |
---|
86 | |
---|
87 | SUBROUTINE write_field2D_v(name,Field) |
---|
88 | IMPLICIT NONE |
---|
89 | |
---|
90 | CHARACTER(LEN=*) :: name |
---|
91 | REAL, DIMENSION(:,:) :: Field |
---|
92 | INTEGER :: ll |
---|
93 | |
---|
94 | ll=size(field,2) |
---|
95 | CALL write_field_v_gen(name,Field,ll) |
---|
96 | |
---|
97 | END SUBROUTINE write_field2D_v |
---|
98 | |
---|
99 | |
---|
100 | SUBROUTINE write_field_v_gen(name,Field,ll) |
---|
101 | USE parallel_lmdz |
---|
102 | USE lmdz_write_field |
---|
103 | USE mod_hallo |
---|
104 | IMPLICIT NONE |
---|
105 | INCLUDE 'dimensions.h' |
---|
106 | INCLUDE 'paramet.h' |
---|
107 | |
---|
108 | CHARACTER(LEN=*) :: name |
---|
109 | REAL, DIMENSION(ijb_v:ije_v,ll) :: Field |
---|
110 | REAL, ALLOCATABLE,SAVE :: New_Field(:,:,:) |
---|
111 | INTEGER,DIMENSION(0:mpi_size-1) :: jj_nb_master |
---|
112 | type(Request),SAVE :: Request_write |
---|
113 | !$OMP THREADPRIVATE(Request_write) |
---|
114 | INTEGER :: ll,i,jje,ije,jjn |
---|
115 | |
---|
116 | |
---|
117 | jj_nb_master(:)=0 |
---|
118 | jj_nb_master(0)=jjp1 |
---|
119 | |
---|
120 | !$OMP BARRIER |
---|
121 | !$OMP MASTER |
---|
122 | allocate(New_Field(iip1,jjm,ll)) |
---|
123 | !$OMP END MASTER |
---|
124 | !$OMP BARRIER |
---|
125 | |
---|
126 | IF (pole_sud) THEN |
---|
127 | jje=jj_end-1 |
---|
128 | ije=ij_end-iip1 |
---|
129 | jjn=jj_nb-1 |
---|
130 | ELSE |
---|
131 | jje=jj_end |
---|
132 | ije=ij_end |
---|
133 | jjn=jj_nb |
---|
134 | ENDIF |
---|
135 | |
---|
136 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
137 | DO i=1,ll |
---|
138 | New_Field(:,jj_begin:jje,i)=reshape(Field(ij_begin:ije,i),(/iip1,jjn/)) |
---|
139 | ENDDO |
---|
140 | !$OMP BARRIER |
---|
141 | CALL Register_SwapField(new_field,new_field,ip1jm,ll,jj_Nb_master,Request_write) |
---|
142 | CALL SendRequest(Request_write) |
---|
143 | !$OMP BARRIER |
---|
144 | CALL WaitRequest(Request_write) |
---|
145 | !$OMP BARRIER |
---|
146 | |
---|
147 | !$OMP MASTER |
---|
148 | IF (MPI_Rank==0) CALL WriteField(name,New_Field) |
---|
149 | DEALLOCATE(New_Field) |
---|
150 | !$OMP END MASTER |
---|
151 | !$OMP BARRIER |
---|
152 | END SUBROUTINE write_field_v_gen |
---|
153 | |
---|
154 | END MODULE write_field_loc |
---|
155 | |
---|