Hello,
I am currently studying the lemsystems.cpp file, and I came across the following two lines in the void LEM::SystemsInternalTimestep(double simdt) function (lines 1331 and 1332):
double mintFactor = __max(simdt / 20.0, 0.02);
double tFactor = __min(mintFactor, simdt);
I'm not entirely sure why a limit is being placed on tfactor, but based on the variable names I think these two lines might be doing the wrong thing.
The name mintFactor seems to imply that it is a minimum possible value for tfactor. However, in the next line it takes the minimum of mintFactor and simdt. This means that if simdt is smaller than mintFactor, tFactor will be smaller than mintFactor.
As an extreme example, imagine if simdt = 0.00001. In that case, mintFactor will be 0.02, since 0.02 is larger than simdt/20. Then tFactor is set to 0.00001, since it is smaller than mintFactor.
Is this an error, or have I misunderstood the purpose of mintFactor?
Many thanks,
msligo
I am currently studying the lemsystems.cpp file, and I came across the following two lines in the void LEM::SystemsInternalTimestep(double simdt) function (lines 1331 and 1332):
double mintFactor = __max(simdt / 20.0, 0.02);
double tFactor = __min(mintFactor, simdt);
I'm not entirely sure why a limit is being placed on tfactor, but based on the variable names I think these two lines might be doing the wrong thing.
The name mintFactor seems to imply that it is a minimum possible value for tfactor. However, in the next line it takes the minimum of mintFactor and simdt. This means that if simdt is smaller than mintFactor, tFactor will be smaller than mintFactor.
As an extreme example, imagine if simdt = 0.00001. In that case, mintFactor will be 0.02, since 0.02 is larger than simdt/20. Then tFactor is set to 0.00001, since it is smaller than mintFactor.
Is this an error, or have I misunderstood the purpose of mintFactor?
Many thanks,
msligo