Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
2a1dab0
Very broken
juleoc02 Oct 19, 2021
60a35b7
Still Very broken
juleoc02 Oct 20, 2021
7d2b0af
Still Very broken. Problem with distribute local to global?
juleoc02 Oct 25, 2021
aed10fd
Still Very broken. trying to distribute triangulation
juleoc02 Oct 27, 2021
a113ccb
Works with trilinos vectors. Not sure how to use them in parallel
juleoc02 Oct 27, 2021
807b6f3
Working on vmult for trilinos direct solver
juleoc02 Oct 28, 2021
893efb6
Solves in preconditioner failing - unclear what is different from dea…
juleoc02 Nov 1, 2021
3dfad85
Solves in preconditioner failing - unclear what is different from dea…
juleoc02 Nov 2, 2021
b3abbb9
added check in preconditioner step 4
juleoc02 Nov 2, 2021
b80192a
added check in preconditioner step 4
juleoc02 Nov 2, 2021
bb7a630
added many checks
juleoc02 Nov 2, 2021
3b4eef2
added many checks
juleoc02 Nov 2, 2021
645b24e
more specific checks
juleoc02 Nov 2, 2021
0d35df6
more specific checks
juleoc02 Nov 2, 2021
13dc8e0
more specific checks
juleoc02 Nov 2, 2021
9b61c4b
One fix down...
juleoc02 Nov 2, 2021
f942b5a
Outputs A Matrix
juleoc02 Nov 3, 2021
8e5fefc
Outputs cell Matrix
juleoc02 Nov 3, 2021
19d60e0
Changed Parameter
juleoc02 Nov 3, 2021
5834d5f
Changed Parameter
juleoc02 Nov 4, 2021
aee2619
Delete CMakeCache.txt
juleoc02 Nov 4, 2021
a2921f8
Delete cmake_install.cmake
juleoc02 Nov 4, 2021
09432aa
Merge remote-tracking branch 'origin/parallel' into parallel
juleoc02 Nov 4, 2021
0238483
Added check to filter matrix
juleoc02 Nov 4, 2021
fb7d9a0
Getting rid of errors
juleoc02 Nov 5, 2021
c967744
Warning Killing
juleoc02 Nov 7, 2021
59ea6a1
RHS calculated
juleoc02 Nov 11, 2021
c2c2ea0
RHS calculated, other outputs trashed, RHS norm output
juleoc02 Nov 12, 2021
c17c302
To Schur Preconditioner Before Breaking!!!!!!!!!!
juleoc02 Nov 12, 2021
22a85b8
KKT seems to be working - Preconditioner Diagonals Giving Me Trouble.
juleoc02 Nov 12, 2021
11ece70
Closer... Always closer...
juleoc02 Nov 16, 2021
eb18c30
changed outputs
juleoc02 Nov 16, 2021
6d2ed73
Density filter matrix acting strange
juleoc02 Nov 16, 2021
3930252
more debugging
juleoc02 Nov 16, 2021
c9014a7
Running. Second solve takes long time.
juleoc02 Nov 18, 2021
30ade24
even more outputs
juleoc02 Nov 23, 2021
8e10b5f
small fix
juleoc02 Nov 23, 2021
b4fa45f
more out
juleoc02 Nov 23, 2021
6ef0504
fdsa
juleoc02 Nov 23, 2021
b76c439
push...
juleoc02 Nov 27, 2021
088a2f1
More outputs...
juleoc02 Dec 2, 2021
5a43225
frobenius norms of system matrix output
juleoc02 Dec 2, 2021
aa33950
works - need to fix outputs
juleoc02 Dec 9, 2021
90dc7f3
getting there
juleoc02 Dec 9, 2021
04ff1ff
mod
juleoc02 Dec 10, 2021
83270d3
running!
juleoc02 Dec 10, 2021
b05e85f
removed some operators
juleoc02 Dec 10, 2021
e7d9007
mod
Dec 17, 2021
41de392
stuff
juleoc02 Dec 20, 2021
4609241
hi
juleoc02 Dec 27, 2021
76ede55
using solve instead of inverse_operator
juleoc02 Dec 27, 2021
1fe58a7
using solve instead of inverse_operator
juleoc02 Dec 27, 2021
a395e70
mod
juleoc02 Dec 27, 2021
6acc1e3
more refinements
juleoc02 Dec 27, 2021
b851836
5 refines
juleoc02 Dec 27, 2021
eb1cf37
ready to try
juleoc02 Jan 3, 2022
3683a6a
4 refinements
juleoc02 Jan 4, 2022
b4614fb
hi
juleoc02 Jan 8, 2022
e374410
warning killing
juleoc02 Jan 10, 2022
b0b8ec4
killed errors
juleoc02 Jan 18, 2022
f5dc696
ready to go
juleoc02 Jan 18, 2022
bce22d1
merging fewer errors
juleoc02 Jan 19, 2022
ec2cb20
no more matrix output
juleoc02 Jan 19, 2022
dc314f0
fixing density filter
Jan 19, 2022
7671d0c
here
juleoc02 Jan 25, 2022
4f89e7b
working?
juleoc02 Jan 25, 2022
4512edf
working?
juleoc02 Jan 25, 2022
854a473
working!
juleoc02 Jan 25, 2022
1534e63
added stuff
juleoc02 Jan 27, 2022
426629b
fixed volume bug
Jan 27, 2022
dacbc27
Bug found!
juleoc02 Jan 27, 2022
eb19e4f
ready to run on up
juleoc02 Jan 27, 2022
bdbb455
making new branch testing trilinos solvers
juleoc02 Jan 28, 2022
3cd48c9
looks good
juleoc02 Feb 2, 2022
bcd5753
away from trilinos solver
juleoc02 Feb 2, 2022
a970e30
AMG implemented
Feb 9, 2022
4b3674b
getting there
Feb 17, 2022
2b55a61
commit
Mar 21, 2022
d2b70f1
prettier
Mar 21, 2022
038e058
started mfgmg
Mar 22, 2022
f777750
getting to a working mfgmg
Mar 28, 2022
632ce15
MFGMG running, but solve is incorrect. Very pretty though?
Apr 11, 2022
a28634f
GMG seems to work. About to implement in Schur Complement
Apr 12, 2022
458e60a
working mf gmg
Apr 13, 2022
c6437d7
updated with wrapped a_mat
juleoc02 Apr 20, 2022
87eabf9
temp commit
Apr 20, 2022
1897aca
partway to working gmg - 14 EVs
Apr 20, 2022
4f87351
home stuff
juleoc02 Apr 27, 2022
f548953
added some documentation
juleoc02 Apr 28, 2022
a1090ff
MFGMG WORKS
juleoc02 May 7, 2022
2d80f87
refactoring
juleoc02 May 7, 2022
ff64a46
refactoring
juleoc02 May 7, 2022
de1ac6e
refactoring
juleoc02 May 7, 2022
e80537a
trying to print
May 11, 2022
88291e8
WORKING GMG PRECONDITIONER
May 11, 2022
ff05ed0
MPI MFGMG Runs, takes one extra GMRES iteration
May 27, 2022
8998b5e
update
May 28, 2022
f864444
Up to date
Feb 2, 2023
72541f3
Ready for release
Mar 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

423 changes: 0 additions & 423 deletions CMakeCache.txt

This file was deleted.

6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Set the name of the project and target:
SET(TARGET "SAND")


# Declare all source files the target consists of. Here, this is only
# the one step-X.cc file, but as you expand your project you may wish
# to add other source files as well. If your project becomes much larger,
Expand All @@ -21,9 +22,8 @@ SET( TARGET_SRC ${TARGET_SRC} ${TARGET_INC}

# Usually, you will not need to modify anything beyond this point...

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)

FIND_PACKAGE(deal.II 9.2.0 QUIET
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)
FIND_PACKAGE(deal.II 9.4.0 QUIET
HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
)
IF(NOT ${deal.II_FOUND})
Expand Down
49 changes: 0 additions & 49 deletions cmake_install.cmake

This file was deleted.

32 changes: 26 additions & 6 deletions include/density_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
#include <deal.II/lac/packaged_operation.h>
#include <deal.II/lac/sparse_direct.h>
#include <deal.II/lac/affine_constraints.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/generic_linear_algebra.h>

#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_refinement.h>
#include <deal.II/grid/cell_id.h>

#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_renumbering.h>
Expand All @@ -47,20 +50,37 @@
* Once formed, we have F*\sigma = \rho*/
namespace SAND {
using namespace dealii;

namespace LA
{
using namespace dealii::LinearAlgebraTrilinos;
}
template<int dim>
class DensityFilter {
public:

DensityFilter()=default;
MPI_Comm mpi_communicator;
std::vector<IndexSet> owned_partitioning;
std::vector<IndexSet> relevant_partitioning;

SparseMatrix<double> filter_matrix;
DensityFilter();
DynamicSparsityPattern filter_dsp;
LA::MPI::SparseMatrix filter_matrix;
LA::MPI::SparseMatrix filter_matrix_transpose;
SparsityPattern filter_sparsity_pattern;
void initialize(Triangulation<dim> &triangulation);

void initialize(DoFHandler<dim> &dof_handler);
std::set<types::global_dof_index> find_relevant_neighbors(types::global_dof_index cell_index) const;

private:
std::set<typename Triangulation<dim>::cell_iterator> find_relevant_neighbors(typename Triangulation<dim>::cell_iterator cell) const;
std::vector<double> cell_m;
std::vector<double> x_coord;
std::vector<double> y_coord;
std::vector<double> z_coord;
std::vector<double> cell_m_part;
std::vector<double> x_coord_part;
std::vector<double> y_coord_part;
std::vector<double> z_coord_part;

ConditionalOStream pcout;

};
}
Expand Down
31 changes: 23 additions & 8 deletions include/input_information.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@ namespace SAND {

//geometry options
constexpr unsigned int geometry_base = GeometryOptions::mbb;
constexpr unsigned int dim = 2;
constexpr unsigned int refinements = 3;

constexpr unsigned int dim = 3;
// constexpr unsigned int refinements = 3;
extern unsigned int refinements;

//nonlinear algorithm options
constexpr double initial_barrier_size = 25;
constexpr double min_barrier_size = .00000;
constexpr double fraction_to_boundary = .9;
constexpr unsigned int max_steps=75;
constexpr double min_barrier_size = 1e-12;

constexpr double fraction_to_boundary = .7;
constexpr unsigned int max_steps=100;

constexpr unsigned int barrier_reduction=BarrierOptions::loqo;
constexpr double required_norm = .0001;

//density filter options
constexpr double filter_r = .251;
constexpr double filter_r = .25;

//other options
constexpr double density_penalty_exponent = 3;
Expand All @@ -39,11 +43,22 @@ namespace SAND {
constexpr bool output_parts_of_matrix = false;

//Linear solver options
constexpr unsigned int solver_choice = SolverOptions::inexact_K_with_exact_A_gmres;
constexpr unsigned int solver_choice = SolverOptions::inexact_K_with_inexact_A_gmres;
constexpr bool use_eisenstat_walker = false;
constexpr double default_gmres_tolerance = 1e-6;

extern unsigned int a_inv_iterations;
extern unsigned int k_inv_iterations;

// constexpr double a_inv_iterations = 5;
// constexpr double k_inv_iterations = 30;

constexpr double a_rel_tol = 1e-12;
constexpr double k_rel_tol = 1e-12;

//Material Options
constexpr double material_lambda = 1.;
constexpr double material_mu = 1.;
}
}
#endif //SAND_INPUT_INFORMATION_H
#endif //SAND_INPUT_INFORMATION_H
121 changes: 101 additions & 20 deletions include/kkt_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
#ifndef SAND_KKT_SYSTEM_H
#define SAND_KKT_SYSTEM_H
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/base/utilities.h>
#include <deal.II/base/conditional_ostream.h>
#include <deal.II/base/index_set.h>
#include <deal.II/base/function.h>
#include <deal.II/base/tensor.h>
#include <deal.II/base/timer.h>

#include <deal.II/lac/block_vector.h>
#include <deal.II/lac/vector.h>
#include <deal.II/lac/full_matrix.h>
#include <deal.II/lac/block_sparse_matrix.h>
#include <deal.II/lac/solver_cg.h>
Expand All @@ -18,10 +22,18 @@
#include <deal.II/lac/packaged_operation.h>
#include <deal.II/lac/sparse_direct.h>
#include <deal.II/lac/affine_constraints.h>
#include <deal.II/lac/generic_linear_algebra.h>
#include <deal.II/lac/dynamic_sparsity_pattern.h>
#include <deal.II/lac/sparsity_tools.h>
#include <deal.II/lac/trilinos_sparse_matrix.h>
#include <deal.II/lac/trilinos_block_sparse_matrix.h>
#include <deal.II/lac/trilinos_parallel_block_vector.h>
#include <deal.II/lac/trilinos_vector.h>

#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/grid_refinement.h>
#include <deal.II/grid/grid_tools.h>

#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_renumbering.h>
Expand All @@ -38,19 +50,50 @@
#include <deal.II/numerics/error_estimator.h>
#include <deal.II/hp/fe_collection.h>

#include <deal.II/distributed/tria.h>
#include <deal.II/distributed/grid_refinement.h>

#include <deal.II/multigrid/multigrid.h>
#include <deal.II/multigrid/mg_transfer_matrix_free.h>
#include <deal.II/multigrid/mg_tools.h>
#include <deal.II/multigrid/mg_coarse.h>
#include <deal.II/multigrid/mg_smoother.h>
#include <deal.II/multigrid/mg_matrix.h>

#include <deal.II/matrix_free/matrix_free.h>
#include <deal.II/matrix_free/operators.h>
#include <deal.II/matrix_free/fe_evaluation.h>


#include "../include/schur_preconditioner.h"
#include "../include/density_filter.h"
#include "matrix_free_elasticity.h"

#include <deal.II/base/conditional_ostream.h>

#include <iostream>
#include <fstream>
#include <algorithm>
namespace SAND {



namespace LA
{
using namespace dealii::LinearAlgebraTrilinos;
}
using namespace dealii;

template<int dim>
class KktSystem {

using SystemMFMatrixType = MF_Elasticity_Operator<dim, 1, double>;
using LevelMFMatrixType = MF_Elasticity_Operator<dim, 1, double>;
public:
MPI_Comm mpi_communicator;
std::vector<IndexSet> owned_partitioning;
std::vector<IndexSet> relevant_partitioning;

KktSystem();

void
Expand All @@ -66,63 +109,101 @@ namespace SAND {
setup_block_system();

void
assemble_block_system(const BlockVector<double> &state, const double barrier_size);
assemble_block_system(const LA::MPI::BlockVector &state, const double barrier_size);

BlockVector<double>
solve(const BlockVector<double> &state, double barrier_size);
LA::MPI::BlockVector
solve(const LA::MPI::BlockVector &state);

BlockVector<double>
LA::MPI::BlockVector
get_initial_state();

double
calculate_objective_value(const BlockVector<double> &state) const;
calculate_objective_value(const LA::MPI::BlockVector &state) const;

double
calculate_barrier_distance(const BlockVector<double> &state) const;
calculate_barrier_distance(const LA::MPI::BlockVector &state) const;

double
calculate_feasibility(const BlockVector<double> &state, const double barrier_size) const;
calculate_feasibility(const LA::MPI::BlockVector &state, const double barrier_size) const;

double
calculate_convergence(const BlockVector<double> &state) const;
calculate_convergence(const LA::MPI::BlockVector &state) const;

void
output(const BlockVector<double> &state, const unsigned int j) const;
output(const LA::MPI::BlockVector &state, const unsigned int j) const;

void
calculate_initial_rhs_error();

double
calculate_rhs_norm(const BlockVector<double> &state, const double barrier_size) const;
calculate_rhs_norm(const LA::MPI::BlockVector &state, const double barrier_size) const;

void
output_stl(const BlockVector<double> &state);
output_stl(const LA::MPI::BlockVector &state);

private:

BlockVector<double>
calculate_rhs(const BlockVector<double> &test_solution, const double barrier_size) const;
LA::MPI::BlockVector
calculate_rhs(const LA::MPI::BlockVector &test_solution, const double barrier_size) const;

BlockDynamicSparsityPattern dsp;
BlockSparsityPattern sparsity_pattern;
BlockSparseMatrix<double> system_matrix;
BlockVector<double> linear_solution;
BlockVector<double> system_rhs;
Triangulation<dim> triangulation;
mutable LA::MPI::BlockSparseMatrix system_matrix;
mutable LA::MPI::BlockVector locally_relevant_solution;
mutable LA::MPI::BlockVector distributed_solution;
LA::MPI::BlockVector system_rhs;
parallel::distributed::Triangulation<dim> triangulation;
DoFHandler<dim> dof_handler;
DoFHandler<dim> dof_handler_displacement;
DoFHandler<dim> dof_handler_density;

std::map<types::global_dof_index,types::global_dof_index> displacement_to_system_dof_index_map;
MGLevelObject<std::map<types::global_dof_index,types::global_dof_index>> level_displacement_to_system_dof_index_map;

AffineConstraints<double> constraints;
AffineConstraints<double> displacement_constraints;
FESystem<dim> fe_nine;
FESystem<dim> fe_ten;
hp::FECollection<dim> fe_collection;
FESystem<dim> fe_displacement;
FE_DGQ<dim> fe_density;
const double density_ratio;
const double density_penalty_exponent;

DensityFilter<dim> density_filter;
mutable DensityFilter<dim> density_filter;

std::map<types::global_dof_index, double> boundary_values;

MGLevelObject<std::map<types::global_dof_index, double>> level_boundary_values;
ConditionalOStream pcout;

double initial_rhs_error;

MGConstrainedDoFs mg_constrained_dofs;
SystemMFMatrixType elasticity_matrix_mf;
MGLevelObject<LevelMFMatrixType> mg_matrices;

OperatorCellData<dim, GMGNumberType> active_cell_data;
MGLevelObject<OperatorCellData<dim, GMGNumberType>> level_cell_data;
dealii::LinearAlgebra::distributed::Vector<double> active_density_vector;
dealii::LinearAlgebra::distributed::Vector<double> relevant_density_vector;
MGLevelObject<dealii::LinearAlgebra::distributed::Vector<double>> level_density_vector;

MGTransferMatrixFree<dim,GMGNumberType> transfer;
MGTransferMatrixFree<dim, double> mg_transfer;

using SmootherType = PreconditionChebyshev<LevelMFMatrixType, LinearAlgebra::distributed::Vector<double>>;
mg::SmootherRelaxation<SmootherType,LinearAlgebra::distributed::Vector<double>> mg_smoother;
MGLevelObject<typename SmootherType::AdditionalData> smoother_data;
MGCoarseGridApplySmoother<LinearAlgebra::distributed::Vector<double>> mg_coarse;
MGLevelObject<std::set<types::boundary_id>> level_dirichlet_boundary_dofs;
MGLevelObject<AffineConstraints<double>> mg_level_constraints;
MGLevelObject<MatrixFreeOperators::MGInterfaceOperator<LevelMFMatrixType>> mg_interface_matrices;

std::set<types::boundary_id> dirichlet_boundary;

LinearAlgebra::distributed::Vector<double> distributed_displacement_sol;
LinearAlgebra::distributed::Vector<double> distributed_displacement_rhs;

};
}

Expand Down
Loading