Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e9ffcb4
Fixed spatial dimension bug in bw_fluid_3d and index error in set_bc_…
hanzhao2020 Feb 11, 2025
bfb2e52
Merge branch 'weak_bc_dir' into ris
hanzhao2020 Feb 11, 2025
9841b37
Merge branch 'SimVascular:main' into ris
hanzhao2020 Feb 25, 2025
1da8805
Adding explicit RIS code.
hanzhao2020 Feb 25, 2025
52f83bc
Updating output and restrat functions for explicit RIS
hanzhao2020 Mar 3, 2025
60984d6
Adding an explicit RIS method test case
hanzhao2020 Mar 3, 2025
3257cf7
Adding implicit RIS functions for serial simulation.
hanzhao2020 Mar 13, 2025
582b719
Parallelization for implicit RIS code.
hanzhao2020 Mar 28, 2025
fa01321
Adding RIS0D functions.
hanzhao2020 Apr 2, 2025
4b7a9ba
Merge branch 'SimVascular:main' into uris
hanzhao2020 Apr 11, 2025
777a735
Fixed bugs for parallelization in implicit RIS code.
Apr 24, 2025
a355b3b
Fixed a bug in same_side function and cleaned up the code.
hanzhao2020 May 16, 2025
3cef697
Merge branch 'SimVascular:main' into uris
hanzhao2020 May 27, 2025
f6358a3
Improve the SDF function and add valve thickness and ressitance speci…
hanzhao2020 Jun 9, 2025
170d5cd
Merge branch 'uris' of https://github.com/hanzhao2020/svMultiPhysics …
hanzhao2020 Jun 9, 2025
a41ad5a
Merge files to URIS branch
hanzhao2020 Jun 9, 2025
39d67c5
Fixed increments in saving ris surfaces.
hanzhao2020 Jul 4, 2025
edd5c69
Adding option for using customized resistance value whenthe RIS valve…
hanzhao2020 Aug 12, 2025
4fcfd9d
Merge branch 'SimVascular:main' into uris
hanzhao2020 Aug 12, 2025
2c3f347
Adding test for unfitted RIS valve
hanzhao2020 Aug 12, 2025
3661bfc
Adding test file for the unfitted RIS method
hanzhao2020 Aug 12, 2025
93c3173
Resolving a double definition of bcast for int array
hanzhao2020 Aug 13, 2025
d848eed
Fixed a bug in unfitted RIS valve test case
hanzhao2020 Aug 13, 2025
45c2be2
Fixed a bug in MPI_Bcast for int array
hanzhao2020 Aug 19, 2025
76ea06a
Merge branch 'main' into uris
aabrown100-git Aug 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Code/Source/solver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ set(CSRCS
ustruct.h ustruct.cpp
vtk_xml.h vtk_xml.cpp
vtk_xml_parser.h vtk_xml_parser.cpp
ris.h ris.cpp
uris.h uris.cpp

CepMod.h CepMod.cpp
CepModAp.h CepModAp.cpp
Expand Down
12 changes: 6 additions & 6 deletions Code/Source/solver/CmMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ void cmType::bcast(const CmMod& cm_mod, Array<double>& data, const std::string&
MPI_Bcast(data.data(), data.size(), cm_mod::mpreal, cm_mod.master, com());
}

/// @brief bcast int array
void cmType::bcast(const CmMod& cm_mod, Array<int>& data, const std::string& name) const
{
MPI_Bcast(data.data(), data.size(), cm_mod::mpint, cm_mod.master, com());
}

/// @brief bcast double Vector
void cmType::bcast(const CmMod& cm_mod, Vector<double>& data, const std::string& name) const
{
Expand All @@ -155,12 +161,6 @@ void cmType::bcast(const CmMod& cm_mod, int* data) const

/// @brief bcast int Vector
void cmType::bcast(const CmMod& cm_mod, Vector<int>& data) const
{
MPI_Bcast(data.data(), data.size(), cm_mod::mpint, cm_mod.master, com());
}

/// @brief bcast int array
void cmType::bcast(const CmMod& cm_mod, Array<int>& data, const std::string& name) const
{
MPI_Bcast(data.data(), data.size(), cm_mod::mpint, cm_mod.master, com());
}
1 change: 1 addition & 0 deletions Code/Source/solver/ComMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ComMod::ComMod()
pstEq = false;
sstEq = false;
ibFlag = false;
risFlag = false;

}

Expand Down
180 changes: 178 additions & 2 deletions Code/Source/solver/ComMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ class bcType
// Robin: apply only in normal direction
bool rbnN = false;

// Strong/Weak application of Dirichlet BC
int clsFlgRis = 0;

// Pre/Res/Flat/Para... boundary types
//
// This stores differnt BCs as bitwise values.
Expand Down Expand Up @@ -194,6 +197,9 @@ class bcType
// Robin: damping
double c = 0.0;

// RIS0D: resistance
double resistance = 0.0;

// Penalty parameters for weakly applied Dir BC
Vector<double> tauB{0.0, 0.0};
//double tauB[2];
Expand Down Expand Up @@ -961,6 +967,15 @@ class mshType
/// @brief IB: Mesh size parameter
double dx = 0.0;

/// @brief RIS resistance value
double res = 0.0;

/// @brief RIS projection tolerance
double tol = 0.0;

/// @brief The volume of this mesh
double v = 0.0;

/// @breif ordering: node ordering for boundaries
std::vector<std::vector<int>> ordering;

Expand Down Expand Up @@ -1061,6 +1076,13 @@ class mshType
/// @brief IB: tracers
traceType trc;

/// @brief RIS: flags of whether elemets are adjacent to RIS projections
// std::vector<bool> eRIS;
Vector<int> eRIS;

/// @brief RIS: processor ids to change element partitions to
Vector<int> partRIS;

/// @brief TET4 quadrature modifier
double qmTET4 = (5.0+3.0*sqrt(5.0))/20.0;

Expand Down Expand Up @@ -1115,6 +1137,9 @@ class eqType
/// @brief IB: Number of possible outputs
int nOutIB = 0;

/// @brief URIS: Number of possible outputs
int nOutURIS = 0;

/// @brief Number of domains
int nDmn = 0;

Expand Down Expand Up @@ -1203,6 +1228,9 @@ class eqType
/// @brief IB: Outputs
std::vector<outputType> outIB;

/// @brief URIS: Outputs
std::vector<outputType> outURIS;

/// @brief Body force associated with this equation
std::vector<bfType> bf;
};
Expand Down Expand Up @@ -1400,6 +1428,113 @@ class ibType
ibCommType cm;
};

/// @brief Data type for Resistive Immersed Surface
//
class risFaceType
{
public:

/// @brief Number of RIS surface
int nbrRIS = 0;

/// @brief Count time steps where no check is needed
Vector<int> nbrIter;

/// @brief List of meshes, and faces connected. The first face is the
// proximal pressure's face, while the second is the distal one
Array3<int> lst;

/// @brief Resistance value
Vector<double> Res;

/// @brief Flag closed surface active, the valve is considerd open initially
std::vector<bool> clsFlg;

/// @brief Mean distal and proximal pressure (1: distal, 2: proximal)
Array<double> meanP;

/// @brief Mean flux on the RIS surface
Vector<double> meanFl;

/// @brief Status RIS interface
std::vector<bool> status;
};

/// @brief Unfitted Resistive Immersed surface data type
//
class urisType
{
public:

// Name of the URIS instance.
std::string name;

// Whether any file has been saved.
bool savedOnce = false;

// Total number of IB nodes.
int tnNo = 0;

// Number of IB meshes.
int nFa = 0;

// Position coordinates (2D array: rows x columns).
Array<double> x;

// Displacement (new) (2D array).
Array<double> Yd;

// Default signed distance value away from the valve.
double sdf_default = 10.0;

// Default distance value of the valve boundary (valve thickness).
double sdf_deps = 0.04;

// Default distance value of the valve boundary when the valve is closed.
double sdf_deps_close = 0.25;

// Displacements of the valve when it opens (3D array).
Array3<double> DxOpen;

// Displacements of the valve when it closes (3D array).
Array3<double> DxClose;

// Normal vector pointing in the positive flow direction (1D array).
Vector<double> nrm;

// Close flag.
bool clsFlg = true;

// Iteration count.
int cnt = 1000000;

// URIS: signed distance function of each node to the uris (1D array).
Vector<double> sdf;

// Mesh scale factor.
double scF = 1.0;

// Mean pressure upstream.
double meanPU = 0.0;

// Mean pressure downstream.
double meanPD = 0.0;

// Relaxation factor to compute weighted averages of pressure values.
double relax_factor = 0.5;

// Array to store the fluid mesh elements that the uris node is in (2D array).
Array<int> elemId;

// Array to count how many times a uris node is found in the fluid mesh of a processor (1D array).
Vector<int> elemCounter;

// Derived type variables
// IB meshes
std::vector<mshType> msh;

};

/// @brief The ComMod class duplicates the data structures in the Fortran COMMOD module
/// defined in MOD.f.
///
Expand Down Expand Up @@ -1470,9 +1605,29 @@ class ComMod {
/// @brief Postprocess step - convert bin to vtk
bool bin2VTK = false;

/// @brief Whether any RIS surface is considered
bool risFlag = false;

/// @brief Whether any one-sided RIS surface with 0D coupling is considered
bool ris0DFlag = false;

/// @brief Whether any URIS surface is considered
bool urisFlag = false;

/// @brief Whether the URIS surface is active
bool urisActFlag = false;

/// @brief Number of URIS surfaces (uninitialized, to be set later)
int nUris;

/// @brief URIS resistance
double urisRes;

/// @brief URIS resistance when the valve is closed
double urisResClose;

/// @brief Whether to use precomputed state-variable solutions
bool usePrecomp = false;

//----- int members -----//

/// @brief Current domain
Expand Down Expand Up @@ -1532,7 +1687,7 @@ class ComMod {
/// @brief Total number of degrees of freedom per node
int tDof = 0;

/// @brief Total number of nodes (total number of nodes on current processor across
/// @brief Total number of nodes (number of nodes on current proc across
/// all meshes)
int tnNo = 0;

Expand All @@ -1542,6 +1697,9 @@ class ComMod {
/// @brief Number of stress values to be stored
int nsymd = 0;

/// @brief Nbr of iterations
int RisnbrIter = 0;


//----- double members -----//

Expand Down Expand Up @@ -1601,6 +1759,18 @@ class ComMod {
/// @brief IB: iblank used for immersed boundaries (1 => solid, 0 => fluid)
Vector<int> iblank;

/// @brief TODO: for now, better to organize these within a class
struct Array2D {
// std::vector<std::vector<int>> map;
Array<int> map;
};

/// @brief RIS mapping array, with local (mesh) enumeration
std::vector<Array2D> risMapList;

/// @brief RIS mapping array, with global (total) enumeration
std::vector<Array2D> grisMapList;

/// @brief Old time derivative of variables (acceleration); known result at current time step
Array<double> Ao;

Expand Down Expand Up @@ -1692,6 +1862,12 @@ class ComMod {
/// @brief IB: Immersed boundary data structure
ibType ib;

/// @brief risFace object
risFaceType ris;

/// @brief unfitted RIS object
std::vector<urisType> uris;

bool debug_active = false;

Timer timer;
Expand Down
Loading
Loading