-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from lucass-carneiro/main
Moving boxes example thorn
- Loading branch information
Showing
68 changed files
with
5,871 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Cactus Code Thorn MovingBoxToy | ||
Author(s) : Lucas Timotheo Sanches <[email protected]> | ||
Maintainer(s): Lucas Timotheo Sanches <[email protected]> | ||
Licence : LGPL | ||
-------------------------------------------------------------------------- | ||
|
||
1. Purpose | ||
|
||
Show how to create moving refinement boxes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Configuration definitions for thorn MovingBoxToy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Interface definition for thorn MovingBoxToy | ||
|
||
IMPLEMENTS: MovingBoxToy | ||
|
||
INHERITS: BoxInBox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
ActiveThorns = " | ||
MovingBoxToy | ||
BoxInBox | ||
CarpetX | ||
CoordinatesX | ||
IOUtil | ||
" | ||
|
||
Cactus::cctk_show_schedule = no | ||
Cactus::presync_mode = "mixed-error" | ||
|
||
CarpetX::poison_undefined_values = yes | ||
|
||
CarpetX::ncells_x = 64 | ||
CarpetX::ncells_y = 64 | ||
CarpetX::ncells_z = 64 | ||
|
||
CarpetX::dtfac = CarpetX::ncells_x | ||
|
||
CarpetX::max_num_levels = 8 | ||
CarpetX::regrid_every = 1 | ||
|
||
BoxInBox::num_regions = 2 | ||
|
||
BoxInBox::num_levels_1 = 2 | ||
BoxInBox::position_x_1 = -0.5 | ||
BoxInBox::radius_x_1[1] = 0.25 | ||
BoxInBox::radius_y_1[1] = 0.25 | ||
BoxInBox::radius_z_1[1] = 0.25 | ||
|
||
BoxInBox::num_levels_2 = 2 | ||
BoxInBox::position_x_2 = +0.5 | ||
BoxInBox::radius_x_2[1] = 0.25 | ||
BoxInBox::radius_y_2[1] = 0.25 | ||
BoxInBox::radius_z_2[1] = 0.25 | ||
|
||
CarpetX::boundary_x = "dirichlet" | ||
CarpetX::boundary_y = "dirichlet" | ||
CarpetX::boundary_z = "dirichlet" | ||
CarpetX::boundary_upper_x = "dirichlet" | ||
CarpetX::boundary_upper_y = "dirichlet" | ||
CarpetX::boundary_upper_z = "dirichlet" | ||
|
||
Cactus::cctk_itlast = 20 | ||
|
||
IO::out_dir = $parfile | ||
IO::out_every = 1 | ||
IO::parfile_write = no | ||
|
||
CarpetX::out_metadata = no | ||
CarpetX::out_norm_vars = "all" | ||
CarpetX::out_norm_omit_unstable = yes | ||
|
||
CarpetX::out_silo_vars = " | ||
CarpetX::regrid_error | ||
CoordinatesX::vertex_coords | ||
CoordinatesX::cell_coords | ||
" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Parameter definitions for thorn MovingBoxToy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Schedule definitions for thorn MovingBoxToy | ||
|
||
SCHEDULE MovingBoxToy_MoveBoxes AT postinitial BEFORE EstimateError | ||
{ | ||
LANG: C | ||
READS: BoxInBox::positions | ||
WRITES: BoxInBox::positions | ||
} "Update box positions" | ||
|
||
SCHEDULE MovingBoxToy_MoveBoxes AT poststep BEFORE EstimateError | ||
{ | ||
LANG: C | ||
READS: BoxInBox::positions | ||
WRITES: BoxInBox::positions | ||
} "Update box positions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Main make.code.defn file for thorn MovingBoxToy | ||
|
||
# Source files in this directory | ||
SRCS = movingboxtoy.cxx | ||
|
||
# Subdirectories containing source files | ||
SUBDIRS = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <cmath> | ||
|
||
template <typename T> | ||
constexpr auto pow2(T val) noexcept -> T { | ||
return val * val; | ||
} | ||
|
||
extern "C" void MovingBoxToy_MoveBoxes(CCTK_ARGUMENTS) { | ||
DECLARE_CCTK_ARGUMENTSX_MovingBoxToy_MoveBoxes; | ||
DECLARE_CCTK_PARAMETERS; | ||
|
||
using std::cos; | ||
using std::sqrt; | ||
|
||
const CCTK_REAL omega{M_PI/4}; | ||
|
||
// Radius of each box | ||
const auto R1 = sqrt(pow2(position_x[0]) + pow2(position_y[0]) + pow2(position_z[0])); | ||
const auto R2 = sqrt(pow2(position_x[1]) + pow2(position_y[1]) + pow2(position_z[1])); | ||
|
||
// Trajectory of box 1 | ||
position_x[0] = R1 * cos(omega * cctk_time); | ||
position_y[0] = R1 * sin(omega * cctk_time); | ||
|
||
// Trajectory of box 2 | ||
position_x[1] = -R2 * cos(omega * cctk_time); | ||
position_y[1] = -R2 * sin(omega * cctk_time); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
ActiveThorns = " | ||
MovingBoxToy | ||
BoxInBox | ||
CarpetX | ||
CoordinatesX | ||
IOUtil | ||
" | ||
|
||
Cactus::cctk_show_schedule = no | ||
Cactus::presync_mode = "mixed-error" | ||
|
||
CarpetX::poison_undefined_values = yes | ||
|
||
CarpetX::ncells_x = 64 | ||
CarpetX::ncells_y = 64 | ||
CarpetX::ncells_z = 64 | ||
|
||
CarpetX::dtfac = CarpetX::ncells_x | ||
|
||
CarpetX::max_num_levels = 8 | ||
CarpetX::regrid_every = 1 | ||
|
||
BoxInBox::num_regions = 2 | ||
|
||
BoxInBox::num_levels_1 = 2 | ||
BoxInBox::position_x_1 = -0.5 | ||
BoxInBox::radius_x_1[1] = 0.25 | ||
BoxInBox::radius_y_1[1] = 0.25 | ||
BoxInBox::radius_z_1[1] = 0.25 | ||
|
||
BoxInBox::num_levels_2 = 2 | ||
BoxInBox::position_x_2 = +0.5 | ||
BoxInBox::radius_x_2[1] = 0.25 | ||
BoxInBox::radius_y_2[1] = 0.25 | ||
BoxInBox::radius_z_2[1] = 0.25 | ||
|
||
CarpetX::boundary_x = "dirichlet" | ||
CarpetX::boundary_y = "dirichlet" | ||
CarpetX::boundary_z = "dirichlet" | ||
CarpetX::boundary_upper_x = "dirichlet" | ||
CarpetX::boundary_upper_y = "dirichlet" | ||
CarpetX::boundary_upper_z = "dirichlet" | ||
|
||
Cactus::cctk_itlast = 5 | ||
|
||
IO::out_dir = $parfile | ||
IO::out_every = 1 | ||
IO::parfile_write = no | ||
|
||
CarpetX::out_metadata = no | ||
CarpetX::out_norm_vars = "all" | ||
CarpetX::out_norm_omit_unstable = yes | ||
|
||
CarpetX::out_tsv_vars = " | ||
CarpetX::regrid_error | ||
CoordinatesX::vertex_coords | ||
CoordinatesX::cell_coords | ||
" | ||
|
Oops, something went wrong.