Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:BattMoTeam/BattMo into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjohansson committed Apr 24, 2024
2 parents 8ed6eef + 8cc440f commit 883f18a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 16 deletions.
19 changes: 17 additions & 2 deletions Battery/BatteryGeometry/BatteryGeneratorMultilayerPouch.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
classdef BatteryGeneratorMultilayerPouch < BatteryGenerator
% Setup 3D grid with tab
% Setup 3D multilayer pouch cell grid with tabs in the y directions
%{
____
___| |__
| |
| |
|___ ___|
| |
|__|
y (height)
^
|
|---> x (width)
%}

properties

Expand Down Expand Up @@ -123,7 +138,7 @@

% Setup widths
x0 = 0.5*(gen.pouch_width - gen.tab_width);
dxlength = [x0; gen.pouch_width-gen.tab_width; x0];
dxlength = [x0; gen.tab_width; x0];
nxs = [gen.elyte_nx; gen.tab_nx; gen.elyte_nx];
x = dxlength./nxs;
x = rldecode(x, nxs);
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Adjoint/evalObjectiveBattmo.m
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ This file is part of The MATLAB Reservoir Simulation Toolbox (MRST).

otherwise

error('Greadient method %s is not implemented',opt.gradientMethod);
error('Gradient method %s is not implemented', opt.gradientMethod);

end

Expand Down
28 changes: 20 additions & 8 deletions Utilities/ComputationalGraph/ComputationalGraphPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
properties (SetAccess = private)

computationalGraphTool
nodenames % local copy from computationalGraphTool
nodenames % names of the nodes, copy from computationalGraphTool, with added comment for the static variable
A % local copy from computationalGraphTool

end
Expand All @@ -14,26 +14,38 @@

nodeinds % current index

markStaticVariables % default = true
plotOptions

end

methods

function cgp = ComputationalGraphPlot(computationalGraphTool)
function cgp = ComputationalGraphPlot(computationalGraphTool, varargin)

opt = struct('markStatic', true);
opt = merge_options(opt, varargin{:});

cgt = computationalGraphTool;

cgp.computationalGraphTool = cgt;

cgp.A = cgt.adjencyMatrix;
cgp.nodenames = cgt.nodenames;
cgp.A = cgt.adjencyMatrix;

nodenames = cgt.nodenames;

if opt.markStatic
staticprops = cgt.staticprops;
for istat = 1 : numel(staticprops)
ind = staticprops{istat}.varnameind;
nodenames{ind} = sprintf('%s (static)', nodenames{ind});
end
end

cgp.nodenames = nodenames;

cgp.nodeinds = (1 : numel(cgp.nodenames))';

cgp.markStaticVariables = true;
cgp.plotOptions = {};
cgp.plotOptions = {};

end

Expand Down Expand Up @@ -167,7 +179,7 @@
opt = struct('doPlot', true);
opt = merge_options(opt, varargin{:});

nodenames = cgp.nodenames;
nodenames = cgp.computationalGraphTool.nodenames;
A = cgp.A;


Expand Down
12 changes: 7 additions & 5 deletions Utilities/Various/BatchProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ function printSimList(bp, simlist, varargin)
end

function sortedsimlist = sortSimList(bp, simlist, varargin)
paramname = varargin{1};
rest = varargin(2 : end);
paramname = varargin{end};
rest = varargin(1 : end - 1);

direction = 'ascend';
usefunc = false;
Expand Down Expand Up @@ -324,13 +324,15 @@ function printSimList(bp, simlist, varargin)
if usefunc
vals = func(vals);
end

[~, ~, ic] = unique(vals, 'sorted');
inds = [ic, (1 : numel(vals))'];

[~, ind] = sort(vals);
switch direction
case 'ascend'
% do nothing
[~, ind] = sortrows(inds);
case 'descend'
ind = ind(end : -1 : 1);
[~, ind] = sortrows(inds, [-1, 2]);
otherwise
error('direction not recognized');
end
Expand Down

0 comments on commit 883f18a

Please sign in to comment.