max_it = m monolithic_linear_solver = MixedUPLinearSolver(velocity_linear_solver, pressure_linear_solver, 1e-6, max_it, m) elif ProjectParameters.Monolithic_Linear_Solver == "SuperLUIterativeSolver": monolithic_linear_solver = ScalingSolver(SuperLUIterativeSolver(), True) # copy Y_WALL for node in fluid_model_part.Nodes: y = node.GetSolutionStepValue(Y_WALL, 0) node.SetValue(Y_WALL, y) dynamic_tau = ProjectParameters.use_dt_in_stabilization oss_switch = ProjectParameters.use_orthogonal_subscales # creating the solvers # fluid solver if(SolverType == "FractionalStep"): fluid_solver = solver.IncompressibleFluidSolver(fluid_model_part, domain_size) fluid_solver.max_val_its = ProjectParameters.max_vel_its fluid_solver.max_press_its = ProjectParameters.max_press_its fluid_solver.predictor_corrector = ProjectParameters.predictor_corrector fluid_solver.vel_toll = ProjectParameters.velocity_relative_tolerance fluid_solver.press_toll = ProjectParameters.pressure_relative_tolerance fluid_solver.dynamic_tau = float(dynamic_tau) fluid_solver.compute_reactions = ProjectParameters.Calculate_reactions elif(SolverType == "monolithic_solver_eulerian"): fluid_solver = solver.MonolithicSolver(fluid_model_part, domain_size) fluid_solver.oss_switch = int(oss_switch) fluid_solver.dynamic_tau = float(dynamic_tau) fluid_solver.rel_vel_tol = ProjectParameters.velocity_relative_tolerance fluid_solver.abs_vel_tol = ProjectParameters.velocity_absolute_tolerance fluid_solver.rel_pres_tol = ProjectParameters.pressure_relative_tolerance fluid_solver.abs_pres_tol = ProjectParameters.pressure_absolute_tolerance
fluid_model_part.SetBufferSize(3) # adding dofs fractional_step_solver.AddDofs(fluid_model_part) # check to ensure that no node has zero density or pressure for node in fluid_model_part.Nodes: if (node.GetSolutionStepValue(DENSITY) == 0.0): print("node ", node.Id, " has zero density!") raise 'node with zero density found' if (node.GetSolutionStepValue(VISCOSITY) == 0.0): print("node ", node.Id, " has zero viscosity!") raise 'node with zero VISCOSITY found' # creating the solvers # fluid solver fluid_solver = fractional_step_solver.IncompressibleFluidSolver( fluid_model_part, domain_size) fluid_solver.predictor_corrector = False fluid_solver.ReformDofAtEachIteration = False fluid_solver.max_press_its = 3 fluid_solver.max_vel_its = 5 fluid_solver.velocity_linear_solver = SkylineLUFactorizationSolver() fluid_solver.pressure_linear_solver = SkylineLUFactorizationSolver() fluid_solver.Initialize() print("fluid solver created") # mesh to be printed if write_post_file: gid_mode = GiDPostMode.GiD_PostBinary multifile = MultiFileFlag.MultipleFiles deformed_mesh_flag = WriteDeformedMeshFlag.WriteUndeformed write_conditions = WriteConditionsFlag.WriteElementsOnly