User: rhaas Date: 2013/05/10 11:37 PM
Added: /CartesianCoordinates/ README, interface.ccl, param.ccl, schedule.ccl /CartesianCoordinates/doc/ documentation.tex /CartesianCoordinates/src/ init.c, make.code.defn, util.c
Log: CartesianCoordinates: import from Zelmani a78ba3bf78b84134a0146284a58e8957afe9667b
CartesianCoordinates provides a minimal implementation of Llama's Coordinates interface with only Cartesian coordinates available. It is useful to run thorns that require Coordinates when not actually using multipatches at all.
Directory Changes:
Directory: /svn:mime-type/ ==========================
+ text/x-csrc
File Changes:
Directory: /CartesianCoordinates/ =================================
File [added]: README Delta lines: +7 -0 =================================================================== --- CartesianCoordinates/README (rev 0) +++ CartesianCoordinates/README 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,7 @@ +Cactus Code Thorn CartesianCoordinates +Thorn Author(s) : Christian Reisswig reisswig@aei.mpg.de +Thorn Maintainer(s) : Christian Reisswig reisswig@aei.mpg.de +-------------------------------------------------------------------------- + +Purpose of the thorn: +
File [added]: interface.ccl Delta lines: +52 -0 =================================================================== --- CartesianCoordinates/interface.ccl (rev 0) +++ CartesianCoordinates/interface.ccl 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,52 @@ +# Interface definition for thorn CartesianCoordinates + +implements: Coordinates +inherits: Grid + +CCTK_INT FUNCTION \ + MultiPatch_GetMap \ + (CCTK_POINTER_TO_CONST IN cctkGH) +PROVIDES FUNCTION MultiPatch_GetMap \ + WITH CartesianCoordinates_GetMap \ + LANGUAGE C + +public: + +int general_coordinates type=SCALAR tags='checkpoint="no"' \ + "Compute derivatives for generalised coordinates, involving a non-trivial Jacobian" + +int interpolate_boundary_points type=SCALAR tags='checkpoint="no"' \ + "Interpolate to points which are on both an inter-patch boundary and an outer boundary" + +int jacobian_state type=SCALAR tags='checkpoint="no"' \ + "State of storage for jacobian" + +int jacobian_derivative_state type=SCALAR tags='checkpoint="no"' \ + "State of storage for derivative of jacobian" + +int inverse_jacobian_state type=SCALAR tags='checkpoint="no"' \ + "State of storage for inverse jacobian" + +int volume_form_state type=SCALAR tags='checkpoint="no"' \ + "State of storage for volume form" + + +real jacobian type=GF timelevels=1 tags='checkpoint="no" prolongation="none"' +{ + J11, J12, J13, J21, J22, J23, J31, J32, J33 +} "Jacobian d[global]/d[local] of the coordinate transformation" + +real inverse_jacobian type=GF timelevels=1 tags='checkpoint="no" prolongation="none"' +{ + iJ11, iJ12, iJ13, iJ21, iJ22, iJ23, iJ31, iJ32, iJ33 +} "Jacobian J_(ik) = dx^i/da^k of the inverse coordinate transformation (a: local, x: global)" + +real jacobian2 type=GF timelevels=1 tags='checkpoint="no" prolongation="none"' +{ + dJ111, dJ112, dJ113, dJ122, dJ123, dJ133, + dJ211, dJ212, dJ213, dJ222, dJ223, dJ233, + dJ311, dJ312, dJ313, dJ322, dJ323, dJ333, +} "Derivative of the Jacobian d^2[global]/d[local]^2" + + +real volume_form type=GF timelevels=1 tags='checkpoint="no" prolongation="none"' "Determinant of Jacobian and nominal grid mask"
File [added]: param.ccl Delta lines: +29 -0 =================================================================== --- CartesianCoordinates/param.ccl (rev 0) +++ CartesianCoordinates/param.ccl 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,29 @@ +# Parameter definitions for thorn CartesianCoordinates + +restricted: + +keyword coordinate_system "Available patch systems" +{ + "Cartesian" :: "Standard CartGrid3D cartesian coordinates" +} "Cartesian" + +private: + +# Choices about storage + +boolean store_jacobian "Store the transformation da^i/dx^k (a: local, x: global), for compatibility with Llama/Coordinates" +{ +} "no" + +boolean store_jacobian_derivative "Store the derivative of the Jacobian d^2[global]/d[local]^2, for compatibility with Llama/Coordinates" +{ +} "no" + +boolean store_inverse_jacobian "Store the transformation dx^i/da^k (a: local, x: global), for compatibility with Llama/Coordinates" +{ +} "no" + +boolean store_volume_form "Store determinant of Jacobian, for compatibility with Llama/Coordinates" +{ +} "no" +
File [added]: schedule.ccl Delta lines: +44 -0 =================================================================== --- CartesianCoordinates/schedule.ccl (rev 0) +++ CartesianCoordinates/schedule.ccl 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,44 @@ +# Schedule definitions for thorn CartesianCoordinates + +STORAGE: general_coordinates +STORAGE: jacobian_state +STORAGE: jacobian_derivative_state +STORAGE: inverse_jacobian_state +STORAGE: volume_form_state + +if (store_jacobian) +{ + STORAGE: jacobian +} + +if (store_jacobian_derivative) +{ + STORAGE: jacobian2 +} + +if (store_inverse_jacobian) +{ + STORAGE: inverse_jacobian +} + +if (store_volume_form) +{ + STORAGE: volume_form +} + +SCHEDULE GROUP Coordinates_SetGlobalCoords_Group AT BASEGRID +{ +} "Determine the global coordinates at each grid point." + +schedule group Coordinates_SetGlobalCoords_Group at CCTK_POSTREGRIDINITIAL +{ +} "Determine the global coordinates of each gridpoint." + +schedule group Coordinates_SetGlobalCoords_Group at CCTK_POSTREGRID +{ +} "Determine the global coordinates of each gridpoint." + +SCHEDULE CartesianCoordinates_Init in Coordinates_SetGlobalCoords_Group +{ + LANG: C +} "Make clear that we have a trivial coordinate system"
Directory: /CartesianCoordinates/doc/ =====================================
File [added]: documentation.tex Delta lines: +144 -0 =================================================================== --- CartesianCoordinates/doc/documentation.tex (rev 0) +++ CartesianCoordinates/doc/documentation.tex 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,144 @@ +% *======================================================================* +% Cactus Thorn template for ThornGuide documentation +% Author: Ian Kelley +% Date: Sun Jun 02, 2002 +% $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $ +% +% 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/%7D%7D +% +% *======================================================================* + +% If you are using CVS use this line to give version information +% $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $ + +\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{Christian Reisswig \textless reisswig@aei.mpg.de\textgreater} + +% The title of the document (not necessarily the name of the Thorn) +\title{CartesianCoordinates} + +% the date your document was last changed, if your document is in CVS, +% please use: +% \date{$ $Date: 2004/01/07 20:12:39 $ $} +\date{February 29 2008} + +\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}
Property changes on: CartesianCoordinates/doc/documentation.tex ___________________________________________________________________
Directory: /CartesianCoordinates/src/ =====================================
File [added]: init.c Delta lines: +113 -0 =================================================================== --- CartesianCoordinates/src/init.c (rev 0) +++ CartesianCoordinates/src/init.c 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,113 @@ +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" + +void CartesianCoordinates_Init(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + *general_coordinates = 0; + + + if (store_jacobian) + { + *jacobian_state = 1; + + 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) + { + const int ijk = CCTK_GFINDEX3D(cctkGH, i,j,k); + J11[ijk] = 1.0; + J12[ijk] = 0.0; + J13[ijk] = 0.0; + + J21[ijk] = 0.0; + J22[ijk] = 1.0; + J23[ijk] = 0.0; + + J31[ijk] = 0.0; + J32[ijk] = 0.0; + J33[ijk] = 1.0; + + } + } + } + } + else + { + *jacobian_state = 0; + } + + if (store_jacobian_derivative) + { + *jacobian_derivative_state = 1; + + 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) + { + const int ijk = CCTK_GFINDEX3D(cctkGH, i,j,k); + + dJ111[ijk] = 0.0; dJ112[ijk] = 0.0; dJ113[ijk] = 0.0; dJ122[ijk] = 0.0; dJ123[ijk] = 0.0; dJ133[ijk] = 0.0; + dJ211[ijk] = 0.0; dJ212[ijk] = 0.0; dJ213[ijk] = 0.0; dJ222[ijk] = 0.0; dJ223[ijk] = 0.0; dJ233[ijk] = 0.0; + dJ311[ijk] = 0.0; dJ312[ijk] = 0.0; dJ313[ijk] = 0.0; dJ322[ijk] = 0.0; dJ323[ijk] = 0.0; dJ333[ijk] = 0.0; + } + } + } + } + + if (store_inverse_jacobian) + { + *inverse_jacobian_state = 1; + + 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) + { + const int ijk = CCTK_GFINDEX3D(cctkGH, i,j,k); + iJ11[ijk] = 1.0; + iJ12[ijk] = 0.0; + iJ13[ijk] = 0.0; + + iJ21[ijk] = 0.0; + iJ22[ijk] = 1.0; + iJ23[ijk] = 0.0; + + iJ31[ijk] = 0.0; + iJ32[ijk] = 0.0; + iJ33[ijk] = 1.0; + + } + } + } + } + else + { + *inverse_jacobian_state = 0; + } + + if (store_volume_form) + { + *volume_form_state = 1; + + 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) + { + const int ijk = CCTK_GFINDEX3D(cctkGH, i,j,k); + // this is the product of the _coarse_ grid spacing: during redcution, Carpet will automatically rescale + // the fine grids! + volume_form[ijk] = cctk_delta_space[0]*cctk_delta_space[1]*cctk_delta_space[2]; + } + } + } + } + else + { + *volume_form_state = 0; + } +} + +
Property changes on: CartesianCoordinates/src/init.c ___________________________________________________________________
File [added]: make.code.defn Delta lines: +7 -0 =================================================================== --- CartesianCoordinates/src/make.code.defn (rev 0) +++ CartesianCoordinates/src/make.code.defn 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,7 @@ +# Main make.code.defn file for thorn CartesianCoordinates + +# Source files in this directory +SRCS = init.c util.c + +# Subdirectories containing source files +SUBDIRS =
File [added]: util.c Delta lines: +22 -0 =================================================================== --- CartesianCoordinates/src/util.c (rev 0) +++ CartesianCoordinates/src/util.c 2013-05-11 04:37:34 UTC (rev 80) @@ -0,0 +1,22 @@ +#include "cctk.h" + +CCTK_INT +CartesianCoordinates_GetBbox(CCTK_POINTER_TO_CONST const GH, + CCTK_INT const size, + CCTK_INT * const bbox) +{ + const cGH* const cctkGH = (const cGH* const) GH; + + for (int i=0; i<6; ++i) + bbox[i] = cctkGH->cctk_bbox[i]; + + return 0; +} + + +CCTK_INT +CartesianCoordinates_GetMap(CCTK_POINTER_TO_CONST const GH) +{ + const cGH* const cctkGH = (const cGH* const) GH; + return 0; +}
Property changes on: CartesianCoordinates/src/util.c ___________________________________________________________________