XGC1
Modules | Functions/Subroutines
petsc_solver_init.F90 File Reference
#include "petsc_version_defs.h"
#include <petsc/finclude/petscts.h>
Include dependency graph for petsc_solver_init.F90:

Modules

module  petsc_solver_module
 

Functions/Subroutines

subroutine petsc_solver_module::init_ksp_comm (nnode)
 Initializes an MPI communicator for use with PETSc KSP solves (Poisson, Ampere). The size of the KSP comm group is set such that, if possible, the number of equations per MPI rank is larger than 5000, which is roughly the weak scaling rollover. More...
 
integer(c_int) function petsc_solver_module::get_sml_ksp_root (i_ksp)
 
subroutine petsc_solver_module::petsc_get_sizes (grid, bc, n_equation, n_boundary, xgc_petsc, petsc_xgc_bd)
 Calculate (i) the number of equations (vertices) of the solver, (ii) the number of XGC boundary vertices included in the solver, (iii) (preliminary) mapping from XGC vertices to PETSc equations, (iv) mapping from XGC vertices to PETSc boundary conditions, all based the XGC boundary object passed as input. More...
 
subroutine petsc_solver_module::petsc_get_bd_map (grid, bc, n_boundary, petsc_xgc_bd, petsc_bd_xgc)
 Generate mapping from PETSc boundary conditions to XGC vertices. This requires the results of petsc_get_sizes because the number of boundary conditions is not known a priori. More...
 
subroutine petsc_solver_module::getnnz (grid, nloc, low, high, d_nnz, o_nnz, xgc_petsc, nglobal, ierr)
 Computes the number of non-zero entries nnz per row in the rank-local rows. More...
 
subroutine petsc_solver_module::petsc_get_partitioning (grid, bc, b_factors, comm, num_pe, n_eq_tot_in, set_diffusion_matrix, xgc_petsc, petsc_xgc_bd, n_eq_loc, xgc_proc_out, proc_eq, ierr)
 Generates a domain partitioning of part of the XGC mesh used by a solver (as defined by the boundary conditions bc) using Parmetis and generates a mapping between PETSc equation index and XGC MPI ranks (those in the communicator comm used by the solver). More...
 
subroutine petsc_solver_module::petsc_get_mapping (nnode, bc, comm, num_pe, n_eq_tot, n_eq_loc, xgc_proc, proc_eq, xgc_petsc, petsc_xgc, petscloc_xgc)
 Based on the Parmetis partition of the XGC domain, updates the mappings between XGC vertices and PETSc equations. More...
 
subroutine petsc_solver_module::petsc_get_template_mat (grid, comm, n_eq_tot, n_eq_loc, xgc_petsc, solver_template_mat, ierr)
 Uses pre-computed (petsc_get_partitioning) local matrix sizes and XGC vertex to PETSc equation mapping to set up a blank template matrix with sufficient pre-allocated memory. More...
 
subroutine petsc_solver_module::petsc_get_bc_mat (solver, n_eq_tot, n_eq_loc, ierr)
 Creates the (empty) LHS and RHS matrices for Dirichlet boundary conditions. More...
 
subroutine petsc_solver_module::petsc_get_fsa_mat (solver, n_eq_tot, n_eq_loc, ierr)
 creates and allocates interior/surface FSA matrices More...
 
subroutine petsc_solver_module::petsc_get_fsa_bc_mat (solver, ierr)
 creates and allocates boundary/surface FSA matrices More...
 
subroutine petsc_solver_module::petsc_get_scatter_one_block (solver, nnode, n_eq_tot, n_eq_loc, petsc_xgc, ierr)
 Generate PETSc scatter mapping from XGC vertices to PETSc equation for a simple solver with one equation (block). Also sets up the corresponding LHS and RHS PETSc vectors. More...
 
subroutine petsc_solver_module::petsc_get_scatter_multi_block (nnode, ksp, mat_all_blocks, mat_one_block, blocksize, varnames, n_eq_tot, n_eq_loc, petscloc_xgc, petsc_xgc, iss, to_petsc, from_petsc, ierr)
 Sets up a PETSc scatter object for a (2D) multi-block field-split solver. More...
 
subroutine petsc_solver_module::petsc_to_xgc (nnode, blocksize, from_petsc, field_petsc, field_xgc, ierr)
 This routine scatters values from the distributed vector compatible with the block-matrix of the 2D diffusion model to local variables on the XGC solver grid. More...
 
subroutine petsc_solver_module::petsc_to_xgc_bd (nn, this, x, xvec)
 Scatters a PETSc vector to XGC boundary data. More...
 
subroutine petsc_solver_module::xgc_to_petsc (nnode, blocksize, to_petsc, field_petsc, field_xgc, ierr)
 This routine scatters values from local variable on the XGC solver grid to the distributed vector compatible with the block-matrix of the 2D diffusion model. More...
 
subroutine petsc_solver_module::xgc_to_petsc_bd (nn, this, x, xvec)
 Scatters XGC boundary data to a PETSc vector. More...
 
subroutine petsc_solver_module::create_1field_solver (solver, mat, ierr)
 Creates a PETSc KSP solver for a one-block system, i.e., for a single equation on the XGC mesh. More...
 
subroutine petsc_solver_module::create_axisym_iter_solver (solver, ierr)
 Creates and sets up the PETSc KSP solver and preconditioner for inverting the axisymmetric Poisson operator. More...
 
subroutine petsc_solver_module::diffusion_matrix_init (diffusion_ts, grid, bc, solver_template_mat, ierr)
 Set up a template matrix for XGC's anomalous diffusion time integrator. This is currently a system of either 4 (adiabatic electrons) or 7 (kinetic electrons) equations. Impurities are not supported yet. More...
 
subroutine petsc_solver_module::set_adiabatic_blending_weights (grid, vec, xgc_petsc, ierr)
 Sets values in a PETSc vector according to the blending function \(\alpha(\psi)\), where \(\alpha = 1\) in region 1 for \(\psi \le \psi_{\mathrm{in}}\), \(\alpha = \frac{\psi_{\textrm{out}} - \psi}{\psi_{\textrm{out}} - \psi_{\textrm{in}}}\) in region 1 for \(\psi_{\mathrm{in}} \lt \psi \lt \psi_{\mathrm{out}}\), and \(\alpha = 0\) in region 1 for \(\psi_{\mathrm{out}} \le \psi\) and outside of region 1. More...
 
subroutine petsc_solver_module::create_helmholtz_solver (solver, b_factors, grid, bc, ierr)
 Set up a KSP solver for a single Helmholtz-type equation (Poisson equation, Ampere's law) More...
 
subroutine petsc_solver_module::create_spectral_helmholtz_solver (solver, b_factors, grid, bc, ntor, ierr)
 Set up a KSP solver for a single toroidal mode number component of Helmholtz-type equation (Poisson equation, Ampere's law) More...
 
subroutine petsc_solver_module::init_and_create (grid, solver, b_factors, bd, scale_vec, is_spectral, is_update, is_axisym)
 
subroutine petsc_solver_module::lhs_set_alpha_beta (grid, solver_data, alpha, beta, scale_loc, skin_norm, is_ampere_cv, is_ampere, is_axisym, n_rhs_mat)
 
subroutine petsc_solver_module::lhs_set_matrix_entries (grid, alpha, beta, b_factors, is_spectral, is_update, bd, scale_vec, solver)
 
subroutine petsc_solver_module::rhs1_set_alpha_beta (grid, solver_data, alpha, beta, scale_loc, use_pade)
 
subroutine petsc_solver_module::rhs1_set_matrix_entries (grid, alpha, beta, b_factors, is_spectral, is_update, bd, solver)
 
subroutine petsc_solver_module::rhs2_set_alpha_beta (grid, solver_data, alpha, beta, scale_loc, skin_norm, is_ampere_cv, is_ampere, is_axisym)
 
subroutine petsc_solver_module::rhs2_set_matrix_entries (grid, alpha, beta, b_factors, is_spectral, is_update, is_ampere, bd, scale_vec, solver)
 
subroutine petsc_solver_module::iter_solver_set_alpha_beta (grid, solver_data, alpha, beta, scale_loc)
 
subroutine petsc_solver_module::iter_solver_set_matrix_entries (grid, alpha, beta, b_factors, bd, solver)
 
subroutine petsc_solver_module::setup_iter_solver_precond (solver, is_update)
 
subroutine petsc_solver_module::spectral_assemble (solver, n_rhs_mat)
 
subroutine petsc_solver_module::create_and_scatter (grid, solver, is_spectral, is_axisym)
 
subroutine petsc_solver_module::init_helmholtz_solver (psn, grid, solver, solver_data, bd, comm, prefix, n_rhs_mat, is_axisym, is_spectral, is_ampere, is_ampere_cv, is_update)
 Setup routine for the Poisson and the Ampere's law solvers This routine can be used for the initial set up, i.e., initializing the the distributed PETSc matrices and the KSP solver, and for updating exisiting solvers for the evolving background profiles. More...