def __init__(self, model, project_parameters):

        # Validate settings
        project_parameters = self._ValidateSettings(project_parameters)

        # Call the base Python solver constructor
        super(PartitionedFSIBaseSolver,self).__init__(model, project_parameters)

        # Auxiliar variables
        self.parallel_type = self.settings["parallel_type"].GetString()
        coupling_settings = self.settings["coupling_settings"]
        self.max_nl_it = coupling_settings["nl_max_it"].GetInt()
        self.nl_tol = coupling_settings["nl_tol"].GetDouble()
        self.solve_mesh_at_each_iteration = coupling_settings["solve_mesh_at_each_iteration"].GetBool()
        self.fluid_interface_submodelpart_name = coupling_settings["fluid_interfaces_list"][0].GetString()
        self.structure_interface_submodelpart_name = coupling_settings["structure_interfaces_list"][0].GetString()

        # Construct the structure solver
        self.structure_solver = python_solvers_wrapper_structural.CreateSolverByParameters(self.model, self.settings["structure_solver_settings"], self.parallel_type)
        self._PrintInfoOnRankZero("::[PartitionedFSIBaseSolver]::", "Structure solver construction finished.")

        # Construct the fluid solver
        self.fluid_solver = python_solvers_wrapper_fluid.CreateSolverByParameters(self.model, self.settings["fluid_solver_settings"], self.parallel_type)
        self._PrintInfoOnRankZero("::[PartitionedFSIBaseSolver]::", "Fluid solver construction finished.")

        # Construct the ALE mesh solver
        self.mesh_solver = python_solvers_wrapper_mesh_motion.CreateSolverByParameters(self.model, self.settings["mesh_solver_settings"], self.parallel_type)
        self._PrintInfoOnRankZero("::[PartitionedFSIBaseSolver]::", "ALE mesh solver construction finished.")
        self._PrintInfoOnRankZero("::[PartitionedFSIBaseSolver]::", "Partitioned FSI base solver construction finished.")
Example #2
0
 def _CreateFluidSolver(self, solver_settings, parallelism):
     '''This function creates the fluid solver.
     It can be overridden to create different fluid solvers
     '''
     KratosMultiphysics.CheckRegisteredApplications(
         "FluidDynamicsApplication")
     import python_solvers_wrapper_fluid
     return python_solvers_wrapper_fluid.CreateSolverByParameters(
         self.model, solver_settings, parallelism)
Example #3
0
    def __init__(self, model, custom_settings):

        super(CoupledFluidThermalSolver, self).__init__(model, custom_settings)

        default_settings = KratosMultiphysics.Parameters("""
        {
            "solver_type" : "ThermallyCoupled",
            "domain_size" : -1,
            "echo_level": 0,
            "fluid_solver_settings": {
                "solver_type": "navier_stokes_solver_vmsmonolithic",
                "model_import_settings": {
                    "input_type": "mdpa",
                    "input_filename": "unknown_name"
                }
            },
            "thermal_solver_settings": {
                "solver_type": "Transient",
                "analysis_type": "linear",
                "model_import_settings": {
                    "input_type": "use_input_model_part"
                },
                "material_import_settings": {
                        "materials_filename": "ThermalMaterials.json"
                }
            }
        }
        """)

        ## Overwrite the default settings with user-provided parameters
        self.settings.ValidateAndAssignDefaults(default_settings)

        ## Get domain size
        self.domain_size = self.settings["domain_size"].GetInt()

        import python_solvers_wrapper_fluid
        self.fluid_solver = python_solvers_wrapper_fluid.CreateSolverByParameters(
            self.model, self.settings["fluid_solver_settings"], "OpenMP")

        import python_solvers_wrapper_convection_diffusion
        self.thermal_solver = python_solvers_wrapper_convection_diffusion.CreateSolverByParameters(
            self.model, self.settings["thermal_solver_settings"], "OpenMP")
    def __init__(self, model, custom_settings):
        super(ConjugateHeatTransferSolver,
              self).__init__(model, custom_settings)
        ## Validate custom settings against defaults
        self._validate_settings(custom_settings)

        ## Get domain size
        self.domain_size = self.settings["domain_size"].GetInt()

        ## Set the fluid dynamics solver
        import python_solvers_wrapper_fluid
        self.fluid_solver = python_solvers_wrapper_fluid.CreateSolverByParameters(
            self.model, self.settings["fluid_domain_solver_settings"]
            ["fluid_solver_settings"], "OpenMP")

        # Set the fluid and solid heat solvers
        import python_solvers_wrapper_convection_diffusion
        self.fluid_thermal_solver = python_solvers_wrapper_convection_diffusion.CreateSolverByParameters(
            self.model, self.settings["fluid_domain_solver_settings"]
            ["thermal_solver_settings"], "OpenMP")
        self.solid_thermal_solver = python_solvers_wrapper_convection_diffusion.CreateSolverByParameters(
            self.model, self.settings["solid_domain_solver_settings"]
            ["thermal_solver_settings"], "OpenMP")
Example #5
0
    def __init__(self, model, custom_settings):

        super(ConjugateHeatTransferSolver,
              self).__init__(model, custom_settings)

        default_settings = KratosMultiphysics.Parameters("""
        {
            "solver_type": "conjugate_heat_transfer",
            "domain_size": -1,
            "echo_level": 0,
            "fluid_domain_solver_settings": {
                "fluid_solver_settings": {
                    "solver_type": "navier_stokes_solver_vmsmonolithic",
                    "model_import_settings": {
                        "input_type": "mdpa",
                        "input_filename": "unknown_name"
                    }
                },
                "thermal_solver_settings":{
                    "model_part_name": "FluidThermalModelPart",
                    "solver_type": "Transient",
                    "analysis_type": "linear",
                    "model_import_settings": {
                        "input_type": "use_input_model_part"
                    },
                    "material_import_settings": {
                        "materials_filename": "ThermicMaterialsFluid.json"
                    }
                }
            },
            "solid_domain_solver_settings":{
                "solid_solver_settings": {
                },
                "thermal_solver_settings": {
                    "model_part_name": "SolidThermalModelPart",
                    "solver_type": "Transient",
                    "analysis_type": "linear",
                    "model_import_settings": {
                        "input_type": "mdpa",
                        "input_filename": "unknown_name"
                    },
                    "material_import_settings": {
                        "materials_filename": "ThermicMaterialsSolid.json"
                    }
                }
            },
            "coupling_settings":{
                "max_iteration": 10,
                "relaxation_factor": 0.7,
                "temperature_relative_tolerance": 1e-5,
                "fluid_interfaces_list": [],
                "solid_interfaces_list": []
            }
        }
        """)

        ## Overwrite the default settings with user-provided parameters
        self.settings.ValidateAndAssignDefaults(default_settings)

        ## Get domain size
        self.domain_size = self.settings["domain_size"].GetInt()

        ## Set the fluid dynamics solver
        import python_solvers_wrapper_fluid
        self.fluid_solver = python_solvers_wrapper_fluid.CreateSolverByParameters(
            self.model, self.settings["fluid_domain_solver_settings"]
            ["fluid_solver_settings"], "OpenMP")

        # Set the fluid and solid heat solvers
        import python_solvers_wrapper_convection_diffusion
        self.fluid_thermal_solver = python_solvers_wrapper_convection_diffusion.CreateSolverByParameters(
            self.model, self.settings["fluid_domain_solver_settings"]
            ["thermal_solver_settings"], "OpenMP")
        self.solid_thermal_solver = python_solvers_wrapper_convection_diffusion.CreateSolverByParameters(
            self.model, self.settings["solid_domain_solver_settings"]
            ["thermal_solver_settings"], "OpenMP")
Example #6
0
 def _CreateFluidSolver(self, solver_settings, parallelism):
    return python_solvers_wrapper_fluid.CreateSolverByParameters(
        self.model, solver_settings, parallelism)