1 subroutine da_set_randomcv(cv_size, rcv)
3 !---------------------------------------------------------------------------
4 ! Purpose: Allocate components of control variable.
6 ! Method: Allocate component in turn.
7 !---------------------------------------------------------------------------
11 integer, intent(in) :: cv_size
12 real, intent(inout) :: rcv(1:cv_size) ! Control variable structure.
15 real :: mean_cv, rms_cv, std_dev_cv
16 real :: sum_cv, sum_cv2
18 if (trace_use) call da_trace_entry("da_set_randomcv")
20 ! [1] Initialize random number generator and scalars:
22 !moved to da_solve.inc
28 ! [2] Calculate random numbers with Gaussian distribution:
31 call da_gauss_noise(rcv(i))
33 sum_cv = sum_cv + rcv(i)
34 sum_cv2 = sum_cv2 + rcv(i) * rcv(i)
37 mean_cv = sum_cv / real(cv_size)
38 rms_cv = sqrt(sum_cv2 / real(cv_size))
39 std_dev_cv = sqrt(rms_cv * rms_cv - mean_cv * mean_cv)
41 write(unit=stdout,fmt=*)
42 write(unit=stdout,fmt='(a)')' Gaussian (Normal) noise statistics:'
43 write(unit=stdout,fmt='(a,f15.5)')' Mean = ', mean_cv
44 write(unit=stdout,fmt='(a,f15.5)')' RMS = ', rms_cv
45 write(unit=stdout,fmt='(a,f15.5)')' STD DEV = ', std_dev_cv
47 if (trace_use) call da_trace_exit("da_set_randomcv")
49 end subroutine da_set_randomcv