[cig-commits] r16087 - in mc/3D/CitcomS/trunk: lib module

tan2 at geodynamics.org tan2 at geodynamics.org
Tue Dec 8 13:43:16 PST 2009


Author: tan2
Date: 2009-12-08 13:43:15 -0800 (Tue, 08 Dec 2009)
New Revision: 16087

Modified:
   mc/3D/CitcomS/trunk/lib/Drive_solvers.c
   mc/3D/CitcomS/trunk/lib/Element_calculations.c
   mc/3D/CitcomS/trunk/lib/Stokes_flow_Incomp.c
   mc/3D/CitcomS/trunk/module/bindings.c
   mc/3D/CitcomS/trunk/module/stokes_solver.c
   mc/3D/CitcomS/trunk/module/stokes_solver.h
Log:
Merged solve_constrained_flow_iterative_pseudo_surf() with void solve_constrained_flow_iterative(); assemble_forces_pseudo_surf() wi

Removed used python bindings in module/stokes_solver.c



Modified: mc/3D/CitcomS/trunk/lib/Drive_solvers.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Drive_solvers.c	2009-12-08 17:19:49 UTC (rev 16086)
+++ mc/3D/CitcomS/trunk/lib/Drive_solvers.c	2009-12-08 21:43:15 UTC (rev 16087)
@@ -178,10 +178,10 @@
 
 void general_stokes_solver_pseudo_surf(struct All_variables *E)
 {
-  void solve_constrained_flow_iterative_pseudo_surf();
+  void solve_constrained_flow_iterative();
   void construct_stiffness_B_matrix();
   void velocities_conform_bcs();
-  void assemble_forces_pseudo_surf();
+  void assemble_forces();
   void get_system_viscosity();
   void std_timestep();
   void remove_rigid_rot();
@@ -207,12 +207,12 @@
   E->monitor.topo_loop = 0;
   if(E->monitor.solution_cycles==0) std_timestep(E);
   while(E->monitor.stop_topo_loop == 0) {
-	  assemble_forces_pseudo_surf(E,0);
+	  assemble_forces(E,0);
 	  if(need_visc_update(E)){
 	    get_system_viscosity(E,1,E->EVI[E->mesh.levmax],E->VI[E->mesh.levmax]);
 	    construct_stiffness_B_matrix(E);
 	  }
-	  solve_constrained_flow_iterative_pseudo_surf(E);
+	  solve_constrained_flow_iterative(E);
 
 	  if (E->viscosity.SDEPV || E->viscosity.PDEPV) {
 
@@ -238,8 +238,10 @@
 			  dUdot_mag = vnorm_nonnewt(E,delta_U,oldU,E->mesh.levmax);
 
 			  if(E->parallel.me==0){
-				  fprintf(stderr,"Stress dependent viscosity: DUdot = %.4e (%.4e) for iteration %d\n",dUdot_mag,Udot_mag,count);
-				  fprintf(E->fp,"Stress dependent viscosity: DUdot = %.4e (%.4e) for iteration %d\n",dUdot_mag,Udot_mag,count);
+                              fprintf(stderr,"Stress dep. visc./plast.: DUdot = %.4e (%.4e) for iteration %d\n",
+                                      dUdot_mag,Udot_mag,count);
+                              fprintf(E->fp,"Stress dep. visc./plast.: DUdot = %.4e (%.4e) for iteration %d\n",
+                                      dUdot_mag,Udot_mag,count);
 				  fflush(E->fp);
 			  }
 
@@ -248,7 +250,7 @@
 
 			  get_system_viscosity(E,1,E->EVI[E->mesh.levmax],E->VI[E->mesh.levmax]);
 			  construct_stiffness_B_matrix(E);
-			  solve_constrained_flow_iterative_pseudo_surf(E);
+			  solve_constrained_flow_iterative(E);
 
 			  count++;
 

Modified: mc/3D/CitcomS/trunk/lib/Element_calculations.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Element_calculations.c	2009-12-08 17:19:49 UTC (rev 16086)
+++ mc/3D/CitcomS/trunk/lib/Element_calculations.c	2009-12-08 21:43:15 UTC (rev 16087)
@@ -43,11 +43,11 @@
 			      struct CCX *,int ,int ,int );
 void assemble_div_u(struct All_variables *,
                     double **, double **, int );
-void get_elt_tr(struct All_variables *, int , int , double [24], int );
-void get_elt_tr_pseudo_surf(struct All_variables *, int , int , double [24], int );
+static void get_elt_tr(struct All_variables *, int , int , double [24], int );
+static void get_elt_tr_pseudo_surf(struct All_variables *, int , int , double [24], int );
 
 
-void add_force(struct All_variables *E, int e, double elt_f[24], int m)
+static void add_force(struct All_variables *E, int e, double elt_f[24], int m)
 {
   const int dims=E->mesh.nsd;
   const int ends=enodes[E->mesh.nsd];
@@ -82,7 +82,6 @@
 
   void get_buoyancy();
   void get_elt_f();
-  void get_elt_tr();
   void strip_bcs_from_residual();
   double global_vdot();
 
@@ -107,9 +106,12 @@
       e = E->boundary.element[m][i];
 
       for(a=0;a<24;a++) elt_f[a] = 0.0;
-      for(a=SIDE_BEGIN; a<=SIDE_END; a++)
-	get_elt_tr(E, i, a, elt_f, m);
-
+      for(a=SIDE_BEGIN; a<=SIDE_END; a++) {
+          if(E->control.pseudo_free_surf)
+              get_elt_tr_pseudo_surf(E, i, a, elt_f, m);
+          else
+              get_elt_tr(E, i, a, elt_f, m);
+      }
       add_force(E, e, elt_f, m);
     }
   }       /* end for m */
@@ -131,64 +133,6 @@
 }
 
 
-void assemble_forces_pseudo_surf(E,penalty)
-     struct All_variables *E;
-     int penalty;
-{
-  double elt_f[24];
-  int m,a,e,i;
-
-  void get_buoyancy();
-  void get_elt_f();
-  void get_elt_tr_pseudo_surf();
-  void strip_bcs_from_residual();
-  double global_vdot();
-
-  const int neq=E->lmesh.neq;
-  const int nel=E->lmesh.nel;
-  const int lev=E->mesh.levmax;
-
-  get_buoyancy(E,E->buoyancy);
-
-  for(m=1;m<=E->sphere.caps_per_proc;m++)    {
-
-    for(a=0;a<neq;a++)
-      E->F[m][a] = 0.0;
-
-    for (e=1;e<=nel;e++)  {
-      get_elt_f(E,e,elt_f,1,m);
-      add_force(E, e, elt_f, m);
-    }
-
-    /* for traction bc */
-    for(i=1; i<=E->boundary.nel; i++) {
-      e = E->boundary.element[m][i];
-
-      for(a=0;a<24;a++) elt_f[a] = 0.0;
-      for(a=SIDE_BEGIN; a<=SIDE_END; a++)
-	get_elt_tr_pseudo_surf(E, i, a, elt_f, m);
-
-      add_force(E, e, elt_f, m);
-    }
-  }       /* end for m */
-
-  (E->solver.exchange_id_d)(E, E->F, lev);
-  strip_bcs_from_residual(E,E->F,lev);
-
-  /* compute the norm of E->F */
-  E->monitor.fdotf = sqrt(global_vdot(E, E->F, E->F, lev));
-
-  if(E->parallel.me==0) {
-      fprintf(stderr, "Momentum equation force %.9e\n",
-              E->monitor.fdotf);
-      fprintf(E->fp, "Momentum equation force %.9e\n",
-              E->monitor.fdotf);
-  }
-
-  return;
-}
-
-
 /*==============================================================
   Function to supply the element strain-displacement matrix Ba at velocity
   quadrature points, which is used to compute element stiffness matrix
@@ -1061,7 +1005,7 @@
   Function to create the element force vector due to stress b.c.
   ================================================================= */
 
-void get_elt_tr(struct All_variables *E, int bel, int side, double elt_tr[24], int m)
+static void get_elt_tr(struct All_variables *E, int bel, int side, double elt_tr[24], int m)
 {
 
 	const int dims=E->mesh.nsd;
@@ -1144,7 +1088,7 @@
 	}
 }
 
-void get_elt_tr_pseudo_surf(struct All_variables *E, int bel, int side, double elt_tr[24], int m)
+static void get_elt_tr_pseudo_surf(struct All_variables *E, int bel, int side, double elt_tr[24], int m)
 {
 
 	const int dims=E->mesh.nsd;

Modified: mc/3D/CitcomS/trunk/lib/Stokes_flow_Incomp.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Stokes_flow_Incomp.c	2009-12-08 17:19:49 UTC (rev 16086)
+++ mc/3D/CitcomS/trunk/lib/Stokes_flow_Incomp.c	2009-12-08 21:43:15 UTC (rev 16087)
@@ -62,26 +62,6 @@
 
 {
     void v_from_vector();
-    void p_to_nodes();
-
-    int cycles;
-
-    cycles=E->control.p_iterations;
-
-    /* Solve for velocity and pressure, correct for bc's */
-
-    solve_Ahat_p_fhat(E,E->U,E->P,E->F,E->control.accuracy,&cycles);
-
-    v_from_vector(E);
-    p_to_nodes(E,E->P,E->NP,E->mesh.levmax);
-
-    return;
-}
-
-void solve_constrained_flow_iterative_pseudo_surf(E)
-     struct All_variables *E;
-
-{
     void v_from_vector_pseudo_surf();
     void p_to_nodes();
 
@@ -93,7 +73,11 @@
 
     solve_Ahat_p_fhat(E,E->U,E->P,E->F,E->control.accuracy,&cycles);
 
-    v_from_vector_pseudo_surf(E);
+    if(E->control.pseudo_free_surf)
+        v_from_vector_pseudo_surf(E);
+    else
+        v_from_vector(E);
+
     p_to_nodes(E,E->P,E->NP,E->mesh.levmax);
 
     return;

Modified: mc/3D/CitcomS/trunk/module/bindings.c
===================================================================
--- mc/3D/CitcomS/trunk/module/bindings.c	2009-12-08 17:19:49 UTC (rev 16086)
+++ mc/3D/CitcomS/trunk/module/bindings.c	2009-12-08 21:43:15 UTC (rev 16087)
@@ -312,21 +312,6 @@
 
     /* from stokes_solver.h */
 
-    {pyCitcom_assemble_forces__name__,
-     pyCitcom_assemble_forces,
-     METH_VARARGS,
-     pyCitcom_assemble_forces__doc__},
-
-    {pyCitcom_assemble_forces_pseudo_surf__name__,
-     pyCitcom_assemble_forces_pseudo_surf,
-     METH_VARARGS,
-     pyCitcom_assemble_forces_pseudo_surf__doc__},
-
-    {pyCitcom_construct_stiffness_B_matrix__name__,
-     pyCitcom_construct_stiffness_B_matrix,
-     METH_VARARGS,
-     pyCitcom_construct_stiffness_B_matrix__doc__},
-
     {pyCitcom_general_stokes_solver__name__,
      pyCitcom_general_stokes_solver,
      METH_VARARGS,
@@ -337,11 +322,6 @@
      METH_VARARGS,
      pyCitcom_general_stokes_solver_setup__doc__},
 
-    {pyCitcom_get_system_viscosity__name__,
-     pyCitcom_get_system_viscosity,
-     METH_VARARGS,
-     pyCitcom_get_system_viscosity__doc__},
-
     {pyCitcom_set_cg_defaults__name__,
      pyCitcom_set_cg_defaults,
      METH_VARARGS,
@@ -352,16 +332,6 @@
      METH_VARARGS,
      pyCitcom_set_mg_defaults__doc__},
 
-    {pyCitcom_solve_constrained_flow_iterative__name__,
-     pyCitcom_solve_constrained_flow_iterative,
-     METH_VARARGS,
-     pyCitcom_solve_constrained_flow_iterative__doc__},
-
-    {pyCitcom_solve_constrained_flow_iterative_pseudo_surf__name__,
-     pyCitcom_solve_constrained_flow_iterative_pseudo_surf,
-     METH_VARARGS,
-     pyCitcom_solve_constrained_flow_iterative_pseudo_surf__doc__},
-
     /* Sentinel */
     {0, 0, 0, 0}
 };

Modified: mc/3D/CitcomS/trunk/module/stokes_solver.c
===================================================================
--- mc/3D/CitcomS/trunk/module/stokes_solver.c	2009-12-08 17:19:49 UTC (rev 16086)
+++ mc/3D/CitcomS/trunk/module/stokes_solver.c	2009-12-08 21:43:15 UTC (rev 16087)
@@ -35,82 +35,13 @@
 #include "drive_solvers.h"
 
 
-void assemble_forces(struct All_variables*, int);
-void construct_stiffness_B_matrix(struct All_variables*);
 void general_stokes_solver(struct All_variables *);
 void general_stokes_solver_setup(struct All_variables*);
-void get_system_viscosity(struct All_variables*, int, float**, float**);
 void set_cg_defaults(struct All_variables*);
 void set_mg_defaults(struct All_variables*);
 void solve_constrained_flow_iterative(struct All_variables*);
 
-void assemble_forces_pseudo_surf(struct All_variables*, int);
-void general_stokes_solver_pseudo_surf(struct All_variables *);
-void solve_constrained_flow_iterative_pseudo_surf(struct All_variables*);
 
-
-
-char pyCitcom_assemble_forces__doc__[] = "";
-char pyCitcom_assemble_forces__name__[] = "assemble_forces";
-
-PyObject * pyCitcom_assemble_forces(PyObject *self, PyObject *args)
-{
-    PyObject *obj;
-    struct All_variables* E;
-
-    if (!PyArg_ParseTuple(args, "O:assemble_forces", &obj))
-        return NULL;
-
-    E = (struct All_variables*)(PyCObject_AsVoidPtr(obj));
-
-    assemble_forces(E,0);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-
-char pyCitcom_assemble_forces_pseudo_surf__doc__[] = "";
-char pyCitcom_assemble_forces_pseudo_surf__name__[] = "assemble_forces_pseudo_surf";
-
-PyObject * pyCitcom_assemble_forces_pseudo_surf(PyObject *self, PyObject *args)
-{
-    PyObject *obj;
-    struct All_variables* E;
-
-    if (!PyArg_ParseTuple(args, "O:assemble_forces_pseudo_surf", &obj))
-        return NULL;
-
-    E = (struct All_variables*)(PyCObject_AsVoidPtr(obj));
-
-    assemble_forces_pseudo_surf(E,0);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-
-char pyCitcom_construct_stiffness_B_matrix__doc__[] = "";
-char pyCitcom_construct_stiffness_B_matrix__name__[] = "construct_stiffness_B_matrix";
-
-PyObject * pyCitcom_construct_stiffness_B_matrix(PyObject *self, PyObject *args)
-{
-    PyObject *obj;
-    struct All_variables* E;
-
-    if (!PyArg_ParseTuple(args, "O:construct_stiffness_B_matrix", &obj))
-        return NULL;
-
-    E = (struct All_variables*)(PyCObject_AsVoidPtr(obj));
-
-    construct_stiffness_B_matrix(E);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-
-
 char pyCitcom_general_stokes_solver__doc__[] = "";
 char pyCitcom_general_stokes_solver__name__[] = "general_stokes_solver";
 
@@ -160,27 +91,6 @@
 
 
 
-char pyCitcom_get_system_viscosity__doc__[] = "";
-char pyCitcom_get_system_viscosity__name__[] = "get_system_viscosity";
-
-PyObject * pyCitcom_get_system_viscosity(PyObject *self, PyObject *args)
-{
-    PyObject *obj;
-    struct All_variables* E;
-
-    if (!PyArg_ParseTuple(args, "O:get_system_viscosity", &obj))
-        return NULL;
-
-    E = (struct All_variables*)(PyCObject_AsVoidPtr(obj));
-
-    get_system_viscosity(E,1,E->EVI[E->mesh.levmax],E->VI[E->mesh.levmax]);
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
-
-
 char pyCitcom_set_cg_defaults__doc__[] = "";
 char pyCitcom_set_cg_defaults__name__[] = "set_cg_defaults";
 
@@ -222,45 +132,6 @@
 }
 
 
-
-char pyCitcom_solve_constrained_flow_iterative__doc__[] = "";
-char pyCitcom_solve_constrained_flow_iterative__name__[] = "solve_constrained_flow_iterative";
-
-PyObject * pyCitcom_solve_constrained_flow_iterative(PyObject *self, PyObject *args)
-{
-    PyObject *obj;
-    struct All_variables* E;
-
-    if (!PyArg_ParseTuple(args, "O:solve_constrained_flow_iterative", &obj))
-        return NULL;
-
-    E = (struct All_variables*)(PyCObject_AsVoidPtr(obj));
-
-    solve_constrained_flow_iterative(E);
-
-    return Py_BuildValue("d", E->viscosity.sdepv_misfit);
-}
-
-
-char pyCitcom_solve_constrained_flow_iterative_pseudo_surf__doc__[] = "";
-char pyCitcom_solve_constrained_flow_iterative_pseudo_surf__name__[] = "solve_constrained_flow_iterative_pseudo_surf";
-
-PyObject * pyCitcom_solve_constrained_flow_iterative_pseudo_surf(PyObject *self, PyObject *args)
-{
-    PyObject *obj;
-    struct All_variables* E;
-
-    if (!PyArg_ParseTuple(args, "O:solve_constrained_flow_iterative_pseudo_surf", &obj))
-        return NULL;
-
-    E = (struct All_variables*)(PyCObject_AsVoidPtr(obj));
-
-    solve_constrained_flow_iterative_pseudo_surf(E);
-
-    return Py_BuildValue("d", E->viscosity.sdepv_misfit);
-}
-
-
 /* $Id$ */
 
 /* End of file */

Modified: mc/3D/CitcomS/trunk/module/stokes_solver.h
===================================================================
--- mc/3D/CitcomS/trunk/module/stokes_solver.h	2009-12-08 17:19:49 UTC (rev 16086)
+++ mc/3D/CitcomS/trunk/module/stokes_solver.h	2009-12-08 21:43:15 UTC (rev 16087)
@@ -28,21 +28,6 @@
 #if !defined(pyCitcom_stokes_solver_h)
 #define pyCitcom_stokes_solver_h
 
-extern char pyCitcom_assemble_forces__name__[];
-extern char pyCitcom_assemble_forces__doc__[];
-PyObject * pyCitcom_assemble_forces(PyObject *, PyObject *);
-
-
-extern char pyCitcom_assemble_forces_pseudo_surf__name__[];
-extern char pyCitcom_assemble_forces_pseudo_surf__doc__[];
-PyObject * pyCitcom_assemble_forces_pseudo_surf(PyObject *, PyObject *);
-
-
-extern char pyCitcom_construct_stiffness_B_matrix__name__[];
-extern char pyCitcom_construct_stiffness_B_matrix__doc__[];
-PyObject * pyCitcom_construct_stiffness_B_matrix(PyObject *, PyObject *);
-
-
 extern char pyCitcom_general_stokes_solver__name__[];
 extern char pyCitcom_general_stokes_solver__doc__[];
 PyObject * pyCitcom_general_stokes_solver(PyObject *, PyObject *);
@@ -53,11 +38,6 @@
 PyObject * pyCitcom_general_stokes_solver_setup(PyObject *, PyObject *);
 
 
-extern char pyCitcom_get_system_viscosity__name__[];
-extern char pyCitcom_get_system_viscosity__doc__[];
-PyObject * pyCitcom_get_system_viscosity(PyObject *, PyObject *);
-
-
 extern char pyCitcom_set_cg_defaults__name__[];
 extern char pyCitcom_set_cg_defaults__doc__[];
 PyObject * pyCitcom_set_cg_defaults(PyObject *, PyObject *);
@@ -67,16 +47,6 @@
 extern char pyCitcom_set_mg_defaults__doc__[];
 PyObject * pyCitcom_set_mg_defaults(PyObject *, PyObject *);
 
-
-extern char pyCitcom_solve_constrained_flow_iterative__name__[];
-extern char pyCitcom_solve_constrained_flow_iterative__doc__[];
-PyObject * pyCitcom_solve_constrained_flow_iterative(PyObject *, PyObject *);
-
-
-extern char pyCitcom_solve_constrained_flow_iterative_pseudo_surf__name__[];
-extern char pyCitcom_solve_constrained_flow_iterative_pseudo_surf__doc__[];
-PyObject * pyCitcom_solve_constrained_flow_iterative_pseudo_surf(PyObject *, PyObject *);
-
 #endif
 
 /* $Id$ */



More information about the CIG-COMMITS mailing list