svMultiPhysics
Loading...
Searching...
No Matches
Public Member Functions | List of all members
OneDSolverInterface Class Reference

Wrapper class for dynamically loading and calling the 1D solver shared library. More...

#include <OneDSolverInterface.h>

Public Member Functions

void load_library (const std::string &interface_lib)
 Load the 1D solver shared library from the given path.
 
void initialize (const std::string &input_file, int &problem_id, int &system_size, const std::string &coupling_type)
 Initialize the 1D solver from an input file.
 
void set_external_step_size (int problem_id, double dt)
 Synchronize the 1D solver's internal time step with the 3D solver.
 
void return_solution (int problem_id, double *solution, int size)
 Copy the current 1D solution into the caller-provided buffer.
 
void update_solution (int problem_id, double *solution, int size)
 Push a solution vector into the 1D solver as the current state.
 
void run_simulation (int problem_id, double current_time, int save_incr, const std::string &coupling_type, double *params, double *solution, double &cpl_value, char last_flag, int &error_code)
 Advance the 1D solver by one time step.
 
void extract_coupled_dof (int problem_id, int &coupled_dof, const std::string &coupling_type)
 Retrieve the index within the solution vector that corresponds to the coupled boundary DOF.
 

Detailed Description

Wrapper class for dynamically loading and calling the 1D solver shared library.

This class loads the svOneDSolver shared library and provides a C++ wrapper around its exported C interface.

The interface is used to couple 3D Navier-Stokes simulations in svMultiPhysics with reduced-order 1D blood flow models in svOneDSolver.

Supported coupling modes:

Each initialized 1D model is identified by a problem_id assigned by svOneDSolver and used in subsequent library calls.

Shared library functions:

Member Function Documentation

◆ extract_coupled_dof()

void OneDSolverInterface::extract_coupled_dof ( int  problem_id,
int &  coupled_dof,
const std::string &  coupling_type 
)

Retrieve the index within the solution vector that corresponds to the coupled boundary DOF.

◆ initialize()

void OneDSolverInterface::initialize ( const std::string &  input_file,
int &  problem_id,
int &  system_size,
const std::string &  coupling_type 
)

Initialize the 1D solver from an input file.

Parameters
[in]input_filePath to the 1D solver .in file.
[out]problem_idProblem identifier assigned by the solver.
[out]system_sizeTotal number of DOFs (nodes * 2: flow + area).
[in]coupling_type"NEU" or "DIR" coupling direction.

◆ load_library()

void OneDSolverInterface::load_library ( const std::string &  interface_lib)

Load the 1D solver shared library from the given path.

◆ return_solution()

void OneDSolverInterface::return_solution ( int  problem_id,
double *  solution,
int  size 
)

Copy the current 1D solution into the caller-provided buffer.

◆ run_simulation()

void OneDSolverInterface::run_simulation ( int  problem_id,
double  current_time,
int  save_incr,
const std::string &  coupling_type,
double *  params,
double *  solution,
double &  cpl_value,
char  last_flag,
int &  error_code 
)

Advance the 1D solver by one time step.

Parameters
[in]problem_idProblem identifier.
[in]save_incrVTK output interval (Increment_in_saving_VTK_files from solver.xml); the 1D library decides internally whether to write output.
[in]coupling_type"NEU" or "DIR".
[in]paramsArray [N, t1, t2, ..., val1, val2, ...] where N=2.
[in,out]solutionSolution vector updated after the step.
[out]cpl_valueThe BC value returned by the 1D solver (pressure for NEU, flow for DIR).
[in]last_flag'L' for the final (committed) iteration, 'D' for derivative / predictor steps.
[out]error_codeNon-zero on failure. 0 indicates success. Any non-zero value is interpreted by this wrapper as a 1D solver failure.

◆ set_external_step_size()

void OneDSolverInterface::set_external_step_size ( int  problem_id,
double  dt 
)

Synchronize the 1D solver's internal time step with the 3D solver.

◆ update_solution()

void OneDSolverInterface::update_solution ( int  problem_id,
double *  solution,
int  size 
)

Push a solution vector into the 1D solver as the current state.


The documentation for this class was generated from the following files: