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

Flow Over Cylinder - Question about PARDISO Solver and Fortran

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2020, 23:43
Default Flow Over Cylinder - Question about PARDISO Solver and Fortran
  #1
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Dear All,

I have a question regards my Solver, I have build a FORTRAN code to solve the incompressible viscous N--S equations.

at first I used dgetrf and dgetri to get the inverse of the pressure matrix and solve the pressure system by matrix multiplication.

all went well and good, after that I tried to include the PARDISO solver so I can save memory when I use a very large grid. so I am solving the pressure system by PARDISO instead of dgetrf and dgetri and matrix multiplication.


I compared the results at the first few time steps and it was identical, and tried that too at time step =100,1000,5000 and the solution was identical too. the problem appears when the time steps increases, it is like there is a cumulative error which increase with time.

my grid is 20Dx10D , Re=200, Epsilon = 0.05, dt=0.005

there is a sample of the results in attachments.
I can see the difference in numbers grows with time steps and I dont know why, although the solution was identical at the first time steps so there is no mathematical problem in the code.
Attached Images
File Type: png p1.png (89.6 KB, 13 views)
File Type: png p2.png (84.2 KB, 12 views)
File Type: png p3.png (60.7 KB, 15 views)
File Type: png p4.png (58.3 KB, 14 views)
File Type: jpg p5.jpg (126.3 KB, 9 views)
AeroSonic is offline   Reply With Quote

Old   May 7, 2020, 23:45
Default
  #2
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Boundary condition

inlet (u=1,v=0)
upper and lower ( v=0)
exit ( P at the midline point = 0 )

Initial Coniditons : from inlet
AeroSonic is offline   Reply With Quote

Old   May 8, 2020, 01:42
Default
  #3
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Difficult to say what the problem could be.
I would address the fact you wrote "the inverse of the pressure matrix". In principle, the pressure matrix is singular, how do you treat this issue?
FMDenaro is offline   Reply With Quote

Old   May 8, 2020, 05:31
Default
  #4
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,152
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Seems like a good case for doing a verification as opposed to a validation:

1) pick up an unsteady case with analytical solution (stokes, taylor vortex, etc.)
2) solve it with different grids and constant CFL, maybe at multiple CFL numbers
3) For each CFL and each grid-time step combination use both solvers
4) Compare both results with the analytical ones

Nothing can beat this at spotting problems and if differences are always below the threshold of the numerical error you can maybe try again with a grid-time step-CFL combination that will bring it below the differences you see. At this point, either the differences will go further down or they won't.

But, beside this, I would maybe first try the following:

1) set up a test with a matrix A like the one from your pressure equation. If you work in 2D, parameterize it with both dx and dy and make different attempts with different values
2) assign yourself a solution x (say, all ones) and compute the resulting rhs = Ax
3) solve the system with both solvers using A and rhs
4) compare results x and try to find out what's wrong and where
5) If it turns out that it is not your fault, just pick the one solver that actually works for you and maybe submit the test to the developers of the one that doesn't
sbaffini is offline   Reply With Quote

Old   May 8, 2020, 10:11
Default
  #5
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
Difficult to say what the problem could be.
I would address the fact you wrote "the inverse of the pressure matrix". In principle, the pressure matrix is singular, how do you treat this issue?
I put the BC before getting the Inverse, I get the inverse once outside the time loop.
AeroSonic is offline   Reply With Quote

Old   May 8, 2020, 10:14
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by AeroSonic View Post
I put the BC before getting the Inverse, I get the inverse once outside the time loop.
What kind of BC are you prescribing?
Then, save a small matrix like a 4x4 and check the inverse
FMDenaro is offline   Reply With Quote

Old   May 8, 2020, 10:27
Default
  #7
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
Seems like a good case for doing a verification as opposed to a validation:

1) pick up an unsteady case with analytical solution (stokes, taylor vortex, etc.)
2) solve it with different grids and constant CFL, maybe at multiple CFL numbers
3) For each CFL and each grid-time step combination use both solvers
4) Compare both results with the analytical ones

Nothing can beat this at spotting problems and if differences are always below the threshold of the numerical error you can maybe try again with a grid-time step-CFL combination that will bring it below the differences you see. At this point, either the differences will go further down or they won't.

But, beside this, I would maybe first try the following:

1) set up a test with a matrix A like the one from your pressure equation. If you work in 2D, parameterize it with both dx and dy and make different attempts with different values
2) assign yourself a solution x (say, all ones) and compute the resulting rhs = Ax
3) solve the system with both solvers using A and rhs
4) compare results x and try to find out what's wrong and where
5) If it turns out that it is not your fault, just pick the one solver that actually works for you and maybe submit the test to the developers of the one that doesn't
I believe the code is running correctly at the first few time steps, as I compared the result at the first time step and after 10 time steps and after 100 time steps, the pressure and velocity results are identical, the first time step is very very similar.

attached for example the result at specific point after 2 time steps
Attached Images
File Type: jpg p6.JPG (98.0 KB, 3 views)
AeroSonic is offline   Reply With Quote

Old   May 8, 2020, 10:28
Default
  #8
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
What kind of BC are you prescribing?
Then, save a small matrix like a 4x4 and check the inverse
Dirichlet BC, P=0 at the mid point of the exit section.
I am solving the problem in 2D.
AeroSonic is offline   Reply With Quote

Old   May 8, 2020, 10:34
Default
  #9
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by AeroSonic View Post
Dirichlet BC, P=0 at the mid point of the exit section.
I am solving the problem in 2D.
Ok, with Dirichlet BC the matrix is not singular.
Now I suggest to check for the divergence-free constraint in each cell.
It is satisfied at machine precision everywhere?
FMDenaro is offline   Reply With Quote

Old   May 8, 2020, 11:12
Default
  #10
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
Ok, with Dirichlet BC the matrix is not singular.
Now I suggest to check for the divergence-free constraint in each cell.
It is satisfied at machine precision everywhere?

I am using Finite Element ( Galerkin Least Squares ) so I had to use a stabilization parameter in the continuity as attached

for the second question, how do I know ?
Attached Images
File Type: jpg p7.JPG (9.2 KB, 2 views)
AeroSonic is offline   Reply With Quote

Old   May 8, 2020, 14:31
Default
  #11
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
I will solve the lid driven cavity problem and check what is happening, may bw something appear and tell me what is going on
AeroSonic 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
Incompressible fluid flow solver tchitchas Main CFD Forum 16 December 14, 2017 18:37
Memory protection in OpenFOAM / combinig with FORTRAN botp OpenFOAM Programming & Development 2 February 15, 2016 12:25
CEL and fortran for multiphase flow andyyuan CFX 0 September 22, 2015 01:26
multi-dimensional dynamic array allocation for multi-block solver using fortran mano Main CFD Forum 4 June 25, 2012 21:01
2-D Euler Solver for compressible flow in Matlab Volkan Main CFD Forum 1 October 28, 2007 01:40


All times are GMT -4. The time now is 05:54.