Skip to content

Commit 5444b69

Browse files
authored
Merge pull request #1790 from aakash10gupta/devel
Writing and reading of general anisotropy parameters to and from binary format gll model files
2 parents f019883 + abdf54a commit 5444b69

File tree

2 files changed

+395
-3
lines changed

2 files changed

+395
-3
lines changed

src/generate_databases/model_gll.f90

Lines changed: 285 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ subroutine model_gll(myrank,nspec,LOCAL_PATH)
3939

4040
use constants, only: NGLLX,NGLLY,NGLLZ,FOUR_THIRDS,IMAIN,MAX_STRING_LEN,IIN
4141

42-
use generate_databases_par, only: ATTENUATION
42+
use generate_databases_par, only: ANISOTROPY, ATTENUATION
4343

44-
use create_regions_mesh_ext_par, only: rhostore,kappastore,mustore,rho_vp,rho_vs,qkappa_attenuation_store,qmu_attenuation_store
44+
use create_regions_mesh_ext_par, only: rhostore,kappastore,mustore,rho_vp,rho_vs,qkappa_attenuation_store,qmu_attenuation_store, &
45+
c11store,c12store,c13store,c14store,c15store,c16store, &
46+
c22store,c23store,c24store,c25store,c26store, &
47+
c33store,c34store,c35store,c36store, &
48+
c44store,c45store,c46store, &
49+
c55store,c56store, &
50+
c66store
4551

4652
use shared_parameters, only: ADIOS_FOR_MESH,HDF5_ENABLED
4753

@@ -173,6 +179,283 @@ subroutine model_gll(myrank,nspec,LOCAL_PATH)
173179
rho_vp(:,:,:,:) = rhostore(:,:,:,:) * vp_read(:,:,:,:)
174180
rho_vs(:,:,:,:) = rhostore(:,:,:,:) * vs_read(:,:,:,:)
175181

182+
if (ANISOTROPY) then
183+
184+
! c11
185+
if (myrank == 0) write(IMAIN,*) ' reading in: c11.bin'
186+
187+
filename = prname_lp(1:len_trim(prname_lp))//'c11.bin'
188+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
189+
if (ier /= 0) then
190+
print *,'Error opening file: ',trim(filename)
191+
stop 'Error reading c11.bin file'
192+
endif
193+
194+
read(IIN) c11store
195+
close(IIN)
196+
197+
! c12
198+
if (myrank == 0) write(IMAIN,*) ' reading in: c12.bin'
199+
200+
filename = prname_lp(1:len_trim(prname_lp))//'c12.bin'
201+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
202+
if (ier /= 0) then
203+
print *,'Error opening file: ',trim(filename)
204+
stop 'Error reading c12.bin file'
205+
endif
206+
207+
read(IIN) c12store
208+
close(IIN)
209+
210+
! c13
211+
if (myrank == 0) write(IMAIN,*) ' reading in: c13.bin'
212+
213+
filename = prname_lp(1:len_trim(prname_lp))//'c13.bin'
214+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
215+
if (ier /= 0) then
216+
print *,'Error opening file: ',trim(filename)
217+
stop 'Error reading c13.bin file'
218+
endif
219+
220+
read(IIN) c13store
221+
close(IIN)
222+
223+
! c14
224+
if (myrank == 0) write(IMAIN,*) ' reading in: c14.bin'
225+
226+
filename = prname_lp(1:len_trim(prname_lp))//'c14.bin'
227+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
228+
if (ier /= 0) then
229+
print *,'Error opening file: ',trim(filename)
230+
stop 'Error reading c14.bin file'
231+
endif
232+
233+
read(IIN) c14store
234+
close(IIN)
235+
236+
! c15
237+
if (myrank == 0) write(IMAIN,*) ' reading in: c15.bin'
238+
239+
filename = prname_lp(1:len_trim(prname_lp))//'c15.bin'
240+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
241+
if (ier /= 0) then
242+
print *,'Error opening file: ',trim(filename)
243+
stop 'Error reading c15.bin file'
244+
endif
245+
246+
read(IIN) c15store
247+
close(IIN)
248+
249+
! c16
250+
if (myrank == 0) write(IMAIN,*) ' reading in: c16.bin'
251+
252+
filename = prname_lp(1:len_trim(prname_lp))//'c16.bin'
253+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
254+
if (ier /= 0) then
255+
print *,'Error opening file: ',trim(filename)
256+
stop 'Error reading c16.bin file'
257+
endif
258+
259+
read(IIN) c16store
260+
close(IIN)
261+
262+
! c22
263+
if (myrank == 0) write(IMAIN,*) ' reading in: c22.bin'
264+
265+
filename = prname_lp(1:len_trim(prname_lp))//'c22.bin'
266+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
267+
if (ier /= 0) then
268+
print *,'Error opening file: ',trim(filename)
269+
stop 'Error reading c22.bin file'
270+
endif
271+
272+
read(IIN) c22store
273+
close(IIN)
274+
275+
! c23
276+
if (myrank == 0) write(IMAIN,*) ' reading in: c23.bin'
277+
278+
filename = prname_lp(1:len_trim(prname_lp))//'c23.bin'
279+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
280+
if (ier /= 0) then
281+
print *,'Error opening file: ',trim(filename)
282+
stop 'Error reading c23.bin file'
283+
endif
284+
285+
read(IIN) c23store
286+
close(IIN)
287+
288+
! c24
289+
if (myrank == 0) write(IMAIN,*) ' reading in: c24.bin'
290+
291+
filename = prname_lp(1:len_trim(prname_lp))//'c24.bin'
292+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
293+
if (ier /= 0) then
294+
print *,'Error opening file: ',trim(filename)
295+
stop 'Error reading c24.bin file'
296+
endif
297+
298+
read(IIN) c24store
299+
close(IIN)
300+
301+
! c25
302+
if (myrank == 0) write(IMAIN,*) ' reading in: c25.bin'
303+
304+
filename = prname_lp(1:len_trim(prname_lp))//'c25.bin'
305+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
306+
if (ier /= 0) then
307+
print *,'Error opening file: ',trim(filename)
308+
stop 'Error reading c25.bin file'
309+
endif
310+
311+
read(IIN) c25store
312+
close(IIN)
313+
314+
! c26
315+
if (myrank == 0) write(IMAIN,*) ' reading in: c26.bin'
316+
317+
filename = prname_lp(1:len_trim(prname_lp))//'c26.bin'
318+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
319+
if (ier /= 0) then
320+
print *,'Error opening file: ',trim(filename)
321+
stop 'Error reading c26.bin file'
322+
endif
323+
324+
read(IIN) c26store
325+
close(IIN)
326+
327+
! c33
328+
if (myrank == 0) write(IMAIN,*) ' reading in: c33.bin'
329+
330+
filename = prname_lp(1:len_trim(prname_lp))//'c33.bin'
331+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
332+
if (ier /= 0) then
333+
print *,'Error opening file: ',trim(filename)
334+
stop 'Error reading c33.bin file'
335+
endif
336+
337+
read(IIN) c33store
338+
close(IIN)
339+
340+
! c34
341+
if (myrank == 0) write(IMAIN,*) ' reading in: c34.bin'
342+
343+
filename = prname_lp(1:len_trim(prname_lp))//'c34.bin'
344+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
345+
if (ier /= 0) then
346+
print *,'Error opening file: ',trim(filename)
347+
stop 'Error reading c34.bin file'
348+
endif
349+
350+
read(IIN) c34store
351+
close(IIN)
352+
353+
! c35
354+
if (myrank == 0) write(IMAIN,*) ' reading in: c35.bin'
355+
356+
filename = prname_lp(1:len_trim(prname_lp))//'c35.bin'
357+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
358+
if (ier /= 0) then
359+
print *,'Error opening file: ',trim(filename)
360+
stop 'Error reading c35.bin file'
361+
endif
362+
363+
read(IIN) c35store
364+
close(IIN)
365+
366+
! c36
367+
if (myrank == 0) write(IMAIN,*) ' reading in: c36.bin'
368+
369+
filename = prname_lp(1:len_trim(prname_lp))//'c36.bin'
370+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
371+
if (ier /= 0) then
372+
print *,'Error opening file: ',trim(filename)
373+
stop 'Error reading c36.bin file'
374+
endif
375+
376+
read(IIN) c36store
377+
close(IIN)
378+
379+
! c44
380+
if (myrank == 0) write(IMAIN,*) ' reading in: c44.bin'
381+
382+
filename = prname_lp(1:len_trim(prname_lp))//'c44.bin'
383+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
384+
if (ier /= 0) then
385+
print *,'Error opening file: ',trim(filename)
386+
stop 'Error reading c44.bin file'
387+
endif
388+
389+
read(IIN) c44store
390+
close(IIN)
391+
392+
! c45
393+
if (myrank == 0) write(IMAIN,*) ' reading in: c45.bin'
394+
395+
filename = prname_lp(1:len_trim(prname_lp))//'c45.bin'
396+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
397+
if (ier /= 0) then
398+
print *,'Error opening file: ',trim(filename)
399+
stop 'Error reading c45.bin file'
400+
endif
401+
402+
read(IIN) c45store
403+
close(IIN)
404+
405+
! c46
406+
if (myrank == 0) write(IMAIN,*) ' reading in: c46.bin'
407+
408+
filename = prname_lp(1:len_trim(prname_lp))//'c46.bin'
409+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
410+
if (ier /= 0) then
411+
print *,'Error opening file: ',trim(filename)
412+
stop 'Error reading c46.bin file'
413+
endif
414+
415+
read(IIN) c46store
416+
close(IIN)
417+
418+
! c55
419+
if (myrank == 0) write(IMAIN,*) ' reading in: c55.bin'
420+
421+
filename = prname_lp(1:len_trim(prname_lp))//'c55.bin'
422+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
423+
if (ier /= 0) then
424+
print *,'Error opening file: ',trim(filename)
425+
stop 'Error reading c55.bin file'
426+
endif
427+
428+
read(IIN) c55store
429+
close(IIN)
430+
431+
! c56
432+
if (myrank == 0) write(IMAIN,*) ' reading in: c56.bin'
433+
434+
filename = prname_lp(1:len_trim(prname_lp))//'c56.bin'
435+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
436+
if (ier /= 0) then
437+
print *,'Error opening file: ',trim(filename)
438+
stop 'Error reading c56.bin file'
439+
endif
440+
441+
read(IIN) c56store
442+
close(IIN)
443+
444+
! c66
445+
if (myrank == 0) write(IMAIN,*) ' reading in: c66.bin'
446+
447+
filename = prname_lp(1:len_trim(prname_lp))//'c66.bin'
448+
open(unit=IIN,file=trim(filename),status='old',action='read',form='unformatted',iostat=ier)
449+
if (ier /= 0) then
450+
print *,'Error opening file: ',trim(filename)
451+
stop 'Error reading c66.bin file'
452+
endif
453+
454+
read(IIN) c66store
455+
close(IIN)
456+
457+
endif
458+
176459
! gets attenuation arrays from files
177460
if (ATTENUATION) then
178461
! shear attenuation

0 commit comments

Comments
 (0)