# importing the solvers needed import fractional_step_solver import NonConformant_OneSideMap SolverSettings = SolidSolverConfiguration solver_module = __import__(SolverSettings.solver_type) for node in origin_model_part.Nodes: # adding dofs node.AddDof(DISPLACEMENT_X, REACTION_X) node.AddDof(DISPLACEMENT_Y, REACTION_Y) node.AddDof(DISPLACEMENT_Z, REACTION_Z) # setting the domain size for the problem to be solved domain_size = SolverSettings.domain_size # importing variables fractional_step_solver.AddVariables(destination_model_part) NonConformant_OneSideMap.AddVariables(destination_model_part, origin_model_part) solver_module.AddVariables(origin_model_part, SolverSettings) # Creating the solid solver, set the constitutive law import constitutive_law_python_utility as constitutive_law_utils constitutive_law = constitutive_law_utils.ConstitutiveLawUtility( origin_model_part, domain_size) constitutive_law.Initialize() # setting up the buffer size: SHOULD BE DONE AFTER READING!!! buffer_size = 3 origin_model_part.SetBufferSize(buffer_size) # importing the solver files
from KratosMultiphysics.IncompressibleFluidApplication import * from KratosMultiphysics.ConvectionDiffusionApplication import * # importing the benchmarking auxiliary functions kratos_benchmarking_path = '../../../../benchmarking' import sys sys.path.append(kratos_benchmarking_path) import benchmarking # defining a model part origin_model_part = ModelPart("FluidPart") new_model_part = ModelPart("NewPart") # define variables for the solvers to be used import fractional_step_solver fractional_step_solver.AddVariables(origin_model_part) origin_model_part.AddNodalSolutionStepVariable(IS_BOUNDARY) origin_model_part.AddNodalSolutionStepVariable(IS_FREE_SURFACE) origin_model_part.AddNodalSolutionStepVariable(IS_BOUNDARY) # ATTENTION: IMPORTANT!! note that the convection_diffusion_solver will work on a different model part # nevertheless, since the new model part will be filled up later, and the nodes to be created will # be shared between the origin and new model part, we will add the variables to the "origin_model_part" # such variables will be copied when creating then new one thermal_settings = ConvectionDiffusionSettings() thermal_settings.SetDensityVariable(DENSITY) thermal_settings.SetDiffusionVariable(CONDUCTIVITY) thermal_settings.SetUnknownVariable(TEMPERATURE) thermal_settings.SetVolumeSourceVariable(HEAT_FLUX) thermal_settings.SetSurfaceSourceVariable(FACE_HEAT_FLUX) thermal_settings.SetMeshVelocityVariable(MESH_VELOCITY)
benchmarking.Output(max_press, "maximum pressure", 0.00001) benchmarking.Output(id_min_vel, "Id of the node with minimum velocity norm", 0.0) benchmarking.Output(x_min_vel, "coord x minimum velocity norm", 0.0) benchmarking.Output(y_min_vel, "coord y minimum velocity norm", 0.0) # defining a model part for the fluid and one for the structure fluid_model_part = ModelPart("FluidPart") # # importing the solvers needed SolverType = fluid_only_var.SolverType if (SolverType == "fractional_step"): import fractional_step_solver fractional_step_solver.AddVariables(fluid_model_part) elif (SolverType == "pressure_splitting"): import decoupled_solver_eulerian decoupled_solver_eulerian.AddVariables(fluid_model_part) elif (SolverType == "monolithic_solver_eulerian"): import monolithic_solver_eulerian monolithic_solver_eulerian.AddVariables(fluid_model_part) elif (SolverType == "monolithic_solver_eulerian_compressible"): import monolithic_solver_eulerian_compressible monolithic_solver_eulerian_compressible.AddVariables(fluid_model_part) else: raise "solver type not supported: options are fractional_step - \ pressure_splitting - monolithic_solver_eulerian - \ monolithic_solver_eulerian_compressible" # introducing input file name
def AddVariables(fluid_model_part, structure_model_part): import fractional_step_solver fractional_step_solver.AddVariables(fluid_model_part) fluid_model_part.AddNodalSolutionStepVariable(DISPLACEMENT) structure_model_part.AddNodalSolutionStepVariable(RELAXED_DISP) print("variables for FractionalStepCoupling added correctly")