PyMPDATA_examples.Olesik_et_al_2022.coordinates
1import numpy as np 2 3 4class x_id: 5 @staticmethod 6 def x(r): 7 return r 8 9 @staticmethod 10 def r(x): 11 return x 12 13 @staticmethod 14 def dx_dr(r): 15 return r**0 16 17 @staticmethod 18 def moment_of_r_integral(x, k): 19 return 1 / (k + 1) * x ** (k + 1) 20 21 22class x_p2: 23 @staticmethod 24 def x(r): 25 return r**2 26 27 @staticmethod 28 def r(x): 29 return np.sqrt(np.where(x < 0, 1e10, x)) 30 31 @staticmethod 32 def dx_dr(r): 33 return 2 * r 34 35 @staticmethod 36 def moment_of_r_integral(x, k): 37 return 2 / (k + 2) * x ** ((k + 2) / 2) 38 39 40class x_p3: 41 @staticmethod 42 def x(r): 43 return r**3 44 45 @staticmethod 46 def r(x): 47 return np.power(x, 1 / 3) 48 49 @staticmethod 50 def dx_dr(r): 51 return 3 * r**2 52 53 @staticmethod 54 def moment_of_r_integral(x, k): 55 return 3 / (k + 3) * x ** ((k + 3) / 3) 56 57 58class x_log_of_pn: 59 def __init__(self, r0=1, base=np.e, n=3): 60 self.r0 = r0 61 self.base = base 62 self.n = n 63 64 def x(self, r): 65 return np.log(r**self.n / self.r0**self.n) / np.log(self.base) 66 67 def r(self, x): 68 return self.r0 * self.base ** (x / self.n) 69 70 def dx_dr(self, r): 71 return self.n / r / np.log(self.base) 72 73 def moment_of_r_integral(self, x, k): 74 return ( 75 self.r0**k 76 * self.n 77 / (k * np.log(self.base)) 78 * self.base ** (k / self.n * x) 79 )
class
x_id:
class
x_p2:
class
x_p3:
class
x_log_of_pn:
59class x_log_of_pn: 60 def __init__(self, r0=1, base=np.e, n=3): 61 self.r0 = r0 62 self.base = base 63 self.n = n 64 65 def x(self, r): 66 return np.log(r**self.n / self.r0**self.n) / np.log(self.base) 67 68 def r(self, x): 69 return self.r0 * self.base ** (x / self.n) 70 71 def dx_dr(self, r): 72 return self.n / r / np.log(self.base) 73 74 def moment_of_r_integral(self, x, k): 75 return ( 76 self.r0**k 77 * self.n 78 / (k * np.log(self.base)) 79 * self.base ** (k / self.n * x) 80 )