rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fv_conv_diff_step.m
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)
3 %
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.
9 
10 % required fields of params:
11 % dt : size of the timestep
12 % k : diffusion parameter
13 
14 % Bernard Haasdonk 27.9.2005
15 
16  num_flux_mat = num_conv_flux.G + num_diff_flux.G;
17 
18  if params.verbose>=5
19  fprintf('.');
20  end;
21 
22  neu_NB_ind =find(grid.NBI == -2);
23  UU = repmat(U,1,size(grid.NBI,2));
24 
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)],...
31  UU(neu_NB_ind),...
32  [grid.NX(neu_NB_ind),...
33  grid.NY(neu_NB_ind)], ...
34  params);
35 
36  % set overall neumann boundary values
37  num_flux_mat(neu_NB_ind) = grid.EL(neu_NB_ind) .* FNneu;
38  end;
39 
40  i = find(isnan(num_flux_mat),1);
41  if ~isempty(i)
42  error('not all fluxes specified, NaN occuring !!');
43  end;
44 
45  NU = U - params.dt * grid.Ainv .* sum( num_flux_mat , 2);
46 
47 % if params.verbose >= 10
48 % plot_fv_data([U,NU],params,'U(n) and U(n+1)');
49 % keyboard;
50 % end;
51 %| \docupdate
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
Definition: verbose.m:17
NBI
NBI(i,j) = element index of j-th neighbour of element i boundary faces are set to -1 or negative valu...
Definition: gridbase.m:102