spectre.utils ============= .. py:module:: spectre.utils Module Contents --------------- .. py:function:: find_res_infaces(q, qres) Ex use: 'surfaces=find_res_infaces(1/o.input.physics.iota[1:], 2.0)' .. py:function:: get_xinit_specwrap(test) .. py:class:: Timer .. py:function:: create_runfile(name, ext, run) .. py:function:: periodic_integrator_thzt(f, t, z) Integrates strictly periodic f where t, z are grids with 0, d, 2d, ..., 2pi-d .. py:function:: get_fsa_wrapper(f, test) .. py:function:: get_freal_fsa(test) .. py:function:: get_freal_fsa_metric(test) .. py:function:: check_fsa_vols(test) .. py:function:: get_xmn(x, test, m, n, lvol=None) .. py:function:: reshape_fjac(fjac, nt, nz) .. py:function:: reshape_modes_fjac(fjac, im_, in_, mpol, ntor, nvol, nt, nz) .. py:function:: get_fmn_force_mask(test) .. py:function:: remove_file(fname) .. py:function:: infaces_unflatten(x, test, add_psifactor=False) .. py:function:: infaces_flatten(r, z, test, add_psifactor=False) .. py:function:: unpack_interfaces(xin, test) .. py:function:: pack_interfaces(r_even, r_odd, z_even, z_odd, test) .. py:function:: get_vec_pot_flat(test) Get vector potential from the current solution. Found using `test.wrapper_funcs_mod.get_vec_pot` Args: test (SPECTRE): Wrapper object Returns: ndarray[float]: At cosine coefficients, shape (sum(lrad+1), mn) ndarray[float]: Az cosine coefficients, shape (sum(lrad+1), mn) ndarray[float]: At sine coefficients, shape (sum(lrad+1), mn) ndarray[float]: Az sine coefficients, shape (sum(lrad+1), mn) .. py:function:: get_vec_pot(test) Get vector potential from the current solution. Found using `test.wrapper_funcs_mod.get_vec_pot` Args: test (SPECTRE): Wrapper object Returns: List[ndarray[float]]: At cosine coefficients, list of arrays with shape (lrad, mn) List[ndarray[float]]: Az cosine coefficients, list of arrays with shape (lrad, mn) List[ndarray[float]]: At sine coefficients, list of arrays with shape (lrad, mn) List[ndarray[float]]: Az sine coefficients, list of arrays with shape (lrad, mn) .. py:function:: update_bnorm(test, first_free_bound, print_info=False) Update B.n on computational boundary from plasma using virtual-casing principle first_free_bound: Sets which surface current is used for the virtual-casing True: the surface current on the inner face of plasma boundary False: the surface current on the outer face of the plasma boundary (requires a solution of vacuum field which in turn requires B.n from plasma) .. py:function:: filter_stellsym_pts(arr, nt, nz) Takes an array on the full (nt, nz) grid and returns only the unique stellarator-symmetric components. Conserves the sum of squared arr (up to a constant factor), e.g. sum(arr**2) == 2 * sum(filter_stellsym_pts(arr**2,...)). .. py:function:: save_errors_to_h5(filename_h5, fsa_err, beltrami_errors_avg, beltrami_errors_max, f_errs_rms, f_errs_max)