Skip to content

Commit

Permalink
TestSubscycling: test subcycling in time
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaas80 committed Feb 28, 2024
1 parent fc2f0bb commit c5c7eb0
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 0 deletions.
9 changes: 9 additions & 0 deletions TestSubcycling/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Cactus Code Thorn TestSubcycling
Author(s) : Roland Haas <[email protected]>
Maintainer(s): Roland Haas <[email protected]>
Licence : NCSA
--------------------------------------------------------------------------

1. Purpose

not documented
3 changes: 3 additions & 0 deletions TestSubcycling/configuration.ccl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Configuration definitions for thorn TestSubcycling

REQUIRES Loop
146 changes: 146 additions & 0 deletions TestSubcycling/doc/documentation.tex
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{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{<path-to-your-.git-directory>}}
\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}
6 changes: 6 additions & 0 deletions TestSubcycling/interface.ccl
Original file line number Diff line number Diff line change
@@ -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"
43 changes: 43 additions & 0 deletions TestSubcycling/par/subcycle.par
Original file line number Diff line number Diff line change
@@ -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
"
1 change: 1 addition & 0 deletions TestSubcycling/param.ccl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Parameter definitions for thorn TestSubcycling
16 changes: 16 additions & 0 deletions TestSubcycling/schedule.ccl
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 7 additions & 0 deletions TestSubcycling/src/make.code.defn
Original file line number Diff line number Diff line change
@@ -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 =
32 changes: 32 additions & 0 deletions TestSubcycling/src/subcycling.cxx
Original file line number Diff line number Diff line change
@@ -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;
});

}

0 comments on commit c5c7eb0

Please sign in to comment.