

This directory contains a combination of C++ and MATLAB files that simulate pressure and flow in the 
pulmonary arteries of Mice, as presented in Qureshi et al. 2017 (Qureshi, M. Umar, et al. Hemodynamic
Assessment of Pulmonary Hypertension in Mice: A Model Based Analysis of the Disease Mechanism. 2017, pp. 
1-23, http://arxiv.org/abs/1712.01699). The C++ code requires a version of gcc and make in order to 
compile. All .m files require MATLAB 2016a or newer to run.

This code can be executed by running the "RunFile.m" file in MATLAB. Additionally, the code can be 
executed in a Mac OS terminal window my typing the executable "./sor06" along with the variables required
by the main file. Appropriate compilers are declared in the Makefile and should be modified based on what
is available on the user's machine. 


The code provided uses fixed 21 vessel network for both a control and hypertensive mouse. Additional 
vessels may be added by adjusting the structure of the Arteries file in the main file sor06.C. Output
solutions from the C++ code are located in the files labeled "pu1_X.2d", where each X corresponds to the 
vessel in the network. The "tube" declaration in arteries.C/.H holds the equations describing the model,
which includes the mass and momentum equations, as well as the constitutive law describing the relation
between pressure and cross-sectional area.

COMPILING: 
In order to compile the files, either type "make" into a terminal window, or type "! make" into the MATLAB
command window. Depending on the operating system, errors may occur in compilation. Changes should be made
accordingly to the "Makefile" to account for operating system specific file paths.


Data Files: 
p_vX.dat: "True" pressure waveform in vessel X.
q_vX.dat: "True" flow waveform in vessel X.
q_inflow.dat: Inflow data that drives the system of PDEs.


Files Included:

Makefile:     Compiles C++ files together
sor06:	      The executable file.
sor06.h:      Header file that initiates the basic, global parameter values.
sor06.C:      A main solver that calls the artery initialization and solves the system of PDEs.
arteries.h:   Header file which declares the class "Tube" and all of its objects and functions.
arteries.C:   Main computational code that computes all variables associated with every artery in the
	      system. Includes calls to tools.C, tools.h, and arteries.h.
tools.h:      Header file that initiates the solver tools.
tools.C:      Contains solvers for the nonlinear systems, including Newton-Raphson method.
main.m:	      MATLAB file that calls the C++ code via the "unix" command. Passes parameter values from
              MATLAB into sor06.C.
gnuplot.m:    MATLAB file that reads the output files and converts them to the appropriate format for plotting.


Output Files:
puX_ID.2d:    The pressure, flow, area, and wavespeed for vessel X and iteration ID. File is read in gnuplot.m.



License:
This project is licensed under the MIT License -  see the LICENSE.txt file for details.

