Skip to content

Simultaneous Analysis and Design in Topology Optimization program #156

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 40 additions & 0 deletions SAND_top_opt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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,
# you may want to either replace the following statement by something like
# FILE(GLOB_RECURSE TARGET_SRC "source/*.cc")
# FILE(GLOB_RECURSE TARGET_INC "include/*.h")
# SET(TARGET_SRC ${TARGET_SRC} ${TARGET_INC})
# or switch altogether to the large project CMakeLists.txt file discussed
# in the "CMake in user projects" page accessible from the "User info"
# page of the documentation.


FILE(GLOB_RECURSE TARGET_SRC "source/*.cc")
FILE(GLOB_RECURSE TARGET_INC "include/*.h")
SET( TARGET_SRC ${TARGET_SRC} ${TARGET_INC}
)


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

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})
MESSAGE(FATAL_ERROR "\n"
"*** Could not locate a (sufficiently recent) version of deal.II. ***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this path."
)
ENDIF()


DEAL_II_INITIALIZE_CACHED_VARIABLES()
PROJECT(${TARGET})
DEAL_II_INVOKE_AUTOPILOT()
1 change: 1 addition & 0 deletions SAND_top_opt/doc/author
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Justin O'Connor <[email protected]>
1 change: 1 addition & 0 deletions SAND_top_opt/doc/builds-on
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
step-79
1 change: 1 addition & 0 deletions SAND_top_opt/doc/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DEAL_II_WITH_CXX14 DEAL_II_WITH_TRILINOS
1 change: 1 addition & 0 deletions SAND_top_opt/doc/entry-name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Simultaneous Analysis and Design in Topology Optimization
1 change: 1 addition & 0 deletions SAND_top_opt/doc/tooltip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Simultaneous Analysis and Design in Topology Optimization using block preconditioning and matrix-free geometric multigrid.
87 changes: 87 additions & 0 deletions SAND_top_opt/include/density_filter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// Created by justin on 5/13/21.
//

#ifndef SAND_DENSITY_FILTER_H
#define SAND_DENSITY_FILTER_H


#include <deal.II/base/quadrature_lib.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/full_matrix.h>
#include <deal.II/lac/block_sparse_matrix.h>
#include <deal.II/lac/solver_cg.h>
#include <deal.II/lac/precondition.h>
#include <deal.II/lac/linear_operator.h>
#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>
#include <deal.II/dofs/dof_tools.h>

#include <deal.II/fe/fe_values.h>
#include <deal.II/fe/fe_dgq.h>
#include <deal.II/fe/fe_system.h>
#include <deal.II/fe/fe_q.h>

#include <deal.II/numerics/vector_tools.h>
#include <deal.II/numerics/matrix_tools.h>
#include <deal.II/numerics/data_out.h>
#include <deal.II/numerics/error_estimator.h>

#include <iostream>
#include <fstream>
#include <algorithm>

/* This object is designed to calculate and form the matrix corresponding to a convolution of the unfiltered density.
* Once formed, we have F*\sigma = \rho*/
namespace SAND {
using namespace dealii;
namespace LA
{
using namespace dealii::LinearAlgebraTrilinos;
}
template<int dim>
class DensityFilter {
public:

MPI_Comm mpi_communicator;
std::vector<IndexSet> owned_partitioning;
std::vector<IndexSet> relevant_partitioning;

DensityFilter();
DynamicSparsityPattern filter_dsp;
LA::MPI::SparseMatrix filter_matrix;
LA::MPI::SparseMatrix filter_matrix_transpose;
SparsityPattern filter_sparsity_pattern;
void initialize(DoFHandler<dim> &dof_handler);
std::set<types::global_dof_index> find_relevant_neighbors(types::global_dof_index cell_index) const;

private:
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;

};
}
#endif //SAND_DENSITY_FILTER_H
61 changes: 61 additions & 0 deletions SAND_top_opt/include/input_information.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// Created by justin on 3/11/21.
//

#ifndef SAND_INPUT_INFORMATION_H
#define SAND_INPUT_INFORMATION_H
#include <deal.II/grid/tria_accessor.h>
#include "parameters_and_components.h"

namespace SAND {
using namespace dealii;

namespace Input
{
constexpr double volume_percentage = .5;

//geometry options
constexpr unsigned int geometry_base = GeometryOptions::mbb;

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

//nonlinear algorithm options
constexpr double initial_barrier_size = 25;
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 = .25;

//other options
constexpr double density_penalty_exponent = 3;

//output options
constexpr bool output_full_preconditioned_matrix = false;
constexpr bool output_full_matrix = false;
constexpr bool output_parts_of_matrix = false;

//Linear solver options
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 = 5;
extern unsigned int 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
Loading