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

Build Implicit operator using operator overloading

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2015, 16:32
Default Build Implicit operator using operator overloading
  #1
Senior Member
 
Join Date: Oct 2011
Posts: 239
Rep Power: 16
naffrancois is on a distinguished road
Hello,

I would like to write a very simple implicit scheme to solve Euler equations, backward Euler. Have one of you ever used operator overloading in Fortran to build the Jacobian matrix ? This is the line I am following but:

Second question, how do you usually debug the Jacobian ? I mean a good clue is when you reach bigger cfl than explicit. But if it does not, or if the time integration simply crashes, how do you check you are accurately computing the Jacobian ?

By the way, I am testing the algorithm on Sod shock tube problem

Cheers
naffrancois is offline   Reply With Quote

Old   May 28, 2015, 11:24
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
The book of Damian Rouson:

Scientific Software Design: The object Oriented Way

has specific examples on this fortran topic. Still, i didn't find the book very pleasant at the first read.
sbaffini is offline   Reply With Quote

Old   May 28, 2015, 17:03
Default
  #3
Senior Member
 
Join Date: Oct 2011
Posts: 239
Rep Power: 16
naffrancois is on a distinguished road
Thank you very much for the reference, I will try to find it and have a look.

Nevertheless, I had to make a try on an even simpler pde, but I am getting the idea and it looks quite powerful. My long term strong doubt is about performance...
naffrancois is offline   Reply With Quote

Old   May 29, 2015, 03:51
Default
  #4
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
This guy:

https://github.com/szaghi/OFF

has developed a basic solver trying to follow the most modern Fortran features. I don't remember the exact details but i remember he complaining about some performance issues when using the most advanced features (probably polymorphicity for type bound procedures). You can find the details here:

http://www.sciencedirect.com/science...10465514001283

Hope it helps

PS There is still an other FV code out there, made by someone who is in contact with Damian Rouson himself. I remember the code being based on several Fortran advanced features. I don't have the link now, but i can provide it in few days. Just to have a comparison.

PPS Here it is the code i was referring to:

http://people.uniroma2.it/salvatore....emo/index.html

and the underlying Ph.D. thesis:

http://www.ce.uniroma2.it/nemo/toninel_phd.pdf
sbaffini is offline   Reply With Quote

Old   June 7, 2015, 14:47
Default
  #5
Senior Member
 
Join Date: Oct 2011
Posts: 239
Rep Power: 16
naffrancois is on a distinguished road
Many thanks for your help and links. I was able to apply the concept to the construction of an implicit operator for the 1d euler equations. As I expected, once all the machinery of operator and function overloading is set, it is very easy to switch from a model equation to another. Way much simpler than hand differentiation.
naffrancois is offline   Reply With Quote

Old   June 7, 2015, 15:39
Default
  #6
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
Do you have any feel of a sensible overhead (some might be unavoidable)?
sbaffini is offline   Reply With Quote

Old   June 9, 2015, 00:47
Default
  #7
Senior Member
 
Join Date: Oct 2011
Posts: 239
Rep Power: 16
naffrancois is on a distinguished road
Well, I did not check the specific computing time spent in the propagation of the derivatives. But, for my goal application which is to solve a sequence of large linear systems (implicit time discretization), the overhead in the end seems to be negligible (<1%). But more tests are coming and extensions to other solvers, I am quite optimist

I am also convinced that it is a much more robust approach, I think so many implicit hand-differentiated codes do not work the way they should just because a small differential mistake was done in the Jacobian. In a Newton-like solver, even a small mistake can spoil the convergence very badly
naffrancois 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
Gradient operator implicit discretization diegon OpenFOAM Running, Solving & CFD 19 August 27, 2022 10:44
Building from Source on Windows using Cygwin64 ericthefatguy SU2 2 May 12, 2015 18:23
SU2 3.0 build failure waku2005 SU2 Installation 4 January 24, 2014 12:40
Hardware build review/advise for student desktop AerE Hardware 10 July 5, 2013 06:03
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07


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