A scratch notebook for testing and developing simmy.


In [2]:
from titan import TitanConfig
from subchandra import SCConfig
#This means that modules will be automatically reloaded when changed.  
#Makes for swift exporatory development, probably a performance hit if using well-tested code.
%load_ext autoreload
%autoreload 2

Simulation & SimulationGrid

SimConfig

XRB Config
SCConfig

In [3]:
#Test SCConfig/SimConfig
test_model_dir = '/home/ajacobs/Research/Projects/Simmy/IPyRoot/SCTestGrid/10044-090-210-4lev-full-512'

#Init from existing test
test_model_config = SCConfig(test_model_dir)
test_model_config.printConfig()


Inputs Configuration
Description: Configuration of the inputs file.  This is the file passed
        to the Maestro executable that sets various Maestro parameters,
        configures the simulation, and provides the location of initial model
        data.
Fields:
    im_file
        Description: Initial model file with data to be read into the Maestro basestate.
        Current value: "sub_chandra.M_WD-1.00.M_He-0.045.hse.C.10240"
    job_name
        Description: Description of the simulation.
        Current value: "512^3 base grid, T_core = 10^7, T_base = 210 MK -- M_WD=1.0, M_He=0.04"
    max_levs
        Description: Number of levels the AMR will refine to.
        Current value: 4
    coarse_res
        Description: Resolution of the base (coarsest) level
        Current value: 512
    anelastic_cutoff
        Description: Density cutoff below which the Maestro velocity constraint is simplified to the anelastic constraint.
        Current value: 64000.0
    octant
        Description: Boolean that sets if an octant or full star should be modeled.
        Current value: .false.
    dim
        Description: Dimensionality of the problem.
        Current value: 3
    physical_size
        Description: Sidelength in cm of the square domain.
        Current value: 1500000000.0
    plot_deltat
        Description: Time interval in s at which to save pltfiles.
        Current value: 10.0d0
    mini_plot_deltat
        Description: Time interval in s at which to save minipltfiles.
        Current value: 0.2d0
    chk_int
        Description: Timestep interval at which to save chkpoint files.
        Current value: 10
    plot_base_name
        Description: Basename for pltfiles. Pltfiles will be saved with this name plus their timestep.
        Current value: "10044-090-210-4lev-full-512_plt"
    mini_plot_base_name
        Description: Basename for minipltfiles. Minipltfiles will be saved with this name plus their timestep.
        Current value: "10044-090-210-4lev-full-512_miniplt"
    check_base_name
        Description: Basename for checkpoint files. Chkfiles will be saved with this name plus their timestep.
        Current value: "10044-090-210-4lev-full-512_chk"
    bc_lo
        Description: Integer flag for the lower (x=y=z=0) boundary
        Current value: 12
    bc_hi
        Description: Integer flag for the hi (x=y=z=max) boundary
        Current value: 12

Initial Model Configuration
Description: Configures the initial model for this simulation.  This
        corresponds to the _params file used by init1d to build an initial 1D
        model to be mapped to the 3D domain.  The data from this model are also
        stored.
Fields:
    nx
        Description: Resolution (number of cells) of the 1D model, should match Maestro base state resolution.
        Current value: 10240
    M_tot
        Description: Mass of the WD core in M_sol.
        Current value: 1.0
    M_He
        Description: Mass of He envelope in M_sol.
        Current value: 0.0445
    delta
        Description: Transition delta from core to envelope in cm.
        Current value: 2000000.0
    temp_core
        Description: Isothermal core temperature in K.
        Current value: 90000000.0
    temp_base
        Description: Temperature at the base of the He envelope in K.
        Current value: 210000000.0
    xmin
        Description: Spatial coordinate in cm the model starts at.
        Current value: 0.0
    xmax
        Description: Spatial coordinate in cm of the last cell, should match the sidelength of domain in octant simulation, half sidelength for full star.
        Current value: 750000000.0
    mixed_co_wd
        Description: Boolean that sets if core is C/O or just C.
        Current value: .false.
    low_density_cutoff
        Description: Density floor in the initial model (NOT for the 3D Maestro domain).
        Current value: 1.d-4
    temp_fluff
        Description: Temperature floor, will also be temperature when below density floor.
        Current value: 7.5d7
    smallt
        Description: An unused parameter that used to be like temp_fluff.
        Current value: 1.d6
    radius
        Description: NumPy array of initial model radius in cm.
        Current value: [  3.66210938e+04   1.09863281e+05   1.83105469e+05 ...,   7.49816895e+08
   7.49890137e+08   7.49963379e+08]
    density
        Description: NumPy array of initial model density in g/cm^3.
        Current value: [  4.04783862e+07   4.04783745e+07   4.04783511e+07 ...,   4.83128894e-03
   4.81266153e-03   4.79410982e-03]
    temperature
        Description: NumPy array of initial model temperature in K.
        Current value: [ 90000000.  90000000.  90000000. ...,  75000000.  75000000.  75000000.]
    pressure
        Description: NumPy array of initial model pressure in dyn/cm^2.
        Current value: [  6.09564571e+24   6.09564325e+24   6.09563834e+24 ...,   7.98193462e+16
   7.98192591e+16   7.98191723e+16]
    soundspeed
        Description: NumPy array of initial model sound speed in cm/s.
        Current value: [  0.00000000e+00   4.58558611e+08   4.58558562e+08 ...,   4.69352862e+09
   4.70260012e+09   4.71168726e+09]
    entropy
        Description: NumPy array of initial model specific entropy in erg/(g*K).
        Current value: [  0.00000000e+00   6.82762373e+07   6.82762427e+07 ...,   8.82233068e+11
   8.85642789e+11   8.89064988e+11]
    species
        Description: NumPy 2D array of initial model species mass fractions.
        Current value: [[  1.00000000e-10   1.00000000e-10   1.00000000e-10 ...,   1.00000000e+00
    1.00000000e+00   1.00000000e+00]
 [  1.00000000e+00   1.00000000e+00   1.00000000e+00 ...,   1.00000000e-10
    1.00000000e-10   1.00000000e-10]
 [  1.00000000e-10   1.00000000e-10   1.00000000e-10 ...,   1.00000000e-10
    1.00000000e-10   1.00000000e-10]]


In [25]:
#Init from scratch test
test_model_dir = '/home/ajacobs/Research/Projects/Simmy/IPyRoot/SCTestGrid/10044-090-210-4lev-debug'

#Design
#  + Get baseline inputs and im ConfigRecs
#  + Make factory method smart enough to use this to gen initial model and finish off initialization of ConfigRecs

#Build up initial model ConfigRecord baseline
im_rec = SCConfig.genIMConfigRec()
im_rec.setField('M_tot', '1.0')
im_rec.setField('M_He', '0.0445')
im_rec.setField('delta', '2000000.0')
im_rec.setField('temp_core', '90000000.0')
im_rec.setField('temp_base', '210000000.0')
im_rec.setField('im_exe', '/home/ajacobs/Codebase/Maestro/Util/initial_models/sub_chandra/init_1d.Linux.gfortran.debug.exe')
print(im_rec)

#Build up inputs ConfigRecord baseline
inputs_rec = SCConfig.genInputsConfigRec()
inputs_rec.setField('max_levs', 2)
inputs_rec.setField('coarse_res', 128)
print(inputs_rec)

#Create the Config object and print
test_model_config = SCConfig(test_model_dir, config_recs=[im_rec,inputs_rec])


Initial Model Configuration
Description: Configures the initial model for this simulation.  This
        corresponds to the _params file used by init1d to build an initial 1D
        model to be mapped to the 3D domain.  The data from this model are also
        stored.
Fields:
    im_exe
        Description: Full path to the initial model builder.
        Current value: /home/ajacobs/Codebase/Maestro/Util/initial_models/sub_chandra/init_1d.Linux.gfortran.debug.exe
    nx
        Description: Resolution (number of cells) of the 1D model, should match Maestro base state resolution.
        Current value: None
    M_tot
        Description: Mass of the WD core in M_sol.
        Current value: 1.0
    M_He
        Description: Mass of He envelope in M_sol.
        Current value: 0.0445
    delta
        Description: Transition delta from core to envelope in cm.
        Current value: 2000000.0
    temp_core
        Description: Isothermal core temperature in K.
        Current value: 90000000.0
    temp_base
        Description: Temperature at the base of the He envelope in K.
        Current value: 210000000.0
    xmin
        Description: Spatial coordinate in cm the model starts at.
        Current value: 0.0
    xmax
        Description: Spatial coordinate in cm of the last cell, should match the sidelength of domain in octant simulation, half sidelength for full star.
        Current value: None
    mixed_co_wd
        Description: Boolean that sets if core is C/O or just C.
        Current value: .false.
    low_density_cutoff
        Description: Density floor in the initial model (NOT for the 3D Maestro domain).
        Current value: 1.d-4
    temp_fluff
        Description: Temperature floor, will also be temperature when below density floor.
        Current value: 7.5d7
    smallt
        Description: An unused parameter that used to be like temp_fluff.
        Current value: 1.d6
    radius
        Description: NumPy array of initial model radius in cm.
        Current value: None
    density
        Description: NumPy array of initial model density in g/cm^3.
        Current value: None
    temperature
        Description: NumPy array of initial model temperature in K.
        Current value: None
    pressure
        Description: NumPy array of initial model pressure in dyn/cm^2.
        Current value: None
    soundspeed
        Description: NumPy array of initial model sound speed in cm/s.
        Current value: None
    entropy
        Description: NumPy array of initial model specific entropy in erg/(g*K).
        Current value: None
    species
        Description: NumPy 2D array of initial model species mass fractions.
        Current value: None

Inputs Configuration
Description: Configuration of the inputs file.  This is the file passed
        to the Maestro executable that sets various Maestro parameters,
        configures the simulation, and provides the location of initial model
        data.
Fields:
    im_file
        Description: Initial model file with data to be read into the Maestro basestate.
        Current value: None
    drdxfac
        Description: 5
        Current value: 5
    job_name
        Description: Description of the simulation.
        Current value: None
    max_levs
        Description: Number of levels the AMR will refine to.
        Current value: 2
    coarse_res
        Description: Resolution of the base (coarsest) level
        Current value: 128
    anelastic_cutoff
        Description: Density cutoff below which the Maestro velocity constraint is simplified to the anelastic constraint.
        Current value: None
    octant
        Description: Boolean that sets if an octant or full star should be modeled.
        Current value: .false.
    dim
        Description: Dimensionality of the problem.
        Current value: 3
    physical_size
        Description: Sidelength in cm of the square domain.
        Current value: None
    plot_deltat
        Description: Time interval in s at which to save pltfiles.
        Current value: 5.0
    mini_plot_deltat
        Description: Time interval in s at which to save minipltfiles.
        Current value: 0.2
    chk_int
        Description: Timestep interval at which to save chkpoint files.
        Current value: 10
    plot_base_name
        Description: Basename for pltfiles. Pltfiles will be saved with this name plus their timestep.
        Current value: None
    mini_plot_base_name
        Description: Basename for minipltfiles. Minipltfiles will be saved with this name plus their timestep.
        Current value: None
    check_base_name
        Description: Basename for checkpoint files. Chkfiles will be saved with this name plus their timestep.
        Current value: None
    bc_lo
        Description: Integer flag for the lower (x=y=z=0) boundary
        Current value: None
    bc_hi
        Description: Integer flag for the hi (x=y=z=max) boundary
        Current value: None

/home/ajacobs/Codebase/Maestro/Util/initial_models/sub_chandra/init_1d.Linux.gfortran.debug.exe /home/ajacobs/Research/Projects/Simmy/IPyRoot/SCTestGrid/10044-090-210-4lev-debug/model/_params.10044-090-210-4lev-debug

Machine

RunConfig

TitanConfig

In [18]:
#Test TitanConfig
config_dict = {}
config_dict['nodes'] = 128
test_config = TitanConfig('/home/ajacobs/Research/Projects/Simmy/IPyRoot/TestModel', config_dict)

#Tests to formalize
#    + Successfully creates file
ICER Config
xrb Config

In [ ]: