run_cronos_C3PO_naequilp_ne

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 clear all
0002 clear mex
0003 clear functions
0004 close all
0005 warning off
0006 pause(1)
0007 dbstop if error
0008 %
0009 % Script for TORE-SUPRA LH discharge #32299 only
0010 %
0011 root_dir = '';%empty or pwd if local
0012 %
0013 % Non axisymmetric perturbation of the toroidal MHD equilibrium (ne fluctuations resuklting from electron drift wave at the plasma edge)
0014 %
0015 scenario = 'naequilp_ne';%Electron drift wave model for the density fluctuations at the plasma edge
0016 %
0017 load ('before_luke@TS_32299_100.0117.mat','equil');%data file from cronos
0018 %
0019 % WARNING: time definitions in LUKE with or without fluctuations
0020 %
0021 %if imag(tn) > 0 : dkeparam.tn = tn/Nfluct -> as an imaginary number, dkeparam.tn prescribes the number of fluctuation iterations
0022 %if imag(tn) == 0 : dkeparam.tn = tn -> as a real number, dkeparam.tn specifies the final time explicitly
0023 %if imag(dtn) > 0: dkeparam.dtn = dtn*Nfluct -> as an imaginary number, dkeparam.dtn prescribes the number of internal time steps
0024 %if imag(dtn) == 0: dkeparam.dtn = dtn -> as a real number, dkeparam.dtn prescribes the number of internal time steps
0025 %
0026 opt_dist = 0;% batch run index in dkepath.remote; (0) for local run, (1) local multicore, (2) remote cephee, (3) remote saturne
0027 opt_save = 1;%In case of crash, to restart simulation from an intermediate step stored in a *.mat file (<0 for launching simulation from backup, 0 no backup, >0 for performing backup)
0028 tn = 10i;%Total normalized integration time. As an imaginary number, dkeparam.tn prescribes the number of fluctuation iterations
0029 display_mode = [0,1,1];%option for display [C3PO, LUKE, time evolution]
0030 p_opt = 2;%option for printing
0031 %
0032 %%%%%%%%%%% WARNING: Nothing below must be modified in case of reload %%%%%%%%%%% %%%%%%%%%%%%%%%
0033 %
0034 Nfluct = [0.381141619674545];%ratio of LUKE internal evolution time to fluctuation time !! set to retrieve old dtn = 2
0035 dtn = 1i;% LUKE internal time step. As an imaginary number, dkeparam.dtn prescribes the number of internal time steps
0036 %
0037 sigmar_max_in = 0.5;%Non axisymmetric perturbation of the toroidal MHD
0038 epsi_rho_in = [0.01];%Non axisymmetric perturbation of the toroidal MHD
0039 %
0040 racc = 0.05;%relative accuracy for time averaged power and current calculation
0041 %
0042 % LH wave: positive lobe (co-current)
0043 %
0044 Npar_p = [];%if empty, use the launch power spectrum calculated by CRONOS (negative value)
0045 dNpar_p = [];%if empty, use the launch power spectrum calculated by CRONOS (negative value)
0046 %
0047 % LH wave: negative lobe (counter-current)
0048 %
0049 Npar_m = [];%if empty, use the launch power spectrum calculated by CRONOS (positive value)
0050 dNpar_m = [];%if empty, use the launch power spectrum calculated by CRONOS (positive value)
0051 %
0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SCAN LOOP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0053 %
0054 ijob = 1;
0055 %
0056 path_simul = [root_dir,scenario,'/'];
0057 if exist(path_simul) ~= 7, mkdir(path_simul);end
0058 %
0059 for sigmar_max = sigmar_max_in,
0060     for epsi_rho = epsi_rho_in,
0061         %
0062         epsi_theta = epsi_rho;%Non axisymmetric perturbation of the toroidal MHD
0063         %
0064         fluct_ref =  ['sigmar_max',num2str(sigmar_max),'_epsi_rho',num2str(epsi_rho)];
0065         %
0066         if isempty(Npar_p),
0067             shot_ref = ['Nfluct',num2str(Nfluct),'_',fluct_ref];
0068         else
0069             shot_ref = ['Npar_p',num2str(abs(Npar_p)),'_Nfluct',num2str(Nfluct),'_',fluct_ref];
0070         end
0071         %
0072         id_simul = [scenario,'_',shot_ref];
0073         %
0074         % Non axisymmetric perturbation of the toroidal MHD equilibrium for any rf waves
0075         %
0076         fluctuations.naequilp.fluct.type = {'ne'};%Type of fluctuations or modulations ('ne': electron density, 'B': magnetic field) {1,nfluct_types}
0077         fluctuations.naequilp.fluct.model = [5];%Statistical ne fluctuation model (>= 1) : [1,nfluct_types]
0078                                 %    - (1) -> 3-D Gaussian model (rho,theta,phi), relative epsi values (benchmark of C3PO)
0079                                 %    - (2) -> 3-D Gaussian model (rho,theta,phi), absolute epsi values (m)
0080                                 %    - (3) -> 2-D Gaussian drift-wave like model global (rho,curtheta), absolute epsi values (m)
0081                                 %    - (4) -> 1-D Gaussian drift-wave like model local (curtheta), absolute epsi values (m)
0082                                 %    - (5) -> 1-D Gaussian drift-wave like model local (cn,cm), absolute epsi values (m)
0083                                 %    - (6) -> 2-D Gaussian drift-wave like model local (rho,cn,cm), absolute epsi values (m)
0084                                 %    - (7) -> *** NOT IMPLEMENTED *** 2-D Gaussian drift-wave like model local (rho,lperp), absolute epsi values (m)
0085         fluctuations.naequilp.fluct.sigmar_max = sigmar_max;%Maximum value of the relative fluctuations variance at the poloidal angle theta = 0 [1,nfluct_types]
0086         fluctuations.naequilp.fluct.sigmar_hwhm = [0.05];%Radial half width at half maximum of the relative fluctuations variance at the poloidal angle theta = 0 [1,nfluct_types]
0087         fluctuations.naequilp.fluct.sigmar_rho = [1];%Radial location where the relative fluctuations variance peaks at the poloidal angle theta = 0 [1,nfluct_types]
0088         fluctuations.naequilp.fluct.polmode = [0.0];%HFS/LFS relative fluctuations variance ratio. No poloidal dependency corresponds to 1 [1,nfluct_types]
0089         %
0090         fluctuations.naequilp.fluct.epsi_rho = epsi_rho;%
0091         fluctuations.naequilp.fluct.epsi_theta = epsi_theta;%theta direction is perp direction for models 3 & 4
0092         fluctuations.naequilp.fluct.epsi_phi = [0.2];%useless for models 3 & 4
0093         %
0094         fluctuations.naequilp.fluct.lmin = [1];%
0095         fluctuations.naequilp.fluct.mmin = [1];%for perp direction for models 3 & 4
0096         fluctuations.naequilp.fluct.nmin = [1];%useless for models 3 & 4
0097         %
0098         fluctuations.naequilp.fluct.lmax = [200];%
0099         fluctuations.naequilp.fluct.mmax = [200];%for perp direction for models 3 & 4
0100         fluctuations.naequilp.fluct.nmax = [5];%useless for models 3 & 4%
0101         %
0102         if opt_dist == 0,%local calculations
0103             %
0104             [timeid,jobid,dkeparam,dkepath,Znorm,Zcurr,ZP0,dke_out,radialDKE,equilDKE,momentumDKE,gridDKE,Zmomcoef,Zbouncecoef,Zmripple,mksa,XXsinksource] = loop_cronos_C3PO_yp(opt_dist,opt_save,id_simul,root_dir,Nfluct,tn,dtn,fluctuations,display_mode,Npar_p,Npar_m);
0105             %
0106             % ---------------------------------------------- Save results ----------------------------------------------
0107             %
0108             save_file = ['LUKE_RESULTS_',id_simul,'.mat'];
0109             save([dkeparam.path_simul,save_file]);
0110             info_dke_yp(2,['Data saved in ',dkeparam.path_simul,save_file]);
0111             %
0112             % ---------------------------------------------- Display results ----------------------------------------------
0113             %
0114             display_cronos_C3PO(id_simul,equilDKE,ZP0,Zcurr,dkeparam,mksa,racc,p_opt,root_dir)
0115             %
0116         else
0117             [timeid,jobid,dkeparam,dkepath] = loop_cronos_C3PO_yp(opt_dist,opt_save,id_simul,root_dir,Nfluct,tn,dtn,fluctuations,display_mode,Npar_p,Npar_m);
0118             %
0119             job.id_simul{ijob} = id_simul;
0120             job.id(ijob) = str2num(jobid);
0121             job.timeid(ijob) = str2num(timeid);
0122             job.dtn(ijob) = dtn;
0123             job.hwhm_npar(ijob) = hwhm_npar;
0124             job.state(ijob) = 0;
0125             %
0126             ijob = ijob + 1;
0127         end    
0128     end
0129 end
0130 %
0131 if opt_dist > 0,%distributed calculations
0132     job_file = ['LUKE_JOB_',id_simul,'.mat'];
0133     save(job_file,'job','opt_dist','dkepath','dkeparam');
0134     info_dke_yp(2,['Data saved in ',job_file]);
0135 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.