|
199 | 199 | # Next we set up the logging and the MPI communicator |
200 | 200 |
|
201 | 201 | logging.basicConfig(level=logging.INFO) |
| 202 | +logger = logging.getLogger("pulse") |
202 | 203 | comm = MPI.COMM_WORLD |
203 | 204 |
|
204 | 205 | # and create an output directory |
|
277 | 278 | # |
278 | 279 |
|
279 | 280 | alpha_epi = pulse.Variable( |
280 | | - dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(1e8)), "Pa / m", |
| 281 | + dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(1e8)), "Pa / m", |
281 | 282 | ) |
282 | 283 | robin_epi_u = pulse.RobinBC(value=alpha_epi, marker=geometry.markers["EPI"][0]) |
283 | 284 | beta_epi = pulse.Variable( |
284 | | - dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(5e3)), "Pa s/ m", |
| 285 | + dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(5e3)), "Pa s/ m", |
285 | 286 | ) |
286 | 287 | robin_epi_v = pulse.RobinBC(value=beta_epi, marker=geometry.markers["EPI"][0], damping=True) |
287 | 288 |
|
|
290 | 291 | ) |
291 | 292 | robin_base_u = pulse.RobinBC(value=alpha_base, marker=geometry.markers["BASE"][0]) |
292 | 293 | beta_base = pulse.Variable( |
293 | | - dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(5e3)), "Pa s/ m", |
| 294 | + dolfinx.fem.Constant(geometry.mesh, dolfinx.default_scalar_type(5e3)), "Pa s/ m", |
294 | 295 | ) |
295 | 296 | robin_base_v = pulse.RobinBC(value=beta_base, marker=geometry.markers["BASE"][0], damping=True) |
296 | 297 |
|
|
305 | 306 |
|
306 | 307 | # Note that we also specify that the base is free to move, meaning that there will be no Dirichlet boundary conditions on the base. Now we can do an initial solve the problem |
307 | 308 |
|
308 | | -log.set_log_level(log.LogLevel.INFO) |
| 309 | +# log.set_log_level(log.LogLevel.INFO) |
309 | 310 | problem.solve() |
310 | 311 |
|
311 | 312 | # The next step is to get the activation and pressure as a function of time. For this we use the time step from the problem parameters |
|
357 | 358 |
|
358 | 359 | volume_form = dolfinx.fem.form(geometry.volume_form(u=problem.u) * geometry.ds(geometry.markers["ENDO"][0])) |
359 | 360 | initial_volume = geo.mesh.comm.allreduce(dolfinx.fem.assemble_scalar(volume_form)) |
360 | | -print(f"Initial volume: {initial_volume}") |
| 361 | +logger.info(f"Initial volume: {initial_volume}") |
361 | 362 |
|
362 | 363 | # and then loop over the time steps and solve the problem for each time step |
363 | 364 |
|
364 | 365 | volumes = [] |
365 | 366 | for i, (tai, pi, ti) in enumerate(zip(activation, pressure, times)): |
366 | | - print(f"Solving for time {ti}, activation {tai}, pressure {pi}") |
| 367 | + logger.info(f"Solving for time {ti}, activation {tai}, pressure {pi}") |
367 | 368 | traction.assign(pi) |
368 | 369 | Ta.assign(tai) |
369 | 370 | problem.solve() |
|
0 commit comments