← Back to team overview

dolfin team mailing list archive

Re: Status of new Expression interface

 

On Thu, Nov 26, 2009 at 09:42:22PM +0000, Harish Narayanan wrote:
> Anders Logg wrote:
> > Looks like the new Expression interface might be working now but more
> > tests are needed. Please help out getting all the demos over to the
> > new interface.
> >
> > The changes to the interface are as follows:
> >
> > 1. V=V argument in Expression should be removed
> >
> > 2. mesh argument in Constant should be removed
> >
> > 3. Subclasses of Expression overloading eval must overload dim if not
> > scalar
> >
> > The Poisson and elasticity demos have been moved and both work.
>
> Attached a patch (I think) cleaning up the hyperelasticity demo.
>
> Harish

I applied it, using

 bzr pull <your-bundle>.bzr

Is it possible to verify that the blob in the end after # begin bundle
does what the patch text seems to indicate and that it doesn't inject
some harmful code?

--
Anders



> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: hnarayanan@xxxxxxxxx-20091126213524-01lfutt4pk7fz7c4
> # target_branch: bzr+ssh://bazaar.launchpad.net/~dolfin-\
> #   core/dolfin/main/
> # testament_sha1: 0211fe69b173e5afe7620f71c063b61f4b8c1056
> # timestamp: 2009-11-26 21:40:47 +0000
> # base_revision_id: logg@xxxxxxxxx-20091126211643-x3c3h07gz7kbd3k1
> #
> # Begin patch
> === modified file 'demo/pde/hyperelasticity/python/demo.py'
> --- demo/pde/hyperelasticity/python/demo.py	2009-10-12 08:20:23 +0000
> +++ demo/pde/hyperelasticity/python/demo.py	2009-11-26 21:35:24 +0000
> @@ -1,14 +1,13 @@
> -""" This demo program solves a hyperelastic problem
> -
> -Implemented in python from cpp demo by Johan Hake.
> -
> -"""
> +""" This demo program solves a hyperelastic problem. It is implemented
> +in Python by Johan Hake following the C++ demo by Harish Narayanan"""
>
>  __author__ = "Johan Hake (hake@xxxxxxxxx)"
>  __date__ = "2009-10-11 -- 2009-10-11"
>  __copyright__ = "Copyright (C) 2008 Johan Hake"
>  __license__  = "GNU LGPL Version 2.1"
>
> +# Modified by Harish Narayanan, 2009.
> +
>  from dolfin import *
>
>  # Optimize compilation of the form
> @@ -23,11 +22,11 @@
>  V = VectorFunctionSpace(mesh, "CG", 1)
>
>  # Define Dirichlet boundary (x = 0 or x = 1)
> -c = Expression(("0.0", "0.0", "0.0"), V = V)
> +c = Expression(("0.0", "0.0", "0.0"))
>  r = Expression(("0.0",
>                  "y0 + (x[1] - y0) * cos(theta) - (x[2] - z0) * sin(theta) - x[1]",
>                  "z0 + (x[1] - y0) * sin(theta) + (x[2] - z0) * cos(theta) - x[2]"),
> -                defaults = dict(y0 = 0.5, z0 = 0.5, theta = pi / 3), V = V)
> +                defaults = dict(y0 = 0.5, z0 = 0.5, theta = pi / 3))
>
>  left, right = compile_subdomains(["(fabs(x[0]) < DOLFIN_EPS) && on_boundary",
>                                    "(fabs(x[0] - 1.0) < DOLFIN_EPS) && on_boundary"])
> @@ -39,8 +38,8 @@
>  v  = TestFunction(V)      # Test function
>  du = TrialFunction(V)     # Incremental displacement
>  u  = Function(V)          # Displacement from previous iteration
> -B  = Expression(("0.0", "0.0", "0.0"), V = V)          # Body force per unit mass
> -T  = Expression(("0.0", "0.0", "0.0"), V = V)          # Traction force on the boundary
> +B  = Expression(("0.0", "0.0", "0.0"))          # Body force per unit mass
> +T  = Expression(("0.0", "0.0", "0.0"))          # Traction force on the boundary
>
>  # Kinematics
>  I = Identity(v.cell().d)        # Identity tensor
> @@ -53,8 +52,8 @@
>  Em = 10.0
>  nu = 0.3
>
> -mu    = Constant(mesh, Em / (2*(1 + nu))) # Lame's constants
> -lmbda = Constant(mesh, Em * nu / ((1 + nu) * (1 - 2 * nu)));
> +mu    = Constant(Em / (2*(1 + nu))) # Lame's constants
> +lmbda = Constant(Em * nu / ((1 + nu) * (1 - 2 * nu)))
>
>  # Strain energy function (material model)
>  psi = lmbda/2*(tr(E)**2) + mu*tr(E*E)
> @@ -75,4 +74,4 @@
>  file << u;
>
>  # Plot and hold solution
> -plot(u, interactive = True)
> +plot(u, mode = "displacement", interactive = True)
>
> # Begin bundle
> IyBCYXphYXIgcmV2aXNpb24gYnVuZ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pHRdApxBjKqT3Y4WqTceNGK7ra0T1UGiyCOBzsCXlR1M0TCwk
> lS1TaK6qgbU4RUPpiXmOrSUNNEw52r06c+yjZBHImFtFMaleh+S9Umitq16UzhVGGIQb07juGmzx
> XTA36UGmJtZmz68v0myjMsUoKBXpBq26BGEfaJ88M8pUgcp8y5hdhz2U08IdqbEW5ajEOKWwKQpc
> PeFDkVr5zcfAVeMKX1qVZNH6E7isxfolsgqJEiq87KZhUSkStZEBpJmdkzIZJouI2pNMFrRZQ4Tf
> AIhNUwykMmd1QEFosWzaDrasAf8v5aE/531ZbwNRdeydkdf7UajAKUdrq3VvfPbkzL2gQ+xO/kLP
> HfZu8wnK96f48OAcV5PeHPTIRAoiQRaFd0SJ3SWVCh6lSjje3qnFS5oB351hArEHGwjF2WwBxNMy
> V5YuVkqhd4OVoZ/1F1dzeoX7zwyKrkPCTEbDkyOKhXQe68tU8wUopk64CvOMA+XopaWiHdffbbMK
> utW6An1r4BBWclc+renM/osBHA9pGjOLopaC4/8XckU4UJD+5Xbn

Attachment: signature.asc
Description: Digital signature


Follow ups

References