feat(operator): implement grad operator in spherical coordinates
@@ -13,3 +13,10 @@ def spherical_curl(u_r, u_theta, u_phi, r, theta, phi):
curl_phi = (d_r(u_theta * r) - d_theta(u_r)) / r
return curl_r, curl_theta, curl_phi
+
+
+def spherical_grad(u, r, theta, phi):
+ grad_r = diff(u, r)
+ grad_theta = diff(u, theta) / r
+ grad_phi = diff(u, phi) / (r * sin(theta))
+ return grad_r, grad_theta, grad_phi
