Problem estimating flow of next timestep in Windkessel UDF
Hi all,
I'm a Master student working on FSI modeling of abdominal aorta aneurysms including the aortic-iliac bifurcation. I'm facing a problem implementing an algorithm in my fluid part. I'm prescribing a 3-element Windkessel model as boundary condition to my outlets. The pressure (p) of the next time step (n+1) can be calculated from the flow (q) using the following function: p(n+1) = (R*C)/(R*C+dt)*p(n) + (dt(Z+R)+Z*R*C)/(R*C+dt)*q(n+1) - (Z*R*C)/(R*C+dt)*q(n) This is easy when you assume q(n+1) = q(n). I implemented this using a define_execute_at_end UDF. The hard part is to predict q(n+1) if you don't assume that it's equal to q(n). My supervisor proposed an iterative method to find a better estimate for the flow in the next time step: 1 - Use q(n) as first estimate of q(n+1) 2 - Calculate the first estimate of p(n+1) given the equation stated previously 3 - Solve the continuity and momentum equations as if it's the next timestep. This will yield a new flow, which will be a better prediction of q(n+1). 4 - Use the new flow to calculate a new estimate of p(n+1) Repeat these steps till convergence is reached (q(new) is almost equal to q(n)). I've not been able to find a way to solve the continuity and momentum equations without continuing to the next timestep. All suggestions are more than welcome!! |
Run with 0
Keep the number of time-steps as 0. Then Fluent does not proceed further in time.
|
Quote:
Thanks in advance. |
Number of Time Steps
Fluent requires user to enter number of time steps apart from the time-step itself. As long the number of time steps is 0, Fluent does not proceed further to next time. Since you wish to carry out a transient simulation, however, you also wants to make sure that an internal convergence is achieved. So, keep the number of time steps to 0 until convergence for q is reached and then switch it to 1 to move to next time. Repeat the process.
|
Quote:
|
Command
The command used to run a transient simulation is
solve dti <number of time steps> <number of iterations per time step> The following command will run 100 iterations but without going further in time solve dti 0 100 |
Okay, I'm going to try to implement this in my UDF. Thanks for your help!
|
Not UDF macros
The commands I shared are not UDF commands. These are text user interface commands.
|
Do you know if there are UDF commands that can solve a steady state problem? I think it would be cumbersome to use a journal for this problem
|
UDF cannot run the simulation
You cannot use C/C++ based UDF to start a simulation, however, you can use Scheme based UDF. But then you will have to learn how to program in Scheme. An alternative could be as follows
1. Use UDF to calculate p(n+1) as you might be doing right now 2. Create a new scheme variable. Look at customization manual of Fluent how to create an rpvar. 3. rpvar can be accessed from scheme, text user interface, as well as C/C++ UDF 4. Set the value of this rpvar to 1 or 0 depending upon whether equation for p(n+1) has converged or not. 5. Run the simulation using command solve dti rpvar 100 This will ensure that Fluent advances to next time only when rpvar is set to 1. Scheme is not very difficult either. With a little help you can implement your iterative procedure within Scheme and then control whole of the simulation from one function. |
Steady-State or Transient
If your case is steady-state, then there is no question of time step. You can just run the simulation and let the iterative process do its job every iteration. If it is transient, then the process I explained in previous post may be used.
|
Quote:
|
All times are GMT -4. The time now is 13:05. |