|
11 | 11 |
|
12 | 12 | log.set_log_level(log.LogLevel.INFO) |
13 | 13 |
|
14 | | -mesh = dolfinx.mesh.create_interval(MPI.COMM_WORLD, 1000, points=[0, 1]) |
| 14 | +avogadro_number = 6.022e23 # 1/mol |
| 15 | + |
| 16 | +tank_height = 1 # m |
| 17 | +tank_diameter = 0.5 # m |
| 18 | +K_S = 1e20 / avogadro_number # solubility of breeder mol/m3/Pa |
| 19 | +diffusivity = 1e-9 # breeder diffusivity m2/s |
| 20 | + |
| 21 | + |
| 22 | +source_term = 0.001 # mol/m3/s generation term |
| 23 | + |
| 24 | +u_b = 0.3 # m/s bubble velocity |
| 25 | +d_b = 0.002 # m bubble diameter |
| 26 | + |
| 27 | +P = 151988 # total gas pressure # TODO should be 7 PSIG - differential at the top |
| 28 | +h_l = ( |
| 29 | + (diffusivity * u_b) / (ufl.pi * d_b) |
| 30 | +) ** 0.5 # mass transport coefficient Higbie penetration model |
| 31 | + |
| 32 | +R = 8.314 # J/mol/K |
| 33 | +T = 900 # K temperature |
| 34 | +epsilon_g = 0.03 # gas void fraction # TODO from correlations |
| 35 | +epsilon_l = 1 - epsilon_g # liquid void fraction |
| 36 | +a = 6 * epsilon_g / d_b # specific interfacial area |
| 37 | + |
| 38 | +# FIXME is this homogeneous? |
| 39 | +E_g = 0.2 * tank_diameter**2 * u_b # gas phase diffusivity (dispersion coefficient) |
| 40 | +E_l = diffusivity # liquid phase diffusivity # FIXME |
| 41 | + |
| 42 | +# MESH AND FUNCTION SPACES |
| 43 | +mesh = dolfinx.mesh.create_interval(MPI.COMM_WORLD, 10000, points=[0, tank_height]) |
15 | 44 | fdim = mesh.topology.dim - 1 |
16 | 45 | cg_el = basix.ufl.element("Lagrange", mesh.basix_cell(), degree=1, shape=(2,)) |
17 | 46 |
|
|
27 | 56 |
|
28 | 57 | dt = 0.2 |
29 | 58 |
|
30 | | -vel_x = 1.0 |
| 59 | +vel_x = u_b |
31 | 60 | vel = dolfinx.fem.Constant(mesh, PETSc.ScalarType([vel_x])) |
32 | 61 |
|
33 | | -K_S = 1 # solubility of breeder |
34 | | -D = 0.001 |
35 | | -P = 1 # total gas pressure |
36 | | -h_l = 0.1 # mass transport coefficient |
| 62 | + |
37 | 63 | EPS = 1e-16 |
38 | 64 |
|
39 | | -gen = dolfinx.fem.Constant(mesh, PETSc.ScalarType(1.0)) # generation term (neutrons) |
| 65 | +gen = dolfinx.fem.Constant( |
| 66 | + mesh, PETSc.ScalarType(source_term) |
| 67 | +) # generation term (neutrons) |
| 68 | + |
| 69 | + |
| 70 | +# VARIATIONAL FORMULATION |
40 | 71 |
|
41 | 72 | # mass transfer rate |
42 | | -J = h_l * (c_T - K_S * (P * y_T2 + EPS) ** 0.5) |
| 73 | +J = a * h_l * (c_T - K_S * (P * y_T2 + EPS)) |
43 | 74 |
|
44 | 75 | F = 0 # variational formulation |
45 | 76 |
|
46 | 77 | # transient terms |
47 | | -F += ((c_T - c_T_n) / dt) * v_c * ufl.dx + ((y_T2 - y_T2_n) / dt) * v_y * ufl.dx |
48 | | - |
| 78 | +F += epsilon_l * ((c_T - c_T_n) / dt) * v_c * ufl.dx |
| 79 | +F += epsilon_g * 1 / (R * T) * (P * (y_T2 - y_T2_n) / dt) * v_y * ufl.dx |
49 | 80 |
|
50 | 81 | # diffusion/dispersion terms |
51 | | -F += D * ufl.dot(ufl.grad(c_T), ufl.grad(v_c)) * ufl.dx |
52 | | -F += ufl.dot(ufl.grad(y_T2), ufl.grad(v_y)) * ufl.dx |
| 82 | +F += epsilon_l * E_l * ufl.dot(ufl.grad(c_T), ufl.grad(v_c)) * ufl.dx |
| 83 | +F += epsilon_g * E_g * ufl.dot(ufl.grad(P * y_T2), ufl.grad(v_y)) * ufl.dx |
53 | 84 |
|
54 | 85 |
|
55 | 86 | # mass exchange (coupling term) |
56 | | -F += J * v_c * ufl.dx - 0.5 * J * v_y * ufl.dx |
| 87 | +F += J * v_c * ufl.dx - J * v_y * ufl.dx |
57 | 88 |
|
58 | 89 | # Generation term in the breeder |
59 | 90 | F += -gen * v_c * ufl.dx |
60 | 91 |
|
61 | 92 | # advection of gas |
62 | | -F += ufl.inner(ufl.dot(ufl.grad(y_T2), vel), v_y) * ufl.dx |
| 93 | +F += 1 / (R * T) * ufl.inner(ufl.dot(ufl.grad(P * y_T2), vel), v_y) * ufl.dx |
63 | 94 |
|
64 | 95 |
|
65 | 96 | # BOUNDARY CONDITIONS |
66 | 97 | gas_inlet_facets = dolfinx.mesh.locate_entities_boundary( |
67 | 98 | mesh, fdim, lambda x: np.isclose(x[0], 0.0) |
68 | 99 | ) |
69 | 100 | gas_outlet_facets = dolfinx.mesh.locate_entities_boundary( |
70 | | - mesh, fdim, lambda x: np.isclose(x[0], 1.0) |
| 101 | + mesh, fdim, lambda x: np.isclose(x[0], tank_height) |
71 | 102 | ) |
72 | 103 | bc1 = dolfinx.fem.dirichletbc( |
73 | 104 | dolfinx.fem.Constant(mesh, 0.0), |
|
0 commit comments