time series data

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

time series data

James
Featool multiphysics is really a good CFD software. While I can know the change of a variable with time from a plot in the GUI mode, may I extract the time series data in the .m code for further processing?
I tried using  c_data = { 'x', 'y', 'z','c','t'}; but it seems I can only extract the data at the end time point.
Reply | Threaded
Open this post in threaded view
|

Re: time series data

Precise Simulation
Administrator
You should be able to use the evalexpr function in m-file scripts and on the Matlab command line to evaluate expressions in any point and time:

https://www.featool.com/doc/evalexpr_8m.html
Reply | Threaded
Open this post in threaded view
|

Re: time series data

James
Thank you for your reply. During simulations, can we enforce variables to be greater than or equal to zero (e.g. for variable such as concentration). Although we can do it in the post-processing steps, it should have been done during simulations with time and space. Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: time series data

Precise Simulation
Administrator
James wrote
Thank you for your reply. During simulations, can we enforce variables to be greater than or equal to zero (e.g. for variable such as concentration). Although we can do it in the post-processing steps, it should have been done during simulations with time and space. Thank you.
In the future, please start a new post for unrelated questions/issues.

As for your question, yes, if you try the equations and boundary conditions should accept the same syntax as for postprocessing expressions. However, the solver might not like it as your equation now is quite non-linear and potentially very unstable/oscillating.
Reply | Threaded
Open this post in threaded view
|

Re: time series data

James
In reply to this post by Precise Simulation
I tried to calculate the variable 1 and variable_2 by calling my custom functions, where c is the concentration at all grid points of the test domain.
fea.expr = { 'Variable_1', 'myfun1(c)';'Variable_2', 'myfun2(c)'  };

While I can extract the time series concentration data at every grid point by using evalexpr (see below), can I get the time series data for Variable_1 and Variable_2 at all grid points? Now I have to re-run the custom functions after I have got the time-series data for concentration (c) at all grid points after the featool has run. Thank you!

c_data = { 'x', 'y'};
n_data = length(c_data);
p = fea.grid.p;
Positions = zeros(length(p),n_data);
for i=1:n_data
  Positions(:,i) = evalexpr( c_data{i}, p, fea );
end
Reply | Threaded
Open this post in threaded view
|

Re: time series data

Precise Simulation
Administrator
You can get coordinates of the evaluation points by using a custom function for equation/boundary coefficinets of the form

  myfun( c, x, y )

Note that the coordinates will be in the quadrature points where the function is evaluated, and the function might be called multiple times for several blocks of cells in each time/evaluation step, as assembly and evaluation is performed vectorized over grouped blocks of grid cells.