MPh-py / MPh

Pythonic scripting interface for Comsol Multiphysics
https://mph.readthedocs.io
MIT License
265 stars 67 forks source link

`model.evaluate()` doesn't return all data points #142

Closed Adrien-Amour closed 1 year ago

Adrien-Amour commented 1 year ago

I'm exporting data from a comsol file to analyse in python using the following line of code,

(x, y, z, Vol, Px, Py, Pz) = model.evaluate(['x', 'y', 'z', 'meshvol', 'es.Px', 'es.Py', 'es.Pz'])

the issue is that the length of the arrays defined by this command is smaller than the number of finite elements in the model. I know this because I have also exported using the comsol gui and there is about an 800 point discrepency between the number of data elements in each method (there is about 140000 points overall). This results in my analysis producing different results depending on whether i export the data as a text file and analyse that, or if i export the data using model.evaluate. Is there any reason why this might happen/ any way I can fix it?

john-hen commented 1 year ago

Hi. I don't see a reason why this would happen, but I also cannot reproduce what you are doing. If you think this is a bug (and it could also be in Comsol, rather than MPh), you should think if you can provide a reproducible example, i.e. a model file. Ideally a minimal example, i.e. a simple model, quick to solve, producing little data, much like the demo model capacitor.mph that ships with MPh.

john-hen commented 1 year ago

Closed as: non-reproducible.