rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
fv_conv_explicit_space.m
Go to the documentation of this file.
1 function INC = fv_conv_explicit_space(U,NU_ind,grid,params)
2 % function INC =
3 % fv_conv_explicit_space(U,NU_ind,grid,params)
4 % function applying an FV-space-discretization operator starting from old
5 % values U corresponding to the geometry given in grid producing a
6 % new vector of elementwise scalars NU but only on for the
7 % subelements with numbers given in NU_ind. If NU_ind is empty, all
8 % new values NU are determined, i.e. length(NU) = length(U) = grid.nelements
9 %
10 % By this, the operator evaluation can be performed in a localized
11 % way, i.e. used for empirical interpolation in rb_nonlin_evol_simulation
12 %
13 % usual timestepping can be performed afterwards by (NU = Id - deltat * INC).
14 %
15 % required fields of params:
16 % verbose: a verbosity level
17 
18 % Bernard Haasdonk 18.5.2007
19 
20 % compute flux at dirichlet and inner edges. Neuman and
21 % cut-edges are not set.
22 
23 %disp('step through fv_conv_explicit_space!!');
24 %keyboard;
25 
26 num_flux = fv_num_conv_flux(U,grid,params);
27 num_flux_mat = num_flux.G;
28 
29 % if no subset is specified: compute all elements
30 if isempty(NU_ind)
31  NU_ind = 1:grid.nelements;
32 end;
33 
34 %if params.verbose>=5
35 % fprintf('.');
36 %end;
37 
38 neu_NB_ind =find(grid.NBI == -2);
39 UU = repmat(U,1,grid.nneigh);
40 
41 % determine neumann-boundary values at end as computed flux is required
42 % in case of outflow-conditions
43 if ~isempty(neu_NB_ind)
44 
45  % in case of file access, the correct filename must be set here
46  % the following is only relevant in case of use of a
47  % params.use_velocitymatrix_file and filecaching mode 2
48  if isfield(params,'filecache_velocity_matrixfile_extract') && ...
49  (params.filecache_velocity_matrixfile_extract == 2);
50  params.velocity_matrixfile = ...
51  cache_velocity_matrixfile_extract(...
52  grid.ECX(neu_NB_ind),...
53  grid.ECY(neu_NB_ind),...
54  'neumann_bnd', ...
55  params);
56  end;
57 
58  FNneu = neuman_values( ...
59  grid.ECX(neu_NB_ind),...
60  grid.ECY(neu_NB_ind),...
61  UU(neu_NB_ind),...
62  grid.NX(neu_NB_ind),...
63  grid.NY(neu_NB_ind), ...
64  params);
65 
66  % set overall neumann boundary values
67  num_flux_mat(neu_NB_ind) = grid.EL(neu_NB_ind) .* FNneu;
68 end;
69 
70 % for to_be_computed elements, we need all fluxes!
71 i = find(isnan(num_flux_mat(NU_ind,:)),1);
72 if ~isempty(i)
73  error('not all fluxes specified, NaN occuring !!');
74 end;
75 
76 %NU = U(NU_ind) - params.dt * grid.Ainv(NU_ind) .* ...
77 % sum( num_flux_mat(NU_ind), 2);
78 INC = grid.Ainv(NU_ind) .* sum( num_flux_mat(NU_ind,:), 2);
79 
80 % if params.verbose >= 10
81 % plot_fv_data([U,NU],params,'U(n) and U(n+1)');
82 % keyboard;
83 % end;
84 % TO BE ADJUSTED TO NEW SYNTAX
85 %| \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
function INC = fv_conv_explicit_space(U, NU_ind,gridbase grid, params)
fv_conv_explicit_space(U,NU_ind,grid,params) function applying an FV-space-discretization operator st...