Replies: 9 comments 6 replies
-
I'm curious that what kind of applications you have in mind? |
Beta Was this translation helpful? Give feedback.
-
Yes, sorry, a month has passed without my having come up with a nice potted example here. So the ex14 referred to above was renamed ex13 in 366392b. It solves the Laplace equation with mixed boundary conditions: (i) unit potential, (ii) zero potential, (iii) zero current, and integrates the Joule heating over the domain to get the resistance R between the positive and ground edges. The resistance of something with two ports is usually thought of as a single quantity, giving the ratio of the signed voltage drop to the signed current. Here the role of the finite element method is condensation: to reduce the continuous multidimensional model to a lumped equivalent, a resistor. But what happens if there are more than two ports? Another way to think about the resistance is that there is a conductance matrix that multiplies the vector of port potentials to give the corresponding vector of port currents. In the case of a single (two-port) resistor, this is just [[+1, -1], [-1, +1]] / R. In general, the [i, j] coefficient of the conductance matrix gives the current into the i - th port given unit potential at the j - th port with the rest grounded. Thus one can calculate the matrix column-wise by solving the n boundary value problems which charge each port in turn. Instead of a single resistor, the reduced order model corresponds to a circuit that looks like a 'complete graph', with a resistor between each pair of distinct nodes with resistance minus one on the off-diagonal coefficient. It can be shown that the matrix has zero row and column sums, so actually only n – 1 of these problems needs to be solved. In the case n = 2, that's one, as in the given example, so there's not much point to this matrix formulation, but for larger n, being able to specify the n – 1 right-hand sides all at once is at least very tidy but also possibly more efficient if one is using a Krylov solver since the Krylov subspace can be shared by the n – 1 right-hand sides and solutions. (I haven't actually demonstrated the latter claim, but the tidiness is a plus enough for me so far.) |
Beta Was this translation helpful? Give feedback.
-
I see now. This is an interesting use case. I'm glad if you are able to contribute. |
Beta Was this translation helpful? Give feedback.
-
Perhaps this should be documented with the example from ‘Three ways to compute multiport inertance’ (hal-02159726), now in press. |
Beta Was this translation helpful? Give feedback.
-
Meanwhile, the next question is whether this will still ‘just work with no modification required to the usual idiom’ if |
Beta Was this translation helpful? Give feedback.
-
No, it doesn't work with iterative solvers from |
Beta Was this translation helpful? Give feedback.
-
Alternative implementations of GMRES like only accept single-column right-hand sides. (And similarly for other Krylov solvers.) Perhaps there's a good reason for this… |
Beta Was this translation helpful? Give feedback.
-
Revisting some code that did work back in 2018-06-28, I find that it doesn't any more; multicolumn right-hand sides no longer seem to be supported by (Were this still an issue, I'd close it; not sure what the equivalent for a Discussion is. Deletion seems excessive.) |
Beta Was this translation helpful? Give feedback.
-
Strike that, sorry, the code with the usual minimal modifications required by the intervening changes to |
Beta Was this translation helpful? Give feedback.
-
This is a nonissue in a sense; multicolumn right-hand sides just work with no modification required to the usual idiom of e.g. ex14 36d7ace
where dofs is still a one-dimensional array of indices but now
u
andb
are two-dimensional withu.shape[0] == b.shape[0] == A.shape[0]
andu.shape[1] == b.shape[1] >= 1
.However, as that might not be obvious and as it is so useful in applications, this is being noted here as worth documenting and worth demonstrating in an example. (I hope to provide one shortly; I have it working in complicated cases but would like to strip it down to essentials before publishing.)
Beta Was this translation helpful? Give feedback.
All reactions