MCPcopy Create free account
hub / github.com/DedalusProject/dedalus / test_trace_explicit

Function test_trace_explicit

dedalus/tests/test_cartesian_operators.py:138–147  ·  view source on GitHub ↗

Test explicit evaluation of trace operator for correctness.

(basis, N, dealias, dtype, layout)

Source from the content-addressed store, hash-verified

136@pytest.mark.parametrize('dtype', dtype_range)
137@pytest.mark.parametrize('layout', ['c', 'g'])
138def test_trace_explicit(basis, N, dealias, dtype, layout):
139 """Test explicit evaluation of trace operator for correctness."""
140 c, d, b, r = basis(N, dealias, dtype)
141 # Random tensor field
142 f = d.TensorField((c,c), bases=b)
143 f.fill_random(layout='g')
144 # Evaluate trace
145 f.change_layout(layout)
146 g = d3.trace(f).evaluate()
147 assert np.allclose(g[layout], np.trace(f[layout]))
148
149
150@pytest.mark.parametrize('basis', [build_FF, build_FC, build_CC, build_FFF, build_FFC])

Callers

nothing calls this directly

Calls 4

TensorFieldMethod · 0.80
fill_randomMethod · 0.80
change_layoutMethod · 0.80
evaluateMethod · 0.45

Tested by

no test coverage detected