Ignore:
Timestamp:
Nov 8, 2024, 10:57:14 AM (13 days ago)
Author:
afalco
Message:

Pluto: print only on master process.
AF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.PLUTO/libf/phypluto/setspi.F90

    r3184 r3504  
    22
    33!==================================================================
    4 !     
     4!
    55!     Purpose
    66!     -------
    77!     Set up spectral intervals and Planck function in the longwave.
    8 !     
     8!
    99!     Authors
    10 !     ------- 
     10!     -------
    1111!     Adapted from setspi in the NASA Ames radiative code by
    1212!     Robin Wordsworth (2009).
    13 !     
     13!
    1414!     Called by
    1515!     ---------
    1616!     callcorrk.F
    17 !     
     17!
    1818!     Calls
    1919!     -----
    2020!     none
    21 !     
     21!
    2222!==================================================================
    2323
     
    2626      use datafile_mod, only: datadir
    2727      use comcstfi_mod, only: pi
     28      use mod_phys_lmdz_para, only : is_master
    2829
    2930      implicit none
     
    4243      real*8 :: c1 = 3.741832D-16 ! W m^-2
    4344      real*8 :: c2 = 1.438786D-2  ! m K
    44      
     45
    4546      real*8 :: lastband(2), plancksum
    4647
     
    7576      write(temp1,'(i2.2)') L_NSPECTI
    7677      !file_id='/corrk_data/' // corrkdir(1:LEN_TRIM(corrkdir)) // '/narrowbands_IR.in'
    77       file_id='/corrk_data/'//trim(adjustl(banddir))//'/narrowbands_IR.in' 
     78      file_id='/corrk_data/'//trim(adjustl(banddir))//'/narrowbands_IR.in'
    7879      file_path=TRIM(datadir)//TRIM(file_id)
    7980
     
    8182      inquire(FILE=file_path,EXIST=file_ok)
    8283      if(.not.file_ok) then
    83          write(*,*)'The file ',TRIM(file_path)
    84          write(*,*)'was not found by setspi.F90, exiting.'
    85          write(*,*)'Check that your path to datagcm:',trim(datadir)
    86          write(*,*)' is correct. You can change it in callphys.def with:'
    87          write(*,*)' datadir = /absolute/path/to/datagcm'
    88          write(*,*)'Also check that the corrkdir you chose in callphys.def exists.'
    89          call abort
    90       endif
    91    
    92 !$OMP MASTER   
     84         if (is_master) then
     85            write(*,*)'The file ',TRIM(file_path)
     86            write(*,*)'was not found by setspi.F90, exiting.'
     87            write(*,*)'Check that your path to datagcm:',trim(datadir)
     88            write(*,*)' is correct. You can change it in callphys.def with:'
     89            write(*,*)' datadir = /absolute/path/to/datagcm'
     90            write(*,*)'Also check that the corrkdir you chose in callphys.def exists.'
     91         endif
     92         call abort_physic("setspi", "File not found by setspi", 1)
     93      endif
     94
     95!$OMP MASTER
    9396      nb=0
    9497      ierr=0
    95       ! check that the file contains the right number of bands 
     98      ! check that the file contains the right number of bands
    9699      open(131,file=file_path,form='formatted')
    97100      read(131,*,iostat=ierr) file_entries
     
    103106      close(131)
    104107
    105       write(*,*) 'setspi: L_NSPECTI = ',L_NSPECTI, 'in the model '
    106       write(*,*) '        there are   ',nb, 'entries in ',TRIM(file_path)
     108      if (is_master) then
     109         write(*,*) 'setspi: L_NSPECTI = ',L_NSPECTI, 'in the model '
     110         write(*,*) '        there are   ',nb, 'entries in ',TRIM(file_path)
     111      endif
    107112      if(nb.ne.L_NSPECTI) then
    108          write(*,*) 'MISMATCH !! I stop here'
    109          call abort
     113         call abort_physic("setspi",'MISMATCH !! I stop here',1)
    110114      endif
    111115
    112116      ! load and display the data
    113117      open(111,file=file_path,form='formatted')
    114       read(111,*) 
     118      read(111,*)
    115119      do M=1,L_NSPECTI-1
    116120         read(111,*) BWNI(M)
     
    123127!$OMP BARRIER
    124128
    125       print*,''
    126       print*,'setspi: IR band limits:'
    127       do M=1,L_NSPECTI+1
    128          print*,m,'-->',BWNI(M),' cm^-1'
    129       end do
    130 
    131 !     Set up mean wavenumbers and wavenumber deltas.  Units of
     129      if (is_master)then
     130         print*,''
     131         print*,'setspi: IR band limits:'
     132         do M=1,L_NSPECTI+1
     133            print*,m,'-->',BWNI(M),' cm^-1'
     134         end do
     135      endif
     136
     137!     Set up mean wavenumbers and wavenumber deltas.  Units of
    132138!     wavenumbers is cm^(-1); units of wavelengths is microns.
    133139
     
    136142         DWNI(M)  = BWNI(M+1)-BWNI(M)
    137143         WAVEI(M) = 1.0D+4/WNOI(M)
    138          BLAMI(M) = 0.01D0/BWNI(M)         
     144         BLAMI(M) = 0.01D0/BWNI(M)
    139145      end do
    140146      BLAMI(M) = 0.01D0/BWNI(M)
     
    147153!     original planck.f; W m^-2 wavenumber^-1, where wavenumber is in CM^-1.
    148154
    149       print*,''
    150       print*,'setspi: Current Planck integration range:'
    151       print*,'T = ',dble(NTstart)/NTfac, ' to ',dble(NTstop)/NTfac,' K.'
     155      if (is_master)then
     156         print*,''
     157         print*,'setspi: Current Planck integration range:'
     158         print*,'T = ',dble(NTstart)/NTfac, ' to ',dble(NTstop)/NTfac,' K.'
     159      endif
    152160
    153161      IF(.NOT.ALLOCATED(planckir)) ALLOCATE(planckir(L_NSPECTI,NTstop-NTstart+1))
     
    159167         bma = (b-a)/2.0D0
    160168         ! if (nw .eq. 25) then !LT debug
    161          !    print*, "a = ",a 
    162          !    print*, "b= ",b 
    163          !    print*,"bpa = ",bpa 
     169         !    print*, "a = ",a
     170         !    print*, "b= ",b
     171         !    print*,"bpa = ",bpa
    164172         !    print*, "bma = ",bma
    165173         ! endif
     
    170178               y    = bma*x(mm)+bpa
    171179               !to avoid floating overflow when T is low and optical wavelength
    172                if ((c2/(y*T)) .lt. 700.0D0) then 
     180               if ((c2/(y*T)) .lt. 700.0D0) then
    173181                  ans  = ans + w(mm)*c1/(y**5*(exp(c2/(y*T))-1.0D0))
    174                else 
     182               else
    175183                  ans = ans +0.0D0
    176184               endif
     
    179187         end do
    180188      end do
    181          
     189
    182190      ! force planck=sigma*eps*T^4 for each temperature in array
    183191      if(forceEC)then
    184          print*,'setspi: Force F=sigma*eps*T^4 for all values of T!'
     192         if (is_master) print*,'setspi: Force F=sigma*eps*T^4 for all values of T!'
    185193         do nt=NTstart,NTstop
    186194            plancksum=0.0D0
    187195            T=dble(NT)/NTfac
    188        
     196
    189197            do NW=1,L_NSPECTI
    190198               plancksum=plancksum+  &
     
    207215            plancksum=plancksum+planckir(NW,nt-NTstart+1)*DWNI(NW)*pi
    208216         end do
    209          print*,'setspi: At lower limit:'
    210          print*,'in model sig*T^4 = ',plancksum,' W m^-2'
    211          print*,'actual sig*T^4   = ',sigma*(dble(nt)/NTfac)**4,' W m^-2'
    212          
     217         if (is_master) then
     218            print*,'setspi: At lower limit:'
     219            print*,'in model sig*T^4 = ',plancksum,' W m^-2'
     220            print*,'actual sig*T^4   = ',sigma*(dble(nt)/NTfac)**4,' W m^-2'
     221         endif
    213222         ! check energy conservation at upper temperature boundary
    214223         plancksum=0.0D0
     
    217226            plancksum=plancksum+planckir(NW,nt-NTstart+1)*DWNI(NW)*pi
    218227         end do
    219          print*,'setspi: At upper limit:'
    220          print*,'in model sig*T^4 = ',plancksum,' W m^-2'
    221          print*,'actual sig*T^4   = ',sigma*(dble(nt)/NTfac)**4,' W m^-2'
    222          print*,''
     228         if (is_master) then
     229            print*,'setspi: At upper limit:'
     230            print*,'in model sig*T^4 = ',plancksum,' W m^-2'
     231            print*,'actual sig*T^4   = ',sigma*(dble(nt)/NTfac)**4,' W m^-2'
     232            print*,''
     233         endif
    223234      endif
    224235
Note: See TracChangeset for help on using the changeset viewer.