@@ -32,6 +32,19 @@ float target_dy = -1.0;
3232float avgstk = -1.0e+15 ;
3333int revstk ;
3434
35+ /* 2025-12-11
36+ Added options to check slip-rate function to determine/modify rupture initation time and
37+ to slip-weight the averaging of tinit. Parameters below are used for these options.
38+ Default is now to use both options, but can be skipped by setting "check_tinit=0" and/or
39+ "tinit_slip_weight=0".
40+ */
41+ int tinit_slip_weight = 1 ;
42+ int check_tinit = 1 ;
43+ float * stfp ;
44+ int it , nt , itmax , it_chk_tt ;
45+ double tmp_d , max_sliprate_d , min_sliprate_d ;
46+ double tol_d = 1.0e-20 ;
47+
3548debug = 1 ;
3649
3750setpar (param_string_len , param_string );
@@ -44,6 +57,10 @@ if(target_dy < 0.0)
4457 mstpar ("dy" ,"f" ,& dy );
4558
4659getpar ("avgstk" ,"f" ,& avgstk );
60+
61+ getpar ("check_tinit" ,"d" ,& check_tinit );
62+ getpar ("tinit_slip_weight" ,"d" ,& tinit_slip_weight );
63+
4764endpar ();
4865
4966if (avgstk > -1.0e+14 )
@@ -173,6 +190,47 @@ fprintf(stderr,"id= %d is= %d kp= %d noff= %d\n",id,is,kp,noff);
173190
174191 tt = srf -> srf_apnts .apntvals [kp ].tinit ;
175192
193+ /* 2025-12-11
194+ Added option to check slip-rate function to determine/modify rupture initation
195+ time. This is only important if the slip-rate is given with some number of leading zeros.
196+ Default is now to use this option, but can be skipped by setting "check_tinit=0".
197+ */
198+ if (check_tinit && (apval_ptr [kp ].nt1 > 0 || apval_ptr [kp ].nt2 > 0 ))
199+ {
200+ if (apval_ptr [kp ].slip1 * apval_ptr [kp ].slip1 >= apval_ptr [kp ].slip2 * apval_ptr [kp ].slip2 )
201+ {
202+ stfp = apval_ptr [kp ].stf1 ;
203+ nt = apval_ptr [kp ].nt1 ;
204+ }
205+ else
206+ {
207+ stfp = apval_ptr [kp ].stf2 ;
208+ nt = apval_ptr [kp ].nt2 ;
209+ }
210+
211+ max_sliprate_d = -1.0 ;
212+ for (it = 0 ;it < nt ;it ++ )
213+ {
214+ tmp_d = (double )(stfp [it ])* (double )(stfp [it ]);
215+ if (tmp_d > max_sliprate_d )
216+ {
217+ max_sliprate_d = tmp_d ;
218+ itmax = it ;
219+ }
220+ }
221+
222+ min_sliprate_d = tol_d * max_sliprate_d ;
223+
224+ it_chk_tt = 1 ;
225+ tmp_d = (double )(stfp [it_chk_tt ])* (double )(stfp [it_chk_tt ]);
226+ while (tmp_d < min_sliprate_d && it_chk_tt < itmax )
227+ it_chk_tt ++ ;
228+
229+ if (tt < (it_chk_tt - 1 )* apval_ptr [kp ].dt )
230+ tt = tt + (it_chk_tt - 1 )* apval_ptr [kp ].dt ;
231+ }
232+ /* end "check_tinit" */
233+
176234 if (mrf_flag == 1 )
177235 {
178236 dmu = (apval_ptr [kp ].vs )* (apval_ptr [kp ].vs )* (apval_ptr [kp ].den );
@@ -278,19 +336,38 @@ fprintf(stderr,"id= %d is= %d kp= %d noff= %d\n",id,is,kp,noff);
278336 m = (long long )ix * nxsum + j + (iy * nysum + k )* (long long )nx * nxsum ;
279337
280338 sp [ip ] = sp [ip ] + slip [m ];
281- ti [ip ] = ti [ip ] + tinit [m ];
339+
340+ /* 2025-12-11
341+ Added option to slip-weight the averaging of tinit (similar to that done for trise).
342+ Default is now to use this option, but can be skipped by setting "tinit_slip_weight=0".
343+ */
344+ if (tinit_slip_weight )
345+ ti [ip ] = ti [ip ] + tinit [m ]* slip [m ];
346+ else
347+ ti [ip ] = ti [ip ] + tinit [m ];
348+
282349 tr [ip ] = tr [ip ] + trise [m ]* slip [m ];
283350 sum = sum + slip [m ];
284351 }
285352 }
286353
287354 sp [ip ] = sp [ip ]* fac ;
288- ti [ip ] = ti [ip ]* fac ;
355+
356+ if (tinit_slip_weight == 0 )
357+ ti [ip ] = ti [ip ]* fac ;
289358
290359 if (sum > 0.0 )
360+ {
291361 tr [ip ] = tr [ip ]/sum ;
362+ if (tinit_slip_weight )
363+ ti [ip ] = ti [ip ]/sum ;
364+ }
292365 else
366+ {
293367 tr [ip ] = 1.0e-05 ;
368+ if (tinit_slip_weight )
369+ ti [ip ] = 1.0e-05 ;
370+ }
294371 }
295372 }
296373
0 commit comments