Capillary Resistance Bug Fix #35
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Capillary Resistance Bug Fixes (and Ubuntu Actions Update)
This PR focuses on fixing the small bugs in Reprosim's
capillary_resistance()function, found by Jordan when investigating this function and attempting to port it to the ReprosimV2 python library.Bugs were all in the constructions of the flow constraints for the venous side of the intermediate villous tree.
Bug 1:
curgen = ceiling((dble(p_unknowns) - dble(i2))/dble(numconvolutes))was calculating the generation wrong on edge cases (i.e. the one right before going up a generation)
Fix:
curgen = ceiling((dble(p_unknowns) - dble(i2) + 1)/dble(numconvolutes))Bug 2:
This should always still be R_seg/divisor, otherwise it could run into more edge cases like above where divisor is 2 and the flow isn't splitting accordingly.
Fix:
remove this whole if block and always do the
elseblock instead.Bug 3:
As we loop over
ng = 1,numgens, we calculate the segment resistance top down generation wise:int_radius_gen = int_rad_vin + (int_rad_vout-int_rad_vin)/dble(numgens)*(dble(ng)-1.0_dp)However, the constraints are set via looping through:
i2 =p_unknowns/2 + (ng-1)*numconvolutes + nc,where
i2orders the venule from the bottom node to the top node (i.e. the final node is the starting node).Thus, the wrong
R_segis being used for each calculation.Fix:
int_radius_gen = int_rad_vin + (int_rad_vout-int_rad_vin)/dble(numgens)*(dble(numgens + 1.0_dp - ng)-1.0_dp)(update
numgens->numgens + 1.0_dp - ng.This value is used in other parts of the venous construction code to get the current generation as well, i.e:
numgens - ng + 1 !current generationActions Update:
ubuntu-20.4forubuntu-latestfor PR checks