@@ -18,24 +18,23 @@ function profile_from_z_transport(
18
18
z_transport_grid:: AbstractVector{<:Real} ,
19
19
rho_ped:: Real = 0.0 )
20
20
21
- z = calc_z (rho, profile_old)
22
-
23
21
transport_indices = [argmin (abs .(rho .- rho_x)) for rho_x in transport_grid]
24
22
index_ped = argmin (abs .(rho .- rho_ped))
25
23
index_last = transport_indices[end ]
26
24
if index_ped > index_last
25
+ z_old = calc_z (rho, profile_old)
27
26
transport_indices = vcat (1 , transport_indices, index_ped)
28
- z_transport_grid = vcat (0.0 , z_transport_grid, z [index_ped])
27
+ z_transport_grid = vcat (0.0 , z_transport_grid, z_old [index_ped])
29
28
else
30
29
transport_indices = vcat (1 , transport_indices)
31
30
z_transport_grid = vcat (0.0 , z_transport_grid)
32
31
end
33
32
34
- z[ 1 : index_last] = interp1d (transport_indices, z_transport_grid).(1 : index_last)
33
+ z = interp1d (transport_indices, z_transport_grid).(1 : index_last)
35
34
36
35
profile_new = similar (profile_old)
37
36
profile_new[index_last: end ] = @views profile_old[index_last: end ]
38
- profile_new[1 : index_last] = @views integ_z (rho[1 : index_last], - z[ 1 : index_last] , profile_new[index_last])
37
+ profile_new[1 : index_last] = @views integ_z (rho[1 : index_last], - z, profile_new[index_last])
39
38
40
39
return profile_new
41
40
end
0 commit comments