def setup_error_monitor(true, history, path=''): '''We measure error in H1 and L2 for simplicity''' from common import monitor_error, H1_norm, L2_norm # Note we produce u1, u2, and p error. It is more natural to have # broken H1 norm so reduce the first 2 errors to single number reduction = lambda e: None if e is None else [sqrt(e[0]**2 + e[1]**2), e[-1]] return monitor_error(true, [H1_norm, H1_norm, L2_norm], history, reduction, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error in H1 and L2 for simplicity''' from common import monitor_error, H1_norm, L2_norm # Note we produce u1, u2, and p error. It is more natural to have # broken H1 norm so reduce the first 2 errors to single number reduction = lambda e: None if e is None else [sqrt(e[0]**2 + e[1]**2), e[-1]] return monitor_error(true, [H1_norm, H1_norm, L2_norm], history, reduction, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error V1 x Q1, V2 x Q2, L2(instead of fractional)''' from common import monitor_error, H1_norm, L2_norm, Hdiv_norm # First stokes, then darcy pressure reduction = lambda e: None if e is None else [sqrt(e[0]**2 + e[2]**2), e[1]] return monitor_error(true, # u1, p, p1 [H1_norm, H1_norm, L2_norm], history, path=path, reduction=reduction)
def setup_error_monitor(true, history, path=''): '''We measure error V1 x Q1, V2 x Q2, L2(instead of fractional)''' from common import monitor_error, H1_norm, L2_norm, Hdiv_norm # Note we produce u1, u2, and p error. It is more natural to have # broken H1 norm so reduce the first 2 errors to single number reduction = lambda e: None if e is None else [sqrt(e[0]**2 + e[1]**2), e[-1]] return monitor_error(true, [H1_norm, L2_norm, Hdiv_norm, L2_norm, L2_norm], history, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error V1 x Q1, V2 x Q2, L2(instead of fractional)''' from common import monitor_error, H1_norm, L2_norm, Hdiv_norm # Note we produce u1, u2, and p error. It is more natural to have # broken H1 norm so reduce the first 2 errors to single number reduction = lambda e: None if e is None else [ sqrt(e[0]**2 + e[1]**2), e[-1] ] return monitor_error(true, [H1_norm, L2_norm, Hdiv_norm, L2_norm, L2_norm], history, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error V1 x Q1, V2 x Q2, L2(instead of fractional)''' from common import monitor_error, H1_norm, L2_norm, Hdiv_norm # First stokes, then darcy pressure reduction = lambda e: None if e is None else [ sqrt(e[0]**2 + e[1]**2), e[2] ] return monitor_error( true, # u1, p, p1 [H1_norm, L2_norm, H1_norm], history, path=path, reduction=reduction)
def setup_error_monitor(true, history, path=''): '''We measure error in Hdiv and L2 for simplicity''' from common import monitor_error, Hdiv_norm, L2_norm from math import sqrt # Note we produce sigma1, sigma2 u1, u2, and p error. But this is just # so that it is easier to compute error as the true solution is # discontinuous. So we compute on subdomain and then reduce reduction = lambda e: None if e is None else [sqrt(e[0]**2 + e[1]**2), # Hdiv sqrt(e[2]**2 + e[3]**2), # L2 e[-1]] return monitor_error(true, [Hdiv_norm, Hdiv_norm, L2_norm, L2_norm, L2_norm], history, reduction, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error in L2 and L2, L2 for simplicity''' # L2 on velocity because eps -> 0 H1 does not make sense from common import monitor_error, H1_norm, L2_norm # Now for the multiplier, since we really know the exact solution # only on pieces of the mesh, we will do things manually # def foo(u, uh): mesh = uh.function_space().mesh() cell_f = MeshFunction('size_t', mesh, mesh.topology().dim(), 0) # Mark pieces # CompiledSubDomain('near(x[1], 1)').mark(cell_f, 0) CompiledSubDomain('near(x[0], 0)').mark(cell_f, 1) CompiledSubDomain('near(x[1], 0)').mark(cell_f, 2) CompiledSubDomain('near(x[0], 1)').mark(cell_f, 3) dX = Measure('dx', domain=mesh, subdomain_data=cell_f) error = sum(inner(uj-uh, uj-uh)*dX(j) for j, uj in enumerate(u)) return sqrt(assemble(error)) return monitor_error(true, [L2_norm, L2_norm, foo], history, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error in L2 and L2, L2 for simplicity''' # L2 on velocity because eps -> 0 H1 does not make sense from common import monitor_error, H1_norm, L2_norm # Now for the multiplier, since we really know the exact solution # only on pieces of the mesh, we will do things manually # def foo(u, uh): mesh = uh.function_space().mesh() cell_f = MeshFunction('size_t', mesh, mesh.topology().dim(), 0) # Mark pieces # CompiledSubDomain('near(x[1], 1)').mark(cell_f, 0) CompiledSubDomain('near(x[0], 0)').mark(cell_f, 1) CompiledSubDomain('near(x[1], 0)').mark(cell_f, 2) CompiledSubDomain('near(x[0], 1)').mark(cell_f, 3) dX = Measure('dx', domain=mesh, subdomain_data=cell_f) error = sum(inner(uj - uh, uj - uh) * dX(j) for j, uj in enumerate(u)) return sqrt(assemble(error)) return monitor_error(true, [L2_norm, L2_norm, foo], history, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error in H1 and L2, L2 for simplicity''' from common import monitor_error, H1_norm, L2_norm return monitor_error(true, [H1_norm, L2_norm, L2_norm], history, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error in H1 and L2 for simplicity''' from common import monitor_error, H1_norm, L2_norm return monitor_error(true, [H1_norm, L2_norm], history, path=path)
def setup_error_monitor(true, history, path=''): '''TODO''' from common import monitor_error, H1_norm, L2_norm return monitor_error(true, [], history, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error in H1 and abs norm for the multiplier''' from common import monitor_error, H1_norm, linf_norm return monitor_error(true, [H1_norm, linf_norm], history, path=path)
def setup_error_monitor(true, history, path=''): '''TODO''' from common import monitor_error, H1_norm, L2_norm return monitor_error(true, [], history, path=path)
def setup_error_monitor(true, history, path=''): '''We measure error in H1 and abs norm for the multiplier''' from common import monitor_error, H1_norm, linf_norm return monitor_error(true, [H1_norm, linf_norm], history, path=path)