WAVEWATCH III  beta 0.0.1
w3uostmd Module Reference

Parmeterization of the unresolved obstacles. More...

Functions/Subroutines

subroutine, public uost_initgrid (IGRID, FILELOCAL, FILESHADOW, LOCALFACTOR, SHADOWFACTOR)
 Allocate the UOST variables for a given grid, and load them from file. More...
 
subroutine, public uost_setgrid (IGRID)
 Sets the current grid in the sourceterm object. More...
 
subroutine, public uost_srctrmcompute (IX, IY, SPEC, CG, DT, U10ABS, U10DIR, S, D)
 Estimates the UOST source term for a give spectrum. More...
 
subroutine uost_sourceterm_compute_ld (THIS, IX, IY, SPEC, CG, DT, U10ABS, U10DIR, S, D)
 Method of the class UOST_SOURCETERM. More...
 

Detailed Description

Parmeterization of the unresolved obstacles.

Author
Lorenzo Mentaschi
Date
08-Oct-2018

Function/Subroutine Documentation

◆ uost_initgrid()

subroutine, public w3uostmd::uost_initgrid ( integer, intent(in)  IGRID,
character(len=*), intent(in)  FILELOCAL,
character(len=*), intent(in)  FILESHADOW,
real, intent(in)  LOCALFACTOR,
real, intent(in)  SHADOWFACTOR 
)

Allocate the UOST variables for a given grid, and load them from file.

Parameters
[in]IGRIDId of the grid being initialized.
[in]FILELOCALFile from where the alpha/beta coefficient for the local dissipation are loaded.
[in]FILESHADOWFile from where the alpha/beta coefficient for the shadow effect are loaded.
[in]LOCALFACTORAdjustment parameter for the local dissipation alpha and beta.
[in]SHADOWFACTORAdjustment parameter for the shadow dissipation alpha and beta.
Author
Lorenzo Mentaschi
Date
01-Oct-2018

Definition at line 123 of file w3uostmd.F90.

123  !/
124  !/ +-----------------------------------+
125  !/ | WAVEWATCH III NOAA/NCEP |
126  !/ | Lorenzo Mentaschi |
127  !/ | FORTRAN 90 |
128  !/ | Last update : 01-Oct-2018 |
129  !/ +-----------------------------------+
130  !/
131  !/ Aug-2018 : Origination. ( version 6.07 )
132  !/
133  ! 1. Purpose : allocate the UOST variables for a given grid, and load
134  ! them from file
135  ! 2. Parameters :
136  !
137  ! Parameter list
138  ! ----------------------------------------------------------------
139  ! IGRID, integer: id of the grid being initialized
140  ! FILELOCAL, string: file from where the alpha/beta coefficient
141  ! for the local dissipation are loaded
142  ! FILESHADOW, string: file from where the alpha/beta coefficient
143  ! for the shadow effect are loaded
144  ! LOCALFACTOR, double: adjustment parameter for the local
145  ! dissipation alpha and beta
146  ! SHADOWFACTOR, double: adjustment parameter for the shadow
147  ! dissipation alpha and beta
148  ! ----------------------------------------------------------------
149  !
150  ! 3. Called by :
151  !
152  ! Name Type Module Description
153  ! ----------------------------------------------------------------
154  ! W3IOGR Subr. W3IOGRMD Initialization of grid objects
155  ! ----------------------------------------------------------------
156  !
157  ! 4. Source code :
158  !
159  !/ ------------------------------------------------------------------- /
160  IMPLICIT NONE
161 
162  INTEGER, INTENT(IN) :: IGRID
163  CHARACTER(LEN=*), INTENT(IN) :: FILELOCAL, FILESHADOW
164  REAL, INTENT(IN) :: LOCALFACTOR, SHADOWFACTOR
165  TYPE(GRID), POINTER :: GRD
166  TYPE(SGRD), POINTER :: SGD
167  REAL :: CGMAX, MINSIZE
168 #ifdef W3_S
169  INTEGER, SAVE :: IENT = 0
170 #endif
171 
172 #ifdef W3_S
173  CALL strace (ient, 'UOST_INITGRID')
174 #endif
175 
176  IF ( (igrid .LE. 0) .OR. (.NOT. ALLOCATED(grids)) ) THEN
177  RETURN
178  ENDIF
179 
180  grd => grids(igrid)
181  sgd => sgrds(igrid)
182  grd%UOSTFILELOCAL = filelocal
183  grd%UOSTFILESHADOW = fileshadow
184  grd%UOSTLOCALFACTOR = localfactor
185  grd%UOSTSHADOWFACTOR = shadowfactor
186 
187  ALLOCATE( grd%UOST_LCL_OBSTRUCTED(grd%NX, grd%NY) )
188  grd%UOST_LCL_OBSTRUCTED = .false.
189  ALLOCATE( grd%UOST_SHD_OBSTRUCTED(grd%NX, grd%NY) )
190  grd%UOST_SHD_OBSTRUCTED = .false.
191  ALLOCATE( grd%UOSTCELLSIZE(grd%NX, grd%NY, sgd%NTH) )
192  grd%UOSTCELLSIZE = 0
193  ALLOCATE( grd%UOSTLOCALALPHA(grd%NX, grd%NY, sgd%NK, sgd%NTH) )
194  grd%UOSTLOCALALPHA = 100
195  ALLOCATE( grd%UOSTLOCALBETA(grd%NX, grd%NY, sgd%NK, sgd%NTH) )
196  grd%UOSTLOCALBETA = 100
197  ALLOCATE( grd%UOSTSHADOWALPHA(grd%NX, grd%NY, sgd%NK, sgd%NTH) )
198  grd%UOSTSHADOWALPHA = 100
199  ALLOCATE( grd%UOSTSHADOWBETA(grd%NX, grd%NY, sgd%NK, sgd%NTH) )
200  grd%UOSTSHADOWBETA = 100
201 
202 
203  IF ( (igrid .GT. 0) .AND. ( ALLOCATED(srctrm)) ) THEN
204  ! loading local/shadow alpha/beta
205  CALL load_alphabeta(grd, sgd, unit_ab)
206 
207  ! warning the user that for cells too small UOST may be inaccurate
208  cgmax = 20 ! simply taking a high value for the max group velocity to give an indication of this threshold
209  minsize = cgmax*grd%DTMAX/1000
210  WRITE(ndso,*)'*** WAVEWATCH-III WARNING IN W3UOST/UOST_INITGRID'
211  WRITE(ndso,*)'UOST: grid ',trim(grd%GNAME),':'
212  WRITE(ndso,*)' global time step == ', grd%DTMAX, ' s'
213  WRITE(ndso,*)' FOR CELLS SMALLER THAN ABOUT ', minsize, &
214  ' KM UOST MAY UNDERESTIMATE THE DISSIPATION'
215  WRITE(ndso,*)
216  ENDIF

References w3gdatmd::grids, w3odatmd::ndso, w3gdatmd::sgrds, and w3servmd::strace().

Referenced by w3iogrmd::w3iogr().

◆ uost_setgrid()

subroutine, public w3uostmd::uost_setgrid ( integer, intent(in)  IGRID)

Sets the current grid in the sourceterm object.

Parameters
[in]IGRIDId of the actual grid.
Author
Lorenzo Mentaschi
Date
01-Oct-2018

Definition at line 232 of file w3uostmd.F90.

232  !/
233  !/ +-----------------------------------+
234  !/ | WAVEWATCH III NOAA/NCEP |
235  !/ | Lorenzo Mentaschi |
236  !/ | FORTRAN 90 |
237  !/ | Last update : 01-Oct-2018 |
238  !/ +-----------------------------------+
239  !/
240  !/ Aug-2018 : Origination. ( version 6.07 )
241  !/
242  ! 1. Purpose : sets the current grid in the sourceterm object
243  ! 2. Parameters :
244  !
245  ! Parameter list
246  ! ----------------------------------------------------------------
247  ! IGRID, integer: id of the actual grid
248  ! ----------------------------------------------------------------
249  !
250  ! 3. Called by :
251  !
252  ! Name Type Module Description
253  ! ----------------------------------------------------------------
254  ! W3INIT Subr. W3INITMD Initialization of grid objects
255  ! W3WAVE Subr. W3WAVEMD Initialization of grid objects
256  ! before computation
257  ! ----------------------------------------------------------------
258  !
259  ! 4. Source code :
260  !
261  !/ ------------------------------------------------------------------- /
262  IMPLICIT NONE
263 
264  INTEGER, INTENT(IN) :: IGRID
265 #ifdef W3_S
266  INTEGER, SAVE :: IENT = 0
267 #endif
268 
269 #ifdef W3_S
270  CALL strace (ient, 'UOST_SETGRID')
271 #endif
272 
273  IF ( .NOT. ALLOCATED(srctrm) ) THEN
274  ALLOCATE(srctrm)
275  ENDIF
276 
277  CALL srctrm%SETGRID(grids(igrid), sgrds(igrid))

References w3gdatmd::grids, w3gdatmd::sgrds, and w3servmd::strace().

Referenced by w3initmd::w3init(), and w3wavemd::w3wave().

◆ uost_sourceterm_compute_ld()

subroutine w3uostmd::uost_sourceterm_compute_ld ( class(uost_sourceterm), intent(inout)  THIS,
integer, intent(in)  IX,
integer, intent(in)  IY,
real, dimension(this%sgd%nspec), intent(in)  SPEC,
real, dimension(this%sgd%nk), intent(in)  CG,
real, intent(in)  DT,
real, intent(in)  U10ABS,
real, intent(in)  U10DIR,
real, dimension(this%sgd%nspec), intent(out)  S,
real, dimension(this%sgd%nspec), intent(out)  D 
)

Method of the class UOST_SOURCETERM.

Computation of the local dissipation of the spectrum.

Parameters
[in,out]THISInstance of UOST_SOURCETERM passed to the method.
[in]IXX coordinates of actual call.
[in]IYY coordinates of actual call.
[in]SPECInput spectrum.
[in]CGGroup velocity.
[in]DTTime step.
[in]U10ABSAbsolute value of U10.
[in]U10DIRDirection of U10.
[out]SSource term.
[out]DDifferential of the source term over the spectrum.
Author
Lorenzo Mentaschi
Date
01-Oct-2018

Definition at line 794 of file w3uostmd.F90.

794  !/
795  !/ +-----------------------------------+
796  !/ | WAVEWATCH III NOAA/NCEP |
797  !/ | Lorenzo Mentaschi |
798  !/ | FORTRAN 90 |
799  !/ | Last update : 01-Oct-2018 |
800  !/ +-----------------------------------+
801  !/
802  !/ Aug-2018 : Origination. ( version 6.07 )
803  !/
804  ! 1. Purpose : Method of the class UOST_SOURCETERM.
805  ! Computation of the local dissipation of the spectrum
806  ! 2. Parameters :
807  !
808  ! Parameter list
809  ! ----------------------------------------------------------------
810  ! THIS: UOST_SOURCETERM instance of UOST_SOURCETERM passed to the method
811  ! (compulsory in oo programming)
812  ! IX, IY: Integer coordinates of the actual cell
813  ! SPEC: real input spectrum
814  ! CG: real group velocity
815  ! DT: real time step
816  ! U10ABS: real absolute value of U10
817  ! U10DIR: real direction of U10
818  ! S: real source term
819  ! D: real differential of the source term over the spectrum
820  ! ----------------------------------------------------------------
821  !
822  ! 3. Called by :
823  !
824  ! Name Type Module Description
825  ! ----------------------------------------------------------------
826  ! UOST_SOURCETERM_COMPUTE Subr. W3UOSTMD Computing the source term
827  ! ----------------------------------------------------------------
828  !
829  ! 4. Source code :
830  !
831  !/ ------------------------------------------------------------------- /
832  IMPLICIT NONE
833 
834  CLASS(UOST_SOURCETERM), INTENT(INOUT) :: THIS
835  INTEGER, INTENT(IN) :: IX, IY
836  REAL, INTENT(IN) :: SPEC(THIS%SGD%NSPEC), CG(THIS%SGD%NK)
837  REAL, INTENT(OUT) :: S(THIS%SGD%NSPEC), D(THIS%SGD%NSPEC)
838  REAL, INTENT(IN) :: U10ABS, U10DIR
839  REAL, INTENT(IN) :: DT
840 
841  INTEGER :: IK, ITH, ISP, NK, NTH
842  REAL :: ALPHA, BETA, CGI, CELLSIZE, SPECI, SFC
843  LOGICAL :: CELLOBSTRUCTED
844  REAL :: TH, PSI
845 #ifdef W3_S
846  INTEGER, SAVE :: IENT = 0
847 #endif
848 
849 #ifdef W3_S
850  CALL strace (ient, 'UOST_SOURCETERM_COMPUTE_LD')
851 #endif
852 
853  s = 0
854  d = 0
855 
856  cellobstructed = this%GRD%UOST_LCL_OBSTRUCTED(ix, iy)
857  IF (.NOT. cellobstructed) RETURN
858 
859  nk = this%SGD%NK
860  nth = this%SGD%NTH
861 
862  DO ik = 1,nk
863  cgi = cg(ik)
864  DO ith = 1,nth
865 
866  ! Getting alpha and beta for local dissipation
867  alpha = this%GRD%UOSTLOCALALPHA(ix, iy, ik, ith)/this%GRD%UOSTABMULTFACTOR
868  alpha = max(min(alpha*this%GRD%UOSTLOCALFACTOR, 1.), 0.)
869  beta = this%GRD%UOSTLOCALBETA(ix, iy, ik, ith)/this%GRD%UOSTABMULTFACTOR
870  beta = max(min(beta*this%GRD%UOSTLOCALFACTOR, 1.), 0.)
871 
872 
873  IF (alpha .EQ. 1) cycle
874 
875  ! Getting the size of the cell along direction ith
876  cellsize = this%GRD%UOSTCELLSIZE(ix, iy, ith)*this%GRD%UOSTCELLSIZEFACTOR
877 
878  isp = ith + (ik-1)*nth
879  speci = spec(isp)
880 
881  th = this%SGD%TH(ith)
882  CALL compute_reduction_psi(u10abs, u10dir, cg(ik), th, dt, psi)
883 
884  IF (beta > 0.09) THEN
885  ! Computing the local dissipation for a partially obstructed cell
886  sfc = - cgi/cellsize * (1 - beta)/beta
887  ELSE
888  ! The cell is almost completely obstructed.
889  ! Dissipating the energy almost completely.
890  sfc = - cgi/cellsize * this%GAMMAUP
891  ENDIF
892 
893  s(isp) = sfc * speci * psi
894  d(isp) = sfc * psi
895  ENDDO
896  ENDDO
897 

References w3servmd::strace().

◆ uost_srctrmcompute()

subroutine, public w3uostmd::uost_srctrmcompute ( integer, intent(in)  IX,
integer, intent(in)  IY,
real, dimension(srctrm%sgd%nspec), intent(in)  SPEC,
real, dimension(srctrm%sgd%nk), intent(in)  CG,
real, intent(in)  DT,
real, intent(in)  U10ABS,
real, intent(in)  U10DIR,
real, dimension(srctrm%sgd%nspec), intent(out)  S,
real, dimension(srctrm%sgd%nspec), intent(out)  D 
)

Estimates the UOST source term for a give spectrum.

Parameters
[in]IX
[in]IY
[in]SPEC
[in]CG
[in]DT
[in]U10ABS
[in]U10DIR
[out]S
[out]D
Author
Lorenzo Mentaschi
Date
01-Oct-2018

Definition at line 299 of file w3uostmd.F90.

299  !/
300  !/ +-----------------------------------+
301  !/ | WAVEWATCH III NOAA/NCEP |
302  !/ | Lorenzo Mentaschi |
303  !/ | FORTRAN 90 |
304  !/ | Last update : 01-Oct-2018 |
305  !/ +-----------------------------------+
306  !/
307  !/ Aug-2018 : Origination. ( version 6.07 )
308  !/
309  ! 1. Purpose : estimates the UOST source term for a give spectrum
310  ! 2. Parameters :
311  !
312  ! Parameter list
313  ! ----------------------------------------------------------------
314  ! IGRID, integer: id of the actual grid
315  ! ----------------------------------------------------------------
316  !
317  ! 3. Called by :
318  !
319  ! Name Type Module Description
320  ! ----------------------------------------------------------------
321  ! W3SRCE Subr. W3SRCEMD Computation of the source terms
322  ! ----------------------------------------------------------------
323  !
324  ! 4. Source code :
325  !
326  !/ ------------------------------------------------------------------- /
327  IMPLICIT NONE
328 
329  INTEGER, INTENT(IN) :: IX, IY
330  REAL, INTENT(IN) :: DT
331  REAL, INTENT(IN) :: SPEC(SRCTRM%SGD%NSPEC), CG(SRCTRM%SGD%NK)
332  REAL, INTENT(IN) :: U10ABS, U10DIR
333  REAL, INTENT(OUT) :: S(SRCTRM%SGD%NSPEC), D(SRCTRM%SGD%NSPEC)
334 #ifdef W3_S
335  INTEGER, SAVE :: IENT = 0
336 #endif
337 
338 #ifdef W3_S
339  CALL strace (ient, 'UOST_SRCTRMCOMPUTE')
340 #endif
341 
342  CALL srctrm%COMPUTE(ix, iy, spec, cg, dt, u10abs, u10dir, s, d)

References file(), w3odatmd::ndse, w3odatmd::ndso, constants::pi, and w3servmd::strace().

Referenced by w3srcemd::w3srce().

w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148