New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 1200 for trunk/AGRIF/AGRIF_FILES/modbc.F – NEMO

Ignore:
Timestamp:
2008-09-24T15:05:20+02:00 (16 years ago)
Author:
rblod
Message:

Adapt Agrif to the new SBC and correct several bugs for agrif (restart writing and reading), see ticket #133
Note : this fix does not work yet on NEC computerq (sxf90/360)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AGRIF/AGRIF_FILES/modbc.F

    r898 r1200  
    4141C 
    4242C 
     43       
    4344C 
    4445C     ************************************************************************** 
     
    4748C  
    4849      Subroutine Agrif_Interp_bc_1d(TypeInterp,parent,child,tab,deb,fin, 
    49      &                              weight,pweight)             
     50     &                              weight,pweight,procname) 
    5051C 
    5152CCC   Description: 
    5253CCC   Subroutine to calculate the boundary conditions on a fine grid for a 1D  
    53 CCC   grid variable. 
    54 C 
    55 C     Declarations: 
    56 C       
    57        
    58 C 
    59 C     Arguments       
    60       INTEGER,DIMENSION(6,6) :: TypeInterp    ! TYPE of interpolation 
    61                                             ! (linear,...) 
    62       TYPE(AGRIF_PVariable) :: parent       ! Variable on the parent grid 
    63       TYPE(AGRIF_PVariable) :: child        ! Variable on the child grid 
    64       TYPE(AGRIF_PVariable) :: childtemp    ! Temporary variable on the child  
    65                                             ! grid 
    66       INTEGER :: deb,fin                    ! Positions of the  interpolations  
    67       REAL, DIMENSION( 
    68      &    lbound(child%var%array1,1):ubound(child%var%array1,1) 
    69      &    ), Target :: tab ! Values of the grid variable 
    70       LOGICAL :: pweight                    ! Indicates if weight is used for   
    71                                             ! the temporal interpolation  
    72       REAL :: weight                        ! Coefficient for the time  
    73                                             ! interpolation 
    74 C 
    75 C 
    76 C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid 
    77 C     variable.   
    78 C 
    79       allocate(childtemp % var)   
    80 C 
    81       childtemp % var % root_var => child % var % root_var 
    82 C       
    83 C     Values of the grid variable 
    84       childtemp % var % array1 => tab   
    85 C 
    86 C     Temporary results for the time interpolation before and after the space  
    87 C     interpolation  
    88       childtemp % var % oldvalues2D => child % var % oldvalues2D 
    89 C  
    90 C     Index indicating if a space interpolation is necessary 
    91       childtemp % var % interpIndex => child % var % interpIndex        
    92       childtemp % var % Interpolationshouldbemade =  
    93      &                 child % var % Interpolationshouldbemade   
    94       childtemp % var % list_interp => child % var% list_interp           
    95 C 
    96 C     Call to the procedure for the calculations of the boundary conditions 
    97       Call Agrif_CorrectVariable 
    98      &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight) 
    99 C 
    100       child % var % oldvalues2D => childtemp % var % oldvalues2D 
    101       child % var % list_interp => childtemp % var %list_interp       
    102 C       
    103       deallocate(childtemp % var) 
    104 C 
    105 C        
    106       End Subroutine Agrif_Interp_bc_1D 
    107 C 
    108 C 
    109 C 
    110 C     ************************************************************************** 
    111 CCC   Subroutine Agrif_Interp_bc_2d 
    112 C     ************************************************************************** 
    113 C  
    114       Subroutine Agrif_Interp_bc_2d(TypeInterp,parent,child,tab,deb,fin, 
    115      &                              weight,pweight,procname) 
    116 C 
    117 CCC   Description: 
    118 CCC   Subroutine to calculate the boundary conditions on a fine grid for a 2D  
    11954CCC   grid variable. 
    12055C 
     
    13570                                            ! done on the fine grid  
    13671      REAL, DIMENSION( 
    137      &         lbound(child%var%array2,1): ubound(child%var%array2,1), 
    138      &         lbound(child%var%array2,2): ubound(child%var%array2,2)),  
    139      &         Target :: tab ! Values of the grid variable 
     72     &         child%var%lb(1):child%var%ub(1)  
     73     &    ), Target :: tab ! Values of the grid variable 
    14074      LOGICAL :: pweight                    ! Indicates if weight is used for   
    14175                                            ! the temporal interpolation  
     
    15286C       
    15387C     Values of the grid variable 
    154       childtemp % var % array2 => tab   
     88      childtemp % var % array1 => tab   
    15589C 
    15690C     Temporary results for the time interpolation before and after the space  
     
    16296      childtemp % var % Interpolationshouldbemade =  
    16397     &                 child % var % Interpolationshouldbemade    
    164       childtemp % var % list_interp => child % var% list_interp     
     98      childtemp % var % list_interp => child % var% list_interp  
     99       
     100      childtemp % var% lb = child % var % lb 
     101      childtemp % var% ub = child % var % ub          
     102C 
     103C     Call to the procedure for the calculations of the boundary conditions 
     104      IF (present(procname)) THEN 
     105      Call Agrif_CorrectVariable 
     106     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight,procname) 
     107      ELSE 
     108      Call Agrif_CorrectVariable 
     109     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight) 
     110      ENDIF 
     111 
     112C    
     113      child % var % oldvalues2D => childtemp % var % oldvalues2D 
     114      child % var % list_interp => childtemp % var %list_interp 
     115C          
     116      deallocate(childtemp % var) 
     117C 
     118C        
     119      End Subroutine Agrif_Interp_bc_1D 
     120C 
     121       
     122C 
     123C 
     124C 
     125C     ************************************************************************** 
     126CCC   Subroutine Agrif_Interp_bc_2d 
     127C     ************************************************************************** 
     128C  
     129      Subroutine Agrif_Interp_bc_2d(TypeInterp,parent,child,tab,deb,fin, 
     130     &                              weight,pweight,procname) 
     131C 
     132CCC   Description: 
     133CCC   Subroutine to calculate the boundary conditions on a fine grid for a 2D  
     134CCC   grid variable. 
     135C 
     136C     Declarations: 
     137C       
     138       
     139C 
     140C     Arguments       
     141      External :: procname 
     142      Optional :: procname 
     143      INTEGER,DIMENSION(6,6) :: TypeInterp    ! TYPE of interpolation (linear,  
     144                                            ! lagrange, spline, ... ) 
     145      TYPE(AGRIF_PVariable) :: parent       ! Variable on the parent grid 
     146      TYPE(AGRIF_PVariable) :: child        ! Variable on the child grid 
     147      TYPE(AGRIF_PVariable) :: childtemp    ! Temporary variable on the child  
     148                                            ! grid 
     149      INTEGER :: deb,fin                    ! Positions where interpolations are 
     150                                            ! done on the fine grid  
     151      REAL, DIMENSION( 
     152     &         child%var%lb(1):child%var%ub(1), 
     153     &         child%var%lb(2):child%var%ub(2)  
     154     &    ), Target :: tab ! Values of the grid variable 
     155      LOGICAL :: pweight                    ! Indicates if weight is used for   
     156                                            ! the temporal interpolation  
     157      REAL :: weight                        ! Coefficient for the time  
     158                                            ! interpolation 
     159C 
     160C 
     161C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid 
     162C     variable.    
     163C 
     164      allocate(childtemp % var)   
     165C 
     166      childtemp % var % root_var => child % var % root_var 
     167C       
     168C     Values of the grid variable 
     169      childtemp % var % array2 => tab   
     170C 
     171C     Temporary results for the time interpolation before and after the space  
     172C     interpolation  
     173      childtemp % var % oldvalues2D => child % var % oldvalues2D 
     174C  
     175C     Index indicating if a space interpolation is necessary 
     176      childtemp % var % interpIndex => child % var % interpIndex        
     177      childtemp % var % Interpolationshouldbemade =  
     178     &                 child % var % Interpolationshouldbemade    
     179      childtemp % var % list_interp => child % var% list_interp  
     180       
     181      childtemp % var% lb = child % var % lb 
     182      childtemp % var% ub = child % var % ub          
    165183C 
    166184C     Call to the procedure for the calculations of the boundary conditions 
     
    211229                                            ! are done on the fine grid  
    212230      REAL, DIMENSION( 
    213      &         lbound(child%var%array3,1):ubound(child%var%array3,1), 
    214      &         lbound(child%var%array3,2):ubound(child%var%array3,2), 
    215      &         lbound(child%var%array3,3):ubound(child%var%array3,3) 
     231     &         child%var%lb(1):child%var%ub(1), 
     232     &         child%var%lb(2):child%var%ub(2), 
     233     &         child%var%lb(3):child%var%ub(3) 
    216234     &         ), Target :: tab ! Values of the grid variable 
    217235      LOGICAL :: pweight                    ! Indicates if weight is used for  
     
    239257      childtemp % var % Interpolationshouldbemade =  
    240258     &                 child % var % Interpolationshouldbemade  
    241       childtemp % var % list_interp => child % var% list_interp            
     259      childtemp % var % list_interp => child % var% list_interp  
     260       
     261      childtemp % var% lb = child % var % lb 
     262      childtemp % var% ub = child % var % ub 
    242263C 
    243264C     Call to the procedure for the calculations of the boundary conditions      
     
    288309                                              ! are done on the fine grid  
    289310      REAL, DIMENSION( 
    290      &        lbound(child%var%array4,1):ubound(child%var%array4,1), 
    291      &        lbound(child%var%array4,2):ubound(child%var%array4,2), 
    292      &        lbound(child%var%array4,3):ubound(child%var%array4,3), 
    293      &        lbound(child%var%array4,4):ubound(child%var%array4,4) 
     311     &         child%var%lb(1):child%var%ub(1), 
     312     &         child%var%lb(2):child%var%ub(2), 
     313     &         child%var%lb(3):child%var%ub(3), 
     314     &         child%var%lb(4):child%var%ub(4) 
    294315     &        ), Target :: tab ! Values of the grid variable 
    295316      LOGICAL :: pweight                      ! Indicates if weight is used for  
     
    317338      childtemp % var % Interpolationshouldbemade =  
    318339     &                 child % var % Interpolationshouldbemade   
    319       childtemp % var % list_interp => child % var% list_interp           
     340      childtemp % var % list_interp => child % var% list_interp  
     341       
     342      childtemp % var% lb = child % var % lb 
     343      childtemp % var% ub = child % var % ub                
    320344C 
    321345C     Call to the procedure for the calculations of the boundary conditions 
     
    365389                                              ! are done on the fine grid  
    366390      REAL, DIMENSION( 
    367      &         lbound(child%var%array5,1):ubound(child%var%array5,1), 
    368      &         lbound(child%var%array5,2):ubound(child%var%array5,2), 
    369      &         lbound(child%var%array5,3):ubound(child%var%array5,3), 
    370      &         lbound(child%var%array5,4):ubound(child%var%array5,4), 
    371      &         lbound(child%var%array5,5):ubound(child%var%array5,5) 
     391     &         child%var%lb(1):child%var%ub(1), 
     392     &         child%var%lb(2):child%var%ub(2), 
     393     &         child%var%lb(3):child%var%ub(3), 
     394     &         child%var%lb(4):child%var%ub(4), 
     395     &         child%var%lb(5):child%var%ub(5) 
    372396     &         ), Target :: tab ! Values of the grid variable 
    373397      LOGICAL :: pweight                      ! Indicates if weight is used for  
     
    395419      childtemp % var % Interpolationshouldbemade =  
    396420     &                 child % var % Interpolationshouldbemade  
    397       childtemp % var % list_interp => child % var% list_interp            
     421      childtemp % var % list_interp => child % var% list_interp   
     422       
     423      childtemp % var% lb = child % var % lb 
     424      childtemp % var% ub = child % var % ub 
     425                      
    398426C 
    399427C     Call to the procedure for the calculations of the boundary conditions   
     
    442470                                              ! are done on the fine grid  
    443471      REAL, DIMENSION( 
    444      &         lbound(child%var%array6,1):ubound(child%var%array6,1), 
    445      &         lbound(child%var%array6,2):ubound(child%var%array6,2), 
    446      &         lbound(child%var%array6,3):ubound(child%var%array6,3), 
    447      &         lbound(child%var%array6,4):ubound(child%var%array6,4), 
    448      &         lbound(child%var%array6,5):ubound(child%var%array6,5), 
    449      &         lbound(child%var%array6,6):ubound(child%var%array6,6) 
     472     &         child%var%lb(1):child%var%ub(1), 
     473     &         child%var%lb(2):child%var%ub(2), 
     474     &         child%var%lb(3):child%var%ub(3), 
     475     &         child%var%lb(4):child%var%ub(4), 
     476     &         child%var%lb(5):child%var%ub(5), 
     477     &         child%var%lb(6):child%var%ub(6) 
    450478     &         ), Target :: tab ! Values of the grid variable 
    451479      LOGICAL :: pweight                      ! Indicates if weight is used for  
     
    473501      childtemp % var % Interpolationshouldbemade =  
    474502     &                 child % var % Interpolationshouldbemade  
    475       childtemp % var % list_interp => child % var% list_interp            
     503      childtemp % var % list_interp => child % var% list_interp   
     504       
     505      childtemp % var% lb = child % var % lb 
     506      childtemp % var% ub = child % var % ub                
    476507C 
    477508C     Call to the procedure for the calculations of the boundary conditions 
     
    626657          case('N') ! No space DIMENSION       
    627658C 
    628             select case (nbdim)  
    629 C       
    630               case(1) 
    631                 nbtab_Child(n) = SIZE(child % var % array1,n) - 1 
    632                 pttab_Child(n) = lbound(child % var % array1,n) 
    633               case(2) 
    634                 nbtab_Child(n) = SIZE(child % var % array2,n) - 1 
    635                 pttab_Child(n) = lbound(child % var % array2,n) 
    636               case(3) 
    637                 nbtab_Child(n) = SIZE(child % var % array3,n) - 1 
    638                 pttab_Child(n) = lbound(child % var % array3,n)   
    639               case(4) 
    640                 nbtab_Child(n) = SIZE(child % var % array4,n) - 1 
    641                 pttab_Child(n) = lbound(child % var % array4,n) 
    642               case(5) 
    643                 nbtab_Child(n) = SIZE(child % var % array5,n) - 1 
    644                 pttab_Child(n) = lbound(child % var % array5,n)       
    645               case(6) 
    646                 nbtab_Child(n) = SIZE(child % var % array6,n) - 1 
    647                 pttab_Child(n) = lbound(child % var % array6,n)       
    648 C 
    649             end select 
     659            nbtab_Child(n) = child % var % ub(n) - child % var % lb(n) 
     660            pttab_Child(n) = child % var % lb(n) 
    650661C 
    651662C           No interpolation but only a copy of the values of the grid variable 
Note: See TracChangeset for help on using the changeset viewer.