[cig-commits] commit: Make MDPI work on adapted grids

Mercurial hg at geodynamics.org
Sat Mar 12 05:37:16 PST 2011


changeset:   117:c6b0d0a8b7f5
user:        Walter Landry <wlandry at caltech.edu>
date:        Fri Mar 11 16:56:26 2011 -0800
files:       P_MDPI_Refine.C input/shear_corner.input
description:
Make MDPI work on adapted grids


diff -r 6b3228876aaf -r c6b0d0a8b7f5 P_MDPI_Refine.C
--- a/P_MDPI_Refine.C	Fri Mar 11 16:55:03 2011 -0800
+++ b/P_MDPI_Refine.C	Fri Mar 11 16:56:26 2011 -0800
@@ -86,6 +86,8 @@ void SAMRAI::geom::P_MDPI_Refine::refine
    tbox::Pointer<geom::CartesianPatchGeometry>
      geom = coarse_patch.getPatchGeometry();
 
+   hier::Box gbox=p_fine.getGhostBox();
+
    const double dx = geom->getDx()[0];
    const double dy = geom->getDx()[1];
 
@@ -103,32 +105,41 @@ void SAMRAI::geom::P_MDPI_Refine::refine
          jp[1]=1;
          pdat::CellIndex center(hier::Index::coarsen(fine,hier::Index(2,2)));
 
-         double dRc_dp_total(0), dRc_dp_fine(0);
-         /* This is horribly inefficient */
-         for(int xx=0;xx<2;++xx)
-           for(int yy=0;yy<2;++yy)
-             {
-               pdat::CellIndex c_fine(center*2);
-               c_fine[0]+=xx;
-               c_fine[1]+=yy;
+         if(fine[0]>gbox.lower(0) && fine[0]<gbox.upper(0)
+            && fine[1]>gbox.lower(1) && fine[1]<gbox.upper(1))
+           {
+             double dRc_dp_total(0), dRc_dp_fine(0);
+             /* This is horribly inefficient */
+             for(int xx=0;xx<2;++xx)
+               for(int yy=0;yy<2;++yy)
+                 {
+                   pdat::CellIndex c_fine(center*2);
+                   c_fine[0]+=xx;
+                   c_fine[1]+=yy;
                
-               pdat::CellIndex left(c_fine-ip),right(c_fine+ip),
-                 down(c_fine-jp), up(c_fine+jp);
-               pdat::SideIndex left_x(left,0,pdat::SideIndex::Lower),
-                 right_x(right,0,pdat::SideIndex::Lower),
-                 down_y(down,1,pdat::SideIndex::Lower),
-                 up_y(up,1,pdat::SideIndex::Lower);
+                   pdat::CellIndex left(c_fine-ip),right(c_fine+ip),
+                     down(c_fine-jp), up(c_fine+jp);
+                   pdat::SideIndex left_x(left,0,pdat::SideIndex::Lower),
+                     right_x(right,0,pdat::SideIndex::Lower),
+                     down_y(down,1,pdat::SideIndex::Lower),
+                     up_y(up,1,pdat::SideIndex::Lower);
 
-               double dRc_dp_weight=dRc_dp(fine_box,c_fine,left,right,down,up,
-                                           left_x,right_x,down_y,up_y,
-                                           cell_viscosity,edge_viscosity,v,
-                                           dx,dy);
-               if(c_fine==fine)
-                 dRc_dp_fine=dRc_dp_weight;
-               dRc_dp_total+=dRc_dp_weight;
-             }
+                   double dRc_dp_weight=
+                     dRc_dp(fine_box,c_fine,left,right,down,up,
+                            left_x,right_x,down_y,up_y,
+                            cell_viscosity,edge_viscosity,v,dx,dy);
 
-         p_fine(fine)=p(center)*dRc_dp_total/(4*dRc_dp_fine);
+                   if(c_fine==fine)
+                     dRc_dp_fine=dRc_dp_weight;
+                   dRc_dp_total+=dRc_dp_weight;
+                 }
+
+             p_fine(fine)=p(center)*dRc_dp_total/(4*dRc_dp_fine);
+           }
+         else
+           {
+             p_fine(fine)=p(center);
+           }
 
          // tbox::plog << "P_MDPI_Refine "
          //            << fine_patch.getPatchLevelNumber() << " "
diff -r 6b3228876aaf -r c6b0d0a8b7f5 input/shear_corner.input
--- a/input/shear_corner.input	Fri Mar 11 16:55:03 2011 -0800
+++ b/input/shear_corner.input	Fri Mar 11 16:56:26 2011 -0800
@@ -34,16 +34,16 @@ FACStokes {
     enable_logging = TRUE   // Bool flag to switch logging on/off
     max_cycles = 1000         // Max number of FAC cycles to use
     residual_tol = 1e-8     // Residual tolerance to solve for
-    num_pre_sweeps = 30      // Number of presmoothing sweeps to use
-    num_post_sweeps = 30     // Number of postsmoothing sweeps to use
+    num_pre_sweeps = 5      // Number of presmoothing sweeps to use
+    num_post_sweeps = 5     // Number of postsmoothing sweeps to use
     smoothing_choice = "Tackley"
     coarse_solver_choice = "Tackley"
     // smoothing_choice = "Gerya"
     // coarse_solver_choice = "Gerya"
-    coarse_solver_max_iterations = 25000
+    coarse_solver_max_iterations = 25
     coarse_solver_tolerance = 1e-8
-    // p_prolongation_method = "P_MDPI_REFINE"
-    p_prolongation_method = "P_REFINE"
+    p_prolongation_method = "P_MDPI_REFINE"
+    // p_prolongation_method = "P_REFINE"
     v_prolongation_method = "V_REFINE"
   }
   bc_coefs {
@@ -93,14 +93,14 @@ StandardTagAndInitialize {
   RefineBoxes {
     // level_0 = [(0,0),(15,15)]
     level_0 = [(0,0),(3,3)]
-    level_1 = [(0,0),(7,7)]
-    level_2 = [(0,0),(15,15)]
+    // level_1 = [(0,0),(7,7)]
+    // level_2 = [(0,0),(15,15)]
     // level_3 = [(0,0),(31,31)]
     // level_4 = [(0,0),(63,63)]
     // level_5 = [(0,0),(127,127)]
-    // level_1 = [(2,2),(3,3)]
-    // level_2 = [(4,4),(5,5)]
-    // level_3 = [(8,8),(20,20)]
+    level_1 = [(2,2),(5,5)]
+    level_2 = [(6,6),(9,9)]
+    level_3 = [(14,14),(15,15)]
     //etc.
   }
 }
@@ -131,7 +131,7 @@ PatchHierarchy {
    //              [level 0 entry]
    //   etc....                       
    // }
-   max_levels = 3
+   max_levels = 4
    ratio_to_coarser {
       level_1            = 2, 2
       level_2            = 2, 2



More information about the CIG-COMMITS mailing list