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

Solving System of Linear equations

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 29, 2009, 09:33
Default Solving System of Linear equations
  #1
Member
 
Mihails Ščepanskis
Join Date: Jul 2009
Posts: 36
Rep Power: 16
shchepan is on a distinguished road
Hi!
I need to solve in OpenFOAM system of linear equation like
A*b = c
where A is tensor (rank 2) and c is vector. A and c are constants.

How can I solve this equation?
Thank you
shchepan is offline   Reply With Quote

Old   September 30, 2009, 02:03
Default
  #2
Member
 
Mihails Ščepanskis
Join Date: Jul 2009
Posts: 36
Rep Power: 16
shchepan is on a distinguished road
Thank you, Stanley!
Can you show how to use this function?
What H-file I should include solve function to work?
shchepan is offline   Reply With Quote

Old   October 1, 2009, 01:09
Default
  #3
Member
 
Mihails Ščepanskis
Join Date: Jul 2009
Posts: 36
Rep Power: 16
shchepan is on a distinguished road
//I've created tensor A:
tensor A(Axx, Axy, Axz, Ayx, Ayy, Ayz, Azx, Azy, Azz);
//and vector c:
vector c(cx, cy, cz);

and now I want to get vector b: A*b=c
shchepan is offline   Reply With Quote

Old   October 1, 2009, 20:05
Default
  #4
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
Why use OpenFOAM instead of MATLAB / Octave for this?
akidess is offline   Reply With Quote

Old   October 2, 2009, 01:46
Default
  #5
Member
 
Mihails Ščepanskis
Join Date: Jul 2009
Posts: 36
Rep Power: 16
shchepan is on a distinguished road
Anton, because it is only one step of big programm.
First I solve MHD turbulent equations in crucible. Then I solve lagrangian equation for solid particle motion. I take into acount lift force to (proportional U x rot(U)). And to solve this aquation I need to solve system of linear algebraic equations.
shchepan is offline   Reply With Quote

Old   November 14, 2010, 14:03
Default
  #6
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Hi Mihails,

I would also be able to solve a system of linear equations in OF as a part of a larger code. Did you ever find out if there is a possibility to solve a system of linear equations i OF?

Thanks
nikwin is offline   Reply With Quote

Old   November 14, 2010, 16:04
Default
  #7
Member
 
Lukasz Miroslaw
Join Date: Dec 2009
Location: Poland
Posts: 66
Rep Power: 16
Lukasz is on a distinguished road
Send a message via Skype™ to Lukasz
Why don't you use our GPU-baed code (speedit.vratis.com)? It can be easily plugged to OF. So far we support CG/BiCGSTAB for solving symmetric/unsymmetric matrices in single/double precision (soon also with complex values).
Lukasz is offline   Reply With Quote

Old   November 15, 2010, 03:50
Default
  #8
Member
 
Mihails Ščepanskis
Join Date: Jul 2009
Posts: 36
Rep Power: 16
shchepan is on a distinguished road
Year ago I decided that it is much easier for me to write my own code that solve systems of linear equation using Gauss method.
__________________
Mihails Ščepanskis
Laboratory for Mathematical Modelling of Environmental and Technological Processes
University of Latvia
shchepan is offline   Reply With Quote

Old   November 15, 2010, 05:30
Default
  #9
Member
 
Lukasz Miroslaw
Join Date: Dec 2009
Location: Poland
Posts: 66
Rep Power: 16
Lukasz is on a distinguished road
Send a message via Skype™ to Lukasz
But happens if the matrix is huge and sparse. The memory requirements are quite high for Gauss method.
Lukasz is offline   Reply With Quote

Old   November 15, 2010, 05:40
Default
  #10
Member
 
Mihails Ščepanskis
Join Date: Jul 2009
Posts: 36
Rep Power: 16
shchepan is on a distinguished road
Of course you are right, Lukasz. I am solving my specific problem and I have no goal to write universal code for systems of linear equations.
__________________
Mihails Ščepanskis
Laboratory for Mathematical Modelling of Environmental and Technological Processes
University of Latvia
shchepan is offline   Reply With Quote

Old   November 16, 2010, 05:27
Default
  #11
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Thanks both of you!

The simplest way for me is to go for Michails suggestion, which I've already implemented in Matlab. Now I will just need to rewrite it into OF which for me will be the tricky part.

Regards
nikwin is offline   Reply With Quote

Old   November 16, 2010, 05:36
Default
  #12
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17
herbert is on a distinguished road
Hi,

if you want to use Gauss-algorithm only, you don't have to hardcode it. There is already a class called simpleMatrix which can do this job. The source is located in src/OpenFOAM/matrices/simpleMatrix/ .

I don't know if there is an example in any solver, but it is quite simple to use.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   November 16, 2010, 07:52
Default
  #13
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Perfect!

It works as expected.

Thanks
/NW
nikwin is offline   Reply With Quote

Old   December 5, 2013, 11:40
Default
  #14
Member
 
Evangelos
Join Date: Sep 2011
Posts: 87
Rep Power: 14
Danath is on a distinguished road
Hello ! can you tell me how you add simpleMatrix to your code ?

I am trying to do the same thing but i have a lot of problems !
Danath 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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 16:33
Differences between serial and parallel runs carsten OpenFOAM Bugs 11 September 12, 2008 12:16
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 17:39.