Skip to content

heat_solver_m ​

A 1-D heat solver whose state lives on the device.

Source: src/third_party/FUNDAL/docs/examples/src/heat_4.F90

Dependencies

Contents ​

Derived Types ​

heat_solver ​

Explicit solver of the 1-D heat equation, temperature with ghost cells 0 and n+1.

Components ​

NameTypeAttributesDescription
ninteger(kind=I4P)
rreal(kind=R8P)
t_devreal(kind=R8P)pointer
tn_devreal(kind=R8P)pointer

Type-Bound Procedures ​

NameAttributesDescription
initpass(self)
runpass(self)
getpass(self)
destroypass(self)

Subroutines ​

init ​

Allocate the device state and upload the initial condition t(0:n+1).

fortran
subroutine init(self, t, r, ierr)

Arguments

NameTypeIntentAttributesDescription
selfclass(heat_solver)inout
treal(kind=R8P)in
rreal(kind=R8P)in
ierrinteger(kind=I4P)out

Call graph

run ​

Advance some steps on the device.

fortran
subroutine run(self, steps)

Arguments

NameTypeIntentAttributesDescription
selfclass(heat_solver)inout
stepsinteger(kind=I4P)in

Call graph

get ​

Download the temperature, ghost cells included.

fortran
subroutine get(self, t)

Arguments

NameTypeIntentAttributesDescription
selfclass(heat_solver)in
treal(kind=R8P)out

Call graph

destroy ​

Release the device state.

fortran
subroutine destroy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(heat_solver)inout

Call graph

diffuse ​

One explicit step: the device arrays are dummy arguments, as OpenACC deviceptr requires.

fortran
subroutine diffuse(n, r, t, tn)

Arguments

NameTypeIntentAttributesDescription
ninteger(kind=I4P)in
rreal(kind=R8P)in
treal(kind=R8P)in
tnreal(kind=R8P)inout

Call graph