41 INTEGER :: m=0,p=0,h=0
42 REAL(KIND=8) :: nx=0.,ny=0.
53 REAL(KIND=8),
DIMENSION(:,:),
ALLOCATABLE :: a,c,d,s
54 REAL(KIND=8),
DIMENSION(:,:,:),
ALLOCATABLE :: b,g
59 REAL(KIND=8),
DIMENSION(:,:),
ALLOCATABLE :: k,m,
n,w
60 REAL(KIND=8),
DIMENSION(:,:,:),
ALLOCATABLE :: o,c
90 REAL(KIND=8) FUNCTION b1(Pi, Pj, Pk)
92 b1 = (pk + pj) /
REAL(pi)
96 REAL(KIND=8) FUNCTION b2(Pi, Pj, Pk)
98 b2 = (pk - pj) /
REAL(pi)
102 REAL(KIND=8) FUNCTION delta(r)
112 REAL(KIND=8) FUNCTION flambda(r)
114 IF (mod(r,2)==0)
THEN 122 REAL(KIND=8) FUNCTION s1(Pj, Pk, Mj, Hk)
123 INTEGER :: Pk,Pj,Mj,Hk
124 s1 = -((pk * mj + pj * hk)) / 2.d0
128 REAL(KIND=8) FUNCTION s2(Pj, Pk, Mj, Hk)
129 INTEGER :: Pk,Pj,Mj,Hk
130 s2 = (pk * mj - pj * hk) / 2.d0
134 REAL(KIND=8) FUNCTION s3(Pj, Pk, Hj, Hk)
135 INTEGER :: Pj,Pk,Hj,Hk
136 s3 = (pk * hj + pj * hk) / 2.d0
140 REAL(KIND=8) FUNCTION s4(Pj, Pk, Hj, Hk)
141 INTEGER :: Pj,Pk,Hj,Hk
142 s4 = (pk * hj - pj * hk) / 2.d0
159 stop
"*** Problem with calculate_a : natm==0 ! ***" 161 IF (.NOT.
ALLOCATED(
atmos%a))
THEN 163 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 170 atmos%a(i,i) = -(
n**2) * ti%Nx**2 - ti%Ny**2
185 IF ((.NOT.
ALLOCATED(
atmos%a)) .OR. (.NOT.
ALLOCATED(
atmos%g)))
THEN 186 stop
"*** atmos%a and atmos%g must be defined before calling calculate_b ! ***" 190 stop
"*** Problem with calculate_b : natm==0 ! ***" 192 IF (.NOT.
ALLOCATED(
atmos%b))
THEN 194 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 222 stop
"*** Problem with calculate_c_atm : natm==0 ! ***" 224 IF (.NOT.
ALLOCATED(
atmos%c))
THEN 226 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 236 IF ((ti%typ ==
"K") .AND. (tj%typ ==
"L"))
THEN 237 val =
n * ti%M *
delta(ti%M - tj%H) *
delta(ti%P - tj%P)
239 IF (val /= 0.d0)
THEN 258 IF ((.NOT.
ALLOCATED(
atmos%s)) .OR. (.NOT.
ALLOCATED(
ocean%M)))
THEN 259 stop
"*** atmos%s and ocean%M must be defined before calling calculate_d ! ***" 264 stop
"*** Problem with calculate_d : natm==0 ! ***" 266 IF (.NOT.
ALLOCATED(
atmos%d))
THEN 268 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 290 REAL(KIND=8) :: val,vb1, vb2, vs1, vs2, vs3, vs4
294 stop
"*** Problem with calculate_g : natm==0 ! ***" 296 IF (.NOT.
ALLOCATED(
atmos%g))
THEN 298 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 310 IF ((ti%typ ==
"A") .AND. (tj%typ ==
"K") .AND. (tk%typ ==
"L"))
THEN 311 vb1 =
b1(ti%P,tj%P,tk%P)
312 vb2 =
b2(ti%P,tj%P,tk%P)
313 val = -2 * sqrt(2.) /
pi * tj%M *
delta(tj%M - tk%H) *
flambda(ti%P + tj%P + tk%P)
314 IF (val /= 0.d0) val = val * (vb1**2 / (vb1**2 - 1) - vb2**2 / (vb2**2 - 1))
315 ELSEIF ((ti%typ ==
"K") .AND. (tj%typ ==
"K") .AND. (tk%typ ==
"L"))
THEN 316 vs1 =
s1(tj%P,tk%P,tj%M,tk%H)
317 vs2 =
s2(tj%P,tk%P,tj%M,tk%H)
318 val = vs1 * (
delta(ti%M - tk%H - tj%M) *
delta(ti%P -&
319 & tk%P + tj%P) -
delta(ti%M- tk%H - tj%M) *&
320 &
delta(ti%P + tk%P - tj%P) + (
delta(tk%H - tj%M&
321 & + ti%M) +
delta(tk%H - tj%M - ti%M)) *&
322 &
delta(tk%P + tj%P - ti%P)) + vs2 * (
delta(ti%M&
323 & - tk%H - tj%M) *
delta(ti%P - tk%P - tj%P) +&
324 & (
delta(tk%H - tj%M - ti%M) +
delta(ti%M + tk%H&
325 & - tj%M)) * (
delta(ti%P - tk%P + tj%P) -&
326 &
delta(tk%P - tj%P + ti%P)))
329 IF (val /= 0.d0)
THEN 333 atmos%g(i,k,j) = -val
334 atmos%g(j,i,k) = -val
335 atmos%g(k,j,i) = -val
349 IF ((ti%typ ==
"L") .AND. (tj%typ ==
"L") .AND. (tk%typ ==
"L"))
THEN 350 vs3 =
s3(tj%P,tk%P,tj%H,tk%H)
351 vs4 =
s4(tj%P,tk%P,tj%H,tk%H)
352 val = vs3 * ((
delta(tk%H - tj%H - ti%H) -
delta(tk%H &
353 &- tj%H + ti%H)) *
delta(tk%P + tj%P - ti%P) +&
354 &
delta(tk%H + tj%H - ti%H) * (
delta(tk%P - tj%P&
355 & + ti%P) -
delta(tk%P - tj%P - ti%P))) + vs4 *&
356 & ((
delta(tk%H + tj%H - ti%H) *
delta(tk%P - tj&
357 &%P - ti%P)) + (
delta(tk%H - tj%H + ti%H) -&
358 &
delta(tk%H - tj%H - ti%H)) * (
delta(tk%P - tj&
359 &%P - ti%P) -
delta(tk%P - tj%P + ti%P)))
362 IF (val /= 0.d0)
THEN 366 atmos%g(i,k,j) = -val
367 atmos%g(j,i,k) = -val
368 atmos%g(k,j,i) = -val
386 stop
"*** Problem with calculate_s : natm==0 ! ***" 387 ELSEIF (
noc == 0)
then 388 stop
"*** Problem with calculate_s : noc==0 ! ***" 390 IF (.NOT.
ALLOCATED(
atmos%s))
THEN 392 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 402 IF (ti%typ ==
"A")
THEN 404 IF (val /= 0.d0)
THEN 405 val = val*8*sqrt(2.)*dj%P/(
pi**2 * (dj%P**2 - ti%P**2) * dj%H)
407 ELSEIF (ti%typ ==
"K")
THEN 409 IF (val /= 0.d0)
THEN 410 val = val*4*dj%H/(
pi * (-4 * ti%M**2 + dj%H**2))
412 ELSEIF (ti%typ ==
"L")
THEN 413 val =
delta(dj%P - ti%P) *
delta(2 * ti%H - dj%H)
415 IF (val /= 0.d0)
THEN 437 IF ((.NOT.
ALLOCATED(
atmos%a)) .OR. (.NOT.
ALLOCATED(
atmos%s)))
THEN 438 stop
"*** atmos%a and atmos%s must be defined before calling calculate_K ! ***" 442 stop
"*** Problem with calculate_K : noc==0 ! ***" 443 ELSEIF (
natm == 0 )
THEN 444 stop
"*** Problem with calculate_K : natm==0 ! ***" 446 IF (.NOT.
ALLOCATED(
ocean%K))
THEN 448 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 468 stop
"*** Problem with calculate_M : noc==0 ! ***" 470 IF (.NOT.
ALLOCATED(
ocean%M))
THEN 472 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 479 ocean%M(i,i) = -(
n**2) * di%Nx**2 - di%Ny**2
492 stop
"*** Problem with calculate_N : noc==0 ! ***" 494 IF (.NOT.
ALLOCATED(
ocean%N))
THEN 496 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 507 IF (val /= 0.d0)
ocean%N(i,j) = val * (-2) * dj%H * di%H *
n / ((dj%H**2 - di%H**2) *
pi)
517 REAL(KIND=8) :: vs3,vs4,val
521 stop
"*** Problem with calculate_O : noc==0 ! ***" 523 IF (.NOT.
ALLOCATED(
ocean%O))
THEN 525 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 537 vs3 =
s3(dj%P,dk%P,dj%H,dk%H)
538 vs4 =
s4(dj%P,dk%P,dj%H,dk%H)
539 val = vs3*((
delta(dk%H - dj%H - di%H) -
delta(dk%H - dj&
540 &%H + di%H)) *
delta(dk%P + dj%P - di%P) +
delta(dk&
541 &%H + dj%H - di%H) * (
delta(dk%P - dj%P + di%P) -&
542 &
delta(dk%P - dj%P - di%P))) + vs4 * ((
delta(dk%H &
543 &+ dj%H - di%H) *
delta(dk%P - dj%P - di%P)) +&
544 & (
delta(dk%H - dj%H + di%H) -
delta(dk%H - dj%H -&
545 & di%H)) * (
delta(dk%P - dj%P - di%P) -
delta(dk%P &
548 IF (val /= 0.d0)
THEN 552 ocean%O(i,k,j) = -val
553 ocean%O(j,i,k) = -val
554 ocean%O(k,j,i) = -val
572 IF ((.NOT.
ALLOCATED(
ocean%O)) .OR. (.NOT.
ALLOCATED(
ocean%M)))
THEN 573 stop
"*** ocean%O and ocean%M must be defined before calling calculate_C ! ***" 577 stop
"*** Problem with calculate_C : noc==0 ! ***" 579 IF (.NOT.
ALLOCATED(
ocean%C))
THEN 581 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 591 IF (val /= 0.d0)
ocean%C(i,j,k) = val
608 IF (.NOT.
ALLOCATED(
atmos%s))
THEN 609 stop
"*** atmos%s must be defined before calling calculate_W ! ***" 613 stop
"*** Problem with calculate_W : noc==0 ! ***" 614 ELSEIF (
natm == 0 )
THEN 615 stop
"*** Problem with calculate_W : natm==0 ! ***" 617 IF (.NOT.
ALLOCATED(
ocean%W))
THEN 619 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 645 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 649 IF (
ams(i,1)==1)
THEN 727 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 731 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 735 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 739 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 743 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 747 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 752 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 756 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 760 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 764 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 768 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" 772 IF (allocstat /= 0) stop
"*** Problem to deallocate ! ***" integer noc
Number of oceanic basis functions.
Atmospheric bloc specification type.
subroutine, public init_inprod
Initialisation of the inner product.
integer nbatm
Number of oceanic blocks.
Inner products between the truncated set of basis functions for the ocean and atmosphere streamfuncti...
real(kind=8) function b1(Pi, Pj, Pk)
Cehelsky & Tung Helper functions.
real(kind=8) function s4(Pj, Pk, Hj, Hk)
Cehelsky & Tung Helper functions.
subroutine calculate_g
Temperature advection terms (atmospheric)
subroutine calculate_m
Forcing of the ocean fields on the ocean.
real(kind=8) function s2(Pj, Pk, Mj, Hk)
Cehelsky & Tung Helper functions.
real(kind=8) function b2(Pi, Pj, Pk)
Cehelsky & Tung Helper functions.
subroutine calculate_a
Eigenvalues of the Laplacian (atmospheric)
real(kind=8) function delta(r)
Integer Dirac delta function.
subroutine calculate_k
Forcing of the atmosphere on the ocean.
subroutine, public deallocate_inprod
Deallocation of the inner products.
subroutine calculate_c_atm
Beta term for the atmosphere.
type(ocean_wavenum), dimension(:), allocatable, public owavenum
Oceanic blocs specification.
subroutine calculate_s
Forcing (thermal) of the ocean on the atmosphere.
Type holding the oceanic inner products tensors.
type(atm_wavenum), dimension(:), allocatable, public awavenum
Atmospheric blocs specification.
Oceanic bloc specification type.
real(kind=8) function s1(Pj, Pk, Mj, Hk)
Cehelsky & Tung Helper functions.
real(kind=8) function s3(Pj, Pk, Hj, Hk)
Cehelsky & Tung Helper functions.
integer natm
Number of atmospheric basis functions.
type(atm_tensors), public atmos
Atmospheric tensors.
subroutine calculate_o
Temperature advection term (passive scalar)
subroutine calculate_n
Beta term for the ocean.
integer nboc
Number of atmospheric blocks.
real(kind=8) function flambda(r)
"Odd or even" function
The model parameters module.
subroutine calculate_w
Short-wave radiative forcing of the ocean.
Type holding the atmospheric inner products tensors.
integer, dimension(:,:), allocatable ams
Atmospheric mode selection array.
subroutine calculate_b
Streamfunction advection terms (atmospheric)
type(ocean_tensors), public ocean
Oceanic tensors.
integer, dimension(:,:), allocatable oms
Ocean mode selection array.
subroutine calculate_c_oc
Streamfunction advection terms (oceanic)
subroutine calculate_d
Forcing of the ocean on the atmosphere.
real(kind=8) n
- Aspect ratio