

August 20, 2018 at 5:21 pmtejasvikrishna45Subscriber
I am trying to model a second grade fluid for which I wrote an UDF. The problem is the momentum source has a term that goes like d3u/d2ydt.
Can any one tell me if a time derivative can be included in the source term? Once I take that time derivative related term, the rest of the source term works and converges pretty easily.
Thanks,
TJ

August 20, 2018 at 7:00 pmKonstantine KourbatskiAnsys Employee
please refer to Sec. 3.2.3.8. Previous Time Step Macros in Fluent Customization Manual. Knowing current value and the value at the previous time step, you can construct a 1st order time derivative. For 2nd order, macros are also available at the t  2* dt. If this is not enough, you can save required data from previous steps in a userdefined memory, and then use it to reconstruct time derivatives.

August 20, 2018 at 7:07 pmtejasvikrishna45Subscriber
Thanks for the reply kkourbat. I have tried all the things that you have talked about. My problem is that the solution diverges with those time derivatives.
Thanks a lot.

August 20, 2018 at 7:34 pmDrAmineAnsys Employee
For which equations are you writing source terms? Have you linearized the source terms?

August 20, 2018 at 8:57 pmtejasvikrishna45Subscriber
Hi abenhadj,
The source term I wrote was for divergence of additional stress.
I am trying to solve this model in channel flow with time varying pressure boundary conditions.
additional stress tensor phi is defined such that phi_11 = a*(u')^2 , phi_12 = a*d(u')/dt, phi_21 = a*d(u')/dt,, phi_22 = a*(u')^2.
where a is a constant and u' = du/dy
I took divergence of the above defined stress tensor.
I am not sure how to linearize this divergence of the above stress tensor
Thanks,
TJ

August 21, 2018 at 5:55 amDrAmineAnsys Employee
If the linearization is not possible based on the dependent variable of the underlying equation you need to make that as a sort of false time stepping (like density divided by fluxes through the cells..).
Without linearization you need then to use smaller time scales and perhaps underrelax the solution process.
But the most important question: why do you need that?

August 21, 2018 at 6:46 pmtejasvikrishna45Subscriber
Hi abenadj,
Thanks for the prompt reply. We are trying to model a class of fluids called 2nd grade/order fluids, equations of which are shown in the attachment below.
Since what I have is the time derivative of velocity gradient(with divergence it technically becomes time derivative of second velocity gradient) I really cant think of any clever way to linearize like the density example. I will try further reducing my time scales and underrelaxation factors to see if that helps.
Thanks,
TJ

August 21, 2018 at 7:12 pmDrAmineAnsys Employee
Hm a sort of viscoelastic fluid. You can additionally check POLYFLOW which is superior when it comes to specific rehelogy (including POLYMAT). A solution in Fluent is possible but would require some babysitting

August 21, 2018 at 7:19 pmtejasvikrishna45Subscriber
I do have access to polyflow here at Texas A&M University. However I really want to see if this code I wrote can be made to work.
I know for a fact that all my other terms are consistent and working, it is only the term that contains the time derivative that causes issues.
I think it will be really helpful to talk to some technical expert like you. Can you tell me the procedure to be able to do that?

August 22, 2018 at 5:33 pmDrAmineAnsys Employee
Polyflow is the right tool for that with its capability to model differential viscosity models.
Please check with your ASC who can then forward your queries to local support if possible.
Good luck.

August 28, 2018 at 2:19 pmKonstantine KourbatskiAnsys Employee
Hello,
This is always a significant challenge to deal with strong explicit nonlinear sources added through a UDF. As abenhadj pointed out, linearization of this complex source implementation is not possible in the framework of the Fluent's UDFs.
My suggestions are as following:
1) save source components into user defined memories in DEFINE_ADJUST by looping over all the cells in the fluid thread. This will make the source components available for postprocessing. Don't apply sources to the equations yet
2) use if(first_iteration) in DEFINE_ADJUST to retain information only at the 1st iteration of the subiterative loop
3) postprocess the source UDMs to confirm they are what you are expecting. Using a simple canonical problem where sources can be analytically calculated would help with comparison
4) apply sources, but with a small value multiplier to artificially reduce their magnitude. This will help you establish stability limits on the source magnitude
5) apply source relaxations, i. e.
source = alpha * source_current_iteration + (1  alpha) * source_prev_iteration
where 0 <= alpha < = 1
Slow ramp up of source magnitude (4) and applying source relaxation (5) can potentially help to stabilize the solution.
6) apply this together with underrelaxing equations to which the sources are applied to.
Other than that, there is little else I can think of, other than some implicit source implementation, which unfortunately cannot be done in the framework provided by Fluent.

 You must be logged in to reply to this topic.
Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
 Suppress Fluent to open with GUI while performing in journal file
 Floating point exception in Fluent
 What are the differences between CFX and Fluent?
 Heat transfer coefficient
 Getting graph and tabular data from result in workbench mechanical
 The solver failed with a nonzero exit code of : 2
 Difference between Kepsilon and Komega Turbulence Model
 Time Step Size and Courant Number
 Mesh Interfaces in ANSYS FLUENT
 error in cfd post

2600

2088

1319

1108

459
© 2023 Copyright ANSYS, Inc. All rights reserved.