Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] use current_constraints for SparsityPattern #1877

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/modules/changes/20170801_tjhei
@@ -0,0 +1,5 @@
New: Sparsity patterns of the system matrix now uses the current_constraints
instead of the static constraints. This allows new kind of constraints in the
system and reduces the number of nonzero entries in the system matrix.
<br>
(Timo Heister, 2017/08/01)
1 change: 1 addition & 0 deletions include/aspect/simulator.h
Expand Up @@ -1430,6 +1430,7 @@ namespace aspect
//TODO: use n_compositional_field separate preconditioners
std_cxx11::shared_ptr<LinearAlgebra::PreconditionILU> C_preconditioner;

bool rebuild_sparsity_and_matrices;
bool rebuild_stokes_matrix;
bool assemble_newton_stokes_matrix;
bool assemble_newton_stokes_system;
Expand Down
7 changes: 7 additions & 0 deletions include/aspect/simulator_access.h
Expand Up @@ -657,6 +657,13 @@ namespace aspect
*/
bool simulator_is_initialized () const;

/**
* Return the value used for rescaling the pressure in the linear
* solver.
*/
double
get_pressure_scaling () const;

/**
* A convenience function that copies the values of the compositional
* fields at the quadrature point q given as input parameter to the
Expand Down
17 changes: 13 additions & 4 deletions source/simulator/core.cc
Expand Up @@ -807,6 +807,16 @@ namespace aspect
// into current_constraints and then add to current_constraints
compute_current_constraints ();

// If needed, construct sparsity patterns and matrices with the current
// constraints. Of course we need to force assembly too.
if (rebuild_sparsity_and_matrices)
{
rebuild_sparsity_and_matrices = false;
setup_system_matrix (introspection.index_sets.system_partitioning);
setup_system_preconditioner (introspection.index_sets.system_partitioning);
rebuild_stokes_matrix = rebuild_stokes_preconditioner = true;
}


// TODO: do this in a more efficient way (TH)? we really only need
// to make sure that the time dependent velocity boundary conditions
Expand Down Expand Up @@ -1398,10 +1408,9 @@ namespace aspect
constraints.close();
signals.post_compute_no_normal_flux_constraints(triangulation);

// finally initialize vectors, matrices, etc.

setup_system_matrix (introspection.index_sets.system_partitioning);
setup_system_preconditioner (introspection.index_sets.system_partitioning);
// Finally initialize vectors. We delay construction of the sparsity
// patterns and matrices until we have current_constraints.
rebuild_sparsity_and_matrices = true;

system_rhs.reinit(introspection.index_sets.system_partitioning, mpi_communicator);
solution.reinit(introspection.index_sets.system_partitioning, introspection.index_sets.system_relevant_partitioning, mpi_communicator);
Expand Down
6 changes: 6 additions & 0 deletions source/simulator/simulator_access.cc
Expand Up @@ -596,6 +596,12 @@ namespace aspect
return (simulator != NULL);
}

template <int dim>
double
SimulatorAccess<dim>::get_pressure_scaling () const
{
return (simulator->pressure_scaling);
}
}


Expand Down