[cig-commits] commit: Clean up smooth_V a little

Mercurial hg at geodynamics.org
Tue Mar 15 02:06:55 PDT 2011


changeset:   133:6a92d38c2b20
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Tue Mar 15 02:05:58 2011 -0700
files:       StokesFACOps.h StokesFACOps/smooth_Gerya.C StokesFACOps/smooth_Tackley.C StokesFACOps/smooth_V.C
description:
Clean up smooth_V a little


diff -r e4f12479fe2a -r 6a92d38c2b20 StokesFACOps.h
--- a/StokesFACOps.h	Tue Mar 15 01:44:56 2011 -0700
+++ b/StokesFACOps.h	Tue Mar 15 02:05:58 2011 -0700
@@ -567,14 +567,11 @@ private:
 
   void smooth_V
   (const int &axis,
-   const int j,
    const hier::Box &pbox,
    tbox::Pointer<geom::CartesianPatchGeometry> &geom,
    const pdat::CellIndex &center,
-   const pdat::CellIndex &left,
-   const pdat::CellIndex &right, 
-   const pdat::CellIndex &down,
-   const pdat::CellIndex &up,
+   const hier::Index &ip,
+   const hier::Index &jp,
    pdat::CellData<double> &p,
    pdat::SideData<double> &v,
    pdat::SideData<double> &v_rhs,
diff -r e4f12479fe2a -r 6a92d38c2b20 StokesFACOps/smooth_Gerya.C
--- a/StokesFACOps/smooth_Gerya.C	Tue Mar 15 01:44:56 2011 -0700
+++ b/StokesFACOps/smooth_Gerya.C	Tue Mar 15 02:05:58 2011 -0700
@@ -145,14 +145,14 @@ void SAMRAI::solv::StokesFACOps::smooth_
                       /* Update v */
                       if(j<pbox.upper(1)+1)
                         {
-                          smooth_V(0,j,pbox,geom,center,left,right,down,up,p,
-                                   v,v_rhs,maxres,dx,dy,cell_viscosity,
+                          smooth_V(0,pbox,geom,center,ip,jp,
+                                   p,v,v_rhs,maxres,dx,dy,cell_viscosity,
                                    edge_viscosity,theta_momentum);
                         }
                       if(i<pbox.upper(0)+1)
                         {
-                          smooth_V(1,i,pbox,geom,center,down,up,left,right,p,
-                                   v,v_rhs,maxres,dy,dx,cell_viscosity,
+                          smooth_V(1,pbox,geom,center,jp,ip,
+                                   p,v,v_rhs,maxres,dy,dx,cell_viscosity,
                                    edge_viscosity,theta_momentum);
                         }
                     }
diff -r e4f12479fe2a -r 6a92d38c2b20 StokesFACOps/smooth_Tackley.C
--- a/StokesFACOps/smooth_Tackley.C	Tue Mar 15 01:44:56 2011 -0700
+++ b/StokesFACOps/smooth_Tackley.C	Tue Mar 15 02:05:58 2011 -0700
@@ -115,9 +115,8 @@ void SAMRAI::solv::StokesFACOps::smooth_
                       center[1]=j;
 
                       /* Update v */
-                      smooth_V(0,j,pbox,geom,center,center-ip,center+ip,
-                               center-jp,center+jp,p,
-                               v,v_rhs,maxres,dx,dy,cell_viscosity,
+                      smooth_V(0,pbox,geom,center,ip,jp,
+                               p,v,v_rhs,maxres,dx,dy,cell_viscosity,
                                edge_viscosity,theta_momentum);
                     }
                 }
@@ -170,8 +169,7 @@ void SAMRAI::solv::StokesFACOps::smooth_
                       center[1]=j;
 
                       /* Update v */
-                      smooth_V(1,i,pbox,geom,center,center-jp,center+jp,
-                               center-ip,center+ip,
+                      smooth_V(1,pbox,geom,center,jp,ip,
                                p,v,v_rhs,maxres,dy,dx,cell_viscosity,
                                edge_viscosity,theta_momentum);
                     }
diff -r e4f12479fe2a -r 6a92d38c2b20 StokesFACOps/smooth_V.C
--- a/StokesFACOps/smooth_V.C	Tue Mar 15 01:44:56 2011 -0700
+++ b/StokesFACOps/smooth_V.C	Tue Mar 15 02:05:58 2011 -0700
@@ -9,14 +9,11 @@
 */
 void SAMRAI::solv::StokesFACOps::smooth_V
 (const int &axis,
- const int j,
  const hier::Box &pbox,
  tbox::Pointer<geom::CartesianPatchGeometry> &geom,
  const pdat::CellIndex &center,
- const pdat::CellIndex &left,
- const pdat::CellIndex &right, 
- const pdat::CellIndex &down,
- const pdat::CellIndex &up,
+ const hier::Index &ip,
+ const hier::Index &jp,
  pdat::CellData<double> &p,
  pdat::SideData<double> &v,
  pdat::SideData<double> &v_rhs,
@@ -28,70 +25,56 @@ void SAMRAI::solv::StokesFACOps::smooth_
  const double &theta_momentum)
 {
   const int off_axis=(axis==0) ? 1 : 0;
-  hier::Index ip(0,0), jp(0,0);
-  ip[axis]=1;
-  jp[off_axis]=1;
 
-  const pdat::SideIndex
-    center_x(center,axis,pdat::SideIndex::Lower),
-    left_x(left,axis,pdat::SideIndex::Lower),
-    right_x(right,axis,pdat::SideIndex::Lower),
-    down_x(down,axis,pdat::SideIndex::Lower),
-    up_x(up,axis,pdat::SideIndex::Lower),
-    center_y(center,off_axis,pdat::SideIndex::Lower),
-    up_y(up,off_axis,pdat::SideIndex::Lower);
-  const pdat::NodeIndex
-    center_e(center,pdat::NodeIndex::LowerLeft),
-    up_e(up,pdat::NodeIndex::LowerLeft);
+  const pdat::SideIndex x(center,axis,pdat::SideIndex::Lower),
+    y(center,off_axis,pdat::SideIndex::Lower);
+  const pdat::NodeIndex edge(center,pdat::NodeIndex::LowerLeft);
     
-  /* Update vx */
-  if(j<pbox.upper(off_axis)+1)
+  /* If at the 'x' boundaries, leave vx as is */
+  if(!((center[axis]==pbox.lower(axis) && v(x-ip)==boundary_value)
+       || (center[axis]==pbox.upper(axis)+1 && v(x+ip)==boundary_value)))
     {
-      /* If at the 'x' boundaries, leave vx as is */
-      if(!((center[axis]==pbox.lower(axis) && v(left_x)==boundary_value)
-           || (center[axis]==pbox.upper(axis)+1 && v(right_x)==boundary_value)))
+      double C_vx;
+      /* If y==0 */
+      hier::Index offset(0,0);
+      bool set_boundary(false);
+      if(center[axis]==pbox.lower(axis)+1
+         && !geom->getTouchesRegularBoundary(axis,0))
         {
-          double C_vx;
-          /* If y==0 */
-          hier::Index offset(0,0);
-          bool set_boundary(false);
-          if(center[axis]==pbox.lower(axis)+1
-             && !geom->getTouchesRegularBoundary(axis,0))
-            {
-              offset[axis]=-2;
-              set_boundary=true;
-            }
-          else if(center[axis]==pbox.upper(axis)
-                  && !geom->getTouchesRegularBoundary(axis,1))
-            {
-              offset[axis]=2;
-              set_boundary=true;
-            }
+          offset[axis]=-2;
+          set_boundary=true;
+        }
+      else if(center[axis]==pbox.upper(axis)
+              && !geom->getTouchesRegularBoundary(axis,1))
+        {
+          offset[axis]=2;
+          set_boundary=true;
+        }
 
-          double dv(0);
-          if(set_boundary)
-            {
-              dv=v(center_x+offset) - v(center_x);
-            }
+      double dv(0);
+      if(set_boundary)
+        {
+          dv=v(x+offset) - v(x);
+        }
 
-          C_vx=dRm_dv(cell_viscosity,edge_viscosity,center,left,up_e,center_e,
-                      dx,dy);
+      C_vx=dRm_dv(cell_viscosity,edge_viscosity,center,center-ip,edge+jp,edge,
+                  dx,dy);
 
-          double delta_Rx=v_rhs(center_x)
-            - v_operator_2D(v,p,cell_viscosity,edge_viscosity,center,
-                            center_e,center_x,center_y,ip,jp,dx,dy);
+      double delta_Rx=v_rhs(x)
+        - v_operator_2D(v,p,cell_viscosity,edge_viscosity,center,
+                        edge,x,y,ip,jp,dx,dy);
 
-          /* No scaling here, though there should be. */
-          maxres=std::max(maxres,std::fabs(delta_Rx));
+      /* No scaling here, though there should be. */
+      maxres=std::max(maxres,std::fabs(delta_Rx));
 
-          v(center_x)+=delta_Rx*theta_momentum/C_vx;
+      v(x)+=delta_Rx*theta_momentum/C_vx;
 
-          /* Set the boundary elements so that the
-             derivative is zero. */
-          if(set_boundary)
-            {
-              v(center_x+offset)=v(center_x) + dv;
-            }
+      /* Set the boundary elements so that the
+         derivative is zero. */
+      if(set_boundary)
+        {
+          v(x+offset)=v(x) + dv;
         }
     }
 }
+



More information about the CIG-COMMITS mailing list