示例#1
0
 def __call__(
     self,
     u: Quantity,
     v: Quantity,
     ua: FloatField,
     va: FloatField,
     comm: CubedSphereCommunicator,
 ):
     """
     Interpolate D-grid to A-grid winds at latitude-longitude coordinates.
     Args:
         u: x-wind on D-grid (in)
         v: y-wind on D-grid (in)
         ua: x-wind on A-grid (out)
         va: y-wind on A-grid (out)
         comm: Cubed-sphere communicator
     """
     if self._do_ord4:
         comm.vector_halo_update(u, v, n_points=self._n_halo)
     self._compute_cubed_to_latlon(
         u.storage,
         v.storage,
         self._dx,
         self._dy,
         self._a11,
         self._a12,
         self._a21,
         self._a22,
         ua,
         va,
     )
示例#2
0
文件: c2l_ord.py 项目: twicki/fv3core
def compute_cubed_to_latlon(
    u: Quantity,
    v: Quantity,
    ua: FloatField,
    va: FloatField,
    comm: CubedSphereCommunicator,
    do_halo_update: bool,
):
    """
    Interpolate D-grid to A-grid winds at latitude-longitude coordinates.

    Args:
        u: x-wind on D-grid (in)
        v: y-wind on D-grid (in)
        ua: x-wind on A-grid (out)
        va: y-wind on A-grid (out)
        comm: Cubed-sphere communicator
        do_halo_update: If True, performs a halo update on u and v
    """
    grid = spec.grid

    if spec.namelist.c2l_ord == 2:
        c2l_ord2(
            u.storage,
            v.storage,
            grid.dx,
            grid.dy,
            grid.a11,
            grid.a12,
            grid.a21,
            grid.a22,
            ua,
            va,
            origin=grid.compute_origin(add=(-1, -1,
                                            0) if do_halo_update else (0, 0,
                                                                       0)),
            domain=grid.domain_shape_compute(
                add=(2, 2, 0) if do_halo_update else (0, 0, 0)),
        )
    else:
        if do_halo_update:
            comm.vector_halo_update(u, v, n_points=grid.halo)
        ord4_transform(
            u.storage,
            v.storage,
            grid.a11,
            grid.a12,
            grid.a21,
            grid.a22,
            grid.dx,
            grid.dy,
            ua,
            va,
            origin=grid.compute_origin(),
            domain=grid.domain_shape_compute(),
        )
示例#3
0
    # set backend
    fv3core.set_backend("numpy")

    # get another namelist for the communicator??
    nml2 = yaml.safe_load(
        open("/fv3core/examples/wrapped/config/c12_6ranks_standard.yml",
             "r"))["namelist"]

    sizer = SubtileGridSizer.from_namelist(nml2)
    allocator = QuantityFactory.from_backend(sizer, fv3core.get_backend())

    # MPI stuff
    comm = mpi4py.MPI.COMM_WORLD
    rank = comm.Get_rank()
    cube_comm = CubedSphereCommunicator(
        comm, CubedSpherePartitioner.from_namelist(nml2))

    # Set the names of quantities in State. This is everything coming from
    # wrapper.initialize.
    initial_names = [
        "specific_humidity",
        "cloud_water_mixing_ratio",
        "rain_mixing_ratio",
        "snow_mixing_ratio",
        "cloud_ice_mixing_ratio",
        "graupel_mixing_ratio",
        "ozone_mixing_ratio",
        "cloud_fraction",
        "air_temperature",
        "pressure_thickness_of_atmospheric_layer",
        "vertical_thickness_of_atmospheric_layer",
示例#4
0
    # set backend
    fv3core.set_backend("numpy")

    # get another namelist for the communicator??
    nml2 = yaml.safe_load(open("/fv3core/examples/wrapped/config/baroclinic.yml", "r"))[
        "namelist"
    ]

    sizer = SubtileGridSizer.from_namelist(nml2)
    allocator = QuantityFactory.from_backend(sizer, fv3core.get_backend())

    # MPI stuff
    comm = mpi4py.MPI.COMM_WORLD
    rank = comm.Get_rank()
    cube_comm = CubedSphereCommunicator(
        comm, CubedSpherePartitioner.from_namelist(nml2)
    )

    # Set the names of quantities in State. This is everything coming from
    # wrapper.initialize
    initial_names = [
        "specific_humidity",
        "cloud_water_mixing_ratio",
        "rain_mixing_ratio",
        "snow_mixing_ratio",
        "cloud_ice_mixing_ratio",
        "graupel_mixing_ratio",
        "ozone_mixing_ratio",
        "air_temperature",
        "pressure_thickness_of_atmospheric_layer",
        "vertical_thickness_of_atmospheric_layer",