Subject: [Fenics] [[email-masked]: [Branch ~dolfin-core/dolfin/main] Rev 5154: Change from a(v, u) to a(u, v) in all documented pde demos. Have not]

From: Anders Logg <[email-masked]>
Date: Wed, 1 Sep 2010 21:19:24 +0200

Can't you just run the script

  utils/copy_demos.sh

That should copy everything. Or am I missing something?

--
Anders

Subject: [Branch ~dolfin-core/dolfin/main] Rev 5154: Change from a(v, u) to a(u, v) in all documented pde demos. Have not
From: [email-masked]
To: Anders Logg <[email-masked]>
Date: Wed, 01 Sep 2010 19:11:21 -0000

------------------------------------------------------------
revno: 5154
committer: Marie E. Rognes <[email-masked]>
branch nick: dolfin-test
timestamp: Wed 2010-09-01 21:09:26 +0200
message:
  Change from a(v, u) to a(u, v) in all documented pde demos. Have not
  regenerated .h/.cpp files.
  
  If someone copies these to the fenics-doc, I will make sure that the
  documentation matches.
modified:
  demo/pde/biharmonic/cpp/Biharmonic.ufl
  demo/pde/biharmonic/python/demo.py
  demo/pde/cahn-hilliard/cpp/CahnHilliard2D.cpp
  demo/pde/cahn-hilliard/cpp/CahnHilliard2D.ufl
  demo/pde/cahn-hilliard/cpp/CahnHilliard3D.cpp
  demo/pde/cahn-hilliard/cpp/CahnHilliard3D.ufl
  demo/pde/cahn-hilliard/python/demo.py
  demo/pde/hyperelasticity/cpp/HyperElasticity.ufl
  demo/pde/hyperelasticity/python/demo.py
  demo/pde/navier-stokes/cpp/PressureUpdate.ufl
  demo/pde/navier-stokes/cpp/TentativeVelocity.ufl
  demo/pde/navier-stokes/cpp/VelocityUpdate.ufl
  demo/pde/poisson/cpp/Poisson.ufl
  demo/pde/poisson/python/demo.py

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

Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
=== modified file 'demo/pde/biharmonic/cpp/Biharmonic.ufl'
--- demo/pde/biharmonic/cpp/Biharmonic.ufl	2010-08-31 23:13:38 +0000
+++ demo/pde/biharmonic/cpp/Biharmonic.ufl	2010-09-01 19:09:26 +0000
@@ -3,9 +3,9 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2009-06-26
-# Last changed: 2009-06-26
+# Last changed: 2010-09-01
 #
-# The bilinear form a(v, u) and linear form L(v) for
+# The bilinear form a(u, v) and linear form L(v) for
 # Biharmonic equation in a discontinuous Galerkin (DG)
 # formulation.
 #
@@ -14,9 +14,9 @@
 # Elements
 element = FiniteElement("Lagrange", triangle, 2)
 
-# Test and trial functions
+# Trial and test functions
+u = TrialFunction(element)
 v = TestFunction(element)
-u = TrialFunction(element)
 f = Coefficient(element)
 
 # Normal component, mesh size and right-hand side
@@ -28,10 +28,10 @@
 alpha = Constant(triangle)
 
 # Bilinear form
-a = inner(div(grad(v)), div(grad(u)))*dx \
-  - inner(avg(div(grad(v))), jump(grad(u), n))*dS \
-  - inner(jump(grad(v), n), avg(div(grad(u))))*dS \
-  + alpha('+')/h_avg*inner(jump(grad(v),n), jump(grad(u),n))*dS
+a = inner(div(grad(u)), div(grad(v)))*dx \
+  - inner(avg(div(grad(u))), jump(grad(v), n))*dS \
+  - inner(jump(grad(u), n), avg(div(grad(v))))*dS \
+  + alpha('+')/h_avg*inner(jump(grad(u), n), jump(grad(v),n))*dS
 
 # Linear form
-L = v*f*dx
+L = f*v*dx

=== modified file 'demo/pde/biharmonic/python/demo.py'
--- demo/pde/biharmonic/python/demo.py	2010-09-01 16:18:18 +0000
+++ demo/pde/biharmonic/python/demo.py	2010-09-01 19:09:26 +0000
@@ -44,9 +44,9 @@
 u0 = Constant(0.0)
 bc = DirichletBC(V, u0, DirichletBoundary())
 
-# Define test and trial functions
+# Define trial and test functions
+u = TrialFunction(V)
 v = TestFunction(V)
-u = TrialFunction(V)
 
 # Define normal component, mesh size and right-hand side
 h = CellSize(mesh)
@@ -58,13 +58,13 @@
 alpha = Constant(8.0)
 
 # Define bilinear form
-a = inner(div(grad(v)), div(grad(u)))*dx \
-  - inner(avg(div(grad(v))), jump(grad(u), n))*dS \
-  - inner(jump(grad(v), n), avg(div(grad(u))))*dS \
-  + alpha('+')/h_avg*inner(jump(grad(v),n), jump(grad(u),n))*dS
+a = inner(div(grad(u)), div(grad(v)))*dx \
+  - inner(avg(div(grad(u))), jump(grad(v), n))*dS \
+  - inner(jump(grad(u), n), avg(div(grad(v))))*dS \
+  + alpha('+')/h_avg*inner(jump(grad(u),n), jump(grad(v),n))*dS
 
 # Define linear form
-L = v*f*dx
+L = f*v*dx
 
 # Create variational problem and solve
 problem = VariationalProblem(a, L, bc)

=== modified file 'demo/pde/cahn-hilliard/cpp/CahnHilliard2D.cpp'
--- demo/pde/cahn-hilliard/cpp/CahnHilliard2D.cpp	2010-08-31 22:27:39 +0000
+++ demo/pde/cahn-hilliard/cpp/CahnHilliard2D.cpp	2010-09-01 19:09:26 +0000
@@ -3677,7 +3677,7 @@
     {0.188409405952072, 0.023931132287081, 0.787659461760847},
     {0.455706020243648, 0.455706020243648, 0.088587959512704},
     {0.295266567779633, 0.295266567779633, 0.409466864440735},
-    {0.106170269119576, 0.106170269119577, 0.787659461760847},
+    {0.106170269119577, 0.106170269119577, 0.787659461760847},
     {0.102717654809626, 0.808694385677670, 0.088587959512704},
     {0.066554067839164, 0.523979067720101, 0.409466864440735},
     {0.023931132287081, 0.188409405952072, 0.787659461760847}};
@@ -3866,7 +3866,7 @@
     {0.188409405952072, 0.023931132287081, 0.787659461760847},
     {0.455706020243648, 0.455706020243648, 0.088587959512704},
     {0.295266567779633, 0.295266567779633, 0.409466864440735},
-    {0.106170269119576, 0.106170269119577, 0.787659461760847},
+    {0.106170269119577, 0.106170269119577, 0.787659461760847},
     {0.102717654809626, 0.808694385677670, 0.088587959512704},
     {0.066554067839164, 0.523979067720101, 0.409466864440735},
     {0.023931132287081, 0.188409405952072, 0.787659461760847}};

=== modified file 'demo/pde/cahn-hilliard/cpp/CahnHilliard2D.ufl'
--- demo/pde/cahn-hilliard/cpp/CahnHilliard2D.ufl	2010-09-01 17:13:12 +0000
+++ demo/pde/cahn-hilliard/cpp/CahnHilliard2D.ufl	2010-09-01 19:09:26 +0000
@@ -2,9 +2,9 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2006
-# Last changed: 2010-08-31
+# Last changed: 2010-09-01
 #
-# The linearised bilinear form a(v, u) and linear form L(v) for
+# The linearised bilinear form a(du, v) and linear form L(v) for
 # the Cahn-Hilliard equation.
 #
 # Compile this form with FFC: ffc -l dolfin -O -f split CahnHilliard2D.ufl
@@ -12,8 +12,8 @@
 P1 = FiniteElement("Lagrange", "triangle", 1)
 ME = P1*P1
 
+du   = TrialFunction(ME)
 q, v = TestFunctions(ME)
-du   = TrialFunction(ME)
 
 u   = Coefficient(ME)  # current solution
 u0  = Coefficient(ME)  # solution from previous converged step
@@ -35,8 +35,8 @@
 f    = 100*c**2*(1-c)**2
 dfdc = diff(f, c)
 
-L0 = q*c*dx  - q*c0*dx   + dt*dot(grad(q), grad(mu_mid))*dx
-L1 = v*mu*dx - v*dfdc*dx - lmbda*dot(grad(v), grad(c))*dx
+L0 = c*q*dx  - c0*q*dx   + dt*dot(grad(mu_mid), grad(q))*dx
+L1 = mu*v*dx - dfdc*v*dx - lmbda*dot(grad(c), grad(v))*dx
 L = L0 + L1
 
 a = derivative(L, u, du)

=== modified file 'demo/pde/cahn-hilliard/cpp/CahnHilliard3D.cpp'
--- demo/pde/cahn-hilliard/cpp/CahnHilliard3D.cpp	2010-08-31 22:27:39 +0000
+++ demo/pde/cahn-hilliard/cpp/CahnHilliard3D.cpp	2010-09-01 19:09:26 +0000
@@ -5171,7 +5171,7 @@
     {0.238563056650491, 0.030301481174276, 0.026133252286735, 0.705002209888498},
     {0.485731727037113, 0.061696018609146, 0.379578230280591, 0.072994024073150},
     {0.342156357895961, 0.043459555653802, 0.267380320411884, 0.347003766038352},
-    {0.154572667042115, 0.019633302935485, 0.120791820133903, 0.705002209888498},
+    {0.154572667042115, 0.019633302935485, 0.120791820133902, 0.705002209888498},
     {0.174656645238399, 0.022184302640820, 0.730165028047632, 0.072994024073150},
     {0.123030632529655, 0.015626939257902, 0.514338662174092, 0.347003766038352},
     {0.055580358392082, 0.007059631139555, 0.232357800579865, 0.705002209888498},
@@ -5183,13 +5183,13 @@
     {0.087102984988800, 0.087102984988800, 0.120791820133902, 0.705002209888498},
     {0.098420473939609, 0.098420473939609, 0.730165028047632, 0.072994024073150},
     {0.069328785893778, 0.069328785893778, 0.514338662174092, 0.347003766038352},
-    {0.031319994765818, 0.031319994765819, 0.232357800579865, 0.705002209888498},
+    {0.031319994765819, 0.031319994765819, 0.232357800579865, 0.705002209888498},
     {0.095219879841715, 0.749664528221693, 0.082121567863443, 0.072994024073150},
-    {0.067074241752058, 0.528074388273447, 0.057847603936143, 0.347003766038352},
+    {0.067074241752059, 0.528074388273447, 0.057847603936143, 0.347003766038352},
     {0.030301481174276, 0.238563056650491, 0.026133252286735, 0.705002209888498},
     {0.061696018609146, 0.485731727037113, 0.379578230280591, 0.072994024073150},
     {0.043459555653802, 0.342156357895961, 0.267380320411884, 0.347003766038352},
-    {0.019633302935484, 0.154572667042115, 0.120791820133903, 0.705002209888498},
+    {0.019633302935485, 0.154572667042115, 0.120791820133902, 0.705002209888498},
     {0.022184302640820, 0.174656645238399, 0.730165028047632, 0.072994024073150},
     {0.015626939257902, 0.123030632529655, 0.514338662174092, 0.347003766038352},
     {0.007059631139555, 0.055580358392082, 0.232357800579865, 0.705002209888498}};
@@ -5467,7 +5467,7 @@
     {0.238563056650491, 0.030301481174276, 0.026133252286735, 0.705002209888498},
     {0.485731727037113, 0.061696018609146, 0.379578230280591, 0.072994024073150},
     {0.342156357895961, 0.043459555653802, 0.267380320411884, 0.347003766038352},
-    {0.154572667042115, 0.019633302935485, 0.120791820133903, 0.705002209888498},
+    {0.154572667042115, 0.019633302935485, 0.120791820133902, 0.705002209888498},
     {0.174656645238399, 0.022184302640820, 0.730165028047632, 0.072994024073150},
     {0.123030632529655, 0.015626939257902, 0.514338662174092, 0.347003766038352},
     {0.055580358392082, 0.007059631139555, 0.232357800579865, 0.705002209888498},
@@ -5479,13 +5479,13 @@
     {0.087102984988800, 0.087102984988800, 0.120791820133902, 0.705002209888498},
     {0.098420473939609, 0.098420473939609, 0.730165028047632, 0.072994024073150},
     {0.069328785893778, 0.069328785893778, 0.514338662174092, 0.347003766038352},
-    {0.031319994765818, 0.031319994765819, 0.232357800579865, 0.705002209888498},
+    {0.031319994765819, 0.031319994765819, 0.232357800579865, 0.705002209888498},
     {0.095219879841715, 0.749664528221693, 0.082121567863443, 0.072994024073150},
-    {0.067074241752058, 0.528074388273447, 0.057847603936143, 0.347003766038352},
+    {0.067074241752059, 0.528074388273447, 0.057847603936143, 0.347003766038352},
     {0.030301481174276, 0.238563056650491, 0.026133252286735, 0.705002209888498},
     {0.061696018609146, 0.485731727037113, 0.379578230280591, 0.072994024073150},
     {0.043459555653802, 0.342156357895961, 0.267380320411884, 0.347003766038352},
-    {0.019633302935484, 0.154572667042115, 0.120791820133903, 0.705002209888498},
+    {0.019633302935485, 0.154572667042115, 0.120791820133902, 0.705002209888498},
     {0.022184302640820, 0.174656645238399, 0.730165028047632, 0.072994024073150},
     {0.015626939257902, 0.123030632529655, 0.514338662174092, 0.347003766038352},
     {0.007059631139555, 0.055580358392082, 0.232357800579865, 0.705002209888498}};

=== modified file 'demo/pde/cahn-hilliard/cpp/CahnHilliard3D.ufl'
--- demo/pde/cahn-hilliard/cpp/CahnHilliard3D.ufl	2010-09-01 17:13:12 +0000
+++ demo/pde/cahn-hilliard/cpp/CahnHilliard3D.ufl	2010-09-01 19:09:26 +0000
@@ -2,9 +2,9 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2006
-# Last changed: 2010-08-31
+# Last changed: 2010-09-01
 #
-# The linearised bilinear form a(v, u) and linear form L(v) for
+# The linearised bilinear form a(du, v) and linear form L(v) for
 # the Cahn-Hilliard equation.
 #
 # Compile this form with FFC: ffc -l dolfin -O -f split CahnHilliard3D.ufl
@@ -12,8 +12,8 @@
 P1 = FiniteElement("Lagrange", "tetrahedron", 1)
 ME = P1*P1
 
+du   = TrialFunction(ME)
 q, v = TestFunctions(ME)
-du   = TrialFunction(ME)
 
 u   = Coefficient(ME)  # current solution
 u0  = Coefficient(ME)  # solution from previous converged step
@@ -35,8 +35,8 @@
 f    = 100*c**2*(1-c)**2
 dfdc = diff(f, c)
 
-L0 = q*c*dx  - q*c0*dx   + dt*dot(grad(q), grad(mu_mid))*dx
-L1 = v*mu*dx - v*dfdc*dx - lmbda*dot(grad(v), grad(c))*dx
+L0 = c*q*dx  - c0*q*dx   + dt*dot(grad(mu_mid), grad(q))*dx
+L1 = mu*v*dx - dfdc*v*dx - lmbda*dot(grad(c), grad(v))*dx
 L = L0 + L1
 
 a = derivative(L, u, du)

=== modified file 'demo/pde/cahn-hilliard/python/demo.py'
--- demo/pde/cahn-hilliard/python/demo.py	2010-08-31 22:27:39 +0000
+++ demo/pde/cahn-hilliard/python/demo.py	2010-09-01 19:09:26 +0000
@@ -48,9 +48,9 @@
 V = FunctionSpace(mesh, "Lagrange", 1)
 ME = V*V
 
-# Define test and trial functions
+# Define trial and test functions
+du    = TrialFunction(ME)
 q, v  = TestFunctions(ME)
-du    = TrialFunction(ME)
 
 # Define functions
 u   = Function(ME)  # current solution

=== modified file 'demo/pde/hyperelasticity/cpp/HyperElasticity.ufl'
--- demo/pde/hyperelasticity/cpp/HyperElasticity.ufl	2010-08-31 14:41:10 +0000
+++ demo/pde/hyperelasticity/cpp/HyperElasticity.ufl	2010-09-01 19:09:26 +0000
@@ -2,9 +2,9 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2009-09-29
-# Last changed: 2010-08-21
+# Last changed: 2010-09-01
 #
-# The bilinear form a(v, u) and linear form L(v) for
+# The bilinear form a(du, v) and linear form L(v) for
 # a hyperelastic model.
 #
 # Compile this form with FFC: ffc -l dolfin -feliminate_zeros -fprecompute_basis_const -fprecompute_ip_const HyperElasticity.ufl
@@ -12,9 +12,9 @@
 # Function spaces
 element = VectorElement("Lagrange", "tetrahedron", 1)
 
-# Test and trial functions
+# Trial and test functions
+du = TrialFunction(element)     # Incremental displacement
 v  = TestFunction(element)      # Test function
-du = TrialFunction(element)     # Incremental displacement
 
 # Functions
 u  = Coefficient(element)       # Displacement from previous iteration

=== modified file 'demo/pde/hyperelasticity/python/demo.py'
--- demo/pde/hyperelasticity/python/demo.py	2010-08-31 21:39:02 +0000
+++ demo/pde/hyperelasticity/python/demo.py	2010-09-01 19:09:26 +0000
@@ -38,8 +38,8 @@
 bcr = DirichletBC(V, r, right)
 
 # Define functions
+du = TrialFunction(V)            # Incremental displacement
 v  = TestFunction(V)             # Test function
-du = TrialFunction(V)            # Incremental displacement
 u  = Function(V)                 # Displacement from previous iteration
 B  = Constant((0.0, -0.5, 0.0))  # Body force per unit mass
 T  = Constant((0.1,  0.0, 0.0))  # Traction force on the boundary

=== modified file 'demo/pde/navier-stokes/cpp/PressureUpdate.ufl'
--- demo/pde/navier-stokes/cpp/PressureUpdate.ufl	2010-08-31 19:13:39 +0000
+++ demo/pde/navier-stokes/cpp/PressureUpdate.ufl	2010-09-01 19:09:26 +0000
@@ -2,9 +2,9 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2010-08-30
-# Last changed: 2010-08-31
+# Last changed: 2010-09-01
 #
-# The bilinear form a(v, u) and linear form L(v) for the pressure
+# The bilinear form a(u, v) and linear form L(v) for the pressure
 # update step in Chorin's method for the incompressible Navier-Stokes
 # equations.
 #

=== modified file 'demo/pde/navier-stokes/cpp/TentativeVelocity.ufl'
--- demo/pde/navier-stokes/cpp/TentativeVelocity.ufl	2010-08-31 19:13:39 +0000
+++ demo/pde/navier-stokes/cpp/TentativeVelocity.ufl	2010-09-01 19:09:26 +0000
@@ -2,9 +2,9 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2010-08-30
-# Last changed: 2010-08-31
+# Last changed: 2010-09-01
 #
-# The bilinear form a(v, u) and linear form L(v) for the tentative
+# The bilinear form a(u, v) and linear form L(v) for the tentative
 # velocity step in Chorin's method for the incompressible
 # Navier-Stokes equations.
 #

=== modified file 'demo/pde/navier-stokes/cpp/VelocityUpdate.ufl'
--- demo/pde/navier-stokes/cpp/VelocityUpdate.ufl	2010-08-31 19:13:39 +0000
+++ demo/pde/navier-stokes/cpp/VelocityUpdate.ufl	2010-09-01 19:09:26 +0000
@@ -2,9 +2,9 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2010-08-30
-# Last changed: 2010-08-31
+# Last changed: 2010-09-01
 #
-# The bilinear form a(v, u) and linear form L(v) for the velocity
+# The bilinear form a(u, v) and linear form L(v) for the velocity
 # update step in Chorin's method for the incompressible Navier-Stokes
 # equations.
 #

=== modified file 'demo/pde/poisson/cpp/Poisson.ufl'
--- demo/pde/poisson/cpp/Poisson.ufl	2010-01-02 16:26:46 +0000
+++ demo/pde/poisson/cpp/Poisson.ufl	2010-09-01 19:09:26 +0000
@@ -2,19 +2,19 @@
 # Licensed under the GNU LGPL Version 2.1.
 #
 # First added:  2005
-# Last changed: 2009-09-08
+# Last changed: 2010-09-01
 #
-# The bilinear form a(v, u) and linear form L(v) for
+# The bilinear form a(u, v) and linear form L(v) for
 # Poisson's equation.
 #
 # Compile this form with FFC: ffc -l dolfin Poisson.ufl.
 
 element = FiniteElement("Lagrange", triangle, 1)
 
+u = TrialFunction(element)
 v = TestFunction(element)
-u = TrialFunction(element)
 f = Coefficient(element)
 g = Coefficient(element)
 
-a = inner(grad(v), grad(u))*dx
-L = v*f*dx + v*g*ds
+a = inner(grad(u), grad(v))*dx
+L = f*v*dx + g*v*ds

=== modified file 'demo/pde/poisson/python/demo.py'
--- demo/pde/poisson/python/demo.py	2010-08-31 21:39:02 +0000
+++ demo/pde/poisson/python/demo.py	2010-09-01 19:09:26 +0000
@@ -34,12 +34,12 @@
 bc = DirichletBC(V, u0, boundary)
 
 # Define variational problem
+u = TrialFunction(V)
 v = TestFunction(V)
-u = TrialFunction(V)
 f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)")
 g = Expression("sin(5*x[0])")
-a = inner(grad(v), grad(u))*dx
-L = v*f*dx + v*g*ds
+a = inner(grad(u), grad(v))*dx
+L = f*v*dx + g*v*ds
 
 # Compute solution
 problem = VariationalProblem(a, L, bc)

---

From: Marie Rognes <[email-masked]>
Date: Wed, 01 Sep 2010 21:20:00 +0200

> That should copy everything. Or am I missing something?

I am not sure if I dare.

--
Marie

---

From: Anders Logg <[email-masked]>
Date: Wed, 1 Sep 2010 21:28:51 +0200

> > That should copy everything. Or am I missing something?

I wrote the script. It should be safe. ;-)

--
Anders

---

From: Marie Rognes <[email-masked]>
Date: Wed, 01 Sep 2010 21:30:05 +0200

> I wrote the script. It should be safe. ;-)

Oh, _that_ changes everything ;) 

--
Marie