class_iterating_procedures.f90 Source File


This file depends on

sourcefile~~class_iterating_procedures.f90~~EfferentGraph sourcefile~class_iterating_procedures.f90 class_iterating_procedures.f90 sourcefile~tools_input.f90 tools_input.f90 sourcefile~class_iterating_procedures.f90->sourcefile~tools_input.f90 sourcefile~class_iterating.f90 class_iterating.f90 sourcefile~class_iterating_procedures.f90->sourcefile~class_iterating.f90 sourcefile~class_psblas.f90 class_psblas.f90 sourcefile~class_iterating_procedures.f90->sourcefile~class_psblas.f90 sourcefile~tools_math.f90 tools_math.f90 sourcefile~class_iterating_procedures.f90->sourcefile~tools_math.f90 sourcefile~tools_input.f90->sourcefile~class_psblas.f90 sourcefile~class_vector.f90 class_vector.f90 sourcefile~tools_input.f90->sourcefile~class_vector.f90 sourcefile~class_iterating.f90->sourcefile~class_psblas.f90 sourcefile~tools_psblas.f90 tools_psblas.f90 sourcefile~class_psblas.f90->sourcefile~tools_psblas.f90 sourcefile~class_stopwatch.f90 class_stopwatch.f90 sourcefile~class_psblas.f90->sourcefile~class_stopwatch.f90 sourcefile~tools_math.f90->sourcefile~class_psblas.f90 sourcefile~tools_math.f90->sourcefile~class_vector.f90 sourcefile~class_vector.f90->sourcefile~class_psblas.f90 sourcefile~class_stopwatch.f90->sourcefile~tools_psblas.f90

Contents


Source Code

!
!     (c) 2019 Guide Star Engineering, LLC
!     This Software was developed for the US Nuclear Regulatory Commission (US NRC)
!     under contract "Multi-Dimensional Physics Implementation into Fuel Analysis under
!     Steady-state and Transients (FAST)", contract # NRC-HQ-60-17-C-0007
!
!
!    NEMO - Numerical Engine (for) Multiphysics Operators
! Copyright (c) 2007, Stefano Toninel
!                     Gian Marco Bianchi  University of Bologna
!              David P. Schmidt    University of Massachusetts - Amherst
!              Salvatore Filippone University of Rome Tor Vergata
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without modification,
! are permitted provided that the following conditions are met:
!
!     1. Redistributions of source code must retain the above copyright notice,
!        this list of conditions and the following disclaimer.
!     2. Redistributions in binary form must reproduce the above copyright notice,
!        this list of conditions and the following disclaimer in the documentation
!        and/or other materials provided with the distribution.
!     3. Neither the name of the NEMO project nor the names of its contributors
!        may be used to endorse or promote products derived from this software
!        without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
! ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
! WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
! ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
! (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
! ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!
!---------------------------------------------------------------------------------
!
! $Id: class_iterating.f90 3093 2008-04-22 14:51:09Z sfilippo $
!
! Description:
!    To be added...
!
SUBMODULE(class_iterating) class_iterating_procedures

    IMPLICIT NONE

CONTAINS

    ! ----- Constructor -----

    MODULE PROCEDURE create_iterating
        USE class_psblas, ONLY : abort_psblas
        USE tools_input
        USE tools_math, ONLY : it_counter_, it_convergence_, it_time_
        USE json_module

        TYPE(json_file) :: nemo_json
        LOGICAL :: found
        CHARACTER(LEN=80) :: iter_sec

        CALL open_file(input_file,nemo_json)
        iter_sec = 'MORFEUS_FV.iterations.'//TRIM(sec)

        ! Sets common members
        iter%icurrent = 0
        CALL nemo_json%get(TRIM(iter_sec)//'.max-steps', iter%nmax, found)
        IF (.NOT.found) THEN
            WRITE(*,100)
            CALL abort_psblas
        END IF

        ! Sets specific members
        SELECT CASE(itype)
        CASE(it_time_)
            CALL nemo_json%get(TRIM(iter_sec)//'.delta-t', iter%delta, found)
            IF (.NOT.found) THEN
                WRITE(*,100)
                CALL abort_psblas
            END IF
            iter%tol   = 0.d0
        CASE(it_convergence_)
            iter%delta = 0.d0
            CALL nemo_json%get(TRIM(iter_sec)//'.tolerance', iter%tol, found)
            IF (.NOT.found) THEN
                WRITE(*,100)
                CALL abort_psblas
            END IF
        CASE(it_counter_)
            iter%delta = 0.d0
            iter%tol   = 0.d0
        CASE DEFAULT
            WRITE(*,100)
            CALL abort_psblas
        END SELECT

100     FORMAT(' ERROR! Illegal ITYPE value in CREATE_ITERATING')

    END PROCEDURE create_iterating


    ! ----- Getters -----

    MODULE PROCEDURE nmax_

        nmax_ = iter%nmax

    END PROCEDURE nmax_


    MODULE PROCEDURE delta_

        delta_ = iter%delta

    END PROCEDURE delta_

    MODULE PROCEDURE tol_

        tol_ = iter%tol

    END PROCEDURE tol_

    MODULE PROCEDURE current_iteration

        current_iteration = iter%icurrent

    END PROCEDURE current_iteration


    MODULE PROCEDURE next_iteration

        next_iteration = iter%icurrent + 1

    END PROCEDURE next_iteration


    MODULE PROCEDURE previous_iteration

        previous_iteration = iter%icurrent - 1

    END PROCEDURE previous_iteration


    ! ----- Setters -----

    MODULE PROCEDURE increment_iterating

        iter%icurrent = iter%icurrent + 1

    END PROCEDURE increment_iterating


    MODULE PROCEDURE reset_iterating

        iter%icurrent = 0

    END PROCEDURE reset_iterating


    ! ----- Utilities -----

    MODULE PROCEDURE stop_iterating

        ! Initialization
        stop_iterating = .FALSE.

        IF(iter%icurrent >= iter%nmax) THEN
            stop_iterating = .TRUE.
            RETURN
        END IF

        IF(PRESENT(eps) .AND. eps <= iter%tol) THEN
            stop_iterating = .TRUE.
        END IF

    END PROCEDURE stop_iterating

    MODULE PROCEDURE nemo_iterating_sizeof
        USE class_psblas, ONLY : nemo_int_long_, nemo_sizeof_dp, nemo_sizeof_int

        nemo_iterating_sizeof =  2 * nemo_sizeof_int + 2* nemo_sizeof_dp

    END PROCEDURE nemo_iterating_sizeof

END SUBMODULE class_iterating_procedures