Ignore:
Timestamp:
Jan 11, 2013, 10:19:19 AM (11 years ago)
Author:
Laurent Fairhead
Message:

Version testing basée sur la r1706


Testing release based on r1706

Location:
LMDZ5/branches/testing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/branches/testing

  • LMDZ5/branches/testing/libf/dyn3dmem/friction_loc.F

    r1669 r1707  
    66      USE parallel
    77      USE control_mod
     8#ifdef CPP_IOIPSL
     9      USE IOIPSL
     10#else
     11! if not using IOIPSL, we still need to use (a local version of) getin
     12      USE ioipsl_getincom
     13#endif
    814      IMPLICIT NONE
    915
    10 c=======================================================================
    11 c
    12 c
    13 c   Objet:
    14 c   ------
    15 c
    16 c  ***********
    17 c    Friction
    18 c  ***********
    19 c
    20 c=======================================================================
     16!=======================================================================
     17!
     18!   Friction for the Newtonian case:
     19!   --------------------------------
     20!    2 possibilities (depending on flag 'friction_type'
     21!     friction_type=0 : A friction that is only applied to the lowermost
     22!                       atmospheric layer
     23!     friction_type=1 : Friction applied on all atmospheric layer (but
     24!       (default)       with stronger magnitude near the surface; see
     25!                       iniacademic.F)
     26!=======================================================================
    2127
    2228#include "dimensions.h"
     
    2430#include "comgeom2.h"
    2531#include "comconst.h"
    26 
    27       REAL pdt
     32#include "iniprint.h"
     33#include "academic.h"
     34
     35! arguments:
     36      REAL,INTENT(inout) :: ucov( iip1,jjb_u:jje_u,llm )
     37      REAL,INTENT(inout) :: vcov( iip1,jjb_v:jje_v,llm )
     38      REAL,INTENT(in) :: pdt ! time step
     39
     40! local variables:
     41
    2842      REAL modv(iip1,jjb_u:jje_u),zco,zsi
    2943      REAL vpn,vps,upoln,upols,vpols,vpoln
    3044      REAL u2(iip1,jjb_u:jje_u),v2(iip1,jjb_v:jje_v)
    31       REAL ucov( iip1,jjb_u:jje_u,llm ),vcov( iip1,jjb_v:jje_v,llm )
    32       INTEGER  i,j
    33       REAL cfric
    34       parameter (cfric=1.e-5)
     45      INTEGER  i,j,l
     46      REAL,PARAMETER :: cfric=1.e-5
     47      LOGICAL,SAVE :: firstcall=.true.
     48      INTEGER,SAVE :: friction_type=1
     49      CHARACTER(len=20) :: modname="friction_p"
     50      CHARACTER(len=80) :: abort_message
     51!$OMP THREADPRIVATE(firstcall,friction_type)
    3552      integer :: jjb,jje
    3653
    37 
     54!$OMP SINGLE
     55      IF (firstcall) THEN
     56        ! set friction type
     57        call getin("friction_type",friction_type)
     58        if ((friction_type.lt.0).or.(friction_type.gt.1)) then
     59          abort_message="wrong friction type"
     60          write(lunout,*)'Friction: wrong friction type',friction_type
     61          call abort_gcm(modname,abort_message,42)
     62        endif
     63        firstcall=.false.
     64      ENDIF
     65!$OMP END SINGLE COPYPRIVATE(friction_type,firstcall)
     66
     67      if (friction_type.eq.0) then ! friction on first layer only
     68!$OMP SINGLE
    3869c   calcul des composantes au carre du vent naturel
    3970      jjb=jj_begin
     
    138169         vcov(iip1,j,1)=vcov(1,j,1)
    139170      enddo
     171!$OMP END SINGLE
     172      endif ! of if (friction_type.eq.0)
     173
     174      if (friction_type.eq.1) then
     175       ! for ucov()
     176        jjb=jj_begin
     177        jje=jj_end
     178        if (pole_nord) jjb=jj_begin+1
     179        if (pole_sud) jje=jj_end-1
     180
     181!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
     182        do l=1,llm
     183          ucov(1:iip1,jjb:jje,l)=ucov(1:iip1,jjb:jje,l)*
     184     &                                  (1.-pdt*kfrict(l))
     185        enddo
     186!$OMP END DO NOWAIT
     187       
     188       ! for vcoc()
     189        jjb=jj_begin
     190        jje=jj_end
     191        if (pole_sud) jje=jj_end-1
     192       
     193!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
     194        do l=1,llm
     195          vcov(1:iip1,jjb:jje,l)=vcov(1:iip1,jjb:jje,l)*
     196     &                                  (1.-pdt*kfrict(l))
     197        enddo
     198!$OMP END DO
     199      endif ! of if (friction_type.eq.1)
    140200
    141201      RETURN
Note: See TracChangeset for help on using the changeset viewer.