brent Function

private function brent(obj, xmin, xmax, label) result(x)

Arguments

Type IntentOptional Attributes Name
class(brent_t), intent(in) :: obj
real(kind=dp), intent(in) :: xmin
real(kind=dp), intent(in) :: xmax
character(len=*), intent(in) :: label

Return Value real(kind=dp)


Calls

proc~~brent~~CallsGraph proc~brent brent f f proc~brent->f proc~set_error set_error proc~brent->proc~set_error proc~zero zero proc~brent->proc~zero proc~zero->f

Called by

proc~~brent~~CalledByGraph proc~brent brent proc~ro_pt ro_pT proc~ro_pt->proc~brent proc~t_roe T_roE proc~t_roe->proc~brent proc~t_rop T_roP proc~t_rop->proc~brent proc~channel_init_part1 channel_init_part1 proc~channel_init_part1->proc~ro_pt proc~circulator_dynamic_parameters_df circulator_dynamic_parameters_t%circulator_dynamic_parameters_df proc~circulator_dynamic_parameters_df->proc~t_rop proc~derivative_function_of_pstar_pt derivative_function_of_pstar_PT proc~derivative_function_of_pstar_pt->proc~t_rop proc~droeint_drop droeint_droP proc~droeint_drop->proc~t_rop proc~ffsrclink_prelax_resolution_from_and_to_ports FFsrcLink_Prelax_resolution_from_and_to_ports proc~ffsrclink_prelax_resolution_from_and_to_ports->proc~t_rop proc~function_of_pstar_mt function_of_pstar_MT proc~function_of_pstar_mt->proc~t_rop proc~outgoing_branch_cold_circulator outgoing_branch_cold_circulator proc~outgoing_branch_cold_circulator->proc~t_rop proc~outgoing_branch_cold_circulator->proc~circulator_dynamic_parameters_df proc~state_rop state_roP proc~outgoing_branch_cold_circulator->proc~state_rop proc~circulator_dynamic_parameters_f circulator_dynamic_parameters_t%circulator_dynamic_parameters_f proc~outgoing_branch_cold_circulator->proc~circulator_dynamic_parameters_f proc~solve_boundary_mt solve_boundary_MT proc~solve_boundary_mt->proc~t_rop proc~solve_boundary_mt->proc~function_of_pstar_mt proc~solve_boundary_mt->proc~state_rop proc~solve_boundary_pt solve_boundary_PT proc~solve_boundary_pt->proc~ro_pt proc~solve_boundary_pt->proc~derivative_function_of_pstar_pt proc~solve_boundary_pt->proc~state_rop proc~state_rop_withr state_roP_withR proc~solve_boundary_pt->proc~state_rop_withr proc~function_of_pstar_pt function_of_pstar_PT proc~solve_boundary_pt->proc~function_of_pstar_pt proc~hugoniot_star_state hugoniot_star_state proc~solve_boundary_pt->proc~hugoniot_star_state proc~solve_junction solve_junction proc~solve_junction->proc~t_roe proc~solve_junction->proc~droeint_drop proc~solve_junction->proc~state_rop proc~state_roe state_roE proc~state_roe->proc~t_roe proc~state_roe_withr state_roE_withR proc~state_roe_withr->proc~t_rop proc~state_rop->proc~t_rop proc~state_rop_withr->proc~t_rop proc~boundary_resolution_from_and_to_ports boundary_resolution_from_and_to_ports proc~boundary_resolution_from_and_to_ports->proc~solve_boundary_mt proc~boundary_resolution_from_and_to_ports->proc~solve_boundary_pt proc~circulator_dynamic_parameters_f->proc~state_rop proc~circulator_resolution_from_and_to_ports circulator_resolution_from_and_to_ports proc~circulator_resolution_from_and_to_ports->proc~outgoing_branch_cold_circulator proc~incoming_branch_cold_circulator incoming_branch_cold_circulator proc~circulator_resolution_from_and_to_ports->proc~incoming_branch_cold_circulator proc~friction_source_term friction_source_term proc~friction_source_term->proc~state_roe proc~friction_source_term->proc~state_roe_withr proc~from_sol_to_prim_channel from_sol_to_prim_channel proc~from_sol_to_prim_channel->proc~state_roe proc~from_sol_to_prim_channel->proc~state_roe_withr proc~function_of_pstar_pt->proc~state_rop proc~hug_brent_f hug_brent_t%hug_brent_f proc~hug_brent_f->proc~droeint_drop proc~hugoniot_star_state->proc~droeint_drop proc~incoming_branch_cold_circulator->proc~state_rop proc~junction_dynamic_parameters_fcn junction_dynamic_parameters_t%junction_dynamic_parameters_fcn proc~junction_dynamic_parameters_fcn->proc~droeint_drop proc~junction_resolution_from_and_to_ports Junction_resolution_from_and_to_ports proc~junction_resolution_from_and_to_ports->proc~solve_junction proc~main_loop main_loop proc~main_loop->proc~ffsrclink_prelax_resolution_from_and_to_ports proc~main_loop->proc~boundary_resolution_from_and_to_ports proc~main_loop->proc~circulator_resolution_from_and_to_ports proc~main_loop->proc~friction_source_term proc~main_loop->proc~from_sol_to_prim_channel proc~main_loop->proc~junction_resolution_from_and_to_ports proc~source_term_definition_channel source_term_definition_channel proc~main_loop->proc~source_term_definition_channel proc~full_physics_definition_channel full_physics_definition_channel proc~main_loop->proc~full_physics_definition_channel proc~sourceterms_notfriction_channel SourceTerms_NOTfriction_channel proc~sourceterms_notfriction_channel->proc~state_roe proc~sourceterms_notfriction_channel->proc~state_roe_withr program~reims_p reims_p program~reims_p->proc~channel_init_part1 program~reims_p->proc~main_loop proc~source_term_definition_channel->proc~sourceterms_notfriction_channel proc~full_physics_definition_channel->proc~source_term_definition_channel

Source Code

function brent(obj, xmin, xmax, label) result(x)
    class(brent_t), intent(in) :: obj
    real(dp),       intent(in) :: xmin, xmax
    character(*),   intent(in) :: label
    real(dp) :: x
    real(dp) :: fmin, fmax

    fmin = obj%f(xmin)
    fmax = obj%f(xmax)
    if (fmin*fmax > 0.0_dp) then
        call set_error(label//': no sign change on bracket, cannot solve')
        x = ieee_value(x, ieee_quiet_nan)
        return
    endif

    x = zero(obj, xmin, xmax, Brent_MachEps, Brent_Tol)
    if (abs(obj%f(x)) > Brent_ResidTol .or. x < xmin .or. x > xmax) then
        call set_error(label//': Brent solve failed to converge')
        x = ieee_value(x, ieee_quiet_nan)
    endif
end function brent