1 function NU = fv_conv_diff_step(U,num_conv_flux,num_diff_flux,grid,params)
2 %
function NU = fv_conv_diff_step(U,num_conv_flux,num_diff_flux,grid,params)
4 %
function performing an FV-time-step starting from old
5 % values U corresponding to the geometry given in grid producing a
6 % new vector of elementwise scalars NU using given flux-information
7 % neuman-flux treatment is performed, dirichlet is assumed to be
8 % incorporated in the specified fluxes num_conv_flux, num_diff_flux.
10 % required fields of params:
11 % dt : size of the timestep
12 % k : diffusion parameter
14 % Bernard Haasdonk 27.9.2005
16 num_flux_mat = num_conv_flux.G + num_diff_flux.G;
22 neu_NB_ind =find(grid.NBI == -2);
23 UU = repmat(U,1,size(grid.NBI,2));
25 % determine neumann-boundary values at end as computed flux is required
26 % in case of outflow-conditions
27 if ~isempty(neu_NB_ind)
28 FNneu = params.neumann_values_ptr( ...
29 [grid.ECX(neu_NB_ind),...
30 grid.ECY(neu_NB_ind)],...
32 [grid.NX(neu_NB_ind),...
33 grid.NY(neu_NB_ind)], ...
36 %
set overall neumann boundary values
37 num_flux_mat(neu_NB_ind) = grid.EL(neu_NB_ind) .* FNneu;
40 i = find(isnan(num_flux_mat),1);
42 error('not all fluxes specified, NaN occuring !!');
45 NU = U - params.dt * grid.Ainv .* sum( num_flux_mat , 2);
48 % plot_fv_data([U,NU],params,'U(n) and U(n+1)');