diff --git a/src/ZSOLVER/ice_adjust.f90 b/src/ZSOLVER/ice_adjust.f90 index 8da04e62e39528cbc163f6ecb66329684dcf72e6..864b5bc88ec32ff45953d8c38e6bab3b092fc26d 100644 --- a/src/ZSOLVER/ice_adjust.f90 +++ b/src/ZSOLVER/ice_adjust.f90 @@ -291,7 +291,8 @@ REAL, DIMENSION(:,:,:), POINTER, CONTIGUOUS & ZLS, & ! guess of the Ls at t+1 ZW1,ZW2, & ! Work arrays for intermediate fields ZCRIAUT, & ! Autoconversion thresholds - ZHCF, ZHR + ZHCF, ZHR +REAL, DIMENSION(:,:,:), pointer , contiguous :: ZTEMP_BUD ! !------------------------------------------------------------------------------- ! @@ -362,6 +363,7 @@ allocate( zw2 (IIU, IJU, IKU ) ) allocate( zcriaut(IIU, IJU, IKU ) ) allocate( zhcf (IIU, IJU, IKU ) ) allocate( zhr (IIU, IJU, IKU ) ) +allocate( ZTEMP_BUD (IIU, IJU, IKU ) ) #else !Pin positions in the pools of MNH memory CALL MNH_MEM_POSITION_PIN() @@ -381,14 +383,35 @@ CALL MNH_MEM_GET( zw2 , IIU, IJU, IKU ) CALL MNH_MEM_GET( zcriaut, IIU, IJU, IKU ) CALL MNH_MEM_GET( zhcf , IIU, IJU, IKU ) CALL MNH_MEM_GET( zhr , IIU, IJU, IKU ) +CALL MNH_MEM_GET( ZTEMP_BUD , IIU, IJU, IKU ) !$acc data present( gtemp, zsigs, zsrcs, zt, zrv, zrc, zri, zcph, zlv, zls, zw1, zw2, zcriaut, zhcf, zhr ) #endif -if ( lbudget_th ) call Budget_store_init( tbudgets(NBUDGET_TH), trim( hbuname ), pths(:, :, :) * prhodj(:, :, :) ) -if ( lbudget_rv ) call Budget_store_init( tbudgets(NBUDGET_RV), trim( hbuname ), prvs(:, :, :) * prhodj(:, :, :) ) -if ( lbudget_rc ) call Budget_store_init( tbudgets(NBUDGET_RC), trim( hbuname ), prcs(:, :, :) * prhodj(:, :, :) ) -if ( lbudget_ri ) call Budget_store_init( tbudgets(NBUDGET_RI), trim( hbuname ), pris(:, :, :) * prhodj(:, :, :) ) +if ( lbudget_th ) then + !$acc kernels + ZTEMP_BUD(:,:,:) = pths(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_init( tbudgets(NBUDGET_TH), trim( hbuname ), ZTEMP_BUD(:,:,:) ) +end if +if ( lbudget_rv ) then + !$acc kernels + ZTEMP_BUD(:,:,:) = prvs(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_init( tbudgets(NBUDGET_RV), trim( hbuname ), ZTEMP_BUD(:,:,:) ) +end if +if ( lbudget_rc ) then + !$acc kernels + ZTEMP_BUD(:,:,:) = prcs(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_init( tbudgets(NBUDGET_RC), trim( hbuname ), ZTEMP_BUD(:,:,:) ) +end if +if ( lbudget_ri ) then + !$acc kernels + ZTEMP_BUD(:,:,:) = pris(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_init( tbudgets(NBUDGET_RI), trim( hbuname ), ZTEMP_BUD(:,:,:) ) +end if ! ITERMAX=1 ! @@ -636,26 +659,34 @@ IF(PRESENT(POUT_TH)) POUT_TH=ZT / PEXN(:,:,:) ! ---------------------- ! if ( lbudget_th ) then -!$acc update self(pths) - call Budget_store_end( tbudgets(NBUDGET_TH), trim( hbuname ), pths(:, :, :) * prhodj(:, :, :) ) + !$acc kernels + ZTEMP_BUD(:,:,:) = pths(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_end( tbudgets(NBUDGET_TH), trim( hbuname ), ZTEMP_BUD(:,:,:) ) end if if ( lbudget_rv ) then -!$acc update self(prvs) - call Budget_store_end( tbudgets(NBUDGET_RV), trim( hbuname ), prvs(:, :, :) * prhodj(:, :, :) ) + !$acc kernels + ZTEMP_BUD(:,:,:) = prvs(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_end( tbudgets(NBUDGET_RV), trim( hbuname ), ZTEMP_BUD(:,:,:) ) end if if ( lbudget_rc ) then -!$acc update self(prcs) - call Budget_store_end( tbudgets(NBUDGET_RC), trim( hbuname ), prcs(:, :, :) * prhodj(:, :, :) ) + !$acc kernels + ZTEMP_BUD(:,:,:) = prcs(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_end( tbudgets(NBUDGET_RC), trim( hbuname ), ZTEMP_BUD(:,:,:) ) end if if ( lbudget_ri ) then -!$acc update self(pris) - call Budget_store_end( tbudgets(NBUDGET_RI), trim( hbuname ), pris(:, :, :) * prhodj(:, :, :) ) + !$acc kernels + ZTEMP_BUD(:,:,:) = pris(:, :, :) * prhodj(:, :, :) + !$acc end kernels + call Budget_store_end( tbudgets(NBUDGET_RI), trim( hbuname ), ZTEMP_BUD(:,:,:) ) end if !$acc end data #ifndef MNH_OPENACC -deallocate( gtemp, zsigs, zsrcs, zt, zrv, zrc, zri, zcph, zlv, zls, zw1, zw2, zcriaut, zhcf, zhr ) +deallocate( gtemp, zsigs, zsrcs, zt, zrv, zrc, zri, zcph, zlv, zls, zw1, zw2, zcriaut, zhcf, zhr , ZTEMP_BUD ) #else !Release all memory allocated with MNH_MEM_GET calls since last call to MNH_MEM_POSITION_PIN CALL MNH_MEM_RELEASE()