source: LMDZ6/branches/Amaury_dev/libf/phylmd/global_mean.F90 @ 5103

Last change on this file since 5103 was 5103, checked in by abarral, 8 weeks ago

Handle CPP_INLANDSIS in lmdz_cppkeys_wrapper.F90
Remove obsolete key wrgrads_thermcell, _ADV_HALO, _ADV_HALLO, isminmax
Remove redundant uses of CPPKEY_INCA (thanks acozic)
Remove obsolete misc/write_field.F90
Remove unused ioipsl_* wrappers
Remove calls to WriteField_u with wrong signature
Convert .F -> .[fF]90
(lint) uppercase fortran operators
[note: 1d and iso still broken - working on it]

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 1.3 KB
Line 
1  SUBROUTINE global_mean(field,airephy,laire,mfield)
2
3! I.Musat: 05.2011
4! calcul moyenne globale d'un champ pondere par l'aire de la maille
5! (laire=.TRUE.) ou somme globale du champ (laire=.FALSE.)
6
7  USE dimphy
8  USE mod_phys_lmdz_para, only: is_sequential
9  USE mod_phys_lmdz_transfert_para, only: reduce_sum
10  use mod_phys_lmdz_mpi_data, only: is_mpi_root
11  USE ioipsl
12  implicit none
13
14  real,dimension(klon),intent(in) :: field
15  real,dimension(klon),intent(in) :: airephy
16  LOGICAL, intent(in) :: laire
17  REAL, intent(out) :: mfield
18  REAL :: airetot     ! Total area the earth
19  REAL :: sumtmp
20  INTEGER :: i
21
22  if (is_sequential) then
23
24   airetot = 0.
25   sumtmp = 0.
26   DO i=1, klon
27    airetot = airetot + airephy(i)
28    sumtmp = sumtmp + field(i)
29   END DO
30   if (laire) THEN
31    if(airetot/=0.) THEN
32     mfield=sumtmp/airetot
33    endif
34   else
35    mfield=sumtmp
36   endif
37
38  else
39
40   CALL reduce_sum(SUM(airephy),airetot)
41   CALL reduce_sum(SUM(field),sumtmp)
42
43!$OMP MASTER
44  if (is_mpi_root) THEN
45  if (laire) THEN
46!  PRINT*,'gmean airetot=',airetot
47   if(airetot/=0.) THEN
48    mfield=sumtmp/airetot
49!  else
50!   mfield=sumtmp
51   endif
52  else
53   mfield=sumtmp
54  endif
55
56! PRINT*,'gmean sumtmp mfield=',sumtmp,mfield
57
58  endif !(is_mpi_root) THEN
59!$OMP END MASTER
60
61  endif
62
63  END SUBROUTINE  global_mean
Note: See TracBrowser for help on using the repository browser.