5 %
function applying an FV-space-discretization
operator starting from old
6 % values U corresponding to the geometry given in model_data.grid producing a
7 %
new vector of elementwise scalars NU but only on
for the subelements with
8 % numbers given in NU_ind. If NU_ind is empty, all
new values NU are
9 % determined, i.e. length(NU) = length(U) = grid.nelements
11 % By
this, the
operator evaluation can be performed in a localized
12 % way, i.e. used
for empirical interpolation in e.g. rb_nonlin_evol_simulation
14 % usual timestepping can be performed afterwards by (NU = Id - deltat *
17 % required fields of model:
19 % model shall set the fields:
20 % diff_weight: weight
for diffusive flux component
21 % conv_weight: weight
for convective flux component
22 % reac_weight: weight
for reaction term
27 % compute flux at dirichlet and inner edges. Neuman and
28 % cut-edges are not set.
30 grid = model_data.grid;
33 warning(
'off',
'MATLAB:structOnObject');
35 smodel =
struct(model);
37 %
if no subset is specified: compute all elements
39 NU_ind = 1:grid.nelements;
42 num_diff_flux.G=zeros(size(grid.NBI));
43 num_conv_flux.G=zeros(size(grid.NBI));
44 if weights.diff_weight ~= 0
45 num_diff_flux = model.num_diff_flux_ptr(smodel,model_data,U,NU_ind);
46 num_flux_mat = weights.diff_weight * num_diff_flux.G;
48 num_flux_mat = zeros(size(grid.NBI));
50 if weights.conv_weight ~= 0
51 num_conv_flux = model.num_conv_flux_ptr(smodel,model_data,U);
52 num_flux_mat = num_flux_mat + weights.conv_weight * num_conv_flux.G;
59 neu_NB_ind = find(grid.NBI == -2);
60 UU = repmat(U,1,grid.nneigh);
62 % determine neumann-boundary values at end as computed flux is required
63 % in case of outflow-conditions
64 if ~isempty(neu_NB_ind>0)
65 % in case of file access, the correct filename must be set here
66 % the following is only relevant in the case where a
67 % model.use_velocitymatrix_file and filecaching mode 2 are selected
68 if model.filecache_velocity_matrixfile_extract == 2;
69 model.velocity_matrixfile = ...
70 velocity_matrixfile_extract(...
73 grid.ECX(neu_NB_ind),...
74 grid.ECY(neu_NB_ind));
77 FNneu = model.neumann_values_ptr( ...
78 [grid.ECX(neu_NB_ind), grid.ECY(neu_NB_ind)],...
80 [grid.NX(neu_NB_ind),grid.NY(neu_NB_ind)], model);
82 % set overall neumann boundary values
83 num_flux_mat(neu_NB_ind) = grid.EL(neu_NB_ind) .* FNneu;
86 % for to_be_computed elements, we need all fluxes!
87 if ~isempty(find(isnan(num_flux_mat(NU_ind,:)),1))
88 error('not all fluxes specified, NaN occuring !!');
91 %NU = U(NU_ind) - model.dt * grid.Ainv(NU_ind) .* ...
92 % sum( num_flux_mat(NU_ind), 2);
93 INC = grid.Ainv(NU_ind,:) .* sum( num_flux_mat(NU_ind,:), 2);
95 react = zeros(1,grid.nelements);
96 if weights.react_weight ~= 0
97 react = reaction(model, grid.CX, grid.CY, U);
98 INC = INC + weights.react_weight * react(NU_ind,:);
103 % plot_fv_data([U,NU],model,'U(n) and U(n+1)');
function r = verbose(level, message, messageId)
This function displays messages depending on a message-id and/or a level. Aditionally you can set/res...
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...
function [ INC , fluxes ] = fv_space_operator(model, model_data, U, NU_ind, weights)
fv_space_operator(model,model_data,U,NU_ind,grid,weights)