Beispiel #1
0
    def execute(self, context):
        if parseXML(context):
            print("File parsed!")
            diffuseparticles.run(
                bpy.path.abspath(
                    context.scene.DsphFoamInputPath),  # Input path
                context.scene.DsphFoamInputPrefix,  # Input files prefix
                bpy.path.abspath(context.scene.DsphFoamPath),  # Output path
                context.scene.DsphFoamPrefix,  # Output files prefix
                "",  # Exclusion zone file
                context.scene.DsphFoamStart,  # Starting timestep
                context.scene.DsphFoamEnd,  # Ending timestep
                4,  # Zero padding
                False,  # Output text files
                False,  # Output ply files
                True,  # Output vtk files
                False,  # Output vtk extra info files
                False,  # Output vtk fluid info files
                context.scene.DsphFoamH,  # H value
                context.scene.DsphFoamMass,  # Fluid particle mass value
                context.scene.DsphFoamTimeStep,  # Timestep duration
                context.scene.DsphFoamMinX,  # Domain limits
                context.scene.DsphFoamMinY,
                context.scene.DsphFoamMinZ,
                context.scene.DsphFoamMaxX,
                context.scene.DsphFoamMaxY,
                context.scene.DsphFoamMaxZ,
                context.scene.DsphFoamMinTrappedAir,
                context.scene.DsphFoamMaxTrappedAir,
                context.scene.DsphFoamMinWaveCrests,
                context.scene.DsphFoamMaxWaveCrests,
                context.scene.DsphFoamMinKinetic,
                context.scene.DsphFoamMaxKinetic,
                context.scene.DsphFoamTAMult,
                context.scene.DsphFoamWCMult,
                context.scene.DsphFoamSprayDensity,
                context.scene.DsphFoamBubblesDensity,
                context.scene.DsphFoamLifetime,
                context.scene.DsphFoamBuoyancy,
                context.scene.DsphFoamDrag)

        fileName = context.scene.DsphFoamPrefix + str(
            context.scene.DsphFoamStart).zfill(4) + ".vtk"

        createObject(context.scene.DsphFoamPrefix + "_FOAM", fileName,
                     context.scene.DsphFoamPath, context.scene.DsphFoamPrefix,
                     ".vtk", "FOAM", True, False, False, True,
                     context.scene.DsphFoamStart, context.scene.DsphFoamEnd)

        return {'FINISHED'}
Beispiel #2
0
    pmin = root.find("./casedef/geometry/definition/pointmin")
    DomainMinx = float(pmin.get("x"))
    DomainMiny = float(pmin.get("y"))
    DomainMinz = float(pmin.get("z"))
    pmax = root.find("./casedef/geometry/definition/pointmax")
    DomainMaxx = float(pmax.get("x"))
    DomainMaxy = float(pmax.get("y"))
    DomainMaxz = float(pmax.get("z"))

diffuseparticles.run(InputDataPath,
                     InputFilesPrefix,
                     OutputDataPath,
                     FilesOutputPrefix,
                     ExclusionZoneFile,
                     StartingTimeStep,
                     EndingTimeStep,
                     ZeroPadding,
                     TextFiles,
                     VtkFiles,
                     VtkDiffuseData,
                     VtkFluidData,
                     h, mass, TimeStep,
                     DomainMinx, DomainMiny, DomainMinz, DomainMaxx, DomainMaxy, DomainMaxz,
                     MinTrappedAirThreshold, MaxTrappedAirThreshold,
                     MinWaveCrestsThreshold, MaxWaveCrestsThreshold,
                     MinKineticEnergyThreshold, MaxKineticEnergyThreshold,
                     DiffuseTrappedAirMultiplier, DiffuseWaveCrestsMultiplier,
                     SprayDensity, BubblesDensity, LifefimeMultiplier,
                     BuoyancyControl, DragControl)

    def execute(self, context):
        if parseXML(context):
            try:
                diffuseparticles.run(
                    bpy.path.abspath(
                        context.scene.DsphFoamInputPath),  # Input path
                    context.scene.DsphFoamInputPrefix,  # Input files prefix
                    bpy.path.abspath(
                        context.scene.DsphFoamPath),  # Output path
                    context.scene.DsphFoamPrefix,  # Output files prefix
                    "",  # Exclusion zone file
                    context.scene.DsphFoamStart,  # Starting timestep
                    context.scene.DsphFoamEnd,  # Ending timestep
                    4,  # Zero padding
                    False,  # Output text files
                    False,  # Output ply files
                    True,  # Output vtk files
                    False,  # Output vtk extra info files
                    False,  # Output vtk fluid info files
                    context.scene.DsphFoamH,  # H value
                    context.scene.DsphFoamMass,  # Fluid particle mass value
                    context.scene.DsphFoamTimeStep,  # Timestep duration
                    context.scene.DsphFoamMinX,  # Domain limits
                    context.scene.DsphFoamMinY,
                    context.scene.DsphFoamMinZ,
                    context.scene.DsphFoamMaxX,
                    context.scene.DsphFoamMaxY,
                    context.scene.DsphFoamMaxZ,
                    context.scene.DsphFoamMinTrappedAir,
                    context.scene.DsphFoamMaxTrappedAir,
                    context.scene.DsphFoamMinWaveCrests,
                    context.scene.DsphFoamMaxWaveCrests,
                    context.scene.DsphFoamMinKinetic,
                    context.scene.DsphFoamMaxKinetic,
                    context.scene.DsphFoamTAMult,
                    context.scene.DsphFoamWCMult,
                    context.scene.DsphFoamSprayDensity,
                    context.scene.DsphFoamBubblesDensity,
                    context.scene.DsphFoamLifetime,
                    context.scene.DsphFoamBuoyancy,
                    context.scene.DsphFoamDrag)

                fileName = context.scene.DsphFoamPrefix + str(
                    context.scene.DsphFoamStart).zfill(4) + ".vtk"

                createObject(context.scene.DsphFoamPrefix + "_FOAM", fileName,
                             context.scene.DsphFoamPath,
                             context.scene.DsphFoamPrefix, ".vtk", "FOAM",
                             True, False, False, True,
                             context.scene.DsphFoamStart,
                             context.scene.DsphFoamEnd)

                return {'FINISHED'}
            except:
                showPopup(
                    "Something went wrong with the simulation. Take a look to the system console to get more information.",
                    "Error", "ERROR")
                return {'CANCELLED'}
        else:
            showPopup(
                "Error: the XML cannot be loaded. Make sure to choose the XML file generated by the gencase tool.",
                "Error", "ERROR")
            return {'CANCELLED'}