scalar_field Derived Type

type, public, extends(field) :: scalar_field

Encapsulate scalar-field state and operations, storing a mesh association in the parent field


Inherits

type~~scalar_field~~InheritsGraph type~scalar_field scalar_field type~field field type~scalar_field->type~field type~dimensions dimensions type~field->type~dimensions dim type~bc_poly bc_poly type~field->type~bc_poly bc type~matptr matptr type~field->type~matptr mats type~mesh mesh type~field->type~mesh msh type~grid grid type~field->type~grid type~bc_wall bc_wall type~bc_poly->type~bc_wall wall type~bc_math bc_math type~bc_poly->type~bc_math math type~motion motion type~bc_poly->type~motion mot type~material material type~matptr->type~material mat type~mesh->type~grid type~face face type~mesh->type~face faces type~vertex vertex type~mesh->type~vertex verts type~least_squares least_squares type~mesh->type~least_squares lsr type~connectivity connectivity type~mesh->type~connectivity v2c, v2f, f2c, c2g, v2v, f2f, c2c, v2b, f2b type~keytable keytable type~mesh->type~keytable ov2c_sup, c2ov_sup, ov2f_sup, f2ov_sup type~vector vector type~mesh->type~vector face_cntr, af, df, cell_cntr type~surface surface type~mesh->type~surface surf type~cell cell type~mesh->type~cell cells psb_desc_type psb_desc_type type~mesh->psb_desc_type desc_v, desc_f, desc_c type~units units type~grid->type~units units_ type~object object type~grid->type~object type~units->type~object type~bc_wall->type~bc_math temp, pressure, conc, vel, pos, stress type~vertex->type~vector position type~a_row a_row type~keytable->type~a_row row type~cylinder cylinder type~surface->type~cylinder my_cylinder type~plane plane type~surface->type~plane my_plane type~motion->type~vector law_y type~cylinder->type~vector center, axis type~plane->type~vector normal

Contents

Source Code


Components

TypeVisibility AttributesNameInitial
integer, private, allocatable:: bmat(:)
real(kind=psb_dpk_), private, allocatable:: bx(:)

face values

integer, private, allocatable:: mat(:)
real(kind=psb_dpk_), private, allocatable:: x(:)

field nodal values

real(kind=psb_dpk_), private, allocatable:: xp(:)

previous nodal values


Constructor

public interface scalar_field

  • public function scalar_field_(base, x, bx)

    Result is new scalar_field from parent field

    Arguments

    Type IntentOptional AttributesName
    type(field), intent(in) :: base
    real(kind=psb_dpk_), intent(in) :: x(:)
    real(kind=psb_dpk_), intent(in) :: bx(:)

    Return Value type(scalar_field)


Type-Bound Procedures

generic, public :: assignment(=) => assign_scalar_field_s, assign_scalar_field_v

User-defined assignment

procedure, public :: bc_

  • interface

    ----- Destructor -----

    Read more…

    private module function bc_(fld)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(in), target:: fld

    Return Value type(bc_poly), pointer, (:)

procedure, public :: check_field_operands

  • interface

    ----- Destructor -----

    Read more…

    private module subroutine check_field_operands(f1, f2, where)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(in) :: f1
    type(field), intent(in) :: f2
    character(len=*), intent(in) :: where

generic, public :: check_mesh_consistency => check_mesh_consistency_bf, check_mesh_consistency_sf

procedure, public :: create_field

  • interface

    ----- Destructor -----

    Read more…

    private module subroutine create_field(fld, msh, dim, bc, mats, on_faces, name)

    Constructor Mandatory arguments

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(out) :: fld
    type(mesh), intent(in), target:: msh

    Optional arguments

    type(dimensions), intent(in), optional :: dim
    type(bc_poly), intent(in), optional target:: bc(:)
    type(matptr), intent(in), optional target:: mats(:)
    logical, intent(in), optional :: on_faces
    character(len=*), intent(in), optional :: name

procedure, public :: create_scalar_field

Constructor

  • interface

    ----- Algebra Operations -----

    private module subroutine create_scalar_field(fld, msh, dim, bc, mats, on_faces, x0, name)

    Define scalar_field from mesh, dimensions, boundary conditions, materials, face-centeredness, and values

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(out) :: fld
    type(mesh), intent(in), target:: msh
    type(dimensions), intent(in), optional :: dim
    type(bc_poly), intent(in), optional target:: bc(:)
    type(matptr), intent(in), optional target:: mats(:)
    logical, intent(in), optional :: on_faces
    real(kind=psb_dpk_), intent(in), optional :: x0
    character(len=*), intent(in), optional :: name

generic, public :: dim_ => get_field_dim

generic, public :: field_norm1 => nemo_scalar_field_norm1

generic, public :: field_normi => nemo_scalar_field_normi

generic, public :: fld_size => get_field_size

procedure, public :: free_field

Destructor

  • interface

    ----- Algebra Operations -----

    private module subroutine free_field(fld)

    Deallocate scalar_field components: field parent and component arrays

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(inout) :: fld

procedure, public :: get_base

  • interface

    ----- Algebra Operations -----

    private module subroutine get_base(fld, base)

    Get parent field

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld
    type(field), intent(out) :: base

generic, public :: get_bx => get_scalar_field_bx

generic, public :: get_material => get_field_mat_sub

procedure, public :: get_mesh

  • interface

    ----- Destructor -----

    Read more…

    private module subroutine get_mesh(fld, msh)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(in) :: fld
    type(mesh), pointer:: msh

procedure, public :: get_scalar_field_mat_id

  • interface

    ----- Algebra Operations -----

    private module function get_scalar_field_mat_id(fld, i)

    Result is scalar_field material identifier

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld
    integer, intent(in) :: i

    Return Value integer

procedure, public :: get_units

  • interface

    private impure elemental module function get_units(this) result(this_units)

    Arguments

    Type IntentOptional AttributesName
    class(grid), intent(in) :: this

    Return Value type(units)

generic, public :: get_x => get_scalar_field_x, get_scalar_field_element

generic, public :: get_xp => get_scalar_field_xp, get_scalar_field_element_prev

generic, public :: interp_on_faces => interp_on_faces_s

  • private interface interp_on_faces_s()

    ----- Algebra Operations -----

    Arguments

    None

procedure, public :: mark_as_defined

  • interface

    private pure module subroutine mark_as_defined(this)

    Mark the object as user-defined

    Arguments

    Type IntentOptional AttributesName
    class(object), intent(inout) :: this

procedure, public :: mat_

  • interface

    ----- Destructor -----

    Read more…

    private module function mat_(fld, i)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(in) :: fld
    integer, intent(in), optional :: i

    Return Value type(material), pointer

procedure, public :: msh_

  • interface

    ----- Destructor -----

    Read more…

    private module function msh_(fld)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(in), target:: fld

    Return Value type(mesh), pointer

procedure, public :: name_

  • interface

    ----- Destructor -----

    Read more…

    private module function name_(fld)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(in) :: fld

    Return Value character(len=:), allocatable

procedure, public :: nemo_sizeof

  • interface

    ----- Algebra Operations -----

    private module function nemo_sizeof(fld)

    Result is the scalar_field size

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld

    Return Value integer(kind=nemo_int_long_)

procedure, public :: on_faces_

Getters

  • interface

    ----- Destructor -----

    Read more…

    private module function on_faces_(fld)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(in) :: fld

    Return Value logical

generic, public :: operator(*) => scalar_field_scal, scalar_field_mul

Algebra operations

  • private interface scalar_field_scal()

    ----- Algebra Operations -----

    Arguments

    None
  • private interface scalar_field_mul()

    ----- Algebra Operations -----

    Arguments

    None

generic, public :: operator(+) => scalar_field_sum

  • private interface scalar_field_sum()

    ----- Algebra Operations -----

    Arguments

    None

generic, public :: operator(-) => scalar_field_dif, scalar_field_dif_s

generic, public :: operator(/) => scalar_field_div

  • private interface scalar_field_div()

    ----- Algebra Operations -----

    Arguments

    None

procedure, public :: set_field_dim

  • interface

    ----- Destructor -----

    Read more…

    private module subroutine set_field_dim(fld, dim)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(inout) :: fld
    type(dimensions), intent(in) :: dim

generic, public :: set_field_element => set_scalar_field_element

generic, public :: set_field_group => set_scalar_field_group

procedure, public :: set_field_on_faces

Setters

  • interface

    ----- Destructor -----

    Read more…

    private module subroutine set_field_on_faces(fld, on_faces)

    Arguments

    Type IntentOptional AttributesName
    class(field), intent(inout) :: fld
    logical, intent(in) :: on_faces

procedure, public :: set_units

  • interface

    private impure elemental module subroutine set_units(this, units_obj)

    Arguments

    Type IntentOptional AttributesName
    class(grid), intent(inout) :: this
    type(units), intent(in) :: units_obj

generic, public :: update_field => update_scalar_field

procedure, public :: user_defined

  • interface

    private pure module function user_defined(this) result(is_defined)

    Return a boolean result indicating whether this object has been initialized since its declaration

    Arguments

    Type IntentOptional AttributesName
    class(object), intent(in) :: this

    Return Value logical

procedure, private :: assign_scalar_field_s

  • interface

    ----- Algebra Operations -----

    private module subroutine assign_scalar_field_s(f, x)

    Set the left-hand-side scalar_field values to the provided constant

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(inout) :: f
    real(kind=psb_dpk_), intent(in) :: x

procedure, private :: assign_scalar_field_v

  • interface

    ----- Algebra Operations -----

    private module subroutine assign_scalar_field_v(f, x)

    Set the left-hand-side scalar_field values to the provided values

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(inout) :: f
    real(kind=psb_dpk_), intent(in) :: x(:)

procedure, private :: check_mesh_consistency_sf

  • interface

    ----- Algebra Operations -----

    private module subroutine check_mesh_consistency_sf(f1, f2, where)

    Abort iff the scalar_field arguments are not associated with the same mesh

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: f1
    type(scalar_field), intent(in) :: f2
    character(len=*), intent(in) :: where

procedure, private :: get_scalar_field_bx

  • interface

    ----- Algebra Operations -----

    private module subroutine get_scalar_field_bx(fld, bx)

    get scalar_field boundary values

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld
    real(kind=psb_dpk_), intent(out), allocatable:: bx(:)

procedure, private :: get_scalar_field_element

  • interface

    ----- Algebra Operations -----

    private module subroutine get_scalar_field_element(fld, x, i)

    get one scalar_field value

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld
    real(kind=psb_dpk_), intent(out) :: x
    integer, intent(in) :: i

procedure, private :: get_scalar_field_element_prev

  • interface

    ----- Algebra Operations -----

    private module subroutine get_scalar_field_element_prev(fld, xp, i)

    get one scalar_field previous value

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld
    real(kind=psb_dpk_), intent(out) :: xp
    integer, intent(in) :: i

procedure, private :: get_scalar_field_x

  • interface

    ----- Algebra Operations -----

    private module subroutine get_scalar_field_x(fld, x)

    get all scalar_field values

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld
    real(kind=psb_dpk_), intent(out), allocatable:: x(:)

procedure, private :: get_scalar_field_xp

  • interface

    ----- Algebra Operations -----

    private module subroutine get_scalar_field_xp(fld, xp)

    Get all scalar_field previous values

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld
    real(kind=psb_dpk_), intent(out), allocatable:: xp(:)

procedure, private :: interp_on_faces_s

  • interface

    ----- Algebra Operations -----

    private module function interp_on_faces_s(fld) result(r)

    Result contains scalar_field cell values interpolated onto cell faces

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld

    Return Value type(scalar_field)

procedure, private :: nemo_scalar_field_norm1

  • interface

    ----- Algebra Operations -----

    private module function nemo_scalar_field_norm1(fld) result(norm)

    Result is L1 norm of scalar_field

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld

    Return Value real(kind=psb_dpk_)

procedure, private :: nemo_scalar_field_normi

  • interface

    ----- Algebra Operations -----

    private module function nemo_scalar_field_normi(fld) result(norm)

    Result is infinity-norm of scalar_field

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: fld

    Return Value real(kind=psb_dpk_)

procedure, private :: scalar_field_dif

  • interface

    ----- Algebra Operations -----

    private module function scalar_field_dif(f1, f2) result(r)

    Result is the arithmetic difference of the two scalar_field operands

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: f1
    type(scalar_field), intent(in) :: f2

    Return Value type(scalar_field)

procedure, private :: scalar_field_dif_s

  • interface

    ----- Algebra Operations -----

    private module function scalar_field_dif_s(f1, f2) result(r)

    Result is the arithmetic difference of the scalar_field operand and the constant operand

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: f1
    real(kind=psb_dpk_), intent(in) :: f2

    Return Value type(scalar_field)

procedure, private :: scalar_field_div

  • interface

    ----- Algebra Operations -----

    private module function scalar_field_div(f1, f2) result(r)

    Result is the ratio of the left-hand-side numerator and right-hand-side denominator scalar_field objects

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: f1
    type(scalar_field), intent(in) :: f2

    Return Value type(scalar_field)

procedure, private :: scalar_field_mul

  • interface

    ----- Algebra Operations -----

    private module function scalar_field_mul(f1, f2) result(r)

    REsult is the arithmetic product of two scalar_field objects

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: f1
    type(scalar_field), intent(in) :: f2

    Return Value type(scalar_field)

procedure, private, pass(f) :: scalar_field_scal

  • interface

    ----- Algebra Operations -----

    private module function scalar_field_scal(a, f) result(r)

    Rescale the scalar_field argument by the provided multiplicative constant

    Arguments

    Type IntentOptional AttributesName
    real(kind=psb_dpk_), intent(in) :: a
    class(scalar_field), intent(in) :: f

    Return Value type(scalar_field)

procedure, private :: scalar_field_sum

  • interface

    ----- Algebra Operations -----

    private module function scalar_field_sum(f1, f2) result(r)

    Result is the arithmetic sum of the two scalar_field operands

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(in) :: f1
    type(scalar_field), intent(in) :: f2

    Return Value type(scalar_field)

procedure, private :: set_scalar_field_element

  • interface

    ----- Algebra Operations -----

    private module subroutine set_scalar_field_element(f, i, x)

    Set one scalar_field value

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(inout) :: f
    integer, intent(in) :: i

    element number to set

    real(kind=psb_dpk_), intent(in) :: x

    value

procedure, private :: set_scalar_field_group

  • interface

    ----- Algebra Operations -----

    private module subroutine set_scalar_field_group(f, ig, x)

    Set a group of scalar field values

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(inout) :: f
    integer, intent(in) :: ig
    real(kind=psb_dpk_), intent(in) :: x

procedure, private :: update_scalar_field

  • interface

    ----- Algebra Operations -----

    private module subroutine update_scalar_field(fld, mats, temp)

    Set all scalar_field values

    Arguments

    Type IntentOptional AttributesName
    class(scalar_field), intent(inout) :: fld
    type(matptr), intent(in), pointer:: mats(:)
    type(scalar_field), intent(in), optional :: temp

    temperature

Source Code

    TYPE, EXTENDS(field) :: scalar_field
      !! label: Morfeus-FV
      !!
      !! Encapsulate scalar-field state and operations, storing a mesh association in the parent field
      !!
        PRIVATE
        REAL(psb_dpk_), ALLOCATABLE :: x(:)  !! field nodal values
        REAL(psb_dpk_), ALLOCATABLE :: xp(:) !! previous nodal values
        REAL(psb_dpk_), ALLOCATABLE :: bx(:) !! face values
        INTEGER, ALLOCATABLE :: mat(:)
        INTEGER, ALLOCATABLE :: bmat(:)
    CONTAINS
        PROCEDURE, PUBLIC :: create_scalar_field               !! Constructor
        PROCEDURE, PUBLIC :: free_field                        !! Destructor
        PROCEDURE, PUBLIC :: get_base
        PROCEDURE, PRIVATE :: get_scalar_field_x, get_scalar_field_element
        GENERIC, PUBLIC :: get_x => get_scalar_field_x, get_scalar_field_element
        PROCEDURE, PRIVATE :: get_scalar_field_xp, get_scalar_field_element_prev
        GENERIC, PUBLIC :: get_xp => get_scalar_field_xp, get_scalar_field_element_prev
        PROCEDURE, PRIVATE :: get_scalar_field_bx
        GENERIC, PUBLIC :: get_bx => get_scalar_field_bx
        PROCEDURE :: get_scalar_field_mat_id
        PROCEDURE, PRIVATE :: update_scalar_field
        GENERIC, PUBLIC :: update_field => update_scalar_field
        PROCEDURE, PRIVATE :: set_scalar_field_element, set_scalar_field_group
        GENERIC, PUBLIC :: set_field_element => set_scalar_field_element
        GENERIC, PUBLIC :: set_field_group => set_scalar_field_group
        PROCEDURE,PRIVATE :: interp_on_faces_s
        GENERIC, PUBLIC :: interp_on_faces => interp_on_faces_s
        PROCEDURE, PRIVATE :: nemo_scalar_field_normi, nemo_scalar_field_norm1
        GENERIC, PUBLIC :: field_normi => nemo_scalar_field_normi
        GENERIC, PUBLIC :: field_norm1 => nemo_scalar_field_norm1
        PROCEDURE, PRIVATE :: scalar_field_sum, scalar_field_dif, scalar_field_dif_s
        PROCEDURE, PRIVATE :: scalar_field_div
        PROCEDURE, PASS(f), PRIVATE :: scalar_field_scal
        PROCEDURE, PRIVATE :: scalar_field_mul
        PROCEDURE, PRIVATE :: assign_scalar_field_s, assign_scalar_field_v
        GENERIC :: ASSIGNMENT(=) => assign_scalar_field_s, assign_scalar_field_v  !! User-defined assignment
        GENERIC :: OPERATOR(*) => scalar_field_scal, scalar_field_mul             !! Algebra operations
        GENERIC :: OPERATOR(+) => scalar_field_sum
        GENERIC :: OPERATOR(-) => scalar_field_dif, scalar_field_dif_s
        GENERIC :: OPERATOR(/) => scalar_field_div
        PROCEDURE, PUBLIC :: nemo_sizeof
        PROCEDURE, PRIVATE :: check_mesh_consistency_sf
        GENERIC, PUBLIC :: check_mesh_consistency => check_mesh_consistency_sf
    END TYPE scalar_field