-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GridX: explore if one can provide a Grid implementation for CarpetX
- Loading branch information
Showing
8 changed files
with
378 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Cactus Code Thorn GridX | ||
Author(s) : Roland Haas <[email protected]> | ||
Maintainer(s): Roland Haas <[email protected]> | ||
Licence : NCSA | ||
-------------------------------------------------------------------------- | ||
|
||
1. Purpose | ||
|
||
not documented |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Configuration definitions for thorn GridX | ||
|
||
REQUIRES Loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
% *======================================================================* | ||
% 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{Roland Haas \textless [email protected]\textgreater} | ||
|
||
% The title of the document (not necessarily the name of the Thorn) | ||
\title{GridX} | ||
|
||
% the date your document was last changed, if your document is in CVS, | ||
% please use: | ||
% \date{$ $Date$ $} | ||
% when using git instead record the commit ID: | ||
% \date{\gitrevision{<path-to-your-.git-directory>}} | ||
\date{March 22 2024} | ||
|
||
\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} | ||
|
||
\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} | ||
|
||
|
||
\begin{thebibliography}{9} | ||
|
||
\end{thebibliography} | ||
|
||
% Do not delete next line | ||
% END CACTUS THORNGUIDE | ||
|
||
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Interface definition for thorn GridX | ||
implements: Grid | ||
inherits: CoordBase | ||
|
||
USES INCLUDE HEADER: loop_device.hxx | ||
|
||
public: | ||
|
||
REAL gridspacings type=SCALAR tags='Checkpoint="no"' | ||
{ | ||
coarse_dx, coarse_dy, coarse_dz | ||
} "3D Cartesian grid spacings" | ||
|
||
REAL coordinates type=GF tags='Prolongation="None" Checkpoint="no"' | ||
{ | ||
x, y, z, r | ||
} "3D Cartesian grid coordinates" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Parameter definitions for thorn GridX | ||
|
||
# TODO: all ignored for now | ||
|
||
restricted: | ||
|
||
REAL dx "Coarse grid spacing in x-direction" | ||
{ | ||
0:* :: "Positive" | ||
} 0.3 | ||
REAL dy "Coarse grid spacing in y-direction" | ||
{ | ||
0:* :: "Positive" | ||
} 0.3 | ||
REAL dz "Coarse grid spacing in z-direction" | ||
{ | ||
0:* :: "Positive" | ||
} 0.3 | ||
REAL dxyz "Coarse grid spacing in x,y,z-directions" | ||
{ | ||
0:* :: "Positive" | ||
} 0.0 | ||
|
||
|
||
REAL xmin "Coordinate minimum in x-direction" | ||
{ | ||
: :: "Anything" | ||
} -1.0 | ||
REAL ymin "Coordinate minimum in y-direction" | ||
{ | ||
: :: "Anything" | ||
} -1.0 | ||
REAL zmin "Coordinate minimum in z-direction" | ||
{ | ||
: :: "Anything" | ||
} -1.0 | ||
REAL xyzmin "Coordinate minimum in x,y,z-directions" | ||
{ | ||
: :: "Anything" | ||
} -424242 | ||
|
||
|
||
REAL xmax "Coordinate maximum in x-direction" | ||
{ | ||
: :: "Anything" | ||
} 1.0 | ||
REAL ymax "Coordinate maximum in y-direction" | ||
{ | ||
: :: "Anything" | ||
} 1.0 | ||
REAL zmax "Coordinate maximum in z-direction" | ||
{ | ||
: :: "Anything" | ||
} 1.0 | ||
REAL xyzmax "Coordinate maximum in xyz-directions" | ||
{ | ||
: :: "Anything" | ||
} -424242 | ||
|
||
|
||
KEYWORD type "Grid type" | ||
{ | ||
"box" :: "Box grid from -0.5 to 0.5" | ||
"byrange" :: "Specify min and max values" | ||
"byspacing" :: "Specify grid spacings" | ||
"coordbase" :: "Get specification from CoordBase" | ||
"multipatch" :: "Get specification from MultiPatch" | ||
} "box" | ||
|
||
KEYWORD domain "Domain type" | ||
{ | ||
"octant" :: "Use an octant about the origin" | ||
"quadrant" :: "Use a quadrant in x-y plane" | ||
"quadrant_reflect_rotate" :: "Use a quadrant with rotation symmetry about an axis" | ||
"bitant" :: "Use a bitant about the x-y plane" | ||
"bitant_rotate" :: "Use a bitant with rotation symmetry about an axis" | ||
"full" :: "Use the full domain" | ||
} "full" | ||
|
||
KEYWORD bitant_plane "Plane defining bitant domain" | ||
{ | ||
"xy" :: "xy-plane" | ||
"xz" :: "xz-plane" | ||
"yz" :: "yz-plane" | ||
} "xy" | ||
|
||
KEYWORD quadrant_direction "Direction defining quadrant domain" | ||
{ | ||
"x" :: "x-direction" | ||
"y" :: "y-direction" | ||
"z" :: "z-direction" | ||
} "z" | ||
|
||
KEYWORD rotation_axis "Axis about which the rotation symmetry is to be applied" | ||
{ | ||
"x" :: "x-axis" | ||
"y" :: "y-axis" | ||
"z" :: "z-axis" | ||
} "z" | ||
|
||
|
||
BOOLEAN symmetry_xmin "Symmetry boundary condition on lower x boundary" | ||
{ | ||
: :: "Logical" | ||
} "no" | ||
|
||
BOOLEAN symmetry_ymin "Symmetry boundary condition on lower y boundary" | ||
{ | ||
: :: "Logical" | ||
} "no" | ||
|
||
BOOLEAN symmetry_zmin "Symmetry boundary condition on lower z boundary" | ||
{ | ||
: :: "Logical" | ||
} "no" | ||
|
||
BOOLEAN symmetry_xmax "Symmetry boundary condition on upper x boundary" | ||
{ | ||
: :: "Logical" | ||
} "no" | ||
|
||
BOOLEAN symmetry_ymax "Symmetry boundary condition on upper y boundary" | ||
{ | ||
: :: "Logical" | ||
} "no" | ||
|
||
BOOLEAN symmetry_zmax "Symmetry boundary condition on upper z boundary" | ||
{ | ||
: :: "Logical" | ||
} "no" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Schedule definitions for thorn GridX | ||
|
||
STORAGE: coordinates gridspacings | ||
|
||
schedule GridX_SetRanges at CCTK_BASEGRID as SpatialSpacings before SpatialCoordinates | ||
{ | ||
LANG:C | ||
WRITES: GRID::gridspacings(everywhere) | ||
} "Set up ranges for spatial 3D Cartesian coordinates (on all grids)" | ||
|
||
# TODO: schedule in postregrid, don't rely on CarpetX scheduling BaseGrid on | ||
# its own | ||
schedule GridX_SetCoordinates as SpatialCoordinates at CCTK_BASEGRID | ||
{ | ||
LANG:C | ||
WRITES: GRID::coordinates(everywhere) | ||
} "Set up spatial 3D Cartesian coordinates on the GH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "cctk.h" | ||
#include "cctk_Arguments.h" | ||
#include "cctk_Parameters.h" | ||
|
||
#include <cmath> | ||
#include <cassert> | ||
|
||
#include "loop_device.hxx" | ||
|
||
// TODO: this should not call itself "grid" since it only provides spacings and | ||
// coords and would alos be used with non-Cartesian grids but Cartesian point | ||
// labels | ||
|
||
extern "C" | ||
void GridX_SetRanges(CCTK_ARGUMENTS) { | ||
DECLARE_CCTK_PARAMETERS; | ||
DECLARE_CCTK_ARGUMENTSX_GridX_SetRanges; | ||
|
||
static int level_run_on = -1; | ||
static int patch_run_on = -1; | ||
|
||
#pragma omp critical | ||
if(level_run_on == -1 || level_run_on > cctk_level || | ||
patch_run_on == -1 || patch_run_on > cctk_patch) { | ||
assert((level_run_on == -1 && patch_run_on == -1) || | ||
(level_run_on != -1 || patch_run_on != -1)); | ||
*coarse_dx = cctk_delta_space[0]; | ||
*coarse_dy = cctk_delta_space[1]; | ||
*coarse_dz = cctk_delta_space[2]; | ||
level_run_on = cctk_level; | ||
patch_run_on = cctk_patch; | ||
} | ||
} | ||
|
||
extern "C" | ||
void GridX_SetCoordinates(CCTK_ARGUMENTS) { | ||
DECLARE_CCTK_PARAMETERS; | ||
DECLARE_CCTK_ARGUMENTSX_GridX_SetCoordinates; | ||
|
||
grid.loop_all_device<0,0,0>( | ||
grid.nghostzones, | ||
[=] CCTK_DEVICE(const Loop::PointDesc &p) CCTK_ATTRIBUTE_ALWAYS_INLINE { | ||
x(p.I) = p.x; | ||
y(p.I) = p.x; | ||
z(p.I) = p.x; | ||
r(p.I) = sqrt(p.x*p.x + p.y*p.y + p.z*p.z); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Main make.code.defn file for thorn GridX | ||
|
||
# Source files in this directory | ||
SRCS = grid.cc | ||
|
||
# Subdirectories containing source files | ||
SUBDIRS = |