Load experiment
Tutorial on how to implement the preload-afterload experiment. This tutorial discusses how to build the model, how to switch between different patch types, and how to extract and plot information from the model.
Todo
Make Preload Afterload methods figure
As all projects, we start with importing packages.
We then create an empty model. Then, we add the LoadExperiment wall object. This object is empty by default, but it needs at least 1 patch object to work. In this tutorial, we use the Patch
object.
1model = CircAdapt('forward_euler')
2model.add_component('LoadExperiment', 'PAE')
3model.add_component('Patch', 'P', 'PAE')
4
5model['LoadExperiment']['n_patch'] = 2
6
7
The model has to be parametized, as default parameter values do not make sense for this setup.
1model.set('Model.t_cycle', 1e-0)
2model.set('Solver.dt', 1e-3)
3model.set('Solver.dt_export', 1e-3)
4
5model['LoadExperiment']['Am_ref_afterload'] = 0.006
6model['LoadExperiment']['T_afterload'] = 200
7model['LoadExperiment']['n_iter'] = 5
8model['Patch']['Am_ref'] = 0.005
9model['Patch']['V_wall'] = 92.43*1e-6
10model['Patch']['ADO'] = 3.0
11model['Patch']['tr'] = 0.5
12model['Patch']['td'] = 0.5
13model['Patch']['k1'] = 10.
14model['Patch']['v_max'] = 7.0
15model['Patch']['dt'] = 0.2
16
17model['Patch']['dt'] = [0.1, 0.1]
18
19model.set('Model.PAE.pAE0.l_si', -0.04 + 2 * np.sqrt(
20 model['LoadExperiment']['Am_ref_afterload'][0]/model['Patch']['Am_ref'][0]))
21model.set('Model.PAE.pAE1.l_si', model.get('Model.PAE.pAE0.l_si', dtype=float))
22
23
Now the model setup is finished and we can run the simulation. For this setup, only 1 run is sufficient.
1t0 = time.time()
2model.run(1)
3t1 = time.time()
4print(t1-t0)
5
The simulation will result in the stresses and tensions shown in the plot below.
(Source code
, png
, hires.png
, pdf
)
The full code is shown below.