nemocrys / pyelmer

A python interface to Elmer.
GNU General Public License v3.0
53 stars 15 forks source link

pyelmer dependence of solver-specific keywords #4

Closed kdadzis closed 3 years ago

kdadzis commented 3 years ago

Currently the classes Boundary, Material, BodyForce etc. contain many keywords for a specific solver in Elmer. These are now stored in pyelmer-internal YAML files or, even worse, programmed directly into the pyelmer code. There are hundreds of solvers and thousands of keywords in Elmer. pyelmer cannot possibly deal with them all. It would be better if such keywords would be stored in YAML files in the simulation folder, where the user of pyelmer can see them and is encouraged to edit them.

As a first try I made a few commits to allow for a more flexible use of YAML files. However, more changes in pyelmer would be necessary: to change boundary settings loaded from the file, to avoid many repeating lines in the YAML files, etc.

arvedes commented 3 years ago

I think the hard-coded keywords are not a problem, because there is the possibility to always add others, e.g. to boundary.data. I like them as a feature because they provide a simpler approach to set up simulations. My big picture is that there are keywords for all 'standard' solvers, however I can just provide them for the ones that I am using.

Let's continue the discussion in the pull request #3 !

kdadzis commented 3 years ago

I added a few comments to the pull request. In general, I still don't see a point making the class/function/variable structure in pyelmer dependent on thousands of continuously changing keywords. Why not keep a nice, well-defined core structure of pyelmer and leave all solver-specific stuff to YAML files? This does not change user experience at all (pyelmer can still provide a set of standard YAML files), but it makes maintaining pyelmer a lot easier in my opinion. Of course, as I mentioned before, some more development would be needed to work with YAML files efficiently. E.g., how can boundary settings be changed later after loading them from a YAML file?

arvedes commented 3 years ago

I see your point, but I still like it to set my_boundary.fixed_heatflux = XYZ. In this way I don't need to remember all the Elmer keywords but can look them up from my auto-completion. I think the Elmer guys (almost) never remove any keywords for compatibility reasons, they just keep adding new ones - there shouldn't be a problem with maintaining this. I also have some ideas how we could structure the keyword if things get too messy. We should not focus too much on the YAML files, they are just one possibility to store dictionaries (which are the actual base data format in pyelmer). Other people may prefer other formats. The possibility to modify dictionaries is provided by Python, I don't see any problems here.

arvedes commented 3 years ago

We'll go on with this here #6!