Browse Source

Minor addition to LinearMag

master
Trevor Irons 8 years ago
parent
commit
fb96498734
2 changed files with 11 additions and 23 deletions
  1. 1
    1
      examples/LinearMag/sphere.geo
  2. 10
    22
      src/FEM4EllipticPDE.cpp

+ 1
- 1
examples/LinearMag/sphere.geo View File

8
  */
8
  */
9
 
9
 
10
 radius = 3.25;     // Radius of the damn thing
10
 radius = 3.25;     // Radius of the damn thing
11
-lc = radius/5;     //  0.25;   // Target element size
11
+lc = radius/10;     //  0.25;   // Target element size
12
 
12
 
13
 // Total Solution Space
13
 // Total Solution Space
14
 Box = 3*radius; // The down side of potential
14
 Box = 3*radius; // The down side of potential

+ 10
- 22
src/FEM4EllipticPDE.cpp View File

9
 //
9
 //
10
 //   Organisation:  Colorado School of Mines (CSM)
10
 //   Organisation:  Colorado School of Mines (CSM)
11
 //                  United States Geological Survey (USGS)
11
 //                  United States Geological Survey (USGS)
12
+//                  University of Utah (UU), 2016
12
 //
13
 //
13
-//          Email:  tirons@mines.edu, tirons@usgs.gov
14
-//
15
-//  This program is free software: you can redistribute it and/or modify
16
-//  it under the terms of the GNU General Public License as published by
17
-//  the Free Software Foundation, either version 3 of the License, or
18
-//  (at your option) any later version.
19
-//
20
-//  This program is distributed in the hope that it will be useful,
21
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
-//  GNU General Public License for more details.
24
-//
25
-//  You should have received a copy of the GNU General Public License
26
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
+//          Email:  tirons@egi.utah.edu
27
 //
15
 //
28
 // ===========================================================================
16
 // ===========================================================================
29
 
17
 
132
         gFcn3 = gFcn;
120
         gFcn3 = gFcn;
133
     }
121
     }
134
 
122
 
135
-    //void FEM4EllipticPDE::SetGrid(vtkDataSet* grid) {
136
-    //    vtkGrid = grid;
137
-    //}
138
-
139
     void FEM4EllipticPDE::SetGrid(vtkUnstructuredGrid* grid) {
123
     void FEM4EllipticPDE::SetGrid(vtkUnstructuredGrid* grid) {
140
         vtkGrid = grid;
124
         vtkGrid = grid;
141
     }
125
     }
173
     }		// -----  end of method FEM4EllipticPDE::SetVTKGridFile  -----
157
     }		// -----  end of method FEM4EllipticPDE::SetVTKGridFile  -----
174
 
158
 
175
 
159
 
160
+    //--------------------------------------------------------------------------------------
161
+    //       Class:  FEM4EllipticPDE
162
+    //      Method:  GetConnectedPoints
163
+    //         (C) Joe Capriotti 2013
164
+    //--------------------------------------------------------------------------------------
176
     vtkSmartPointer<vtkIdList> FEM4EllipticPDE::GetConnectedPoints(const int& id0) {
165
     vtkSmartPointer<vtkIdList> FEM4EllipticPDE::GetConnectedPoints(const int& id0) {
177
         vtkSmartPointer<vtkIdList> pointIds = vtkSmartPointer<vtkIdList>::New();
166
         vtkSmartPointer<vtkIdList> pointIds = vtkSmartPointer<vtkIdList>::New();
178
         vtkSmartPointer<vtkIdList> cellList = vtkSmartPointer<vtkIdList>::New();
167
         vtkSmartPointer<vtkIdList> cellList = vtkSmartPointer<vtkIdList>::New();
192
             }
181
             }
193
         }
182
         }
194
         return pointIds;
183
         return pointIds;
195
-    }
184
+    }		// -----  end of method FEM4EllipticPDE::GetConnectedPoints  -----
196
 
185
 
197
     Real FEM4EllipticPDE::dist(Real r0[3], Real r1[3]) {
186
     Real FEM4EllipticPDE::dist(Real r0[3], Real r1[3]) {
198
         Real rm0 = r1[0] - r0[0];
187
         Real rm0 = r1[0] - r0[0];
432
                     coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[ii], 1));
421
                     coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[ii], 1));
433
                 } else {
422
                 } else {
434
                     for (int jj=0; jj<4; ++jj) {
423
                     for (int jj=0; jj<4; ++jj) {
435
-                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj],        GradPhi.col(ii).tail<3>().dot(GradPhi.col(jj).tail<3>() ) * V * sigma_bar ) );
424
+                        coeffs.push_back( Eigen::Triplet<Real> ( ID[ii], ID[jj], GradPhi.col(ii).tail<3>().dot(GradPhi.col(jj).tail<3>() ) * V * sigma_bar ) );
436
                     }
425
                     }
437
                 }
426
                 }
438
             }
427
             }
533
                         Real nv2 = vtkGrid->GetPointData()->GetScalars("G")->GetTuple(ID[jj])[0];
522
                         Real nv2 = vtkGrid->GetPointData()->GetScalars("G")->GetTuple(ID[jj])[0];
534
                         if ( std::abs(nv1) > 1e-12 && std::abs(nv2) > 1e-12) {
523
                         if ( std::abs(nv1) > 1e-12 && std::abs(nv2) > 1e-12) {
535
                             Real length = ( C.row(ii).tail<3>()-C.row(jj).tail<3>()  ).norm();
524
                             Real length = ( C.row(ii).tail<3>()-C.row(jj).tail<3>()  ).norm();
536
-
537
-                            g(ID[ii]) += ((nv1+nv2)/2.)/(length);//*(V/4.);// * (vtkGrid->GetPointData()->GetScalars("G")->GetTuple(ID[ii])[0]); // Point source
525
+                            g(ID[ii]) += ((nv1+nv2)/2.)/(length);
538
                         }
526
                         }
539
                     }
527
                     }
540
                 }
528
                 }

Loading…
Cancel
Save