Skip to content

Commit c1b5523

Browse files
Make output routine with dt_out more robust
1 parent 408ac14 commit c1b5523

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • CHT/flow-over-plate/buoyantPimpleFoam-fenics/Solid

CHT/flow-over-plate/buoyantPimpleFoam-fenics/Solid/heat.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def fluxes_from_temperature_full_domain(f, v_vec, k):
8888
nz = 1
8989

9090
fenics_dt = 0.01 # time step size
91-
dt_out = 0.2
91+
dt_out = 0.2 # interval for writing VTK files
9292
y_top = 0
9393
y_bottom = y_top - .25
9494
x_left = 0
@@ -147,6 +147,8 @@ def fluxes_from_temperature_full_domain(f, v_vec, k):
147147
u_D.t = t + dt
148148

149149
file_out = File("Solid/VTK/%s.pvd" % precice.get_participant_name())
150+
file_out << u_n
151+
print("output vtk for time = {}".format(float(t)))
150152
n = 0
151153

152154
while precice.is_coupling_ongoing():
@@ -181,13 +183,13 @@ def fluxes_from_temperature_full_domain(f, v_vec, k):
181183
n += 1
182184

183185
if precice.is_time_window_complete():
184-
if abs(float(t) % dt_out) < 10e-5: # output if t is a multiple of dt_out
186+
tol = 10e-5 # we need some tolerance, since otherwise output might be skipped.
187+
if abs((float(t)+tol) % dt_out) < 2*tol: # output if t is a multiple of dt_out
188+
print("output vtk for time = {}".format(float(t)))
185189
file_out << u_n
186190

187191
# Update dirichlet BC
188192
u_D.t = t + dt(0)
189193

190-
file_out << u_n
191-
192194
# Hold plot
193195
precice.finalize()

0 commit comments

Comments
 (0)