Ignore:
Timestamp:
Nov 10, 2021, 8:46:21 AM (3 years ago)
Author:
emillour
Message:

Generic GCM:
Bug fix (concerns OpenMP only) in inifis. And some cleanup in the
output messages.
EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90

    r2542 r2583  
    2323  use callkeys_mod
    2424  use ioipsl_getin_p_mod, only : getin_p
    25   use mod_phys_lmdz_para, only : is_parallel
     25  use mod_phys_lmdz_para, only : is_parallel, is_master, bcast
    2626
    2727!=======================================================================
     
    7171  REAL,INTENT(IN) :: plat(ngrid),plon(ngrid),parea(ngrid)
    7272  integer,intent(in) :: day_ini
    73   INTEGER ig,ierr
     73
     74  INTEGER ig
     75  CHARACTER(len=20) :: rname="inifis" ! routine name, for messages
    7476 
    7577  EXTERNAL iniorbit,orbite
     
    109111! --------------------------------------------------------------
    110112     
    111   ! check that 'callphys.def' file is around
    112   OPEN(99,file='callphys.def',status='old',form='formatted',iostat=ierr)
    113   CLOSE(99)
    114   IF(ierr.EQ.0) iscallphys=.true. !iscallphys initialised as false in callkeys_mod module
    115      
    116 !!!      IF(ierr.EQ.0) THEN
     113  IF (is_master) THEN
     114    ! check if 'callphys.def' file is around
     115    inquire(file="callphys.def",exist=iscallphys)
     116    write(*,*) trim(rname)//": iscallphys=",iscallphys
     117  ENDIF
     118  call bcast(iscallphys)
     119
    117120  IF(iscallphys) THEN
    118      PRINT*
    119      PRINT*
    120      PRINT*,'--------------------------------------------'
    121      PRINT*,' inifis: Parametres pour la physique (callphys.def)'
    122      PRINT*,'--------------------------------------------'
    123 
    124      write(*,*) "Directory where external input files are:"
     121
     122     if (is_master) then
     123       write(*,*)
     124       write(*,*)'--------------------------------------------'
     125       write(*,*)trim(rname)//': Parameters for the physics (callphys.def)'
     126       write(*,*)'--------------------------------------------'
     127     endif
     128
     129     if (is_master) write(*,*) trim(rname)//&
     130       ": Directory where external input files are:"
    125131     ! default 'datadir' is set in "datadir_mod"
    126132     call getin_p("datadir",datadir) ! default path
    127      write(*,*) " datadir = ",trim(datadir)
    128 
    129      write(*,*) "Run with or without tracer transport ?"
     133     if (is_master) write(*,*) trim(rname)//": datadir = ",trim(datadir)
     134
     135     if (is_master) write(*,*) trim(rname)//&
     136       ": Run with or without tracer transport ?"
    130137     tracer=.false. ! default value
    131138     call getin_p("tracer",tracer)
    132      write(*,*) " tracer = ",tracer
    133 
    134      write(*,*) "Run with or without atm mass update ", &
    135             " due to tracer evaporation/condensation?"
     139     if (is_master) write(*,*) trim(rname)//": tracer = ",tracer
     140
     141     if (is_master) write(*,*) trim(rname)//&
     142       ": Run with or without atm mass update "//&
     143       " due to tracer evaporation/condensation?"
    136144     mass_redistrib=.false. ! default value
    137145     call getin_p("mass_redistrib",mass_redistrib)
    138      write(*,*) " mass_redistrib = ",mass_redistrib
    139 
    140      write(*,*) "Diurnal cycle ?"
    141      write(*,*) "(if diurnal=false, diurnal averaged solar heating)"
     146     if (is_master) write(*,*) trim(rname)//&
     147       ": mass_redistrib = ",mass_redistrib
     148
     149     if (is_master) then
     150       write(*,*) trim(rname)//": Diurnal cycle ?"
     151       write(*,*) trim(rname)//&
     152       ": (if diurnal=false, diurnal averaged solar heating)"
     153     endif
    142154     diurnal=.true. ! default value
    143155     call getin_p("diurnal",diurnal)
    144      write(*,*) " diurnal = ",diurnal
    145 
    146      write(*,*) "Seasonal cycle ?"
    147      write(*,*) "(if season=false, Ls stays constant, to value ", &
    148          "set in 'start'"
     156     if (is_master) write(*,*) trim(rname)//": diurnal = ",diurnal
     157
     158     if (is_master) then
     159       write(*,*) trim(rname)//": Seasonal cycle ?"
     160       write(*,*) trim(rname)//&
     161       ": (if season=false, Ls stays constant, to value ", &
     162       "set in 'start'"
     163     endif
    149164     season=.true. ! default value
    150165     call getin_p("season",season)
    151      write(*,*) " season = ",season
     166     if (is_master) write(*,*) trim(rname)//": season = ",season
    152167     
    153      write(*,*) "No seasonal cycle: initial day to lock the run during restart"
     168     if (is_master) write(*,*) trim(rname)//&
     169       ": No seasonal cycle: initial day to lock the run during restart"
    154170     noseason_day=0.0 ! default value
    155171     call getin_p("noseason_day",noseason_day)
    156      write(*,*) "noseason_day=", noseason_day
    157 
    158      write(*,*) "Tidally resonant rotation ?"
     172     if (is_master) write(*,*) trim(rname)//": noseason_day=", noseason_day
     173
     174     if (is_master) write(*,*) trim(rname)//": Tidally resonant rotation ?"
    159175     tlocked=.false. ! default value
    160176     call getin_p("tlocked",tlocked)
    161      write(*,*) "tlocked = ",tlocked
    162 
    163      write(*,*) "Saturn ring shadowing ?"
     177     if (is_master) write(*,*) trim(rname)//": tlocked = ",tlocked
     178
     179     if (is_master) write(*,*) trim(rname)//": Saturn ring shadowing ?"
    164180     rings_shadow = .false.
    165181     call getin_p("rings_shadow", rings_shadow)
    166      write(*,*) "rings_shadow = ", rings_shadow
     182     if (is_master) write(*,*) trim(rname)//": rings_shadow = ", rings_shadow
    167183         
    168      write(*,*) "Compute latitude-dependent gravity field?"
     184     if (is_master) write(*,*) trim(rname)//&
     185       ": Compute latitude-dependent gravity field?"
    169186     oblate = .false.
    170187     call getin_p("oblate", oblate)
    171      write(*,*) "oblate = ", oblate
    172 
    173      write(*,*) "Flattening of the planet (a-b)/a "
     188     if (is_master) write(*,*) trim(rname)//": oblate = ", oblate
     189
     190     if (is_master) write(*,*) trim(rname)//": Flattening of the planet (a-b)/a "
    174191     flatten = 0.0
    175192     call getin_p("flatten", flatten)
    176      write(*,*) "flatten = ", flatten
     193     if (is_master) write(*,*) trim(rname)//": flatten = ", flatten
    177194         
    178195
    179      write(*,*) "Needed if oblate=.true.: J2"
     196     if (is_master) write(*,*) trim(rname)//": Needed if oblate=.true.: J2"
    180197     J2 = 0.0
    181198     call getin_p("J2", J2)
    182      write(*,*) "J2 = ", J2
     199     if (is_master) write(*,*) trim(rname)//": J2 = ", J2
    183200         
    184      write(*,*) "Needed if oblate=.true.: Planet mass (*1e24 kg)"
     201     if (is_master) write(*,*) trim(rname)//&
     202       ": Needed if oblate=.true.: Planet mass (*1e24 kg)"
    185203     MassPlanet = 0.0
    186204     call getin_p("MassPlanet", MassPlanet)
    187      write(*,*) "MassPlanet = ", MassPlanet         
    188 
    189      write(*,*) "Needed if oblate=.true.: Planet mean radius (m)"
     205     if (is_master) write(*,*) trim(rname)//": MassPlanet = ", MassPlanet         
     206
     207     if (is_master) write(*,*) trim(rname)//&
     208       ": Needed if oblate=.true.: Planet mean radius (m)"
    190209     Rmean = 0.0
    191210     call getin_p("Rmean", Rmean)
    192      write(*,*) "Rmean = ", Rmean
     211     if (is_master) write(*,*) trim(rname)//": Rmean = ", Rmean
    193212         
    194213! Test of incompatibility:
    195214! if tlocked, then diurnal should be false
    196215     if (tlocked.and.diurnal) then
    197        print*,'If diurnal=true, we should turn off tlocked.'
    198        stop
    199      endif
    200 
    201      write(*,*) "Tidal resonance ratio ?"
     216       call abort_physic(rname,"If diurnal=true, we should turn off tlocked",1)
     217     endif
     218
     219     if (is_master) write(*,*) trim(rname)//": Tidal resonance ratio ?"
    202220     nres=0          ! default value
    203221     call getin_p("nres",nres)
    204      write(*,*) "nres = ",nres
    205 
    206      write(*,*) "Write some extra output to the screen ?"
     222     if (is_master) write(*,*) trim(rname)//": nres = ",nres
     223
     224     if (is_master) write(*,*) trim(rname)//&
     225       ": Write some extra output to the screen ?"
    207226     lwrite=.false. ! default value
    208227     call getin_p("lwrite",lwrite)
    209      write(*,*) " lwrite = ",lwrite
    210 
    211      write(*,*) "Save statistics in file stats.nc ?"
     228     if (is_master) write(*,*) trim(rname)//": lwrite = ",lwrite
     229
     230     if (is_master) write(*,*) trim(rname)//&
     231       ": Save statistics in file stats.nc ?"
    212232     callstats=.true. ! default value
    213233     call getin_p("callstats",callstats)
    214      write(*,*) " callstats = ",callstats
    215 
    216      write(*,*) "Test energy conservation of model physics ?"
     234     if (is_master) write(*,*) trim(rname)//": callstats = ",callstats
     235
     236     if (is_master) write(*,*) trim(rname)//&
     237       ": Test energy conservation of model physics ?"
    217238     enertest=.false. ! default value
    218239     call getin_p("enertest",enertest)
    219      write(*,*) " enertest = ",enertest
    220 
    221      write(*,*) "Check to see if cpp values used match gases.def ?"
     240     if (is_master) write(*,*) trim(rname)//": enertest = ",enertest
     241
     242     if (is_master) write(*,*) trim(rname)//&
     243       ": Check to see if cpp values used match gases.def ?"
    222244     check_cpp_match=.true. ! default value
    223245     call getin_p("check_cpp_match",check_cpp_match)
    224      write(*,*) " check_cpp_match = ",check_cpp_match
    225 
    226      write(*,*) "call radiative transfer ?"
     246     if (is_master) write(*,*) trim(rname)//&
     247       ": check_cpp_match = ",check_cpp_match
     248
     249     if (is_master) write(*,*) trim(rname)//": call radiative transfer ?"
    227250     callrad=.true. ! default value
    228251     call getin_p("callrad",callrad)
    229      write(*,*) " callrad = ",callrad
    230 
    231      write(*,*) "call correlated-k radiative transfer ?"
     252     if (is_master) write(*,*) trim(rname)//": callrad = ",callrad
     253
     254     if (is_master) write(*,*) trim(rname)//&
     255       ": call correlated-k radiative transfer ?"
    232256     corrk=.true. ! default value
    233257     call getin_p("corrk",corrk)
    234      write(*,*) " corrk = ",corrk
    235 
    236      write(*,*) "prohibit calculations outside corrk T grid?"
     258     if (is_master) write(*,*) trim(rname)//": corrk = ",corrk
     259
     260     if (is_master) write(*,*) trim(rname)//&
     261       ": prohibit calculations outside corrk T grid?"
    237262     strictboundcorrk=.true. ! default value
    238263     call getin_p("strictboundcorrk",strictboundcorrk)
    239      write(*,*) "strictboundcorrk = ",strictboundcorrk
    240 
    241      write(*,*) "Minimum atmospheric temperature for Planck function integration ?"
     264     if (is_master) write(*,*) trim(rname)//&
     265       ": strictboundcorrk = ",strictboundcorrk
     266
     267     if (is_master) write(*,*) trim(rname)//&
     268       ": Minimum atmospheric temperature for Planck function integration ?"
    242269     tplanckmin=30.0 ! default value
    243270     call getin_p("tplanckmin",tplanckmin)
    244      write(*,*) " tplanckmin = ",tplanckmin
     271     if (is_master) write(*,*) trim(rname)//": tplanckmin = ",tplanckmin
    245272 
    246      write(*,*) "Maximum atmospheric temperature for Planck function integration ?"
     273     if (is_master) write(*,*) trim(rname)//&
     274       ": Maximum atmospheric temperature for Planck function integration ?"
    247275     tplanckmax=1500.0 ! default value
    248276     call getin_p("tplanckmax",tplanckmax)
    249      write(*,*) " tplanckmax = ",tplanckmax
     277     if (is_master) write(*,*) trim(rname)//": tplanckmax = ",tplanckmax
    250278 
    251      write(*,*) "Temperature step for Planck function integration ?"
     279     if (is_master) write(*,*) trim(rname)//&
     280       ": Temperature step for Planck function integration ?"
    252281     dtplanck=0.1 ! default value
    253282     call getin_p("dtplanck",dtplanck)
    254      write(*,*) " dtplanck = ",dtplanck
     283     if (is_master) write(*,*) trim(rname)//": dtplanck = ",dtplanck
    255284 
    256      write(*,*) "call gaseous absorption in the visible bands?", &
    257                     "(matters only if callrad=T)"
     285     if (is_master) write(*,*) trim(rname)//&
     286       ": call gaseous absorption in the visible bands?"//&
     287       " (matters only if callrad=T)"
    258288     callgasvis=.false. ! default value
    259289     call getin_p("callgasvis",callgasvis)
    260      write(*,*) " callgasvis = ",callgasvis
     290     if (is_master) write(*,*) trim(rname)//": callgasvis = ",callgasvis
    261291       
    262      write(*,*) "call continuum opacities in radiative transfer ?", &
    263                     "(matters only if callrad=T)"
     292     if (is_master) write(*,*) trim(rname)//&
     293       ": call continuum opacities in radiative transfer ?"//&
     294       " (matters only if callrad=T)"
    264295     continuum=.true. ! default value
    265296     call getin_p("continuum",continuum)
    266      write(*,*) " continuum = ",continuum
     297     if (is_master) write(*,*) trim(rname)//": continuum = ",continuum
    267298 
    268      write(*,*) "version for H2H2 CIA file ?"
     299     if (is_master) write(*,*) trim(rname)//": version for H2H2 CIA file ?"
    269300     versH2H2cia=2011 ! default value (should be 2018 but retrocompatibility first)
    270301     call getin_p("versH2H2cia",versH2H2cia)
    271      write(*,*) " versH2H2cia = ",versH2H2cia
     302     if (is_master) write(*,*) trim(rname)//": versH2H2cia = ",versH2H2cia
    272303     ! Sanity check
    273304     if (versH2H2cia.ne.2011 .and. versH2H2cia.ne.2018) then
    274         print*,'Error: Choose a correct value (2011 or 2018) for versH2H2cia !'
    275         call abort
     305        call abort_physic(rname,"Error: Choose a correct value (2011 or 2018) for versH2H2cia !",1)
    276306     endif
    277307
    278      write(*,*) "call turbulent vertical diffusion ?"
     308     if (is_master) write(*,*) trim(rname)//&
     309       ": call turbulent vertical diffusion ?"
    279310     calldifv=.true. ! default value
    280311     call getin_p("calldifv",calldifv)
    281      write(*,*) " calldifv = ",calldifv
    282 
    283      write(*,*) "use turbdiff instead of vdifc ?"
     312     if (is_master) write(*,*) trim(rname)//": calldifv = ",calldifv
     313
     314     if (is_master) write(*,*) trim(rname)//": use turbdiff instead of vdifc ?"
    284315     UseTurbDiff=.true. ! default value
    285316     call getin_p("UseTurbDiff",UseTurbDiff)
    286      write(*,*) " UseTurbDiff = ",UseTurbDiff
    287 
    288      write(*,*) "call convective adjustment ?"
     317     if (is_master) write(*,*) trim(rname)//": UseTurbDiff = ",UseTurbDiff
     318
     319     if (is_master) write(*,*) trim(rname)//": call convective adjustment ?"
    289320     calladj=.true. ! default value
    290321     call getin_p("calladj",calladj)
    291      write(*,*) " calladj = ",calladj
    292 
    293      write(*,*)"call Lott's non-oro GWs parameterisation scheme ?"
     322     if (is_master) write(*,*) trim(rname)//": calladj = ",calladj
     323
     324     if (is_master) write(*,*)trim(rname)//&
     325       ": call Lott's non-oro GWs parameterisation scheme ?"
    294326     calllott_nonoro=.false. ! default value
    295327     call getin_p("calllott_nonoro",calllott_nonoro)
    296      write(*,*)" calllott_nonoro = ",calllott_nonoro
     328     if (is_master) write(*,*)trim(rname)//&
     329       ": calllott_nonoro = ",calllott_nonoro
    297330     
    298      write(*,*)"Max Value of EP flux at launching altitude"
     331     if (is_master) write(*,*)trim(rname)//&
     332       ": Max Value of EP flux at launching altitude"
    299333     epflux_max=0.0                ! default value
    300334     call getin_p("epflux_max",epflux_max)
    301      write(*,*)"epflux_max = ",epflux_max
    302 
    303      write(*,*) "call thermal plume model ?"
     335     if (is_master) write(*,*)trim(rname)//": epflux_max = ",epflux_max
     336
     337     if (is_master) write(*,*) trim(rname)//": call thermal plume model ?"
    304338     calltherm=.false. ! default value
    305339     call getin_p("calltherm",calltherm)
    306      write(*,*) " calltherm = ",calltherm
    307 
    308      write(*,*) "call CO2 condensation ?"
     340     if (is_master) write(*,*) trim(rname)//": calltherm = ",calltherm
     341
     342     if (is_master) write(*,*) trim(rname)//": call CO2 condensation ?"
    309343     co2cond=.false. ! default value
    310344     call getin_p("co2cond",co2cond)
    311      write(*,*) " co2cond = ",co2cond
     345     if (is_master) write(*,*) trim(rname)//": co2cond = ",co2cond
    312346! Test of incompatibility
    313347     if (co2cond.and.(.not.tracer)) then
    314         print*,'We need a CO2 ice tracer to condense CO2'
    315         call abort
     348        call abort_physic(rname,"Error: We need a CO2 ice tracer to condense CO2!",1)
    316349     endif
    317350 
    318      write(*,*) "CO2 supersaturation level ?"
     351     if (is_master) write(*,*) trim(rname)//": CO2 supersaturation level ?"
    319352     co2supsat=1.0 ! default value
    320353     call getin_p("co2supsat",co2supsat)
    321      write(*,*) " co2supsat = ",co2supsat
    322 
    323      write(*,*) "Radiative timescale for Newtonian cooling ?"
     354     if (is_master) write(*,*) trim(rname)//": co2supsat = ",co2supsat
     355
     356     if (is_master) write(*,*) trim(rname)//&
     357     ": Radiative timescale for Newtonian cooling (in Earth days)?"
    324358     tau_relax=30. ! default value
    325359     call getin_p("tau_relax",tau_relax)
    326      write(*,*) " tau_relax = ",tau_relax
     360     if (is_master) write(*,*) trim(rname)//": tau_relax = ",tau_relax
    327361     tau_relax=tau_relax*24*3600 ! convert Earth days --> seconds
    328362
    329      write(*,*)"call thermal conduction in the soil ?"
     363     if (is_master) write(*,*)trim(rname)//&
     364       ": call thermal conduction in the soil ?"
    330365     callsoil=.true. ! default value
    331366     call getin_p("callsoil",callsoil)
    332      write(*,*) " callsoil = ",callsoil
     367     if (is_master) write(*,*) trim(rname)//": callsoil = ",callsoil
    333368         
    334      write(*,*)"Rad transfer is computed every iradia", &
    335                    " physical timestep"
     369     if (is_master) write(*,*)trim(rname)//&
     370       ": Rad transfer is computed every iradia", &
     371       " physical timestep"
    336372     iradia=1 ! default value
    337373     call getin_p("iradia",iradia)
    338      write(*,*)" iradia = ",iradia
     374     if (is_master) write(*,*)trim(rname)//": iradia = ",iradia
    339375       
    340      write(*,*)"Rayleigh scattering ?"
     376     if (is_master) write(*,*)trim(rname)//": Rayleigh scattering ?"
    341377     rayleigh=.false.
    342378     call getin_p("rayleigh",rayleigh)
    343      write(*,*)" rayleigh = ",rayleigh
    344 
    345      write(*,*) "Use blackbody for stellar spectrum ?"
     379     if (is_master) write(*,*)trim(rname)//": rayleigh = ",rayleigh
     380
     381     if (is_master) write(*,*) trim(rname)//&
     382       ": Use blackbody for stellar spectrum ?"
    346383     stelbbody=.false. ! default value
    347384     call getin_p("stelbbody",stelbbody)
    348      write(*,*) " stelbbody = ",stelbbody
    349 
    350      write(*,*) "Stellar blackbody temperature ?"
     385     if (is_master) write(*,*) trim(rname)//": stelbbody = ",stelbbody
     386
     387     if (is_master) write(*,*) trim(rname)//": Stellar blackbody temperature ?"
    351388     stelTbb=5800.0 ! default value
    352389     call getin_p("stelTbb",stelTbb)
    353      write(*,*) " stelTbb = ",stelTbb
    354 
    355      write(*,*)"Output mean OLR in 1D?"
     390     if (is_master) write(*,*) trim(rname)//": stelTbb = ",stelTbb
     391
     392     if (is_master) write(*,*) trim(rname)//": Output mean OLR in 1D?"
    356393     meanOLR=.false.
    357394     call getin_p("meanOLR",meanOLR)
    358      write(*,*)" meanOLR = ",meanOLR
    359 
    360      write(*,*)"Output spectral OLR in 3D?"
     395     if (is_master) write(*,*) trim(rname)//": meanOLR = ",meanOLR
     396
     397     if (is_master) write(*,*)trim(rname)//": Output spectral OLR in 3D?"
    361398     specOLR=.false.
    362399     call getin_p("specOLR",specOLR)
    363      write(*,*)" specOLR = ",specOLR
    364 
    365      write(*,*)"Output diagnostic optical thickness attenuation exp(-tau)?"
     400     if (is_master) write(*,*)trim(rname)//": specOLR = ",specOLR
     401
     402     if (is_master) write(*,*)trim(rname)//&
     403       ": Output diagnostic optical thickness attenuation exp(-tau)?"
    366404     diagdtau=.false.
    367405     call getin_p("diagdtau",diagdtau)
    368      write(*,*)" diagdtau = ",diagdtau
    369 
    370      write(*,*)"Operate in kastprof mode?"
     406     if (is_master) write(*,*)trim(rname)//": diagdtau = ",diagdtau
     407
     408     if (is_master) write(*,*)trim(rname)//": Operate in kastprof mode?"
    371409     kastprof=.false.
    372410     call getin_p("kastprof",kastprof)
    373      write(*,*)" kastprof = ",kastprof
    374 
    375      write(*,*)"Uniform absorption in radiative transfer?"
     411     if (is_master) write(*,*)trim(rname)//": kastprof = ",kastprof
     412
     413     if (is_master) write(*,*)trim(rname)//&
     414       ": Uniform absorption in radiative transfer?"
    376415     graybody=.false.
    377416     call getin_p("graybody",graybody)
    378      write(*,*)" graybody = ",graybody
     417     if (is_master) write(*,*)trim(rname)//": graybody = ",graybody
    379418
    380419! Soil model
    381      write(*,*)"Number of sub-surface layers for soil scheme?"
     420     if (is_master) write(*,*)trim(rname)//&
     421       ": Number of sub-surface layers for soil scheme?"
    382422     ! default value of nsoilmx set in comsoil_h
    383423     call getin_p("nsoilmx",nsoilmx)
    384      write(*,*)" nsoilmx=",nsoilmx
     424     if (is_master) write(*,*)trim(rname)//": nsoilmx=",nsoilmx
    385425     
    386      write(*,*)"Thickness of topmost soil layer (m)?"
     426     if (is_master) write(*,*)trim(rname)//&
     427       ": Thickness of topmost soil layer (m)?"
    387428     ! default value of lay1_soil set in comsoil_h
    388429     call getin_p("lay1_soil",lay1_soil)
    389      write(*,*)" lay1_soil = ",lay1_soil
     430     if (is_master) write(*,*)trim(rname)//": lay1_soil = ",lay1_soil
    390431     
    391      write(*,*)"Coefficient for soil layer thickness distribution?"
     432     if (is_master) write(*,*)trim(rname)//&
     433       ": Coefficient for soil layer thickness distribution?"
    392434     ! default value of alpha_soil set in comsoil_h
    393435     call getin_p("alpha_soil",alpha_soil)
    394      write(*,*)" alpha_soil = ",alpha_soil
     436     if (is_master) write(*,*)trim(rname)//": alpha_soil = ",alpha_soil
    395437
    396438! Slab Ocean
    397      write(*,*) "Use slab-ocean ?"
     439     if (is_master) write(*,*) trim(rname)//": Use slab-ocean ?"
    398440     ok_slab_ocean=.false.         ! default value
    399441     call getin_p("ok_slab_ocean",ok_slab_ocean)
    400      write(*,*) "ok_slab_ocean = ",ok_slab_ocean
     442     if (is_master) write(*,*) trim(rname)//": ok_slab_ocean = ",ok_slab_ocean
    401443     ! Sanity check: for now slab oncean only works in serial mode
    402444     if (ok_slab_ocean.and.is_parallel) then
    403        write(*,*) " Error: slab ocean should only be used in serial mode!"
    404        call abort
    405      endif
    406 
    407      write(*,*) "Use slab-sea-ice ?"
     445       call abort_physic(rname," Error: slab ocean should only be used in serial mode!",1)
     446     endif
     447
     448     if (is_master) write(*,*) trim(rname)//": Use slab-sea-ice ?"
    408449     ok_slab_sic=.true.         ! default value
    409450     call getin_p("ok_slab_sic",ok_slab_sic)
    410      write(*,*) "ok_slab_sic = ",ok_slab_sic
    411 
    412      write(*,*) "Use heat transport for the ocean ?"
     451     if (is_master) write(*,*) trim(rname)//": ok_slab_sic = ",ok_slab_sic
     452
     453     if (is_master) write(*,*) trim(rname)//&
     454       ": Use heat transport for the ocean ?"
    413455     ok_slab_heat_transp=.true.   ! default value
    414456     call getin_p("ok_slab_heat_transp",ok_slab_heat_transp)
    415      write(*,*) "ok_slab_heat_transp = ",ok_slab_heat_transp
     457     if (is_master) write(*,*) trim(rname)//&
     458       ": ok_slab_heat_transp = ",ok_slab_heat_transp
    416459
    417460! Photochemistry and chemistry in the thermosphere
    418461
    419      write(*,*) "Use photochemistry ?"
     462     if (is_master) write(*,*) trim(rname)//": Use photochemistry ?"
    420463     photochem=.false.         ! default value
    421464     call getin_p("photochem",photochem)
    422      write(*,*) "photochem = ",photochem
    423 
    424      write(*,*) "Use photolysis heat table ?"
     465     if (is_master) write(*,*) trim(rname)//": photochem = ",photochem
     466
     467     if (is_master) write(*,*) trim(rname)//": Use photolysis heat table ?"
    425468     photoheat=.false.         ! default value
    426469     call getin_p("photoheat",photoheat)
    427      write(*,*) "photoheat = ",photoheat
    428 
    429      write(*,*) "Use photolysis online calculation ?"
     470     if (is_master) write(*,*) trim(rname)//": photoheat = ",photoheat
     471
     472     if (is_master) write(*,*) trim(rname)//&
     473       ": Use photolysis online calculation ?"
    430474     jonline=.false.         ! default value
    431475     call getin_p("jonline",jonline)
    432      write(*,*) "jonline = ",jonline
    433 
    434      write(*,*) "Use deposition ?"
     476     if (is_master) write(*,*) trim(rname)//": jonline = ",jonline
     477
     478     if (is_master) write(*,*) trim(rname)//": Use deposition ?"
    435479     depos=.false.         ! default value
    436480     call getin_p("depos",depos)
    437      write(*,*) "depos = ",depos
    438 
    439      write(*,*)"Production of haze ?"
     481     if (is_master) write(*,*) trim(rname)//": depos = ",depos
     482
     483     if (is_master) write(*,*)trim(rname)//": Production of haze ?"
    440484     haze=.false. ! default value
    441485     call getin_p("haze",haze)
    442      write(*,*)" haze = ",haze
     486     if (is_master) write(*,*)trim(rname)//": haze = ",haze
    443487
    444488! Global1D mean and solar zenith angle
     
    452496      ! Test of incompatibility : if global1d is true, there should not be any diurnal cycle.
    453497      if (global1d.and.diurnal) then
    454          call abort_physic("inifis",'if global1d is true, diurnal must be set to false',1)
     498         call abort_physic(rname,'if global1d is true, diurnal must be set to false',1)
    455499      endif
    456500
     
    462506         write(*,*) "szangle = ",szangle
    463507      endif
    464    endif
     508   endif ! of if (ngrid.eq.1)
    465509
    466510! Test of incompatibility:
    467511! if kastprof used, we must be in 1D
    468512     if (kastprof.and.(ngrid.gt.1)) then
    469        print*,'kastprof can only be used in 1D!'
    470        call abort
    471      endif
    472 
    473      write(*,*)"Stratospheric temperature for kastprof mode?"
     513       call abort_physic(rname,'kastprof can only be used in 1D!',1)
     514     endif
     515
     516     if (is_master) write(*,*)trim(rname)//&
     517       ": Stratospheric temperature for kastprof mode?"
    474518     Tstrat=167.0
    475519     call getin_p("Tstrat",Tstrat)
    476      write(*,*)" Tstrat = ",Tstrat
    477 
    478      write(*,*)"Remove lower boundary?"
     520     if (is_master) write(*,*)trim(rname)//": Tstrat = ",Tstrat
     521
     522     if (is_master) write(*,*)trim(rname)//": Remove lower boundary?"
    479523     nosurf=.false.
    480524     call getin_p("nosurf",nosurf)
    481      write(*,*)" nosurf = ",nosurf
     525     if (is_master) write(*,*)trim(rname)//": nosurf = ",nosurf
    482526
    483527! Tests of incompatibility:
    484528     if (nosurf.and.callsoil) then
    485        print*,'nosurf not compatible with soil scheme!'
    486        print*,'... got to make a choice!'
    487        call abort
    488      endif
    489 
    490      write(*,*)"Add an internal heat flux?", &
     529       if (is_master) then
     530         write(*,*)trim(rname)//'nosurf not compatible with soil scheme!'
     531         write(*,*)trim(rname)//'... got to make a choice!'
     532       endif
     533       call abort_physic(rname,"nosurf not compatible with soil scheme!",1)
     534     endif
     535
     536     if (is_master) write(*,*)trim(rname)//": Add an internal heat flux?", &
    491537                   "... matters only if callsoil=F"
    492538     intheat=0.
    493539     call getin_p("intheat",intheat)
    494      write(*,*)" intheat = ",intheat
    495 
    496      write(*,*)"Use Newtonian cooling for radiative transfer?"
     540     if (is_master) write(*,*)trim(rname)//": intheat = ",intheat
     541
     542     if (is_master) write(*,*)trim(rname)//&
     543       ": Use Newtonian cooling for radiative transfer?"
    497544     newtonian=.false.
    498545     call getin_p("newtonian",newtonian)
    499      write(*,*)" newtonian = ",newtonian
     546     if (is_master) write(*,*)trim(rname)//": newtonian = ",newtonian
    500547
    501548! Tests of incompatibility:
    502549     if (newtonian.and.corrk) then
    503        print*,'newtonian not compatible with correlated-k!'
    504        call abort
     550       call abort_physic(rname,'newtonian not compatible with correlated-k!',1)
    505551     endif
    506552     if (newtonian.and.calladj) then
    507        print*,'newtonian not compatible with adjustment!'
    508        call abort
     553       call abort_physic(rname,'newtonian not compatible with adjustment!',1)
    509554     endif
    510555     if (newtonian.and.calldifv) then
    511        print*,'newtonian not compatible with a boundary layer!'
    512        call abort
    513      endif
    514 
    515      write(*,*)"Test physics timescale in 1D?"
     556       call abort_physic(rname,'newtonian not compatible with a boundary layer!',1)
     557     endif
     558
     559     if (is_master) write(*,*)trim(rname)//": Test physics timescale in 1D?"
    516560     testradtimes=.false.
    517561     call getin_p("testradtimes",testradtimes)
    518      write(*,*)" testradtimes = ",testradtimes
     562     if (is_master) write(*,*)trim(rname)//": testradtimes = ",testradtimes
    519563
    520564! Test of incompatibility:
    521565! if testradtimes used, we must be in 1D
    522566     if (testradtimes.and.(ngrid.gt.1)) then
    523        print*,'testradtimes can only be used in 1D!'
    524        call abort
    525      endif
    526 
    527      write(*,*)"Default planetary temperature?"
     567       call abort_physic(rname,'testradtimes can only be used in 1D!',1)
     568     endif
     569
     570     if (is_master) write(*,*)trim(rname)//": Default planetary temperature?"
    528571     tplanet=215.0
    529572     call getin_p("tplanet",tplanet)
    530      write(*,*)" tplanet = ",tplanet
    531 
    532      write(*,*)"Which star?"
     573     if (is_master) write(*,*)trim(rname)//": tplanet = ",tplanet
     574
     575     if (is_master) write(*,*)trim(rname)//": Which star?"
    533576     startype=1 ! default value = Sol
    534577     call getin_p("startype",startype)
    535      write(*,*)" startype = ",startype
    536 
    537      write(*,*)"Value of stellar flux at 1 AU?"
     578     if (is_master) write(*,*)trim(rname)//": startype = ",startype
     579
     580     if (is_master) write(*,*)trim(rname)//": Value of stellar flux at 1 AU?"
    538581     Fat1AU=1356.0 ! default value = Sol today
    539582     call getin_p("Fat1AU",Fat1AU)
    540      write(*,*)" Fat1AU = ",Fat1AU
     583     if (is_master) write(*,*)trim(rname)//": Fat1AU = ",Fat1AU
    541584
    542585
    543586! TRACERS:
    544587
    545      write(*,*)"Varying H2O cloud fraction?"
     588     if (is_master) write(*,*)trim(rname)//": Varying H2O cloud fraction?"
    546589     CLFvarying=.false.     ! default value
    547590     call getin_p("CLFvarying",CLFvarying)
    548      write(*,*)" CLFvarying = ",CLFvarying
    549 
    550      write(*,*)"Value of fixed H2O cloud fraction?"
     591     if (is_master) write(*,*)trim(rname)//": CLFvarying = ",CLFvarying
     592
     593     if (is_master) write(*,*)trim(rname)//&
     594       ": Value of fixed H2O cloud fraction?"
    551595     CLFfixval=1.0                ! default value
    552596     call getin_p("CLFfixval",CLFfixval)
    553      write(*,*)" CLFfixval = ",CLFfixval
    554 
    555      write(*,*)"fixed radii for Cloud particles?"
     597     if (is_master) write(*,*)trim(rname)//": CLFfixval = ",CLFfixval
     598
     599     if (is_master) write(*,*)trim(rname)//": fixed radii for Cloud particles?"
    556600     radfixed=.false. ! default value
    557601     call getin_p("radfixed",radfixed)
    558      write(*,*)" radfixed = ",radfixed
     602     if (is_master) write(*,*)trim(rname)//": radfixed = ",radfixed
    559603
    560604     if(kastprof)then
     
    562606     endif 
    563607
    564      write(*,*)"Number mixing ratio of CO2 ice particles:"
     608     if (is_master) write(*,*)trim(rname)//&
     609       ": Number mixing ratio of CO2 ice particles:"
    565610     Nmix_co2=1.e6 ! default value
    566611     call getin_p("Nmix_co2",Nmix_co2)
    567      write(*,*)" Nmix_co2 = ",Nmix_co2
     612     if (is_master) write(*,*)trim(rname)//": Nmix_co2 = ",Nmix_co2
    568613
    569614!         write(*,*)"Number of radiatively active aerosols:"
     
    572617!         write(*,*)" naerkind = ",naerkind
    573618
    574      write(*,*)"Opacity of dust (if used):"
     619     if (is_master) write(*,*)trim(rname)//": Opacity of dust (if used):"
    575620     dusttau=0. ! default value
    576621     call getin_p("dusttau",dusttau)
    577      write(*,*)" dusttau = ",dusttau
    578 
    579      write(*,*)"Radiatively active CO2 aerosols?"
     622     if (is_master) write(*,*)trim(rname)//": dusttau = ",dusttau
     623
     624     if (is_master) write(*,*)trim(rname)//": Radiatively active CO2 aerosols?"
    580625     aeroco2=.false.     ! default value
    581626     call getin_p("aeroco2",aeroco2)
    582      write(*,*)" aeroco2 = ",aeroco2
    583 
    584      write(*,*)"Fixed CO2 aerosol distribution?"
     627     if (is_master) write(*,*)trim(rname)//": aeroco2 = ",aeroco2
     628
     629     if (is_master) write(*,*)trim(rname)//": Fixed CO2 aerosol distribution?"
    585630     aerofixco2=.false.     ! default value
    586631     call getin_p("aerofixco2",aerofixco2)
    587      write(*,*)" aerofixco2 = ",aerofixco2
    588 
    589      write(*,*)"Radiatively active water ice?"
     632     if (is_master) write(*,*)trim(rname)//": aerofixco2 = ",aerofixco2
     633
     634     if (is_master) write(*,*)trim(rname)//": Radiatively active water ice?"
    590635     aeroh2o=.false.     ! default value
    591636     call getin_p("aeroh2o",aeroh2o)
    592      write(*,*)" aeroh2o = ",aeroh2o
    593 
    594      write(*,*)"Fixed H2O aerosol distribution?"
     637     if (is_master) write(*,*)trim(rname)//": aeroh2o = ",aeroh2o
     638
     639     if (is_master) write(*,*)trim(rname)//": Fixed H2O aerosol distribution?"
    595640     aerofixh2o=.false.     ! default value
    596641     call getin_p("aerofixh2o",aerofixh2o)
    597      write(*,*)" aerofixh2o = ",aerofixh2o
    598 
    599      write(*,*)"Radiatively active sulfuric acid aerosols?"
     642     if (is_master) write(*,*)trim(rname)//": aerofixh2o = ",aerofixh2o
     643
     644     if (is_master) write(*,*)trim(rname)//&
     645       ": Radiatively active sulfuric acid aerosols?"
    600646     aeroh2so4=.false.     ! default value
    601647     call getin_p("aeroh2so4",aeroh2so4)
    602      write(*,*)" aeroh2so4 = ",aeroh2so4
     648     if (is_master) write(*,*)trim(rname)//": aeroh2so4 = ",aeroh2so4
    603649 
    604      write(*,*)"Radiatively active auroral aerosols?"
     650     if (is_master) write(*,*)trim(rname)//&
     651       ": Radiatively active auroral aerosols?"
    605652     aeroaurora=.false.     ! default value
    606653     call getin_p("aeroaurora",aeroaurora)
    607      write(*,*)" aeroaurora = ",aeroaurora
     654     if (is_master) write(*,*)trim(rname)//": aeroaurora = ",aeroaurora
    608655
    609656!=================================
     
    611658! You should now use N-LAYER scheme (see below).
    612659
    613      write(*,*)"Radiatively active two-layer aerosols?"
     660     if (is_master) write(*,*)trim(rname)//&
     661       ": Radiatively active two-layer aerosols?"
    614662     aeroback2lay=.false.     ! default value
    615663     call getin_p("aeroback2lay",aeroback2lay)
    616      write(*,*)" aeroback2lay = ",aeroback2lay
    617 
    618      if (aeroback2lay) then
     664     if (is_master) write(*,*)trim(rname)//": aeroback2lay = ",aeroback2lay
     665
     666     if (aeroback2lay.and.is_master) then
    619667       print*,'Warning : The TWOLAY AEROSOL scheme is deprecated and buggy...'
    620668       print*,'You should use the generic n-layer scheme (see aeronlay).'
    621669     endif
    622670
    623      write(*,*)"Radiatively active ammonia cloud?"
     671     if (is_master) write(*,*)trim(rname)//": Radiatively active ammonia cloud?"
    624672     aeronh3=.false.     ! default value
    625673     call getin_p("aeronh3",aeronh3)
    626      write(*,*)" aeronh3 = ",aeronh3
    627 
    628      if (aeronh3) then
     674     if (is_master) write(*,*)trim(rname)//": aeronh3 = ",aeronh3
     675
     676     if (aeronh3.and.is_master) then
    629677       print*,'Warning : You are using specific NH3 cloud scheme ...'
    630678       print*,'You should use the generic n-layer scheme (see aeronlay).'
    631679     endif
    632680
    633      write(*,*)"TWOLAY AEROSOL: total optical depth ", &
    634                     "in the tropospheric layer (visible)"
     681     if (is_master) write(*,*)trim(rname)//&
     682       ": TWOLAY AEROSOL: total optical depth "//&
     683       "in the tropospheric layer (visible)"
    635684     obs_tau_col_tropo=8.D0
    636685     call getin_p("obs_tau_col_tropo",obs_tau_col_tropo)
    637      write(*,*)" obs_tau_col_tropo = ",obs_tau_col_tropo
    638 
    639      write(*,*)"TWOLAY AEROSOL: total optical depth ", &
    640                     "in the stratospheric layer (visible)"
     686     if (is_master) write(*,*)trim(rname)//&
     687       ": obs_tau_col_tropo = ",obs_tau_col_tropo
     688
     689     if (is_master) write(*,*)trim(rname)//&
     690       ": TWOLAY AEROSOL: total optical depth "//&
     691       "in the stratospheric layer (visible)"
    641692     obs_tau_col_strato=0.08D0
    642693     call getin_p("obs_tau_col_strato",obs_tau_col_strato)
    643      write(*,*)" obs_tau_col_strato = ",obs_tau_col_strato
    644 
    645      write(*,*)"TWOLAY AEROSOL: optprop_back2lay_vis?"
     694     if (is_master) write(*,*)trim(rname)//&
     695       ": obs_tau_col_strato = ",obs_tau_col_strato
     696
     697     if (is_master) write(*,*)trim(rname)//&
     698       ": TWOLAY AEROSOL: optprop_back2lay_vis?"
    646699     optprop_back2lay_vis = 'optprop_saturn_vis_n20.dat'
    647700     call getin_p("optprop_back2lay_vis",optprop_back2lay_vis)
    648      write(*,*)" optprop_back2lay_vis = ",optprop_back2lay_vis
    649 
    650      write(*,*)"TWOLAY AEROSOL: optprop_back2lay_ir?"
     701     if (is_master) write(*,*)trim(rname)//&
     702       ": optprop_back2lay_vis = ",trim(optprop_back2lay_vis)
     703
     704     if (is_master) write(*,*)trim(rname)//&
     705       ": TWOLAY AEROSOL: optprop_back2lay_ir?"
    651706     optprop_back2lay_ir = 'optprop_saturn_ir_n20.dat'
    652707     call getin_p("optprop_back2lay_ir",optprop_back2lay_ir)
    653      write(*,*)" optprop_back2lay_ir = ",optprop_back2lay_ir
     708     if (is_master) write(*,*)trim(rname)//&
     709       ": optprop_back2lay_ir = ",trim(optprop_back2lay_ir)
    654710     
    655      write(*,*)"TWOLAY AEROSOL: pres_bottom_tropo? in pa"
     711     if (is_master) write(*,*)trim(rname)//&
     712       ": TWOLAY AEROSOL: pres_bottom_tropo? in pa"
    656713     pres_bottom_tropo=66000.0
    657714     call getin_p("pres_bottom_tropo",pres_bottom_tropo)
    658      write(*,*)" pres_bottom_tropo = ",pres_bottom_tropo
    659 
    660      write(*,*)"TWOLAY AEROSOL: pres_top_tropo? in pa"
     715     if (is_master) write(*,*)trim(rname)//&
     716       ": pres_bottom_tropo = ",pres_bottom_tropo
     717
     718     if (is_master) write(*,*)trim(rname)//&
     719       ": TWOLAY AEROSOL: pres_top_tropo? in pa"
    661720     pres_top_tropo=18000.0
    662721     call getin_p("pres_top_tropo",pres_top_tropo)
    663      write(*,*)" pres_top_tropo = ",pres_top_tropo
    664 
    665      write(*,*)"TWOLAY AEROSOL: pres_bottom_strato? in pa"
     722     if (is_master) write(*,*)trim(rname)//&
     723       ": pres_top_tropo = ",pres_top_tropo
     724
     725     if (is_master) write(*,*)trim(rname)//&
     726       ": TWOLAY AEROSOL: pres_bottom_strato? in pa"
    666727     pres_bottom_strato=2000.0
    667728     call getin_p("pres_bottom_strato",pres_bottom_strato)
    668      write(*,*)" pres_bottom_strato = ",pres_bottom_strato
     729     if (is_master) write(*,*)trim(rname)//&
     730       ": pres_bottom_strato = ",pres_bottom_strato
    669731
    670732     ! Sanity check
    671733     if (pres_bottom_strato .gt. pres_top_tropo) then
     734       if(is_master) then
    672735       print*,'Error : TWOLAY AEROSOL, Please ensure that in callphys.def'
    673736       print*,'you have pres_top_tropo > pres_bottom_strato !'
    674        call abort
    675      endif
    676 
    677      write(*,*)"TWOLAY AEROSOL: pres_top_strato? in pa"
     737       endif
     738       call abort_physic(rname," pres_top_tropo > pres_bottom_strato!",1)
     739     endif
     740
     741     if (is_master) write(*,*)trim(rname)//&
     742       ": TWOLAY AEROSOL: pres_top_strato? in pa"
    678743     pres_top_strato=100.0
    679744     call getin_p("pres_top_strato",pres_top_strato)
    680      write(*,*)" pres_top_strato = ",pres_top_strato
    681 
    682      write(*,*)"TWOLAY AEROSOL: particle size in the ", &
    683                     "tropospheric layer, in meters"
     745     if (is_master) write(*,*)trim(rname)//&
     746       ": pres_top_strato = ",pres_top_strato
     747
     748     if (is_master) write(*,*)trim(rname)//&
     749       ": TWOLAY AEROSOL: particle size in the ", &
     750       "tropospheric layer, in meters"
    684751     size_tropo=2.e-6
    685752     call getin_p("size_tropo",size_tropo)
    686      write(*,*)" size_tropo = ",size_tropo
    687 
    688      write(*,*)"TWOLAY AEROSOL: particle size in the ", &
    689                     "stratospheric layer, in meters"
     753     if (is_master) write(*,*)trim(rname)//": size_tropo = ",size_tropo
     754
     755     if (is_master) write(*,*)trim(rname)//&
     756       ": TWOLAY AEROSOL: particle size in the ", &
     757       "stratospheric layer, in meters"
    690758     size_strato=1.e-7
    691759     call getin_p("size_strato",size_strato)
    692      write(*,*)" size_strato = ",size_strato
    693 
    694      write(*,*)"NH3 (thin) cloud: total optical depth"
     760     if (is_master) write(*,*)trim(rname)//": size_strato = ",size_strato
     761
     762     if (is_master) write(*,*)trim(rname)//&
     763       ": NH3 (thin) cloud: total optical depth"
    695764     tau_nh3_cloud=7.D0
    696765     call getin_p("tau_nh3_cloud",tau_nh3_cloud)
    697      write(*,*)" tau_nh3_cloud = ",tau_nh3_cloud
    698 
    699      write(*,*)"NH3 (thin) cloud pressure level"
     766     if (is_master) write(*,*)trim(rname)//": tau_nh3_cloud = ",tau_nh3_cloud
     767
     768     if (is_master) write(*,*)trim(rname)//": NH3 (thin) cloud pressure level"
    700769     pres_nh3_cloud=7.D0
    701770     call getin_p("pres_nh3_cloud",pres_nh3_cloud)
    702      write(*,*)" pres_nh3_cloud = ",pres_nh3_cloud
    703 
    704      write(*,*)"NH3 (thin) cloud: particle sizes"
     771     if (is_master) write(*,*)trim(rname)//": pres_nh3_cloud = ",pres_nh3_cloud
     772
     773     if (is_master) write(*,*)trim(rname)//": NH3 (thin) cloud: particle sizes"
    705774     size_nh3_cloud=3.e-6
    706775     call getin_p("size_nh3_cloud",size_nh3_cloud)
    707      write(*,*)" size_nh3_cloud = ",size_nh3_cloud
     776     if (is_master) write(*,*)trim(rname)//": size_nh3_cloud = ",size_nh3_cloud
    708777
    709778!=================================
    710779! Generic N-LAYER aerosol scheme
    711780
    712      write(*,*)"Radiatively active generic n-layer aerosols?"
     781     if (is_master) write(*,*)trim(rname)//&
     782       ": Radiatively active generic n-layer aerosols?"
    713783     aeronlay=.false.     ! default value
    714784     call getin_p("aeronlay",aeronlay)
    715      write(*,*)" aeronlay = ",aeronlay
    716 
    717      write(*,*)"Number of generic aerosols layers?"
     785     if (is_master) write(*,*)trim(rname)//": aeronlay = ",aeronlay
     786
     787     if (is_master) write(*,*)trim(rname)//&
     788       ": Number of generic aerosols layers?"
    718789     nlayaero=1     ! default value
    719790     call getin_p("nlayaero",nlayaero)
    720791     ! Avoid to allocate arrays of size 0
    721792     if (aeronlay .and. nlayaero.lt.1) then
     793       if (is_master) then
    722794       print*, " You are trying to set no generic aerosols..."
    723795       print*, " Set aeronlay=.false. instead ! I abort."
    724        call abort
     796       endif
     797       call abort_physic(rname,"no generic aerosols...",1)
    725798     endif
    726799     if (.not. aeronlay) nlayaero=1
    727      write(*,*)" nlayaero = ",nlayaero
     800     if (is_master) write(*,*)trim(rname)//": nlayaero = ",nlayaero
    728801
    729802     ! This is necessary, we just set the number of aerosol layers
     
    739812     IF(.NOT.ALLOCATED(optprop_aeronlay_vis)) ALLOCATE(optprop_aeronlay_vis(nlayaero))     
    740813
    741      write(*,*)"Generic n-layer aerosols: Optical depth at reference wavelenght"
     814     if (is_master) write(*,*)trim(rname)//&
     815       ": Generic n-layer aerosols: Optical depth at reference wavelenght"
    742816     aeronlay_tauref=1.0E-1
    743817     call getin_p("aeronlay_tauref",aeronlay_tauref)
    744      write(*,*)" aeronlay_tauref = ",aeronlay_tauref
    745 
    746      write(*,*)"Generic n-layer aerosols: Reference wavelenght for optical depths (m)"
     818     if (is_master) write(*,*)trim(rname)//&
     819       ": aeronlay_tauref = ",aeronlay_tauref
     820
     821     if (is_master) write(*,*)trim(rname)//&
     822       ": Generic n-layer aerosols: Reference wavelenght for optical depths (m)"
    747823     aeronlay_lamref=0.6E-6
    748824     call getin_p("aeronlay_lamref",aeronlay_lamref)
    749      write(*,*)" aeronlay_lamref = ",aeronlay_lamref
    750 
    751      write(*,*)"Generic n-layer aerosols: Vertical profile choice : &
    752                      (1) Tau btwn ptop and pbot follows atm. scale height &
    753                  or  (2) Tau above pbot follows its own scale height"
     825     if (is_master) write(*,*)trim(rname)//&
     826       ": aeronlay_lamref = ",aeronlay_lamref
     827
     828     if (is_master) then
     829       write(*,*)trim(rname)//&
     830       ": Generic n-layer aerosols: Vertical profile choice : "
     831       write(*,*)trim(rname)//&
     832       "             (1) Tau btwn ptop and pbot follows atm. scale height"
     833       write(*,*)trim(rname)//&
     834       "         or  (2) Tau above pbot follows its own scale height"
     835     endif
    754836     aeronlay_choice=1
    755837     call getin_p("aeronlay_choice",aeronlay_choice)
    756      write(*,*)" aeronlay_choice = ",aeronlay_choice
    757 
    758      write(*,*)"Generic n-layer aerosols: bottom pressures (Pa)"
     838     if (is_master) write(*,*)trim(rname)//&
     839       ": aeronlay_choice = ",aeronlay_choice
     840
     841     if (is_master) write(*,*)trim(rname)//&
     842       ": Generic n-layer aerosols: bottom pressures (Pa)"
    759843     aeronlay_pbot=2000.0
    760844     call getin_p("aeronlay_pbot",aeronlay_pbot)
    761      write(*,*)" aeronlay_pbot = ",aeronlay_pbot
    762 
    763      write(*,*)"Generic n-layer aerosols: (if choice=1) Top pressures (Pa) "
     845     if (is_master) write(*,*)trim(rname)//": aeronlay_pbot = ",aeronlay_pbot
     846
     847     if (is_master) write(*,*)trim(rname)//&
     848       ": Generic n-layer aerosols: (if choice=1) Top pressures (Pa) "
    764849     aeronlay_ptop=300000.0
    765850     call getin_p("aeronlay_ptop",aeronlay_ptop)
    766      write(*,*)" aeronlay_ptop = ",aeronlay_ptop
    767 
    768      write(*,*)"Generic n-layer aerosols: (if choice=2) Scale height / atm. scale height"
     851     if (is_master) write(*,*)trim(rname)//": aeronlay_ptop = ",aeronlay_ptop
     852
     853     if (is_master) write(*,*)trim(rname)//&
     854       ": Generic n-layer aerosols: (if choice=2) Scale height / atm. scale height"
    769855     aeronlay_sclhght=0.2
    770856     call getin_p("aeronlay_sclhght",aeronlay_sclhght)
    771      write(*,*)" aeronlay_sclhght = ",aeronlay_sclhght
    772 
    773      write(*,*)"Generic n-layer aerosols: particles effective radii (m)"
     857     if (is_master) write(*,*)trim(rname)//&
     858       ": aeronlay_sclhght = ",aeronlay_sclhght
     859
     860     if (is_master) write(*,*)trim(rname)//&
     861       ": Generic n-layer aerosols: particles effective radii (m)"
    774862     aeronlay_size=1.e-6
    775863     call getin_p("aeronlay_size",aeronlay_size)
    776      write(*,*)" aeronlay_size = ",aeronlay_size
    777 
    778      write(*,*)"Generic n-layer aerosols: particles radii effective variance"
     864     if (is_master) write(*,*)trim(rname)//": aeronlay_size = ",aeronlay_size
     865
     866     if (is_master) write(*,*)trim(rname)//&
     867       ": Generic n-layer aerosols: particles radii effective variance"
    779868     aeronlay_nueff=0.1
    780869     call getin_p("aeronlay_nueff",aeronlay_nueff)
    781      write(*,*)" aeronlay_nueff = ",aeronlay_nueff
    782 
    783      write(*,*)"Generic n-layer aerosols: VIS optical properties file"
     870     if (is_master) write(*,*)trim(rname)//": aeronlay_nueff = ",aeronlay_nueff
     871
     872     if (is_master) write(*,*)trim(rname)//&
     873       ": Generic n-layer aerosols: VIS optical properties file"
    784874     optprop_aeronlay_vis = 'optprop_saturn_vis_n20.dat'
    785875     call getin_p("optprop_aeronlay_vis",optprop_aeronlay_vis)
    786      write(*,*)" optprop_aeronlay_vis = ",optprop_aeronlay_vis
    787 
    788      write(*,*)"Generic n-layer aerosols: IR optical properties file"
     876     if (is_master) write(*,*)trim(rname)//&
     877       ": optprop_aeronlay_vis = ",optprop_aeronlay_vis
     878
     879     if (is_master) write(*,*)trim(rname)//&
     880     ": Generic n-layer aerosols: IR optical properties file"
    789881     optprop_aeronlay_ir = 'optprop_saturn_ir_n20.dat'
    790882     call getin_p("optprop_aeronlay_ir",optprop_aeronlay_ir)
    791      write(*,*)" optprop_aeronlay_ir = ",optprop_aeronlay_ir
     883     if (is_master) write(*,*)trim(rname)//&
     884       ": optprop_aeronlay_ir = ",optprop_aeronlay_ir
    792885     
    793886
    794887!=================================
    795888
    796      write(*,*)"Cloud pressure level (with kastprof only):"
     889     if (is_master) write(*,*)trim(rname)//&
     890       ": Cloud pressure level (with kastprof only):"
    797891     cloudlvl=0. ! default value
    798892     call getin_p("cloudlvl",cloudlvl)
    799      write(*,*)" cloudlvl = ",cloudlvl
    800 
    801      write(*,*)"Is the variable gas species radiatively active?"
     893     if (is_master) write(*,*)trim(rname)//": cloudlvl = ",cloudlvl
     894
     895     if (is_master) write(*,*)trim(rname)//&
     896       ": Is the variable gas species radiatively active?"
    802897     Tstrat=167.0
    803898     varactive=.false.
    804899     call getin_p("varactive",varactive)
    805      write(*,*)" varactive = ",varactive
    806 
    807      write(*,*)"Is the variable gas species distribution set?"
     900     if (is_master) write(*,*)trim(rname)//": varactive = ",varactive
     901
     902     if (is_master) write(*,*)trim(rname)//&
     903       ": Is the variable gas species distribution set?"
    808904     varfixed=.false.
    809905     call getin_p("varfixed",varfixed)
    810      write(*,*)" varfixed = ",varfixed
    811 
    812      write(*,*)"What is the saturation % of the variable species?"
     906     if (is_master) write(*,*)trim(rname)//": varfixed = ",varfixed
     907
     908     if (is_master) write(*,*)trim(rname)//&
     909       ": What is the saturation % of the variable species?"
    813910     satval=0.8
    814911     call getin_p("satval",satval)
    815      write(*,*)" satval = ",satval
     912     if (is_master) write(*,*)trim(rname)//": satval = ",satval
    816913
    817914
     
    819916! if varactive, then varfixed should be false
    820917     if (varactive.and.varfixed) then
    821        print*,'if varactive, varfixed must be OFF!'
    822        stop
    823      endif
    824 
    825      write(*,*) "Gravitationnal sedimentation ?"
     918       call abort_physic(rname,'if varactive, varfixed must be OFF!',1)
     919     endif
     920
     921     if (is_master) write(*,*)trim(rname)//": Gravitationnal sedimentation ?"
    826922     sedimentation=.false. ! default value
    827923     call getin_p("sedimentation",sedimentation)
    828      write(*,*) " sedimentation = ",sedimentation
    829 
    830      write(*,*) "Compute water cycle ?"
     924     if (is_master) write(*,*)trim(rname)//": sedimentation = ",sedimentation
     925
     926     if (is_master) write(*,*)trim(rname)//": Compute water cycle ?"
    831927     water=.false. ! default value
    832928     call getin_p("water",water)
    833      write(*,*) " water = ",water
     929     if (is_master) write(*,*)trim(rname)//": water = ",water
    834930         
    835931! Test of incompatibility:
    836932! if water is true, there should be at least a tracer
    837933     if (water.and.(.not.tracer)) then
    838         print*,'if water is ON, tracer must be ON too!'
    839         stop
    840      endif
    841 
    842      write(*,*) "Include water condensation ?"
     934        call abort_physic(rname,'if water is ON, tracer must be ON too!',1)
     935     endif
     936
     937     if (is_master) write(*,*)trim(rname)//": Include water condensation ?"
    843938     watercond=.false. ! default value
    844939     call getin_p("watercond",watercond)
    845      write(*,*) " watercond = ",watercond
     940     if (is_master) write(*,*)trim(rname)//": watercond = ",watercond
    846941
    847942! Test of incompatibility:
    848943! if watercond is used, then water should be used too
    849944     if (watercond.and.(.not.water)) then
    850         print*,'if watercond is used, water should be used too'
    851         stop
    852      endif
    853 
    854      write(*,*) "Include water precipitation ?"
     945        call abort_physic(rname,&
     946          'if watercond is used, water should be used too',1)
     947     endif
     948
     949     if (is_master) write(*,*)trim(rname)//": Include water precipitation ?"
    855950     waterrain=.false. ! default value
    856951     call getin_p("waterrain",waterrain)
    857      write(*,*) " waterrain = ",waterrain
    858 
    859      write(*,*) "Include surface hydrology ?"
     952     if (is_master) write(*,*)trim(rname)//": waterrain = ",waterrain
     953
     954     if (is_master) write(*,*)trim(rname)//": Include surface hydrology ?"
    860955     hydrology=.false. ! default value
    861956     call getin_p("hydrology",hydrology)
    862      write(*,*) " hydrology = ",hydrology
    863 
    864      write(*,*) "Evolve surface water sources ?"
     957     if (is_master) write(*,*)trim(rname)//": hydrology = ",hydrology
     958
     959     if (is_master) write(*,*)trim(rname)//": Evolve surface water sources ?"
    865960     sourceevol=.false. ! default value
    866961     call getin_p("sourceevol",sourceevol)
    867      write(*,*) " sourceevol = ",sourceevol
    868 
    869      write(*,*) "Ice evolution timestep ?"
     962     if (is_master) write(*,*)trim(rname)//": sourceevol = ",sourceevol
     963
     964     if (is_master) write(*,*)trim(rname)//": Ice evolution timestep ?"
    870965     icetstep=100.0 ! default value
    871966     call getin_p("icetstep",icetstep)
    872      write(*,*) " icetstep = ",icetstep
     967     if (is_master) write(*,*)trim(rname)//": icetstep = ",icetstep
    873968         
    874      write(*,*) "Spectral Dependant albedo ?"
     969     if (is_master) write(*,*)trim(rname)//": Spectral Dependant albedo ?"
    875970     albedo_spectral_mode=.false. ! default value
    876971     call getin_p("albedo_spectral_mode",albedo_spectral_mode)
    877      write(*,*) " albedo_spectral_mode = ",albedo_spectral_mode
    878 
    879      write(*,*) "Snow albedo ?"
    880      write(*,*) "If albedo_spectral_mode=.true., then this "
    881      write(*,*) "corresponds to the 0.5 microns snow albedo."
     972     if (is_master) write(*,*)trim(rname)//&
     973     ": albedo_spectral_mode = ",albedo_spectral_mode
     974
     975     if (is_master) then
     976       write(*,*)trim(rname)//": Snow albedo ?"
     977       write(*,*)trim(rname)//": If albedo_spectral_mode=.true., then this "
     978       write(*,*)trim(rname)//": corresponds to the 0.5 microns snow albedo."
     979     endif
    882980     albedosnow=0.5         ! default value
    883981     call getin_p("albedosnow",albedosnow)
    884      write(*,*) " albedosnow = ",albedosnow
     982     if (is_master) write(*,*)trim(rname)//": albedosnow = ",albedosnow
    885983         
    886      write(*,*) "Ocean albedo ?"
     984     if (is_master) write(*,*)trim(rname)//": Ocean albedo ?"
    887985     alb_ocean=0.07         ! default value
    888986     call getin_p("alb_ocean",alb_ocean)
    889      write(*,*) " alb_ocean = ",alb_ocean
     987     if (is_master) write(*,*)trim(rname)//": alb_ocean = ",alb_ocean
    890988         
    891      write(*,*) "CO2 ice albedo ?"
     989     if (is_master) write(*,*)trim(rname)//": CO2 ice albedo ?"
    892990     albedoco2ice=0.5       ! default value
    893991     call getin_p("albedoco2ice",albedoco2ice)
    894      write(*,*) " albedoco2ice = ",albedoco2ice
    895 
    896      write(*,*) "Maximum ice thickness ?"
     992     if (is_master) write(*,*)trim(rname)//": albedoco2ice = ",albedoco2ice
     993
     994     if (is_master) write(*,*)trim(rname)//": Maximum ice thickness ?"
    897995     maxicethick=2.0         ! default value
    898996     call getin_p("maxicethick",maxicethick)
    899      write(*,*) " maxicethick = ",maxicethick
    900 
    901      write(*,*) "Freezing point of seawater ?"
     997     if (is_master) write(*,*)trim(rname)//": maxicethick = ",maxicethick
     998
     999     if (is_master) write(*,*)trim(rname)//": Freezing point of seawater ?"
    9021000     Tsaldiff=-1.8          ! default value
    9031001     call getin_p("Tsaldiff",Tsaldiff)
    904      write(*,*) " Tsaldiff = ",Tsaldiff
    905 
    906      write(*,*) "Minimum eddy mix coeff in 1D ?"
     1002     if (is_master) write(*,*)trim(rname)//": Tsaldiff = ",Tsaldiff
     1003
     1004     if (is_master) write(*,*)trim(rname)//": Minimum eddy mix coeff in 1D ?"
    9071005     kmixmin=1.0e-2         ! default value
    9081006     call getin_p("kmixmin",kmixmin)
    909      write(*,*) " kmixmin = ",kmixmin
    910 
    911      write(*,*) "Does user want to force cpp and mugaz?"
     1007     if (is_master) write(*,*)trim(rname)//": kmixmin = ",kmixmin
     1008
     1009     if (is_master) write(*,*)trim(rname)//&
     1010       ": Does user want to force cpp and mugaz?"
    9121011     force_cpp=.false. ! default value
    9131012     call getin_p("force_cpp",force_cpp)
    914      write(*,*) " force_cpp = ",force_cpp
     1013     if (is_master) write(*,*)trim(rname)//": force_cpp = ",force_cpp
    9151014
    9161015     if (force_cpp) then
    9171016       mugaz = -99999.
    918        PRINT *,'MEAN MOLECULAR MASS in g mol-1 ?'
     1017       if (is_master) write(*,*)trim(rname)//&
     1018         ": MEAN MOLECULAR MASS in g mol-1 ?"
    9191019       call getin_p("mugaz",mugaz)
    9201020       IF (mugaz.eq.-99999.) THEN
    921            PRINT *, "mugaz must be set if force_cpp = T"
    922            STOP
     1021         call abort_physic(rname,"mugaz must be set if force_cpp = T",1)
    9231022       ELSE
    924            write(*,*) "mugaz=",mugaz
     1023         if (is_master) write(*,*)trim(rname)//": mugaz=",mugaz
    9251024       ENDIF
    9261025       cpp = -99999.
    927        PRINT *,'SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?'
     1026       if (is_master) write(*,*)trim(rname)//&
     1027         ": SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?"
    9281028       call getin_p("cpp",cpp)
    9291029       IF (cpp.eq.-99999.) THEN
     
    9311031           STOP
    9321032       ELSE
    933            write(*,*) "cpp=",cpp
     1033           if (is_master) write(*,*)trim(rname)//": cpp=",cpp
    9341034       ENDIF
    9351035     endif ! of if (force_cpp)
     
    9371037     call calc_cpp_mugaz
    9381038
    939      PRINT*,'--------------------------------------------'
    940      PRINT*
    941      PRINT*
     1039     if (is_master) then
     1040       PRINT*,'--------------------------------------------'
     1041       PRINT*
     1042       PRINT*
     1043     endif
    9421044  ELSE
    943      write(*,*)
    944      write(*,*) 'Cannot read file callphys.def. Is it here ?'
    945      stop
     1045     call abort_physic(rname,'Cannot read file callphys.def. Is it here ?',1)
    9461046  ENDIF ! of IF(iscallphys)
    9471047
    948   PRINT*
    949   PRINT*,'inifis: daysec',daysec
    950   PRINT*
    951   PRINT*,'inifis: The radiative transfer is computed:'
    952   PRINT*,'           each ',iradia,' physical time-step'
    953   PRINT*,'        or each ',iradia*dtphys,' seconds'
    954   PRINT*
    955 
     1048  if (is_master) then
     1049    PRINT*
     1050    PRINT*,'inifis: daysec',daysec
     1051    PRINT*
     1052    PRINT*,'inifis: The radiative transfer is computed:'
     1053    PRINT*,'           each ',iradia,' physical time-step'
     1054    PRINT*,'        or each ',iradia*dtphys,' seconds'
     1055    PRINT*
     1056  endif
    9561057
    9571058!-----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.