simphony / simphony-mayavi

The mayavi adapters to the simphony framework
BSD 2-Clause "Simplified" License
0 stars 1 forks source link

PhaseVolumeFraction not accepted #207

Closed khiltunen closed 7 years ago

khiltunen commented 7 years ago

If CUBA.VOLUME_FRACTION is PhaseVolumeFraction variable list an error is produced

zero_air = PhaseVolumeFraction(air, 0) one_water = PhaseVolumeFraction(water, 1) cell.data[CUBA.VOLUME_FRACTION] = [one_water, zero_air]

stefanoborini commented 7 years ago

version?

khiltunen commented 7 years ago

Latest commit on simphony-openfoam 'new-cuds-support' branch

stefanoborini commented 7 years ago

which error does it produce?

khiltunen commented 7 years ago

This happens only with the dataset having CUBA.VOLUME_FRACTION as list of PhaseValueFraction's

Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14665, in lambda event: event.callable(*event.args, **event.kw) ) File "foam_controlwrapper/examples/poiseuille_vof.py", line 180, in view src = CUDSSource(cuds=mesh_in_engine) File "/usr/local/lib/python2.7/dist-packages/simphony_mayavi-0.6.0.dev21-py2.7.egg/simphony_mayavi/sources/cuds_source.py", line 136, in init self.cuds = cuds File "/usr/local/lib/python2.7/dist-packages/simphony_mayavi-0.6.0.dev21-py2.7.egg/simphony_mayavi/sources/cuds_source.py", line 73, in _set_cuds self._update_vtk_cuds_from_cuds(value) File "/usr/local/lib/python2.7/dist-packages/simphony_mayavi-0.6.0.dev21-py2.7.egg/simphony_mayavi/sources/cuds_source.py", line 206, in _update_vtk_cuds_from_cuds vtk_cuds = VTKMesh.from_mesh(cuds) File "/usr/local/lib/python2.7/dist-packages/simphony_mayavi-0.6.0.dev21-py2.7.egg/simphony_mayavi/cuds/vtk_mesh.py", line 161, in from_mesh cell_data.load_onto_vtk(data_set.cell_data) File "/usr/local/lib/python2.7/dist-packages/simphony_mayavi-0.6.0.dev21-py2.7.egg/simphony_mayavi/core/cuba_data_accumulator.py", line 140, in load_onto_vtk data = numpy.array(self._data[cuba], dtype=float) ValueError: setting an array element with a sequence.

stefanoborini commented 7 years ago

I see that you have a script that reproduces the error, could you please make it available?

stefanoborini commented 7 years ago

VOLUME_FRACTION is a double. It does not accept PhaseValueFraction objects. you should use PHASE_VOLUME_FRACTION for that.

Actually, you should create a PhaseVolumeFractions (with an s) object, with those two PhaseVolumeFraction instances as values for self.phase_volume_fraction, and then set the PhaseVolumeFractions object with the key PHASE_VOLUME_FRACTIONS