Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zachetienne authored Aug 14, 2023
2 parents 8455e7f + 76357c9 commit b022cb9
Show file tree
Hide file tree
Showing 31 changed files with 881 additions and 822 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy nrpylatex
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: UnitTests
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/github-actions-MacOS12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy nrpylatex clang_format
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: UnitTests
run: |
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/github-actions-ubuntu20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["2.7.18", "3.6.9", "3.8.3", "3.10", "3.11"]
python-version: ["3.6.9", "3.8.3", "3.10", "3.11"]
sympy-version: ["sympy", "sympy==1.2"]

steps:
Expand All @@ -36,11 +36,12 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install testfixtures ${{ matrix.sympy-version }} mpmath jupyter matplotlib scipy nrpylatex clang_format
python -m pip install testfixtures ${{ matrix.sympy-version }} mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Core Jupyter notebook testsuite
run: |
./UnitTesting/core_Jupyter_notebook_testsuite.sh
PYDEVD_DISABLE_FILE_VALIDATION=1 ./UnitTesting/core_Jupyter_notebook_testsuite.sh
coreJupdevSymPy:

Expand Down Expand Up @@ -71,11 +72,12 @@ jobs:
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install --upgrade git+https://github.com/sympy/sympy/
python -m pip install testfixtures mpmath jupyter matplotlib scipy nrpylatex clang_format
python -m pip install testfixtures mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Core Jupyter notebook testsuite
run: |
./UnitTesting/core_Jupyter_notebook_testsuite.sh
PYDEVD_DISABLE_FILE_VALIDATION=1 ./UnitTesting/core_Jupyter_notebook_testsuite.sh
UnitTests:
Expand All @@ -84,7 +86,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["2.7.18", "3.6.9", "3.8.3", "3.10", "3.11"]
python-version: ["3.6.9", "3.8.3", "3.10", "3.11"]
sympy-version: ["sympy", "sympy==1.3"]

steps:
Expand All @@ -107,7 +109,8 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install testfixtures ${{ matrix.sympy-version }} mpmath jupyter matplotlib scipy nrpylatex clang_format
python -m pip install testfixtures ${{ matrix.sympy-version }} mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: UnitTests
run: |
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/github-actions-ubuntu22.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ jobs:
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install --upgrade git+https://github.com/sympy/sympy/
python -m pip install testfixtures mpmath jupyter matplotlib scipy nrpylatex clang_format
python -m pip install testfixtures mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Core Jupyter notebook testsuite
run: |
./UnitTesting/${{ matrix.testname }}.sh
PYDEVD_DISABLE_FILE_VALIDATION=1 ./UnitTesting/${{ matrix.testname }}.sh
CoreJuplatestSymPy:

Expand Down Expand Up @@ -71,11 +72,12 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy nrpylatex clang_format
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Core Jupyter notebook testsuite
run: |
./UnitTesting/core_Jupyter_notebook_testsuite.sh
PYDEVD_DISABLE_FILE_VALIDATION=1 ./UnitTesting/core_Jupyter_notebook_testsuite.sh
UnitTestdevSymPy:

Expand Down Expand Up @@ -106,7 +108,8 @@ jobs:
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install --upgrade git+https://github.com/sympy/sympy/
python -m pip install testfixtures mpmath jupyter matplotlib scipy nrpylatex clang_format
python -m pip install testfixtures mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: UnitTests
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/github-actions-windows2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: master

jobs:
TwoBHsCollidelatestSymPy:
NRPyUnitTests:

runs-on: windows-2022
strategy:
Expand All @@ -29,7 +29,8 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade nbconvert
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy nrpylatex clang_format
- name: Core Jupyter notebook testsuite
python -m pip install testfixtures sympy mpmath jupyter matplotlib scipy clang_format
python -m pip install git+https://github.com/zachetienne/nrpylatex.git
- name: NRPyUnitTests
run: |
bash ./UnitTesting/run_NRPy_UnitTests.sh python3
7 changes: 4 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ disable=too-many-arguments,redefined-outer-name,wrong-import-position,too-many-l
unspecified-encoding, # ADDED
use-maxsplit-arg, # ADDED
consider-using-f-string, # ADDED
redundant-u-string-prefix, # ADDED
raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
use-symbolic-message-instead

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -534,5 +535,5 @@ preferred-modules=

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
15 changes: 13 additions & 2 deletions CarpetX/WaveToy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,38 @@
from subprocess import call
import numpy as np
from fstr import f
from outputC import lhrh

par.set_parval_from_str("outputC::PRECISION", "CCTK_REALVEC")

pre_kernel = """
#include <iostream>
#include <cmath>
const int nx = 10, ny = 10;
int mask;
using std::cos;
using std::sin;
typedef double CCTK_REALVEC;
struct PointDesc {
static constexpr int DI[3]={0,0,0};
double x,y;
double x,y,dx=.01,dy=.02;
int I=0;
};
namespace Arith {
template<typename T>
double iota() { return T(0); }
}
struct GF {
double data;
double& operator()(int n) { return data; }
double& operator()(int n,int p) { return data; }
double& operator()(int n,int l,int p) { return data; }
};
double cctk_delta_space[3] = {.5, .4};
Expand Down Expand Up @@ -146,7 +158,6 @@ def main():
regrid_error = thorn.get_regrid_error()
x,y,z = thorn.get_xyz()

from outputC import lhrh
import indexedexp as ixp
import NRPy_param_funcs as par

Expand Down
26 changes: 13 additions & 13 deletions CarpetX_z4c/Z4c.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ def Initial():
schedule_bin="Z4cNRPy_InitialGroup",
doc="Convert ADM to Z4c variables, part 1",
centering=centering)

initial2_eqns = [
geneqns(lhs=dgammatilde[li,lj,lk], values=gammatildeDD_dD),
loop,
geneqns(lhs=gammatilde[ua,ub],values=gammatildeUU_expr),
geneqns(lhs=dgammatilde[ui,uj,lk], rhs=gammatilde[ui,ux] * gammatilde[uj,uy] * dgammatilde[lx,ly,lk]),
geneqns(lhs=Gammatilde[ui], rhs=dgammatilde[ui,ux,lx])
]

thorn.add_func(
"Z4cNRPy_Initial2",
body=initial2_eqns,
Expand Down Expand Up @@ -188,7 +188,7 @@ def Enforce():
geneqns(lhs=gammatilde[li,lj], rhs=(1 / cbrt(detgammatilde)) * gammatilde[li,lj]),
geneqns(lhs=Atilde[li,lj], rhs=(Atilde[li,lj] - trAtilde / 3 * gammatilde[li,lj]))
]

thorn.add_func(
"Z4cNRPy_Enforce",
body=enforce_eqns,
Expand Down Expand Up @@ -217,7 +217,7 @@ def ADM():
geneqns(lhs=dt2alp, rhs=sympify(0)),
geneqns(lhs=dtdtbeta[ui], rhs=zero * betaG[ui]),
]

thorn.add_func(
"Z4cNRPy_ADM",
body=adm_eqns,
Expand Down Expand Up @@ -280,7 +280,7 @@ def RHS():
# RHS
geneqns(lhs=gammatilde[ui,uj], values=gammatildeUU_expr),
geneqns(lhs=g[ui,uj], rhs=chi*gammatilde[ui,uj]),
geneqns(lhs=dg[li,lj,lk],
geneqns(lhs=dg[li,lj,lk],
rhs=(- 1 / chi**2 * dchi[lk] * gammatilde[li,lj]
+ 1 / chi * dgammatilde[li,lj,lk])),
geneqns(lhs=Christoffel[li,lj,lk],
Expand Down Expand Up @@ -316,7 +316,7 @@ def RHS():
+ (betaG[ux] * dKhat[lx])
# + eps_diss * dissKhat
)),
geneqns(lhs=Christoffeltilde[li,lj,lk],
geneqns(lhs=Christoffeltilde[li,lj,lk],
rhs=Rational(1,2) * (dgammatilde[li,lj,lk] + dgammatilde[li,lk,lj] - dgammatilde[lj,lk,li])),
geneqns(lhs=Christoffeltilde[ui,lj,lk], rhs=gammatilde[ui,ux]*Christoffeltilde[lx,lj,lk]),
geneqns(lhs=Christoffeltilde[li,lj,uk], rhs=gammatilde[uk,ux]*Christoffeltilde[li,lj,lx]),
Expand Down Expand Up @@ -388,12 +388,12 @@ def RHS():
+ betaG[ux] * dTheta[lx]
# + eps_diss * dissTheta
), True))),

[lhrh(lhs=rhs_alphaG,
rhs=(- alphaG * f_mu_L * Khat
# + eps_diss * dissalphaG
))],

geneqns(lhs=rhs_betaG[ui], rhs=(+ f_mu_S * Gammatilde[ui] - eta * betaG[ui])),
loop,

Expand All @@ -414,7 +414,7 @@ def RHS():
geneqns(lhs=rhs_betaG[ui], rhs=rhs_betaG[ui] + eps_diss * betaG1_dKO1[ui,lx]*one[ux]),
loop,
]

thorn.add_func(
"Z4cNRPy_RHS",
body=rhs_eqns,
Expand Down Expand Up @@ -462,7 +462,7 @@ def Constraints():

# HC, eqn. (14)
geneqns(lhs=g[ui,uj], rhs=chi*gammatilde[ui,uj]),
geneqns(lhs=dg[li,lj,lk],
geneqns(lhs=dg[li,lj,lk],
rhs=(- 1 / chi**2 * dchi[lk] * gammatilde[li,lj]
+ 1 / chi * dgammatilde[li,lj,lk])),
geneqns(lhs=Christoffel[li,lj,lk],
Expand All @@ -473,7 +473,7 @@ def Constraints():
rhs=1 / alphaG**2 * (+ eTtt
- 2 * betaG[ux] * eTt[lx]
+ betaG[ux] * betaG[uy] * eT[lx,ly])),
geneqns(lhs=DDchi[li,lj],
geneqns(lhs=DDchi[li,lj],
rhs=ddchi[li,lj] - Christoffeltilde[ux,li,lj] * dchi[lx]),
# arXiv:1212.2901 [gr-qc], (8)
geneqns(lhs=Rchi[li,lj],
Expand Down Expand Up @@ -534,7 +534,7 @@ def Constraints():
+ Theta**2
+ 2 * gammatilde[lx,ly] * ZetatildeCval[ux] * ZetatildeCval[uy])))),
]

thorn.add_func(
"Z4cNRPy_Constraints",
body=constraints_eqns,
Expand Down Expand Up @@ -583,7 +583,7 @@ def Constraints():
--- a/Z4cNRPy/schedule.ccl
+++ b/Z4cNRPy/schedule.ccl
@@ -107,20 +107,20 @@
SCHEDULE Z4cNRPy_Enforce IN Z4cNRPy_PostStepGroup {
LANG: C
- READS: Z4cNRPy::AtildeDD00GF(everywhere)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import NRPy_param_funcs as par # NRPy+: Parameter interface
import sympy as sp # SymPy: The Python computer algebra package upon which NRPy+ depends
import grid as gri # NRPy+: Functions having to do with numerical grids
import deprecated_grid as evil_gri # NRPy+: Functions having to do with numerical grids
import indexedexp as ixp # NRPy+: Symbolic indexed expression (e.g., tensors, vectors, etc.) support
import reference_metric as rfm # NRPy+: Reference metric support
import cmdline_helper as cmd # NRPy+: Multi-platform Python command-line interface
Expand Down Expand Up @@ -117,7 +118,7 @@ def Set_up_CurviBoundaryConditions(Ccodesdir,verbose=True,Cparamspath=os.path.jo

# Step 2.a: Generate Ccodesdir/gridfunction_defines.h file,
# containing human-readable gridfunction aliases
evolved_variables_list, auxiliary_variables_list, auxevol_variables_list = gri.output__gridfunction_defines_h__return_gf_lists(Ccodesdir)[0:3]
evolved_variables_list, auxiliary_variables_list, auxevol_variables_list = evil_gri.output__gridfunction_defines_h__return_gf_lists(Ccodesdir)[0:3]

# Step 2.b: set the parity conditions on all gridfunctions in gf_list,
# based on how many digits are at the end of their names
Expand Down
17 changes: 17 additions & 0 deletions Deprecated/deprecated_grid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# grid.py: functions & parameters related to numerical grids
# functions: Automatic loop output, output C code needed for gridfunction memory I/O, gridfunction registration

# Author: Zachariah B. Etienne
# zachetie **at** gmail **dot* com

import grid as gri # NRPy+: gridding
import os

####################
# TO BE DEPRECATED
def output__gridfunction_defines_h__return_gf_lists(outdir):
with open(os.path.join(outdir, "gridfunction_defines.h"), "w") as file:
file.write("/* This file is automatically generated by NRPy+. Do not edit. */\n\n")
file.write(gri.gridfunction_defines())
return gri.gridfunction_lists()
####################
File renamed without changes.
3 changes: 2 additions & 1 deletion SIMD.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def lookup_rational(arg):
return arg

if map_sym_to_rat is None:
expr, map_sym_to_rat = cse_preprocess(expr)
cse_preprocessed_expr_list, map_sym_to_rat = cse_preprocess(expr)
expr = cse_preprocessed_expr_list[0]

map_rat_to_sym = {map_sym_to_rat[v]:v for v in map_sym_to_rat}

Expand Down
Loading

0 comments on commit b022cb9

Please sign in to comment.