calculus
moment_kinetics.calculus
— Modulemoment_kinetics.calculus.derivative!
— Methodderivative!(df, f, coord, spectral)
Non-upwinding derivative.
moment_kinetics.calculus.derivative!
— Methodderivative!(df, f, coord, adv_fac, spectral)
Upwinding derivative.
moment_kinetics.calculus.derivative_elements_to_full_grid!
— Methodmoment_kinetics.calculus.derivative_elements_to_full_grid!
— Methodmoment_kinetics.calculus.elements_to_full_grid_interior_pts!
— Methodmaps the derivative at points away from element boundaries from the grid/element representation to the full grid representation
moment_kinetics.calculus.elementwise_derivative!
— Functionelementwise_derivative!(coord, f, adv_fac, spectral)
elementwise_derivative!(coord, f, spectral)
Generic function for element-by-element derivatives
First signature, with adv_fac
, calculates an upwind derivative, the second signature calculates a derivative without upwinding information.
Result is stored in coord.scratch_2d.
moment_kinetics.calculus.elementwise_indefinite_integration!
— Functionmoment_kinetics.calculus.elementwise_indefinite_integration!
— MethodA function that takes the indefinite integral in each element of coord.grid
, leaving the result (element-wise) in coord.scratch_2d
.
moment_kinetics.calculus.indefinite_integral!
— Methodindefinite_integral!(pf, f, coord, spectral)
Indefinite line integral.
This function is designed to work on local-in-memory data only, with distributed-memory MPI not implemented here. A function which integrates along a line which is distributed in memory exists in moment_kinetics.em_fields
as calculate_phi_from_Epar!()
. The distributed-memory functionality could be ported to a generic function, similiar to how the derivative! functions are generalised in moment_kinetics.derivatives
.
moment_kinetics.calculus.indefinite_integral_elements_to_full_grid!
— Methodmoment_kinetics.calculus.integral
— MethodComputes the integral of the 3D integrand, using the input wgts
moment_kinetics.calculus.integral
— MethodComputes the integral of the integrand multiplied by v^n, using the input wgts
moment_kinetics.calculus.integral
— MethodComputes the integral of the 2D integrand, using the input wgts
moment_kinetics.calculus.integral
— MethodComputes the integral of the integrand multiplied by v, using the input wgts
moment_kinetics.calculus.integral
— MethodComputes the integral of the integrand, using the input wgts
moment_kinetics.calculus.integral
— MethodCompute the 2D integral ∫d^2vperp.dvpa prefactor(vperp,vpa)*integrand
In this variant vperp
and vpa
should be coordinate
objects.
Note that vperp_wgts contains the extra factor of vperp required for the Jacobian.
moment_kinetics.calculus.integral
— MethodCompute the 1D integral ∫dv prefactor(v)*integrand
In this variant v
should be a coordinate
object.
moment_kinetics.calculus.integral
— MethodCompute the 3D integral ∫dvzeta.dvr.dvz prefactor(vzeta,vr,vz)*integrand
In this variant vzeta
, vr
, and vz
should be coordinate
objects.
moment_kinetics.calculus.mass_matrix_solve!
— Functionmass_matrix_solve!(f, b, spectral::weak_discretization_info)
Solve
\[M.f = b\]
for $a$, where $M$ is the mass matrix of a weak-form finite element method and $b$ is an input.
moment_kinetics.calculus.reconcile_element_boundaries_upwind!
— Methodif at the boundary point within the element, must carefully choose which value of df to use; this is because df is multi-valued at the overlapping point at the boundary between neighboring elements. here we choose to use the value of df from the upwind element.