Skip to content

Commit 9bb27f6

Browse files
committed
Re-org gen_vqs_1.f90 for usability
1 parent 671a236 commit 9bb27f6

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

src/Utility/Pre-Processing/gen_vqs_1.f90

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
! (3) transect.bp (depths denote seg #)
1010
! Outputs: vgrid.in; vgrid_master.out; transect*.out; debug outputs (fort*)
1111
! Use plot_VQS.m to viz vgrid_master.out; transect*.out
12-
! ifort -O2 -mcmodel=medium -CB -Bstatic -o gen_vqs_1.exe ../UtilLib/schism_geometry.f90 gen_vqs_1.f90
12+
! ifx -O2 -mcmodel=medium -CB -Bstatic -o gen_vqs_1.exe ../UtilLib/schism_geometry.f90 gen_vqs_1.f90
1313

1414
use schism_geometry_mod
1515
implicit real*8(a-h,o-z)
1616
integer, allocatable :: elnode(:,:),elside(:,:),kbp0(:),kbp(:),ic3(:,:),isdel(:,:),isidenode(:,:),m0(:)
1717
allocatable :: xnd(:),ynd(:),dp(:),xcj(:,:),ycj(:,:),eta2(:),znd(:,:),z1tmp(:),z2tmp(:)
18-
allocatable :: hsm(:),nv_vqs(:),z_mas(:,:),a_vqs(:)
18+
allocatable :: hsm(:),nv_vqs(:),z_mas(:,:),a_vqs(:),theta_b(:),theta_f(:)
1919
allocatable :: xybp(:,:),dpbp(:),imap(:),transect_len(:),sigma_vqs(:,:),i34(:)
2020

2121
! print*, 'Want to output along a transect? (0: no; 1:yes)'
@@ -25,11 +25,25 @@
2525
!m_vqs: # of master grids
2626
m_vqs=39
2727
dz_bot_min=1 !min. bottom layer thickness [m]
28-
allocate(hsm(m_vqs),nv_vqs(m_vqs),a_vqs(m_vqs))
28+
allocate(hsm(m_vqs),nv_vqs(m_vqs),a_vqs(m_vqs),theta_b(m_vqs),theta_f(m_vqs))
2929
hsm=(/50,60,80,110,150,200,260,330,410,500,600,710,830,960,1100,1250,1410, & !m_vqs=39
3030
&1580,1760,1950,2150,2360,2580,2810,3050,3300,3560,3830,4110,4400,4700,5010,5330, &
3131
&5660,6000,6350,6710,7080,7460/)
3232
nv_vqs(1:m_vqs)=(/(21+1*(i-1),i=1,m_vqs)/) !# of levels for each master grid (increasing with depth)
33+
!S stretching constants for each depth
34+
theta_b=0 !\in [0,1]
35+
theta_f=(/(3+0.0*(m-1),m=1,m_vqs)/) !>0
36+
37+
! Other consts.
38+
! Stretching const. for the 1st master grid and also for depth <= hsm(1)
39+
! |a_vqs0|<=1 (1: skew toward bottom; -1: toward surface; 0: no bias)
40+
a_vqs0=-0.3
41+
42+
etal=0 !elevation (const)
43+
if(etal<=-hsm(1)) then
44+
write(*,*)'elev<hsm:',etal
45+
stop
46+
endif
3347

3448
if(m_vqs<2) then
3549
write(*,*)'Check vgrid.in:',m_vqs
@@ -43,18 +57,7 @@
4357
endif
4458
enddo !m
4559

46-
! Other consts.
47-
! Stretching const. for the 1st master grid and also for depth <= hsm(1)
48-
! |a_vqs0|<=1 (1: skew toward bottom; -1: toward surface; 0: no bias)
49-
a_vqs0=-0.3
50-
5160
! Generate a master vgrid (z_mas)
52-
etal=0 !used in master grid only; elev.
53-
if(etal<=-hsm(1)) then
54-
write(*,*)'elev<hsm:',etal
55-
stop
56-
endif
57-
5861
nvrt_m=nv_vqs(m_vqs)
5962
print*, 'nvrt in master vgrid=',nvrt_m
6063
allocate(z_mas(nvrt_m,m_vqs))
@@ -70,10 +73,10 @@
7073
! z_mas(k,m)=tmp*(etal+hsm(m))+etal
7174

7275
! Option 2: S
73-
theta_b=0
74-
theta_f=3+0.0*(m-1)
75-
cs=(1-theta_b)*sinh(theta_f*sigma)/sinh(theta_f)+ &
76-
&theta_b*(tanh(theta_f*(sigma+0.5))-tanh(theta_f*0.5))/2/tanh(theta_f*0.5)
76+
! theta_b=0
77+
! theta_f=3+0.0*(m-1)
78+
cs=(1-theta_b(m))*sinh(theta_f(m)*sigma)/sinh(theta_f(m))+ &
79+
&theta_b(m)*(tanh(theta_f(m)*(sigma+0.5))-tanh(theta_f(m)*0.5))/2/tanh(theta_f(m)*0.5)
7780
!Note that the 1st master grid is actually sigma not S
7881
z_mas(k,m)=etal*(1+sigma)+hsm(1)*sigma+(hsm(m)-hsm(1))*cs
7982
enddo !k

0 commit comments

Comments
 (0)