Appearance
adam_prism_fnl_coil_object
ADAM, PRISM coil source definition, FNL backend.
Source: src/app/prism/fnl/adam_prism_fnl_coil_object.F90
Dependencies
Contents
- prism_fnl_coil_object
- destroy
- copy_cpu_gpu
- copy_gpu_cpu
- initialize
- detect_plasma_dev
- capture_plasma_dev
- restore_plasma_dev
- free_support
- push_support
Derived Types
prism_fnl_coil_object
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
A_gpu | real(kind=R8P) | pointer | Current amplitude (A) |
f_gpu | real(kind=R8P) | pointer | Current frequency, if AC (Hz) |
phase_gpu | real(kind=R8P) | pointer | Current initial phase, if AC |
J_vec_gpu | real(kind=R8P) | pointer | Matrice contenente versori corrente spire (se assente = 0) |
support_gpu | integer(kind=I4P) | pointer | Cells (b,i,j,k) with J_vec /= 0, interior first, (4,n). |
plasma_j_gpu | real(kind=R8P) | pointer | Plasma current on the support, (3,n,slot). |
support_number | integer(kind=I4P) | Number of support cells. | |
support_interior | integer(kind=I4P) | Number of interior support cells (the first ones). | |
support_host | integer(kind=I4P) | allocatable | Host copy of the device support (to detect a change). |
plasma_j_active | logical | Slot holds a plasma current. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
copy_cpu_gpu | pass(self) | Copy data from CPU to GPU. |
copy_gpu_cpu | pass(self) | Copy data from GPU to CPU. |
destroy | pass(self) | Free device data owned by this object. |
initialize | pass(self) | Initialize class from global singletons. |
capture_plasma_dev | pass(self) | Keep the plasma current of the coil support. |
detect_plasma_dev | pass(self) | Plasma on the interior coil support. |
restore_plasma_dev | pass(self) | Write the kept plasma current back (inside the coil stamp). |
free_support | pass(self) | Free the device support and its plasma slots. |
push_support | pass(self) | Push the support of the host J_vec and its committed slot. |
Subroutines
destroy
Free device data owned by the coil FNL object.
fortran
subroutine destroy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | inout | Coils. |
Call graph
copy_cpu_gpu
Copy data from CPU to GPU.
fortran
subroutine copy_cpu_gpu(self, coil, grid, blocks_number, buf6D, db6, hb6, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | inout | The field. | |
coil | class(prism_coil_object) | in | Coils on host. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
blocks_number | integer(kind=I4P) | in | Number of blocks in use. | |
buf6D | real(kind=R8P) | inout | optional | Buffer (host memory, device shape), rank 6D. |
db6 | integer(kind=I4P) | in | optional | Device data bounds, rank 6. |
hb6 | integer(kind=I4P) | in | optional | Host data bounds, rank 6. |
verbose | logical | in | optional | Flag to activate verbose mode. |
Call graph
copy_gpu_cpu
Copy data from GPU to CPU.
fortran
subroutine copy_gpu_cpu(self, coil, grid, buf6D, db6, hb6, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | inout | The field. | |
coil | class(prism_coil_object) | inout | Coils on host. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
buf6D | real(kind=R8P) | inout | optional | Buffer (host memory, device shape), rank 6D. |
db6 | integer(kind=I4P) | in | optional | Device data bounds, rank 6. |
hb6 | integer(kind=I4P) | in | optional | Host data bounds, rank 6. |
verbose | logical | in | optional | Flag to activate verbose mode. |
Call graph
initialize
Initialize class from program-scope field (adam_field_global) and grid (adam_grid_global) singletons. Requires mpih_fnl (adam_fnl_mpih_global), field and grid singletons to be ready.
fortran
subroutine initialize(self, coil, field, grid, buf6D, db6, hb6)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | inout | Coils. | |
coil | class(prism_coil_object) | in | target | Coils on host. |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
buf6D | real(kind=R8P) | inout | optional | Buffer (host memory, device shape), rank 6D. |
db6 | integer(kind=I4P) | in | optional | Device data bounds, rank 6. |
hb6 | integer(kind=I4P) | in | optional | Host data bounds, rank 6. |
Call graph
detect_plasma_dev
Device twin of prism_coil_object%detect_plasma: plasma current (and charge) on the interior support cells right after a PIC deposit into q_gpu. Local to this rank.
fortran
subroutine detect_plasma_dev(self, ngc, q_gpu, var_jx, var_jy, var_jz, check_current, check_charge, overlap_current, overlap_charge)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | in | Coils, device data. | |
ngc | integer(kind=I4P) | in | Number of ghost cells. | |
q_gpu | real(kind=R8P) | in | Deposited field (device). | |
var_jx | integer(kind=I4P) | in | Index of Jx. | |
var_jy | integer(kind=I4P) | in | Index of Jy. | |
var_jz | integer(kind=I4P) | in | Index of Jz. | |
check_current | logical | in | The J rows hold a fresh deposit. | |
check_charge | logical | in | The charge row holds a fresh deposit. | |
overlap_current | logical | out | Plasma current on the support. | |
overlap_charge | logical | out | Plasma charge on the support. |
Call graph
capture_plasma_dev
Device twin of prism_coil_object%capture_plasma: keep the J rows of the support cells (interior and ghost, the ghosts refreshed by the caller) in slot, or empty the slot (no plasma current on the support: the stamp is unchanged).
fortran
subroutine capture_plasma_dev(self, ngc, q_gpu, slot, var_jx, var_jy, var_jz, active)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | inout | Coils, device data. | |
ngc | integer(kind=I4P) | in | Number of ghost cells. | |
q_gpu | real(kind=R8P) | in | Deposited field (device). | |
slot | integer(kind=I4P) | in | COIL_SLOT_COMMITTED or COIL_SLOT_STAGE. | |
var_jx | integer(kind=I4P) | in | Index of Jx. | |
var_jy | integer(kind=I4P) | in | Index of Jy. | |
var_jz | integer(kind=I4P) | in | Index of Jz. | |
active | logical | in | Plasma current on the support (of some rank). |
Call graph
restore_plasma_dev
Device twin of prism_coil_object%restore_plasma: inside the coil stamp, after the support was cleared, write back the plasma current kept in slot (nothing when the slot is empty); the coil current is then added on top.
fortran
subroutine restore_plasma_dev(self, ngc, q_gpu, slot, var_jx, var_jy, var_jz)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | in | Coils, device data. | |
ngc | integer(kind=I4P) | in | Number of ghost cells. | |
q_gpu | real(kind=R8P) | inout | Field (device). | |
slot | integer(kind=I4P) | in | COIL_SLOT_COMMITTED or COIL_SLOT_STAGE. | |
var_jx | integer(kind=I4P) | in | Index of Jx. | |
var_jy | integer(kind=I4P) | in | Index of Jy. | |
var_jz | integer(kind=I4P) | in | Index of Jz. |
Call graph
free_support
Free the device support and its plasma slots.
fortran
subroutine free_support(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | inout | Coils, device data. |
Call graph
push_support
Push the support of the host J_vec (the list prism_coil_object%support_cells builds, in the host order). An unchanged support keeps the device slots (a re-push of the same J_vec); a changed one (AMR) starts with empty slots, filled again by the next deposit. The committed slot of the host is uploaded when it was kept on this same support (the t0 deposit, registered on the host by compute_coils_current_time_zero): the caller then invalidates the host support, so a later push cannot upload it again.
fortran
subroutine push_support(self, coil, blocks_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_coil_object) | inout | Coils, device data. | |
coil | class(prism_coil_object) | in | Coils on host. | |
blocks_number | integer(kind=I4P) | in | Number of blocks in use. |
Call graph