Ejemplo n.º 1
0
 def initProperties(self, obj):
     addObjectProperty(
         obj, "OutputPath", "", "App::PropertyPath", "",
         "Path to which cases are written (blank to use system default)")
     addObjectProperty(obj, "IsActiveAnalysis", False, "App::PropertyBool",
                       "", "Active analysis object in document")
     obj.setEditorMode("IsActiveAnalysis", 1)  # Make read-only (2 = hidden)
     addObjectProperty(obj, 'NeedsMeshRewrite', True, "App::PropertyBool",
                       "", "Mesh setup needs to be re-written")
     addObjectProperty(obj, 'NeedsCaseRewrite', True, "App::PropertyBool",
                       "", "Case setup needs to be re-written")
     addObjectProperty(obj, 'NeedsMeshRerun', True, "App::PropertyBool", "",
                       "Mesher needs to be re-run before running solver")
Ejemplo n.º 2
0
    def initProperties(self, obj):
        # Not currently used, but required for parent class
        addObjectProperty(obj, "References", [], "App::PropertyLinkSubList", "Material", "List of material shapes")

        # Compatibility with FEM material object
        if addObjectProperty(
                obj, "Category", ["Solid", "Fluid"], "App::PropertyEnumeration", "Material", "Type of material"):
            obj.Category = "Fluid"

        # 'Material' PropertyMap already present in MaterialObjectPython
        if not obj.Material:
            mats, name_path_list = CfdTools.importMaterials()
            # Load a default to initialise the values for each type
            obj.Material = mats[name_path_list[[np[0] for np in name_path_list].index('AirIsothermal')][1]]
        elif not obj.Material.get('Type'):
            mat = obj.Material
            mat['Type'] = 'Isothermal'
            obj.Material = mat
Ejemplo n.º 3
0
    def initProperties(self, obj):
        addObjectProperty(obj, 'CaseName', "meshCase", "App::PropertyString",
                          "", "Name of directory in which the mesh is created")

        # Setup and utility
        addObjectProperty(
            obj, 'STLRelativeLinearDeflection', 1, "App::PropertyFloat",
            "Surface triangulation",
            "Maximum relative linear deflection for built-in surface triangulation"
        )
        addObjectProperty(
            obj, 'STLAngularMeshDensity', 100, "App::PropertyFloat",
            "Surface triangulation",
            "Mesh elements per 360 degrees for surface triangulation with GMSH"
        )

        addObjectProperty(
            obj, 'NumberOfProcesses', 1, "App::PropertyInteger", "",
            "Number of parallel processes (only applicable to cfMesh and snappyHexMesh)"
        )

        addObjectProperty(
            obj, 'NumberOfThreads', 0, "App::PropertyInteger", "",
            "Number of parallel threads per process (only applicable to cfMesh and gmsh). "
            "0 means use all available (if NumberOfProcesses = 1) or use 1 (if NumberOfProcesses > 1)"
        )

        addObjectProperty(obj, "Part", None, "App::PropertyLink",
                          "Mesh Parameters", "Part object to mesh")

        if addObjectProperty(obj, "MeshUtility", MESHERS,
                             "App::PropertyEnumeration", "Mesh Parameters",
                             "Meshing utilities"):
            obj.MeshUtility = MESHERS[0]

        # Refinement
        addObjectProperty(obj, "CharacteristicLengthMax", "0 m",
                          "App::PropertyLength", "Mesh Parameters",
                          "Max mesh element size (0.0 = infinity)")

        addObjectProperty(
            obj, 'PointInMesh', {
                "x": '0 m',
                "y": '0 m',
                "z": '0 m'
            }, "App::PropertyMap", "Mesh Parameters",
            "Location vector inside the region to be meshed (must not coincide with a cell face)"
        )

        addObjectProperty(obj, 'CellsBetweenLevels', 3, "App::PropertyInteger",
                          "Mesh Parameters",
                          "Number of cells between each level of refinement")

        addObjectProperty(obj, 'EdgeRefinement', 1, "App::PropertyFloat",
                          "Mesh Parameters",
                          "Relative edge (feature) refinement")

        # PolyDualMesh
        addObjectProperty(obj, 'ConvertToDualMesh', False, "App::PropertyBool",
                          "Mesh Parameters", "Convert to polyhedral dual mesh")

        # Edge detection, implicit / explicit (NB Implicit = False implies Explicit = True)
        addObjectProperty(obj, 'ImplicitEdgeDetection', False,
                          "App::PropertyBool", "Mesh Parameters",
                          "Use implicit edge detection")

        # Mesh dimension
        if addObjectProperty(obj, 'ElementDimension',
                             CfdMesh.known_element_dimensions,
                             "App::PropertyEnumeration", "Mesh Parameters",
                             "Dimension of mesh elements (Default 3D)"):
            obj.ElementDimension = '3D'
Ejemplo n.º 4
0
    def initProperties(self, obj):
        addObjectProperty(obj, 'PotentialFlow', True, "App::PropertyBool",
                          "Flow",
                          "Initialise velocity with potential flow solution")
        addObjectProperty(obj, 'PotentialFlowP', False, "App::PropertyBool",
                          "Flow",
                          "Initialise pressure with potential flow solution")
        addObjectProperty(obj, 'UseInletUValues', False, "App::PropertyBool",
                          "Flow", "Initialise with flow values from inlet")
        addObjectProperty(obj, 'UseOutletPValue', True, "App::PropertyBool",
                          "Flow", "Initialise with flow values from outlet")
        addObjectProperty(obj, 'Ux', '0 m/s', "App::PropertySpeed", "Flow",
                          "Velocity (x component)")
        addObjectProperty(obj, 'Uy', '0 m/s', "App::PropertySpeed", "Flow",
                          "Velocity (y component)")
        addObjectProperty(obj, 'Uz', '0 m/s', "App::PropertySpeed", "Flow",
                          "Velocity (z component)")
        addObjectProperty(obj, 'Pressure', '0 Pa', "App::PropertyPressure",
                          "Flow", "Static pressure")
        addObjectProperty(obj, 'UseInletTemperatureValue', False,
                          "App::PropertyBool", "Thermal",
                          "Initialise with temperature value from inlet")
        addObjectProperty(obj, 'Temperature', '293 K', "App::PropertyQuantity",
                          "Thermal", "Temperature")
        addObjectProperty(obj, 'UseInletTurbulenceValues', False,
                          "App::PropertyBool", "Turbulence",
                          "Initialise turbulence with values from inlet")
        addObjectProperty(obj, 'k', '0.01 m^2/s^2', "App::PropertyQuantity",
                          "Turbulence", "Turbulent kinetic energy")
        addObjectProperty(obj, 'omega', '1 rad/s', "App::PropertyQuantity",
                          "Turbulence", "Specific turbulent dissipation rate")
        addObjectProperty(obj, 'epsilon', '50 m^2/s^3',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent dissipation rate")
        addObjectProperty(obj, 'nuTilda', '55 m^2/s^1',
                          "App::PropertyQuantity", "Turbulence",
                          "Modified turbulent viscosity")
        addObjectProperty(obj, 'gammaInt', '1', "App::PropertyQuantity",
                          "Turbulence", "Turbulent intermittency")
        addObjectProperty(obj, 'ReThetat', '1', "App::PropertyQuantity",
                          "Turbulence",
                          "Transition Momentum Thickness Reynolds Number")
        addObjectProperty(obj, 'nut', '50 m^2/s^1', "App::PropertyQuantity",
                          "Turbulence", "Turbulent viscosity")
        addObjectProperty(obj, 'kEqnk', '0.01 m^2/s^2',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent kinetic energy")
        addObjectProperty(obj, 'kEqnNut', '50 m^2/s^1',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent viscosity")

        addObjectProperty(obj, 'VolumeFractions', {}, "App::PropertyMap",
                          "Volume Fraction", "Volume fraction values")
        addObjectProperty(obj, 'BoundaryU', None, "App::PropertyLink", "",
                          "U boundary")
        addObjectProperty(obj, 'BoundaryP', None, "App::PropertyLink", "",
                          "P boundary")
        addObjectProperty(obj, 'BoundaryT', None, "App::PropertyLink", "",
                          "T boundary")
        addObjectProperty(obj, 'BoundaryTurb', None, "App::PropertyLink", "",
                          "Turbulence boundary")
Ejemplo n.º 5
0
    def initProperties(self, obj):
        # Common to all
        if addObjectProperty(obj, 'ShapeRefs', [], "App::PropertyLinkSubList",
                             "", "List of mesh refinement objects"):
            # Backward compat
            if 'References' in obj.PropertiesList:
                doc = FreeCAD.getDocument(obj.Document.Name)
                for r in obj.References:
                    if not r[1]:
                        obj.ShapeRefs += [doc.getObject(r[0])]
                    else:
                        obj.ShapeRefs += [(doc.getObject(r[0]), r[1])]
                obj.removeProperty('References')
                obj.removeProperty('LinkedObjects')

        addObjectProperty(
            obj, "Internal", False, "App::PropertyBool", "",
            "Whether the refinement region is a volume rather than surface")

        addObjectProperty(obj, "Extrusion", False, "App::PropertyBool", "",
                          "Defines an extrusion from a patch")

        addObjectProperty(
            obj, "RelativeLength", 0.75, "App::PropertyFloat", "Refinement",
            "Set relative length of the elements for this region")

        addObjectProperty(obj, "RefinementThickness", "0 m",
                          "App::PropertyLength", "Surface refinement",
                          "Set refinement region thickness")

        addObjectProperty(obj, "NumberLayers", 0, "App::PropertyInteger",
                          "Surface refinement",
                          "Set number of boundary layers")

        addObjectProperty(obj, "ExpansionRatio", 1.0, "App::PropertyFloat",
                          "Surface refinement",
                          "Set expansion ratio within boundary layers")

        addObjectProperty(obj, "FirstLayerHeight", "0 m",
                          "App::PropertyLength", "Surface refinement",
                          "Set the maximum first layer height")

        addObjectProperty(obj, "RegionEdgeRefinement", 1, "App::PropertyFloat",
                          "Surface refinement",
                          "Relative edge (feature) refinement")

        addObjectProperty(obj, "ExtrusionType", EXTRUSION_TYPES[0],
                          "App::PropertyString", "Extrusion",
                          "Type of extrusion")

        addObjectProperty(
            obj, "KeepExistingMesh", False, "App::PropertyBool", "Extrusion",
            "If true, then the extrusion extends the existing mesh rather than replacing it"
        )

        addObjectProperty(obj, "ExtrusionThickness", "1 mm",
                          "App::PropertyLength", "Extrusion",
                          "Total distance of the extruded layers")

        addObjectProperty(obj, "ExtrusionAngle", 5, "App::PropertyAngle",
                          "Extrusion",
                          "Total angle through which the patch is extruded")

        addObjectProperty(obj, "ExtrusionLayers", 1, "App::PropertyInteger",
                          "Extrusion", "Number of extrusion layers to add")

        addObjectProperty(obj, "ExtrusionRatio", 1.0, "App::PropertyFloat",
                          "Extrusion", "Expansion ratio of extrusion layers")

        addObjectProperty(obj, "ExtrusionAxisPoint", FreeCAD.Vector(0, 0, 0),
                          "App::PropertyPosition", "Extrusion",
                          "Point on axis for sector extrusion")

        addObjectProperty(obj, "ExtrusionAxisDirection",
                          FreeCAD.Vector(1, 0, 0), "App::PropertyVector",
                          "Extrusion",
                          "Direction of axis for sector extrusion")
Ejemplo n.º 6
0
    def initProperties(self, obj):
        addObjectProperty(
            obj, "RefinementInterval", 1, "App::PropertyInteger",
            "DynamicMesh",
            "Set the interval at which to run the dynamic mesh refinement")

        addObjectProperty(obj, "MaxRefinementLevel", 1, "App::PropertyInteger",
                          "DynamicMesh",
                          "Set the maximum dynamic mesh refinement level")

        addObjectProperty(
            obj, "BufferLayers", 1, "App::PropertyInteger", "DynamicMesh",
            "Set the number of buffer layers between refined and existing cells"
        )

        addObjectProperty(
            obj, "MaxRefinementCells", 20000000, "App::PropertyInteger",
            "DynamicMesh",
            "Set the maximum number of cells allowed during dynamic mesh refinement"
        )

        addObjectProperty(obj, "RefinementField", "alpha.water",
                          "App::PropertyString", "DynamicMesh",
                          "Set the target refinement field")

        addObjectProperty(obj, "LowerRefinementLevel", 0.001,
                          "App::PropertyFloat", "DynamicMesh",
                          "Set the lower mesh refinement")

        addObjectProperty(obj, "UpperRefinementLevel", 0.999,
                          "App::PropertyFloat", "DynamicMesh",
                          "Set the upper mesh refinement")

        addObjectProperty(
            obj, "UnRefinementLevel", 10, "App::PropertyInteger",
            "DynamicMesh",
            "Set the unrefinement level below which the mesh will be unrefined"
        )

        addObjectProperty(
            obj, "WriteFields", False, "App::PropertyBool", "DynamicMesh",
            "Whether to write the dynamic mesh refinement fields after refinement"
        )
Ejemplo n.º 7
0
    def initProperties(self, obj):
        addObjectProperty(
            obj, "InputCaseName", "case", "App::PropertyFile", "Solver",
            "Name of case directory where the input files are written")
        addObjectProperty(obj, "Parallel", True, "App::PropertyBool", "Solver",
                          "Parallel analysis on multiple CPU cores")
        addObjectProperty(obj, "ParallelCores", 4, "App::PropertyInteger",
                          "Solver",
                          "Number of cores on which to run parallel analysis")

        addObjectProperty(
            obj, "MaxIterations", 2000, "App::PropertyInteger",
            "IterationControl",
            "Maximum number of iterations to run steady-state analysis")
        addObjectProperty(obj, "SteadyWriteInterval", 100,
                          "App::PropertyInteger", "IterationControl",
                          "Iteration output interval")
        addObjectProperty(obj, "ConvergenceTol", 1e-3, "App::PropertyFloat",
                          "IterationControl",
                          "Global absolute solution convergence criterion")
        addObjectProperty(obj, "EndTime", "1 s", "App::PropertyQuantity",
                          "TimeStepControl",
                          "Total time to run transient solution")
        addObjectProperty(obj, "TimeStep", "0.001 s", "App::PropertyQuantity",
                          "TimeStepControl", "Time step increment")
        addObjectProperty(obj, "TransientWriteInterval", "0.1 s",
                          "App::PropertyQuantity", "TimeStepControl",
                          "Output time interval")

        self.residual_plotter = TimePlot(title="Simulation residuals",
                                         y_label="Residual",
                                         is_log=True)
        self.forces_plotters = {}
        self.force_coeffs_plotters = {}
        self.probes_plotters = {}
Ejemplo n.º 8
0
    def initProperties(self, obj):
        if addObjectProperty(obj, 'ShapeRefs', [], "App::PropertyLinkSubList",
                             "", "Boundary faces"):
            # Backward compat
            if 'References' in obj.PropertiesList:
                doc = FreeCAD.getDocument(obj.Document.Name)
                for r in obj.References:
                    if not r[1]:
                        obj.ShapeRefs += [doc.getObject(r[0])]
                    else:
                        obj.ShapeRefs += [(doc.getObject(r[0]), r[1])]
                obj.removeProperty('References')
                obj.removeProperty('LinkedObjects')

        addObjectProperty(obj, 'DefaultBoundary', False, "App::PropertyBool",
                          "Boundary faces")
        addObjectProperty(obj, 'BoundaryType', BOUNDARY_TYPES,
                          "App::PropertyEnumeration", "",
                          "Boundary condition category")

        all_subtypes = []
        for s in SUBTYPES:
            all_subtypes += s

        addObjectProperty(obj, 'BoundarySubType', all_subtypes,
                          "App::PropertyEnumeration", "",
                          "Boundary condition type")
        addObjectProperty(obj, 'VelocityIsCartesian', True,
                          "App::PropertyBool", "Flow",
                          "Whether to use components of velocity")
        addObjectProperty(obj, 'Ux', '0 m/s', "App::PropertySpeed", "Flow",
                          "Velocity (x component)")
        addObjectProperty(obj, 'Uy', '0 m/s', "App::PropertySpeed", "Flow",
                          "Velocity (y component)")
        addObjectProperty(obj, 'Uz', '0 m/s', "App::PropertySpeed", "Flow",
                          "Velocity (z component)")
        addObjectProperty(obj, 'VelocityMag', '0 m/s', "App::PropertySpeed",
                          "Flow", "Velocity magnitude")
        addObjectProperty(obj, 'DirectionFace', '', "App::PropertyString",
                          "Flow", "Face describing direction (normal)")
        addObjectProperty(obj, 'ReverseNormal', False, "App::PropertyBool",
                          "Flow", "Direction is inward-pointing if true")
        addObjectProperty(obj, 'Pressure', '0 Pa', "App::PropertyPressure",
                          "Flow", "Static pressure")
        addObjectProperty(obj, 'SlipRatio', '0', "App::PropertyQuantity",
                          "Flow", "Slip ratio")
        addObjectProperty(obj, 'VolFlowRate', '0 m^3/s',
                          "App::PropertyQuantity", "Flow", "Volume flow rate")
        addObjectProperty(obj, 'MassFlowRate', '0 kg/s',
                          "App::PropertyQuantity", "Flow", "Mass flow rate")

        if addObjectProperty(obj, 'PorousBaffleMethod', POROUS_METHODS,
                             "App::PropertyEnumeration", "Baffle", "Baffle"):
            obj.PorousBaffleMethod = 'porousCoeff'

        addObjectProperty(obj, 'PressureDropCoeff', '0',
                          "App::PropertyQuantity", "Baffle",
                          "Porous baffle pressure drop coefficient")
        addObjectProperty(obj, 'ScreenWireDiameter', '0.2 mm',
                          "App::PropertyLength", "Baffle",
                          "Porous screen mesh diameter")
        addObjectProperty(obj, 'ScreenSpacing', '2 mm', "App::PropertyLength",
                          "Baffle", "Porous screen mesh spacing")

        addObjectProperty(obj, 'ThermalBoundaryType', THERMAL_BOUNDARY_TYPES,
                          "App::PropertyEnumeration", "Thermal",
                          "Type of thermal boundary")
        addObjectProperty(obj, 'Temperature', '293 K', "App::PropertyQuantity",
                          "Thermal", "Temperature")
        addObjectProperty(obj, 'HeatFlux', '0 W/m^2', "App::PropertyQuantity",
                          "Thermal", "Wall heat flux")
        addObjectProperty(obj, 'HeatTransferCoeff', '0 W/m^2/K',
                          "App::PropertyQuantity", "Thermal",
                          "Wall heat transfer coefficient")

        # Turbulence
        all_turb_specs = []
        for k in TURBULENT_INLET_SPEC:
            all_turb_specs += TURBULENT_INLET_SPEC[k][1]

        all_turb_specs = list(set(all_turb_specs))  # Remove duplicates

        if addObjectProperty(obj, 'TurbulenceInletSpecification',
                             all_turb_specs, "App::PropertyEnumeration",
                             "Turbulence", "Turbulent quantities specified"):
            obj.TurbulenceInletSpecification = 'intensityAndLengthScale'

        # k omega SST
        addObjectProperty(obj, 'TurbulentKineticEnergy', '0.01 m^2/s^2',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent kinetic energy")
        addObjectProperty(obj, 'SpecificDissipationRate', '1 rad/s',
                          "App::PropertyQuantity", "Turbulence",
                          "Specific turbulent dissipation rate")

        # k epsilon
        addObjectProperty(obj, 'DissipationRate', '50 m^2/s^3',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent dissipation rate")

        # Spalart Allmaras
        addObjectProperty(obj, 'NuTilda', '55 m^2/s^1',
                          "App::PropertyQuantity", "Turbulence",
                          "Modified turbulent viscosity")

        # Langtry Menter 4 eqn k omega SST
        addObjectProperty(obj, 'Intermittency', '1', "App::PropertyQuantity",
                          "Turbulence", "Turbulent intermittency")
        addObjectProperty(obj, 'ReThetat', '1', "App::PropertyQuantity",
                          "Turbulence",
                          "Transition momentum thickness Reynolds number")

        # LES models
        addObjectProperty(obj, 'TurbulentViscosity', '50 m^2/s^1',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent viscosity")
        addObjectProperty(obj, 'kEqnTurbulentKineticEnergy', '0.01 m^2/s^2',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent viscosity")
        addObjectProperty(obj, 'kEqnTurbulentViscosity', '50 m^2/s^1',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulent viscosity")

        # General
        addObjectProperty(obj, 'TurbulenceIntensityPercentage', '1',
                          "App::PropertyQuantity", "Turbulence",
                          "Turbulence intensity (percent)")
        # Backward compat
        if 'TurbulenceIntensity' in obj.PropertiesList:
            obj.TurbulenceIntensityPercentage = obj.TurbulenceIntensity * 100.0
            obj.removeProperty('TurbulenceIntensity')

        addObjectProperty(obj, 'TurbulenceLengthScale', '0.1 m',
                          "App::PropertyLength", "Turbulence",
                          "Length scale of turbulent eddies")
        addObjectProperty(obj, 'VolumeFractions', {}, "App::PropertyMap",
                          "Volume fraction", "Volume fractions")
Ejemplo n.º 9
0
    def initProperties(self, obj):
        addObjectProperty(obj, 'FieldName', "S", "App::PropertyString",
                          "Scalar transport",
                          "Name of the scalar transport field")

        addObjectProperty(
            obj, 'DiffusivityFixed', False, "App::PropertyBool",
            "Scalar transport",
            "Use fixed value for diffusivity rather than viscosity")

        # This is actually rho*diffusivity, but this is what OpenFOAM uses
        addObjectProperty(obj, 'DiffusivityFixedValue', "0.001 kg/m/s",
                          "App::PropertyQuantity", "Scalar transport",
                          "Diffusion coefficient for fixed diffusivity")

        addObjectProperty(obj, 'RestrictToPhase', False, "App::PropertyBool",
                          "Scalar transport",
                          "Restrict transport within phase")

        addObjectProperty(obj, 'PhaseName', "water", "App::PropertyString",
                          "Scalar transport", "Transport within phase")

        addObjectProperty(obj, 'InjectionRate', '1 kg/s',
                          "App::PropertyQuantity", "Scalar transport",
                          "Injection rate")

        addObjectProperty(obj, 'InjectionPoint', FreeCAD.Vector(0, 0, 0),
                          "App::PropertyPosition", "Scalar transport",
                          "Location of the injection point")
Ejemplo n.º 10
0
    def initProperties(self, obj):

        # Setup and utility
        addObjectProperty(obj, 'ReportingFunctionType', OBJECT_NAMES,
                          "App::PropertyEnumeration", "",
                          "Type of reporting function")

        addObjectProperty(obj, 'Patch', None, "App::PropertyLink",
                          "Function object",
                          "Patch on which to create the function object")

        # Forces
        addObjectProperty(obj, 'ReferenceDensity', '1 kg/m^3',
                          "App::PropertyQuantity", "Forces",
                          "Reference density")
        addObjectProperty(obj, 'ReferencePressure', '0 Pa',
                          "App::PropertyPressure", "Forces",
                          "Reference pressure")
        addObjectProperty(obj, 'CentreOfRotation', FreeCAD.Vector(0, 0, 0),
                          "App::PropertyPosition", "Forces",
                          "Centre of rotation")
        addObjectProperty(obj, 'WriteFields', False, "App::PropertyBool",
                          "Forces", "Whether to write output fields")

        # Force coefficients
        addObjectProperty(obj, 'Lift', FreeCAD.Vector(1, 0, 0),
                          "App::PropertyVector", "Force coefficients",
                          "Lift direction (x component)")

        addObjectProperty(obj, 'Drag', FreeCAD.Vector(0, 1, 0),
                          "App::PropertyVector", "Force coefficients",
                          "Drag direction")

        addObjectProperty(obj, 'MagnitudeUInf', '1 m/s',
                          "App::PropertyQuantity", "Force coefficients",
                          "Freestream velocity magnitude")
        addObjectProperty(obj, 'LengthRef', '1 m', "App::PropertyQuantity",
                          "Force coefficients", "Coefficient length reference")
        addObjectProperty(obj, 'AreaRef', '1 m^2', "App::PropertyQuantity",
                          "Force coefficients", "Coefficient area reference")

        # Spatial binning
        addObjectProperty(obj, 'NBins', 0, "App::PropertyInteger", "Forces",
                          "Number of bins")
        addObjectProperty(obj, 'Direction', FreeCAD.Vector(1, 0, 0),
                          "App::PropertyVector", "Forces", "Binning direction")
        addObjectProperty(obj, 'Cumulative', True, "App::PropertyBool",
                          "Forces", "Cumulative")

        # Probes
        addObjectProperty(obj, 'SampleFieldName', "p", "App::PropertyString",
                          "Probes", "Name of the field to sample")

        addObjectProperty(obj, 'ProbePosition', FreeCAD.Vector(0, 0, 0),
                          "App::PropertyPosition", "Probes",
                          "Location of the probe sample location")
Ejemplo n.º 11
0
    def initProperties(self, obj):
        # obj.supportedProperties()
        # ['App::PropertyBool', 'App::PropertyBoolList', 'App::PropertyFloat', 'App::PropertyFloatList',
        #  'App::PropertyFloatConstraint', 'App::PropertyPrecision', 'App::PropertyQuantity',
        #  'App::PropertyQuantityConstraint', 'App::PropertyAngle', 'App::PropertyDistance', 'App::PropertyLength',
        #  'App::PropertyArea', 'App::PropertyVolume', 'App::PropertySpeed', 'App::PropertyAcceleration',
        #  'App::PropertyForce', 'App::PropertyPressure', 'App::PropertyInteger', 'App::PropertyIntegerConstraint',
        #  'App::PropertyPercent', 'App::PropertyEnumeration', 'App::PropertyIntegerList', 'App::PropertyIntegerSet',
        #  'App::PropertyMap', 'App::PropertyString', 'App::PropertyUUID', 'App::PropertyFont',
        #  'App::PropertyStringList', 'App::PropertyLink', 'App::PropertyLinkChild', 'App::PropertyLinkGlobal',
        #  'App::PropertyLinkSub', 'App::PropertyLinkSubChild', 'App::PropertyLinkSubGlobal', 'App::PropertyLinkList',
        #  'App::PropertyLinkListChild', 'App::PropertyLinkListGlobal', 'App::PropertyLinkSubList',
        #  'App::PropertyLinkSubListChild', 'App::PropertyLinkSubListGlobal', 'App::PropertyMatrix',
        #  'App::PropertyVector', 'App::PropertyVectorDistance', 'App::PropertyPosition', 'App::PropertyDirection',
        #  'App::PropertyVectorList', 'App::PropertyPlacement', 'App::PropertyPlacementList',
        #  'App::PropertyPlacementLink', 'App::PropertyColor', 'App::PropertyColorList', 'App::PropertyMaterial',
        #  'App::PropertyMaterialList', 'App::PropertyPath', 'App::PropertyFile', 'App::PropertyFileIncluded',
        #  'App::PropertyPythonObject', 'App::PropertyExpressionEngine', 'Part::PropertyPartShape',
        #  'Part::PropertyGeometryList', 'Part::PropertyShapeHistory', 'Part::PropertyFilletEdges',
        #  'Fem::PropertyFemMesh', 'Fem::PropertyPostDataObject']

        if addObjectProperty(obj, "Time", ['Steady', 'Transient'],
                             "App::PropertyEnumeration", "Physics modelling",
                             "Resolve time dependence"):
            obj.Time = 'Steady'

        if addObjectProperty(
                obj, "Flow",
            ['Incompressible', 'Compressible', 'HighMachCompressible'],
                "App::PropertyEnumeration", "Physics modelling",
                "Flow algorithm"):
            obj.Flow = 'Incompressible'

        if addObjectProperty(obj, "Thermal", ['None', 'Energy'],
                             "App::PropertyEnumeration", "Physics modelling",
                             "Thermal modelling"):
            obj.Thermal = 'None'

        if addObjectProperty(obj, "Phase", ['Single', 'FreeSurface'],
                             "App::PropertyEnumeration", "Physics modelling",
                             "Type of phases present"):
            obj.Phase = 'Single'

        if addObjectProperty(obj, "Turbulence",
                             ['Inviscid', 'Laminar', 'DES', 'RANS', 'LES'],
                             "App::PropertyEnumeration", "Physics modelling",
                             "Type of turbulence modelling"):
            obj.Turbulence = 'Laminar'

        if addObjectProperty(obj, "TurbulenceModel", [
                'kOmegaSST', 'kEpsilon', 'SpalartAllmaras', 'kOmegaSSTLM',
                'kOmegaSSTDES', 'kOmegaSSTDDES', 'kOmegaSSTIDDES',
                'SpalartAllmarasDES', 'SpalartAllmarasDDES',
                'SpalartAllmarasIDDES', 'kEqn', 'Smagorinsky', 'WALE'
        ], "App::PropertyEnumeration", "Physics modelling",
                             "Turbulence model"):
            obj.TurbulenceModel = 'kOmegaSST'

        addObjectProperty(obj, "gx", '0 m/s^2', "App::PropertyAcceleration",
                          "Physics modelling",
                          "Gravitational acceleration vector (x component)")
        addObjectProperty(obj, "gy", '-9.81 m/s^2',
                          "App::PropertyAcceleration", "Physics modelling",
                          "Gravitational acceleration vector (y component)")
        addObjectProperty(obj, "gz", '0 m/s^2', "App::PropertyAcceleration",
                          "Physics modelling",
                          "Gravitational acceleration vector (z component)")