pypesh Documentation¶
pypesh is a repository that attempts to find a solution to advection diffusion problem
with \(\varphi = 1\) for \(z \to \infty\) and \(\phi = 0\) on a surface of the sphere and \(\mathrm{Pe}\) denoting Peclet number. Final value determining the flux of \(\varphi\) onto the sphere is the Sherwood number defined as
Where \(D\) is diffusion constant and \(\Phi\) is flux falling onto the sphere.
Package contents¶
Analytic¶
- pypesh.analytic.clift_approximation(pe)¶
Analytic approximation to numerical solution of Clift et. al.
- Parameters
pe (float) – Peclet number defined as R u / D.
- Returns
Sherwod calculated from Clift et. al. approximation
- Return type
float
Example
>>> import pypesh.analytic as analytic >>> analytic.clift_approximation(1000) 6.800655008742168
- pypesh.analytic.direct_impact(peclet, ball_radius)¶
Our approximation of Sherwood number for peclet and ball_radius
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of big ball
- Returns
Sherwod calculated our approximation
- Return type
float
Example
>>> import pypesh.analytic as analytic >>> analytic.direct_impact(1000, 1) 0.0 >>> analytic.direct_impact(1000, 0.9) 3.6249999999999982
- pypesh.analytic.our_approximation(peclet, ball_radius)¶
Our approximation of Sherwood number for peclet and ball_radius
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of big ball
- Returns
Sherwod calculated our approximation
- Return type
float
Example
>>> import pypesh.analytic as analytic >>> analytic.our_approximation(1000, 1) 6.800655008742168 >>> analytic.our_approximation(1000, 0.9) 10.425655008742165
- pypesh.analytic.sherwood_from_flux(flux, peclet)¶
sherwood is defined as flux_dimesional/(4 pi D R) = U R^2 flux / (4 pi D R) = flux*(Pe/4 pi)
- Parameters
flux (float) – Flux passing the ceiling
peclet (float) – Peclet number defined as R u / D.
- Returns
sherwood from dimensionless flux
- Return type
float
Example
>>> import pypesh.analytic as analytic >>> analytic.sherwood_from_flux(0.1, 1000) 7.957747154594768
Stokes Flow¶
For comparison check: https://en.wikipedia.org/wiki/Stokes%27_law
- pypesh.stokes_flow.psi(r, z, ball_radius)¶
Given location of the tracer find streamfunction – Stokes flow around sphere of size ball_radius (stationary) and ambient flow u_inf = [0,0,1].
Location is measured from the centre in cylindrical coordinates [r, phi, z], z is parallel to ambient flow.
Compare: https://en.wikipedia.org/wiki/Stokes%27_law#Transversal_flow_around_a_sphere
- Parameters
r (float) – distance from central axis of ball.
z (float) – height above the plane perpendicular to ambient flow, containing centre of sphere
ball_radius (float) – Radius of ball.
- Returns
value of streamline at [r, 0, z]
- Return type
float
Example
>>> import pypesh.stokes_flow as sf >>> sf.psi(1, 1, 1) 0.05805826175840782
- pypesh.stokes_flow.stokes_around_sphere_explicite(r, z, ball_radius)¶
Given location of the tracer find drift velocity – Stokes flow around sphere of size big_r (stationary) and ambient flow u_inf = [0,0,1].
Location is measured from the centre of the sphere.
Compare: https://en.wikipedia.org/wiki/Stokes%27_law#Transversal_flow_around_a_sphere
- Parameters
r (any) – Radius
z (any) – Height
ball_radius (float) – Radius of ball.
- Returns
Velocity in rho direction, Velocity in phi direction, Velocity in z direction
- Return type
tuple
Example
>>> import pypesh.stokes_flow as sf >>> sf.stokes_around_sphere_explicite(1, 1, 0.7) (-0.14013972519640885, 0, 0.4583120114372806)
- pypesh.stokes_flow.stokes_around_sphere_jnp(q, ball_radius)¶
Given location of the tracer find drift velocity – Stokes flow around sphere of size big_r (stationary) and ambient flow u_inf = [0,0,1].
Location is measured from the centre of the sphere.
Compare: https://en.wikipedia.org/wiki/Stokes%27_law#Transversal_flow_around_a_sphere
- Parameters
q (jnp.array) – Lenght 3, cartesian position from centre of the sphere.
ball_radius (float) – Radius of ball.
- Returns
Flow velocity in cartesian coordinates at q
- Return type
jnp.array
Example
>>> import jax.numpy as jnp >>> import pypesh.stokes_flow as sf >>> posjnp = jnp.array([1,1,1]) >>> sf.stokes_around_sphere_jnp(posjnp, 0.9) Array([-0.0948298, -0.0948298, 0.4803847], dtype=float32)
- pypesh.stokes_flow.stokes_around_sphere_np(q, ball_radius)¶
Given location of the tracer find drift velocity – Stokes flow around sphere of size big_r (stationary) and ambient flow u_inf = [0,0,1].
Location is measured from the centre of the sphere.
Compare: https://en.wikipedia.org/wiki/Stokes%27_law#Transversal_flow_around_a_sphere
- Parameters
q (np.array) – Lenght 3, cartesian position from centre of the sphere.
ball_radius (float) – Radius of ball.
- Returns
Flow velocity in cartesian coordinates at q
- Return type
np.array
Example
>>> import pypesh.stokes_flow as sf >>> import numpy as np >>> posnp = np.array([1,1,1]) >>> sf.stokes_around_sphere_np(posnp, 0.9) array([-0.09482978, -0.09482978, 0.48038476])
- pypesh.stokes_flow.streamline_radius(z, ball_radius, r_start=1)¶
Find the radius of streamline at heigh z, that goes through the position [r_start, 0, 0]
Location is measured from the centre in cylindrical coordinates [r, phi, z], z is parallel to ambient flow.
- Parameters
z (float) – height above the plane perpendicular to ambient flow, containing centre of sphere
ball_radius (float) – Radius of ball.
r_start (float) – radius of searched streamline for z = 0
- Returns
radius of streamline that pases [r_start, 0, 0]
- Return type
float
Example
>>> import pypesh.stokes_flow as sf >>> sf.streamline_radius(5, 0.8) 0.2710224007612492
Generate Mesh¶
For package: https://scikit-fem.readthedocs.io/en/latest/
- pypesh.generate_mesh.gen_mesh(mesh=0.01, far_mesh=0.5, cell_size=1, width=10, ceiling=10, floor=10, save=False, show_mesh=False)¶
Generates mesh used then by sciki-fem to solve advection-diffusion in Stokes Flow.
- Parameters
mesh (far) – Density of triangles in most interesting region
mesh – Density of triangles in region far away from axis, ceiling and sphere
cell_size (float, optional) – Scales cell size, keeping ratio of walls to ceiling
width (float, optional) – Width of cell
ceiling (float, optional) – Distance from 0 to upper boundary of cell
floor (float, optional) – Distance from 0 to lower boundary of cell
save (Bool, optional) – Default False, if True than mesh will be saved in /meshes/
show (bool, optional) – Default False, if True mesh is shown
- Returns
skfem object, used by scikit-fem
- Return type
<skfem MeshTri1 object>
Example
>>> import pypesh.generate_mesh as msh >>> msh.gen_mesh() Transforming over 1000 vertices to C_CONTIGUOUS. Transforming over 1000 elements to C_CONTIGUOUS. <skfem MeshTri1 object> Number of elements: 90756 Number of vertices: 46225 Number of nodes: 46225 Named boundaries [# facets]: left [972], right [40], top [264], bottom [20], ball [396]
Finite Element Method¶
Using package: https://scikit-fem.readthedocs.io/en/latest/
- pypesh.fem.get_mesh(peclet)¶
Loads mesh adequate to Peclet number
- Parameters
peclet (float) – Peclet number defined as R u / D.
- Returns
skfem object <skfem MeshTri1 object> used by scikit-fem, <skfem CellBasis(MeshTri1, ElementTriP1) object> boundaries of mesh
- Return type
tuple
Example
>>> import pypesh.fem as fem >>> fem.get_mesh(1000) (<skfem MeshTri1 object> Number of elements: 90756 Number of vertices: 46225 Number of nodes: 46225 Named boundaries [# facets]: left [972], right [40], top [264], bottom [20], ball [396], <skfem CellBasis(MeshTri1, ElementTriP1) object> Number of elements: 90756 Number of DOFs: 46225 Size: 19603296 B)
- pypesh.fem.sherwood_fem(peclet, ball_radius)¶
sherwood is defined as flux_dimesional/(4 pi D R) = U R^2 flux / (4 pi D R) = flux*(Pe/4 pi)
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
- Returns
Sherwood calcualted for selected peclet and ball radius using fem approach.
- Return type
float
Example
>>> import pypesh.fem as fem >>> fem.sherwood_fem(10000, 0.9) 54.93467214954524
Trajectories approach¶
Using package: https://pychastic.readthedocs.io/en/latest/
- pypesh.trajectories.draw_trajectory_at_x(x_position, peclet, ball_radius, trials=5, floor_h=5, t_max=10)¶
Generate trajectories of particles in a simulation for certain x position amd returns whole trajectory.
- Parameters
x_postition (float) – Radius where probability is evaluated (simulation initiation point)
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
trials (int, optional) – Default 5, Number of trajectories.
floor_h (int, optional) – Default 5, Initial depth for simulation
t_max (float, optional) – Default 5, time of simulation
- Returns
ball_hit- jnp.array() of 1 and 0, if 1 trajectory within radius 1, 0 missroof_hit- jnp.array() of 1 and 0, if 1 trajectory at the end above height 2, 0 misssomething_hit- jnp.array() of 1 and 0, union ofball_hitandroof_hittrajectories- jnp.array() trials by 100*t_max by 3 with x(t), y(t), z(t) positions for each trial.- Return type
dict
Example
>>> import pypesh.trajectories as traj >>> traj.draw_trajectory_at_x(0.1, 1000, 0.9, trials = 1, t_max = .1) {'ball_hit': Array([False], dtype=bool), 'roof_hit': Array([False], dtype=bool), 'something_hit': Array([False], dtype=bool), 'trajectories': Array([[[ 1.01513535e-01, 1.41892245e-03, -4.98940468e+00], [ 1.03897616e-01, 9.31997492e-04, -4.97806931e+00], [ 1.04288198e-01, -1.80142978e-03, -4.97903204e+00], [ 9.97019112e-02, -3.12771578e-03, -4.96664095e+00], [ 1.02413967e-01, -2.95094796e-03, -4.96111631e+00], [ 1.01300426e-01, 6.96127070e-04, -4.94909143e+00], [ 1.03424884e-01, -6.30148593e-03, -4.94255972e+00], [ 1.03292465e-01, -5.54783177e-03, -4.93507099e+00], [ 9.94927734e-02, -4.31211060e-03, -4.92812681e+00], [ 9.83759165e-02, -7.30469078e-03, -4.92086792e+00]]], dtype=float32)} >>> traj.draw_trajectory_at_x(0.1, 1000, 0.9, trials = 2, t_max = .05) {'ball_hit': Array([False, False], dtype=bool), 'roof_hit': Array([False, False], dtype=bool), 'something_hit': Array([False, False], dtype=bool), 'trajectories': Array([[[ 9.8736316e-02, -7.5448438e-04, -4.9963560e+00], [ 9.6689783e-02, -4.3136943e-03, -4.9961877e+00], [ 9.7639665e-02, -5.3856885e-03, -4.9852118e+00], [ 9.8702230e-02, -7.6030511e-03, -4.9785647e+00], [ 9.1684863e-02, 7.3614251e-04, -4.9669151e+00]],[[ 1.0136999e-01, -1.1048245e-02, -4.9944925e+00], [ 1.0074968e-01, -3.2547791e-03, -4.9900651e+00], [ 1.0723757e-01, -6.1367834e-03, -4.9799914e+00], [ 1.1393108e-01, -1.7973720e-03, -4.9786887e+00], [ 1.1445464e-01, -7.9164971e-03, -4.9739923e+00]]], dtype=float32)}
- pypesh.trajectories.hitting_propability_at_x(x_position, peclet, ball_radius, trials=100, floor_h=5, partition=1, t_max=40)¶
Generate trajectories of particles in a simulation for certain x position. Than calculates the propability of hitting for this position.
- Parameters
x_postition (float) – Radius where probability is evaluated (simulation initiation point)
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
trials (int, optional) – Number of trajectories.
floor_h (int, optional) – Initial depth for simulation.
parition (int, optional) – Default 1, if to expensive in RAM partition into ‘partition’ parts.
t_max (float, optional) – Default 40.0, select time of simmulation
- Returns
value of propability
- Return type
float
Example
>>> import pypesh.trajectories as traj >>> traj.hitting_propability_at_x(0.1, 10**4, 0.9) Array(0.82, dtype=float32, weak_type=True)
- pypesh.trajectories.sherwood_trajectories(peclet, ball_radius, mesh_out=4, mesh_jump=6, trials=100, floor_h=5, spread=4, t_max=40.0, partition=1)¶
Calculates the distribution of probability of hitting as a function of radius, at depth floor_h. Addaptive sampling is implemented to ensure effective calculation. Position of greatest slope is assumed to be at streamline that pass position [1, 0, 0], then spread is scaled as sqrt(1/peclet) sim sqrt(D). Then integrates with weigth and finds the Sherwood number
- Parameters
peclet (float, optional) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
mesh_out (int, optional) – Amount of samples outside the region of highest slope
mesh_jump (int, optional) – Amount of samples in the region of highest slope
trials (int, optional) – Number of trajectories per position, uncertainty of propability estimation is sqrt(trials)/trials.
floor_h (int, optional) – Initial depth for simulation
spread (int, optional) – How far in sqrt(1/peclet), mesh_out will reach
parition (int, optional) – Default 1, if to expensive in RAM partition into ‘partition’ parts.
t_max (float, optional) – Default 40.0, select time of simmulation
- Returns
float - estimation of resulting sherwood number (flux/advective_flux), array - Radius samples, array - Probability values ordered as radius samples
- Return type
tuple
Example
>>> import pypesh.trajectories as traj >>> traj.sherwood_trajectories(10**6, 0.9) (3646.3631062456793, array([0.10064565, 0.11064565, 0.12064565, 0.13064565, 0.13464565, 0.13864565, 0.14264565, 0.14664565, 0.15064565, 0.16064565, 0.17064565, 0.18064565]), array([1. , 1. , 0.98999995, 0.95 , 0.83 , 0.68 , 0.45 , 0.17999999, 0.02 , 0. , 0. , 0. ], dtype=float32))
- pypesh.trajectories.simulate_trajectory(drift, noise, initial, t_max, whole_trajectory=False, seed=0)¶
Simulates trajectories starting from initial conditions, affected by noise and moved via drift.
- Parameters
derift (callable) – Function describing drift term of the equation, should return np.array of length
dimension.noise (callable) – Function describing noise term of the equation, should return np.array of size
(dimension,noiseterms).initial (jnp.array) – Array of positions where to start simulating
t_max (float) – Time of calculation
whole_trajectory (boole, optional) – Deafult False, if True than also returns whole trajectory (Warning expensive in memory)
seed (int) – Default 0, if diferent than 0, different random seed is used for SDE.
- Returns
ball_hit- jnp.array() of 1 and 0, if 1 trajectory within radius 1, 0 missroof_hit- jnp.array() of 1 and 0, if 1 trajectory at the end above height 2, 0 misssomething_hit- jnp.array() of 1 and 0, union ofball_hitandroof_hit- Return type
dict
Example
>>> import pypesh.trajectories as traj >>> import pypesh.stokes_flow as sf >>> def drift(q): ... return sf.stokes_around_sphere_jnp(q, 0.9) >>> noise = traj.diffusion_function(100) >>> init = traj._construct_initial_trials_at_x(0, 5, 3) >>> traj.simulate_trajectory(drift, noise, init, 20) {'ball_hit': Array([False, True, True], dtype=bool), 'roof_hit': Array([ True, True, True], dtype=bool), 'something_hit': Array([ True, True, True], dtype=bool)}
Visualisation¶
Visualisation of different results from code.
- pypesh.visualisation.draw_cross_section_fem(peclet, ball_radius, downstream_distance=5, show=False, density=400, maximal_radius=1)¶
Draws cross section of hitting probability at selected height using scikit-fem.
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
downstream_distance (float, optional) – Default 5, downstream distance in ball radius where distribution is plotted
show (bool, optional) – Default False, if True plot is shown
denstity (int, optional) – Default 400, how many points in result
maximal_radius (float, optional) – Default 1, maximal radius to place in result
- Returns
density by 2 array with location probability pairs.
- Return type
np.array
Example
>>> import pypesh.visualisation as visual >>> visual.draw_cross_section_fem(1000, 0.9, density = 10) array([[ 0.00000000e+00, 7.96836968e-01], [ 1.11111111e-01, 6.95108509e-01], [ 2.22222222e-01, 4.52912665e-01], [ 3.33333333e-01, 2.11422004e-01], [ 4.44444444e-01, 6.74661539e-02], [ 5.55555556e-01, 1.42087363e-02], [ 6.66666667e-01, 1.95186128e-03], [ 7.77777778e-01, 1.57053994e-04], [ 8.88888889e-01, 5.67654858e-06], [ 1.00000000e+00, -2.40005303e-07]])
- pypesh.visualisation.draw_cross_section_traj(peclet, ball_radius, downstream_distance=5, show=False, mesh_out=4, mesh_jump=6, spread=4, trials=200, partition=1, t_max=40)¶
Draws cross section of hitting probability at selected height using pychastic.
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
downstream_distance (float, optional) – Default 5, downstream distance in ball radius where distribution is plotted
show (bool, optional) – Default False, if True plot is shown
denstity (int, optional) – Default 10, how many points in result
maximal_radius (float, optional) – Default 1, maximal radius to place in result
mesh_out (int, optional) – Amount of samples outside the region of highest slope
mesh_jump (int, optional) – Amount of samples in the region of highest slope
spread (int, optional) – How far in sqrt(1/peclet), mesh_out will reach
trials (int, optional) – Default 200, Number of trajectories.
parition (int, optional) – Default 1, if to expensive in RAM partition into ‘partition’ parts.
t_max (float, optional) – Default 40.0, select time of simmulation
- Returns
density by 2 array with location probability pairs.
- Return type
np.array
Example
>>> import pypesh.visualisation as visual >>> visual.draw_cross_section_traj(1000, 0.9) array([[0. , 0.77499998], [0.09137468, 0.67000002], [0.18274937, 0.47999999], [0.27412405, 0.315 ], [0.36549873, 0.155 ], [0.45687341, 0.04 ], [0.77310118, 0. ], [1.08932895, 0. ], [1.40555671, 0. ]])
- pypesh.visualisation.draw_distributions_fem(peclet, ball_radius, limits=[-2.5, 2.5, -2.5, 5], draw_streamline=False)¶
Draws distribution of concentration
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
limits (list) – minimal radius, maximal radius, minimal height, maximal height
draw_streamline (boole, optional) – Default False, if True adds a streamline for pe -> infty
- Return type
None
Example
>>> import pypesh.visualisation as visual >>> visual.draw_distributions_fem(1000, 0.9)
- pypesh.visualisation.visualise_trajectories(peclet, ball_radius, positions, t_max=20, downstream_distance=5, show=False)¶
Draws trajectories simulated by pychastic.
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
positions (dict) – Keys: position where simulate, Values: how many times
t_max (float, optional) – Default 20, time of simulation
downstream_distance (float, optional) – Default 5, downstream distance in ball radius where distribution is plotted
show (bool, optional) – Default False, if True plot is shown
- Returns
list of outcomes from pychastic for each position
- Return type
list
Example
>>> visual.visualise_trajectories(1000, 0.9, {0.1: 2, 0.2: 1}, t_max=0.05) [{'ball_hit': Array([False, False], dtype=bool), 'roof_hit': Array([False, False], dtype=bool), 'something_hit': Array([False, False], dtype=bool), 'trajectories': Array([[[ 9.74556133e-02, 3.57697834e-03, -4.99383068e+00], [ 1.03875704e-01, 1.23539870e-03, -4.99430752e+00], [ 1.00019522e-01, 2.17465451e-03, -4.99006510e+00], [ 9.64764059e-02, 3.37144663e-03, -4.98079920e+00], [ 9.23867375e-02, 9.56971012e-03, -4.97192192e+00]], [[ 1.00915655e-01, -3.44433682e-03, -4.99829912e+00], [ 9.91058275e-02, -7.94267934e-03, -4.98968840e+00], [ 1.03579685e-01, -5.71627077e-03, -4.98568869e+00], [ 1.08699612e-01, -5.76060778e-03, -4.97635365e+00], [ 1.07397184e-01, -8.04143026e-03, -4.96779823e+00]]], dtype=float32)}, {'ball_hit': Array([False], dtype=bool), 'roof_hit': Array([False], dtype=bool), 'something_hit': Array([False], dtype=bool), 'trajectories': Array([[[ 1.9748163e-01, 3.5769783e-03, -4.9938278e+00], [ 2.0392781e-01, 1.2353971e-03, -4.9943018e+00], [ 2.0009771e-01, 2.1746524e-03, -4.9900560e+00], [ 1.9658074e-01, 3.3714436e-03, -4.9807873e+00], [ 1.9251731e-01, 9.5697045e-03, -4.9719067e+00]]], dtype=float32)}]
- pypesh.visualisation.visualise_trajectories_with_streamplot(peclet, ball_radius, positions, t_max=20, downstream_distance=5, show=False, save='no')¶
Draws trajectories simulated by pychastic.
- Parameters
peclet (float) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
positions (dict) – Keys: position where simulate, Values: how many times
t_max (float, optional) – Default 20, time of simulation
downstream_distance (float, optional) – Default 5, downstream distance in ball radius where distribution is plotted
show (bool, optional) – Default False, if True plot is shown
- Returns
list of outcomes from pychastic for each position
- Return type
list
Example
>>> visual.visualise_trajectories_with_streamplot(1000, 0.9, {0.1: 2, 0.2: 1}, t_max=0.05) [{'ball_hit': Array([False, False], dtype=bool), 'roof_hit': Array([False, False], dtype=bool), 'something_hit': Array([False, False], dtype=bool), 'trajectories': Array([[[ 9.74556133e-02, 3.57697834e-03, -4.99383068e+00], [ 1.03875704e-01, 1.23539870e-03, -4.99430752e+00], [ 1.00019522e-01, 2.17465451e-03, -4.99006510e+00], [ 9.64764059e-02, 3.37144663e-03, -4.98079920e+00], [ 9.23867375e-02, 9.56971012e-03, -4.97192192e+00]], [[ 1.00915655e-01, -3.44433682e-03, -4.99829912e+00], [ 9.91058275e-02, -7.94267934e-03, -4.98968840e+00], [ 1.03579685e-01, -5.71627077e-03, -4.98568869e+00], [ 1.08699612e-01, -5.76060778e-03, -4.97635365e+00], [ 1.07397184e-01, -8.04143026e-03, -4.96779823e+00]]], dtype=float32)}, {'ball_hit': Array([False], dtype=bool), 'roof_hit': Array([False], dtype=bool), 'something_hit': Array([False], dtype=bool), 'trajectories': Array([[[ 1.9748163e-01, 3.5769783e-03, -4.9938278e+00], [ 2.0392781e-01, 1.2353971e-03, -4.9943018e+00], [ 2.0009771e-01, 2.1746524e-03, -4.9900560e+00], [ 1.9658074e-01, 3.3714436e-03, -4.9807873e+00], [ 1.9251731e-01, 9.5697045e-03, -4.9719067e+00]]], dtype=float32)}]
Pe vs Sh¶
Final package pesh that calculates the value of \(Sh\) for given Peclet and radius of rigid ball.
- pypesh.pesh.all_sherwood(peclet, ball_radius, mesh_out=4, mesh_jump=6, trials=100, floor_h=5, spread=4, t_max=40.0, partition=1)¶
Calculates the sherwood number using clift approximation, fem approach and trajectories approach.
- Parameters
peclet (float, optional) – Peclet number defined as R u / D.
ball_radius (float) – Radius of the big ball.
mesh_out (int, optional) – For trajectories, amount of samples outside the region of highest slope
mesh_jump (int, optional) – For trajectories, amount of samples in the region of highest slope
trials (int, optional) – For trajectories, number of trajectories per position, uncertainty of propability estimation is sqrt(trials)/trials.
floor_h (int, optional) – For trajectories, initial depth for simulation
spread (int, optional) – For trajectories, how far in sqrt(1/peclet), mesh_out will reach
- Returns
float - Clift et. al., float - our approximation, float - fem approach, float - fem approach different integral , float - trajectories approach
- Return type
tuple
Example
>>> import pypesh.pesh as pesh >>> pesh.all_sherwood(1000, 0.9) (6.800655008742168, 10.425655008742165, np.float64(12.033892568100546), np.float64(11.720084145681978), 0)
- pypesh.pesh.sherwood_heatmap()¶
Interpolate the sherwood number for given peclet and ball_radius and returns a function.
- Returns
Gives sherwood number for given peclet and ball_radius
- Return type
function
Example
>>> import pypesh.pesh as pesh >>> import numpy as np >>> interp = pesh.sherwood_heatmap() >>> to_call = np.array([1000,0.9]) >>> interp(to_call) array([12.03389257])