FV3 Bundle
laplacian_2d.f90
Go to the documentation of this file.
1 ! (C) Copyright 2009-2016 ECMWF.
2 !
3 ! This software is licensed under the terms of the Apache Licence Version 2.0
4 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 ! In applying this licence, ECMWF does not waive the privileges and immunities
6 ! granted to it by virtue of its status as an intergovernmental organisation nor
7 ! does it submit to any jurisdiction.
8 
9 !> Horizontal Laplacian operator
10 
11 !> Nothing fancy here.
12 !! It's just the standard 5-point finite-difference Laplacian.
13 
14 subroutine laplacian_2d (x,del2x,nx,ny,deltax,deltay)
15 
16 !--- The 2d Laplacian
17 
18 use kinds
19 
20 implicit none
21 integer, intent(in) :: nx !< Zonal grid dimension
22 integer, intent(in) :: ny !< Meridional grid dimension
23 real(kind=kind_real), intent(in) :: x(nx,ny) !< Streamfunction
24 real(kind=kind_real), intent(out) :: del2x(nx,ny) !< Result of applying Laplacian to x
25 real(kind=kind_real), intent(in) :: deltax !< Zonal grid spacing (non-dimensional)
26 real(kind=kind_real), intent(in) :: deltay !< Meridional grid spacing (non-dimensional)
27 
28 !--- del-squared of the streamfunction (5-point laplacian)
29 
30 del2x(:,:) = -2.0_kind_real*( 1.0_kind_real/(deltax*deltax) &
31  +1.0_kind_real/(deltay*deltay))*x(:,:)
32 
33 del2x(1:nx-1,:) = del2x(1:nx-1,:) + (1.0_kind_real/(deltax*deltax))*x(2:nx ,:)
34 del2x(nx ,:) = del2x(nx ,:) + (1.0_kind_real/(deltax*deltax))*x(1 ,:)
35 del2x(2:nx ,:) = del2x(2:nx ,:) + (1.0_kind_real/(deltax*deltax))*x(1:nx-1,:)
36 del2x(1 ,:) = del2x(1 ,:) + (1.0_kind_real/(deltax*deltax))*x(nx ,:)
37 
38 del2x(:,1:ny-1) = del2x(:,1:ny-1) + (1.0_kind_real/(deltay*deltay))*x(:,2:ny )
39 del2x(:,2:ny ) = del2x(:,2:ny ) + (1.0_kind_real/(deltay*deltay))*x(:,1:ny-1)
40 
41 end subroutine laplacian_2d
subroutine laplacian_2d(x, del2x, nx, ny, deltax, deltay)
Horizontal Laplacian operator.