phi.get_patch("bottom").set_patch_uniform(2., "fixedGradient")

# create time loop
save_fields = []
save_fields.append(phi)

start_time = 0.
stop_time = 2.
time_step = 1.
save_step = 1.

myLoop = time_loop.TimeLoop(save_fields, start_time, stop_time, time_step)
myLoop.uniform_save_times(save_step)

# set up equation for phi
phi_eqn = generic_equation.GenericScalarEquation(myMesh, phi, "bicg")

# save initial condition
myLoop.save_current(0)

# iteration loop
for time_ in myLoop.times:
    myLoop.time = time_
    myLoop.print_time()

    phi_eqn.reset()

    #    phi_eqn += implicit_operators.DdtEuler(phi, myLoop.dt)
    phi_eqn -= implicit_operators.Laplace(phi)

    phi_eqn.solve()
Exemple #2
0
time_step = 0.01
#time_step  = [ (  0.5  , 0.01 ),
#               (  1.0  , 0.05 ),
#               (  2.0  , 0.1  )  ]
save_step = 0.5
vtk_start = 0

myLoop = time_loop.TimeLoop(save_fields, start_time, stop_time, time_step)
myLoop.uniform_save_times(save_step)
myLoop.vtk_start = vtk_start

# set up equation for U and p_corr
#U_eqn      = generic_equation.GenericVectorEquation(myMesh, U,       "gs"       , 0.7 )
#p_corr_eqn = generic_equation.GenericScalarEquation(myMesh, p_corr,  "lu_solver", 1.  )
U_eqn = generic_equation.GenericVectorEquation(myMesh, U, "bicg", 0.7)
p_corr_eqn = generic_equation.GenericScalarEquation(myMesh, p_corr, "cg", 1.)
p_under_relaxation = 0.3

# save initial condition
if start_time == 0.:
    # clear output dirs
    output.clean_output_dirs()
    myLoop.save_current(0)

# prepare monitors
# linear solver residuals are added by default
# divergence
p_corr_eqn.add_monitor("divU_pred")
p_corr_eqn.add_monitor("divU_corr")
# global mass balance
p_corr_eqn.add_monitor("global_mass_cons")
Exemple #3
0
save_fields = [U, p, p_corr, div_field]

# 1st run
start_time = 0.
stop_time = 0.13
time_step = 0.0065
save_step = 0.065
vtk_start = 0

myLoop = time_loop.TimeLoop(save_fields, start_time, stop_time, time_step)
myLoop.uniform_save_times(save_step)
myLoop.vtk_start = vtk_start

# set up equation for U and p_corr
U_eqn = generic_equation.GenericVectorEquation(myMesh, U, "gs", 0.7)
p_corr_eqn = generic_equation.GenericScalarEquation(myMesh, p_corr,
                                                    "lu_solver", 1.)
p_under_relaxation = 1.

# save initial condition
if start_time == 0.:
    # clear output dirs
    output.clean_output_dirs()
    myLoop.save_current(0)

# prepare monitors
# linear solver residuals are added by default
# divergence
p_corr_eqn.add_monitor("divU_pred")
p_corr_eqn.add_monitor("divU_corr")
# drag coefficient
p_corr_eqn.add_monitor("cd")