Fixed URIS contribution for more than one valve in fluid equation#552
Fixed URIS contribution for more than one valve in fluid equation#552hanzhao2020 wants to merge 5 commits into
Conversation
…tiPhysics into fix-ris-factor
There was a problem hiding this comment.
Pull request overview
This PR updates the URIS (unfitted RIS) valve contribution in the fluid/FSi assembly to correctly account for multiple valves by summing contributions at quadrature points (instead of taking only the maximum), and refactors the URIS factor computation into a dedicated helper.
Changes:
- Sum URIS valve contributions per quadrature point and pass the total resistance factor into
fluid_3d_m/fluid_3d_c. - Add
uris::uris_compute_ris_factor()and store per-valve resistance onurisType(removing globalComMod::urisRes*and theClosed_resistanceinput). - Update URIS test cases and expected output artifacts.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cases/uris/pipe_uris_fsi/solver.xml | Removes Closed_resistance from URIS test input. |
| tests/cases/uris/pipe_uris_fsi/result_005.vtu | Updates expected results (Git LFS pointer). |
| tests/cases/uris/pipe_uris_cfd/solver.xml | Removes Closed_resistance from URIS test input. |
| tests/cases/uris/pipe_uris_cfd/result_005.vtu | Updates expected results (Git LFS pointer). |
| Code/Source/solver/uris.h | Declares uris_compute_ris_factor() helper. |
| Code/Source/solver/uris.cpp | Implements RIS-factor accumulation across multiple URIS valves; moves resistance storage to urisType. |
| Code/Source/solver/Parameters.h | Removes resistance_close from URISMeshParameters. |
| Code/Source/solver/Parameters.cpp | Removes Closed_resistance parameter and changes URIS thickness defaults. |
| Code/Source/solver/fsi.cpp | Uses uris_compute_ris_factor() and passes summed factor into fluid assembly. |
| Code/Source/solver/fluid.h | Updates fluid_3d_m/c signatures to accept the total URIS resistance factor. |
| Code/Source/solver/fluid.cpp | Uses uris_compute_ris_factor() and applies summed factor in momentum/continuity assembly. |
| Code/Source/solver/distribute.cpp | Broadcasts per-valve urisType::resistance and removes broadcasts of deleted ComMod::urisRes*. |
| Code/Source/solver/ComMod.h | Adds urisType::resistance and removes ComMod::urisRes / urisResClose. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| com_mod.urisFlag = true; | ||
| com_mod.urisActFlag = true; | ||
|
|
||
| auto param = simulation->parameters.URIS_mesh_parameters[0]; | ||
| com_mod.urisRes = param->resistance(); | ||
| com_mod.urisResClose = param->resistance_close(); | ||
|
|
||
| std::cout << "URIS resistance: " << com_mod.urisRes << std::endl; | ||
| std::cout << "URIS resistance when the valve is closed: " << com_mod.urisResClose << std::endl; | ||
|
|
||
| int nUris = simulation->parameters.URIS_mesh_parameters.size(); | ||
| com_mod.nUris = nUris; |
| #endif | ||
|
|
||
| const int eNoN = lM.eNoN; | ||
| const int nUris = com_mod.nUris; | ||
| ris_factor_total_el.resize(fs.nG); | ||
| ris_factor_total_el = 0.0; | ||
|
|
||
| for (int g = 0; g < fs.nG; g++) { | ||
| Vector<double> dist_srf(nUris); | ||
| dist_srf = 0.0; | ||
| for (int a = 0; a < eNoN; a++) { | ||
| int Ac = lM.IEN(a,e); | ||
| for (int iUris = 0; iUris < nUris; iUris++) { | ||
| dist_srf(iUris) += fs.N(a,g) * std::fabs(com_mod.uris[iUris].sdf(Ac)); |
There was a problem hiding this comment.
Changed to fs.eNoN in the updated code.
|
|
||
| for (int g = 0; g < fs.nG; g++) { | ||
| Vector<double> dist_srf(nUris); |
| set_parameter("Mesh_scale_factor", 1.0, !required, mesh_scale_factor); | ||
| set_parameter("Thickness", 0.04, !required, thickness); | ||
| set_parameter("Closed_thickness", 0.25, !required, close_thickness); | ||
| set_parameter("Thickness", 0.2, !required, thickness); | ||
| set_parameter("Closed_thickness", 0.2, !required, close_thickness); | ||
| set_parameter("Resistance", 1.0e5, !required, resistance); |
There was a problem hiding this comment.
Mentioned this in the pull request release notes
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #552 +/- ##
==========================================
- Coverage 68.80% 68.80% -0.01%
==========================================
Files 181 181
Lines 34157 34162 +5
Branches 5903 5904 +1
==========================================
+ Hits 23503 23506 +3
- Misses 10517 10519 +2
Partials 137 137 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Resolves #547
Release Notes
uris.cppClosed_resistanceinput parameter for URIS valves so that the valve uses the same resistance whether open or closed. Changed default valve half thickness from 0.04 to 0.2.Testing
Code of Conduct & Contributing Guidelines