Skip to content

Commit

Permalink
cvode and condition_order args
Browse files Browse the repository at this point in the history
  • Loading branch information
nrnhines committed Jan 5, 2025
1 parent 7d1aee7 commit a4efb10
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions args.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
type=float,
default=100.)

parser.add_argument("-method",
dest='method',
metavar='N',
help="0-fixed, 1-global cvode, 2-local cvode",
type=int,
default=0)

parser.add_argument("-2nd_order_thresh",
dest='thresh_order2',
action='store_true',
help="2nd order correct threshold detection (cvode only)",
default=False)

parser.add_argument("-gran",
metavar='N',
help="global Random123 index (default 0)",
Expand Down
14 changes: 14 additions & 0 deletions ringtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
# stop time of simulation
tstop = args.tstop

# Which integration method to use
method = args.method

# Cvode threshold detection --- first or second order
condition_order = 2 if args.thresh_order2 is True else 1

# whether to randomize cell parameters
randomize_parameters = args.rparm

Expand Down Expand Up @@ -76,6 +82,9 @@
print ("%s %s" % (str(nbranch), str(ncompart)))
print ("nring=%d\ncell per ring=%d\nncell_per_type=%d" % (nring, ncell, ncell_per_type))
print ("ntype=%d" % ntype)
methname=["fixed", "global vardt, ", "local vardt, "]
co = "condition_order="+str(condition_order) if method else ""
print ("method = %s %s" % (methname[method], co))

#from cell import BallStick
h.load_file("cell.hoc")
Expand Down Expand Up @@ -195,6 +204,11 @@ def create_rings():

## Initialize ##

if method > 0:
h.cvode.condition_order(condition_order)
h.cvode.active(1)
if (method == 2):
h.cvode.use_local_dt(1)
pc.set_maxstep(10)
h.stdinit()
timeit("initialized", settings.rank)
Expand Down

0 comments on commit a4efb10

Please sign in to comment.