def __init__(self, Model, settings): KratosMultiphysics.Process.__init__(self) default_parameters = KratosMultiphysics.Parameters(""" { "model_part_name" : "default_model_part_name", "perform_corrections" : true, "correction_frequency_in_time_steps" : 20, "write_to_log_file" : true, "log_file_name" : "mass_conservation.log" } """) settings.ValidateAndAssignDefaults(default_parameters) self._fluid_model_part = Model[settings["model_part_name"].GetString()] self._write_to_log = settings["write_to_log_file"].GetBool() self._my_log_file = settings["log_file_name"].GetString() self._is_printing_rank = ( self._fluid_model_part.GetCommunicator().MyPID() == 0) self.mass_conservation_check_process = KratosFluid.MassConservationCheckProcess( self._fluid_model_part, settings) if self._is_printing_rank: KratosMultiphysics.Logger.PrintInfo( "ApplyMassConservationCheckProcess", "Construction finished.")
def __init__(self, Model, settings): KratosMultiphysics.Process.__init__(self) default_parameters = KratosMultiphysics.Parameters(""" { "model_part_name" : "default_model_part_name", "mass_computation_frequency" : 20, "compare_to_initial_values" : true, "write_to_log_file" : true } """) settings.ValidateAndAssignDefaults(default_parameters) self.fluid_model_part = Model[settings["model_part_name"].GetString()] self.write_to_log = settings["write_to_log_file"].GetBool() self.mass_conservation_check_process = KratosFluid.MassConservationCheckProcess( self.fluid_model_part, settings) # writing first line in file if (self.write_to_log): with open("ApplyMassConservationCheckProcess.log", "w") as logFile: logFile.write("positiveVolume" + "\t" + "negativeVolume" + "\n")