[cig-commits] commit: Get rid of hard-coded constants in HRS_Erosion

Mercurial hg at geodynamics.org
Tue Apr 6 20:39:25 PDT 2010


changeset:   843:487f03ba821c
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Tue Apr 06 20:37:43 2010 -0700
files:       plugins/HRS_Erosion/Context.h plugins/HRS_Erosion/HRS_Erosion.c
description:
Get rid of hard-coded constants in HRS_Erosion


diff -r 1b00affdd14c -r 487f03ba821c plugins/HRS_Erosion/Context.h
--- a/plugins/HRS_Erosion/Context.h	Thu Apr 01 07:01:03 2010 -0700
+++ b/plugins/HRS_Erosion/Context.h	Tue Apr 06 20:37:43 2010 -0700
@@ -32,6 +32,10 @@
 		double			DT;
 		double			first_t_erosion;
 		double			vT;
+		double			m;
+		double			n;
+		double			ka;
+		double			h;
                 FeVariable*             v;
 		AbstractContext*        ctx;
                 TimeIntegrator*         timeIntegrator;
diff -r 1b00affdd14c -r 487f03ba821c plugins/HRS_Erosion/HRS_Erosion.c
--- a/plugins/HRS_Erosion/HRS_Erosion.c	Thu Apr 01 07:01:03 2010 -0700
+++ b/plugins/HRS_Erosion/HRS_Erosion.c	Tue Apr 06 20:37:43 2010 -0700
@@ -68,7 +68,7 @@ void Underworld_HRS_Erosion_Execute( Tim
 {
   double				dt;
   FeVariable *velocity;
-  double K = spCtx->K;
+  const double K = spCtx->K;
   Grid* grid;
   Mesh* mesh;
   unsigned nDims;
@@ -77,7 +77,7 @@ void Underworld_HRS_Erosion_Execute( Tim
   MPI_Comm comm;
   double DT = spCtx->DT;
   double first_t_erosion = spCtx->first_t_erosion;
-  double vT = spCtx->vT;
+  const double vT = spCtx->vT;
   IJK ijk_right;
   IJK ijk_left;
   Bool on_top, on_right, found;
@@ -210,10 +210,10 @@ void Underworld_HRS_Erosion_Execute( Tim
 				
   /* Insert equation here and calculate new slope: */
 
-  const double m=0.4; 
-  const double n=1; 
-  const double ka=4;
-  const double h=1.4; 
+  const double m=spCtx->m; 
+  const double n=spCtx->n; 
+  const double ka=spCtx->ka;
+  const double h=spCtx->h;
   double S=tan(a_mean_old);
 
   /* alpha_calculated=(alpha1+atan((2.*vT./W1.^2 - 2*K*ka*W1^(h*m-1)*S^n/(h*m+1))*dt)) */
@@ -356,6 +356,10 @@ void _Underworld_HRS_Erosion_AssignFromX
   spCtx->DT = Dictionary_GetDouble(spDict, "dt_erosion");
   spCtx->first_t_erosion = Dictionary_GetDouble(spDict, "first_t_erosion");
   spCtx->vT = Dictionary_GetDouble(spDict, "vT");
+  spCtx->m = Dictionary_GetDouble(spDict, "m");
+  spCtx->n = Dictionary_GetDouble(spDict, "n");
+  spCtx->ka = Dictionary_GetDouble(spDict, "ka");
+  spCtx->h = Dictionary_GetDouble(spDict, "h");
 }
 
 void _Underworld_HRS_Erosion_Build( void* codelet, void* data ) {



More information about the CIG-COMMITS mailing list