From 5091afc21beb2aabc1b0c8de3de993020c218aee Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 23 Jun 2011 12:21:30 -0400 Subject: AMRToy: Example thorn providing a regridding criterion --- CarpetExtra/AMRToy/README | 9 ++ CarpetExtra/AMRToy/doc/documentation.tex | 144 ++++++++++++++++++++ CarpetExtra/AMRToy/interface.ccl | 5 + CarpetExtra/AMRToy/par/amr-simple-cc.par | 219 ++++++++++++++++++++++++++++++ CarpetExtra/AMRToy/par/amr-simple.par | 211 ++++++++++++++++++++++++++++ CarpetExtra/AMRToy/param.ccl | 18 +++ CarpetExtra/AMRToy/schedule.ccl | 15 ++ CarpetExtra/AMRToy/src/make.code.defn | 7 + CarpetExtra/AMRToy/src/set_level_mask.F90 | 35 +++++ 9 files changed, 663 insertions(+) create mode 100644 CarpetExtra/AMRToy/README create mode 100644 CarpetExtra/AMRToy/doc/documentation.tex create mode 100644 CarpetExtra/AMRToy/interface.ccl create mode 100644 CarpetExtra/AMRToy/par/amr-simple-cc.par create mode 100644 CarpetExtra/AMRToy/par/amr-simple.par create mode 100644 CarpetExtra/AMRToy/param.ccl create mode 100644 CarpetExtra/AMRToy/schedule.ccl create mode 100644 CarpetExtra/AMRToy/src/make.code.defn create mode 100644 CarpetExtra/AMRToy/src/set_level_mask.F90 (limited to 'CarpetExtra') diff --git a/CarpetExtra/AMRToy/README b/CarpetExtra/AMRToy/README new file mode 100644 index 000000000..b9bf2bf16 --- /dev/null +++ b/CarpetExtra/AMRToy/README @@ -0,0 +1,9 @@ +Cactus Code Thorn AMRToy +Author(s) : Erik Schnetter +Maintainer(s): Erik Schnetter +Licence : GPL +-------------------------------------------------------------------------- + +1. Purpose + +Set up some AMR grid structures. diff --git a/CarpetExtra/AMRToy/doc/documentation.tex b/CarpetExtra/AMRToy/doc/documentation.tex new file mode 100644 index 000000000..526b67e1a --- /dev/null +++ b/CarpetExtra/AMRToy/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 eschnetter@perimeterinstitute.ca\textgreater} + +% The title of the document (not necessarily the name of the Thorn) +\title{AMRToy} + +% the date your document was last changed, if your document is in CVS, +% please use: +% \date{$ $Date: 2004-01-07 14:12:39 -0600 (Wed, 07 Jan 2004) $ $} +\date{June 15 2011} + +\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/CarpetExtra/AMRToy/interface.ccl b/CarpetExtra/AMRToy/interface.ccl new file mode 100644 index 000000000..000ff859a --- /dev/null +++ b/CarpetExtra/AMRToy/interface.ccl @@ -0,0 +1,5 @@ +# Interface definition for thorn AMRToy + +IMPLEMENTS: AMRToy + +INHERITS: grid CarpetRegrid2 diff --git a/CarpetExtra/AMRToy/par/amr-simple-cc.par b/CarpetExtra/AMRToy/par/amr-simple-cc.par new file mode 100644 index 000000000..2f4723840 --- /dev/null +++ b/CarpetExtra/AMRToy/par/amr-simple-cc.par @@ -0,0 +1,219 @@ +Cactus::cctk_run_title = "Minkowski/AMR" + +Cactus::cctk_full_warnings = yes +Cactus::highlight_warning_messages = no + +Cactus::terminate = "time" +Cactus::cctk_final_time = 0.0 + + + +ActiveThorns = "IOUtil" + +IO::out_dir = $parfile + + + +#ActiveThorns = "TerminationTrigger" +# +#TerminationTrigger::max_walltime = @WALLTIME_HOURS@ # hours +#TerminationTrigger::on_remaining_walltime = 15 # minutes +# +#TerminationTrigger::termination_from_file = yes +#TerminationTrigger::create_termination_file = yes +#TerminationTrigger::termination_file = "../TERMINATE" + + + +ActiveThorns = "AEILocalInterp" + +ActiveThorns = "Fortran" + +ActiveThorns = "LocalInterp" + +ActiveThorns = "LoopControl" + +ActiveThorns = "GSL" + +ActiveThorns = "GenericFD" + +ActiveThorns = "Slab" + + + +ActiveThorns = "InitBase" + + + +ActiveThorns = "Carpet CarpetLib CarpetInterp CarpetReduce CarpetSlab" + +Carpet::verbose = no +Carpet::veryverbose = no +Carpet::schedule_barriers = no +Carpet::storage_verbose = no +Carpet::timers_verbose = no +CarpetLib::output_bboxes = no + +Carpet::domain_from_coordbase = yes +Carpet::max_refinement_levels = 10 + +driver::ghost_size = 3 +Carpet::refinement_centering = "cell" +Carpet::use_buffer_zones = yes + +Carpet::prolongation_order_space = 5 +Carpet::prolongation_order_time = 2 + +Carpet::convergence_level = 0 + +Carpet::init_fill_timelevels = yes + +Carpet::poison_new_timelevels = yes +CarpetLib::poison_new_memory = yes + +Carpet::output_timers_every = 512 +CarpetLib::print_timestats_every = 512 +CarpetLib::print_memstats_every = 512 + + + +ActiveThorns = "NaNChecker" + +NaNChecker::check_every = 1 # 512 +NaNChecker::action_if_found = "terminate" +NaNChecker::check_vars = " +" + + + +ActiveThorns = "Boundary CartGrid3D CoordBase SymBase" + +CoordBase::domainsize = "minmax" + +CoordBase::xmin = -120.00 +CoordBase::ymin = -120.00 +CoordBase::zmin = -120.00 +CoordBase::xmax = +120.00 +CoordBase::ymax = +120.00 +CoordBase::zmax = +120.00 +CoordBase::dx = 2.00 +CoordBase::dy = 2.00 +CoordBase::dz = 2.00 + +CoordBase::boundary_staggered_x_lower = yes +CoordBase::boundary_staggered_y_lower = yes +CoordBase::boundary_staggered_z_lower = yes +CoordBase::boundary_staggered_x_upper = yes +CoordBase::boundary_staggered_y_upper = yes +CoordBase::boundary_staggered_z_upper = yes + +CoordBase::boundary_size_x_lower = 3 +CoordBase::boundary_size_y_lower = 3 +CoordBase::boundary_size_z_lower = 3 +CoordBase::boundary_size_x_upper = 3 +CoordBase::boundary_size_y_upper = 3 +CoordBase::boundary_size_z_upper = 3 + +CartGrid3D::type = "coordbase" + + + +ActiveThorns = "SphericalSurface" + + + +ActiveThorns = "AMRToy CarpetRegrid2" + +CarpetRegrid2::regrid_every = 128 +CarpetRegrid2::freeze_unaligned_levels = yes +CarpetRegrid2::verbose = yes +CarpetRegrid2::veryverbose = no + +Carpet::regrid_during_initialisation = yes + +CarpetRegrid2::adaptive_refinement = yes +CarpetRegrid2::adaptive_block_size = 8 + + +AMRToy::radius_type = "sphere" +AMRToy::min_radius = 29.999 +AMRToy::max_radius = 59.999 + + + +ActiveThorns = "MoL Time" + +MoL::ODE_Method = "RK4" +MoL::MoL_Intermediate_Steps = 4 +MoL::MoL_Num_Scratch_Levels = 1 + +Time::dtfac = 0.40 + + + +ActiveThorns = "CarpetIOBasic" + +IOBasic::outInfo_every = 128 +IOBasic::outInfo_reductions = "norm2" +IOBasic::outInfo_vars = " + Carpet::physical_time_per_hour + Carpet::local_grid_points_per_second +" + + + +ActiveThorns = "CarpetIOScalar" + +IOScalar::one_file_per_group = yes + +IOScalar::outScalar_every = 128 +IOScalar::outScalar_vars = " + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + + + +ActiveThorns = "CarpetIOASCII" + +IOASCII::one_file_per_group = yes + +IOASCII::output_symmetry_points = no +IOASCII::output_ghost_points = no + +IOASCII::out0D_every = 128 +IOASCII::out0D_vars = " + Carpet::timing + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + +IOASCII::out1D_every = 128 +IOASCII::out1D_vars = " + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + +IOASCII::out2D_every = 128 +IOASCII::out2D_vars = " + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + + + +ActiveThorns = "Formaline" + + + +ActiveThorns = "TimerReport" + +TimerReport::out_every = 512 +TimerReport::out_filename = "TimerReport" +TimerReport::output_all_timers_together = yes +TimerReport::output_all_timers_readable = yes +TimerReport::n_top_timers = 20 diff --git a/CarpetExtra/AMRToy/par/amr-simple.par b/CarpetExtra/AMRToy/par/amr-simple.par new file mode 100644 index 000000000..940b382bc --- /dev/null +++ b/CarpetExtra/AMRToy/par/amr-simple.par @@ -0,0 +1,211 @@ +Cactus::cctk_run_title = "Minkowski/AMR" + +Cactus::cctk_full_warnings = yes +Cactus::highlight_warning_messages = no + +Cactus::terminate = "time" +Cactus::cctk_final_time = 0.0 + + + +ActiveThorns = "IOUtil" + +IO::out_dir = $parfile + + + +#ActiveThorns = "TerminationTrigger" +# +#TerminationTrigger::max_walltime = @WALLTIME_HOURS@ # hours +#TerminationTrigger::on_remaining_walltime = 15 # minutes +# +#TerminationTrigger::termination_from_file = yes +#TerminationTrigger::create_termination_file = yes +#TerminationTrigger::termination_file = "../TERMINATE" + + + +ActiveThorns = "AEILocalInterp" + +ActiveThorns = "Fortran" + +ActiveThorns = "LocalInterp" + +ActiveThorns = "LoopControl" + +ActiveThorns = "GSL" + +ActiveThorns = "GenericFD" + +ActiveThorns = "Slab" + + + +ActiveThorns = "InitBase" + + + +ActiveThorns = "Carpet CarpetLib CarpetInterp CarpetReduce CarpetSlab" + +Carpet::verbose = no +Carpet::veryverbose = no +Carpet::schedule_barriers = no +Carpet::storage_verbose = no +Carpet::timers_verbose = no +CarpetLib::output_bboxes = no + +Carpet::domain_from_coordbase = yes +Carpet::max_refinement_levels = 10 + +driver::ghost_size = 3 +Carpet::use_buffer_zones = yes + +Carpet::prolongation_order_space = 5 +Carpet::prolongation_order_time = 2 + +Carpet::convergence_level = 0 + +Carpet::init_fill_timelevels = yes + +Carpet::poison_new_timelevels = yes +CarpetLib::poison_new_memory = yes + +Carpet::output_timers_every = 512 +CarpetLib::print_timestats_every = 512 +CarpetLib::print_memstats_every = 512 + + + +ActiveThorns = "NaNChecker" + +NaNChecker::check_every = 1 # 512 +NaNChecker::action_if_found = "terminate" +NaNChecker::check_vars = " +" + + + +ActiveThorns = "Boundary CartGrid3D CoordBase SymBase" + +CoordBase::domainsize = "minmax" + +CoordBase::xmin = -120.00 +CoordBase::ymin = -120.00 +CoordBase::zmin = -120.00 +CoordBase::xmax = +120.00 +CoordBase::ymax = +120.00 +CoordBase::zmax = +120.00 +CoordBase::dx = 2.00 +CoordBase::dy = 2.00 +CoordBase::dz = 2.00 + +CoordBase::boundary_size_x_lower = 3 +CoordBase::boundary_size_y_lower = 3 +CoordBase::boundary_size_z_lower = 3 +CoordBase::boundary_size_x_upper = 3 +CoordBase::boundary_size_y_upper = 3 +CoordBase::boundary_size_z_upper = 3 + +CartGrid3D::type = "coordbase" + + + +ActiveThorns = "SphericalSurface" + + + +ActiveThorns = "AMRToy CarpetRegrid2" + +CarpetRegrid2::regrid_every = 128 +CarpetRegrid2::freeze_unaligned_levels = yes +CarpetRegrid2::verbose = yes +CarpetRegrid2::veryverbose = no + +Carpet::regrid_during_initialisation = yes + +CarpetRegrid2::adaptive_refinement = yes +CarpetRegrid2::adaptive_block_size = 8 + + +AMRToy::radius_type = "sphere" +AMRToy::min_radius = 29.999 +AMRToy::max_radius = 59.999 + + + +ActiveThorns = "MoL Time" + +MoL::ODE_Method = "RK4" +MoL::MoL_Intermediate_Steps = 4 +MoL::MoL_Num_Scratch_Levels = 1 + +Time::dtfac = 0.40 + + + +ActiveThorns = "CarpetIOBasic" + +IOBasic::outInfo_every = 128 +IOBasic::outInfo_reductions = "norm2" +IOBasic::outInfo_vars = " + Carpet::physical_time_per_hour + Carpet::local_grid_points_per_second +" + + + +ActiveThorns = "CarpetIOScalar" + +IOScalar::one_file_per_group = yes + +IOScalar::outScalar_every = 128 +IOScalar::outScalar_vars = " + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + + + +ActiveThorns = "CarpetIOASCII" + +IOASCII::one_file_per_group = yes + +IOASCII::output_symmetry_points = no +IOASCII::output_ghost_points = no + +IOASCII::out0D_every = 128 +IOASCII::out0D_vars = " + Carpet::timing + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + +IOASCII::out1D_every = 128 +IOASCII::out1D_vars = " + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + +IOASCII::out2D_every = 128 +IOASCII::out2D_vars = " + grid::coordinates + CarpetReduce::weight + CarpetRegrid2::level_mask +" + + + +ActiveThorns = "Formaline" + + + +ActiveThorns = "TimerReport" + +TimerReport::out_every = 512 +TimerReport::out_filename = "TimerReport" +TimerReport::output_all_timers_together = yes +TimerReport::output_all_timers_readable = yes +TimerReport::n_top_timers = 20 diff --git a/CarpetExtra/AMRToy/param.ccl b/CarpetExtra/AMRToy/param.ccl new file mode 100644 index 000000000..95496d1c0 --- /dev/null +++ b/CarpetExtra/AMRToy/param.ccl @@ -0,0 +1,18 @@ +# Parameter definitions for thorn AMRToy + +KEYWORD radius_type "Norm defining the shape of the refined region" STEERABLE=always +{ + "diamond" :: "L_1 norm" + "sphere" :: "L_2 norm" + "box" :: "L_inf norm" +} "sphere" + +CCTK_REAL min_radius "Minimum refinement radius" STEERABLE=always +{ + (0:* :: "" +} 1.0 + +CCTK_REAL max_radius "Maximum refinement radius" STEERABLE=always +{ + 0:* :: "" +} 1.0 diff --git a/CarpetExtra/AMRToy/schedule.ccl b/CarpetExtra/AMRToy/schedule.ccl new file mode 100644 index 000000000..045d61988 --- /dev/null +++ b/CarpetExtra/AMRToy/schedule.ccl @@ -0,0 +1,15 @@ +# Schedule definitions for thorn AMRToy + +STORAGE: CarpetRegrid2::level_mask + +SCHEDULE AMR_set_level_mask AT preregridinitial +{ + LANG: Fortran + OPTIONS: global loop-local +} "Set AMR mask" + +SCHEDULE AMR_set_level_mask AT preregrid +{ + LANG: Fortran + OPTIONS: global loop-local +} "Set AMR mask" diff --git a/CarpetExtra/AMRToy/src/make.code.defn b/CarpetExtra/AMRToy/src/make.code.defn new file mode 100644 index 000000000..7653a8227 --- /dev/null +++ b/CarpetExtra/AMRToy/src/make.code.defn @@ -0,0 +1,7 @@ +# Main make.code.defn file for thorn AMRToy + +# Source files in this directory +SRCS = set_level_mask.F90 + +# Subdirectories containing source files +SUBDIRS = diff --git a/CarpetExtra/AMRToy/src/set_level_mask.F90 b/CarpetExtra/AMRToy/src/set_level_mask.F90 new file mode 100644 index 000000000..0a7483097 --- /dev/null +++ b/CarpetExtra/AMRToy/src/set_level_mask.F90 @@ -0,0 +1,35 @@ +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Functions.h" +#include "cctk_Parameters.h" + +subroutine AMR_set_level_mask (CCTK_ARGUMENTS) + implicit none + DECLARE_CCTK_ARGUMENTS + DECLARE_CCTK_FUNCTIONS + DECLARE_CCTK_PARAMETERS + +!!$ character*1000 :: msg +!!$ +!!$ write (msg, '("Origin: ",3g25.15)') CCTK_ORIGIN_SPACE(:) +!!$ call CCTK_INFO (msg) +!!$ write (msg, '("Delta: ",3g25.15)') CCTK_DELTA_SPACE(:) +!!$ call CCTK_INFO (msg) + + if (any(level_mask<0 .or. level_mask>100)) then + call CCTK_WARN(CCTK_WARN_ABORT, "level mask contains strange values") + end if + + if (CCTK_EQUALS(radius_type, "diamond")) then + ! L_1 norm + level_mask = max_radius / max(abs(x)+abs(y)+abs(z), min_radius) + else if (CCTK_EQUALS(radius_type, "sphere")) then + ! L_2 norm + level_mask = max_radius / max(r, min_radius) + else if (CCTK_EQUALS(radius_type, "box")) then + ! L_inf norm + level_mask = max_radius / max(max(abs(x),abs(y),abs(z)), min_radius) + else + call CCTK_WARN(CCTK_WARN_ABORT, "internal error") + end if +end subroutine AMR_set_level_mask -- cgit v1.2.3