MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
model.f90
Go to the documentation of this file.
1 
8 module model
9  use globals, only:dp
10  implicit none
11  integer :: &
12  ngas,& !< number of gases
13  nfv
14  integer, dimension(:), allocatable :: &
15  mor
16  real(dp), dimension(:), allocatable :: &
17  dz,& !< size of finite volume
18  dif,& !< diffusivity
19  sol,& !< solubility
20  bc
21  private
22  public modelpu,ngas,nfv,dz,dif,sol,bc,mor
23 contains
24 !********************************BEGINNING*************************************
32 subroutine modelpu(neq, time, ystate, yprime)
33  use constants
34  integer, intent(in) :: neq
35  real(dp), intent(in) :: time
36  real(dp), intent(in) :: ystate(neq)
37  real(dp), intent(out) :: yprime(neq)
38  integer :: i, j, k
39  real(dp) :: fluxw,fluxe
40  k=1
41  j=1
42  do i=1,ngas
43  fluxw=-2*dif(k)*sol(k)*(ystate(k)-bc(i))/dz(j)
44  fluxe=-2*dif(k)*dif(k+ngas)*sol(k)*sol(k+ngas)*&
45  (ystate(k+ngas)-ystate(k))/&
46  (dif(k+ngas)*dz(j)*sol(k)+dif(k)*dz(j+1)*sol(k+ngas))
47  yprime(k)=(fluxw-fluxe)/dz(j)
48  k=k+1
49  enddo
50  do j=2,nfv-1
51  do i=1,ngas
52  fluxw=-2*dif(k-ngas)*dif(k)*sol(k)*sol(k-ngas)*&
53  (ystate(k)-ystate(k-ngas))/&
54  (dif(k)*dz(j-1)*sol(k-ngas)+dif(k-ngas)*dz(j)*sol(k))
55  fluxe=-2*dif(k)*dif(k+ngas)*sol(k)*sol(k+ngas)*&
56  (ystate(k+ngas)-ystate(k))/&
57  (dif(k+ngas)*dz(j)*sol(k)+dif(k)*dz(j+1)*sol(k+ngas))
58  yprime(k)=(fluxw-fluxe)/dz(j)
59  k=k+1
60  enddo
61  enddo
62  j=nfv
63  do i=1,ngas
64  fluxw=-2*dif(k-ngas)*dif(k)*sol(k)*sol(k-ngas)*&
65  (ystate(k)-ystate(k-ngas))/&
66  (dif(k)*dz(j-1)*sol(k-ngas)+dif(k-ngas)*dz(j)*sol(k))
67  fluxe=0
68  yprime(k)=(fluxw-fluxe)/dz(j)
69  k=k+1
70  enddo
71 end subroutine modelpu
72 !***********************************END****************************************
73 end module model
namespace with global variables
Definition: globals.f90:8