Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extended cubed-sphere dual halo with a correct alpha-beta projection. #90

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5a4895f
Added ghost field to CubedSphereCellColumns functionspace.
odlomax Dec 21, 2021
8fbd001
Permitted variable sized halos on functionspaces.
odlomax Jan 5, 2022
fc5a717
Addressed reviewer comments.
odlomax Jan 10, 2022
dc3fe67
Added extended halo on cubed sphere dual mesh.
odlomax Jan 14, 2022
ed1daad
Added test for extended dual mesh halo
odlomax Jan 14, 2022
e7f3246
Added test for extended dual mesh halo
odlomax Jan 14, 2022
6289bf7
Addressed reviewer comments.
odlomax Jan 17, 2022
8c44238
Removed rank restrictions on redistribution class.
odlomax Jan 18, 2022
1f32272
Added xy to alphabeta method (and inverse) to CubedeSphereProjectionB…
odlomax Jan 25, 2022
fd301d8
Addressed reviewer comments. Added list initialisation to square matr…
odlomax Jan 31, 2022
64b52e6
Made cubedsphere mesh generator test cheaper.
odlomax Jan 31, 2022
384d4a0
Addressed reviewer comments and minor tidy up.
odlomax Feb 1, 2022
ab09059
Merged with ecmwf/develop.
odlomax Feb 2, 2022
0243b01
Removed JacobianXY class and added general Matrix class.
odlomax Feb 9, 2022
1640d54
Removed JacobianXY class and added general Matrix class.
odlomax Feb 9, 2022
e7d65fe
Fixed type error.
odlomax Feb 9, 2022
3c27320
Identified issue with transpose call.
odlomax Feb 9, 2022
5706bee
Tidy up. Forgot to add cols and rows method to matrix.
odlomax Feb 9, 2022
ed6de7d
Added extra bounds checking.
odlomax Feb 9, 2022
d439b6b
Added extra bounds checking.
odlomax Feb 9, 2022
5afcfc8
Linked to eckit_maths lib.
odlomax Feb 10, 2022
9d83c22
Added cwiseProduct.
odlomax Feb 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/atlas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ util/KDTree.cc
util/KDTree.h
util/PolygonXY.cc
util/PolygonXY.h
util/Matrix.h
util/Metadata.cc
util/Metadata.h
util/Point.cc
Expand Down Expand Up @@ -908,6 +909,7 @@ target_link_libraries( atlas PUBLIC
eckit
eckit_geometry
eckit_linalg
eckit_maths
eckit_mpi
eckit_option
)
Expand Down
5 changes: 5 additions & 0 deletions src/atlas/functionspace/CubedSphereColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ idx_t CubedSphereColumns<BaseFunctionSpace>::index(idx_t t, idx_t i, idx_t j) co
return cubedSphereColumnsHandle_.get()->index(t, i, j);
}

template <typename BaseFunctionSpace>
bool CubedSphereColumns<BaseFunctionSpace>::is_valid_index(idx_t t, idx_t i, idx_t j) const {
return cubedSphereColumnsHandle_.get()->is_valid_index(t, i, j);
}

template <typename BaseFunctionSpace>
Field CubedSphereColumns<BaseFunctionSpace>::tij() const {
return cubedSphereColumnsHandle_.get()->tij();
Expand Down
3 changes: 3 additions & 0 deletions src/atlas/functionspace/CubedSphereColumns.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class CubedSphereColumns : public BaseFunctionSpace {
/// Return array_view index for (t, i, j).
idx_t index(idx_t t, idx_t i, idx_t j) const;

/// Return true if (t, i, j) is a valid index.
bool is_valid_index(idx_t t, idx_t i, idx_t j) const;

/// Return tij field.
Field tij() const;

Expand Down
23 changes: 23 additions & 0 deletions src/atlas/functionspace/detail/CubedSphereStructure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,29 @@ idx_t CubedSphereStructure::index(idx_t t, idx_t i, idx_t j) const {
return tijToIdx_[static_cast<size_t>(t)][vecIndex(t, i, j)];
}

bool CubedSphereStructure::is_valid_index(idx_t t, idx_t i, idx_t j) const {


// Check if t is in range.
if (t < 0 || t > 5) {
return false;
}

// Check if i and j are in range in index method.
if ( i < i_begin(t) || i >= i_end(t) ||
j < j_begin(t) || j >= j_end(t)) {
return false;
}

// Check if (t, i, j) is a valid index.
if (index(t, i, j) == invalid_index()) {
return false;
}

return true;

}

Field CubedSphereStructure::tij() const {
return tij_;
}
Expand Down
4 changes: 4 additions & 0 deletions src/atlas/functionspace/detail/CubedSphereStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ class CubedSphereStructure : public util::Object {
/// Return array_view index for (t, i, j).
idx_t index(idx_t t, idx_t i, idx_t j) const;

/// Return true if (t, i, j) is a valid index.
bool is_valid_index(idx_t t, idx_t i, idx_t j) const;


/// Return ijt field.
Field tij() const;

Expand Down
12 changes: 11 additions & 1 deletion src/atlas/grid/CubedSphereGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,19 @@ class CubedSphereGrid : public Grid {
// Return the size of the cubed sphere grid, where N is the number of grid boxes along the edge of a tile
inline int N() const { return grid_->N(); }

// Return the number of tiles
/// @brief return tiles object.
inline atlas::grid::CubedSphereTiles tiles() const { return grid_->tiles(); }

/// @brief return cubed sphere projection object.
inline const projection::detail::CubedSphereProjectionBase& cubedSphereProjection() const {

const auto projPtr =
dynamic_cast<const projection::detail::CubedSphereProjectionBase*>
(projection().get());

return *projPtr;
};

temporary::IterateTIJ tij() const { return temporary::IterateTIJ(*grid_); }

const std::string& stagger() const { return grid_->stagger(); }
Expand Down
8 changes: 8 additions & 0 deletions src/atlas/grid/Tiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,13 @@ std::ostream& operator<<(std::ostream& os, const CubedSphereTiles& t) {
return os;
}

const PointXY& CubedSphereTiles::tileCentre(size_t t) const {
return get()->tileCentre(t);
}

const util::Matrix22& CubedSphereTiles::tileJacobian(size_t t) const {
return get()->tileJacobian(t);
}

} // namespace grid
} // namespace atlas
8 changes: 8 additions & 0 deletions src/atlas/grid/Tiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "atlas/library/config.h"
#include "atlas/util/ObjectHandle.h"
#include "atlas/util/Matrix.h"

//---------------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -85,6 +86,13 @@ class CubedSphereTiles : DOXYGEN_HIDE(public util::ObjectHandle<atlas::grid::det
// a "diagonal" extension over corners of the cube.
atlas::PointXY tileCubePeriodicity(const atlas::PointXY& xyExtended, const atlas::idx_t tile) const;

/// @brief Return the position of the tile centre in xy space.
const PointXY& tileCentre(size_t t) const;

/// @brief Return the Jacobian of xy with respect to the curvilinear
/// coordinates of the tile.
const util::Matrix22& tileJacobian(size_t t) const;

private:
/// Output to stream
void print(std::ostream&) const;
Expand Down
9 changes: 9 additions & 0 deletions src/atlas/grid/detail/tiles/FV3Tiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,15 @@ void FV3CubedSphereTiles::print(std::ostream& os) const {
}


const PointXY& FV3CubedSphereTiles::tileCentre(size_t t) const {
throw_NotImplemented("tileCentre not implemented for FV3Tiles", Here());
}

const util::Matrix22& FV3CubedSphereTiles::tileJacobian(size_t t) const {
throw_NotImplemented("tileJacobian not implemented for FV3Tiles", Here());;
}


namespace {
static CubedSphereTilesBuilder<FV3CubedSphereTiles> register_builder(FV3CubedSphereTiles::static_type());
}
Expand Down
5 changes: 5 additions & 0 deletions src/atlas/grid/detail/tiles/FV3Tiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ class FV3CubedSphereTiles : public CubedSphereTiles {

virtual void print(std::ostream&) const override;

virtual const PointXY& tileCentre(size_t t) const override;

virtual const util::Matrix22& tileJacobian(size_t t) const override;


private:
};

Expand Down
Loading