Changeset 3746 for trunk/LMDZ.GENERIC/libf
- Timestamp:
- Apr 29, 2025, 3:17:22 PM (8 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/interpolate_continuum.F90
r3713 r3746 53 53 54 54 character(len=512) :: line 55 character(len=21),parameter :: rname="interpolate_continuum" 55 56 56 57 integer i, pos, iT, iW, iB, count_norm, igas … … 224 225 write(*,*) 'https://web.lmd.jussieu.fr/~lmdz/planets/generic/datagcm/continuum_data/' 225 226 endif 226 call abort_physic( "interpolate_continuum","missing input file",1)227 call abort_physic(rname,"missing input file",1) 227 228 endif 228 229 … … 473 474 call interpolate_T_abs_coeff(z_temp,temp_arr_CO2CO2,num_T_CO2CO2,abs_coef,abs_arr_CO2CO2_VI(ind_WN,:)) 474 475 else 475 print*,'You must select visible (VI) or infrared (IR) c anal.'476 stop476 print*,'You must select visible (VI) or infrared (IR) channel.' 477 call abort_physic(rname,"CO2CO2 bad channel",1) 477 478 endif 478 479 elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_N2)) then … … 483 484 call interpolate_T_abs_coeff(z_temp,temp_arr_N2N2,num_T_N2N2,abs_coef,abs_arr_N2N2_VI(ind_WN,:)) 484 485 else 485 print*,'You must select visible (VI) or infrared (IR) c anal.'486 stop486 print*,'You must select visible (VI) or infrared (IR) channel.' 487 call abort_physic(rname,"N2N2 bad channel",1) 487 488 endif 488 489 elseif ((igas_X .eq. igas_O2) .and. (igas_Y .eq. igas_O2)) then … … 493 494 call interpolate_T_abs_coeff(z_temp,temp_arr_O2O2,num_T_O2O2,abs_coef,abs_arr_O2O2_VI(ind_WN,:)) 494 495 else 495 print*,'You must select visible (VI) or infrared (IR) c anal.'496 stop496 print*,'You must select visible (VI) or infrared (IR) channel.' 497 call abort_physic(rname,"O2O2 bad channel",1) 497 498 endif 498 499 elseif ((igas_X .eq. igas_CH4) .and. (igas_Y .eq. igas_CH4)) then … … 503 504 call interpolate_T_abs_coeff(z_temp,temp_arr_CH4CH4,num_T_CH4CH4,abs_coef,abs_arr_CH4CH4_VI(ind_WN,:)) 504 505 else 505 print*,'You must select visible (VI) or infrared (IR) c anal.'506 stop506 print*,'You must select visible (VI) or infrared (IR) channel.' 507 call abort_physic(rname,"CH4CH4 bad channel",1) 507 508 endif 508 509 elseif ((igas_X .eq. igas_H2) .and. (igas_Y .eq. igas_H2)) then … … 513 514 call interpolate_T_abs_coeff(z_temp,temp_arr_H2H2,num_T_H2H2,abs_coef,abs_arr_H2H2_VI(ind_WN,:)) 514 515 else 515 print*,'You must select visible (VI) or infrared (IR) c anal.'516 stop516 print*,'You must select visible (VI) or infrared (IR) channel.' 517 call abort_physic(rname,"H2H2 bad channel",1) 517 518 endif 518 519 elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_H2O)) then … … 523 524 call interpolate_T_abs_coeff(z_temp,temp_arr_H2OH2O,num_T_H2OH2O,abs_coef,abs_arr_H2OH2O_VI(ind_WN,:)) 524 525 else 525 print*,'You must select visible (VI) or infrared (IR) c anal.'526 stop526 print*,'You must select visible (VI) or infrared (IR) channel.' 527 call abort_physic(rname,"H2OH2O bad channel",1) 527 528 endif 528 529 elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_H2)) then … … 533 534 call interpolate_T_abs_coeff(z_temp,temp_arr_N2H2,num_T_N2H2,abs_coef,abs_arr_N2H2_VI(ind_WN,:)) 534 535 else 535 print*,'You must select visible (VI) or infrared (IR) c anal.'536 stop536 print*,'You must select visible (VI) or infrared (IR) channel.' 537 call abort_physic(rname,"N2H2 bad channel",1) 537 538 endif 538 539 elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_O2)) then … … 543 544 call interpolate_T_abs_coeff(z_temp,temp_arr_N2O2,num_T_N2O2,abs_coef,abs_arr_N2O2_VI(ind_WN,:)) 544 545 else 545 print*,'You must select visible (VI) or infrared (IR) c anal.'546 stop546 print*,'You must select visible (VI) or infrared (IR) channel.' 547 call abort_physic(rname,"N2O2 bad channel",1) 547 548 endif 548 549 elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_CH4)) then … … 553 554 call interpolate_T_abs_coeff(z_temp,temp_arr_N2CH4,num_T_N2CH4,abs_coef,abs_arr_N2CH4_VI(ind_WN,:)) 554 555 else 555 print*,'You must select visible (VI) or infrared (IR) c anal.'556 stop556 print*,'You must select visible (VI) or infrared (IR) channel.' 557 call abort_physic(rname,"N2CH4 bad channel",1) 557 558 endif 558 559 elseif ((igas_X .eq. igas_CO2) .and. (igas_Y .eq. igas_O2)) then … … 563 564 call interpolate_T_abs_coeff(z_temp,temp_arr_CO2O2,num_T_CO2O2,abs_coef,abs_arr_CO2O2_VI(ind_WN,:)) 564 565 else 565 print*,'You must select visible (VI) or infrared (IR) c anal.'566 stop566 print*,'You must select visible (VI) or infrared (IR) channel.' 567 call abort_physic(rname,"CO2O2 bad channel",1) 567 568 endif 568 569 elseif ((igas_X .eq. igas_H2) .and. (igas_Y .eq. igas_CH4)) then … … 573 574 call interpolate_T_abs_coeff(z_temp,temp_arr_H2CH4,num_T_H2CH4,abs_coef,abs_arr_H2CH4_VI(ind_WN,:)) 574 575 else 575 print*,'You must select visible (VI) or infrared (IR) c anal.'576 stop576 print*,'You must select visible (VI) or infrared (IR) channel.' 577 call abort_physic(rname,"H2CH4 bad channel",1) 577 578 endif 578 579 elseif ((igas_X .eq. igas_H2) .and. (igas_Y .eq. igas_He)) then … … 583 584 call interpolate_T_abs_coeff(z_temp,temp_arr_H2He,num_T_H2He,abs_coef,abs_arr_H2He_VI(ind_WN,:)) 584 585 else 585 print*,'You must select visible (VI) or infrared (IR) c anal.'586 stop586 print*,'You must select visible (VI) or infrared (IR) channel.' 587 call abort_physic(rname,"H2He bad channel",1) 587 588 endif 588 589 elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_N2)) then … … 593 594 call interpolate_T_abs_coeff(z_temp,temp_arr_H2ON2,num_T_H2ON2,abs_coef,abs_arr_H2ON2_VI(ind_WN,:)) 594 595 else 595 print*,'You must select visible (VI) or infrared (IR) c anal.'596 stop596 print*,'You must select visible (VI) or infrared (IR) channel.' 597 call abort_physic(rname,"H2ON2 bad channel",1) 597 598 endif 598 599 elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_O2)) then … … 603 604 call interpolate_T_abs_coeff(z_temp,temp_arr_H2OO2,num_T_H2OO2,abs_coef,abs_arr_H2OO2_VI(ind_WN,:)) 604 605 else 605 print*,'You must select visible (VI) or infrared (IR) c anal.'606 stop606 print*,'You must select visible (VI) or infrared (IR) channel.' 607 call abort_physic(rname,"H2OO2 bad channel",1) 607 608 endif 608 609 elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_CO2)) then … … 613 614 call interpolate_T_abs_coeff(z_temp,temp_arr_H2OCO2,num_T_H2OCO2,abs_coef,abs_arr_H2OCO2_VI(ind_WN,:)) 614 615 else 615 print*,'You must select visible (VI) or infrared (IR) c anal.'616 stop616 print*,'You must select visible (VI) or infrared (IR) channel.' 617 call abort_physic(rname,"H2OCO2 bad channel",1) 617 618 endif 618 619 elseif ((igas_X .eq. igas_CO2) .and. (igas_Y .eq. igas_H2)) then … … 623 624 call interpolate_T_abs_coeff(z_temp,temp_arr_CO2H2,num_T_CO2H2,abs_coef,abs_arr_CO2H2_VI(ind_WN,:)) 624 625 else 625 print*,'You must select visible (VI) or infrared (IR) c anal.'626 stop626 print*,'You must select visible (VI) or infrared (IR) channel.' 627 call abort_physic(rname,"CO2H2 bad channel",1) 627 628 endif 628 629 elseif ((igas_X .eq. igas_CO2) .and. (igas_Y .eq. igas_CH4)) then … … 633 634 call interpolate_T_abs_coeff(z_temp,temp_arr_CO2CH4,num_T_CO2CH4,abs_coef,abs_arr_CO2CH4_VI(ind_WN,:)) 634 635 else 635 print*,'You must select visible (VI) or infrared (IR) c anal.'636 stop636 print*,'You must select visible (VI) or infrared (IR) channel.' 637 call abort_physic(rname,"CO2CH4 bad channel",1) 637 638 endif 638 639 endif ! igas_X / igas_Y condition … … 777 778 print*, 'Maximum temperature is ', maxval(temp_arr), ' K' 778 779 endif 779 call abort_physic(rname,"temperature too low",1)780 call abort_physic(rname,"temperature too high",1) 780 781 else 781 782 z_temp=maxval(temp_arr) … … 803 804 804 805 integer iT 805 double precision z_temp806 integer num_T807 double precision temp_arr(num_T)808 809 double precision abs_coef810 double precision abs_arr(num_T)806 double precision,intent(in) :: z_temp 807 integer,intent(in) :: num_T 808 double precision,intent(in) :: temp_arr(num_T) 809 810 double precision,intent(out) :: abs_coef 811 double precision,intent(in) :: abs_arr(num_T) 811 812 812 813 ! Check where to interpolate … … 816 817 end do 817 818 819 ! If below lowest temperature in temp_arr() 820 if (iT==1) then 821 abs_coef=abs_arr(1) 822 return 823 endif 824 818 825 ! We proceed to a simple linear interpolation using the two most nearby temperatures 819 826 if(iT .lt. num_T) then 820 827 abs_coef=abs_arr(iT-1)+(abs_arr(iT)-abs_arr(iT-1))*(z_temp-temp_arr(iT-1))/(temp_arr(iT)-temp_arr(iT-1)) 821 828 else 829 ! If above highest temperature 822 830 abs_coef=abs_arr(iT) 823 831 endif
Note: See TracChangeset
for help on using the changeset viewer.