phi.get_patch("outlet"      ).set_patch_uniform(0., "fixedGradient")
phi.get_patch("frontAndBack").set_patch_uniform(0., "fixedGradient")

# create time loop
save_fields = [U,phi]

start_time = 0.
stop_time  = 0.2
time_step  = 0.001
save_step  = 0.01

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.GenericVectorEquation(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.DdtEulerVec(phi, myLoop.dt)    
    phi_eqn += implicit_operators.DivergenceVec(phi, m_dot, "STOIC")
    
    phi_eqn.solve()
Beispiel #2
0
stop_time = 5.
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