5 %
function applying an FV-space-discretization
operator starting from old
6 % values U corresponding to the geometry given in grid producing a
7 %
new vector of elementwise scalars NU but only on
for the
8 % subelements with numbers given in NU_ind. If NU_ind is empty, all
9 %
new values NU are determined, i.e. length(NU) = length(U) =
12 % By
this, the
operator evaluation can be performed in a localized
13 % way, i.e. used
for empirical interpolation in rb_nonlin_evol_simulation
15 % usual timestepping can be performed afterwards by (NU = Id - deltat *
18 % required fields of params:
24 % compute flux at dirichlet and inner edges. Neuman and
25 % cut-edges are not set.
27 num_flux = fv_num_diff_flux(U,grid,params);
28 num_flux_mat = num_flux.G;
30 %
if no subset is specified: compute all elements
32 NU_ind = 1:grid.nelements;
39 neu_NB_ind = find(grid.NBI == -2);
40 UU = repmat(U,1,grid.nneigh);
42 % determine neumann-boundary values at end as computed flux is required
43 % in case of outflow-conditions
44 if ~isempty(neu_NB_ind)
46 FNneu = neuman_values( ...
47 grid.ECX(neu_NB_ind),...
48 grid.ECY(neu_NB_ind),...
50 grid.NX(neu_NB_ind),...
51 grid.NY(neu_NB_ind), ...
54 % set overall neumann boundary values
55 num_flux_mat(neu_NB_ind) = grid.EL(neu_NB_ind) .* FNneu;
59 % for to_be_computed elements, we need all fluxes!
60 if ~isempty(find(isnan(num_flux_mat(NU_ind,:)),1))
61 error('not all fluxes specified, NaN occuring !!');
64 %NU = U(NU_ind) - params.dt * grid.Ainv(NU_ind) .* ...
65 % sum( num_flux_mat(NU_ind), 2);
66 if isequal(params.name_diffusivity_tensor, 'richards')
68 % x_hill = params.geometry_transformation_spline_x;
69 % y_hill = params.geometry_transformation_spline_y;
70 % y_hill(2) = params.hill_height;
71 p_mu = spline_select(params);
72 [ breaks, coeffs, pieces, order ] = unmkpp(p_mu);
73 p_mu_int = mkpp(breaks, [coeffs(1:order), 0] ./ [order:-1:1, 1]);
74 Ainv = ppval(p_mu_int, grid.X(grid.VI(:,2)))' ...
75 - ppval(p_mu_int, grid.X(grid.VI(:,3)))';
76 Ainv = (( grid.Y(grid.VI(:,2)) - grid.Y(grid.VI(:,1)) )' ...
80 INC = Ainv(NU_ind) .* sum ( num_flux_mat(NU_ind,:), 2);
82 INC = grid.Ainv(NU_ind) .* sum( num_flux_mat(NU_ind,:), 2);
86 % plot_fv_data([U,NU],params,'U(n) and U(n+1)');
90 % TO BE ADJUSTED TO NEW SYNTAX
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 = fv_diff_explicit_space(U, NU_ind,gridbase grid, params)
fv_diff_explicit_space(U,NU_ind,grid,params)