Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Commit e30afed

Browse files
author
Dilawar Singh
committed
The default values changed in the commit (ba1065c) breaks example such
as https://github.com/BhallaLab/moose-examples/blob/09ca09e68f163a0920653a9400214aff10b6ba16/snippets/rxdFuncDiffusion.py . The sparse matrix has upper limit of number of rows and columns to 20,000. In the example linked, new values makes it impossible to run the example as is. To overcome this, we notify the user whenever this limit is reached and ask them to set `diffLength` before setting up the `x1`. On top of this, we can also revert default values to original larger values. Not sure why these values were changed to the scale of 1e-6? Unless the reason is known, I am not going to change current values. The above linked example now works with this commit.
1 parent d3fe5e9 commit e30afed

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

mesh/CylMesh.cpp

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,23 @@ void CylMesh::setX1( const Eref& e, double v )
291291

292292
size_t numVoxels = (v - x0_) / diffLength_;
293293
x1_ = v;
294-
if( numVoxels > SM_MAX_COLUMNS )
294+
if( numVoxels >= SM_MAX_COLUMNS )
295295
{
296-
MOOSE_WARN( "Warn: Too many voxels (" << numVoxels << ") would be created "
297-
<< " with current diffusion-length of " << diffLength_
298-
<< "(maximum voxels allowed=" << SM_MAX_COLUMNS << "). "
299-
<< " Rescaling length of compartment." );
300-
x1_ = diffLength_ * SM_MAX_COLUMNS;
296+
x1_ = diffLength_ * (SM_MAX_COLUMNS-1);
297+
MOOSE_WARN("setX1: Too many voxels (" << numVoxels << ") would be created "
298+
<< "with current diffLength of " << diffLength_
299+
<< "m (maximum voxels allowed=" << SM_MAX_COLUMNS << "). "
300+
<< " Changing length of the compartment: "
301+
<< "x0=" << x0_ << ", x1=" << x1_
302+
<< ". You should change `diffLength` before setting `x1`."
303+
);
304+
}
305+
if(numVoxels > 0)
306+
{
307+
vector< double > childConcs;
308+
getChildConcs( e, childConcs );
309+
updateCoords( e, childConcs );
301310
}
302-
vector< double > childConcs;
303-
getChildConcs( e, childConcs );
304-
updateCoords( e, childConcs );
305311
}
306312

307313
double CylMesh::getX1( const Eref& e ) const
@@ -403,15 +409,21 @@ void CylMesh::setDiffLength( const Eref& e, double v )
403409
size_t numVoxels = (size_t) ((x1_-x0_)/diffLength_);
404410
if( numVoxels >= SM_MAX_COLUMNS )
405411
{
412+
stringstream ss;
413+
ss << "setDiffLength: Too many voxels (" << numVoxels << ") would be created "
414+
<< "for current value of x1=" << x1_ << "m, and x0=" << x0_
415+
<< "m (max " << SM_MAX_COLUMNS << " allowed). ";
406416
x1_ = x0_ + diffLength_ * (SM_MAX_COLUMNS - 1);
407-
MOOSE_WARN( "Too many voxels (" << numVoxels << ") would be created "
408-
<< "for diffLength of " << diffLength_
409-
<< " (maximum " << SM_MAX_COLUMNS << " allowed). "
410-
<< " Changing compartment length to " << (x1_ - x0_) << ".");
417+
ss << " Changing the length of the compartment: "
418+
<< "x0= " << x0_ << ", x1= " << x1_;
419+
MOOSE_WARN(ss.str());
420+
}
421+
if(numVoxels > 0)
422+
{
423+
vector< double > childConcs;
424+
getChildConcs( e, childConcs );
425+
updateCoords( e, childConcs );
411426
}
412-
vector< double > childConcs;
413-
getChildConcs( e, childConcs );
414-
updateCoords( e, childConcs );
415427
}
416428

417429
double CylMesh::getDiffLength( const Eref& e ) const

utility/print_function.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ using namespace std;
7070
#endif
7171

7272
#define MOOSE_WARN( a ) { \
73-
stringstream ss; ss << a; \
73+
stringstream ss; ss << __func__ << ": " << a; \
7474
moose::showWarn( ss.str() ); \
7575
}
7676

0 commit comments

Comments
 (0)