Commit 6c3e4078 authored by kb's avatar kb
Browse files

included calls for spatial varying An

parent adeb73e4
!$Id: m2d.F90,v 1.27 2009-05-07 13:16:10 bjb Exp $
!$Id: m2d.F90,v 1.28 2009-05-07 16:00:26 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -23,6 +23,8 @@
use time, only: julianday,secondsofday
use parameters, only: avmmol
use domain, only: imin,imax,jmin,jmax,az,au,av,H,HU,HV,min_depth
use domain, only: ilg,ihg,jlg,jhg
use domain, only: ill,ihl,jll,jhl
use domain, only: openbdy,z0_method,z0_const,z0
use halo_zones, only : update_2d_halo,wait_halo
use halo_zones, only : U_TAG,V_TAG,H_TAG
......@@ -125,15 +127,22 @@
select case (An_method)
case(0)
LEVEL2 'An_method=0 -> horizontal numerical diffusion not included'
An = _ZERO_
case(1)
LEVEL2 'An_method=1 -> Using constant horizontal numerical diffusion'
if (An_const .lt. _ZERO_) then
call getm_error("init_2d()", &
"Constant horizontal numerical diffusion <0");
else
An = An_const
end if
case(2)
LEVEL2 'An_method=2 -> Using space varying horizontal numerical diffusion'
LEVEL2 '.. will read An from An_file ',An_file
LEVEL2 '.. will read An from An_file ',trim(An_file)
stop 'not working properly yet'
call get_2d_field("test.nc","An",ilg,ihg,jlg,jhg,An(ill:ihl,jll:jhl))
call update_2d_halo(An,An,az,imin,jmin,imax,jmax,H_TAG)
call wait_halo(H_TAG)
case default
call getm_error("init_2d()", &
"A non valid An method has been chosen");
......@@ -193,20 +202,6 @@
zub=zub0
zvb=zvb0
! horizontal diffusion
if (An_method .eq. 0) then
An = _ZERO_
end if
if (An_method .eq. 1) then
An = An_const
end if
! TODO: We need to actually read in the data before we send to neighbors
if (An_method .eq. 2) then
call update_2d_halo(An,An,az,imin,jmin,imax,jmax,H_TAG)
call wait_halo(H_TAG)
end if
call depth_update()
#ifdef DEBUG
......@@ -280,7 +275,7 @@
#ifndef UV_ADV_DIRECT
call uv_advect()
if (Am .gt. _ZERO_ .or. An_method .gt. 0) then
call uv_diffusion(Am,An) ! Has to be called after uv_advect.
call uv_diffusion(Am,An_method,An) ! Has to be called after uv_advect.
end if
call mirror_bdy_2d(UEx,U_TAG)
call mirror_bdy_2d(VEx,V_TAG)
......
!$Id: uv_diffusion.F90,v 1.9 2009-05-07 13:16:10 bjb Exp $
!$Id: uv_diffusion.F90,v 1.10 2009-05-07 16:00:26 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -6,7 +6,7 @@
! !ROUTINE: uv_diffusion - 2D diffusion of momentum \label{sec-uv-diffusion}
!
! !INTERFACE:
subroutine uv_diffusion(Am,An)
subroutine uv_diffusion(Am,An_method,An)
!
! !DESCRIPTION:
!
......@@ -167,6 +167,7 @@
!
! !INPUT PARAMETERS:
REALTYPE, intent(in) :: Am
integer, intent(in) :: An_method
REALTYPE, intent(in) :: An(E2DFIELD)
!
! !INPUT/OUTPUT PARAMETERS:
......@@ -196,8 +197,9 @@
PP(i,j)=2.*Am*DYC*D(i,j) &
*(U(i,j)/DU(i,j)-U(i-1,j)/DU(i-1,j))/DXC
end if
! We could disable the following line entirely, if An_method.eq.0
PP(i,j)=PP(i,j)+An(i,j)*DYC*(U(i,j)-U(i-1,j))/DXC
if (An_method .gt. 0) then
PP(i,j)=PP(i,j)+An(i,j)*DYC*(U(i,j)-U(i-1,j))/DXC
end if
end if
end do
end do
......@@ -220,8 +222,9 @@
*((U(i,j+1)/DU(i,j+1)-U(i,j)/DU(i,j))/DYX &
+(V(i+1,j)/DV(i+1,j)-V(i,j)/DV(i,j))/DXX )
end if
! We could disable the following line entirely, if An_method.eq.0
PP(i,j)=PP(i,j)+An(i,j)*(U(i,j+1)-U(i,j))*DXX/DYX
if (An_method .gt. 0) then
PP(i,j)=PP(i,j)+An(i,j)*(U(i,j+1)-U(i,j))*DXX/DYX
end if
end if
end do
end do
......@@ -244,8 +247,9 @@
*((U(i,j+1)/DU(i,j+1)-U(i,j)/DU(i,j))/DYX &
+(V(i+1,j)/DV(i+1,j)-V(i,j)/DV(i,j))/DXX )
end if
! We could disable the following line entirely, if An_method.eq.0
PP(i,j)=PP(i,j)+An(i,j)*(V(i+1,j)-V(i,j))*DYX/DXX
if (An_method .gt. 0) then
PP(i,j)=PP(i,j)+An(i,j)*(V(i+1,j)-V(i,j))*DYX/DXX
end if
end if
end do
end do
......@@ -267,8 +271,9 @@
PP(i,j)=2.*Am*DXC*D(i,j) &
*(V(i,j)/DV(i,j)-V(i,j-1)/DV(i,j-1))/DYC
end if
! We could disable the following line entirely, if An_method.eq.0
PP(i,j)=PP(i,j)+An(i,j)*DXC*(V(i,j)-V(i,j-1))/DYC
if (An_method .gt. 0) then
PP(i,j)=PP(i,j)+An(i,j)*DXC*(V(i,j)-V(i,j-1))/DYC
end if
end if
end do
end do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment