Ignore:
Timestamp:
May 21, 2020, 2:22:24 AM (5 years ago)
Author:
dubos
Message:

simple_physics : physics output with DYNAMICO, tested on Camelot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dynamico_lmdz/simple_physics/phyparam/DYNAMICO/icosa_phyparam_mod.F90

    r4237 r4240  
    44! FCM gets confused when external modules are USEd at module level
    55! => USE statements to DYNAMICO modules go into subroutines
     6 
     7  USE icosa, ONLY : t_field
    68
    79  IMPLICIT NONE
     
    1416  REAL, PARAMETER :: oneday = 86400. ! hard-coded                                                                                                                                                         
    1517  INTEGER, PARAMETER :: log_unit = 15
     18
     19  TYPE(t_field),POINTER :: f_write2d(:), f_write_llm(:), f_write_llmp1(:)
    1620
    1721  PUBLIC :: init_physics, physics
     
    4044      flush_plugin => flush_log_
    4145
     46      CALL init_plugin_writefield
     47
    4248      physics_log_level='INF'
    4349      CALL getin('physics_log_level', physics_log_level)
     
    94100      END DO
    95101
    96       IF(is_mpi_master) PRINT *, 'phyparam phi :', pphi(inout%ngrid/2+1, :)
     102!      IF(is_mpi_master) PRINT *, 'phyparam phi :', pphi(inout%ngrid/2+1, :)
    97103
    98104      CALL check_NaN('physics', 'ulon', inout%ulon)
     
    108114           &        inout%dulon, inout%dulat, inout%dtemp, dps)
    109115
    110       IF(is_mpi_master) PRINT *, 'phyparam dT :', inout%dtemp(inout%ngrid/2+1, :)
     116!      IF(is_mpi_master) PRINT *, 'phyparam dT :', inout%dtemp(inout%ngrid/2+1, :)
    111117
    112118      CALL check_NaN('physics', 'dulon', inout%dulon)
     
    140146      INTEGER(c_int), INTENT(IN), VALUE :: lev, taglen, buflen, bufsize
    141147      CHARACTER(KIND=c_char), INTENT(IN) :: tag(taglen), buf(buflen, bufsize)
     148
    142149      CHARACTER(buflen+1) :: line
    143       !    SUBROUTINE flush_log_(lev, tag, buf)
    144       !      INTEGER, INTENT(IN) :: lev
    145       !      CHARACTER(*), INTENT(IN) :: tag, buf(:)
    146150      CHARACTER(100) :: prefix
    147151      INTEGER :: i
     
    151155         DO i=1, bufsize
    152156            WRITE(line,*) buf(:,i)
    153             WRITE(log_unit,*) TRIM(prefix), TRIM(line)
     157            WRITE(log_unit,*) TRIM(prefix) // TRIM(line)
    154158         END DO
    155159         WRITE(log_unit, *) ''
     
    186190    END SUBROUTINE read_paramb
    187191
     192!--------------------------------------- writefield ------------------------------------
     193
     194    SUBROUTINE init_plugin_writefield
     195      USE icosa, ONLY : t_field, field_t, type_real, allocate_field, llm
     196      USE writefield_mod, ONLY : writefield1_plugin, writefield2_plugin
     197      CALL allocate_field(f_write2d,     field_t, type_real,        name='phyparam_write2d')
     198      CALL allocate_field(f_write_llm,   field_t, type_real, llm,   name='phyparam_write_llm')
     199      CALL allocate_field(f_write_llmp1, field_t, type_real, llm+1, name='phyparam_write_llmp1')
     200      writefield1_plugin => plugin_writefield1
     201    END SUBROUTINE init_plugin_writefield
     202
     203    SUBROUTINE plugin_writefield1(name,longname,unit, var)
     204      USE physics_interface_mod, ONLY : unpack_field, inout => physics_inout
     205      USE output_field_mod, ONLY : output_field
     206      CHARACTER(*), INTENT(IN) :: name, longname, unit
     207      REAL, INTENT(IN)         :: var(:)
     208      WRITELOG(*,*) TRIM(name), ' : ', TRIM(longname), MINVAL(var), MAXVAL(var), inout%it
     209      LOG_INFO('writefield1')
     210      CALL unpack_field(f_write2d, var)
     211      CALL output_field('phyparam_'//TRIM(name), f_write2d)
     212    END SUBROUTINE plugin_writefield1
     213
     214    SUBROUTINE plugin_writefield2(name,longname,unit, var)
     215      CHARACTER(*), INTENT(IN) :: name, longname, unit
     216      REAL, INTENT(IN)         :: var(:,:)
     217    END SUBROUTINE plugin_writefield2
     218
    188219END MODULE icosa_phyparam_mod
Note: See TracChangeset for help on using the changeset viewer.