loop_rfdiff_dke_jd

PURPOSE ^

SYNOPSIS ^

function [ZXYD_rf,ZXYF_rf,ZXYD_rf_tp,ZXYF_rf_tp,gridindex_rf] = loop_rfdiff_dke_jd(dkepath,dkeparam,display,equilDKE,gridDKE,Zmomcoef,Zbouncecoef,mksa,radialDKE,waveparam)

DESCRIPTION ^

 This function splits the calculation of rfdiff_dke_jd
 with possible use of distributed computing

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [ZXYD_rf,ZXYF_rf,ZXYD_rf_tp,ZXYF_rf_tp,gridindex_rf] = loop_rfdiff_dke_jd(dkepath,dkeparam,display,equilDKE,gridDKE,Zmomcoef,Zbouncecoef,mksa,radialDKE,waveparam)
0002 %
0003 % This function splits the calculation of rfdiff_dke_jd
0004 % with possible use of distributed computing
0005 %
0006 [dkecluster] = clustermode_luke(dkeparam.clustermode,'rfdiff_dke_jd',dkepath);
0007 nproc = dkecluster.scheduler.clustersize;
0008 %
0009 ny = max(waveparam.biy_rf);
0010 nproc = min([ny,nproc]);
0011 dkecluster.scheduler.clustersize = nproc;
0012 %
0013 waveparams = cell(1,nproc);
0014 nyd = ceil(ny/nproc);
0015 %
0016 for iproc=1:nproc,
0017     %
0018     bmask = (waveparam.biy_rf >= nyd*(iproc-1)+1) & (waveparam.biy_rf <= min([ny,nyd*iproc]));    
0019     %
0020     waveparams{iproc} = struct;
0021     waveparams{iproc}.model = waveparam.model;
0022     waveparams{iproc}.biy_rf = waveparam.biy_rf(bmask)-nyd*(iproc-1);
0023     waveparams{iproc}.bir_rf = waveparam.bir_rf(bmask);
0024     waveparams{iproc}.bds_rf = waveparam.bds_rf(bmask);
0025     waveparams{iproc}.bomega_rf = waveparam.bomega_rf(bmask);
0026     waveparams{iproc}.bopt_rf = waveparam.bopt_rf(bmask);
0027     waveparams{iproc}.bthetab_rf = waveparam.bthetab_rf(bmask);
0028     waveparams{iproc}.bB_rf = waveparam.bB_rf(bmask);
0029     waveparams{iproc}.bNpar_rf = waveparam.bNpar_rf(bmask);
0030     waveparams{iproc}.bdNpar_rf = waveparam.bdNpar_rf(bmask);
0031     waveparams{iproc}.bNperp_rf = waveparam.bNperp_rf(bmask);
0032     waveparams{iproc}.bepolp_rf = waveparam.bepolp_rf(bmask);
0033     waveparams{iproc}.bepolm_rf = waveparam.bepolm_rf(bmask);
0034     waveparams{iproc}.bepolz_rf = waveparam.bepolz_rf(bmask);
0035     waveparams{iproc}.bphinorm_rf = waveparam.bphinorm_rf(bmask);
0036     waveparams{iproc}.n_rf_list = waveparam.n_rf_list;
0037     %
0038 end
0039 %
0040 [flags,ZXYD_rf,ZXYF_rf,ZXYD_rf_tp,ZXYF_rf_tp,gridindex_rf] = mdce_run('rfdiff_dke_jd',{dkeparam,display,equilDKE,gridDKE,Zmomcoef,Zbouncecoef,mksa,radialDKE,''},9,waveparams,dkecluster);
0041 %
0042 ZXYD_rf = conc_field_jd(ZXYD_rf);
0043 ZXYF_rf = conc_field_jd(ZXYF_rf);
0044 ZXYD_rf_tp = NaN;%conc_field_jd(ZXYF_rf_tp);
0045 ZXYF_rf_tp = NaN;%conc_field_jd(ZXYF_rf_tp);
0046 %
0047 npn = gridindex_rf{1}.npn;
0048 nmhu = gridindex_rf{1}.nmhu;
0049 nr = gridindex_rf{1}.nr;
0050 nr_dke = gridindex_rf{1}.nr_dke;
0051 nn_rf = gridindex_rf{1}.nn_rf;
0052 %
0053 ny = gridindex_rf{1}.ny;
0054 mask_y = gridindex_rf{1}.mask_y;
0055 gridindex_rf{1} = rmfield(gridindex_rf{1},{'npn','nmhu','nr','nr_dke','nn_rf','ny','mask_y'});
0056 for iproc = 2:nproc,
0057     %
0058     ny = ny + gridindex_rf{iproc}.ny;
0059     mask_y = [mask_y;gridindex_rf{iproc}.mask_y + nyd*(iproc-1)];
0060     gridindex_rf{iproc} = rmfield(gridindex_rf{iproc},{'npn','nmhu','nr','nr_dke','nn_rf','ny','mask_y'});
0061     %
0062 end
0063 %
0064 gridindex_rf = conc_field_jd(gridindex_rf);
0065 gridindex_rf.mask_y = mask_y;
0066 gridindex_rf.npn = npn;
0067 gridindex_rf.nmhu = nmhu;
0068 gridindex_rf.nr = nr;
0069 gridindex_rf.nr_dke = nr_dke;
0070 gridindex_rf.nn_rf = nn_rf;
0071 gridindex_rf.ny = ny;
0072 %
0073 end
0074 %
0075 function sout = conc_field_jd(sin)
0076 %
0077 sout = struct;
0078 nin = length(sin);
0079 %
0080 fields = fieldnames(sin{1});
0081 %
0082 for ifield = 1:length(fields),
0083     %
0084     field = fields{ifield};
0085     %
0086     sout.(field) = sin{1}.(field);
0087     for iin = 2:nin,
0088         %
0089         sout.(field) = [sout.(field);sin{iin}.(field)];
0090         %
0091     end
0092     %
0093 end
0094 %
0095 end
0096 
0097

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