ROMS
Loading...
Searching...
No Matches
white_noise_mod Module Reference

Functions/Subroutines

subroutine, public white_noise1d (ng, model, rscheme, imin, imax, lbi, ubi, rmin, rmax, r)
 
subroutine, public white_noise2d (ng, model, gtype, rscheme, imin, imax, jmin, jmax, lbi, ubi, lbj, ubj, rmin, rmax, r)
 
subroutine, public white_noise2d_bry (ng, tile, model, boundary, rscheme, imin, imax, lbij, ubij, rmin, rmax, r)
 
subroutine, public white_noise3d (ng, model, gtype, rscheme, imin, imax, jmin, jmax, lbi, ubi, lbj, ubj, lbk, ubk, rmin, rmax, r)
 
subroutine, public white_noise3d_bry (ng, tile, model, boundary, rscheme, imin, imax, lbij, ubij, lbk, ubk, rmin, rmax, r)
 

Function/Subroutine Documentation

◆ white_noise1d()

subroutine, public white_noise_mod::white_noise1d ( integer, intent(in) ng,
integer, intent(in) model,
integer, intent(in) rscheme,
integer, intent(in) imin,
integer, intent(in) imax,
integer, intent(in) lbi,
integer, intent(in) ubi,
real(r8), intent(out) rmin,
real(r8), intent(out) rmax,
real(r8), dimension(lbi:), intent(out) r )

Definition at line 49 of file white_noise.F.

52!***********************************************************************
53!
54 USE mod_param
55 USE mod_parallel
56 USE mod_scalars
57!
58 USE nrutil, ONLY : gasdev
59!
60! Imported variable declarations.
61!
62 integer, intent(in) :: ng, model, Rscheme
63 integer, intent(in) :: Imin, Imax, LBi, UBi
64
65 real(r8), intent(out) :: Rmin, Rmax
66
67#ifdef ASSUMED_SHAPE
68 real(r8), intent(out) :: R(LBi:)
69#else
70 real(r8), intent(out) :: R(LBi:UBi)
71#endif
72!
73! Local variable declarations.
74!
75 integer :: i, ic
76
77 real(r8), parameter :: fac = 2.0_r8 * 1.73205080756887720_r8
78
79 real(r8), dimension((UBi-LBi+1)) :: random
80!
81!-----------------------------------------------------------------------
82! Generate an array of random numbers.
83!-----------------------------------------------------------------------
84!
85! Initialize output array.
86!
87 DO i=lbi,ubi
88 r(i)=0.0_r8
89 END DO
90!
91! F90 intrinsic pseudorandom numbers with an uniform distribution
92! over the range 0 <= R < 1.
93!
94 IF (rscheme.eq.0) THEN
95 CALL random_number (r(lbi:))
96!
97! Scale (fac=2*SQRT(3)) the random number to insure the expectation
98! mean to be approximately zero, E(R)=0, and the expectation variance
99! to be approximately unity, E(R^2)=1 (Bennett, 2002; book page 72).
100!
101! Recall that,
102!
103! E(R) = sum[R f(R)]
104!
105! where F(R) is the random variable probability distribution.
106!
107 DO i=imin,imax
108 r(i)=fac*(r(i)-0.5_r8)
109 END DO
110 rmin=minval(r)
111 rmax=maxval(r)
112!
113! Random deviates with a Gaussian (normal) distribuiton over the
114! range from -1 to 1.
115!
116 ELSE IF (rscheme.eq.1) THEN
117 IF (master) THEN
118 CALL gasdev (random)
119 rmin=minval(random)
120 rmax=maxval(random)
121 END IF
122 ic=0
123 DO i=imin,imax
124 ic=ic+1
125 r(i)=random(ic)
126 END DO
127 END IF
128
129 RETURN
logical master
Definition nrutil.F:1

References mod_parallel::master.

◆ white_noise2d()

subroutine, public white_noise_mod::white_noise2d ( integer, intent(in) ng,
integer, intent(in) model,
integer, intent(in) gtype,
integer, intent(in) rscheme,
integer, intent(in) imin,
integer, intent(in) imax,
integer, intent(in) jmin,
integer, intent(in) jmax,
integer, intent(in) lbi,
integer, intent(in) ubi,
integer, intent(in) lbj,
integer, intent(in) ubj,
real(r8), intent(out) rmin,
real(r8), intent(out) rmax,
real(r8), dimension(lbi:ubi,lbj:ubj), intent(out) r )

Definition at line 134 of file white_noise.F.

138!***********************************************************************
139!
140 USE mod_param
141 USE mod_parallel
142 USE mod_scalars
143!
144#ifdef DISTRIBUTE
145 USE distribute_mod, ONLY : mp_scatter2d
146#endif
147 USE nrutil, ONLY : gasdev
148!
149! Imported variable declarations.
150!
151 integer, intent(in) :: ng, model, gtype, Rscheme
152 integer, intent(in) :: Imin, Imax, Jmin, Jmax
153 integer, intent(in) :: LBi, UBi, LBj, UBj
154
155 real(r8), intent(out) :: Rmin, Rmax
156
157 real(r8), intent(out) :: R(LBi:UBi,LBj:UBj)
158!
159! Local variable declarations.
160!
161 integer :: Npts, i, ic, j
162
163 real(r8), parameter :: fac = 2.0_r8 * 1.73205080756887720_r8
164
165 real(r8), allocatable :: random(:)
166!
167!-----------------------------------------------------------------------
168! Generate an array of random numbers.
169!-----------------------------------------------------------------------
170!
171! Initialize output array.
172!
173 DO j=lbj,ubj
174 DO i=lbi,ubi
175 r(i,j)=0.0_r8
176 END DO
177 END DO
178!
179! F90 intrinsic pseudorandom numbers with an uniform distribution
180! over the range 0 <= R < 1.
181!
182 IF (rscheme.eq.0) THEN
183 CALL random_number (r(lbi:,lbj:))
184!
185! Scale (fac=2*SQRT(3)) the random number to insure the expectation
186! mean to be approximately zero, E(R)=0, and the expectation variance
187! to be approximately unity, E(R^2)=1 (Bennett, 2002; book page 72).
188!
189! Recall that,
190!
191! E(R) = sum[R f(R)]
192!
193! where F(R) is the random variable probability distribution.
194!
195 DO j=jmin,jmax
196 DO i=imin,imax
197 r(i,j)=fac*(r(i,j)-0.5_r8)
198 END DO
199 END DO
200 rmin=minval(r)
201 rmax=maxval(r)
202!
203! Random deviates with a Gaussian (normal) distribuiton with zero
204! mean and unit variance.
205!
206 ELSE IF (rscheme.eq.1) THEN
207 npts=(lm(ng)+2)*(mm(ng)+2)
208 IF (.not.allocated(random)) THEN
209 allocate ( random(npts+2) )
210 END IF
211 IF (master) THEN
212 CALL gasdev (random)
213 rmin=random(1)
214 rmax=random(1)
215 DO ic=1,npts
216 rmin=min(rmin,random(ic))
217 rmax=max(rmax,random(ic))
218 END DO
219 END IF
220#ifdef DISTRIBUTE
221 npts=SIZE(random)
222 CALL mp_scatter2d (ng, model, lbi, ubi, lbj, ubj, &
223 & nghostpoints, gtype, rmin, rmax, &
224# if defined READ_WATER && defined MASKING
225 & (lm(ng)+2)*(mm(ng)+2), &
226 & scalars(ng)%IJwater(:,gtype), &
227# endif
228 & npts, random, r)
229#else
230 ic=0
231 DO j=jmin,jmax
232 DO i=imin,imax
233 ic=ic+1
234 r(i,j)=random(ic)
235 END DO
236 END DO
237#endif
238 IF (allocated(random)) THEN
239 deallocate (random)
240 END IF
241 END IF
242
243 RETURN
subroutine mp_scatter2d(ng, model, lbi, ubi, lbj, ubj, nghost, gtype, amin, amax, nwpts, ij_water, npts, a, awrk)
integer nghostpoints
Definition mod_param.F:710
integer, dimension(:), allocatable lm
Definition mod_param.F:455
integer, dimension(:), allocatable mm
Definition mod_param.F:456
type(t_scalars), dimension(:), allocatable scalars
Definition mod_scalars.F:65

References mod_param::lm, mod_parallel::master, mod_param::mm, distribute_mod::mp_scatter2d(), mod_param::nghostpoints, and mod_scalars::scalars.

Referenced by random_ic_mod::random_ic_tile(), and normalization_mod::randomization_tile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ white_noise2d_bry()

subroutine, public white_noise_mod::white_noise2d_bry ( integer, intent(in) ng,
integer, intent(in) tile,
integer, intent(in) model,
integer, intent(in) boundary,
integer, intent(in) rscheme,
integer, intent(in) imin,
integer, intent(in) imax,
integer, intent(in) lbij,
integer, intent(in) ubij,
real(r8), intent(out) rmin,
real(r8), intent(out) rmax,
real(r8), dimension(lbij:), intent(out) r )

Definition at line 248 of file white_noise.F.

252!***********************************************************************
253!
254 USE mod_param
255 USE mod_parallel
256 USE mod_scalars
257!
258#ifdef DISTRIBUTE
259 USE distribute_mod, ONLY : mp_bcastf
261#endif
262 USE nrutil, ONLY : gasdev
263!
264! Imported variable declarations.
265!
266 integer, intent(in) :: ng, tile, model, boundary, Rscheme
267 integer, intent(in) :: Imin, Imax
268 integer, intent(in) :: LBij, UBij
269
270 real(r8), intent(out) :: Rmin, Rmax
271
272#ifdef ASSUMED_SHAPE
273 real(r8), intent(out) :: R(LBij:)
274#else
275 real(r8), intent(out) :: R(LBij:UBij)
276#endif
277!
278! Local variable declarations.
279!
280 integer :: Ioff, i, ic
281
282 real(r8), parameter :: fac = 2.0_r8 * 1.73205080756887720_r8
283
284 real(r8), dimension(UBij-LBij+1) :: random
285!
286!-----------------------------------------------------------------------
287! Generate an array of random numbers.
288!-----------------------------------------------------------------------
289!
290! Initialize output array.
291!
292 DO i=lbij,ubij
293 r(i)=0.0_r8
294 END DO
295!
296! F90 intrinsic pseudorandom numbers with an uniform distribution
297! over the range 0 <= R < 1.
298!
299 IF (rscheme.eq.0) THEN
300 CALL random_number (r(lbij:))
301!
302! Scale (fac=2*SQRT(3)) the random number to insure the expectation
303! mean to be approximately zero, E(R)=0, and the expectation variance
304! to be approximately unity, E(R^2)=1 (Bennett, 2002; book page 72).
305!
306! Recall that,
307!
308! E(R) = sum[R f(R)]
309!
310! where F(R) is the random variable probability distribution.
311!
312 DO i=imin,imax
313 r(i)=fac*(r(i)-0.5_r8)
314 END DO
315 rmin=minval(r)
316 rmax=maxval(r)
317!
318! Random deviates with a Gaussian (normal) distribuiton with zero
319! mean and unit variance.
320!
321 ELSE IF (rscheme.eq.1) THEN
322 IF (master) THEN
323 CALL gasdev (random)
324 END IF
325#ifdef DISTRIBUTE
326 CALL mp_bcastf (ng, model, random)
327#endif
328 rmin=minval(random)
329 rmax=maxval(random)
330
331 ioff=1-lbij
332 DO i=imin,imax
333 ic=i+ioff
334 r(i)=random(ic)
335 END DO
336#ifdef DISTRIBUTE
337 CALL mp_exchange2d_bry (ng, tile, model, 1, boundary, &
338 & lbij, ubij, &
339 & nghostpoints, &
340 & ewperiodic(ng), nsperiodic(ng), &
341 & r)
342#endif
343 END IF
344
345 RETURN
logical, dimension(:), allocatable ewperiodic
logical, dimension(:), allocatable nsperiodic
subroutine mp_exchange2d_bry(ng, tile, model, nvar, boundary, lbij, ubij, nghost, ew_periodic, ns_periodic, a, b, c, d)

References mod_scalars::ewperiodic, mod_parallel::master, mp_exchange_mod::mp_exchange2d_bry(), mod_param::nghostpoints, and mod_scalars::nsperiodic.

Referenced by random_ic_mod::random_ic_tile(), and normalization_mod::randomization_tile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ white_noise3d()

subroutine, public white_noise_mod::white_noise3d ( integer, intent(in) ng,
integer, intent(in) model,
integer, intent(in) gtype,
integer, intent(in) rscheme,
integer, intent(in) imin,
integer, intent(in) imax,
integer, intent(in) jmin,
integer, intent(in) jmax,
integer, intent(in) lbi,
integer, intent(in) ubi,
integer, intent(in) lbj,
integer, intent(in) ubj,
integer, intent(in) lbk,
integer, intent(in) ubk,
real(r8), intent(out) rmin,
real(r8), intent(out) rmax,
real(r8), dimension(lbi:,lbj:,lbk:), intent(out) r )

Definition at line 352 of file white_noise.F.

356!***********************************************************************
357!
358 USE mod_param
359 USE mod_parallel
360 USE mod_scalars
361!
362# ifdef DISTRIBUTE
363 USE distribute_mod, ONLY : mp_scatter3d
364# endif
365 USE nrutil, ONLY : gasdev
366!
367! Imported variable declarations.
368!
369 integer, intent(in) :: ng, model, gtype, Rscheme
370 integer, intent(in) :: Imin, Imax, Jmin, Jmax
371 integer, intent(in) :: LBi, UBi, LBj, UBj, LBk, UBk
372
373 real(r8), intent(out) :: Rmin, Rmax
374
375# ifdef ASSUMED_SHAPE
376 real(r8), intent(out) :: R(LBi:,LBj:,LBk:)
377# else
378 real(r8), intent(out) :: R(LBi:UBi,LBj:UBj,LBk:UBk)
379# endif
380!
381! Local variable declarations.
382!
383 integer :: Npts, i, ic, j, k
384
385 real(r8), parameter :: fac = 2.0_r8 * 1.73205080756887720_r8
386
387 real(r8), allocatable :: random(:)
388!
389!-----------------------------------------------------------------------
390! Generate an array of random numbers.
391!-----------------------------------------------------------------------
392!
393! Initialize output array.
394!
395 DO k=lbk,ubk
396 DO j=lbj,ubj
397 DO i=lbi,ubi
398 r(i,j,k)=0.0_r8
399 END DO
400 END DO
401 END DO
402!
403! F90 intrinsic pseudorandom numbers with an uniform distribution
404! over the range 0 <= R < 1.
405!
406 IF (rscheme.eq.0) THEN
407 CALL random_number (r(lbi:,lbj:,lbk:))
408!
409! Scale (fac=2*SQRT(3)) the random number to insure the expectation
410! mean to be approximately zero, E(R)=0, and the expectation variance
411! to be approximately unity, E(R^2)=1.
412!
413! Recall that,
414!
415! E(R) = sum[R f(R)]
416!
417! where F(R) is the random variable probability distribution
418!
419 DO k=lbk,ubk
420 DO j=jmin,jmax
421 DO i=imin,imax
422 r(i,j,k)=fac*(r(i,j,k)-0.5_r8)
423 END DO
424 END DO
425 END DO
426 rmin=minval(r)
427 rmax=maxval(r)
428!
429! Random deviates with a Gaussian (normal) distribution with zero
430! mean and unit variance.
431!
432 ELSE IF (rscheme.eq.1) THEN
433 npts=(lm(ng)+2)*(mm(ng)+2)*(ubk-lbk+1)
434 IF (.not.allocated(random)) THEN
435 allocate ( random(npts+2) )
436 END IF
437 IF (master) THEN
438 CALL gasdev (random)
439 rmin=random(1)
440 rmax=random(1)
441 DO ic=1,npts
442 rmin=min(rmin,random(ic))
443 rmax=max(rmax,random(ic))
444 END DO
445 END IF
446# ifdef DISTRIBUTE
447 npts=SIZE(random)
448 CALL mp_scatter3d (ng, model, lbi, ubi, lbj, ubj, lbk, ubk, &
449 & nghostpoints, gtype, rmin, rmax, &
450# if defined READ_WATER && defined MASKING
451 & (lm(ng)+2)*(mm(ng)+2), &
452 & scalars(ng)%IJwater(:,gtype), &
453# endif
454 & npts, random, r)
455# else
456 ic=0
457 DO k=lbk,ubk
458 DO j=jmin,jmax
459 DO i=imin,imax
460 ic=ic+1
461 r(i,j,k)=random(ic)
462 END DO
463 END DO
464 END DO
465# endif
466 IF (allocated(random)) THEN
467 deallocate (random)
468 END IF
469 END IF
470
471 RETURN
subroutine mp_scatter3d(ng, model, lbi, ubi, lbj, ubj, lbk, ubk, nghost, gtype, amin, amax, nwpts, ij_water, npts, a, awrk)

References mod_param::lm, mod_parallel::master, mod_param::mm, distribute_mod::mp_scatter3d(), mod_param::nghostpoints, and mod_scalars::scalars.

Referenced by random_ic_mod::random_ic_tile(), and normalization_mod::randomization_tile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ white_noise3d_bry()

subroutine, public white_noise_mod::white_noise3d_bry ( integer, intent(in) ng,
integer, intent(in) tile,
integer, intent(in) model,
integer, intent(in) boundary,
integer, intent(in) rscheme,
integer, intent(in) imin,
integer, intent(in) imax,
integer, intent(in) lbij,
integer, intent(in) ubij,
integer, intent(in) lbk,
integer, intent(in) ubk,
real(r8), intent(out) rmin,
real(r8), intent(out) rmax,
real(r8), dimension(lbij:,lbk:), intent(out) r )

Definition at line 476 of file white_noise.F.

480!***********************************************************************
481!
482 USE mod_param
483 USE mod_parallel
484 USE mod_scalars
485!
486# ifdef DISTRIBUTE
487 USE distribute_mod, ONLY : mp_bcastf
489# endif
490 USE nrutil, ONLY : gasdev
491!
492! Imported variable declarations.
493!
494 integer, intent(in) :: ng, tile, model, boundary, Rscheme
495 integer, intent(in) :: Imin, Imax
496 integer, intent(in) :: LBij, UBij, LBk, UBk
497
498 real(r8), intent(out) :: Rmin, Rmax
499
500# ifdef ASSUMED_SHAPE
501 real(r8), intent(out) :: R(LBij:,LBk:)
502# else
503 real(r8), intent(out) :: R(LBij:UBij,LBk:UBk)
504# endif
505!
506! Local variable declarations.
507!
508 integer :: Ilen, Ioff, i, ic, k, kc
509
510 real(r8), parameter :: fac = 2.0_r8 * 1.73205080756887720_r8
511
512 real(r8), dimension((UBij-LBij+1)*(UBk-LBk+1)) :: random
513!
514!-----------------------------------------------------------------------
515! Generate an array of random numbers.
516!-----------------------------------------------------------------------
517!
518! Initialize output array.
519!
520 DO k=lbk,ubk
521 DO i=lbij,ubij
522 r(i,k)=0.0_r8
523 END DO
524 END DO
525!
526! F90 intrinsic pseudorandom numbers with an uniform distribution
527! over the range 0 <= R < 1.
528!
529 IF (rscheme.eq.0) THEN
530 CALL random_number (r(lbij:,lbk:))
531!
532! Scale (fac=2*SQRT(3)) the random number to insure the expectation
533! mean to be approximately zero, E(R)=0, and the expectation variance
534! to be approximately unity, E(R^2)=1 (Bennett, 2002; book page 72).
535!
536! Recall that,
537!
538! E(R) = sum[R f(R)]
539!
540! where F(R) is the random variable probability distribution.
541!
542 DO k=lbk,ubk
543 DO i=imin,imax
544 r(i,k)=fac*(r(i,k)-0.5_r8)
545 END DO
546 END DO
547 rmin=minval(r)
548 rmax=maxval(r)
549!
550! Random deviates with a Gaussian (normal) distribuiton with zero
551! mean and unit variance.
552!
553 ELSE IF (rscheme.eq.1) THEN
554 IF (master) THEN
555 CALL gasdev (random)
556 END IF
557# ifdef DISTRIBUTE
558 CALL mp_bcastf (ng, model, random)
559# endif
560 rmin=minval(random)
561 rmax=maxval(random)
562
563 ilen=ubij-lbij+1
564 ioff=1-lbij
565
566 DO k=lbk,ubk
567 kc=(k-lbk)*ilen
568 DO i=imin,imax
569 ic=i+ioff+kc
570 r(i,k)=random(ic)
571 END DO
572 END DO
573# ifdef DISTRIBUTE
574 CALL mp_exchange3d_bry (ng, tile, model, 1, boundary, &
575 & lbij, ubij, lbk, ubk, &
576 & nghostpoints, &
577 & ewperiodic(ng), nsperiodic(ng), &
578 & r)
579# endif
580 END IF
581
582 RETURN
subroutine mp_exchange3d_bry(ng, tile, model, nvar, boundary, lbij, ubij, lbk, ubk, nghost, ew_periodic, ns_periodic, a, b, c, d)

References mod_scalars::ewperiodic, mod_parallel::master, mp_exchange_mod::mp_exchange3d_bry(), mod_param::nghostpoints, and mod_scalars::nsperiodic.

Referenced by random_ic_mod::random_ic_tile(), and normalization_mod::randomization_tile().

Here is the call graph for this function:
Here is the caller graph for this function: