Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .github/workflows/build-BinaryBH-example.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/grchombo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: GRChombo

on:
push:
schedule:
# Run once per month
- cron: "0 0 1 * *"

jobs:
build:
name: Build BinaryBH example with TwoPunctures
runs-on: ubuntu-24.04
env:
CHOMBO_HOME: ${{ github.workspace }}/Chombo/lib
TWOPUNCTURES_SOURCE: ${{ github.workspace }}/TwoPunctures/Source
OMP_NUM_THREADS: 1

steps:
- name: Checkout Chombo
uses: actions/checkout@v6
with:
repository: GRChombo/Chombo
path: Chombo

- name: Checkout GRChombo
uses: actions/checkout@v6
with:
repository: GRChombo/GRChombo
path: GRChombo

- name: Checkout TwoPunctures
uses: actions/checkout@v6
with:
path: TwoPunctures

- name: Install Chombo and TwoPunctures dependencies
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install \
csh \
libhdf5-dev \
libhdf5-openmpi-dev \
openmpi-bin \
libblas-dev \
liblapack-dev \
libgetopt-complete-perl \
libgsl-dev

- name: Build Chombo
run: |
cp $GITHUB_WORKSPACE/GRChombo/InstallNotes/MakeDefsLocalExamples/ubuntu-gcc.Make.defs.local \
$CHOMBO_HOME/mk/Make.defs.local
make -j 4 AMRTimeDependent AMRTools BaseTools BoxTools
working-directory: ${{ env.CHOMBO_HOME }}

- name: Build BinaryBH example with TwoPunctures
run: |
make all -j 4
working-directory: ${{ github.workspace }}/GRChombo/Examples/BinaryBH
44 changes: 44 additions & 0 deletions .github/workflows/grteclyn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: GRTeclyn

on:
push:
schedule:
# Run once per month
- cron: "0 0 1 * *"

jobs:
build:
name: Build BinaryBH example with TwoPunctures
runs-on: ubuntu-24.04
env:
OMP_NUM_THREADS: 1

steps:
- name: Checkout AMReX
uses: actions/checkout@v6
with:
repository: AMReX-Codes/amrex
path: amrex

- name: Checkout GRTeclyn
uses: actions/checkout@v6
with:
repository: GRTLCollaboration/GRTeclyn
path: GRTeclyn

- name: Checkout TwoPunctures
uses: actions/checkout@v6
with:
path: TwoPunctures

- name: Install GRTeclyn dependencies
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install \
libopenmpi-dev \
libgsl-dev

- name: Build BinaryBH example with TwoPunctures
run: |
make -j 4 USE_TWOPUNCTURES=TRUE
working-directory: ${{ github.workspace }}/GRTeclyn/Examples/BinaryBH
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# TwoPunctures (GRChombo)
# TwoPunctures (GRChombo/GRTeclyn)

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

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

It has been modified to allow integration with GRChombo.
It has been modified to allow integration with
[GRChombo](https://github.com/GRTLCollaboration/GRChombo) and
[GRTeclyn](https://github.com/GRTLCollaboration/GRTeclyn).

## Physics

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

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

## GRTeclyn integration

To build the BinaryBH GRTeclyn example with TwoPunctures initial data, set the
makefile variable `USE_TWOPUNCTURES = TRUE`. By default, the build system will
assume this repository is cloned next to GRTeclyn i.e.
`/path/to/GRTeclyn/../TwoPunctures` (like AMReX) but this can be overridden by
setting the `TWOPUNCTURES_HOME` variable. Both of these variables can be set in
the following ways:

* on the command line e.g.
```
make -j 4 USE_TWOPUNCTURES=TRUE TWOPUNCTURES_HOME=/path/to/TwoPunctures
```
* in the `Make.local-pre` or `Make.local` files located in `amrex/Tools/GNUMake`
* by setting it as an environment variable

As for GRChombo, it requires linking with the GNU Scientific Library (GSL). If
necessary, the GSL install location can be passed to the build system by setting
`GSL_HOME`.

> [!NOTE]
> TwoPunctures parameter names differ between GRChombo and GRTeclyn.

> [!NOTE]
> When running GRTeclyn on GPUs, TwoPunctures will still run and
> interpolate the data onto the grid on the CPU. In this case, since you will
> generally have a much greater number of cells per MPI process, spectral
> interpolation will be *very* slow.

## License

The authors of the original TwoPunctures code are Marcus Ansorg, Erik Schnetter,
Expand Down
12 changes: 12 additions & 0 deletions Source/Make.package
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CEXE_sources += CoordTransf.cpp \
Equations.cpp \
FuncAndJacobian.cpp \
Newton.cpp \
TP_Parameters.cpp \
TP_Utilities.cpp \
TwoPunctures.cpp

CEXE_headers += TP_ConservedVectorNames.hpp \
TP_Parameters.hpp \
TP_Utilities.hpp \
TwoPunctures.hpp
30 changes: 30 additions & 0 deletions Source/TwoPunctures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@
#ifndef __TWO_PUNCTURES_MAIN__
#define __TWO_PUNCTURES_MAIN__

#ifdef CH_SPACEDIM
#define USE_CHOMBO
#elif defined(AMREX_SPACEDIM)
#define USE_AMREX
#endif

#ifdef USE_CHOMBO
// Chombo includes
#include "MayDay.H"
#include "SPMD.H"
#include "parstream.H"
#elif defined(USE_AMREX)
// AMReX includes
#include "AMReX.H"
#include "AMReX_ParallelDescriptor.H"
#include "AMReX_Print.H"
#endif

// Our includes
#include "TP_ConservedVectorNames.hpp"
#include "TP_Parameters.hpp"
#include "TP_Utilities.hpp"
#include <cstdio>

#ifdef USE_CHOMBO
// Chombo namespace
#include "UsingNamespace.H"
#endif

namespace TP
{
Expand All @@ -29,6 +44,7 @@ namespace TP
**/
#define TP_RESTRICT __restrict__

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

Expand All @@ -41,6 +57,20 @@ inline int TP_MyProc() { return procID(); }
}
#define TP_ERROR MayDay::Error
#define TP_WARN MayDay::Warning
#elif defined(USE_AMREX)
/* Give MPI information about rank */
inline int TP_MyProc() { return amrex::ParallelDescriptor::MyProc(); }

#define TP_INFO(args...) \
{ \
amrex::Print() << "TP: "; \
char buf[1024]; \
sprintf(buf, args); \
amrex::Print() << buf << std::endl; \
}
#define TP_ERROR amrex::Error
#define TP_WARN amrex::Warning
#endif

/* end of quick adaptions */

Expand Down