simphony / simphony-common

The native implementation of the Simphony cuds objects
BSD 2-Clause "Simplified" License
7 stars 5 forks source link

Data correctness is not enforced (example: openfoam setup in simphony-ui) #420

Open stefanoborini opened 7 years ago

stefanoborini commented 7 years ago

In simphony-ui, the following situation is present:

    pressure_BC = {}                                                                      
    pressure_BC['inlet'] = get_boundary_condition_description(                            
            inlet_BC.pressure_boundary_condition)                                         
    pressure_BC['outlet'] = get_boundary_condition_description(                           
            outlet_BC.pressure_boundary_condition)                                        
    pressure_BC['walls'] = get_boundary_condition_description(                            
            walls_BC.pressure_boundary_condition)                                         
    pressure_BC['frontAndBack'] = get_boundary_condition_description(                     
            front_and_back_BC.pressure_boundary_condition)                                
    openfoam_wrapper.BC[CUBA.PRESSURE] = pressure_BC     

Two things are incorrect here, but I will focus only on the one on the topic. The point is that CUBA.PRESSURE (defined in cuba.yml to refer to a double) it is instead referring to a complex dict structure that has nothing to do with a pressure value.

The fact is that this works because openfoam wrapper just accepts this, as there are pretty much no enforcement strategies for correctness, the openfoam wrapper can do pretty much what it wants, and so is the client enforcing it, but it's a violation of simphony data model fundamental rules that makes it confusing to use and inconsistent.