2019.09.23 Step-3 Study
The step-3 is the first for really calculating something in Deal.II and mainly talking about the solving process of the Poisson’s equation as an example.
We can run the default code and derive the results.
This example only considers the displacement in the x direction. So the DoF is the number of the nodes when using Q1 elements.
Now I will go through all the possible extensions suggested on the Deal.II online tutorial.
- Changing the mesh to hyper shell used previously and L-shape.
1 | // hyper shell mesh, added by zzd |
We can see from the result that the problem we raised in the end of step-2 has some negative influence here. See the points of the mesh has been detached from its neighbours (see the sharp point at the top of the “cone” shape). Therefore, I need to further investigate this problem.
1 | // hyper L shape, added by zzd |
The L-shape looks good here.
- Changing the boundary condition.
1
2
3
4
5
6
7
8
9
10std::map<types::global_dof_index, double> boundary_values;
VectorTools::interpolate_boundary_values(dof_handler,
0,
ConstantFunction<2> (100), // added by zzd
//Functions::ZeroFunction<2>(),
boundary_values);
MatrixTools::apply_boundary_values(boundary_values,
system_matrix,
solution,
system_rhs);
- Modifying the type of the boundary conditions
1
2
3
4
5
6
7
8void Step3::make_grid(int refinements)
{
GridGenerator::hyper_cube(triangulation, -1, 1);
triangulation.begin_active()->face(0)->set_boundary_id(1); // added by zzd
triangulation.refine_global(refinements);
std::cout << "Number of active cells: " << triangulation.n_active_cells()
<< std::endl;
}
4.Observe convergence
1 | void Step3::output_results() const |
This is the convergence info. with 10 refinements.
We can see it is same as the 9th refinements, which imply the simulation has been converged successfully.
However, this mesh (1024*1024=104,8576, over 1 million) is too big to be shown by gnuplot on my laptop.
The official tutorial document is as follows,
https://www.dealii.org/current/doxygen/deal.II/step_3.html