[cig-commits] r16403 - mc/3D/CitcomS/trunk/lib

becker at geodynamics.org becker at geodynamics.org
Wed Mar 10 11:55:02 PST 2010


Author: becker
Date: 2010-03-10 11:55:02 -0800 (Wed, 10 Mar 2010)
New Revision: 16403

Modified:
   mc/3D/CitcomS/trunk/lib/BC_util.c
   mc/3D/CitcomS/trunk/lib/Ggrd_handling.c
   mc/3D/CitcomS/trunk/lib/Topo_gravity.c
Log:
This logic should make more sense for internal BCs, but still testing. 



Modified: mc/3D/CitcomS/trunk/lib/BC_util.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/BC_util.c	2010-03-10 19:38:15 UTC (rev 16402)
+++ mc/3D/CitcomS/trunk/lib/BC_util.c	2010-03-10 19:55:02 UTC (rev 16403)
@@ -319,27 +319,17 @@
 	/* we're looping through all nodes for the possibility that
 	   there are several internal processors which need BCs */
 	k = noz + E->mesh.toplayerbc;
-	if(k < 1)myerror(E,"out of bounds for noz and toplayerbc");
-	onbottom = ((k==1) && (E->parallel.me_loc[3]==0))?(1):(0);
-	if(!onbottom)
-	  ncount++;		/* not in top or bottom */
+	if(k <= 1)myerror(E,"out of bounds for noz and toplayerbc");
+	ncount++;		/* not in top or bottom */
 	if(E->mesh.topvbc != 1) {	/* free slip */
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,1,0.0,VBX,0,lv,j);
-	  if(onbottom)
-	    internal_horizontal_bc(E,E->sphere.cap[j].VB,k,3,0.0,VBZ,1,lv,j);
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,2,0.0,VBY,0,lv,j);
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,1,E->control.VBXtopval,SBX,1,lv,j);
-	  if(onbottom)
-	    internal_horizontal_bc(E,E->sphere.cap[j].VB,k,3,0.0,SBZ,0,lv,j);
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,2,E->control.VBYtopval,SBY,1,lv,j);
 	}else{		/* no slip */
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,1,E->control.VBXtopval,VBX,1,lv,j);
-	  if(onbottom)
-	    internal_horizontal_bc(E,E->sphere.cap[j].VB,k,3,0.0,VBZ,1,lv,j);
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,2,E->control.VBYtopval,VBY,1,lv,j);
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,1,0.0,                 SBX,0,lv,j);
-	  if(onbottom)
-	    internal_horizontal_bc(E,E->sphere.cap[j].VB,k,3,0.0,SBZ,0,lv,j);
 	  internal_horizontal_bc(E,E->sphere.cap[j].VB,k,2,0.0,                 SBY,0,lv,j);
 	}
       }

Modified: mc/3D/CitcomS/trunk/lib/Ggrd_handling.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Ggrd_handling.c	2010-03-10 19:38:15 UTC (rev 16402)
+++ mc/3D/CitcomS/trunk/lib/Ggrd_handling.c	2010-03-10 19:55:02 UTC (rev 16403)
@@ -683,7 +683,7 @@
 void ggrd_read_vtop_from_file(struct All_variables *E, int is_global)
 {
   MPI_Status mpi_stat;
-  int mpi_rc,interpolate,timedep,use_codes,code,assign,ontop,kinc;
+  int mpi_rc,interpolate,timedep,use_codes,code,assign,ontop;
   int mpi_inmsg, mpi_success_message = 1;
   int m,el,i,k,i1,i2,ind,nodel,j,level, verbose;
   int nox,noz,noy,noxl,noyl,nozl,lselect,idim,noxnoz,noxlnozl,save_codes,topnode,botnode;
@@ -949,24 +949,23 @@
 		}else{
 		  assign = TRUE;topnode = nozl;botnode = k+1;
 		}
-		kinc = 1;
 	      }else{
 		/* only one internal node */
-		assign = TRUE;
-		topnode = nozl;
+
 		if(level == E->mesh.gridmax){
+		  assign = TRUE;
 		  botnode = nozl +  E->mesh.toplayerbc;
-		  kinc = topnode - botnode;
+		  topnode = botnode;
 		}else{
 		  if(E->parallel.me == 0)
 		    fprintf(stderr,"WARNING: assigning single layer internal boundary condition only to top level multigrid\n");
-		  botnode = nozl;kinc = 1;
+		  assign = FALSE;
+		  botnode = topnode = nozl;
 		}
 	      }
 	    }else{		/* just top node */
 	      assign = TRUE;
 	      topnode = botnode = nozl;
-	      kinc = 1;
 	    }
 	    if(verbose)
 	      fprintf(stderr,"ggrd_read_vtop_from_file: mixed: internal: %i assign: %i k: %i to %i (%i)\n",
@@ -1027,7 +1026,7 @@
 		  
 		  */
 		  
-		  for(k = botnode;k <= topnode;k += kinc){
+		  for(k = botnode;k <= topnode;k++){
 		    ontop = ((k==nozl) && (E->parallel.me_loc[3]==E->parallel.nprocz-1))?(TRUE):(FALSE);
 		    /* depth loop */
 		    nodel =  k + (j-1) * nozl + (i-1)*noxlnozl; /* top node =  nozl + (j-1) * nozl + (i-1)*noxlnozl; */
@@ -1173,7 +1172,7 @@
 	      XXX
 	      
 	      */
-	      for(k = botnode;k <= topnode;k += kinc){
+	      for(k = botnode;k <= topnode;k++){
 		ontop = ((k==noz) && (E->parallel.me_loc[3]==E->parallel.nprocz-1))?(TRUE):(FALSE);
 		nodel = k + (j-1) * noz + (i-1)*noxnoz ; /*  node =  k + (j-1) * nozg + (i-1)*noxgnozg; */	
 		if(use_codes){

Modified: mc/3D/CitcomS/trunk/lib/Topo_gravity.c
===================================================================
--- mc/3D/CitcomS/trunk/lib/Topo_gravity.c	2010-03-10 19:38:15 UTC (rev 16402)
+++ mc/3D/CitcomS/trunk/lib/Topo_gravity.c	2010-03-10 19:55:02 UTC (rev 16403)
@@ -495,8 +495,8 @@
        no side boundary conditions
 
     */
-    if(E->mesh.toplayerbc > 0){
-      /* internal BCs for top toplayerbc layers */
+    if(E->mesh.toplayerbc != 0){
+      /* internal BCs are allowed */
       for(m=1; m<=E->sphere.caps_per_proc; m++)
 	for(i=1; i<=E->lmesh.noy; i++)
 	  for(j=1; j<=E->lmesh.nox; j++)
@@ -505,24 +505,9 @@
 	      for(d=1; d<=E->mesh.nsd; d++)
 		if(E->node[m][n] & sbc_flag[d]) {
 		  /* apply internal traction vector on horizontal surface */
-		  if(layers(E,m,n) <= E->mesh.toplayerbc)
-		    E->gstress[m][(n-1)*6+stress_index[d][3]] = E->sphere.cap[m].VB[d][n];
+		  E->gstress[m][(n-1)*6+stress_index[d][3]] = E->sphere.cap[m].VB[d][n];
 		}
 	    }
-
-    }else if(E->mesh.toplayerbc < 0){ 
-      /* internal BCs for a single node layer noz+toplayerbc down */
-      for(m=1; m<=E->sphere.caps_per_proc; m++)
-	for(i=1; i<=E->lmesh.noy; i++)
-	  for(j=1; j<=E->lmesh.nox; j++){
-	    k = E->lmesh.noz + E->mesh.toplayerbc;
-	    n = k+(j-1)*E->lmesh.noz+(i-1)*noxnoz;
-	    for(d=1; d<=E->mesh.nsd; d++)
-	      if(E->node[m][n] & sbc_flag[d]) {
-		/* apply internal traction vector on horizontal surface */
-		E->gstress[m][(n-1)*6+stress_index[d][3]] = E->sphere.cap[m].VB[d][n];
-	      }
-	  }
     }else{
       /* default */
       for(m=1; m<=E->sphere.caps_per_proc; m++)



More information about the CIG-COMMITS mailing list