Ejemplo n.º 1
0
    def __init__(self):
        PropertyStorage.__init__(self)
        self.properties = [
            {
                "Diffusion coefficient": 1.1,
                "attributes": {
                    # Some link in the chain does not seem to support unicode chars,
                    # So I have to write unicode like this:
                    # (\u00B2 is Superscript Two)
                    "suffix": u"mm\u00B2/s"
                }
            },
            {
                # Set this to true to have residuals be factored in by the flowsolver
                # (as of Dec. 2020 this is not implemented in the flowsolver and this flag will have no effect)
                "Residual control": False,
            },
            {
                "Residual criteria": 0.001,
                "attributes": {
                    "minimum": 0.0
                }
            },

            # I am deliberately not including ScalarSymbol as a PropertyStorage property, because it needs special treatment and validation before being renamed,
            # the UI renames the node and checks for duplicates.
            #
            # I could hook into the property changed event, but it seems easier to just not show it in the property tree.
        ]

        # Qt is very heavily invested in Unicode
        self._scalarSymbol = u"new Scalar"
        self._reactionString = u"0"
 def testAccessNew(self):
     storage = PropertyStorage()
     storage.properties = [
         {'a': [
              {'b': 1}
             ]
          }]
     self.checkAccess(storage)
 def testAccessOld(self):
     storage = PropertyStorage()
     storage.properties = [
         {"name": 'a',
          "value": [
              {"name": 'b',
               "value": 1}
             ]
          }]
     self.checkAccess(storage)
Ejemplo n.º 4
0
 def __init__(self):
     PropertyStorage.__init__(self)
     self.properties = [
         # Add properties here
     ]
    def __init__(self):
        PropertyStorage.__init__(self)

        # NOTE: These iterations are not written to solver.inp, they are used by a second Python file in the flowsolver.
        self.Iterations = []

        self.properties = [
            {
                "Time parameters":
                 [
                    {
                        "Number of time steps": 200,
                        "attributes": {"minimum": 1}
                    },
                    {
                        "Time step size": 0.01,
                        "attributes": {"minimum": 0.0, "suffix": " s"}
                    }
                 ]
            },
            {
                "Fluid parameters":
                [
                    {
                        "Viscosity": 0.004,
                        "attributes": {"minimum": 0.0, "suffix": u" g/(mm\u00B7s)"}
                    },
                    {
                        "Density": 0.00106,
                        "attributes": {"minimum": 0.0, "suffix": u" g/mm\u00B3"}
                    }
                ]
            },
            {
                "Simulation parameters":
                [
                    {
                        "Solver type": SolverType.memLS,
                        "attributes": {"enumNames": SolverType.enumNames}
                    },
                    {
                        "Number of time steps between restarts": 5,
                        "attributes": {"minimum": 1}
                    },
                    {
                        "Residual control": True,
                    },
                    {
                        "Residual criteria": 0.001,
                        "attributes": {"minimum": 0.0}
                    },
                    {
                        "Minimum required iterations": 2,
                        "attributes": {"minimum": 1}
                    },
                    {
                        "Step construction": 5,
                        "attributes": {"minimum": 1}
                    },
                    {
                        "Pressure coupling": CouplingType.Implicit,
                        "attributes": {"enumNames": CouplingType.enumNames}
                    },
                    {
                        "Influx coefficient": 0.5,
                        "attributes": {"minimum": 0.01, "maximum": 1.0}
                    },
                    {
                        "Simulate in Purely Zero Dimensions": False,
                    },
                ]
            },
            {
                "Output parameters":
                [
                    {
                        "Output wall shear stress": True
                    },
                    {
                        "Output error indicator": True
                    }
                ]
            },
            {
                "Scalar simulation parameters":
                [
                    {
                        # This parameter has no units
                        "Scalar Influx Coefficient": 1.0,
                        "attributes": {"minimum": 0.01, "maximum": 1.0}
                    },

                    # If you want to run the fluid solver only for a few timesteps before running the scalar simulation
                    # (e.g., to let the fluids "settle out"), set this to something other than timestep 1.
                    # Note that timesteps are 1-based. This is NOT an iteration.
                    {
                        "Start scalar simulation at timestep": 1,
                        "attributes": {"minimum": 1}
                    },
                    {
                        "End Flow Simulation Early":
                        [
                            # If you want to stop running the flowsolver after a certain number of timesteps, but continue running
                            # the scalar problem after that, enable this option and set the timestep to stop on
                            #
                            # The names are a bit redundant because I think it looks up the name of the property only
                            # based on the innermost name
                            {
                                "End Flow Simulation Early Enable": False,
                            },

                            {
                                "End Flow Simulation at Timestep": 1,
                                "attributes": {"minimum": 1}
                            }
                        ]
                    },

                    # Type type of scalar discontinuity capturing, 
                    # 1 0 is the one we usually use.
                    {
                        "Scalar Discontinuity Capturing": u"1 0"
                    },


                ]
            },
        ]
 def __init__(self):
     PropertyStorage.__init__(self)
     self.properties = [
         {
             "Time parameters": [{
                 "Number of time steps": 200,
                 "attributes": {
                     "minimum": 1
                 }
             }, {
                 "Time step size": 0.01,
                 "attributes": {
                     "minimum": 0.0,
                     "suffix": " s"
                 }
             }]
         },
         {
             "Fluid parameters": [{
                 "Viscosity": 0.004,
                 "attributes": {
                     "minimum": 0.0,
                     "suffix": u" g/(mm\u00B7s)"
                 }
             }, {
                 "Density": 0.00106,
                 "attributes": {
                     "minimum": 0.0,
                     "suffix": u" g/mm\u00B3"
                 }
             }]
         },
         {
             "Simulation parameters": [
                 {
                     "Solver type": SolverType.memLS,
                     "attributes": {
                         "enumNames": SolverType.enumNames
                     }
                 },
                 {
                     "Number of time steps between restarts": 5,
                     "attributes": {
                         "minimum": 1
                     }
                 },
                 {
                     "Residual control": True,
                 },
                 {
                     "Residual criteria": 0.001,
                     "attributes": {
                         "minimum": 0.0
                     }
                 },
                 {
                     "Minimum required iterations": 2,
                     "attributes": {
                         "minimum": 1
                     }
                 },
                 {
                     "Step construction": 5,
                     "attributes": {
                         "minimum": 1
                     }
                 },
                 {
                     "Pressure coupling": CouplingType.Implicit,
                     "attributes": {
                         "enumNames": CouplingType.enumNames
                     }
                 },
                 {
                     "Influx coefficient": 0.5,
                     "attributes": {
                         "minimum": 0.01,
                         "maximum": 1.0
                     }
                 },
                 {
                     "Simulate in Purely Zero Dimensions": False,
                 },
             ]
         },
         {
             "Output parameters": [{
                 "Output wall shear stress": True
             }, {
                 "Output error indicator": True
             }]
         },
     ]
Ejemplo n.º 7
0
 def __init__(self):
     PropertyStorage.__init__(self)
     self.faceIdentifiers = []