Changeset 25295


Ignore:
Timestamp:
07/20/20 23:24:15 (5 years ago)
Author:
adhikari
Message:

CHG: we extract Love kernels at planetary depth.

Location:
issm/trunk-jpl/src/c/modules/FourierLoveCorex
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/FourierLoveCorex/love_numbers.f90

    r22382 r25295  
    9090 character*40,     dimension(:),   pointer :: sourcs
    9191 integer,          dimension(:),   pointer :: indx,indx2
    92  integer :: nbc,nfext,ifreq,ntheta2,nphi2
     92 integer :: nbc,nfext,ifreq,ntheta2,nphi2,pp
    9393 double precision :: cst,prec, delta!,h1,h2,k1,k2,l1,l2,dh1,dh2,dk1,dk2,dl1,dl2
    9494 double precision :: he,ke,le
     
    9696 double complex :: loveh,lovel,lovek
    9797 logical :: logi
     98 integer :: nbc_init
    9899 integer :: i,j,k,n, fr,m,l, source_type
    99100 double complex :: hs(nfreq,degmax+1), ls(nfreq,degmax+1), ks(nfreq,degmax+1)
    100  
    101  double complex, dimension((nlayer+1)*6,1) :: lovekernels
     101 !double complex, dimension(nbc_init,1) :: lovekernels
     102 double complex, dimension(:,:), allocatable :: lovekernels
    102103 double complex :: lks(nfreq,(degmax+1)*(nlayer+1)*6)
    103104
     
    107108 pi=dacos(-1.d0)
    108109
    109 
    110110  open(unit=101, file='lastrun_log')
     111
    111112 cpu_count=0
    112113 cpu_count=cpu_count+1;call cpu_time(cpu_time1(cpu_count))
     
    129130 ! Test number of interfaces and of boundary conditions
    130131  nbc = 0
     132  lks=0.d0
    131133  !!! >>> SA: 01/27/2018 => following changes are made to retrieve love numbers at depth
    132134  !do i=1,nlayer+1
    133135 !if (radbc(i)) nbc=nbc+6
    134136  !enddo
    135   nbc = (nlayer+1)*6
     137  nbc_init = (nlayer+1)*6
     138  nbc=nbc_init
    136139  !!! >>> SA
    137140
     
    153156
    154157 nfext = 13 ! Number of potential excitation sources
    155  allocate( bc(nbc,nbc), indx(nbc) )
    156  allocate( f(nfext,nbc), sourcs(nfext) )
     158 allocate( lovekernels(nbc_init,1) )
     159 allocate( bc(nbc,nbc_init), indx(nbc_init) )
     160 allocate( f(nfext,nbc_init), sourcs(nfext) )
    157161
    158162 sourcs(1)='ICB --Volumetric Potential'
     
    187191 !allow_layer_del = .true.     ! Do we allow deletion of the central layers in the calculation if necessary?
    188192 layerrap = 1.d0  ! Max absolute ratio between love numbers at the top and bottom of the last layer
    189  
     193
    190194 ! Mode search parameters
    191195 freq0 = -1.d10
     
    212216
    213217 bc(:,:)=0.d0
     218
    214219 
    215220 
     
    227232        endif
    228233 deg=degmin-1
    229 
    230234
    231235
     
    242246  !write(*,*)
    243247  !!write(101,*), fr, T
    244 
    245 
    246 
    247248
    248249 do fr=1,nfreq
     
    289290   !print*,(deg)
    290291   bc(:,:)=0.d0
     292   lovekernels(:,1)=0.d0
    291293   call boundary_conditions_matrix(bc,indx,nbc)
    292294        !print*,'bc ok', layerrap
     
    295297   call solution(deg,bc,indx,f,sourcs,nfext,nbc,loveh,lovel,lovek,delta,lovekernels)
    296298
     299   !do i=1,nbc
     300   !   lks(fr,deg*nbc+i) = lovekernels(i)
     301   !end do
     302
    297303        !print*,'first_sol', layerrap, epsdb
    298304
    299305   ! Automatic reduction of the number of layers when the attenuation with depth becomes too strong
     306   allow_layer_del=.true.
     307   !allow_layer_del=.false.
    300308   if (allow_layer_del.eqv..true.) then
    301309
    302      do while ((layerrap<=epsdb).and.(nbc>12).or.(isnan(layerrap)) )
     310      print*, layerrap, epsdb, nbc
     311      !do while ((layerrap<=epsdb).and.(nbc>12*6).or.(isnan(layerrap)) )
     312      do while ((layerrap<=epsdb).and.(nbc>12).or.(isnan(layerrap)) )
     313     !do while ((layerrap<=epsdb).and.(nbc>12*(nlayer+1)).or.(isnan(layerrap)) ) ! SA: for love Kernels
    303314 !              print*,'trying to delete layer', layerrap, epsdb, nbc
    304315     !write(101,*)
     
    318329     end do
    319330     radbc(n) =.false.
     331     radbc(n+1) =.true.
    320332     !write(101,*) ' New start interface: ', radius(n+1)/1.d3,' km'
    321333     if (display) then
     
    323335     endif
    324336       
    325      deallocate( bc, indx, f, sourcs )
     337     deallocate( bc, indx, f, sourcs, lovekernels )
    326338     allocate( bc(nbc,nbc), indx(nbc) )
    327339     allocate( f(nfext,nbc), sourcs(nfext) )
    328  
     340   
     341     allocate( lovekernels(nbc,1) )
    329342
    330343     bc(:,:)=0.d0
     344     lovekernels(:,1)=0.d0
     345
    331346     call boundary_conditions_matrix(bc,indx,nbc)
    332347     call external_forcing(deg,f,sourcs,nfext,nbc)
     
    334349
    335350    end do
     351
     352      !do i=1,nbc
     353      !   pp = ((nlayer+1)*6 - nbc)/6
     354      !   lks(fr, deg*nbc + pp*6 + i) = lovekernels(i)
     355      !end do
     356
    336357   end if
    337358
     
    343364    !!! and love kernels
    344365    do i=1,nbc
    345       lks(fr,deg*nbc+i) = lovekernels(i,1)
     366      !lks(fr,deg*nbc+i) = lovekernels(i,1)
     367      lks(fr,(deg+1)*nbc_init+i-nbc) = lovekernels(i,1)
    346368    end do
    347     !!! for ks... 6th variable is y5 => love_k
    348     do i = 1,nbc/6
    349       lks(fr,deg*nbc+6*i) = lks(fr,deg*nbc+6*i) - (radius(i)/ra)**deg
    350     end do
    351369
    352370        !print*,dble(hs(fr,deg+1)), dimag(hs(fr,deg+1)),dble(ks(fr,deg+1)), dimag(ks(fr,deg+1))
  • issm/trunk-jpl/src/c/modules/FourierLoveCorex/lovenb_sub.f90

    r22478 r25295  
    4242       
    4343   if ((dlog10(1.d0/ra**dint(dble(deg)/10.d0)))<-250.d0) then
    44         valini=1.d-300!*complex(1.d0,1.d0)
     44        !valini=1.d-300!*complex(1.d0,1.d0)
     45           valini=10.d0**(-dble(150)/dble(nbc/6-1))!*complex(1.d0,1.d0)
    4546   else
    46         valini= 1.d0!*complex(1.d0,1.d0)
     47           valini= 1.d0!*complex(1.d0,1.d0)
    4748   endif
    4849
    49  
    5050  ! Which among the model interfaces is the first to display boundary conditions
    5151  ifirst = 0
     
    6060  !    and typing the matrix boundary conditions
    6161  ibc = 0   ! Counter of interfaces with boundary conditions
    62 
     62 
    6363  do i = ifirst,nlayer
    6464 
     
    8181      !!! >>> SA: 01/27/2018 => changes made to retrieve love numbers at depth
    8282                !!!if (radbc(i)) then
    83                 ystart(:)=0.d0
     83                ystart(:)= 0.d0
    8484                        ystart(j)= valini
    8585                        k=ibc+1
     
    9999                        jj = 6*k+j+is-3
    100100                        do kk=1,ny
    101                                 bc(ii+kk,jj) = ystart(kk)*one
     101            bc(ii+kk,jj) = ystart(kk)*one !/valini
    102102                        end do
    103103                !!!else
     
    149149  end do
    150150
    151 
    152151  !-- Internal sphere
    153152
     
    165164                  bc(nbc,nbc)=1.d0
    166165        end if
    167        
    168166
    169167        !print*, bc, imag_eval
     
    317315  logical :: ok
    318316
    319 
    320317  bcsav(:,:) = bc(:,:)
    321318  rads=0.d0
     
    323320  ldb=nbc
    324321
     322 ! open(unit=370,file='../temp')
     323 !  do i=1,nbc
     324 !     do j=1,nbc
     325 !        write(370,*), real(bc(i,j))
     326 !     end do
     327 !  end do
     328 ! close(370)
    325329
    326330  ifirst = 0
     
    362366        call ZGESV(nbc,1,bc,lda,ipiv,sc,ldb,info)
    363367
    364         if (info.ne.0) then
     368        if (info.ne.0) then
    365369                print*, 'Error in ZGESV : LAPACK linear equation solver couldn''t resolve the system'
    366370        end if
    367371   !!! >>> y1, y3, y5 at surface (by default)
     372        !loveh = sc(nbc-2,1)*ra*go0 !go_surf
     373        !lovel = sc(nbc-1,1)*ra*go0 !go_surf
    368374        loveh = sc(nbc-2,1)*ra*go_surf
    369375        lovel = sc(nbc-1,1)*ra*go_surf
     
    371377        delta = (1.d0-dble(n+1)/dble(n)*(lovek-1.d0)+2.d0/dble(n)*loveh)
    372378
    373    !!! >>> at depth [by SA on 1/31/2018]
    374    !!! sc outputs as follows (so scale it accordingly)
    375    !!!      y4 y2 y6 y1 y3 y5
    376    !!!      at center of mass of the earth (top row) => at surface (bottom row)
    377    !print *, nbc
    378    do j = 1,nbc/6
    379       !!! y4, y2, y6 are not scaled yet =>>> ask lambert ==>>>
    380       !love_kernels((j-1)*6+1,1) = sc((j-1)*6+1,1)               ! y4 NOT SCALED YET
    381       !love_kernels((j-1)*6+2,1) = sc((j-1)*6+2,1)               ! y2 NOT SCALED YET
    382       !love_kernels((j-1)*6+3,1) = sc((j-1)*6+3,1)               ! y6 NOT SCALED YET
    383       love_kernels((j-1)*6+4,1) = sc((j-1)*6+4,1)*ra*go_surf    ! y1 => love_h
    384       love_kernels((j-1)*6+5,1) = sc((j-1)*6+5,1)*ra*go_surf    ! y3 => love_l
    385       love_kernels((j-1)*6+6,1) = sc((j-1)*6+6,1)*ra*go0        ! y5 => love_k
    386       !if (deg==2) then
    387       !   print *, real(love_kernels((j-1)*6+1,1)), real(love_kernels((j-1)*6+4,1))
    388       !end if
    389    end do
    390    ! some reshuffling is needed for y4, y2, y6...
    391    do j = 2,nbc/6
    392       !!! y4, y2, y6 are not scaled yet =>>> ask lambert ==>>>
    393       love_kernels((j-2)*6+1,1) = sc((j-1)*6+1,1)               ! y4 NOT SCALED YET
    394       love_kernels((j-2)*6+2,1) = sc((j-1)*6+2,1)               ! y2 NOT SCALED YET
    395       love_kernels((j-2)*6+3,1) = sc((j-1)*6+3,1)               ! y6 NOT SCALED YET
    396    end do
    397    !!! these are surface values...
    398    love_kernels(nbc-5,1) = sc(1,1)               ! y4 NOT SCALED YET
    399    love_kernels(nbc-4,1) = sc(2,1)               ! y4 NOT SCALED YET
    400    love_kernels(nbc-3,1) = sc(3,1)               ! y4 NOT SCALED YET
    401  
    402    !print *, ' ************* '
    403    !if (deg==2) then
    404    !  do ibc=1,nbc/6
    405          !print *, real(sc( (ibc-1)*6+1:(ibc-1)*6+6 , 1))
    406    !      print *, real(love_kernels( (ibc-1)*6+1:(ibc-1)*6+6 , 1))
    407     !  end do
    408       !print *, ' ************* '
    409       !do ibc=1,nbc/6
    410       !   print *, real(love_kernels( (ibc-1)*6+1:(ibc-1)*6+6 , 1))
    411       !end do
    412       !print *, ' ************* '
    413       !print*, ra*go_surf, ra*go0, mu0
    414    !end if
    415    !!! >>> SA
     379   !print *, ra, go0, go_surf
     380
     381        do j=1,nbc
     382      if (j<nbc-2) then ! no need for valini restoration for surface.
     383         sc(j,1) = sc(j,1)*valini**((nbc-j-3)/6+1)
     384      endif
     385           love_kernels(j,1)=sc(j,1) !*valini
     386        end do
    416387
    417388        sumy2=0.d0
     
    426397
    427398
    428         ibc = 0
    429         do  j = nlayer,1,-1
    430                 if (radbc(j)) then
    431                         ibc=ibc+1
    432                         if (soliddim(j)) then
    433 
    434                                 loveh1 = sc(nbc - ibc*6 -3 +1,1)*ra*go_surf*valini
    435                                 lovel1 = sc(nbc -ibc*6 -3 +3,1)*ra*go_surf*valini
    436                                 lovek1 = sc(nbc -ibc*6 -3 +5,1)*ra*go0*valini
    437                         else
    438 
    439                                 sumh=0.d0
    440                                 suml=0.d0
    441                                 sumk=0.d0
    442                                 ii = nbc - (ibc+1)*6
    443                                 jj = nbc - (ibc+1)*6 -3
    444                                 if (j==ifirst) then
    445                                         icmin = 4
    446                                 else
    447                                         icmin = 1
    448                                 end if
    449                                 do ic=icmin,6
    450                                         sumh = sumh+bcsav(ii+1,jj+ic)*sc(jj+ic,1)
    451                                         suml = suml+bcsav(ii+3,jj+ic)*sc(jj+ic,1)
    452                                         sumk = sumk+bcsav(ii+5,jj+ic)*sc(jj+ic,1)
    453                                 end do
    454                                 loveh1 = sumh*ra*go_surf*valini
    455                                 lovel1 = suml*ra*go_surf*valini
    456                                 lovek1 = sumk*ra*go0*valini
    457 
    458                         end if                 
    459                         if (j==ifirst) then
    460 
    461                                 layerrap = zabs(loveh1s/loveh)
    462                                 if (layerrap > zabs(lovel1s/lovel)) layerrap = zabs(lovel1s/lovel)
    463                                 if (layerrap > zabs((lovek1s-(rads/ra)**deg)/(lovek-1.d0))) &
    464                                 layerrap = zabs((lovek1s-(rads/ra)**deg)/(lovek-1.d0))
    465                         endif
    466 
    467                         loveh1s = loveh1
    468                         lovel1s = lovel1
    469                         lovek1s = lovek1
    470                         rads = radius(j)
    471                         !if (radius(j)==rb) then
    472                         !        write(*,*) 'CMB ',n,loveh1,lovel1,lovek1-(rb/ra)**deg
    473                         !else if (radius(j)==rc) then
    474                         !        write(*,*) 'ICB ',n,loveh1,lovel1,lovek1-(rc/ra)**deg
    475                         !else
    476                         !       if (j<10) then
    477                         !                write(*,*) 'ITF-',j,n,loveh1,lovel1,lovek1-(radius(j)/ra)**deg
    478                         !       else
    479                         !                write(*,*) 'ITF-',j,n,loveh1,lovel1,lovek1-(radius(j)/ra)**deg
    480                         !       end if
    481                         !endif
    482                 end if
    483         end do
    484 
    485   end do
    486   end if
    487  
     399   !print*, '***********'
     400   !print*, radbc
     401   !print*, '***********'
     402
     403   loveh1 = sc(4,1)
     404   lovel1 = sc(6,1)
     405   lovek1 = sc(8,1) - (radius(nlayer-nbc/6+3)/ra)**deg/(go0*ra)
     406
     407   loveh1s = sc(nbc-2,1)
     408   lovel1s = sc(nbc-1,1)
     409   lovek1s = sc(nbc,1) - 1.d0/(go0*ra)
     410
     411   ! ratio of love_number_at_depth vs love_number_at_surface was compared
     412   ! the comparison is suited for two solid-layers.
     413   ! Not sure whether it works as well when we have a liquid layer at depth.
     414   layerrap = zabs(loveh1/loveh1s)
     415   if (zabs(lovel1/lovel1s) < layerrap) then
     416      layerrap = zabs(lovel1/lovel1s)
     417   endif
     418   if (zabs(lovek1/lovek1s) < layerrap) then
     419      layerrap = zabs(lovek1/lovek1s)
     420   endif
     421
     422   end do
     423   end if
     424 
     425   !open(unit=371,file='../temp2')
     426   !do i=1,nbc
     427   !   write(371,*), real(sc(i,1))
     428   !end do
     429   !close(371)
    488430
    489431 !301 format(a4,5x,'n=',i3,5x,'h=',f14.10,5x,'l=',f14.10,5x,'k=',f14.10)
  • issm/trunk-jpl/src/c/modules/FourierLoveCorex/model.f90

    r22382 r25295  
    6565 call earth_nlayers(1.d0,ro,la,mu,g,solid)
    6666   go_surf = g
     67   go0 = g !!! LC+SA: 07/20/2020.
    6768   ro_mean = 3.d0/4.d0*go_surf/(pi*GG*ra)
    6869        if (display) then
Note: See TracChangeset for help on using the changeset viewer.