Skip to content

Issue 546 pressure initialization#564

Open
taeoukkim wants to merge 52 commits into
SimVascular:mainfrom
taeoukkim:issue-546-pressure-initialization
Open

Issue 546 pressure initialization#564
taeoukkim wants to merge 52 commits into
SimVascular:mainfrom
taeoukkim:issue-546-pressure-initialization

Conversation

@taeoukkim
Copy link
Copy Markdown

IMPORTANT: This PR is based on the Issue #512 branch and should be reviewed after that PR.

Current situation

resolves #546

Release Notes

In addition to the existing option of initializing the pressure field from a full 3D result file, the code now supports initializing the entire 3D pressure field using a single scalar value specified in solver.xml. This provides a lightweight and convenient alternative when a uniform initial pressure field is sufficient.

Also changed 3D-1D and 3D-0D coupling relaxation method at the first time step with initial pressure

Documentation

I will change document. We have observed that selecting an appropriate initial pressure value can reduce the initial pressure oscillations in both standalone 3D simulations and coupled 3D–1D / 3D–0D simulations.

Testing

Initial pressure test done.

Code of Conduct & Contributing Guidelines

taeoukkim added 30 commits June 3, 2026 16:33
…e DOFs from linear solve

For 1D Dirichlet coupling, `iBC_Dir` is cleared in read_files.cpp so that
set_bc_cpl routes the BC correctly. However this caused fsi_ls_ini to skip
registering the face with the FSILS linear solver as a Dirichlet (BC_TYPE_Dir)
constraint. As a result, the preconditioner did not zero out those rows/columns,
and the linear solver overwrote the velocity values applied by set_bc_dir with
the NS solution, producing a lower-than-expected centerline velocity (~47 vs ~63.66).

Fix: detect Coupled-DIR faces in fsi_ls_ini and register them as BC_TYPE_Dir so
their DOFs are properly excluded from Ax=b.
- CouplingInterfaceParameters: add Coupling_ramp_steps (int) and
  Coupling_ramp_ref_pressure (double) XML parameters
- CoupledBoundaryCondition: add oned_ramp_steps_ / oned_ramp_ref_pressure_
  private members with set_oned_ramp() / get_oned_ramp_steps() /
  get_oned_ramp_ref_pressure() accessors; propagate through all
  copy/move constructors and assignment operators
- read_files.cpp: read ramp params from CouplingInterfaceParameters and
  store them in lBc.coupled_bc via set_oned_ramp()
- svOneD_subroutines.cpp: OneDModelState gains ramp_steps,
  ramp_ref_pressure, step_count fields; init_svOneD reads them from
  coupled_bc; calc_svOneD applies linear pressure ramp for DIR coupling;
  step_count is incremented on every committed (BCFlag=='L') step
Implements exponential smoothing of the pressure boundary condition
sent to the 1D solver (DIR coupling only):

  P_sent = omega * P_target + (1 - omega) * P_prev_sent

where P_target has already been through the ramp filter.

- Parameters.h/cpp: add Coupling_dir_relax_factor parameter (default 1.0)
- CoupledBoundaryCondition.h/cpp: add oned_relax_factor_ field, getter,
  setter, copy/move and distribute() broadcast
- read_files.cpp: parse and apply the new parameter
- svOneD_subroutines.cpp: add relax_factor / P_prev_sent_old/new to
  OneDModelState; apply under-relaxation after ramp; update history
  only on BCFlag=='L' committed steps; NEU coupling untouched
taeoukkim and others added 21 commits June 3, 2026 17:25
…oD_interface, delete legacy sv0D code, keep all svOneD 3D-1D coupling implementation
… compute_valM/compute_jacobian_and_normal const
Co-authored-by: taeoukkim <74677557+taeoukkim@users.noreply.github.com>
…omain with it. fix: remove coupling_ on parameter names
…me step now uses proper P0. P0 is average pressure of the coupled surface from the inital condition
@aabrown100-git
Copy link
Copy Markdown
Collaborator

@taeoukkim Could you please request some reviewers to review this PR?

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 extends svMultiPhysics to support initializing the 3D pressure field from a single scalar specified in solver.xml (Issue #546) and adds/expands infrastructure for mixed 3D–0D and 3D–1D coupled boundary condition workflows (related to Issue #512), including startup ramping/relaxation behavior.

Changes:

  • Add Initial_pressure_scalar parsing/broadcast and apply it as a uniform initial pressure when no pressure restart field is provided.
  • Introduce a new svOneD (1D) coupling interface layer (dynamic library wrapper + solver stepping routines) and route per-face coupled BCs to either svZeroD or svOneD.
  • Adjust coupled BC and RCR handling to better support mixed coupling configurations (e.g., filtering RCR faces, DIR-coupled velocity application).

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/cases/fluid/pipe_svOneD_2faces/solver.xml Adds an example case for svOneD coupling on two outlet faces.
Code/Source/solver/txt.cpp Updates end-of-step coupling calls; adds svOneD handling and final flowrate refresh before committing 1D state.
Code/Source/solver/svZeroD_interface.h Updates svZeroD init API to accept SolutionStates.
Code/Source/solver/svZeroD_interface.cpp Filters svZeroD vs svOneD coupled faces; adds ramp/relax history handling and DIR flow broadcast.
Code/Source/solver/svOneD_subroutines.h Declares svOneD init/step entry points.
Code/Source/solver/svOneD_subroutines.cpp Implements parallel per-face 1D model initialization/stepping with MPI broadcasts.
Code/Source/solver/svOneD_interface/OneDSolverInterface.h Adds dlopen/dlsym-based wrapper for svOneDSolver interface library.
Code/Source/solver/svOneD_interface/OneDSolverInterface.cpp Implements dynamic symbol loading and wrapper calls into the 1D library.
Code/Source/solver/Simulation.cpp Reads scalar initial pressure from XML into ComMod.
Code/Source/solver/set_bc.cpp Updates coupled BC compute paths (pressure vs flow) and improves RCR integration safety for mixed cases.
Code/Source/solver/read_files.cpp Adds svOneD interface parsing and per-face routing for Coupled BCs; supports mixed svZeroD+svOneD.
Code/Source/solver/Parameters.h Adds svOneD interface parameter list and coupling-interface options; adds initial_pressure parameter.
Code/Source/solver/Parameters.cpp Wires new XML parameters: svOneD interface, per-face 1D input file, ramp/relax, and Initial_pressure_scalar.
Code/Source/solver/initialize.cpp Applies scalar initial pressure when no pressure field restart is provided.
Code/Source/solver/distribute.cpp Broadcasts new initial-pressure fields and svOneD interface settings; adjusts cplBC broadcast behavior.
Code/Source/solver/CoupledBoundaryCondition.h Extends CoupledBoundaryCondition with svOneD fields + ramp/relax state; adds cap-surface exception types.
Code/Source/solver/CoupledBoundaryCondition.cpp Distributes svOneD ramp/relax config; adds DIR flow broadcast; improves cap-surface copy checks.
Code/Source/solver/ComMod.h Adds initial-pressure fields and svOneD coupling interface state/storage.
Code/Source/solver/ComMod.cpp Implements svOneDSolverInterfaceType::set_data().
Code/Source/solver/CMakeLists.txt Adds svOneD sources to the solver build.
Code/Source/solver/baf_ini.cpp Initializes svZeroD/svOneD with seeded SolutionStates; marks RCR faces and handles coupled-DIR LS registration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 217 to 218
diff = diff*relTol;
}
Comment on lines +58 to +63
#include <fstream>
#include <iomanip>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
Comment on lines +954 to +955
std::string msg = "Initialize Yo(nsd,a) to initial_pressure value from solver.xml: " + std::to_string(com_mod.initial_pressure);
std::cout << msg << std::endl;
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.

Initialize the pressure field using a single scalar value

3 participants