Skip to content
Snippets Groups Projects
Commit ed480ee1 authored by MichelJuillard's avatar MichelJuillard
Browse files

choose LU preconditioner by default

parent 51ab885e
Branches
No related tags found
No related merge requests found
...@@ -55,7 +55,7 @@ int main(int argc, char **argv) ...@@ -55,7 +55,7 @@ int main(int argc, char **argv)
user.exogenous = new double[exo_nbr]; user.exogenous = new double[exo_nbr];
user.params = params; user.params = params;
user.steady_state = steady_state; user.steady_state = steady_state;
user.periods = 40; user.periods = 4000;
user.first_col = endo_nbr; user.first_col = endo_nbr;
user.endo_nbr = endo_nbr; user.endo_nbr = endo_nbr;
user.exo_nbr = exo_nbr; user.exo_nbr = exo_nbr;
...@@ -197,6 +197,12 @@ int main(int argc, char **argv) ...@@ -197,6 +197,12 @@ int main(int argc, char **argv)
Set SNES/KSP/KSP/PC runtime options, e.g., Set SNES/KSP/KSP/PC runtime options, e.g.,
-snes_view -snes_monitor -ksp_type <ksp> -pc_type <pc> -snes_view -snes_monitor -ksp_type <ksp> -pc_type <pc>
*/ */
KSP ksp;
PC pc;
ierr = SNESGetKSP(snes,&ksp);CHKERRQ(ierr);
ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
ierr = PCSetType(pc,PCLU);CHKERRQ(ierr);
// PetscOptionsSetValue("-pc_type","lu");
ierr = SNESSetFromOptions(snes);CHKERRQ(ierr); ierr = SNESSetFromOptions(snes);CHKERRQ(ierr);
/* /*
...@@ -390,7 +396,7 @@ PetscErrorCode FormJacobian(SNES snes,Vec y,Mat J, Mat B,void *ctx) ...@@ -390,7 +396,7 @@ PetscErrorCode FormJacobian(SNES snes,Vec y,Mat J, Mat B,void *ctx)
xsi - starting interior grid index xsi - starting interior grid index
xei - ending interior grid index xei - ending interior grid index
*/ */
int row = 0; int row = ys;
if (ys == 0) /* left boundary */ if (ys == 0) /* left boundary */
{ {
PetscReal *y1 = new PetscReal[3*user->endo_nbr]; PetscReal *y1 = new PetscReal[3*user->endo_nbr];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment