source: LMDZ5/branches/IPSLCM6.0.11pre/libf/phylmd/global_mean.F90 @ 5171

Last change on this file since 5171 was 1907, checked in by lguez, 11 years ago

Added a copyright property to every file of the distribution, except
for the fcm files (which have their own copyright). Use svn propget on
a file to see the copyright. For instance:

$ svn propget copyright libf/phylmd/physiq.F90
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

Also added the files defining the CeCILL version 2 license, in French
and English, at the top of the LMDZ tree.

  • 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
  • Property svn:executable set to *
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.NE.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.NE.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.