Changes between Version 1 and Version 2 of schwarz_lmdz


Ignore:
Timestamp:
07/23/19 16:31:39 (2 years ago)
Author:
snguyen
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • schwarz_lmdz

    v1 v2  
    33== Schwarz loop (similar to NEMO) == 
    44 
     5The schwarz loop is implemented in the `leapfrog_loc.F` procedure that is responsible for the time marching. 
    56 
     7As with NEMO there are three loops around the original time-stepping scheme of `leapfrog_loc.F`: 
     8* the outer loop increments counter `iswloop` with values : `1 to nsloops`. 
     9* the middle loop increments counter `kswr` with values : `1 to mswr`. 
     10* the inside loop increments counter `itau` with values : `(iswloop - 1) * ntsinswr to iswloop * ntsinswr` 
     11 
     12As for NEMO if you run a 5 day simulation with a coupling window of 1 day and a Schwarz iteration number of 6. You get `nsloops = 5` and `mswr = 6`. The value of `ntsinswr` depends on your time step. It is the number of dynamical time steps during a coupling window. 
     13 
     14The loop is implemented around the time stepping scheme. 
     15 
     16The beginning of the loops is before the `CONTINUE 1` command: 
     17{{{ 
     18c----------------------------------- 
     19c  Beginning of schwarz looping 
     20c----------------------------------- 
     21 
     22      iswloop = 1 
     23 
     24      swzloop: DO WHILE ( iswloop <= nsloops ) 
     25 
     26c$OMP MASTER 
     27      IF (mpi_rank==0) THEN 
     28         WRITE(lunout,*) 'leapfrog_loc' 
     29         WRITE(lunout,*) '*** Schwarz loops ***' 
     30         WRITE(lunout,*) 'iswloop = ',iswloop 
     31      ENDIF 
     32c$OMP END MASTER 
     33 
     34      kswr = 1 
     35 
     36      swzit: DO WHILE ( kswr <= mswr )  
     37 
     38c$OMP MASTER 
     39      IF (mpi_rank==0) THEN 
     40         WRITE(lunout,*) 'kswr = ',kswr 
     41      ENDIF 
     42c$OMP END MASTER 
     43 
     44      IF ( kswr == 1 ) THEN 
     45        CALL store_current_time_swz 
     46        CALL dynredem1_swz(vcov,ucov,teta,q,masse,ps,phis,p,pks,pk,pkf) 
     47        swz_store = .TRUE. 
     48      ELSE 
     49        CALL restore_current_time_swz 
     50        CALL dynetat0_swz(vcov,ucov,teta,q,masse,ps,phis,p,pks,pk,pkf) 
     51        swz_restore = .TRUE. 
     52      ENDIF 
     53 
     54      itau = (iswloop - 1) * ntsinswr    
     55 
     56c----------------------------------------------------------------------- 
     57c   Debut de l'integration temporelle: 
     58c   ---------------------------------- 
     59c et du parallelisme !! 
     60 
     61   1  CONTINUE ! Matsuno Forward step begins here 
     62}}} 
     63 
     64The end of the loops is after the test for MATSUNO/LEAPFROG vs PURE_MATSUNO method: 
     65{{{ 
     66      END IF ! of IF(.not.purmats) 
     67 
     68c------------------------------ 
     69cend of schwarz loop 
     70c------------------------------ 
     71 
     72      END DO swzit! kswr 
     73 
     74      iswloop = iswloop + 1 
     75 
     76      END DO swzloop! iswloop 
     77 
     78      call fin_swz_dyn ! deallocate schwarz dynamics pointers 
     79      call fin_swz_phy ! deallocate schwarz physics arrays 
     80}}} 
     81 
     82a condition to cycle the loop on `kswr` is added inside the MATSUNO/LEAPFROG condition: 
     83{{{ 
     84c----------------------------------------- 
     85c Test de la fin de la fenêtre de Schwarz 
     86c----------------------------------------- 
     87 
     88            IF ( itau == iswloop * ntsinswr .AND. 
     89     &         .NOT.(itau == itaufin .AND. kswr == mswr ) ) THEN 
     90              kswr = kswr + 1 
     91              CYCLE swzit 
     92            ENDIF 
     93 
     94c----------------------------------------------------------------------- 
     95c   gestion de l'integration temporelle: 
     96c   ------------------------------------ 
     97 
     98            IF( MOD(itau,iperiod).EQ.0 )    THEN 
     99                    GO TO 1 
     100            ELSE IF ( MOD(itau-1,iperiod). EQ. 0 ) THEN 
     101}}} 
     102 
     103It works only if the number of steps in the coupling windows is commensurate with the Matsuno steps frequency. 
     104 
     105The loop needs to initialise the Schwarz parameters be fore starting: 
     106{{{ 
     107c------------------------------------- 
     108c Initialization of schwarz parameters 
     109c------------------------------------- 
     110 
     111      CALL init_swz_dyn ! allocate schwarz dynamics pointers 
     112      CALL init_swz_phy ! allocate schwarz physics arrays 
     113 
     114!      ncplfrq  = 86400 
     115      ntsinswr = ncplfrq / dtvr 
     116      nsloops  = itaufin / ntsinswr 
     117 
     118c$OMP MASTER 
     119      IF (mpi_rank==0) THEN 
     120         WRITE(lunout,*) 'leapfrog_loc, ncplfrq  : ',ncplfrq 
     121         WRITE(lunout,*) '              ntsinswr : ',ntsinswr 
     122         WRITE(lunout,*) '              nsloops  : ',nsloops 
     123         WRITE(lunout,*) '              mswr     : ',mswr 
     124      ENDIF 
     125c$OMP END MASTER 
     126 
     127c----------------------------------- 
     128c  Beginning of schwarz looping 
     129c----------------------------------- 
     130 
     131      iswloop = 1 
     132}}} 
    6133 
    7134== coding details == 
    8135 
    9 == coupling == 
     136== coupling with OASIS == 
     137 
     138== validation procedure ==