Skip to content

Topic/default/extend simul

Pierre Augier requested to merge topic/default/extend-simul into branch/default

I like to introduce a mechanism to "extend a Simul class" with another class.

The first application is to introduce a particular output specialized for one study. Thus, we don't want to have it in a solver used for many applications.

This MR will contain deep changes (also in fluidsim_core), it's a bit tricky and it can have consequences on projects depending on fluidsim_core. Thus, I don't assign to myself this time 🙂 !

More coming soon...

Proposed new API:

# can be anywhere, but should be importable (otherwise, the simulation can't be loaded afterwards)
from fluidsim.extend_simul.spatial_means_center_milestone import SpatialMeansCenter

Simul = SpatialMeansCenter.create_extended_Simul(Simul)

# then, as usual
params = Simul.create_default_params()
...

Note: I'm not very happy with the name create_extended_Simul...

Then, the simulation can be loaded as usual with load_sim_for_plots, load_state_phys_file and load_for_restart.

There is another case when one wants to plug this output to a simulation already created. Then, I guess we need to do:

params, Simul = load_for_restart(name_dir)
Simul = SpatialMeansCenter.create_extended_Simul(Simul)
SpatialMeansCenter.complete_params_with_default(params)
Edited by Pierre Augier

Merge request reports

Loading