Skip to content

Commit 3da7111

Browse files
committed
user manual updates
1 parent cc9bde8 commit 3da7111

1 file changed

Lines changed: 119 additions & 36 deletions

File tree

docs/USER_MANUAL.md

Lines changed: 119 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -166,44 +166,136 @@ Each line in the file (after header) corresponds to one row (X-direction).
166166
- `1:0` means Material ID 1, Heater ID 0 (no heater).
167167
- `1:1` means Material ID 1, Heater ID 1 (active heater).
168168

169+
169170
---
170171

171172
## Cylindrical Grid Mode
172173

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:
174179

175180
| Grid axis | Physical meaning | Notes |
176181
| :--- | :--- | :--- |
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:
191+
192+
rho * Cv * dT/dt = (1/r) d/dr (r * kappa * dT/dr) + d/dy (kappa * dT/dy) + q
193+
194+
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
180197

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).
209+
210+
#### 2. Heat-matrix (H-matrix) conductivity corrections
211+
212+
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:
213+
214+
| Neighbour | Interface radius | Correction factor |
215+
| :--- | :--- | :--- |
216+
| Inner (ix - 1) | r_inner = (ix - 1) * dr | (ix - 1) / (ix - 0.5) |
217+
| Outer (ix + 1) | r_outer = ix * dr | ix / (ix - 0.5) |
182218

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.
184220

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.
186222

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.
188224

189-
where `r_in = (ix−1)·dr` and `r_out = ix·dr`.
225+
#### 3. Boundary-vector corrections
190226

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.
192228

193-
- Inner neighbour: factor = `(ix − 1) / (ix − 0.5)`
194-
- Outer neighbour: factor = `ix / (ix − 0.5)`
229+
### `system.in` format in cylindrical mode
195230

196-
Axial (y) conductivities are unchanged.
231+
The grid dimensions line still reads three integers (`nx ny nz`), but `nz` **must** be `1`.
232+
233+
The physical dimensions line reads **only two** values:
234+
```
235+
Lx Ly
236+
```
237+
where `Lx` is the cylinder radius and `Ly` is the axial length. The code internally sets Lz = 1.0 (a dummy value).
238+
239+
The rest of the file (material/heater grid) is written identically to Cartesian mode -- one row of `nx` entries per y-index.
240+
241+
**Example** -- 10-cell radial x 5-cell axial cylinder, radius 0.005 m, length 0.01 m:
242+
```
243+
10 5 1
244+
0.005 0.01
245+
246+
! Z=1, Y=1 Row (top)
247+
1:1 1:1 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
248+
! Z=1, Y=2 Row
249+
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
250+
! Z=1, Y=3 Row
251+
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
252+
! Z=1, Y=4 Row
253+
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
254+
! Z=1, Y=5 Row (bottom)
255+
1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0 1:0
256+
```
257+
Here `ix = 1,2` at `iy = 1` are heated (the central core at the top of the cylinder).
197258

198259
### Boundary conditions
199260

200-
| Boundary | Behaviour |
201-
| :--- | :--- |
202-
| **r = 0** (centre, `ix = 1` inner face) | Symmetry boundary — zero radial heat flux. Automatic, no user input needed. |
203-
| **r = R** (outer radius, `ix = nx` outer face) | Controlled by `kappaBoundNr` and `T_BathNr` in `param.in`. |
204-
| **y = 0** and **y = Ly** (top/bottom) | Standard Cartesian boundaries (`kappaBoundy1`/`kappaBoundNy`, `T_Bathy1`/`T_Bathy2`). |
261+
| Boundary | Behaviour | Keywords |
262+
| :--- | :--- | :--- |
263+
| **r = 0** (centre, inner face of `ix = 1`) | **Symmetry** -- zero radial heat flux. Applied automatically; no user input needed. | -- |
264+
| **r = R** (outer radius, outer face of `ix = nx`) | Fixed-temperature bath with a finite boundary conductivity. | `kappaBoundNr`, `T_BathNr` |
265+
| **y = 0** (top, `iy = 1`) | Standard axial boundary. | `kappaBoundy1`, `T_Bathy1` |
266+
| **y = Ly** (bottom, `iy = ny`) | Standard axial boundary. | `kappaBoundNy`, `T_Bathy2` |
267+
268+
> **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.
285+
286+
### Analytical steady-state solution (verification)
287+
288+
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):**
205291

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.
292+
T(r) = T_bath + (q * R_H^2) / (2 * lambda) * ln(R_B / R_H) + q / (4 * lambda) * (R_H^2 - r^2)
293+
294+
**Outside the heater (r > R_H):**
295+
296+
T(r) = T_bath + (q * R_H^2) / (2 * lambda) * ln(R_B / r)
297+
298+
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.
207299

208300
### Example `param.in` (cylindrical)
209301
```
@@ -222,24 +314,15 @@ T_BathNr = 300.0
222314
_WriteToTxt = T
223315
```
224316

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
230318

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.
243326

244327
---
245328

0 commit comments

Comments
 (0)