Hello Dumux,
I would like to solve a linear system of equations (A*x = b) using the Dune
ISTL. To use the Dumux implementation (seqsolverbackend.hh),
Dune::FieldVectors need to be wrapped in Dune::Blockvectors and a
Dune::FieldMatrix is wrapped in a Dune::BCRSMatrix. I am not familiar with
these data types and the Dune documentation on the homepage is really
confusing. Since the system is not too large, I guess I can solve everything in
a single block? This is the code I use right now:
Dune::FieldMatrix<Scalar, numSurfaceReactions, numSurfaceSpecies> A;
for(int speciesIdx=0; speciesIdx<numSurfaceSpecies; speciesIdx++)
for(int reactionIdx=0; reactionIdx<numSurfaceReactions;
reactionIdx++)
assign values...
// right hand side
Dune::BlockVector<Dune::FieldVector<Scalar, numSurfaceReactions> > b;
b.resize(1); // does this mean there is only one block containing a
FieldVector ?
for(int reactionIdx=0; reactionIdx<numSurfaceReactions; reactionIdx++)
b[0][reactionIdx] = ...
// solution
Dune::BlockVector<Dune::FieldVector<Scalar, numSurfaceSpecies> > x;
x.resize(1);
typedef typename Dune::FieldMatrix<Scalar, numSurfaceReactions,
numSurfaceSpecies> MatrixBlock;
typedef typename Dune::BCRSMatrix<MatrixBlock> ISTLMatrix;
ISTLMatrix A2(1, 1, ISTLMatrix::random); // does this mean there is only one
block containing a FieldMatrix ?
for(int speciesIdx=0; speciesIdx<numSurfaceSpecies; speciesIdx++)
for(int reactionIdx=0; reactionIdx<numSurfaceReactions;
reactionIdx++)
A2[0][0][reactionIdx][speciesIdx] = ... HOW TO ASSIGN VALUES???
I get a segmentation fault from the last line. Is there better information on
BCRS matrices somewhere? Any hints on how to set up this matrix are greatly
appreciated!
Best regards
Georg Futter
--------------------------
German Aerospace Center (DLR)
Institute of Engineering Thermodynamics | Computational Electrochemistry |
Pfaffenwaldring 38-40 | 70569 Stuttgart
Dipl.-Ing. Georg Futter | Ph.D. student
Telefon 0711/6862-8135 | [email protected]<mailto:[email protected]>
www.DLR.de<http://www.dlr.de/>
_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux