apply Dirichlet conditions by setting rows to I, rhs to value
See original GitHub issueFor the first time, I’m looking at scikit-fem in a serious manner. Diving into it, I notice that the common way the “apply” Dirichlet conditions is to eliminate the respective entries from the matrix/rhs à la
A, b = condense(A, b, I=mesh.interior_nodes())
I on the other hand would like to see those condition applied via setting the respective rows in A
to diagonal 1
and 0
otherwise plus the respective rhs entry to the value. Something like
apply_dirichlet(A, b, mesh.boundary_nodes(), vals)
perhaps. The resulting matrix has the same spectral properties as the condensed A
, so the number of iterations with Krylov methods will be the same, too. Advantages of this approach include the fact that neither A
nor b
need to be rewritten in memory. Also, the solution will include the values of all degrees of freedom, making postprocessing easier.
Issue Analytics
- State:
- Created 2 years ago
- Comments:29 (29 by maintainers)
Top Results From Across the Web
fem1dlinear
function fem1dlinear % This function solves the 1D BVP % -au'' + bu' + cu = f in (x0, x1) % with either...
Read more >[petsc-users] better way of setting dirichlet boundary conditions
1) First create the big system matrix (from DM da) including the identity >> rows for Dirichlet points and corresponding rhs, Lets say...
Read more >Dirichlet boundary conditions Hcurl? - General - FEniCS Project
Hello, For an exercise class in numerics I wanted to setup a simple example for the curl-curl operator (magneto-statics) but I cannot seem ......
Read more >Implementation of Dirichlet boundary condition when tgv=-1
As far as I read, when using tgv=-1, freefem doesn't apply dirichlet BC in a symmetric way. The symmetric way would look like...
Read more >FEM implementation of Dirichlet boundary conditions in elastostatic ...
I do not have any Neumann boundary conditions. ... of the diagonal of the matrix, and setting the Dirichlet value in the corresponding...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright, I’m a little slow. You already had a solution here and it remains to vectorize it.
Ah, of course:
the left stepping matrix
A
is no longer symmetric so can’t just be transposed willy-nilly to avoid theReplacing that with
backsolve = splu(A).solve
makes it run O. K.