[cig-commits] commit: Get rid of compute_dR_dv since we can get the values from compute_coefficients.
Mercurial
hg at geodynamics.org
Fri Mar 30 09:32:34 PDT 2012
changeset: 140:ba38ec727c92
user: Walter Landry <wlandry at caltech.edu>
date: Fri Mar 30 09:22:59 2012 -0700
files: compute_coefficients/compute_coefficients.cxx compute_dR_dv.cxx main.cxx wscript
description:
Get rid of compute_dR_dv since we can get the values from compute_coefficients.
diff -r c63e54bcf2e9 -r ba38ec727c92 compute_coefficients/compute_coefficients.cxx
--- a/compute_coefficients/compute_coefficients.cxx Fri Mar 30 06:48:19 2012 -0700
+++ b/compute_coefficients/compute_coefficients.cxx Fri Mar 30 09:22:59 2012 -0700
@@ -46,7 +46,9 @@ void compute_coefficients(const double l
const double disty[Nx][Ny+1],
std::vector<Coefficient> Cfx[2][Nx+1][Ny],
std::vector<Coefficient> Cfy[2][Nx][Ny+1],
- std::vector<Coefficient> Cfp[2][Nx][Ny])
+ std::vector<Coefficient> Cfp[2][Nx][Ny],
+ double dRx[Nx+1][Ny],
+ double dRy[Nx][Ny+1])
{
double zx[Nx+1][Ny], zy[Nx][Ny+1], p[Nx][Ny];
double fx[Nx+1][Ny], fy[Nx][Ny+1];
@@ -83,6 +85,9 @@ void compute_coefficients(const double l
distx,disty);
if(R!=0)
Cfx[0][i][j].push_back(Coefficient(di,dj,R));
+
+ if(di==i && dj==j)
+ dRx[i][j]=R;
zx[di][dj]=0;
}
for(int di=std::max(i-max_r,0);di<=std::min(i+max_r,max_ij(1,0));++di)
@@ -120,6 +125,9 @@ void compute_coefficients(const double l
distx,disty);
if(R!=0)
Cfy[1][i][j].push_back(Coefficient(di,dj,R));
+
+ if(di==i && dj==j)
+ dRy[i][j]=R;
zy[di][dj]=0;
}
shrink_capacity(Cfy[0][i][j]);
diff -r c63e54bcf2e9 -r ba38ec727c92 compute_dR_dv.cxx
--- a/compute_dR_dv.cxx Fri Mar 30 06:48:19 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* Computes the derivative of the residual and correction w/respect to the
- augumented velocity (z). This is equal to the correction when
- z(i.j)=1 and everywhere z=0 and gravity=0, because everything is
- linear in z. */
-
-#include "constants.hxx"
-#include "compute_Cxyz.hxx"
-
-void compute_dR_dv(const double log_etax[Nx+1][Ny],
- const double log_etay[Nx][Ny+1],
- const double distx[Nx+1][Ny],
- const double disty[Nx][Ny+1],
- double dRx[Nx+1][Ny],
- double dRy[Nx][Ny+1])
-{
- double zx[Nx+1][Ny], zy[Nx][Ny+1];
- double fx[Nx+1][Ny], fy[Nx][Ny+1];
-
- for(int i=0;i<Nx+1;++i)
- for(int j=0;j<Ny;++j)
- zx[i][j]=fx[i][j]=0;
-
- for(int i=0;i<Nx;++i)
- for(int j=0;j<Ny+1;++j)
- zy[i][j]=fy[i][j]=0;
-
- /* TODO: add in the terms due to the derivative of the viscosity */
-
- for(int j=0;j<Ny;++j)
- for(int i=1;i<Nx;++i)
- {
- zx[i][j]=1;
- compute_Cxyz(zx,zy,log_etax,log_etay,distx,disty,
- 0,i,j,dRx[i][j]);
- zx[i][j]=0;
-
- if(j==0 || j==Ny-1)
- dRx[i][j]-=5/(h*h);
- else
- dRx[i][j]-=6/(h*h);
- }
-
- for(int j=1;j<Ny;++j)
- for(int i=0;i<Nx;++i)
- {
- zy[i][j]=1;
- compute_Cxyz(zx,zy,log_etax,log_etay,distx,disty,
- 1,i,j,dRy[i][j]);
- zy[i][j]=0;
-
- if(i==0 || i==Nx-1)
- dRy[i][j]-=5/(h*h);
- else
- dRy[i][j]-=6/(h*h);
- }
-
-}
-
-
diff -r c63e54bcf2e9 -r ba38ec727c92 main.cxx
--- a/main.cxx Fri Mar 30 06:48:19 2012 -0700
+++ b/main.cxx Fri Mar 30 09:22:59 2012 -0700
@@ -22,20 +22,15 @@ extern void compute_Cp(const double zx[N
const int &i, const int &j,
double &Cp);
-extern void compute_dR_dv(const double log_etax[Nx+1][Ny],
- const double log_etay[Nx][Ny+1],
- const double distx[Nx+1][Ny],
- const double disty[Nx][Ny+1],
- double dRx[Nx+1][Ny],
- double dRy[Nx][Ny+1]);
-
void compute_coefficients(const double log_etax[Nx+1][Ny],
const double log_etay[Nx][Ny+1],
const double distx[Nx+1][Ny],
const double disty[Nx][Ny+1],
std::vector<Coefficient> Cfx[2][Nx+1][Ny],
std::vector<Coefficient> Cfy[2][Nx][Ny+1],
- std::vector<Coefficient> Cfp[2][Nx][Ny]);
+ std::vector<Coefficient> Cfp[2][Nx][Ny],
+ double dRx[Nx+1][Ny],
+ double dRy[Nx][Ny+1]);
int main()
{
@@ -67,8 +62,7 @@ int main()
initial(model,zx,zy,log_etax,log_etay,p,fx,fy,distx,disty);
- compute_dR_dv(log_etax,log_etay,distx,disty,dRx,dRy);
- compute_coefficients(log_etax,log_etay,distx,disty,Cfx,Cfy,Cfp);
+ compute_coefficients(log_etax,log_etay,distx,disty,Cfx,Cfy,Cfp,dRx,dRy);
double Resid_p[Nx][Ny], Resid_x[Nx+1][Ny], Resid_y[Nx][Ny+1];
diff -r c63e54bcf2e9 -r ba38ec727c92 wscript
--- a/wscript Fri Mar 30 06:48:19 2012 -0700
+++ b/wscript Fri Mar 30 09:22:59 2012 -0700
@@ -16,7 +16,6 @@ def build(bld):
'compute_v_on_interface/compute_dv_dtt.cxx',
'compute_Cxyz.cxx',
'compute_Cp.cxx',
- 'compute_dR_dv.cxx',
'compute_jumps.cxx',
'Interface/Interface.cxx'],
More information about the CIG-COMMITS
mailing list