You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -166,44 +166,136 @@ Each line in the file (after header) corresponds to one row (X-direction).
166
166
-`1:0` means Material ID 1, Heater ID 0 (no heater).
167
167
-`1:1` means Material ID 1, Heater ID 1 (active heater).
168
168
169
+
169
170
---
170
171
171
172
## Cylindrical Grid Mode
172
173
173
-
HeatFlow supports an axisymmetric cylindrical coordinate system, enabled by setting `_CylindricalGrid = T` in `param.in`. In this mode the standard Cartesian grid is reinterpreted as a 2D radial–axial (r–y) domain:
174
+
HeatFlow supports an **axisymmetric cylindrical** coordinate system. This mode solves the heat equation on a 2-D radial-axial (r-y) cross-section of a cylinder, assuming full rotational symmetry about the central axis (r = 0). It is enabled by setting `_CylindricalGrid = T` in `param.in`.
175
+
176
+
### Coordinate mapping
177
+
178
+
The standard Cartesian grid indices are reinterpreted as follows:
174
179
175
180
| Grid axis | Physical meaning | Notes |
176
181
| :--- | :--- | :--- |
177
-
|**x**| Radial direction (r) |`x=1` is at the centre of the cylinder, increasing outward. |
178
-
|**y**| Axial direction (down the cylinder) | Same as Cartesian y. |
179
-
|**z**| Azimuthal (unused) | Must be set to `nz = 1`. |
182
+
|**x** (radial, r) | Radial direction |`ix = 1` is the innermost shell (centred at r = dr/2); radial distance increases outward. |
183
+
|**y**| Axial direction | Identical to Cartesian y. |
184
+
|**z**| Azimuthal (unused) |**Must** be set to `nz = 1`. The code will stop with an error if nz is not 1. |
185
+
186
+
The total cylinder radius is R = Lx and the axial length is Ly, where Lx and Ly are the physical dimensions given in `system.in`.
187
+
188
+
### Governing equation
189
+
190
+
In cylindrical coordinates with azimuthal symmetry the heat equation becomes:
where q is the volumetric heat-source density. The extra 1/r factor in the radial term is what distinguishes cylindrical from Cartesian diffusion; it means that interface areas and cell volumes depend on the radius.
195
+
196
+
### How the code implements cylindrical symmetry
180
197
181
-
### How it works
198
+
Internally the code makes three adjustments compared with the Cartesian solver. All other parts of the time-stepping, solver, output, etc. remain the same.
199
+
200
+
#### 1. Cell volumes
201
+
202
+
Each cell is a cylindrical **annular shell**. For a cell at radial index `ix` with uniform radial spacing dr = Lx / nx:
203
+
204
+
r_in = (ix - 1) * dr
205
+
r_out = ix * dr
206
+
V(ix) = pi * (r_out^2 - r_in^2) * dy
207
+
208
+
Note that the innermost cell (`ix = 1`) is a solid disk (r_in = 0), while all other cells are annular rings whose volume grows with radius. These volumes are used when converting total power into volumetric power density: the heater routine divides the input power by the summed `heated_volume` (which is the sum of cylindrical volumes of all heated cells).
The finite-difference discretisation of the radial term `(1/r) d/dr (r * kappa * dT/dr)` produces interface fluxes that scale with the interface radius rather than being uniform. The code multiplies the standard Cartesian conductivity entries by geometric correction factors:
| Outer (ix + 1) | r_outer = ix * dr | ix / (ix - 0.5) |
182
218
183
-
The simulation grid in `system.in` is defined as a standard 2D array (`nx × ny`, `nz = 1`). The physical dimensions `Lx`and `Ly` represent the cylinder radius and axial length respectively. Internally, the code makes two adjustments:
219
+
Here `(ix - 0.5) * dr` is the cell-centre radius. These factors arise because the heat flux through a cylindrical surface of radius r and height dy is proportional to `2 * pi * r * dy`, and the ratio of the interface area to the cell-centre area gives the correction.
184
220
185
-
1.**Cell volumes**— Each radial shell at index `ix` (with `dr = Lx/nx`) has volume:
221
+
**Axial (y) conductivities are unchanged**-- the axial term has the same form as in Cartesian coordinates.
186
222
187
-
`V = π (r_out² − r_in²) × dy × dz`
223
+
**Z-direction terms are zeroed out** -- since nz = 1, the code explicitly sets the z-neighbour conductivities F and G to zero in the H-matrix.
188
224
189
-
where `r_in = (ix−1)·dr` and `r_out = ix·dr`.
225
+
#### 3. Boundary-vector corrections
190
226
191
-
2.**Heat-matrix conductivities** — The discretised radial heat equation in cylindrical coordinates is `(1/r) ∂/∂r (r κ ∂T/∂r)`. The interface area between adjacent radial shells scales with the interface radius. The code applies correction factors to the radial conductivity terms:
227
+
The boundary contribution at the outer radius (`ix = nx`) also receives the cylindrical area correction. The boundary conductivity term is multiplied by `r_outer / r_centre = ix / (ix - 0.5)` to account for the larger outer interface area. This ensures the fixed-temperature bath condition at r = R is applied with the correct radial geometry.
> **Important:** In cylindrical mode the Cartesian x-boundary and z-boundary keywords (`kappaBoundx1`, `kappaBoundNx`, `kappaBoundz1`, `kappaBoundNz`, `T_Bathx1`, `T_Bathx2`, `T_Bathz1`, `T_Bathz2`) are **not used** and are overridden internally. Use `kappaBoundNr` and `T_BathNr` for the outer radial boundary.
269
+
270
+
If only the global `kappaBound` keyword is set (without an explicit `kappaBoundNr`), the code will issue a warning and use the global value for all cylindrical boundaries.
271
+
272
+
### Heating in cylindrical mode
273
+
274
+
Power input works the same as in Cartesian mode: cells are tagged with a heater ID in `system.in`, and the `power_in` value from `param.in` is distributed over all heated cells.
275
+
276
+
The key difference is that the **heated volume** is now the sum of cylindrical annular shell volumes rather than rectangular brick volumes. The heater routine computes:
277
+
278
+
V_heated = SUM over heated cells of: pi * (r_out^2 - r_in^2) * dy
279
+
280
+
and the volumetric power density applied to each heated cell is:
281
+
282
+
q = power_in / V_heated
283
+
284
+
This means that if the heater covers the inner two radial cells (`ix = 1,2`), the heated volume is `pi * (2*dr)^2 * dy`, not `2 * dr * dy` as it would be in Cartesian mode. All heating types (constant, pulsed, AC, etc.) listed in the [Heating Types](#heating-types) table are available in cylindrical mode.
For a uniformly heated disk of radius R_H inside a cylinder of outer radius R_B with a fixed boundary temperature T_bath, the steady-state radial temperature profile is:
289
+
290
+
**Inside the heater (r <= R_H):**
205
291
206
-
> **Note:** In cylindrical mode the Cartesian x and z boundary keywords (`kappaBoundx1`, `kappaBoundNx`, `kappaBoundz1`, `kappaBoundNz`) are not used. Set `kappaBoundNr` and `T_BathNr` instead.
where `lambda = rho * Cv * kappa` is the thermal conductivity and q is the volumetric heating rate inside the disk. Inside the heater the profile is parabolic; outside it follows a logarithmic decay. This solution can be used to verify cylindrical-mode simulations against theory.
207
299
208
300
### Example `param.in` (cylindrical)
209
301
```
@@ -222,24 +314,15 @@ T_BathNr = 300.0
222
314
_WriteToTxt = T
223
315
```
224
316
225
-
### Example `system.in` (cylindrical)
226
-
A 10-cell radial × 5-cell axial cylinder, radius 0.005 m, length 0.01 m:
227
-
```
228
-
10 5 1
229
-
0.005 0.01 0.001
317
+
### Checklist for setting up a cylindrical simulation
230
318
231
-
! Z=1, Y=1 Row (top)
232
-
1:1 1:1 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
233
-
! Z=1, Y=2 Row
234
-
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
235
-
! Z=1, Y=3 Row
236
-
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
237
-
! Z=1, Y=4 Row
238
-
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
239
-
! Z=1, Y=5 Row (bottom)
240
-
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
241
-
```
242
-
Here `x=1,2` at `y=1` are heated (the central core at the top of the cylinder).
319
+
1. Set `_CylindricalGrid = T` in `param.in`.
320
+
2. Set `nz = 1` in `system.in`.
321
+
3. Provide **two** physical dimensions (`Lx Ly`) on the second line of `system.in` -- `Lx` is the outer radius, `Ly` is the axial length.
322
+
4. Set `kappaBoundNr` and `T_BathNr` for the outer radial boundary.
323
+
5. Set `kappaBoundy1`/`kappaBoundNy` and `T_Bathy1`/`T_Bathy2` for the axial boundaries (or set them to zero for insulating/mirror boundaries).
324
+
6. Do **not** set `kappaBoundx1`, `kappaBoundNx`, `kappaBoundz1`, or `kappaBoundNz` -- they are overridden.
325
+
7. Tag heated cells in `system.in` as usual (`MaterialID:HeaterID`). Remember that heated volume is now cylindrical.
0 commit comments