EMPIRE DA  v1.9.1
Data assimilation codes using EMPIRE communication
 All Classes Files Functions Variables Pages
minimal_empire.f90
Go to the documentation of this file.
1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 !!! Time-stamp: <2016-12-13 18:16:21 pbrowne>
3 !!!
4 !!! minimal code to setup and test empire comms
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 
31  use comms
32  use pf_control
33  use sizes
34  implicit none
35  include 'mpif.h'
36  integer :: mpi_err,total_timesteps,i,j
37 
38  real(kind=kind(1.0d0)), allocatable, dimension(:,:) :: x
39 
40 
41  print*,'RUNNING MINIMAL_EMPIRE'
42  print*,'EMPIRE COUPLING VERSION ',comm_version
43 
44 
45  print*,'Reading state_dim from file state_dim: '
46  open(11,file='state_dim',action='read',status='old')
47  read(11,*) state_dim
48  close(11)
49 
50 
52  call initialise_mpi
53 
54 
55  print*,'allocating space for state vector (',state_dim,',',cnt,'):'
56  allocate(x(state_dim,cnt))
57 
58 
59  print*,'Reading total_timesteps from file timesteps: '
60  open(11,file='timesteps',action='read',status='old')
61  read(11,*) total_timesteps
62  close(11)
63  print*,'Total timesteps read as ',total_timesteps
64 
65  print*,'receiving initial states'
66  call recv_all_models(state_dim,cnt,x)
67  do j = 1,state_dim
68  x(j,:) = x(j,:) + j
69  end do
70 
71  do i = 1,total_timesteps
72  print*,'starting timestep ',i
73  call send_all_models(state_dim,cnt,x,1)
74  call recv_all_models(state_dim,cnt,x)
75  do j = 1,state_dim
76  x(j,:) = x(j,:) + j
77  end do
78 
79  end do
80 
81  print*,'sending final states'
82  call send_all_models(state_dim,cnt,x,3)
83 
84 
85 
86  call mpi_finalize(mpi_err)
87  print*,'MINIMAL_EMPIRE got to the end without breaking!'
88  print*,'my communicators were: ',cpl_mpi_comms(:)
89 
90 
91 
92 
93 end program minimal_empire
94 
95 
subroutine send_all_models(stateDim, nrhs, x, tag)
subroutine to send all the model states to the models
Definition: comms.f90:945
Module containing EMPIRE coupling data.
Definition: comms.f90:57
subroutine recv_all_models(stateDim, nrhs, x)
subroutine to receive all the model states from the models after
Definition: comms.f90:993
subroutine initialise_mpi(mdl_id, cpl_root, cpl_mpi_comm)
program minimal_empire
the main program
Module that stores the dimension of observation and state spaces.
Definition: sizes.f90:29
module pf_control holds all the information to control the the main program
Definition: pf_control.f90:29