Skip to content

Commit

Permalink
Moved driver initializaton into "TDycore Setup" stage.
Browse files Browse the repository at this point in the history
Also added a few more timers.
  • Loading branch information
jeff-cohere committed Oct 5, 2020
1 parent b690829 commit 3bb9c85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tdycore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1411,16 +1411,19 @@ PetscErrorCode TDyPostSolveSNESSolver(TDy tdy,Vec U) {
PetscErrorCode TDyCreateVectors(TDy tdy) {
PetscErrorCode ierr;
PetscFunctionBegin;
TDY_START_FUNCTION_TIMER()
ierr = DMCreateGlobalVector(tdy->dm,&tdy->solution); CHKERRQ(ierr);
ierr = VecDuplicate(tdy->solution,&tdy->residual); CHKERRQ(ierr);
ierr = VecDuplicate(tdy->solution,&tdy->accumulation_prev); CHKERRQ(ierr);
ierr = VecDuplicate(tdy->solution,&tdy->soln_prev); CHKERRQ(ierr);
TDY_STOP_FUNCTION_TIMER()
PetscFunctionReturn(0);
}

PetscErrorCode TDyCreateJacobian(TDy tdy) {
PetscErrorCode ierr;
PetscFunctionBegin;
TDY_START_FUNCTION_TIMER()
ierr = DMCreateMatrix(tdy->dm,&tdy->J); CHKERRQ(ierr);
ierr = MatSetOption(tdy->J,MAT_KEEP_NONZERO_PATTERN,PETSC_FALSE); CHKERRQ(ierr);
ierr = MatSetOption(tdy->J,MAT_ROW_ORIENTED,PETSC_FALSE); CHKERRQ(ierr);
Expand All @@ -1431,6 +1434,7 @@ PetscErrorCode TDyCreateJacobian(TDy tdy) {
ierr = MatSetOption(tdy->Jpre,MAT_ROW_ORIENTED,PETSC_FALSE); CHKERRQ(ierr);
ierr = MatSetOption(tdy->Jpre,MAT_NO_OFF_PROC_ZERO_ROWS,PETSC_TRUE); CHKERRQ(ierr);
ierr = MatSetOption(tdy->Jpre,MAT_NEW_NONZERO_LOCATIONS,PETSC_TRUE); CHKERRQ(ierr);
TDY_STOP_FUNCTION_TIMER()
PetscFunctionReturn(0);
}

2 changes: 2 additions & 0 deletions src/tdydriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
PetscErrorCode TDyDriverInitializeTDy(TDy tdy) {
PetscErrorCode ierr;
PetscFunctionBegin;
TDyEnterProfilingStage("TDycore Setup");
TDY_START_FUNCTION_TIMER()
PetscReal gravity[3] = {0.,0.,0.};
SNESLineSearch linesearch;
Expand Down Expand Up @@ -109,5 +110,6 @@ PetscErrorCode TDyDriverInitializeTDy(TDy tdy) {
CHKERRQ(ierr);
}
TDY_STOP_FUNCTION_TIMER()
TDyExitProfilingStage("TDycore Setup");
PetscFunctionReturn(0);
}

0 comments on commit 3bb9c85

Please sign in to comment.