-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmod_model.f90
80 lines (70 loc) · 2.45 KB
/
mod_model.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
module mod_model
use mod_param
use mod_mpimess
use mod_varandtypes
implicit none
private
public :: chymmodel
contains
subroutine chymmodel(istep, chym_runoff)
implicit none
integer, intent(in) :: istep
real, intent(in) :: chym_runoff(:,:)
logical :: first
data first /.true./
save first
integer :: step,imax,imin,jmax,jmin,i,j,idir
integer,save :: i1,i2,j1,j2
real :: rainload,dm
if (first) then
first=.false.
call mpi_barrier(mycomm,mpierr)
i1 = ide1gb+1
i2 = ide2gb-1
j1 = jde1gb+1
j2 = jde2gb-1
if (ma%has_bdytop) i2 = ide2gb
if (ma%has_bdybottom) i1 = ide1gb
if (ma%has_bdyleft) j1 = jde1gb
if (ma%has_bdyright) j2 = jde2gb
endif
call exchange_bdy(h2o_sub(jde1gb:jde2gb,ide1gb:ide2gb),2,jde1, &
jde2,ide1,ide2,jde1gb,jde2gb,ide1gb,ide2gb)
call exchange_bdy(bwet_sub(jde1gb:jde2gb,ide1gb:ide2gb),2,jde1, &
jde2,ide1,ide2,jde1gb,jde2gb,ide1gb,ide2gb)
call exchange_bdy(port_sub(jde1gb:jde2gb,ide1gb:ide2gb),2,jde1, &
jde2,ide1,ide2,jde1gb,jde2gb,ide1gb,ide2gb)
do i=i1,i2
do j=j1,j2
idir=fmap(j,i)
if (luse(j,i).ne.mare.and.idir.ge.1 &
.and.idir.le.8) then
dm=port_sub(j,i)*deltat
if (dm.gt.h2o_sub(j,i)) then
dm=h2o_sub(j,i)
end if
wkm1_sub(j,i)=wkm1_sub(j,i)-dm
wkm1_sub(j+ir(idir),i+jr(idir))= &
wkm1_sub(j+ir(idir),i+jr(idir))+dm
endif
enddo
enddo
call exchange_bdy(wkm1_sub(jde1gb:jde2gb,ide1gb:ide2gb),2,jde1, &
jde2,ide1,ide2,jde1gb,jde2gb,ide1gb,ide2gb)
do i=i1,i2
do j=j1,j2
idir=fmap(j,i)
if (luse(j,i).ne.mare.and.idir.ge.1.and.idir.le.8) then
rainload=chym_area(j,i)*1.0e+06*(chym_runoff(j,i))*deltat !m3 of water recharge in the grid cell
if (rainload.le.-900) then
endif
if (rainload.gt.200000.0) then
endif
h2o_sub(j,i)=h2o_sub(j,i)+wkm1_sub(j,i)+rainload
bwet_sub(j,i)=h2o_sub(j,i)/chym_dx(j,i)
port_sub(j,i)=alfa(j,i)*bwet_sub(j,i)
endif
enddo
enddo
end subroutine chymmodel
end module mod_model