1function [anp1,bnp1,historySum,tRBC_now] = get_historyContribution(t,an,bn,sn,zeroLoc,K,...
2 dt,tRBC, W, snIdxNow, p,q,p0,q0,sn_hat,tRBC_now,phi_tn,phit_tn,s,tol)
3% GET_HISTORYCONTRIBUTION a function to get the history contribution in BIE
4%
5% INPUTs:
6% t: current time
7% an,bn: Fourier coefficients
8% sn,sn_hat: density grid function and transform
9% zeroLoc: location of the zero frequency
10% K: grid of frequency values
11% dt: time-step
12% tRBC,tRBC_now: time-step for radiation boundary conditions and tRBC_now
13% is parameter to indicate which value on the time grid is being used at
14% the current step.
15% dt; time-step
16% W: width of the window function
17% snIdxNow: index of sn at the first time-step
18% p,q,p0,q0: the integrals p and q needed for the history evaluation
19% (see notes). p0 and q0 correspond to the zero-frequency case.
20% phi_tn,phit_tn: blending and window function for free-space projection
21% s:location of sources
22% tol: error tol
23% addProj: button to add free-space projection
24%
25% OUTPUTs:
26% anp1,bnp1: Fourier coefficients at the new time-step
27% historySum: sum needed in the history evaluation on the right side
28% tRBC_now: the updated time to apply RBC
30[anp1,bnp1] = alphaEvolution_spectral(an,bn,sn,zeroLoc,K,dt,W,snIdxNow,p,q,p0,q0,sn_hat);
31if(t>=tRBC_now)
32 [anp1,bnp1,~] = alphaRBCproj(anp1,bnp1,phi_tn,phit_tn);
33 tRBC_now = tRBC_now + tRBC;
34end
36historySum = finufft1d2(s,-1,tol,anp1,struct('modeord',1));
38end