From d986f862436d12862a55eabcb17451854d8d2e2d Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Tue, 19 Sep 2023 11:51:55 -0400 Subject: [PATCH] Fix: no power 1/3 in enstrophy norm --- docs/nstrophy_doc.tex | 6 +++--- src/navier-stokes.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/nstrophy_doc.tex b/docs/nstrophy_doc.tex index 3edbbe7..09efcba 100644 --- a/docs/nstrophy_doc.tex +++ b/docs/nstrophy_doc.tex @@ -177,16 +177,16 @@ It can be made by specifying the parameter {\tt adaptive\_norm}. \begin{equation} \|f\|:=\frac1{\mathcal N}\sqrt{\sum_k k^2|f_k|^2} ,\quad - \mathcal N:=\left(\frac{\sqrt{\sum_k k^2|\hat u_k^{(n)}|^2}+\sqrt{\sum_k k^2|\hat U_k^{(n)}|^2}}{\sum_k k^2|\hat u_k^{(n)}|^2}\right)^{\frac13} + \mathcal N:=\frac{\sqrt{\sum_k k^2|\hat u_k^{(n)}|^2}+\sqrt{\sum_k k^2|\hat U_k^{(n)}|^2}}{\sum_k k^2|\hat u_k^{(n)}|^2} . \end{equation} Doing so controls the error of the enstrophy through \begin{equation} - \mathcal N^2|\mathcal En(\hat u)-\mathcal En(\hat U)|\equiv|\|\hat u\|^2-\|\hat U\|^2|\leqslant \|\hat u-\hat U\|(\|\hat u\|+\|\hat U\|) + \frac1{\mathcal N^2}|\mathcal En(\hat u)-\mathcal En(\hat U)|\equiv|\|\hat u\|^2-\|\hat U\|^2|\leqslant \|\hat u-\hat U\|(\|\hat u\|+\|\hat U\|) \end{equation} so \begin{equation} - \mathcal N^2 + \frac1{\mathcal N^2} |\mathcal En(\hat u)-\mathcal En(\hat U)|\leqslant \|\hat u-\hat U\|\frac1{\mathcal N}\left(\sqrt{\sum_k k^2|\hat u_k|^2}+\sqrt{\sum_k k^2|\hat U_k|^2}\right) \end{equation} diff --git a/src/navier-stokes.c b/src/navier-stokes.c index 9ab9126..dbdcd12 100644 --- a/src/navier-stokes.c +++ b/src/navier-stokes.c @@ -820,7 +820,7 @@ int ns_step_rkf45( } } err=sqrt(err); - relative=pow((sqrt(sumu)+sqrt(sumU))/sumu, 1./3); + relative=(sqrt(sumu)+sqrt(sumU))/sumu; } else{ fprintf(stderr,"bug: unknown norm: %u, contact ian.jauslin@rutgers.edu\n", adaptive_norm); @@ -966,7 +966,7 @@ int ns_step_rkbs32( } } err=sqrt(err); - relative=pow((sqrt(sumu)+sqrt(sumU))/sumu, 1./3); + relative=(sqrt(sumu)+sqrt(sumU))/sumu; } else{ fprintf(stderr,"bug: unknown norm: %u, contact ian.jauslin@rutgers,edu\n", adaptive_norm); @@ -1143,7 +1143,7 @@ int ns_step_rkdp54( } } err=sqrt(err); - relative=pow((sqrt(sumu)+sqrt(sumU))/sumu, 1./3); + relative=(sqrt(sumu)+sqrt(sumU))/sumu; } else{ fprintf(stderr,"bug: unknown norm: %u, contact ian.jauslin@rutgers,edu\n", adaptive_norm);