CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

ANSYS fluent and OpenFoAM comparison

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By sbaffini
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2021, 20:36
Default ANSYS fluent and OpenFoAM comparison
  #1
Member
 
Anonymous.
Join Date: Sep 2020
Posts: 35
Rep Power: 5
gentodin is on a distinguished road
Hi I was comparing ANSYS fluent and OPEN FOAM as a solver recently and was wondering what are the hardcoded difference between them that cannot be changed.

I am running a simple case from CFDNINJA with the same settings in Openfoam.

I notice both use a different linear solver where Ansys is using AMG(algebraic Multigrid) while Openfoam is using Conjugate gradient solver. (I can change it to GAMG but I have yet to understand fully how AMG's algorithm work.)

I was also wondering why the following occurs where the console ouput for ANSYS fluent is different from Openfoam where the fluent iterates all equation at the same time until all equation satisfy the residual but openfoam iterates one equations by one equations (I.e. Velocity equation then temperature equation).

Console output of ANSYS fluent: Ansys fluent console output.png
Console output of Openfoam: Openfoam console output.png

-------------------------------------------------------------------------------------
Do linear solvers affect the output of a cfd simulation? i.e. oscillation occurs for OF but not ANSYS in my simulation when I use a turbulence model with exactly the same input.

Setup for ANSYS fluent:
Realizable K-e
Standard wall function
Transient, PISO algorithm
Energy equation: on
No gravity
Fluid Material: Ansys database, Water(h20) liquid
Linear Solver: AMG
(Other settings were left at default)

Setup for Openfoam:
Solver used: BuoyantBoussinesqPimpleFOAM
Realizable K-e
Standard Wall function
Pimple converted to PISO algorithm.
Temperature equation on.
No gravity
Fluid material same as ANSYS.
Linear solver: Conjugate gradient based.
(Othersettings were set to be the same as ANsys fluent as shown in the attachmend below)

Geometry 2D mixing elbow case from CFD NINJA : https://www.youtube.com/watch?v=Pjee...NJA%2FANSYSCFD

My input files for OpenFOAM are attached here:
https://entuedu-my.sharepoint.com/:f...Xvv7Q?e=S2U6vD

Ansys fluent settings:
https://entuedu-my.sharepoint.com/:f...mkTgw?e=dQWWPg

I am at lost as I have been working on getting similar results but my Openfoam simulation kept oscilliating.
Attached Files
File Type: txt fvSolution.txt (2.6 KB, 6 views)
File Type: txt fvSchemes.txt (1.6 KB, 6 views)
File Type: txt ControlDict.txt (1.3 KB, 1 views)
gentodin is offline   Reply With Quote

Old   February 22, 2021, 04:21
Default
  #2
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
While the two clearly have a common background as unstructured, cell centered, finite volume CFD codes, a CFD software is never just a cut and paste of this or that model/technique.

There are aspects related to the software engineering, the understanding of the method/model/technique by the developer, the effort put in making it work in a consistent, relevant manner.

Thus, even if they were using exactly the same models and numerical methods, there would probably still be differences. Yet they differ a lot both on the methods and the specific models. So, I wouldn't expect any similarity. What you can expect is that, being the two codes still very similar in most aspects, and assuming that they are well coded, that the numerical results for a given case, for an identical grid and case setup (if possible at all), will eventually converge to solutions very close to each other, if not identical for very special cases.

Few relevant aspects from your setup that could be different:

1) turbulence model and implementation: this is really code specific, we don't know how fluent is coded but I expect differences to be present. For example, which gradient enters the model source terms? There are several of them in a code like Fluent, and it is not that obvious, from a purely theoretical perspective, which one should be used.

2) wall functions implementations: OF has its own way to implement them that I'm pretty sure is not followed in Fluent. Also, understanding correctly how wall function iterations work is something I expect that has been investigated in Fluent, while the fixed point iterations used in OF at wide has a certain number of theoretical limitations.

3) Excluding AMG, I would have expected strong similarities between the linear algebraic solvers of the two codes (yet, not identical again). But for AMG, unless OF tried to exactly replicate what Fluent does (which isn't the case), there are little chances for the two to do the exact same thing.

4) Even the PISO receipt used in Fluent, it is unlikely to be the textbook one or any PIMPLE variant (whatever PIMPLE means).

And I haven't even mentioned all the remaining numerical aspects, like schemes for convective and diffusive fluxes, gradients (yet here the differences are likely to be minor only), parallallel implementation, etc.

If you are using OF, I suggest you to forget about Fluent and instead focus on making it work knowing how things should be done in OF. Then, if you expect that a different setup should work as well, you can investigate which modification is the one that causes problems.
arjun and aero_head like this.
sbaffini is offline   Reply With Quote

Old   February 22, 2021, 07:10
Default
  #3
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
To answer your specific questions:

1) Assuming you were using a very similar, if not identical, solver between the two codes, that is, a segregated one (which solves one equation after the other), what you see in Fluent is that someone was paid to actually work out a clever way to present the residuals that wouldn't flood the screen with information you already know and would certainly upset a paying customer. It is resources allocated where open source can't.

From the technical point of view, Fluent can simply compute the residuals one after the other, store them, and just present them all together. I mean, it simply works. OF, au contraire, being based on a library with a kind of rigid infrastructure, can't do certain things without compromiting the maintainability of its flexible structure, so it won't do that, because that's killing its own raison d'etre.

2) Ideally, linear solvers should affect the path to a certain solution, but not the solution itself. But, in theory, the path might be so affected (or the solver not well equipped for the path) that with some of them you may actually end up in dead ends (i.e., no convergence) or even a different solution (we are still dealing with nonlinear equations that, in several circumstances, happen to have multiple valid solutions). Honestly, however, I don't think this is relevant in your case, other choices tend to have larger impacts if not properly handled.
aero_head likes this.
sbaffini is offline   Reply With Quote

Old   February 22, 2021, 20:54
Default Thank you
  #4
Member
 
Anonymous.
Join Date: Sep 2020
Posts: 35
Rep Power: 5
gentodin is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
While the two clearly have a common background as unstructured, cell centered, finite volume CFD codes, a CFD software is never just a cut and paste of this or that model/technique.

There are aspects related to the software engineering, the understanding of the method/model/technique by the developer, the effort put in making it work in a consistent, relevant manner.

Thus, even if they were using exactly the same models and numerical methods, there would probably still be differences. Yet they differ a lot both on the methods and the specific models. So, I wouldn't expect any similarity. What you can expect is that, being the two codes still very similar in most aspects, and assuming that they are well coded, that the numerical results for a given case, for an identical grid and case setup (if possible at all), will eventually converge to solutions very close to each other, if not identical for very special cases.

Few relevant aspects from your setup that could be different:

1) turbulence model and implementation: this is really code specific, we don't know how fluent is coded but I expect differences to be present. For example, which gradient enters the model source terms? There are several of them in a code like Fluent, and it is not that obvious, from a purely theoretical perspective, which one should be used.

2) wall functions implementations: OF has its own way to implement them that I'm pretty sure is not followed in Fluent. Also, understanding correctly how wall function iterations work is something I expect that has been investigated in Fluent, while the fixed point iterations used in OF at wide has a certain number of theoretical limitations.

3) Excluding AMG, I would have expected strong similarities between the linear algebraic solvers of the two codes (yet, not identical again). But for AMG, unless OF tried to exactly replicate what Fluent does (which isn't the case), there are little chances for the two to do the exact same thing.

4) Even the PISO receipt used in Fluent, it is unlikely to be the textbook one or any PIMPLE variant (whatever PIMPLE means).

And I haven't even mentioned all the remaining numerical aspects, like schemes for convective and diffusive fluxes, gradients (yet here the differences are likely to be minor only), parallallel implementation, etc.

If you are using OF, I suggest you to forget about Fluent and instead focus on making it work knowing how things should be done in OF. Then, if you expect that a different setup should work as well, you can investigate which modification is the one that causes problems.
Thank you for your advice and reply, I've read both your comments. It gives me a small confidence boost on my bad results that it is actually common to get very different results from both software.

By results, I mean taking the same points in the elbow geometry and plotting the velocity against time for both Fluent and OF. Lowest I've obtained was as shown here:
Selected points for analysis.JPG

Results.JPG

How to understand the results: MAPE used across the timesteps https://en.wikipedia.org/wiki/Mean_a...rcentage_error

Each column represents the velocity relative error value of the x and y direction of all 5 points between OpenFOAM result and Fluent(10 rows in total)

The column header represents the Parameters that I've changed gradually in OpenFOAM to match ANSYS fluent. The right-most column has the closest parameter input that matches Fluent however it performed very badly.

A follow-up question would be if it is normal to have values behave like this or would be more logical to get a smooth curve as shown below. What error value would you expect if there is nothing wrong with both simulations for the turbulence model? (How different would you expect from both simulations?)

I've simulated another case with laminar flow(DNS) for OF and Ansys fluent and obtain an error of higher<3% using the same error analysis.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Though a doubt lingers in my mind. If I simulate 2 simulations on both software and obtain different results, which one should I trust or how do I trust them? Considering they have the same input but different end results.

Other than that, I'm only able to reduce oscillation after changing from linear upwind to upwind discretization: Oscillation.JPG
gentodin is offline   Reply With Quote

Old   February 23, 2021, 05:16
Default
  #5
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
First of all, you can only compare two converged solutions, if any.

Second, why do you mention time? Is it an unsteady computation? That complicates matter a lot.

Third, again, you can only compare using the same schemes. Fluent certainly doesn't have what OF calls linear.

The differences you are experiencing suggest me that you haven't a converged solution for at least one of the codes. This might or not be related to something fundamentally wrong in the setup. But I can't know this.
sbaffini is offline   Reply With Quote

Old   February 24, 2021, 21:35
Default
  #6
Member
 
Anonymous.
Join Date: Sep 2020
Posts: 35
Rep Power: 5
gentodin is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
First of all, you can only compare two converged solutions, if any.

Second, why do you mention time? Is it an unsteady computation? That complicates matter a lot.

Third, again, you can only compare using the same schemes. Fluent certainly doesn't have what OF calls linear.

The differences you are experiencing suggest me that you haven't a converged solution for at least one of the codes. This might or not be related to something fundamentally wrong in the setup. But I can't know this.
Hi, I would want to compare two converged solutions but its not possible to get Openfoam converge unless I change the schemes but changing the scheme would mean I can't compare them.

Yes I am running a transient simulation how does having unsteady computation complicate matter alot?

Definitely, just by running such a simulation tells me alot about CFD as a topic in itself.

I was given advice in running a simpler geometry case for comparison.
gentodin is offline   Reply With Quote

Old   February 26, 2021, 03:58
Default
  #7
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
That case is (or was last time I checked) one of the firsts in the Fluent tutorials (if not the very first), so I expect the Fluent solution to be spot on if you followed that. Also, I am pretty sure that the case is steady and solved as such in the Fluent tutorial.

Now, your solution in Fluent certainly uses the upwind scheme, and so the OF approach should use that as well, unless you know a reason to do otherwise. Indeed, it is the linear scheme that seems problematic, the one that actually doesn't exist in Fluent.

Using a simpler geometry case, one where you maybe also have a reference solution, obviously helps in determining which code is right and which one is wrong but, I think this is not relevant here.

If you are starting to learn CFD, let me suggest you to avoid OF for now. Fluent prohibits a lot of unreasonable choices and, still, it is very hard to manage on actual complex cases. OF is a collection of things that might or not make sense in certain cases.

If someone is forcing you to use OF without a proper CFD training then he is wrong.
sbaffini is offline   Reply With Quote

Reply


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
[Other] [Request] OpenFOAM mesh to 2D Ansys fluent mesh anon_q OpenFOAM Community Contributions 6 July 3, 2023 05:24
OpenFOAM vs ANSYS Fluent (Solution and Schemes) gentodin OpenFOAM Programming & Development 2 February 21, 2021 20:56
Comparison between OpenFoam and Fluent results chku24 OpenFOAM Running, Solving & CFD 2 January 19, 2020 19:52
Comparison between OpenFOAM and FLUENT: capabilities Time4Tea OpenFOAM 2 November 5, 2018 13:11
How to export Ansys Fluent results to OpenFOAM? anon_q OpenFOAM 1 April 5, 2018 07:25


All times are GMT -4. The time now is 21:49.