/ concept-collection / windowedFourierProjection
Sign in
concept-collection / windowedFourierProjection
windowedFourierProjection / wfp_1Dspringscattering / get_solnAndErr.m
63 lines · 2.2 KBBlameHistoryRaw
1function [u,ue,tn_sol,n_sol,tSOL_now,sn_sol] = get_solnAndErr(u,ue,tn_sol,n_sol,...
2 tSOL_now,x,t,snIdxNow,sn,an,interpNodesIdx_sol,...
3 interpAndGLWeights_sol,interpShift_sol,s,M,delta,tol,tSOL,solnType,dataParam,fixSolCnt,n,tgh,sn_sol)
4% GET_SOLNANDERR to compute the solution and error (if available)
5%
6% INPUTs
7% u,ue: computed and exact solutions
8% tn_sol,n_sol,tSOL_now: solution time grid and index, tSOL_now is a
9% variable to track the time of the solution with respect to the actual
10% time grid
11% x: spatial grid for testing
12% t,tn: current time, and time grid
13% snIdxNow: index of sn at the first time-step
14% sn: the density grid functions
15% an: Fourier Coefficients
16% interpNodesIdx_sol,interpAndGLWeights_sol,interpShift_sol:
17% interpolation parameters needed for the computation of the local part
18% of the solution.
19% s,M: source location and total num of sources
20% tol: error tolerance
21% mu,t0: parameters needed for the computation of the manufactured
22% solution for error computation. These variables are held in the
23% dataParam struct for ease of passing in functions and switching between
24% test solutions.
25% W,delta: width of the window function: W*dt = delta
26% h_temp: paramter needed for free-space projection
27% tSOL: time-step for the test solution grid
28% addProj: button to get free-space solution
29% solnType: manufactured or true
30% writerObj: object to save movie
31% plotMovie: button to plot movie
32% saveMovie: button to save movie
33%
34% OUTPUTs
35% u,ue: computed and exact solutions
36% tn_sol,n_sol,tSOL_now: solution time grid and index, tSOL_now is a
37% variable to track the time of the solution with respect to the actual
38% time grid
41mu = dataParam.mu;
42t0 = dataParam.t0;
44% if(t>=tSOL_now)
45if(mod(n-tgh,fixSolCnt) == 0 && t>=0)
47 sn_sol(:,(n_sol + 1)) = sn(end,:)';
49 u(:,(n_sol+1)) = get_uSol(x,t,snIdxNow,sn,an,interpNodesIdx_sol,...
50 interpAndGLWeights_sol,interpShift_sol,s,M,delta,tol);
52 if(strcmp(solnType,'ms'))
53 ue(:,(n_sol+1)) = get_ExactSol(x,t,mu,t0,M,s);
54 else
55 ue(:,(n_sol+1)) = get_uIncident(x,t,mu,t0);
56 end
58 tn_sol(n_sol+1) = t;
59 n_sol = n_sol + 1;
60 tSOL_now = tSOL_now + tSOL;
61end
63end
moveopenescclose