Skip to content

Commit

Permalink
Move trivial gravity example to stokesjako.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
jedbrown committed May 1, 2011
1 parent cb21a2c commit 3f4bf85
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/fs/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dohp_link_executable (ellip ellip.c)
dohp_link_executable (bu bu.c)
dohp_link_executable (cunit cunit.c)
dohp_link_executable (elast elast.c elastexact.c)
dohp_link_executable (stokes stokes.c stokesexact.c)
dohp_link_executable (stokes stokes.c stokesjako.c stokesexact.c)

dohp_add_test (fs-mf-projection-v1 1 fs-ex1 -snes_mf -ksp_type minres -const_BDeg 5 -snes_monitor_short -ksp_converged_reason -dfs_ordering_type natural -proj_version 1)
#dohp_add_test (fs-mf-projection-v2 1 fs-ex1 -snes_mf -ksp_type minres -const_BDeg 5 -snes_monitor_short -ksp_converged_reason -dfs_ordering_type natural -proj_version 2)
Expand Down
25 changes: 1 addition & 24 deletions src/fs/tests/stokes.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,6 @@ PetscFList StokesCaseList = 0;

#define StokesCaseType char*

static void StokesCaseSolution_Gravity(StokesCase dUNUSED scase,const dReal dUNUSED x[3],dScalar u[],dScalar du[],dScalar *p,dScalar dp[])
{ /* Defines inhomogeneous Dirichlet boundary conditions */
u[0] = u[1] = u[2] = 0;
for (dInt i=0; i<9; i++) du[i] = 0;
*p = 0;
for (dInt i=0; i<3; i++) dp[i] = 0;
}
static void StokesCaseForcing_Gravity(StokesCase scase,const dReal dUNUSED x[3],dScalar fu[],dScalar *fp)
{
fu[0] = 0;
fu[1] = 0;
fu[2] = scase->gravity;
fp[0] = 0;
}
static dErr StokesCaseCreate_Gravity(StokesCase scase)
{
dFunctionBegin;
scase->reality = dTRUE;
scase->solution = StokesCaseSolution_Gravity;
scase->forcing = StokesCaseForcing_Gravity;
dFunctionReturn(0);
}

dErr StokesCaseRegister(const char *name,StokesCaseCreateFunction screate)
{
dErr err;
Expand Down Expand Up @@ -101,7 +78,7 @@ static dErr StokesCaseRegisterAll(void)

dFunctionBegin;
err = StokesCaseRegisterAll_Exact();dCHK(err);
err = StokesCaseRegister("gravity",StokesCaseCreate_Gravity);dCHK(err);
err = StokesCaseRegisterAll_Jako();dCHK(err);
dFunctionReturn(0);
}

Expand Down
1 change: 1 addition & 0 deletions src/fs/tests/stokesimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ extern PetscFList StokesCaseList;
dErr StokesCaseRegister(const char *name,StokesCaseCreateFunction screate);

dErr StokesCaseRegisterAll_Exact(void); /* Defined in generated stokesexact.c */
dErr StokesCaseRegisterAll_Jako(void); /* Defined in stokesjako.c */

#endif
36 changes: 36 additions & 0 deletions src/fs/tests/stokesjako.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "stokesimpl.h"

// Trivial gravity model
static void StokesCaseSolution_Gravity(StokesCase dUNUSED scase,const dReal dUNUSED x[3],dScalar u[],dScalar du[],dScalar *p,dScalar dp[])
{ /* Defines inhomogeneous Dirichlet boundary conditions */
u[0] = u[1] = u[2] = 0;
for (dInt i=0; i<9; i++) du[i] = 0;
*p = 0;
for (dInt i=0; i<3; i++) dp[i] = 0;
}
static void StokesCaseForcing_Gravity(StokesCase scase,const dReal dUNUSED x[3],dScalar fu[],dScalar *fp)
{
fu[0] = 0;
fu[1] = 0;
fu[2] = scase->gravity;
fp[0] = 0;
}
static dErr StokesCaseCreate_Gravity(StokesCase scase)
{
dFunctionBegin;
scase->reality = dTRUE;
scase->solution = StokesCaseSolution_Gravity;
scase->forcing = StokesCaseForcing_Gravity;
dFunctionReturn(0);
}


dErr StokesCaseRegisterAll_Jako(void)
{
dErr err;

dFunctionBegin;
err = StokesCaseRegisterAll_Exact();dCHK(err);
err = StokesCaseRegister("gravity",StokesCaseCreate_Gravity);dCHK(err);
dFunctionReturn(0);
}

0 comments on commit 3f4bf85

Please sign in to comment.