def Initialize(self):
        """This function initializes the PfemFluidExplicitSolver
        Usage: It is designed to be called ONCE, BEFORE the execution of the solution-loop
        """
        self.KratosPrintInfo("::[Pfem Fluid Explicit Solver]:: -START-")

        # Get the computing model part
        self.computing_model_part = self.GetComputingModelPart()
        mechanical_scheme = KratosPfemFluid.FirstOrderForwardEulerScheme(
            1.0e-4, 1.0, 0, 0)
        import KratosMultiphysics.python_linear_solver_factory as linear_solver_factory
        linear_solver = linear_solver_factory.ConstructSolver(
            self.settings["velocity_linear_solver_settings"])
        self.fluid_solver = KratosPfemFluid.ExplicitStrategy(
            self.computing_model_part, mechanical_scheme, linear_solver, False,
            True, True)
        # Set echo_level
        self.fluid_solver.SetEchoLevel(self.settings["echo_level"].GetInt())

        # Set initialize flag
        if self.main_model_part.ProcessInfo[
                KratosMultiphysics.IS_RESTARTED] == True:
            self.mechanical_solver.SetInitializePerformedFlag(True)

        # Check if everything is assigned correctly
        self.fluid_solver.Check()
        self.KratosPrintInfo("::[Pfem Fluid  Explicit Solver]:: -END- ")
Esempio n. 2
0
    def _InitializeGiDIO(self, gidpost_flags, param):
        '''Initialize GidIO objects (for volume and cut outputs) and related data.'''
        self.volume_file_name = self.base_file_name
        self.cut_file_name = self.volume_file_name + "_cuts"
        self.post_mode = self.__get_gidpost_flag(param, "GiDPostMode",
                                                 self.__post_mode)
        self.write_deformed_mesh = self.__get_gidpost_flag(
            param, "WriteDeformedMeshFlag", self.__write_deformed_mesh)
        self.write_conditions = self.__get_gidpost_flag(
            param, "WriteConditionsFlag", self.__write_conditions)
        self.multifile_flag = self.__get_gidpost_flag(param, "MultiFileFlag",
                                                      self.__multi_file_flag)

        if self.body_output or self.node_output:
            self.body_io = PfemFluid.PfemFluidGidIO(self.volume_file_name,
                                                    self.post_mode,
                                                    self.multifile_flag,
                                                    self.write_deformed_mesh,
                                                    self.write_conditions)

        if self.skin_output or self.num_planes > 0:
            self.cut_io = PfemFluid.PfemFluidGidIO(
                self.cut_file_name, self.post_mode, self.multifile_flag,
                self.write_deformed_mesh,
                WriteConditionsFlag.WriteConditionsOnly
            )  # Cuts are conditions, so we always print conditions in the cut ModelPart
    def SetPreMeshingProcesses(self):

        if (self.echo_level > 0):
            print(
                "::[fluid_pre_refining_mesher]:: -START SetPreMeshingProcesses-"
            )

        refining_parameters = self.MeshingParameters.GetRefiningParameters()
        refining_options = refining_parameters.GetRefiningOptions()

        #recover_volume_losses  = KratosPfemFluid.RecoverVolumeLosses(self.model_part, self.MeshingParameters, self.echo_level)
        #self.mesher.SetPreMeshingProcess(recover_volume_losses)

        unactive_peak_elements = False
        unactive_sliver_elements = False
        set_active_flag = KratosPfemFluid.SetActiveFlagMesherProcess(
            self.main_model_part, unactive_peak_elements,
            unactive_sliver_elements, self.echo_level)
        self.mesher.SetPreMeshingProcess(set_active_flag)

        inlet_management = KratosPfemFluid.InletManagement(
            self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPreMeshingProcess(inlet_management)

        remove_mesh_nodes = KratosPfemFluid.RemoveMeshNodesForFluids(
            self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPreMeshingProcess(remove_mesh_nodes)

        if (refining_options.Is(
                KratosDelaunay.MesherUtilities.REFINE_INSERT_NODES)):
            generate_new_nodes = KratosPfemFluid.GenerateNewNodesBeforeMeshing(
                self.model_part, self.MeshingParameters, self.echo_level)
            self.mesher.SetPreMeshingProcess(generate_new_nodes)
Esempio n. 4
0
    def CreateAssignmentProcess(self, params):

        if( self.value_is_numeric ):
            params.AddValue("variable_name", self.settings["variable_name"])
            counter = 0
            for i in self.value:
                params["value"][counter].SetDouble(i)
                counter+=1
            self.AssignValueProcess = PfemFluid.AssignVectorToConditionsProcess(self.model_part, params)
        else:
            #function values are assigned to a vector variable :: transformation is needed
            if( isinstance(self.var,KratosMultiphysics.Array1DVariable3) ):
                variable_name = self.settings["variable_name"].GetString() + "_VECTOR"
                #print("::[--Assign_Variable--]:: "+variable_name)
                params.AddEmptyValue("variable_name")
                params["variable_name"].SetString(variable_name)
            else:
                params.AddValue("variable_name", self.settings["variable_name"])
            counter = 0
            for i in self.value:
                params["value"][counter].SetDouble(i)
                counter+=1
            params.AddEmptyValue("entity_type").SetString("CONDITIONS")
            self.AssignValueProcess = PfemFluid.AssignVectorFieldToEntitiesProcess(self.model_part, self.compiled_function, "function",  self.value_is_spatial_function, params)

        # in case of going to previous time step for time step reduction
        self.CreateUnAssignmentProcess(params)
Esempio n. 5
0
    def SetPostMeshingProcesses(self):

        # The order set is the order of execution:
        if(self.echo_level>0):
            print("::[fluid_mesher]:: -START SetPostMeshingProcesses-")

        #select mesh elements
        select_mesh_elements  = KratosPfemFluid.SelectMeshElementsForFluids(self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(select_mesh_elements)
        #rebuild elements
        #rebuild_mesh_elements = KratosDelaunay.BuildMeshElements(self.main_model_part, self.MeshingParameters, self.echo_level)
        #self.mesher.SetPostMeshingProcess(rebuild_mesh_elements)

        #rebuild elements
        rebuild_mesh_elements = KratosDelaunay.GenerateNewElements(self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_elements)

        ### rebuild boundary
        ############ choose just one of the following two options: ############
        ## use this if you want conditions
        ## ATTENTION: this is slow, and must be used together with ModelMeshingWithConditionsForFluids and BuildModelPartBoundary
        #rebuild_mesh_boundary = KratosPfemFluid.GenerateNewConditionsForFluids(self.model_part, self.MeshingParameters, self.echo_level)
        ## if you use the following, you will not use/build/compute conditions
        ## ATTENTION: it must be used together with ModelMeshingForFluids and BuildModelPartBoundaryForFluids
        rebuild_mesh_boundary = KratosPfemFluid.BuildMeshBoundaryForFluids(self.model_part, self.MeshingParameters, self.echo_level)
        #######################################################################
        self.mesher.SetPostMeshingProcess(rebuild_mesh_boundary)
 def SolveSolutionStep(self):
     pfem_is_converged = self.fluid_solver.SolveSolutionStep()
     KratosPfemFluid.SetMeshVelocityForThermalCouplingProcess(self.fluid_solver.main_model_part).Execute()
     KratosPfemFluid.SetMaterialPropertiesForThermalCouplingProcess(self.fluid_solver.main_model_part,self.thermal_solver.main_model_part).Execute()
     KM.Logger.Print("\nSolution of convection-diffusion at t=" + "{:.3f}".format(self.fluid_solver.main_model_part.ProcessInfo[KM.TIME]) + "s", label="")
     KM.Logger.Flush()
     thermal_is_converged = self.thermal_solver.SolveSolutionStep()
     return (pfem_is_converged and thermal_is_converged)
 def CreateUnAssignmentProcess(self, params):
     params["compound_assignment"].SetString(self.GetInverseAssigment(self.settings["compound_assignment"].GetString()))
     if( self.value_is_numeric ):
         self.UnAssignValueProcess = PfemFluid.AssignScalarToEntitiesProcess(self.model_part, params)
     else:
         if( self.value_is_current_value ):
             self.UnAssignValueProcess = KratosMultiphysics.Process() #void process
         else:
             self.UnAssignValueProcess = PfemFluid.AssignScalarFieldToEntitiesProcess(self.model_part, self.compiled_function, "function",  self.value_is_spatial_function, params)
Esempio n. 8
0
    def InitializeSolutionStep(self):
        #self.fluid_solver.InitializeSolutionStep()

        adaptive_time_interval = KratosPfemFluid.AdaptiveTimeIntervalProcess(self.main_model_part,self.settings["echo_level"].GetInt())
        adaptive_time_interval.Execute()

        unactive_peak_elements = True
        unactive_sliver_elements = True
        set_active_flag = KratosPfemFluid.SetActiveFlagProcess(self.main_model_part,unactive_peak_elements,unactive_sliver_elements,self.settings["echo_level"].GetInt())
        set_active_flag.Execute()
 def CreateUnAssignmentProcess(self, params):
     params["compound_assignment"].SetString(
         self.GetInverseAssigment(
             self.settings["compound_assignment"].GetString()))
     if (self.value_is_numeric):
         self.UnAssignValueProcess = PfemFluid.AssignVectorToConditionsProcess(
             self.model_part, params)
     else:
         self.UnAssignValueProcess = PfemFluid.AssignVectorFieldToEntitiesProcess(
             self.model_part, self.compiled_function, "function",
             self.value_is_spatial_function, params)
    def SetFixAndFreeProcesses(self,params):

        if( self.fix_time_integration == True ):
            params["variable_name"].SetString(self.settings["variable_name"].GetString())
            self.primary_variable_name = self.TimeIntegrationMethod.GetPrimaryVariableName()
            if( self.primary_variable_name != self.variable_name ):
                params["variable_name"].SetString(self.primary_variable_name)

        fix_dof_process  =  PfemFluid.FixScalarPfemDofProcess(self.model_part, params)
        self.FixDofsProcesses.append(fix_dof_process)
        free_dof_process = PfemFluid.FreeScalarPfemDofProcess(self.model_part, params)
        self.FreeDofsProcesses.append(free_dof_process)
Esempio n. 11
0
    def SetPostMeshingProcesses(self):

        # The order set is the order of execution:
        print(
            "::[fluid_post_refining_modeler]:: -START SetPostMeshingProcesses-"
        )

        #select mesh elements
        #generate_particles  = KratosPfemBase.GenerateNewNodes(self.main_model_part, self.MeshingParameters, self.mesh_id, self.echo_level)
        #self.mesher.SetPostMeshingProcess(generate_particles)

        #select mesh elements
        #select_mesh_elements  = KratosPfemBase.SelectMeshElements(self.main_model_part, self.MeshingParameters, self.echo_level)
        #self.mesher.SetPostMeshingProcess(select_mesh_elements)
        select_mesh_elements = KratosPfemFluid.SelectMeshElementsForFluids(
            self.main_model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(select_mesh_elements)

        #rebuild elements
        #rebuild_mesh_elements = KratosPfemBase.BuildMeshElements(self.main_model_part, self.MeshingParameters, self.mesh_id, self.echo_level)
        rebuild_mesh_elements = KratosPfemBase.BuildMeshElements(
            self.main_model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_elements)

        #rebuild boundary
        rebuild_mesh_boundary = KratosPfemBase.ReconstructMeshBoundary(
            self.main_model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_boundary)
Esempio n. 12
0
    def Initialize(self):
        KratosMultiphysics.Logger.PrintInfo(
            "SwimmingDEM",
            self.main_model_part.SetBufferSize(
                self.settings["buffer_size"].GetInt()))

        # Get the computing model part
        self.computing_model_part = self.GetComputingModelPart()

        self.fluid_solver = KratosPfemFluid.TwoStepVPDEMcouplingStrategy(
            self.computing_model_part, self.velocity_linear_solver,
            self.pressure_linear_solver,
            self.settings["reform_dofs_at_each_step"].GetBool(),
            self.settings["velocity_tolerance"].GetDouble(),
            self.settings["pressure_tolerance"].GetDouble(),
            self.settings["maximum_pressure_iterations"].GetInt(),
            self.settings["time_order"].GetInt(),
            self.main_model_part.ProcessInfo[
                KratosMultiphysics.SPACE_DIMENSION])

        echo_level = self.settings["echo_level"].GetInt()

        # Set echo_level
        self.fluid_solver.SetEchoLevel(echo_level)

        # Check if everything is assigned correctly
        self.fluid_solver.Check()
Esempio n. 13
0
    def RemeshFluidDomains(self):

        if (self.remesh_domains_active):
            # if(self.contact_search):
            #    self.ContactTransfer()

            if (self.echo_level > 1):
                print("::[Remesh_fluid_domains_process]:: MESH DOMAIN...",
                      self.counter)

            meshing_options = KratosMultiphysics.Flags()
            self.modeler_utils = KratosPfemBase.ModelerUtilities()

            meshing_options.Set(self.modeler_utils.KEEP_ISOLATED_NODES, True)

            #self.model_meshing =  KratosPfemBase.ModelMeshing(self.main_model_part, meshing_options, self.echo_level)
            self.model_meshing = KratosPfemFluid.ModelMeshingForFluids(
                self.main_model_part, meshing_options, self.echo_level)

            self.model_meshing.ExecuteInitialize()

            id = 0

            for domain in self.meshing_domains:

                domain.ExecuteMeshing()

                self.remesh_executed = True

                id += 1

            self.model_meshing.ExecuteFinalize()

            self.counter += 1
Esempio n. 14
0
    def __init__(self, Model, custom_settings ):

        assign_vector_components_to_nodes_process.AssignVectorComponentsToNodesProcess.__init__(self, Model, custom_settings)


        ##add inlet to fluid domain:
        #transfer_flags = KratosSolid.FlagsContainer()
        #transfer_flags.PushBack(KratosMultiphysics.NOT_FLUID)
        #assign_flags = KratosSolid.FlagsContainer()
        #assign_flags.PushBack(KratosMultiphysics.FLUID)
        #entity_type = "Nodes"
        #for part in self.model:
            #print(" A: Part ",part)
            #for sub_part in self.model[part].SubModelParts:
                #print(" B: SubPart ",sub_part)
                #if(sub_part.Is(KratosMultiphysics.FLUID)):
                    #if(sub_part.IsNot(KratosMultiphysics.ACTIVE)):
                        #print(" C: FLUID  ",sub_part)
                        #transfer_process = KratosSolid.TransferEntitiesProcess(sub_part,self.model_part,entity_type,transfer_flags,assign_flags)
                        #transfer_process.Execute()

        self.model_part = Model[custom_settings["model_part_name"].GetString()]

        self.echo_level=0
        self.model_inlet =  KratosPfemFluid.SetInlet(self.model_part,self.echo_level)
        self.model_inlet.Execute()
Esempio n. 15
0
    def SetPostMeshingProcesses(self):

        # The order set is the order of execution:
        if (self.echo_level > 0):
            print(
                "::[fluid_pre_refining_modeler]:: -START SetPostMeshingProcesses-"
            )

        refining_parameters = self.MeshingParameters.GetRefiningParameters()
        refining_options = refining_parameters.GetRefiningOptions()

        #select mesh elements
        select_mesh_elements = KratosPfemFluid.SelectMeshElementsForFluids(
            self.model_part, self.MeshingParameters, self.echo_level)
        #select_mesh_elements  = KratosPfem.SelectMeshElements(self.main_model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(select_mesh_elements)
        #rebuild elements
        #rebuild_mesh_elements = KratosPfem.BuildMeshElements(self.main_model_part, self.MeshingParameters, self.mesh_id, self.echo_level)
        #self.mesher.SetPostMeshingProcess(rebuild_mesh_elements)

        if (refining_options.Is(KratosPfem.ModelerUtilities.REFINE_ADD_NODES)):
            select_refine_elements = KratosPfem.SetElementsToRefineOnSize(
                self.model_part, self.MeshingParameters, self.echo_level)
            self.mesher.SetPostMeshingProcess(select_refine_elements)

    #rebuild elements
    #rebuild_mesh_elements = KratosPfem.BuildMeshElements(self.model_part, self.MeshingParameters, self.mesh_id, self.echo_level)
        rebuild_mesh_elements = KratosPfem.BuildMeshElements(
            self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_elements)

        #rebuild boundary
        rebuild_mesh_boundary = KratosPfem.BuildMeshBoundary(
            self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_boundary)
Esempio n. 16
0
    def Initialize(self):

        print("::[Pfem Fluid Solver]:: -START-")

        print(self.main_model_part.SetBufferSize(self.settings["buffer_size"].GetInt()))

        # Get the computing model part
        self.computing_model_part = self.GetComputingModelPart()

        self.fluid_solver = KratosPfemFluid.TwoStepVPDEMcouplingStrategy(self.computing_model_part,
                                                              self.velocity_linear_solver,
                                                              self.pressure_linear_solver,
                                                              self.settings["reform_dofs_at_each_step"].GetBool(),
                                                              self.settings["velocity_tolerance"].GetDouble(),
                                                              self.settings["pressure_tolerance"].GetDouble(),
                                                              self.settings["maximum_pressure_iterations"].GetInt(),
                                                              self.settings["time_order"].GetInt(),
                                                              self.main_model_part.ProcessInfo[KratosMultiphysics.SPACE_DIMENSION])

        echo_level = self.settings["echo_level"].GetInt()

        # Set echo_level
        self.fluid_solver.SetEchoLevel(echo_level)

        # Set initialize flag
        if( self.main_model_part.ProcessInfo[KratosMultiphysics.IS_RESTARTED] == True ):
            self.mechanical_solver.SetInitializePerformedFlag(True)


        # Check if everything is assigned correctly
        self.fluid_solver.Check()


        print("::[Pfem Fluid Solver]:: -END- ")
    def RemeshDomains(self):

        if(self.remesh_domains):

            if( self.echo_level >= 0 ):
                print("::[Modeler_Utility]:: MESH DOMAIN...", self.counter)

            #meshing_options = Flags()
            meshing_options = KratosMultiphysics.Flags()

            #self.model_meshing = ModelMeshing(self.model_part, meshing_options, self.echo_level)
            self.model_meshing = KratosPfemFluid.ModelMeshingForFluids(self.model_part, meshing_options, self.echo_level)

            ##self.model_meshing = ModelMeshingForFluids(self.model_part, meshing_options, self.echo_level)

            self.model_meshing.ExecuteInitialize()

            id = 0
            for mesher in self.mesh_modelers:

                mesh_id = self.mesh_ids[id]
                
                mesher.InitializeMeshModeler(self.model_part)
                
                mesher.GenerateMesh(self.model_part);

                mesher.FinalizeMeshModeler(self.model_part)

                self.remesh_executed = True

                id+=1

            self.model_meshing.ExecuteFinalize()
          
            self.counter += 1 
    def ExecuteInitializeSolutionStep(self):
        """This function executes the Initialize solution step of the process
        """
        self.step_count += 1
        currentTime = self.main_model_part.ProcessInfo[KratosMultiphysics.TIME]
        currentStep = self.main_model_part.ProcessInfo[KratosMultiphysics.STEP]

        if currentStep >= 2 and self.fileTotalVolume is None and self.write_total_volume:
            self.fileTotalVolume = open("totalVolumeBeforeMeshing.txt", 'w')

        if (currentStep > 1 and self.fileTotalVolume is not None):
            for domain in self.meshing_domains:
                if (domain.Active()):
                    domain.ComputeAverageMeshParameters()
                    meanVolumeBeforeMeshing = domain.GetMeanVolume()
                    totalVolumeBeforeMeshing = domain.GetTotalVolume()
                    outstring = str(currentTime) + " " + str(
                        totalVolumeBeforeMeshing) + " "
                    self.fileTotalVolume.write(outstring)

        volume_acceleration = self.main_model_part.ProcessInfo[
            KratosMultiphysics.GRAVITY]
        variable_utils = KratosMultiphysics.VariableUtils()
        if (currentStep == 1):
            variable_utils.SetVectorVar(KratosMultiphysics.VOLUME_ACCELERATION,
                                        volume_acceleration,
                                        self.main_model_part.Nodes)

        if self.remesh_domains_active:
            if self.meshing_before_output:
                if self.IsMeshingStep():
                    if self.echo_level > 1:
                        print(
                            "::[Remesh_Fluid_Domains_Process]:: RemeshFluidDomains "
                        )
                    self.RemeshFluidDomains()

                    # Updating conditions on the free surface
                    if self.update_conditions_on_free_surface:
                        if self.echo_level > 1:
                            print(
                                "::[Remesh_Fluid_Domains_Process]:: UpdateConditionsOnFreeSurface "
                            )
                        KratosPfemFluid.UpdateConditionsOnFreeSurfaceProcess(self.main_model_part, \
                            self.settings["update_conditions_on_free_surface"]).Execute()

        if currentStep > 1 and self.fileTotalVolume is not None:
            for domain in self.meshing_domains:
                if domain.Active():
                    domain.ComputeAverageMeshParameters()
                    meanVolumeAfterMeshing = domain.GetMeanVolume()
                    totalVolumeAfterMeshing = domain.GetTotalVolume()
                    diffMeanVolume = meanVolumeAfterMeshing - meanVolumeBeforeMeshing
                    diffTotalVolume = totalVolumeAfterMeshing - totalVolumeBeforeMeshing
                    outstring = str(totalVolumeAfterMeshing) + " " + str(
                        diffTotalVolume) + "\n"
                    self.fileTotalVolume.write(outstring)
        if self.fileTotalVolume is not None:
            self.fileTotalVolume.flush()
Esempio n. 19
0
    def InitializeSolutionStep(self):
        #self.fluid_solver.InitializeSolutionStep()
        if self._TimeBufferIsInitialized():
            self.fluid_solver.InitializeSolutionStep()

        if (self.settings["time_stepping"]["automatic_time_step"].GetBool()):
            adaptive_time_interval = KratosPfemFluid.AdaptiveTimeIntervalProcess(self.main_model_part,self.settings["echo_level"].GetInt())
            adaptive_time_interval.Execute()
    def SetPostMeshingProcesses(self):

        # The order set is the order of execution:
        if(self.echo_level>0):
            print("::[fluid_mesher]:: -START SetPostMeshingProcesses-")

        rebuild_mesh_boundary = KratosPfemFluid.BuildMeshBoundaryForFluids(self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_boundary)
    def CreateAssignmentProcess(self, params):

        params["variable_name"].SetString(self.settings["variable_name"].GetString())
        if( self.value_is_numeric ):
            params.AddEmptyValue("value").SetDouble(self.value)
            params.AddEmptyValue("entity_type").SetString("NODES")
            self.AssignValueProcess = PfemFluid.AssignScalarToEntitiesProcess(self.model_part, params)
        else:
            if( self.value_is_current_value ):
                self.AssignValueProcess = KratosMultiphysics.Process() #void process
            else:
                params.AddEmptyValue("entity_type").SetString("NODES")
                self.AssignValueProcess = PfemFluid.AssignScalarFieldToEntitiesProcess(self.model_part, self.compiled_function, "function",  self.value_is_spatial_function, params)


        # in case of going to previous time step for time step reduction
        self.CreateUnAssignmentProcess(params)
Esempio n. 22
0
    def FinalizeSolutionStep(self):
        #pass
        self.fluid_solver.FinalizeSolutionStep()  

        unactive_peak_elements = True
        unactive_sliver_elements = True
        set_active_flag = KratosPfemFluid.SetActiveFlagProcess(self.main_model_part,unactive_peak_elements,unactive_sliver_elements,self.settings["echo_level"].GetInt())
        set_active_flag.ExecuteFinalize()
 def InitializeSolutionStep(self):
     KratosPfemFluid.UpdateThermalModelPartProcess(
         self.fluid_solver.main_model_part, \
         self.thermal_solver.main_model_part, \
         self.thermal_solver.GetComputingModelPart(), \
         self.domain_size).Execute()
     self.fluid_solver.InitializeSolutionStep()
     self.thermal_solver.InitializeSolutionStep()
    def SetPreMeshingProcesses(self):

        if(self.echo_level>0):
            print("::[fluid_mesher]:: -START SetPreMeshingProcesses-")
        
        unactive_peak_elements = False
        unactive_sliver_elements = False
        set_active_flag = KratosPfemFluid.SetActiveFlagMesherProcess(self.main_model_part,unactive_peak_elements,unactive_sliver_elements,self.echo_level)
        self.mesher.SetPreMeshingProcess(set_active_flag)
Esempio n. 25
0
    def Initialize(self):

        print("::[Pfem Fluid Explicit Solver]:: -START-")

        # Get the computing model part
        self.computing_model_part = self.GetComputingModelPart()

        #mechanical_scheme = KratosSolidMechanics.ExplicitCentralDifferencesScheme(self.settings["max_delta_time"].GetDouble(),
        #                                                                          self.settings["fraction_delta_time"].GetDouble(),
        #                                                                          self.settings["time_step_prediction_level"].GetDouble(),
        #                                                                          self.settings["rayleigh_damping"].GetBool())

        mechanical_scheme = KratosPfemFluid.FirstOrderForwardEulerScheme(1.0e-4,
                                                                         1.0,
                                                                         0,
                                                                         0)
        import KratosMultiphysics.python_linear_solver_factory as linear_solver_factory
        linear_solver = linear_solver_factory.ConstructSolver(self.settings["velocity_linear_solver_settings"])
        #self.fluid_solver = KratosPfemFluid.ExplicitStrategy(self.computing_model_part,
        #                                                     mechanical_scheme,
        #                                                     linear_solver,
        #                                                     self.settings["compute_reactions"].GetBool(),
        #                                                     self.settings["reform_dofs_at_each_step"].GetBool(),
        #                                                     self.settings["move_mesh_flag"].GetBool())

        self.fluid_solver = KratosPfemFluid.ExplicitStrategy(self.computing_model_part,
                                                             mechanical_scheme,
                                                             linear_solver,
                                                             False,
                                                             True,
                                                             True)
        # Set echo_level
        self.fluid_solver.SetEchoLevel(self.settings["echo_level"].GetInt())

        # Set initialize flag
        if( self.main_model_part.ProcessInfo[KratosMultiphysics.IS_RESTARTED] == True ):
            self.mechanical_solver.SetInitializePerformedFlag(True)

        # Check if everything is assigned correctly
        self.fluid_solver.Check()


        print("::[Pfem Fluid  Explicit Solver]:: -END- ")
    def SetPostMeshingProcesses(self):

        # The order set is the order of execution:
        if (self.echo_level > 0):
            print("::[fluid_mesher]:: -START SetPostMeshingProcesses-")

        #select mesh elements
        select_mesh_elements = KratosPfemFluid.SelectMeshElementsForFluids(
            self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(select_mesh_elements)

        #rebuild elements
        rebuild_mesh_elements = KratosDelaunay.GenerateNewElements(
            self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_elements)

        rebuild_mesh_boundary = KratosPfemFluid.BuildMeshBoundaryForFluids(
            self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPostMeshingProcess(rebuild_mesh_boundary)
Esempio n. 27
0
    def __init__(self, Model, custom_settings):

        AssignVectorComponentsToNodesProcess.__init__(self, Model,
                                                      custom_settings)

        self.model_part = Model[custom_settings["model_part_name"].GetString()]

        self.echo_level = 0
        self.model_inlet = KratosPfemFluid.SetInlet(self.model_part,
                                                    self.echo_level)
        self.model_inlet.Execute()
Esempio n. 28
0
    def SetPreMeshingProcesses(self):

        if(self.echo_level>0):
            print("::[fluid_mesher]:: -START SetPreMeshingProcesses-")

        #recover_volume_losses  = KratosPfemFluid.RecoverVolumeLosses(self.model_part, self.MeshingParameters, self.echo_level)
        #self.mesher.SetPreMeshingProcess(recover_volume_losses)

        unactive_peak_elements = False
        unactive_sliver_elements = False
        set_active_flag = KratosPfemFluid.SetActiveFlagMesherProcess(self.main_model_part,unactive_peak_elements,unactive_sliver_elements,self.echo_level)
        self.mesher.SetPreMeshingProcess(set_active_flag)

        inlet_management = KratosPfemFluid.InletManagement(self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPreMeshingProcess(inlet_management)

        remove_mesh_nodes = KratosPfemFluid.RemoveMeshNodesForFluids(self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPreMeshingProcess(remove_mesh_nodes)

        generate_new_nodes  = KratosPfemFluid.GenerateNewNodesBeforeMeshing(self.model_part, self.MeshingParameters, self.echo_level)
        self.mesher.SetPreMeshingProcess(generate_new_nodes)
    def BuildMeshBoundaryForFluids(self):

        print("::[Modeler_Utility]:: Build Mesh Boundary for fluids ")
        # set building options:
        mesh_id = 0

        # define building utility
        skin_build = KratosPfemFluid.BuildMeshBoundaryForFluids(self.model_part, self.echo_level, mesh_id)
 
        # execute building:
        skin_build.Execute()

        print("::[Modeler_Utility]:: Mesh Boundary Build executed ")
    def SetPreMeshingProcesses(self):

        if (self.echo_level > 0):
            print("::[fluid_mesher]:: -START SetPreMeshingProcesses-")

        #recover_volume_losses  = KratosPfemFluid.RecoverVolumeLosses(self.model_part, self.MeshingParameters, self.echo_level)
        #self.mesher.SetPreMeshingProcess(recover_volume_losses)

        unactive_peak_elements = False
        unactive_sliver_elements = False
        set_active_flag = KratosPfemFluid.SetActiveFlagMesherProcess(
            self.main_model_part, unactive_peak_elements,
            unactive_sliver_elements, self.echo_level)
        self.mesher.SetPreMeshingProcess(set_active_flag)