On 6/8/21 3:33 AM, Corbin Foucart wrote:
>
> I've written generic, implicit HDG/DG solvers that solve a second-order
> diffusion type equation $\frac{du}{dt} - \nabla^2 u = f$ (where f is a generic
> DG finite element field). As I'm expanding the code to a set of projection
> methods, I'd like this $f$ to represent an explicitly computed advection term
> on the right-hand side $\nabla\cdot (u^k \otimes u^k)$ at time $k+1$.
>
> I'd like to assemble the weak form of the advection term, something like
> $-(∇v, u^k\otimes u^k)_K +(v, F^*(u)\cdot n)_{\partial K}$ (where F^*(u) is
> the convective numerical flux) on the right hand side for every element K and
> store that as a DG field.
This is conceptually not the right approach. A finite element field is a
function of the form
u_h(x) = \sum_j U_j \psi_j(x)
where U_j is a vector of coefficients. But you don't have a field of this
form: You have a vector
F_j
= sum_K -(∇psi_j, u^k\otimes u^k)_K +(\psi_j, F^*(u)\cdot n)_{\partial K}
but this is a vector of (weighted) integrals of the previous solution, not a
vector of expansion coefficients.
In other words, your vector F_j is a vector alright, but it does *not*
corresponding to a finite element field, whether continuous or discontinuous.
> To avoid breaking the abstraction of the implicit
> solver classes, is it possible to compute this term outside the main solver
> classes and pass it in as a DG Field represented as a Vector<double>?
What you plan to do is no different, really, than any of the other right hand
side vectors we assemble. For example, in step-4, we assemble a right hand
side vector ("system_rhs") in assemble_system(). The only difference is that
in your case, this right hand side vector depends on the previous solution,
but conceptually you're doing the same thing.
Of course, it may be the case that you're not doing any other assembly
operations in each time step, for example because you keep using the same
matrix every time. But you can always write a function of the form
assemble_rhs() that only assembles a rhs vector. As just one example, the new
step-77 program has a function compute_residual() that does essentially this.
Best
Wolfgang
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/