CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2

Custom source term in incompressible fluid flow simulation

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2021, 17:31
Default Custom source term in incompressible fluid flow simulation
  #1
New Member
 
Jaroslaw
Join Date: May 2021
Posts: 6
Rep Power: 5
jw-89 is on a distinguished road
Dear SU2 Users,

I am a very beginner at using SU2 and need more detailed instructions on how to implement a user-defined source term in an incompressible fluid flow simulation. More precisely, I am not completely sure how to set the gradient of my own source term, which is a function of the flow velocity, fluid density, and some cell-defined external quantities that I provide to the solver via a text file. I implemented a specialized CNumerics class, and overwritten the definition of the method 'ComputeResidual'. Here I compute my special momentum- (in N) and energy-source term (in W) and an approximation of the Jacobian (diagonal values) with respect to the conservative variables.

So far so good, I am using INC_RANS solver with active INC_ENERGY_EQUATION, SST turbulence model, and INC_IDEAL_GAS fluid model. For small geometries, the defined solver converges (in temperature residual) and returns a reasonable solution. However, I have the impression that the gradient information of the new source term has only a little effect (if any at all). I would expect that by providing the correct gradient (or at least a good approximation) of the main ingredient that drives the simulation we reduce the required number of iterations. This is not the case in my example. No matter if I define the gradients or not, the solution process looks the same.

For larger geometries (with several thousands of nodes), it is not likely to converge at all. Furthermore, updating the global Jacobian with the diagonal entries of the true Jacobian of my source term does not help. This observation prompts me to ask the following questions:
What is the correct way of defining the Jacobian for a custom source term?
Is there a configuration parameter that controls whether the user-defined gradients are used in the solver?

I believe it is worth mentioning that a similar approach works in Fluent with the use of user-defined functions.

I appreciate your help.
jw-89 is offline   Reply With Quote

Old   June 7, 2021, 06:37
Default
  #2
Member
 
Ole Burghardt
Join Date: Mar 2016
Location: Kiel, Germany
Posts: 60
Rep Power: 10
Sprotte is on a distinguished road
Hi,

Quote:
Originally Posted by jw-89 View Post
Dear SU2 Users,

I would expect that by providing the correct gradient (or at least a good approximation) of the main ingredient that drives the simulation we reduce the required number of iterations.
It should, assuming you've checked that the routine you've overwritten is called (?)

You could check your residual implementation first by using an explicit time stepping and if everything's fine, you go back to the Jacobian issue.

Best, Ole
Sprotte is offline   Reply With Quote

Old   June 7, 2021, 08:11
Default
  #3
New Member
 
Jaroslaw
Join Date: May 2021
Posts: 6
Rep Power: 5
jw-89 is on a distinguished road
Many thanks for replying to my post.

Quote:
Originally Posted by Sprotte View Post
It should, assuming you've checked that the routine you've overwritten is called (?)
This is already verified and I am sure that the routine I implemented is called. The computed residual looks fine and it contributes to LinSysRes of CIncEulerSolver. I update also the Jacobian in an analogous way but it has a very minor effect on the simulation. Any idea what can be wrong?

Regards, Jaroslaw
jw-89 is offline   Reply With Quote

Old   June 7, 2021, 17:17
Default
  #4
pcg
Senior Member
 
Pedro Gomes
Join Date: Dec 2017
Posts: 466
Rep Power: 13
pcg is on a distinguished road
Join the developers meeting https://meet.jit.si/SU2_DevMeeting Wednesday at 15h UK and show us the code.
pcg is offline   Reply With Quote

Old   June 8, 2021, 07:37
Default
  #5
Member
 
Ole Burghardt
Join Date: Mar 2016
Location: Kiel, Germany
Posts: 60
Rep Power: 10
Sprotte is on a distinguished road
Sounds like some SetTime_Step thing though. See you tomorrow maybe!
Sprotte is offline   Reply With Quote

Old   June 8, 2021, 09:33
Default
  #6
New Member
 
Jaroslaw
Join Date: May 2021
Posts: 6
Rep Power: 5
jw-89 is on a distinguished road
Quote:
Originally Posted by pcg View Post
Join the developers meeting https://meet.jit.si/SU2_DevMeeting Wednesday at 15h UK and show us the code.
Thank you guys, I will gladly join the meeting.
jw-89 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Intuition for why flow follows convex surfaces lopp Main CFD Forum 47 February 1, 2022 13:14
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 03:04
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 18:45.