Example #1
0
def AddDofs(fluid_model_part, structure_model_part):
    import fractional_step_solver
    fractional_step_solver.AddDofs(fluid_model_part)
# reading the fluid part
gid_mode = GiDPostMode.GiD_PostBinary
multifile = MultiFileFlag.MultipleFiles
deformed_mesh_flag = WriteDeformedMeshFlag.WriteUndeformed
write_conditions = WriteConditionsFlag.WriteElementsOnly
gid_io = GidIO(input_file_name, gid_mode, multifile, deformed_mesh_flag,
               write_conditions)
model_part_io_fluid = ModelPartIO(input_file_name)
model_part_io_fluid.ReadModelPart(fluid_model_part)

# setting up the buffer size: SHOULD BE DONE AFTER READING!!!
fluid_model_part.SetBufferSize(3)

# adding dofs
if (SolverType == "fractional_step"):
    fractional_step_solver.AddDofs(fluid_model_part)
elif (SolverType == "pressure_splitting"):
    decoupled_solver_eulerian.AddDofs(fluid_model_part)
elif (SolverType == "monolithic_solver_eulerian"):
    monolithic_solver_eulerian.AddDofs(fluid_model_part)
elif (SolverType == "monolithic_solver_eulerian_compressible"):
    monolithic_solver_eulerian_compressible.AddDofs(fluid_model_part)

# select here the laplacian form!!!!!!!!!!!!!!!!!
laplacian_form = 2

# check to ensure that no node has zero density or pressure
for node in fluid_model_part.Nodes:
    if (node.GetSolutionStepValue(DENSITY) == 0.0):
        print("node ", node.Id, " has zero density!")
        raise 'node with zero density found'
Example #3
0
# reading a model
gid_mode_flag = GiDPostMode.GiD_PostAscii
use_multifile = MultiFileFlag.MultipleFiles
deformed_print_flag = WriteDeformedMeshFlag.WriteDeformed
write_conditions = WriteConditionsFlag.WriteConditions
gid_io = GidIO("cavity3D", gid_mode_flag, use_multifile, deformed_print_flag,
               write_conditions)
gid_io.ReadModelPart(model_part)

print(model_part)

# the buffer size should be set up here after the mesh is read for the first time
model_part.SetBufferSize(3)

# adding dofs
fractional_step_solver.AddDofs(model_part)

for i in range(0, nrefinements):
    for elem in model_part.Elements:
        elem.SetValue(SPLIT_ELEMENT, True)

    # compute the nodal neighbours on the initial mesh
    number_of_avg_elems = 20
    number_of_avg_nodes = 20
    nodal_neighbour_search = FindNodalNeighboursProcess(
        model_part, number_of_avg_elems, number_of_avg_nodes)
    nodal_neighbour_search.Execute()

    # perform the refinement
    Refine = LocalRefineTetrahedraMesh(model_part)
    refine_on_reference = False