Last change
on this file since 5725 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:
671 bytes
|
Rev | Line | |
---|
[5725] | 1 | #!/usr/bin/env python3 |
---|
| 2 | |
---|
| 3 | import pyoasis |
---|
| 4 | from pyoasis import OASIS |
---|
| 5 | from mpi4py import MPI |
---|
| 6 | |
---|
| 7 | comm = MPI.COMM_WORLD |
---|
| 8 | |
---|
| 9 | component_name = "sender-points" |
---|
| 10 | |
---|
| 11 | comp = pyoasis.Component(component_name, True, comm) |
---|
| 12 | |
---|
| 13 | print(comp) |
---|
| 14 | |
---|
| 15 | n_points = 16 |
---|
| 16 | |
---|
| 17 | comm_rank = comp.localcomm.rank |
---|
| 18 | comm_size = comp.localcomm.size |
---|
| 19 | |
---|
| 20 | local_size = int(n_points/comm_size) |
---|
| 21 | offset = comm_rank*local_size |
---|
| 22 | |
---|
| 23 | indices = [] |
---|
| 24 | for i in range(local_size): |
---|
| 25 | indices.append(offset + i) |
---|
| 26 | |
---|
| 27 | partition = pyoasis.PointsPartition(indices) |
---|
| 28 | print(partition) |
---|
| 29 | |
---|
| 30 | variable = pyoasis.Var("FSENDOCN", partition, OASIS.OUT) |
---|
| 31 | print(variable) |
---|
| 32 | |
---|
| 33 | comp.enddef() |
---|
| 34 | |
---|
| 35 | date = int(0) |
---|
| 36 | |
---|
| 37 | field = pyoasis.asarray(indices) |
---|
| 38 | |
---|
| 39 | variable.put(date, field) |
---|
| 40 | |
---|
| 41 | del comp |
---|
Note: See
TracBrowser
for help on using the repository browser.