Skip to content

Commit

Permalink
Add Laplace equation example
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhinder committed Jan 23, 2012
1 parent d95d5ec commit c56affb
Show file tree
Hide file tree
Showing 14 changed files with 1,477 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Examples/Laplace/configuration.ccl
@@ -0,0 +1,6 @@
# File produced by Kranc

REQUIRES GenericFD
OPTIONAL LoopControl
{
}
40 changes: 40 additions & 0 deletions Examples/Laplace/interface.ccl
@@ -0,0 +1,40 @@
# File produced by Kranc

implements: Laplace

inherits: Grid GenericFD Boundary



USES INCLUDE: GenericFD.h
USES INCLUDE: Symmetry.h
USES INCLUDE: sbp_calc_coeffs.h
USES INCLUDE: Boundary.h
USES INCLUDE: loopcontrol.h

CCTK_INT FUNCTION MoLRegisterEvolved(CCTK_INT IN EvolvedIndex, CCTK_INT IN RHSIndex)
USES FUNCTION MoLRegisterEvolved

SUBROUTINE Diff_coeff(CCTK_POINTER_TO_CONST IN cctkGH, CCTK_INT IN dir, CCTK_INT IN nsize, CCTK_INT OUT ARRAY imin, CCTK_INT OUT ARRAY imax, CCTK_REAL OUT ARRAY q, CCTK_INT IN table_handle)
USES FUNCTION Diff_coeff

CCTK_INT FUNCTION MultiPatch_GetMap(CCTK_POINTER_TO_CONST IN cctkGH)
USES FUNCTION MultiPatch_GetMap

CCTK_INT FUNCTION Boundary_SelectGroupForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN group_name, CCTK_STRING IN bc_name)
USES FUNCTION Boundary_SelectGroupForBC

CCTK_INT FUNCTION Boundary_SelectVarForBC(CCTK_POINTER_TO_CONST IN GH, CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, CCTK_STRING IN var_name, CCTK_STRING IN bc_name)
USES FUNCTION Boundary_SelectVarForBC

public:
CCTK_REAL phi_group type=GF timelevels=3 tags=''
{
phi
} "phi_group"

public:
CCTK_REAL phi_grouprhs type=GF timelevels=3 tags=''
{
phirhs
} "phi_grouprhs"
186 changes: 186 additions & 0 deletions Examples/Laplace/param.ccl
@@ -0,0 +1,186 @@
# File produced by Kranc


shares: GenericFD



shares: MethodOfLines

USES CCTK_INT MoL_Num_Evolved_Vars
USES CCTK_INT MoL_Num_ArrayEvolved_Vars

restricted:
CCTK_INT verbose "verbose" STEERABLE=ALWAYS
{
*:* :: ""
} 0

restricted:
CCTK_REAL Lx "Lx"
{
"*:*" :: ""
} 0

restricted:
CCTK_REAL Ly "Ly"
{
"*:*" :: ""
} 0

restricted:
CCTK_REAL phi0 "phi0"
{
"*:*" :: ""
} 0

restricted:
CCTK_REAL mu "mu"
{
"*:*" :: ""
} 0

restricted:
CCTK_INT fdOrder "fdOrder"
{
*:* :: ""
} 2

restricted:
CCTK_INT Laplace_MaxNumEvolvedVars "Number of evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars STEERABLE=RECOVER
{
1:1 :: "Number of evolved variables used by this thorn"
} 1

restricted:
CCTK_INT Laplace_MaxNumArrayEvolvedVars "Number of Array evolved variables used by this thorn" ACCUMULATOR-BASE=MethodofLines::MoL_Num_ArrayEvolved_Vars STEERABLE=RECOVER
{
0:0 :: "Number of Array evolved variables used by this thorn"
} 0

restricted:
CCTK_INT timelevels "Number of active timelevels" STEERABLE=RECOVER
{
0:3 :: ""
} 3

restricted:
CCTK_INT rhs_timelevels "Number of active RHS timelevels" STEERABLE=RECOVER
{
0:3 :: ""
} 1

restricted:
CCTK_INT other_timelevels "Number of active timelevels for non-evolved grid functions" STEERABLE=RECOVER
{
0:3 :: ""
} 1

restricted:
CCTK_INT Laplace_initial_calc_every "Laplace_initial_calc_every" STEERABLE=ALWAYS
{
*:* :: ""
} 1

restricted:
CCTK_INT Laplace_initial_boundary_calc_every "Laplace_initial_boundary_calc_every" STEERABLE=ALWAYS
{
*:* :: ""
} 1

restricted:
CCTK_INT Laplace_relax_calc_every "Laplace_relax_calc_every" STEERABLE=ALWAYS
{
*:* :: ""
} 1

restricted:
CCTK_INT Laplace_boundary_calc_every "Laplace_boundary_calc_every" STEERABLE=ALWAYS
{
*:* :: ""
} 1

restricted:
CCTK_INT Laplace_initial_calc_offset "Laplace_initial_calc_offset" STEERABLE=ALWAYS
{
*:* :: ""
} 0

restricted:
CCTK_INT Laplace_initial_boundary_calc_offset "Laplace_initial_boundary_calc_offset" STEERABLE=ALWAYS
{
*:* :: ""
} 0

restricted:
CCTK_INT Laplace_relax_calc_offset "Laplace_relax_calc_offset" STEERABLE=ALWAYS
{
*:* :: ""
} 0

restricted:
CCTK_INT Laplace_boundary_calc_offset "Laplace_boundary_calc_offset" STEERABLE=ALWAYS
{
*:* :: ""
} 0

private:
KEYWORD phi_bound "Boundary condition to implement" STEERABLE=ALWAYS
{
"flat" :: "Flat boundary condition"
"none" :: "No boundary condition"
"static" :: "Boundaries held fixed"
"radiative" :: "Radiation boundary condition"
"scalar" :: "Dirichlet boundary condition"
"newrad" :: "Improved radiative boundary condition"
"skip" :: "skip boundary condition code"
} "skip"

private:
KEYWORD phi_group_bound "Boundary condition to implement" STEERABLE=ALWAYS
{
"flat" :: "Flat boundary condition"
"none" :: "No boundary condition"
"static" :: "Boundaries held fixed"
"radiative" :: "Radiation boundary condition"
"scalar" :: "Dirichlet boundary condition"
"newrad" :: "Improved radiative boundary condition"
"skip" :: "skip boundary condition code"
} "none"

private:
CCTK_REAL phi_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS
{
"0:*" :: "outgoing characteristic speed > 0"
} 1.

private:
CCTK_REAL phi_group_bound_speed "characteristic speed at boundary" STEERABLE=ALWAYS
{
"0:*" :: "outgoing characteristic speed > 0"
} 1.

private:
CCTK_REAL phi_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS
{
"*:*" :: "value of limit value is unrestricted"
} 0.

private:
CCTK_REAL phi_group_bound_limit "limit value for r -> infinity" STEERABLE=ALWAYS
{
"*:*" :: "value of limit value is unrestricted"
} 0.

private:
CCTK_REAL phi_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS
{
"*:*" :: "unrestricted"
} 0.

private:
CCTK_REAL phi_group_bound_scalar "Dirichlet boundary value" STEERABLE=ALWAYS
{
"*:*" :: "unrestricted"
} 0.

98 changes: 98 additions & 0 deletions Examples/Laplace/schedule.ccl
@@ -0,0 +1,98 @@
# File produced by Kranc


if (timelevels == 1)
{
STORAGE: phi_group[1]
}
if (timelevels == 2)
{
STORAGE: phi_group[2]
}
if (timelevels == 3)
{
STORAGE: phi_group[3]
}

if (rhs_timelevels == 1)
{
STORAGE: phi_grouprhs[1]
}
if (rhs_timelevels == 2)
{
STORAGE: phi_grouprhs[2]
}
if (rhs_timelevels == 3)
{
STORAGE: phi_grouprhs[3]
}

schedule Laplace_Startup at STARTUP
{
LANG: C
OPTIONS: meta
} "create banner"

schedule Laplace_RegisterVars in MoL_Register
{
LANG: C
OPTIONS: meta
} "Register Variables for MoL"

schedule Laplace_RegisterSymmetries in SymmetryRegister
{
LANG: C
OPTIONS: meta
} "register symmetries"

schedule Laplace_initial AT INITIAL
{
LANG: C
SYNC: phi_group
} "Laplace_initial"

schedule Laplace_initial_boundary AT INITIAL after Laplace_initial
{
LANG: C
SYNC: phi_group
} "Laplace_initial_boundary"

schedule Laplace_relax in MoL_CalcRHS
{
LANG: C
} "Laplace_relax"

schedule Laplace_relax AT ANALYSIS
{
LANG: C
SYNC: phi_grouprhs
} "Laplace_relax"

schedule Laplace_boundary in MoL_RHSBoundaries
{
LANG: C
} "Laplace_boundary"

schedule Laplace_boundary AT ANALYSIS
{
LANG: C
SYNC: phi_grouprhs
} "Laplace_boundary"

schedule Laplace_SelectBoundConds in MoL_PostStep
{
LANG: C
OPTIONS: level
SYNC: phi_group
} "select boundary conditions"

schedule Laplace_CheckBoundaries at BASEGRID
{
LANG: C
OPTIONS: meta
} "check boundaries treatment"

schedule group ApplyBCs as Laplace_ApplyBCs in MoL_PostStep after Laplace_SelectBoundConds
{
# no language specified
} "Apply boundary conditions controlled by thorn Boundary"

0 comments on commit c56affb

Please sign in to comment.