Skip to content

Commit

Permalink
reorganize solveIncrement
Browse files Browse the repository at this point in the history
Broke solveIncrement into four smaller sections:
1. Aux vars that are not nonlinear (sequential)
2. Explicit vars (concurrent)
3. Linear solves (sequential)
4. Nonlinear solve (concurrent)

TODO/NOTES:
I broke the skip_time_dependent thing.
Changes not yet propogated.
Need some documentation.
Prefer to pass var_index into solver rather than use member variable currentFieldIndex.
Maybe removed need for member variable currentIncrement.
computeExplicitRHS-like functions are commented with "HERE" to be replaced
  • Loading branch information
fractalsbyx committed Jan 16, 2025
1 parent 782a625 commit e427dd7
Show file tree
Hide file tree
Showing 2 changed files with 464 additions and 455 deletions.
64 changes: 51 additions & 13 deletions include/core/matrixFreePDE.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/lac/affine_constraints.h>
#include <deal.II/lac/la_parallel_vector.h>
#include <deal.II/lac/solver_control.h>
#include <deal.II/lac/vector.h>
#include <deal.II/matrix_free/fe_evaluation.h>
#include <deal.II/matrix_free/matrix_free.h>
Expand All @@ -32,6 +33,7 @@
#include <core/variableValueContainer.h>
#include <grains/SimplifiedGrainRepresentation.h>
#include <nucleation/nucleus.h>
#include <sys/types.h>
#include <utilities/computeStress.h>
#include <utilities/utilities.h>

Expand Down Expand Up @@ -171,6 +173,10 @@ class MatrixFreePDE : public Subscriptor

std::vector<SimplifiedGrainRepresentation<dim>> simplified_grain_representations;

// ===========================================================================
// METHODS FOR SOLVING
// ===========================================================================

/**
* Method to solve each time increment of a time-dependent problem. For
* time-independent problems this method is called only once. This method
Expand All @@ -179,7 +185,51 @@ class MatrixFreePDE : public Subscriptor
* problems, Implicit (matrix-free) solver for Elliptic problems.
*/
virtual void
solveIncrement(bool skip_time_dependent);
solveIncrement(uint current_increment, bool skip_time_dependent);

void
linearSolveOnce(unsigned int var_index, SolverControl &solver_control);
void
auxiliaryOnce(unsigned int var_index, uint current_increment);
bool
nonlinearIncrement(unsigned int var_index,
SolverControl &solver_control,
uint current_increment);
bool
auxiliaryIncrement(unsigned int var_index, uint current_increment);
void
print_explicit_update(uint var_index, uint current_increment);
void
print_linear_update(uint var_index,
uint current_increment,
SolverControl &solver_control);
void
print_nonlinear_update(uint var_index, uint current_increment);
void
print_nonlinear_status(uint var_index,
uint current_increment,
uint nonlinear_iteration_index,
double diff);

/*Method to compute an explicit timestep*/
void
updateExplicitSolution(unsigned int var_index);

void
updateLinearSolution(unsigned int var_index);

/*Method to compute an implicit timestep*/
bool
updateImplicitSolution(unsigned int fieldIndex, unsigned int nonlinear_iteration_index);

/*Method to apply boundary conditions*/
void
applyBCs(unsigned int var_index);

// ===========================================================================
//
// ===========================================================================

/* Method to write solution fields to vtu and pvtu (parallel) files.
*
* This method can be enabled/disabled by setting the flag writeOutput to
Expand Down Expand Up @@ -263,18 +313,6 @@ class MatrixFreePDE : public Subscriptor
void
computeInvM();

/*Method to compute an explicit timestep*/
void
updateExplicitSolution(unsigned int fieldIndex);

/*Method to compute an implicit timestep*/
bool
updateImplicitSolution(unsigned int fieldIndex, unsigned int nonlinear_iteration_index);

/*Method to apply boundary conditions*/
void
applyBCs(unsigned int fieldIndex);

/**
* \brief Compute element volume for the triangulation
*/
Expand Down
Loading

0 comments on commit e427dd7

Please sign in to comment.