Changeset 4371 for LMDZ6/trunk/libf


Ignore:
Timestamp:
Dec 7, 2022, 2:58:39 PM (2 years ago)
Author:
Laurent Fairhead
Message:

Bug fix for xios writing in the dynamics. Problem was that a variable that I thought was shared
actually was not leading to undefind values in the variables written out to XIOS
LF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/dyn3dmem/mod_xios_dyn3dmem.F90

    r4146 r4371  
    2929     MODULE PROCEDURE writefield_dyn1d_v, writefield_dyn2d_v
    3030  END INTERFACE writefield_dyn_v
     31
     32     REAL, ALLOCATABLE, SAVE :: NewField_U(:,:,:), NewField_V(:,:,:)
    3133 
    3234
     
    6365! 0 Initialisations
    6466     pi = 4. * ATAN (1.)
     67! allocation of fields passed to xios
     68!$OMP BARRIER
     69!$OMP MASTER
     70     allocate(NewField_U(iip1, jj_begin:jj_end, llm))
     71     allocate(NewField_V(iip1, jj_begin:jj_end, llm))     
     72!$OMP END MASTER
     73!$OMP BARRIER
    6574
    6675! 1 Context initialisation
     
    151160     CHARACTER(LEN=*)   :: name
    152161     REAL, DIMENSION(ij_begin:ij_end,llm) :: Field
    153      REAL, DIMENSION(iip1, jj_begin:jj_end,llm) :: NewField
     162!     REAL, ALLOCATABLE, SAVE :: NewField(:,:,:)
    154163     INTEGER :: i,j,l, count
    155164
    156 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
     165!!!!!$OMP BARRIER
     166!!!!!$OMP MASTER
     167!!!!     allocate(NewField(iip1, jj_begin:jj_end, llm))
     168!!!!!$OMP END MASTER
     169!!!!!$OMP BARRIER
     170
     171
     172!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
    157173     DO l = 1, llm
    158        NewField(:,jj_begin:jj_end,l)=reshape(Field(ij_begin:ij_end,l),(/iip1,jj_nb/))
     174       NewField_U(:,jj_begin:jj_end,l)=reshape(Field(ij_begin:ij_end,l),(/iip1,jj_nb/))
    159175     ENDDO
    160176!$OMP ENDDO
     
    162178
    163179!$OMP MASTER
    164 !!     write(14,*)'iip1,ij_begin,ij_end,llm,jj_begin,jj_end,jj_nb ',iip1,ij_begin,ij_end,llm,jj_begin,jj_end,jj_nb
    165 
    166      CALL xios_send_field(name, NewField)
    167 !$OMP END MASTER   
     180     CALL xios_send_field(name, NewField_U)
     181!!!!     DEALLOCATE(NewField)
     182!$OMP END MASTER   
     183!$OMP BARRIER
    168184 
    169185   END SUBROUTINE  writefield_dyn2d_u
     
    207223     CHARACTER(LEN=*)   :: name
    208224     REAL, DIMENSION(ij_begin:ij_end,llm) :: Field
    209      REAL, DIMENSION(iip1,  jj_begin:jj_end,llm) :: NewField
     225!!!!     REAL, ALLOCATABLE, SAVE :: NewField(:,:,:)
    210226     INTEGER :: l, jje, ije, jjn
     227
     228!!!!!$OMP BARRIER
     229!!!!!$OMP MASTER
     230!!!!     allocate(NewField(iip1,  jj_begin:jj_end,llm))
     231!!!!!$OMP END MASTER
     232!!!!!$OMP BARRIER
    211233
    212234     IF (pole_sud) THEN
     
    223245!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
    224246     DO l = 1, llm
    225         NewField(:,jj_begin:jje,l)=reshape(Field(ij_begin:ije,l),(/iip1,jjn/))
     247        NewField_V(:,jj_begin:jje,l)=reshape(Field(ij_begin:ije,l),(/iip1,jjn/))
    226248     ENDDO
    227249!$OMP ENDDO
    228 
    229250!$OMP BARRIER       
    230 !$OMP MASTER
    231      CALL xios_send_field(name, NewField(:,jj_begin:jje,:))
    232 !$OMP END MASTER   
     251
     252!$OMP MASTER
     253     CALL xios_send_field(name, NewField_V(:,jj_begin:jje,:))
     254!!!!     DEALLOCATE(NewField)
     255!$OMP END MASTER   
     256!$OMP BARRIER
    233257 
    234258   END SUBROUTINE  writefield_dyn2d_v
Note: See TracChangeset for help on using the changeset viewer.