Skip to content

Commit e1cbb3f

Browse files
authored
Merge branch 'development' into MagneX_hybrid_ML
2 parents 2c773d5 + 4372ba8 commit e1cbb3f

35 files changed

Lines changed: 818 additions & 246 deletions

Exec/DMI_diagnostic/DMI_diagnostic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ main (int argc,
118118
int k = (hi.z+1)/2;
119119
int j = (hi.y+1)/2;
120120
for (auto i = (hi.x+1)/2; i <= hi.x; ++i) {
121-
std::cout << i << " " << mfdata(i,j,k,3)/1.1e6 << " " << mfdata(i,j,k,16)+offset << "\n";
121+
std::cout << i << " " << mfdata(i,j,k,2)/1.1e6 << " " << mfdata(i,j,k,3)+offset << "\n";
122122
// 2pi cyclic fix
123123
if (i<hi.x) {
124-
if (offset==0. && mfdata(i,j,k,16)>5. && mfdata(i+1,j,k,16)<1.) {
124+
if (offset==0. && mfdata(i,j,k,3)>5. && mfdata(i+1,j,k,3)<1.) {
125125
offset = 2.*M_PI;
126126
}
127127
}

Exec/GNUmakefile

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,43 +74,14 @@ endif
7474
# else
7575
# LDFLAGS += -Wl,--no-as-needed,-rpath=$(TORCH_LIBPATH) $(TORCH_LIBS)
7676
# endif
77+
SUNDIALS_HOME ?= ../../sundials/instdir
7778

7879
include $(AMREX_HOME)/Tools/GNUMake/Make.defs
7980

8081
include ../Source/Make.package
8182
VPATH_LOCATIONS += ../Source
8283
INCLUDE_LOCATIONS += ../Source
8384

84-
ifeq ($(USE_SUNDIALS),TRUE)
85-
ifeq ($(USE_CUDA),TRUE)
86-
SUNDIALS_ROOT ?= $(TOP)../../sundials/instdir_cuda
87-
else
88-
SUNDIALS_ROOT ?= $(TOP)../../sundials/instdir
89-
endif
90-
ifeq ($(NERSC_HOST),perlmutter)
91-
SUNDIALS_LIB_DIR ?= $(SUNDIALS_ROOT)/lib64
92-
else
93-
SUNDIALS_LIB_DIR ?= $(SUNDIALS_ROOT)/lib
94-
endif
95-
96-
USE_CVODE_LIBS ?= TRUE
97-
USE_ARKODE_LIBS ?= TRUE
98-
99-
DEFINES += -DAMREX_USE_SUNDIALS
100-
INCLUDE_LOCATIONS += $(SUNDIALS_ROOT)/include
101-
LIBRARY_LOCATIONS += $(SUNDIALS_LIB_DIR)
102-
103-
LIBRARIES += -L$(SUNDIALS_LIB_DIR) -lsundials_cvode
104-
LIBRARIES += -L$(SUNDIALS_LIB_DIR) -lsundials_arkode
105-
LIBRARIES += -L$(SUNDIALS_LIB_DIR) -lsundials_nvecmanyvector
106-
LIBRARIES += -L$(SUNDIALS_LIB_DIR) -lsundials_core
107-
108-
ifeq ($(USE_CUDA),TRUE)
109-
LIBRARIES += -L$(SUNDIALS_LIB_DIR) -lsundials_nveccuda
110-
endif
111-
112-
endif
113-
11485
include $(AMREX_HOME)/Src/Base/Make.package
11586
include $(AMREX_HOME)/Src/FFT/Make.package
11687
include $(AMREX_HOME)/Src/Boundary/Make.package

Exec/README_sundials

Lines changed: 3 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,4 @@
1-
SUNDIALS installation guide:
2-
https://computing.llnl.gov/projects/sundials/faq#inst
1+
Refer to https://amrex-codes.github.io/amrex/docs_html/TimeIntegration_Chapter.html
2+
for SNUDIALS installation, build, and usage instructions.
33

4-
Installation
5-
6-
# You need SUNDIALS v7.1.1 or later.
7-
# Check https://computing.llnl.gov/projects/sundials/sundials-software to see if it's available for download.
8-
# If so, download sundials-x.y.z.tar.gz and extract it at the same level as amrex using
9-
>> tar -xzvf sundials-x.y.z.tar.gz # where x.y.z is the version of sundials
10-
>> mv sundials-x.y.z sundials-src
11-
12-
# If v7.1.1. is not available on the website, clone the git repo directly and use the latest version
13-
# At the same level that amrex is cloned, do:
14-
15-
>> git clone https://github.com/LLNL/sundials.git
16-
>> mv sundials sundials-src
17-
18-
# Next
19-
20-
>> mkdir sundials
21-
>> cd sundials
22-
23-
######################
24-
HOST BUILD
25-
######################
26-
27-
>> mkdir instdir
28-
>> mkdir builddir
29-
>> cd builddir
30-
31-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir/examples -DENABLE_MPI=ON ../../sundials-src
32-
33-
######################
34-
NVIDIA/CUDA BUILD
35-
######################
36-
37-
# Navigate back to the 'sundials' directory and do:
38-
39-
>> mkdir instdir_cuda
40-
>> mkdir builddir_cuda
41-
>> cd builddir_cuda
42-
43-
>> cmake -DCMAKE_INSTALL_PREFIX=/pathto/sundials/instdir_cuda -DEXAMPLES_INSTALL_PATH=/pathto/sundials/instdir_cuda/examples -DENABLE_CUDA=ON -DENABLE_MPI=ON ../../sundials-src
44-
45-
######################
46-
47-
>> make -j4
48-
>> make install
49-
50-
# in your .bashrc or preferred configuration file, add the following (and then "source ~/.bashrc")
51-
52-
# If you have a CPU build:
53-
54-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir/lib/
55-
56-
# If you have a NVIDIA/CUDA build:
57-
58-
>> export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pathto/sundials/instdir_cuda/lib/
59-
60-
# now you are ready to compile MagneX with:
61-
62-
>> make -j4 USE_SUNDIALS=TRUE # optional to have 'USE_CUDA=TRUE' as well
63-
64-
# in your inputs file, you will need to have:
65-
66-
TimeIntegratorOption = 4 #amrex/sundials backend integrators
67-
68-
# INTEGRATION
69-
## integration.type can take on the following values:
70-
## 0 or "ForwardEuler" => Native AMReX Forward Euler integrator
71-
## 1 or "RungeKutta" => Native AMReX Explicit Runge Kutta controlled by integration.rk.type
72-
## 2 or "SUNDIALS" => SUNDIALS backend controlled by integration.sundials.strategy
73-
integration.type = SUNDIALS
74-
75-
## Native AMReX Explicit Runge-Kutta parameters
76-
#
77-
## integration.rk.type can take the following values:
78-
### 0 = User-specified Butcher Tableau
79-
### 1 = Forward Euler
80-
### 2 = Trapezoid Method
81-
### 3 = SSPRK3 Method
82-
### 4 = RK4 Method
83-
integration.rk.type = 1
84-
85-
# Set the SUNDIALS method type:
86-
# ERK = Explicit Runge-Kutta method
87-
# DIRK = Diagonally Implicit Runge-Kutta method
88-
#
89-
# Optionally select a specific SUNDIALS method by name, see the SUNDIALS
90-
# documentation for the supported method names
91-
92-
# Use forward Euler (fixed step sizes only)
93-
integration.sundials.type = ERK
94-
integration.sundials.method = ARKODE_FORWARD_EULER_1_1
4+
Make sure that SUNDIALS_HOME in the GNUmakefile points to the installation directory.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
amrex.use_gpu_aware_mpi=1
2+
3+
n_cell = 128 128 128
4+
max_grid_size_x = 32
5+
max_grid_size_y = 32
6+
max_grid_size_z = 64
7+
8+
dt = 1.e-15
9+
nsteps = 100
10+
plot_int = -1
11+
chk_int = -1
12+
restart = -1
13+
14+
prob_lo = 0. 0. 0.
15+
prob_hi = 512.e-9 512.e-9 512.e-9
16+
17+
mu0 = 1.25663e-6
18+
19+
Mx_parser(x,y,z) = "8.e5 * (x>0.)*(x<512.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9)"
20+
My_parser(x,y,z) = "0."
21+
Mz_parser(x,y,z) = "0."
22+
23+
# Field 1: mu_0 Hx=-24.6 mT, mu_0 Hy= 4.3 mT, mu_0 Hz= 0.0 mT
24+
# which is a field approximately 25 mT, directed 170 degrees counterclockwise from the positive x axis
25+
timedependent_Hbias = 0
26+
Hx_bias_parser(x,y,z,t) = "1.e5"
27+
Hy_bias_parser(x,y,z,t) = "1.e5"
28+
Hz_bias_parser(x,y,z,t) = "1.e5"
29+
30+
timedependent_alpha = 0
31+
alpha_parser(x,y,z,t) = "(x>0.)*(x<512.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * 0.5"
32+
Ms_parser(x,y,z) = "(x>0.)*(x<512.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * 8.e5"
33+
gamma_parser(x,y,z) = "(x>0.)*(x<512.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * -1.759e11"
34+
exchange_parser(x,y,z) = "(x>0.)*(x<512.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * 1.3e-11"
35+
anisotropy_parser(x,y,z) = "(x>0.)*(x<512.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * -139.26"
36+
DMI_parser(x,y,z) = "(x>0.)*(x<512.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * -4.5e-3"
37+
38+
precession = 1
39+
demag_coupling = 1
40+
FFT_solver = 1
41+
M_normalization = 1 # 0 = unsaturated case; 1 = saturated case
42+
exchange_coupling = 1
43+
anisotropy_coupling = 1
44+
anisotropy_axis = 0.0 0.0 1.0
45+
DMI_coupling = 1
46+
47+
# INTEGRATION
48+
49+
TimeIntegratorOption = 1 #Forward Euler
50+
51+
integration.type = RungeKutta
52+
integration.rk.type = 1
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
amrex.use_gpu_aware_mpi=1
2+
3+
n_cell = 256 128 128
4+
max_grid_size_x = 32
5+
max_grid_size_y = 32
6+
max_grid_size_z = 64
7+
8+
dt = 1.e-15
9+
nsteps = 100
10+
plot_int = -1
11+
chk_int = -1
12+
restart = -1
13+
14+
prob_lo = 0. 0. 0.
15+
prob_hi = 1024.e-9 512.e-9 512.e-9
16+
17+
mu0 = 1.25663e-6
18+
19+
Mx_parser(x,y,z) = "8.e5 * (x>0.)*(x<1024.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9)"
20+
My_parser(x,y,z) = "0."
21+
Mz_parser(x,y,z) = "0."
22+
23+
# Field 1: mu_0 Hx=-24.6 mT, mu_0 Hy= 4.3 mT, mu_0 Hz= 0.0 mT
24+
# which is a field approximately 25 mT, directed 170 degrees counterclockwise from the positive x axis
25+
timedependent_Hbias = 0
26+
Hx_bias_parser(x,y,z,t) = "1.e5"
27+
Hy_bias_parser(x,y,z,t) = "1.e5"
28+
Hz_bias_parser(x,y,z,t) = "1.e5"
29+
30+
timedependent_alpha = 0
31+
alpha_parser(x,y,z,t) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * 0.5"
32+
Ms_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * 8.e5"
33+
gamma_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * -1.759e11"
34+
exchange_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * 1.3e-11"
35+
anisotropy_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * -139.26"
36+
DMI_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<512.e-9)*(z>0.)*(z<512.e-9) * -4.5e-3"
37+
38+
precession = 1
39+
demag_coupling = 1
40+
FFT_solver = 1
41+
M_normalization = 1 # 0 = unsaturated case; 1 = saturated case
42+
exchange_coupling = 1
43+
anisotropy_coupling = 1
44+
anisotropy_axis = 0.0 0.0 1.0
45+
DMI_coupling = 1
46+
47+
# INTEGRATION
48+
49+
TimeIntegratorOption = 1 #Forward Euler
50+
51+
integration.type = RungeKutta
52+
integration.rk.type = 1
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
amrex.use_gpu_aware_mpi=1
2+
3+
n_cell = 256 256 128
4+
max_grid_size_x = 32
5+
max_grid_size_y = 32
6+
max_grid_size_z = 64
7+
8+
dt = 1.e-15
9+
nsteps = 100
10+
plot_int = -1
11+
chk_int = -1
12+
restart = -1
13+
14+
prob_lo = 0. 0. 0.
15+
prob_hi = 1024.e-9 1024.e-9 512.e-9
16+
17+
mu0 = 1.25663e-6
18+
19+
Mx_parser(x,y,z) = "8.e5 * (x>0.)*(x<1024.e-9)*(y>0.)*(y<1024.e-9)*(z>0.)*(z<512.e-9)"
20+
My_parser(x,y,z) = "0."
21+
Mz_parser(x,y,z) = "0."
22+
23+
# Field 1: mu_0 Hx=-24.6 mT, mu_0 Hy= 4.3 mT, mu_0 Hz= 0.0 mT
24+
# which is a field approximately 25 mT, directed 170 degrees counterclockwise from the positive x axis
25+
timedependent_Hbias = 0
26+
Hx_bias_parser(x,y,z,t) = "1.e5"
27+
Hy_bias_parser(x,y,z,t) = "1.e5"
28+
Hz_bias_parser(x,y,z,t) = "1.e5"
29+
30+
timedependent_alpha = 0
31+
alpha_parser(x,y,z,t) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<1024.e-9)*(z>0.)*(z<512.e-9) * 0.5"
32+
Ms_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<1024.e-9)*(z>0.)*(z<512.e-9) * 8.e5"
33+
gamma_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<1024.e-9)*(z>0.)*(z<512.e-9) * -1.759e11"
34+
exchange_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<1024.e-9)*(z>0.)*(z<512.e-9) * 1.3e-11"
35+
anisotropy_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<1024.e-9)*(z>0.)*(z<512.e-9) * -139.26"
36+
DMI_parser(x,y,z) = "(x>0.)*(x<1024.e-9)*(y>0.)*(y<1024.e-9)*(z>0.)*(z<512.e-9) * -4.5e-3"
37+
38+
precession = 1
39+
demag_coupling = 1
40+
FFT_solver = 1
41+
M_normalization = 1 # 0 = unsaturated case; 1 = saturated case
42+
exchange_coupling = 1
43+
anisotropy_coupling = 1
44+
anisotropy_axis = 0.0 0.0 1.0
45+
DMI_coupling = 1
46+
47+
# INTEGRATION
48+
49+
TimeIntegratorOption = 1 #Forward Euler
50+
51+
integration.type = RungeKutta
52+
integration.rk.type = 1
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
amrex.use_gpu_aware_mpi=1
2+
3+
n_cell = 1024 1024 1024
4+
max_grid_size_x = 32
5+
max_grid_size_y = 32
6+
max_grid_size_z = 64
7+
8+
dt = 1.e-15
9+
nsteps = 100
10+
plot_int = -1
11+
chk_int = -1
12+
restart = -1
13+
14+
prob_lo = 0. 0. 0.
15+
prob_hi = 4096.e-9 4096.e-9 4096.e-9
16+
17+
mu0 = 1.25663e-6
18+
19+
Mx_parser(x,y,z) = "8.e5 * (x>0.)*(x<4096.e-9)*(y>0.)*(y<4096.e-9)*(z>0.)*(z<4096.e-9)"
20+
My_parser(x,y,z) = "0."
21+
Mz_parser(x,y,z) = "0."
22+
23+
# Field 1: mu_0 Hx=-24.6 mT, mu_0 Hy= 4.3 mT, mu_0 Hz= 0.0 mT
24+
# which is a field approximately 25 mT, directed 170 degrees counterclockwise from the positive x axis
25+
timedependent_Hbias = 0
26+
Hx_bias_parser(x,y,z,t) = "1.e5"
27+
Hy_bias_parser(x,y,z,t) = "1.e5"
28+
Hz_bias_parser(x,y,z,t) = "1.e5"
29+
30+
timedependent_alpha = 0
31+
alpha_parser(x,y,z,t) = "(x>0.)*(x<4096.e-9)*(y>0.)*(y<4096.e-9)*(z>0.)*(z<4096.e-9) * 0.5"
32+
Ms_parser(x,y,z) = "(x>0.)*(x<4096.e-9)*(y>0.)*(y<4096.e-9)*(z>0.)*(z<4096.e-9) * 8.e5"
33+
gamma_parser(x,y,z) = "(x>0.)*(x<4096.e-9)*(y>0.)*(y<4096.e-9)*(z>0.)*(z<4096.e-9) * -1.759e11"
34+
exchange_parser(x,y,z) = "(x>0.)*(x<4096.e-9)*(y>0.)*(y<4096.e-9)*(z>0.)*(z<4096.e-9) * 1.3e-11"
35+
anisotropy_parser(x,y,z) = "(x>0.)*(x<4096.e-9)*(y>0.)*(y<4096.e-9)*(z>0.)*(z<4096.e-9) * -139.26"
36+
DMI_parser(x,y,z) = "(x>0.)*(x<4096.e-9)*(y>0.)*(y<4096.e-9)*(z>0.)*(z<4096.e-9) * -4.5e-3"
37+
38+
precession = 1
39+
demag_coupling = 1
40+
FFT_solver = 1
41+
M_normalization = 1 # 0 = unsaturated case; 1 = saturated case
42+
exchange_coupling = 1
43+
anisotropy_coupling = 1
44+
anisotropy_axis = 0.0 0.0 1.0
45+
DMI_coupling = 1
46+
47+
# INTEGRATION
48+
49+
TimeIntegratorOption = 1 #Forward Euler
50+
51+
integration.type = RungeKutta
52+
integration.rk.type = 1

0 commit comments

Comments
 (0)