Fix for user-defined inlet velocity profile failure#556
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #556 +/- ##
=======================================
Coverage 69.08% 69.08%
=======================================
Files 181 181
Lines 34256 34257 +1
Branches 5931 5932 +1
=======================================
+ Hits 23665 23666 +1
Misses 10454 10454
Partials 137 137 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Looks good to me! |
There was a problem hiding this comment.
Pull request overview
Fixes a solver initialization issue that breaks user-defined inlet velocity profiles (Issue #555) by avoiding an unconditional reallocation of bcType::gx during boundary-condition initialization.
Changes:
- Preserve previously-read user-defined spatial profile data in
lBc.gxby only allocating when it is empty. - Prevents user-defined profile values from being reset to zero during
bc_ini().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // lBc.gx may have values set when for example when | ||
| // reading in a user-defined profile. | ||
| if (lBc.gx.size() == 0) { | ||
| lBc.gx.resize(lFa.nNo); | ||
| } |
There was a problem hiding this comment.
@ktbolt is it worth validating that lBc.gx.size() == lFa.nNo if it's not 0?
| lBc.gx.resize(lFa.nNo); | ||
| //if (.NOT.ALLOCATED(lBc.gx)) ALLOCATE(lBc.gx(lFa.nNo)) | ||
|
|
||
| // lBc.gx may have values set when for example when |
There was a problem hiding this comment.
@ktbolt do you have a test you can add for user-defined spatial profile?
|
|
||
| // lBc.gx may have values set when for example when | ||
| // reading in a user-defined profile. | ||
| if (lBc.gx.size() == 0) { |
There was a problem hiding this comment.
Interesting, so previously any time a user defined a spatial profile the solver would fail?
There was a problem hiding this comment.
@aabrown100-git Correct; there are no CI tests for the Spatial_profile_file_path parameter.
| // lBc.gx may have values set when for example when | ||
| // reading in a user-defined profile. | ||
| if (lBc.gx.size() == 0) { | ||
| lBc.gx.resize(lFa.nNo); | ||
| } |
There was a problem hiding this comment.
@ktbolt is it worth validating that lBc.gx.size() == lFa.nNo if it's not 0?
| lBc.gx.resize(lFa.nNo); | ||
| //if (.NOT.ALLOCATED(lBc.gx)) ALLOCATE(lBc.gx(lFa.nNo)) | ||
|
|
||
| // lBc.gx may have values set when for example when |
There was a problem hiding this comment.
@ktbolt do you have a test you can add for user-defined spatial profile?
|
@aabrown100-git It might be good to check that |
|
@aabrown100-git I am undecided about adding a CI test since the user-defined profile impact such only a small section of code; don't want to have too many CI cases. Maybe this should be a Unit Test ? |
@ktbolt I think a CI test would be good. We could do a unit test too, but would a unit test have caught this bug? I'm thinking a unit test would verify that user-defined profile data is read in correctly, but would we need another unit test to verify that it is not inadvertently overwritten like in this case? A simple CI test could be just another variation of our |
|
@aabrown100-git We would need two unit tests
My feeling is that this code is somewhat isolated from other code development so a CI test is not needed; also worried about the proliferation of CI tests. |
|
@ktbolt Sounds good, doesn't hurt to add those unit tests. Would the second test check Regarding the proliferation of CI tests, are you concerned about the testing time becoming too long? Perhaps we could start creating a different type of CI test that just checks the simulation runs without error, without checking that the solution matches some reference. We could make these very fast (1 timestep, 1 Newton iteration, big tolerances). |
|
@aabrown100-git I was thinking to test I am worried about the testing time as we keep adding more CI tests for added functionality (2D struct, electromechanics, etc.) and having tests that are really not integration tests. CI tests checking to see if a simulation just runs without an error is an interesting idea but I think the cases it would be useful for could just be covered by unit tests maybe. Note that we will start adding |
|
@ktbolt Okay sounds good about the unit tests! |
This is a simple fix for #555.
There is no CI test for a user-defined inlet velocity profile.