Changeset 25295
- Timestamp:
- 07/20/20 23:24:15 (5 years ago)
- 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 90 90 character*40, dimension(:), pointer :: sourcs 91 91 integer, dimension(:), pointer :: indx,indx2 92 integer :: nbc,nfext,ifreq,ntheta2,nphi2 92 integer :: nbc,nfext,ifreq,ntheta2,nphi2,pp 93 93 double precision :: cst,prec, delta!,h1,h2,k1,k2,l1,l2,dh1,dh2,dk1,dk2,dl1,dl2 94 94 double precision :: he,ke,le … … 96 96 double complex :: loveh,lovel,lovek 97 97 logical :: logi 98 integer :: nbc_init 98 99 integer :: i,j,k,n, fr,m,l, source_type 99 100 double complex :: hs(nfreq,degmax+1), ls(nfreq,degmax+1), ks(nfreq,degmax+1) 100 101 double complex, dimension( (nlayer+1)*6,1):: lovekernels101 !double complex, dimension(nbc_init,1) :: lovekernels 102 double complex, dimension(:,:), allocatable :: lovekernels 102 103 double complex :: lks(nfreq,(degmax+1)*(nlayer+1)*6) 103 104 … … 107 108 pi=dacos(-1.d0) 108 109 109 110 110 open(unit=101, file='lastrun_log') 111 111 112 cpu_count=0 112 113 cpu_count=cpu_count+1;call cpu_time(cpu_time1(cpu_count)) … … 129 130 ! Test number of interfaces and of boundary conditions 130 131 nbc = 0 132 lks=0.d0 131 133 !!! >>> SA: 01/27/2018 => following changes are made to retrieve love numbers at depth 132 134 !do i=1,nlayer+1 133 135 !if (radbc(i)) nbc=nbc+6 134 136 !enddo 135 nbc = (nlayer+1)*6 137 nbc_init = (nlayer+1)*6 138 nbc=nbc_init 136 139 !!! >>> SA 137 140 … … 153 156 154 157 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) ) 157 161 158 162 sourcs(1)='ICB --Volumetric Potential' … … 187 191 !allow_layer_del = .true. ! Do we allow deletion of the central layers in the calculation if necessary? 188 192 layerrap = 1.d0 ! Max absolute ratio between love numbers at the top and bottom of the last layer 189 193 190 194 ! Mode search parameters 191 195 freq0 = -1.d10 … … 212 216 213 217 bc(:,:)=0.d0 218 214 219 215 220 … … 227 232 endif 228 233 deg=degmin-1 229 230 234 231 235 … … 242 246 !write(*,*) 243 247 !!write(101,*), fr, T 244 245 246 247 248 248 249 do fr=1,nfreq … … 289 290 !print*,(deg) 290 291 bc(:,:)=0.d0 292 lovekernels(:,1)=0.d0 291 293 call boundary_conditions_matrix(bc,indx,nbc) 292 294 !print*,'bc ok', layerrap … … 295 297 call solution(deg,bc,indx,f,sourcs,nfext,nbc,loveh,lovel,lovek,delta,lovekernels) 296 298 299 !do i=1,nbc 300 ! lks(fr,deg*nbc+i) = lovekernels(i) 301 !end do 302 297 303 !print*,'first_sol', layerrap, epsdb 298 304 299 305 ! 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. 300 308 if (allow_layer_del.eqv..true.) then 301 309 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 303 314 ! print*,'trying to delete layer', layerrap, epsdb, nbc 304 315 !write(101,*) … … 318 329 end do 319 330 radbc(n) =.false. 331 radbc(n+1) =.true. 320 332 !write(101,*) ' New start interface: ', radius(n+1)/1.d3,' km' 321 333 if (display) then … … 323 335 endif 324 336 325 deallocate( bc, indx, f, sourcs )337 deallocate( bc, indx, f, sourcs, lovekernels ) 326 338 allocate( bc(nbc,nbc), indx(nbc) ) 327 339 allocate( f(nfext,nbc), sourcs(nfext) ) 328 340 341 allocate( lovekernels(nbc,1) ) 329 342 330 343 bc(:,:)=0.d0 344 lovekernels(:,1)=0.d0 345 331 346 call boundary_conditions_matrix(bc,indx,nbc) 332 347 call external_forcing(deg,f,sourcs,nfext,nbc) … … 334 349 335 350 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 336 357 end if 337 358 … … 343 364 !!! and love kernels 344 365 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) 346 368 end do 347 !!! for ks... 6th variable is y5 => love_k348 do i = 1,nbc/6349 lks(fr,deg*nbc+6*i) = lks(fr,deg*nbc+6*i) - (radius(i)/ra)**deg350 end do351 369 352 370 !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 42 42 43 43 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) 45 46 else 46 valini= 1.d0!*complex(1.d0,1.d0)47 valini= 1.d0!*complex(1.d0,1.d0) 47 48 endif 48 49 49 50 50 ! Which among the model interfaces is the first to display boundary conditions 51 51 ifirst = 0 … … 60 60 ! and typing the matrix boundary conditions 61 61 ibc = 0 ! Counter of interfaces with boundary conditions 62 62 63 63 do i = ifirst,nlayer 64 64 … … 81 81 !!! >>> SA: 01/27/2018 => changes made to retrieve love numbers at depth 82 82 !!!if (radbc(i)) then 83 ystart(:)= 0.d083 ystart(:)= 0.d0 84 84 ystart(j)= valini 85 85 k=ibc+1 … … 99 99 jj = 6*k+j+is-3 100 100 do kk=1,ny 101 bc(ii+kk,jj) = ystart(kk)*one 101 bc(ii+kk,jj) = ystart(kk)*one !/valini 102 102 end do 103 103 !!!else … … 149 149 end do 150 150 151 152 151 !-- Internal sphere 153 152 … … 165 164 bc(nbc,nbc)=1.d0 166 165 end if 167 168 166 169 167 !print*, bc, imag_eval … … 317 315 logical :: ok 318 316 319 320 317 bcsav(:,:) = bc(:,:) 321 318 rads=0.d0 … … 323 320 ldb=nbc 324 321 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) 325 329 326 330 ifirst = 0 … … 362 366 call ZGESV(nbc,1,bc,lda,ipiv,sc,ldb,info) 363 367 364 if (info.ne.0) then368 if (info.ne.0) then 365 369 print*, 'Error in ZGESV : LAPACK linear equation solver couldn''t resolve the system' 366 370 end if 367 371 !!! >>> 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 368 374 loveh = sc(nbc-2,1)*ra*go_surf 369 375 lovel = sc(nbc-1,1)*ra*go_surf … … 371 377 delta = (1.d0-dble(n+1)/dble(n)*(lovek-1.d0)+2.d0/dble(n)*loveh) 372 378 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 416 387 417 388 sumy2=0.d0 … … 426 397 427 398 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) 488 430 489 431 !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 65 65 call earth_nlayers(1.d0,ro,la,mu,g,solid) 66 66 go_surf = g 67 go0 = g !!! LC+SA: 07/20/2020. 67 68 ro_mean = 3.d0/4.d0*go_surf/(pi*GG*ra) 68 69 if (display) then
Note:
See TracChangeset
for help on using the changeset viewer.