subroutine from_sol_to_prim_channel(me)
type(channel_t), intent(inout) :: me
real(dp) :: PoutCP,ToutCP,coutCP,rocheck
integer :: jj
do jj=1,me%HeProp%NbCells
me%StVar%He_cs(:,jj)=me%StVar%He_cs(:,jj)+me%big%bvx(1:Nb_VarC,jj) ! update of cons by the solution
me%StVar%He_pr(Pri_ro,jj)=me%StVar%He_cs(Con_Mas,jj)
rocheck=me%StVar%He_pr(Pri_ro,jj)
if(ieee_is_nan(rocheck) .or. rocheck<0.001_dp .or. rocheck>160.0_dp) then
call set_error('unphysical density in channel '//trim(me%HeProp%name))
return
endif
me%StVar%He_pr(Pri_u,jj)=me%StVar%He_cs(Con_Qdm,jj)/me%StVar%He_cs(Con_Mas,jj)
me%StVar%He_pr(Pri_e,jj)=me%StVar%He_cs(Con_Ene,jj)/me%StVar%He_cs(Con_Mas,jj)-&
0.5_dp*me%StVar%He_pr(Pri_u,jj)**2
me%StVar%He_pr(Pri_R,jj)=me%StVar%He_cs(Con_R,jj)
if(R_Correction) then
call state_roE_withR(me%StVar%He_pr(Pri_ro,jj), me%StVar%He_pr(Pri_e,jj), &
me%StVar%He_pr(Pri_R,jj), PoutCP, ToutCP, coutCP)
else
call state_roE(me%StVar%He_pr(Pri_ro,jj), me%StVar%He_pr(Pri_e,jj), PoutCP, ToutCP, coutCP)
endif
if (ToutCP >= T_He_max .or. ToutCP <= T_He_min) then
call set_error('temperature out of EOS range in channel '//trim(me%HeProp%name))
return
end if
me%StVar%He_pr(Pri_p,jj)=PoutCP
me%StVar%He_pr(Pri_T,jj)=ToutCP
me%StVar%He_pr(Pri_c,jj)=coutCP
enddo
end subroutine from_sol_to_prim_channel