dxss package#

Submodules#

dxss.gmres module#

dxss.gmres.convergence_monitor(ksp, its, rnorm)[source]#

A simple rate-printing convergence monitor.

The function trace is dictated by PETSc. https://petsc.org/release/petsc4py/reference/petsc4py.typing.KSPMonitorFunction.html

Parameters:
  • ksp (KSP) – The PETSc.KSP instance. Currently unused (ARG001). Needed to comply with PETSc’s monitor function format.

  • its (int) – The iteration count passed in by PETSc.

  • rnorm (float) – The (estimated) 2-norm of (preconditioned) residual.

Return type:

None

Note: The rnorm is _not_ the relative normalisation despite its name.

dxss.gmres.get_gmres_solution(A, b, pre, maxsteps=100, tol=None, restart=None, printrates=True, reltol=None)[source]#

Solve linear system A @ x = b with generalized minimal residual method (GMRes).

Uses PETSc GMRes implementation.

Parameters:
  • A – Object implementing PETSc MatPythonProtocol to use as matrix A.

  • b (Vec) – PETSc vector object to use as right-hand side term b.

  • pre – Object implementing PCPythonProtocol to use as GMRes preconditioner.

  • maxsteps (int) – Maximum number of GMRes iterations to use.

  • tol (Optional[float]) – Absolute convergence tolerance - absolute size of the (preconditioned) residual norm.

  • restart (Optional[int]) – Number of iterations after which to restart.

  • printrates (bool) – Whether to show convergence statistics during solving.

  • reltol (Optional[float]) – Relative convergence tolerance, relative decrease in the (preconditioned) residual norm.

Return type:

tuple[Vec, Vec]

dxss.meshes module#

dxss.meshes.create_initial_mesh_convex(init_h_scale=1.0)[source]#
dxss.meshes.get_3d_mesh_data_all_around(n_ref, init_h_scale=1.0)[source]#
dxss.meshes.get_mesh_bottom_data(h_init=1.25, eta=0.6)[source]#
dxss.meshes.get_mesh_convex(n_ref, init_h_scale=1.0)[source]#
dxss.meshes.get_mesh_data_all_around(n_ref, init_h_scale=1.0)[source]#
dxss.meshes.get_mesh_hierarchy(n_ref, init_h_scale=1.0)[source]#
dxss.meshes.get_mesh_hierarchy_fitted_disc(n_ref, eta, h_init=1.25)[source]#
dxss.meshes.get_mesh_hierarchy_nonconvex(n_ref, init_h_scale=1.0)[source]#
dxss.meshes.get_mesh_inclusion(h_init=1.25, order=2)[source]#
dxss.meshes.get_mesh_inclusion_square(h_init=1.25, x_l=-1.25, x_r=1.25, y_l=-1.25, y_r=1.25, eta=1.25)[source]#

dxss.precomp_time_int module#

class dxss.precomp_time_int.QuadRule(name, npoints)[source]#

Bases: object

current_pts(a, b)[source]#
t_weights(delta_t)[source]#
dxss.precomp_time_int.d_theta_ref(tau)[source]#
dxss.precomp_time_int.get_elmat_time(q, qstar)[source]#
dxss.precomp_time_int.theta_ref(tau)[source]#

dxss.solve_1d module#

class dxss.solve_1d.PySolver(Asp, psolver)[source]#

Bases: object

solve(b_inp, x_out)[source]#
dxss.solve_1d.dt_sample_sol(t, xu)[source]#
dxss.solve_1d.get_lu_solver(msh, mat)[source]#
dxss.solve_1d.omega_ind_convex(x)[source]#
dxss.solve_1d.omega_ind_nogcc(x)[source]#
dxss.solve_1d.sample_sol(t, xu)[source]#
dxss.solve_1d.solve_problem(measure_errors=False)[source]#

dxss.solve_2d module#

class dxss.solve_2d.PySolver(Asp, psolver)[source]#

Bases: object

solve(b_inp, x_out)[source]#
dxss.solve_2d.dt_sample_sol(t, xu)[source]#
dxss.solve_2d.get_lu_solver(msh, mat)[source]#
dxss.solve_2d.omega_ind_convex(x)[source]#
dxss.solve_2d.sample_sol(t, xu)[source]#
dxss.solve_2d.solve_problem(measure_errors=False)[source]#

dxss.solve_3d module#

class dxss.solve_3d.PySolver(Asp, psolver)[source]#

Bases: object

solve(b_inp, x_out)[source]#
dxss.solve_3d.dt_sample_sol(t, xu)[source]#
dxss.solve_3d.get_lu_solver(msh, mat)[source]#
dxss.solve_3d.omega_ind(x)[source]#
dxss.solve_3d.sample_sol(t, xu)[source]#
dxss.solve_3d.solve_problem(measure_errors=False)[source]#

dxss.space_time module#

class dxss.space_time.DataDomain(indicator_function=None, fitted=True)[source]#

Bases: object

fitted: bool = True#
indicator_function: Union[Callable, Function] = None#
class dxss.space_time.OrderSpace(k, kstar)[source]#

Bases: object

k: int#
kstar: int#
class dxss.space_time.OrderTime(q, qstar)[source]#

Bases: object

q: int#
qstar: int#
class dxss.space_time.ProblemParameters(jumps_in_fw_problem=False, well_posed=False)[source]#

Bases: object

jumps_in_fw_problem: bool = False#
well_posed: bool = False#
class dxss.space_time.SpaceTime(polynomial_order_time, polynomial_order_space, N, T, t, msh, stabilisation_terms, omega, solution, parameters=ProblemParameters(jumps_in_fw_problem=False, well_posed=False))[source]#

Bases: object

apply_spacetime_matrix(vec_in, vec_out)[source]#
coupling_matrix_between_slices_multiply(vec_in, vec_out)[source]#
get_slab_bfi()[source]#
get_slab_bfi_first_slab()[source]#
get_slab_matrix()[source]#
get_slab_matrix_first_slab()[source]#
get_spacetime_bfi(precond=False)[source]#
get_spacetime_lfi()[source]#
get_spacetime_matrix(precond=False)[source]#
get_spacetime_matrix_coarse()[source]#
get_spacetime_rhs()[source]#
measured_errors(u_inp, verbose=False)[source]#
plot(uh_inp, n_space=100, n_time_subdiv=10, abs_val=False)[source]#
plot_error(uh_inp, n_space=100, n_time_subdiv=10)[source]#
plot_para_view(uh_inp, name='abserr')[source]#
pre_time_marching(b, x_sol)[source]#
pre_time_marching_improved(b, x_sol)[source]#
pre_twolvl(b, x_sol)[source]#
prepare_coarse_grid_correction(msh_coarse)[source]#
prepare_precondition_gmres()[source]#
prolongation(x_coarse, x_fine)[source]#
q_op(x_in, x_out)[source]#
restriction(x_coarse, x_fine)[source]#
set_solver_coarse(solver)[source]#
set_solver_first_slab(solver)[source]#
set_solver_slab(solver)[source]#
setup_coupling_matrix_between_slices()[source]#
setup_rhs()[source]#
setup_scaled_mass_matrix_between_slices()[source]#
setup_slab_matrix(with_jumps=True)[source]#
setup_spacetime_finite_elements()[source]#
setup_spacetime_matrix(afes, precond=False)[source]#
slab_matrix_no_dg_jumps_multiply(vec_in, vec_out)[source]#
class dxss.space_time.SpaceTimePETScMatrixWrapper(space_time)[source]#

Bases: object

Class wrapping space-time solver to provide interface for use as PETSc.Mat.

The required interface is documented at https://petsc.org/main/petsc4py/petsc_python_types.html#petsc-python-mat

Parameters:

space_time (SpaceTime) – Space time solver instance to wrap.

mult(mat, vec_in, vec_out)[source]#

Matrix vector multiplication vec_out = mat @ vec_in.

Parameters:
  • mat (Mat) – PETSc matrix holding PETSc data structures. Unused.

  • vec_in (Vec) – The vector to perform matrix multiplication with.

  • vec_out (Vec) – The vector to write result of multiplication to.

Return type:

None

class dxss.space_time.SpaceTimePETScPreconditionerWrapper(space_time)[source]#

Bases: object

Class wrapping space-time solver to provide interface for use as PETSc.PC.

Uses the space-time solvers improved time-marching preconditioner.

The required interface is documented at https://petsc.org/main/petsc4py/petsc_python_types.html#petsc-python-preconditioner-type

Parameters:

space_time (SpaceTime) – Space time solver instance to wrap.

apply(pc, vec_in, vec_out)[source]#

Apply preconditioner to vector vec_in writing out to vec_out.

Parameters:
  • pc (PC) – PETSc preconditioner holding PETSc data structures. Unused.

  • vec_in (Vec) – The vector to apply preconditioner to.

  • vec_out (Vec) – The vector to write result of preconditioning vec_in to.

Return type:

None

class dxss.space_time.ValueAndDerivative(v, dvdt)[source]#

Bases: object

dvdt: ndarray#
v: ndarray#
dxss.space_time.get_sparse_matrix(mat)[source]#

Module contents#

DOLFINx space-time finite element space time slab solvers.