def initProperties(self, obj):
        # Not currently used
        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()
            obj.Material = mats[name_path_list[[np[0] for np in name_path_list].index('Air')][1]]
Exemple #2
0
    def initProperties(self, obj):
        addObjectProperty(obj, 'CaseName', "meshCase", "App::PropertyString",
                          "", "Name of directory in which the mesh is created")

        addObjectProperty(obj, 'ShapeFaceNames', [], "App::PropertyStringList",
                          "", "Mesh face names")

        addObjectProperty(obj, 'STLLinearDeflection', 0.05,
                          "App::PropertyFloat", "", "STL linear deflection")

        addObjectProperty(
            obj, 'NumberCores', 1, "App::PropertyInteger", "",
            "Number of parallel cores "
            "(only applicable when using snappyHexMesh) ")

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

        if addObjectProperty(obj, "MeshUtility", _CfdMesh.known_mesh_utility,
                             "App::PropertyEnumeration", "Mesh Parameters",
                             "Meshing utilities"):
            obj.MeshUtility = 'cfMesh'

        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")

        if addObjectProperty(obj, 'ElementDimension',
                             _CfdMesh.known_element_dimensions,
                             "App::PropertyEnumeration", "Mesh Parameters",
                             "Dimension of mesh elements (Default 3D)"):
            obj.ElementDimension = '3D'
Exemple #3
0
 def initProperties(self, obj):
     addObjectProperty(obj, 'References', [], "App::PropertyPythonObject",
                       "", "Boundary faces")
     addObjectProperty(obj, 'LinkedObjects', [], "App::PropertyLinkList",
                       "", "Linked objects")
     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 magitude")
     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", "Temperature")
     addObjectProperty(obj, 'HeatTransferCoeff', '0 W/m^2/K',
                       "App::PropertyQuantity", "Thermal", "Temperature")
     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 dups
     if addObjectProperty(obj, 'TurbulenceInletSpecification',
                          all_turb_specs, "App::PropertyEnumeration",
                          "Turbulence", "Temperature"):
         obj.TurbulenceInletSpecification = 'intensityAndLengthScale'
     addObjectProperty(obj, 'TurbulentKineticEnergy', '0.01 m^2/s^2',
                       "App::PropertyQuantity", "Turbulence", "Temperature")
     addObjectProperty(obj, 'SpecificDissipationRate', '1 rad/s',
                       "App::PropertyQuantity", "Turbulence", "Temperature")
     addObjectProperty(obj, 'TurbulenceIntensity', '0.1',
                       "App::PropertyQuantity", "Turbulence", "Temperature")
     addObjectProperty(obj, 'TurbulenceLengthScale', '0.1 m',
                       "App::PropertyLength", "Turbulence", "Temperature")
     addObjectProperty(obj, 'VolumeFractions', {}, "App::PropertyMap",
                       "Volume fraction", "Volume fractions")
Exemple #4
0
    def __init__(self, obj):
        self.Type = "CfdSolverFoam"
        self.Object = obj  # keep a ref to the DocObj for nonGui usage
        obj.Proxy = self  # link between App::DocumentObject to  this object

        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::PropertyFloat", "IterationControl",
                          "Iteration output interval")
        addObjectProperty(obj, "ConvergenceTol", 1e-4, "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", "IterationControl",
                          "Iteration output interval")
Exemple #5
0
    def initProperties(self, obj):
        # Common to all
        addObjectProperty(
            obj, "RelativeLength", 0.75, "App::PropertyFloat", "",
            "Set relative length of the elements for this region")

        addObjectProperty(obj, "References", [], "App::PropertyPythonObject",
                          "", "List of mesh refinement objects")

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

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

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

        addObjectProperty(obj, "ExpansionRatio", 1.2, "App::PropertyFloat",
                          "cfMesh",
                          "Set expansion ratio within boundary layers")

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

        # snappy:
        addObjectProperty(obj, "RegionEdgeRefinement", 1, "App::PropertyFloat",
                          "snappyHexMesh",
                          "Relative edge (feature) refinement")

        addObjectProperty(obj, "Baffle", False, "App::PropertyBool",
                          "snappyHexMesh", "Create a zero thickness baffle")
Exemple #6
0
 def initProperties(self, obj):
     addObjectProperty(obj, 'References', [], "App::PropertyPythonObject")
     addObjectProperty(obj, 'LinkedObjects', [], 'App::PropertyLinkList',
                       "", "Linked objects")
     if obj.Name.startswith('PorousZone'):
         if addObjectProperty(obj, 'PorousCorrelation', POROUS_CORRELATIONS,
                              "App::PropertyEnumeration", "Porous zone",
                              "Porous drag model"):
             obj.PorousCorrelation = 'DarcyForchheimer'
         addObjectProperty(obj, 'D1', '0 1/m^2', "App::PropertyQuantity",
                           "Darcy-Forchheimer",
                           "Darcy coefficient (direction 1)")
         addObjectProperty(obj, 'D2', '0 1/m^2', "App::PropertyQuantity",
                           "Darcy-Forchheimer",
                           "Darcy coefficient (direction 2)")
         addObjectProperty(obj, 'D3', '0 1/m^2', "App::PropertyQuantity",
                           "Darcy-Forchheimer",
                           "Darcy coefficient (direction 3)")
         addObjectProperty(obj, 'F1', '0 1/m', "App::PropertyQuantity",
                           "Darcy-Forchheimer",
                           "Forchheimer coefficient (direction 1)")
         addObjectProperty(obj, 'F2', '0 1/m', "App::PropertyQuantity",
                           "Darcy-Forchheimer",
                           "Forchheimer coefficient (direction 2)")
         addObjectProperty(obj, 'F3', '0 1/m', "App::PropertyQuantity",
                           "Darcy-Forchheimer",
                           "Forchheimer coefficient (direction 3)")
         addObjectProperty(obj, 'e1', FreeCAD.Vector(1, 0, 0),
                           "App::PropertyVector", "Darcy-Forchheimer",
                           "Principal direction 1")
         addObjectProperty(obj, 'e2', FreeCAD.Vector(0, 1, 0),
                           "App::PropertyVector", "Darcy-Forchheimer",
                           "Principal direction 2")
         addObjectProperty(obj, 'e3', FreeCAD.Vector(0, 0, 1),
                           "App::PropertyVector", "Darcy-Forchheimer",
                           "Principal direction 3")
         addObjectProperty(obj, 'OuterDiameter', '0 m',
                           "App::PropertyLength", "Jakob", "Tube diameter")
         addObjectProperty(obj, 'TubeAxis', FreeCAD.Vector(0, 0, 1),
                           "App::PropertyVector", "Jakob",
                           "Direction parallel to tubes")
         addObjectProperty(obj, 'TubeSpacing', '0 m', "App::PropertyLength",
                           "Jakob", "Spacing between tube layers")
         addObjectProperty(obj, 'SpacingDirection', FreeCAD.Vector(1, 0, 0),
                           "App::PropertyVector", "Jakob",
                           "Direction normal to tube layers")
         addObjectProperty(
             obj, 'AspectRatio', '1.73', "App::PropertyQuantity", "Jakob",
             "Tube spacing aspect ratio (layer-to-layer : tubes in layer)")
         addObjectProperty(obj, 'VelocityEstimate', '0 m/s',
                           "App::PropertySpeed", "Jakob",
                           "Approximate flow velocity")
     elif obj.Name.startswith('InitialisationZone'):
         addObjectProperty(obj, "VelocitySpecified", False,
                           "App::PropertyBool", "Initialisation zone",
                           "Whether the zone initialises velocity")
         addObjectProperty(obj, 'Ux', '0 m/s', "App::PropertySpeed",
                           "Initialisation zone", "Velocity (x component)")
         addObjectProperty(obj, 'Uy', '0 m/s', "App::PropertySpeed",
                           "Initialisation zone", "Velocity (y component)")
         addObjectProperty(obj, 'Uz', '0 m/s', "App::PropertySpeed",
                           "Initialisation zone", "Velocity (z component)")
         addObjectProperty(obj, "PressureSpecified", False,
                           "App::PropertyBool", "Initialisation zone",
                           "Whether the zone initialises pressure")
         addObjectProperty(obj, 'Pressure', '0 kg/m/s^2',
                           "App::PropertyPressure", "Initialisation zone",
                           "Static pressure")
         addObjectProperty(obj, "VolumeFractionSpecified", True,
                           "App::PropertyBool", "Initialisation zone",
                           "Whether the zone initialises volume fraction")
         addObjectProperty(obj, "VolumeFractions", {}, "App::PropertyMap",
                           "Initialisation zone", "Volume fraction values")
Exemple #7
0
 def initProperties(self, obj):
     addObjectProperty(obj, 'PotentialFoam', True, "App::PropertyBool",
                       "Flow", "Initialise with potential flow solution")
     addObjectProperty(obj, 'UseInletUPValues', False, "App::PropertyBool",
                       "Flow", "Initialise with flow values from inlet")
     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, 'UseInletTemperatureValues', 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, 'VolumeFractions', {}, "App::PropertyMap",
                       "Volume Fraction", "Volume fraction values")
     addObjectProperty(obj, 'Inlet', None, "App::PropertyLink", "",
                       "Inlet boundary name")
Exemple #8
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)
    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', 'RANS'],
                             "App::PropertyEnumeration", "Physics modelling",
                             "Type of turbulence modelling"):
            obj.Turbulence = ['Inviscid', 'Laminar', 'RANS']

        addObjectProperty(obj, "TurbulenceModel", ['kOmegaSST'],
                          "App::PropertyEnumeration", "Physics modelling",
                          "Turbulence model")

        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)")