# 简介

deal.II是一款开源的求解偏微分方程的有限元软件，它有如下几个特点

• 使用C++编写
• 有多种单元类型
• 可以大规模并行
• 可以自适应网格
• 文档和范例齐全
• 与其他库有良好的接口

# 安装

deal.II最新版本为8.4.1,可从官网上下载源码，解压后进入源文件目录安装：

 1 2 3 4 5  mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/dir ../deal.II make install make test 

# 编译运行

deal.II的文档和example特别完备，刚开始接触可以它多达54个例子进行。

 1 2 3  cmake . make make run 

 1  cmake -DDEAL_II_DIR=/path/to/installed/deal.II . 

# 第一个教学实例——step-1

 1  #include 

 1 2  #include #include 
 1  #include 

 1  #include 
 1  #include 

 1  using namespace dealii; 

 1 2  GridGenerator::hyper_cube (triangulation); triangulation.refine_global (4); 

 1  GridGenerator::hyper_shell (triangulation,center,inner_radius,outer_radius,10); 

 1 2 3 4 5 6 7 8  Triangulation<2> triangulation; const Point<2> center (1,0); const double inner_radius = 0.5, outer_radius = 1.0; GridGenerator::hyper_shell (triangulation, center, inner_radius, outer_radius, 10); triangulation.refine_global (3); 

 1 2 3 4 5 6 7 8 9 10  Triangulation<2> triangulation; const Point<2> center (1,0); const double inner_radius = 0.5, outer_radius = 1.0; GridGenerator::hyper_shell (triangulation, center, inner_radius, outer_radius, 10); const HyperShellBoundary<2> boundary_description(center); triangulation.set_boundary (0, boundary_description); triangulation.refine_global (3); 

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Triangulation<2> triangulation; const Point<2> center (1,0); const double inner_radius = 0.5, outer_radius = 1.0; GridGenerator::hyper_shell (triangulation, center, inner_radius, outer_radius, 10); const SphericalManifold<2> boundary_description(center); triangulation.set_manifold (0, boundary_description); Triangulation<2>::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); for (; cell!=endc; ++cell) cell->set_all_manifold_ids (0); triangulation.refine_global (3); 

 1 2 3 4 5 6 7 8 9 10  Triangulation<2> triangulation; const Point<2> center (1,0); const double inner_radius = 0.5, outer_radius = 1.0; GridGenerator::hyper_shell (triangulation, center, inner_radius, outer_radius, 3); // four circumferential cells const HyperShellBoundary<2> boundary_description(center); triangulation.set_boundary (0, boundary_description); triangulation.refine_global (3); 

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Triangulation<2> triangulation; const Point<2> center (1,0); const double inner_radius = 0.5, outer_radius = 1.0; GridGenerator::hyper_shell (triangulation, center, inner_radius, outer_radius, 3); // three circumferential cells const SphericalManifold<2> boundary_description(center); triangulation.set_manifold (0, boundary_description); Triangulation<2>::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); for (; cell!=endc; ++cell) cell->set_all_manifold_ids (0); triangulation.refine_global (3); 

 1 2 3 4  Triangulation<2>::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); for (; cell!=endc; ++cell) 

 1 2 3  for (unsigned int v=0; v < GeometryInfo<2>::vertices_per_cell; ++v) 

 1 2 3 4 5 6 7  const double distance_from_center = center.distance (cell->vertex(v)); if (std::fabs(distance_from_center - inner_radius) < 1e-10) { cell->set_refine_flag (); break; } 

 1  triangulation.execute_coarsening_and_refinement (); 

 1  triangulation.set_manifold (0); 

second_grid给了我们提示，可以设定不同的细化条件，比如设定当cell的中心的y坐标大于0时才加密：

 1 2 3  for (; cell!=endc; ++cell) if (cell->center()[1] > 0) cell->set_refine_flag (); 

# 最后

deal.II的作者建议尽早学会使用一个debugger！

http://blog.sciencenet.cn/home.php?mod=space&uid=441611

http://qixinbo.info/tags/deal-II/

## 亓欣波

#### 求解偏微分方程开源有限元软件deal.II学习--Step 2

2016-08-30 15:02:15

#### 求解偏微分方程开源有限元软件deal.II学习--Step 5

2016-08-30 15:04:53

#### linux+dealii

2017-07-07 14:08:33

#### 使用Deal.II过程

2017-04-16 22:34:59

#### 开源有限元软件大全

2014年04月04日 103KB 下载

#### 求解偏微分方程开源有限元软件deal.II学习--Step 7

2016-10-18 17:53:25

#### 求解偏微分方程开源有限元软件deal.II学习--Step 4

2016-08-30 15:04:00

#### 安装dealii的问题

2016-07-18 20:24:27

#### Ubuntu安装aspect

2017-04-09 13:45:07

#### 理工学生常用开源软件库

2013-07-12 10:11:07