From 610bb2b5de5eeccc0e78cdcaf99dbe0be92ad80c Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 24 Nov 2009 21:52:24 +0000 Subject: Add three thorns ID_Bin_BH, ID_Bin_NS, and ID_Mag_NS that import LORENE initial data. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinInitialData/Meudon_Mag_NS/trunk@2 9a8dfbc3-8997-403f-b745-98a780c092cc --- README | 12 ++++ configuration.ccl | 3 + doc/documentation.tex | 144 +++++++++++++++++++++++++++++++++++++++++ interface.ccl | 5 ++ param.ccl | 41 ++++++++++++ schedule.ccl | 18 ++++++ src/Mag_NS.cc | 166 ++++++++++++++++++++++++++++++++++++++++++++++++ src/check_parameters.cc | 21 ++++++ src/make.code.defn | 7 ++ 9 files changed, 417 insertions(+) create mode 100644 README create mode 100644 configuration.ccl create mode 100644 doc/documentation.tex create mode 100644 interface.ccl create mode 100644 param.ccl create mode 100644 schedule.ccl create mode 100644 src/Mag_NS.cc create mode 100644 src/check_parameters.cc create mode 100644 src/make.code.defn diff --git a/README b/README new file mode 100644 index 0000000..a7b8a72 --- /dev/null +++ b/README @@ -0,0 +1,12 @@ +Cactus Code Thorn ID_Mag_NS +Author(s) : Erik Schnetter +Maintainer(s): Erik Schnetter +Licence : GPL +-------------------------------------------------------------------------- + +1. Purpose + +Import LORENE Mag_NS magnetised neutron star initial data. + +This thorn is one of three closely related thorns ID_Bin_BH, +ID_Bin_NS, and ID_Mag_NS which all import LORENE initial data. diff --git a/configuration.ccl b/configuration.ccl new file mode 100644 index 0000000..44ac876 --- /dev/null +++ b/configuration.ccl @@ -0,0 +1,3 @@ +# Configuration definition for thorn ID_Mag_NS + +REQUIRES LORENE diff --git a/doc/documentation.tex b/doc/documentation.tex new file mode 100644 index 0000000..7d1f411 --- /dev/null +++ b/doc/documentation.tex @@ -0,0 +1,144 @@ +% *======================================================================* +% 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@cct.lsu.edu\textgreater} + +% The title of the document (not necessarily the name of the Thorn) +\title{ID\_Bin\_BH} + +% the date your document was last changed, if your document is in CVS, +% please use: +% \date{$ $Date$ $} +\date{November 24 2009} + +\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} diff --git a/interface.ccl b/interface.ccl new file mode 100644 index 0000000..3f58e3b --- /dev/null +++ b/interface.ccl @@ -0,0 +1,5 @@ +# Interface definition for thorn ID_Mag_NS + +IMPLEMENTS: ID_Mag_NS + +INHERITS: grid ADMBase HydroBase diff --git a/param.ccl b/param.ccl new file mode 100644 index 0000000..b154c6f --- /dev/null +++ b/param.ccl @@ -0,0 +1,41 @@ +# Parameter definitions for thorn ID_Mag_NS + +SHARES: ADMBase + +EXTENDS KEYWORD initial_data +{ + "ID_Mag_NS" :: "" +} + +EXTENDS KEYWORD initial_lapse +{ + "ID_Mag_NS" :: "" +} + +EXTENDS KEYWORD initial_shift +{ + "ID_Mag_NS" :: "" +} + + + +SHARES: HydroBase + +EXTENDS KEYWORD initial_hydro +{ + "ID_Mag_NS" :: "" +} + +EXTENDS KEYWORD initial_Bmag +{ + "ID_Mag_NS" :: "" +} + + + +PRIVATE: + +STRING filename "Input file name" +{ + "" :: "" +} "" diff --git a/schedule.ccl b/schedule.ccl new file mode 100644 index 0000000..eac9010 --- /dev/null +++ b/schedule.ccl @@ -0,0 +1,18 @@ +# Schedule definitions for thorn ID_Mag_NS + +if (CCTK_EQUALS (initial_data, "ID_Mag_NS") || + CCTK_EQUALS (initial_lapse, "ID_Mag_NS") || + CCTK_EQUALS (initial_shift, "ID_Mag_NS") || + CCTK_EQUALS (initial_hydro, "ID_Mag_NS") || + CCTK_EQUALS (initial_Bmag, "ID_Mag_NS")) +{ + SCHEDULE ID_Mag_NS_check_parameters AT paramcheck + { + LANG: C + } "Check parameters" + + SCHEDULE ID_Mag_NS_initialise IN ADMBase_Initial + { + LANG: C + } "Set up magnetised neutron star initial data" +} diff --git a/src/Mag_NS.cc b/src/Mag_NS.cc new file mode 100644 index 0000000..af67c4c --- /dev/null +++ b/src/Mag_NS.cc @@ -0,0 +1,166 @@ +#include +#include +#include + +#include +#include +#include + +#include + +using namespace std; + + + +extern "C" +void ID_Mag_NS_initialise (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + CCTK_INFO ("Setting up LORENE Mag_NS initial data"); + + + + // Meudon data are distributed in SI units (MKSA). Here are some + // conversion factors. + + // Defined constants + CCTK_REAL const c_light = 299792458.0; // speed of light [m/s] + CCTK_REAL const mu0 = 4*M_PI * 1.0e-7; // vacuum permeability [N/A^2] + CCTK_REAL const eps0 = 1 / (mu0 * pow(c_light,2)); + + // Constants of nature (IAU, CODATA): + CCTK_REAL const G_grav = 6.67428e-11; // gravitational constant [m^3/kg/s^2] + CCTK_REAL const M_sun = 1.98892e+30; // solar mass [kg] + + // Cactus units in terms of SI units: + // (These are derived from M = M_sun, c = G = 1, and using 1/M_sun + // for the magnetic field) + CCTK_REAL const cactusM = M_sun; + CCTK_REAL const cactusL = cactusM * G_grav / pow(c_light,2); + CCTK_REAL const cactusT = cactusL / c_light; + CCTK_REAL const cactusB = + sqrt(4*M_PI) / cactusL / sqrt(4*M_PI * eps0 * G_grav / pow(c_light,2)); + + // Other quantities in terms of Cactus units + CCTK_REAL const coord_unit = cactusL / 1.0e+3; // from km + CCTK_REAL const rho_unit = cactusM / pow(cactusL,3); // from kg/m^3 + CCTK_REAL const ener_unit = pow(cactusL,2); // from c^2 + CCTK_REAL const vel_unit = cactusL / cactusT / c_light; // from c + CCTK_REAL const B_unit = cactusB / 1.0e+9; // from 10^9 T + + + + CCTK_INFO ("Setting up coordinates"); + + int const npoints = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2]; + + vector xx(npoints), yy(npoints), zz(npoints); + +#pragma omp parallel for + for (int i=0; i +#include +#include + + + +extern "C" +void ID_Mag_NS_check_parameters (CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + if (not CCTK_EQUALS (initial_data , "ID_Mag_NS") or + not CCTK_EQUALS (initial_lapse, "ID_Mag_NS") or + not CCTK_EQUALS (initial_shift, "ID_Mag_NS") or + not CCTK_EQUALS (initial_hydro, "ID_Mag_NS") or + not CCTK_EQUALS (initial_Bmag, "ID_Mag_NS")) + { + CCTK_PARAMWARN ("The parameters ADMBase::initial_data, ADMBase::initial_lapse, ADMBase::initial_shift, HydroBase::initial_hydro, and HydroBase::initial_Bmag must all be set to the value \"ID_Mag_NS\""); + } +} diff --git a/src/make.code.defn b/src/make.code.defn new file mode 100644 index 0000000..329f9f1 --- /dev/null +++ b/src/make.code.defn @@ -0,0 +1,7 @@ +# Main make.code.defn file for thorn ID_Mag_NS + +# Source files in this directory +SRCS = Mag_NS.cc check_parameters.cc + +# Subdirectories containing source files +SUBDIRS = -- cgit v1.2.3