[cig-commits] commit: Compute dRc_dp correctly. Does not seem to make much difference.

Mercurial hg at geodynamics.org
Thu Mar 29 18:35:09 PDT 2012


changeset:   136:01fed406ab39
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Thu Mar 29 18:23:56 2012 -0700
files:       main.cxx
description:
Compute dRc_dp correctly.  Does not seem to make much difference.


diff -r 40cd5b154dd2 -r 01fed406ab39 main.cxx
--- a/main.cxx	Thu Mar 29 15:57:42 2012 -0700
+++ b/main.cxx	Thu Mar 29 18:23:56 2012 -0700
@@ -335,23 +335,23 @@ int main()
             double Rc=dzx_x + dzy_y + dlog_etax*zx_avg + dlog_etay*zy_avg
               + Cp;
             
-            double dRc_dzxp=1/h - dlog_etax/2;
-            double dRc_dzxm=-1/h - dlog_etax/2;
-            double dRc_dzyp=1/h - dlog_etay/2;
-            double dRc_dzym=-1/h - dlog_etay/2;
-
             double dRmp_dp=-1/h;
             double dRmm_dp=1/h;
 
-            /* TODO: fix dRm_dz for the boundaries.  It should be
-               -5/(h*h) sometimes. */
+            double dRc_dp(0);
+            if(i!=Nx-1)
+              dRc_dp+=(1/h - dlog_etax/2)*dRmp_dp/dRx[i+1][j];
 
-            double dRm_dz=-6/(h*h) + 2*dlog_etayy + dlog_etaxx;
+            if(i!=0)
+              dRc_dp+=(-1/h - dlog_etax/2)*dRmm_dp/dRx[i][j];
 
-            double dRc_dp=dRc_dzxp*dRmp_dp/dRm_dz
-              + dRc_dzxm*dRmm_dp/dRm_dz
-              + dRc_dzyp*dRmp_dp/dRm_dz
-              + dRc_dzym*dRmm_dp/dRm_dz;
+            if(j!=Ny-1)
+              dRc_dp+=(1/h - dlog_etay/2)*dRmp_dp/dRy[i][j+1];
+
+            if(j!=0)
+              dRc_dp+=(-1/h - dlog_etay/2)*dRmm_dp/dRy[i][j];
+
+            // double dRc_dp=4.0/6;
 
             Resid_p[i][j]=Rc;
 



More information about the CIG-COMMITS mailing list