Skip to content

Commit 3292328

Browse files
committed
Refactor Geometry module
1 parent 17b220f commit 3292328

68 files changed

Lines changed: 1593 additions & 3752 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildkite/Manifest.toml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.buildkite/perf/pipeline.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ steps:
2424
- "echo $$JULIA_DEPOT_PATH"
2525
- echo "--- Instantiate AMIP env"
2626
# Instantiate and dev install ClimaCore
27-
- "julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'"
28-
- 'julia --project=$COUPLER_PATH/experiments/AMIP/ -e ''using Pkg; Pkg.develop(path=".")'''
29-
- 'julia --project=$COUPLER_PATH/experiments/AMIP/ -e ''using Pkg; Pkg.add("MPI")'''
30-
- "julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.precompile()'"
31-
- "julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.status()'"
27+
- julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'
28+
- julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.develop(path=".")'
29+
- julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.add("MPI")'
30+
- julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.precompile()'
31+
- julia --project=$COUPLER_PATH/experiments/AMIP/ -e 'using Pkg; Pkg.status()'
3232
agents:
3333
slurm_gpus: 1
3434
slurm_cpus_per_task: 8

.buildkite/pipeline.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ steps:
252252
retry: *retry_policy
253253
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/geometry.jl"
254254

255-
- label: "Unit: axistensors"
256-
key: unit_axistensors
255+
- label: "Unit: tensors"
256+
key: unit_tensors
257257
retry: *retry_policy
258-
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/axistensors.jl"
258+
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/Geometry/tensors.jl"
259259

260260
- label: "Unit: mul_with_projection"
261261
key: unit_mul_with_projection
@@ -1090,12 +1090,12 @@ steps:
10901090
agents:
10911091
slurm_gpus: 1
10921092

1093-
- label: "Unit: field_matrix_indexing (CPU)"
1093+
- label: "Unit: field matrix indexing (CPU)"
10941094
key: cpu_field_matrix_indexing
10951095
retry: *retry_policy
10961096
command: "julia --color=yes --check-bounds=yes --project=.buildkite test/MatrixFields/field_matrix_indexing.jl"
10971097

1098-
- label: "Unit: field_matrix_indexing (GPU)"
1098+
- label: "Unit: field matrix indexing (GPU)"
10991099
key: gpu_field_matrix_indexing
11001100
retry: *retry_policy
11011101
command: "julia --color=yes --project=.buildkite test/MatrixFields/field_matrix_indexing.jl"
@@ -1621,14 +1621,6 @@ steps:
16211621

16221622
# TODO: improve performance label: [inference, allocs, flops, latency, benchmark, boundscheck]
16231623
# TODO: use perf env for perf jobs, or merge test/perf envs
1624-
- group: "Perf: Geometry"
1625-
steps:
1626-
1627-
- label: "Perf: Axis tensor conversion benchmarks"
1628-
key: "cpu_axis_tensor_conversion_perf_bm"
1629-
retry: *retry_policy
1630-
command: "julia --color=yes --project=.buildkite test/Geometry/axistensor_conversion_benchmarks.jl"
1631-
16321624
- group: "Perf: DataLayouts"
16331625
steps:
16341626

@@ -2500,9 +2492,10 @@ steps:
25002492
command:
25012493
- "julia --color=yes --project=.buildkite examples/hybrid/driver.jl"
25022494
artifact_paths:
2503-
- "examples/hybrid/sphere/output/held_suarez_rhoe/Float32/*"
2495+
- "examples/hybrid/sphere/output/held_suarez_rhoe/Float64/*"
25042496
env:
25052497
TEST_NAME: "sphere/held_suarez_rhoe"
2498+
FLOAT_TYPE: "Float64"
25062499

25072500
- label: ":computer: Float64 3D sphere dry Held-Suarez (ρθ)"
25082501
key: "cpu_held_suarez_rho_theta_float64"

.github/workflows/ClimaCoreVTK.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
sudo apt-get update && sudo apt-get -y install paraview python3-paraview
2828
- name: Install Julia dependencies
2929
run: |
30-
julia --project=monorepo -e 'using Pkg; Pkg.develop(path="$(pwd())/lib/ClimaCoreVTK")'
30+
julia --project=monorepo -e 'using Pkg; Pkg.develop(path="lib/ClimaCoreVTK")'
31+
julia --project=monorepo -e 'using Pkg; Pkg.develop(path=".")'
3132
- name: Run the tests
3233
env:
3334
CI_OUTPUT_DIR: output

.github/workflows/docs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ jobs:
1616
with:
1717
version: '1.10'
1818
- name: Install dependencies
19-
run: julia --project=docs -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate(;verbose=true)'
19+
run: >
20+
julia --project=docs -e 'using Pkg; Pkg.develop(path=".");
21+
Pkg.develop(path="lib/ClimaCoreVTK");
22+
Pkg.instantiate(;verbose=true)'
2023
- name: Build and deploy
2124
env:
2225
GKSwstype: "100" # headless GR: https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/2

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2424
MultiBroadcastFusion = "c3c07f87-98de-43f2-a76f-835b330b2cbb"
2525
NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f"
2626
PkgVersion = "eebad327-c553-4316-9ea0-9fa01ccd7688"
27+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2728
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
2829
RootSolvers = "7181ea78-2dcb-4de3-ab41-2b8ab5a31e74"
2930
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

docs/src/APIs/geometry_api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Geometry.LocalGeometry
2020
## Internals
2121

2222
```@docs
23-
Geometry.Δz_metric_component
2423
Geometry.:⊗
2524
```
2625

docs/src/matrix_fields.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ scalar_field_matrix
108108
A FieldMatrix entry can be:
109109

110110
- A `UniformScaling`, which contains a `Number`
111-
- A `DiagonalMatrixRow`, which can contain either a `Number` or a tensor (represented as a `Geometry.Axis2Tensor`)
111+
- A `DiagonalMatrixRow` containing a `Number` or a `Geometry.Tensor{2}`. The
112+
tensor's basis is whatever the user supplies; there's no padding convention
113+
imposed here.
112114
- A `ColumnwiseBandMatrixField`, where each value is a [`BandMatrixRow`](@ref) with entries of any type that can be represented using the field's base number type.
113115

114116
If an entry contains a composite type, the fields of that type can be extracted.
@@ -173,8 +175,8 @@ The recursive indexing of an internal entry given some entry `entry` and interna
173175
works as follows:
174176

175177
1. If the `internal_name_pair` is blank, return `entry`
176-
2. If the element type of each band of `entry` is an `Axis2Tensor`, and `internal_name_pair` is of the form `(@name(components.data.1...), @name(components.data.2...))` (potentially with different numbers), then extract the specified component, and recurse on it with the remaining `internal_name_pair`.
177-
3. If the element type of each band of `entry` is a `Geometry.AdjointAxisVector`, then recurse on the parent of the adjoint.
178+
2. If the element type of each band of `entry` is a `Geometry.Tensor{2}`, and `internal_name_pair` is of the form `(@name(components.data.1...), @name(components.data.2...))` (potentially with different numbers), then extract the specified component, and recurse on it with the remaining `internal_name_pair`.
179+
3. If the element type of each band of `entry` is an `Adjoint` of a `Geometry.AbstractTensor{1}` (an adjoint rank-1 tensor), then recurse on the parent of the adjoint.
178180
4. If `internal_name_pair[1]` is not empty, and the first name in it is a field of the element type of each band of `entry`, extract that field from `entry`, and recurse into it with the remaining names of `internal_name_pair[1]` and all of `internal_name_pair[2]`
179181
5. If `internal_name_pair[2]` is not empty, and the first name in it is a field of the element type of each band of `entry`, extract that field from `entry`, and recurse into it with all of `internal_name_pair[1]` and the remaining names of `internal_name_pair[2]`
180182
6. At this point, if none of the previous cases are true, both `internal_name_pair[1]` and `internal_name_pair[2]` should be non-empty, and it is assumed that `entry` is being used to implicitly represent some tensor structure. If the first name in `internal_name_pair[1]` is equivalent to `internal_name_pair[2]`, then both the first names are dropped, and entry is recursed onto. If the first names are different, both the first names are dropped, and the zero of entry is recursed onto.

examples/hybrid/box/bubble_3d_rhotheta.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ function rhs!(dY, Y, _, t)
253253
# Horizontal momentum
254254
@. dρuₕ += -uvdivf2c(ρw If(uₕ))
255255
Ih = Ref(
256-
Geometry.Axis2Tensor(
256+
Geometry.Tensor(
257+
I,
257258
(Geometry.UVAxis(), Geometry.UVAxis()),
258-
@SMatrix [1.0 0.0; 0.0 1.0]
259259
),
260260
)
261261
@. dρuₕ -= hdiv(ρuₕ uₕ + p * Ih)

examples/hybrid/implicit_equation_jacobian.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ function ImplicitEquationJacobian(Y, transform, flags = (;))
6262
ᶠ𝕄_name = @name(f.w)
6363

6464
BidiagonalRow_C3 = BidiagonalMatrixRow{C3{FT}}
65-
BidiagonalRow_ACT3 = BidiagonalMatrixRow{Adjoint{FT, CT3{FT}}}
66-
QuaddiagonalRow_ACT3 = QuaddiagonalMatrixRow{Adjoint{FT, CT3{FT}}}
65+
BidiagonalRow_ACT3 = BidiagonalMatrixRow{typeof(CT3(FT(0))')}
66+
QuaddiagonalRow_ACT3 = QuaddiagonalMatrixRow{typeof(CT3(FT(0))')}
6767
TridiagonalRow_C3xACT3 =
6868
TridiagonalMatrixRow{typeof(C3(FT(0)) * CT3(FT(0))')}
6969
∂ᶜ𝔼ₜ∂ᶠ𝕄_Row_ACT3 =
7070
flags.∂ᶜ𝔼ₜ∂ᶠ𝕄_mode == :exact && :ρe in propertynames(Y.c) ?
7171
QuaddiagonalRow_ACT3 : BidiagonalRow_ACT3
72-
∂Yₜ∂Y = FieldMatrix(
72+
∂Yₜ∂Y = MatrixFields.FieldMatrix(
7373
(ᶜρ_name, ᶠ𝕄_name) => zeros(BidiagonalRow_ACT3, axes(Y.c)),
7474
(ᶜ𝔼_name, ᶠ𝕄_name) => zeros(∂ᶜ𝔼ₜ∂ᶠ𝕄_Row_ACT3, axes(Y.c)),
7575
(ᶠ𝕄_name, ᶜρ_name) => zeros(BidiagonalRow_C3, axes(Y.f)),

0 commit comments

Comments
 (0)