1) Does this region line up with cells of your mesh? If so, my normal way is to interpolate that expression into a P0 function: P0 = Function(mesh, "DG", 0) f = Function(P0) f.interpolate(Expression("(x[0] >= 0.25 && x[0] <= 0.30 && x[1] >= 0.25 && x[1] <= 0.30) ? 1.0 : 0.0")) and then use f in calculations. 2) Pass, someone else can answer this 3) "Yes", but can you be more specific? SUPG is just modifying the test function, so my code looked something like ... u = ... alpha = ... phi = TestFunction(V) phiSUPG = phi + alpha*dot(u, grad(phi)) a = phiSUPG*....*dx + .... On 31 August 2015 at 22:31, Justin Chang <jychang48@gmail.com> wrote:
Hi all,
1) How do I define a volumetric source/sink for a specific region? For example, if I am solving a diffusion equation with homogeneous BCs and have a volumetric source f(x,y) such that
if (x[0] >= 0.25 && x[0] <= 0.30 && x[1] >= 0.25 && x[1] <= 0.30): f == 1 else: f == 0
2) I want to play around with PETSc's Variational Inequality <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/SNES/SNESVINEWTONSSLS.html> solver. In my own PETSc code all I had to do was provide a Jacobian matrix, a residual vector, pass in the options -snes_type vinewtonssls (or it might be vinewotnrsls), and pass in SNESVINEWTONSSLS <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/SNES/SNESVINEWTONSSLS.html> . From my last discussion with some PETSc folks it seems this VI feature is relatively now, so I was wondering if that last item can be invoked through the version of petsc4py you guys are using?
3) Is it possible to employ the SUPG formulation for advection-diffusion problems in firedrake?
Thanks, Justin
participants (1)
- 
                
                Andrew McRae