-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Flux Error Estimation #85
Conversation
5e11633
to
53b3185
Compare
9bd4ef9
to
47bea57
Compare
53b3185
to
3ea2806
Compare
47bea57
to
695259b
Compare
3ea2806
to
e3d0d39
Compare
2f8772b
to
fafcd1e
Compare
e3d0d39
to
16c91e4
Compare
fafcd1e
to
fcfa7e2
Compare
16c91e4
to
9e8b615
Compare
5cd41c2
to
cb2f758
Compare
cb2f758
to
165e150
Compare
- Some of these are necessary in the AMR branch - Some of these are minor cleanup/rationalization - Some are aesthetics
165e150
to
22022a3
Compare
- Introduces the FluxProjector class, which is used for computing a "coarse flux" in a vector L2 space, then performing a global mass matrix inversion to compute a "smooth" flux that better represents the underlying physical quantity. This is achieved through a multigrid hierarchy. - Introduces the CurlFluxErrorEstimator and GradFluxErrorEstimator classes, which utilize the FluxProjector class to compute elemental error estimates comparing the coarse numerical flux from the solution against a smoothed flux from a global mass matrix inversion. - Introduces the CurlFluxErrorEstimator class which utilizes a flux projector to compute a smooth flux in an ND space. Provides methods for real valued vectors, and complex vectors. The flux is assumed to take the form μ⁻¹∇ × V, where V is either A or E depending on the solver mode. - Introduces the GradFluxErrorEstimator class which utilizes a flux projector to compute a smooth flux in an H1^d space. The flux is assumed to be of the form ϵ ∇ ϕ - Introduce the CurlFluxCoefficient and GradFluxCoefficient classes which compute the numerical Curl and Grad fluxes given a solution.
22022a3
to
97372d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good @hughcars, I went ahead and made an initial pass as the tests are passing now.
Several style and organizational comments, but one large issue which came up towards the end in the linalg/errorestimator.cpp
classes. I see you are allocating a FiniteElementSpace
(L2) for the discontinuous flux, and constructing these scalar_mass_matrices
and smooth_to_coarse_embed
objects to perform the estimation. For reasons noted above, this is something to avoid and I think the loops over elements once the smooth flux GridFunction
is computed needs to be reworked. This can be done fully matrix-free, as mfem::GridFunction::ComputeElementLpErrors
. There may be good reason you have decided to go your current route vs. the other implementation, but maybe this was done prematurely. I would imagine it looking something like:
... compute mfem::ParGridFunction smooth_flux, and using CurlFluxCoefficient flux_coef ...
for e in 0, ... , NE-1:
T = mesh.GetElementTransformation(e);
ir = mfem::IntRules.Get(T.GetGeometryType(), q_order);
for ip in ir.GetNPoints():
T.SetIntPoint(ip);
U = smooth_flux.GetVectorValue(T, ip);
V = flux_coef.Eval(T, ip);
// Integrate over the element: \int_e (U-V)^T (U-V) dV = \sum_i w_i ||U_i - V_i||_2^2
// (w_i = ip.weight * T->Weight(), see GridFunction::ComputeLpError)
// For the normalization, use \int_e ||U||_2^2 dV = sum_i w_i ||U_i||^2
end
end
The loop over integration points can use dense matrix arithmetic using the overrides to GetVectorValue
and Eval
which return a DenseMatrix
where each column is the vector at an integration point. I am fairly certain this approach is an improvement in the long run over what you have there, as you avoid the big memory allocations associated with the dense element matrices.
3f3f79b
to
cf6a2b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working my way up from the bottom, so have added some (final) comments on ErrorEstimator
and ErrorIndicator
. I think there is something to be rethought with the ErrorIndicator
class which will clarify the normalization and make this class more useful.
I haven't looked at anything inside of drivers/
since I think this changes should be finalized first before I look at the "user" code.
eca57eb
to
f536eec
Compare
68dfe76
to
4d0dc70
Compare
…erator now that only one field is written per Solve() Also some corresponding simplification of ErrorIndicator class some remaining style fixes/remove std::transform over mfem::Vector.
…ding legacy LinearForm assembly and simplify, removing need for custom Coefficients and improving ComplexVector organization
…indicators are already relative quantities)
4d0dc70
to
565d90c
Compare
…le for error estimation
Introduce flux error estimation based on a global ZZ solve.
a vector L2 space, then performing a global mass matrix inversion to compute a
"smooth" flux that better represents the underlying physical quantity. This is achieved
through a multigrid hierarchy.
FluxProjector class to compute elemental error estimates comparing the coarse numerical flux
from the solution against a smoothed flux from a global mass matrix inversion.
smooth flux in an ND space. Provides methods for real valued vectors, and complex vectors.
The flux is assumed to take the form μ⁻¹∇ × V, where V is either A or E depending on the solver mode.
smooth flux in an H1^d space. The flux is assumed to be of the form ϵ ∇ ϕ
and Grad fluxes given a solution.
Issue #, if available:
#2