-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
61 lines (45 loc) · 1.86 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""This file is part of pyPDAF
Copyright (C) 2022 University of Reading and
National Centre for Earth Observation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import log
import config
import model
import model_integrator
from parallelisation import parallelisation
from PDAF_system import PDAF_system
def main():
pe = parallelisation(dim_ens=config.dim_ens, n_modeltasks=config.n_modeltasks)
# Initial Screen output
if pe.mype_ens == 0:
log.logger.info('+++++ PDAF online mode +++++')
log.logger.info('2D model with parallelization')
# Initialise model
# throughout this example and PDAF, we must assume that each ensemble member
# uses the same domain decomposition.
model_ens = [model.model(pe=pe) for i in range(pe.dim_ens_l)]
model_ens[0].print_info(pe)
if not config.USE_PDAF:
model_ens.init_field(pe.mype_model)
# Initialise model integrator
integrator = model_integrator.model_integrator(model_ens)
# Initialise PDAF system
das = PDAF_system(pe, model_ens)
if config.USE_PDAF:
das.init_pdaf(screen=config.screen)
integrator.forward(config.nsteps, das)
if config.USE_PDAF:
das.finalise()
pe.finalize_parallel()
if __name__ == '__main__':
main()