c Fichier INCLUDE de resout.f: ajustements du pas temporel pour atteindre divers c objectifs Ex: rayon, Teff, L c arrèts sur R, T, Xc, He core : on ajuste que si ajuste =.TRUE. c ajuste= suffixe A dans la NAMELIST precision c avec ajuste=.FALSE. on arrète dès que la valeur requise est traversée c arrèt sur x_stop à 10^-4 près, no_last: ce n'est pas le modèle à calculer IR12: IF(x_ajuste .AND. no_last)THEN c si au temps t, X <= Xstop IR36: IF(chim_t(1,1) <= x_stopm)THEN SELECT CASE(langue) CASE('english') WRITE(usl_static,1133)chim_t(1,1),x_stopm WRITE(2,1133)chim_t(1,1),x_stopm 1133 FORMAT(/,'STOP, a time t, Xc_t=',es10.3, 1 ' is still lesser than Xstop=',es10.3) CASE DEFAULT WRITE(usl_static,133)chim_t(1,1),x_stopm WRITE(2,133)chim_t(1,1),x_stopm 133 FORMAT(/,'ARRET, au temps t, Xc_t=',es10.3, 1 ' est déjà inférieur à Xstop=',es10.3) END SELECT CALL sortie('ajustements 1') ENDIF IR36 c si on a traversé x_stop d1=chim_t(1,1)-x_stopm d2=chim(1,1)-x_stopm lx_stop=d1*d2 <= 0.d0 IR35: IF(lx_stop)THEN c on affine la localisation, ajuste= suffixe A dans la NAMELIST precision c avec ajuste=.FALSE. on arrètera dès que la valeur requise est traversée IR22: IF(ajuste)THEN c la précision d'ajustement est-elle atteinte? IR23: IF(ABS(d2) > dx_tams)THEN c on affine la localisation dt=dt*(x_stopm-chim_t(1,1))/(chim(1,1)-chim_t(1,1)) SELECT CASE(langue) CASE('english') WRITE(usl_static,1124)dt,x_stop,chim_t(1,1)*nucleo(1), 1 chim(1,1)*nucleo(1) WRITE(2,1124)dt,x_stop,chim_t(1,1)*nucleo(1), 1 chim(1,1)*nucleo(1) 1124 FORMAT(/,'adjustement of the time step to get Xc=x_stop', 1 /,'dt=',es10.3,', X stop=',es10.3,', X(t)=',es10.3, 2 ', X(t+dt)=',es10.3) CASE DEFAULT WRITE(usl_static,124)dt,x_stop,chim_t(1,1)*nucleo(1), 1 chim(1,1)*nucleo(1) WRITE(2,124)dt,x_stop,chim_t(1,1)*nucleo(1), 1 chim(1,1)*nucleo(1) 124 FORMAT(/,'ajustement du pas temp. pour avoir Xc=x_stop', 1 /,'dt=',es10.3,', X arret=',es10.3,', X(t)=',es10.3, 2 ', X(t+dt)=',es10.3) END SELECT CALL update(.FALSE.,dt,dts) IF(l_pertm .OR. l_pertmt)CALL pertm(dt) compt=0 ; err=1.d20 ; new_rep=.FALSE. CYCLE Bnr1 ENDIF IR23 c si besoin reprise du dernier modèle avec le max. de couches et même dt c no_last: ce n'est pas le dernier modèle à calculer IR30: IF(nc_max .AND. n_qs < n_max)THEN CALL update(.FALSE.,dt,dts) ; CALL fcmax(cmax) no_last=.FALSE. SELECT CASE(langue) CASE('english') WRITE(usl_static,1130)n_max ; WRITE(2,1130)n_max CASE DEFAULT WRITE(usl_static,130)n_max ; WRITE(2,130)n_max END SELECT c PRINT*,n_qs,n_max,no_last,cmax compt=0 ; err=1.d20 ; new_rep=.FALSE. CYCLE Bnr1 ENDIF IR30 ENDIF IR22 ENDIF IR35 ENDIF IR12 c t_ajuste: arrêt sur T_stop, no_last: ce n'est pas le dernier modèle IR14: IF(t_ajuste .AND. no_last)THEN c si on a traversé T_stop d1=1.d0-bp_t(2,1)/lnt_stop d2=1.d0-bp(2,1)/lnt_stop lt_stop=d1*d2 <= 0.d0 IR24: IF(lt_stop)THEN c PRINT*,ajuste,lt_stop,d2 ; PAUSE'ajusteT' c on affine la localisation, ajuste= suffixe A dans la NAMELIST precision c avec ajuste=.FALSE. on arrêtera dès que la valeur requise est traversée IR25: IF(ajuste)THEN c la précision d'ajustement est-elle atteinte? IR34: IF(ABS(d2) > 5.d-5)THEN dt=dt*(lnt_stop-bp_t(2,1))/(bp(2,1)-bp_t(2,1)) SELECT CASE(langue) CASE('english') WRITE(usl_static,1125)dt,t_stop,EXP(bp_t(2,1)),EXP(bp(2,1)) WRITE(2,1125)dt,t_stop,EXP(bp_t(2,1)),EXP(bp(2,1)) 1125 FORMAT(/,'adjustement of the time step to get Tc=t_stop', 1 /,'dt=',es10.3,', t stop=',es10.3,', T(t)=',es10.3, 2 ', T(t+dt)=',es10.3) CASE DEFAULT WRITE(usl_static,125)dt,t_stop,EXP(bp_t(2,1)),EXP(bp(2,1)) WRITE(2,125)dt,t_stop,EXP(bp_t(2,1)),EXP(bp(2,1)) 125 FORMAT(/,'ajustement du pas temp. pour avoir Tc=t_stop', 1 /,'dt=',es10.3,', T arret=',es10.3,', T(t)=',es10.3, 2 ', T(t+dt)=',es10.3) END SELECT CALL update(.FALSE.,dt,dts) compt=0 ; err=1.d20 ; new_rep=.FALSE. CYCLE Bnr1 ENDIF IR34 ENDIF IR25 c si besoin reprise du dernier modèle avec le max. de couches et même dt c nc_max: on calcule un modèle avec le maximum de couches IR29: IF(nc_max .AND. n_qs < n_max)THEN CALL update(.FALSE.,dt,dts) ; CALL fcmax(cmax) no_last=.FALSE. SELECT CASE(langue) CASE('english') WRITE(usl_static,1130)n_max ; WRITE(2,1130)n_max 1130 FORMAT(/,'Last model, number of shells --> n_max=',i5) CASE DEFAULT WRITE(usl_static,130)n_max ; WRITE(2,130)n_max 130 FORMAT(/,'dernier modèle, nombre de couches, n_max=',i5) END SELECT compt=0 ; err=1.d20 ; new_rep=.FALSE. CYCLE Bnr1 ENDIF IR29 ENDIF IR24 ENDIF IR14 c arrèt sur He_core : si X < xtams au niveau de la masse hhe_core c on ajuste que si ajuste =.TRUE. c avec ajuste=.FALSE. on arrète dès que la valeur requise est traversée IR15: IF(he_ajuste)THEN c si on a traversé x_tams au niveau du He_core CALL bsp1dn(nchim,chim,mc,mct,n_ch,m_ch, 1 knotc,.TRUE.,hhe_core,lq,xchim,dxchim) IF(no_croiss)PRINT*,'Pb. at 01 in ajustements' CALL bsp1dn(nchim,chim_t,mc_t,mct_t,n_ch_t,m_ch, 1 knotc_t,.TRUE.,hhe_core,lq,xchim_t,dxchim) IF(no_croiss)PRINT*,'Pb. at 02 in ajustements' IR26: IF(xchim_t(1) > x_tams .AND. xchim(1) <= x_tams)THEN c le He core est nécessairement plus grand qu'un core convectif avec X < X TAMS IR27: IF(m_zc(1) > he_core .AND. .NOT.lconv(1))THEN SELECT CASE(langue) CASE('english') WRITE(usl_static,1127)he_core,m_zc(1) WRITE(2,1127)he_core,m_zc(1) 1127 FORMAT(/,'STOP, in the convective core X ~ X TAMS',/, 1 'unconsistency : He core =',es10.3,' < M_zc =',es10.3) CASE DEFAULT WRITE(usl_static,127)he_core,m_zc(1) WRITE(2,127)he_core,m_zc(1) 127 FORMAT(/,'ARRET, dans le coeur conv. X ~ X TAMS,',/, 1 'incompatibilité : He core =',es10.3,' < M_zc =',es10.3) END SELECT CALL sortie('ajustements 2') ENDIF IR27 lhe_stop=ABS(xchim(1)-x_tams) < dx_tams c on affine la localisation IR28: IF(ajuste .AND. .NOT.lhe_stop)THEN dt=dt*(x_tamsm-xchim_t(1))/(xchim(1)-xchim_t(1)) SELECT CASE(langue) CASE('english') WRITE(usl_static,1126)dt,xchim_t(1),he_core,xchim(1) WRITE(2,1126)dt,xchim_t(1),he_core,xchim(1) 1126 FORMAT(/,'adjustement of the time step to fit the He core', 1 /,'dt=',es10.3,', X(t)=',es10.3,', he core=',es10.3, 2 ', X(t+dt)=',es10.3) CASE DEFAULT WRITE(usl_static,126)dt,xchim_t(1),he_core,xchim(1) WRITE(2,126)dt,xchim_t(1),he_core,xchim(1) 126 FORMAT(/,'ajustement du pas temporel pour le He core', /, 1 'dt=',es10.3,', X(t)=',es10.3,', he core=',es10.3, 2 ', X(t+dt)=',es10.3) END SELECT CALL update(.FALSE.,dt,dts) compt=0 ; err=1.d20 ; new_rep=.FALSE. CYCLE Bnr1 ENDIF IR28 ENDIF IR26 ENDIF IR15 c arrèt sur R_stop, on ajuste que si ajuste =.TRUE. c avec ajuste=.FALSE. on arrète dès que la valeur requise est traversée c sauf pour le modèle ultime après ajustement pour lequel no_last=.FALSE. c PRINT*,r_ajuste,ajuste,no_last,nc_max c WRITE(*,2000)rstar_t,rstar,r_stop ; PAUSE'r_stop' IR17: IF(r_ajuste .AND. no_last)THEN d1=1.d0-rstar_t/r_stop d2=1.d0-rstar/r_stop c PRINT*,'d1,d2,d1*d2,rstar_t,rstar,r_stop,dt' c WRITE(*,2000)d1,d2,d1*d2,rstar_t,rstar,r_stop,dt c si on a traversé R_stop lr_stop=d1*d2 <= 0.d0 IR19: IF(lr_stop)THEN c PRINT*,ajuste,lr_stop,d2 ; PAUSE'ajuste R' c avec ajuste=.FALSE. on arrète dès que la valeur requise est traversée c ajustement, ajuste= suffixe A dans la NAMELIST precision IR18: IF(ajuste)THEN c la précision d'ajustement est-elle atteinte? IR20: IF(ABS(d2) > 1.d-3)THEN dt=ABS(dt*d1/(d2-d1)) SELECT CASE(langue) CASE('english') WRITE(usl_static,1128)dt,r_stop,rstar_t,rstar WRITE(2,1128)dt,r_stop,rstar_t,rstar 1128 FORMAT(/,'adjustement of the time step to get R_stop',/, 1 'dt=',es10.3,', R_stop=',es10.3,', R(t)=',es10.3, 2 ', R(t+dt)=',es10.3) CASE DEFAULT WRITE(usl_static,128)dt,r_stop,rstar_t,rstar WRITE(2,128)dt,r_stop,rstar_t,rstar 128 FORMAT(/,'ajustement du pas temp. pour avoir R_stop',/, 1 'dt=',es10.3,', R_arret=',es10.3,', R(t)=',es10.3, 2 ', R(t+dt)=',es10.3) END SELECT c PRINT*,'dt,d1,d2,d1-d2',lr_stop c WRITE(*,2000)dt,d1,d2,d1-d2 ; PAUSE'new dt' c modèle avec le nouveau dt CALL update(.FALSE.,dt,dts) compt=0 ; err=1.d20 ; new_rep=.FALSE. CYCLE Bnr1 ENDIF IR20 ENDIF IR18 c si besoin reprise du dernier modèle avec le max. de couches et même dt IR21: IF(nc_max .AND. n_qs < n_max)THEN CALL update(.FALSE.,dt,dts) ; CALL fcmax(cmax) no_last=.FALSE. SELECT CASE(langue) CASE('english') WRITE(usl_static,1130)n_max ; WRITE(2,1130)n_max CASE DEFAULT WRITE(usl_static,130)n_max ; WRITE(2,130)n_max END SELECT c PRINT*,n_qs,n_max,no_last,cmax compt=0 ; err=1.d20 ; new_rep=.FALSE. CYCLE Bnr1 ENDIF IR21 ENDIF IR19 ENDIF IR17