0
$\begingroup$

I am solving non-linear PDE using iterations. Correspondingly, the coefficients are functions on the (same) mesh that I have created and fixed. Between iterations I need to update these function by doing some arithmetic operations on them. Just doing all in a straightforward way leads to Mathematica being very slow. So, I have to prepare my PDE coefficients in advance by creating new interpolating functions for them. I do this via, for example

ElementMeshInterpolation[oldfunction["ElementMesh"], oldfunction["ValuesOnGrid"]^2]

Is there a smart way to tell Mathematica to create a single interpolating function from arithmetic operations (and derivatives) of several functions on the same grid?

$\endgroup$
4
  • $\begingroup$ oldfunction'["ValuesOnGrid"] gives the values of the derivative on the grid, if you didn't know that. The way you show seems to do what you want. If you use multiple functions, each has to be defined on the same element mesh. If not, evaluate the function on the coordinates of the element mesh that is the basis of the new interpolating function. $\endgroup$
    – Michael E2
    Commented Jul 4 at 16:07
  • 3
    $\begingroup$ Do you perhaps mean to use EvaluateOnElementMesh? $\endgroup$
    – user21
    Commented Jul 4 at 17:39
  • $\begingroup$ Oh, yes! Thank you! EvaluateOnElementMesh answers my question! $\endgroup$ Commented Jul 5 at 18:08
  • $\begingroup$ I did not have this function in my Version 13, will need to update to 14. $\endgroup$ Commented Jul 5 at 18:17

0