(from a discussion from hangouts today)
The functionality for averaging in main is somewhat restrictive (fixed order of certain parameters). In the light of adding other parameters to be averaged (thermal expansivity, heat capacities, ...), this becomes a problem.
Suggestion:
Add a new class that gets in the constructor:
- a rock
- an averaging scheme
- list of p, T
The class would have individual functions that return vectors of data for v_s, v_p, moduli, density, etc.. I guess we can change the interface of averaging scheme (maybe to operate on a list of minerals and a single given p and T?), which will be used inside this new class.
Internally the class could compute the required things in a lazy fashion (compute v_s from the moduli only when needed, compute the moduli only once when needed, etc.).
I am not sure how to name this class, maybe "Model"?
Usage would look something like this:
rock = ... # type Material as before
p, T = ... # lists as before
model = Model(rock, p, T, VoigtReussHill)
plt.plot(p, model.v_s())
# and model.K(), model.G(), model.density(), ...
[vs_err,rho_err]=burnman.compare_chifactor \
([model.v_s(), model.density()],[seis_vs,seis_rho])
This is much cleaner than what we have right now!
Questions:
- What would a good name for this be? Model? Earth? Realization?
- We would lose the ability to look at moduli for individual phases. Is that a problem? I guess one could offer the ability to look at the individual elastic properties before they are averaged (like calculate_moduli does).
- Other thoughts?