steady flow with GenBC

Provides a system for patient-specific cardiovascular modeling and simulation.
POST REPLY
User avatar
Kimberly Stevens
Posts: 15
Joined: Mon Dec 03, 2018 12:06 pm

steady flow with GenBC

Post by Kimberly Stevens » Mon Mar 18, 2019 6:21 am

Hello,

I was wondering if there is a way to implement GenBC when you have steady flow. Since you only specify the time derivative of pressure or flow, and they would both be zero if the flow is steady, I wasn't sure how to prescribe my LPN circuit. As a simplified example, how would you suggest implementing the circuit sketched in the attached, where I prescribe Qin? I'm interested in how the flow would split between the two branches when I change the downstream conditions in the LPN. I realize that this example is so simple that assuming the resistance of the 3D model is constant with flowrate, I could solve for the resistance in the 3D model and then solve the flow split by hand, but I was wondering if there would be a way to set this example up in GenBC for more complicated downstream conditions.

Thank you.
Attachments
IMG_1369.jpg
IMG_1369.jpg (184.27 KiB) Viewed 596 times

User avatar
Weiguang Yang
Posts: 108
Joined: Mon Apr 07, 2008 2:17 pm

Re: steady flow with GenBC

Post by Weiguang Yang » Mon Mar 18, 2019 9:45 am

I assume the circuit you drew in the upstream of the 3D model is a resistor and the pressure distal to the resistor is P_d. At the bifurcation, you have Q_in=Q_1+Q_2, where Q_1 and Q_2 are the flow to the upstream resistor and the 3D model respectively. The pressure at the bifurcation is equal to the inlet pressure of the 3D model, denoted by P_2. If you prescribe a Dirichlet boundary condition in GenBC for the inlet (i.e. the LPN provides Q fro the 3D model and the interface pressure is read from the 3D domain.), P_2 is known and Q_1=(P_2-P_d)/R. So Q_2=Q_in - (P_2-P_d)/R.
That is the equation in your GenBC.

User avatar
Kimberly Stevens
Posts: 15
Joined: Mon Dec 03, 2018 12:06 pm

Re: steady flow with GenBC

Post by Kimberly Stevens » Mon Mar 18, 2019 10:19 am

Thanks for the reply. I agree that those equations would describe the LPN. Perhaps I'm misunderstanding something about how the GenBC equations are implemented, but I thought you could only prescribe equations the time derivative of Q and P? i.e. f_i=dx_i/dt? My confusion came because dx_i/dt = 0 since it's steady flow. Or could you also specify x?

User avatar
Weiguang Yang
Posts: 108
Joined: Mon Apr 07, 2008 2:17 pm

Re: steady flow with GenBC

Post by Weiguang Yang » Mon Mar 18, 2019 2:57 pm

Yes, you can specify flow rates directly without integration. In user.f, the intent for x is INTENT(INOUT). You can directly update x and pass the value out and set the derivative f=0.

User avatar
Kimberly Stevens
Posts: 15
Joined: Mon Dec 03, 2018 12:06 pm

Re: steady flow with GenBC

Post by Kimberly Stevens » Wed May 08, 2019 12:01 pm

Thank you for the response. I tried specifying x(1) directly with a Dirichlet BC at the inlet, similar to the tutorial case. I set x(1)=-(Qtot - P(1)/R1), where Qtot is a constant, P(1) is the pressure at the inlet, as obtained from the 3D solver, and R1 is a constant. That formulation seemed unstable so I set x(1) = -10D0 to troubleshoot, and this worked fine. It looked like P(1) was always unstable at the beginning of the simulation, which I assumed was causing the problem. So I set up a conditional statement to set x(1) as a constant until P(1) stabilized, and then set x(1) = Qtot - P(1)/R1. But as soon as it switches P(1) gets unstable, which makes me think there's a problem with my formulation, and not just that the instabilities are coming from the initialization of the 3D solver. But I can't figure out why setting x(1) = Qtot - P(1)/R1 would make P(1) unstable. I think I must not understand exactly how GenBC interacts with the 3D solver. My USER.f file is attached, as is a screen shot of AllData at the point where the solution switches over. Any help would be greatly appreciated.
Attachments
USER.txt
(4.95 KiB) Downloaded 37 times
Capture.PNG
Capture.PNG (80.68 KiB) Viewed 493 times

User avatar
Kimberly Stevens
Posts: 15
Joined: Mon Dec 03, 2018 12:06 pm

Re: steady flow with GenBC

Post by Kimberly Stevens » Wed May 08, 2019 12:36 pm

I was trying to figure out more how the boundary condition/LPN solver and the fluid dynamics simulation (Navier-Stokes solver) interact, so I had the LPN solver print out P(1) for each of the internal iterations, and I realized that P(1) changes (see attached). I was confused because I thought P(1) was the pressure on the Dirichlet face, which it obtains from the fluid dynamics simulation, so I didn't think it would change on the internal LPN iterations. Is there something I'm misunderstanding about what P(1) is?
Attachments
Capture2.PNG
Capture2.PNG (37.75 KiB) Viewed 487 times

User avatar
Weiguang Yang
Posts: 108
Joined: Mon Apr 07, 2008 2:17 pm

Re: steady flow with GenBC

Post by Weiguang Yang » Wed May 15, 2019 4:37 pm

This boundary condition might not be well imposed. Under this setting, the inflow condition can fluctuate a lot if the pressure is not stable. Under converged conditions, dpdt should be very small and having a 0D-3D coupling like this might be OK. But this is not better than prescribing the inflow condition directly because the 0D-3D coupling is less stable. 0D-3D coupling usually works for an ODE governed LPM. I think it is because there are other components such that the inflow values are less sensitive to the inlet pressure fluctuations.
Maybe it is not a good idea to prescribe inflow in this way. I notice the pressure is close to 0 mmHg (if it is in cgs). You can try to increase the outlet resistance and R1 in order to increase the pressure or reduce time steps mesh size/increase number of iterations. In addition, you can try to provide pressure for the inlet instead of flow. Just some thoughts. I am not sure if they work.

POST REPLY