Last change
on this file since 6328 was
6328,
checked in by aclsce, 17 months ago
|
First import of oasis3-mct_5.0 (from oasis git server, branch OASIS3-MCT_5.0)
|
File size:
716 bytes
|
Line | |
---|
1 | #!/usr/bin/env python3 |
---|
2 | |
---|
3 | import numpy |
---|
4 | import pyoasis |
---|
5 | from pyoasis import OASIS |
---|
6 | from mpi4py import MPI |
---|
7 | |
---|
8 | component_name = "receiver" |
---|
9 | |
---|
10 | commworld = MPI.COMM_WORLD.Split(1) |
---|
11 | comp = pyoasis.Component(component_name, communicator = commworld) |
---|
12 | print(comp) |
---|
13 | |
---|
14 | n_points = 1600 |
---|
15 | |
---|
16 | partition = pyoasis.SerialPartition(n_points) |
---|
17 | print(partition) |
---|
18 | |
---|
19 | variable = pyoasis.Var("FRECVATM", partition, OASIS.IN) |
---|
20 | print(variable) |
---|
21 | |
---|
22 | comp.enddef() |
---|
23 | |
---|
24 | date = int(0) |
---|
25 | field = pyoasis.asarray(numpy.zeros(n_points)) |
---|
26 | |
---|
27 | variable.get(date, field) |
---|
28 | |
---|
29 | expected_field = pyoasis.asarray(numpy.arange(n_points, dtype=numpy.float64)) |
---|
30 | epsilon = 1e-8 |
---|
31 | error = numpy.abs(field - expected_field).sum() |
---|
32 | if error < epsilon: |
---|
33 | print("Data received successfully") |
---|
34 | |
---|
35 | del comp |
---|
Note: See
TracBrowser
for help on using the repository browser.