Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Add Matrix to SymbolicBFI

More
2 years 11 months ago #3772 by creativeworker
Hello,

is there any possibility to add a constant Matrix to the Bilinear Form?
Code:
a = BilinearForm(fes) a+= SymbolicBFI(weak_K(u,v)) a+= "const. Matrix from Numpy" #either here a.Assemble() a.mat += "const Matrix form Numpy" # or here (but does then a.AssembleLinearization() work later?)

The benefit would be that I can still use a.Apply, a.AssembleLinearization, etc... as I would with only considering the "analytical, continous" weak form of my problem.

Thanks for your help in advance!
More
2 years 11 months ago #3782 by christopher
One should be able to create a scipy sparse matrix like here:
docu.ngsolve.org/latest/i-tutorials/unit...ighlight=scipy%20csr

and if copy=False argument is set, one should be able to manipulate the underlying c++ matrix. But not 100% sure if no copy is involved so please check!

Best
Christopher
The following user(s) said Thank You: creativeworker
Time to create page: 0.128 seconds