source: trunk/src/shift_field.f90 @ 28

Last change on this file since 28 was 4, checked in by mlanger, 11 years ago
File size: 3.7 KB
Line 
1!**********************************************************************
2! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
3! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
4! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
5!                                                                     *
6! This file is part of FLEXPART.                                      *
7!                                                                     *
8! FLEXPART is free software: you can redistribute it and/or modify    *
9! it under the terms of the GNU General Public License as published by*
10! the Free Software Foundation, either version 3 of the License, or   *
11! (at your option) any later version.                                 *
12!                                                                     *
13! FLEXPART is distributed in the hope that it will be useful,         *
14! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
15! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
16! GNU General Public License for more details.                        *
17!                                                                     *
18! You should have received a copy of the GNU General Public License   *
19! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
20!**********************************************************************
21
22subroutine shift_field(field,nxf,nyf,nzfmax,nzf,nmax,n)
23  !                        i/o   i   i    i     i   i   i
24  !*****************************************************************************
25  !                                                                            *
26  !  This subroutine shifts global fields by nxshift grid cells, in order to   *
27  !  facilitate all sorts of nested wind fields, or output grids, which,       *
28  !  without shifting, would overlap with the domain "boundary".               *
29  !                                                                            *
30  !    Author: A. Stohl                                                        *
31  !                                                                            *
32  !    3 July 2002                                                             *
33  !                                                                            *
34  !*****************************************************************************
35  !                                                                            *
36  ! Variables:                                                                 *
37  !                                                                            *
38  ! Constants:                                                                 *
39  !                                                                            *
40  !*****************************************************************************
41
42  use par_mod
43
44  implicit none
45
46  integer :: nxf,nyf,nzf,n,ix,jy,kz,ixs,nzfmax,nmax
47  real :: field(0:nxmax-1,0:nymax-1,nzfmax,nmax),xshiftaux(0:nxmax-1)
48
49  ! Loop over y and z
50  !******************
51
52  do kz=1,nzf
53    do jy=0,nyf-1
54
55  ! Shift the data
56  !***************
57
58      if (nxshift.ne.0) then
59        do ix=0,nxf-1
60          if (ix.ge.nxshift) then
61            ixs=ix-nxshift
62          else
63            ixs=nxf-nxshift+ix
64          endif
65          xshiftaux(ixs)=field(ix,jy,kz,n)
66        end do
67        do ix=0,nxf-1
68          field(ix,jy,kz,n)=xshiftaux(ix)
69        end do
70      endif
71
72  ! Repeat the westernmost grid cells at the easternmost domain "boundary"
73  !***********************************************************************
74
75      field(nxf,jy,kz,n)=field(0,jy,kz,n)
76    end do
77  end do
78
79end subroutine shift_field
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG