27 use fckit_log_module,
only : fckit_log
35 type(qg_field),
intent(inout) :: flds
36 type(c_ptr),
intent(in) :: config
38 integer :: jx,jy,icentre,jcentre,ii,jj,ipert
39 real(kind=kind_real) :: distx,disty,d1,d2,f1,f2,rsmax,deltax0,deltay0,deltax,deltay,zz
40 real(kind=kind_real),
allocatable :: pv(:,:,:), rs(:,:)
41 character(len=160) :: record
45 d1 = config_get_real(config,
"top_layer_depth")
46 d2 = config_get_real(config,
"bottom_layer_depth")
56 allocate(pv(flds%geom%nx,flds%geom%ny,2))
57 allocate(rs(flds%geom%nx,flds%geom%ny))
62 flds%x_south(1) = 0.0_kind_real
63 flds%x_south(2) = 0.0_kind_real
64 flds%x_north(1) = -
real(flds%geom%ny+1,kind_real)*deltay*u1
65 flds%x_north(2) = -
real(flds%geom%ny+1,kind_real)*deltay*u2
69 flds%x(jx,jy,1) = -
real(jy,kind_real)*deltay*u1
70 flds%x(jx,jy,2) = -
real(jy,kind_real)*deltay*u2
74 ipert = config_get_int(config,
"perturb")
76 write(record,*)
"qg_invent_state_f90: Perturbing invented state by ",ipert,
"%." 77 call fckit_log%info(record)
78 zz=
real(ipert,kind_real)/100.0_kind_real
81 flds%x(jx,jy,1) = (1.0_kind_real+zz)*flds%x(jx,jy,1)
82 flds%x(jx,jy,2) = (1.0_kind_real-zz)*flds%x(jx,jy,2)
87 icentre=flds%geom%nx/4
88 jcentre=3*flds%geom%ny/4
91 distx =
real(min(icentre-ii,flds%geom%nx-(icentre-ii)),kind_real) * deltax0
92 disty =
real(abs(jj-jcentre),kind_real) * deltay0
93 rs(ii,jj) = rsmax*exp(-(distx*distx+disty*disty)/(
worog*
worog))
97 call calc_pv(flds%geom%nx,flds%geom%ny,pv,flds%x,flds%x_north,flds%x_south, &
98 & f1,f2,deltax,deltay,
bet,rs)
101 flds%q_south(jx,1) = 2.0_kind_real*pv(jx,1,1)-pv(jx,2,1)
102 flds%q_south(jx,2) = 2.0_kind_real*pv(jx,1,2)-pv(jx,2,2)
105 flds%q_north(jx,1) = 2.0_kind_real*pv(jx,flds%geom%ny,1)-pv(jx,flds%geom%ny-1,1)
106 flds%q_north(jx,2) = 2.0_kind_real*pv(jx,flds%geom%ny,2)-pv(jx,flds%geom%ny-1,2)
real(kind=kind_real), parameter domain_meridional
meridional model domain (m)
real(kind=kind_real), parameter horog
height of orography (m)
real(kind=kind_real), parameter f0
Coriolis parameter at southern boundary.
real(kind=kind_real), parameter g
gravity (m^2 s^{-2})
Constants for the QG model.
real(kind=kind_real), parameter rossby_number
real(kind=kind_real), parameter bet
subroutine calc_pv(kx, ky, pv, x, x_north, x_south, f1, f2, deltax, deltay, bet, rs, lbc)
Calculate potential vorticity from streamfunction.
real(kind=kind_real), parameter u1
subroutine invent_state(flds, config)
Invent an initial state for the QG model.
Structure holding configuration variables for the QG model.
Handle fields for the QG model.
real(kind=kind_real), parameter domain_zonal
model domain (m) in zonal direction
real(kind=kind_real), parameter dlogtheta
difference in log(pot. T) across boundary
real(kind=kind_real), parameter u2
real(kind=kind_real), parameter worog
e-folding width of orography (m)
real(kind=kind_real), parameter scale_length
horizontal length scale (m)