Changeset 3503 for trunk


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

Pluto: surfini.F and soil_settings.F to .F90.
AF

Location:
trunk/LMDZ.PLUTO/libf/phypluto
Files:
2 moved

Legend:

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

    r3502 r3503  
    22
    33!      use netcdf
    4       use comsoil_h, only: layer, mlayer, inertiedat, volcapa,
    5      &                     lay1_soil, alpha_soil
    6       use iostart, only: inquire_field_ndims, get_var, get_field,
    7      &                   inquire_field, inquire_dimension_length
     4      use comsoil_h, only: layer, mlayer, inertiedat, volcapa,  &
     5                          lay1_soil, alpha_soil
     6      use iostart, only: inquire_field_ndims, get_var, get_field, &
     7                        inquire_field, inquire_dimension_length
     8      use mod_phys_lmdz_para, only : is_master
    89      implicit none
    910
     
    9293        allocate(oldmlayer(dimlen),stat=ierr)
    9394        if (ierr.ne.0) then
    94           write(*,*) 'soil_settings: failed allocation of oldmlayer!'
     95          if (is_master) write(*,*) 'soil_settings: failed allocation of oldmlayer!'
    9596          stop
    9697        endif
     
    105106          endif
    106107          ! check if loaded mid-layer depth value differs from current one
    107           if (abs((oldmlayer(1)-lay1_soil*alpha_soil**(-1./2.))/
    108      &             (lay1_soil*alpha_soil**(-1./2.))).gt.1.e-6) then
     108          if (abs((oldmlayer(1)-lay1_soil*alpha_soil**(-1./2.))/&
     109                  (lay1_soil*alpha_soil**(-1./2.))).gt.1.e-6) then
    109110            interpol=.true.
    110111          endif
     
    112113
    113114        if (interpol) then
    114           write(*,*)'soil_settings: Interpolation of soil temperature ',
    115      &              'and thermal inertia will be required!'
     115          if (is_master) write(*,*)'soil_settings: Interpolation of soil temperature ',  &
     116                   'and thermal inertia will be required!'
    116117        endif
    117118
     
    120121! 1.3 Read depths values or set olddepthdef flag and values
    121122      if (ndims.eq.1) then ! we know that there is none
    122         write(*,*)'soil_settings: no <soildepth> field expected'
    123         write(*,*)'building one mimicking old definitions'
     123        if (is_master) write(*,*)'soil_settings: no <soildepth> field expected'
     124        if (is_master) write(*,*)'building one mimicking old definitions'
    124125        olddepthdef=.true.
    125126        interpol=.true.
     
    128129          allocate(oldmlayer(dimlen),stat=ierr)
    129130          if (ierr.ne.0) then
    130             write(*,*) 'soil_settings: failed allocation of oldmlayer!'
     131            if (is_master) write(*,*) 'soil_settings: failed allocation of oldmlayer!'
    131132            stop
    132133          endif
     
    140141          call get_var("soildepth",oldmlayer,found)
    141142          if (.not.found) then
    142             write(*,*)'soil_settings: Problem while reading <soildepth>'
     143            if (is_master) write(*,*)'soil_settings: Problem while reading <soildepth>'
    143144          endif
    144145        else ! put values in mlayer
    145146          call get_var("soildepth",mlayer,found)
    146           print*,"mlayer",mlayer
     147          if (is_master) print*,"mlayer",mlayer
    147148          if (.not.found) then
    148             write(*,*)'soil_settings: Problem while reading <soildepth>'
     149            if (is_master) write(*,*)'soil_settings: Problem while reading <soildepth>'
    149150          endif
    150151        endif !of if (interpol)
     
    165166      ! Check that these values are the same as those prescibed for mlayers
    166167      if ((abs(mlay1_soil-lay1_soil)/lay1_soil).gt.1.e-6) then
    167          write(*,*) "soil_settings error: mlay1_soil=",mlay1_soil
    168          write(*,*) " does not match comsoil_h lay1_soil=",lay1_soil
     168         if (is_master) write(*,*) "soil_settings error: mlay1_soil=",mlay1_soil
     169         if (is_master) write(*,*) " does not match comsoil_h lay1_soil=",lay1_soil
    169170         stop
    170171      endif
    171172      if ((abs(malpha-alpha_soil)/alpha_soil).gt.1.e-6) then
    172          write(*,*) "soil_settings error: malpha=",malpha
    173          write(*,*) " does not match comsoil_h alpha_soil=",alpha_soil
     173         if (is_master) write(*,*) "soil_settings error: malpha=",malpha
     174         if (is_master) write(*,*) " does not match comsoil_h alpha_soil=",alpha_soil
    174175         stop
    175176      endif
     
    186187
    187188      if (volcapa.le.0.0) then
    188         write(*,*)'soil_settings: Warning, volcapa = ',volcapa
    189         write(*,*)'               That doesn t seem right'
    190         write(*,*)'        Initializing Volumetric heat capacity to ',
    191      &             default_volcapa
     189        if (is_master) write(*,*)'soil_settings: Warning, volcapa = ',volcapa
     190        if (is_master) write(*,*)'               That doesn t seem right'
     191        if (is_master) write(*,*)'        Initializing Volumetric heat capacity to ',  &
     192                  default_volcapa
    192193        volcapa=default_volcapa
    193194      endif
     
    201202
    202203      if (ndims.eq.1) then ! "old 2D-surface" format
    203        write(*,*)'soil_settings: Thermal inertia is only given as surfac
    204      &e data!'
     204       if (is_master) write(*,*)'soil_settings: Thermal inertia is only given as surfac&
     205     e data!'
    205206       ! Read Surface thermal inertia
    206207       allocate(surfinertia(ngrid))
    207208       call get_field("inertiedat",surfinertia,found)
    208209       if (.not.found) then
    209          write(*,*) "soil_settings: Failed loading <inertiedat>"
     210         if (is_master) write(*,*) "soil_settings: Failed loading <inertiedat>"
    210211         call abort
    211212       endif
    212213
    213        write(*,*)' => Building soil thermal inertia (using reference sur
    214      &face thermal inertia)'
     214       if (is_master) write(*,*)' => Building soil thermal inertia (using reference sur&
     215     face thermal inertia)'
    215216       do iloop=1,nsoil
    216217         inertiedat(:,iloop)=surfinertia(:)
     
    223224           allocate(oldinertiedat(ngrid,dimlen),stat=ierr)
    224225           if (ierr.ne.0) then
    225             write(*,*) 'soil_settings: failed allocation of ',
    226      &                 'oldinertiedat!'
     226            if (is_master) write(*,*) 'soil_settings: failed allocation of ',  &
     227                      'oldinertiedat!'
    227228            stop
    228229           endif
     
    230231        call get_field("inertiedat",oldinertiedat,found)
    231232        if (.not.found) then
    232           write(*,*) "soil_settings: Failed loading <inertiedat>"
     233          if (is_master) write(*,*) "soil_settings: Failed loading <inertiedat>"
    233234          call abort
    234235        endif
     
    236237         call get_field("inertiedat",inertiedat,found)
    237238         if (.not.found) then
    238            write(*,*) "soil_settings: Failed loading <inertiedat>"
     239           if (is_master) write(*,*) "soil_settings: Failed loading <inertiedat>"
    239240           call abort
    240241         endif
     
    249250!      if (ierr.ne.nf90_noerr) then
    250251      if (.not.ok) then
    251         write(*,*)'soil_settings: Field <tsoil> not found!'
    252         write(*,*)' => Building <tsoil> from surface values <tsurf>'
     252        if (is_master) write(*,*)'soil_settings: Field <tsoil> not found!'
     253        if (is_master) write(*,*)' => Building <tsoil> from surface values <tsurf>'
    253254        do iloop=1,nsoil
    254255          tsoil(:,iloop)=tsurf(:)
     
    259260           allocate(oldtsoil(ngrid,dimlen),stat=ierr)
    260261           if (ierr.ne.0) then
    261              write(*,*) 'soil_settings: failed allocation of ',
    262      &                  'oldtsoil!'
     262             if (is_master) write(*,*) 'soil_settings: failed allocation of ', &
     263                       'oldtsoil!'
    263264             stop
    264265           endif
     
    266267         call get_field("tsoil",oldtsoil,found)
    267268         if (.not.found) then
    268            write(*,*) "soil_settings: Failed loading <tsoil>"
     269           if (is_master) write(*,*) "soil_settings: Failed loading <tsoil>"
    269270           call abort
    270271         endif
     
    272273         call get_field("tsoil",tsoil,found,timeindex=indextime)
    273274         if (.not.found) then
    274            write(*,*) "soil_settings: Failed loading <tsoil>"
     275           if (is_master) write(*,*) "soil_settings: Failed loading <tsoil>"
    275276           call abort
    276277         endif
     
    292293          ! build vertical coordinate
    293294          oldgrid(1)=0. ! ground
    294           oldgrid(2:dimlen+1)=oldmlayer(1:dimlen)*
    295      &                (inertiedat(ig,1)/volcapa)
     295          oldgrid(2:dimlen+1)=oldmlayer(1:dimlen)*&
     296                     (inertiedat(ig,1)/volcapa)
    296297          ! interpolate
    297298          call interp_line(oldgrid,oldval,dimlen+1,mlayer,newval,nsoil)
     
    308309
    309310      if (interpol) then
    310       write(*,*)'soil_settings: Vertical interpolation along new grid'
     311      if (is_master) write(*,*)'soil_settings: Vertical interpolation along new grid'
    311312      ! interpolate soil temperatures and thermal inertias
    312313        if (.not.allocated(oldgrid)) then
     
    351352! ----------------------------------------------------------------------
    352353
    353       write(*,*)
    354       write(*,*)'Soil volumetric heat capacity:',volcapa
     354      if (is_master) write(*,*)
     355      if (is_master) write(*,*)'Soil volumetric heat capacity:',volcapa
    355356
    356357      xmin = MINVAL(inertiedat)
    357358      xmax = MAXVAL(inertiedat)
    358       write(*,*)'Soil thermal inertia <inertiedat>:',xmin,xmax
     359      if (is_master) write(*,*)'Soil thermal inertia <inertiedat>:',xmin,xmax
    359360
    360361      xmin = 1.0E+20
     
    362363      xmin = MINVAL(tsoil)
    363364      xmax = MAXVAL(tsoil)
    364       write(*,*)'Soil temperature <tsoil>:',xmin,xmax
     365      if (is_master) write(*,*)'Soil temperature <tsoil>:',xmin,xmax
    365366      end
  • trunk/LMDZ.PLUTO/libf/phypluto/surfini.F90

    r3502 r3503  
    1       SUBROUTINE surfini(ngrid,nq,qsurf,albedo,albedo_bareground,
    2      &                   albedo_snow_SPECTV,albedo_n2_ice_SPECTV)
     1      SUBROUTINE surfini(ngrid,nq,qsurf,albedo,albedo_bareground,&
     2                        albedo_snow_SPECTV,albedo_n2_ice_SPECTV)
    33
    44      USE surfdat_h, only: albedodat
     
    1111
    1212
    13 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    14 cccccccccccccc                                                                 cccccccccccccc
    15 cccccccccccccc   Spectral Albedo Initialisation - Routine modified by MT2015.  cccccccccccccc
    16 cccccccccccccc                                                                 cccccccccccccc
    17 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     13!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     14!!!!!!!                                                                 !!!!!!!
     15!!!!!!!   Spectral Albedo Initialisation - Routine modified by MT2015.  !!!!!!!
     16!!!!!!!                                                                 !!!!!!!
     17!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1818
    1919
    20 c--------------------
    21 c   Declarations:
    22 c--------------------
     20!--------------------
     21!   Declarations:
     22!--------------------
    2323
    2424      INTEGER,INTENT(IN) :: ngrid
     
    3333      REAL :: min_albedo,max_albedo
    3434
    35 c=======================================================================
     35!=======================================================================
    3636
    3737      ! Step 1 : Initialisation of the Spectral Albedos.
Note: See TracChangeset for help on using the changeset viewer.