code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
#Checking input validity
ut.check_range([Diam, ">0", "Diameter"],
[RatioVCOrifice, "0-1", "VC orifice ratio"])
if Height > 0:
return (RatioVCOrifice * area_circle(Diam).magnitude
* np.sqrt(2 * gravity.magnitude * Height))
else:
return 0 | def flow_orifice(Diam, Height, RatioVCOrifice) | Return the flow rate of the orifice. | 6.889877 | 6.806971 | 1.01218 |
#Checking input validity
ut.check_range([RatioVCOrifice, "0-1", "VC orifice ratio"])
if Height > -Diam / 2:
flow_vert = integrate.quad(lambda z: (Diam * np.sin(np.arccos(z/(Diam/2)))
* np.sqrt(Height - z)
... | def flow_orifice_vert(Diam, Height, RatioVCOrifice) | Return the vertical flow rate of the orifice. | 6.436082 | 6.390907 | 1.007069 |
#Checking input validity
ut.check_range([Diam, ">0", "Diameter"], [FlowRate, ">0", "Flow rate"],
[RatioVCOrifice, "0-1", "VC orifice ratio"])
return ((FlowRate
/ (RatioVCOrifice * area_circle(Diam).magnitude)
)**2
/ (2*gravity.magnitude)
... | def head_orifice(Diam, RatioVCOrifice, FlowRate) | Return the head of the orifice. | 7.856182 | 7.874472 | 0.997677 |
#Checking input validity
ut.check_range([Height, ">0", "Height"], [FlowRate, ">0", "Flow rate"],
[RatioVCOrifice, "0-1, >0", "VC orifice ratio"])
return FlowRate / (RatioVCOrifice * np.sqrt(2 * gravity.magnitude * Height)) | def area_orifice(Height, RatioVCOrifice, FlowRate) | Return the area of the orifice. | 6.98864 | 7.000474 | 0.99831 |
#Inputs do not need to be checked here because they are checked by
#functions this function calls.
return np.ceil(area_orifice(HeadLossOrifice, RatioVCOrifice,
FlowPlant).magnitude
/ area_circle(DiamOrifice).magnitude) | def num_orifices(FlowPlant, RatioVCOrifice, HeadLossOrifice, DiamOrifice) | Return the number of orifices. | 8.872486 | 8.15137 | 1.088466 |
#Checking input validity
ut.check_range([Diam, ">0", "Diameter"], [Nu, ">0", "Nu"])
return np.pi * Diam * RE_TRANSITION_PIPE * Nu / 4 | def flow_transition(Diam, Nu) | Return the flow rate for the laminar/turbulent transition.
This equation is used in some of the other equations for flow. | 13.56808 | 16.173342 | 0.838916 |
#Checking input validity
ut.check_range([Diam, ">0", "Diameter"], [Length, ">0", "Length"],
[HeadLossFric, ">=0", "Headloss due to friction"],
[Nu, ">0", "Nu"])
return (np.pi*Diam**4) / (128*Nu) * gravity.magnitude * HeadLossFric / Length | def flow_hagen(Diam, HeadLossFric, Length, Nu) | Return the flow rate for laminar flow with only major losses. | 6.686502 | 6.628749 | 1.008713 |
#Checking input validity
ut.check_range([Diam, ">0", "Diameter"], [Length, ">0", "Length"],
[HeadLossFric, ">0", "Headloss due to friction"],
[Nu, ">0", "Nu"], [PipeRough, "0-1", "Pipe roughness"])
logterm = np.log10(PipeRough / (3.7 * Diam)
... | def flow_swamee(Diam, HeadLossFric, Length, Nu, PipeRough) | Return the flow rate for turbulent flow with only major losses. | 5.823294 | 5.72441 | 1.017274 |
#Inputs do not need to be checked here because they are checked by
#functions this function calls.
FlowHagen = flow_hagen(Diam, HeadLossFric, Length, Nu).magnitude
if FlowHagen < flow_transition(Diam, Nu).magnitude:
return FlowHagen
else:
return flow_swamee(Diam, HeadLossFric, L... | def flow_pipemajor(Diam, HeadLossFric, Length, Nu, PipeRough) | Return the flow rate with only major losses.
This function applies to both laminar and turbulent flows. | 5.835845 | 5.739833 | 1.016727 |
#Checking input validity - inputs not checked here are checked by
#functions this function calls.
ut.check_range([HeadLossExpans, ">=0", "Headloss due to expansion"],
[KMinor, ">0", "K minor"])
return (area_circle(Diam).magnitude * np.sqrt(2 * gravity.magnitude
... | def flow_pipeminor(Diam, HeadLossExpans, KMinor) | Return the flow rate with only minor losses.
This function applies to both laminar and turbulent flows. | 14.971054 | 15.551725 | 0.962662 |
#Inputs do not need to be checked here because they are checked by
#functions this function calls.
if KMinor == 0:
FlowRate = flow_pipemajor(Diam, HeadLoss, Length, Nu,
PipeRough).magnitude
else:
FlowRatePrev = 0
err = 1.0
FlowRate =... | def flow_pipe(Diam, HeadLoss, Length, Nu, PipeRough, KMinor) | Return the the flow in a straight pipe.
This function works for both major and minor losses and
works whether the flow is laminar or turbulent. | 3.314393 | 3.289721 | 1.0075 |
#Checking input validity
ut.check_range([FlowRate, ">0", "Flow rate"], [Length, ">0", "Length"],
[HeadLossFric, ">0", "Headloss due to friction"],
[Nu, ">0", "Nu"], [PipeRough, "0-1", "Pipe roughness"])
a = ((PipeRough ** 1.25)
* ((Length * FlowRate**2)
... | def diam_swamee(FlowRate, HeadLossFric, Length, Nu, PipeRough) | Return the inner diameter of a pipe.
The Swamee Jain equation is dimensionally correct and returns the
inner diameter of a pipe given the flow rate and the head loss due
to shear on the pipe walls. The Swamee Jain equation does NOT take
minor losses into account. This equation ONLY applies to turbulent... | 5.756063 | 5.844717 | 0.984832 |
#Inputs do not need to be checked here because they are checked by
#functions this function calls.
DiamLaminar = diam_hagen(FlowRate, HeadLossFric, Length, Nu).magnitude
if re_pipe(FlowRate, DiamLaminar, Nu) <= RE_TRANSITION_PIPE:
return DiamLaminar
else:
return diam_swamee(Flow... | def diam_pipemajor(FlowRate, HeadLossFric, Length, Nu, PipeRough) | Return the pipe IDiam that would result in given major losses.
This function applies to both laminar and turbulent flow. | 6.85738 | 6.19955 | 1.106109 |
#Checking input validity
ut.check_range([FlowRate, ">0", "Flow rate"], [KMinor, ">=0", "K minor"],
[HeadLossExpans, ">0", "Headloss due to expansion"])
return (np.sqrt(4 * FlowRate / np.pi)
* (KMinor / (2 * gravity.magnitude * HeadLossExpans)) ** (1/4)
) | def diam_pipeminor(FlowRate, HeadLossExpans, KMinor) | Return the pipe ID that would result in the given minor losses.
This function applies to both laminar and turbulent flow. | 7.497428 | 7.979239 | 0.939617 |
#Inputs do not need to be checked here because they are checked by
#functions this function calls.
if KMinor == 0:
Diam = diam_pipemajor(FlowRate, HeadLoss, Length, Nu,
PipeRough).magnitude
else:
Diam = max(diam_pipemajor(FlowRate, HeadLoss,
... | def diam_pipe(FlowRate, HeadLoss, Length, Nu, PipeRough, KMinor) | Return the pipe ID that would result in the given total head loss.
This function applies to both laminar and turbulent flow and
incorporates both minor and major losses. | 3.662246 | 3.636807 | 1.006995 |
#Checking input validity
ut.check_range([FlowRate, ">0", "Flow rate"], [Height, ">0", "Height"])
return ((3 / 2) * FlowRate
/ (con.VC_ORIFICE_RATIO * np.sqrt(2 * gravity.magnitude) * Height ** (3 / 2))
) | def width_rect_weir(FlowRate, Height) | Return the width of a rectangular weir. | 12.518563 | 12.127968 | 1.032206 |
#Checking input validity
ut.check_range([FlowRate, ">0", "Flow rate"], [Width, ">0", "Width"])
return (((3/2) * FlowRate
/ (con.VC_ORIFICE_RATIO * np.sqrt(2 * gravity.magnitude) * Width)
) ** (2/3)) | def headloss_weir(FlowRate, Width) | Return the headloss of a weir. | 14.649833 | 14.36999 | 1.019474 |
#Checking input validity
ut.check_range([Height, ">0", "Height"], [Width, ">0", "Width"])
return ((2/3) * con.VC_ORIFICE_RATIO
* (np.sqrt(2*gravity.magnitude) * Height**(3/2))
* Width) | def flow_rect_weir(Height, Width) | Return the flow of a rectangular weir. | 15.758524 | 15.602004 | 1.010032 |
#Checking input validity
ut.check_range([FlowRate, ">0", "Flow rate"], [Width, ">0", "Width"])
return (FlowRate / (Width * np.sqrt(gravity.magnitude))) ** (2/3) | def height_water_critical(FlowRate, Width) | Return the critical local water depth. | 10.179559 | 10.066585 | 1.011223 |
#Checking input validity
ut.check_range([HeightWaterCritical, ">0", "Critical height of water"])
return np.sqrt(gravity.magnitude * HeightWaterCritical) | def vel_horizontal(HeightWaterCritical) | Return the horizontal velocity. | 19.886089 | 18.799892 | 1.057777 |
#Checking input validity
ut.check_range([Length, ">0", "Length"], [Diam, ">0", "Diam"],
[Vel, ">0", "Velocity"], [Nu, ">0", "Nu"],
[Porosity, "0-1", "Porosity"])
return (K_KOZENY * Length * Nu
/ gravity.magnitude * (1-Porosity)**2
/ Porosity... | def headloss_kozeny(Length, Diam, Vel, Porosity, Nu) | Return the Carmen Kozeny Sand Bed head loss. | 5.931184 | 5.927825 | 1.000567 |
if color != "":
inner_diameter = ID_colored_tube(color)
term1 = (R_pump * 2 * np.pi - k_nonlinear * inner_diameter) / u.rev
term2 = np.pi * (inner_diameter ** 2) / 4
return (term1 * term2).to(u.mL/u.rev) | def vol_per_rev_3_stop(color="", inner_diameter=0) | Return the volume per revolution of an Ismatec 6 roller pump
given the inner diameter (ID) of 3-stop tubing. The calculation is
interpolated from the table found at
http://www.ismatec.com/int_e/pumps/t_mini_s_ms_ca/tubing_msca2.htm.
Note:
1. Either input a string as the tubing color code or a numbe... | 8.112025 | 8.808903 | 0.920889 |
tubing_data_path = os.path.join(os.path.dirname(__file__), "data",
"3_stop_tubing.txt")
df = pd.read_csv(tubing_data_path, delimiter='\t')
idx = df["Color"] == color
return df[idx]['Diameter (mm)'].values[0] * u.mm | def ID_colored_tube(color) | Look up the inner diameter of Ismatec 3-stop tubing given its color code.
:param color: Color of the 3-stop tubing
:type color: string
:returns: Inner diameter of the 3-stop tubing (mm)
:rtype: float
:Examples:
>>> from aguaclara.research.peristaltic_pump import ID_colored_tube
>>> from ... | 4.418539 | 3.458586 | 1.277556 |
tubing_data_path = os.path.join(os.path.dirname(__file__), "data",
"LS_tubing.txt")
df = pd.read_csv(tubing_data_path, delimiter='\t')
idx = df["Number"] == id_number
return df[idx]['Flow (mL/rev)'].values[0] * u.mL/u.turn | def vol_per_rev_LS(id_number) | Look up the volume per revolution output by a Masterflex L/S pump
through L/S tubing of the given ID number.
:param id_number: Identification number of the L/S tubing. Valid numbers are 13-18, 24, 35, and 36.
:type id_number: int
:return: Volume per revolution output by a Masterflex L/S pump through t... | 4.385682 | 4.158413 | 1.054653 |
return (vol_per_rev * rpm).to(u.mL/u.s) | def flow_rate(vol_per_rev, rpm) | Return the flow rate from a pump given the volume of fluid pumped per
revolution and the desired pump speed.
:param vol_per_rev: Volume of fluid output per revolution (dependent on pump and tubing)
:type vol_per_rev: float
:param rpm: Desired pump speed in revolutions per minute
:type rpm: float
... | 3.791711 | 6.755437 | 0.561283 |
if ent_pipe_id > exit_pipe_id:
print('k_value_expansion: Entrance pipe\'s inner diameter is larger '
'than exit pipe\'s inner diameter, using reduction instead.')
return k_value_reduction(ent_pipe_id, exit_pipe_id, q,
fitting_angle, rounded,
... | def k_value_expansion(ent_pipe_id, exit_pipe_id, q,
fitting_angle=180, rounded=False,
nu=con.WATER_NU, pipe_rough=mats.PVC_PIPE_ROUGH) | Calculates the minor loss coefficient (k-value) of a square,
tapered, or rounded expansion in a pipe. Defaults to square.
To use tapered, set angle to something that isn't 180.
To use rounded, set rounded to True.
Parameters:
ent_pipe_id: Entrance pipe's inner diameter from which fluid flows.... | 2.812205 | 2.506133 | 1.122129 |
if ent_pipe_id < exit_pipe_id:
print('k_value_reduction: Entrance pipe\'s inner diameter is less than '
'exit pipe\'s inner diameter, using expansion instead.')
return k_value_expansion(ent_pipe_id, exit_pipe_id, q,
fitting_angle, rounded,
... | def k_value_reduction(ent_pipe_id, exit_pipe_id, q,
fitting_angle=180, rounded=False,
nu=con.WATER_NU, pipe_rough=mats.PVC_PIPE_ROUGH) | Calculates the minor loss coefficient (k-value) of a square,
tapered, or rounded reduction in a pipe. Defaults to square.
To use tapered, set angle to something that isn't 180.
To use rounded, set rounded to True.
Parameters:
ent_pipe_id: Entrance pipe's inner diameter from which fluid flows.... | 2.961194 | 2.599242 | 1.139253 |
if orifice_id > pipe_id:
raise ValueError('The orifice\'s inner diameter cannot be larger than'
'that of the entrance pipe.')
re = pc.re_pipe(q, pipe_id, nu) # Entrance pipe's Reynolds number.
orifice_type = _get_orifice_type(orifice_l, orifice_id)
if orifice_t... | def k_value_orifice(pipe_id, orifice_id, orifice_l, q,
nu=con.WATER_NU) | Calculates the minor loss coefficient of an orifice plate in a
pipe.
Parameters:
pipe_id: Entrance pipe's inner diameter from which fluid flows.
orifice_id: Orifice's inner diameter.
orifice_l: Orifice's length from start to end.
q: Fluid's q rate.
nu: Fluid's dynamic v... | 3.079335 | 2.702642 | 1.13938 |
if re < 2500:
return (1.2 + (160 / re)) * ((ent_pipe_id / exit_pipe_id) ** 4)
else:
return (0.6 + 0.48 * f) * (ent_pipe_id / exit_pipe_id) ** 2\
* ((ent_pipe_id / exit_pipe_id) ** 2 - 1) | def _k_value_square_reduction(ent_pipe_id, exit_pipe_id, re, f) | Returns the minor loss coefficient for a square reducer.
Parameters:
ent_pipe_id: Entrance pipe's inner diameter.
exit_pipe_id: Exit pipe's inner diameter.
re: Reynold's number.
f: Darcy friction factor. | 3.335631 | 2.894159 | 1.152539 |
k_value_square_reduction = _k_value_square_reduction(ent_pipe_id, exit_pipe_id,
re, f)
if 45 < fitting_angle <= 180:
return k_value_square_reduction * np.sqrt(np.sin(fitting_angle / 2))
elif 0 < fitting_angle <= 45:
return k_val... | def _k_value_tapered_reduction(ent_pipe_id, exit_pipe_id, fitting_angle, re, f) | Returns the minor loss coefficient for a tapered reducer.
Parameters:
ent_pipe_id: Entrance pipe's inner diameter.
exit_pipe_id: Exit pipe's inner diameter.
fitting_angle: Fitting angle between entrance and exit pipes.
re: Reynold's number.
f: Darcy friction factor. | 3.036279 | 3.196558 | 0.949859 |
nu = pc.viscosity_kinematic(T)
K_minor = con.PIPE_ENTRANCE_K_MINOR + con.PIPE_EXIT_K_MINOR + con.EL90_K_MINOR
drain_ID = pc.diam_pipe(q_plant, depth_end, depth_end, nu, mat.PVC_PIPE_ROUGH, K_minor)
drain_ND = pipe.SDR_available_ND(drain_ID, SDR)
return pipe.OD(drain_ND).magnitude | def drain_OD(q_plant, T, depth_end, SDR) | Return the nominal diameter of the entrance tank drain pipe. Depth at the
end of the flocculator is used for headloss and length calculation inputs in
the diam_pipe calculation.
Parameters
----------
q_plant: float
Plant flow rate
T: float
Design temperature
depth_end: flo... | 11.070817 | 13.176544 | 0.840191 |
num_plates = np.ceil(np.sqrt(q_plant / (design.ent_tank.CENTER_PLATE_DIST.magnitude
* W_chan * design.ent_tank.CAPTURE_BOD_VEL.magnitude * np.sin(
design.ent_tank.PLATE_ANGLE.to(u.rad).magnitude))))
return num_plates | def num_plates_ET(q_plant, W_chan) | Return the number of plates in the entrance tank.
This number minimizes the total length of the plate settler unit.
Parameters
----------
q_plant: float
Plant flow rate
W_chan: float
Width of channel
Returns
-------
float
?
Examples
--------
>>> f... | 8.202454 | 8.418616 | 0.974323 |
L_plate = (q_plant / (num_plates_ET(q_plant, W_chan) * W_chan *
design.ent_tank.CAPTURE_BOD_VEL.magnitude * np.cos(
design.ent_tank.PLATE_ANGLE.to(u.rad).magnitude)))
- (design.ent_tank.PLATE_S.magnitude * np.tan(design.ent_tank.PLATE_ANGLE.to(u.rad).magnitude))
... | def L_plate_ET(q_plant, W_chan) | Return the length of the plates in the entrance tank.
Parameters
----------
q_plant: float
Plant flow rate
W_chan: float
Width of channel
Returns
-------
float
?
Examples
--------
>>> from aguaclara.play import*
>>> L_plate_ET(20*u.L/u.s,2*u.m)
... | 6.211362 | 6.199881 | 1.001852 |
alpha0_carbonate = 1/(1+(K1_carbonate/invpH(pH)) *
(1+(K2_carbonate/invpH(pH))))
return alpha0_carbonate | def alpha0_carbonate(pH) | Calculate the fraction of total carbonates in carbonic acid form (H2CO3)
:param pH: pH of the system
:type pH: float
:return: Fraction of carbonates in carbonic acid form (H2CO3)
:rtype: float
:Examples:
>>> from aguaclara.research.environmental_processes_analysis import alpha0_carbonate
... | 5.225934 | 9.980538 | 0.523612 |
alpha1_carbonate = 1/((invpH(pH)/K1_carbonate) + 1 +
(K2_carbonate/invpH(pH)))
return alpha1_carbonate | def alpha1_carbonate(pH) | Calculate the fraction of total carbonates in bicarbonate form (HCO3-)
:param pH: pH of the system
:type pH: float
:return: Fraction of carbonates in bicarbonate form (HCO3-)
:rtype: float
:Examples:
>>> from aguaclara.research.environmental_processes_analysis import alpha1_carbonate
>>>... | 5.692072 | 10.837541 | 0.525218 |
alpha2_carbonate = 1/(1+(invpH(pH)/K2_carbonate) *
(1+(invpH(pH)/K1_carbonate)))
return alpha2_carbonate | def alpha2_carbonate(pH) | Calculate the fraction of total carbonates in carbonate form (CO3-2)
:param pH: pH of the system
:type pH: float
:return: Fraction of carbonates in carbonate form (CO3-2)
:rtype: float
:Examples:
>>> from aguaclara.research.environmental_processes_analysis import alpha2_carbonate
>>> rou... | 5.828625 | 10.252178 | 0.568525 |
return (total_carbonates * (u.eq/u.mol * alpha1_carbonate(pH) +
2 * u.eq/u.mol * alpha2_carbonate(pH)) +
1 * u.eq/u.mol * Kw/invpH(pH) - 1 * u.eq/u.mol * invpH(pH)) | def ANC_closed(pH, total_carbonates) | Calculate the acid neutralizing capacity (ANC) under a closed system
in which no carbonates are exchanged with the atmosphere during the
experiment. Based on pH and total carbonates in the system.
:param pH: pH of the system
:type pH: float
:param total_carbonates: Total carbonate concentration in ... | 5.367537 | 6.009799 | 0.893131 |
#return the list of files in the directory
filenames = os.listdir(dirpath)
#extract the flowrates from the filenames and apply units
airflows = ((np.array([i.split('.', 1)[0] for i in filenames])).astype(np.float32))
#sort airflows and filenames so that they are in ascending order of flow rates... | def aeration_data(DO_column, dirpath) | Extract the data from folder containing tab delimited
files of aeration data. The file must be the original tab delimited file.
All text strings below the header must be removed from these files.
The file names must be the air flow rates with units of micromoles/s.
An example file name would be "300.xls... | 4.604628 | 3.22583 | 1.427424 |
fraction_O2 = 0.21
P_O2 = P_air * fraction_O2
return ((P_O2.to(u.atm).magnitude) *
u.mg/u.L*np.exp(1727 / temp.to(u.K).magnitude - 2.105)) | def O2_sat(P_air, temp) | Calculate saturaed oxygen concentration in mg/L for 278 K < T < 318 K
:param P_air: Air pressure with appropriate units
:type P_air: float
:param temp: Water temperature with appropriate units
:type temp: float
:return: Saturated oxygen concentration in mg/L
:rtype: float
:Examples:
... | 5.660686 | 7.004483 | 0.808152 |
df = pd.read_csv(data_file_path, delimiter='\t', header=5)
V_t = np.array(pd.to_numeric(df.iloc[0:, 0]))*u.mL
pH = np.array(pd.to_numeric(df.iloc[0:, 1]))
df = pd.read_csv(data_file_path, delimiter='\t', header=-1, nrows=5)
V_S = pd.to_numeric(df.iloc[0, 1])*u.mL
N_t = pd.to_numeric(df.iloc... | def Gran(data_file_path) | Extract the data from a ProCoDA Gran plot file. The file must be the original tab delimited file.
:param data_file_path: The path to the file. If the file is in the working directory, then the file name is sufficient.
:return: collection of
* **V_titrant** (*float*) - Volume of titrant in mL
... | 2.949741 | 1.949054 | 1.513422 |
return C_influent * (1-np.exp(-t)) + C_initial*np.exp(-t) | def CMFR(t, C_initial, C_influent) | Calculate the effluent concentration of a conversative (non-reacting)
material with continuous input to a completely mixed flow reactor.
Note: time t=0 is the time at which the material starts to flow into the
reactor.
:param C_initial: The concentration in the CMFR at time t=0.
:type C_initial: f... | 3.154002 | 6.300292 | 0.500612 |
return (N**N)/special.gamma(N) * (t**(N-1))*np.exp(-N*t) | def E_CMFR_N(t, N) | Calculate a dimensionless measure of the output tracer concentration
from a spike input to a series of completely mixed flow reactors.
:param t: The time(s) at which to calculate the effluent concentration. Time can be made dimensionless by dividing by the residence time of the CMFR.
:type t: float or nump... | 6.479872 | 14.56218 | 0.44498 |
# replace any times at zero with a number VERY close to zero to avoid
# divide by zero errors
if isinstance(t, list):
t[t == 0] = 10**(-10)
return (Pe/(4*np.pi*t))**(0.5)*np.exp((-Pe*((1-t)**2))/(4*t)) | def E_Advective_Dispersion(t, Pe) | Calculate a dimensionless measure of the output tracer concentration from
a spike input to reactor with advection and dispersion.
:param t: The time(s) at which to calculate the effluent concentration. Time can be made dimensionless by dividing by the residence time of the CMFR.
:type t: float or numpy.arr... | 6.360907 | 10.044112 | 0.633297 |
return C_bar*E_CMFR_N(t_seconds/t_bar, N) | def Tracer_CMFR_N(t_seconds, t_bar, C_bar, N) | Used by Solver_CMFR_N. All inputs and outputs are unitless. This is
The model function, f(x, ...). It takes the independent variable as the
first argument and the parameters to fit as separate remaining arguments.
:param t_seconds: List of times
:type t_seconds: float list
:param t_bar: Average tim... | 4.69345 | 10.316473 | 0.454947 |
C_unitless = C_data.magnitude
C_units = str(C_bar_guess.units)
t_seconds = (t_data.to(u.s)).magnitude
# assume that a guess of 1 reactor in series is close enough to get a solution
p0 = [theta_guess.to(u.s).magnitude, C_bar_guess.magnitude,1]
popt, pcov = curve_fit(Tracer_CMFR_N, t_seconds,... | def Solver_CMFR_N(t_data, C_data, theta_guess, C_bar_guess) | Use non-linear least squares to fit the function
Tracer_CMFR_N(t_seconds, t_bar, C_bar, N) to reactor data.
:param t_data: Array of times with units
:type t_data: float list
:param C_data: Array of tracer concentration data with units
:type C_data: float list
:param theta_guess: Estimate of tim... | 3.499706 | 3.2896 | 1.06387 |
return C_bar*E_Advective_Dispersion(t_seconds/t_bar, Pe) | def Tracer_AD_Pe(t_seconds, t_bar, C_bar, Pe) | Used by Solver_AD_Pe. All inputs and outputs are unitless. This is the
model function, f(x, ...). It takes the independent variable as the
first argument and the parameters to fit as separate remaining arguments.
:param t_seconds: List of times
:type t_seconds: float list
:param t_bar: Average time... | 9.450745 | 17.108545 | 0.552399 |
#remove time=0 data to eliminate divide by zero error
t_data = t_data[1:-1]
C_data = C_data[1:-1]
C_unitless = C_data.magnitude
C_units = str(C_bar_guess.units)
t_seconds = (t_data.to(u.s)).magnitude
# assume that a guess of 1 reactor in series is close enough to get a solution
p0 =... | def Solver_AD_Pe(t_data, C_data, theta_guess, C_bar_guess) | Use non-linear least squares to fit the function
Tracer_AD_Pe(t_seconds, t_bar, C_bar, Pe) to reactor data.
:param t_data: Array of times with units
:type t_data: float list
:param C_data: Array of tracer concentration data with units
:type C_data: float list
:param theta_guess: Estimate of tim... | 3.608969 | 3.439743 | 1.049197 |
u.default_format = '.' + str(n) + 'g'
pd.options.display.float_format = ('{:,.' + str(n) + '}').format | def set_sig_figs(n=4) | Set the number of significant figures used to print Pint, Pandas, and
NumPy quantities.
Args:
n (int): Number of significant figures to display. | 4.952579 | 6.414815 | 0.772053 |
data = data_from_dates(path, dates)
first_time_column = pd.to_numeric(data[0].iloc[:, 0])
start = max(day_fraction(start_time), first_time_column[0])
start_idx = time_column_index(start, first_time_column)
end_idx = time_column_index(day_fraction(end_time),
pd.to_numeric(data[-1].iloc[... | def get_data_by_time(path, columns, dates, start_time='00:00', end_time='23:59') | Extract columns of data from a ProCoDA datalog based on date(s) and time(s)
Note: Column 0 is time. The first data column is column 1.
:param path: The path to the folder containing the ProCoDA data file(s)
:type path: string
:param columns: A single index of a column OR a list of indices of columns o... | 3.083707 | 3.563714 | 0.865307 |
has_text = data.iloc[:, 0].astype(str).str.contains('(?!e-)[a-zA-Z]')
text_rows = list(has_text.index[has_text])
return data.drop(text_rows) | def remove_notes(data) | Omit notes from a DataFrame object, where notes are identified as rows with non-numerical entries in the first column.
:param data: DataFrame object to remove notes from
:type data: Pandas.DataFrame
:return: DataFrame object with no notes
:rtype: Pandas.DataFrame | 5.630704 | 5.807158 | 0.969614 |
hour = int(time.split(":")[0])
minute = int(time.split(":")[1])
return hour/24 + minute/1440 | def day_fraction(time) | Convert a 24-hour time to a fraction of a day.
For example, midnight corresponds to 0.0, and noon to 0.5.
:param time: Time in the form of 'HH:MM' (24-hour time)
:type time: string
:return: A day fraction
:rtype: float
:Examples:
.. code-block:: python
day_fraction("18:30") | 2.464971 | 3.242226 | 0.760271 |
interval = time_column[1]-time_column[0]
return int(round((time - time_column[0])/interval + .5)) | def time_column_index(time, time_column) | Return the index of lowest time in the column of times that is greater
than or equal to the given time.
:param time: the time to index from the column of time; a day fraction
:type time: float
:param time_column: a list of times (in day fractions), must be increasing and equally spaced
:type time_c... | 4.17466 | 4.315191 | 0.967433 |
if path[-1] != os.path.sep:
path += os.path.sep
if not isinstance(dates, list):
dates = [dates]
data = []
for d in dates:
filepath = path + 'datalog ' + d + '.xls'
data.append(remove_notes(pd.read_csv(filepath, delimiter='\t')))
return data | def data_from_dates(path, dates) | Return list DataFrames representing the ProCoDA datalogs stored in
the given path and recorded on the given dates.
:param path: The path to the folder containing the ProCoDA data file(s)
:type path: string
:param dates: A single date or list of dates for which data was recorded, formatted "M-D-YYYY"
... | 3.505081 | 3.562594 | 0.983856 |
if len(data) == 1:
result = list(pd.to_numeric(data[0].iloc[start_idx:end_idx, column]))
else:
result = list(pd.to_numeric(data[0].iloc[start_idx:, column]))
for i in range(1, len(data)-1):
data[i].iloc[0, 0] = 0
result += list(pd.to_numeric(data[i].iloc[:, c... | def column_start_to_end(data, column, start_idx, end_idx) | Return a list of numeric data entries in the given column from the starting
index to the ending index. This can list can be compiled over one or more
DataFrames.
:param data: a list of DataFrames to extract data in one column from
:type data: Pandas.DataFrame list
:param column: a column index
... | 2.299042 | 2.267283 | 1.014008 |
data_agg = []
day = 0
first_day = True
overnight = False
extension = ".xls"
if path[-1] != '/':
path += '/'
if not isinstance(dates, list):
dates = [dates]
for d in dates:
state_file = path + "statelog " + d + extension
data_file = path + "datalog "... | def get_data_by_state(path, dates, state, column) | Reads a ProCoDA file and extracts the time and data column for each
iteration ofthe given state.
Note: column 0 is time, the first data column is column 1.
:param path: The path to the folder containing the ProCoDA data file(s), defaults to the current directory
:type path: string
:param dates: A ... | 2.27844 | 2.269947 | 1.003741 |
df = pd.read_csv(path, delimiter='\t')
start_time = pd.to_numeric(df.iloc[start, 0])*u.day
day_times = pd.to_numeric(df.iloc[start:end, 0])
time_data = np.subtract((np.array(day_times)*u.day), start_time)
return time_data | def column_of_time(path, start, end=-1) | This function extracts the column of times from a ProCoDA data file.
:param path: The file path of the ProCoDA data file. If the file is in the working directory, then the file name is sufficient.
:type path: string
:param start: Index of first row of data to extract from the data file
:type start: int... | 3.550128 | 4.116375 | 0.86244 |
if not isinstance(start, int):
start = int(start)
if not isinstance(end, int):
end = int(end)
df = pd.read_csv(path, delimiter='\t')
if units == "":
if isinstance(column, int):
data = np.array(pd.to_numeric(df.iloc[start:end, column]))
else:
... | def column_of_data(path, start, column, end="-1", units="") | This function extracts a column of data from a ProCoDA data file.
Note: Column 0 is time. The first data column is column 1.
:param path: The file path of the ProCoDA data file. If the file is in the working directory, then the file name is sufficient.
:type path: string
:param start: Index of first r... | 2.088693 | 2.356549 | 0.886336 |
df = pd.read_csv(path, delimiter='\t')
text_row = df.iloc[0:-1, 0].str.contains('[a-z]', '[A-Z]')
text_row_index = text_row.index[text_row].tolist()
notes = df.loc[text_row_index]
return notes | def notes(path) | This function extracts any experimental notes from a ProCoDA data file.
:param path: The file path of the ProCoDA data file. If the file is in the working directory, then the file name is sufficient.
:type path: string
:return: The rows of the data file that contain text notes inserted during the experime... | 4.258571 | 4.412819 | 0.965045 |
outputs = []
metafile = pd.read_csv(path, delimiter='\t', header=None)
metafile = np.array(metafile)
ids = metafile[1:, 0]
if not isinstance(ids[0], str):
ids = list(map(str, ids))
if metaids:
paths = []
for i in range(len(ids)):
if ids[i] in metaids:... | def read_state_with_metafile(func, state, column, path, metaids=[],
extension=".xls", units="") | Takes in a ProCoDA meta file and performs a function for all data of a
certain state in each of the experiments (denoted by file paths in then
metafile)
Note: Column 0 is time. The first data column is column 1.
:param func: A function that will be applied to data from each instance of the state
:... | 2.642918 | 2.553192 | 1.035142 |
if not isinstance(funcs, list):
funcs = [funcs] * len(headers)
if not isinstance(states, list):
states = [states] * len(headers)
if not isinstance(columns, list):
columns = [columns] * len(headers)
data_agg = []
for i in range(len(headers)):
ids, data = read_s... | def write_calculations_to_csv(funcs, states, columns, path, headers, out_name,
metaids=[], extension=".xls") | Writes each output of the given functions on the given states and data
columns to a new column in the specified output file.
Note: Column 0 is time. The first data column is column 1.
:param funcs: A function or list of functions which will be applied in order to the data. If only one function is given it... | 2.624745 | 2.66782 | 0.983854 |
B_plate = sed_inputs['plate_settlers']['S'] + sed_inputs['plate_settlers']['thickness']
return math.floor((sed_inputs['plate_settlers']['L_cantilevered'].magnitude / B_plate.magnitude
* np.tan(sed_inputs['plate_settlers']['angle'].to(u.rad).magnitude)) + 1) | def n_sed_plates_max(sed_inputs=sed_dict) | Return the maximum possible number of plate settlers in a module given
plate spacing, thickness, angle, and unsupported length of plate settler.
Parameters
----------
S_plate : float
Edge to edge distance between plate settlers
thickness_plate : float
Thickness of PVC sheet used to m... | 6.972538 | 4.313725 | 1.616361 |
return ((sed_inputs['tank']['vel_up'].to(u.inch/u.s).magnitude /
sed_inputs['manifold']['diffuser']['vel_max'].to(u.inch/u.s).magnitude)
* sed_inputs['tank']['W']) | def w_diffuser_inner_min(sed_inputs=sed_dict) | Return the minimum inner width of each diffuser in the sedimentation tank.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations. Can be found in sed.yaml
Returns
-------
float
Minimum inner width of ... | 7.348462 | 8.796022 | 0.83543 |
return ut.ceil_nearest(w_diffuser_inner_min(sed_inputs).magnitude,
(np.arange(1/16,1/4,1/16)*u.inch).magnitude) | def w_diffuser_inner(sed_inputs=sed_dict) | Return the inner width of each diffuser in the sedimentation tank.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Inner width of each diffuser in ... | 11.023753 | 12.79726 | 0.861415 |
return (w_diffuser_inner_min(sed_inputs['tank']['W']) +
(2 * sed_inputs['manifold']['diffuser']['thickness_wall'])).to(u.m).magnitude | def w_diffuser_outer(sed_inputs=sed_dict) | Return the outer width of each diffuser in the sedimentation tank.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Outer width of each diffuser in ... | 13.32072 | 16.051031 | 0.829898 |
return ((sed_inputs['manifold']['diffuser']['A'] /
(2 * sed_inputs['manifold']['diffuser']['thickness_wall']))
- w_diffuser_inner(sed_inputs).to(u.inch)).to(u.m).magnitude | def L_diffuser_outer(sed_inputs=sed_dict) | Return the outer length of each diffuser in the sedimentation tank.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Outer length of each diffuser i... | 10.777956 | 12.161643 | 0.886225 |
return L_diffuser_outer(sed_inputs['tank']['W']) -
(2 * (sed_inputs['manifold']['diffuser']['thickness_wall']).to(u.m)).magnitude) | def L_diffuser_inner(sed_inputs=sed_dict) | Return the inner length of each diffuser in the sedimentation tank.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Inner length of each diffuser i... | 16.582094 | 18.421324 | 0.900158 |
return (sed_inputs['tank']['vel_up'].to(u.m/u.s) *
sed_inputs['tank']['W'].to(u.m) *
L_diffuser_outer(sed_inputs)).magnitude | def q_diffuser(sed_inputs=sed_dict) | Return the flow through each diffuser.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Flow through each diffuser in the sedimentation tank
Exa... | 8.997475 | 10.19538 | 0.882505 |
return (q_diffuser(sed_inputs).magnitude
/ (w_diffuser_inner(w_tank) * L_diffuser_inner(w_tank)).magnitude) | def vel_sed_diffuser(sed_inputs=sed_dict) | Return the velocity through each diffuser.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Flow through each diffuser in the sedimentation tank
... | 12.547677 | 15.622301 | 0.80319 |
return (sed_inputs['tank']['L'] * sed_inputs['tank']['vel_up'].to(u.m/u.s) *
sed_inputs['tank']['W'].to(u.m)).magnitude | def q_tank(sed_inputs=sed_dict) | Return the maximum flow through one sedimentation tank.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Maximum flow through one sedimentation tank... | 5.612858 | 7.455789 | 0.752819 |
vel_manifold_max = (sed_inputs['diffuser']['vel_max'].to(u.m/u.s).magnitude *
sqrt(2*((1-(sed_inputs['manifold']['ratio_Q_man_orifice'])**2)) /
(((sed_inputs['manifold']['ratio_Q_man_orifice'])**2)+1)))
return vel_manifold_max | def vel_inlet_man_max(sed_inputs=sed_dict) | Return the maximum velocity through the manifold.
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
float
Maximum velocity through the manifold.
Exampl... | 5.784726 | 6.812671 | 0.849113 |
q = q_tank(sed_inputs).magnitude
return (int(np.ceil(Q_plant / q))) | def n_tanks(Q_plant, sed_inputs=sed_dict) | Return the number of sedimentation tanks required for a given flow rate.
Parameters
----------
Q_plant : float
Total plant flow rate
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
--... | 9.222693 | 15.561614 | 0.592657 |
n_tanks = n_tanks(Q_plant, sed_inputs)
return ((n_tanks * sed_inputs['tank']['W']) + sed_inputs['thickness_wall'] +
((n_tanks-1) * sed_inputs['thickness_wall'])) | def L_channel(Q_plant, sed_inputs=sed_dict) | Return the length of the inlet and exit channels for the sedimentation tank.
Parameters
----------
Q_plant : float
Total plant flow rate
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
... | 5.972497 | 5.967499 | 1.000838 |
#Inputs do not need to be checked here because they are checked by
#functions this function calls.
nu = pc.viscosity_dynamic(temp)
hl = sed_input['manifold']['exit_man']['hl_orifice'].to(u.m)
L = sed_ipnut['manifold']['tank']['L']
N_orifices = sed_inputs['manifold']['exit_man']['N_orifices'... | def ID_exit_man(Q_plant, temp, sed_inputs=sed_dict) | Return the inner diameter of the exit manifold by guessing an initial
diameter then iterating through pipe flow calculations until the answer
converges within 1%% error
Parameters
----------
Q_plant : float
Total plant flow rate
temp : float
Design temperature
sed_inputs : di... | 7.726044 | 7.686468 | 1.005149 |
Q_orifice = Q_plant/sed_input['exit_man']['N_orifices']
D_orifice = np.sqrt(Q_orifice**4)/(np.pi * con.RATIO_VC_ORIFICE * np.sqrt(2 * pc.GRAVITY.magnitude * sed_input['exit_man']['hl_orifice'].magnitude))
return ut.ceil_nearest(D_orifice, drill_bits) | def D_exit_man_orifice(Q_plant, drill_bits, sed_inputs=sed_dict) | Return the diameter of the orifices in the exit manifold for the sedimentation tank.
Parameters
----------
Q_plant : float
Total plant flow rate
drill_bits : list
List of possible drill bit sizes
sed_inputs : dict
A dictionary of all of the constant inputs needed for sediment... | 8.415298 | 9.095009 | 0.925265 |
L_sed_plate = ((sed_input['plate_settlers']['S'] * ((sed_input['tank']['vel_up']/sed_input['plate_settlers']['vel_capture'])-1)
+ sed_input['plate_settlers']['thickness'] * (sed_input['tank']['vel_up']/sed_input['plate_settlers']['vel_capture']))
/ (np.sin(sed_input['plate_se... | def L_sed_plate(sed_inputs=sed_dict) | Return the length of a single plate in the plate settler module based on
achieving the desired capture velocity
Parameters
----------
sed_inputs : dict
A dictionary of all of the constant inputs needed for sedimentation tank
calculations can be found in sed.yaml
Returns
-------
... | 4.016018 | 3.91708 | 1.025258 |
index = (np.abs(np.array(pipedb['NDinch']) - (ND))).argmin()
return pipedb.iloc[index, 1] | def OD(ND) | Return a pipe's outer diameter according to its nominal diameter.
The pipe schedule is not required here because all of the pipes of a
given nominal diameter have the same outer diameter.
Steps:
1. Find the index of the closest nominal diameter.
(Should this be changed to find the next largest ... | 9.855004 | 7.950272 | 1.239581 |
myindex = (np.abs(np.array(pipedb['NDinch']) - (ND))).argmin()
return (pipedb.iloc[myindex, 1] - 2*(pipedb.iloc[myindex, 5])) | def ID_sch40(ND) | Return the inner diameter for schedule 40 pipes.
The wall thickness for these pipes is in the pipedb.
Take the values of the array, subtract the ND, take the absolute
value, find the index of the minimium value. | 7.713631 | 4.53336 | 1.701526 |
ND_all_available = []
for i in range(len(pipedb['NDinch'])):
if pipedb.iloc[i, 4] == 1:
ND_all_available.append((pipedb['NDinch'][i]))
return ND_all_available * u.inch | def ND_all_available() | Return an array of available nominal diameters.
NDs available are those commonly used as based on the 'Used' column
in the pipedb. | 5.681035 | 3.860897 | 1.471429 |
ID = []
ND = ND_all_available()
for i in range(len(ND)):
ID.append(ID_SDR(ND[i], SDR).magnitude)
return ID * u.inch | def ID_SDR_all_available(SDR) | Return an array of inner diameters with a given SDR.
IDs available are those commonly used based on the 'Used' column
in the pipedb. | 6.209229 | 6.361308 | 0.976093 |
for i in range(len(np.array(ID_SDR_all_available(SDR)))):
if np.array(ID_SDR_all_available(SDR))[i] >= (ID.to(u.inch)).magnitude:
return ND_all_available()[i] | def ND_SDR_available(ID, SDR) | Return an available ND given an ID and a schedule.
Takes the values of the array, compares to the ID, and finds the index
of the first value greater or equal. | 5.789641 | 5.249004 | 1.102998 |
# Ensure all the arguments except total headloss are the same length
#TODO
# Total number of pipe lengths
n = diameters.size
# Start with a flow rate guess based on the flow through a single pipe section
flow = pc.flow_pipe(diameters[0], target_headloss, lengths[0], nu, pipe_rough, k_min... | def flow_pipeline(diameters, lengths, k_minors, target_headloss,
nu=con.WATER_NU, pipe_rough=mats.PVC_PIPE_ROUGH) | This function takes a single pipeline with multiple sections, each potentially with different diameters,
lengths and minor loss coefficients and determines the flow rate for a given headloss.
:param diameters: list of diameters, where the i_th diameter corresponds to the i_th pipe section
:type diameters: ... | 5.919502 | 5.668377 | 1.044303 |
w_per_flow = 2 / ((2 * pc.gravity * z) ** (1 / 2) *
con.VC_ORIFICE_RATIO * np.pi * self.hl)
return w_per_flow.to_base_units() | def stout_w_per_flow(self, z) | Return the width of a Stout weir at elevation z. More info
here. <https://confluence.cornell.edu/display/AGUACLARA/
LFOM+sutro+weir+research> | 12.372258 | 10.47699 | 1.180898 |
N_estimated = (self.hl * np.pi / (2 * self.stout_w_per_flow(self.hl) * self.q)).to(u.dimensionless)
variablerow = min(10, max(4, math.trunc(N_estimated.magnitude)))
return variablerow | def n_rows(self) | This equation states that the open area corresponding to one row
can be set equal to two orifices of diameter=row height. If there
are more than two orifices per row at the top of the LFOM then there
are more orifices than are convenient to drill and more than
necessary for good accuracy... | 15.357656 | 13.576065 | 1.13123 |
return (4 / (3 * math.pi) * (2 * pc.gravity * self.hl) ** (1 / 2)).to(u.m/u.s) | def vel_critical(self) | The average vertical velocity of the water inside the LFOM pipe
at the very bottom of the bottom row of orifices The speed of
falling water is 0.841 m/s for all linear flow orifice meters of
height 20 cm, independent of total plant flow rate. | 10.712917 | 10.791332 | 0.992734 |
return (self.safety_factor * self.q / self.vel_critical).to(u.cm**2) | def area_pipe_min(self) | The minimum cross-sectional area of the LFOM pipe that assures
a safety factor. | 16.799139 | 12.799801 | 1.312453 |
ID = pc.diam_circle(self.area_pipe_min)
return pipe.ND_SDR_available(ID, self.sdr) | def nom_diam_pipe(self) | The nominal diameter of the LFOM pipe | 35.347866 | 39.936367 | 0.885105 |
# Calculate the center of the top row:
z = self.hl - 0.5 * self.b_rows
# Multiply the stout weir width by the height of one row.
return self.stout_w_per_flow(z) * self.q * self.b_rows | def area_top_orifice(self) | Estimate the orifice area corresponding to the top row of orifices.
Another solution method is to use integration to solve this problem.
Here we use the width of the stout weir in the center of the top row
to estimate the area of the top orifice | 16.598978 | 9.87356 | 1.681154 |
maxdrill = min(self.b_rows, self.d_orifice_max)
return ut.floor_nearest(maxdrill, self.drill_bits) | def orifice_diameter(self) | The actual orifice diameter. We don't let the diameter extend
beyond its row space. | 19.903542 | 17.115694 | 1.162883 |
c = math.pi * pipe.ID_SDR(self.nom_diam_pipe, self.sdr)
b = self.orifice_diameter + self.s_orifice
return math.floor(c/b) | def n_orifices_per_row_max(self) | A bound on the number of orifices allowed in each row.
The distance between consecutive orifices must be enough to retain
structural integrity of the pipe. | 17.070496 | 13.792967 | 1.237623 |
return np.linspace(1 / self.n_rows, 1, self.n_rows)*self.q | def flow_ramp(self) | An equally spaced array representing flow at each row. | 9.374066 | 5.279451 | 1.775576 |
return (np.linspace(0, self.n_rows-1, self.n_rows))*self.b_rows + 0.5 * self.orifice_diameter | def height_orifices(self) | Calculates the height of the center of each row of orifices.
The bottom of the bottom row orifices is at the zero elevation
point of the LFOM so that the flow goes to zero when the water height
is at zero. | 9.46137 | 6.342576 | 1.491724 |
flow = 0
for i in range(Row_Index_Submerged + 1):
flow = flow + (N_LFOM_Orifices[i] * (
pc.flow_orifice_vert(self.orifice_diameter,
self.b_rows*(Row_Index_Submerged + 1)
- self.height_orifices[i]... | def flow_actual(self, Row_Index_Submerged, N_LFOM_Orifices) | Calculates the flow for a given number of submerged rows of orifices
harray is the distance from the water level to the center of the
orifices when the water is at the max level.
Parameters
----------
Row_Index_Submerged: int
The index of the submerged row. All rows bel... | 6.37429 | 6.160331 | 1.034732 |
# H is distance from the bottom of the next row of orifices to the
# center of the current row of orifices
H = self.b_rows - 0.5*self.orifice_diameter
flow_per_orifice = pc.flow_orifice_vert(self.orifice_diameter, H, con.VC_ORIFICE_RATIO)
n = np.zeros(self.n_rows)
... | def n_orifices_per_row(self) | Calculate number of orifices at each level given an orifice
diameter. | 5.078629 | 4.772974 | 1.064039 |
FLOW_lfom_error = np.zeros(self.n_rows)
for i in range(self.n_rows):
actual_flow = self.flow_actual(i, self.n_orifices_per_row)
FLOW_lfom_error[i] = (((actual_flow - self.flow_ramp[i]) / self.flow_ramp[i]).to(u.dimensionless)).magnitude
return FLOW_lfom_error | def error_per_row(self) | This function calculates the error of the design based on the
differences between the predicted flow rate
and the actual flow rate through the LFOM. | 4.967098 | 3.988615 | 1.245319 |
step_32nd = np.arange(0.03125, 0.25, 0.03125)
step_8th = np.arange(0.25, 1.0, 0.125)
step_4th = np.arange(1.0, 2.0, 0.25)
maximum = [2.0]
return np.concatenate((step_32nd,
step_8th,
step_4th,
maximum)) * u.inch | def get_drill_bits_d_imperial() | Return array of possible drill diameters in imperial. | 3.107889 | 2.894379 | 1.073767 |
return np.concatenate((np.arange(1.0, 10.0, 0.1),
np.arange(10.0, 18.0, 0.5),
np.arange(18.0, 36.0, 1.0),
np.arange(40.0, 55.0, 5.0))) * u.mm | def get_drill_bits_d_metric() | Return array of possible drill diameters in metric. | 2.570204 | 2.258921 | 1.137802 |
return self._C_sys * (self._Q_sys / self._Q_stock).to(u.dimensionless) | def C_stock(self) | Return the required concentration of material in the stock given a
reactor's desired system flow rate, system concentration, and stock
flow rate.
:return: Concentration of material in the stock
:rtype: float | 9.442092 | 8.128115 | 1.161658 |
return Stock.T_stock(self, V_stock, self._Q_stock).to(u.hr) | def T_stock(self, V_stock) | Return the amount of time at which the stock of materal will be
depleted.
:param V_stock: Volume of the stock of material
:type V_stock: float
:return: Time at which the stock will be depleted
:rtype: float | 11.335405 | 12.702152 | 0.8924 |
return Stock.V_super_stock(self, V_stock, self.C_stock(), C_super_stock) | def V_super_stock(self, V_stock, C_super_stock) | Return the volume of super (more concentrated) stock that must be
diluted for the desired stock volume and required stock concentration.
:param V_stock: Volume of the stock of material
:type V_stock: float
:param C_super_stock: Concentration of the super stock
:type C_super_stoc... | 5.582066 | 6.82104 | 0.81836 |
return self._Q_sys * (self._C_sys / self._C_stock).to(u.dimensionless) | def Q_stock(self) | Return the required flow rate from the stock of material given
a reactor's desired system flow rate, system concentration, and stock
concentration.
:return: Flow rate from the stock of material
:rtype: float | 9.400718 | 7.630233 | 1.232036 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.