How to compute displacement and strain at an arbitrary location

Hi guys,

I know this is a basic question but can anyone tell me what is the function/code snippet to compute the nodal (displacement) and element (strain, stress) property at an arbitrary location (which may not be a mesh node) on the structure?

If you project the stress/strain into a suitable function space, you can use the point evaluation method part of Function to evaluate at any point.
See for instance: Bitbucket

Thanks for the reply. I use that. I also found this code

    strain_gauges = [
        Point(0.03, 0.03),
        Point(0.12, 0.12)
    ]

    strain = 0.5 * (grad(u) + grad(u).T)
    [s00,s01,s10,s11] = strain.split(True)
    print(s00(strain_gauges[0]))

Does this also work?

Where did you find this code?
If you simply try to run it:

from dolfin import *

mesh = UnitSquareMesh(10, 10)
V = VectorFunctionSpace(mesh, "CG", 1)
u = Function(V)

train_gauges = [
        Point(0.03, 0.03),
        Point(0.12, 0.12)
    ]

strain = 0.5 * (grad(u) + grad(u).T)

[s00,s01,s10,s11] = strain.split(True)
print(s00(strain_gauges[0]))

you obtain the following error message:

Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
  File "split_ufl.py", line 14, in <module>
    [s00,s01,s10,s11] = strain.split(True)
AttributeError: 'ComponentTensor' object has no attribute 'split'

as you need to project the ufl expression into a suitable function space.