From 647d1276811cc237bba8a776a96592d5b4a12217 Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Mon, 2 Dec 2024 11:08:28 +0100 Subject: [PATCH 1/5] Fix CSTR volume singleton dimension --- include/common/SolutionRecorderImpl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common/SolutionRecorderImpl.hpp b/include/common/SolutionRecorderImpl.hpp index bc245c1ed..e3bb4448f 100644 --- a/include/common/SolutionRecorderImpl.hpp +++ b/include/common/SolutionRecorderImpl.hpp @@ -882,7 +882,7 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder { oss.str(""); oss << prefix << "_VOLUME"; - writer.template matrix(oss.str(), _numTimesteps, _nVolumeDof, _curStorage->volume.data(), 1); + writer.template vector(oss.str(), _numTimesteps, _curStorage->volume.data(), 1); } } From ee4bb1f1240069f4809f416adda3003284bdafb1 Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Mon, 2 Dec 2024 11:16:41 +0100 Subject: [PATCH 2/5] wip --- include/common/SolutionRecorderImpl.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/common/SolutionRecorderImpl.hpp b/include/common/SolutionRecorderImpl.hpp index e3bb4448f..fd0d73040 100644 --- a/include/common/SolutionRecorderImpl.hpp +++ b/include/common/SolutionRecorderImpl.hpp @@ -882,7 +882,9 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder { oss.str(""); oss << prefix << "_VOLUME"; - writer.template vector(oss.str(), _numTimesteps, _curStorage->volume.data(), 1); + // Note: since the CSTR is currently the only unit operation that simulates volume, and _numVolumeDof is 1, we always write this as a vector. + // Once other unit operations are implemented with more than one volume, we should add the option here to write this as a matrix (singletonDimension filed etc, see other output). + writer.template vector(oss.str(), _numTimesteps * _nVolumeDof, _curStorage->volume.data(), 1); } } From 47a73e729056011bb3ac43591f03089fec6f0379 Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Mon, 2 Dec 2024 11:33:21 +0100 Subject: [PATCH 3/5] Suppress write of particle coordinate for CSTR (via fix of numparticleshells) --- src/libcadet/model/StirredTankModel.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcadet/model/StirredTankModel.hpp b/src/libcadet/model/StirredTankModel.hpp index 61eb1cc4a..dc720b997 100644 --- a/src/libcadet/model/StirredTankModel.hpp +++ b/src/libcadet/model/StirredTankModel.hpp @@ -191,7 +191,7 @@ class CSTRModel : public UnitOperationBase virtual unsigned int numInletPorts() const CADET_NOEXCEPT { return 1; } virtual unsigned int numOutletPorts() const CADET_NOEXCEPT { return 1; } virtual unsigned int numParticleTypes() const CADET_NOEXCEPT { return _nParType; } - virtual unsigned int numParticleShells(unsigned int parType) const CADET_NOEXCEPT { return 1; } + virtual unsigned int numParticleShells(unsigned int parType) const CADET_NOEXCEPT { return 0; } virtual unsigned int numBoundStates(unsigned int parType) const CADET_NOEXCEPT { return _strideBound[parType]; } virtual unsigned int numMobilePhaseDofs() const CADET_NOEXCEPT { return _nComp; } virtual unsigned int numParticleMobilePhaseDofs() const CADET_NOEXCEPT { return 0; } From 1450aa56e35c2095df5f79c74d31047aaf02743f Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Mon, 2 Dec 2024 11:39:49 +0100 Subject: [PATCH 4/5] Suppress write of particle coordinates for LRMP and CSTR and suppress write of axial coordinates for CSTR --- include/common/SolutionRecorderImpl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/SolutionRecorderImpl.hpp b/include/common/SolutionRecorderImpl.hpp index fd0d73040..1b2e8fcd1 100644 --- a/include/common/SolutionRecorderImpl.hpp +++ b/include/common/SolutionRecorderImpl.hpp @@ -339,12 +339,12 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder if (!_storeCoordinates) return; - if (!_axialCoords.empty()) + if (!_axialCoords.empty() && ((_keepBulkSingletonDim && (_nAxialCells == 1)) || (_nAxialCells > 1))) writer.template vector("AXIAL_COORDINATES", _axialCoords); if (!_radialCoords.empty()) writer.template vector("RADIAL_COORDINATES", _radialCoords); - if (!_particleCoords.empty()) + if (!_particleCoords.empty() && ((_keepParticleSingletonDim && (_nParShells == 1)) || (_nParShells > 1))) { std::ostringstream oss; unsigned int offset = 0; From b799f8995f587312a8cf9249d4bc9b1b8be76b41 Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Mon, 2 Dec 2024 11:46:33 +0100 Subject: [PATCH 5/5] fixup! --- include/common/SolutionRecorderImpl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common/SolutionRecorderImpl.hpp b/include/common/SolutionRecorderImpl.hpp index 1b2e8fcd1..4e43b7e24 100644 --- a/include/common/SolutionRecorderImpl.hpp +++ b/include/common/SolutionRecorderImpl.hpp @@ -344,13 +344,13 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder if (!_radialCoords.empty()) writer.template vector("RADIAL_COORDINATES", _radialCoords); - if (!_particleCoords.empty() && ((_keepParticleSingletonDim && (_nParShells == 1)) || (_nParShells > 1))) + if (!_particleCoords.empty()) { std::ostringstream oss; unsigned int offset = 0; for (std::size_t pt = 0; pt < _nParShells.size(); ++pt) { - if (_nParShells[pt] == 0) + if (_nParShells[pt] == 0 || (!_keepParticleSingletonDim && (_nParShells[pt] == 1))) continue; oss.str("");