Skip to content

Fixed URIS contribution for more than one valve in fluid equation#552

Open
hanzhao2020 wants to merge 5 commits into
SimVascular:mainfrom
hanzhao2020:fix-ris-factor
Open

Fixed URIS contribution for more than one valve in fluid equation#552
hanzhao2020 wants to merge 5 commits into
SimVascular:mainfrom
hanzhao2020:fix-ris-factor

Conversation

@hanzhao2020
Copy link
Copy Markdown
Contributor

@hanzhao2020 hanzhao2020 commented May 21, 2026

Resolves #547

Release Notes

  • Summed all contributions from URIS valves in overlap regions instead of using only the maximum contribution
  • Stored URIS valve contributions at different Gauss points in a vector for each element
  • Encapsulated the URIS contribution computation into a function in uris.cpp
  • Removed the Closed_resistance input 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

  • Updated URIS valve test case results due to the changes in URIS contribution. All tests passed

Code of Conduct & Contributing Guidelines

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 on urisType (removing global ComMod::urisRes* and the Closed_resistance input).
  • 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.

Comment on lines 557 to 563
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;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed!

Comment on lines +1294 to +1307
#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));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to fs.eNoN in the updated code.

Comment thread Code/Source/solver/uris.cpp Outdated
Comment on lines +1300 to +1302

for (int g = 0; g < fs.nG; g++) {
Vector<double> dist_srf(nUris);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines 2986 to 2989
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);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioned this in the pull request release notes

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 97.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.80%. Comparing base (ed4c544) to head (c5f1454).

Files with missing lines Patch % Lines
Code/Source/solver/fluid.cpp 96.66% 1 Missing ⚠️
Code/Source/solver/fsi.cpp 92.85% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent smoothed Dirac delta value for RIS method with more than one valve

2 participants