Last change
on this file was
5725,
checked in by aclsce, 3 years ago
|
Added new oasis3-MCT version to be used to handle ensembles simulations with XIOS.
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/usr/bin/env python3 |
---|
2 | |
---|
3 | import pyoasis |
---|
4 | from pyoasis import OASIS |
---|
5 | import numpy as np |
---|
6 | |
---|
7 | comp = pyoasis.Component("sender-serial") |
---|
8 | print(comp) |
---|
9 | |
---|
10 | n_points = 1 |
---|
11 | partition = pyoasis.SerialPartition(n_points) |
---|
12 | |
---|
13 | var_1 = pyoasis.Var("FSENDOCN_1", partition, OASIS.OUT) |
---|
14 | print("Sender ", var_1) |
---|
15 | var_2 = pyoasis.Var("FSENDOCN_2", partition, OASIS.OUT) |
---|
16 | print("Sender ", var_2) |
---|
17 | |
---|
18 | comp.enddef() |
---|
19 | |
---|
20 | intra_one = comp.get_intracomm("receiver_one") |
---|
21 | print("Sender intra_one: rank = {} of {}".format(intra_one.rank, |
---|
22 | intra_one.size)) |
---|
23 | |
---|
24 | inter_two = comp.get_intercomm("receiver_two") |
---|
25 | print("Sender inter_two: rank = {} of {}".format(inter_two.rank, |
---|
26 | inter_two.size)) |
---|
27 | |
---|
28 | print("Sender: coupling frequencies for {} are ".format(var_2.name), |
---|
29 | var_2.cpl_freqs, flush=True) |
---|
30 | |
---|
31 | for date in range(43200): |
---|
32 | |
---|
33 | if var_1.put_inquire(date) == OASIS.SENT: |
---|
34 | var_1.put(date, pyoasis.asarray([date], dtype=np.float64)) |
---|
35 | |
---|
36 | if any([date % freq == 0 for freq in var_2.cpl_freqs]): |
---|
37 | comp.debug_level = 2 |
---|
38 | var_2.put(date, pyoasis.asarray([-1.*date], dtype=np.float64), |
---|
39 | date % 10800 == 0) |
---|
40 | comp.debug_level = 0 |
---|
41 | if date == 0: |
---|
42 | print("PyOasis debug level set to {}".format(comp.debug_level)) |
---|
43 | |
---|
44 | del comp |
---|
Note: See
TracBrowser
for help on using the repository browser.