吸附材料孔道及多球体体系内切最大球体半径的求解问询
Hey there! Let's break this down step by step—first working through the 2D case you used for illustration, then moving to the 3D problem you actually need for your research.
2D Case: Three Circles & Enclosed Tangent Circle
For three circles with centers u=(x₁,y₁), v=(x₂,y₂), k=(x₃,y₃) and radii r₁, r₂, r₃, we want to find the radius r_g (and center g=(x,y)) of the largest circle that fits in the gap between them and touches all three.
Core Equations
Since the enclosed circle is tangent to each of the three circles, the distance between their centers equals the sum of their radii:
||g - u|| = r₁ + r_g||g - v|| = r₂ + r_g||g - k|| = r₃ + r_g
Expanding these into Cartesian coordinates gives three quadratic equations. To simplify, subtract pairs of equations (e.g., equation 1 minus equation 2, equation 2 minus equation 3) to eliminate the x² and y² terms. This leaves you with two linear equations in x, y, and r_g.
Solving the System
- Rearrange the linear equations to express
xandyas functions ofr_g. - Substitute these expressions back into one of the original quadratic equations. This will result in a single quadratic equation in
r_g. - Solve the quadratic equation—you’ll get two solutions; pick the positive, physically meaningful one (the smaller positive root corresponds to the circle in the inner gap, while the larger root is the circle enclosing all three original circles).
3D Case: Four Spheres & Enclosed Tangent Sphere
Extending this to 3D (four spheres of the adsorbent material, with a fifth gas sphere fitting in the gap) follows exactly the same logic, just with an extra dimension.
Core Equations
For four spheres with centers u=(x₁,y₁,z₁), v=(x₂,y₂,z₂), k=(x₃,y₃,z₃), l=(x₄,y₄,z₄) and radii r₁, r₂, r₃, r₄, the tangent condition gives four distance equations:
||g - u|| = r₁ + r_g||g - v|| = r₂ + r_g||g - k|| = r₃ + r_g||g - l|| = r₄ + r_g
Solving the System
- Subtract three pairs of equations (e.g., equation 1 - equation 4, equation 2 - equation 4, equation 3 - equation 4) to get three linear equations in
x,y,z, andr_g. - Solve the linear system to express
x,y,zin terms ofr_g. - Substitute these into one of the original quadratic equations to get a quadratic equation for
r_g. - Again, select the positive root that corresponds to the inner gap (the smaller positive solution— the larger root is the sphere enclosing all four adsorbent spheres).
Practical Implementation Tip
For real-world research data, you’ll likely want to use numerical tools to solve these systems instead of doing it by hand. Here’s a quick Python snippet for the 2D case (easily extendable to 3D):
import numpy as np from scipy.optimize import root_scalar # Define your three circles (example: equilateral triangle, radius 1 each) u = np.array([0, 0]) r1 = 1 v = np.array([2, 0]) r2 = 1 k = np.array([1, np.sqrt(3)]) r3 = 1 # Build linear system from equation differences A = np.array([ [-2*(u[0]-v[0]), -2*(u[1]-v[1]), 2*(r2 - r1)], [-2*(v[0]-k[0]), -2*(v[1]-k[1]), 2*(r3 - r2)] ]) B = np.array([ (v[0]**2 + v[1]**2 - u[0]**2 - u[1]**2) + (r1**2 - r2**2), (k[0]**2 + k[1]**2 - v[0]**2 - v[1]**2) + (r2**2 - r3**2) ]) # Invert the linear part to get x,y as functions of rg inv_A = np.linalg.inv(A[:, :2]) def get_xy(rg): return inv_A @ (B - A[:, 2] * rg) # Define the quadratic equation to solve def equation(rg): x, y = get_xy(rg) return (x - u[0])**2 + (y - u[1])**2 - (r1 + rg)**2 # Find the root (inner gap solution) result = root_scalar(equation, bracket=[0, 1], method='brentq') print(f"2D Enclosed Circle Radius: {result.root:.4f}")
Notes on Edge Cases
- If the quadratic equation has no positive real roots, that means there’s no gap large enough to fit a non-zero radius sphere/circle (the adsorbent atoms are too close together).
- In 3D, if the four spheres are coplanar, the inner gap will be a 2D-like space, and the enclosed sphere’s radius might be zero or negative (meaning no 3D pore exists).
Let me know if you need help adapting this to your specific dataset or troubleshooting any edge cases!
备注:内容来源于stack exchange,提问作者myster

