last_tasks_for_channels Subroutine

public subroutine last_tasks_for_channels(me, sim)

Arguments

Type IntentOptional Attributes Name
type(channel_t), intent(inout) :: me
type(simulation_t), intent(in) :: sim

Calls

proc~~last_tasks_for_channels~~CallsGraph proc~last_tasks_for_channels last_tasks_for_channels proc~state_rot state_roT proc~last_tasks_for_channels->proc~state_rot proc~jacobian_rot jacobian_roT proc~state_rot->proc~jacobian_rot proc~eos_terms eos_terms proc~jacobian_rot->proc~eos_terms proc~eos_e_terms eos_e_terms proc~eos_terms->proc~eos_e_terms proc~fill_f_terms fill_f_terms proc~eos_terms->proc~fill_f_terms proc~fill_e_tpart fill_e_Tpart proc~eos_e_terms->proc~fill_e_tpart proc~fill_ff_terms fill_ff_terms proc~eos_e_terms->proc~fill_ff_terms proc~fill_g_dreg_terms fill_g_Dreg_terms proc~fill_e_tpart->proc~fill_g_dreg_terms

Called by

proc~~last_tasks_for_channels~~CalledByGraph proc~last_tasks_for_channels last_tasks_for_channels proc~main_loop main_loop proc~main_loop->proc~last_tasks_for_channels program~reims_p reims_p program~reims_p->proc~main_loop

Source Code

subroutine last_tasks_for_channels(me,sim)    
    type(channel_t), intent(inout) :: me
    type(simulation_t), intent(in) :: sim

    real(dp) :: mdot,HHH,Rout,Pout,eout,cout
    integer :: jj

    me%err = 0_dp
    me%err_den = 0_dp

    do jj=1,me%HeProp%NbCells

        ! Write to HDF5
        me%hdf%data(jj,1) = me%StVar%He_pr(Pri_p,jj)/1.0e5_dp                               ! He Pressure (Bar)
        me%hdf%data(jj,2) = me%StVar%He_pr(Pri_ro,jj)                                       ! He Density (kg/m3)
        me%hdf%data(jj,3) = me%StVar%He_pr(Pri_u,jj)                                        ! He Velocity (m/s)
        me%hdf%data(jj,4) = me%HeProp%Area*me%StVar%He_pr(Pri_u,jj)*me%StVar%He_pr(Pri_ro,jj) ! He MassFlowRate (kg/s)
        me%hdf%data(jj,5) = me%StVar%He_pr(Pri_T,jj)                                        ! He Temperature (K)
        call state_roT(me%StVar%He_pr(Pri_ro,jj), me%StVar%He_pr(Pri_T,jj), Rout, Pout, eout, cout)
        mdot=me%HeProp%Area*me%StVar%He_pr(Pri_u,jj)*me%StVar%He_pr(Pri_ro,jj)
        HHH=eout+Pout/me%StVar%He_pr(Pri_ro,jj)+0.5_dp*(me%StVar%He_pr(Pri_u,jj)**2)
        me%hdf%data(jj,6)=mdot*HHH                                                               ! He Mdot*H
        me%hdf%data(jj,7)=me%StVar%He_pr(Pri_R,jj)                                          ! He R eq
        me%hdf%data(jj,8)=me%srcPP%Su(jj)

        ! For step management
        if(sim%explicit) then
            me%err = me%err + (me%StVar%He_pr(Pri_p,jj) - me%StVarOld%He_pr(Pri_p,jj))**2
            me%err_den = me%err_den + me%StVarOld%He_pr(Pri_p,jj)**2
        else
            me%err = me%err + ( (1.0_dp/6.0_dp) * (sim%dtPrev1+sim%dt) * ( &
                (me%StVar    %He_cs(2,jj)-me%StVarOld %He_cs(2,jj))               / sim%dt - &
                (me%StVarOld %He_cs(2,jj)-me%StVarOld2%He_cs(2,jj)) * (sim%dt+sim%dtPrev1) / sim%dtPrev1**2 + &
                (me%StVarOld2%He_cs(2,jj)-me%StVarOld3%He_cs(2,jj)) *  sim%dt/sim%dtPrev1  / sim%dtPrev2 ))**2
            me%err_den = me%err_den + (me%StVarOld%He_cs(2,jj))**2                      
        endif

    enddo
      
end subroutine last_tasks_for_channels