#adding the variables of the diffusion problem:
convection_diffusion_solver_scripts.AddVariables(
    main_model_part)  # no settings here! (read from the model_part)

# Read model_part (note: the buffer_size is set here) (restart is read here)
solver.ImportModelPart()

# Add dofs (always after importing the model part)
if ((main_model_part.ProcessInfo).Has(KratosMultiphysics.IS_RESTARTED)):
    if (main_model_part.ProcessInfo[KratosMultiphysics.IS_RESTARTED] == False):
        solver.AddDofs()
else:
    solver.AddDofs()

#adding variables for the thermal problem
convection_diffusion_solver_scripts.AddDofs(main_model_part)

#TEMP!!!!!!!! BOUNDARY CONDITIONS MUST ALSO BE SET BY THE USER!
for node in main_model_part.Nodes:
    node.SetSolutionStepValue(KratosMultiphysics.CONDUCTIVITY, 0.0001)
    node.SetSolutionStepValue(KratosMultiphysics.TEMPERATURE, 2.5)
    if node.Is(KratosMultiphysics.RIGID):
        if node.X < 0.298:
            node.SetSolutionStepValue(KratosMultiphysics.TEMPERATURE, 0)
            node.Fix(KratosMultiphysics.TEMPERATURE)
        if node.X > 0.298:
            node.SetSolutionStepValue(KratosMultiphysics.TEMPERATURE, 5)
            node.Fix(KratosMultiphysics.TEMPERATURE)

# Build sub_model_parts or submeshes (rearrange parts for the application of custom processes)
## Get the list of the submodel part in the object Model
Exemple #2
0
diffusion_solver.AddVariables(model_part,
                              ProjectParameters.DiffusionSolverSettings)

# Set mechanical variables
mechanical_solver.AddVariables(model_part)

# Reading model part
model_part_io = ModelPartIO(problem_name)
model_part_io.ReadModelPart(model_part)

# Set buffer size
buffer_size = 2
model_part.SetBufferSize(buffer_size)

# Set thermal degrees of freedom
diffusion_solver.AddDofs(model_part)

# Set mechanical degrees of freedom
mechanical_solver.AddDofs(model_part)

# Set ProcessInfo variables and fill the previous steps of the buffer with the initial conditions
current_time = -(buffer_size - 1) * delta_time
model_part.ProcessInfo[
    TIME] = current_time  #current_time and TIME = 0 after filling the buffer
model_part.ProcessInfo[REFERENCE_TEMPERATURE] = model_part.GetTable(
    18
).GetNearestValue(
    0.0
)  # To start computations at time = 0  / Table 5 = Reference Temperature Values
for step in range(buffer_size - 1):
    current_time = current_time + delta_time