aboutsummaryrefslogtreecommitdiff
path: root/src/Compute_Norm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Compute_Norm.c')
-rw-r--r--src/Compute_Norm.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/Compute_Norm.c b/src/Compute_Norm.c
index 2fd7752..e159b80 100644
--- a/src/Compute_Norm.c
+++ b/src/Compute_Norm.c
@@ -59,6 +59,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
*nr1stvars,*nr2ndvars);
/* L2-norm of 1st order variables */
+ *norm_u=0.;
for (vind=0; vind< *nr1stvars; vind++) {
ierr=CCTK_Reduce(cctkGH,target_proc,reduction_handle,1,
CCTK_VARIABLE_REAL,&result,1,varindices_1st[vind]);
@@ -70,6 +71,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
CCTK_VarName(varindices_1st[vind]),result);
}
result=result-bgvals_1st[vind];
+ *norm_u=*norm_u+result;
*norm=*norm+result*result;
}
@@ -77,6 +79,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
fprintf(stderr," after 1st order vars norm=%16.8g\n",*norm);
/* L2-norm of 2nd order variables */
+ *norm_v=0.;
for (vind=0; vind< *nr2ndvars; vind++) {
ierr=CCTK_Reduce(cctkGH,target_proc,reduction_handle,1,
CCTK_VARIABLE_REAL,&result,1,varindices_2nd[vind]);
@@ -88,6 +91,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
CCTK_VarName(varindices_2nd[vind]),result);
}
result=result-bgvals_2nd[vind];
+ *norm_v=*norm_v+result;
*norm=*norm+result*result;
}
@@ -95,6 +99,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
fprintf(stderr," after 2nd order vars norm=%16.8g\n",*norm);
/* L2-norm of D_{+i} terms */
+ *norm_grad=0.;
/* d_x */
for (vind=0; vind< *nr2ndvars; vind++) {
data=CCTK_VarDataPtrI(cctkGH,0,varindices_2nd[vind]);
@@ -117,6 +122,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
vind,varindices_2nd[vind],
CCTK_VarName(varindices_2nd[vind]),result);
}
+ *norm_grad=*norm_grad+result;
*norm=*norm+result*result;
}
@@ -145,6 +151,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
vind,varindices_2nd[vind],
CCTK_VarName(varindices_2nd[vind]),result);
}
+ *norm_grad=*norm_grad+result;
*norm=*norm+result*result;
}
@@ -173,6 +180,7 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
vind,varindices_2nd[vind],
CCTK_VarName(varindices_2nd[vind]),result);
}
+ *norm_grad=*norm_grad+result;
*norm=*norm+result*result;
}
@@ -187,7 +195,9 @@ void Norms_Compute_Norms (CCTK_ARGUMENTS)
*norm=sqrt(*norm);
- if (verbose>1)
- CCTK_VInfo(CCTK_THORNSTRING,"norm= %16.8g",*norm);
-
+ if (verbose>1) {
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "norm= %16.8g (norm_u=%f, norm_v=%f, norm_grad=%f)",
+ *norm,*norm_u,*norm_v,*norm_grad);
+ }
}