! $Id$ ! ! This modules contains the routines for simulation with ! simple hydrogen ionization. ! !** AUTOMATIC CPARAM.INC GENERATION **************************** ! Declare (for generation of cparam.inc) the number of f array ! variables and auxiliary variables added by this module ! ! CPARAM logical, parameter :: leos = .true. ! ! MVAR CONTRIBUTION 0 ! MAUX CONTRIBUTION 2 ! ! PENCILS PROVIDED ss; gss(3); ee; pp; lnTT; cs2; cp; cp1; cp1tilde ! PENCILS PROVIDED glnTT(3); TT; TT1; gTT(3); yH; hss(3,3); hlnTT(3,3); del2TT; del6TT; del6lnTT ! PENCILS PROVIDED del2ss; del6ss; del2lnTT; cv; cv1; glnmumol(3); ppvap; csvap2 ! PENCILS PROVIDED rho_anel; rho1gpp(3) ! !*************************************************************** module EquationOfState ! use Cparam use Cdata use General, only: keep_compiler_quiet use Messages ! implicit none ! include 'eos.h' ! integers specifying which independent variables to use in eoscalc integer, parameter :: ilnrho_ss=1,ilnrho_ee=2,ilnrho_pp=3,ilnrho_lnTT=4 integer, parameter :: irho_ss=7, ilnrho_TT=9, irho_TT=10, ipp_ss=11 integer, parameter :: ipp_cs2=12 integer, parameter :: irho_eth=13, ilnrho_eth=14 ! secondary parameters calculated in initialize real :: TT_ion,lnTT_ion,TT_ion_,lnTT_ion_ real :: ss_ion,ee_ion,kappa0,xHe_term,ss_ion1,Srad0 real :: lnrho_e,lnrho_e_,lnrho_H,lnrho_He ! integer :: icp,ics integer :: ics ! namelist parameters real, parameter :: yHmin=tiny(TT_ion), yHmax=1-epsilon(TT_ion) real :: xHe=0.1 real :: yMetals=0 real :: yHacc=1e-5 !ajwm Moved here from Density.f90 !ajwm Completely irrelevant to eos_ionization but density and entropy need !ajwm reworking to be independent of these things first !ajwm can't use impossible else it breaks reading param.nml !ajwm SHOULDN'T BE HERE... But can wait till fully unwrapped real :: cs0=impossible, rho0=impossible, cp=impossible, cv=impossible real :: cs20=impossible, lnrho0=impossible logical :: lpp_as_aux=.false., lcp_as_aux=.false. real :: gamma=impossible, gamma_m1=impossible,gamma1=impossible real :: cs2bot=impossible, cs2top=impossible ! input parameters namelist /eos_init_pars/ xHe,yMetals,yHacc,lpp_as_aux,lcp_as_aux ! run parameters namelist /eos_run_pars/ xHe,yMetals,yHacc,lpp_as_aux,lcp_as_aux !ajwm Not sure this should exist either... integer :: imass=1 ! real, dimension(nchemspec,18) :: species_constants ! real :: Cp_const=impossible real :: Pr_number=0.7 logical :: lpres_grad=.false. ! contains !*********************************************************************** subroutine register_eos ! ! 2-feb-03/axel: adapted from Interstellar module ! 13-jun-03/tobi: re-adapted from visc_shock module ! use FArrayManager use Sub ! leos_ionization=.true. ! ! Set indices for auxiliary variables. ! call farray_register_auxiliary('yH',iyH) if (ilnTT==0) call farray_register_auxiliary('lnTT',ilnTT) ! ! Identify version number (generated automatically by SVN). ! if (lroot) call svn_id( & "$Id$") ! ! Writing files for use with IDL. ! aux_var(aux_count)=',yh $' aux_count=aux_count+1 if (naux < maux) aux_var(aux_count)=',lnTT $' if (naux == maux) aux_var(aux_count)=',lnTT' aux_count=aux_count+1 if (lroot) then write(15,*) 'yH = fltarr(mx,my,mz)*one' write(15,*) 'lnTT = fltarr(mx,my,mz)*one' endif ! endsubroutine register_eos !*********************************************************************** subroutine units_eos ! ! If unit_temperature hasn't been specified explictly in start.in, ! set it to 1 (Kelvin). ! ! 24-jun-06/tobi: coded ! if (unit_temperature==impossible) then if (lfix_unit_std) then unit_temperature=unit_density*unit_velocity**2/k_B_cgs else unit_temperature=1. endif endif ! endsubroutine units_eos !*********************************************************************** subroutine initialize_eos ! ! Perform any post-parameter-read initialization, e.g. set derived ! parameters. ! ! 2-feb-03/axel: adapted from Interstellar module ! use General use Mpicomm, only: stop_it use Sub, only: register_report_aux use SharedVariables,only: put_shared_variable ! real :: mu1yHxHe ! if (lroot) print*,'initialize_eos: ENTER' ! ! ionization parameters ! since m_e and chiH, as well as hbar are all very small ! it is better to divide m_e and chiH separately by hbar. ! mu1yHxHe=1+3.97153*xHe TT_ion=chiH/k_B lnTT_ion=log(TT_ion) TT_ion_=chiH_/k_B lnTT_ion_=log(chiH_/k_B) lnrho_e=1.5*log((m_e/hbar)*(chiH/hbar)/2./pi)+log(m_H)+log(mu1yHxHe) lnrho_H=1.5*log((m_H/hbar)*(chiH/hbar)/2./pi)+log(m_H)+log(mu1yHxHe) lnrho_He=1.5*log((m_He/hbar)*(chiH/hbar)/2./pi)+log(m_H)+log(mu1yHxHe) lnrho_e_=1.5*log((m_e/hbar)*(chiH_/hbar)/2./pi)+log(m_H)+log(mu1yHxHe) ss_ion=k_B/m_H/mu1yHxHe ss_ion1=1/ss_ion ee_ion=ss_ion*TT_ion kappa0=sigmaH_/m_H/mu1yHxHe/4.0 Srad0=sigmaSB*TT_ion**4.0D0/pi ! if (xHe>0) then xHe_term=xHe*(log(xHe)-lnrho_He) elseif (xHe<0) then call stop_it('initialize_eos: xHe lower than zero makes no sense') else xHe_term=0 endif ! ! pressure and cp as optional auxiliary variable ! if (lpp_as_aux) call register_report_aux('pp',ipp) if (lcp_as_aux) call register_report_aux('cp',icp) ! if (lroot.and.ip<14) then print*,'initialize_eos: reference values for ionization' print*,'initialize_eos: yHmin,yHmax,yMetals=',yHmin,yHmax,yMetals print*,'initialize_eos: TT_ion,ss_ion,kappa0=', & TT_ion,ss_ion,kappa0 print*,'initialize_eos: lnrho_e,lnrho_H,lnrho_He,lnrho_e_=', & lnrho_e,lnrho_H,lnrho_He,lnrho_e_ endif if (.not.ldensity) then call put_shared_variable('rho0',rho0,caller='initialize_eos') call put_shared_variable('lnrho0',lnrho0) endif ! ! write scale non-free constants to file; to be read by idl ! if (lroot) then open (1,file=trim(datadir)//'/pc_constants.pro',position="append") write (1,*) 'TT_ion=',TT_ion write (1,*) 'lnTT_ion=',lnTT_ion write (1,*) 'TT_ion_=',TT_ion_ write (1,*) 'lnTT_ion_=',lnTT_ion_ write (1,*) 'lnrho_e=',lnrho_e write (1,*) 'lnrho_H=',lnrho_H write (1,*) 'lnrho_p=',lnrho_H write (1,*) 'lnrho_He=',lnrho_He write (1,*) 'lnrho_e_=',lnrho_e_ write (1,*) 'ss_ion=',ss_ion write (1,*) 'ee_ion=',ee_ion write (1,*) 'kappa0=',kappa0 write (1,*) 'Srad0=',Srad0 write (1,*) 'k_B=',k_B write (1,*) 'm_H=',m_H close (1) endif ! endsubroutine initialize_eos !*********************************************************************** subroutine select_eos_variable(variable,findex) ! ! Calculate average particle mass in the gas relative to ! ! 02-apr-06/tony: implemented ! character (len=*), intent(in) :: variable integer, intent(in) :: findex ! call keep_compiler_quiet(variable) call keep_compiler_quiet(findex) ! DUMMY ideagas version below !! integer :: this_var=0 !! integer, save :: ieosvar=0 !! integer, save :: ieosvar_selected=0 !! integer, parameter :: ieosvar_lnrho = 1 !! integer, parameter :: ieosvar_rho = 2 !! integer, parameter :: ieosvar_ss = 4 !! integer, parameter :: ieosvar_lnTT = 8 !! integer, parameter :: ieosvar_TT = 16 !! integer, parameter :: ieosvar_cs2 = 32 !! integer, parameter :: ieosvar_pp = 64 !!! !! if (ieosvar>=2) & !! call fatal_error("select_eos_variable", & !! "2 thermodynamic quantities have already been defined while attempting to add a 3rd: ") !//variable) !! !! ieosvar=ieosvar+1 !! !!! select case (variable) !! if (variable=='ss') then !! this_var=ieosvar_ss !! if (findex<0) then !! leos_isentropic=.true. !! endif !! elseif (variable=='cs2') then !! this_var=ieosvar_cs2 !! if (findex==-2) then !! leos_localisothermal=.true. !! elseif (findex<0) then !! leos_isothermal=.true. !! endif !! elseif (variable=='lnTT') then !! this_var=ieosvar_lnTT !! if (findex<0) then !! leos_isothermal=.true. !! endif !! elseif (variable=='lnrho') then !! this_var=ieosvar_lnrho !! if (findex<0) then !! leos_isochoric=.true. !! endif !! elseif (variable=='rho') then !! this_var=ieosvar_rho !! if (findex<0) then !! leos_isochoric=.true. !! endif !! elseif (variable=='pp') then !! this_var=ieosvar_pp !! if (findex<0) then !! leos_isobaric=.true. !! endif !! else !! call fatal_error("select_eos_variable", & !! "unknown thermodynamic variable") !! endif !! if (ieosvar==1) then !! ieosvar1=findex !! ieosvar_selected=ieosvar_selected+this_var !! return !! endif !!! !!! Ensure the indexes are in the correct order. !!! !! if (this_var abs(dyHold*df) ) ! ! Bisection ! dyHold=dyH dyH=0.5*(yHhigh-yHlow) yH=yHhigh-dyH elsewhere ! ! Newton-Raphson ! dyHold=dyH dyH=f/df ! Apply floor to dyH (necessary to avoid negative yH in samples ! /0d-tests/heating_ionize) dyH=min(dyH,yH-yHmin) dyH=max(dyH,yH-yHmax) ! plausibly needed as well yH=yH-dyH endwhere endwhere where (abs(dyH)>max(yHacc,1e-31)*max(yH,1e-31)) ! use max to avoid underflow fractions1=1/(1+yH+xHe) lnTT_=(2.0/3.0)*((ss/ss_ion+(1-yH)*(log(1-yH+epsi)-lnrho_H) & +yH*(2*log(yH)-lnrho_e-lnrho_H) & +xHe_term)*fractions1+lnrho-2.5) TT1_=exp(-lnTT_) f=lnrho_e-lnrho+1.5*lnTT_-TT1_+log(1-yH+epsi)-2*log(yH) dlnTT_=((2.0/3.0)*(-f-TT1_)-1)*fractions1 df=dlnTT_*(1.5+TT1_)-1/(1-yH+epsi)-2/yH where (f<0) yHhigh=yH elsewhere yHlow=yH endwhere elsewhere found=.true. endwhere if (all(found)) return enddo ! endsubroutine rtsafe_pencil !*********************************************************************** subroutine rtsafe(ivars,var1,var2,yHlb,yHub,yH,rterror,rtdebug) ! ! safe newton raphson algorithm (adapted from NR) ! ! 09-apr-03/tobi: changed to subroutine ! integer, intent(in) :: ivars real, intent(in) :: var1,var2 real, intent(in) :: yHlb,yHub real, intent(inout) :: yH logical, intent(out), optional :: rterror logical, intent(in), optional :: rtdebug ! real :: dyHold,dyH,yHl,yHh,f,df,temp integer :: i integer, parameter :: maxit=1000 ! if (present(rterror)) rterror=.false. if (present(rtdebug)) then if (rtdebug) print*,'rtsafe: i,yH=',0,yH endif ! yHl=yHlb yHh=yHub dyH=1 dyHold=dyH ! call saha(ivars,var1,var2,yH,f,df) ! do i=1,maxit if (present(rtdebug)) then if (rtdebug) print*,'rtsafe: i,yH=',i,yH endif if ( sign(1.,((yH-yHl)*df-f)) & == sign(1.,((yH-yHh)*df-f)) & .or. abs(2*f) > abs(dyHold*df) ) then dyHold=dyH dyH=0.5*(yHl-yHh) yH=yHh+dyH if (yHh==yH) return else dyHold=dyH dyH=f/df temp=yH yH=yH-dyH if (temp==yH) return endif if (abs(dyH)0) yH_term=yH*(2*log(yH)-lnrho_e-lnrho_H) elsewhere yH_term=0 endwhere ! where (yH<1) one_yH_term=(1-yH)*(log(1-yH+epsi)-lnrho_H) elsewhere one_yH_term=0 endwhere ! ss=ss_ion*((1+yH+xHe)*(1.5*log(T0/TT_ion)-lnrho+2.5) & -yH_term-one_yH_term-xHe_term) ! f(l1:l2,m,n,iss)=ss ! enddo enddo ! endsubroutine isothermal_entropy !*********************************************************************** subroutine isothermal_lnrho_ss(f,T0,rho0) ! ! Isothermal stratification for lnrho and ss (for yH=0!) ! ! Currently only implemented for ionization_fixed. ! real, dimension(mx,my,mz,mfarray), intent(inout) :: f real, intent(in) :: T0,rho0 ! call keep_compiler_quiet(f) call keep_compiler_quiet(T0) call keep_compiler_quiet(rho0) ! endsubroutine isothermal_lnrho_ss !*********************************************************************** subroutine get_average_pressure(average_density,average_pressure) ! ! 01-dec-2009/piyali+dhruba: coded ! use Cdata ! real, intent(in):: average_density real, intent(out):: average_pressure ! call keep_compiler_quiet(average_density) call keep_compiler_quiet(average_pressure) ! endsubroutine get_average_pressure !*********************************************************************** subroutine bc_ss_flux(f,topbot,lone_sided) ! ! constant flux boundary condition for entropy (called when bcz='c1') ! ! 23-jan-2002/wolf: coded ! 11-jun-2002/axel: moved into the entropy module ! 8-jul-2002/axel: split old bc_ss into two ! 26-aug-2003/tony: distributed across ionization modules ! 3-oct-16/MR: added new optional switch lone_sided ! use Mpicomm, only: stop_it use Gravity use SharedVariables,only:get_shared_variable ! real, pointer :: Fbot,Ftop,FtopKtop,FbotKbot,hcond0,hcond1,chi logical, pointer :: lmultilayer, lheatc_chiconst ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f logical, optional :: lone_sided real, dimension (size(f,1),size(f,2)) :: tmp_xy,TT_xy,rho_xy,yH_xy integer :: i ! ! Do the `c1' boundary condition (constant heat flux) for entropy. ! check whether we want to do top or bottom (this is precessor dependent) ! ! Get the shared variables ! call get_shared_variable('hcond0',hcond0,caller='bc_ss_flux') call get_shared_variable('hcond1',hcond1) call get_shared_variable('Fbot',Fbot) call get_shared_variable('Ftop',Ftop) call get_shared_variable('FbotKbot',FbotKbot) call get_shared_variable('FtopKtop',FtopKtop) call get_shared_variable('chi',chi) call get_shared_variable('lmultilayer',lmultilayer) call get_shared_variable('lheatc_chiconst',lheatc_chiconst) ! select case (topbot) ! ! bottom boundary ! --------------- ! case ('bot') if (lmultilayer) then if (headtt) print*,'bc_ss_flux: Fbot,hcond=',Fbot,hcond0*hcond1 else if (headtt) print*,'bc_ss_flux: Fbot,hcond=',Fbot,hcond0 endif ! ! calculate Fbot/(K*cs2) ! rho_xy=exp(f(:,:,n1,ilnrho)) TT_xy=exp(f(:,:,n1,ilnTT)) ! ! check whether we have chi=constant at bottom, in which case ! we have the nonconstant rho_xy*chi in tmp_xy. ! if (lheatc_chiconst) then tmp_xy=Fbot/(rho_xy*chi*TT_xy) else tmp_xy=FbotKbot/TT_xy endif ! ! get ionization fraction at bottom boundary ! yH_xy=f(:,:,n1,iyH) ! ! enforce ds/dz + gamma_m1/gamma*dlnrho/dz = - gamma_m1/gamma*Fbot/(K*cs2) ! do i=1,nghost f(:,:,n1-i,iss)=f(:,:,n1+i,iss)+ss_ion*(1+yH_xy+xHe)* & (f(:,:,n1+i,ilnrho)-f(:,:,n1-i,ilnrho)+3*i*dz*tmp_xy) enddo ! ! top boundary ! ------------ ! case ('top') if (lmultilayer) then if (headtt) print*,'bc_ss_flux: Ftop,hcond=',Ftop,hcond0*hcond1 else if (headtt) print*,'bc_ss_flux: Ftop,hcond=',Ftop,hcond0 endif ! ! calculate Fbot/(K*cs2) ! rho_xy=exp(f(:,:,n2,ilnrho)) TT_xy=exp(f(:,:,n2,ilnTT)) ! ! check whether we have chi=constant at bottom, in which case ! we have the nonconstant rho_xy*chi in tmp_xy. ! if (lheatc_chiconst) then tmp_xy=Ftop/(rho_xy*chi*TT_xy) else tmp_xy=FtopKtop/TT_xy endif ! ! get ionization fraction at top boundary ! yH_xy=f(:,:,n2,iyH) ! ! enforce ds/dz + gamma_m1/gamma*dlnrho/dz = - gamma_m1/gamma*Fbot/(K*cs2) ! do i=1,nghost f(:,:,n2+i,iss)=f(:,:,n2-i,iss)+ss_ion*(1+yH_xy+xHe)* & (f(:,:,n2-i,ilnrho)-f(:,:,n2+i,ilnrho)-3*i*dz*tmp_xy) enddo ! case default print*,"bc_ss_flux: invalid argument" call stop_it("") endselect call keep_compiler_quiet(present(lone_sided)) ! endsubroutine bc_ss_flux !*********************************************************************** subroutine bc_ss_flux_turb(f,topbot) ! ! dummy routine ! ! 4-may-2009/axel: dummy routine ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_flux_turb !*********************************************************************** subroutine bc_ss_flux_turb_x(f,topbot) ! ! dummy routine ! ! 31-may-2010/pete: dummy routine ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_flux_turb_x !*********************************************************************** subroutine bc_ss_flux_condturb_x(f,topbot) ! ! 23-apr-2014/pete: dummy ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_flux_condturb_x !*********************************************************************** subroutine bc_ss_flux_condturb_mean_x(f,topbot) ! ! 07-jan-2015/pete: dummy ! character (len=3) :: topbot real, dimension (mx,my,mz,mfarray) :: f ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_flux_condturb_mean_x !*********************************************************************** subroutine bc_ss_flux_condturb_z(f,topbot) ! ! 15-jul-2014/pete: dummy ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_flux_condturb_z !*********************************************************************** subroutine bc_ss_temp_old(f,topbot) ! ! boundary condition for entropy: constant temperature ! ! 23-jan-2002/wolf: coded ! 11-jun-2002/axel: moved into the entropy module ! 8-jul-2002/axel: split old bc_ss into two ! 23-jun-2003/tony: implemented for leos_fixed_ionization ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_temp_old: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_temp_old !*********************************************************************** subroutine bc_ss_temp_x(f,topbot) ! ! boundary condition for entropy: constant temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_temp_x: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_temp_x !*********************************************************************** subroutine bc_ss_temp_y(f,topbot) ! ! boundary condition for entropy: constant temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_temp_y: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_temp_y !*********************************************************************** subroutine bc_ss_temp_z(f,topbot,lone_sided) ! ! boundary condition for entropy: constant temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f logical, optional :: lone_sided ! call stop_it("bc_ss_temp_z: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) call keep_compiler_quiet(present(lone_sided)) ! endsubroutine bc_ss_temp_z !*********************************************************************** subroutine bc_lnrho_temp_z(f,topbot) ! ! boundary condition for density: constant temperature ! ! 19-aug-2005/tobi: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_lnrho_temp_z: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_lnrho_temp_z !*********************************************************************** subroutine bc_lnrho_pressure_z(f,topbot) ! ! boundary condition for density: constant pressure ! ! 19-aug-2005/tobi: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_lnrho_pressure_z: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_lnrho_pressure_z !*********************************************************************** subroutine bc_ss_temp2_z(f,topbot) ! ! boundary condition for entropy: constant temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_temp2_z: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_temp2_z !*********************************************************************** subroutine bc_ss_temp3_z(f,topbot) ! ! 31-jan-2013/axel: coded to impose cs2bot and dcs2bot at bottom ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call fatal_error('bc_ss_temp3_z', & 'not implemented in eos_ionization') ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_temp3_z !*********************************************************************** subroutine bc_ss_stemp_x(f,topbot) ! ! boundary condition for entropy: symmetric temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_stemp_x: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_stemp_x !*********************************************************************** subroutine bc_ss_stemp_y(f,topbot) ! ! boundary condition for entropy: symmetric temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_stemp_y: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_stemp_y !*********************************************************************** subroutine bc_ss_stemp_z(f,topbot) ! ! boundary condition for entropy: symmetric temperature ! ! 26-sep-2003/tony: coded ! use Mpicomm, only: stop_it use Gravity ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f real, dimension (size(f,1),size(f,2),nghost) :: lnrho,ss,yH,lnTT,TT,K,sqrtK,yH_term,one_yH_term integer :: i ! ! Symmetric temperature/sound speed for entropy. ! This assumes that the density is already set (ie density _must_ register ! first!) ! ! check whether we want to do top or bottom (this is processor dependent) ! select case (topbot) ! ! bottom boundary ! case ('bot') do i=1,nghost f(:,:,n1-i,ilnTT) = f(:,:,n1+i,ilnTT) enddo ! lnrho=f(:,:,1:n1-1,ilnrho) lnTT=f(:,:,1:n1-1,ilnTT) TT=exp(lnTT) ! K=exp(lnrho_e-lnrho-TT_ion/TT)*(TT/TT_ion)**1.5 sqrtK=sqrt(K) yH=2*sqrtK/(sqrtK+sqrt(4+K)) ! where (yH>0) yH_term=yH*(2*log(yH)-lnrho_e-lnrho_H) elsewhere yH_term=0 endwhere ! where (yH<1) one_yH_term=(1-yH)*(log(1-yH+epsi)-lnrho_H) elsewhere one_yH_term=0 endwhere ! ss=ss_ion*((1+yH+xHe)*(1.5*log(TT/TT_ion)-lnrho+2.5) & -yH_term-one_yH_term-xHe_term) ! f(:,:,1:n1-1,iyH)=yH f(:,:,1:n1-1,iss)=ss ! ! top boundary ! case ('top') do i=1,nghost f(:,:,n2+i,ilnTT) = f(:,:,n2-i,ilnTT) enddo ! lnrho=f(:,:,n2+1:,ilnrho) lnTT =f(:,:,n2+1:,ilnTT) TT=exp(lnTT) ! K=exp(lnrho_e-lnrho-TT_ion/TT)*(TT/TT_ion)**1.5 sqrtK=sqrt(K) yH=2*sqrtK/(sqrtK+sqrt(4+K)) ! where (yH>0) yH_term=yH*(2*log(yH)-lnrho_e-lnrho_H) elsewhere yH_term=0 endwhere ! where (yH<1) one_yH_term=(1-yH)*(log(1-yH+epsi)-lnrho_H) elsewhere one_yH_term=0 endwhere ! ss=ss_ion*((1+yH+xHe)*(1.5*log(TT/TT_ion)-lnrho+2.5) & -yH_term-one_yH_term-xHe_term) ! f(:,:,n2+1:,iyH)=yH f(:,:,n2+1:,iss)=ss ! case default print*,"bc_ss_stemp_z: invalid argument" call stop_it("") endselect ! endsubroutine bc_ss_stemp_z !*********************************************************************** subroutine bc_ss_a2stemp_x(f,topbot) ! ! boundary condition for entropy: symmetric temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_a2stemp_x: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_a2stemp_x !*********************************************************************** subroutine bc_ss_a2stemp_y(f,topbot) ! ! boundary condition for entropy: symmetric temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_a2stemp_y: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_a2stemp_y !*********************************************************************** subroutine bc_ss_a2stemp_z(f,topbot) ! ! boundary condition for entropy: symmetric temperature ! ! 3-aug-2002/wolf: coded ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_ss_a2stemp_z: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_a2stemp_z !*********************************************************************** subroutine bc_ss_energy(f,topbot) ! ! boundary condition for entropy ! ! may-2002/nils: coded ! 11-jul-2002/nils: moved into the entropy module ! 26-aug-2003/tony: distributed across ionization modules ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! ! The 'ce' boundary condition for entropy makes the energy constant at ! the boundaries. ! This assumes that the density is already set (ie density must register ! first!) ! call stop_it("bc_ss_stemp_y: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_ss_energy !*********************************************************************** subroutine bc_stellar_surface(f,topbot) ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_stellar_surface: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_stellar_surface !*********************************************************************** subroutine bc_lnrho_cfb_r_iso(f,topbot) ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_lnrho_cfb_r_iso: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_lnrho_cfb_r_iso !*********************************************************************** subroutine bc_lnrho_hds_z_iso(f,topbot) ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_lnrho_hds_z_iso: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_lnrho_hds_z_iso !*********************************************************************** subroutine bc_lnrho_hdss_z_iso(f,topbot) ! use Mpicomm, only: stop_it ! character (len=3) :: topbot real, dimension (:,:,:,:) :: f ! call stop_it("bc_lnrho_hdss_z_iso: NOT IMPLEMENTED IN EOS_IONIZATION") ! call keep_compiler_quiet(f) call keep_compiler_quiet(topbot) ! endsubroutine bc_lnrho_hdss_z_iso !*********************************************************************** subroutine write_thermodyn ! endsubroutine write_thermodyn !*********************************************************************** subroutine read_thermodyn(input_file) ! character (len=*), intent(in) :: input_file ! call keep_compiler_quiet(input_file) ! endsubroutine read_thermodyn !*********************************************************************** subroutine read_species(input_file) ! character (len=*) :: input_file ! call keep_compiler_quiet(input_file) ! endsubroutine read_species !*********************************************************************** subroutine find_species_index(species_name,ind_glob,ind_chem,found_specie) ! integer, intent(out) :: ind_glob integer, intent(inout) :: ind_chem character (len=*), intent(in) :: species_name logical, intent(out) :: found_specie ! call keep_compiler_quiet(ind_glob) call keep_compiler_quiet(ind_chem) call keep_compiler_quiet(species_name) call keep_compiler_quiet(found_specie) ! endsubroutine find_species_index !*********************************************************************** subroutine find_mass(element_name,MolMass) ! character (len=*), intent(in) :: element_name real, intent(out) :: MolMass ! call keep_compiler_quiet(element_name) call keep_compiler_quiet(MolMass) ! endsubroutine find_mass !*********************************************************************** subroutine get_stratz(z, rho0z, dlnrho0dz, eth0z) ! ! Get background stratification in z direction. ! ! 13-oct-14/ccyang: dummy ! real, dimension(:), intent(in) :: z real, dimension(:), intent(out), optional :: rho0z, dlnrho0dz, eth0z ! call fatal_error('get_stratz', 'Stratification for this EOS is not implemented. ') ! call keep_compiler_quiet(z) if (present(rho0z)) call keep_compiler_quiet(rho0z) if (present(dlnrho0dz)) call keep_compiler_quiet(dlnrho0dz) if (present(eth0z)) call keep_compiler_quiet(eth0z) ! endsubroutine get_stratz !*********************************************************************** subroutine pushdiags2c(p_diag) integer, parameter :: n_diags=0 integer(KIND=ikind8), dimension(:) :: p_diag call keep_compiler_quiet(p_diag) endsubroutine pushdiags2c !*********************************************************************** subroutine pushpars2c(p_par) use Syscalls, only: copy_addr integer, parameter :: n_pars=1 integer(KIND=ikind8), dimension(n_pars) :: p_par call copy_addr(cs20,p_par(1)) endsubroutine pushpars2c !*********************************************************************** endmodule EquationOfState