소스 검색

A few minor changes towards annalytic solution convergence.

iss2
Trevor Irons 8 년 전
부모
커밋
8bb08df16b
5개의 변경된 파일20개의 추가작업 그리고 14개의 파일을 삭제
  1. 7
    4
      examples/ResampleWithDataset.cpp
  2. 2
    1
      examples/VTKEdgeGsphere.cpp
  3. 3
    3
      examples/borehole/sphere.geo
  4. 2
    2
      examples/borehole/sphereBox.geo
  5. 6
    4
      src/FEM4EllipticPDE.cpp

+ 7
- 4
examples/ResampleWithDataset.cpp 파일 보기

34
 int main(int argc, char**argv) {
34
 int main(int argc, char**argv) {
35
 
35
 
36
 
36
 
37
-    std::cout << "Mesh processing routine\n";
37
+    std::cout << "Mesh boundary assigment routine\n";
38
     if (argc<4) {
38
     if (argc<4) {
39
         std::cout << "usage:\n" << "./ResampleWithDataset  inMesh.vtu  boundaries.stl  outG.vtu" << std::endl;
39
         std::cout << "usage:\n" << "./ResampleWithDataset  inMesh.vtu  boundaries.stl  outG.vtu" << std::endl;
40
         exit(EXIT_SUCCESS);
40
         exit(EXIT_SUCCESS);
41
     }
41
     }
42
 
42
 
43
-    vtkUnstructuredGrid* uGrid = vtkUnstructuredGrid::New();
43
+    vtkUnstructuredGrid* uGrid;// = vtkUnstructuredGrid::New();
44
 
44
 
45
     std::string fn = argv[1];
45
     std::string fn = argv[1];
46
     if(fn.substr(fn.find_last_of(".") + 1) == "vtk") {
46
     if(fn.substr(fn.find_last_of(".") + 1) == "vtk") {
72
         Stencil->SetFileName(argv[2]);
72
         Stencil->SetFileName(argv[2]);
73
         Stencil->Update();
73
         Stencil->Update();
74
 
74
 
75
-    vtkUnstructuredGrid* output = vtkUnstructuredGrid::New();
76
 
75
 
77
     vtkProbeFilter* Resample = vtkProbeFilter::New();
76
     vtkProbeFilter* Resample = vtkProbeFilter::New();
78
         //Resample->SetSourceData( uGrid );
77
         //Resample->SetSourceData( uGrid );
85
     std::cout << *Resample << std::endl;
84
     std::cout << *Resample << std::endl;
86
 
85
 
87
     vtkXMLUnstructuredGridWriter* Writer = vtkXMLUnstructuredGridWriter::New();
86
     vtkXMLUnstructuredGridWriter* Writer = vtkXMLUnstructuredGridWriter::New();
88
-        //Resample->Probe(uGrid, Stencil->GetOutput(), output);
89
         Writer->SetInputData( Resample->GetOutput() );
87
         Writer->SetInputData( Resample->GetOutput() );
90
         Writer->SetFileName( argv[3] );
88
         Writer->SetFileName( argv[3] );
91
         Writer->Write();
89
         Writer->Write();
92
 
90
 
91
+    Writer->Delete();
92
+    Resample->Delete();
93
+    //Reader->Delete();
94
+    Stencil->Delete();
95
+
93
     //std::cout << *Stencil << std::endl;
96
     //std::cout << *Stencil << std::endl;
94
 
97
 
95
 }
98
 }

+ 2
- 1
examples/VTKEdgeGsphere.cpp 파일 보기

145
         } else if (std::string(argv[3]) == "gravity") {
145
         } else if (std::string(argv[3]) == "gravity") {
146
             double mass = 4./3. * PI * (R*R*R); // volume * density (1)
146
             double mass = 4./3. * PI * (R*R*R); // volume * density (1)
147
             if (raddist < R) {
147
             if (raddist < R) {
148
-                phi->InsertTuple1( in, mass * ( 3*(R*R) - raddist*raddist )/(2*(R*R*R)) ); // (1./3.)*point[2] );
148
+                phi->InsertTuple1( in, mass * (( 3*(R*R) - raddist*raddist )/(2*(R*R*R))) ); // (1./3.)*point[2] );
149
+                //phi->InsertTuple1( in,  (2*PI/3)*(3*R*R-raddist*raddist)  ); // (1./3.)*point[2] );
149
             } else {
150
             } else {
150
                 //phi->InsertTuple1( in, 0);
151
                 //phi->InsertTuple1( in, 0);
151
                 //double costheta = point[2]/raddist ;
152
                 //double costheta = point[2]/raddist ;

+ 3
- 3
examples/borehole/sphere.geo 파일 보기

8
  */
8
  */
9
 
9
 
10
 radius = 2.25;     // Radius of the damn thing
10
 radius = 2.25;     // Radius of the damn thing
11
-lc = radius;     //  0.25;   // Target element size
11
+lc = 15*radius;     //  0.25;   // Target element size
12
 
12
 
13
 // Total Solution Space
13
 // Total Solution Space
14
-Box = 10*radius; // The down side of potential
14
+Box = 100*radius; // The down side of potential
15
 X0 = -Box;
15
 X0 = -Box;
16
 X1 =  Box;
16
 X1 =  Box;
17
 Y0 = -Box;
17
 Y0 = -Box;
19
 Z0 = -Box;
19
 Z0 = -Box;
20
 Z1 =  Box;
20
 Z1 =  Box;
21
 
21
 
22
-cellSize=lc/5; ///10;
22
+cellSize=radius/10; ///10;
23
 dd = 0 ; //  1e-5; //cellSize; // .01;
23
 dd = 0 ; //  1e-5; //cellSize; // .01;
24
 pio2=Pi/2;
24
 pio2=Pi/2;
25
 
25
 

+ 2
- 2
examples/borehole/sphereBox.geo 파일 보기

11
 D1 = 11;          // Bottom of magnet
11
 D1 = 11;          // Bottom of magnet
12
 radius = 2.25;     // Radius of the damn thing
12
 radius = 2.25;     // Radius of the damn thing
13
 
13
 
14
-lc = 1*radius;   //  0.25;   // Target element size
14
+lc = 10*radius;   //  0.25;   // Target element size
15
 
15
 
16
 // Total Solution Space
16
 // Total Solution Space
17
-Box = 10*radius; // The down side of potential
17
+Box = 100*radius; // The down side of potential
18
 X0 = -Box;
18
 X0 = -Box;
19
 X1 =  Box;
19
 X1 =  Box;
20
 Y0 = -Box;
20
 Y0 = -Box;

+ 6
- 4
src/FEM4EllipticPDE.cpp 파일 보기

48
 	// ====================  LIFECYCLE     =======================
48
 	// ====================  LIFECYCLE     =======================
49
 
49
 
50
 	FEM4EllipticPDE::FEM4EllipticPDE(const std::string&name) :
50
 	FEM4EllipticPDE::FEM4EllipticPDE(const std::string&name) :
51
-			LemmaObject(name), BndryH(1), BndrySigma(1),
51
+			LemmaObject(name), BndryH(1000), BndrySigma(1000),
52
             vtkSigma(NULL), vtkG(NULL), vtkGrid(NULL), gFcn3(NULL) {
52
             vtkSigma(NULL), vtkG(NULL), vtkGrid(NULL), gFcn3(NULL) {
53
 	}
53
 	}
54
 
54
 
214
 
214
 
215
         //Eigen::BiCGSTAB<Eigen::SparseMatrix<Real> > cg(A);
215
         //Eigen::BiCGSTAB<Eigen::SparseMatrix<Real> > cg(A);
216
         cg.setMaxIterations(3000);
216
         cg.setMaxIterations(3000);
217
+        cg.setTolerance(1e-28);
217
 
218
 
218
-        std::cout <<"          rows\tcols\n";
219
+        std::cout << "  rows\tcols\n";
219
         std::cout << "A: "  << A.rows() << "\t" << A.cols() << std::endl;
220
         std::cout << "A: "  << A.rows() << "\t" << A.cols() << std::endl;
220
         std::cout << "g: "  << g.rows() << "\t" << g.cols() << std::endl;
221
         std::cout << "g: "  << g.rows() << "\t" << g.cols() << std::endl;
221
 
222
 
321
 
322
 
322
             for (int ii=0; ii<4; ++ii) {
323
             for (int ii=0; ii<4; ++ii) {
323
                 for (int jj=0; jj<4; ++jj) {
324
                 for (int jj=0; jj<4; ++jj) {
325
+                    /* homogeneous Dirichlet boundary */
324
                     if (jj == ii) {
326
                     if (jj == ii) {
325
                         // Apply Homogeneous Dirichlet Boundary conditions
327
                         // Apply Homogeneous Dirichlet Boundary conditions
326
                         Real bb = vtkGrid->GetPointData()->GetScalars("vtkValidPointMask")->GetTuple(ID[ii])[0];
328
                         Real bb = vtkGrid->GetPointData()->GetScalars("vtkValidPointMask")->GetTuple(ID[ii])[0];
385
             //}
387
             //}
386
             //TODO this seems wrong!
388
             //TODO this seems wrong!
387
             //avg /= 4.;
389
             //avg /= 4.;
388
-                //g(ID[ii]) +=  (V) * ( vtkGrid->GetPointData()->GetScalars("G")->GetTuple(ID[ii])[0] )  ;
389
-                g(ID[ii]) += PI* (V) * avg;
390
+                g(ID[ii]) +=  (V/4.) * ( vtkGrid->GetPointData()->GetScalars("G")->GetTuple(ID[ii])[0] )  ;
391
+                //g(ID[ii]) +=  V/4*avg;
390
                   //g(ID[ii]) +=  6.67 *(V/4.) * avg;
392
                   //g(ID[ii]) +=  6.67 *(V/4.) * avg;
391
             }
393
             }
392
             //g(ID[0]) +=  (V/4.) * avg;
394
             //g(ID[0]) +=  (V/4.) * avg;

Loading…
취소
저장