Skip to content

Commit

Permalink
STORM 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Aug 19, 2018
0 parents commit ccad791
Show file tree
Hide file tree
Showing 49 changed files with 4,862 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
.nfs*

# BOUT files #
*dmp*
*restart*
*log*
*.dat
*.png
*.mat
*~
*pyc
*.pkl
*.nc
BOUT.settings

# videos and images #
*.png
*.mp4
*.gif
*.jpeg
*.bmp
*.pdf

*filaments
data_*
*.txt
storm2d/storm2d
675 changes: 675 additions & 0 deletions COPYING

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
STORM
-----

STORM plasma simulation model, built using BOUT++ framework.

Table of Contents
-----------------

* [Options](/doc/options.md)

License
-------

If you use STORM, please cite the relevant papers (see
[References](#references)) in any publication. We also request that you contact
us (email:fulvio.[email protected]) if you want to use or modify STORM.

Full text of the license is in the file COPYING.

Copyright L. Easy, F. Militello, T. Nicholas, J. Omotani, F. Riva, N.
Walkden, UKAEA, 2017, 2018
email: [email protected]

This file is part of the STORM module of BOUT++.

STORM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

STORM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with STORM. If not, see <https://www.gnu.org/licenses/>.

References
----------

[1] L. Easy, F. Militello, J. Omotani, B. Dudson, E. Havlíčková, P. Tamain, V.
Naulin, and A. H. Nielsen, Physics of Plasmas 21, 122515 (2014),
https://doi.org/10.1063/1.4904207

[2] L. Easy, F. Militello, J. Omotani, N.R. Walkden, and B. Dudson, Physics of
Plasmas 23, 012512 (2016), https://doi.org/10.1063/1.4940330

[3] N.R. Walkden, L. Easy, F. Militello and J.T. Omotani, Plasma Physics and
Controlled Fusion 58, 115010 (2016),
https://doi.org/10.1088/0741-3335/58/11/115010

[4] F. Militello, B. Dudson, L. Easy, A. Kirk and P. Naylor, Plasma Physics and
Controlled Fusion 59, 125013 (2017), https://doi.org/10.1088/1361-6587/aa9252
221 changes: 221 additions & 0 deletions doc/options.md

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions storm2d/data/BOUT.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
timestep = 25 # Timestep length of outputted data
nout = 20 # Number of outputted timesteps

MZ = 256 # Number of Z points
zmin = 0
zmax = mesh:Lz/2./pi # input z is fracs of 2pi
myg = 0 # No need for Y communications

[mesh]
Ly = 5500.0
Lx = 150.0
Lz = 100.0

nx = 388 # including 4 guard cells
ny = 1 # excluding guard cells
dx = Lx/(nx-4)

[storm]
B_0 = 0.5 # Tesla
T_e0 = 20 # eV
T_i0 = 20 # eV
m_i = 2 # Atomic Units
q = 7 # Dimensionless
R_c = 1.5 # m
n_0 = 0.5e19 # m^-3
Z = 1 # Dimensionless
loglambda = -1 # Dimensionless

bracket = 2 # 0 = std, 1 = simple, 2 = arakawa
isothermal = true # switch for isothermal simulations
SOL_closure = sheath_diss # choice of parallel closure to use

[blob]
A = 2
delta_x = 10
delta_z = 10
x0 = 0.25
z0 = 0.5

[All]
bndry_all = neumann

[n]
function = 1.0 + (blob:A)*exp(-(mesh:Lx*(x-blob:x0)/blob:delta_x)*(mesh:Lx*(x-blob:x0)/blob:delta_x))*exp(-(mesh:Lz*((z/(2*pi))-blob:z0)/blob:delta_z)*(mesh:Lz*((z/(2*pi))- blob:z0)/blob:delta_z))

[T]
function = 1.

[vort]
#function = 0.

[sigma_n] # Density sink
#function = 1.119e-4

[sigma_T] # Temperature sink
#function = 2.326e-3

[sigma_vort] # Vorticity sink
#function = 1.119e-4

[mesh:ddx]
first = C2
second = C2
upwind = C2

[mesh:ddz]
first = C2
second = C2
upwind = C2

[laplace]
global_flags = 0
inner_boundary_flags = 0
outer_boundary_flags = 0

[solver]
type=pvode
mxstep = 100000000 # max steps before result is deemed not to converge
#atol = 1e-12 # Absolute tolerance
#rtol = 1e-5 # Relative tolerance

25 changes: 25 additions & 0 deletions storm2d/data/viewdata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3

from boututils.showdata import showdata
from boutdata import collect
from numpy import *
from matplotlib import pyplot as plt
import sys
import os

# T = collect('T', tind = [5500,6000], yguards = False)
phi = collect('phi', yguards = False)
n = collect('n', yguards = False)
vort = collect('vort', yguards = False)

x = slice(2,-2)
y = 0
z = slice(None)
t = slice(None)

n = n[t,x,y,z]
phi = phi[t,x,y,z]
# T = T[t,x,y,z]
vort = vort[t,x,y,z]

showdata([[n], [phi], [vort]], titles = ['n', 'phi', 'vort'])
84 changes: 84 additions & 0 deletions storm2d/filament_scan
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env python

# Copyright L. Easy, F. Militello, T. Nicholas, J. Omotani, F. Riva, N.
# Walkden, UKAEA, 2017, 2018
# email: [email protected]
#
# This file is part of the STORM module of BOUT++.
#
# STORM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# STORM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with STORM. If not, see <https://www.gnu.org/licenses/>.

from boututils.run_wrapper import shell, launch, getmpirun
from boutdata import collect
from boutdata.data import BoutOptionsFile
import numpy as np
import os
import shutil

delta_perp_list = [10,12,14,16,18,20,25,30,35,40,45,50,55,60]
sheath_dissipation = True
short_run = True
nproc = 8

MPIRUN = getmpirun()

for delta_perp in delta_perp_list:
print "running delta_perp =", delta_perp
path = "d" + str(delta_perp)
if (sheath_dissipation):
path = path + "_SD"
else:
path = path + "_VA"

if(short_run):
path = path + "_s"
if not os.path.exists(path):
os.makedirs(path)

shutil.copy("data/BOUT.inp", path)

# Determine timestep to use
options = BoutOptionsFile(path+"/BOUT.inp")
storm_options = options["storm"]
Te = storm_options.evaluate_scalar("T_e0")
e = 1.602176565e-19
m_i = storm_options.evaluate_scalar("m_i")*1.66053892e-27
B0 = storm_options.evaluate_scalar("B_0")
Omega_i = e*B0/m_i
c_s = (Te*e/m_i)**0.5
rho_s = c_s/Omega_i
R_c = storm_options.evaluate_scalar("R_c")
g = 2*(rho_s)/R_c
interchange_time = (float(delta_perp)/g)**0.5

timestep = 100

if(short_run):
timestep = interchange_time/3

# Need to scale dx, Zmax by delta_perp
Lx = 15.0*delta_perp
Lz = 10.0*delta_perp

arguments = "-d " + path + " timestep=" + str(timestep) + " mesh:Lx=" + str(Lx) + " mesh:Lz=" + str(Lz) + " blob:delta_x=" + str(delta_perp) + " blob:delta_z=" + str(delta_perp)

# Command to run
cmd = "./storm2d " + arguments
# Launch using MPI
s, out = launch(cmd, runcmd=MPIRUN, nproc=nproc, pipe=True)

# Save output to log file
f = open(path+"/output.log", "w")
f.write(out)
f.close()
2 changes: 2 additions & 0 deletions storm2d/make.config.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# make.config sets user-defined values, for example the path to the BOUT++ directory
BOUT_TOP =../../BOUT-dev
29 changes: 29 additions & 0 deletions storm2d/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright L. Easy, F. Militello, T. Nicholas, J. Omotani, F. Riva, N.
# Walkden, UKAEA, 2017, 2018
# email: [email protected]
#
# This file is part of the STORM module of BOUT++.
#
# STORM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# STORM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with STORM. If not, see <https://www.gnu.org/licenses/>.

# Set user-specified values
ifneq ("$(wildcard make.config)","")
include make.config
else
$(error "The 'make.config' file does not exist. You must create it for STORM to compile. See the example in 'make.config.example'")
endif

SOURCEC = storm2d.cxx

include $(BOUT_TOP)/make.config
40 changes: 40 additions & 0 deletions storm2d/savematlab2d
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python

# Copyright L. Easy, F. Militello, T. Nicholas, J. Omotani, F. Riva, N.
# Walkden, UKAEA, 2017, 2018
# email: [email protected]
#
# This file is part of the STORM module of BOUT++.
#
# STORM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# STORM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with STORM. If not, see <https://www.gnu.org/licenses/>.

#from boututils import shell, launch, getmpirun
from boutdata import collect
from scipy import io as sio
import numpy as np
import os
import shutil

os.chdir('data')

#Read in Data
t = collect('t_array')
n = collect('n', yguards = True)
T = collect('T', yguards = True)
phi = collect('phi', yguards = True)
vort = collect('vort', yguards = True)

sio.savemat("matlab_output.mat", mdict={'t':t, 'n':n, 'T':T, 'phi':phi, 'vort':vort})

os.chdir('../')
Loading

0 comments on commit ccad791

Please sign in to comment.