def collectAll(comm, rank, pos, splits, myHalo, os, fullDims, fullDepth, sp): if rank == 0: osAll = oceanState.OceanState(fullDims[0], fullDims[1], fullDims[2]) osAll.depth = fullDepth osAll.layerDepths = os.layerDepths else: osAll = dummyOs collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.E, osAll.E) collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.U, osAll.U) collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.V, osAll.V) collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.W, osAll.W) collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.T, osAll.T) collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.S, osAll.S) collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.windU, osAll.windU) collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.windV, osAll.windV) if sp.passiveTracer: collectOneVar(comm, rank, pos, splits, myHalo, fullDims, os.X, osAll.X) return osAll
def getOcean(self, imax, jmax, kmax): if self.modeSplittingOn: return oceanStateSplit.OceanStateSplit(imax, jmax, kmax) else: return oceanState.OceanState(imax, jmax, kmax)
def __init__(self, os): self.avg = oceanState.OceanState(os.imax, os.jmax, os.kmax, includeAncillaries=False) self.avg.dz = os.dz.copy() self.avg.layerDepths = os.layerDepths.copy() self.avg.depth[...] = os.depth[...] self.nValues = 0 # The number of times we have recorded values
from mpi4py import MPI import math import numpy as np import oceanState halo = 3 # The extra grid cells included around each tile representing the # interface with neightbouring tiles. # Need at least 3 grid cells halo in order to avoid errors associated with horizontal diffusivity dummyOs = oceanState.OceanState(2, 2, 2) # Dummy OceanState object def mpiSettings(comm): rank = comm.Get_rank() size = comm.Get_size() if size == 1: splits = (1, 1) # TEST elif size == 2: splits = (2, 1) elif size == 3: splits = (3, 1) elif size == 4: splits = (2, 2) elif size == 6: splits = (3, 2) elif size == 8: splits = (4, 2) elif size == 9: splits = (3, 3) elif size == 12: splits = (4, 3)