Example #1
0
jprof = (1 - (1 - 0.001**(1 / 0.41)) * (radialgrid / radialgrid[-1])**2)**0.41
efield = jTot * jprof / conductivity[-1, :]
ds.eqsys.E_field.setPrescribedData(efield=efield, radius=radialgrid)

ds.save(f'settings_1init.h5')
if run_init:
    runiface(ds, f'out_1init.h5')

#######
# exp #
#######
# Start expdecay

ds3 = DREAMSettings(ds)
if run_exp:
    ds3.fromOutput(f'out_1init.h5')

temperature_exp = Tfinal_exp + (T_initial * temp_prof - Tfinal_exp) * np.exp(
    -times_exp / t0_exp).reshape(-1, 1)
ds3.eqsys.T_cold.setPrescribedData(temperature=temperature_exp,
                                   times=times_exp,
                                   radius=radialgrid)
ds3.eqsys.E_field.setType(Efield.TYPE_SELFCONSISTENT)
ds3.eqsys.E_field.setBoundaryCondition(bctype=Efield.BC_TYPE_PRESCRIBED,
                                       inverse_wall_time=0,
                                       V_loop_wall_R0=E_wall * 2 * np.pi)

ds3.timestep.setTmax(Tmax_exp)
ds3.timestep.setNt(Nt_exp)

ds3.save(f'settings_2exp.h5')
Example #2
0
ds.timestep.setTmax(Tmax_init1)
ds.timestep.setNt(Nt_init1)

ds.save('init_settings.h5')
ds.output.setFilename('output_init.h5')

# Save settings to HDF5 file
runiface(ds, 'output_init2.h5', quiet=False)
# Set time stepper
ds.timestep.setTmax(Tmax_init2)
ds.timestep.setNt(Nt_init2)
if T_selfconsistent:
    ds.eqsys.T_cold.setType(ttype=T_cold.TYPE_SELFCONSISTENT)
ds.solver.setLinearSolver(Solver.LINEAR_SOLVER_LU)

ds.fromOutput('output_init2.h5')
ds.save('init_settings.h5')
runiface(ds, 'output_init3.h5', quiet=False)

###########
# RESTART #
###########

ds2 = DREAMSettings(ds)

ds2.fromOutput('output_init3.h5')

ds2.eqsys.E_field.setType(Efield.TYPE_SELFCONSISTENT)
ds2.eqsys.E_field.setBoundaryCondition(bctype=Efield.BC_TYPE_PRESCRIBED,
                                       inverse_wall_time=0,
                                       V_loop_wall_R0=E_wall * 2 * np.pi)
Example #3
0
# Set up radial grid
ds1.radialgrid.setB0(5)
ds1.radialgrid.setMinorRadius(0.22)
ds1.radialgrid.setWallRadius(0.22)
ds1.radialgrid.setNr(1)

# Use the linear solver
ds1.solver.setType(Solver.LINEAR_IMPLICIT)

ds1.other.include('fluid/runawayRate')

# Set time stepper
ds1.timestep.setTmax(2e-1)
ds1.timestep.setNt(10)

# Set name of output file
ds1.output.setFilename('output1.h5')

# Save settings to HDF5 file
ds1.save('dream_settings_1.h5')

##############################
# PART II
##############################
ds2 = DREAMSettings(ds1)

ds2.fromOutput('output1.h5', ignore=['n_i'])
ds2.output.setFilename('output2.h5')
ds2.save('dream_settings_2.h5')
Example #4
0
ds.eqsys.E_field.setPrescribedData(efield=efield, radius=radialgrid)

# Save settings to HDF5 file
ds.save(folder_name + 'init_settings2' + filename_ending + '.h5')
runiface(ds,
         folder_name + 'output_init2' + filename_ending + '.h5',
         quiet=False)

#####################
# RESTART injection #
#####################

ds2 = DREAMSettings(ds)

ds2.fromOutput(folder_name + 'output_init2' + filename_ending + '.h5',
               ignore=['v_p'])
ds2.eqsys.spi.setInitialData(vp=vp_init)

ds2.eqsys.E_field.setType(Efield.TYPE_SELFCONSISTENT)
ds2.eqsys.E_field.setBoundaryCondition(bctype=Efield.BC_TYPE_PRESCRIBED,
                                       inverse_wall_time=0,
                                       V_loop_wall_R0=E_wall * 2 * np.pi)

if T_selfconsistent:
    ds2.eqsys.T_cold.setType(ttype=T_cold.TYPE_SELFCONSISTENT)

ds2.timestep.setTmax(Tmax_restart)
ds2.timestep.setNt(Nt_restart)
ds2.timestep.setNumberOfSaveSteps(int(Tmax_restart / 1e-4))

ds2.save(folder_name + 'injection_restart_settings' + filename_ending + '.h5')
Example #5
0
ds.solver.setMaxIterations(maxiter=100)
ds.solver.setVerbose(False)

ds.other.include('fluid', 'lnLambda', 'nu_s', 'nu_D')

# Save settings to HDF5 file
ds.output.setFilename('output_init.h5')
ds.save('init_settings.h5')

###########
# RESTART #
###########

ds2 = DREAMSettings(ds)

ds2.fromOutput('output_init.h5')

ds2.eqsys.E_field.setType(Efield.TYPE_SELFCONSISTENT)
ds2.eqsys.E_field.setBoundaryCondition(bctype=Efield.BC_TYPE_PRESCRIBED,
                                       inverse_wall_time=0,
                                       V_loop_wall_R0=E_wall * 2 * np.pi)
if T_selfconsistent:
    ds2.eqsys.T_cold.setType(ttype=T_cold.TYPE_SELFCONSISTENT)

ds.timestep.setType(TimeStepper.TYPE_ADAPTIVE)
ds2.timestep.setTmax(Tmax_restart)
#ds2.timestep.setNt(Nt_restart)

# I need to do the below for the boundary condition to be changed
#ds2.eqsys.f_hot.setBoundaryCondition(bc=FHot.BC_F_0)
Example #6
0
ds.eqsys.E_field.setPrescribedData(efield=efield, radius=radialgrid)

if run_init:
    # Save settings to HDF5 file
    ds.save(folder_name + 'init_settings_' + filename_ending + '.h5')
    runiface(ds,
             folder_name + 'output_init_' + filename_ending + '.h5',
             quiet=False)

##########################
# RESTART injection init #
##########################
# Used to accelerate the distribution to carry the right current

ds2 = DREAMSettings(ds)
ds2.fromOutput(folder_name + 'output_init_' + filename_ending + '.h5',
               ignore=['Y_p', 'x_p', 'v_p'])

#ds2.eqsys.E_field.setType(Efield.TYPE_SELFCONSISTENT)
#ds2.eqsys.E_field.setBoundaryCondition(bctype = Efield.BC_TYPE_PRESCRIBED, inverse_wall_time = 0, V_loop_wall = E_wall*2*np.pi, wall_radius=radius_wall)

if T_selfconsistent:
    ds2.eqsys.T_cold.setType(ttype=T_cold.TYPE_SELFCONSISTENT)

ds2.timestep.setTmax(Tmax_init2)
ds2.timestep.setNt(Nt_init2)
#ds2.timestep.setType(ttype=TimeStep.TYPE_ADAPTIVE)

if run_injection_init:
    ds2.save(folder_name + 'init2_restart_settings_' + filename_ending + '.h5')
    runiface(ds2,
             folder_name + 'output_init2_' + filename_ending + '.h5',
Example #7
0
ds.solver.setMaxIterations(maxiter=100)
ds.solver.setVerbose(False)

ds.other.include('fluid', 'scalar')

# Save settings to HDF5 file
ds.save('init_settings.h5')
runiface(ds, 'output_init.h5', quiet=False)

###########
# RESTART #
###########

ds2 = DREAMSettings(ds)

ds2.fromOutput('output_init.h5')

ds2.eqsys.E_field.setType(Efield.TYPE_SELFCONSISTENT)
ds2.eqsys.E_field.setBoundaryCondition(bctype=Efield.BC_TYPE_PRESCRIBED,
                                       inverse_wall_time=0,
                                       V_loop_wall_R0=E_wall * 2 * np.pi)
if T_selfconsistent:
    ds2.eqsys.T_cold.setType(ttype=T_cold.TYPE_SELFCONSISTENT)
    ds.eqsys.T_cold.setRecombinationRadiation(False)

ds2.timestep.setTmax(Tmax_restart)
ds2.timestep.setNt(Nt_restart)

ds2.save('restart_settings.h5')
runiface(ds2, 'output_restart.h5', quiet=False)