paddle 1.1.7__tar.gz → 1.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {paddle-1.1.7 → paddle-1.1.9}/.bumpversion.cfg +1 -1
  2. {paddle-1.1.7 → paddle-1.1.9}/.github/workflows/ci.yml +1 -2
  3. {paddle-1.1.7 → paddle-1.1.9}/.gitignore +6 -0
  4. {paddle-1.1.7 → paddle-1.1.9}/PKG-INFO +1 -1
  5. {paddle-1.1.7 → paddle-1.1.9}/pyproject.toml +1 -1
  6. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/__init__.py +1 -1
  7. paddle-1.1.9/tests/robert.py +102 -0
  8. paddle-1.1.9/tests/robert.yaml +64 -0
  9. paddle-1.1.9/tests/shock.py +67 -0
  10. paddle-1.1.9/tests/shock.yaml +60 -0
  11. paddle-1.1.9/tests/straka.py +101 -0
  12. paddle-1.1.9/tests/straka.yaml +74 -0
  13. {paddle-1.1.7 → paddle-1.1.9}/.github/workflows/bump-and-tag.yaml +0 -0
  14. {paddle-1.1.7 → paddle-1.1.9}/.github/workflows/cd.yml +0 -0
  15. {paddle-1.1.7 → paddle-1.1.9}/.pre-commit-config.yaml +0 -0
  16. {paddle-1.1.7 → paddle-1.1.9}/LICENSE +0 -0
  17. {paddle-1.1.7 → paddle-1.1.9}/Makefile +0 -0
  18. {paddle-1.1.7 → paddle-1.1.9}/README.md +0 -0
  19. {paddle-1.1.7 → paddle-1.1.9}/docker/.dockerignore +0 -0
  20. {paddle-1.1.7 → paddle-1.1.9}/docker/Dockerfile +0 -0
  21. {paddle-1.1.7 → paddle-1.1.9}/docker/Dockerfile.cuda +0 -0
  22. {paddle-1.1.7 → paddle-1.1.9}/docker/entrypoint.sh +0 -0
  23. {paddle-1.1.7 → paddle-1.1.9}/docker/nvim/init.lua +0 -0
  24. {paddle-1.1.7 → paddle-1.1.9}/docker/nvim/lua/plugins.lua +0 -0
  25. {paddle-1.1.7 → paddle-1.1.9}/docker/requirements.txt +0 -0
  26. {paddle-1.1.7 → paddle-1.1.9}/docker/scripts/git-done +0 -0
  27. {paddle-1.1.7 → paddle-1.1.9}/docker/scripts/git-send +0 -0
  28. {paddle-1.1.7 → paddle-1.1.9}/docker-compose.override.yaml.tmp +0 -0
  29. {paddle-1.1.7 → paddle-1.1.9}/docker-compose.yaml +0 -0
  30. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/crm.py +0 -0
  31. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/evolve_kinetics.py +0 -0
  32. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/find_init_params.py +0 -0
  33. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/nc2pt.py +0 -0
  34. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/pt2nc.py +0 -0
  35. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/setup_profile.py +0 -0
  36. {paddle-1.1.7 → paddle-1.1.9}/src/paddle/write_profile.py +0 -0
  37. {paddle-1.1.7 → paddle-1.1.9}/tests/.gitignore +0 -0
  38. {paddle-1.1.7 → paddle-1.1.9}/tests/data/saturn1d.yaml +0 -0
  39. {paddle-1.1.7 → paddle-1.1.9}/tests/test_saturn_adiabat.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 1.1.7
2
+ current_version = 1.1.9
3
3
  commit = True
4
4
  tag = True
5
5
 
@@ -44,8 +44,7 @@ jobs:
44
44
  strategy:
45
45
  fail-fast: true
46
46
  matrix:
47
- #os: [ubuntu-latest, macOS-latest]
48
- os: [ubuntu-latest]
47
+ os: [ubuntu-latest, macOS-latest]
49
48
  steps:
50
49
  - name: Check out code
51
50
  uses: actions/checkout@v4
@@ -208,3 +208,9 @@ __marimo__/
208
208
 
209
209
  # docker
210
210
  docker-compose.override.yaml
211
+
212
+ # netcdf outputs
213
+ *.nc
214
+
215
+ # restart outputs
216
+ *.restart
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paddle
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Python Atmospheric Dynamics: Discovery and Learning about Exoplanets. An open-source, user-friendly python frontend of canoe
5
5
  Project-URL: Homepage, https://github.com/elijah-mullens/paddle
6
6
  Project-URL: Repository, https://github.com/elijah-mullens/paddle
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "paddle"
7
- version = "1.1.7"
7
+ version = "1.1.9"
8
8
  description = "Python Atmospheric Dynamics: Discovery and Learning about Exoplanets. An open-source, user-friendly python frontend of canoe"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -4,4 +4,4 @@ from .find_init_params import find_init_params
4
4
  from .evolve_kinetics import evolve_kinetics
5
5
 
6
6
  __all__ = ["setup_profile", "write_profile", "find_init_params", "evolve_kinetics"]
7
- __version__ = "1.1.7"
7
+ __version__ = "1.1.9"
@@ -0,0 +1,102 @@
1
+ import torch
2
+ import math
3
+ import time
4
+ from snapy import MeshBlockOptions, MeshBlock
5
+ from snapy import kIDN, kIPR
6
+
7
+
8
+ def call_user_output(bvars):
9
+ hydro_w = bvars["hydro_w"]
10
+ out = {}
11
+ temp = hydro_w[kIPR] / (Rd * hydro_w[kIDN])
12
+ out["temp"] = temp
13
+ out["theta"] = temp * (p0 / hydro_w[kIPR]).pow(Rd / cp)
14
+ return out
15
+
16
+
17
+ dT = 0.5
18
+ p0 = 1.0e5
19
+ Ts = 303.15
20
+ xc = 500.0
21
+ yc = 0.0
22
+ zc = 260.0
23
+ s = 100.0
24
+ a = 50.0
25
+ grav = 9.8
26
+ Rd = 287.0
27
+ gamma = 1.4
28
+ uniform_bubble = False
29
+
30
+ # use cuda if available
31
+ if torch.cuda.is_available():
32
+ device = torch.device("cuda:0")
33
+ else:
34
+ device = torch.device("cpu")
35
+
36
+ # set hydrodynamic options
37
+ op = MeshBlockOptions.from_yaml("robert.yaml")
38
+ block = MeshBlock(op)
39
+ block.to(device)
40
+
41
+ # get handles to modules
42
+ coord = block.module("hydro.coord")
43
+ thermo = block.module("hydro.eos.thermo")
44
+
45
+ # thermodynamics
46
+ cp = gamma / (gamma - 1.0) * Rd
47
+
48
+ # set initial condition
49
+ x3v, x2v, x1v = torch.meshgrid(
50
+ coord.buffer("x3v"), coord.buffer("x2v"), coord.buffer("x1v"), indexing="ij"
51
+ )
52
+
53
+ # dimensions
54
+ nc3 = coord.buffer("x3v").shape[0]
55
+ nc2 = coord.buffer("x2v").shape[0]
56
+ nc1 = coord.buffer("x1v").shape[0]
57
+ nvar = 5
58
+
59
+ w = torch.zeros((nvar, nc3, nc2, nc1), device=device)
60
+
61
+ temp = Ts - grav * x1v / cp
62
+ w[kIPR] = p0 * torch.pow(temp / Ts, cp / Rd)
63
+
64
+ r = torch.sqrt((x3v - yc) ** 2 + (x2v - xc) ** 2 + (x1v - zc) ** 2)
65
+ temp += torch.where(r <= a, dT * torch.pow(w[kIPR] / p0, Rd / cp), 0.0)
66
+ if not uniform_bubble:
67
+ temp += torch.where(
68
+ r > a,
69
+ dT * torch.exp(-(((r - a) / s) ** 2)) * torch.pow(w[kIPR] / p0, Rd / cp),
70
+ 0.0,
71
+ )
72
+ w[kIDN] = w[kIPR] / (Rd * temp)
73
+
74
+ block_vars = {}
75
+ block_vars["hydro_w"] = w
76
+ block_vars = block.initialize(block_vars)
77
+
78
+ block.set_user_output_func(call_user_output)
79
+
80
+ # integration
81
+ start_time = time.time()
82
+ current_time = 0.0
83
+ block.make_outputs(block_vars, current_time)
84
+
85
+ while not block.intg.stop(block.inc_cycle(), current_time):
86
+ dt = block.max_time_step(block_vars)
87
+ block.print_cycle_info(block_vars, current_time, dt)
88
+
89
+ for stage in range(len(block.intg.stages)):
90
+ block.forward(block_vars, dt, stage)
91
+
92
+ err = block.check_redo(block_vars)
93
+ if err > 0:
94
+ continue # redo current step
95
+ if err < 0:
96
+ break # terminate
97
+
98
+ current_time += dt
99
+ block.make_outputs(block_vars, current_time)
100
+
101
+ block.finalize(block_vars, current_time)
102
+ print("elapsed time = ", time.time() - start_time)
@@ -0,0 +1,64 @@
1
+ reference-state:
2
+ Tref: 0.
3
+ Pref: 1.e5
4
+
5
+ species:
6
+ - name: dry
7
+ composition: {O: 0.42, N: 1.56, Ar: 0.01}
8
+ cv_R: 2.5
9
+
10
+ geometry:
11
+ type: cartesian
12
+ bounds: {x1min: 0., x1max: 1.5e3, x2min: 0., x2max: 1.e3, x3min: -0.5, x3max: 0.5}
13
+ cells: {nx1: 300, nx2: 200, nx3: 1, nghost: 3}
14
+
15
+ dynamics:
16
+ equation-of-state:
17
+ type: ideal-gas
18
+ density-floor: 1.e-10
19
+ pressure-floor: 1.e-10
20
+ limiter: false
21
+
22
+ vertical-projection:
23
+ type: temperature
24
+ pressure-margin: 1.e-6
25
+
26
+ reconstruct:
27
+ vertical: {type: weno5, scale: false, shock: true}
28
+ horizontal: {type: weno5, scale: false, shock: true}
29
+
30
+ riemann-solver:
31
+ type: lmars
32
+
33
+ boundary-condition:
34
+ internal:
35
+ solid-density: 1.e3
36
+ solid-pressure: 1.9
37
+ max-iter: 5
38
+
39
+ external:
40
+ x1-inner: reflecting
41
+ x1-outer: reflecting
42
+ x2-inner: reflecting
43
+ x2-outer: reflecting
44
+ x3-inner: reflecting
45
+ x3-outer: reflecting
46
+
47
+ integration:
48
+ type: rk3
49
+ cfl: 0.9
50
+ implicit-scheme: 0
51
+ nlim: -1
52
+ tlim: 1080
53
+ ncycle_out: 10
54
+
55
+ forcing:
56
+ const-gravity:
57
+ grav1: -9.8
58
+
59
+ outputs:
60
+ - type: restart
61
+ dt: 300.
62
+ - type: netcdf
63
+ variables: [prim, uov]
64
+ dt: 30.
@@ -0,0 +1,67 @@
1
+ import torch
2
+ from snapy import MeshBlockOptions, MeshBlock
3
+ from snapy import kIDN, kIPR, kIV1, kIV2, kIV3
4
+
5
+ # use cuda if available
6
+ if torch.cuda.is_available():
7
+ device = torch.device("cuda:0")
8
+ else:
9
+ device = torch.device("cpu")
10
+
11
+ # set hydrodynamic model
12
+ op = MeshBlockOptions.from_yaml("shock.yaml")
13
+
14
+ # initialize block
15
+ block = MeshBlock(op)
16
+ block.to(device)
17
+
18
+ # get handles to modules
19
+ coord = block.hydro.module("coord")
20
+
21
+ # set initial condition
22
+ x3v, x2v, x1v = torch.meshgrid(
23
+ coord.buffer("x3v"), coord.buffer("x2v"), coord.buffer("x1v"), indexing="ij"
24
+ )
25
+
26
+ # dimensions
27
+ nc3 = coord.buffer("x3v").shape[0]
28
+ nc2 = coord.buffer("x2v").shape[0]
29
+ nc1 = coord.buffer("x1v").shape[0]
30
+ nvar = 5
31
+
32
+ w = torch.zeros((nvar, nc3, nc2, nc1), device=device)
33
+
34
+ w[kIDN] = torch.where(x1v < 0.0, 1.0, 0.125)
35
+ w[kIPR] = torch.where(x1v < 0.0, 1.0, 0.1)
36
+ w[kIV1] = w[kIV2] = w[kIV3] = 0.0
37
+
38
+ # internal boundary
39
+ r1 = torch.sqrt(x1v * x1v + x2v * x2v + x3v * x3v)
40
+ solid = torch.where(r1 < 0.1, 1, 0).to(torch.bool)
41
+
42
+ block_vars = {}
43
+ block_vars["hydro_w"] = w
44
+ block_vars["solid"] = solid
45
+ block_vars = block.initialize(block_vars)
46
+
47
+ # integration
48
+ current_time = 0.0
49
+ block.make_outputs(block_vars, current_time)
50
+
51
+ while not block.intg.stop(block.inc_cycle(), current_time):
52
+ dt = block.max_time_step(block_vars)
53
+ block.print_cycle_info(block_vars, current_time, dt)
54
+
55
+ for stage in range(len(block.intg.stages)):
56
+ block.forward(block_vars, dt, stage)
57
+
58
+ err = block.check_redo(block_vars)
59
+ if err > 0:
60
+ continue # redo current step
61
+ if err < 0:
62
+ break # terminate
63
+
64
+ current_time += dt
65
+ block.make_outputs(block_vars, current_time)
66
+
67
+ block.finalize(block_vars, current_time)
@@ -0,0 +1,60 @@
1
+ reference-state:
2
+ Tref: 0.
3
+ Pref: 1.e5
4
+
5
+ species:
6
+ - name: dry
7
+ composition: {O: 0.42, N: 1.56, Ar: 0.01}
8
+ cv_R: 2.5
9
+
10
+ geometry:
11
+ type: cartesian
12
+ bounds: {x1min: -0.5, x1max: 0.5, x2min: -0.5, x2max: 0.5, x3min: -0.5, x3max: 0.5}
13
+ cells: {nx1: 256, nx2: 256, nx3: 1, nghost: 3}
14
+
15
+ dynamics:
16
+ equation-of-state:
17
+ type: ideal-gas
18
+ density-floor: 1.e-10
19
+ pressure-floor: 1.e-10
20
+ limiter: false
21
+
22
+ vertical-projection:
23
+ type: none
24
+ pressure-margin: 1.e-6
25
+
26
+ reconstruct:
27
+ vertical: {type: weno5, scale: false, shock: true}
28
+ horizontal: {type: weno5, scale: false, shock: true}
29
+
30
+ riemann-solver:
31
+ type: hllc
32
+
33
+ boundary-condition:
34
+ internal:
35
+ solid-density: 1.e3
36
+ solid-pressure: 1.e9
37
+ max-iter: 5
38
+
39
+ external:
40
+ x1-inner: outflow
41
+ x1-outer: outflow
42
+ x2-inner: outflow
43
+ x2-outer: outflow
44
+ x3-inner: outflow
45
+ x3-outer: outflow
46
+
47
+ integration:
48
+ type: rk3
49
+ cfl: 0.9
50
+ implicit-scheme: 0
51
+ nlim: 200
52
+ tlim: 1.0
53
+ ncycle_out: 10
54
+
55
+ outputs:
56
+ - type: restart
57
+ dt: 0.1
58
+ - type: netcdf
59
+ variables: [prim]
60
+ dt: 0.01
@@ -0,0 +1,101 @@
1
+ import torch
2
+ import math
3
+ import time
4
+ import kintera
5
+ from snapy import MeshBlockOptions, MeshBlock
6
+ from snapy import kIDN, kIPR
7
+
8
+
9
+ def call_user_output(bvars):
10
+ hydro_w = bvars["hydro_w"]
11
+ out = {}
12
+ temp = hydro_w[kIPR] / (Rd * hydro_w[kIDN])
13
+ out["temp"] = temp
14
+ out["theta"] = temp * (p0 / hydro_w[kIPR]).pow(Rd / cp)
15
+ return out
16
+
17
+
18
+ p0 = 1.0e5
19
+ Ts = 300.0
20
+ xc = 0.0
21
+ xr = 4.0e3
22
+ zc = 3.0e3
23
+ zr = 2.0e3
24
+ dT = -15.0
25
+ grav = 9.8
26
+ Rd = 287.0
27
+ gamma = 1.4
28
+ K = 75.0
29
+
30
+ # use cuda if available
31
+ if torch.cuda.is_available():
32
+ device = torch.device("cuda:0")
33
+ else:
34
+ device = torch.device("cpu")
35
+
36
+ # set hydrodynamic options
37
+ op = MeshBlockOptions.from_yaml("straka.yaml")
38
+
39
+ # initialize block
40
+ block = MeshBlock(op)
41
+ block.to(device)
42
+
43
+ # get handles to modules
44
+ coord = block.module("hydro.coord")
45
+ thermo = block.module("hydro.eos.thermo")
46
+ eos = block.module("hydro.eos")
47
+
48
+ # thermodynamics
49
+ Rd = kintera.constants.Rgas / kintera.species_weights()[0]
50
+ cv = kintera.species_cref_R()[0] * Rd
51
+ cp = cv + Rd
52
+
53
+ # setup a meshgrid for simulation
54
+ x3v, x2v, x1v = torch.meshgrid(
55
+ coord.buffer("x3v"), coord.buffer("x2v"), coord.buffer("x1v"), indexing="ij"
56
+ )
57
+
58
+ # dimensions
59
+ nc3 = coord.buffer("x3v").shape[0]
60
+ nc2 = coord.buffer("x2v").shape[0]
61
+ nc1 = coord.buffer("x1v").shape[0]
62
+ nvar = 5
63
+
64
+ w = torch.zeros((nvar, nc3, nc2, nc1), device=device)
65
+
66
+ L = torch.sqrt(((x2v - xc) / xr) ** 2 + ((x1v - zc) / zr) ** 2)
67
+ temp = Ts - grav * x1v / cp
68
+
69
+ w[kIPR] = p0 * torch.pow(temp / Ts, cp / Rd)
70
+ temp += torch.where(L <= 1, dT * (torch.cos(L * math.pi) + 1.0) / 2.0, 0)
71
+ w[kIDN] = w[kIPR] / (Rd * temp)
72
+
73
+ block_vars = {}
74
+ block_vars["hydro_w"] = w
75
+ block_vars = block.initialize(block_vars)
76
+
77
+ block.set_user_output_func(call_user_output)
78
+
79
+ # integration
80
+ start_time = time.time()
81
+ current_time = 0.0
82
+ block.make_outputs(block_vars, current_time)
83
+
84
+ while not block.intg.stop(block.inc_cycle(), current_time):
85
+ dt = block.max_time_step(block_vars)
86
+ block.print_cycle_info(block_vars, current_time, dt)
87
+
88
+ for stage in range(len(block.intg.stages)):
89
+ block.forward(block_vars, dt, stage)
90
+
91
+ err = block.check_redo(block_vars)
92
+ if err > 0:
93
+ continue # redo current step
94
+ if err < 0:
95
+ break # terminate
96
+
97
+ current_time += dt
98
+ block.make_outputs(block_vars, current_time)
99
+
100
+ block.finalize(block_vars, current_time)
101
+ print("elapsed time = ", time.time() - start_time)
@@ -0,0 +1,74 @@
1
+ reference-state:
2
+ Tref: 0.
3
+ Pref: 1.e5
4
+
5
+ species:
6
+ - name: dry
7
+ composition: {O: 0.42, N: 1.56, Ar: 0.01}
8
+ cv_R: 2.5
9
+
10
+ geometry:
11
+ type: cartesian
12
+ bounds: {x1min: 0., x1max: 6.4e3, x2min: 0., x2max: 25.6e3, x3min: 0., x3max: 25.6e3}
13
+ cells: {nx1: 64, nx2: 256, nx3: 1, nghost: 3}
14
+
15
+ dynamics:
16
+ equation-of-state:
17
+ type: ideal-gas
18
+ density-floor: 1.e-10
19
+ pressure-floor: 1.e-10
20
+ limiter: false
21
+
22
+ vertical-projection:
23
+ type: temperature
24
+ pressure-margin: 1.e-6
25
+
26
+ reconstruct:
27
+ vertical: {type: weno5, scale: false, shock: false}
28
+ horizontal: {type: weno5, scale: false, shock: false}
29
+
30
+ riemann-solver:
31
+ type: lmars
32
+
33
+ boundary-condition:
34
+ internal:
35
+ solid-density: 1.e3
36
+ solid-pressure: 1.e9
37
+ max-iter: 5
38
+
39
+ external:
40
+ x1-inner: reflecting
41
+ x1-outer: reflecting
42
+ x2-inner: reflecting
43
+ x2-outer: reflecting
44
+ x3-inner: reflecting
45
+ x3-outer: reflecting
46
+
47
+ integration:
48
+ type: rk3
49
+ cfl: 0.9
50
+ implicit-scheme: 0
51
+ nlim: -1
52
+ tlim: 900
53
+ ncycle_out: 10
54
+
55
+ outputs:
56
+ - type: restart
57
+ dt: 300.
58
+ - type: netcdf
59
+ variables: [prim, uov]
60
+ dt: 30.
61
+
62
+ forcing:
63
+ const-gravity:
64
+ grav1: -9.8
65
+
66
+ problem:
67
+ p0: 1.e5
68
+ Ts: 300.
69
+ xc: 0.
70
+ xr: 4.e3
71
+ zc: 3.e3
72
+ zr: 2.e3
73
+ dT: -15.
74
+ K: 75.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes