[cig-commits] commit: Change Update_V to smooth_V

Mercurial hg at geodynamics.org
Tue Mar 15 01:45:53 PDT 2011


changeset:   132:e4f12479fe2a
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Tue Mar 15 01:44:56 2011 -0700
files:       StokesFACOps.h StokesFACOps/Update_V.C StokesFACOps/smooth_Gerya.C StokesFACOps/smooth_Tackley.C StokesFACOps/smooth_V.C wscript
description:
Change Update_V to smooth_V


diff -r 2d353fbcc99e -r e4f12479fe2a StokesFACOps.h
--- a/StokesFACOps.h	Tue Mar 15 01:44:08 2011 -0700
+++ b/StokesFACOps.h	Tue Mar 15 01:44:56 2011 -0700
@@ -565,7 +565,7 @@ private:
       int num_sweeps,
       double residual_tolerance = -1.0);
 
-  void Update_V
+  void smooth_V
   (const int &axis,
    const int j,
    const hier::Box &pbox,
diff -r 2d353fbcc99e -r e4f12479fe2a StokesFACOps/Update_V.C
--- a/StokesFACOps/Update_V.C	Tue Mar 15 01:44:08 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-#include "StokesFACOps.h"
-#include "Boundary.h"
-#include "dRc_dp.h"
-/*
-********************************************************************
-* Updates one component of the velocity during a red-black *
-* Gauss-Seidel iteration.  *
-********************************************************************
-*/
-void SAMRAI::solv::StokesFACOps::Update_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,
- pdat::CellData<double> &p,
- pdat::SideData<double> &v,
- pdat::SideData<double> &v_rhs,
- double &maxres,
- const double &dx,
- const double &dy,
- pdat::CellData<double> &cell_viscosity,
- pdat::NodeData<double> &edge_viscosity,
- 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);
-    
-  /* 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(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))
-            {
-              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);
-            }
-
-          C_vx=dRm_dv(cell_viscosity,edge_viscosity,center,left,up_e,center_e,
-                      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);
-
-          /* No scaling here, though there should be. */
-          maxres=std::max(maxres,std::fabs(delta_Rx));
-
-          v(center_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;
-            }
-        }
-    }
-}
diff -r 2d353fbcc99e -r e4f12479fe2a StokesFACOps/smooth_Gerya.C
--- a/StokesFACOps/smooth_Gerya.C	Tue Mar 15 01:44:08 2011 -0700
+++ b/StokesFACOps/smooth_Gerya.C	Tue Mar 15 01:44:56 2011 -0700
@@ -145,13 +145,13 @@ void SAMRAI::solv::StokesFACOps::smooth_
                       /* Update v */
                       if(j<pbox.upper(1)+1)
                         {
-                          Update_V(0,j,pbox,geom,center,left,right,down,up,p,
+                          smooth_V(0,j,pbox,geom,center,left,right,down,up,p,
                                    v,v_rhs,maxres,dx,dy,cell_viscosity,
                                    edge_viscosity,theta_momentum);
                         }
                       if(i<pbox.upper(0)+1)
                         {
-                          Update_V(1,i,pbox,geom,center,down,up,left,right,p,
+                          smooth_V(1,i,pbox,geom,center,down,up,left,right,p,
                                    v,v_rhs,maxres,dy,dx,cell_viscosity,
                                    edge_viscosity,theta_momentum);
                         }
diff -r 2d353fbcc99e -r e4f12479fe2a StokesFACOps/smooth_Tackley.C
--- a/StokesFACOps/smooth_Tackley.C	Tue Mar 15 01:44:08 2011 -0700
+++ b/StokesFACOps/smooth_Tackley.C	Tue Mar 15 01:44:56 2011 -0700
@@ -115,7 +115,7 @@ void SAMRAI::solv::StokesFACOps::smooth_
                       center[1]=j;
 
                       /* Update v */
-                      Update_V(0,j,pbox,geom,center,center-ip,center+ip,
+                      smooth_V(0,j,pbox,geom,center,center-ip,center+ip,
                                center-jp,center+jp,p,
                                v,v_rhs,maxres,dx,dy,cell_viscosity,
                                edge_viscosity,theta_momentum);
@@ -170,7 +170,7 @@ void SAMRAI::solv::StokesFACOps::smooth_
                       center[1]=j;
 
                       /* Update v */
-                      Update_V(1,i,pbox,geom,center,center-jp,center+jp,
+                      smooth_V(1,i,pbox,geom,center,center-jp,center+jp,
                                center-ip,center+ip,
                                p,v,v_rhs,maxres,dy,dx,cell_viscosity,
                                edge_viscosity,theta_momentum);
diff -r 2d353fbcc99e -r e4f12479fe2a StokesFACOps/smooth_V.C
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/StokesFACOps/smooth_V.C	Tue Mar 15 01:44:56 2011 -0700
@@ -0,0 +1,97 @@
+#include "StokesFACOps.h"
+#include "Boundary.h"
+#include "dRc_dp.h"
+/*
+********************************************************************
+* Updates one component of the velocity during a red-black *
+* Gauss-Seidel iteration.  *
+********************************************************************
+*/
+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,
+ pdat::CellData<double> &p,
+ pdat::SideData<double> &v,
+ pdat::SideData<double> &v_rhs,
+ double &maxres,
+ const double &dx,
+ const double &dy,
+ pdat::CellData<double> &cell_viscosity,
+ pdat::NodeData<double> &edge_viscosity,
+ 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);
+    
+  /* 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(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))
+            {
+              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);
+            }
+
+          C_vx=dRm_dv(cell_viscosity,edge_viscosity,center,left,up_e,center_e,
+                      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);
+
+          /* No scaling here, though there should be. */
+          maxres=std::max(maxres,std::fabs(delta_Rx));
+
+          v(center_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;
+            }
+        }
+    }
+}
diff -r 2d353fbcc99e -r e4f12479fe2a wscript
--- a/wscript	Tue Mar 15 01:44:08 2011 -0700
+++ b/wscript	Tue Mar 15 01:44:56 2011 -0700
@@ -53,7 +53,7 @@ def build(bld):
                         'StokesFACOps/set_boundaries.C',
                         'StokesFACOps/solveCoarsestLevel.C',
                         'StokesFACOps/solveCoarsestLevel_HYPRE.C',
-                        'StokesFACOps/Update_V.C',
+                        'StokesFACOps/smooth_V.C',
                         'StokesFACOps/xeqScheduleFluxCoarsen.C',
                         'StokesFACOps/xeqScheduleGhostFill.C',
                         'StokesFACOps/xeqScheduleGhostFillNoCoarse.C',



More information about the CIG-COMMITS mailing list