Cyclops Base¶
Library of miscellaneous helper functions for Cyclops init/admin tasks.
Functions¶
- read_ICs : Read initial conditions from the Polvani experiments
- geopotential_transform : Transform the height field from (u,v,h) to skew-Hermitian (u,v,phi)
- inv_geopotential_transform : Transform the height field from skew-Hermitian (u,v,phi) to (u,v,h)
- compute_L_2_error : Compute the L_2 error between two vectors
- compute_L_infty_error : Compute the L_infty (sup-norm) error between two vectors
- h_init : Generate an initially stationary Gaussian height field for testing
-
cyclops_base.compute_L_2_error(U_hat_ref, U_hat_approx)[source]¶ Computes and returns the L_2 error.
The L_2 error is defined as:
\[L_{2} = \frac{\sqrt{\sum e^{2}}}{\sqrt{\sum u_{ref}^{2}}}\]where e is the absolute error.
The errors are computed in Fourier space but returned in real space. The returned error is the L_2 error of all three variables together.
The reference solution will generally be the solution at the previous iteration, which is used for measuring convergence.
Parameters
- U_hat_ref : the solution at the previous timestep (or a reference solution)
- U_hat_approx : the solution at the current timestep
- st : spectral toolbox object
Returns
- error : The computed L_2 error
-
cyclops_base.compute_L_infty_error(U_hat_ref, U_hat_approx)[source]¶ Compute the L_infty error at a given timestep.
The L_infty error is defined as:
\[L_{\infty} = \max\left|\frac{U_{new}-U_{old}}{U_{old}}\right|\]The errors are computed in Fourier space but returned in real space. The returned error is the greatest of the errors computed for both velocities and the height.
The reference solution will generally be the solution at the previous iteration, which is used for measuring convergence.
Parameters
- U_hat_ref : the solution at the previous timestep (or a reference solution)
- U_hat_approx : the solution at the current timestep
- st : spectral toolbox object
Returns
- error : The computed L_infty error
-
cyclops_base.compute_errors(U_hat_old, U_hat_new)[source]¶ Call-through to the two error-computing methods.
This method is used to analyse the iterative error and compared the current and previous timesteps. Both the L_inf and L_2 errors are computed.
Parameters
- U_hat_old : the solution at the previous timestep
- U_hat_new : the solution at the current timestep
Returns
- errors : a list containing the L_inf and L_2 errors, respectively
See Also
compute_L_infty_error, compute_L_2_error