From f4fc50581dd84db366ecf43ed10d1bedba30205f Mon Sep 17 00:00:00 2001 From: Xavier Raynaud Date: Sun, 21 Apr 2024 22:07:17 +0200 Subject: [PATCH 1/5] fixed sorting in BatchProcessor --- Utilities/Various/BatchProcessor.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Utilities/Various/BatchProcessor.m b/Utilities/Various/BatchProcessor.m index 232043aa..764fd06d 100644 --- a/Utilities/Various/BatchProcessor.m +++ b/Utilities/Various/BatchProcessor.m @@ -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 From d1318d08657430beab7c46345ce79b0d871bfe00 Mon Sep 17 00:00:00 2001 From: Xavier Raynaud Date: Mon, 22 Apr 2024 10:51:01 +0200 Subject: [PATCH 2/5] changed order in sorting in BatchProcessor --- Utilities/Various/BatchProcessor.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/Various/BatchProcessor.m b/Utilities/Various/BatchProcessor.m index 764fd06d..64e52473 100644 --- a/Utilities/Various/BatchProcessor.m +++ b/Utilities/Various/BatchProcessor.m @@ -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; From 02a061e480a2975eedc3085e779eec169dac5633 Mon Sep 17 00:00:00 2001 From: Xavier Raynaud Date: Mon, 22 Apr 2024 18:16:26 +0200 Subject: [PATCH 3/5] added static mark option in ComputationalGraphPlot --- .../ComputationalGraphPlot.m | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Utilities/ComputationalGraph/ComputationalGraphPlot.m b/Utilities/ComputationalGraph/ComputationalGraphPlot.m index 2413544c..f28e2353 100644 --- a/Utilities/ComputationalGraph/ComputationalGraphPlot.m +++ b/Utilities/ComputationalGraph/ComputationalGraphPlot.m @@ -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 @@ -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 @@ -167,7 +179,7 @@ opt = struct('doPlot', true); opt = merge_options(opt, varargin{:}); - nodenames = cgp.nodenames; + nodenames = cgp.computationalGraphTool.nodenames; A = cgp.A; From b0f2a57b0d2755bb2a5aebd20efb064f16cf2c83 Mon Sep 17 00:00:00 2001 From: August Johansson Date: Wed, 24 Apr 2024 14:37:58 +0200 Subject: [PATCH 4/5] Fix bug in MLP geometry: width was too big --- .../BatteryGeneratorMultilayerPouch.m | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Battery/BatteryGeometry/BatteryGeneratorMultilayerPouch.m b/Battery/BatteryGeometry/BatteryGeneratorMultilayerPouch.m index 16bcc864..308038f2 100644 --- a/Battery/BatteryGeometry/BatteryGeneratorMultilayerPouch.m +++ b/Battery/BatteryGeometry/BatteryGeneratorMultilayerPouch.m @@ -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 @@ -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); From 8263c35a7cee35eb7d8f45a8973dfac4a894879f Mon Sep 17 00:00:00 2001 From: August Johansson Date: Wed, 24 Apr 2024 14:38:43 +0200 Subject: [PATCH 5/5] Fix spelling --- Utilities/Adjoint/evalObjectiveBattmo.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Adjoint/evalObjectiveBattmo.m b/Utilities/Adjoint/evalObjectiveBattmo.m index 7731d3c6..43288324 100644 --- a/Utilities/Adjoint/evalObjectiveBattmo.m +++ b/Utilities/Adjoint/evalObjectiveBattmo.m @@ -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