[cig-commits] commit: Modified Params, to allow multiple boundary condition flags
Mercurial
hg at geodynamics.org
Thu May 29 11:26:21 PDT 2008
changeset: 125:52c28b2751ed
user: Marc Spiegelman <mspieg at ldeo.columbia.edu>
date: Sun Mar 16 14:39:01 2008 -0400
files: src/Params.c src/SolitaryWave2DSL.c src/SolitaryWave2DSL.h
description:
Modified Params, to allow multiple boundary condition flags
M src/Params.c
M src/SolitaryWave2DSL.c
M src/SolitaryWave2DSL.h
diff -r 8037b9cbe111 -r 52c28b2751ed src/Params.c
--- a/src/Params.c Thu Jan 17 08:09:35 2008 -0500
+++ b/src/Params.c Sun Mar 16 14:39:01 2008 -0400
@@ -36,26 +36,11 @@ int SetParams(AppCtx *user)
REG_TRUE(bag,&p->inputFromFile,PETSC_FALSE ,"inputFromFile","<DO NOT SET> flag will be true if you specify an input file name");
p->inputFromFile = OptionsHasName("-input_file");
+ ierr = SetDomainAndWaveParams(bag,p); CHKERRQ(ierr);
ierr = SetDAGridParams(bag,grid); CHKERRQ(ierr);
- ierr = SetDomainAndWaveParams(bag,p); CHKERRQ(ierr);
ierr = SetTimeStepParams(bag,p,tsCtx); CHKERRQ(ierr);
PetscFunctionReturn(0);
-}
-
-/*---------------------------------------------------------------------*/
-#undef __FUNCT__
-#define __FUNCT__ "SetDAGridParams"
-int SetDAGridParams(PetscBag bag, GridInfo *grid)
-/*---------------------------------------------------------------------*/
-{
- grid->periodic = DA_XYPERIODIC;
- grid->stencil = DA_STENCIL_STAR; /* stencil for dmmg da */
- grid->stencilC = DA_STENCIL_BOX; /* stencil for characteristic solve */
- grid->dof = 2;
- grid->stencilWidth = 1; /* stencilWidth for dmmg da */
- grid->stencilWidthC= 2; /* stencilWidth for bicubic characteristic solve */
- return 0;
}
/*---------------------------------------------------------------------*/
@@ -69,6 +54,8 @@ int SetDomainAndWaveParams(PetscBag bag,
REG_INTG(bag,&p->nDims,2 ,"nDims","<DO NOT SET> Grid dimensionality");
REG_INTG(bag,&p->niCoarse,5 ,"ni_coarse","number of x points on coarsest level, set with -ni_coarse");
REG_INTG(bag,&p->njCoarse,5 ,"nj_coarse","number of x points on coarsest level, set with -nj_coarse");
+ REG_INTG(bag,&p->xBoundaryFlag,0 ,"xBCFlag","Boundary condition in X, set with -xBCFlag (0: periodic, 1: reflection");
+ REG_INTG(bag,&p->zBoundaryFlag,0 ,"zBCFlag","Boundary condition in z, set with -zBCFlag (0: periodic, 1: phi=1,C=0 top, freeflux bottom");
REG_REAL(bag,&p->width,64.0 ,"width" ,"Width of domain, x-dir, set with -width");
REG_REAL(bag,&p->height,64.0 ,"height","height of domain, z-dir, set with -height");
REG_REAL(bag,&p->nExp,3. ,"nExp","permeability exponent, set with -nExp ");
@@ -84,6 +71,35 @@ int SetDomainAndWaveParams(PetscBag bag,
return 0;
}
+/*---------------------------------------------------------------------*/
+#undef __FUNCT__
+#define __FUNCT__ "SetDAGridParams"
+int SetDAGridParams(PetscBag bag, GridInfo *grid)
+/*---------------------------------------------------------------------*/
+{
+ int ierr;
+ Parameter *p;
+
+
+ ierr = PetscBagGetData(bag,(void**)&p);CHKERRQ(ierr);
+ if ( p->xBoundaryFlag == 0 ) {
+ grid->periodic = DA_XPERIODIC;
+ }
+ if ( p->zBoundaryFlag == 0 ) {
+ grid->periodic = DA_YPERIODIC;
+ }
+ if ( p->xBoundaryFlag ==0 && p->zBoundaryFlag == 0 ) {
+ grid->periodic = DA_XYPERIODIC;
+ }
+ grid->stencil = DA_STENCIL_STAR; /* stencil for dmmg da */
+ grid->stencilC = DA_STENCIL_BOX; /* stencil for characteristic solve */
+ grid->dof = 2;
+ grid->stencilWidth = 1; /* stencilWidth for dmmg da */
+ grid->stencilWidthC= 2; /* stencilWidth for bicubic characteristic solve */
+ return 0;
+}
+
+
/*---------------------------------------------------------------------*/
#undef __FUNCT__
@@ -99,8 +115,6 @@ int SetTimeStepParams(PetscBag bag, Para
REG_REAL(bag,&p->currentTime,0. ,"currentTime","<DO NOT SET> current time for output ");
return 0;
}
-
-
/*---------------------------------------------------------------------*/
diff -r 8037b9cbe111 -r 52c28b2751ed src/SolitaryWave2DSL.c
--- a/src/SolitaryWave2DSL.c Thu Jan 17 08:09:35 2008 -0500
+++ b/src/SolitaryWave2DSL.c Sun Mar 16 14:39:01 2008 -0400
@@ -15,8 +15,15 @@
\phi_t+W0\phi_z =C
- which is uniformly discretized on a standard mesh with doubly periodic boundary conditions.
-
+ which is uniformly discretized on a standard mesh
+ BC's: Extend to allow several options
+ Horizontal BC's: x periodic periodic or reflection -xBoundaries
+ Vertical BC's: z periodic or
+ Top: constant porosity, C = 0
+ Bottom: free flux dP/dz = 0 but allow dP/dx and P to vary
+ output forcing is given by consistent 1-sided derivative
+ of the gravity driven flux at the bottom
+
The initial condition is a 1-D Solitary wave of Amplitude A with
n=3 and position z0 over a background porosity of
1. Alternatively, this program can read the input file in for
@@ -120,7 +127,10 @@ int main(int argc,char **argv)
for (i=0; i< param->mgLevels; i++) {
user[i].bag = userInit.bag;
user[i].grid = userInit.grid;
- user[i].tsCtx = userInit.tsCtx;
+ if ( i > 0 ) {
+ user[i].grid.dx = 2*user[i-1].grid.dx;
+ user[i].grid.dz = 2*user[i-1].grid.dz;
+ }
dmmg[i]->user = &user[i];
}
diff -r 8037b9cbe111 -r 52c28b2751ed src/SolitaryWave2DSL.h
--- a/src/SolitaryWave2DSL.h Thu Jan 17 08:09:35 2008 -0500
+++ b/src/SolitaryWave2DSL.h Sun Mar 16 14:39:01 2008 -0400
@@ -51,6 +51,8 @@ typedef struct {
PetscReal width, height; /* width and height of box in compaction lengths */
PetscTruth useFieldSplitPC; /* Boolean to initialize fieldsplitPC...or not */
PetscTruth useApproxJacobian; /* Boolean to toggle full or approximate Jacobian */
+ /* Boundary Condtion Flags */
+ int xBoundaryFlag, zBoundaryFlag;
/* initial solitary wave parameters */
PetscReal nExp; /* permeability exponent, number of grid points per compaction length */
PetscReal amp, z0; /* initial amplitude and position of solitary wave */
More information about the cig-commits
mailing list