I’m working on a hyper-reduction method where each element in the mesh has a unique weight.
The weights must be applied to the local element stiffness matrices during the assembly to the bilinear form.
Is there a way of doing that given a vector of element weights?
Or else is there a way to get single element stiffness matrices in global coordinates?
You can for example parse the elementwise coefficients as a list or a numpy array and store them in a c++ array. Then in the evaluate function of your coefficient you query the element number by
int elnr = mip.GetTransformation().GetElementNr();
Then return the corresponding value from the array.
You can then use this CoefficientFunction in your stiffness bilinearform.
I hope this helps, if you run into problems write again. This part of the documentation is not often used yet.
thank you! Now the weighting CoefficientFunction works.
For linear problems the everything works as expected but I want to apply the element weights to nonlinear problems as well.
When calling AssembleLinearization of the BilinearForm I get the following error:
K_weighted.AssembleLinearization(u_full.vec)
Evaluate AutoDiff<double> not overloaded, type = class ngfem::MyElementWeightCFin Assemble Element Mat, bfi = Symbolic BFI in AssembleLinearization
Is there a way to make AssembleLinearization work with the custom CoefficientFunction?