Closed volpatto closed 1 year ago
If you change the line where you build _F
to _F = AssembledVector(assemble(b_form))
this will work fine. Just for reference, we have one test in our test suite which is doing something similar (handwrite the SCPC, but for a 3x3 system) here https://github.com/firedrakeproject/firedrake/blob/2946e2fb6309e5b71fb90a8a2512a12d79b7d06b/tests/slate/test_variational_prb.py#L76 I marked the relevant line in the link.
Oh, so that is it! Thanks, @sv2518! And thanks also for indicating the relevant test, I checked the tests but missed this one.
Hi firedrakers!
Description
I have been working on a primal hybrid formulation. You can understand it as a primal version of HDG (I think that formulation details are not required, so I will skip most of them). The resulting algebraic system has the following structure:
$$ M x=f $$
with
$$ \mathrm{M}:=\left[\begin{array}{ll} M{00} & M{01} \ M{10} & M{11} \end{array}\right], \quad \mathrm{x}:=\left[\begin{array}{l} \mathrm{p} \ \lambda \end{array}\right], \quad \mathrm{f}:=\left[\begin{array}{c} \mathrm{f}_0 \ \mathrm{f}_1 \end{array}\right] $$
where $p$ is vector associated to the primal variable and $\lambda$ with the Lagrange multiplier.
Condensing the system, we have:
$$ \left(M{11}-M{10}M{00}^{-1} M{01}\right) \lambda=f1 - M{10}M_{00}^{-1} \mathrm{f}_0 $$
and we can recover the solution for the primal variable with:
$$ \mathbf{p}=M_{00}^{-1}\left(f0 - M{01} \boldsymbol{\lambda}\right) $$
I have to solve the problem through Static Condensation.
Issue
I tried two approaches to solve the condensed system. Below I provide the relevant code snippets for each case.
Using Static Condensation as PC in solver parameters.
This approach is fine, works as expected. I set the part to solve the problem as below:
Solving with Slate
I am not sure with this is the correct term the previous approach also uses Slate under the hood, whatever. The point is I'm obtaining a lot of outputs related to the generated kernels, and this stuff is too much for my shallow understanding of Slate (and Firedrake in general). I tried to follow the Slate paper. Here is the code:
This approach did not work. The output last few lines are:
So what I have missed? Is this expected? Any suggestion to fix it? Thanks in advance!
Supporting material
The codes and output.
Firedrake status