Ignore:
Timestamp:
Aug 24, 2007 3:10:38 PM (14 years ago)
Author:
letzel
Message:
  • Improved coupler: evaporation - salinity-flux coupling for humidity = .T.,

avoid MPI hangs when coupled runs terminate, add DOC/app/chapter_3.8;

  • Optional calculation of km and kh from initial TKE e_init;
  • Default initialization of km,kh = 0.00001 for ocean = .T.;
  • Allow data_output_pr= q, wq, w"q", w*q* for humidity = .T.;
  • Bugfix: Rayleigh damping for ocean fixed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/surface_coupler.f90

    r102 r108  
    44! Actual revisions:
    55! -----------------
     6! include latent heatflux and salinity flux for atmosphere runs with moisture
     7! modifications to terminate coupled runs
    68!
    79!
     
    2729    IMPLICIT NONE
    2830
    29     INTEGER ::  k
     31    INTEGER ::  i, j, k
    3032
    3133    REAL    ::  simulated_time_remote
     
    3638
    3739!
    38 !-- First exchange the current simulated time between the models,
     40!-- In case of model termination initiated by the remote model
     41!-- (terminate_coupled_remote > 0), initiate termination of the local model.
     42!-- The rest of the coupler must then be skipped because it would cause an MPI
     43!-- intercomminucation hang.
     44!-- If necessary, the coupler will be called at the beginning of the next
     45!-- restart run.
     46    CALL MPI_SENDRECV( terminate_coupled,        1, MPI_INTEGER, myid,  0, &
     47                       terminate_coupled_remote, 1, MPI_INTEGER, myid,  0, &
     48                       comm_inter, status, ierr )
     49    IF ( terminate_coupled_remote > 0 )  THEN
     50       IF ( myid == 0 )  THEN
     51          PRINT*, '+++ surface_coupler:'
     52          PRINT*, '    remote model "', TRIM( coupling_mode_remote ), &
     53               '" terminated'
     54          PRINT*, '    with terminate_coupled_remote = ', &
     55               terminate_coupled_remote
     56          PRINT*, '    local model  "', TRIM( coupling_mode ), &
     57               '" has'
     58          PRINT*, '    terminate_coupled = ', &
     59               terminate_coupled
     60       ENDIF
     61       CALL local_stop
     62       RETURN
     63    ENDIF
     64!
     65!-- Exchange the current simulated time between the models,
    3966!-- currently just for testing
    4067    CALL MPI_SEND( simulated_time, 1, MPI_REAL, myid, 11, comm_inter, ierr )
     
    5885
    5986!
     87!--    Send humidity flux at bottom surface to the ocean model
     88       IF ( humidity )  THEN
     89          WRITE ( 9, * )  '*** send qsws to ocean'
     90          CALL local_flush( 9 )
     91          CALL MPI_SEND( qsws(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 13, &
     92               comm_inter, ierr )
     93          WRITE ( 9, * )  '    ready'
     94          CALL local_flush( 9 )
     95       ENDIF
     96
     97!
    6098!--    Receive temperature at the bottom surface from the ocean model
    6199       WRITE ( 9, * )  '*** receive pt from ocean'
    62100       CALL local_flush( 9 )
    63        CALL MPI_RECV( pt(0,nys-1,nxl-1), 1, type_xy, myid, 13, comm_inter, &
     101       CALL MPI_RECV( pt(0,nys-1,nxl-1), 1, type_xy, myid, 14, comm_inter, &
    64102                      status, ierr )
    65103       WRITE ( 9, * )  '    ready'
     
    70108       WRITE ( 9, * )  '*** send usws to ocean'
    71109       CALL local_flush( 9 )
    72        CALL MPI_SEND( usws(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 14, &
     110       CALL MPI_SEND( usws(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 15, &
    73111                      comm_inter, ierr )
    74112       WRITE ( 9, * )  '    ready'
     
    79117       WRITE ( 9, * )  '*** send vsws to ocean'
    80118       CALL local_flush( 9 )
    81        CALL MPI_SEND( vsws(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 15, &
     119       CALL MPI_SEND( vsws(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 16, &
    82120                      comm_inter, ierr )
    83121       WRITE ( 9, * )  '    ready'
     
    96134
    97135!
     136!--    Receive humidity flux from the atmosphere model (bottom)
     137!--    and add it to the heat flux at the sea surface (top)...
     138       IF ( humidity_remote )  THEN
     139          WRITE ( 9, * )  '*** receive qswst_remote from atmosphere'
     140          CALL local_flush( 9 )
     141          CALL MPI_RECV( qswst_remote(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, &
     142               13, comm_inter, status, ierr )
     143          WRITE ( 9, * )  '    ready'
     144          CALL local_flush( 9 )
     145
     146          tswst = tswst + qswst_remote * 2.2626108e6
     147          !latent heat of vaporization in m2/s2, or 540 cal/g, or 40.65 kJ/mol
     148!
     149!--    ...and convert it to a salinity flux at the sea surface (top)
     150!--       following Steinhorn (1991), JPO 21, pp. 1681-1683:
     151!--       S'w' = -S * evaporation / ( rho_water * ( 1 - S ) )
     152          saswst = -1.0 * sa(nzt,:,:) * qswst_remote /  &
     153               ( rho(nzt,:,:) * ( 1.0 - sa(nzt,:,:) ) )
     154       ENDIF
     155
     156!
    98157!--    Adjust the kinematic heat flux with respect to ocean density
    99158!--    (constants are the specific heat capacities for air and water)
    100        tswst = tswst / rho_surface * 1005.0 / 4218.0
     159       tswst = tswst / rho(nzt,:,:) * 1005.0 / 4218.0
    101160
    102161!
     
    104163       WRITE ( 9, * )  '*** send pt to atmosphere'
    105164       CALL local_flush( 9 )
    106        CALL MPI_SEND( pt(nzt,nys-1,nxl-1), 1, type_xy, myid, 13, comm_inter, &
     165       CALL MPI_SEND( pt(nzt,nys-1,nxl-1), 1, type_xy, myid, 14, comm_inter, &
    107166                      ierr )
    108167       WRITE ( 9, * )  '    ready'
     
    114173       WRITE ( 9, * )  '*** receive uswst from atmosphere'
    115174       CALL local_flush( 9 )
    116        CALL MPI_RECV( uswst(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 14, &
     175       CALL MPI_RECV( uswst(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 15, &
    117176                      comm_inter, status, ierr )
    118177       WRITE ( 9, * )  '    ready'
     
    124183       WRITE ( 9, * )  '*** receive vswst from atmosphere'
    125184       CALL local_flush( 9 )
    126        CALL MPI_RECV( vswst(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 15, &
     185       CALL MPI_RECV( vswst(nys-1,nxl-1), ngp_xy, MPI_REAL, myid, 16, &
    127186                      comm_inter, status, ierr )
    128187       WRITE ( 9, * )  '    ready'
     
    131190!
    132191!--    Adjust the momentum fluxes with respect to ocean density
    133        uswst = uswst / rho_surface
    134        vswst = vswst / rho_surface
     192       uswst = uswst / rho(nzt,:,:)
     193       vswst = vswst / rho(nzt,:,:)
    135194
    136195    ENDIF
Note: See TracChangeset for help on using the changeset viewer.