>
> The minimal code.
>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/006ec2fb-d714-4798-a1ca-35ae0b14d0be%40googlegroups.com.
#include
#include
#include
#include
namespace LA
{
#if defined(DEAL_II_WITH_TRILINOS)
using namespace dealii::LinearAlgebraTrilinos;
#else
# error DEAL_II_WITH_TRILINOS required
#endif
}
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace Step55
{
using namespace dealii;
template
class StokesProblem
{
public:
StokesProblem (unsigned int degree);
void run ();
private:
void make_grid ();
void setup_system ();
unsigned int degree;
MPI_Comm mpi_communicator;
FESystem fe;
parallel::distributed::Triangulation triangulation;
DoFHandler dof_handler;
std::vector owned_partitioning;
std::vector relevant_partitioning;
ConstraintMatrix constraints;
};
template
StokesProblem::StokesProblem (unsigned int degree)
:
degree (degree),
mpi_communicator (MPI_COMM_WORLD),
fe (FE_RaviartThomas(degree), 1,
FE_DGQ(degree), 1),
triangulation (mpi_communicator,
typename Triangulation::MeshSmoothing
(Triangulation::smoothing_on_refinement |
Triangulation::smoothing_on_coarsening)),
dof_handler (triangulation)
{}
template
void StokesProblem::make_grid()
{
GridGenerator::hyper_cube (triangulation, 0, 1.0);
triangulation.refine_global (3);
}
template
void StokesProblem::setup_system ()
{
dof_handler.distribute_dofs (fe);
DoFRenumbering::component_wise(dof_handler);
std::vector dofs_per_component(dim + 1);
DoFTools::count_dofs_per_component(dof_handler, dofs_per_component);
const unsigned int n_u = dofs_per_component[0],
n_p = dofs_per_component[dim];
std::cout << "Number of active cells: " << triangulation.n_active_cells()
<< std::endl
<< "Total number of cells: " << triangulation.n_cells()
<< std::endl
<< "Number of degrees of freedom: " << dof_handler.n_dofs()
<< " (" << n_u << '+' << n_p << ')' << std::endl;
owned_partitioning.resize(2);
owned_partitioning[0] = dof_handler.locally_owned_dofs ().get_view(0, n_u);
owned_partitioning[1] = dof_handler.locally_owned_dofs ().get_view(n_u, n_u+n_p);
IndexSet locally_relevant_dofs;
DoFTools::extract_locally_relevant_dofs (dof_handler,
locally_relevant_dofs);
relevant_partitioning.resize(2);
relevant_partitioning[0] = locally_relevant_dofs.get_view(0, n_u);
relevant_partitioning[1] = locally_relevant_dofs.get_view(n_u, n_u+n_p);
constraints.reinit (locally_relevant_dofs);
DoFTools::make_hanging_node_constraints (dof_handler, constraints);
VectorTools::project_boundary_values_div_conforming(dof_handler,
0,
ZeroFunction(dim),
0,
constraints);
constraints.close ();
}
template
void StokesProblem::run ()
{
make_grid ();
setup_system ();
}
}
int main(int argc, char *argv[])
{
using namespace dealii;
using namespace Step55;
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
StokesProblem<2> problem (0);
problem.run ();
return 0;
}
##
# CMake script for the step-21 tutorial program:
##
# Set the name of the project and target:
SET(TARGET "test")
# 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