コード例 #1
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)
コード例 #2
0
ファイル: basicE.py プロジェクト: chalmersplasmatheory/DREAM
# Disable runaway grid
ds.runawaygrid.setEnabled(False)

# Use the new nonlinear solver
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)
コード例 #3
0
ds.eqsys.f_hot.setBoundaryCondition(DistFunc.BC_F_0) # F=0 outside the boundary
ds.eqsys.f_hot.setSynchrotronMode(DistFunc.SYNCHROTRON_MODE_NEGLECT)
ds.eqsys.f_hot.setAdvectionInterpolationMethod(DistFunc.AD_INTERP_UPWIND)

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

# Set up radial grid
ds.radialgrid.setB0(5)
ds.radialgrid.setMinorRadius(0.22)
ds.radialgrid.setWallRadius(0.22)
ds.radialgrid.setNr(1)

# Set solver type
ds.solver.setType(Solver.LINEAR_IMPLICIT) # semi-implicit time stepping
ds.solver.preconditioner.setEnabled(False)

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

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

ds.output.setTiming(stdout=True, file=True)
ds.output.setFilename('output.h5')

# Save settings to HDF5 file
ds.save('dream_settings.h5')

コード例 #4
0
ファイル: restart.py プロジェクト: chalmersplasmatheory/DREAM
# 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')
コード例 #5
0
    ds.eqsys.n_re.transport.setBoundaryCondition(Transport.BC_F_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')
コード例 #6
0
ファイル: SPI.py プロジェクト: chalmersplasmatheory/DREAM
ds.runawaygrid.setEnabled(False)

# 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, :]
コード例 #7
0
# Use the linear solver
# 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)
コード例 #8
0
                ) + 'f_hot_transport' + str(use_f_hot_transport) + 'dBB' + str(
                    dBOverB) + 'CQ_only' + str(transport_CQ_only) + '_new'
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, :]
コード例 #9
0
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,
                                         V_loop_wall_R0=0)

# Set Rechester-Rosenbluth transport
# in T_cold
ds_re.eqsys.T_cold.transport.setMagneticPerturbation(dBOverB)
ds_re.eqsys.T_cold.transport.setBoundaryCondition(Transport.BC_F_0)
# and in f_hot
ds_re.eqsys.f_hot.transport.setMagneticPerturbation(dBOverB)
ds_re.eqsys.f_hot.transport.setBoundaryCondition(Transport.BC_F_0)

# Set solver type
#ds.solver.setType(Solver.LINEAR_IMPLICIT) # semi-implicit time stepping
ds_re.solver.setType(Solver.NONLINEAR)
ds_re.solver.setVerbose(True)
#ds_re.solver.setLinearSolver(Solver.LINEAR_SOLVER_LU)
ds_re.solver.setLinearSolver(Solver.LINEAR_SOLVER_MUMPS)
ds_re.solver.tolerance.set(reltol=1e-4)
#ds_re.solver.setDebug(savejacobian=True, savenumericaljacobian=True, timestep=1,iteration=5)

ds_re.output.setTiming(stdout=True, file=True)
ds_re.output.setFilename('output.h5')

# Save settings to HDF5 file
ds_re.save('dream_settings.h5')
コード例 #10
0
ファイル: iter.py プロジェクト: chalmersplasmatheory/DREAM
# Disable runaway grid
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: