def SetConstants(self, settings): defaults = Kratos.Parameters('''{ "wall_smoothness_beta" : 5.2, "von_karman" : 0.41, "c_mu" : 0.09, "c1" : 1.44, "c2" : 1.92, "sigma_k" : 1.0, "sigma_epsilon" : 1.3, "stabilizing_upwind_operator_coefficient" : 1.2, "stabilizing_positivity_preserving_coefficient" : 1.2 }''') settings.ValidateAndAssignDefaults(defaults) process_info = self.GetBaseModelPart().ProcessInfo process_info.SetValue(KratosRANS.WALL_SMOOTHNESS_BETA, settings["wall_smoothness_beta"].GetDouble()) process_info.SetValue(KratosRANS.WALL_VON_KARMAN, settings["von_karman"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENCE_RANS_C_MU, settings["c_mu"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENCE_RANS_C1, settings["c1"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENCE_RANS_C2, settings["c2"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENT_KINETIC_ENERGY_SIGMA, settings["sigma_k"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENT_ENERGY_DISSIPATION_RATE_SIGMA, settings["sigma_epsilon"].GetDouble()) process_info.SetValue(KratosRANS.RANS_STABILIZATION_DISCRETE_UPWIND_OPERATOR_COEFFICIENT, settings["stabilizing_upwind_operator_coefficient"].GetDouble()) process_info.SetValue(KratosRANS.RANS_STABILIZATION_DIAGONAL_POSITIVITY_PRESERVING_COEFFICIENT, settings["stabilizing_positivity_preserving_coefficient"].GetDouble()) process_info.SetValue(KratosRANS.RANS_LINEAR_LOG_LAW_Y_PLUS_LIMIT, RansCalculationUtilities.CalculateLogarithmicYPlusLimit( process_info[KratosRANS.WALL_VON_KARMAN], process_info[KratosRANS.WALL_SMOOTHNESS_BETA] ))
def SetConstants(self, settings): defaults = Kratos.Parameters('''{ "wall_law_constants":{ "kappa": 0.41, "beta" : 5.2, "c_mu" : 0.09 }, "k_omega_constants": { "sigma_k" : 0.85, "sigma_omega": 0.5, "beta" : 0.0750, "a1" : 0.31 }, "k_epsilon_constants": { "sigma_k" : 1.0, "sigma_omega": 0.856, "beta" : 0.0828 }, "stabilization_constants":{ "upwind_operator_coefficient" : 1.2, "positivity_preserving_coefficient" : 1.2 } }''') settings.RecursivelyValidateAndAssignDefaults(defaults) process_info = self.GetBaseModelPart().ProcessInfo # wall law constants constants = settings["wall_law_constants"] process_info.SetValue(KratosRANS.WALL_SMOOTHNESS_BETA, constants["beta"].GetDouble()) process_info.SetValue(KratosRANS.WALL_VON_KARMAN, constants["kappa"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENCE_RANS_C_MU, constants["c_mu"].GetDouble()) process_info.SetValue(KratosRANS.RANS_LINEAR_LOG_LAW_Y_PLUS_LIMIT, RansCalculationUtilities.CalculateLogarithmicYPlusLimit( process_info[KratosRANS.WALL_VON_KARMAN], process_info[KratosRANS.WALL_SMOOTHNESS_BETA] )) # k-omega constants constants = settings["k_omega_constants"] process_info.SetValue(KratosRANS.TURBULENT_KINETIC_ENERGY_SIGMA_1, constants["sigma_k"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENT_SPECIFIC_ENERGY_DISSIPATION_RATE_SIGMA_1, constants["sigma_omega"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENCE_RANS_BETA_1, constants["beta"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENCE_RANS_A1, constants["a1"].GetDouble()) # k-epsilon constants constants = settings["k_epsilon_constants"] process_info.SetValue(KratosRANS.TURBULENT_KINETIC_ENERGY_SIGMA_2, constants["sigma_k"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENT_SPECIFIC_ENERGY_DISSIPATION_RATE_SIGMA_2, constants["sigma_omega"].GetDouble()) process_info.SetValue(KratosRANS.TURBULENCE_RANS_BETA_2, constants["beta"].GetDouble()) # stabilization parameters constants = settings["stabilization_constants"] process_info.SetValue(KratosRANS.RANS_STABILIZATION_DISCRETE_UPWIND_OPERATOR_COEFFICIENT, constants["upwind_operator_coefficient"].GetDouble()) process_info.SetValue(KratosRANS.RANS_STABILIZATION_DIAGONAL_POSITIVITY_PRESERVING_COEFFICIENT, constants["positivity_preserving_coefficient"].GetDouble())
def InitializeWallLawProperties(model): for model_part_name in model.GetModelPartNames(): for properties in model[model_part_name].Properties: # logarithmic wall law if (properties.Has(KratosRANS.WALL_VON_KARMAN) and properties.Has(KratosRANS.WALL_SMOOTHNESS_BETA)): von_karman = properties.GetValue(KratosRANS.WALL_VON_KARMAN) beta = properties.GetValue(KratosRANS.WALL_SMOOTHNESS_BETA) y_plus_limit = RansCalculationUtilities.CalculateLogarithmicYPlusLimit( von_karman, beta) properties.SetValue( KratosRANS.RANS_LINEAR_LOG_LAW_Y_PLUS_LIMIT, y_plus_limit)
def SetConstants(self, settings): defaults = Kratos.Parameters('''{ "von_karman": 0.41, "beta" : 5.2, "c_mu" : 0.09 }''') settings.ValidateAndAssignDefaults(defaults) # set constants von_karman = settings["von_karman"].GetDouble() beta = settings["beta"].GetDouble() y_plus_limit = RansCalculationUtilities.CalculateLogarithmicYPlusLimit( von_karman, beta) process_info = self.GetBaseModelPart().ProcessInfo process_info.SetValue(KratosRANS.WALL_VON_KARMAN, von_karman) process_info.SetValue(KratosRANS.WALL_SMOOTHNESS_BETA, beta) process_info.SetValue(KratosRANS.RANS_LINEAR_LOG_LAW_Y_PLUS_LIMIT, y_plus_limit) process_info.SetValue(KratosRANS.TURBULENCE_RANS_C_MU, settings["c_mu"].GetDouble())