lib/App/SeismicUnixGui/sunix/par/vel2stiff.pm untested

filter: Statementstmt 0.0% 0 / 160 Branchbran 0.0% 0 / 36 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 26 Podpod 0.0% 0 / 22 totaltotal 0.0% 0 / 244 CC 19 SCAR 16.6
CC
19
Cov
0%
c11_file
6.0
c13_file
6.0
c15_file
6.0
CRAP 5.3
1 package App::SeismicUnixGui::sunix::par::vel2stiff;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR: Juan Lorenzo (Perl module only)
8  
9 DATE:
10  
11 DESCRIPTION:
12  
13 Version:
14  
15 =head2 USE
16  
17 =head3 NOTES
18  
19 =head4 Examples
20  
21 =head2 SYNOPSIS
22  
23 =head3 SEISMIC UNIX NOTES
24 VEL2STIFF - Transforms VELocities, densities, and Thomsen or Sayers
25  
26 parameters to elastic STIFFnesses
27  
28  
29  
30 vel2stiff [Required parameters] [Optional Parameters] > stdout
31  
32  
33  
34 Required parameters:
35  
36 vpfile= file with P-wave velocities
37  
38 vsfile= file with S-wave velocities
39  
40 rhofile= file with densities
41  
42  
43  
44 Optional Parameters:
45  
46 epsfile= file with Thomsen/Sayers epsilon
47  
48 deltafile= file with Thomsen/Sayers delta
49  
50 gammafile= file with Thomsen/Sayers gamma
51  
52 phi_file= angle of axis of symmetry from vertical (radians)
53  
54  
55  
56 c11_file=c11_file output filename for c11 values
57  
58 c13_file=c13_file output filename for c13 values
59  
60 c15_file=c15_file output filename for c15 values
61  
62 c33_file=c33_file output filename for c33 values
63  
64 c35_file=c35_file output filename for c35 values
65  
66 c44_file=c44_file output filename for c44 values
67  
68 c55_file=c55_file output filename for c55 values
69  
70 c66_file=c66_file output filename for c66 values
71  
72  
73  
74 paramtype=1 (1) Thomsen parameters, (0) Sayers parameters(see below)
75  
76  
77  
78 nx=101 number of x samples 2nd (slow) dimension
79  
80 nz=101 number of z samples 1st (fast) dimension
81  
82  
83  
84 Notes:
85  
86 Transforms velocities, density and Thomsen/Sayers parameters
87  
88 epsilon, delta, and gamma into elastic stiffness coefficients.
89  
90  
91  
92 If only P-wave, S-wave velocities and density is given as input,
93  
94 the model is assumed to be isotropic.
95  
96  
97  
98 If files containing Thomsen/Sayers parameters are given, the model
99  
100 will be assumed to have VTI symmetry.
101  
102  
103  
104 All input files vpfile, vsfile, rhofile etc. are assumed to consist
105  
106 only of C style binary floating point numbers representing the
107  
108 corresponding material values of vp, vs, rho etc. Similarly, the output
109  
110 files consist of the coresponding stiffnesses as C style binary floats.
111  
112 If the output files are to be used as input for a modeling program,
113  
114 such as suea2df, then further, the contents are assumed be arrays of
115  
116 floating point numbers of the form of Array[n2][n1], where the fast
117  
118 dimension, dimension 1, represents depth.
119  
120  
121  
122  
123  
124  
125  
126 Author:
127  
128 CWP: Sverre Brandsberg-Dahl 1999
129  
130  
131  
132 Extended:
133  
134 CWP: Stig-Kyrre Foss 2001
135  
136 - to include the option to use the parameters by Sayers (1995)
137  
138 instead of the Thomsen parameters
139  
140  
141  
142 Technical reference:
143  
144 Sayers, C. M.: Simplified anisotropy parameters for transversely
145  
146 isotropic sedimentary rocks. Geophysics 1995, pages 1933-1935.
147  
148  
149  
150 =head2 CHANGES and their DATES
151  
152 =cut
153  
154 use Moose;
155 our $VERSION = '0.0.1';
156  
157 =head2 Import packages
158  
159 =cut
160  
161 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
162  
163 use App::SeismicUnixGui::misc::SeismicUnix qw($in $out $on $go $to $suffix_ascii $off $suffix_su $suffix_bin);
164 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
165  
166 =head2 instantiation of packages
167  
168 =cut
169  
170 my $get = L_SU_global_constants->new();
171 my $Project = Project_config->new();
172 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
173 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
174 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
175  
176 my $var = $get->var();
177 my $on = $var->{_on};
178 my $off = $var->{_off};
179 my $true = $var->{_true};
180 my $false = $var->{_false};
181 my $empty_string = $var->{_empty_string};
182  
183 =head2 Encapsulated
184 hash of private variables
185  
186 =cut
187  
188 my $vel2stiff = {
189 _c11_file => '',
190 _c13_file => '',
191 _c15_file => '',
192 _c33_file => '',
193 _c35_file => '',
194 _c44_file => '',
195 _c55_file => '',
196 _c66_file => '',
197 _deltafile => '',
198 _epsfile => '',
199 _gammafile => '',
200 _nx => '',
201 _nz => '',
202 _paramtype => '',
203 _phi_file => '',
204 _rhofile => '',
205 _vpfile => '',
206 _vsfile => '',
207 _Step => '',
208 _note => '',
209  
210 };
211  
212 =head2 sub Step
213  
214 collects switches and assembles bash instructions
215 by adding the program name
216  
217 =cut
218  
219 sub Step {
220  
221 $vel2stiff->{_Step} = 'vel2stiff' . $vel2stiff->{_Step};
222 return ( $vel2stiff->{_Step} );
223  
224 }
225  
226 =head2 sub note
227  
228 collects switches and assembles bash instructions
229 by adding the program name
230  
231 =cut
232  
233 sub note {
234  
235 $vel2stiff->{_note} = 'vel2stiff' . $vel2stiff->{_note};
236 return ( $vel2stiff->{_note} );
237  
238 }
239  
240 =head2 sub clear
241  
242 =cut
243  
244 sub clear {
245  
246 $vel2stiff->{_c11_file} = '';
247 $vel2stiff->{_c13_file} = '';
248 $vel2stiff->{_c15_file} = '';
249 $vel2stiff->{_c33_file} = '';
250 $vel2stiff->{_c35_file} = '';
251 $vel2stiff->{_c44_file} = '';
252 $vel2stiff->{_c55_file} = '';
253 $vel2stiff->{_c66_file} = '';
254 $vel2stiff->{_deltafile} = '';
255 $vel2stiff->{_epsfile} = '';
256 $vel2stiff->{_gammafile} = '';
257 $vel2stiff->{_nx} = '';
258 $vel2stiff->{_nz} = '';
259 $vel2stiff->{_paramtype} = '';
260 $vel2stiff->{_phi_file} = '';
261 $vel2stiff->{_rhofile} = '';
262 $vel2stiff->{_vpfile} = '';
263 $vel2stiff->{_vsfile} = '';
264 $vel2stiff->{_Step} = '';
265 $vel2stiff->{_note} = '';
266 }
267  
268 =head2 sub c11_file
269  
270  
271 =cut
272  
273 sub c11_file {
274  
275 my ( $self, $c11_file ) = @_;
276 if ( $c11_file ne $empty_string ) {
277  
278 $vel2stiff->{_c11_file} = $c11_file;
279 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c11_file=' . $vel2stiff->{_c11_file};
280 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c11_file=' . $vel2stiff->{_c11_file};
281  
282 } else {
283 print("vel2stiff, c11_file, missing c11_file,\n");
284 }
285 }
286  
287 =head2 sub c13_file
288  
289  
290 =cut
291  
292 sub c13_file {
293  
294 my ( $self, $c13_file ) = @_;
295 if ( $c13_file ne $empty_string ) {
296  
297 $vel2stiff->{_c13_file} = $c13_file;
298 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c13_file=' . $vel2stiff->{_c13_file};
299 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c13_file=' . $vel2stiff->{_c13_file};
300  
301 } else {
302 print("vel2stiff, c13_file, missing c13_file,\n");
303 }
304 }
305  
306 =head2 sub c15_file
307  
308  
309 =cut
310  
311 sub c15_file {
312  
313 my ( $self, $c15_file ) = @_;
314 if ( $c15_file ne $empty_string ) {
315  
316 $vel2stiff->{_c15_file} = $c15_file;
317 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c15_file=' . $vel2stiff->{_c15_file};
318 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c15_file=' . $vel2stiff->{_c15_file};
319  
320 } else {
321 print("vel2stiff, c15_file, missing c15_file,\n");
322 }
323 }
324  
325 =head2 sub c33_file
326  
327  
328 =cut
329  
330 sub c33_file {
331  
332 my ( $self, $c33_file ) = @_;
333 if ( $c33_file ne $empty_string ) {
334  
335 $vel2stiff->{_c33_file} = $c33_file;
336 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c33_file=' . $vel2stiff->{_c33_file};
337 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c33_file=' . $vel2stiff->{_c33_file};
338  
339 } else {
340 print("vel2stiff, c33_file, missing c33_file,\n");
341 }
342 }
343  
344 =head2 sub c35_file
345  
346  
347 =cut
348  
349 sub c35_file {
350  
351 my ( $self, $c35_file ) = @_;
352 if ( $c35_file ne $empty_string ) {
353  
354 $vel2stiff->{_c35_file} = $c35_file;
355 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c35_file=' . $vel2stiff->{_c35_file};
356 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c35_file=' . $vel2stiff->{_c35_file};
357  
358 } else {
359 print("vel2stiff, c35_file, missing c35_file,\n");
360 }
361 }
362  
363 =head2 sub c44_file
364  
365  
366 =cut
367  
368 sub c44_file {
369  
370 my ( $self, $c44_file ) = @_;
371 if ( $c44_file ne $empty_string ) {
372  
373 $vel2stiff->{_c44_file} = $c44_file;
374 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c44_file=' . $vel2stiff->{_c44_file};
375 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c44_file=' . $vel2stiff->{_c44_file};
376  
377 } else {
378 print("vel2stiff, c44_file, missing c44_file,\n");
379 }
380 }
381  
382 =head2 sub c55_file
383  
384  
385 =cut
386  
387 sub c55_file {
388  
389 my ( $self, $c55_file ) = @_;
390 if ( $c55_file ne $empty_string ) {
391  
392 $vel2stiff->{_c55_file} = $c55_file;
393 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c55_file=' . $vel2stiff->{_c55_file};
394 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c55_file=' . $vel2stiff->{_c55_file};
395  
396 } else {
397 print("vel2stiff, c55_file, missing c55_file,\n");
398 }
399 }
400  
401 =head2 sub c66_file
402  
403  
404 =cut
405  
406 sub c66_file {
407  
408 my ( $self, $c66_file ) = @_;
409 if ( $c66_file ne $empty_string ) {
410  
411 $vel2stiff->{_c66_file} = $c66_file;
412 $vel2stiff->{_note} = $vel2stiff->{_note} . ' c66_file=' . $vel2stiff->{_c66_file};
413 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' c66_file=' . $vel2stiff->{_c66_file};
414  
415 } else {
416 print("vel2stiff, c66_file, missing c66_file,\n");
417 }
418 }
419  
420 =head2 sub deltafile
421  
422  
423 =cut
424  
425 sub deltafile {
426  
427 my ( $self, $deltafile ) = @_;
428 if ( $deltafile ne $empty_string ) {
429  
430 $vel2stiff->{_deltafile} = $deltafile;
431 $vel2stiff->{_note} = $vel2stiff->{_note} . ' deltafile=' . $vel2stiff->{_deltafile};
432 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' deltafile=' . $vel2stiff->{_deltafile};
433  
434 } else {
435 print("vel2stiff, deltafile, missing deltafile,\n");
436 }
437 }
438  
439 =head2 sub epsfile
440  
441  
442 =cut
443  
444 sub epsfile {
445  
446 my ( $self, $epsfile ) = @_;
447 if ( $epsfile ne $empty_string ) {
448  
449 $vel2stiff->{_epsfile} = $epsfile;
450 $vel2stiff->{_note} = $vel2stiff->{_note} . ' epsfile=' . $vel2stiff->{_epsfile};
451 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' epsfile=' . $vel2stiff->{_epsfile};
452  
453 } else {
454 print("vel2stiff, epsfile, missing epsfile,\n");
455 }
456 }
457  
458 =head2 sub gammafile
459  
460  
461 =cut
462  
463 sub gammafile {
464  
465 my ( $self, $gammafile ) = @_;
466 if ( $gammafile ne $empty_string ) {
467  
468 $vel2stiff->{_gammafile} = $gammafile;
469 $vel2stiff->{_note} = $vel2stiff->{_note} . ' gammafile=' . $vel2stiff->{_gammafile};
470 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' gammafile=' . $vel2stiff->{_gammafile};
471  
472 } else {
473 print("vel2stiff, gammafile, missing gammafile,\n");
474 }
475 }
476  
477 =head2 sub nx
478  
479  
480 =cut
481  
482 sub nx {
483  
484 my ( $self, $nx ) = @_;
485 if ( $nx ne $empty_string ) {
486  
487 $vel2stiff->{_nx} = $nx;
488 $vel2stiff->{_note} = $vel2stiff->{_note} . ' nx=' . $vel2stiff->{_nx};
489 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' nx=' . $vel2stiff->{_nx};
490  
491 } else {
492 print("vel2stiff, nx, missing nx,\n");
493 }
494 }
495  
496 =head2 sub nz
497  
498  
499 =cut
500  
501 sub nz {
502  
503 my ( $self, $nz ) = @_;
504 if ( $nz ne $empty_string ) {
505  
506 $vel2stiff->{_nz} = $nz;
507 $vel2stiff->{_note} = $vel2stiff->{_note} . ' nz=' . $vel2stiff->{_nz};
508 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' nz=' . $vel2stiff->{_nz};
509  
510 } else {
511 print("vel2stiff, nz, missing nz,\n");
512 }
513 }
514  
515 =head2 sub paramtype
516  
517  
518 =cut
519  
520 sub paramtype {
521  
522 my ( $self, $paramtype ) = @_;
523 if ( $paramtype ne $empty_string ) {
524  
525 $vel2stiff->{_paramtype} = $paramtype;
526 $vel2stiff->{_note} = $vel2stiff->{_note} . ' paramtype=' . $vel2stiff->{_paramtype};
527 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' paramtype=' . $vel2stiff->{_paramtype};
528  
529 } else {
530 print("vel2stiff, paramtype, missing paramtype,\n");
531 }
532 }
533  
534 =head2 sub phi_file
535  
536  
537 =cut
538  
539 sub phi_file {
540  
541 my ( $self, $phi_file ) = @_;
542 if ( $phi_file ne $empty_string ) {
543  
544 $vel2stiff->{_phi_file} = $phi_file;
545 $vel2stiff->{_note} = $vel2stiff->{_note} . ' phi_file=' . $vel2stiff->{_phi_file};
546 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' phi_file=' . $vel2stiff->{_phi_file};
547  
548 } else {
549 print("vel2stiff, phi_file, missing phi_file,\n");
550 }
551 }
552  
553 =head2 sub rhofile
554  
555  
556 =cut
557  
558 sub rhofile {
559  
560 my ( $self, $rhofile ) = @_;
561 if ( $rhofile ne $empty_string ) {
562  
563 $vel2stiff->{_rhofile} = $rhofile;
564 $vel2stiff->{_note} = $vel2stiff->{_note} . ' rhofile=' . $vel2stiff->{_rhofile};
565 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' rhofile=' . $vel2stiff->{_rhofile};
566  
567 } else {
568 print("vel2stiff, rhofile, missing rhofile,\n");
569 }
570 }
571  
572 =head2 sub vpfile
573  
574  
575 =cut
576  
577 sub vpfile {
578  
579 my ( $self, $vpfile ) = @_;
580 if ( $vpfile ne $empty_string ) {
581  
582 $vel2stiff->{_vpfile} = $vpfile;
583 $vel2stiff->{_note} = $vel2stiff->{_note} . ' vpfile=' . $vel2stiff->{_vpfile};
584 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' vpfile=' . $vel2stiff->{_vpfile};
585  
586 } else {
587 print("vel2stiff, vpfile, missing vpfile,\n");
588 }
589 }
590  
591 =head2 sub vsfile
592  
593  
594 =cut
595  
596 sub vsfile {
597  
598 my ( $self, $vsfile ) = @_;
599 if ( $vsfile ne $empty_string ) {
600  
601 $vel2stiff->{_vsfile} = $vsfile;
602 $vel2stiff->{_note} = $vel2stiff->{_note} . ' vsfile=' . $vel2stiff->{_vsfile};
603 $vel2stiff->{_Step} = $vel2stiff->{_Step} . ' vsfile=' . $vel2stiff->{_vsfile};
604  
605 } else {
606 print("vel2stiff, vsfile, missing vsfile,\n");
607 }
608 }
609  
610 =head2 sub get_max_index
611  
612 max index = number of input variables -1
613
614 =cut
615  
616 sub get_max_index {
617 my ($self) = @_;
618 my $max_index = 17;
619  
620 return ($max_index);
621 }
622  
623 1;