# confusion for DPG with primal formulation from dolfin import * import helper_functions as help p = int(help.parseArg('--p', 1)) fp = int(help.parseArg('--fp', p)) numRefs = 4 init_N = 4 h_vec = [] conf_err = [] nconf_err = [] for ref in xrange(0, numRefs): N = init_N * 2**ref mesh = UnitSquareMesh(N, N) n = FacetNormal(mesh) V = FunctionSpace(mesh, "CG", p) ue = Expression("sin(x[0]*pi)*sin(x[1]*pi)", pi=2.0 * acos(0.0)) forcing = Expression("2.0*pi*pi*sin(pi*x[0])*sin(pi*x[1])", pi=2.0 * acos(0.0)) + ue # ================ standard solve ==================== u, v = TrialFunction(V), TestFunction(V) a = inner(grad(u), grad(v)) * dx + inner(u, v) * dx L = forcing * v * dx # rhs bc = DirichletBC(V, Constant(0.0), DomainBoundary()) uh = Function(V) solve(a == L, uh, bc)
from dolfin import * from numpy import array, argsort, amax from math import ceil import helper_functions as help import helper_confusion as chelp # Create mesh and definene function space eps = float(help.parseArg('--eps',1e-2)) pU = int(help.parseArg('--p',1)) N = int(help.parseArg('--N',4)) useStrongBC = help.parseArg('--useStrongBC','False')=='True' #eval using strings plotFlag = help.parseArg('--plot','True')=='True' #eval using strings dp = int(help.parseArg('--dp',1)) pV = pU+dp mesh = UnitSquareMesh(N,N) # define problem params print "eps = ", eps beta = Expression(('1.0','0.0')) ue = chelp.erikkson_solution(eps) grad_ue = chelp.erikkson_solution_gradient(eps) zero = Expression('0.0') infl = chelp.Inflow() outfl = 1-infl
from dolfin import * from numpy import array, argsort, amax from math import ceil import helper_functions as help import helper_confusion as chelp useBulkChasing = False useAdaptivity = False # Create mesh and definene function space eps = float(help.parseArg('--eps', 1e-2)) pU = int(help.parseArg('--p', 1)) N = int(help.parseArg('--N', 4)) numRefs = int(help.parseArg('--numRefs', 1)) numQRefs = int(help.parseArg('--numQRefs', 4)) useStrongBC = help.parseArg('--useStrongBC', 'False') == 'True' #eval using strings plotFlag = help.parseArg('--plot', 'True') == 'True' #eval using strings dp = int(help.parseArg('--dp', 1)) pV = pU + dp mesh = UnitSquareMesh(N, N) zero = Expression('0.0') # define problem params print "eps = ", eps beta = Constant((.5, 1.0))
# confusion for DPG with primal formulation from dolfin import * import helper_functions as help p = int(help.parseArg('--p',1)) fp = int(help.parseArg('--fp',p)) numRefs = 4 init_N = 4 h_vec = [] conf_err = [] nconf_err = [] for ref in xrange(0,numRefs): N = init_N*2**ref mesh = UnitSquareMesh(N,N) n = FacetNormal(mesh) V = FunctionSpace(mesh,"CG", p) ue = Expression("sin(x[0]*pi)*sin(x[1]*pi)",pi = 2.0*acos(0.0)) forcing = Expression("2.0*pi*pi*sin(pi*x[0])*sin(pi*x[1])",pi=2.0*acos(0.0)) + ue # ================ standard solve ==================== u,v = TrialFunction(V),TestFunction(V) a = inner(grad(u),grad(v))*dx + inner(u,v)*dx L = forcing*v*dx # rhs bc = DirichletBC(V, Constant(0.0), DomainBoundary()) uh = Function(V) solve( a==L, uh, bc) # ================ nonconforming solve ==================
from dolfin import * import helper_functions as help import helper_confusion as chelp import sys,getopt #print 'Number of arguments:', len(sys.argv), 'arguments.' #print 'Argument List:', str(sys.argv) p = int(help.parseArg('--p',1)) N = int(help.parseArg('--N',4)) numRefs = int(help.parseArg('--numRefs',1)) eps = float(help.parseArg('--eps',1e-2)) numQRefs = int(help.parseArg('--numQRefs',4)) print "args = ", [p,N,numRefs,eps,numQRefs] # define problem params beta = Constant(('1.0','0.0')) ue = chelp.erikkson_solution(eps) def u0_boundary(x, on_boundary): return on_boundary mesh = UnitSquareMesh(N,N) # Load mesh and subdomains h_vec = [] err_vec = [] for refIndex in xrange(numRefs): h = CellSize(mesh)
from dolfin import * import helper_functions as help import helper_confusion as chelp import sys, getopt #print 'Number of arguments:', len(sys.argv), 'arguments.' #print 'Argument List:', str(sys.argv) p = int(help.parseArg('--p', 1)) N = int(help.parseArg('--N', 4)) numRefs = int(help.parseArg('--numRefs', 1)) eps = float(help.parseArg('--eps', 1e-2)) numQRefs = int(help.parseArg('--numQRefs', 4)) print "args = ", [p, N, numRefs, eps, numQRefs] # define problem params beta = Constant(('1.0', '0.0')) ue = chelp.erikkson_solution(eps) def u0_boundary(x, on_boundary): return on_boundary mesh = UnitSquareMesh(N, N) # Load mesh and subdomains h_vec = [] err_vec = [] for refIndex in xrange(numRefs):