0001 function [dtnmin_fluct,dtns_fluct] = calc_dtn_fluct_jd(fluct,wavestructs,mksa)
0002
0003
0004 flucttypes = fieldnames(fluct);
0005
0006 flucttypelist = {'ne','B'};
0007
0008 dtns_fluct = struct;
0009 dtnmin_fluct = Inf;
0010
0011
0012
0013 for ifluct = 1:length(flucttypes),
0014
0015 flucttype = flucttypes{ifluct};
0016
0017 if ~any(strcmp(flucttype,flucttypelist)),
0018 continue
0019 end
0020
0021 for imodel = 1:length(fluct.(flucttype)),
0022
0023 if fluct.(flucttype)(imodel).model == 0,
0024 epsi_rho = Inf;
0025 epsi_theta = Inf;
0026 epsi_phi = Inf;
0027 elseif fluct.(flucttype)(imodel).model == 1,
0028 error('Fluctuation model ''1'' is not implemented (ray tracing benchmark only). Check the function that builds the fluct structure.');
0029 elseif fluct.(flucttype)(imodel).model == 2,
0030 epsi_rho = fluct.(flucttype)(imodel).epsi_rho;
0031 epsi_theta = fluct.(flucttype)(imodel).epsi_theta;
0032 epsi_phi = fluct.(flucttype)(imodel).epsi_phi;
0033 elseif fluct.(flucttype)(imodel).model == 3,
0034 epsi_rho = fluct.(flucttype)(imodel).epsi_rho;
0035 epsi_theta = fluct.(flucttype)(imodel).epsi_theta;
0036 epsi_phi = Inf;
0037 elseif fluct.(flucttype)(imodel).model == 4 || fluct.(flucttype)(imodel).model == 5,
0038 epsi_rho = Inf;
0039 epsi_theta = fluct.(flucttype)(imodel).epsi_theta;
0040 epsi_phi = Inf;
0041 else
0042 error('Fluctuation model >=6 not implemented.');
0043 end
0044
0045 dtns_fluct.(flucttype)(imodel).dtn_rho = 2.14*mksa.nhu_ref*max(epsi_rho)/mksa.vde_ref;
0046 dtns_fluct.(flucttype)(imodel).dtn_theta = 2.14*mksa.nhu_ref*max(epsi_theta)/mksa.vde_ref;
0047 dtns_fluct.(flucttype)(imodel).dtn_phi = 2.14*mksa.nhu_ref*max(epsi_phi)/mksa.vde_ref;
0048
0049 dtnmin_fluct = min([dtnmin_fluct,dtns_fluct.(flucttype)(imodel).dtn_rho,dtns_fluct.(flucttype)(imodel).dtn_theta,dtns_fluct.(flucttype)(imodel).dtn_phi]);
0050
0051 end
0052 end
0053
0054
0055
0056 for iw = 1:length(wavestructs),
0057 if isfield(wavestructs{iw}.launch,'tail') && isfield(wavestructs{iw}.launch.tail,'dtn'),
0058 dtns_fluct.npar0_lh(iw).dtn = 2.14*wavestructs{iw}.launch.tail.dtn;
0059 else
0060 dtns_fluct.npar0_lh(iw).dtn = Inf;
0061 end
0062
0063 dtnmin_fluct = min([dtnmin_fluct,dtns_fluct.npar0_lh(iw).dtn]);
0064
0065 end
0066