From c5c7eb05dd22764388365ceae428ca38086bcd67 Mon Sep 17 00:00:00 2001 From: Roland Haas Date: Wed, 28 Feb 2024 08:44:43 -0600 Subject: [PATCH] TestSubscycling: test subcycling in time --- TestSubcycling/README | 9 ++ TestSubcycling/configuration.ccl | 3 + TestSubcycling/doc/documentation.tex | 146 +++++++++++++++++++++++++++ TestSubcycling/interface.ccl | 6 ++ TestSubcycling/par/subcycle.par | 43 ++++++++ TestSubcycling/param.ccl | 1 + TestSubcycling/schedule.ccl | 16 +++ TestSubcycling/src/make.code.defn | 7 ++ TestSubcycling/src/subcycling.cxx | 32 ++++++ 9 files changed, 263 insertions(+) create mode 100644 TestSubcycling/README create mode 100644 TestSubcycling/configuration.ccl create mode 100644 TestSubcycling/doc/documentation.tex create mode 100644 TestSubcycling/interface.ccl create mode 100644 TestSubcycling/par/subcycle.par create mode 100644 TestSubcycling/param.ccl create mode 100644 TestSubcycling/schedule.ccl create mode 100644 TestSubcycling/src/make.code.defn create mode 100644 TestSubcycling/src/subcycling.cxx diff --git a/TestSubcycling/README b/TestSubcycling/README new file mode 100644 index 000000000..e5abb00df --- /dev/null +++ b/TestSubcycling/README @@ -0,0 +1,9 @@ +Cactus Code Thorn TestSubcycling +Author(s) : Roland Haas +Maintainer(s): Roland Haas +Licence : NCSA +-------------------------------------------------------------------------- + +1. Purpose + +not documented diff --git a/TestSubcycling/configuration.ccl b/TestSubcycling/configuration.ccl new file mode 100644 index 000000000..04ee9acaa --- /dev/null +++ b/TestSubcycling/configuration.ccl @@ -0,0 +1,3 @@ +# Configuration definitions for thorn TestSubcycling + +REQUIRES Loop diff --git a/TestSubcycling/doc/documentation.tex b/TestSubcycling/doc/documentation.tex new file mode 100644 index 000000000..c79b76fea --- /dev/null +++ b/TestSubcycling/doc/documentation.tex @@ -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 rhaas@illinois.edu\textgreater} + +% The title of the document (not necessarily the name of the Thorn) +\title{TestSubcycling} + +% 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{}} +\date{February 26 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} diff --git a/TestSubcycling/interface.ccl b/TestSubcycling/interface.ccl new file mode 100644 index 000000000..f426303ae --- /dev/null +++ b/TestSubcycling/interface.ccl @@ -0,0 +1,6 @@ +# Interface definition for thorn TestSubcycling +implements: TestSubcycling + +USES INCLUDE HEADER: loop.hxx + +CCTK_REAL iteration TYPE=GF CENTERING={VVV} TAGS="checkpoint='no'" "subcycling and prolongation test" diff --git a/TestSubcycling/par/subcycle.par b/TestSubcycling/par/subcycle.par new file mode 100644 index 000000000..51a2a2705 --- /dev/null +++ b/TestSubcycling/par/subcycle.par @@ -0,0 +1,43 @@ +ActiveThorns = " + CarpetX + ErrorEstimator + IOUtil + TestSubcycling +" + +Cactus::presync_mode = "mixed-error" + +CarpetX::poison_undefined_values = yes + +CarpetX::ncells_x = 32 +CarpetX::ncells_y = 32 +CarpetX::ncells_z = 32 + +CarpetX::periodic_x = yes +CarpetX::periodic_y = yes +CarpetX::periodic_z = yes + +Cactus::cctk_itlast = 4 + +CarpetX::use_subcycling_wip = yes + +ErrorEstimator::region_shape = "cube" +ErrorEstimator::scale_by_resolution = "yes" +CarpetX::regrid_error_threshold = 4. +CarpetX::max_num_levels = 2 + +IO::out_dir = $parfile +IO::out_every = 1 +IO::parfile_write = no + +CarpetX::out_adios2_every = 0 +CarpetX::out_silo_every = 0 +CarpetX::out_openpmd_every = 0 + +CarpetX::verbose = no +CarpetX::out_performance = no +CarpetX::out_metadata = no +CarpetX::out_tsv_vars = " + TestSubcycling::iteration + CarpetX::regrid_error +" diff --git a/TestSubcycling/param.ccl b/TestSubcycling/param.ccl new file mode 100644 index 000000000..ff4acc884 --- /dev/null +++ b/TestSubcycling/param.ccl @@ -0,0 +1 @@ +# Parameter definitions for thorn TestSubcycling diff --git a/TestSubcycling/schedule.ccl b/TestSubcycling/schedule.ccl new file mode 100644 index 000000000..c158c1c5c --- /dev/null +++ b/TestSubcycling/schedule.ccl @@ -0,0 +1,16 @@ +# Schedule definitions for thorn TestSubcycling + +STORAGE: iteration + +schedule TestSubcycling_Init AT INITIAL +{ + LANG: C + WRITES: iteration(everywhere) +} "initialize test grid function" + +schedule TestSubcycling_Update AT EVOL +{ + LANG: C + WRITES: iteration(interior) + SYNC: iteration +} "update test grid function" diff --git a/TestSubcycling/src/make.code.defn b/TestSubcycling/src/make.code.defn new file mode 100644 index 000000000..ee8f9fdf6 --- /dev/null +++ b/TestSubcycling/src/make.code.defn @@ -0,0 +1,7 @@ +# Main make.code.defn file for thorn TestSubcycling + +# Source files in this directory +SRCS = subcycling.cxx + +# Subdirectories containing source files +SUBDIRS = diff --git a/TestSubcycling/src/subcycling.cxx b/TestSubcycling/src/subcycling.cxx new file mode 100644 index 000000000..a3f33a2ea --- /dev/null +++ b/TestSubcycling/src/subcycling.cxx @@ -0,0 +1,32 @@ +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "loop.hxx" + +extern "C" +void TestSubcycling_Init(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_PARAMETERS; + DECLARE_CCTK_ARGUMENTSX_TestSubcycling_Init; + + CCTK_INFO("Initializing grid function"); + grid.loop_all<0,0,0>(grid.nghostzones, [=](const Loop::PointDesc &pt) { + CCTK_REAL canary = 100 + 10 * cctk_iteration + 1 * cctk_level; + iteration(pt.I) = canary; + }); + +} + +extern "C" +void TestSubcycling_Update(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_PARAMETERS; + DECLARE_CCTK_ARGUMENTSX_TestSubcycling_Update; + + CCTK_VINFO("Updating grid function at iteration %d level %d", cctk_iteration, cctk_level); + grid.loop_int<0,0,0>(grid.nghostzones, [=] CCTK_HOST(const Loop::PointDesc &pt) { + CCTK_REAL canary = 100 + 10 * cctk_iteration + 1 * cctk_level; + iteration(pt.I) = canary; + }); + +}