[cig-commits] commit: Make it easier to only run one iteration and check vs analytic solution.
Mercurial
hg at geodynamics.org
Wed Mar 28 02:44:25 PDT 2012
changeset: 122:a92b20b2e783
user: Walter Landry <wlandry at caltech.edu>
date: Tue Mar 27 16:06:56 2012 -0700
files: main.cxx
description:
Make it easier to only run one iteration and check vs analytic solution.
diff -r fd0aa4755b4e -r a92b20b2e783 main.cxx
--- a/main.cxx Tue Mar 27 16:06:14 2012 -0700
+++ b/main.cxx Tue Mar 27 16:06:56 2012 -0700
@@ -42,10 +42,11 @@ int main()
distx[Nx+1][Ny], disty[Nx][Ny+1], dCx[Nx+1][Ny], dCy[Nx][Ny+1];
double zx_new[Nx+1][Ny], zy_new[Nx][Ny+1], p_new[Nx][Ny];
- const bool jacobi(false);
+ const bool check_initial(true);
+ const bool jacobi(check_initial);
/* Initial conditions */
- int n_sweeps=1001;
+ const int n_sweeps(check_initial ? 1 : 1001);
const double theta_mom=0.7;
const double theta_continuity=1.0;
const double tolerance=1.0e-6;
@@ -63,21 +64,24 @@ int main()
for(int i=0;i<Nx+1;++i)
for(int j=0;j<Ny;++j)
{
- zx[i][j]=0;
+ if(!check_initial)
+ zx[i][j]=0;
Resid_x[i][j]=0;
}
for(int i=0;i<Nx;++i)
for(int j=0;j<Ny+1;++j)
{
- zy[i][j]=0;
+ if(!check_initial)
+ zy[i][j]=0;
Resid_y[i][j]=0;
}
for(int i=0;i<Nx;++i)
for(int j=0;j<Ny;++j)
{
- p[i][j]=0;
+ if(!check_initial)
+ p[i][j]=0;
Resid_p[i][j]=0;
}
@@ -349,6 +353,9 @@ int main()
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 dRm_dz=-6/(h*h) + 2*dlog_etayy + dlog_etaxx;
double dRc_dp=dRc_dzxp*dRmp_dp/dRm_dz
@@ -463,7 +470,7 @@ int main()
p[i][j]=p_new[i][j];
}
- if(sweep%1000==0)
+ if(sweep%100==0)
{
std::cout << "sweep "
<< sweep << " "
More information about the CIG-COMMITS
mailing list