Example program demonstrating how to sweep a straight, pipe-like NURBS volume onto a toroidal pipe (donut) with an optional progressive cross-section twist and a sinusoidal wobble in the global z-direction as it travels around the torus.
The program:
Creates a straight pipe segment (ring extruded along ),
Refines it along the axial direction (knot insertion + degree elevation),
Maps the control points onto a torus of major radius R,
Applies a cross-section twist of twist_turns full rotations over one loop,
Superimposes a vertical wobble ,
Exports the resulting NURBS volume to VTK and displays it,
Prints the approximate enclosed volume (Gaussian integration).
| Type | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|
| real(kind=rk), | parameter | :: | Az | = | 0.1_rk |
amplitude of vertical wobble |
| integer, | parameter | :: | Nref | = | 30 | |
| real(kind=rk), | parameter | :: | R | = | 1.00_rk |
major radius |
| real(kind=rk), | parameter | :: | center(3) | = | [0.0_rk, 0.0_rk, 0.0_rk] |
center of the ring |
| integer | :: | i | ||||
| real(kind=rk), | parameter | :: | length | = | 1.0_rk |
length of the pipe |
| integer, | parameter | :: | nwaves_z | = | 6 |
number of sine waves per full loop |
| real(kind=rk), | parameter | :: | phase_z | = | 0.1_rk |
phase shift (radians) |
| real(kind=rk), | parameter | :: | r1 | = | 0.12_rk |
inner radius |
| real(kind=rk), | parameter | :: | r2 | = | 0.20_rk |
outer radius |
| type(nurbs_volume) | :: | ring |
straight pipe segment |
|||
| type(nurbs_volume) | :: | sh |
toroidal pipe shape |
|||
| real(kind=rk), | parameter | :: | twist_turns | = | 1.0_rk |
cross-section twist (turns over full loop) |
Map a straight pipe (ring extruded in ) onto a toroidal pipe with: • cross-section twist: , • vertical wobble: .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(nurbs_volume), | intent(inout) | :: | this | |||
| real(kind=rk), | intent(in) | :: | c(3) | |||
| real(kind=rk), | intent(in) | :: | R | |||
| real(kind=rk), | intent(in) | :: | twist_turns | |||
| real(kind=rk), | intent(in) | :: | Az | |||
| integer, | intent(in) | :: | nwaves_z | |||
| real(kind=rk), | intent(in) | :: | phase_z |