Commit 9adf6926 authored by Pierre Cazenave's avatar Pierre Cazenave
Browse files

Fix weights for the nodes and elements to share common values.

parent c13d74ab
......@@ -104,6 +104,8 @@ function Nested = find_nesting_region(conf, Mobj)
% 2016-12-22 Fairly major rewrite to make things clearer and less prone
% to subtle bugs.
% 2017-02-16 Fix for direct nesting (no weights needed).
% 2017-02-20 Fix non-critical bug which added empty cells for the nest
% elements. Also make the node and element weight values match one another.
%
%==========================================================================
......@@ -144,18 +146,14 @@ for obc_idx = 1:Mobj.nObs
% Generate the weights for the elements and nodes.
if conf.Nested_type(obc_idx) == 3
if conf.power == 0
weights_nodes = nan(1, conf.levels(obc_idx) + 1);
weights_elems = nan(1, conf.levels(obc_idx));
weights_nodes(1:end - 1) = fliplr((1:conf.levels(obc_idx))./conf.levels(obc_idx));
weights_nodes(end) = 0;
weights_elems(1:end - 1) = fliplr((1:conf.levels(obc_idx) - 1)./conf.levels(obc_idx) - 1);
weights_elems(end) = 0;
weights_nodes = fliplr((1:conf.levels(obc_idx) + 1)./(conf.levels(obc_idx) + 1));
else
weights_nodes = 1:conf.levels(obc_idx) + 1;
weights_nodes = 1./weights_nodes.^conf.power;
weights_elems = 1:conf.levels(obc_idx);
weights_elems = 1./weights_elems.^conf.power;
end
% Use the same weights as the nodes, but drop the last level
% (elements is always 1 smaller).
weights_elems = weights_nodes(1:end - 1);
end
% Save the original open boundary nodes into the nested struct (Nested).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment