1#ifndef __CS_SLES_PETSC_H__
2#define __CS_SLES_PETSC_H__
34#include <petscviewer.h>
133 PetscBool is_initialized;
134 PetscInitialized(&is_initialized);
136 if (is_initialized == PETSC_FALSE) {
140 PetscInitializeNoArguments();
155 PetscViewerCreate(PETSC_COMM_WORLD, &v);
156 PetscViewerSetType(v, PETSCVIEWERASCII);
157 PetscViewerFileSetMode(v, FILE_MODE_APPEND);
158 PetscViewerFileSetName(v,
"petsc_setup.log");
161 PetscViewerDestroy(&v);
MPI_Comm cs_glob_mpi_comm
Definition cs_defs.c:181
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
#define END_C_DECLS
Definition cs_defs.h:468
cs_halo_rotation_t
Definition cs_halo.h:60
cs_log_t
Definition cs_log.h:48
struct _cs_matrix_t cs_matrix_t
Definition cs_matrix.h:90
cs_sles_convergence_state_t
Definition cs_sles.h:56
struct _cs_sles_t cs_sles_t
Definition cs_sles.h:68
void cs_sles_petsc_setup(void *context, const char *name, const cs_matrix_t *a, int verbosity)
Setup PETSc linear equation solver.
Definition cs_sles_petsc.c:729
cs_sles_petsc_t * cs_sles_petsc_define(int f_id, const char *name, MatType matrix_type, cs_sles_petsc_setup_hook_t *setup_hook, void *context)
Define and associate a PETSc linear system solver for a given field or equation name.
Definition cs_sles_petsc.c:536
cs_sles_convergence_state_t cs_sles_petsc_solve(void *context, const char *name, const cs_matrix_t *a, int verbosity, cs_halo_rotation_t rotation_mode, double precision, double r_norm, int *n_iter, double *residue, const cs_real_t *rhs, cs_real_t *vx, size_t aux_size, void *aux_vectors)
Call PETSc linear equation solver.
Definition cs_sles_petsc.c:1301
static void cs_sles_petsc_init(void)
Definition cs_sles_petsc.h:127
static void cs_sles_petsc_log_setup(KSP ksp)
Definition cs_sles_petsc.h:151
bool cs_sles_petsc_error_post_and_abort(cs_sles_t *sles, cs_sles_convergence_state_t state, const cs_matrix_t *a, cs_halo_rotation_t rotation_mode, const cs_real_t *rhs, cs_real_t *vx)
Error handler for PETSc solver.
Definition cs_sles_petsc.c:1524
cs_sles_petsc_t * cs_sles_petsc_create(MatType matrix_type, cs_sles_petsc_setup_hook_t *setup_hook, void *context)
Create PETSc linear system solver info and context.
Definition cs_sles_petsc.c:582
void * cs_sles_petsc_copy(const void *context)
Create PETSc linear system solver info and context based on existing info and context.
Definition cs_sles_petsc.c:659
void cs_sles_petsc_destroy(void **context)
Destroy PETSc linear system solver info and context.
Definition cs_sles_petsc.c:683
void() cs_sles_petsc_setup_hook_t(void *context, Mat a, KSP ksp)
Function pointer for user settings of a PETSc KSP solver setup.
Definition cs_sles_petsc.h:78
struct _cs_sles_petsc_t cs_sles_petsc_t
Definition cs_sles_petsc.h:84
void cs_sles_petsc_log(const void *context, cs_log_t log_type)
Log sparse linear equation solver info.
Definition cs_sles_petsc.c:1566
void cs_sles_petsc_free(void *context)
Free PETSc linear equation solver setup context.
Definition cs_sles_petsc.c:1477
void cs_user_sles_petsc_hook(void *context, Mat a, KSP ksp)
Definition cs_sles_petsc.c:490