def __init__(self, T3t=k.T3t, T0=k.T0, Pa=k.Pa, delta=0.01, gamma=k.GAMMA, verbose=True): self.delta = delta self.data = Problem1.empty_data_array(delta) self.P1 = Problem1(verbose=False) self.SF_P1, self.M0_P1 = self.P1.SF, self.P1.M0 self.M0, self.SF = 0, 0 self.air = pm.get('ig.air') self.T3t = T3t self.T0 = T0 self.Pa = Pa self.M4 = 2 self.gamma = gamma self.verbose = verbose self.ideal_nozzle()
def main(): if len(sys.argv) != 3: print "Invalid Commandline Args" return with open(sys.argv[1], 'r') as f: data = f.read() dataArr = data.split("\n") if not dataArr[0].lower() == "aggregation" and not dataArr[0].lower( ) == "monitor" and not dataArr[0].lower() == "pancakes": print "Unknown config file" return if dataArr[0].lower() == "aggregation": p = Problem2() elif dataArr[0].lower() == "pancakes": p = Problem3() else: p = Problem1() if sys.argv[2] == "all": algos = ["bfs", "iddfs", "unicost", "greedy", "astar"] for algo in algos: p.solveProblem(sys.argv[1], algo) return p.solveProblem(sys.argv[1], sys.argv[2])
def __init__(self, T3t=k.T3t, T0=k.T0, Pa=k.Pa, delta=0.01, verbose=True): self.delta = delta self.data = Problem1.empty_data_array(delta) self.T3t = T3t self.T0 = T0 self.Pa = Pa self.verbose = verbose self.P2 = Problem2()
def __init__(self, T3t=k.T3t, T0=k.T0, Pa=k.Pa, delta=0.01, gamma=k.GAMMA, verbose=True): self.delta = delta self.data = Problem1.empty_data_array(delta) self.P1 = Problem1(verbose=False) self.SF_P1, self.M0_P1 = self.P1.SF, self.P1.M0 self.air = pm.get('ig.air') self.T3t = T3t self.T0 = T0 self.Pa = Pa self.gamma = gamma self.verbose = verbose self.M0_star = self.equation_A() #self.optimize() self.M4 = 2.53 self.A = self.equation_B(self.M4) #self.nozzle_area_ratio = self.equation_B() self.execute()
def __init__(self, delta=0.01): self.data = Problem2.empty_data_array(delta) self.SF_ideal, self.M0_ideal = Problem1.return_values() # self.M0_at_SF_max = 2.34 # self.SF_max = 817.5201699820385 self.air = pm.get('ig.air') self.delta = 0.01 self.g = self.gamma(k.T0) self.Ts, self.gs = self.throat_convergence() self.Ps = self.pressure_from_temperature() self.Te = self.temperature_from_pressure() self.Me_id = self.Me_ideal() self.A = self.area_ratio() self.execute()
try: while True: system('cls') # limpa a tela header() # exibe nome do sistema, nomes dos desenvolvedores e telefone da FATEC Ourinhos # escolha de qual problema ser executado option = input( ' 1. Determinar quantos hectares devem ser cultivados para cada uma das plantações e ' 'tendo lucro máximo.\n' ' 2. Determinar quantos hectares devem ser cultivados para cada uma das plantações e ' 'quanto de cada criação deve ser mantido para maximizar a receita líquida.\n' ' 3. Maximizar o valor presente das plantações e escolher quais cultivar.\n\n' ' Qual problema deve ser executado? ') system('cls') # limpa a tela header() # exibe nome do sistema, nomes dos desenvolvedores e telefone da FATEC Ourinhos if option.__eq__('1'): Problem1() break elif option.__eq__('2'): Problem2() break elif option.__eq__('3'): Problem3() break else: print(' Opção inválida!', end='\n\n') pause(' Pressione qualquer tecla para continuar...') print(end='\n') # verificando se deseja executar o Agroplex novamente a = '' while not a.lower().startswith('s') and not a.lower().startswith('n'): a = input('\n Executar novamente? (S/N): ')
# mpi communicator comm = mpi_comm_world() if MPI.rank(comm) == 0 : set_log_level(PROGRESS) else : set_log_level(ERROR) # arguments args = get_args() post = args.postprocess # run the simulation quad = 4 order = 2 fact = 1.0 ndivs = [ 1, 2, 4, 8, 16 ] dofs = [] poss = [] for ndiv in ndivs : pb = Problem1(comm, post, ndiv=ndiv, order=order, quad=quad, reduction_factor=fact, structured=False) pb.run() dofs.append(pb.problem.state.function_space().dim()) poss.append(pb.problem.get_point_position()) info("order ndiv fact dofs posx posy posz") for ndiv, dof, pos in zip(ndivs, dofs, poss) : info("{:5d} {:4d} {:5.1f} {:7d} {:.4f} {:.4f} {:.4f}"\ .format(order, ndiv, fact, dof, pos[0], pos[1], pos[2]))
def setUp(self): self.problem1 = Problem1()
def prob1(): if request.method=='POST': starID = request.form['starID'] starlist = Problem1(starID) return render_template('prob1result.html', results=starlist, starID=starID) return render_template('prob1.html')
from problem1 import Problem1 from problem2 import Problem2 if __name__ == "__main__": Problem1().run(19.5, 20, 22) Problem2().run(80, 60) # result_p2 = Problem2().run(20, 22) # print(f"{result_p1:.3f}") # print(f"{result_p2:.3f}")