DESC icon indicating copy to clipboard operation
DESC copied to clipboard

Surfaces can compute more than they should

Open unalmis opened this issue 1 year ago • 3 comments

We have things in the list of variables that we say we can compute on certain objects, but shouldn't be able. One could be misled that a quantity not typically associated with their surface was computed somehow by integrating on the boundary, or just by sampling the given surface.

If a quantity cannot be computed on an object, we should just not have a compute function for that object instead of setting dummy zero values.

Stetting dummy values causes bugs. For example n_rho defined as $\nabla \rho / \Vert \nabla \rho \Vert$ should not be defined on a ZernikeRZToroidalSection. But we say it is, and give it a dummy value of 0. Now, the area of that cross-section is well-defined, however we compute that area using n_rho, and since that dependency is a dummy for this surface, it shouldn't give the correct value.

unalmis avatar Jul 12 '24 20:07 unalmis

Remove @pytest.mark.xfail(reason="GitHub issue 1127.") from tests/test_configuration.py::TestGetSurfaces::test_get_zeta_surface once resolved.

unalmis avatar Jul 20 '24 17:07 unalmis

Fix for this is to remove the Surface level implementations of the compute quantities in question, and implement them only for the subclasses that actually make sense

dpanici avatar Aug 13 '24 19:08 dpanici

Note discussed in dev meeting: if redesigning to propagate nan for quantities that can't be computed, then make sure surface_integral class doesn't mask out all nan quantities. Just mask out nan on the axis.

unalmis avatar Feb 26 '25 21:02 unalmis

Would resolution of this issue make sense to happen on #1094 ? @unalmis

dpanici avatar May 09 '25 13:05 dpanici

Either there or separate is fine

unalmis avatar May 09 '25 17:05 unalmis

I think I will do it separate for now. That branch still has some things that have to be fixed it seems and it requires this to be done anyways

dpanici avatar May 09 '25 19:05 dpanici

I have a PR I think addressing this now. Basically,

  • For "desc.geometry.surface.FourierRZToroidalSurface" , the radial derivative is undefined (is a constant rho surface so has no notion of how things change off-surface), so any $\partial_{\rho}$ quantity is now undefined
    • also has its own implementation of n_rho which has no axis limit defined (avoiding errors from the data index when it tried to build n_rho dependencies for the surface, and saw that the surface has no radial deriv defined which are needed for the axis limit of n_rho

"desc.geometry.surface.ZernikeRZToroidalSection" , the toroidal derivative is undefined (is a constant zeta surface so has no notion of how things change off-surface), so any $\partial_{\zeta}$ quantity is now undefined

  • I also added a differente perimeter(z) implementation that is actually at constant zeta, not constant phi, as it makes no sense to ask for the perimeter at constant phi of a ZernikeRZToroidalSection that maybe has nonzero omega, as it is defined only at constant zeta

"desc.geometry.core.Surface" parametrization is only used for quantities well-defined by both of the above subclasses (basically only things that need no derivs or theta derivs only)

dpanici avatar May 14 '25 16:05 dpanici