From ba6e2772d5cbc5fa30f511235d5d42341be8561e Mon Sep 17 00:00:00 2001 From: Tilman Metz Date: Mon, 5 Oct 2015 17:38:12 +0200 Subject: [PATCH] TSNAP2 will be set to TIME if TSNAP>TIME. ( Time is recalculated to TIME=NT*DT in sofi3D.c and thus can differ to TIME given in .json. So even if TIME and TSNAP2 are equal in .json they can differ in the checkfd functions) --- src/checkfd_acoustic.c | 10 ++++++---- src/checkfd_ssg.c | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/checkfd_acoustic.c b/src/checkfd_acoustic.c index ef456ea..5902af1 100644 --- a/src/checkfd_acoustic.c +++ b/src/checkfd_acoustic.c @@ -432,10 +432,12 @@ void checkfd_acoustic(FILE *fp, float *** prho, float *** ppi, float **srcpos, i if (SNAP){ fprintf(fp," Checking the snapshot parameters. \n"); - if ((TSNAP2>TIME) && (MYID==0)){ - sprintf(errormessage,"TSNAP2 = %e (last snapshot) > Time of wave propagation %e. Choose smaller TSNAP2.",TSNAP2, TIME); - err(errormessage); /* if TSNAP2>simulation TIME, snapmerge will generate "additional" snapshots out of nowhere, thus, snapshot files size blow up */ - } + if (TSNAP2>TIME) { + sprintf(errormessage,"\nTSNAP2 = %e (last snapshot) > Time of wave propagation %e. TSNAP2 was changed to be equal to TIME.\n",TSNAP2, TIME); + TSNAP2=TIME; + if (MYID==0) + warning(errormessage); /* if TSNAP2>simulation TIME, snapmerge will generate "additional" snapshots out of nowhere, thus, snapshot files size blow up */ + } snapoutx=NX/(float)IDX; snapouty=NY/(float)IDY; diff --git a/src/checkfd_ssg.c b/src/checkfd_ssg.c index e89c6c3..b57df0f 100755 --- a/src/checkfd_ssg.c +++ b/src/checkfd_ssg.c @@ -549,9 +549,11 @@ void checkfd(FILE *fp, float *** prho, float *** ppi, float *** pu, if (SNAP){ fprintf(fp," Checking the snapshot parameters. \n"); - if ((TSNAP2>TIME) && (MYID==0)){ - sprintf(errormessage,"TSNAP2 = %e (last snapshot) > Time of wave propagation %e. Choose smaller TSNAP2.",TSNAP2, TIME); - err(errormessage); /* if TSNAP2>simulation TIME, snapmerge will generate "additional" snapshots out of nowhere, thus, snapshot files size blow up */ + if (TSNAP2>TIME) { + sprintf(errormessage,"\nTSNAP2 = %e (last snapshot) > Time of wave propagation %e. TSNAP2 was changed to be equal to TIME.\n",TSNAP2, TIME); + TSNAP2=TIME; + if (MYID==0) + warning(errormessage); /* if TSNAP2>simulation TIME, snapmerge will generate "additional" snapshots out of nowhere, thus, snapshot files size blow up */ } snapoutx=NX/(float)IDX; -- GitLab