def AppendValuesForTheHistoryForce(self): if PT.RecursiveFindTrueBoolInParameters(self.MAE_parameters, 'do_use_mae'): self.basset_force_tool.AppendIntegrandsWindow( self.dem_solver.spheres_model_part) else: self.basset_force_tool.AppendIntegrands( self.dem_solver.spheres_model_part)
def SetHistoryForceOptions(self): self.history_force_on = False self.MAE_parameters = Parameters("{}") for prop in self.project_parameters["properties"].values(): #TODO: now it only works for one property! self.history_force_on = (PT.RecursiveFindParametersWithCondition( self.project_parameters["properties"], 'history_force_parameters', condition=lambda value: value['name'].GetString() != 'default')) if self.history_force_on: self.MAE_parameters = prop["hydrodynamic_law_parameters"]["history_force_parameters"]["mae_parameters"] break self.do_use_mae = PT.RecursiveFindTrueBoolInParameters(self.MAE_parameters, 'do_use_mae')
def ConstructListsOfVariablesForCoupling(self, parameters): # fluid coupling variables self.coupling_fluid_vars = [] self.coupling_fluid_vars += [Kratos.MATERIAL_ACCELERATION] self.coupling_fluid_vars += [Fluid.MASS_SOURCE] self.coupling_fluid_vars += [SDEM.EXACT_VELOCITY] self.coupling_fluid_vars += [SDEM.VECTORIAL_ERROR] self.coupling_fluid_vars += [SDEM.ERROR_X] self.coupling_fluid_vars += [SDEM.ERROR_Y] self.coupling_fluid_vars += [SDEM.ERROR_Z] self.coupling_fluid_vars += [SDEM.ERROR_P] self.coupling_fluid_vars += [SDEM.SCALAR_ERROR] self.coupling_fluid_vars += [SDEM.EXACT_PRESSURE] self.coupling_fluid_vars += [ Kratos.KratosGlobals.GetVariable( parameters["body_force_per_unit_mass_variable_name"].GetString( )) ] if parameters["custom_fluid"]["fluid_model_type"].GetInt() == 0: self.coupling_fluid_vars += [SDEM.AVERAGED_FLUID_VELOCITY] if (parameters["custom_fluid"]["fluid_model_type"].GetInt() == 0 or parameters["coupling"]["coupling_level_type"].GetInt() > 1): self.coupling_fluid_vars += [Kratos.FLUID_FRACTION] self.coupling_fluid_vars += [Kratos.FLUID_FRACTION_OLD] if 'DISPERSE_FRACTION' in self.nodal_results: self.coupling_fluid_vars += [Kratos.DISPERSE_FRACTION] if parameters["coupling"]["backward_coupling"][ "filter_velocity_option"].GetBool(): self.coupling_fluid_vars += [Kratos.PARTICLE_VEL_FILTERED] self.coupling_fluid_vars += [Kratos.TIME_AVERAGED_ARRAY_3] self.coupling_fluid_vars += [Kratos.PHASE_FRACTION] if parameters["custom_fluid"]["fluid_model_type"].GetInt() >= 1: self.coupling_fluid_vars += [Kratos.FLUID_FRACTION_GRADIENT] self.coupling_fluid_vars += [Kratos.FLUID_FRACTION_RATE] if parameters["coupling"]["coupling_level_type"].GetInt() >= 1: self.coupling_fluid_vars += [Kratos.HYDRODYNAMIC_REACTION] if parameters["coupling"]["coupling_level_type"].GetInt( ) >= 1 and parameters["coupling"]["forward_coupling"][ "time_averaging_type"].GetInt() > 0: self.coupling_fluid_vars += [Kratos.MEAN_HYDRODYNAMIC_REACTION] if parameters["non_newtonian_fluid"]["non_newtonian_option"].GetBool(): self.coupling_fluid_vars += [Kratos.POWER_LAW_N] self.coupling_fluid_vars += [Kratos.POWER_LAW_K] self.coupling_fluid_vars += [Kratos.YIELD_STRESS] # self.coupling_fluid_vars += [Kratos.GEL_STRENGTH] # TODO: make specific option for this if parameters["coupling"]["backward_coupling"][ "viscosity_modification_type"].GetInt(): self.coupling_fluid_vars += [Kratos.VISCOSITY] if parameters["custom_fluid"]["embedded_option"].GetBool(): self.coupling_fluid_vars += [Kratos.DISTANCE] # dem coupling variables self.coupling_dem_vars = [] if parameters["coupling"]["coupling_level_type"].GetInt() > 0: self.coupling_dem_vars += [Kratos.FLUID_VEL_PROJECTED] self.coupling_dem_vars += [Kratos.FLUID_ACCEL_PROJECTED] self.coupling_dem_vars += [Kratos.FLUID_DENSITY_PROJECTED] self.coupling_dem_vars += [Kratos.FLUID_VISCOSITY_PROJECTED] self.coupling_dem_vars += [Kratos.HYDRODYNAMIC_FORCE] self.coupling_dem_vars += [Kratos.HYDRODYNAMIC_MOMENT] self.coupling_dem_vars += [Kratos.MATERIAL_FLUID_ACCEL_PROJECTED] self.coupling_dem_vars += [Kratos.FLUID_ACCEL_PROJECTED] self.coupling_dem_vars += [ Kratos.FLUID_ACCEL_FOLLOWING_PARTICLE_PROJECTED ] self.coupling_dem_vars += [Kratos.ADDITIONAL_FORCE ] # Here for safety for the moment if PT.RecursiveFindTrueBoolInParameters( parameters["properties"], 'do_apply_faxen_corrections'): self.coupling_dem_vars += [Kratos.FLUID_VEL_LAPL_PROJECTED] self.coupling_dem_vars += [ Kratos.FLUID_VEL_LAPL_RATE_PROJECTED ] if self.do_include_history_force: self.coupling_dem_vars += [Kratos.FLUID_VEL_PROJECTED_RATE] if parameters["coupling"]["coupling_level_type"].GetInt( ) >= 1 or parameters["custom_fluid"]["fluid_model_type"].GetInt() == 0: self.coupling_dem_vars += [Kratos.FLUID_FRACTION_PROJECTED] if (parameters["coupling"]["coupling_level_type"].GetInt() >= 1 and 'FLUID_FRACTION_GRADIENT_PROJECTED' in self.dem_printing_vars): self.coupling_dem_vars += [ Kratos.FLUID_FRACTION_GRADIENT_PROJECTED ] if parameters["non_newtonian_fluid"]["non_newtonian_option"].GetBool(): self.coupling_dem_vars += [Kratos.POWER_LAW_N] self.coupling_dem_vars += [Kratos.POWER_LAW_K] self.coupling_dem_vars += [Kratos.YIELD_STRESS] if PT.RecursiveFindParametersWithCondition( parameters["properties"], 'vorticity_induced_lift_parameters', condition=lambda value: not (value['name'].GetString() == 'default')): self.coupling_dem_vars += [Kratos.FLUID_VORTICITY_PROJECTED] self.coupling_dem_vars += [Kratos.SHEAR_RATE_PROJECTED] if parameters["custom_fluid"]["embedded_option"].GetBool(): self.coupling_dem_vars += [Kratos.DISTANCE] if 'REYNOLDS_NUMBER' in self.dem_nodal_results: self.coupling_dem_vars += [Kratos.REYNOLDS_NUMBER] if self.do_backward_coupling: if parameters["coupling"]["backward_coupling"][ "apply_time_filter_to_fluid_fraction_option"].GetBool(): self.time_filtered_vars += [Kratos.FLUID_FRACTION] if parameters["coupling"]["backward_coupling"][ "filter_velocity_option"].GetBool(): self.time_filtered_vars += [Kratos.PARTICLE_VEL_FILTERED] if self.time_filtered_vars: self.coupling_fluid_vars += [Kratos.TIME_AVERAGED_DOUBLE] self.coupling_fluid_vars += [Kratos.TIME_AVERAGED_ARRAY_3]
def ConstructListsOfVariables(self, parameters): # PRINTING VARIABLES # constructing lists of variables to be printed self.nodal_results, self.gauss_points_results = [], [] self.fluid_parameters = parameters['fluid_parameters'] if self.fluid_parameters.Has('sdem_output_processes'): gid_output_options = self.fluid_parameters[ "sdem_output_processes"]["gid_output"][0]["Parameters"] result_file_configuration = gid_output_options[ "postprocess_parameters"]["result_file_configuration"] gauss_point_results = result_file_configuration[ "gauss_point_results"] nodal_variables = self.fluid_parameters["sdem_output_processes"][ "gid_output"][0]["Parameters"]["postprocess_parameters"][ "result_file_configuration"]["nodal_results"] self.nodal_results = [ nodal_variables[i].GetString() for i in range(nodal_variables.size()) ] self.gauss_points_results = [ gauss_point_results[i].GetString() for i in range(gauss_point_results.size()) ] self.ConstructListsOfResultsToPrint(parameters) # COUPLING VARIABLES # listing the variables involved in the fluid-particles coupling if parameters["coupling"]["coupling_level_type"].GetInt(): self.ConstructListsOfVariablesForCoupling(parameters) # VARIABLES TO ADD # listing nodal variables to be added to the model parts (memory will be allocated for them) # fluid variables self.fluid_vars = [] self.fluid_vars += [Kratos.TORQUE] self.fluid_vars += self.fluid_printing_vars self.fluid_vars += self.coupling_fluid_vars if parameters["pressure_grad_recovery_type"].GetInt() > 0: self.fluid_vars += [Fluid.RECOVERED_PRESSURE_GRADIENT] if (parameters["gradient_calculation_type"].GetInt() > 1 or parameters["pressure_grad_recovery_type"].GetInt() > 1 or parameters["material_acceleration_calculation_type"].GetInt() == 7 or parameters["laplacian_calculation_type"].GetInt() > 1): self.fluid_vars += [Kratos.NODAL_WEIGHTS] if parameters["material_acceleration_calculation_type"].GetInt(): self.fluid_vars += [Kratos.MATERIAL_ACCELERATION] self.fluid_vars += [Kratos.VELOCITY_COMPONENT_GRADIENT] if (parameters["material_acceleration_calculation_type"].GetInt() == 5 or parameters["material_acceleration_calculation_type"]. GetInt() == 6): if parameters["store_full_gradient_option"].GetBool(): self.fluid_vars += [Kratos.VELOCITY_X_GRADIENT] self.fluid_vars += [Kratos.VELOCITY_Y_GRADIENT] self.fluid_vars += [Kratos.VELOCITY_Z_GRADIENT] if (parameters["vorticity_calculation_type"].GetInt() > 0 or PT.RecursiveFindParametersWithCondition( parameters["properties"], 'vorticity_induced_lift_parameters')): self.fluid_vars += [Kratos.VORTICITY] if parameters["laplacian_calculation_type"].GetInt(): self.fluid_vars += [Kratos.VELOCITY_LAPLACIAN] if PT.RecursiveFindTrueBoolInParameters(parameters["properties"], 'do_apply_faxen_corrections'): self.fluid_vars += [Kratos.VELOCITY_LAPLACIAN_RATE] if parameters["coupling"]["backward_coupling"][ "calculate_diffusivity_option"].GetBool(): self.fluid_vars += [Kratos.CONDUCTIVITY] # dem variables self.dem_vars = [] self.dem_vars += self.dem_printing_vars self.dem_vars += self.coupling_dem_vars self.dem_vars += [Kratos.BUOYANCY] self.dem_vars += [Kratos.VELOCITY_OLD] if self.do_include_history_force: self.dem_vars += [Kratos.BASSET_FORCE] if parameters["frame_of_reference"]["frame_type"].GetInt( ) and self.do_include_history_force > 0: self.dem_vars += [SDEM.DISPLACEMENT_OLD] self.dem_vars += [Kratos.VELOCITY_OLD_OLD] if (parameters["custom_dem"]["translational_integration_scheme"]. GetString() in {'Hybrid_Bashforth', 'TerminalVelocityScheme'} or self.do_include_history_force): self.dem_vars += [Kratos.VELOCITY_OLD] self.dem_vars += [Kratos.ADDITIONAL_FORCE_OLD] self.dem_vars += [Kratos.AUX_VEL] if parameters["add_each_hydro_force_option"].GetBool(): self.dem_vars += [Kratos.DRAG_FORCE] self.dem_vars += [Kratos.PARTICLE_SPHERICITY ] # TODO: add only when needed if (PT.RecursiveFindParametersWithCondition( parameters["properties"], 'vorticity_induced_lift_parameters') and parameters["add_each_hydro_force_option"].GetBool()): self.dem_vars += [Kratos.LIFT_FORCE] if parameters["add_each_hydro_force_option"].GetBool(): self.dem_vars += [Kratos.VIRTUAL_MASS_FORCE] # clusters variables self.clusters_vars = [] # rigid faces variables self.rigid_faces_vars = [ Kratos.VELOCITY, Kratos.ANGULAR_VELOCITY, Kratos.DISPLACEMENT, DEM.DELTA_DISPLACEMENT, Kratos.DELTA_ROTATION, DEM.CONTACT_FORCES, DEM.DEM_PRESSURE, DEM.ELASTIC_FORCES, Kratos.PRESSURE, DEM.TANGENTIAL_ELASTIC_FORCES, DEM.SHEAR_STRESS, Kratos.NODAL_AREA, Kratos.VELOCITY_OLD ] if parameters["custom_fluid"]["embedded_option"].GetBool(): self.rigid_faces_vars += [Kratos.FORCE] self.rigid_faces_vars += [Kratos.POSITIVE_FACE_PRESSURE] self.rigid_faces_vars += [Kratos.NEGATIVE_FACE_PRESSURE] self.fluid_vars += self.rigid_faces_vars # inlet variables self.inlet_vars = self.dem_vars