SimVascular / SimVascular/svOneDSolver

Initial flow rate value is never used

Open
#104 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
22
Forks
27
PR merge metrics
No merged PRs in 30d

Description

The SEGMENT section in the input file offers the ability to set an initial value for flow rate:

# ============
# SEGMENT CARD
# ============
# - Segment Name (string)
# - Segment ID (int)
# - Segment Length (double)
# - Total Finite Elements in Segment (int)
# - Segment Inlet Node (int)
# - Segment Outlet Node (int)
# - Segment Inlet Area (double)
# - Segment Outlet Area (double)
# - Segment Inflow Value (double)
# - Segment Material (string)
# - Type of Loss (string - 'NONE','STENOSIS','BRANCH_THROUGH_DIVIDING','BRANCH_SIDE_DIVIDING','BRANCH_THROUGH_CONVERGING',
#                          'BRANCH_SIDE_CONVERGING','BIFURCATION_BRANCH')
# - Branch Angle (double)
# - Upstream Segment ID (int)
# - Branch Segment ID (int)
# - Boundary Condition Type (string - 'NOBOUND','PRESSURE','AREA','FLOW','RESISTANCE','RESISTANCE_TIME','PRESSURE_WAVE',
#                                     'WAVE','RCR','CORONARY','IMPEDANCE','PULMONARY')
# - Data Table Name (string)

The specified value is only set at the inlet of each segment and 0 elsewhere (line 1347 of cvOneDBFSolver).

void cvOneDBFSolver::CalcInitProps(long ID){
  double segLen = subdomainList[ID] -> GetLength();
  double Qo, dQ0dT;
  Qo = subdomainList[ID] -> GetInitialFlow();
  dQ0dT=0;

  double So = subdomainList[ID] -> GetInitInletS();
  double Sn = subdomainList[ID] -> GetInitOutletS();
  for( long node = 0; node < subdomainList[ID]->GetNumberOfNodes(); node++){
  double zn = subdomainList[ID]->GetNodalCoordinate( node);
  long eqNumbers[2];
  mathModels[0]->GetNodalEquationNumbers(node, eqNumbers, ID);

  // Linear Interpolation
  double zi = (zn - segLen)/(0.0-segLen);
  double Si = (zi*(So - Sn)) + Sn;
  (*previousSolution)[eqNumbers[0]] = Si;

    if(node == 0){
      (*previousSolution)[eqNumbers[1]] = Qo;
    }else{
      (*previousSolution)[eqNumbers[1]] = 0.0;
    }
  }
}

I think it would make more sense to set it to the specified value for all points belonging to the same segment, since this is the best guess in case of very stiff walls.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cvOneDBFSolver::CalcInitProps, around line 1347, and trace how GetInitialFlow() is assigned to previousSolution for each node. Ensure the specified initial flow value is used for every point in the segment, then verify that the initialized values match the issue's expected behavior for stiff walls.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.