File size: 2,143 Bytes
ebc16f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <mshr.h>
#include <dolfin.h>
#include <ImmersedBoundaryMethod.h>

namespace dolfin {

class FiberDirection : public Expression
{
public:
  FiberDirection(
      std::shared_ptr<MeshFunction<double> > f0_0, 
      std::shared_ptr<MeshFunction<double> > f0_1, 
      std::shared_ptr<MeshFunction<double> > f0_2
  ) : Expression(3), f0_0(f0_0), f0_1(f0_1), f0_2(f0_2) {}

  // Function for evaluating expression on each cell
  void eval(Array<double>& values, const Array<double>& x, const ufc::cell& cell) const
  {
    const uint D = cell.topological_dimension;
    const uint cell_index = cell.index;
    values[0] = (*c00)[cell_index];
    values[1] = (*c01)[cell_index];
    values[2] = (*c11)[cell_index];
  }

  // The data stored in mesh functions
  std::shared_ptr<MeshFunction<double> > f0_0;
  std::shared_ptr<MeshFunction<double> > f0_1;
  std::shared_ptr<MeshFunction<double> > f0_2;

};
}
int main(){
    double mesh_resolution = 120;

    double length = 74.4;
    double bottom = -115;
    double length_2 = 9.9;
    double bottom_2 = 5.1;

    std::cout << "Create solid mesh.\n";
    auto domain_small   = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom), dolfin::Point(0.0,0.0,bottom+length), 13.182, 13.182);
    auto domain_big     = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom), dolfin::Point(0.0,0.0,bottom+length), 14.672, 14.672);
    auto domain_small_2   = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom_2), dolfin::Point(0.0,0.0,bottom_2+length_2), 13.343, 13.343);
    auto domain_big_2     = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom_2), dolfin::Point(0.0,0.0,bottom_2+length_2), 14.833, 14.833);

    auto domain = domain_big - domain_small + domain_big_2 - domain_small_2;
    auto solid_mesh = std::make_shared<ImmersedMesh>(mshr::generate_mesh(domain, mesh_resolution));

    dolfin::File mesh_file_0("extended_tube.pvd");
    mesh_file_0 << *solid_mesh->get_dolfin_mesh();

    dolfin::XDMFFile mesh_file("/public/home/fenics/Mesh_1/valve/mesh.xdmf");
    auto mesh = dolfin::Mesh();
    mesh_file.read(mesh);
    mesh_file.close();

}