@@ -69,8 +69,8 @@ def main(inflow: 'inflow velocity' = 10,
69
69
meshdofs0 = meshdofs
70
70
meshdofs00 = meshdofs
71
71
meshdofs000 = meshdofs
72
- meshdofs0000 = meshdofs
73
- lhs0 = numpy . zeros ( len ( ns . ubasis ))
72
+ lhs = numpy . zeros ( len ( ns . ubasis ))
73
+ lhs0 = lhs
74
74
75
75
# for visualization
76
76
bezier = domain .sample ('bezier' , 2 )
@@ -98,7 +98,6 @@ def main(inflow: 'inflow velocity' = 10,
98
98
99
99
# initialize preCICE
100
100
precice_dt = interface .initialize ()
101
- dt = min (precice_dt , timestepsize )
102
101
103
102
# boundary conditions for fluid equations
104
103
sqr = domain .boundary ['wall,flap' ].integral ('urel_k urel_k d:x0' @ ns , degree = 4 )
@@ -132,7 +131,6 @@ def main(inflow: 'inflow velocity' = 10,
132
131
# better initial guess: start from Stokes solution, comment out for comparison with other solvers
133
132
#res_stokes = domain.integral('(ubasis_ni,j ((u_i,j + u_j,i) rho nu - p δ_ij) + pbasis_n u_k,k) d:x' @ ns, degree=4)
134
133
#lhs0 = solver.solve_linear('lhs', res_stokes, constrain=cons, arguments=dict(meshdofs=meshdofs, meshdofs0=meshdofs0, meshdofs00=meshdofs00, meshdofs000=meshdofs000, dt=dt))
135
- lhs00 = lhs0
136
134
137
135
timestep = 0
138
136
@@ -149,9 +147,19 @@ def main(inflow: 'inflow velocity' = 10,
149
147
150
148
# save checkpoint
151
149
if interface .is_action_required (precice .action_write_iteration_checkpoint ()):
152
- checkpoint = lhs0 , lhs00 , timestep , meshdofs0 , meshdofs00 , meshdofs000 , meshdofs0000
150
+ checkpoint = timestep , lhs , lhs0 , meshdofs , meshdofs0 , meshdofs00 , meshdofs000
153
151
interface .mark_action_fulfilled (precice .action_write_iteration_checkpoint ())
154
152
153
+ # advance variables
154
+ timestep += 1
155
+ lhs00 = lhs0
156
+ lhs0 = lhs
157
+ meshdofs0000 = meshdofs000
158
+ meshdofs000 = meshdofs00
159
+ meshdofs00 = meshdofs0
160
+ meshdofs0 = meshdofs
161
+ dt = min (precice_dt , timestepsize )
162
+
155
163
# solve fluid equations
156
164
lhs = solver .newton ('lhs' , res , lhs0 = lhs0 , constrain = cons ,
157
165
arguments = dict (lhs0 = lhs0 , dt = dt , meshdofs = meshdofs , meshdofs0 = meshdofs0 ,
@@ -171,20 +179,10 @@ def main(inflow: 'inflow velocity' = 10,
171
179
172
180
# do the coupling
173
181
precice_dt = interface .advance (dt )
174
- dt = min (precice_dt , timestepsize )
175
-
176
- # advance variables
177
- timestep += 1
178
- lhs00 = lhs0
179
- lhs0 = lhs
180
- meshdofs0000 = meshdofs000
181
- meshdofs000 = meshdofs00
182
- meshdofs00 = meshdofs0
183
- meshdofs0 = meshdofs
184
182
185
183
# read checkpoint if required
186
184
if interface .is_action_required (precice .action_read_iteration_checkpoint ()):
187
- lhs0 , lhs00 , timestep , meshdofs0 , meshdofs00 , meshdofs000 , meshdofs0000 = checkpoint
185
+ timestep , lhs , lhs0 , meshdofs , meshdofs0 , meshdofs00 , meshdofs000 = checkpoint
188
186
interface .mark_action_fulfilled (precice .action_read_iteration_checkpoint ())
189
187
190
188
if interface .is_time_window_complete ():
0 commit comments