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

test/spectraloperators.jl: most tests fail when number of elem is different in x1 and x2 directions #122

Closed
valeriabarra opened this issue Aug 19, 2021 · 7 comments · Fixed by #137
Labels
bug Something isn't working

Comments

@valeriabarra
Copy link
Member

valeriabarra commented Aug 19, 2021

While running tests for the TensorProductMesh development in #82, I realized that most tests in test/spectraloperators.jl fail when exercised with a different number of elements in the different directions, e.g., with

mesh = Meshes.EquispacedRectangleMesh(domain, 15, 16)

instead of the current value (16,16).

The only three in the file that pass are the gradient , curl-curl, and the div tests.

@valeriabarra valeriabarra added the bug Something isn't working label Aug 19, 2021
@jakebolewski
Copy link
Contributor

jakebolewski commented Aug 19, 2021

Do they fail or just have a different rtol threshold?

@valeriabarra
Copy link
Member Author

For instance, the annhilator property: div-curl one gives:

annhilator property: div-curl: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:208
  Expression: norm(divcurlv) < 1.0e-12
   Evaluated: 1.0770728336308875 < 1.0e-12
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:208 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:199
Test Summary:                 | Fail  Total
annhilator property: div-curl |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:198

@jakebolewski
Copy link
Contributor

jakebolewski commented Aug 19, 2021

That intermediate DSS might be wrong, this works (at least on PR #97):

@testset "annhilator property: div-curl" begin
    v = Geometry.Covariant3Vector.(sin.(coords.x1 .+ 2 .* coords.x2))
    curl = Operators.Curl()
    div = Operators.Divergence()

    curlv = curl.(v)
    divcurlv = div.(curlv)
    Spaces.weighted_dss!(divcurlv)

    @test norm(divcurlv) < 1e-12
end

as well as:

    divcurlv = div.(curl.(v)
    Spaces.weighted_dss!(divcurlv)
    @test norm(divcurlv) < 1e-12

I'll have to think about if both forms should work when my brain is a bit less fried :) It would be good to test if the other failures are the same issue, and enumerate any other unique failures we need to look into.

@valeriabarra
Copy link
Member Author

I am not sure I can identify which ones are giving unique failures, but I can report them if that's easier for you or anyone else to identify them:

annhilator property: curl-grad: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:194
  Expression: norm(curlgradf) < 1.0e-12
   Evaluated: 1.077072833630888 < 1.0e-12
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:194 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:184
Test Summary:                  | Fail  Total
annhilator property: curl-grad |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:183
weak div: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:179
  Expression: ≈(divv, divv_ref, rtol = 0.01)
   Evaluated: Float64-valued Field:
  [-9.01898, -0.566907, 0.197179, 0.783528, 15.3015, -0.72033, -0.287674, 0.442648, 0.959776, 1.11825  …  -2.81855, -2.73177, -2.32475, -1.66925, -1.26127, 32.3432, -2.66464, -2.15346, -1.42788, 49.9297] ≈ Float64-valued Field:
  [-1.0, -0.566808, 0.197423, 0.783903, 0.988568, -0.720414, -0.28777, 0.442481, 0.959593, 1.11804  …  -2.81837, -2.73158, -2.32459, -1.66914, -1.26122, -2.81566, -2.665, -2.15372, -1.42796, -1.0] (rtol=0.01)
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:179 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:166
Test Summary: | Fail  Total
weak div      |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:165
weak curl: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:144
  Expression: ≈(curlv, Geometry.Contravariant3Vector.(curlv_ref), rtol = 0.01)
   Evaluated: ClimaCore.Geometry.AxisTensor{Float64, 1, Tuple{ClimaCore.Geometry.ContravariantAxis{(3,)}}, SVector{1, Float64}}-valued Field:
  components: 
    data: 
      1: [18.215, 2.64121, 3.71827, 4.46859, 22.2919, 2.78456, 3.36565, 4.23013, 4.67292, 4.69392  …  -1.29298, -1.12865, -0.46558, 0.548533, 1.17907, 4.93697, -0.707187, 0.193491, 1.34748, 49.7482] ≈ ClimaCore.Geometry.AxisTensor{Float64, 1, Tuple{ClimaCore.Geometry.ContravariantAxis{(3,)}}, SVector{1, Float64}}-valued Field:
  components: 
    data: 
      1: [2.0, 2.64064, 3.71965, 4.46778, 4.68026, 2.7854, 3.36408, 4.23126, 4.67122, 4.69757  …  -1.2969, -1.12725, -0.467034, 0.549745, 1.17787, -1.02608, -0.70558, 0.192939, 1.3489, 2.0] (rtol=0.01)
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:144 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:131
Test Summary: | Fail  Total
weak curl     |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:130
weak curl-strong curl: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:123
  Expression: ≈(curlcurlv, Geometry.Cartesian12Vector.(curlcurlv_ref1, curlcurlv_ref2), rtol = 0.04)
   Evaluated: ClimaCore.Geometry.Cartesian12Vector{Float64}-valued Field:
  components: 
    data: 
      1: [75.3957, 5.5722, 4.01882, 1.68285, 40.4028, 5.39709, 4.80838, 2.97759, 0.459535, -1.04194  …  3.17035, 4.1693, 5.68372, 6.46009, 6.47879, 55.583, 4.39989, 5.68199, 6.15028, -95.9795]
      2: [-8.38557, -8.64609, -6.86408, -3.88092, -5.34938, -8.64298, -8.03481, -5.82128, -2.54134, -0.544508  …  -2.6508, -4.3964, -7.17448, -8.86078, -9.18391, 45.4161, -5.23925, -7.69555, -8.9351, 86.4767] ≈ ClimaCore.Geometry.Cartesian12Vector{Float64}-valued Field:
  components: 
    data: 
      1: [6.0, 5.57024, 4.02246, 1.68052, 0.227155, 5.4041, 4.80505, 2.97971, 0.456981, -1.04049  …  3.17163, 4.16658, 5.68571, 6.45666, 6.48572, 3.48105, 4.39775, 5.68575, 6.14837, 6.0]
      2: [-9.0, -8.64442, -6.86533, -3.87939, -1.96768, -8.64696, -8.03339, -5.82257, -2.54027, -0.545325  …  -2.65139, -4.39507, -7.17557, -8.85919, -9.18777, -3.59463, -5.23801, -7.69698, -8.93349, -9.0] (rtol=0.04)
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:123 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:100
Test Summary:         | Fail  Total
weak curl-strong curl |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:99
weak curl-strong curl: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:123
  Expression: ≈(curlcurlv, Geometry.Cartesian12Vector.(curlcurlv_ref1, curlcurlv_ref2), rtol = 0.04)
   Evaluated: ClimaCore.Geometry.Cartesian12Vector{Float64}-valued Field:
  components: 
    data: 
      1: [75.3957, 5.5722, 4.01882, 1.68285, 40.4028, 5.39709, 4.80838, 2.97759, 0.459535, -1.04194  …  3.17035, 4.1693, 5.68372, 6.46009, 6.47879, 55.583, 4.39989, 5.68199, 6.15028, -95.9795]
      2: [-8.38557, -8.64609, -6.86408, -3.88092, -5.34938, -8.64298, -8.03481, -5.82128, -2.54134, -0.544508  …  -2.6508, -4.3964, -7.17448, -8.86078, -9.18391, 45.4161, -5.23925, -7.69555, -8.9351, 86.4767] ≈ ClimaCore.Geometry.Cartesian12Vector{Float64}-valued Field:
  components: 
    data: 
      1: [6.0, 5.57024, 4.02246, 1.68052, 0.227155, 5.4041, 4.80505, 2.97971, 0.456981, -1.04049  …  3.17163, 4.16658, 5.68571, 6.45666, 6.48572, 3.48105, 4.39775, 5.68575, 6.14837, 6.0]
      2: [-9.0, -8.64442, -6.86533, -3.87939, -1.96768, -8.64696, -8.03339, -5.82257, -2.54027, -0.545325  …  -2.65139, -4.39507, -7.17557, -8.85919, -9.18777, -3.59463, -5.23801, -7.69698, -8.93349, -9.0] (rtol=0.04)
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:123 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:100
Test Summary:         | Fail  Total
weak curl-strong curl |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:99
curl: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:70
  Expression: ≈(curlv, curlv_ref, rtol = 0.01)
   Evaluated: ClimaCore.Geometry.AxisTensor{Float64, 1, Tuple{ClimaCore.Geometry.ContravariantAxis{(3,)}}, SVector{1, Float64}}-valued Field:
  components: 
    data: 
      1: [0.208689, 2.64121, 3.71827, 4.46859, 2.80863, 2.78456, 3.36565, 4.23013, 4.67292, 4.69392  …  -1.29298, -1.12865, -0.46558, 0.548533, 1.17907, -1.02348, -0.707187, 0.193491, 1.34748, 2.00176] ≈ ClimaCore.Geometry.AxisTensor{Float64, 1, Tuple{ClimaCore.Geometry.ContravariantAxis{(3,)}}, SVector{1, Float64}}-valued Field:
  components: 
    data: 
      1: [2.0, 2.64064, 3.71965, 4.46778, 4.68026, 2.7854, 3.36408, 4.23126, 4.67122, 4.69757  …  -1.2969, -1.12725, -0.467034, 0.549745, 1.17787, -1.02608, -0.70558, 0.192939, 1.3489, 2.0] (rtol=0.01)
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:70 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:55
Test Summary: | Fail  Total
curl          |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:54
weak gradient: Test Failed at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:47
  Expression: ≈(gradf, Geometry.Cartesian12Vector.(cos.(coords.x1 .+ 2 .* coords.x2), 2 .* cos.(coords.x1 .+ 2 .* coords.x2)), rtol = 0.01)
   Evaluated: ClimaCore.Geometry.Cartesian12Vector{Float64}-valued Field:
  components: 
    data: 
      1: [-0.853538, -0.997393, -0.978141, -0.940558, -0.923546, -0.9908, -0.978464, -0.94105, -0.885999, -0.85015  …  -0.85015, -0.885999, -0.94105, -0.978464, -0.9908, 18.5067, -0.940558, -0.978141, -0.997393, -0.999982]
      2: [-19.7131, -1.99435, -1.95588, -1.8807, -21.33, -1.98182, -1.95709, -1.88228, -1.77213, -1.70047  …  -1.70047, -1.77213, -1.88228, -1.95709, -1.98182, -22.5417, -1.8807, -1.95588, -1.99435, -1.99957] ≈ ClimaCore.Geometry.Cartesian12Vector{Float64}-valued Field:
  components: 
    data: 
      1: [-1.0, -0.997385, -0.978148, -0.94055, -0.913545, -0.990818, -0.978457, -0.941056, -0.885992, -0.850166  …  -0.850166, -0.885992, -0.941056, -0.978457, -0.990818, -0.913545, -0.94055, -0.978148, -0.997385, -1.0]
      2: [-2.0, -1.99477, -1.9563, -1.8811, -1.82709, -1.98164, -1.95691, -1.88211, -1.77198, -1.70033  …  -1.70033, -1.77198, -1.88211, -1.95691, -1.98164, -1.82709, -1.8811, -1.9563, -1.99477, -2.0] (rtol=0.01)
Stacktrace:
 [1] macro expansion
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:47 [inlined]
 [2] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
 [3] top-level scope
   @ ~/CliMA/ClimaCore.jl/test/spectraloperators.jl:41
Test Summary: | Fail  Total
weak gradient |    1      1
ERROR: LoadError: Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/valeria/CliMA/ClimaCore.jl/test/spectraloperators.jl:40

@valeriabarra
Copy link
Member Author

@jakebolewski , I thought you mentioned that these tests passed with mesh = Meshes.EquispacedRectangleMesh(domain, 15, 16) in PR #97 (that I have seen it's been replaced by #127 ), but even after merging the latter, I still see these fail on main, including the newly introduced test for restriction/interpolation

@jakebolewski
Copy link
Contributor

please go back and read my comment

@valeriabarra
Copy link
Member Author

Ok, so you meant without the intermediate Spaces.weighted_dss!(curlv) call between the curl and the div. Sorry, I hadn't seen the difference in the code block (more words help). Thanks for confirming that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants