Drug release (add. var transport) for months, problem with time step selection

 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 12, 2016, 02:21 Drug release (add. var transport) for months, problem with time step selection #1 Member   Ftab Join Date: Sep 2011 Posts: 87 Rep Power: 14 Hi all, I am modeling drug release (additional variable in kg /m^3) from multiple micron-sized (80 um) humps into a cylinder of 4mm diametr, with no symmetry. The 3D mesh becomes gigantic (25 millions). I have fluid domain (max velocity 0.5 m/s) and porous domain (max vel= 0.0005 mm/s), both having humps and mass transport. Drug release BC is variable in time (days) and should be modeled for two month period. The flow is unsteady with period of 2 seconds. I now have these questions: - As drug release is having scales of days, can I model the high frequency flow as Steady state? If yes, is it correct to solve flow steadily, converge and then turn flow simulation off and only solve AV? - Courant No. is irrelevant for CFX. What should be the time step then for drug release (AV) which should be modeled for 60 days? Small time steps (seconds) will take for ever for this huge mesh to finish.

 September 12, 2016, 02:43 #2 Member   Ftab Join Date: Sep 2011 Posts: 87 Rep Power: 14 To update: Running it with Steady Flow, and then unsteady AV (still do not know if correct) - Convergence criteria is set to 1e-5 (tight?) - Time step: fixed to 1s >> Corant 999 > not converging in 20 iterations - Time step: fixed to 0.2s >> Corant 135> Converges in 7 iterations - Time step: fixed to 0.1s >> Corant 65> Converges in 4 iterations Freaks me out if I will need to run it with time step bellow 1 sec and simulate 60 days!!! Adaptive time stepping??? good idea?

September 12, 2016, 03:04
#3
Super Moderator

Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,749
Rep Power: 143
Quote:
 As drug release is having scales of days, can I model the high frequency flow as Steady state?
That all depends on whether assuming it is steady state is a good enough approximation of the true transient flow. You will have to assess that based on the flow and the accuracy you require.

Quote:
 Courant No. is irrelevant for CFX
That is going a bit too far. CFX can handle a wide range of flows and different flow regimes require different Courant numbers. But once you have determined the Courant number which works for your class of flow it is likely that it will be a good estimate of time step size for changes in mesh or flow velocity.

This simulation has a massive range in time scales (flow = milliseconds, drug accumulation = days) which means simply modelling it as a transient simulation is not a very effective approach. You should look at a separation of variables approach so you can model fluid and drug time scales as separate simulations. For instance use the fluid simulation to get the drug mass flow rate, then use a drug only model to model the accumulation of drug. Your comment about a steady flow then transient AV is an example of this approach - just be careful to check the steady result is equivalent to the transient case, at least for a short period of time.

Quote:
 Convergence criteria is set to 1e-5 (tight?)
Do a convergence sensitivity check and work it out for your case.

Quote:
 Freaks me out if I will need to run it with time step bellow 1 sec and simulate 60 days!!!
That is why people build supercomputers. Have you seen what simulations they do on supercomputers? I estimate about 50% of the supercomputers in the world are doing CFD simulations. If the simulation needs small time steps and a fine mesh then you have to use small time steps and a fine mesh. You need a bigger computer or more patience to wait until it is finished. (My longest CFD run is 90 days. So you are not as long as that one yet).

September 12, 2016, 23:00
#4
Member

Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 14
Quote:
 Originally Posted by ghorrocks That all depends on whether assuming it is steady state is a good enough approximation of the true transient flow. You will have to assess that based on the flow and the accuracy you require.
Although being long term (days) the drug is released and the source is decaying over time. That is why I need to model it transient. For the flow, it is a blood flowing with specific wave form over 1 second period and repeating it self. Comparing the time scale of flow and drug release, I suspect it is a safe assumption to use the steady state flow solution as the average of flow effect.

Quote:
 Originally Posted by ghorrocks That is going a bit too far. CFX can handle a wide range of flows and different flow regimes require different Courant numbers. But once you have determined the Courant number which works for your class of flow it is likely that it will be a good estimate of time step size for changes in mesh or flow velocity.
What I meant with irrelevant was the implicit solver being not very much sensitive to Courant number as the other (fluent like) explicit solver. I am still not clear when you say finding proper Courant and then time step. It is chicken and egg. If I know the Courant the time step is selected. Same goes if I decide the time step. What is the mechanism? Do I change the time step (and therefore Courant) in a way that I get the convergence in 3-5 iteration, as a rule of thumb? As I am not limited to Courant <1 what is the criteria of "good" time step then?

Quote:
 Originally Posted by ghorrocks This simulation has a massive range in time scales (flow = milliseconds, drug accumulation = days) which means simply modelling it as a transient simulation is not a very effective approach. You should look at a separation of variables approach so you can model fluid and drug time scales as separate simulations. For instance use the fluid simulation to get the drug mass flow rate, then use a drug only model to model the accumulation of drug. Your comment about a steady flow then transient AV is an example of this approach - just be careful to check the steady result is equivalent to the transient case, at least for a short period of time.
Absolutely agree, will do that. However, I do not know if the way I want to treat them separately with steady flow could be done with this periodic heart pulse-like flow where the flow is repeating itself every second (meaning converging flow in one cycle and then repeating the result periodically). That might work obviously good if the time step is fraction of seconds. I think I end up with time step above 1 second and then steady flow is more practical.

Quote:
 Originally Posted by ghorrocks Do a convergence sensitivity check and work it out for your case.
You mean using different convergence criteria and checking some physical phenomena or monitoring point, right? Should it be done after time step and courant is decided?

Quote:
 Originally Posted by ghorrocks That is why people build supercomputers. Have you seen what simulations they do on supercomputers? I estimate about 50% of the supercomputers in the world are doing CFD simulations. If the simulation needs small time steps and a fine mesh then you have to use small time steps and a fine mesh. You need a bigger computer or more patience to wait until it is finished. (My longest CFD run is 90 days. So you are not as long as that one yet).
I agree. Parallel processing is the solution. Unfortunately speed up is not that high with CFX as far as I know. I have had simulations up to 1oo cores for month or so, and I totally agree this is one of those cases.

September 12, 2016, 23:32
#5
Super Moderator

Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,749
Rep Power: 143
Quote:
 What I meant with irrelevant was the implicit solver being not very much sensitive to Courant number as the other (fluent like) explicit solver. I am still not clear when you say finding proper Courant and then time step. It is chicken and egg. If I know the Courant the time step is selected. Same goes if I decide the time step. What is the mechanism? Do I change the time step (and therefore Courant) in a way that I get the convergence in 3-5 iteration, as a rule of thumb? As I am not limited to Courant <1 what is the criteria of "good" time step then?
Explicit solvers have a hard limit on Courant number - if you exceed 1.0 then the simulation is guaranteed to diverge and crash. Implicit solvers do not have this hard limit. The actual Courant number which an implicit solver can run to is more determined by numerical accuracy issues. For CFX in many cases the best way is to use adaptive time stepping homing in on 3-5 coeff loops per iteration as that generates time steps which the solver can solve easily, and that also tends to mean a time step size small enough to have sufficient accuracy.

Quote:
 However, I do not know if the way I want to treat them separately with steady flow could be done with this periodic heart pulse-like flow where the flow is repeating itself every second
Yes, it certainly can. Have a look at Reynolds averaging in turbulence models - a very similar concept is used there to make the random fluctuations of turbulence to be modelled by a steady state turbulence model.

Quote:
 You mean using different convergence criteria and checking some physical phenomena or monitoring point, right?
Yes, that is right.

Quote:
 Should it be done after time step and courant is decided?
Strictly speaking once you have adjusted the time step you should re-check the convergence and mesh. This means sensitivity analysis on all parameters (mesh, time step, convergence tolerance) requires a few iterations before everything is converged.

My experience with CFX is that:
* Convergence tolerance is pretty independent of time step or mesh. Once you have found a good convergence tolerance you can change the mesh and time step and your convergence tolerance should still be good.
* Mesh size and time step are closely linked. So if you change the mesh you definitely need to change the time step.
* Initially it will be just a simple linear scaling between mesh size and time step size but as the finer mesh starts to resolve finer features it departs linearity.
* A big reason I recommend adaptive time stepping to 3-5 coeff loops per iteration is because it means you do not need to do a sensitivity analysis on time step size. Removing one variable to do the sensitivity study on dramatically simplifies it.

Quote:
 Unfortunately speed up is not that high with CFX as far as I know.
You have not been reading the CFX marketing material, have you CFX scales just fine way beyond 100 cores. But to get speedups to large numbers of cores you need a carefully designed cluster with high speed interconnects. Details are important as a small bottleneck 100x will result in a major bottleneck in a big parallel run. You cannot just string together lots of PCs with ethernet and expect to get good performance. This works fine to maybe 10 cores, but beyond that you need to design the system carefully.

 September 15, 2016, 15:51 #6 Member   Ftab Join Date: Sep 2011 Posts: 87 Rep Power: 14 Perfect as always Glenn! You are a blessing to this community. I think I have enough material to get busy for now. Thanks, Ftab

 Tags additional variable, cfx 15, time step size