Skip to content

Commit 6f3cdf3

Browse files
authored
Merge pull request #7 from GRTLCollaboration/enhancement/grteclyn_support
Add support for GRTeclyn
2 parents 64f264e + 80a38d2 commit 6f3cdf3

6 files changed

Lines changed: 180 additions & 61 deletions

File tree

.github/workflows/build-BinaryBH-example.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/grchombo.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: GRChombo
2+
3+
on:
4+
push:
5+
schedule:
6+
# Run once per month
7+
- cron: "0 0 1 * *"
8+
9+
jobs:
10+
build:
11+
name: Build BinaryBH example with TwoPunctures
12+
runs-on: ubuntu-24.04
13+
env:
14+
CHOMBO_HOME: ${{ github.workspace }}/Chombo/lib
15+
TWOPUNCTURES_SOURCE: ${{ github.workspace }}/TwoPunctures/Source
16+
OMP_NUM_THREADS: 1
17+
18+
steps:
19+
- name: Checkout Chombo
20+
uses: actions/checkout@v6
21+
with:
22+
repository: GRChombo/Chombo
23+
path: Chombo
24+
25+
- name: Checkout GRChombo
26+
uses: actions/checkout@v6
27+
with:
28+
repository: GRChombo/GRChombo
29+
path: GRChombo
30+
31+
- name: Checkout TwoPunctures
32+
uses: actions/checkout@v6
33+
with:
34+
path: TwoPunctures
35+
36+
- name: Install Chombo and TwoPunctures dependencies
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get -y --no-install-recommends install \
40+
csh \
41+
libhdf5-dev \
42+
libhdf5-openmpi-dev \
43+
openmpi-bin \
44+
libblas-dev \
45+
liblapack-dev \
46+
libgetopt-complete-perl \
47+
libgsl-dev
48+
49+
- name: Build Chombo
50+
run: |
51+
cp $GITHUB_WORKSPACE/GRChombo/InstallNotes/MakeDefsLocalExamples/ubuntu-gcc.Make.defs.local \
52+
$CHOMBO_HOME/mk/Make.defs.local
53+
make -j 4 AMRTimeDependent AMRTools BaseTools BoxTools
54+
working-directory: ${{ env.CHOMBO_HOME }}
55+
56+
- name: Build BinaryBH example with TwoPunctures
57+
run: |
58+
make all -j 4
59+
working-directory: ${{ github.workspace }}/GRChombo/Examples/BinaryBH

.github/workflows/grteclyn.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: GRTeclyn
2+
3+
on:
4+
push:
5+
schedule:
6+
# Run once per month
7+
- cron: "0 0 1 * *"
8+
9+
jobs:
10+
build:
11+
name: Build BinaryBH example with TwoPunctures
12+
runs-on: ubuntu-24.04
13+
env:
14+
OMP_NUM_THREADS: 1
15+
16+
steps:
17+
- name: Checkout AMReX
18+
uses: actions/checkout@v6
19+
with:
20+
repository: AMReX-Codes/amrex
21+
path: amrex
22+
23+
- name: Checkout GRTeclyn
24+
uses: actions/checkout@v6
25+
with:
26+
repository: GRTLCollaboration/GRTeclyn
27+
path: GRTeclyn
28+
29+
- name: Checkout TwoPunctures
30+
uses: actions/checkout@v6
31+
with:
32+
path: TwoPunctures
33+
34+
- name: Install GRTeclyn dependencies
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get -y --no-install-recommends install \
38+
libopenmpi-dev \
39+
libgsl-dev
40+
41+
- name: Build BinaryBH example with TwoPunctures
42+
run: |
43+
make -j 4 USE_TWOPUNCTURES=TRUE
44+
working-directory: ${{ github.workspace }}/GRTeclyn/Examples/BinaryBH

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
# TwoPunctures (GRChombo)
1+
# TwoPunctures (GRChombo/GRTeclyn)
22

3-
![Build BinaryBH example with TwoPunctures](https://github.com/GRChombo/TwoPunctures/workflows/Build%20BinaryBH%20example%20with%20TwoPunctures/badge.svg)
3+
[![GRChombo](https://github.com/GRTLCollaboration/TwoPunctures/actions/workflows/grchombo.yml/badge.svg)](https://github.com/GRTLCollaboration/TwoPunctures/actions/workflows/grchombo.yml)
4+
[![GRTeclyn](https://github.com/GRTLCollaboration/TwoPunctures/actions/workflows/grteclyn.yml/badge.svg)](https://github.com/GRTLCollaboration/TwoPunctures/actions/workflows/grteclyn.yml)
45
![Style](https://github.com/GRChombo/TwoPunctures/workflows/Style/badge.svg)
56

67
This repository originates from the
78
[standalone TwoPunctures](https://bitbucket.org/relastro/twopunctures-standalone)
89
code which in turn comes from the original Einstein Toolkit thorn
910
[TwoPunctures](https://bitbucket.org/einsteintoolkit/einsteininitialdata/).
1011

11-
It has been modified to allow integration with GRChombo.
12+
It has been modified to allow integration with
13+
[GRChombo](https://github.com/GRTLCollaboration/GRChombo) and
14+
[GRTeclyn](https://github.com/GRTLCollaboration/GRTeclyn).
1215

1316
## Physics
1417

@@ -33,6 +36,35 @@ subdirectory of the GRChombo repository.
3336

3437
In either case linking with the GNU Scientific Library (GSL) is required.
3538

39+
## GRTeclyn integration
40+
41+
To build the BinaryBH GRTeclyn example with TwoPunctures initial data, set the
42+
makefile variable `USE_TWOPUNCTURES = TRUE`. By default, the build system will
43+
assume this repository is cloned next to GRTeclyn i.e.
44+
`/path/to/GRTeclyn/../TwoPunctures` (like AMReX) but this can be overridden by
45+
setting the `TWOPUNCTURES_HOME` variable. Both of these variables can be set in
46+
the following ways:
47+
48+
* on the command line e.g.
49+
```
50+
make -j 4 USE_TWOPUNCTURES=TRUE TWOPUNCTURES_HOME=/path/to/TwoPunctures
51+
```
52+
* in the `Make.local-pre` or `Make.local` files located in `amrex/Tools/GNUMake`
53+
* by setting it as an environment variable
54+
55+
As for GRChombo, it requires linking with the GNU Scientific Library (GSL). If
56+
necessary, the GSL install location can be passed to the build system by setting
57+
`GSL_HOME`.
58+
59+
> [!NOTE]
60+
> TwoPunctures parameter names differ between GRChombo and GRTeclyn.
61+
62+
> [!NOTE]
63+
> When running GRTeclyn on GPUs, TwoPunctures will still run and
64+
> interpolate the data onto the grid on the CPU. In this case, since you will
65+
> generally have a much greater number of cells per MPI process, spectral
66+
> interpolation will be *very* slow.
67+
3668
## License
3769

3870
The authors of the original TwoPunctures code are Marcus Ansorg, Erik Schnetter,

Source/Make.package

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CEXE_sources += CoordTransf.cpp \
2+
Equations.cpp \
3+
FuncAndJacobian.cpp \
4+
Newton.cpp \
5+
TP_Parameters.cpp \
6+
TP_Utilities.cpp \
7+
TwoPunctures.cpp
8+
9+
CEXE_headers += TP_ConservedVectorNames.hpp \
10+
TP_Parameters.hpp \
11+
TP_Utilities.hpp \
12+
TwoPunctures.hpp

Source/TwoPunctures.hpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,34 @@
22
#ifndef __TWO_PUNCTURES_MAIN__
33
#define __TWO_PUNCTURES_MAIN__
44

5+
#ifdef CH_SPACEDIM
6+
#define USE_CHOMBO
7+
#elif defined(AMREX_SPACEDIM)
8+
#define USE_AMREX
9+
#endif
10+
11+
#ifdef USE_CHOMBO
512
// Chombo includes
613
#include "MayDay.H"
714
#include "SPMD.H"
815
#include "parstream.H"
16+
#elif defined(USE_AMREX)
17+
// AMReX includes
18+
#include "AMReX.H"
19+
#include "AMReX_ParallelDescriptor.H"
20+
#include "AMReX_Print.H"
21+
#endif
922

1023
// Our includes
1124
#include "TP_ConservedVectorNames.hpp"
1225
#include "TP_Parameters.hpp"
1326
#include "TP_Utilities.hpp"
1427
#include <cstdio>
1528

29+
#ifdef USE_CHOMBO
1630
// Chombo namespace
1731
#include "UsingNamespace.H"
32+
#endif
1833

1934
namespace TP
2035
{
@@ -29,6 +44,7 @@ namespace TP
2944
**/
3045
#define TP_RESTRICT __restrict__
3146

47+
#ifdef USE_CHOMBO
3248
/* Give MPI information about rank */
3349
inline int TP_MyProc() { return procID(); }
3450

@@ -41,6 +57,20 @@ inline int TP_MyProc() { return procID(); }
4157
}
4258
#define TP_ERROR MayDay::Error
4359
#define TP_WARN MayDay::Warning
60+
#elif defined(USE_AMREX)
61+
/* Give MPI information about rank */
62+
inline int TP_MyProc() { return amrex::ParallelDescriptor::MyProc(); }
63+
64+
#define TP_INFO(args...) \
65+
{ \
66+
amrex::Print() << "TP: "; \
67+
char buf[1024]; \
68+
sprintf(buf, args); \
69+
amrex::Print() << buf << std::endl; \
70+
}
71+
#define TP_ERROR amrex::Error
72+
#define TP_WARN amrex::Warning
73+
#endif
4474

4575
/* end of quick adaptions */
4676

0 commit comments

Comments
 (0)