Skip to content

Commit

Permalink
Merge pull request #50 from LLNL/ContinuationSolver
Browse files Browse the repository at this point in the history
Initial implementation of continuation solve
  • Loading branch information
holm10 authored Oct 27, 2023
2 parents 153a803 + 95b8ae6 commit edc9ab4
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions pyscripts/rundt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ def __init__(self, *args, n_stor = False, **kwargs):
# TODO: Add restore/recover from timeslice
# TODO: Add plot timeslice directly
# NOTE: No -> Utilize direct I/O from file instead
self.numvar = bbb.numvar
try:
self.nx
except:
self.nx = com.nx
try:
self.ny
except:
self.ny = com.ny
self.ixpt1 = com.ixpt1[0]
self.ixpt2 = com.ixpt2[0]
self.iysptrx = com.iysptrx
self.equationkey = array([b'te', b'ti', b'phi', b'up', b'ni', b'ng',
b'tg'])

Expand Down Expand Up @@ -49,7 +61,15 @@ def itroub(self):
bbb.idxu, bbb.idxn, bbb.idxg, bbb.idxtg]
equationsdescription = [ 'Electron energy', 'Ion energy', 'Potential',
'Ion momentum', 'Ion density', 'Gas density', 'Gas temperature']

# Assert required dict is present
try:
self.classvars
except:
self.classvars = {}
for cvar in ['itrouble', 'troubleeq', 'internaleq',
'internalspecies', 'troubleindex', 'dtrealfail',
'ylfail', 'yldotsfscalfail']:
self.classvars[cvar] = []
# Find the fortran index of the troublemaking equation
self.classvars['itrouble'].append(deepcopy(argmax(abs(bbb.yldot*\
bbb.sfscal)[:bbb.neq])+1))
Expand Down Expand Up @@ -120,7 +140,7 @@ def store_timeslice(self):
for var in ['ni', 'ng', 'up', 'te', 'ti', 'tg', 'phi', 'dt_tot']:
self.classvars['slice_{}'.format(var)].append(deepcopy(getattr(bbb, var)))


def save_intermediate(self, savename):
from uedge.hdf5 import hdf5_save
from os.path import exists
Expand Down Expand Up @@ -906,7 +926,6 @@ def dostaticiter():
return True
return False


def staticiter():
""" Tries to reduce initial fnrm by iterating at constant var """
from uedge import bbb
Expand Down Expand Up @@ -1140,6 +1159,10 @@ def dtsolve(dtdeltafac):
bbb.ftol = ftol
bbb.incpset = incpset
bbb.itermx = itermx
# TODO: Resolve how to run continuation solver w/ mmaxu
# TODO: Add coding for autodetecting when avg nfe approx mmaxu
# and upate jacobian then

# bbb.ismmaxuc = 0
# bbb.mmaxu = 70
if (bbb.iterm == 1) and (bbb.ijactot > 0):
Expand Down

0 comments on commit edc9ab4

Please sign in to comment.