← Back to team overview

dolfin team mailing list archive

[noreply@xxxxxxxxxxxxx: [Branch ~dolfin-core/dolfin/rognes] Rev 5758: Workaround UFL subdomains bug. Python and cpp navier-stokes match.]

 

!
--- Begin Message ---
------------------------------------------------------------
revno: 5758
committer: Marie E. Rognes <meg@xxxxxxxxx>
branch nick: dolfin
timestamp: Sun 2011-03-13 23:57:41 +0100
message:
  Workaround UFL subdomains bug. Python and cpp navier-stokes match.
modified:
  demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py
  site-packages/dolfin/fem/formmanipulations.py
  site-packages/dolfin/fem/variationalproblem.py


--
lp:~dolfin-core/dolfin/rognes
https://code.launchpad.net/~dolfin-core/dolfin/rognes

Your team DOLFIN Core Team is subscribed to branch lp:~dolfin-core/dolfin/rognes.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/rognes/+edit-subscription
=== modified file 'demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py'
--- demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py	2011-03-13 11:27:15 +0000
+++ demo/undocumented/auto-adaptive-navier-stokes/python/demo_auto-adaptive-navier-stokes.py	2011-03-13 22:57:41 +0000
@@ -60,6 +60,7 @@
 M.exterior_facet_domains = outflow_markers;
 
 pde.parameters["adaptivity"]["reference"] = 0.40863917;
+pde.parameters["adaptivity"]["plot_mesh"] = False;
 
 # Solve to given tolerance
 tol = 1.e-05

=== modified file 'site-packages/dolfin/fem/formmanipulations.py'
--- site-packages/dolfin/fem/formmanipulations.py	2011-01-11 07:05:35 +0000
+++ site-packages/dolfin/fem/formmanipulations.py	2011-03-13 22:57:41 +0000
@@ -1,11 +1,20 @@
 import ufl
 from dolfin import FunctionSpace, MixedFunctionSpace, TrialFunction
 
-__all__ = ["derivative", "increase_order", "tear"]
+__all__ = ["derivative", "increase_order", "tear",
+           "assign_domains"]
+
+def assign_domains(fro=None, to=None):
+    # Remove me if this gets added to UFL instead.
+    to.cell_domains = fro.cell_domains
+    to.interior_facet_domains = fro.interior_facet_domains
+    to.exterior_facet_domains = fro.exterior_facet_domains
 
 def derivative(form, u, du=None):
     if du is None:
         du = TrialFunction(u.function_space())
+    a = ufl.derivative(form, u, du)
+    assign_domains(fro=form, to=a)
     return ufl.derivative(form, u, du)
 
 def increase_order(V):

=== modified file 'site-packages/dolfin/fem/variationalproblem.py'
--- site-packages/dolfin/fem/variationalproblem.py	2011-03-11 10:06:29 +0000
+++ site-packages/dolfin/fem/variationalproblem.py	2011-03-13 22:57:41 +0000
@@ -129,10 +129,14 @@
         module = __import__("dolfin.fem.formmanipulations")
 
         (a_star, L_star) = generate_dual_forms(forms, u, module)
+        module.assign_domains(fro=bilinear, to=a_star) # FIXME: Check cpp
+        module.assign_domains(fro=goal, to=L_star)
+
         if self.is_linear:
             weak_residual = generate_weak_residual((bilinear, linear), u)
         else:
             weak_residual = generate_weak_residual(linear)
+        module.assign_domains(fro=linear, to=weak_residual) # NB
 
         V = u.function_space()
         mesh = V.mesh()
@@ -141,8 +145,9 @@
         E = module.increase_order(V)
         Ez_h = Function(E)
 
-        # Generate error estimate (residual) (# FIXME: Add option here)
+        # Generate error estimate (residual)
         eta_h = dolfin.action(weak_residual, Ez_h)
+        module.assign_domains(fro=weak_residual, to=eta_h)
 
         # Define approximation space for cell and facet residuals
         V_h = module.tear(V)
@@ -152,6 +157,7 @@
         b_T = Function(B)
         b_T.vector()[:] = 1.0
         a_R_T, L_R_T = generate_cell_residual(weak_residual, V_h, b_T, module)
+        module.assign_domains(fro=weak_residual, to=L_R_T)
 
         # Generate facet residual stuff
         R_T = Function(V_h)
@@ -159,6 +165,7 @@
         b_e = Function(C)
         a_R_dT, L_R_dT = generate_facet_residual(weak_residual, V_h, b_e, R_T,
                                                  module)
+        module.assign_domains(fro=weak_residual, to=L_R_dT)
 
         # Generate error indicators (# FIXME: Add option here)
         R_dT = Function(V_h)


--- End Message ---

Follow ups