[cig-commits] r15114 - mc/3D/CitcomS/trunk/module/Exchanger

tan2 at geodynamics.org tan2 at geodynamics.org
Wed Jun 3 14:08:01 PDT 2009


Author: tan2
Date: 2009-06-03 14:08:01 -0700 (Wed, 03 Jun 2009)
New Revision: 15114

Modified:
   mc/3D/CitcomS/trunk/module/Exchanger/BoundarySVTInlet.cc
   mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.cc
   mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.h
Log:
Update SVTInlet to inherit from BaseSVTInlet


Modified: mc/3D/CitcomS/trunk/module/Exchanger/BoundarySVTInlet.cc
===================================================================
--- mc/3D/CitcomS/trunk/module/Exchanger/BoundarySVTInlet.cc	2009-06-03 21:07:04 UTC (rev 15113)
+++ mc/3D/CitcomS/trunk/module/Exchanger/BoundarySVTInlet.cc	2009-06-03 21:08:01 UTC (rev 15114)
@@ -33,9 +33,6 @@
 #include "Boundary.h"
 #include "BoundarySVTInlet.h"
 
-using Exchanger::Array2D;
-using Exchanger::DIM;
-using Exchanger::STRESS_DIM;
 using Exchanger::Sink;
 
 

Modified: mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.cc
===================================================================
--- mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.cc	2009-06-03 21:07:04 UTC (rev 15113)
+++ mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.cc	2009-06-03 21:08:01 UTC (rev 15114)
@@ -34,47 +34,16 @@
 #include "Exchanger/Sink.h"
 #include "SVTInlet.h"
 
-extern "C" {
-
-#include "element_definitions.h"
-
-    void check_bc_consistency(const All_variables *E);
-    void construct_id(const All_variables *E);
-}
-
-using Exchanger::Array2D;
-using Exchanger::DIM;
-using Exchanger::STRESS_DIM;
 using Exchanger::Sink;
 
 
-const unsigned vbcFlag[] = {VBX, VBY, VBZ};
-const unsigned sbcFlag[] = {SBX, SBY, SBZ};
-
-
 SVTInlet::SVTInlet(const Boundary& boundary,
 		   const Sink& sink,
 		   All_variables* e) :
-    Inlet(boundary, sink),
-    E(e),
-    s(sink.size()),
-    s_old(sink.size()),
-    v(sink.size()),
-    v_old(sink.size()),
-    t(sink.size()),
-    t_old(sink.size())
-{
-    journal::debug_t debug("CitcomS-Exchanger");
-    debug << journal::at(__HERE__) << journal::endl;
+    BaseSVTInlet(boundary, sink, e)
+{}
 
-    // set CitcomS boundary flags
-    setVBCFlag();
-    setTBCFlag();
 
-    check_bc_consistency(E);
-}
-
-
 SVTInlet::~SVTInlet()
 {}
 
@@ -105,140 +74,6 @@
 }
 
 
-void SVTInlet::impose()
-{
-    journal::debug_t debug("CitcomS-Exchanger");
-    debug << journal::at(__HERE__) << journal::endl;
-
-    // impose normal velocity and shear stress as BC for momentum eqn.
-    imposeSV();
-
-    // impose temperature BC for energy eqn.
-    imposeT();
-}
-
-
-// private functions
-
-void SVTInlet::setVBCFlag()
-{
-    // BC: normal velocity and shear traction
-
-    const Boundary& boundary = dynamic_cast<const Boundary&>(mesh);
-    const int m = 1;
-
-    for(int i=0; i<boundary.size(); i++) {
-        int n = boundary.nodeID(i);
-	for(int d=0; d<DIM; ++d)
-	    if(boundary.normal(d,i)) {
-		E->node[m][n] = E->node[m][n] | vbcFlag[d];
-		E->node[m][n] = E->node[m][n] & (~sbcFlag[d]);
-	    } else {
-		E->node[m][n] = E->node[m][n] | sbcFlag[d];
-		E->node[m][n] = E->node[m][n] & (~vbcFlag[d]);
-	    }
-    }
-
-    // reconstruct ID array to reflect changes in VBC
-    construct_id(E);
-}
-
-
-void SVTInlet::setTBCFlag()
-{
-    const int m = 1;
-    for(int i=0; i<mesh.size(); i++) {
-	int n = mesh.nodeID(i);
-	E->node[m][n] = E->node[m][n] | TBX;
-	E->node[m][n] = E->node[m][n] | TBY;
-	E->node[m][n] = E->node[m][n] | TBZ;
-	E->node[m][n] = E->node[m][n] & (~FBX);
-	E->node[m][n] = E->node[m][n] & (~FBY);
-	E->node[m][n] = E->node[m][n] & (~FBZ);
-    }
-}
-
-
-void SVTInlet::imposeSV()
-{
-    const int sidelow[3] = {SIDE_NORTH, SIDE_WEST, SIDE_BOTTOM};
-    const int sidehigh[3] = {SIDE_SOUTH, SIDE_EAST, SIDE_TOP};
-
-    const Boundary& boundary = dynamic_cast<const Boundary&>(mesh);
-
-    double N1, N2;
-    getTimeFactors(N1, N2);
-
-    const int m = 1;
-    for(int i=0; i<sink.size(); i++) {
-	int j = sink.meshNode(i);
-	int n = boundary.nodeID(j);
-	int q = E->sbc.node[m][n];
-
-	for(int d=0; d<DIM; d++)
-	    if(E->node[m][n] & vbcFlag[d])
-		E->sphere.cap[m].VB[d+1][n] = N1 * v_old[d][i] + N2 * v[d][i];
-
-	if(E->node[m][n] & (SBX | SBY | SBZ))
-	    for(int d=0; d<DIM; d++) {
-		int p;
-		if(boundary.normal(d,j) == -1)
-		    p = sidelow[d];
-		else if(boundary.normal(d,j) == 1)
-		    p = sidehigh[d];
-		else
-		    continue;
-
-		for(int k=0; k<DIM; k++) {
-		    E->sbc.SB[m][p][k+1][q] =
-			boundary.normal(d,j) *
-			( N1 * side_tractions(s_old, i, d, k) +
-			  N2 * side_tractions(s, i, d, k) );
-		}
-	}
-    }
-}
-
-
-void SVTInlet::imposeT()
-{
-    journal::debug_t debugBC("CitcomS-imposeT");
-    debugBC << journal::at(__HERE__);
-
-    double N1, N2;
-    getTimeFactors(N1, N2);
-
-    const int m = 1;
-    for(int i=0; i<sink.size(); i++) {
-	int j = sink.meshNode(i);
-	int n = mesh.nodeID(j);
-
-	for(int d=0; d<DIM; d++)
-	    E->sphere.cap[m].TB[d+1][n] = N1 * t_old[0][i] + N2 * t[0][i];
-
- 	debugBC << E->sphere.cap[m].TB[1][n] << " "
- 		<< E->sphere.cap[m].TB[2][n] << " "
- 		<< E->sphere.cap[m].TB[3][n] << journal::newline;
-
-    }
-    debugBC << journal::endl;
-
-    (E->temperatures_conform_bcs)(E);
-}
-
-
-double SVTInlet::side_tractions(const Array2D<double,STRESS_DIM>& stress,
-				int node, int normal_dir, int dim) const
-{
-    const int stress_index[3][3] =
-	{ {0, 3, 4},
-	  {3, 1, 5},
-	  {4, 5, 2} };
-
-    return stress[ stress_index[normal_dir][dim] ][node];
-}
-
-
 // version
 // $Id$
 

Modified: mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.h
===================================================================
--- mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.h	2009-06-03 21:07:04 UTC (rev 15113)
+++ mc/3D/CitcomS/trunk/module/Exchanger/SVTInlet.h	2009-06-03 21:08:01 UTC (rev 15114)
@@ -33,22 +33,12 @@
 #if !defined(pyCitcomSExchanger_SVTInlet_h)
 #define pyCitcomSExchanger_SVTInlet_h
 
-#include "Exchanger/Array2D.h"
-#include "Exchanger/DIM.h"
-#include "Exchanger/Inlet.h"
+#include "BaseSVTInlet.h"
 
 struct All_variables;
-class Boundary;
 
 
-class SVTInlet : public Exchanger::Inlet{
-    All_variables* E;
-    Exchanger::Array2D<double,Exchanger::STRESS_DIM> s;
-    Exchanger::Array2D<double,Exchanger::STRESS_DIM> s_old;
-    Exchanger::Array2D<double,Exchanger::DIM> v;
-    Exchanger::Array2D<double,Exchanger::DIM> v_old;
-    Exchanger::Array2D<double,1> t;
-    Exchanger::Array2D<double,1> t_old;
+class SVTInlet : public BaseSVTInlet{
 
 public:
     SVTInlet(const Boundary& boundary,
@@ -58,17 +48,6 @@
     virtual ~SVTInlet();
 
     virtual void recv();
-    virtual void impose();
-
-private:
-    void setVBCFlag();
-    void setTBCFlag();
-
-    void imposeSV();
-    void imposeT();
-
-    double side_tractions(const Exchanger::Array2D<double,Exchanger::STRESS_DIM>& stress,
-			  int node, int normal_dir,  int dim) const;
 };
 
 



More information about the CIG-COMMITS mailing list