1 subroutine da_apply_power (power, max_wavenumber, ccv, c_cvsize)
3 !-------------------------------------------------------------------------
4 ! Purpose: Adjust power spectrum for the control variable
5 !-------------------------------------------------------------------------
9 integer, intent(in) :: max_wavenumber ! Smallest scale required (ni/2 - 1).
10 integer, intent(in) :: c_cvsize ! Size of complex cv-array
11 real*8, intent(in) :: power(0:max_wavenumber) ! Power Spectrum
12 complex, intent(inout):: ccv(1:c_cvsize) ! complex control array
14 integer :: m, n, index
16 ! Adjust Power spectrum
18 do n =0, max_wavenumber
20 ccv(n+1) = ccv(n+1) * sqrt (power(n)/(2*n+1))
23 index = m*(max_wavenumber+1- m) + m*(m+1)/2+n-m + 1
24 ccv(index) = ccv(index) * sqrt (power(n)/(2*n+1))
28 end subroutine da_apply_power