Calculating gradient on a "Finley_Elements on FinleyMesh"

Asked by Sebastian Langer

Hi everyone,

how can I calculate a gradient using grad on a variable of the FunctionSpace "Finley_Elements on FinleyMesh "?

It returns the following error:

  File "escript/py_src/util.py", line 5602, in grad
RuntimeError: FinleyAdapterException: Finley_Assemble_gradient: Cannot calculate gradient of data because of unsuitable input data representation.

Sebastian

Question information

Language:
English Edit question
Status:
Solved
For:
esys-escript Edit question
Assignee:
No assignee Edit question
Solved by:
Lutz Gross
Solved:
Last query:
Last reply:
Revision history for this message
Best Lutz Gross (l-gross) said :
#1

Obviously Finley does not allow calculation of gradients from data with Function() attribute. Reason is : it assumed that these data are representing a discontinuous function. If you believe that it is still reasonable to calculate the gradient you need to smmooth the data. A common way to do this is using a projector:

  from esys.escript.pdetools import Projector

  assert mydata.getFunctionSpace() == Function( mydata.getDomain())
  proj=Projector(mydata.getDomain())
  mysmoothdata=proj(mydata)

  This approach solves the PDE: (D=1.)*(u=mysmoothdata) = (Y=mydata)

Revision history for this message
Sebastian Langer (s-langer) said :
#2

Thanks Lutz Gross, that solved my question.

Revision history for this message
Sebastian Langer (s-langer) said :
#3

Works like a charm!

Cheers, Sebastian