ソースを参照

A few minor changes towards annalytic solution convergence.

iss2
Trevor Irons 8年前
コミット
8bb08df16b

+ 7
- 4
examples/ResampleWithDataset.cpp ファイルの表示

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

+ 2
- 1
examples/VTKEdgeGsphere.cpp ファイルの表示

@@ -145,7 +145,8 @@ int main(int argc, char**argv) {
145 145
         } else if (std::string(argv[3]) == "gravity") {
146 146
             double mass = 4./3. * PI * (R*R*R); // volume * density (1)
147 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 150
             } else {
150 151
                 //phi->InsertTuple1( in, 0);
151 152
                 //double costheta = point[2]/raddist ;

+ 3
- 3
examples/borehole/sphere.geo ファイルの表示

@@ -8,10 +8,10 @@
8 8
  */
9 9
 
10 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 13
 // Total Solution Space
14
-Box = 10*radius; // The down side of potential
14
+Box = 100*radius; // The down side of potential
15 15
 X0 = -Box;
16 16
 X1 =  Box;
17 17
 Y0 = -Box;
@@ -19,7 +19,7 @@ Y1 =  Box;
19 19
 Z0 = -Box;
20 20
 Z1 =  Box;
21 21
 
22
-cellSize=lc/5; ///10;
22
+cellSize=radius/10; ///10;
23 23
 dd = 0 ; //  1e-5; //cellSize; // .01;
24 24
 pio2=Pi/2;
25 25
 

+ 2
- 2
examples/borehole/sphereBox.geo ファイルの表示

@@ -11,10 +11,10 @@ D0 = 10;          // Top of magnet
11 11
 D1 = 11;          // Bottom of magnet
12 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 16
 // Total Solution Space
17
-Box = 10*radius; // The down side of potential
17
+Box = 100*radius; // The down side of potential
18 18
 X0 = -Box;
19 19
 X1 =  Box;
20 20
 Y0 = -Box;

+ 6
- 4
src/FEM4EllipticPDE.cpp ファイルの表示

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

読み込み中…
キャンセル
保存