Exemplo n.º 1
0
ds.solver.setType(Solver.NONLINEAR)
ds.solver.tolerance.set(reltol=1e-4)
ds.solver.setMaxIterations(maxiter=100)
ds.solver.setVerbose(True)

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

# Set time stepper
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 #
###########
Exemplo n.º 2
0
# Disable runaway and hot-tail grid
ds.runawaygrid.setEnabled(False)
ds.hottailgrid.setEnabled(False)

# Use the nonlinear solver
ds.solver.setType(Solver.NONLINEAR)
ds.solver.setLinearSolver(linsolv=Solver.LINEAR_SOLVER_LU)
ds.solver.setTolerance(reltol=0.01)
ds.solver.setMaxIterations(maxiter=500)
#ds.solver.setVerbose(True)

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

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

#### Ionization #############
ds2 = DREAMSettings(ds)

ds2.timestep.setTmax(Tmax_restart_ioniz)
ds2.timestep.setNt(Nt_restart_ioniz)

ds2.save('ioniz_restart_settings.h5')

runiface(ds2, 'output_restart_ioniz.h5', quiet=False)

#### Equilibration ############
ds3 = DREAMSettings(ds2)

ds3.timestep.setTmax(Tmax_restart_eq)
Exemplo n.º 3
0
# Use the nonlinear solver
ds.solver.setType(Solver.NONLINEAR)
ds.solver.setLinearSolver(linsolv=Solver.LINEAR_SOLVER_LU)

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

filename_ending = 'deposition' + str(
    ds.eqsys.spi.deposition) + 'heatAbsorbtion' + str(
        ds.eqsys.spi.heatAbsorbtion) + 'cloudRadiusMode' + str(
            ds.eqsys.spi.cloudRadiusMode) + 'Nr' + str(Nr) + 'new'
folder_name = 'dep_comp/'

# 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 set current #
#######################

do = DREAMOutput(folder_name + 'output_init' + filename_ending + '.h5')
conductivity = do.other.fluid.conductivity.getData()
jprof = 1
I0 = 2e6
j0 = I0 / np.trapz(2 * np.pi * radialgrid * jprof, radialgrid)
efield = j0 * jprof / conductivity[-1, :]

ds.eqsys.E_field.setPrescribedData(efield=efield, radius=radialgrid)
Exemplo n.º 4
0
    # with hyperresistivity:
#    ds.eqsys.psi_p.transport.prescribeDiffusion(drr=1e-5)
#    ds.eqsys.psi_p.transport.setBoundaryCondition(Transport.BC_CONSERVATIVE)
elif transport_mode == Transport.TRANSPORT_RECHESTER_ROSENBLUTH and hotTailGrid_enabled:
    ds.eqsys.f_hot.transport.setMagneticPerturbation(1e-5)
    ds.eqsys.f_hot.transport.setBoundaryCondition(Transport.BC_F_0)
#########################################

########
# init #
########
# To get the right initial current profile

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

######################################
# RE-SCALE E-FIELD FOR RIGHT CURRENT #
######################################
do = DREAMOutput(f'out_1init.h5')
conductivity = do.other.fluid.conductivity.getData()
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')

#######
# ds.solver.setType(Solver.LINEAR_IMPLICIT)

# Use the nonlinear solver
ds.solver.setType(Solver.NONLINEAR)
ds.solver.setLinearSolver(linsolv=Solver.LINEAR_SOLVER_LU)
ds.solver.tolerance.set(reltol=1e-4)
ds.solver.setMaxIterations(maxiter = 500)
# ds.solver.setVerbose(True)


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


# Save settings to HDF5 file
ds.save('init_settings_nNe'+str(n_Z)+'nD_inj'+str(n_D_inj)+filename_ending+'.h5')
runiface(ds, 'output_init_nNe'+str(n_Z)+'nD_inj'+str(n_D_inj)+filename_ending+'.h5', quiet=False)


#######################
# RESTART set current #
#######################

do=DREAMOutput('output_init_nNe'+str(n_Z)+'nD_inj'+str(n_D_inj)+filename_ending+'.h5')
conductivity=do.other.fluid.conductivity.getData()
jprof=(1-(1-0.001**(1/0.41))*(radialgrid/radialgrid[-1])**2)**0.41
# efield=1.81e6*jprof/conductivity[-1,:]
efield=1.69e6*jprof/conductivity[-1,:]

ds.eqsys.E_field.setPrescribedData(efield=efield, radius=radialgrid)

# Save settings to HDF5 file
Exemplo n.º 6
0
else:
    filename_ending = 'nShardD' + str(nShardD) + 'kpD' + str(kp) + 'vpD' + str(
        abs_vp_mean) + '_Ne_mixed' + str(
            SPIMolarFractionNe[0]) + '_hottail' + str(
                hotTailGrid_enabled) + 'heat_transport' + str(
                    use_heat_transport) + 'f_hot_transport' + str(
                        use_f_hot_transport) + 'dBB' + str(
                            dBOverB) + 'CQ_only' + str(transport_CQ_only)

folder_name = 'hottail_scan_cylindrical_DMS_profs/'

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 set current #
#######################

do = DREAMOutput(folder_name + 'output_init' + filename_ending + '.h5')
conductivity = do.other.fluid.conductivity.getData()
jprof = (1 - (1 - 0.001**(1 / 0.41)) * (radialgrid / radialgrid[-1])**2)**0.41
I0 = 15e6
j0 = I0 / np.trapz(2 * np.pi * radialgrid * jprof, radialgrid)
efield = j0 * jprof / conductivity[-1, :]

ds.eqsys.E_field.setPrescribedData(efield=efield, radius=radialgrid)
Exemplo n.º 7
0
# ds.solver.setType(Solver.LINEAR_IMPLICIT)

# Use the nonlinear solver
ds.solver.setType(Solver.NONLINEAR)
ds.solver.setLinearSolver(linsolv=Solver.LINEAR_SOLVER_LU)
ds.solver.tolerance.set(reltol=1e-4)
ds.solver.setMaxIterations(maxiter = 500)
# ds.solver.setVerbose(True)


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


# Save settings to HDF5 file
ds.save('init_settings_nNe'+str(n_Z)+'nD_inj'+str(n_D_inj)+filename_ending+'.h5')
runiface(ds, 'output_init_nNe'+str(n_Z)+'nD_inj'+str(n_D_inj)+filename_ending+'.h5', quiet=False)


#######################
# RESTART set current #
#######################

do=DREAMOutput('output_init_nNe'+str(n_Z)+'nD_inj'+str(n_D_inj)+filename_ending+'.h5')
conductivity=do.other.fluid.conductivity.getData()
jprof=(1-(1-0.001**(1/0.41))*(do.grid.r[:]/radialgrid[-1])**2)**0.41
#jprof=(1-(1-0.001**(1/0.41))*(radialgrid/radialgrid[-1])**2)**0.41
# efield=1.81e6*jprof/conductivity[-1,:]
efield=1.69e6*jprof/conductivity[-1,:]

ds.eqsys.E_field.setPrescribedData(efield=efield, radius=do.grid.r[:])
ds.eqsys.T_cold.setPrescribedData(T)

# Disable runaway grid
ds.runawaygrid.setEnabled(False)

# Set time stepper
ds.timestep.setTmax(5e-1)
ds.timestep.setNt(4)

# Set initialization E_field
ds.eqsys.E_field.setPrescribedData(Ip0 / 1.56e8)

# include otherquantities to save to output
ds.other.include('fluid', 'transport')

runiface(ds, 'init_output.h5', quiet=True)

################################################
######## BEGIN RESTART SIMULATION SETUP ########
################################################

ds_re = DREAMSettings(ds)

# Set time stepper
ds_re.timestep.setTmax(tMax)
ds_re.timestep.setNt(Nt)

ds_re.eqsys.T_cold.setType(T_cold.TYPE_SELFCONSISTENT)
ds_re.eqsys.E_field.setType(Efield.TYPE_SELFCONSISTENT)
ds_re.eqsys.E_field.setBoundaryCondition(bctype=Efield.BC_TYPE_PRESCRIBED,
                                         inverse_wall_time=0,
Exemplo n.º 9
0
ds.runawaygrid.setEnabled(False)

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

# Use the nonlinear solver
ds.solver.setType(Solver.NONLINEAR)
ds.solver.setTolerance(reltol=1e-4)
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)