%%%%%%%%%%%  DESCRIPTION OF DOCUMENTS/FILES  %%%%%%%%%%%

+ Nektar_Simulations: this folder contains four folders: 01_Aorta, 02_TCPC, 03_Aorta-TCPC, and 04_Aorta-TCPC_closedloop.

  -- 01_Aorta

    - ConvertHistoryFiles.m: this file converts the Nektar1D simulations results (.his files) into the file simulation_data.mat, which can be read by Matlab.

    - M004art_aorta.in and M004art_aorta_IN_1.bcs: these are the input and boundary condition files for Nektar1D simulations.

    - measurements.mat: this file contains the pressure, flow, and volume measurements.

    - main_M004art_aorta_RESULTS.m: this file plots the simulation results, calculates some errors, and pastes results in the results.xlmx Excel file.

  -- 02_TCPC

    - ConvertHistoryFiles.m: this file converts the Nektar1D simulations results (.his files) into the file simulation_data.mat, which can be read by Matlab.

    - M005art_Fcross.in, M005art_Fcross_IN_1.bcs, and M005art_Fcross_OUT_5.bcs: these are the input and boundary condition files for Nektar1D simulations.

    - measurements.mat: this file contains the pressure, flow, and volume measurements.

    - main_M005art_Fcross_RESULTS.m: this file plots the simulation results, calculates some errors, and pastes results in the results.xlmx Excel file.

  -- 03_Aorta-TCPC

    - ConvertHistoryFiles.m: this file converts the Nektar1D simulations results (.his files) into the file simulation_data.mat, which can be read by Matlab.

    - M009art_coupled.in, M009art_coupled_IN_1.bcs, and M009art_coupled.fo: these are the input and boundary condition files for Nektar1D simulations, and a file that contains additional simulation results (cardiac haemodynamic measures).

    - measurements.mat: this file contains the pressure, flow, and volume measurements.

    - main_M009art_coupled_RESULTS.m: this file plots the simulation results, calculates some errors, and pastes results in the results.xlmx Excel file.

  -- 04_Aorta-TCPC_closedloop

    - ConvertHistoryFiles.m: this file converts the Nektar1D simulations results (.his files) into the file simulation_data.mat, which can be read by Matlab.

    - M009art_closedloop_03.in and M009art_closedloop_03.fo: these are the input file for Nektar1D simulations and a file that contains additional simulation results.

    - measurements.mat: this file contains the pressure, flow, and volume measurements.

    - main_M009art_closedloop_RESULTS.m: this file plots the simulation results, calculates some errors, and pastes results in the results.xlmx Excel file.



+ data.xlsx: this file is used to develop the model, from Submodel 1 to the final closed-loop model. Blue cells are filled during the process of developing the closed-loop Fontan model.

+ results.xlsx: in this file the simulation results are stored (Submodel 1, Submodel 2, Submodel 3, Submodel 4, and Model).

+ measurements.mat: this file contains the pressure, flow, and volume measurements.

+ Estimate_Ks.m: this Matlab function estimates the parameter Ks of the ventricle pressure model using the Newton–Raphson method.

+ Estimate_Pout_and_tau.m: this Matlab function estimates the parameters Pout and tau of the exponential pressure decay during diastole, using the Newton-Raphson method.

+ Estimate_R2_and_C.m: this Matlab function estimates the parameters R1, R2 and C of a three-element Windkessel model using the Newton–Raphson method.

+ Create_inflow.m: this Matlab function is used to complete the bcs file.

+ Create_inflow_Nektar: this Matlab function is used to complete the bcs file.

+ FourierSeries.m: this Matlab function is used to convert a function from time domain to frecuency domain.

+ Shift_waveform.m: this Matlab function is used to shift a waveform in time.

+ Calculate_Cost_Matrix.m: this Matlab function is necessary in Estimate_R2_and_C.m.

+ Calculate_Cost_Vector_Ks.m: this Matlab function is necessary in Estimate_Ks.m.

+ Plot_Estimated_Windkessel.m: this Matlab function is used to plot the estimated vs measured inlet Pressure in a three-element Windkessel model.



+ main_01_Ventricle_E_tuning.m: using this file the parameters of the ventricle are estimated/tuned (Emin, Emax, V0, m1, m2, tau1, tau2, Ks).

+ main_02_0D_Sim_Heat_3WK.m: using this file Submodel 1 is defined; i.e., the parameters of the mitral valve (rho, l_eff, Kvo, Kvc, Aann), atrium (Emin, Emax, V0, m1, m2, tau1, tau2, Ks, tonset), and aortic valve (rho, l_eff, Kvo, Kvc, Aann) are estimated/tuned.

+ main_03_M004art_aorta.m: using this file Submodel 2 is defined.

+ main_04_Build_InputFile_M004art_aorta.m: this file generates the files needed to simulate Submodel 2 in Nektar1D.

+ main_05_M005art_Fcross.m: using this file Submodel 3 is defined.

+ main_06_Build_InputFile_M005art_Fcross.m: this file generates the files needed to simulate Submodel 3 in Nektar1D.

+ main_07_coupling_dAo_IVC.m: this file performs the coupling between the descending aorta and the inferior vena cava.

+ main_08_Coupling_supAo_SVC.m: this file performs the coupling between the head-and-neck arteries and the superior vena cava.

+ main_09_Build_InputFile_M009art_coupled.m: using this file the files needed to simulate Submodel 4 in Nektar1D are generated.

+ main_10_Build_InputFile_M009art_closedloop.m: this file generates the files needed to simulate the closed-loop model in Nektar1D.





%%%%%%%%%%%  STEPS TO BE FOLLOWED TO CREATE THE CLOSED-LOOP FONTAN MODEL FROM PRESSURE, FLOW AND VOLUME MEASUREMENTS  %%%%%%%%%%%

+ Execute main_01_Ventricle_E_tuning.m in Matlab

+ Execute main_02_0D_Sim_Heat_3WK.m in Matlab

+ Execute main_03_M004art_aorta.m in Matlab

+ Execute main_04_Build_InputFile_M004art_aorta.m in Matlab

  - In this file, the variables "Path_output" and "Path_VU" must be updated

+ Execute M004art_aorta in Nektar1D

+ Execute ConvertHistoryFiles.m and main_M004art_aorta_RESULTS.m in Matlab

  - In main_M004art_aorta_RESULTS.m, the variable DataDir must be updated

+ Execute main_05_M005art_Fcross.m in Matlab

+ Execute main_06_Build_InputFile_M005art_Fcross.m in Matlab

  - In this file, the variables "Path_output" and "Path_VU" must be updated

+ Execute M005art_Fcross in Nektar1D

+ Execute ConvertHistoryFiles.m and main_M005art_Fcross_RESULTS.m in Matlab

  - In main_M005art_Fcross_RESULTS.m, the variable DataDir must be updated

+ Execute main_07_coupling_dAo_IVC.m

+ Execute main_08_Coupling_supAo_SVC.m

+ Execute main_09_Build_InputFile_M009art_coupled.m in Matlab

  - In this file, the variables "Path_output" and "Path_VU" must be updated

+ Execute M009art_coupled in Nektar1D (VERSION 11 MUST BE USED)

+ Execute ConvertHistoryFiles.m and main_M009art_coupled_RESULTS.m in Matlab

  - In main_M009art_coupled_RESULTS.m, the variable DataDir must be updated

+ Execute main_10_Build_InputFile_M009art_closedloop.m in Matlab

  - In this file, the variables "Path_output" and "Path_VU" must be updated

+ Execute M009art_closedloop in Nektar1D

+ Execute ConvertHistoryFiles.m and main_M009art_closedloop_RESULTS.m in Matlab

  - In main_M009art_closedloop_RESULTS.m, the variables MatlabDir and DataDir must be updated