aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherrmann <herrmann@f4913095-0e4f-0410-abea-a123d184f1f3>2005-03-23 22:03:23 +0000
committerherrmann <herrmann@f4913095-0e4f-0410-abea-a123d184f1f3>2005-03-23 22:03:23 +0000
commit6a611ee5c19a7562bf8b23570ff1039897272265 (patch)
tree60174b1fd211e5b4d34b8755f1742af0c276c1c6
parent0b2fc3b6c08d39f19eb684f5ab2afa7e32947a68 (diff)
output of individual pieces of the norm.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Norms/trunk@11 f4913095-0e4f-0410-abea-a123d184f1f3
-rw-r--r--interface.ccl2
-rw-r--r--src/Compute_Norm.c16
2 files changed, 14 insertions, 4 deletions
diff --git a/interface.ccl b/interface.ccl
index 70daffa..f99c901 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -29,7 +29,7 @@ REAL bgvals_group TYPE=ARRAY DIM=1 SIZE=max_nr_vars DISTRIB=constant
REAL norm_group TYPE=SCALAR
{
- norm
+ norm, norm_u, norm_v, norm_grad
} "computed norm"
REAL diff_term_group TYPE=GF
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);
+ }
}