Beispiel #1
0
    def do_setup(self, arg, opts=None):
        """Setup main solver and all other necessary files"""
        try:
            self.problem.loadBoundaries()
            self.problem.solver = chooseFromDictionary("Choose solver:", ofoam.solvers)()
            ## @todo Now only RAS model

            print "== Setup RASP =="
            self.problem.raspFile = ofoam.rasproperties.cmdSetup()
            self.problem.turbulentModel = self.problem.raspFile.data[0][1][0][1]

            print "== Setup Variables =="
            self.problem.variables = self.problem.solver.getDefaultVariables(self.problem.turbulentModel)

            linSolver = None
            for v in self.problem.variables:
                if linSolver != None and query_yn("Use previous solver for " + v.name):
                    v.solver = linSolver
                else:
                    linSolver = ofoam.linSolvers.cmdSetup(v.name)
                    v.solver = linSolver

                v.relaxFactor = askForFloat("Set relax factor ", v.relaxFactor)
                v.resControl = askForFloat("Set residual control ", v.resControl)

            self.problem.nlSolverConf = setupFromOptions(
                ofoam.nLinSolvers.Options.options[self.problem.solver.nlSolver]
            )

            print "== SAVE FV Solution =="
            self.problem.saveFvSolution()

        except IncompleteData as e:
            print e
Beispiel #2
0
def cmdSetup(vName):

    print 'SETUP ' + vName
    setup = [('solver', chooseFromList('Select solver : ', [o[0] for o in Options.options]))]
    
    opts = []
    
    for i in Options.options:
        if i[0] == setup[0][1]:
            opts = i[1]
            break
    
    setup += setupFromOptions(opts)
    
    return setup
Beispiel #3
0
def cmdSetup(solverName):
    conf = [('application', solverName)]
    conf += (setupFromOptions(Options.options))
    return conf