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

Linear Solver

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 8, 2011, 20:03
Question Linear Solver
  #1
Member
 
Join Date: Jan 2010
Posts: 44
Rep Power: 6
Argen is on a distinguished road
Assuming one linear system AX=B, where A is a matrix of NxN and B is a vector, A and B are known and vector X is unknown. How to use the linear solver in OpenFoam to solve this linear system?
Argen is offline   Reply With Quote

Old   October 8, 2011, 21:28
Default
  #2
Member
 
Join Date: Jan 2010
Posts: 44
Rep Power: 6
Argen is on a distinguished road
I thought that two fields of X and B are probably created first as
Info<< "Reading field T\n" <<endl;
volScalarField X
(
IOobject
(
"X",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
while I don't know how to set up B since it is known.

Another question is how to set an equation to solve
fvScalarMatrix XEqn
(
A(X) ????
);

XEqn.solve();

If this step is properly handled, it could be easy to set up linear solver and preconditioner in fvSolution

Any idea on this problem?
Argen is offline   Reply With Quote

Old   October 8, 2011, 22:36
Default
  #3
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 418
Rep Power: 14
santiagomarquezd will become famous soon enough
Argen, X and B creating is just as you showed in the post. Respect the matrix, as far as I know the problem is that fvMatrices in FOAM are ever related to a geometrical problem and its discretization, so that is not possible to create them only from their coefficients and positions in the matrix (Both fvMatrix and lduMatrix don't have constructors from elements and positions). It requires to use the lduAddressing at low level and would require to code your own classes to do so.

Please FOAMers correct me if I'm wrong.


Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D.
Post-doctoral Fellow
Research Center for Computational Mechanics (CIMEC) - CONICET/FICH-UNL
T.E.: 54-342-4511594 Ext. 1005
Güemes 3450 - (3000) Santa Fe
Santa Fe - Argentina
http://www.cimec.org.ar
santiagomarquezd is offline   Reply With Quote

Old   October 10, 2011, 02:17
Default
  #4
Member
 
Join Date: Jan 2010
Posts: 44
Rep Power: 6
Argen is on a distinguished road
Quote:
Originally Posted by santiagomarquezd View Post
Argen, X and B creating is just as you showed in the post. Respect the matrix, as far as I know the problem is that fvMatrices in FOAM are ever related to a geometrical problem and its discretization, so that is not possible to create them only from their coefficients and positions in the matrix (Both fvMatrix and lduMatrix don't have constructors from elements and positions). It requires to use the lduAddressing at low level and would require to code your own classes to do so.

Please FOAMers correct me if I'm wrong.
lduAddressing is a addressing array which is provided for the lower and upper triangles to translate their face index into a corresponding cell index. I could not figure out how to make it from the known matrix, A. As Santiago mentioned, I sense that lduMatrix and fvMatrix can't work for this case since matrix is generated in OpenFOAM directly by discretizing a certain equation.

Do you have more suggestions on it?
Argen is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dealing with BC's in OF 1.6 vkrastev OpenFOAM Running, Solving & CFD 5 September 4, 2012 12:58
ERROR #004100018; Fatal overflow in linear solver Attila CFX 1 April 13, 2012 23:22
What's the difference between a linear and a nonlinear solver? bearcat Main CFD Forum 1 February 5, 2010 08:11
free C code for large sparse matrix linear solver ztdep Main CFD Forum 7 May 24, 2007 15:14
linear solver failure when using SST model fanzhong Meng CFX 4 March 21, 2006 21:16


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