Skip to content

Add 3D-1D coupling interface APIs#131

Open
taeoukkim wants to merge 3 commits into
SimVascular:masterfrom
taeoukkim:issue-129-3d-1d-coupling
Open

Add 3D-1D coupling interface APIs#131
taeoukkim wants to merge 3 commits into
SimVascular:masterfrom
taeoukkim:issue-129-3d-1d-coupling

Conversation

@taeoukkim

Copy link
Copy Markdown

Current situation

resolves #129

Release Notes

Update 1D solver for 3D-1D coupling.
Functions are stored in "interface.cpp" file.
Main functions are: initialize_1d, set_external_step_size_1d, return_1d_solution, update_1d_solution, run_1d_simulation_step_1d, and extract_coupled_dof.
Now, when you compile the code, it will create a shared library for coupling at ".../svOneDSolver/build/lib/libsvoned_interface.dylib"
The API functions can be accessed through this shared library.

Documentation

I will update document.

Testing

3D-1D testing done

Code of Conduct & Contributing Guidelines

@taeoukkim
taeoukkim requested a review from Copilot July 14, 2026 21:56
@taeoukkim
taeoukkim requested review from ktbolt and mrp089 and removed request for Copilot July 14, 2026 22:00
@ktbolt

ktbolt commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@taeoukkim This PR does not build on MacOS.

svOneDSolver/Code/Source/cvOneDOptions.h:128:10: error: no template named 'optional' in namespace 'std'
    std::optional<int> vtkOutputType = std::nullopt; 
    ~~~~~^

This is a CMake issue I think; I'll have a look.

@ktbolt

ktbolt commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@taeoukkim The compiler used to build svOneDSolver/Code/Source/interface/interface.cpp was set to c++17.

I added

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

after the PROJECT CMake command and now everything compiles ok.

@ktbolt ktbolt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@taeoukkim You've done a great job here adding an interface to an old and confusing code !

A couple of important things to clean up

  1. Only use print statements for debugging; they should not be active for release

  2. Use a consistent error handing; really everything should use cvException I'm guessing; writing to cerr is not very useful should throw I think

svOneDSolver writes out lots of .dat files and prints a simulation history to stdout I think. How is this managed for the 3D interface ?

Comment thread Code/Source/interface/CMakeLists.txt Outdated
Comment thread Code/Source/interface/interface.cpp
Comment thread Code/Source/interface/interface.cpp
Comment thread Code/Source/interface/interface.cpp Outdated
Comment thread Code/Source/interface/interface.cpp
Comment thread Code/Source/interface/interface.cpp
Comment thread Code/Source/interface/interface.cpp Outdated
Comment thread Code/Source/interface/interface.cpp Outdated
Comment thread Code/Source/interface/interface.cpp
Comment thread Code/Source/interface/interface.cpp
@taeoukkim

Copy link
Copy Markdown
Author

@taeoukkim The compiler used to build svOneDSolver/Code/Source/interface/interface.cpp was set to c++17.

I added

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

after the PROJECT CMake command and now everything compiles ok.

Thank you for identifying the issue and suggesting the fix!! I added the C++20 settings to the top-level CMakeLists.txt and confirmed that the interface library builds successfully on my Mac.

@taeoukkim

Copy link
Copy Markdown
Author

@ktbolt Thank you very much for the thorough review and helpful suggestions. I have addressed all of the comments. I also clarified that accepted coupled solutions are written to VTK and text files at the requested output interval. Both the standalone OneDSolver and svoned_interface build successfully on macOS, and I confirmed that the standalone solver still runs correctly.

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.

3D-1D coupling

2 participants