|
[Sponsors] |
Solution of a linear system in a semi-implicit method |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 18, 2016, 10:23 |
Solution of a linear system in a semi-implicit method
|
#1 |
New Member
Justin Wiegmann
Join Date: Aug 2015
Posts: 20
Rep Power: 10 |
Hello Foamers!
I have again a problem. I think its easy to solve for you guys, but my code can't be correct. The implicit Euler method shall be implemented. Therefore, I have to solve a linear system Ax = b. 'b' is in this case the velocity vector of the actual time step 'n'. 'Ax' contains everything with respect the new 'U' of time step n+1 that I want to solve this system for. This part of my code looks as follows: Code:
fvVectorMatrix UEqn ( U - (-runTime.deltaT()*fvm::div(phi, U)+ runTime.deltaT()*nu * fvm::laplacian(U)) ); solve (UEqn == U); Can you tell me how to solve that system to get the new velocity field 'U'. Thank you and best regards! |
|
January 18, 2016, 12:41 |
|
#2 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Hi,
why you don't want to write your matrix as in standard OpenFOAM solver: Code:
fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U)) ); UEqn.solve(); Code:
volVectorField Uold = U.oldTime() fvVectorMatrix UEqn ( fvm::Sp(geometricOneField(),U) == runTime.deltaT()* ( -fvm::div(phi, U) + nu * fvm::laplacian(U)) ) + Uold ); UEqn.solve();
__________________
MDPI Fluids (Q2) special issue for OSS software: https://www.mdpi.com/journal/fluids/..._modelling_OSS GitHub: https://github.com/unicfdlab Linkedin: https://linkedin.com/in/matvey-kraposhin-413869163 RG: https://www.researchgate.net/profile/Matvey_Kraposhin |
|
January 19, 2016, 13:19 |
|
#3 |
New Member
Justin Wiegmann
Join Date: Aug 2015
Posts: 20
Rep Power: 10 |
Thank you very much! That helped me a lot. I want to do this, because of a Benchmark of methods based on the projection method in OpenFOAM.
Instead of 'geometricOneField()' I just wrote '1', because an error occured in the compiling process. But in my opinion, it works fine now. Now, I want to implement a DIRK method, so I have to compute velocity slopes, let's say 'ki'. Is it possible to use 'UEqn' to solve the linear system for a volVectorField 'ki' somehow? Or can I only do this always with 'U'? Is there a general method to do that with any volVectorFields without writing a completely new code for that? The 'ki's should be stored in the PtrList<volVectorField> ki It would be nice to define the method for the linear system in fvSolution, too. Best regards! |
|
January 22, 2016, 10:23 |
|
#4 |
New Member
Justin Wiegmann
Join Date: Aug 2015
Posts: 20
Rep Power: 10 |
Okay, maybe the question is too stupid I am a beginner and it is quite difficult to get the knowledge from other sources..
Maybe someone can help me with this: ('lauf3, lauf4' are just running numbers.., 'k' is a volVectorField, Uold is derived from volVectorField 'U') I want to solve the system for k Code:
fvVectorMatrix kEqn ( fvm::Sp(1, k) == - fvm::div (phi, Uold + runTime.deltaT()*A[lauf3][lauf4] * k) + nu * fvm::laplacian (Uold + runTime.deltaT()*A[lauf3][lauf4] * k) ); kEqn.solve() Thanks and best regards! |
|
January 25, 2016, 03:25 |
|
#5 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 18 |
You need to only have the field you want to solve for in the second argument of the fvm:: operators, not others. You can put the other fields in the first argument.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SU2 cfg file and runtime problems | hedley | SU2 | 19 | January 26, 2016 04:17 |
Unsteady simulation solution files in parallel | gunnersnroses | SU2 | 1 | December 15, 2015 13:28 |
exact meaning of semi implicit in SIMPLE algorithm | venkataramana | Main CFD Forum | 0 | April 14, 2011 21:08 |
Implicit iterative Gauss-Seidel method | dearboy | Main CFD Forum | 5 | November 29, 2010 09:18 |
Philosophy of implicit solution of different regions | Louis Le Grange | OpenFOAM | 0 | October 5, 2009 10:53 |