Skip to content

Vector rotation in I/O operations #1087

Description

@einola

At the moment, we assume the input and output vectors are aligned with the native coordinate system, i.e. spherical coordinates with a displaced pole over Greenland. What we should expect is:

  1. Input vectors are aligned with the input grid
  2. Output vectors are aligned with the output grid, or north and east

The rotation should be performed by the input or output routines to ensure maximum flexibility in their design and to ensure that, inside the model, all vectors are always oriented along the model coordinate system, i.e., the displaced pole over Greenland.

As an example, the current ParaGridIO based implementation of TOPAZOcean::update contains the follwoing

    // Read TOPAZ forcings at midnight
    if (std::fmod((tst.start - TimePoint()).seconds(), 86400.) == 0.) {
        forcingState = ParaGridIO::readForcingTimeStatic(forcings, tst.start, filePath);
    }

    sstExtAccessor.getHostRW() = forcingState.data.at(sstName);
    sssExtAccessor.getHostRW() = forcingState.data.at(sssName);
    mldAccessor.getHostRW() = forcingState.data.at(mldName);
    uAccessor.getHostRW() = forcingState.data.at(uName);
    vAccessor.getHostRW() = forcingState.data.at(vName);

Once updated, that code would look something like

    // Read TOPAZ forcings at midnight
    if (std::fmod((tst.start - TimePoint()).seconds(), 86400.) == 0.) {
        forcingState = ParaGridIO::readForcingTimeStatic(forcings, grid, tst.start, filePath);
    }

    sstExtAccessor.getHostRW() = forcingState.data.at(sstName);
    sssExtAccessor.getHostRW() = forcingState.data.at(sssName);
    mldAccessor.getHostRW() = forcingState.data.at(mldName);
    {uAccessor.getHostRW(),  vAccessor.getHostRW()} = forcingState.getVectorFields(uName, vName);

This would require sending grid information to ParaGridIO::readFocingTimeStatic and implementing a new function getVectorFields in ParagridIO. Importantly, we would want getVectorFields to belong to a separate (base) class, so that it can be used in the XIOS implementation as well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions