Dataset Viewer
Auto-converted to Parquet Duplicate
thorn_name
stringclasses
66 values
url
stringclasses
12 values
configuration
stringclasses
40 values
interface
stringclasses
66 values
param
stringclasses
66 values
schedule
stringclasses
66 values
src_filename
stringlengths
5
52
src_code
stringlengths
0
349k
context_filenames
stringlengths
8
3.24k
context
stringlengths
118
2M
doc_tex_content
stringclasses
40 values
doc_tex_filenames
stringclasses
5 values
readme_content
stringclasses
58 values
readme_filename
stringclasses
2 values
combined_doc_context
stringclasses
58 values
CactusExamples/Poisson
https://bitbucket.org/cactuscode/cactusexamples.git
# Configuration definition for thorn Poisson REQUIRES Boundary Carpet CartGrid3D TATelliptic
# Interface definition for thorn Poisson IMPLEMENTS: Poisson INHERITS: boundary grid USES INCLUDE HEADER: carpet.h USES INCLUDE HEADER: TATelliptic.h CCTK_INT FUNCTION Boundary_SelectGroupForBC \ (CCTK_POINTER_TO_CONST IN cctkGH, \ CCTK_INT IN faces, \ CCTK_INT IN boundary_width, \ CCTK_INT IN table_handle, \ CCTK_STRING IN group_name, \ CCTK_STRING IN bc_name) REQUIRES FUNCTION Boundary_SelectGroupForBC CCTK_REAL potential TYPE=gf { phi } "Potential for elliptic equation" CCTK_REAL residual TYPE=gf { res } "Residual for elliptic equation"
# Parameter definitions for thorn Poisson STRING solver "Name of TATelliptic solver that should be used" { .* :: "must be an activated TATelliptic solver" } "TATJacobi" STRING options "Options for the solver" { .* :: "no restriction" } "" REAL radius "Radius of uniformly charged sphere" { 0:* :: "" } 1.0 REAL charge "Charge of uniformly charged sphere" { *:* :: "" } 1.0
# Schedule definitions for thorn Poisson STORAGE: potential residual SCHEDULE Poisson_prepare AT initial { LANG: C } "Set up initial guess for initial data" SCHEDULE Poisson_solve AT postinitial { LANG: C # OPTIONS: global } "Calculate uniform charge initial data" SCHEDULE GROUP Poisson_boundaries { } "Apply boundary conditions to initial data" SCHEDULE Poisson_boundaries_select IN Poisson_boundaries { LANG: C OPTIONS: level SYNC: potential } "Select boundary conditions for initial data" SCHEDULE GROUP ApplyBCs AS Poisson_boundaries_apply IN Poisson_boundaries AFTER Poisson_boundaries_select { } "Apply boundary conditions to initial data"
uniform_charge.c
#include <assert.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <cctk.h> #include <cctk_Arguments.h> #include <cctk_Parameters.h> #include <util_ErrorCodes.h> #include <util_Table.h> #include <carpet.h> #include <TATelliptic.h> static int calc_residual (const cGH * const cctkGH, int const options_table, void * const userdata); static int apply_bounds (const cGH * const cctkGH, int const options_table, void * const userdata); static void apply_bounds_level (CCTK_ARGUMENTS); void Poisson_prepare (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; /* Initial data for the solver */ #pragma omp parallel for collapse(3) for (int k=0; k<cctk_lsh[2]; ++k) { for (int j=0; j<cctk_lsh[1]; ++j) { for (int i=0; i<cctk_lsh[0]; ++i) { int ipos = CCTK_GFINDEX3D(cctkGH,i,j,k); phi[ipos] = 0; } } } } void Poisson_solve (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Grid variables for the solver */ #define NVAR 1 /* number of equations to solve */ int var_ind[NVAR]; /* index of variable */ int res_ind[NVAR]; /* index of residual */ var_ind[0] = CCTK_VarIndex ("Poisson::phi"); res_ind[0] = CCTK_VarIndex ("Poisson::res"); /* Options for the solver */ int options_table = Util_TableCreateFromString (options); assert (options_table>=0); /* Call solver */ ierr = TATelliptic_CallSolver (cctkGH, var_ind, res_ind, NVAR, options_table, calc_residual, apply_bounds, 0, solver); if (ierr!=0) { CCTK_WARN (CCTK_WARN_ALERT, "Failed to solve elliptic equation"); } ierr = Util_TableDestroy (options_table); assert (!ierr); } /* Caculate the residual */ int calc_residual (const cGH * const cctkGH, int const options_table, void * const userdata) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; /* charge density */ CCTK_REAL rho = charge / (4.0/3.0 * M_PI * pow(radius,3)); /* offsets for 3D array layout */ int di = CCTK_GFINDEX3D(cctkGH,1,0,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); int dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); int dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); CCTK_REAL idx2[3]; /* inverse squared grid spacing */ for (int d=0; d<3; ++d) { idx2[d] = 1.0 / pow(CCTK_DELTA_SPACE(d), 2); } for (int d=0; d<3; ++d) { assert (cctk_nghostzones[d] >= 1); } /* Initialize residual to zero: We only do this to ensure the boundaries of the residual are defined, and are not nan. That in turn is only needed to make output look nicer. */ #pragma omp parallel for collapse(3) for (int k=0; k<cctk_lsh[2]; ++k) { for (int j=0; j<cctk_lsh[1]; ++j) { for (int i=0; i<cctk_lsh[0]; ++i) { int ipos = CCTK_GFINDEX3D(cctkGH,i,j,k); res[ipos] = 0.0; } } } /* Calculate residual: res = Laplace phi + 4 pi rho */ #pragma omp parallel for collapse(3) for (int k=cctk_nghostzones[2]; k<cctk_lsh[2]-cctk_nghostzones[2]; ++k) { for (int j=cctk_nghostzones[1]; j<cctk_lsh[1]-cctk_nghostzones[1]; ++j) { for (int i=cctk_nghostzones[0]; i<cctk_lsh[0]-cctk_nghostzones[0]; ++i) { int ipos = CCTK_GFINDEX3D(cctkGH,i,j,k); res[ipos] = + (phi[ipos-di] - 2*phi[ipos] + phi[ipos+di]) * idx2[0] + (phi[ipos-dj] - 2*phi[ipos] + phi[ipos+dj]) * idx2[1] + (phi[ipos-dk] - 2*phi[ipos] + phi[ipos+dk]) * idx2[2] + (r[ipos]<radius ? 4 * M_PI * rho : 0); } } } /* Success */ return 0; } /* Apply the boundary conditions to the solution */ int apply_bounds (const cGH * const cctkGH, int const options_table, void * const userdata) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Switch to level mode */ ierr = CallLevelFunction ((cGH *)cctkGH, apply_bounds_level); assert (!ierr); /* Success */ return 0; } void apply_bounds_level (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Call boundary condition schedule group */ ierr = CallScheduleGroup (cctkGH, "Poisson_boundaries"); assert (!ierr); } void Poisson_boundaries_select (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Select Direchlet boundary conditions */ ierr = Boundary_SelectGroupForBC (cctkGH, CCTK_ALL_FACES, 1, -1, "Poisson::potential", "scalar"); assert (!ierr); }
make.code.defn
make.code.defn: ``` # Main make.code.defn file for thorn Poisson # Source files in this directory SRCS = uniform_charge.c # Subdirectories containing source files SUBDIRS = ```
=== documentation.tex === % *======================================================================* % Cactus Thorn template for ThornGuide documentation % Author: Ian Kelley % Date: Sun Jun 02, 2002 % $Header$ % % Thorn documentation in the latex file doc/documentation.tex % will be included in ThornGuides built with the Cactus make system. % The scripts employed by the make system automatically include % pages about variables, parameters and scheduling parsed from the % relevant thorn CCL files. % % This template contains guidelines which help to assure that your % documentation will be correctly added to ThornGuides. More % information is available in the Cactus UsersGuide. % % Guidelines: % - Do not change anything before the line % % START CACTUS THORNGUIDE", % except for filling in the title, author, date, etc. fields. % - Each of these fields should only be on ONE line. % - Author names should be separated with a \\ or a comma. % - You can define your own macros, but they must appear after % the START CACTUS THORNGUIDE line, and must not redefine standard % latex commands. % - To avoid name clashes with other thorns, 'labels', 'citations', % 'references', and 'image' names should conform to the following % convention: % ARRANGEMENT_THORN_LABEL % For example, an image wave.eps in the arrangement CactusWave and % thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps % - Graphics should only be included using the graphicx package. % More specifically, with the "\includegraphics" command. Do % not specify any graphic file extensions in your .tex file. This % will allow us to create a PDF version of the ThornGuide % via pdflatex. % - References should be included with the latex "\bibitem" command. % - Use \begin{abstract}...\end{abstract} instead of \abstract{...} % - Do not use \appendix, instead include any appendices you need as % standard sections. % - For the benefit of our Perl scripts, and for future extensions, % please use simple latex. % % *======================================================================* % % Example of including a graphic image: % \begin{figure}[ht] % \begin{center} % \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure} % \end{center} % \caption{Illustration of this and that} % \label{MyArrangement_MyThorn_MyLabel} % \end{figure} % % Example of using a label: % \label{MyArrangement_MyThorn_MyLabel} % % Example of a citation: % \cite{MyArrangement_MyThorn_Author99} % % Example of including a reference % \bibitem{MyArrangement_MyThorn_Author99} % {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999), % 1--16. {\tt http://www.nowhere.com/}} % % *======================================================================* % If you are using CVS use this line to give version information % $Header$ \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} % The author of the documentation \author{Erik Schnetter \textless schnetter@gmail.com\textgreater} % The title of the document (not necessarily the name of the Thorn) \title{Poisson} % the date your document was last changed, if your document is in CVS, % please use: % \date{$ $Date$ $} \date{November 25, 2014} \maketitle % Do not delete next line % START CACTUS THORNGUIDE % Add all definitions used in this documentation here % \def\mydef etc % Add an abstract for this thorn's documentation \begin{abstract} This is an example thorn describing how to use the TATPETSc interface to PETSc. It solves the Poisson equation for a spherical charge distribution on a uniform grid. \end{abstract} % The following sections are suggestive only. % Remove them or add your own. \section{Introduction} PETSc is a well-known library for solving elliptic equations. TATPETSc is a Cactus thorn that provides a wrapper for calling PETSc to solve elliptic equations on uniform grids. (TATPETSc currently supports neither mesh refinement nor multi-block systems.) TATPETSc can solve both linear and non-linear systems. \section{Physical System} Here we solve the Poisson equation \begin{eqnarray} \Delta\Phi(x) &=& \rho(x) \end{eqnarray} where the right hand side $\rho$ is given by \begin{eqnarray} \rho(r) & = & \left\{ \begin{array}{ll} Q/V & r\le R \\ 0 & r>R \end{array} \right. \end{eqnarray} for the charge $Q$ and the radius $R$, with $V=4\pi R^3/3$. We use Dirichlet boundary conditions $\Phi(x)=0$. \section{Numerical Implementation} PETSc supports a large number of options to choose solvers. Here we use PETSc's default settings. \section{Using This Thorn} In the example parameter file, we set the parameter \texttt{TATPETSc::options} to select the following PETSc options: \begin{itemize} \item \verb+-snes_atol 1e-8+: set absolute tolerance for residual \item \verb+-snes_stol 1e-8+: set relative tolerance for residual \item \verb+-snes_monitor+: output progress information at each iteration of the non-linear solver \item \verb+-ksp_monitor+: output progress information at each iteration of the linear (Krylov subspace) solver \end{itemize} \subsection{Examples} The solution (the potential $\Phi(x)$) is stored in the grid function \texttt{potential}, the residual (a measure for the error) in the grid function \texttt{residual}. % Do not delete next line % END CACTUS THORNGUIDE \end{document}
documentation.tex
Cactus Code Thorn Poisson Author(s) : Erik Schnetter <schnetter@gmail.com> Maintainer(s): Erik Schnetter <schnetter@gmail.com> Licence : GPL -------------------------------------------------------------------------- 1. Purpose Solve the Poisson equation with the TATelliptic framework.
README
## README (README): ``` Cactus Code Thorn Poisson Author(s) : Erik Schnetter <schnetter@gmail.com> Maintainer(s): Erik Schnetter <schnetter@gmail.com> Licence : GPL -------------------------------------------------------------------------- 1. Purpose Solve the Poisson equation with the TATelliptic framework. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === % *======================================================================* % Cactus Thorn template for ThornGuide documentation % Author: Ian Kelley % Date: Sun Jun 02, 2002 % $Header$ % % Thorn documentation in the latex file doc/documentation.tex % will be included in ThornGuides built with the Cactus make system. % The scripts employed by the make system automatically include % pages about variables, parameters and scheduling parsed from the % relevant thorn CCL files. % % This template contains guidelines which help to assure that your % documentation will be correctly added to ThornGuides. More % information is available in the Cactus UsersGuide. % % Guidelines: % - Do not change anything before the line % % START CACTUS THORNGUIDE", % except for filling in the title, author, date, etc. fields. % - Each of these fields should only be on ONE line. % - Author names should be separated with a \\ or a comma. % - You can define your own macros, but they must appear after % the START CACTUS THORNGUIDE line, and must not redefine standard % latex commands. % - To avoid name clashes with other thorns, 'labels', 'citations', % 'references', and 'image' names should conform to the following % convention: % ARRANGEMENT_THORN_LABEL % For example, an image wave.eps in the arrangement CactusWave and % thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps % - Graphics should only be included using the graphicx package. % More specifically, with the "\includegraphics" command. Do % not specify any graphic file extensions in your .tex file. This % will allow us to create a PDF version of the ThornGuide % via pdflatex. % - References should be included with the latex "\bibitem" command. % - Use \begin{abstract}...\end{abstract} instead of \abstract{...} % - Do not use \appendix, instead include any appendices you need as % standard sections. % - For the benefit of our Perl scripts, and for future extensions, % please use simple latex. % % *======================================================================* % % Example of including a graphic image: % \begin{figure}[ht] % \begin{center} % \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure} % \end{center} % \caption{Illustration of this and that} % \label{MyArrangement_MyThorn_MyLabel} % \end{figure} % % Example of using a label: % \label{MyArrangement_MyThorn_MyLabel} % % Example of a citation: % \cite{MyArrangement_MyThorn_Author99} % % Example of including a reference % \bibitem{MyArrangement_MyThorn_Author99} % {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999), % 1--16. {\tt http://www.nowhere.com/}} % % *======================================================================* % If you are using CVS use this line to give version information % $Header$ \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} % The author of the documentation \author{Erik Schnetter \textless schnetter@gmail.com\textgreater} % The title of the document (not necessarily the name of the Thorn) \title{Poisson} % the date your document was last changed, if your document is in CVS, % please use: % \date{$ $Date$ $} \date{November 25, 2014} \maketitle % Do not delete next line % START CACTUS THORNGUIDE % Add all definitions used in this documentation here % \def\mydef etc % Add an abstract for this thorn's documentation \begin{abstract} This is an example thorn describing how to use the TATPETSc interface to PETSc. It solves the Poisson equation for a spherical charge distribution on a uniform grid. \end{abstract} % The following sections are suggestive only. % Remove them or add your own. \section{Introduction} PETSc is a well-known library for solving elliptic equations. TATPETSc is a Cactus thorn that provides a wrapper for calling PETSc to solve elliptic equations on uniform grids. (TATPETSc currently supports neither mesh refinement nor multi-block systems.) TATPETSc can solve both linear and non-linear systems. \section{Physical System} Here we solve the Poisson equation \begin{eqnarray} \Delta\Phi(x) &=& \rho(x) \end{eqnarray} where the right hand side $\rho$ is given by \begin{eqnarray} \rho(r) & = & \left\{ \begin{array}{ll} Q/V & r\le R \\ 0 & r>R \end{array} \right. \end{eqnarray} for the charge $Q$ and the radius $R$, with $V=4\pi R^3/3$. We use Dirichlet boundary conditions $\Phi(x)=0$. \section{Numerical Implementation} PETSc supports a large number of options to choose solvers. Here we use PETSc's default settings. \section{Using This Thorn} In the example parameter file, we set the parameter \texttt{TATPETSc::options} to select the following PETSc options: \begin{itemize} \item \verb+-snes_atol 1e-8+: set absolute tolerance for residual \item \verb+-snes_stol 1e-8+: set relative tolerance for residual \item \verb+-snes_monitor+: output progress information at each iteration of the non-linear solver \item \verb+-ksp_monitor+: output progress information at each iteration of the linear (Krylov subspace) solver \end{itemize} \subsection{Examples} The solution (the potential $\Phi(x)$) is stored in the grid function \texttt{potential}, the residual (a measure for the error) in the grid function \texttt{residual}. % Do not delete next line % END CACTUS THORNGUIDE \end{document} ```
CactusExamples/Poisson
https://bitbucket.org/cactuscode/cactusexamples.git
# Configuration definition for thorn Poisson REQUIRES Boundary Carpet CartGrid3D TATelliptic
# Interface definition for thorn Poisson IMPLEMENTS: Poisson INHERITS: boundary grid USES INCLUDE HEADER: carpet.h USES INCLUDE HEADER: TATelliptic.h CCTK_INT FUNCTION Boundary_SelectGroupForBC \ (CCTK_POINTER_TO_CONST IN cctkGH, \ CCTK_INT IN faces, \ CCTK_INT IN boundary_width, \ CCTK_INT IN table_handle, \ CCTK_STRING IN group_name, \ CCTK_STRING IN bc_name) REQUIRES FUNCTION Boundary_SelectGroupForBC CCTK_REAL potential TYPE=gf { phi } "Potential for elliptic equation" CCTK_REAL residual TYPE=gf { res } "Residual for elliptic equation"
# Parameter definitions for thorn Poisson STRING solver "Name of TATelliptic solver that should be used" { .* :: "must be an activated TATelliptic solver" } "TATJacobi" STRING options "Options for the solver" { .* :: "no restriction" } "" REAL radius "Radius of uniformly charged sphere" { 0:* :: "" } 1.0 REAL charge "Charge of uniformly charged sphere" { *:* :: "" } 1.0
# Schedule definitions for thorn Poisson STORAGE: potential residual SCHEDULE Poisson_prepare AT initial { LANG: C } "Set up initial guess for initial data" SCHEDULE Poisson_solve AT postinitial { LANG: C # OPTIONS: global } "Calculate uniform charge initial data" SCHEDULE GROUP Poisson_boundaries { } "Apply boundary conditions to initial data" SCHEDULE Poisson_boundaries_select IN Poisson_boundaries { LANG: C OPTIONS: level SYNC: potential } "Select boundary conditions for initial data" SCHEDULE GROUP ApplyBCs AS Poisson_boundaries_apply IN Poisson_boundaries AFTER Poisson_boundaries_select { } "Apply boundary conditions to initial data"
make.code.defn
# Main make.code.defn file for thorn Poisson # Source files in this directory SRCS = uniform_charge.c # Subdirectories containing source files SUBDIRS =
uniform_charge.c
uniform_charge.c: ``` #include <assert.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <cctk.h> #include <cctk_Arguments.h> #include <cctk_Parameters.h> #include <util_ErrorCodes.h> #include <util_Table.h> #include <carpet.h> #include <TATelliptic.h> static int calc_residual (const cGH * const cctkGH, int const options_table, void * const userdata); static int apply_bounds (const cGH * const cctkGH, int const options_table, void * const userdata); static void apply_bounds_level (CCTK_ARGUMENTS); void Poisson_prepare (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; /* Initial data for the solver */ #pragma omp parallel for collapse(3) for (int k=0; k<cctk_lsh[2]; ++k) { for (int j=0; j<cctk_lsh[1]; ++j) { for (int i=0; i<cctk_lsh[0]; ++i) { int ipos = CCTK_GFINDEX3D(cctkGH,i,j,k); phi[ipos] = 0; } } } } void Poisson_solve (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Grid variables for the solver */ #define NVAR 1 /* number of equations to solve */ int var_ind[NVAR]; /* index of variable */ int res_ind[NVAR]; /* index of residual */ var_ind[0] = CCTK_VarIndex ("Poisson::phi"); res_ind[0] = CCTK_VarIndex ("Poisson::res"); /* Options for the solver */ int options_table = Util_TableCreateFromString (options); assert (options_table>=0); /* Call solver */ ierr = TATelliptic_CallSolver (cctkGH, var_ind, res_ind, NVAR, options_table, calc_residual, apply_bounds, 0, solver); if (ierr!=0) { CCTK_WARN (CCTK_WARN_ALERT, "Failed to solve elliptic equation"); } ierr = Util_TableDestroy (options_table); assert (!ierr); } /* Caculate the residual */ int calc_residual (const cGH * const cctkGH, int const options_table, void * const userdata) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; /* charge density */ CCTK_REAL rho = charge / (4.0/3.0 * M_PI * pow(radius,3)); /* offsets for 3D array layout */ int di = CCTK_GFINDEX3D(cctkGH,1,0,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); int dj = CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0); int dk = CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0); CCTK_REAL idx2[3]; /* inverse squared grid spacing */ for (int d=0; d<3; ++d) { idx2[d] = 1.0 / pow(CCTK_DELTA_SPACE(d), 2); } for (int d=0; d<3; ++d) { assert (cctk_nghostzones[d] >= 1); } /* Initialize residual to zero: We only do this to ensure the boundaries of the residual are defined, and are not nan. That in turn is only needed to make output look nicer. */ #pragma omp parallel for collapse(3) for (int k=0; k<cctk_lsh[2]; ++k) { for (int j=0; j<cctk_lsh[1]; ++j) { for (int i=0; i<cctk_lsh[0]; ++i) { int ipos = CCTK_GFINDEX3D(cctkGH,i,j,k); res[ipos] = 0.0; } } } /* Calculate residual: res = Laplace phi + 4 pi rho */ #pragma omp parallel for collapse(3) for (int k=cctk_nghostzones[2]; k<cctk_lsh[2]-cctk_nghostzones[2]; ++k) { for (int j=cctk_nghostzones[1]; j<cctk_lsh[1]-cctk_nghostzones[1]; ++j) { for (int i=cctk_nghostzones[0]; i<cctk_lsh[0]-cctk_nghostzones[0]; ++i) { int ipos = CCTK_GFINDEX3D(cctkGH,i,j,k); res[ipos] = + (phi[ipos-di] - 2*phi[ipos] + phi[ipos+di]) * idx2[0] + (phi[ipos-dj] - 2*phi[ipos] + phi[ipos+dj]) * idx2[1] + (phi[ipos-dk] - 2*phi[ipos] + phi[ipos+dk]) * idx2[2] + (r[ipos]<radius ? 4 * M_PI * rho : 0); } } } /* Success */ return 0; } /* Apply the boundary conditions to the solution */ int apply_bounds (const cGH * const cctkGH, int const options_table, void * const userdata) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Switch to level mode */ ierr = CallLevelFunction ((cGH *)cctkGH, apply_bounds_level); assert (!ierr); /* Success */ return 0; } void apply_bounds_level (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Call boundary condition schedule group */ ierr = CallScheduleGroup (cctkGH, "Poisson_boundaries"); assert (!ierr); } void Poisson_boundaries_select (CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr; /* Select Direchlet boundary conditions */ ierr = Boundary_SelectGroupForBC (cctkGH, CCTK_ALL_FACES, 1, -1, "Poisson::potential", "scalar"); assert (!ierr); } ```
=== documentation.tex === % *======================================================================* % Cactus Thorn template for ThornGuide documentation % Author: Ian Kelley % Date: Sun Jun 02, 2002 % $Header$ % % Thorn documentation in the latex file doc/documentation.tex % will be included in ThornGuides built with the Cactus make system. % The scripts employed by the make system automatically include % pages about variables, parameters and scheduling parsed from the % relevant thorn CCL files. % % This template contains guidelines which help to assure that your % documentation will be correctly added to ThornGuides. More % information is available in the Cactus UsersGuide. % % Guidelines: % - Do not change anything before the line % % START CACTUS THORNGUIDE", % except for filling in the title, author, date, etc. fields. % - Each of these fields should only be on ONE line. % - Author names should be separated with a \\ or a comma. % - You can define your own macros, but they must appear after % the START CACTUS THORNGUIDE line, and must not redefine standard % latex commands. % - To avoid name clashes with other thorns, 'labels', 'citations', % 'references', and 'image' names should conform to the following % convention: % ARRANGEMENT_THORN_LABEL % For example, an image wave.eps in the arrangement CactusWave and % thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps % - Graphics should only be included using the graphicx package. % More specifically, with the "\includegraphics" command. Do % not specify any graphic file extensions in your .tex file. This % will allow us to create a PDF version of the ThornGuide % via pdflatex. % - References should be included with the latex "\bibitem" command. % - Use \begin{abstract}...\end{abstract} instead of \abstract{...} % - Do not use \appendix, instead include any appendices you need as % standard sections. % - For the benefit of our Perl scripts, and for future extensions, % please use simple latex. % % *======================================================================* % % Example of including a graphic image: % \begin{figure}[ht] % \begin{center} % \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure} % \end{center} % \caption{Illustration of this and that} % \label{MyArrangement_MyThorn_MyLabel} % \end{figure} % % Example of using a label: % \label{MyArrangement_MyThorn_MyLabel} % % Example of a citation: % \cite{MyArrangement_MyThorn_Author99} % % Example of including a reference % \bibitem{MyArrangement_MyThorn_Author99} % {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999), % 1--16. {\tt http://www.nowhere.com/}} % % *======================================================================* % If you are using CVS use this line to give version information % $Header$ \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} % The author of the documentation \author{Erik Schnetter \textless schnetter@gmail.com\textgreater} % The title of the document (not necessarily the name of the Thorn) \title{Poisson} % the date your document was last changed, if your document is in CVS, % please use: % \date{$ $Date$ $} \date{November 25, 2014} \maketitle % Do not delete next line % START CACTUS THORNGUIDE % Add all definitions used in this documentation here % \def\mydef etc % Add an abstract for this thorn's documentation \begin{abstract} This is an example thorn describing how to use the TATPETSc interface to PETSc. It solves the Poisson equation for a spherical charge distribution on a uniform grid. \end{abstract} % The following sections are suggestive only. % Remove them or add your own. \section{Introduction} PETSc is a well-known library for solving elliptic equations. TATPETSc is a Cactus thorn that provides a wrapper for calling PETSc to solve elliptic equations on uniform grids. (TATPETSc currently supports neither mesh refinement nor multi-block systems.) TATPETSc can solve both linear and non-linear systems. \section{Physical System} Here we solve the Poisson equation \begin{eqnarray} \Delta\Phi(x) &=& \rho(x) \end{eqnarray} where the right hand side $\rho$ is given by \begin{eqnarray} \rho(r) & = & \left\{ \begin{array}{ll} Q/V & r\le R \\ 0 & r>R \end{array} \right. \end{eqnarray} for the charge $Q$ and the radius $R$, with $V=4\pi R^3/3$. We use Dirichlet boundary conditions $\Phi(x)=0$. \section{Numerical Implementation} PETSc supports a large number of options to choose solvers. Here we use PETSc's default settings. \section{Using This Thorn} In the example parameter file, we set the parameter \texttt{TATPETSc::options} to select the following PETSc options: \begin{itemize} \item \verb+-snes_atol 1e-8+: set absolute tolerance for residual \item \verb+-snes_stol 1e-8+: set relative tolerance for residual \item \verb+-snes_monitor+: output progress information at each iteration of the non-linear solver \item \verb+-ksp_monitor+: output progress information at each iteration of the linear (Krylov subspace) solver \end{itemize} \subsection{Examples} The solution (the potential $\Phi(x)$) is stored in the grid function \texttt{potential}, the residual (a measure for the error) in the grid function \texttt{residual}. % Do not delete next line % END CACTUS THORNGUIDE \end{document}
documentation.tex
Cactus Code Thorn Poisson Author(s) : Erik Schnetter <schnetter@gmail.com> Maintainer(s): Erik Schnetter <schnetter@gmail.com> Licence : GPL -------------------------------------------------------------------------- 1. Purpose Solve the Poisson equation with the TATelliptic framework.
README
## README (README): ``` Cactus Code Thorn Poisson Author(s) : Erik Schnetter <schnetter@gmail.com> Maintainer(s): Erik Schnetter <schnetter@gmail.com> Licence : GPL -------------------------------------------------------------------------- 1. Purpose Solve the Poisson equation with the TATelliptic framework. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === % *======================================================================* % Cactus Thorn template for ThornGuide documentation % Author: Ian Kelley % Date: Sun Jun 02, 2002 % $Header$ % % Thorn documentation in the latex file doc/documentation.tex % will be included in ThornGuides built with the Cactus make system. % The scripts employed by the make system automatically include % pages about variables, parameters and scheduling parsed from the % relevant thorn CCL files. % % This template contains guidelines which help to assure that your % documentation will be correctly added to ThornGuides. More % information is available in the Cactus UsersGuide. % % Guidelines: % - Do not change anything before the line % % START CACTUS THORNGUIDE", % except for filling in the title, author, date, etc. fields. % - Each of these fields should only be on ONE line. % - Author names should be separated with a \\ or a comma. % - You can define your own macros, but they must appear after % the START CACTUS THORNGUIDE line, and must not redefine standard % latex commands. % - To avoid name clashes with other thorns, 'labels', 'citations', % 'references', and 'image' names should conform to the following % convention: % ARRANGEMENT_THORN_LABEL % For example, an image wave.eps in the arrangement CactusWave and % thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps % - Graphics should only be included using the graphicx package. % More specifically, with the "\includegraphics" command. Do % not specify any graphic file extensions in your .tex file. This % will allow us to create a PDF version of the ThornGuide % via pdflatex. % - References should be included with the latex "\bibitem" command. % - Use \begin{abstract}...\end{abstract} instead of \abstract{...} % - Do not use \appendix, instead include any appendices you need as % standard sections. % - For the benefit of our Perl scripts, and for future extensions, % please use simple latex. % % *======================================================================* % % Example of including a graphic image: % \begin{figure}[ht] % \begin{center} % \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure} % \end{center} % \caption{Illustration of this and that} % \label{MyArrangement_MyThorn_MyLabel} % \end{figure} % % Example of using a label: % \label{MyArrangement_MyThorn_MyLabel} % % Example of a citation: % \cite{MyArrangement_MyThorn_Author99} % % Example of including a reference % \bibitem{MyArrangement_MyThorn_Author99} % {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999), % 1--16. {\tt http://www.nowhere.com/}} % % *======================================================================* % If you are using CVS use this line to give version information % $Header$ \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} % The author of the documentation \author{Erik Schnetter \textless schnetter@gmail.com\textgreater} % The title of the document (not necessarily the name of the Thorn) \title{Poisson} % the date your document was last changed, if your document is in CVS, % please use: % \date{$ $Date$ $} \date{November 25, 2014} \maketitle % Do not delete next line % START CACTUS THORNGUIDE % Add all definitions used in this documentation here % \def\mydef etc % Add an abstract for this thorn's documentation \begin{abstract} This is an example thorn describing how to use the TATPETSc interface to PETSc. It solves the Poisson equation for a spherical charge distribution on a uniform grid. \end{abstract} % The following sections are suggestive only. % Remove them or add your own. \section{Introduction} PETSc is a well-known library for solving elliptic equations. TATPETSc is a Cactus thorn that provides a wrapper for calling PETSc to solve elliptic equations on uniform grids. (TATPETSc currently supports neither mesh refinement nor multi-block systems.) TATPETSc can solve both linear and non-linear systems. \section{Physical System} Here we solve the Poisson equation \begin{eqnarray} \Delta\Phi(x) &=& \rho(x) \end{eqnarray} where the right hand side $\rho$ is given by \begin{eqnarray} \rho(r) & = & \left\{ \begin{array}{ll} Q/V & r\le R \\ 0 & r>R \end{array} \right. \end{eqnarray} for the charge $Q$ and the radius $R$, with $V=4\pi R^3/3$. We use Dirichlet boundary conditions $\Phi(x)=0$. \section{Numerical Implementation} PETSc supports a large number of options to choose solvers. Here we use PETSc's default settings. \section{Using This Thorn} In the example parameter file, we set the parameter \texttt{TATPETSc::options} to select the following PETSc options: \begin{itemize} \item \verb+-snes_atol 1e-8+: set absolute tolerance for residual \item \verb+-snes_stol 1e-8+: set relative tolerance for residual \item \verb+-snes_monitor+: output progress information at each iteration of the non-linear solver \item \verb+-ksp_monitor+: output progress information at each iteration of the linear (Krylov subspace) solver \end{itemize} \subsection{Examples} The solution (the potential $\Phi(x)$) is stored in the grid function \texttt{potential}, the residual (a measure for the error) in the grid function \texttt{residual}. % Do not delete next line % END CACTUS THORNGUIDE \end{document} ```
CactusExamples/SampleBoundary
https://bitbucket.org/cactuscode/cactusexamples.git
# Interface definition for thorn SampleBoundary # $Header$ implements: LinExtrapBnd CCTK_INT FUNCTION Boundary_RegisterPhysicalBC(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN CCTK_FPOINTER function_pointer(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN num_vars, \ CCTK_INT ARRAY IN var_indices, \ CCTK_INT ARRAY IN faces, \ CCTK_INT ARRAY IN boundary_widths, \ CCTK_INT ARRAY IN table_handles),\ CCTK_STRING IN bc_name) USES FUNCTION Boundary_RegisterPhysicalBC CCTK_INT FUNCTION \ SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST IN cctkGH) USES FUNCTION SymmetryTableHandleForGrid
# Parameter definitions for thorn SampleBoundary # $Header$
# Schedule definitions for thorn SampleBoundary # $Header$ schedule SampleBoundary_RegisterBCs at CCTK_BASEGRID { lang: C } "Register boundary conditions that this thorn provides"
Register.c
/*@@ @file Register.c @date 6 May 2003 @author David Rideout @desc Register implemented boundary conditions. @enddesc @version $Header$ @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "SampleBnd.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_Register_c); /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* Local Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ***************** Aliased Routine Prototypes *********************** ********************************************************************/ /******************************************************************** ***************** Scheduled Routine Prototypes ********************* ********************************************************************/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS); /******************************************************************** ********************* Other Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ********************* Local Data ***************************** ********************************************************************/ /******************************************************************** ********************* Aliased Routines *********************** ********************************************************************/ /******************************************************************** ********************* Scheduled Routines ********************* ********************************************************************/ /*@@ @routine SampleBoundary_RegisterBCs @date 6 May 2003 @author David Rideout @desc Register all boundary conditions implemented by this thorn. @enddesc @calls @history @endhistory @var CCTK_ARGUMENTS @vdesc Cactus argument list @vtype CCTK_* @vio in @endvar @returntype void @@*/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS) { int err; err = Boundary_RegisterPhysicalBC((CCTK_POINTER) cctkGH, (phys_bc_fn_ptr) &BndLinExtrap, "LinExtrap"); if (err) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Error %d when registering routine to handle \"LinExtrap\" " "boundary condition", err); } } /******************************************************************** ********************* Local Routines ************************* ********************************************************************/
SampleBnd.h LinearExtrapBnd.c make.code.defn LinearExtrapBnd.F
SampleBnd.h: ``` /*@@ @file SampleBnd.h @date 6 May 2003 @author David Rideout @desc Prototypes for boundary routines @enddesc @@*/ #ifndef _SAMPLEBND_H_ #define _SAMPLEBND_H_ #ifdef __cplusplus extern "C" { #endif /* data type for pointer to function which implements a physical boundary condition: */ typedef CCTK_INT (*const phys_bc_fn_ptr)(const CCTK_POINTER_TO_CONST, const CCTK_INT, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *); /* prototype for routine registed as providing 'LinExtrap' boundary condition */ int BndLinExtrap (const CCTK_POINTER_TO_CONST GH, const CCTK_INT num_vars, const CCTK_INT *var_indices, const CCTK_INT *faces, const CCTK_INT *widths, const CCTK_INT *table_handles); #ifdef __cplusplus } #endif #endif /* _SAMPLEBND_H_ */ ``` LinearExtrapBnd.c: ``` /*@@ @file LinearExtrapBnd.c @date 24 Jan 2003 @author David Rideout @desc Function which is registered as handling Carsten Gundlach's "linear_extrap_one_bndry" boundary condition @enddesc @history @hdate @hauthor @hdesc @endhistory @version $Id$ @@*/ #include "cctk.h" #include "util_Table.h" /* the rcs ID and its dummy function to use it */ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_LinearExtrapBnd_c); /* #define DEBUG */ /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* External Routine Prototypes ****************** ********************************************************************/ void CCTK_FCALL CCTK_FNAME(Linear_extrap_one_bndry)(int *doBC, const int *lsh, CCTK_REAL *var_ptr); int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables); /******************************************************************** ******************** Scheduled Routines *********************** ********************************************************************/ /******************************************************************** ******************** External Routines ************************ ********************************************************************/ /*@@ @routine BndLinExtrap @date 24 Jan 2003 @author David Rideout @desc Apply linear extrapolation boundary condition to a group of grid functions given by their indices. This routine is registered to handle the linear extrapolation boundary condition. Can only handle 3D grid functions. All symmetries are ignored for now -- the symmetry bcs must overwrite the output of this bc where necessary @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy @vtype const cGH * @vio in @endvar @var num_vars @vdesc number of variables passed in through vars[] @vtype int @vio in @endvar @var var_indices @vdesc array of variable indicies to which to apply this boundary condition @vtype int * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc @vtype int @vio in @endvar @var widths @vdesc array of boundary widths for each variable @vtype int @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments @vtype int @vio in @endvar @calls CCTK_GroupIndexFromVarI CCTK_GroupDimI CCTK_VarTypeI Linear_extrap_one_bndry @history @hdate @hauthor @hdesc @endhistory @returntype int @returndesc each bit of return value indicates a possible error code, as follows: 0 for success -1 invalid faces specification -2 unsupported staggering -4 boundary width != 1 -8 potentially valid table handle -16 dimension is not supported -32 possibly called with a grid scalar @endreturndesc @@*/ int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables) { int i, j, gi, gtype, dim, retval, err; int doBC[6]; const int *lsh, *bbox; CCTK_INT symtable; CCTK_INT symbnd[6]; CCTK_INT is_physical[6]; CCTK_REAL *var_ptr; cGroupDynamicData group_data; retval = 0; #ifdef DEBUG printf("calling BndLinExtrap at iter %d\n", GH->cctk_iteration); #endif /* loop through variables, one at a time (since this is all that Linear_extrap_one_bndry can handle) */ for (i=0; i<num_vars; ++i) { /* Check to see if faces specification is valid */ if (faces[i] != CCTK_ALL_FACES) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Faces specification %d for LinExtrap boundary conditions on " "%s is not implemented yet. " "Not applying bc.", faces[i], CCTK_VarName(vars[i])); retval |= 1; } /* Check to see if the boundary width might be something other than one */ if (widths[i] != 1) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "LinExtrapBnd does not handle boundary widths other than one." " Assuming boundary width of one on all faces."); retval |= 4; } /* Ignore table handles */ if (tables[i] >= 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Possibly valid table handle. LinExtrapBnd ignores " "information stored in tables."); retval |= 8; } /* Gather some important information about this grid variable */ gi = CCTK_GroupIndexFromVarI(vars[i]); gtype = CCTK_GroupTypeI(gi); if (gtype==CCTK_GF) { dim = GH->cctk_dim; bbox = GH->cctk_bbox; lsh = GH->cctk_lsh; } else { err = CCTK_GroupDynamicData(GH, gi, &group_data); if (err) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Error getting group information for group %s. " "Perhaps it is a grid scalar?", CCTK_GroupName(gi)); retval |= 32; } dim = group_data.dim; bbox = group_data.bbox; lsh = group_data.lsh; } var_ptr = GH->data[vars[i]][0]; #ifdef DEBUG printf("dim=%d bbox[0]=%d lsh[1]=%d\n", dim, bbox[0], lsh[1]); printf("var_ptr=%p\n", var_ptr); #endif /* Check dimension */ if (dim != 3) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Variable dimension of %d not supported. " "Not applying bc.", dim); retval |= 16; } /* Decide on which faces the bc should be applied */ for (j=0; j<2*dim; ++j) { doBC[j] = lsh[j/2] > widths[i]+2 && bbox[j]; } /* see if we have a physical boundary */ symtable = SymmetryTableHandleForGrid (GH); if (symtable < 0) CCTK_WARN (0, "internal error"); err = Util_TableGetIntArray (symtable, 2 * dim, symbnd, "symmetry_handle"); if (err != 2 * dim) CCTK_WARN (0, "internal error"); for (j = 0; j < 2 * dim; j++) { is_physical[j] = symbnd[j] < 0; } /* Only do bc on faces without a symmetry bc */ for (j=0; j<2*dim; ++j) { doBC[j] &= is_physical[i]; } /* Apply the boundary condition */ if( !( retval & ( 1 | 16 ) ) ) /* unless particularly bad errors */ CCTK_FNAME(Linear_extrap_one_bndry)(doBC, lsh, var_ptr); } return -retval; } /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` make.code.defn: ``` # Main make.code.defn file for thorn SampleBoundary # $Header$ # Source files in this directory SRCS = Register.c LinearExtrapBnd.c LinearExtrapBnd.F # Subdirectories containing source files SUBDIRS = ``` LinearExtrapBnd.F: ``` c This subroutine linearly extrapolates one Cactus variable c on one boundary of the Cactus grid box. C $Header$ #include "cctk.h" subroutine Linear_extrap_one_bndry(doBC, lsh, var) implicit none integer doBC(6) integer lsh(3) CCTK_REAL var(lsh(1),lsh(2),lsh(3)) integer nx,ny,nz C Grid parameters. nx = lsh(1) ny = lsh(2) nz = lsh(3) C Linear extrapolation from the interiors to the boundaries. C Does not support octant or quadrant. C 6 faces. if (doBC(1).eq.1) then var(1,:,:) = 2.d0 * var(2,:,:) - var(3,:,:) endif if (doBC(3).eq.1) then var(:,1,:) = 2.d0 * var(:,2,:) - var(:,3,:) endif if (doBC(5).eq.1) then var(:,:,1) = 2.d0 * var(:,:,2) - var(:,:,3) endif if (doBC(2).eq.1) then var(nx,:,:) = 2.d0 * var(nx-1,:,:) - var(nx-2,:,:) endif if (doBC(4).eq.1) then var(:,ny,:) = 2.d0 * var(:,ny-1,:) - var(:,ny-2,:) endif if (doBC(6).eq.1) then var(:,:,nz) = 2.d0 * var(:,:,nz-1) - var(:,:,nz-2) endif C 12 edges. C 4 round face x=min. if ( doBC(1).eq.1 $ .and. doBC(3).eq.1) then var(1,1,:) = 2.d0 * var(2,2,:) - var(3,3,:) end if if ( doBC(1).eq.1 $ .and. doBC(4).eq.1) then var(1,ny,:) = 2.d0 * var(2,ny-1,:) - var(2,ny-2,:) end if if ( doBC(1).eq.1 $ .and. doBC(5).eq.1) then var(1,:,1) = 2.d0 * var(2,:,2) - var(3,:,3) end if if ( doBC(1).eq.1 $ .and. doBC(6).eq.1) then var(1,:,nz) = 2.d0 * var(2,:,nz-1) - var(3,:,nz-2) end if C 4 around face x=max. if ( doBC(2).eq.1 $ .and. doBC(3).eq.1) then var(nx,1,:) = 2.d0 * var(nx-1,2,:) - var(nx-2,3,:) end if if ( doBC(2).eq.1 $ .and. doBC(4).eq.1) then var(nx,ny,:) = 2.d0 * var(nx-1,ny-1,:) - var(nx-2,ny-2,:) end if if ( doBC(2).eq.1 $ .and. doBC(5).eq.1) then var(nx,:,1) = 2.d0 * var(nx-1,:,2) - var(nx-2,:,3) end if if ( doBC(2).eq.1 $ .and. doBC(6).eq.1) then var(nx,:,nz) = 2.d0 * var(nx-1,:,nz-1) - var(nx-2,:,nz-2) end if C Remaining 2 in y=min. if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,1,1) = 2.d0 * var(:,2,2) - var(:,3,3) end if if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,1,nz) = 2.d0 * var(:,2,nz-1) - var(:,2,nz-2) end if C Remaining 2 in y=ymax. if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,ny,1) = 2.d0 * var(:,ny-1,2) - var(:,ny-2,3) end if if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,ny,nz) = 2.d0 * var(:,ny-1,nz-1) - var(:,ny-2,nz-2) end if C 8 corners. if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(1,1,1) = 2.d0*var(2,2,2) - var(3,3,3) end if if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(1,1,nz) = 2.d0*var(2,2,nz-1) - var(3,3,nz-2) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(1,ny,1) = 2.d0*var(2,ny-1,2) - var(3,ny-2,3) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(1,ny,nz) = 2.d0*var(2,ny-1,nz-1) - var(3,ny-2,nz-2) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(nx,1,1) = 2.d0*var(nx-1,2,2) - var(nx-2,3,3) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(nx,1,nz) = 2.d0*var(nx-1,2,nz-1) - var(nx-2,3,nz-2) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(nx,ny,1) = 2.d0*var(nx-1,ny-1,2) - var(nx-2,ny-2,3) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(nx,ny,nz) = 2.d0*var(nx-1,ny-1,nz-1) - var(nx-2,ny-2,nz-2) end if return end ```
=== documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn
documentation.tex
Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions.
README
## README (README): ``` Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn ```
CactusExamples/SampleBoundary
https://bitbucket.org/cactuscode/cactusexamples.git
# Interface definition for thorn SampleBoundary # $Header$ implements: LinExtrapBnd CCTK_INT FUNCTION Boundary_RegisterPhysicalBC(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN CCTK_FPOINTER function_pointer(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN num_vars, \ CCTK_INT ARRAY IN var_indices, \ CCTK_INT ARRAY IN faces, \ CCTK_INT ARRAY IN boundary_widths, \ CCTK_INT ARRAY IN table_handles),\ CCTK_STRING IN bc_name) USES FUNCTION Boundary_RegisterPhysicalBC CCTK_INT FUNCTION \ SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST IN cctkGH) USES FUNCTION SymmetryTableHandleForGrid
# Parameter definitions for thorn SampleBoundary # $Header$
# Schedule definitions for thorn SampleBoundary # $Header$ schedule SampleBoundary_RegisterBCs at CCTK_BASEGRID { lang: C } "Register boundary conditions that this thorn provides"
SampleBnd.h
/*@@ @file SampleBnd.h @date 6 May 2003 @author David Rideout @desc Prototypes for boundary routines @enddesc @@*/ #ifndef _SAMPLEBND_H_ #define _SAMPLEBND_H_ #ifdef __cplusplus extern "C" { #endif /* data type for pointer to function which implements a physical boundary condition: */ typedef CCTK_INT (*const phys_bc_fn_ptr)(const CCTK_POINTER_TO_CONST, const CCTK_INT, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *); /* prototype for routine registed as providing 'LinExtrap' boundary condition */ int BndLinExtrap (const CCTK_POINTER_TO_CONST GH, const CCTK_INT num_vars, const CCTK_INT *var_indices, const CCTK_INT *faces, const CCTK_INT *widths, const CCTK_INT *table_handles); #ifdef __cplusplus } #endif #endif /* _SAMPLEBND_H_ */
Register.c LinearExtrapBnd.c make.code.defn LinearExtrapBnd.F
Register.c: ``` /*@@ @file Register.c @date 6 May 2003 @author David Rideout @desc Register implemented boundary conditions. @enddesc @version $Header$ @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "SampleBnd.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_Register_c); /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* Local Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ***************** Aliased Routine Prototypes *********************** ********************************************************************/ /******************************************************************** ***************** Scheduled Routine Prototypes ********************* ********************************************************************/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS); /******************************************************************** ********************* Other Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ********************* Local Data ***************************** ********************************************************************/ /******************************************************************** ********************* Aliased Routines *********************** ********************************************************************/ /******************************************************************** ********************* Scheduled Routines ********************* ********************************************************************/ /*@@ @routine SampleBoundary_RegisterBCs @date 6 May 2003 @author David Rideout @desc Register all boundary conditions implemented by this thorn. @enddesc @calls @history @endhistory @var CCTK_ARGUMENTS @vdesc Cactus argument list @vtype CCTK_* @vio in @endvar @returntype void @@*/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS) { int err; err = Boundary_RegisterPhysicalBC((CCTK_POINTER) cctkGH, (phys_bc_fn_ptr) &BndLinExtrap, "LinExtrap"); if (err) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Error %d when registering routine to handle \"LinExtrap\" " "boundary condition", err); } } /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` LinearExtrapBnd.c: ``` /*@@ @file LinearExtrapBnd.c @date 24 Jan 2003 @author David Rideout @desc Function which is registered as handling Carsten Gundlach's "linear_extrap_one_bndry" boundary condition @enddesc @history @hdate @hauthor @hdesc @endhistory @version $Id$ @@*/ #include "cctk.h" #include "util_Table.h" /* the rcs ID and its dummy function to use it */ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_LinearExtrapBnd_c); /* #define DEBUG */ /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* External Routine Prototypes ****************** ********************************************************************/ void CCTK_FCALL CCTK_FNAME(Linear_extrap_one_bndry)(int *doBC, const int *lsh, CCTK_REAL *var_ptr); int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables); /******************************************************************** ******************** Scheduled Routines *********************** ********************************************************************/ /******************************************************************** ******************** External Routines ************************ ********************************************************************/ /*@@ @routine BndLinExtrap @date 24 Jan 2003 @author David Rideout @desc Apply linear extrapolation boundary condition to a group of grid functions given by their indices. This routine is registered to handle the linear extrapolation boundary condition. Can only handle 3D grid functions. All symmetries are ignored for now -- the symmetry bcs must overwrite the output of this bc where necessary @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy @vtype const cGH * @vio in @endvar @var num_vars @vdesc number of variables passed in through vars[] @vtype int @vio in @endvar @var var_indices @vdesc array of variable indicies to which to apply this boundary condition @vtype int * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc @vtype int @vio in @endvar @var widths @vdesc array of boundary widths for each variable @vtype int @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments @vtype int @vio in @endvar @calls CCTK_GroupIndexFromVarI CCTK_GroupDimI CCTK_VarTypeI Linear_extrap_one_bndry @history @hdate @hauthor @hdesc @endhistory @returntype int @returndesc each bit of return value indicates a possible error code, as follows: 0 for success -1 invalid faces specification -2 unsupported staggering -4 boundary width != 1 -8 potentially valid table handle -16 dimension is not supported -32 possibly called with a grid scalar @endreturndesc @@*/ int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables) { int i, j, gi, gtype, dim, retval, err; int doBC[6]; const int *lsh, *bbox; CCTK_INT symtable; CCTK_INT symbnd[6]; CCTK_INT is_physical[6]; CCTK_REAL *var_ptr; cGroupDynamicData group_data; retval = 0; #ifdef DEBUG printf("calling BndLinExtrap at iter %d\n", GH->cctk_iteration); #endif /* loop through variables, one at a time (since this is all that Linear_extrap_one_bndry can handle) */ for (i=0; i<num_vars; ++i) { /* Check to see if faces specification is valid */ if (faces[i] != CCTK_ALL_FACES) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Faces specification %d for LinExtrap boundary conditions on " "%s is not implemented yet. " "Not applying bc.", faces[i], CCTK_VarName(vars[i])); retval |= 1; } /* Check to see if the boundary width might be something other than one */ if (widths[i] != 1) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "LinExtrapBnd does not handle boundary widths other than one." " Assuming boundary width of one on all faces."); retval |= 4; } /* Ignore table handles */ if (tables[i] >= 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Possibly valid table handle. LinExtrapBnd ignores " "information stored in tables."); retval |= 8; } /* Gather some important information about this grid variable */ gi = CCTK_GroupIndexFromVarI(vars[i]); gtype = CCTK_GroupTypeI(gi); if (gtype==CCTK_GF) { dim = GH->cctk_dim; bbox = GH->cctk_bbox; lsh = GH->cctk_lsh; } else { err = CCTK_GroupDynamicData(GH, gi, &group_data); if (err) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Error getting group information for group %s. " "Perhaps it is a grid scalar?", CCTK_GroupName(gi)); retval |= 32; } dim = group_data.dim; bbox = group_data.bbox; lsh = group_data.lsh; } var_ptr = GH->data[vars[i]][0]; #ifdef DEBUG printf("dim=%d bbox[0]=%d lsh[1]=%d\n", dim, bbox[0], lsh[1]); printf("var_ptr=%p\n", var_ptr); #endif /* Check dimension */ if (dim != 3) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Variable dimension of %d not supported. " "Not applying bc.", dim); retval |= 16; } /* Decide on which faces the bc should be applied */ for (j=0; j<2*dim; ++j) { doBC[j] = lsh[j/2] > widths[i]+2 && bbox[j]; } /* see if we have a physical boundary */ symtable = SymmetryTableHandleForGrid (GH); if (symtable < 0) CCTK_WARN (0, "internal error"); err = Util_TableGetIntArray (symtable, 2 * dim, symbnd, "symmetry_handle"); if (err != 2 * dim) CCTK_WARN (0, "internal error"); for (j = 0; j < 2 * dim; j++) { is_physical[j] = symbnd[j] < 0; } /* Only do bc on faces without a symmetry bc */ for (j=0; j<2*dim; ++j) { doBC[j] &= is_physical[i]; } /* Apply the boundary condition */ if( !( retval & ( 1 | 16 ) ) ) /* unless particularly bad errors */ CCTK_FNAME(Linear_extrap_one_bndry)(doBC, lsh, var_ptr); } return -retval; } /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` make.code.defn: ``` # Main make.code.defn file for thorn SampleBoundary # $Header$ # Source files in this directory SRCS = Register.c LinearExtrapBnd.c LinearExtrapBnd.F # Subdirectories containing source files SUBDIRS = ``` LinearExtrapBnd.F: ``` c This subroutine linearly extrapolates one Cactus variable c on one boundary of the Cactus grid box. C $Header$ #include "cctk.h" subroutine Linear_extrap_one_bndry(doBC, lsh, var) implicit none integer doBC(6) integer lsh(3) CCTK_REAL var(lsh(1),lsh(2),lsh(3)) integer nx,ny,nz C Grid parameters. nx = lsh(1) ny = lsh(2) nz = lsh(3) C Linear extrapolation from the interiors to the boundaries. C Does not support octant or quadrant. C 6 faces. if (doBC(1).eq.1) then var(1,:,:) = 2.d0 * var(2,:,:) - var(3,:,:) endif if (doBC(3).eq.1) then var(:,1,:) = 2.d0 * var(:,2,:) - var(:,3,:) endif if (doBC(5).eq.1) then var(:,:,1) = 2.d0 * var(:,:,2) - var(:,:,3) endif if (doBC(2).eq.1) then var(nx,:,:) = 2.d0 * var(nx-1,:,:) - var(nx-2,:,:) endif if (doBC(4).eq.1) then var(:,ny,:) = 2.d0 * var(:,ny-1,:) - var(:,ny-2,:) endif if (doBC(6).eq.1) then var(:,:,nz) = 2.d0 * var(:,:,nz-1) - var(:,:,nz-2) endif C 12 edges. C 4 round face x=min. if ( doBC(1).eq.1 $ .and. doBC(3).eq.1) then var(1,1,:) = 2.d0 * var(2,2,:) - var(3,3,:) end if if ( doBC(1).eq.1 $ .and. doBC(4).eq.1) then var(1,ny,:) = 2.d0 * var(2,ny-1,:) - var(2,ny-2,:) end if if ( doBC(1).eq.1 $ .and. doBC(5).eq.1) then var(1,:,1) = 2.d0 * var(2,:,2) - var(3,:,3) end if if ( doBC(1).eq.1 $ .and. doBC(6).eq.1) then var(1,:,nz) = 2.d0 * var(2,:,nz-1) - var(3,:,nz-2) end if C 4 around face x=max. if ( doBC(2).eq.1 $ .and. doBC(3).eq.1) then var(nx,1,:) = 2.d0 * var(nx-1,2,:) - var(nx-2,3,:) end if if ( doBC(2).eq.1 $ .and. doBC(4).eq.1) then var(nx,ny,:) = 2.d0 * var(nx-1,ny-1,:) - var(nx-2,ny-2,:) end if if ( doBC(2).eq.1 $ .and. doBC(5).eq.1) then var(nx,:,1) = 2.d0 * var(nx-1,:,2) - var(nx-2,:,3) end if if ( doBC(2).eq.1 $ .and. doBC(6).eq.1) then var(nx,:,nz) = 2.d0 * var(nx-1,:,nz-1) - var(nx-2,:,nz-2) end if C Remaining 2 in y=min. if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,1,1) = 2.d0 * var(:,2,2) - var(:,3,3) end if if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,1,nz) = 2.d0 * var(:,2,nz-1) - var(:,2,nz-2) end if C Remaining 2 in y=ymax. if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,ny,1) = 2.d0 * var(:,ny-1,2) - var(:,ny-2,3) end if if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,ny,nz) = 2.d0 * var(:,ny-1,nz-1) - var(:,ny-2,nz-2) end if C 8 corners. if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(1,1,1) = 2.d0*var(2,2,2) - var(3,3,3) end if if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(1,1,nz) = 2.d0*var(2,2,nz-1) - var(3,3,nz-2) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(1,ny,1) = 2.d0*var(2,ny-1,2) - var(3,ny-2,3) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(1,ny,nz) = 2.d0*var(2,ny-1,nz-1) - var(3,ny-2,nz-2) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(nx,1,1) = 2.d0*var(nx-1,2,2) - var(nx-2,3,3) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(nx,1,nz) = 2.d0*var(nx-1,2,nz-1) - var(nx-2,3,nz-2) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(nx,ny,1) = 2.d0*var(nx-1,ny-1,2) - var(nx-2,ny-2,3) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(nx,ny,nz) = 2.d0*var(nx-1,ny-1,nz-1) - var(nx-2,ny-2,nz-2) end if return end ```
=== documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn
documentation.tex
Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions.
README
## README (README): ``` Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn ```
CactusExamples/SampleBoundary
https://bitbucket.org/cactuscode/cactusexamples.git
# Interface definition for thorn SampleBoundary # $Header$ implements: LinExtrapBnd CCTK_INT FUNCTION Boundary_RegisterPhysicalBC(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN CCTK_FPOINTER function_pointer(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN num_vars, \ CCTK_INT ARRAY IN var_indices, \ CCTK_INT ARRAY IN faces, \ CCTK_INT ARRAY IN boundary_widths, \ CCTK_INT ARRAY IN table_handles),\ CCTK_STRING IN bc_name) USES FUNCTION Boundary_RegisterPhysicalBC CCTK_INT FUNCTION \ SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST IN cctkGH) USES FUNCTION SymmetryTableHandleForGrid
# Parameter definitions for thorn SampleBoundary # $Header$
# Schedule definitions for thorn SampleBoundary # $Header$ schedule SampleBoundary_RegisterBCs at CCTK_BASEGRID { lang: C } "Register boundary conditions that this thorn provides"
LinearExtrapBnd.c
/*@@ @file LinearExtrapBnd.c @date 24 Jan 2003 @author David Rideout @desc Function which is registered as handling Carsten Gundlach's "linear_extrap_one_bndry" boundary condition @enddesc @history @hdate @hauthor @hdesc @endhistory @version $Id$ @@*/ #include "cctk.h" #include "util_Table.h" /* the rcs ID and its dummy function to use it */ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_LinearExtrapBnd_c); /* #define DEBUG */ /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* External Routine Prototypes ****************** ********************************************************************/ void CCTK_FCALL CCTK_FNAME(Linear_extrap_one_bndry)(int *doBC, const int *lsh, CCTK_REAL *var_ptr); int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables); /******************************************************************** ******************** Scheduled Routines *********************** ********************************************************************/ /******************************************************************** ******************** External Routines ************************ ********************************************************************/ /*@@ @routine BndLinExtrap @date 24 Jan 2003 @author David Rideout @desc Apply linear extrapolation boundary condition to a group of grid functions given by their indices. This routine is registered to handle the linear extrapolation boundary condition. Can only handle 3D grid functions. All symmetries are ignored for now -- the symmetry bcs must overwrite the output of this bc where necessary @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy @vtype const cGH * @vio in @endvar @var num_vars @vdesc number of variables passed in through vars[] @vtype int @vio in @endvar @var var_indices @vdesc array of variable indicies to which to apply this boundary condition @vtype int * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc @vtype int @vio in @endvar @var widths @vdesc array of boundary widths for each variable @vtype int @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments @vtype int @vio in @endvar @calls CCTK_GroupIndexFromVarI CCTK_GroupDimI CCTK_VarTypeI Linear_extrap_one_bndry @history @hdate @hauthor @hdesc @endhistory @returntype int @returndesc each bit of return value indicates a possible error code, as follows: 0 for success -1 invalid faces specification -2 unsupported staggering -4 boundary width != 1 -8 potentially valid table handle -16 dimension is not supported -32 possibly called with a grid scalar @endreturndesc @@*/ int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables) { int i, j, gi, gtype, dim, retval, err; int doBC[6]; const int *lsh, *bbox; CCTK_INT symtable; CCTK_INT symbnd[6]; CCTK_INT is_physical[6]; CCTK_REAL *var_ptr; cGroupDynamicData group_data; retval = 0; #ifdef DEBUG printf("calling BndLinExtrap at iter %d\n", GH->cctk_iteration); #endif /* loop through variables, one at a time (since this is all that Linear_extrap_one_bndry can handle) */ for (i=0; i<num_vars; ++i) { /* Check to see if faces specification is valid */ if (faces[i] != CCTK_ALL_FACES) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Faces specification %d for LinExtrap boundary conditions on " "%s is not implemented yet. " "Not applying bc.", faces[i], CCTK_VarName(vars[i])); retval |= 1; } /* Check to see if the boundary width might be something other than one */ if (widths[i] != 1) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "LinExtrapBnd does not handle boundary widths other than one." " Assuming boundary width of one on all faces."); retval |= 4; } /* Ignore table handles */ if (tables[i] >= 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Possibly valid table handle. LinExtrapBnd ignores " "information stored in tables."); retval |= 8; } /* Gather some important information about this grid variable */ gi = CCTK_GroupIndexFromVarI(vars[i]); gtype = CCTK_GroupTypeI(gi); if (gtype==CCTK_GF) { dim = GH->cctk_dim; bbox = GH->cctk_bbox; lsh = GH->cctk_lsh; } else { err = CCTK_GroupDynamicData(GH, gi, &group_data); if (err) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Error getting group information for group %s. " "Perhaps it is a grid scalar?", CCTK_GroupName(gi)); retval |= 32; } dim = group_data.dim; bbox = group_data.bbox; lsh = group_data.lsh; } var_ptr = GH->data[vars[i]][0]; #ifdef DEBUG printf("dim=%d bbox[0]=%d lsh[1]=%d\n", dim, bbox[0], lsh[1]); printf("var_ptr=%p\n", var_ptr); #endif /* Check dimension */ if (dim != 3) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Variable dimension of %d not supported. " "Not applying bc.", dim); retval |= 16; } /* Decide on which faces the bc should be applied */ for (j=0; j<2*dim; ++j) { doBC[j] = lsh[j/2] > widths[i]+2 && bbox[j]; } /* see if we have a physical boundary */ symtable = SymmetryTableHandleForGrid (GH); if (symtable < 0) CCTK_WARN (0, "internal error"); err = Util_TableGetIntArray (symtable, 2 * dim, symbnd, "symmetry_handle"); if (err != 2 * dim) CCTK_WARN (0, "internal error"); for (j = 0; j < 2 * dim; j++) { is_physical[j] = symbnd[j] < 0; } /* Only do bc on faces without a symmetry bc */ for (j=0; j<2*dim; ++j) { doBC[j] &= is_physical[i]; } /* Apply the boundary condition */ if( !( retval & ( 1 | 16 ) ) ) /* unless particularly bad errors */ CCTK_FNAME(Linear_extrap_one_bndry)(doBC, lsh, var_ptr); } return -retval; } /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ /******************************************************************** ********************* Local Routines ************************* ********************************************************************/
Register.c SampleBnd.h make.code.defn LinearExtrapBnd.F
Register.c: ``` /*@@ @file Register.c @date 6 May 2003 @author David Rideout @desc Register implemented boundary conditions. @enddesc @version $Header$ @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "SampleBnd.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_Register_c); /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* Local Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ***************** Aliased Routine Prototypes *********************** ********************************************************************/ /******************************************************************** ***************** Scheduled Routine Prototypes ********************* ********************************************************************/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS); /******************************************************************** ********************* Other Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ********************* Local Data ***************************** ********************************************************************/ /******************************************************************** ********************* Aliased Routines *********************** ********************************************************************/ /******************************************************************** ********************* Scheduled Routines ********************* ********************************************************************/ /*@@ @routine SampleBoundary_RegisterBCs @date 6 May 2003 @author David Rideout @desc Register all boundary conditions implemented by this thorn. @enddesc @calls @history @endhistory @var CCTK_ARGUMENTS @vdesc Cactus argument list @vtype CCTK_* @vio in @endvar @returntype void @@*/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS) { int err; err = Boundary_RegisterPhysicalBC((CCTK_POINTER) cctkGH, (phys_bc_fn_ptr) &BndLinExtrap, "LinExtrap"); if (err) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Error %d when registering routine to handle \"LinExtrap\" " "boundary condition", err); } } /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` SampleBnd.h: ``` /*@@ @file SampleBnd.h @date 6 May 2003 @author David Rideout @desc Prototypes for boundary routines @enddesc @@*/ #ifndef _SAMPLEBND_H_ #define _SAMPLEBND_H_ #ifdef __cplusplus extern "C" { #endif /* data type for pointer to function which implements a physical boundary condition: */ typedef CCTK_INT (*const phys_bc_fn_ptr)(const CCTK_POINTER_TO_CONST, const CCTK_INT, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *); /* prototype for routine registed as providing 'LinExtrap' boundary condition */ int BndLinExtrap (const CCTK_POINTER_TO_CONST GH, const CCTK_INT num_vars, const CCTK_INT *var_indices, const CCTK_INT *faces, const CCTK_INT *widths, const CCTK_INT *table_handles); #ifdef __cplusplus } #endif #endif /* _SAMPLEBND_H_ */ ``` make.code.defn: ``` # Main make.code.defn file for thorn SampleBoundary # $Header$ # Source files in this directory SRCS = Register.c LinearExtrapBnd.c LinearExtrapBnd.F # Subdirectories containing source files SUBDIRS = ``` LinearExtrapBnd.F: ``` c This subroutine linearly extrapolates one Cactus variable c on one boundary of the Cactus grid box. C $Header$ #include "cctk.h" subroutine Linear_extrap_one_bndry(doBC, lsh, var) implicit none integer doBC(6) integer lsh(3) CCTK_REAL var(lsh(1),lsh(2),lsh(3)) integer nx,ny,nz C Grid parameters. nx = lsh(1) ny = lsh(2) nz = lsh(3) C Linear extrapolation from the interiors to the boundaries. C Does not support octant or quadrant. C 6 faces. if (doBC(1).eq.1) then var(1,:,:) = 2.d0 * var(2,:,:) - var(3,:,:) endif if (doBC(3).eq.1) then var(:,1,:) = 2.d0 * var(:,2,:) - var(:,3,:) endif if (doBC(5).eq.1) then var(:,:,1) = 2.d0 * var(:,:,2) - var(:,:,3) endif if (doBC(2).eq.1) then var(nx,:,:) = 2.d0 * var(nx-1,:,:) - var(nx-2,:,:) endif if (doBC(4).eq.1) then var(:,ny,:) = 2.d0 * var(:,ny-1,:) - var(:,ny-2,:) endif if (doBC(6).eq.1) then var(:,:,nz) = 2.d0 * var(:,:,nz-1) - var(:,:,nz-2) endif C 12 edges. C 4 round face x=min. if ( doBC(1).eq.1 $ .and. doBC(3).eq.1) then var(1,1,:) = 2.d0 * var(2,2,:) - var(3,3,:) end if if ( doBC(1).eq.1 $ .and. doBC(4).eq.1) then var(1,ny,:) = 2.d0 * var(2,ny-1,:) - var(2,ny-2,:) end if if ( doBC(1).eq.1 $ .and. doBC(5).eq.1) then var(1,:,1) = 2.d0 * var(2,:,2) - var(3,:,3) end if if ( doBC(1).eq.1 $ .and. doBC(6).eq.1) then var(1,:,nz) = 2.d0 * var(2,:,nz-1) - var(3,:,nz-2) end if C 4 around face x=max. if ( doBC(2).eq.1 $ .and. doBC(3).eq.1) then var(nx,1,:) = 2.d0 * var(nx-1,2,:) - var(nx-2,3,:) end if if ( doBC(2).eq.1 $ .and. doBC(4).eq.1) then var(nx,ny,:) = 2.d0 * var(nx-1,ny-1,:) - var(nx-2,ny-2,:) end if if ( doBC(2).eq.1 $ .and. doBC(5).eq.1) then var(nx,:,1) = 2.d0 * var(nx-1,:,2) - var(nx-2,:,3) end if if ( doBC(2).eq.1 $ .and. doBC(6).eq.1) then var(nx,:,nz) = 2.d0 * var(nx-1,:,nz-1) - var(nx-2,:,nz-2) end if C Remaining 2 in y=min. if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,1,1) = 2.d0 * var(:,2,2) - var(:,3,3) end if if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,1,nz) = 2.d0 * var(:,2,nz-1) - var(:,2,nz-2) end if C Remaining 2 in y=ymax. if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,ny,1) = 2.d0 * var(:,ny-1,2) - var(:,ny-2,3) end if if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,ny,nz) = 2.d0 * var(:,ny-1,nz-1) - var(:,ny-2,nz-2) end if C 8 corners. if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(1,1,1) = 2.d0*var(2,2,2) - var(3,3,3) end if if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(1,1,nz) = 2.d0*var(2,2,nz-1) - var(3,3,nz-2) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(1,ny,1) = 2.d0*var(2,ny-1,2) - var(3,ny-2,3) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(1,ny,nz) = 2.d0*var(2,ny-1,nz-1) - var(3,ny-2,nz-2) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(nx,1,1) = 2.d0*var(nx-1,2,2) - var(nx-2,3,3) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(nx,1,nz) = 2.d0*var(nx-1,2,nz-1) - var(nx-2,3,nz-2) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(nx,ny,1) = 2.d0*var(nx-1,ny-1,2) - var(nx-2,ny-2,3) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(nx,ny,nz) = 2.d0*var(nx-1,ny-1,nz-1) - var(nx-2,ny-2,nz-2) end if return end ```
=== documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn
documentation.tex
Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions.
README
## README (README): ``` Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn ```
CactusExamples/SampleBoundary
https://bitbucket.org/cactuscode/cactusexamples.git
# Interface definition for thorn SampleBoundary # $Header$ implements: LinExtrapBnd CCTK_INT FUNCTION Boundary_RegisterPhysicalBC(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN CCTK_FPOINTER function_pointer(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN num_vars, \ CCTK_INT ARRAY IN var_indices, \ CCTK_INT ARRAY IN faces, \ CCTK_INT ARRAY IN boundary_widths, \ CCTK_INT ARRAY IN table_handles),\ CCTK_STRING IN bc_name) USES FUNCTION Boundary_RegisterPhysicalBC CCTK_INT FUNCTION \ SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST IN cctkGH) USES FUNCTION SymmetryTableHandleForGrid
# Parameter definitions for thorn SampleBoundary # $Header$
# Schedule definitions for thorn SampleBoundary # $Header$ schedule SampleBoundary_RegisterBCs at CCTK_BASEGRID { lang: C } "Register boundary conditions that this thorn provides"
make.code.defn
# Main make.code.defn file for thorn SampleBoundary # $Header$ # Source files in this directory SRCS = Register.c LinearExtrapBnd.c LinearExtrapBnd.F # Subdirectories containing source files SUBDIRS =
Register.c SampleBnd.h LinearExtrapBnd.c LinearExtrapBnd.F
Register.c: ``` /*@@ @file Register.c @date 6 May 2003 @author David Rideout @desc Register implemented boundary conditions. @enddesc @version $Header$ @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "SampleBnd.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_Register_c); /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* Local Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ***************** Aliased Routine Prototypes *********************** ********************************************************************/ /******************************************************************** ***************** Scheduled Routine Prototypes ********************* ********************************************************************/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS); /******************************************************************** ********************* Other Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ********************* Local Data ***************************** ********************************************************************/ /******************************************************************** ********************* Aliased Routines *********************** ********************************************************************/ /******************************************************************** ********************* Scheduled Routines ********************* ********************************************************************/ /*@@ @routine SampleBoundary_RegisterBCs @date 6 May 2003 @author David Rideout @desc Register all boundary conditions implemented by this thorn. @enddesc @calls @history @endhistory @var CCTK_ARGUMENTS @vdesc Cactus argument list @vtype CCTK_* @vio in @endvar @returntype void @@*/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS) { int err; err = Boundary_RegisterPhysicalBC((CCTK_POINTER) cctkGH, (phys_bc_fn_ptr) &BndLinExtrap, "LinExtrap"); if (err) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Error %d when registering routine to handle \"LinExtrap\" " "boundary condition", err); } } /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` SampleBnd.h: ``` /*@@ @file SampleBnd.h @date 6 May 2003 @author David Rideout @desc Prototypes for boundary routines @enddesc @@*/ #ifndef _SAMPLEBND_H_ #define _SAMPLEBND_H_ #ifdef __cplusplus extern "C" { #endif /* data type for pointer to function which implements a physical boundary condition: */ typedef CCTK_INT (*const phys_bc_fn_ptr)(const CCTK_POINTER_TO_CONST, const CCTK_INT, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *); /* prototype for routine registed as providing 'LinExtrap' boundary condition */ int BndLinExtrap (const CCTK_POINTER_TO_CONST GH, const CCTK_INT num_vars, const CCTK_INT *var_indices, const CCTK_INT *faces, const CCTK_INT *widths, const CCTK_INT *table_handles); #ifdef __cplusplus } #endif #endif /* _SAMPLEBND_H_ */ ``` LinearExtrapBnd.c: ``` /*@@ @file LinearExtrapBnd.c @date 24 Jan 2003 @author David Rideout @desc Function which is registered as handling Carsten Gundlach's "linear_extrap_one_bndry" boundary condition @enddesc @history @hdate @hauthor @hdesc @endhistory @version $Id$ @@*/ #include "cctk.h" #include "util_Table.h" /* the rcs ID and its dummy function to use it */ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_LinearExtrapBnd_c); /* #define DEBUG */ /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* External Routine Prototypes ****************** ********************************************************************/ void CCTK_FCALL CCTK_FNAME(Linear_extrap_one_bndry)(int *doBC, const int *lsh, CCTK_REAL *var_ptr); int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables); /******************************************************************** ******************** Scheduled Routines *********************** ********************************************************************/ /******************************************************************** ******************** External Routines ************************ ********************************************************************/ /*@@ @routine BndLinExtrap @date 24 Jan 2003 @author David Rideout @desc Apply linear extrapolation boundary condition to a group of grid functions given by their indices. This routine is registered to handle the linear extrapolation boundary condition. Can only handle 3D grid functions. All symmetries are ignored for now -- the symmetry bcs must overwrite the output of this bc where necessary @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy @vtype const cGH * @vio in @endvar @var num_vars @vdesc number of variables passed in through vars[] @vtype int @vio in @endvar @var var_indices @vdesc array of variable indicies to which to apply this boundary condition @vtype int * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc @vtype int @vio in @endvar @var widths @vdesc array of boundary widths for each variable @vtype int @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments @vtype int @vio in @endvar @calls CCTK_GroupIndexFromVarI CCTK_GroupDimI CCTK_VarTypeI Linear_extrap_one_bndry @history @hdate @hauthor @hdesc @endhistory @returntype int @returndesc each bit of return value indicates a possible error code, as follows: 0 for success -1 invalid faces specification -2 unsupported staggering -4 boundary width != 1 -8 potentially valid table handle -16 dimension is not supported -32 possibly called with a grid scalar @endreturndesc @@*/ int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables) { int i, j, gi, gtype, dim, retval, err; int doBC[6]; const int *lsh, *bbox; CCTK_INT symtable; CCTK_INT symbnd[6]; CCTK_INT is_physical[6]; CCTK_REAL *var_ptr; cGroupDynamicData group_data; retval = 0; #ifdef DEBUG printf("calling BndLinExtrap at iter %d\n", GH->cctk_iteration); #endif /* loop through variables, one at a time (since this is all that Linear_extrap_one_bndry can handle) */ for (i=0; i<num_vars; ++i) { /* Check to see if faces specification is valid */ if (faces[i] != CCTK_ALL_FACES) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Faces specification %d for LinExtrap boundary conditions on " "%s is not implemented yet. " "Not applying bc.", faces[i], CCTK_VarName(vars[i])); retval |= 1; } /* Check to see if the boundary width might be something other than one */ if (widths[i] != 1) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "LinExtrapBnd does not handle boundary widths other than one." " Assuming boundary width of one on all faces."); retval |= 4; } /* Ignore table handles */ if (tables[i] >= 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Possibly valid table handle. LinExtrapBnd ignores " "information stored in tables."); retval |= 8; } /* Gather some important information about this grid variable */ gi = CCTK_GroupIndexFromVarI(vars[i]); gtype = CCTK_GroupTypeI(gi); if (gtype==CCTK_GF) { dim = GH->cctk_dim; bbox = GH->cctk_bbox; lsh = GH->cctk_lsh; } else { err = CCTK_GroupDynamicData(GH, gi, &group_data); if (err) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Error getting group information for group %s. " "Perhaps it is a grid scalar?", CCTK_GroupName(gi)); retval |= 32; } dim = group_data.dim; bbox = group_data.bbox; lsh = group_data.lsh; } var_ptr = GH->data[vars[i]][0]; #ifdef DEBUG printf("dim=%d bbox[0]=%d lsh[1]=%d\n", dim, bbox[0], lsh[1]); printf("var_ptr=%p\n", var_ptr); #endif /* Check dimension */ if (dim != 3) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Variable dimension of %d not supported. " "Not applying bc.", dim); retval |= 16; } /* Decide on which faces the bc should be applied */ for (j=0; j<2*dim; ++j) { doBC[j] = lsh[j/2] > widths[i]+2 && bbox[j]; } /* see if we have a physical boundary */ symtable = SymmetryTableHandleForGrid (GH); if (symtable < 0) CCTK_WARN (0, "internal error"); err = Util_TableGetIntArray (symtable, 2 * dim, symbnd, "symmetry_handle"); if (err != 2 * dim) CCTK_WARN (0, "internal error"); for (j = 0; j < 2 * dim; j++) { is_physical[j] = symbnd[j] < 0; } /* Only do bc on faces without a symmetry bc */ for (j=0; j<2*dim; ++j) { doBC[j] &= is_physical[i]; } /* Apply the boundary condition */ if( !( retval & ( 1 | 16 ) ) ) /* unless particularly bad errors */ CCTK_FNAME(Linear_extrap_one_bndry)(doBC, lsh, var_ptr); } return -retval; } /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` LinearExtrapBnd.F: ``` c This subroutine linearly extrapolates one Cactus variable c on one boundary of the Cactus grid box. C $Header$ #include "cctk.h" subroutine Linear_extrap_one_bndry(doBC, lsh, var) implicit none integer doBC(6) integer lsh(3) CCTK_REAL var(lsh(1),lsh(2),lsh(3)) integer nx,ny,nz C Grid parameters. nx = lsh(1) ny = lsh(2) nz = lsh(3) C Linear extrapolation from the interiors to the boundaries. C Does not support octant or quadrant. C 6 faces. if (doBC(1).eq.1) then var(1,:,:) = 2.d0 * var(2,:,:) - var(3,:,:) endif if (doBC(3).eq.1) then var(:,1,:) = 2.d0 * var(:,2,:) - var(:,3,:) endif if (doBC(5).eq.1) then var(:,:,1) = 2.d0 * var(:,:,2) - var(:,:,3) endif if (doBC(2).eq.1) then var(nx,:,:) = 2.d0 * var(nx-1,:,:) - var(nx-2,:,:) endif if (doBC(4).eq.1) then var(:,ny,:) = 2.d0 * var(:,ny-1,:) - var(:,ny-2,:) endif if (doBC(6).eq.1) then var(:,:,nz) = 2.d0 * var(:,:,nz-1) - var(:,:,nz-2) endif C 12 edges. C 4 round face x=min. if ( doBC(1).eq.1 $ .and. doBC(3).eq.1) then var(1,1,:) = 2.d0 * var(2,2,:) - var(3,3,:) end if if ( doBC(1).eq.1 $ .and. doBC(4).eq.1) then var(1,ny,:) = 2.d0 * var(2,ny-1,:) - var(2,ny-2,:) end if if ( doBC(1).eq.1 $ .and. doBC(5).eq.1) then var(1,:,1) = 2.d0 * var(2,:,2) - var(3,:,3) end if if ( doBC(1).eq.1 $ .and. doBC(6).eq.1) then var(1,:,nz) = 2.d0 * var(2,:,nz-1) - var(3,:,nz-2) end if C 4 around face x=max. if ( doBC(2).eq.1 $ .and. doBC(3).eq.1) then var(nx,1,:) = 2.d0 * var(nx-1,2,:) - var(nx-2,3,:) end if if ( doBC(2).eq.1 $ .and. doBC(4).eq.1) then var(nx,ny,:) = 2.d0 * var(nx-1,ny-1,:) - var(nx-2,ny-2,:) end if if ( doBC(2).eq.1 $ .and. doBC(5).eq.1) then var(nx,:,1) = 2.d0 * var(nx-1,:,2) - var(nx-2,:,3) end if if ( doBC(2).eq.1 $ .and. doBC(6).eq.1) then var(nx,:,nz) = 2.d0 * var(nx-1,:,nz-1) - var(nx-2,:,nz-2) end if C Remaining 2 in y=min. if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,1,1) = 2.d0 * var(:,2,2) - var(:,3,3) end if if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,1,nz) = 2.d0 * var(:,2,nz-1) - var(:,2,nz-2) end if C Remaining 2 in y=ymax. if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,ny,1) = 2.d0 * var(:,ny-1,2) - var(:,ny-2,3) end if if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,ny,nz) = 2.d0 * var(:,ny-1,nz-1) - var(:,ny-2,nz-2) end if C 8 corners. if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(1,1,1) = 2.d0*var(2,2,2) - var(3,3,3) end if if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(1,1,nz) = 2.d0*var(2,2,nz-1) - var(3,3,nz-2) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(1,ny,1) = 2.d0*var(2,ny-1,2) - var(3,ny-2,3) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(1,ny,nz) = 2.d0*var(2,ny-1,nz-1) - var(3,ny-2,nz-2) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(nx,1,1) = 2.d0*var(nx-1,2,2) - var(nx-2,3,3) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(nx,1,nz) = 2.d0*var(nx-1,2,nz-1) - var(nx-2,3,nz-2) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(nx,ny,1) = 2.d0*var(nx-1,ny-1,2) - var(nx-2,ny-2,3) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(nx,ny,nz) = 2.d0*var(nx-1,ny-1,nz-1) - var(nx-2,ny-2,nz-2) end if return end ```
=== documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn
documentation.tex
Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions.
README
## README (README): ``` Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn ```
CactusExamples/SampleBoundary
https://bitbucket.org/cactuscode/cactusexamples.git
# Interface definition for thorn SampleBoundary # $Header$ implements: LinExtrapBnd CCTK_INT FUNCTION Boundary_RegisterPhysicalBC(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN CCTK_FPOINTER function_pointer(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN num_vars, \ CCTK_INT ARRAY IN var_indices, \ CCTK_INT ARRAY IN faces, \ CCTK_INT ARRAY IN boundary_widths, \ CCTK_INT ARRAY IN table_handles),\ CCTK_STRING IN bc_name) USES FUNCTION Boundary_RegisterPhysicalBC CCTK_INT FUNCTION \ SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST IN cctkGH) USES FUNCTION SymmetryTableHandleForGrid
# Parameter definitions for thorn SampleBoundary # $Header$
# Schedule definitions for thorn SampleBoundary # $Header$ schedule SampleBoundary_RegisterBCs at CCTK_BASEGRID { lang: C } "Register boundary conditions that this thorn provides"
LinearExtrapBnd.F
c This subroutine linearly extrapolates one Cactus variable c on one boundary of the Cactus grid box. C $Header$ #include "cctk.h" subroutine Linear_extrap_one_bndry(doBC, lsh, var) implicit none integer doBC(6) integer lsh(3) CCTK_REAL var(lsh(1),lsh(2),lsh(3)) integer nx,ny,nz C Grid parameters. nx = lsh(1) ny = lsh(2) nz = lsh(3) C Linear extrapolation from the interiors to the boundaries. C Does not support octant or quadrant. C 6 faces. if (doBC(1).eq.1) then var(1,:,:) = 2.d0 * var(2,:,:) - var(3,:,:) endif if (doBC(3).eq.1) then var(:,1,:) = 2.d0 * var(:,2,:) - var(:,3,:) endif if (doBC(5).eq.1) then var(:,:,1) = 2.d0 * var(:,:,2) - var(:,:,3) endif if (doBC(2).eq.1) then var(nx,:,:) = 2.d0 * var(nx-1,:,:) - var(nx-2,:,:) endif if (doBC(4).eq.1) then var(:,ny,:) = 2.d0 * var(:,ny-1,:) - var(:,ny-2,:) endif if (doBC(6).eq.1) then var(:,:,nz) = 2.d0 * var(:,:,nz-1) - var(:,:,nz-2) endif C 12 edges. C 4 round face x=min. if ( doBC(1).eq.1 $ .and. doBC(3).eq.1) then var(1,1,:) = 2.d0 * var(2,2,:) - var(3,3,:) end if if ( doBC(1).eq.1 $ .and. doBC(4).eq.1) then var(1,ny,:) = 2.d0 * var(2,ny-1,:) - var(2,ny-2,:) end if if ( doBC(1).eq.1 $ .and. doBC(5).eq.1) then var(1,:,1) = 2.d0 * var(2,:,2) - var(3,:,3) end if if ( doBC(1).eq.1 $ .and. doBC(6).eq.1) then var(1,:,nz) = 2.d0 * var(2,:,nz-1) - var(3,:,nz-2) end if C 4 around face x=max. if ( doBC(2).eq.1 $ .and. doBC(3).eq.1) then var(nx,1,:) = 2.d0 * var(nx-1,2,:) - var(nx-2,3,:) end if if ( doBC(2).eq.1 $ .and. doBC(4).eq.1) then var(nx,ny,:) = 2.d0 * var(nx-1,ny-1,:) - var(nx-2,ny-2,:) end if if ( doBC(2).eq.1 $ .and. doBC(5).eq.1) then var(nx,:,1) = 2.d0 * var(nx-1,:,2) - var(nx-2,:,3) end if if ( doBC(2).eq.1 $ .and. doBC(6).eq.1) then var(nx,:,nz) = 2.d0 * var(nx-1,:,nz-1) - var(nx-2,:,nz-2) end if C Remaining 2 in y=min. if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,1,1) = 2.d0 * var(:,2,2) - var(:,3,3) end if if ( doBC(3).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,1,nz) = 2.d0 * var(:,2,nz-1) - var(:,2,nz-2) end if C Remaining 2 in y=ymax. if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(5).eq.1) then var(:,ny,1) = 2.d0 * var(:,ny-1,2) - var(:,ny-2,3) end if if ( doBC(4).eq.1 .and. ny.ge.4 $ .and. doBC(6).eq.1) then var(:,ny,nz) = 2.d0 * var(:,ny-1,nz-1) - var(:,ny-2,nz-2) end if C 8 corners. if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(1,1,1) = 2.d0*var(2,2,2) - var(3,3,3) end if if (doBC(1).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(1,1,nz) = 2.d0*var(2,2,nz-1) - var(3,3,nz-2) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(1,ny,1) = 2.d0*var(2,ny-1,2) - var(3,ny-2,3) end if if (doBC(1).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(1,ny,nz) = 2.d0*var(2,ny-1,nz-1) - var(3,ny-2,nz-2) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(5).eq.1) then var(nx,1,1) = 2.d0*var(nx-1,2,2) - var(nx-2,3,3) end if if (doBC(2).eq.1 .and. doBC(3).eq.1 .and. doBC(6).eq.1) then var(nx,1,nz) = 2.d0*var(nx-1,2,nz-1) - var(nx-2,3,nz-2) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(5).eq.1) then var(nx,ny,1) = 2.d0*var(nx-1,ny-1,2) - var(nx-2,ny-2,3) end if if (doBC(2).eq.1 .and. doBC(4).eq.1 .and. doBC(6).eq.1) then var(nx,ny,nz) = 2.d0*var(nx-1,ny-1,nz-1) - var(nx-2,ny-2,nz-2) end if return end
Register.c SampleBnd.h LinearExtrapBnd.c make.code.defn
Register.c: ``` /*@@ @file Register.c @date 6 May 2003 @author David Rideout @desc Register implemented boundary conditions. @enddesc @version $Header$ @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "SampleBnd.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_Register_c); /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* Local Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ***************** Aliased Routine Prototypes *********************** ********************************************************************/ /******************************************************************** ***************** Scheduled Routine Prototypes ********************* ********************************************************************/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS); /******************************************************************** ********************* Other Routine Prototypes ********************* ********************************************************************/ /******************************************************************** ********************* Local Data ***************************** ********************************************************************/ /******************************************************************** ********************* Aliased Routines *********************** ********************************************************************/ /******************************************************************** ********************* Scheduled Routines ********************* ********************************************************************/ /*@@ @routine SampleBoundary_RegisterBCs @date 6 May 2003 @author David Rideout @desc Register all boundary conditions implemented by this thorn. @enddesc @calls @history @endhistory @var CCTK_ARGUMENTS @vdesc Cactus argument list @vtype CCTK_* @vio in @endvar @returntype void @@*/ void SampleBoundary_RegisterBCs(CCTK_ARGUMENTS) { int err; err = Boundary_RegisterPhysicalBC((CCTK_POINTER) cctkGH, (phys_bc_fn_ptr) &BndLinExtrap, "LinExtrap"); if (err) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Error %d when registering routine to handle \"LinExtrap\" " "boundary condition", err); } } /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` SampleBnd.h: ``` /*@@ @file SampleBnd.h @date 6 May 2003 @author David Rideout @desc Prototypes for boundary routines @enddesc @@*/ #ifndef _SAMPLEBND_H_ #define _SAMPLEBND_H_ #ifdef __cplusplus extern "C" { #endif /* data type for pointer to function which implements a physical boundary condition: */ typedef CCTK_INT (*const phys_bc_fn_ptr)(const CCTK_POINTER_TO_CONST, const CCTK_INT, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *, const CCTK_INT *); /* prototype for routine registed as providing 'LinExtrap' boundary condition */ int BndLinExtrap (const CCTK_POINTER_TO_CONST GH, const CCTK_INT num_vars, const CCTK_INT *var_indices, const CCTK_INT *faces, const CCTK_INT *widths, const CCTK_INT *table_handles); #ifdef __cplusplus } #endif #endif /* _SAMPLEBND_H_ */ ``` LinearExtrapBnd.c: ``` /*@@ @file LinearExtrapBnd.c @date 24 Jan 2003 @author David Rideout @desc Function which is registered as handling Carsten Gundlach's "linear_extrap_one_bndry" boundary condition @enddesc @history @hdate @hauthor @hdesc @endhistory @version $Id$ @@*/ #include "cctk.h" #include "util_Table.h" /* the rcs ID and its dummy function to use it */ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_SampleBoundary_LinearExtrapBnd_c); /* #define DEBUG */ /******************************************************************** ********************* Local Data Types *********************** ********************************************************************/ /******************************************************************** ********************* External Routine Prototypes ****************** ********************************************************************/ void CCTK_FCALL CCTK_FNAME(Linear_extrap_one_bndry)(int *doBC, const int *lsh, CCTK_REAL *var_ptr); int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables); /******************************************************************** ******************** Scheduled Routines *********************** ********************************************************************/ /******************************************************************** ******************** External Routines ************************ ********************************************************************/ /*@@ @routine BndLinExtrap @date 24 Jan 2003 @author David Rideout @desc Apply linear extrapolation boundary condition to a group of grid functions given by their indices. This routine is registered to handle the linear extrapolation boundary condition. Can only handle 3D grid functions. All symmetries are ignored for now -- the symmetry bcs must overwrite the output of this bc where necessary @enddesc @var GH @vdesc Pointer to CCTK grid hierarchy @vtype const cGH * @vio in @endvar @var num_vars @vdesc number of variables passed in through vars[] @vtype int @vio in @endvar @var var_indices @vdesc array of variable indicies to which to apply this boundary condition @vtype int * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc @vtype int @vio in @endvar @var widths @vdesc array of boundary widths for each variable @vtype int @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments @vtype int @vio in @endvar @calls CCTK_GroupIndexFromVarI CCTK_GroupDimI CCTK_VarTypeI Linear_extrap_one_bndry @history @hdate @hauthor @hdesc @endhistory @returntype int @returndesc each bit of return value indicates a possible error code, as follows: 0 for success -1 invalid faces specification -2 unsupported staggering -4 boundary width != 1 -8 potentially valid table handle -16 dimension is not supported -32 possibly called with a grid scalar @endreturndesc @@*/ int BndLinExtrap (const cGH *GH, int num_vars, int *vars, int *faces, int *widths, int *tables) { int i, j, gi, gtype, dim, retval, err; int doBC[6]; const int *lsh, *bbox; CCTK_INT symtable; CCTK_INT symbnd[6]; CCTK_INT is_physical[6]; CCTK_REAL *var_ptr; cGroupDynamicData group_data; retval = 0; #ifdef DEBUG printf("calling BndLinExtrap at iter %d\n", GH->cctk_iteration); #endif /* loop through variables, one at a time (since this is all that Linear_extrap_one_bndry can handle) */ for (i=0; i<num_vars; ++i) { /* Check to see if faces specification is valid */ if (faces[i] != CCTK_ALL_FACES) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Faces specification %d for LinExtrap boundary conditions on " "%s is not implemented yet. " "Not applying bc.", faces[i], CCTK_VarName(vars[i])); retval |= 1; } /* Check to see if the boundary width might be something other than one */ if (widths[i] != 1) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "LinExtrapBnd does not handle boundary widths other than one." " Assuming boundary width of one on all faces."); retval |= 4; } /* Ignore table handles */ if (tables[i] >= 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Possibly valid table handle. LinExtrapBnd ignores " "information stored in tables."); retval |= 8; } /* Gather some important information about this grid variable */ gi = CCTK_GroupIndexFromVarI(vars[i]); gtype = CCTK_GroupTypeI(gi); if (gtype==CCTK_GF) { dim = GH->cctk_dim; bbox = GH->cctk_bbox; lsh = GH->cctk_lsh; } else { err = CCTK_GroupDynamicData(GH, gi, &group_data); if (err) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Error getting group information for group %s. " "Perhaps it is a grid scalar?", CCTK_GroupName(gi)); retval |= 32; } dim = group_data.dim; bbox = group_data.bbox; lsh = group_data.lsh; } var_ptr = GH->data[vars[i]][0]; #ifdef DEBUG printf("dim=%d bbox[0]=%d lsh[1]=%d\n", dim, bbox[0], lsh[1]); printf("var_ptr=%p\n", var_ptr); #endif /* Check dimension */ if (dim != 3) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, "Variable dimension of %d not supported. " "Not applying bc.", dim); retval |= 16; } /* Decide on which faces the bc should be applied */ for (j=0; j<2*dim; ++j) { doBC[j] = lsh[j/2] > widths[i]+2 && bbox[j]; } /* see if we have a physical boundary */ symtable = SymmetryTableHandleForGrid (GH); if (symtable < 0) CCTK_WARN (0, "internal error"); err = Util_TableGetIntArray (symtable, 2 * dim, symbnd, "symmetry_handle"); if (err != 2 * dim) CCTK_WARN (0, "internal error"); for (j = 0; j < 2 * dim; j++) { is_physical[j] = symbnd[j] < 0; } /* Only do bc on faces without a symmetry bc */ for (j=0; j<2*dim; ++j) { doBC[j] &= is_physical[i]; } /* Apply the boundary condition */ if( !( retval & ( 1 | 16 ) ) ) /* unless particularly bad errors */ CCTK_FNAME(Linear_extrap_one_bndry)(doBC, lsh, var_ptr); } return -retval; } /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ /******************************************************************** ********************* Local Routines ************************* ********************************************************************/ ``` make.code.defn: ``` # Main make.code.defn file for thorn SampleBoundary # $Header$ # Source files in this directory SRCS = Register.c LinearExtrapBnd.c LinearExtrapBnd.F # Subdirectories containing source files SUBDIRS = ```
=== documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn
documentation.tex
Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions.
README
## README (README): ``` Cactus Code Thorn SampleBoundary Author(s) : Carsten Gundlach David Rideout Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This thorn provides a simple example of how to create and register a physical boundary condition. It implements a linear extrapolation boundary condition in three dimensions. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} \title{Sample (Physical) Boundary Condition} \author{David Rideout} \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE \begin{abstract} Provides a simple linear extrapolation boundary condition, to serve as an example for people who wish to write their own physical boundary conditions. \end{abstract} \section{Introduction} This thorn provides a linear extrapolation boundary condition in three dimensions. It is intended as an example for writing physical boundary conditions. (See the ThornGuide for \texttt{CactusBase/Boundary} for details on Cactus boundary conditions.) It is registered under the name \texttt{LinearExtrap}. The code which actually implements the boundary condition is written in fixed form Fortran 90, in the file \texttt{LinearExtrapBnd.F}. This code was written by Carsten Gundlach, and is taken directly from the thorn \texttt{AEIThorns/Exact}. As such it illustrates a simple way to properly implement a boundary condition using Fortran code which was written long before the current boundary implementation specification. \section{Obtaining This Thorn} This thorn is provided within the \texttt{CactusExamples} arrangement, in the standard Cactus distribution. \section{Some Details} The \texttt{LinearExtrap} boundary condition registered by this thorn only works in three dimensions. The value on a boundary face is determined by fitting a straight line through the two points 'inside' of the boundary point. For the edges and corners, two points along the diagonal are used to determine the line. In this way the thorn also provides an example of how to handle edges and corners, though only in a dimension specific way. \section{Using This Thorn} To use this thorn, simply activate it in your parameter file, select some variables for the \texttt{LinearExtrap} boundary condition, and be sure that \texttt{ApplyBCs} (as e.g. \texttt{MyThorn\_ApplyBCs}) is scheduled at an appropriate point. %\section{Numerical Implementation} %\subsection{Special Behaviour} %\subsection{Interaction With Other Thorns} %\subsection{Examples} %\subsection{Support and Feedback} %\subsection{Thorn Source Code} %\subsection{Thorn Documentation} %\subsection{Acknowledgements} %\begin{thebibliography}{9} %\end{thebibliography} %\section{History} % Do not delete next line % END CACTUS THORNGUIDE \end{document} % LocalWords: LinearExtrap LinearExtrapBnd MyThorn ```
CactusExamples/WaveMoL
https://bitbucket.org/cactuscode/cactusexamples.git
# Configuration definition for thorn BSSN_MoL # $Header$ REQUIRES CartGrid3D Boundary
# Interface definition for thorn WaveMoL # $Header$ implements: wavemol USES INCLUDE: Symmetry.h CCTK_INT FUNCTION MoLRegisterEvolvedGroup(CCTK_INT IN EvolvedIndex, \ CCTK_INT IN RHSIndex) CCTK_INT FUNCTION MoLRegisterConstrained(CCTK_INT IN ConstrainedIndex) REQUIRES FUNCTION MoLRegisterEvolvedGroup REQUIRES FUNCTION MoLRegisterConstrained 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 var_name, CCTK_STRING IN bc_name) REQUIRES FUNCTION Boundary_SelectGroupForBC public cctk_real scalarevolvemol_scalar type = GF Timelevels = 3 tags='tensortypealias="Scalar"' { phi phit } "The scalar field and time derivative" cctk_real scalarevolvemol_vector type = GF Timelevels = 3 tags='tensortypealias="U"' { phix phiy phiz } "The scalar field spatial derivatives" cctk_real scalarrhsmol_scalar type = GF Timelevels = 1 { phirhs phitrhs } "The right hand side for the scalar field" cctk_real scalarrhsmol_vector type = GF Timelevels = 1 { phixrhs phiyrhs phizrhs } "The right hand side for the scalar field derivatives" cctk_real energy type = GF Timelevels = 1 "The energy of the field"
# Parameter definitions for thorn WaveMoL # $Header$ shares: MethodOfLines USES CCTK_INT MoL_Num_Evolved_Vars USES CCTK_INT MoL_Num_Constrained_Vars USES CCTK_INT MoL_Num_SaveAndRestore_Vars restricted: CCTK_INT WaveMoL_MaxNumEvolvedVars "The maximum number of evolved variables used by WaveMoL" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Evolved_Vars { 5:5 :: "Just 5: phi and the four derivatives" } 5 CCTK_INT WaveMoL_MaxNumConstrainedVars "The maximum number of constrained variables used by WaveMoL" ACCUMULATOR-BASE=MethodofLines::MoL_Num_Constrained_Vars { 1:1 :: "The energy" } 1 private: KEYWORD bound "Type of boundary condition to use" { "none" :: "No boundary condition" "flat" :: "Flat boundary condition" "radiation" :: "Radiation boundary condition" } "none"
# Schedule definitions for thorn WaveMoL # $Header$ STORAGE: scalarevolvemol_scalar[3], scalarevolvemol_vector[3] STORAGE: scalarrhsmol_scalar, scalarrhsmol_vector STORAGE: energy schedule WaveMoL_Startup at STARTUP { LANG: C } "Register Banner" schedule WaveMoL_InitSymBound at BASEGRID { LANG: C OPTIONS: META } "Schedule symmetries" schedule WaveMoL_RegisterVars in MoL_Register { LANG: C OPTIONS: META } "Register variables for MoL" schedule WaveMoL_CalcRHS in MoL_CalcRHS { LANG: C } "Register RHS calculation for MoL" schedule WaveMoL_Energy in MoL_PostStep { LANG: C } "Calculate the energy" schedule WaveMoL_Energy at POSTINITIAL { LANG: C } "Calculate the energy" schedule WaveMoL_Boundaries in MoL_PostStep { LANG: C OPTIONS: LEVEL SYNC: scalarevolvemol_scalar SYNC: scalarevolvemol_vector } "Register boundary enforcement in MoL" schedule GROUP ApplyBCs as WaveMoL_ApplyBCs in MoL_PostStep after WaveMoL_Boundaries { } "Apply boundary conditions for WaveMoL"
WaveMoLRegister.c
/*@@ @file WaveMoLRegister.c @date Fri Nov 9 13:47:07 2001 @author Ian Hawke @desc Routine to register the variables with the MoL thorn. @enddesc @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_WaveMoL_WaveMoLRegister_c) /* #ifndef DEBUG_MOL #define DEBUG_MOL #endif */ void WaveMoL_RegisterVars(CCTK_ARGUMENTS); /*@@ @routine WaveMoL_RegisterVars @date Fri Nov 9 13:47:41 2001 @author Ian Hawke @desc The registration routine. @enddesc @calls @calledby @history @endhistory @@*/ void WaveMoL_RegisterVars(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; CCTK_INT ierr = 0, group, rhs, var; group = CCTK_GroupIndex("wavemol::scalarevolvemol_scalar"); rhs = CCTK_GroupIndex("wavemol::scalarrhsmol_scalar"); if (CCTK_IsFunctionAliased("MoLRegisterEvolvedGroup")) { ierr += MoLRegisterEvolvedGroup(group, rhs); } else { CCTK_WARN(0, "MoL function not aliased"); ierr++; } group = CCTK_GroupIndex("wavemol::scalarevolvemol_vector"); rhs = CCTK_GroupIndex("wavemol::scalarrhsmol_vector"); if (CCTK_IsFunctionAliased("MoLRegisterEvolvedGroup")) { ierr += MoLRegisterEvolvedGroup(group, rhs); } else { CCTK_WARN(0, "MoL function MoLRegisterEvolvedGroup not aliased"); ierr++; } var = CCTK_VarIndex("wavemol::energy"); if (CCTK_IsFunctionAliased("MoLRegisterConstrained")) { ierr += MoLRegisterConstrained(var); } else { CCTK_WARN(0, "MoL function MoLRegisterConstrained not aliased"); ierr++; } if (ierr) CCTK_WARN(0,"Problems registering with MoL"); #ifdef DEBUG_MOL printf("If we've got this far, then we've done with wavetoy registration.\n"); #endif }
WaveMoL.c make.code.defn InitSymBound.c Startup.c
WaveMoL.c: ``` /*@@ @file WaveMoL.c @date Fri Nov 9 13:33:25 2001 @author Ian Hawke @desc The equivalent of WaveToy.c @enddesc @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" /* #ifndef DEBUG_MOL #define DEBUG_MOL #endif */ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_WaveMoL_WaveMoL_c) void WaveMoL_Boundaries(CCTK_ARGUMENTS); void WaveMoL_CalcRHS(CCTK_ARGUMENTS); void WaveMoL_Energy(CCTK_ARGUMENTS); /*@@ @routine WaveMoL_Boundaries @date Fri Nov 9 13:34:47 2001 @author Ian Hawke @desc A slight alteration of the standard routine. Note that I haven't set up the error checking correctly as yet. @enddesc @calls @calledby @history @endhistory @@*/ void WaveMoL_Boundaries(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; int ierr=-1; #ifdef DEBUG_MOL printf("We've reached the Boundary enforcement; step must be done!\n"); #endif /* Uses all default arguments, so invalid table handle -1 can be passed */ ierr = Boundary_SelectGroupForBC (cctkGH, CCTK_ALL_FACES, 1, -1, "wavemol::scalarevolvemol_scalar", bound); if (ierr < 0) { CCTK_WARN(0,"Boundary conditions not applied - giving up!"); } ierr = Boundary_SelectGroupForBC (cctkGH, CCTK_ALL_FACES, 1, -1, "wavemol::scalarevolvemol_vector", bound); if (ierr < 0) { CCTK_WARN(0,"Boundary conditions not applied - giving up!"); } return; } /*@@ @routine WaveMoL_CalcRHS @date Fri Nov 9 13:37:27 2001 @author Ian Hawke @desc The routine that calculates the RHS of the PDE for the MoL step. @enddesc @calls @calledby @history @endhistory @@*/ void WaveMoL_CalcRHS(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; int i,j,k; int index; int istart, jstart, kstart, iend, jend, kend; CCTK_REAL dx,dy,dz; CCTK_REAL hdxi, hdyi, hdzi; /* Set up shorthands */ dx = CCTK_DELTA_SPACE(0); dy = CCTK_DELTA_SPACE(1); dz = CCTK_DELTA_SPACE(2); hdxi = 0.5 / dx; hdyi = 0.5 / dy; hdzi = 0.5 / dz; istart = 1; jstart = 1; kstart = 1; iend = cctk_lsh[0]-1; jend = cctk_lsh[1]-1; kend = cctk_lsh[2]-1; /* Calculate the right hand sides. */ #ifdef DEBUG_MOL printf("About to loop.\n"); #endif for (k=0; k<cctk_lsh[2]; k++) { for (j=0; j<cctk_lsh[1]; j++) { for (i=0; i<cctk_lsh[0]; i++) { index = CCTK_GFINDEX3D(cctkGH,i,j,k); phirhs[index] = phit[index]; phitrhs[index] = 0; phixrhs[index] = 0; phiyrhs[index] = 0; phizrhs[index] = 0; } } } for (k=kstart; k<kend; k++) { for (j=jstart; j<jend; j++) { for (i=istart; i<iend; i++) { index = CCTK_GFINDEX3D(cctkGH,i,j,k); phitrhs[index] = (phix[CCTK_GFINDEX3D(cctkGH, i+1, j, k)] - phix[CCTK_GFINDEX3D(cctkGH, i-1, j, k)]) *hdxi + (phiy[CCTK_GFINDEX3D(cctkGH, i, j+1, k)] - phiy[CCTK_GFINDEX3D(cctkGH, i, j-1, k)]) *hdyi + (phiz[CCTK_GFINDEX3D(cctkGH, i, j, k+1)] - phiz[CCTK_GFINDEX3D(cctkGH, i, j, k-1)]) *hdzi; phixrhs[index] = (phit[CCTK_GFINDEX3D(cctkGH, i+1, j, k)] - phit[CCTK_GFINDEX3D(cctkGH, i-1, j, k)]) *hdxi; phiyrhs[index] = (phit[CCTK_GFINDEX3D(cctkGH, i, j+1, k)] - phit[CCTK_GFINDEX3D(cctkGH, i, j-1, k)]) *hdyi; phizrhs[index] = (phit[CCTK_GFINDEX3D(cctkGH, i, j, k+1)] - phit[CCTK_GFINDEX3D(cctkGH, i, j, k-1)]) *hdzi; #ifdef DEBUG_MOL printf("ijk %i %i %i, phitrhs %f\n",i,j,k,phitrhs[index]); #endif } } } #ifdef DEBUG_MOL printf("Done with loop\n"); #endif return; } /*@@ @routine WaveMoL_Energy @date Sat Jun 26 15:39:18 2004 @author Ian Hawke @desc Computes the energy d_t phi ^2 + d_x^i phi ^2. An illustration of using constrained MoL variables rather than anything useful. @enddesc @calls @calledby @history @endhistory @@*/ void WaveMoL_Energy(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; int i,j,k; int index; for (k=0; k<cctk_lsh[2]; k++) { for (j=0; j<cctk_lsh[1]; j++) { for (i=0; i<cctk_lsh[0]; i++) { index = CCTK_GFINDEX3D(cctkGH,i,j,k); energy[index] = phit[index]*phit[index] + phix[index]*phix[index] + phiy[index]*phiy[index] + phiz[index]*phiz[index]; } } } } ``` make.code.defn: ``` # Main make.code.defn file for thorn WaveMoL # $Header$ # Source files in this directory SRCS = WaveMoL.c InitSymBound.c Startup.c WaveMoLRegister.c # Subdirectories containing source files SUBDIRS = ``` InitSymBound.c: ``` /*@@ @file InitSymBound.c @date Fri Nov 9 13:29:53 2001 @author Ian Hawke @desc Sets the symmetries for Wave Toy - again copies the standard. @enddesc @@*/ #include "cctk.h" #include "cctk_Arguments.h" #include "Symmetry.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_WaveMoL_InitSymBound_c) void WaveMoL_InitSymBound(CCTK_ARGUMENTS); /*@@ @routine WaveMoL_InitSymBound @date Fri Nov 9 13:31:28 2001 @author Ian Hawke @desc Another straight copy of a wave toy routine, however extended for all the new GFs. @enddesc @calls @calledby @history @endhistory @@*/ void WaveMoL_InitSymBound(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; int sym[3]; sym[0] = 1; sym[1] = 1; sym[2] = 1; SetCartSymVN(cctkGH, sym,"wavemol::phi"); SetCartSymVN(cctkGH, sym,"wavemol::phit"); sym[0] = -1; sym[1] = 1; sym[2] = 1; SetCartSymVN(cctkGH, sym,"wavemol::phix"); sym[0] = 1; sym[1] = -1; sym[2] = 1; SetCartSymVN(cctkGH, sym,"wavemol::phiy"); sym[0] = 1; sym[1] = 1; sym[2] = -1; SetCartSymVN(cctkGH, sym,"wavemol::phiz"); return; } ``` Startup.c: ``` /*@@ @file Startup.c @date Fri Nov 9 13:27:48 2001 @author Ian Hawke @desc Register banner - a straight copy of WaveToy. @enddesc @@*/ #include "cctk.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusExamples_WaveMoL_Startup_c) int WaveMoL_Startup(void); /*@@ @routine WaveMoL_Startup @date Fri Nov 9 13:28:58 2001 @author Ian Hawke @desc Again a straight copy of WaveToyC @enddesc @calls @calledby @history @endhistory @@*/ int WaveMoL_Startup(void) { const char *banner = "WaveMoL: Evolutions of a Scalar Field"; CCTK_RegisterBanner(banner); return 0; } ```
=== documentation.tex === % *======================================================================* % Cactus Thorn template for ThornGuide documentation % Author: Ian Kelley % Date: Sun Jun 02, 2002 % $Header$ % % Thorn documentation in the latex file doc/documentation.tex % will be included in ThornGuides built with the Cactus make system. % The scripts employed by the make system automatically include % pages about variables, parameters and scheduling parsed from the % relevent thorn CCL files. % % This template contains guidelines which help to assure that your % documentation will be correctly added to ThornGuides. More % information is available in the Cactus UsersGuide. % % Guidelines: % - Do not change anything before the line % % START CACTUS THORNGUIDE", % except for filling in the title, author, date etc. fields. % - Each of these fields should only be on ONE line. % - Author names should be sparated with a \\ or a comma % - You can define your own macros, but they must appear after % the START CACTUS THORNGUIDE line, and must not redefine standard % latex commands. % - To avoid name clashes with other thorns, 'labels', 'citations', % 'references', and 'image' names should conform to the following % convention: % ARRANGEMENT_THORN_LABEL % For example, an image wave.eps in the arrangement CactusWave and % thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps % - Graphics should only be included using the graphix package. % More specifically, with the "includegraphics" command. Do % not specify any graphic file extensions in your .tex file. This % will allow us (later) to create a PDF version of the ThornGuide % via pdflatex. | % - References should be included with the latex "bibitem" command. % - Use \begin{abstract}...\end{abstract} instead of \abstract{...} % - Do not use \appendix, instead include any appendices you need as % standard sections. % - For the benefit of our Perl scripts, and for future extensions, % please use simple latex. % % *======================================================================* % % Example of including a graphic image: % \begin{figure}[ht] % \begin{center} % \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure} % \end{center} % \caption{Illustration of this and that} % \label{MyArrangement_MyThorn_MyLabel} % \end{figure} % % Example of using a label: % \label{MyArrangement_MyThorn_MyLabel} % % Example of a citation: % \cite{MyArrangement_MyThorn_Author99} % % Example of including a reference % \bibitem{MyArrangement_MyThorn_Author99} % {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999), % 1--16. {\tt http://www.nowhere.com/}} % % *======================================================================* % If you are using CVS use this line to give version information % $Header$ \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} % The author of the documentation \author{Ian Hawke} % The title of the document (not necessarily the name of the Thorn) \title{The scalar wave equation in Method of Lines form} % the date your document was last changed, if your document is in CVS, % please use: \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE % Add all definitions used in this documentation here % \def\mydef etc % Add an abstract for this thorn's documentation \begin{abstract} WaveMoL is an example implementation of a thorn that uses the method of lines thorn MoL. The wave equation in first order form is implemented. \end{abstract} % The following sections are suggestive only. % Remove them or add your own. % \section{Introduction} % \section{Physical System} % \section{Numerical Implementation} % \section{Using This Thorn} % \subsection{Obtaining This Thorn} % \subsection{Basic Usage} % \subsection{Special Behaviour} % \subsection{Interaction With Other Thorns} % \subsection{Examples} % \subsection{Support and Feedback} % \section{History} % \subsection{Thorn Source Code} % \subsection{Thorn Documentation} % \subsection{Acknowledgements} \section{Purpose} \label{sec:purpose} WaveToy is the simple test thorn that comes with Cactus as standard. This is written so that it solves the wave equation \begin{equation} \label{eq:wave1} \partial_t^2 \phi = \partial_{x^i}^2 \phi^i \end{equation} directly using the leapfrog scheme. This form of the equations isn't suitable for use with the method of lines. The purpose of this thorn is to rewrite the equations in first order form \begin{eqnarray} \label{eq:wave2} \partial_t \Phi & = & \partial_{x^i} \Pi^i, \\ \partial_t \Pi^j & = & \partial_{x^j} \Phi, \\ \partial_t \phi & = & \Phi, \\ \partial_{x^j} \phi & = & \Pi^j. \end{eqnarray} The first three equations (which expand to five separate PDEs) will be evolved. The final equation is used to set the initial data and can be thought of as a constraint. This will be implemented using simple second order differencing in space. Time evolution is performed by the method of lines thorn MoL. \section{How it works} \label{sec:details} The equations are evolved entirely using the method of lines thorn. So all we have to provide (for the evolution) is a method of calculating the right hand side of equation~(\ref{eq:wave2}) and boundary conditions. The boundary conditions are standard from wavetoy itself. The right hand side is calculated using second order centred finite differences. To be compatible with the method of lines thorn we must let it know that the GFs $(\phi, \Pi, \Phi^j)$ exist and where they are stored. They should all have at least two time levels (although the addition of extra time levels may not cause problems it's just wasting space). The GFs corresponding to the right hand sides must also be registered with the MoL thorn. These should only have one time level. MoL is informed of the existence of these grid functions through the accumulator parameters and the aliased functions. % Do not delete next line % END CACTUS THORNGUIDE \end{document}
documentation.tex
Cactus Code Thorn WaveMoL Author(s) : Ian Hawke Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This implements the wave equation in FOSH form for use with the Method of Lines thorn. Intended as a basic test.
README
## README (README): ``` Cactus Code Thorn WaveMoL Author(s) : Ian Hawke Maintainer(s): Cactus team Licence : LGPL -------------------------------------------------------------------------- 1. Purpose This implements the wave equation in FOSH form for use with the Method of Lines thorn. Intended as a basic test. ``` ## Documentation (.tex files): Files: documentation.tex ```tex === documentation.tex === % *======================================================================* % Cactus Thorn template for ThornGuide documentation % Author: Ian Kelley % Date: Sun Jun 02, 2002 % $Header$ % % Thorn documentation in the latex file doc/documentation.tex % will be included in ThornGuides built with the Cactus make system. % The scripts employed by the make system automatically include % pages about variables, parameters and scheduling parsed from the % relevent thorn CCL files. % % This template contains guidelines which help to assure that your % documentation will be correctly added to ThornGuides. More % information is available in the Cactus UsersGuide. % % Guidelines: % - Do not change anything before the line % % START CACTUS THORNGUIDE", % except for filling in the title, author, date etc. fields. % - Each of these fields should only be on ONE line. % - Author names should be sparated with a \\ or a comma % - You can define your own macros, but they must appear after % the START CACTUS THORNGUIDE line, and must not redefine standard % latex commands. % - To avoid name clashes with other thorns, 'labels', 'citations', % 'references', and 'image' names should conform to the following % convention: % ARRANGEMENT_THORN_LABEL % For example, an image wave.eps in the arrangement CactusWave and % thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps % - Graphics should only be included using the graphix package. % More specifically, with the "includegraphics" command. Do % not specify any graphic file extensions in your .tex file. This % will allow us (later) to create a PDF version of the ThornGuide % via pdflatex. | % - References should be included with the latex "bibitem" command. % - Use \begin{abstract}...\end{abstract} instead of \abstract{...} % - Do not use \appendix, instead include any appendices you need as % standard sections. % - For the benefit of our Perl scripts, and for future extensions, % please use simple latex. % % *======================================================================* % % Example of including a graphic image: % \begin{figure}[ht] % \begin{center} % \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure} % \end{center} % \caption{Illustration of this and that} % \label{MyArrangement_MyThorn_MyLabel} % \end{figure} % % Example of using a label: % \label{MyArrangement_MyThorn_MyLabel} % % Example of a citation: % \cite{MyArrangement_MyThorn_Author99} % % Example of including a reference % \bibitem{MyArrangement_MyThorn_Author99} % {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999), % 1--16. {\tt http://www.nowhere.com/}} % % *======================================================================* % If you are using CVS use this line to give version information % $Header$ \documentclass{article} % Use the Cactus ThornGuide style file % (Automatically used from Cactus distribution, if you have a % thorn without the Cactus Flesh download this from the Cactus % homepage at www.cactuscode.org) \usepackage{../../../../doc/latex/cactus} \begin{document} % The author of the documentation \author{Ian Hawke} % The title of the document (not necessarily the name of the Thorn) \title{The scalar wave equation in Method of Lines form} % the date your document was last changed, if your document is in CVS, % please use: \date{$ $Date$ $} \maketitle % Do not delete next line % START CACTUS THORNGUIDE % Add all definitions used in this documentation here % \def\mydef etc % Add an abstract for this thorn's documentation \begin{abstract} WaveMoL is an example implementation of a thorn that uses the method of lines thorn MoL. The wave equation in first order form is implemented. \end{abstract} % The following sections are suggestive only. % Remove them or add your own. % \section{Introduction} % \section{Physical System} % \section{Numerical Implementation} % \section{Using This Thorn} % \subsection{Obtaining This Thorn} % \subsection{Basic Usage} % \subsection{Special Behaviour} % \subsection{Interaction With Other Thorns} % \subsection{Examples} % \subsection{Support and Feedback} % \section{History} % \subsection{Thorn Source Code} % \subsection{Thorn Documentation} % \subsection{Acknowledgements} \section{Purpose} \label{sec:purpose} WaveToy is the simple test thorn that comes with Cactus as standard. This is written so that it solves the wave equation \begin{equation} \label{eq:wave1} \partial_t^2 \phi = \partial_{x^i}^2 \phi^i \end{equation} directly using the leapfrog scheme. This form of the equations isn't suitable for use with the method of lines. The purpose of this thorn is to rewrite the equations in first order form \begin{eqnarray} \label{eq:wave2} \partial_t \Phi & = & \partial_{x^i} \Pi^i, \\ \partial_t \Pi^j & = & \partial_{x^j} \Phi, \\ \partial_t \phi & = & \Phi, \\ \partial_{x^j} \phi & = & \Pi^j. \end{eqnarray} The first three equations (which expand to five separate PDEs) will be evolved. The final equation is used to set the initial data and can be thought of as a constraint. This will be implemented using simple second order differencing in space. Time evolution is performed by the method of lines thorn MoL. \section{How it works} \label{sec:details} The equations are evolved entirely using the method of lines thorn. So all we have to provide (for the evolution) is a method of calculating the right hand side of equation~(\ref{eq:wave2}) and boundary conditions. The boundary conditions are standard from wavetoy itself. The right hand side is calculated using second order centred finite differences. To be compatible with the method of lines thorn we must let it know that the GFs $(\phi, \Pi, \Phi^j)$ exist and where they are stored. They should all have at least two time levels (although the addition of extra time levels may not cause problems it's just wasting space). The GFs corresponding to the right hand sides must also be registered with the MoL thorn. These should only have one time level. MoL is informed of the existence of these grid functions through the accumulator parameters and the aliased functions. % Do not delete next line % END CACTUS THORNGUIDE \end{document} ```
CactusExamples/WaveMoL
https://bitbucket.org/cactuscode/cactusexamples.git
# Configuration definition for thorn BSSN_MoL # $Header$ REQUIRES CartGrid3D Boundary
"# Interface definition for thorn WaveMoL\n# $Header$\n\nimplements: wavemol\n\nUSES INCLUDE: Symmet(...TRUNCATED)
"# Parameter definitions for thorn WaveMoL\n# $Header$\n\nshares: MethodOfLines\n\nUSES CCTK_INT MoL(...TRUNCATED)
"# Schedule definitions for thorn WaveMoL\n# $Header$\n\nSTORAGE: scalarevolvemol_scalar[3], scalare(...TRUNCATED)
WaveMoL.c
" /*@@\n @file WaveMoL.c\n @date Fri Nov 9 13:33:25 2001\n @author Ian Hawke\n (...TRUNCATED)
WaveMoLRegister.c make.code.defn InitSymBound.c Startup.c
"WaveMoLRegister.c:\n```\n /*@@\n @file WaveMoLRegister.c\n @date Fri Nov 9 13:47:07 (...TRUNCATED)
"=== documentation.tex ===\n% *=====================================================================(...TRUNCATED)
documentation.tex
"Cactus Code Thorn WaveMoL\nAuthor(s) : Ian Hawke\nMaintainer(s): Cactus team\nLicence : LGP(...TRUNCATED)
README
"## README (README):\n```\nCactus Code Thorn WaveMoL\nAuthor(s) : Ian Hawke\nMaintainer(s): Cactu(...TRUNCATED)
CactusExamples/WaveMoL
https://bitbucket.org/cactuscode/cactusexamples.git
# Configuration definition for thorn BSSN_MoL # $Header$ REQUIRES CartGrid3D Boundary
"# Interface definition for thorn WaveMoL\n# $Header$\n\nimplements: wavemol\n\nUSES INCLUDE: Symmet(...TRUNCATED)
"# Parameter definitions for thorn WaveMoL\n# $Header$\n\nshares: MethodOfLines\n\nUSES CCTK_INT MoL(...TRUNCATED)
"# Schedule definitions for thorn WaveMoL\n# $Header$\n\nSTORAGE: scalarevolvemol_scalar[3], scalare(...TRUNCATED)
make.code.defn
"# Main make.code.defn file for thorn WaveMoL\n# $Header$\n\n# Source files in this directory\nSRCS (...TRUNCATED)
WaveMoLRegister.c WaveMoL.c InitSymBound.c Startup.c
"WaveMoLRegister.c:\n```\n /*@@\n @file WaveMoLRegister.c\n @date Fri Nov 9 13:47:07 (...TRUNCATED)
"=== documentation.tex ===\n% *=====================================================================(...TRUNCATED)
documentation.tex
"Cactus Code Thorn WaveMoL\nAuthor(s) : Ian Hawke\nMaintainer(s): Cactus team\nLicence : LGP(...TRUNCATED)
README
"## README (README):\n```\nCactus Code Thorn WaveMoL\nAuthor(s) : Ian Hawke\nMaintainer(s): Cactu(...TRUNCATED)
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
5