コード例 #1
0
 def update(self):
     if CfdTools.checkWorkingDir(self.solver_object.WorkingDir):
         self.form.le_working_dir.setText(self.solver_object.WorkingDir)
     else:
         wd = CfdTools.getTempWorkingDir()
         self.solver_object.WorkingDir = wd
         self.form.le_working_dir.setText(wd)
     return
コード例 #2
0
 def update(self):
     'fills the widgets with solver properties, and it must exist and writable'
     if CfdTools.isWorkingDirValid(self.solver_object.WorkingDir):
         self.form.le_working_dir.setText(self.solver_object.WorkingDir)
     else:
         wd = CfdTools.getTempWorkingDir()
         self.solver_object.WorkingDir = wd
         self.form.le_working_dir.setText(wd)
     return
コード例 #3
0
    def get_tmp_file_paths(self):

        tmpdir = CfdTools.getTempWorkingDir()
        # geometry file
        self.temp_file_geometry = tmpdir + os.path.sep + self.part_obj.Name + '_Geometry.brep'
        print('  ' + self.temp_file_geometry)
        # mesh file
        self.mesh_name = self.part_obj.Name + '_Mesh_TmpGmsh'

        suffix = CaeMesherGmsh.output_format_suffix[
            self.mesh_obj.OutputFormat]  # '.unv'
        self.temp_file_mesh = tmpdir + os.path.sep + self.mesh_name + suffix
        print('  ' + self.temp_file_mesh)
        # GMSH input file
        self.temp_file_geo = tmpdir + os.path.sep + 'shape2mesh.geo'
        print('  ' + self.temp_file_geo)
コード例 #4
0
ファイル: CfdSolver.py プロジェクト: liujiamingustc/Cfd-4
    def __init__(self, obj):
        self.Type = "CfdSolver"
        self.Object = obj  # keep a ref to the DocObj for nonGui usage
        obj.Proxy = self  # link between App::DocumentObject to  this object

        # some properties previously defined in FemSolver C++ object are moved here
        if "SolverName" not in obj.PropertiesList:
            obj.addProperty("App::PropertyString", "SolverName", "Solver",
                            "unique solver name to identify the solver", True)
            # solver independent setup in solver control task panel
            obj.addProperty("App::PropertyPath", "WorkingDir", "Solver",
                            "Solver process is run in this directory")
            obj.addProperty(
                "App::PropertyString", "InputCaseName", "Solver",
                "input file name without suffix or case folder name")
            obj.addProperty("App::PropertyBool", "Parallel", "Solver",
                            "solver is run with muliticore or on cluster")
            obj.addProperty(
                "App::PropertyBool", "ResultObtained", "Solver",
                "result of analysis has been obtained, i.e. case setup is fine",
                True)

            import CfdTools
            obj.WorkingDir = CfdTools.getTempWorkingDir()
            obj.InputCaseName = 'TestCase'

        # other properties, supported by any CFD solver, corresponding to physical_model of CfdOF fork
        obj.addProperty("App::PropertyEnumeration", "PhysicalDomain", "Solver",
                        "unique solver name to identify the solver")
        obj.PhysicalDomain = supported_physical_domains
        obj.PhysicalDomain = 'Fluidic'

        # TODO: this should be treated as a body source
        obj.addProperty("App::PropertyVector", "Gravity", "CFD",
                        "gravity and other body accel"
                        )  # outdated, using FemConstraintSelfWeight object

        # API: addProperty(self,type,name='',group='',doc='',attr=0,readonly=False,hidden=False)
        # CfdOF: split this property into TurbulenceModel(RANSModel) and Turbulence
        if 'Turbulence' not in obj.PropertiesList:
            obj.addProperty("App::PropertyEnumeration", "Turbulence",
                            "Physics modelling",
                            "Type of major turbulence modelling group")
            obj.Turbulence = ['Inviscid', 'Laminar', 'RANS', 'LES', 'DNS']
            obj.Turbulence = 'Laminar'
        # todo: builder and write are not adapted to use this
        if "TurbulenceModel" not in obj.PropertiesList:
            obj.addProperty("App::PropertyEnumeration", "TurbulenceModel",
                            "CFD", "specific turbulence model group,etc")
            obj.TurbulenceModel = ['laminar', 'invisic', 'kEpsilon', 'kOmega']
            obj.TurbulenceModel = "laminar"

        # CfdOF: 'Thermal'  [None, Buoyant, ...]
        if "HeatTransfering" not in obj.PropertiesList:
            # heat transfer group, conjudate and radition is not activated yet
            obj.addProperty(
                "App::PropertyBool", "HeatTransfering", "HeatTransfer",
                "calc temperature field, needed by compressible flow")
            obj.addProperty(
                "App::PropertyBool", "Buoyant", "HeatTransfer",
                "gravity induced flow, needed by compressible heat transfering analysis"
            )
            '''
            obj.addProperty("App::PropertyEnumeration", "RadiationModel", "HeatTransfer",
                            "radiation heat transfer model", True)
            obj.RadiationModel = list(supported_radiation_models)
            obj.addProperty("App::PropertyBool", "Conjugate", "HeatTransfer",
                            "MultiRegion fluid and solid conjugate heat transfering analysis", True)
            '''

        if "Transient" not in obj.PropertiesList:
            # Transient solver related: CurrentTime TimeStep StartTime, StopTime, not activated yet!
            obj.addProperty("App::PropertyBool", "Transient", "Time",
                            "Static or transient analysis", True)
            obj.addProperty("App::PropertyFloat", "StartTime", "Time",
                            "Time settings for transient analysis", True)
            obj.addProperty("App::PropertyFloat", "EndTime", "Time",
                            "Time settings for transient analysis", True)
            obj.addProperty("App::PropertyFloat", "TimeStep", "Time",
                            "Time step (second) for transient analysis", True)
            obj.addProperty("App::PropertyFloat", "WriteInterval", "Time",
                            "WriteInterval (second) for transient analysis",
                            True)