Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polishing off 3D Classic support in data.py #43

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 41 additions & 60 deletions src/python/clawutil/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,76 +444,57 @@ class ClawInputData(Data):
Object that will be written out to claw.data.
"""
def __init__(self, ndim):
if (not isinstance(ndim, int)):
raise AttributeError("Unsupported data type %s for number of dimensions in ClawInputData"%type(ndim))
if (ndim < 1 or ndim > 3):
raise AttributeError("Unsupported number of dimensions %d for ClawInputData"%ndim)

super(ClawInputData,self).__init__()
self.add_attribute('ndim',ndim)

# Set default values:
if ndim == 1:
self.add_attribute('mx',100)
self.add_attribute('nout',5)
self.add_attribute('outstyle',1)
self.add_attribute('tfinal',1.0)
self.add_attribute('dt_initial',1.e-5)
self.add_attribute('dt_max',1.e99)
self.add_attribute('cfl_desired',0.9)
self.add_attribute('cfl_max',1.0)
self.add_attribute('max_steps',5000)
self.add_attribute('dt_variable',1)
self.add_attribute('order',2)
self.add_attribute('order_trans',0)
self.add_attribute('verbosity',0)
self.add_attribute('src_split',0)
self.add_attribute('mcapa',0)
self.add_attribute('maux',0)
self.add_attribute('meqn',1)
self.add_attribute('mwaves',1)
self.add_attribute('mthlim',[4])
self.add_attribute('t0',0.)
self.add_attribute('xlower',0.)
self.add_attribute('xupper',1.)
self.add_attribute('mbc',2)
self.add_attribute('mthbc_xlower',1)
self.add_attribute('mthbc_xupper',1)
self.add_attribute('restart',0)
self.add_attribute('N_restart',0)


elif ndim == 2:
self.add_attribute('mx',100)
self.add_attribute('mx',100)
self.add_attribute('nout',5)
self.add_attribute('outstyle',1)
self.add_attribute('tfinal',1.0)
self.add_attribute('dt_initial',1.e-5)
self.add_attribute('dt_max',1.e99)
self.add_attribute('cfl_desired',0.9)
self.add_attribute('cfl_max',1.0)
self.add_attribute('max_steps',5000)
self.add_attribute('dt_variable',1)
self.add_attribute('order',2)
self.add_attribute('order_trans',2)
self.add_attribute('verbosity',0)
self.add_attribute('src_split',0)
self.add_attribute('mcapa',0)
self.add_attribute('maux',0)
self.add_attribute('meqn',1)
self.add_attribute('mwaves',1)
self.add_attribute('mthlim',[4])
self.add_attribute('t0',0.)
self.add_attribute('xlower',0.)
self.add_attribute('xupper',1.)
self.add_attribute('mbc',2)
self.add_attribute('mthbc_xlower',1)
self.add_attribute('mthbc_xupper',1)
self.add_attribute('restart',0)
self.add_attribute('N_restart',0)

if ndim > 1:
self.add_attribute('my',100)
self.add_attribute('nout',5)
self.add_attribute('outstyle',1)
self.add_attribute('tfinal',1.0)
self.add_attribute('dt_initial',1.e-5)
self.add_attribute('dt_max',1.e99)
self.add_attribute('cfl_desired',0.9)
self.add_attribute('cfl_max',1.0)
self.add_attribute('max_steps',5000)
self.add_attribute('dt_variable',1)
self.add_attribute('order',2)
self.add_attribute('order_trans',2)
self.add_attribute('verbosity',0)
self.add_attribute('src_split',0)
self.add_attribute('mcapa',0)
self.add_attribute('maux',0)
self.add_attribute('meqn',1)
self.add_attribute('mwaves',1)
self.add_attribute('mthlim',[4])
self.add_attribute('t0',0.)
self.add_attribute('xlower',0.)
self.add_attribute('xupper',1.)
self.add_attribute('ylower',0.)
self.add_attribute('yupper',1.)
self.add_attribute('mbc',2)
self.add_attribute('mthbc_xlower',1)
self.add_attribute('mthbc_xupper',1)
self.add_attribute('mthbc_ylower',1)
self.add_attribute('mthbc_yupper',1)
self.add_attribute('restart',0)
self.add_attribute('N_restart',0)

else:
raise AttributeError("Only ndim=1 or 2 supported so far")
if ndim == 3:
self.add_attribute('mz',100)
self.add_attribute('zlower',0.)
self.add_attribute('zupper',1.)
self.add_attribute('mthbc_zlower',1)
self.add_attribute('mthbc_zupper',1)


def write(self):
print 'Creating data file claw.data for use with xclaw'
Expand Down