EMPIRE DA  v1.9.1
Data assimilation codes using EMPIRE communication
 All Classes Files Functions Variables Pages
user_perturb_particle.f90
Go to the documentation of this file.
1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 !!! Time-stamp: <2015-05-06 11:14:07 pbrowne>
3 !!!
4 !!! Subroutine to implement user specific initial perturbations
5 !!! Copyright (C) 2015 Philip A. Browne
6 !!!
7 !!! This program is free software: you can redistribute it and/or modify
8 !!! it under the terms of the GNU General Public License as published by
9 !!! the Free Software Foundation, either version 3 of the License, or
10 !!! (at your option) any later version.
11 !!!
12 !!! This program is distributed in the hope that it will be useful,
13 !!! but WITHOUT ANY WARRANTY; without even the implied warranty of
14 !!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 !!! GNU General Public License for more details.
16 !!!
17 !!! You should have received a copy of the GNU General Public License
18 !!! along with this program. If not, see <http://www.gnu.org/licenses/>.
19 !!!
20 !!! Email: p.browne @ reading.ac.uk
21 !!! Mail: School of Mathematical and Physical Sciences,
22 !!! University of Reading,
23 !!! Reading, UK
24 !!! RG6 6BB
25 !!!
26 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27 
34 subroutine user_perturb_particle(n,x)
35  integer, parameter :: rk=kind(1.0d0)
36  integer, intent(in) :: n
37  real(kind=rk), dimension(n), intent(inout) :: x
38 
39 
40  !specific variables needed for uniform perturbation example
41  real(kind=rk), dimension(n) :: lower,upper,unif
42 
43  !set lower bound
44  lower = -10.0d0
45 
46  !ser upper bound
47  upper = 15.0d0
48 
49  !get random numbers in [0,1]
50  call uniformrandomnumbers1d(0.0d0, 1.0d0, n,unif)
51 
52  !scale and shift unif in [0,1] to [lower,upper]
53  unif = unif*(upper-lower) + lower
54 
55  !now add this perturbation to the state
56  x = x + unif
57 
58 
59 end subroutine user_perturb_particle
subroutine user_perturb_particle(n, x)
Subroutine to perturb state vector as defined by the user governed by the init option.
subroutine uniformrandomnumbers1d(minv, maxv, n, phi)
generate one dimension of uniform random numbers
Definition: gen_rand.f90:59