Skip to content

Commit

Permalink
Makes box2 run through
Browse files Browse the repository at this point in the history
- Minimal fixes to make box2 work as expected
- Example used Python2, very old...
- As such, is not a good representation of how UEDGE or Python should be used
Would be wise to replace/update case completely in the future
  • Loading branch information
holm10 committed Oct 17, 2023
1 parent 6f5e384 commit 8b60376
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion pyexamples/box2/box2_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# This is a Python version of the box case from Andreas Holm
###########################################################################

from uedge import bbb, com, grd


#-Geometry
bbb.mhdgeo=-1 #-set cartesian geometry
Expand Down Expand Up @@ -96,7 +98,7 @@


#-Neutral gas propeties
bbb.tfcx=5.;bbb.tfcy=5. #Franck-Condon temperatures
#bbb.tfcx=5.;bbb.tfcy=5. #Franck-Condon temperatures
bbb.cngfx=1.;bbb.cngfy=1. #turn-on grad(T_g) flux if =1
bbb.cngflox=1.;bbb.cngfloy=0. #turn-on drift with ions if =1
bbb.cngmom = 1. #ion-gas momentum transfer
Expand Down
6 changes: 4 additions & 2 deletions pyexamples/box2/plotcontour.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from uedge import bbb, com
gs=gridspec.GridSpec(2, 2)

plt.figure(10)
plt.subplot(gs[0,0])
CS = plt.contour(com.zm[:,:,0], com.rm[:,:,0], bbb.te/ev)
CS = plt.contour(com.zm[:,:,0], com.rm[:,:,0], bbb.te/bbb.ev)
plt.clabel(CS, inline=1, fontsize=10)
params = {'mathtext.default': 'regular' }
plt.rcParams.update(params)
Expand All @@ -14,7 +16,7 @@


plt.subplot(gs[0,1])
CS = plt.contour(com.zm[:,:,0], com.rm[:,:,0], bbb.ti/ev)
CS = plt.contour(com.zm[:,:,0], com.rm[:,:,0], bbb.ti/bbb.ev)
plt.clabel(CS, inline=1, fontsize=10)
plt.title('T$\mathregular{_i}$ [ev]')
plt.grid(True)
Expand Down
21 changes: 12 additions & 9 deletions pyexamples/box2/runcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@
import matplotlib.gridspec as gridspec
import numpy as np
import os
from uedge.uedgeplots import *
from uedge.rundt import rundt

#-import some utilities for using OS
###execfile(os.path.join(os.environ['HOME'], 'utils/python/osfun.py'))

def paws():
programPause = input("Press the <ENTER> key to continue...")

##-how to do this better?
#-in .bashrc: "export PYLIB=/home/umansky1/PyUEDGE/uedge/pylib"
execfile(os.environ['PYLIB']+"/plotmesh.py")
execfile(os.environ['PYLIB']+"/plotcontour.py")
execfile(os.environ['PYLIB']+"/plotvar.py")
execfile(os.environ['PYLIB']+"/paws.py")
execfile(os.environ['PYLIB']+"/osfun.py")
#execfile(os.environ['PYLIB']+"/plotmesh.py")
#execfile(os.environ['PYLIB']+"/plotcontour.py")
#execfile(os.environ['PYLIB']+"/plotvar.py")
#execfile(os.environ['PYLIB']+"/osfun.py")
#execfile("../../plotmesh.py")
#execfile("../../pylib/plotvar.py")
#execfile("../../pylib/plotr.py")
Expand All @@ -32,7 +35,7 @@


#-read UEDGE settings
execfile("box2_in.py")
from box2_in import *


#-do a quick preliminary run to set all internals
Expand All @@ -41,7 +44,7 @@

#-show grid
plotmesh()
wait = raw_input("PAUSING, PRESS ENTER TO CONTINUE...")
wait = input("PAUSING, PRESS ENTER TO CONTINUE...")


#-this should be done in uefacets
Expand All @@ -66,13 +69,13 @@
bbb.isbcwdt=1
bbb.dtreal = 1e-14; bbb.itermx=30; bbb.exmain()
bbb.t_stop=1e0
bbb.rundt()
rundt()
bbb.dtreal=1e20; bbb.isbcwdt=0; bbb.exmain()
hdf5_save('mycase.h5')


###execfile('plotcontour.py')
plotcontour()
from plotcontour import *
paws()


Expand Down

0 comments on commit 8b60376

Please sign in to comment.