Last change
on this file since 6331 was
6331,
checked in by aclsce, 17 months ago
|
Moved oasis-mct_5.0 in oasis3-mct/branches directory.
|
File size:
1.0 KB
|
Line | |
---|
1 | #!/usr/bin/env python3 |
---|
2 | |
---|
3 | import pyoasis |
---|
4 | from pyoasis import OASIS |
---|
5 | import numpy |
---|
6 | |
---|
7 | from mpi4py import MPI |
---|
8 | |
---|
9 | comm = MPI.COMM_WORLD |
---|
10 | |
---|
11 | component_name = "sender-orange" |
---|
12 | |
---|
13 | comp = pyoasis.Component(component_name, True, comm) |
---|
14 | |
---|
15 | local_comm_rank = comp.localcomm.rank |
---|
16 | local_comm_size = comp.localcomm.size |
---|
17 | |
---|
18 | coupled = True |
---|
19 | if local_comm_size > 3: |
---|
20 | if local_comm_rank >= local_comm_size - 2: |
---|
21 | coupled = False |
---|
22 | |
---|
23 | print(comp, flush=True) |
---|
24 | |
---|
25 | comp.create_couplcomm(coupled) |
---|
26 | |
---|
27 | if coupled: |
---|
28 | comm_rank = comp.couplcomm.rank |
---|
29 | comm_size = comp.couplcomm.size |
---|
30 | |
---|
31 | n_points = 16 |
---|
32 | extent = int(n_points / comm_size) |
---|
33 | offset = comm_rank * extent |
---|
34 | |
---|
35 | offsets = [offset] |
---|
36 | extents = [extent] |
---|
37 | |
---|
38 | partition = pyoasis.OrangePartition(offsets, extents) |
---|
39 | print(partition, flush=True) |
---|
40 | |
---|
41 | variable = pyoasis.Var("FSENDOCN", partition, OASIS.OUT) |
---|
42 | print(variable, flush=True) |
---|
43 | |
---|
44 | comp.enddef() |
---|
45 | |
---|
46 | if coupled: |
---|
47 | date = int(0) |
---|
48 | |
---|
49 | field = pyoasis.asarray(numpy.zeros(extent)) |
---|
50 | for i in range(extent): |
---|
51 | field[i] = offset + i |
---|
52 | |
---|
53 | variable.put(date, field) |
---|
54 | |
---|
55 | del comp |
---|
Note: See
TracBrowser
for help on using the repository browser.