[cig-commits] commit: Make set_boundary handle the case where we are setting the pressure and not the velocity

Mercurial hg at geodynamics.org
Sat Apr 16 09:55:13 PDT 2011


changeset:   164:4da8a7a0723a
user:        Walter Landry <wlandry at caltech.edu>
date:        Sat Apr 16 09:35:26 2011 -0700
files:       set_boundary.C
description:
Make set_boundary handle the case where we are setting the pressure and not the velocity


diff -r e29160299bda -r 4da8a7a0723a set_boundary.C
--- a/set_boundary.C	Fri Apr 15 20:31:02 2011 -0700
+++ b/set_boundary.C	Sat Apr 16 09:35:26 2011 -0700
@@ -67,76 +67,82 @@ void set_boundary(const SAMRAI::hier::Pa
     }
 
 
-  tbox::Pointer<pdat::SideData<double> > v_ptr = patch.getPatchData(v_id);
-  pdat::SideData<double> &v(*v_ptr);
+  if(v_id!=-1)
+    {
+      tbox::Pointer<pdat::SideData<double> > v_ptr = patch.getPatchData(v_id);
+      pdat::SideData<double> &v(*v_ptr);
 
-  hier::Box gbox=v.getGhostBox();
-  for(int ix=0; ix<dim; ++ix)
-    {
-      for(pdat::SideIterator si(gbox,ix); si; si++)
+      hier::Box gbox=v.getGhostBox();
+      for(int ix=0; ix<dim; ++ix)
         {
-          pdat::SideIndex x(*si);
+          for(pdat::SideIterator si(gbox,ix); si; si++)
+            {
+              pdat::SideIndex x(*si);
 
-          // double pos_x=geom->getXLower()[0]
-          //   + geom->getDx()[0]*(x[0]-pbox.lower()[0]);
+              // double pos_x=geom->getXLower()[0]
+              //   + geom->getDx()[0]*(x[0]-pbox.lower()[0]);
 
-          /* Set a sentinel value for normal components */
-          if(x[ix]<pbox.lower(ix) && geom->getTouchesRegularBoundary(ix,0))
-            {
-              if(lower_dirichlet[ix])
-                v(x)=boundary_value;
+              /* Set a sentinel value for normal components */
+              if(x[ix]<pbox.lower(ix) && geom->getTouchesRegularBoundary(ix,0))
+                {
+                  if(lower_dirichlet[ix])
+                    v(x)=boundary_value;
+                  else
+                    v(x)=v(x+pp[ix]*2);
+                }
+              else if(x[ix]>pbox.upper(ix)+1
+                      && geom->getTouchesRegularBoundary(ix,1))
+                {
+                  if(upper_dirichlet[ix])
+                    v(x)=boundary_value;
+                  else
+                    v(x)=v(x-pp[ix]*2);
+                }
+              /* Set values for normal components */
+              else if(x[ix]==pbox.lower(ix)
+                      && geom->getTouchesRegularBoundary(ix,0)
+                      && !rhs && lower_dirichlet[ix])
+                {
+                  v(x)=lower_boundary[ix];
+                }
+              else if(x[ix]==pbox.upper(ix)+1
+                      && geom->getTouchesRegularBoundary(ix,1)
+                      && !rhs && upper_dirichlet[ix])
+                {
+                  v(x)=upper_boundary[ix];
+                }
+              /* Set derivatives for tangential component */
               else
-                v(x)=v(x+pp[ix]*2);
-            }
-          else if(x[ix]>pbox.upper(ix)+1 && geom->getTouchesRegularBoundary(ix,1))
-            {
-              if(upper_dirichlet[ix])
-                v(x)=boundary_value;
-              else
-                v(x)=v(x-pp[ix]*2);
-            }
-          /* Set values for normal components */
-          else if(x[ix]==pbox.lower(ix) && geom->getTouchesRegularBoundary(ix,0)
-                  && !rhs && lower_dirichlet[ix])
-            {
-              v(x)=lower_boundary[ix];
-            }
-          else if(x[ix]==pbox.upper(ix)+1 && geom->getTouchesRegularBoundary(ix,1)
-                  && !rhs && upper_dirichlet[ix])
-            {
-              v(x)=upper_boundary[ix];
-            }
-          /* Set derivatives for tangential component */
-          else
-            {
-              for(int iy=(ix+1)%dim; iy!=ix; iy=(iy+1)%dim)
                 {
-                  if(x[iy]<pbox.lower(iy)
-                     && geom->getTouchesRegularBoundary(iy,0))
+                  for(int iy=(ix+1)%dim; iy!=ix; iy=(iy+1)%dim)
                     {
-                      v(x)=v(x+pp[iy]);
+                      if(x[iy]<pbox.lower(iy)
+                         && geom->getTouchesRegularBoundary(iy,0))
+                        {
+                          v(x)=v(x+pp[iy]);
 
-                      // if(ix==0 && iy==1)
-                      //   {
-                      //     if(pos_x<0.1 || rhs)
-                      //       {
-                      //         v(x)=-v(x+pp[iy]);
-                      //       }
-                      //     else
-                      //       {
-                      //         v(x)=-v(x+pp[iy]) + 2*upper_boundary[0];
-                      //       }
-                      //   }
-                    }
-                  else if(x[iy]>pbox.upper(iy)
-                          && geom->getTouchesRegularBoundary(iy,1))
-                    {
-                      v(x)=v(x-pp[iy]);
+                          // if(ix==0 && iy==1)
+                          //   {
+                          //     if(pos_x<0.1 || rhs)
+                          //       {
+                          //         v(x)=-v(x+pp[iy]);
+                          //       }
+                          //     else
+                          //       {
+                          //         v(x)=-v(x+pp[iy]) + 2*upper_boundary[0];
+                          //       }
+                          //   }
+                        }
+                      else if(x[iy]>pbox.upper(iy)
+                              && geom->getTouchesRegularBoundary(iy,1))
+                        {
+                          v(x)=v(x-pp[iy]);
 
-                      // if(ix==1 && iy==0)
-                      //   {
-                      //     v(x)=-v(x-pp[iy]);
-                      //   }
+                          // if(ix==1 && iy==0)
+                          //   {
+                          //     v(x)=-v(x-pp[iy]);
+                          //   }
+                        }
                     }
                 }
             }



More information about the CIG-COMMITS mailing list