postanimate for variables in the custom functions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

postanimate for variables in the custom functions

James
postanimate in featool is a nice function. I would like to use it for some variables in my custom functions. The time- and space-dependent datasets for these variables cannot be found in fea, and the coordinates from custom functions are different from those in fea.grid.p. Is there any solution to apply postanimate to custom-function variables?
Reply | Threaded
Open this post in threaded view
|

Re: postanimate for variables in the custom functions

Precise Simulation
Administrator
James wrote
postanimate in featool is a nice function. I would like to use it for some variables in my custom functions. The time- and space-dependent datasets for these variables cannot be found in fea, and the coordinates from custom functions are different from those in fea.grid.p. Is there any solution to apply postanimate to custom-function variables?
If your simulation output is correct, the solutions will always be stored in the "fea.sol" field, with solution vector in "fea.sol.u" (rows corresponding to degrees of freedom, and columns to time), and list of corresponding times in "fea.sol.t". Then you plot a custom function of the solution and time as

  postanim( fea, 'surfexpr', 'myfun(x,y,u,t)' )

where 'u' is the name of the dependent variable. In the "myfun" call x, y, u will then correspond to arrays evaluated in the numerical quadrature (intergration) points, and 't' the current time. If your 'myfun' function is expects nodal corrdinates you will currently have to perform interpolation to match them.