A type of uniform field which also has a uniform gradient. Of course, this is impossible in practice, but it can be useful for tricking certain routines into working properly. Ideally a whole new derived type would be created which just holds the value and gradient at a single point, but the emphasis is on getting something quickly. Note that the gradient is not propagated across operations--the result of all overloaded operators is just a normal uniform field with no gradient.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=r8), | public, | dimension(:), allocatable | :: | grad | The values of the gradient in each direction. |
Creates a new scalar field with a uniform value across all of space but a non-zero gradient.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r8), | intent(in) | :: | val | The value of the field |
||
real(kind=r8), | intent(in), | dimension(:) | :: | grad | An array in which the |
A scalar field initated based on teh arguments of this function.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(uniform_gradient_field), | intent(in) | :: | this | |||
integer, | intent(in) | :: | dir | Direction in which to differentiate |
||
integer, | intent(in), | optional | :: | order | Order of the derivative, default = 1 |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(uniform_gradient_field), | intent(in) | :: | this |
The result of this operation
Checks fields are equal within a tolerance
Evaluates whether two scalar fields are equal within a tolerance,
specified by set_tol
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(uniform_gradient_field), | intent(in) | :: | this | |||
class(scalar_field), | intent(in) | :: | rhs |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(uniform_gradient_field), | intent(inout) | :: | this | |||
class(scalar_field), | intent(in) | :: | rhs |
type, extends(uniform_scalar_field), public :: uniform_gradient_field
!* Author: Chris MacMackin
! Date: July 2017
!
! A type of uniform field which also has a uniform gradient. Of
! course, this is impossible in practice, but it can be useful for
! tricking certain routines into working properly. Ideally a whole
! new derived type would be created which just holds the value and
! gradient at a single point, but the emphasis is on getting
! something quickly. Note that the gradient is not propagated
! across operations--the result of all overloaded operators is
! just a normal uniform field with no gradient.
!
real(r8), dimension(:), allocatable :: grad
!! The values of the gradient in each direction.
contains
private
procedure, public :: d_dx => uniform_gradient_d_dx
!! \(\frac{\partial^n}{\partial x_i^n}({\rm field})\)
procedure :: gradient => uniform_gradient_gradient
!! \(\nabla {\rm field}\)
procedure :: is_equal => uniform_gradient_is_equal
!! Checks fields are equal within a tolerance
procedure :: assign_field => uniform_gradient_assign
!! \({\rm field} = {\rm field}\)
end type uniform_gradient_field