From 2af3c0bd2d0f4dd70c7b21b310b3741b3cb7eb80 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 11 Jan 2022 09:34:22 -0500 Subject: [PATCH 01/23] [wip] add Mutation directive --- src/Kernel/Main/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Kernel/Main/main.cpp b/src/Kernel/Main/main.cpp index aa02fd41..0e9c60ab 100644 --- a/src/Kernel/Main/main.cpp +++ b/src/Kernel/Main/main.cpp @@ -23,6 +23,10 @@ #define HAVE_ENZYME #endif +#ifdef _MUTATIONPP +#define HAVE_MPP +#endif + #ifdef _MPI #define HAVE_MPI #endif @@ -37,6 +41,10 @@ #include "cublas_v2.h" #endif +#ifdef HAVE_MPP +#include +#endif + #ifdef HAVE_MPI #include #endif From d10bc31315ae573462b31188e8df9768f3879082 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Thu, 13 Jan 2022 12:07:14 -0500 Subject: [PATCH 02/23] Mutation++ inside C++ Kernel. Able to be configured through MATLAB interface --- .../hypersoniccylinder/app/compileMutation.sh | 4 ++ .../hypersoniccylinder/app/fixargsMPP_Mac.sh | 6 +++ src/Kernel/AppDriver/avfieldDriver.cpp | 7 +++- src/Kernel/AppDriver/fbouDriver.cpp | 5 +++ src/Kernel/AppDriver/fhatDriver.cpp | 12 +++++- src/Kernel/AppDriver/fluxDriver.cpp | 5 +++ src/Kernel/AppDriver/initodgDriver.cpp | 6 ++- src/Kernel/AppDriver/initqDriver.cpp | 6 ++- src/Kernel/AppDriver/inituDriver.cpp | 4 ++ src/Kernel/AppDriver/initudgDriver.cpp | 6 ++- src/Kernel/AppDriver/initvDriver.cpp | 6 ++- src/Kernel/AppDriver/initwDriver.cpp | 6 ++- src/Kernel/AppDriver/initwdgDriver.cpp | 6 ++- src/Kernel/AppDriver/opuApp.cpp | 4 ++ src/Kernel/AppDriver/outputDriver.cpp | 7 +++- src/Kernel/AppDriver/sourceDriver.cpp | 7 +++- src/Kernel/AppDriver/sourcewDriver.cpp | 7 +++- src/Kernel/AppDriver/tdfuncDriver.cpp | 7 +++- src/Kernel/AppDriver/ubouDriver.cpp | 5 +++ src/Kernel/AppDriver/uhatDriver.cpp | 5 +++ src/Kernel/Common/application.h | 40 ++++++++++++++++++- src/Kernel/Common/common.h | 7 ++++ src/Kernel/Discretization/readbinaryfiles.cpp | 27 +++++++++++++ src/Kernel/Main/main.cpp | 2 +- src/Matlab/Preprocessing/initializepde.m | 4 +- src/Matlab/Preprocessing/writeapp.m | 5 +++ 26 files changed, 189 insertions(+), 17 deletions(-) create mode 100755 Applications/NavierStokes/hypersoniccylinder/app/compileMutation.sh create mode 100755 Applications/NavierStokes/hypersoniccylinder/app/fixargsMPP_Mac.sh diff --git a/Applications/NavierStokes/hypersoniccylinder/app/compileMutation.sh b/Applications/NavierStokes/hypersoniccylinder/app/compileMutation.sh new file mode 100755 index 00000000..bf2f6127 --- /dev/null +++ b/Applications/NavierStokes/hypersoniccylinder/app/compileMutation.sh @@ -0,0 +1,4 @@ +#!/bin/bash +g++ -fPIC -O3 -c opuApp.cpp -w -std=c++11 -D _MUTATIONPP -I /Users/rloekvh/Mutationpp/install/include/mutation++/ -I /Users/rloekvh/Mutationpp/thirdparty/eigen/ -I /Users/rloekvh/Mutationpp/install +ar -rvs opuApp.a opuApp.o +g++ -std=c++11 ../../../../src/Kernel/Main/main.cpp -w -o serialapp ../../../../lib/Mac/commonCore.a ../../../../lib/Mac/opuCore.a opuApp.a -O2 -ldl -lm -lblas -llapack -lmutation++ -std=c++11 -D _MUTATIONPP -L /Users/rloekvh/Mutationpp/install/lib/ -I /Users/rloekvh/Mutationpp/install/include/mutation++/ -I /Users/rloekvh/Mutationpp/thirdparty/eigen/ -I /Users/rloekvh/Mutationpp/install/include/ diff --git a/Applications/NavierStokes/hypersoniccylinder/app/fixargsMPP_Mac.sh b/Applications/NavierStokes/hypersoniccylinder/app/fixargsMPP_Mac.sh new file mode 100755 index 00000000..91968410 --- /dev/null +++ b/Applications/NavierStokes/hypersoniccylinder/app/fixargsMPP_Mac.sh @@ -0,0 +1,6 @@ +#!/bin/bash +sed -i '' 's/int ncw)/int ncw, Mutation::Mixture *mix)/g' opu*.cpp +sed -i '' 's/int ne)/int ne, Mutation::Mixture *mix)/g' opu*.cpp +sed -i '' 's/, ncw)/, ncw, mix)/g' opu*.cpp +sed -i '' 's/, ne)/, ne, mix)/g' opu*.cpp +sed -i '' 's/int)/int, Mutation::Mixture *)/g' opu*.cpp \ No newline at end of file diff --git a/src/Kernel/AppDriver/avfieldDriver.cpp b/src/Kernel/AppDriver/avfieldDriver.cpp index ea77d65f..c54c4117 100644 --- a/src/Kernel/AppDriver/avfieldDriver.cpp +++ b/src/Kernel/AppDriver/avfieldDriver.cpp @@ -22,8 +22,13 @@ void AvfieldDriver(dstype *f, dstype *xg, dstype *udg, dstype *odg, dstype *wdg, /* 2. Compute physical source */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP opuAvfield(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, common.modelnumber, - numPoints, nc, ncu, nd, ncx, nco, ncw, nco, npe, ne); + numPoints, nc, ncu, nd, ncx, nco, ncw, nco, npe, ne, app.mix); + #else + opuAvfield(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, common.modelnumber, + numPoints, nc, ncu, nd, ncx, nco, ncw, nco, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/fbouDriver.cpp b/src/Kernel/AppDriver/fbouDriver.cpp index a087bd51..69d9edb4 100644 --- a/src/Kernel/AppDriver/fbouDriver.cpp +++ b/src/Kernel/AppDriver/fbouDriver.cpp @@ -18,8 +18,13 @@ void FbouDriver(dstype *fb, dstype *xg, dstype *udg, dstype * odg, dstype * wdg, /* 3. Compute physical boundary conditions */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP + opuFbou(fb, xg, udg, odg, wdg, uhg, nl, app.tau, app.uinf, app.physicsparam, time, + common.modelnumber, ib, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else opuFbou(fb, xg, udg, odg, wdg, uhg, nl, app.tau, app.uinf, app.physicsparam, time, common.modelnumber, ib, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/fhatDriver.cpp b/src/Kernel/AppDriver/fhatDriver.cpp index 4f9984d6..20d68abf 100644 --- a/src/Kernel/AppDriver/fhatDriver.cpp +++ b/src/Kernel/AppDriver/fhatDriver.cpp @@ -21,8 +21,13 @@ void FhatDriver(dstype *fg, dstype *xg, dstype *ug1, dstype *ug2, dstype * og1, if (common.extFhat==1) { #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP opuFhat(fg, xg, ug1, ug2, og1, og2, wg1, wg2, uh, nl, app.tau, app.uinf, app.physicsparam, - time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else + opuFhat(fg, xg, ug1, ug2, og1, og2, wg1, wg2, uh, nl, app.tau, app.uinf, app.physicsparam, + time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP @@ -55,8 +60,13 @@ void FhatDriver(dstype *fg, dstype *xg, dstype *ug1, dstype *ug2, dstype * og1, if (common.extStab>=1) { #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP + opuStab(fg, xg, ug1, ug2, og1, og2, wg1, wg2, uh, nl, app.tau, app.uinf, app.physicsparam, + time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else opuStab(fg, xg, ug1, ug2, og1, og2, wg1, wg2, uh, nl, app.tau, app.uinf, app.physicsparam, time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/fluxDriver.cpp b/src/Kernel/AppDriver/fluxDriver.cpp index 99f87283..b5e3adea 100644 --- a/src/Kernel/AppDriver/fluxDriver.cpp +++ b/src/Kernel/AppDriver/fluxDriver.cpp @@ -19,8 +19,13 @@ void FluxDriver(dstype *f, dstype *xg, dstype *udg, dstype *odg, dstype *wdg, me /* 2. Compute physical source */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP + opuFlux(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, + common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else opuFlux(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/initodgDriver.cpp b/src/Kernel/AppDriver/initodgDriver.cpp index 5765bc24..5d3bf326 100644 --- a/src/Kernel/AppDriver/initodgDriver.cpp +++ b/src/Kernel/AppDriver/initodgDriver.cpp @@ -9,7 +9,11 @@ void InitodgDriver(dstype *f, dstype *xg, appstruct &app, Int ncx, Int nco, Int /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { - opuInitodg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nco, npe, ne); + #ifdef HAVE_MPP + opuInitodg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nco, npe, ne, app.mix); + #else + opuInitodg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nco, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/initqDriver.cpp b/src/Kernel/AppDriver/initqDriver.cpp index 6b198a3e..8fc0e80a 100644 --- a/src/Kernel/AppDriver/initqDriver.cpp +++ b/src/Kernel/AppDriver/initqDriver.cpp @@ -9,7 +9,11 @@ void InitqDriver(dstype *f, dstype *xg, appstruct &app, Int ncx, Int nc, Int npe /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { - opuInitq(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #ifdef HAVE_MPP + opuInitq(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne, app.mix); + #else + opuInitq(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/inituDriver.cpp b/src/Kernel/AppDriver/inituDriver.cpp index 2c16c0f7..668feb20 100644 --- a/src/Kernel/AppDriver/inituDriver.cpp +++ b/src/Kernel/AppDriver/inituDriver.cpp @@ -9,7 +9,11 @@ void InituDriver(dstype *f, dstype *xg, appstruct &app, Int ncx, Int nc, Int npe /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP + opuInitu(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne, app.mix); + #else opuInitu(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/initudgDriver.cpp b/src/Kernel/AppDriver/initudgDriver.cpp index df6cdc77..4cc9c677 100644 --- a/src/Kernel/AppDriver/initudgDriver.cpp +++ b/src/Kernel/AppDriver/initudgDriver.cpp @@ -9,7 +9,11 @@ void InitudgDriver(dstype *f, dstype *xg, appstruct &app, Int ncx, Int nc, Int n /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { - opuInitudg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #ifdef HAVE_MPP + opuInitudg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne, app.mix); + #else + opuInitudg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/initvDriver.cpp b/src/Kernel/AppDriver/initvDriver.cpp index 08f58e2a..a273c461 100644 --- a/src/Kernel/AppDriver/initvDriver.cpp +++ b/src/Kernel/AppDriver/initvDriver.cpp @@ -9,7 +9,11 @@ void InitvDriver(dstype *f, dstype *xg, appstruct &app, Int ncx, Int nc, Int npe /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { - opuInitv(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #ifdef HAVE_MPP + opuInitv(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne, app.mix); + #else + opuInitv(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/initwDriver.cpp b/src/Kernel/AppDriver/initwDriver.cpp index f03d65c7..da7085a8 100644 --- a/src/Kernel/AppDriver/initwDriver.cpp +++ b/src/Kernel/AppDriver/initwDriver.cpp @@ -9,7 +9,11 @@ void InitwDriver(dstype *f, dstype *xg, appstruct &app, Int ncx, Int nc, Int npe /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { - opuInitw(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #ifdef HAVE_MPP + opuInitw(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne, app.mix); + #else + opuInitw(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, nc, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/initwdgDriver.cpp b/src/Kernel/AppDriver/initwdgDriver.cpp index 62621ec6..01ba2f89 100644 --- a/src/Kernel/AppDriver/initwdgDriver.cpp +++ b/src/Kernel/AppDriver/initwdgDriver.cpp @@ -9,7 +9,11 @@ void InitwdgDriver(dstype *f, dstype *xg, appstruct &app, Int ncx, Int ncw, Int /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { - opuInitwdg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, ncw, npe, ne); + #ifdef HAVE_MPP + opuInitwdg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, ncw, npe, ne, app.mix); + #else + opuInitwdg(f, xg, app.uinf, app.physicsparam, modelnumber, numPoints, ncx, ncw, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/opuApp.cpp b/src/Kernel/AppDriver/opuApp.cpp index b4141e49..91258594 100644 --- a/src/Kernel/AppDriver/opuApp.cpp +++ b/src/Kernel/AppDriver/opuApp.cpp @@ -3,6 +3,10 @@ #include #include +#ifdef _MUTATIONPP +#include +#endif + #include "opuFlux.cpp" #include "opuSource.cpp" #include "opuSourcew.cpp" diff --git a/src/Kernel/AppDriver/outputDriver.cpp b/src/Kernel/AppDriver/outputDriver.cpp index 2408301e..75cc620e 100644 --- a/src/Kernel/AppDriver/outputDriver.cpp +++ b/src/Kernel/AppDriver/outputDriver.cpp @@ -22,8 +22,13 @@ void OutputDriver(dstype *f, dstype *xg, dstype *udg, dstype *odg, dstype *wdg, /* 2. Compute output field */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP opuOutput(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, - common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, nce, npe, ne); + common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, nce, npe, ne, app.mix); + #else + opuOutput(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, + common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, nce, npe, ne); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/sourceDriver.cpp b/src/Kernel/AppDriver/sourceDriver.cpp index 4f315428..f09bc339 100644 --- a/src/Kernel/AppDriver/sourceDriver.cpp +++ b/src/Kernel/AppDriver/sourceDriver.cpp @@ -23,8 +23,13 @@ void SourceDriver(dstype *f, dstype *xg, dstype *udg, dstype *odg, dstype *wdg, /* 2. Compute physical source */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP opuSource(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, - common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else + opuSource(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, + common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/sourcewDriver.cpp b/src/Kernel/AppDriver/sourcewDriver.cpp index d85ea4eb..f722987c 100644 --- a/src/Kernel/AppDriver/sourcewDriver.cpp +++ b/src/Kernel/AppDriver/sourcewDriver.cpp @@ -18,8 +18,13 @@ void SourcewDriver(dstype *f, dstype *xg, dstype *udg, dstype *odg, dstype *wdg, /* 2. Compute physical source */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP opuSourcew(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, common.modelnumber, - numPoints, nc, ncu, nd, ncx, nco, ncw, ncw, npe, ne); + numPoints, nc, ncu, nd, ncx, nco, ncw, ncw, npe, ne, app.mix); + #else + opuSourcew(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, common.modelnumber, + numPoints, nc, ncu, nd, ncx, nco, ncw, ncw, npe, ne, app.mix); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/tdfuncDriver.cpp b/src/Kernel/AppDriver/tdfuncDriver.cpp index 47598c97..02c733d8 100644 --- a/src/Kernel/AppDriver/tdfuncDriver.cpp +++ b/src/Kernel/AppDriver/tdfuncDriver.cpp @@ -18,8 +18,13 @@ void TdfuncDriver(dstype *f, dstype *xg, dstype *udg, dstype *odg, dstype *wdg, /* 2. Compute physical source */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP opuTdfunc(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, - common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else + opuTdfunc(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, + common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/ubouDriver.cpp b/src/Kernel/AppDriver/ubouDriver.cpp index b34633bf..0c3041ce 100644 --- a/src/Kernel/AppDriver/ubouDriver.cpp +++ b/src/Kernel/AppDriver/ubouDriver.cpp @@ -18,8 +18,13 @@ void UbouDriver(dstype *fb, dstype *xg, dstype *udg, dstype * odg, dstype * wdg, /* 3. Compute physical boundary conditions */ #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP + opuUbou(fb, xg, udg, odg, wdg, uhg, nl, app.tau, app.uinf, app.physicsparam, time, + common.modelnumber, ib, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else opuUbou(fb, xg, udg, odg, wdg, uhg, nl, app.tau, app.uinf, app.physicsparam, time, common.modelnumber, ib, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/AppDriver/uhatDriver.cpp b/src/Kernel/AppDriver/uhatDriver.cpp index 6a7b4d75..896f49cd 100644 --- a/src/Kernel/AppDriver/uhatDriver.cpp +++ b/src/Kernel/AppDriver/uhatDriver.cpp @@ -19,8 +19,13 @@ void UhatDriver(dstype *fg, dstype *xg, dstype *ug1, dstype *ug2, dstype * og1, if (common.extUhat==1) { #ifdef HAVE_ONETHREAD if (backend==0) { + #ifdef HAVE_MPP + opuUhat(fg, xg, ug1, ug2, og1, og2, wg1, wg2, uh, nl, app.tau, app.uinf, app.physicsparam, + time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw, app.mix); + #else opuUhat(fg, xg, ug1, ug2, og1, og2, wg1, wg2, uh, nl, app.tau, app.uinf, app.physicsparam, time, common.modelnumber, numPoints, nc, ncu, nd, ncx, nco, ncw); + #endif } #endif #ifdef HAVE_OPENMP diff --git a/src/Kernel/Common/application.h b/src/Kernel/Common/application.h index 2e5434c2..966eeee9 100644 --- a/src/Kernel/Common/application.h +++ b/src/Kernel/Common/application.h @@ -1,6 +1,9 @@ #ifndef __APPLICATION_H__ #define __APPLICATION_H__ - +#ifdef _MUTATIONPP +#include +// using namespace Mutation; +#endif #ifdef HAVE_ONETHREAD template void opuFlux(T *f, T *pg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw); @@ -35,6 +38,41 @@ template void opuInitudg(T *udg, T *xdg, T *uinf, T *param, int mod template void opuInitwdg(T *udg, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int ncw, int npe, int ne); template void opuInitodg(T *udg, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nco, int npe, int ne); +#ifdef _MUTATIONPP +template void opuFlux(T *f, T *pg, T *udg, T *odg, T *wdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuSource(T *s, T *pg, T *udg, T *odg, T *wdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuSourcew(T *s, T *pg, T *udg, T *odg, T *wdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *); +template void opuTdfunc(T *s, T *pg, T *udg, T *odg, T *wdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuFbou(T *fh, T *pg, T *udg, T *odg, T *wdg, T *uhg, T *nl, + T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, + int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuUbou(T *ub, T *pg, T *udg, T *odg, T *wdg, T *uhg, T *nl, + T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, + int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuAvfield(T *avfield, T *xdg, T *udg, T *odg, T *wdg, T *uinf, + T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *); +template void opuOutput(T *output, T *xdg, T *udg, T *odg, T *wdg, T *uinf, + T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *); +template void opuFhat(T *fh, T *xg, T *udg1, T *udg2, T *odg1, T *odg2, + T *wdg1, T *wdg2, T *uhg, T *nl, T *tau, T *uinf, T *param, T time, int modelnumber, + int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuUhat(T *fh, T *xg, T *udg1, T *udg2, T *odg1, T *odg2, + T *wdg1, T *wdg2, T *uhg, T *nl, T *tau, T *uinf, T *param, T time, int modelnumber, + int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuStab(T *fh, T *xg, T *udg1, T *udg2, T *odg1, T *odg2, + T *wdg1, T *wdg2, T *uhg, T *nl, T *tau, T *uinf, T *param, T time, int modelnumber, + int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *); +template void opuInitu(T *udg, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nc, int npe, int ne, Mutation::Mixture *); +template void opuInitq(T *udg, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nc, int npe, int ne, Mutation::Mixture *); +template void opuInitudg(T *udg, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nc, int npe, int ne, Mutation::Mixture *); +template void opuInitwdg(T *udg, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int ncw, int npe, int ne, Mutation::Mixture *); +template void opuInitodg(T *udg, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nco, int npe, int ne, Mutation::Mixture *); +#endif + #ifdef HAVE_ENZYME template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw); diff --git a/src/Kernel/Common/common.h b/src/Kernel/Common/common.h index 4d55afd2..fdacf9a2 100644 --- a/src/Kernel/Common/common.h +++ b/src/Kernel/Common/common.h @@ -56,6 +56,10 @@ typedef int Int; // int enzyme_const, enzyme_dup; // #endif +#ifdef HAVE_MPP +#include +#endif + #define MKL_INT int #define CPUFREE(x) \ @@ -327,6 +331,9 @@ struct appstruct { dstype *dtcoef_q=NULL; /* factor when discretizing the time derivative of the Q equation. Allow scalar field for local time stepping in steady problems? */ dstype *dtcoef_p=NULL; /* factor when discretizing the time derivative of the P equation. Allow scalar field for local time stepping in steady problems? */ + #ifdef HAVE_MPP + Mutation::Mixture *mix=NULL; + #endif // custom destructor void freememory(Int hostmemory) { diff --git a/src/Kernel/Discretization/readbinaryfiles.cpp b/src/Kernel/Discretization/readbinaryfiles.cpp index 6ecafe95..dfed5cfc 100644 --- a/src/Kernel/Discretization/readbinaryfiles.cpp +++ b/src/Kernel/Discretization/readbinaryfiles.cpp @@ -7,6 +7,11 @@ #include "../AppDriver/initwdgDriver.cpp" #include "../AppDriver/initodgDriver.cpp" +#include + +#ifdef HAVE_MPP +#include +#endif void readappstruct(string filename, appstruct &app) { // Open file to read @@ -35,6 +40,28 @@ void readappstruct(string filename, appstruct &app) app.vindx = readiarrayfromdouble(in, app.nsize[12]); readarray(in, &app.dae_dt, app.nsize[13]); + #ifdef HAVE_MPP + char a[50]; + in.getline(a, 50, 'X'); + string MixtureName = a; + + char b[50]; + in.getline(b, 50, 'X'); + string StateModel = b; + + char c[50]; + in.getline(c, 50, 'X'); + string ThermoDB = c; + + Mutation::MixtureOptions opts(MixtureName); + opts.setStateModel(StateModel); + opts.setThermodynamicDatabase(ThermoDB); + + app.mix = new Mutation::Mixture(opts); + + printf("Mutation mixture initialized\n"); + #endif + Int i, ncu, ncq, ncp; ncu = app.ndims[6];// number of compoments of (u) ncq = app.ndims[7];// number of compoments of (q) diff --git a/src/Kernel/Main/main.cpp b/src/Kernel/Main/main.cpp index 0e9c60ab..1cf1c2fb 100644 --- a/src/Kernel/Main/main.cpp +++ b/src/Kernel/Main/main.cpp @@ -42,7 +42,7 @@ #endif #ifdef HAVE_MPP -#include +#include #endif #ifdef HAVE_MPI diff --git a/src/Matlab/Preprocessing/initializepde.m b/src/Matlab/Preprocessing/initializepde.m index 5ac2018d..fd483af8 100644 --- a/src/Matlab/Preprocessing/initializepde.m +++ b/src/Matlab/Preprocessing/initializepde.m @@ -115,6 +115,4 @@ pde.dae_steps = 0; pde.dae_dt = 0.0; % dual time steps - - - +pde.mutationflag = 0; % mutation options \ No newline at end of file diff --git a/src/Matlab/Preprocessing/writeapp.m b/src/Matlab/Preprocessing/writeapp.m index 3ce5f552..8a8eb89d 100644 --- a/src/Matlab/Preprocessing/writeapp.m +++ b/src/Matlab/Preprocessing/writeapp.m @@ -73,6 +73,11 @@ fwrite(fileID,app.vindx(:)-1,'double',endian); end fwrite(fileID,app.dae_dt(:),'double',endian); +if app.mutationflag + fwrite(fileID,strcat(app.mutationopts{1}, "X"),'char',endian); % Mixture name + fwrite(fileID,strcat(app.mutationopts{2}, "X"),'char',endian); % State model + fwrite(fileID,strcat(app.mutationopts{3}, "X"),'char',endian); % Thermo DB +end fclose(fileID); From baa58f2d6b1420094961be3fa0917ea1c014e0b3 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Thu, 13 Jan 2022 15:33:33 -0500 Subject: [PATCH 03/23] working code compilation matlab --- src/Matlab/Gencode/compilecode.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Matlab/Gencode/compilecode.m b/src/Matlab/Gencode/compilecode.m index 3541a227..88eb874e 100644 --- a/src/Matlab/Gencode/compilecode.m +++ b/src/Matlab/Gencode/compilecode.m @@ -12,6 +12,7 @@ enzyme = app.enzyme; cpuflags = app.cpuflags; gpuflags = app.gpuflags; +mutationflag = app.mutationflag; % current directory cdir = pwd(); @@ -45,12 +46,26 @@ compilerstr{i} = ""; end +if mutationflag + mutationpath = app.mutationpath; + + mutationinclude = " -D _MUTATIONPP"; + mutationinclude = append(mutationinclude, " -I ", mutationpath, "/install/include/mutation++/"); + mutationinclude = append(mutationinclude, " -I ", mutationpath, "/thirdparty/eigen/"); + mutationinclude = append(mutationinclude, " -I ", mutationpath, "/install/"); + + mutationlib = append(" -L ", mutationpath, "/install/lib/ -lmutation++"); +end + if ~isempty(cpucompiler) if (~isempty(enzyme)) compilerstr{1} = cpucompiler + " -D _ENZYME -fPIC -O3 -c opuApp.cpp" + " -Xclang -load -Xclang " + coredir + enzyme; else compilerstr{1} = cpucompiler + " -fPIC -O3 -c opuApp.cpp"; end + if mutationflag + compilerstr{1} = append(compilerstr{1}, mutationinclude); + end compilerstr{2} = "ar -rvs opuApp.a opuApp.o"; end @@ -59,6 +74,8 @@ compilerstr{4} = "ar -rvs gpuApp.a gpuApp.o"; end + + if (~isempty(cpuflags)>0) && (~isempty(cpucompiler)>0) str2 = coredir + "commonCore.a " + coredir + "opuCore.a " + "opuApp.a "; str3 = cpuflags; @@ -69,6 +86,9 @@ str1 = cpucompiler + " -std=c++11 " + maindir + "main.cpp " + "-o serial" + appname + " "; compilerstr{5} = str1 + str2 + str3; end + if mutationflag + compilerstr{5} = append(compilerstr{5}, mutationinclude, mutationlib); + end end if (~isempty(cpuflags)) && (~isempty(mpicompiler)>0) @@ -76,6 +96,9 @@ str2 = coredir + "commonCore.a " + coredir + "opuCore.a " + "opuApp.a "; str3 = cpuflags; compilerstr{6} = str1 + str2 + str3; + if mutationflag + compilerstr{6} = append(compilerstr{6}, mutationinclude, mutationlib); + end end if (~isempty(cpuflags)>0) && (~isempty(cpucompiler)>0) && (~isempty(gpucompiler)>0) && (~isempty(gpuflags)>0) From 26e6f3ac568d12903db86fa5add3a46d94d3633e Mon Sep 17 00:00:00 2001 From: rloekvh Date: Thu, 13 Jan 2022 18:15:25 -0500 Subject: [PATCH 04/23] Mutation interface with Julia and Python --- src/Julia/Gencode/compilecode.jl | 21 +++++++++++++++++++ src/Julia/Preprocessing/initializepde.jl | 8 +++++++ src/Julia/Preprocessing/writeapp.jl | 5 +++++ src/Kernel/AppDriver/sourcewDriver.cpp | 2 +- src/Kernel/Discretization/readbinaryfiles.cpp | 4 +--- src/Python/Gencode/compilecode.py | 16 ++++++++++++++ src/Python/Preprocessing/initializepde.py | 2 ++ src/Python/Preprocessing/writeapp.py | 8 +++++++ 8 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/Julia/Gencode/compilecode.jl b/src/Julia/Gencode/compilecode.jl index ce6a0c87..142c0d86 100644 --- a/src/Julia/Gencode/compilecode.jl +++ b/src/Julia/Gencode/compilecode.jl @@ -13,6 +13,7 @@ gpucompiler = app.gpucompiler; enzyme = app.enzyme; cpuflags = app.cpuflags; gpuflags = app.gpuflags; +mutationflag = app.mutationflag # current directory cdir = pwd(); @@ -45,12 +46,26 @@ cp(appdriverdir * "gpuApp.cu", cdir * "/gpuApp.cu", force=true); compilerstr = Array{String, 1}(undef, 12); +if mutationflag == 1 + mutationpath = app.mutationpath; + + mutationinclude = " -D _MUTATIONPP"; + mutationinclude = mutationinclude * " -I " * mutationpath * "/install/include/mutation++/" + mutationinclude = mutationinclude * " -I " * mutationpath * "/thirdparty/eigen/" + mutationinclude = mutationinclude * " -I " * mutationpath * "/install/" + + mutationlib = " -L " * mutationpath * "/install/lib/ -lmutation++" +end + if length(cpucompiler)>0 if (length(enzyme)>0) compilerstr[1] = cpucompiler * " -D _ENZYME -fPIC -O3 -c opuApp.cpp" * " -Xclang -load -Xclang " * coredir * enzyme; else compilerstr[1] = cpucompiler * " -fPIC -O3 -c opuApp.cpp"; end + if mutationflag == 1 + compilerstr[1] = compilerstr[1] * mutationinclude + end compilerstr[2] = "ar -rvs opuApp.a opuApp.o"; else compilerstr[1] = ""; @@ -77,6 +92,9 @@ if (length(cpuflags)>0) && (length(cpucompiler)>0) str1 = cpucompiler * " -std=c++11 " * maindir * "main.cpp " * "-o serial" * appname * " "; compilerstr[5] = str1 * str2 * str3; end + if mutationflag == 1 + compilerstr[5] = compilerstr[5] * mutationinclude * mutationlib + end end if (length(cpuflags)>0) && (length(mpicompiler)>0) @@ -84,6 +102,9 @@ if (length(cpuflags)>0) && (length(mpicompiler)>0) str2 = coredir * "commonCore.a " * coredir * "opuCore.a " * "opuApp.a "; str3 = cpuflags; compilerstr[6] = str1 * str2 * str3; + if mutationflag == 1 + compilerstr[6]= compilerstr[6] * mutationinclude * mutationlib + end end if (length(cpuflags)>0) && (length(cpucompiler)>0) && (length(gpucompiler)>0) && (length(gpuflags)>0) diff --git a/src/Julia/Preprocessing/initializepde.jl b/src/Julia/Preprocessing/initializepde.jl index 213564ee..933d4183 100644 --- a/src/Julia/Preprocessing/initializepde.jl +++ b/src/Julia/Preprocessing/initializepde.jl @@ -117,6 +117,10 @@ mutable struct PDEStruct dae_steps::IntP; dae_dt::Array{FloatP,1}; # dual time steps + mutationflag::IntP + mutationopts::Dict + mutationpath::String + PDEStruct() = new(); end @@ -241,6 +245,10 @@ function initializepde(version) pde.dae_steps = 0; pde.dae_dt = [0.0]; # dual time steps + pde.mutationflag = 0 + pde.mutationopts = Dict() + pde.mutationpath = "" + return pde; end diff --git a/src/Julia/Preprocessing/writeapp.jl b/src/Julia/Preprocessing/writeapp.jl index ca8ed47f..34a013d1 100644 --- a/src/Julia/Preprocessing/writeapp.jl +++ b/src/Julia/Preprocessing/writeapp.jl @@ -90,6 +90,11 @@ if nsize[14]>0 write(fileID,app.dae_dt[:]); end +if app.mutationflag == 1 + write(fileID, app.mutationopts["MixtureName"] * "X") + write(fileID, app.mutationopts["StateModel"] * "X") + write(fileID, app.mutationopts["ThermoDB"] * "X") +end close(fileID); return app; diff --git a/src/Kernel/AppDriver/sourcewDriver.cpp b/src/Kernel/AppDriver/sourcewDriver.cpp index f722987c..f029b724 100644 --- a/src/Kernel/AppDriver/sourcewDriver.cpp +++ b/src/Kernel/AppDriver/sourcewDriver.cpp @@ -23,7 +23,7 @@ void SourcewDriver(dstype *f, dstype *xg, dstype *udg, dstype *odg, dstype *wdg, numPoints, nc, ncu, nd, ncx, nco, ncw, ncw, npe, ne, app.mix); #else opuSourcew(f, xg, udg, odg, wdg, app.uinf, app.physicsparam, time, common.modelnumber, - numPoints, nc, ncu, nd, ncx, nco, ncw, ncw, npe, ne, app.mix); + numPoints, nc, ncu, nd, ncx, nco, ncw, ncw, npe, ne); #endif } #endif diff --git a/src/Kernel/Discretization/readbinaryfiles.cpp b/src/Kernel/Discretization/readbinaryfiles.cpp index dfed5cfc..4029c2d2 100644 --- a/src/Kernel/Discretization/readbinaryfiles.cpp +++ b/src/Kernel/Discretization/readbinaryfiles.cpp @@ -39,12 +39,11 @@ void readappstruct(string filename, appstruct &app) app.stgib = readiarrayfromdouble(in, app.nsize[11]); app.vindx = readiarrayfromdouble(in, app.nsize[12]); readarray(in, &app.dae_dt, app.nsize[13]); - #ifdef HAVE_MPP char a[50]; in.getline(a, 50, 'X'); string MixtureName = a; - + char b[50]; in.getline(b, 50, 'X'); string StateModel = b; @@ -58,7 +57,6 @@ void readappstruct(string filename, appstruct &app) opts.setThermodynamicDatabase(ThermoDB); app.mix = new Mutation::Mixture(opts); - printf("Mutation mixture initialized\n"); #endif diff --git a/src/Python/Gencode/compilecode.py b/src/Python/Gencode/compilecode.py index b27a2729..4dd0db0a 100644 --- a/src/Python/Gencode/compilecode.py +++ b/src/Python/Gencode/compilecode.py @@ -19,6 +19,8 @@ def compilecode(app): cpuflags = app['cpuflags']; gpuflags = app['gpuflags']; + mutationflag = app['mutationflag'] + # current directory cdir = os.getcwd(); ii = cdir.find(codename) @@ -43,6 +45,14 @@ def compilecode(app): shutil.copyfile(appdriverdir + "gpuApp.cu", cdir + "/gpuApp.cu"); compilerstr = ["" for i in range(12)] + if mutationflag: + mutationpath = app['mutationpath'] + mutationinclude = " -D _MUTATIONPP"; + mutationinclude = mutationinclude + " -I " + mutationpath + "/install/include/mutation++/" + mutationinclude = mutationinclude + " -I " + mutationpath + "/thirdparty/eigen/" + mutationinclude = mutationinclude + " -I " + mutationpath + "/install/" + + mutationlib = " -L " + mutationpath + "/install/lib/ -lmutation++" if size(cpucompiler)>0: #compilerstr[0] = cpucompiler + " -fPIC -O3 -c opuApp.cpp"; @@ -50,6 +60,8 @@ def compilecode(app): compilerstr[0] = cpucompiler + " -D _ENZYME -fPIC -O3 -c opuApp.cpp" + " -Xclang -load -Xclang " + coredir + enzyme; else: compilerstr[0] = cpucompiler + " -fPIC -O3 -c opuApp.cpp"; + if mutationflag: + compilerstr[0] = compilerstr[0] + mutationinclude compilerstr[1] = "ar -rvs opuApp.a opuApp.o"; else: compilerstr[0] = ""; @@ -73,12 +85,16 @@ def compilecode(app): else: str1 = cpucompiler + " -std=c++11 " + maindir + "main.cpp " + "-o serial" + appname + " "; compilerstr[4] = str1 + str2 + str3; + if mutationflag: + compilerstr[4] = compilerstr[4] + mutationinclude + mutationlib if ( size(cpuflags)>0) and ( size(mpicompiler)>0): str1 = mpicompiler + " -std=c++11 -D _MPI " + maindir + "main.cpp " + "-o mpi" + appname + " "; str2 = coredir + "commonCore.a " + coredir + "opuCore.a " + "opuApp.a "; str3 = cpuflags; compilerstr[5] = str1 + str2 + str3; + if mutationflag: + compilerstr[5] = compilerstr[5] + mutationinclude + mutationlib if ( size(cpuflags)>0) and ( size(cpucompiler)>0) and ( size(gpucompiler)>0) and ( size(gpuflags)>0): str1 = cpucompiler + " -std=c++11 -D _CUDA " + maindir + "main.cpp " + "-o gpu" + appname + " "; diff --git a/src/Python/Preprocessing/initializepde.py b/src/Python/Preprocessing/initializepde.py index 862badcd..93b2d521 100644 --- a/src/Python/Preprocessing/initializepde.py +++ b/src/Python/Preprocessing/initializepde.py @@ -118,4 +118,6 @@ def initializepde(version): pde['dae_steps'] = 0; pde['dae_dt'] = numpy.array([0.0]); # dual time steps + pde['mutationflag'] = 0 + return pde diff --git a/src/Python/Preprocessing/writeapp.py b/src/Python/Preprocessing/writeapp.py index 029fb336..9dbbf260 100644 --- a/src/Python/Preprocessing/writeapp.py +++ b/src/Python/Preprocessing/writeapp.py @@ -103,6 +103,14 @@ def writeapp(app,filename): app['dae_dt'] = array(app['dae_dt']).flatten(order = 'F'); app['dae_dt'].astype('float64').tofile(fileID); + if app['mutationflag']: + app['mutationopts']['MixtureName'] = array((app['mutationopts']['MixtureName'] +'X').encode()) + app['mutationopts']['MixtureName'].tofile(fileID) + app['mutationopts']['StateModel'] = array((app['mutationopts']['StateModel'] +'X').encode()) + app['mutationopts']['StateModel'].tofile(fileID) + app['mutationopts']['ThermoDB'] = array((app['mutationopts']['ThermoDB'] +'X').encode()) + app['mutationopts']['ThermoDB'].tofile(fileID) + fileID.close(); return app; From 47625ac2dceffd8fd1af86d8a0682dac1d04a0a1 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Wed, 23 Feb 2022 13:54:08 -0500 Subject: [PATCH 05/23] add shock relaxation example [WIP] --- .../1DShockTube/app/compileMutation.sh | 5 + .../1DShockTube/app/fixargsMPP_Mac.sh | 6 + .../Hypersonics/1DShockTube/app/movefiles.sh | 5 + .../1DShockTube/app/opuInituMPP.cpp | 45 +++++ .../1DShockTube/app/opuInitwdgMPP.cpp | 101 ++++++++++ .../1DShockTube/app/opuSourcewMPP.cpp | 40 ++++ Applications/Hypersonics/1DShockTube/pdeapp.m | 126 +++++++++++++ .../Hypersonics/1DShockTube/pdemodel.m | 163 ++++++++++++++++ .../Hypersonics/1DShockTube/pdemodel_inflow.m | 178 ++++++++++++++++++ .../Hypersonics/1DShockTube/smoothstep.m | 17 ++ .../Hypersonics/1DShockTube/smoothstep_down.m | 16 ++ .../Hypersonics/1DShockTube/smoothstep_up.m | 15 ++ 12 files changed, 717 insertions(+) create mode 100755 Applications/Hypersonics/1DShockTube/app/compileMutation.sh create mode 100755 Applications/Hypersonics/1DShockTube/app/fixargsMPP_Mac.sh create mode 100755 Applications/Hypersonics/1DShockTube/app/movefiles.sh create mode 100644 Applications/Hypersonics/1DShockTube/app/opuInituMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/pdeapp.m create mode 100644 Applications/Hypersonics/1DShockTube/pdemodel.m create mode 100644 Applications/Hypersonics/1DShockTube/pdemodel_inflow.m create mode 100644 Applications/Hypersonics/1DShockTube/smoothstep.m create mode 100644 Applications/Hypersonics/1DShockTube/smoothstep_down.m create mode 100644 Applications/Hypersonics/1DShockTube/smoothstep_up.m diff --git a/Applications/Hypersonics/1DShockTube/app/compileMutation.sh b/Applications/Hypersonics/1DShockTube/app/compileMutation.sh new file mode 100755 index 00000000..85433a9a --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/compileMutation.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# /opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++ +/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++ -fPIC -O3 -c opuApp.cpp -D _MUTATIONPP -I /Users/rloekvh/Mutationpp/install/include/mutation++/ -I /Users/rloekvh/Mutationpp/thirdparty/eigen/ -I /Users/rloekvh/Mutationpp/install/ +ar -rvs opuApp.a opuApp.o +/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++ -std=c++11 ../../../../src/Kernel/Main/main.cpp -o serialapp ../../../../lib/Mac/commonCore.a ../../../../lib/Mac/opuCore.a opuApp.a -arch arm64 -O2 -ldl -lm -lblas -llapack -D _MUTATIONPP -I /Users/rloekvh/Mutationpp/install/include/mutation++/ -I /Users/rloekvh/Mutationpp/thirdparty/eigen/ -I /Users/rloekvh/Mutationpp/install/ -L /Users/rloekvh/Mutationpp/install/lib/ -lmutation++ diff --git a/Applications/Hypersonics/1DShockTube/app/fixargsMPP_Mac.sh b/Applications/Hypersonics/1DShockTube/app/fixargsMPP_Mac.sh new file mode 100755 index 00000000..91968410 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/fixargsMPP_Mac.sh @@ -0,0 +1,6 @@ +#!/bin/bash +sed -i '' 's/int ncw)/int ncw, Mutation::Mixture *mix)/g' opu*.cpp +sed -i '' 's/int ne)/int ne, Mutation::Mixture *mix)/g' opu*.cpp +sed -i '' 's/, ncw)/, ncw, mix)/g' opu*.cpp +sed -i '' 's/, ne)/, ne, mix)/g' opu*.cpp +sed -i '' 's/int)/int, Mutation::Mixture *)/g' opu*.cpp \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/app/movefiles.sh b/Applications/Hypersonics/1DShockTube/app/movefiles.sh new file mode 100755 index 00000000..28be2086 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/movefiles.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cp opuInituMPP.cpp opuInitu.cpp +cp opuInitwdgMPP.cpp opuInitwdg.cpp +cp opuSourcewMPP.cpp opuSourcew.cpp \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/app/opuInituMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuInituMPP.cpp new file mode 100644 index 00000000..339e8d1e --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuInituMPP.cpp @@ -0,0 +1,45 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + for (int ispecies = 0; ispecies < nspecies; ispecies++ ) + { + f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]; + } + f[j+npe*nspecies+npe*nce*k] = mix->P(); + + } +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp new file mode 100644 index 00000000..5abcdcb7 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp @@ -0,0 +1,40 @@ +template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + for (int ispecies = 0; ispecies < nspecies; ispecies++ ) + { + f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]; + } + f[j+npe*nspecies+npe*nce*k] = mix->P(); + } +} + +template void opuSourcew(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSourcew(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/pdeapp.m b/Applications/Hypersonics/1DShockTube/pdeapp.m new file mode 100644 index 00000000..482a3420 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -0,0 +1,126 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +% pde.cpuappflags = "-arch x86_64"; +% pde.cpulibflags = "-arch x86_64"; +% pde.cpuflags = "-arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelC"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_inflow"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +%pde.platform = "gpu"; % choose this option if NVIDIA GPUs are available +pde.mpiprocs = 1; % number of MPI processors + +% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 1; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages +nt = 100; +pde.dt = 1e-5*ones(1,nt); % time step sizes +% pde.saveSolFreq = 100; +% pde.soltime = 1:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected + +%Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 40; +pde.matvectol = 1e-3; +pde.NLiter = 4; +% pde.RBdim = 10 + +% rhoL = [0 0 0.000936356 0.000248905 0]; +% rhouL = 4.74105; +% rhoEL = 12226.7; +% rhoR = [0 0 0.00691678 0.00183864 0]; +% rhouR = 4.74544; +% rhoER = 72810.4; +rho_pre = [0 0 0 0.000911061 0.000242181 ]; +rhou_pre = 4.61296; +rhoE_pre = 9128.09; + +rho_post = [0 0 0 0.00672992 0.00178897 ]; +rhou_post = 4.61724; +rhoE_post = 52157.2; + +pde.physicsparam = [rho_pre(:)', rhou_pre, rhoE_pre, rho_post(:)', rhou_post, rhoE_post]; +% pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; + % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 +pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 5, 1000]; % DG stabilization parameter +% pde.tau = 5; +pde.dae_alpha = 0; +pde.dae_beta = 1; +% create a grid of 8 by 8 on the unit square +nDiv = 2^11; + +[mesh.p,mesh.t] = linemesh(nDiv-1); +a = -0.1; b = 1; +mesh.p = a + (b-a)*mesh.p; +mesh.p = loginc(mesh.p, 5); +% expressions for domain boundaries +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary + +%% call exasim to generate and run C++ code to solve the PDE model +% [sol,pde,mesh,master,dmd] = exasim(pde,mesh); + +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +% eval('!./movefiles.sh'); +% eval('!cp opuInituMPP.cpp opuInitu.cpp'); +eval('!cp opuInitwdgMPP.cpp opuInitwdg.cpp'); +eval('!cp opuSourcewMPP.cpp opuSourcew.cpp'); +% eval('!./compileMutation.sh'); +cd(".."); +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +runstr = runcode(pde); + +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +ti = nt; +sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); +for i = 1:5 + u = sol(:,i,:); + subplot(1,3,1) + hold on + plot(dgnodes(:),u(:),'LineWidth',1.3) +end +u = sol(:,6,:); +subplot(1,3,2) +plot(dgnodes(:),u(:),'LineWidth',1.3); + +u = sol(:,7,:); +subplot(1,3,3) +plot(dgnodes(:), u(:),'LineWidth',1.3) + +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); +% w = solw(:,6,:); +% figure(2); +% plot(dgnodes(:),w(:)) + + + diff --git a/Applications/Hypersonics/1DShockTube/pdemodel.m b/Applications/Hypersonics/1DShockTube/pdemodel.m new file mode 100644 index 00000000..e40c7b0c --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdemodel.m @@ -0,0 +1,163 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.sourcew = @sourcew; + pde.initw = @initw; +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + m = sym(ones(nspecies + 2, 1)); + m = sym([1.0; 1.0; 1.0; 1.0; 1.0]); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + u = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % Mutation outputs + + p = w(nspecies + 1); %pressure + + H = E+p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + f(ispecies) = rho_i(ispecies) * u; + end + f(nspecies + 1) = rhou * u + p; + f(nspecies + 2) = rhou * H; +end + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + s = sym(zeros(nspecies + 2,1)); + omega_i = sym(zeros(nspecies,1)); + rho_i = sym(zeros(5,1)); + rho = 0; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1/ rho; + u = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % Mutation outputs + for ispecies = 1:nspecies + omega_i(ispecies) = w(ispecies); + end + p = w(nspecies + 1); %pressure + + H = E+p*rhoinv; %enthalpy + + % Sources + for ispecies = 1:nspecies + s(ispecies) = omega_i(ispecies); + end +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ub = sym(zeros(nspecies+2, 2)); + + rhoL = mu(1:nspecies); + rhouL = mu(nspecies+1); + rhoEL = mu(nspecies+2); + + rhoR = mu(nspecies+3:2*nspecies+2); + rhouR = mu(2*nspecies+3); + rhoER = mu(2*nspecies+4); + + ub(:,1) = [rhoL(:); rhouL; rhoEL]; + ub(:,2) = [rhoR(:); rhouR; rhoER]; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + + fb(:,1) = f*n(1) + tau(1)*(u-uhat); + fb(:,2) = f*n(1) + tau(1)*(u-uhat); +end + +function u0 = initu(x, mu, eta) + % To be manually modified + nspecies = 5; + u0 = sym(zeros(nspecies+2)); + + rhoL = mu(1:nspecies); + rhouL = mu(nspecies+1); + rhoEL = mu(nspecies+2); + + rhoR = mu(nspecies+3:2*nspecies+2); + rhouR = mu(2*nspecies+3); + rhoER = mu(2*nspecies+4); + + u0 = [rhoL(:) + rhoR(:); rhouL + rhouR; rhoEL + rhoER]; +end + +function sw = sourcew(u, q, w, v, x, t, mu, eta) + nspecies = 5; + + sw = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + u = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % Mutation inputs + rhoe = rhoE - 0.5 * rho * u^2; + for i = 1:nspecies + sw(i) = rho_i(i); + end + sw(nspecies + 1) = rhoe; +end + +function w0 = initw(x, mu, eta) + nspecies = 5; + w0 = sym(zeros(nspecies + 1,1)); +end \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m new file mode 100644 index 00000000..f42c2a43 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m @@ -0,0 +1,178 @@ + +function pde = pdemodel_inflow + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.sourcew = @sourcew; + pde.initw = @initw; +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + m = sym(ones(nspecies + 2, 1)); + m = sym([1.0; 1.0; 1.0; 1.0; 1.0]); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + u = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % Mutation outputs + + p = w(nspecies + 1); %pressure + + H = E+p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + f(ispecies) = rho_i(ispecies) * u; + end + f(nspecies + 1) = rhou * u + p; + f(nspecies + 2) = rhou * H; +% f(nspecies + 2) = (rhoE + p)*u; +end + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + s = sym(zeros(nspecies + 2,1)); + omega_i = sym(zeros(nspecies,1)); + rho_i = sym(zeros(5,1)); + rho = 0; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1/ rho; + u = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % Mutation outputs + for ispecies = 1:nspecies + omega_i(ispecies) = w(ispecies); + end + p = w(nspecies + 1); %pressure + + H = E+p*rhoinv; %enthalpy + + % Sources + for ispecies = 1:nspecies + s(ispecies) = omega_i(ispecies); + end +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ub = sym(zeros(nspecies+2, 2)); + +% rhoL = mu(1:nspecies); +% rhouL = mu(nspecies+1); +% rhoEL = mu(nspecies+2); +% +% rho_post = mu(nspecies+3:2*nspecies+2); +% rhou_post = mu(2*nspecies+3); +% rhoE_post = mu(2*nspecies+4); + +% ub(:,1) = [rhoL(:); rhouL; rhoEL]; + + ub(:,1) = mu(8:14); +% ub(:,1) = u(:); + ub(:,2) = u(:); +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + finflow = flux(mu(8:14), q, w, v, x, t, mu, eta); + fb(:,1) = finflow*n(1) + tau.*(mu(8:14)-uhat); +% fb(:,1) = f*n(1) + tau.*(u-uhat); + fb(:,2) = f*n(1) + tau.*(u-uhat); +end + +function u0 = initu(x, mu, eta) + % To be manually modified + nspecies = 5; + u0 = sym(zeros(nspecies+2,1)); + + rho_pre = mu(1:nspecies); + rhou_pre = mu(nspecies+1); + rhoE_pre = mu(nspecies+2); + + rho_post = mu(nspecies+3:2*nspecies+2); + rhou_post = mu(2*nspecies+3); + rhoE_post = mu(2*nspecies+4); + +% for i = 1:nspecies +% u0(i) = smoothstep(x, rho_post(i), rho_pre(i), 1/1000); +% end + u0(1) = smoothstep_up(x, rho_post(1), rho_pre(1), 1/100); + u0(2) = smoothstep_up(x, rho_post(2), rho_pre(2), 1/100); + u0(3) = smoothstep_up(x, rho_post(3), rho_pre(3), 1/100); + u0(4) = smoothstep_down(x, rho_post(4), rho_pre(4), 1/100); + u0(5) = smoothstep_down(x, rho_post(5), rho_pre(5), 1/100); + u0(nspecies+1) = smoothstep_down(x, rhou_post, rhou_pre, 1/100); + u0(nspecies+2) = smoothstep_down(x, rhoE_post, rhoE_pre, 1/100); +% u0 = [rhoL(:) + rhoR(:); rhouL + rhouR; rhoEL + rhoER]; +end + +function sw = sourcew(u, q, w, v, x, t, mu, eta) + nspecies = 5; + + sw = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + u = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % Mutation inputs + rhoe = rhoE - 0.5 * rho * u^2; + for i = 1:nspecies + sw(i) = rho_i(i); + end + sw(nspecies + 1) = rhoe; +end + +function w0 = initw(x, mu, eta) + nspecies = 5; + w0 = sym(zeros(nspecies + 1,1)); +end \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/smoothstep.m b/Applications/Hypersonics/1DShockTube/smoothstep.m new file mode 100644 index 00000000..2ba057bd --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/smoothstep.m @@ -0,0 +1,17 @@ +function [out] = smoothstep(x,y1,y2,b) +if y1 < y2 + flip = 1; + ymin = y1; + ymax = y2; +else + flip = -1; + ymin = y2; + ymax = y1; +end +height = ymax - ymin; +scale = (height/2); +out = flip*scale*tanh(x/b); +disp(scale + min(out(:))); +% out = out + (ymin - min(out(:))); +out = out + (ymin + scale); +end diff --git a/Applications/Hypersonics/1DShockTube/smoothstep_down.m b/Applications/Hypersonics/1DShockTube/smoothstep_down.m new file mode 100644 index 00000000..73e9fb8a --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/smoothstep_down.m @@ -0,0 +1,16 @@ +function [out] = smoothstep_down(x,yminus,yplus,b) +% if yminus < yplus +% flip = 1; +% ymin = yminus; +% ymax = yplus; +% else + flip = -1; + ymin = yplus; + ymax = yminus; +% end +height = ymax - ymin; +scale = (height/2); +out = flip*scale*tanh(x/b); +% out = out + (ymin - min(out(:))); +out = out + (ymin + scale); +end diff --git a/Applications/Hypersonics/1DShockTube/smoothstep_up.m b/Applications/Hypersonics/1DShockTube/smoothstep_up.m new file mode 100644 index 00000000..486a6dc5 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/smoothstep_up.m @@ -0,0 +1,15 @@ +function [out] = smoothstep_up(x,yminus,yplus,b) +% if yminus < yplus + flip = 1; + ymin = yminus; + ymax = yplus; +% else +% flip = -1; +% ymin = yplus; +% ymax = yminus; +% end +height = ymax - ymin; +scale = (height/2); +out = flip*scale*tanh(x/b); +out = out + (ymin + scale); +end From a0dd71ff3241dc0f6decf58045bf3f1e6c949d94 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Mon, 28 Feb 2022 15:07:13 -0500 Subject: [PATCH 06/23] updates to examples --- Applications/Hypersonics/1DShockTube/pdeapp.m | 40 ++-- .../Hypersonics/1DShockTube/pdeapp_euler.m | 151 +++++++++++++++ .../Hypersonics/1DShockTube/pdemodel_euler.m | 183 ++++++++++++++++++ .../Hypersonics/1DShockTube/pdemodel_inflow.m | 61 +++--- 4 files changed, 393 insertions(+), 42 deletions(-) create mode 100644 Applications/Hypersonics/1DShockTube/pdeapp_euler.m create mode 100644 Applications/Hypersonics/1DShockTube/pdemodel_euler.m diff --git a/Applications/Hypersonics/1DShockTube/pdeapp.m b/Applications/Hypersonics/1DShockTube/pdeapp.m index 482a3420..bc3c9727 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -9,7 +9,7 @@ pde.mutationopts = {}; pde.mutationopts{1} = "air_5"; pde.mutationopts{2} = "ChemNonEq1T"; -pde.mutationopts{3} = "RRHO"; +pde.mutationopts{3} = "NASA-9"; pde.mutationpath = "/Users/rloekvh/Mutationpp"; pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; @@ -29,17 +29,18 @@ pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages -nt = 100; -pde.dt = 1e-5*ones(1,nt); % time step sizes -% pde.saveSolFreq = 100; +nt = 10; +pde.dt = 1e-3*ones(1,nt); % time step sizes +pde.saveSolFreq = 10000; % pde.soltime = 1:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected %Solver params -pde.linearsolveriter = 80; -pde.GMRESrestart = 40; -pde.matvectol = 1e-3; -pde.NLiter = 4; -% pde.RBdim = 10 +pde.linearsolveriter = 40; +pde.GMRESrestart = 20; +pde.linearsolvertol = 1e-1; +pde.matvectol = 1e-1; +pde.NLiter = 5; +pde.RBdim = 5; % rhoL = [0 0 0.000936356 0.000248905 0]; % rhouL = 4.74105; @@ -55,20 +56,26 @@ rhou_post = 4.61724; rhoE_post = 52157.2; -pde.physicsparam = [rho_pre(:)', rhou_pre, rhoE_pre, rho_post(:)', rhou_post, rhoE_post]; +rho_inf = sum(rho_post); +u_inf = rhou_post/rho_inf; + +% pde.physicsparam = [rho_pre(:)', rhou_pre, rhoE_pre, rho_post(:)', rhou_post, rhoE_post]; +pde.physicsparam = [rho_pre(:)'/rho_inf, rhou_pre/(rho_inf * u_inf), rhoE_pre/(rho_inf * u_inf * u_inf), rho_post(:)'/rho_inf, rhou_post/(rho_inf*u_inf), rhoE_post/(rho_inf * u_inf * u_inf)]; + +pde.externalparam = [rho_inf, u_inf]; % pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 -pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 5, 1000]; % DG stabilization parameter -% pde.tau = 5; +% pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 10, 50000]; % DG stabilization parameter +pde.tau = 0.02; pde.dae_alpha = 0; pde.dae_beta = 1; % create a grid of 8 by 8 on the unit square -nDiv = 2^11; +nDiv = 2^9; [mesh.p,mesh.t] = linemesh(nDiv-1); -a = -0.1; b = 1; +a = 0; b = 2; mesh.p = a + (b-a)*mesh.p; -mesh.p = loginc(mesh.p, 5); +mesh.p = loginc(mesh.p, 10); % expressions for domain boundaries mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary @@ -90,6 +97,9 @@ % eval('!cp opuInituMPP.cpp opuInitu.cpp'); eval('!cp opuInitwdgMPP.cpp opuInitwdg.cpp'); eval('!cp opuSourcewMPP.cpp opuSourcew.cpp'); +% eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); +% eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); +% eval('!cp opuSource_MPP.cpp opuSource.cpp'); % eval('!./compileMutation.sh'); cd(".."); % compile source codes to build an executable file and store it in app folder diff --git a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m new file mode 100644 index 00000000..1e403c9f --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m @@ -0,0 +1,151 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +% pde.mutationflag = 1; +% pde.mutationopts = {}; +% pde.mutationopts{1} = "air_5"; +% pde.mutationopts{2} = "ChemNonEq1T"; +% pde.mutationopts{3} = "NASA-9"; +% pde.mutationpath = "/Users/rloekvh/Mutationpp"; + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +% pde.cpuappflags = "-arch x86_64"; +% pde.cpulibflags = "-arch x86_64"; +% pde.cpuflags = "-arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelC"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_euler"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +%pde.platform = "gpu"; % choose this option if NVIDIA GPUs are available +pde.mpiprocs = 1; % number of MPI processors +% TODO: THINK ABOUT MACH NUMBER, MAKE SURE SCALING IS CORRECT!!! +% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 1; % polynomial degree +% pde.torder = 2; % time-stepping order of accuracy +% pde.nstage = 2; % time-stepping number of stages +% nt = 100000; +% pde.dt = 1e-4*ones(1,nt); % time step sizes +% pde.saveSolFreq = 10000; +pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected + +%Solver params +% pde.linearsolveriter = 40; +% pde.linearsolvertol = 1e-1; +% pde.GMRESrestart = 20; +% pde.matvectol = 1e-2; +% pde.NLiter = 10; +% pde.RBdim = 10; + +% rhoL = [0 0 0.000936356 0.000248905 0]; +% rhouL = 4.74105; +% rhoEL = 12226.7; +% rhoR = [0 0 0.00691678 0.00183864 0]; +% rhouR = 4.74544; +% rhoER = 72810.4; +% rho_pre = [0 0 0 0.000911061 0.000242181 ]; +rho_pre = 0.0012; +rhou_pre = 4.61296; +rhoE_pre = 9128.09; +u_pre = 4000.0; + +% rho_post = [0 0 0 0.00672992 0.00178897 ]; +rho_post = 0.0085; +rhou_post = 4.61724; +rhoE_post = 52157.2; +u_post = 542.0; + +rho_inf = rho_post; +u_inf = u_post; +%% +pde.physicsparam = [rho_pre(:)'/rho_inf,... + rhou_pre/(rho_inf*u_inf),... + rhoE_pre/(rho_inf*u_inf^2),... + rho_post(:)'/rho_inf,... + rhou_post/(rho_inf*u_inf),... + rhoE_post/(rho_inf*u_inf^2)/3]; +% pde.physicsparam = [rho_pre(:)',... +% rhou_pre,... +% rhoE_pre,... +% rho_post(:)',... +% rhou_post,... +% rhoE_post]; +% pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; + % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 +% pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 10, 50000]; % DG stabilization parameter +pde.tau = 15; +% pde.dae_alpha = 0; +% pde.dae_beta = 1; +% create a grid of 8 by 8 on the unit square +nDiv = 2^12; + +[mesh.p,mesh.t] = linemesh(nDiv-1); +a = 0; b = 1; +mesh.p = a + (b-a)*mesh.p; +mesh.p = loginc(mesh.p, 10); +% expressions for domain boundaries +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-8, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary + +%% call exasim to generate and run C++ code to solve the PDE model +% [sol,pde,mesh,master,dmd] = exasim(pde,mesh); + +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +% eval('!./fixargsMPP_Mac.sh'); +% eval('!./movefiles.sh'); +% eval('!cp opuInituMPP.cpp opuInitu.cpp'); +% eval('!cp opuInitwdgMPP.cpp opuInitwdg.cpp'); +% eval('!cp opuSourcewMPP.cpp opuSourcew.cpp'); +% eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); +% eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); +% eval('!cp opuSource_MPP.cpp opuSource.cpp'); +% eval('!./compileMutation.sh'); +cd(".."); +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +runstr = runcode(pde); + +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +% for ti = pde.soltime +% ti = nt; +% sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +sol = getsolution(['dataout/out'],dmd,master.npe); +nspecies=1; +dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); +for i = 1:nspecies + rho = sol(:,i,:); +% subplot(1,3,1) +% hold on +% plot(dgnodes(:),u(:),'LineWidth',1.3) +end +rhou = sol(:,nspecies+1,:); +% subplot(1,3,2) +% plot(dgnodes(:),u(:),'LineWidth',1.3); + +rhoE = sol(:,nspecies+2,:); + +u = rhou./rho; +% subplot(1,3,3) +plot(dgnodes(:), u(:),'LineWidth',1.3); drawnow +% end +% plot + + + + diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m new file mode 100644 index 00000000..d1f57c82 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m @@ -0,0 +1,183 @@ + +function pde = pdemodel_inflow +% pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 1; + m = sym(ones(nspecies + 2, 1)); +% m = sym([1.0; 1.0; 1.0; 1.0; 1.0]); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + + nspecies = 1; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(1,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + u = rhou * rhoinv; %velocity + E = rhoE * rhoinv; %energy + + % Mutation outputs + +% p = w(nspecies + 1); %pressure + gamma = 1.4; + gammam1 = gamma-1; + p = gammam1 * (rhoE - 0.5 * rho * u^2); + H = E+p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + f(ispecies) = rho_i(ispecies) * u; + end + f(nspecies + 1) = rhou * u + p; + f(nspecies + 2) = rhou * H; +% f(nspecies + 2) = (rhoE + p)*u; +end + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 1; + + s = sym(zeros(nspecies + 2,1)); +% omega_i = sym(zeros(nspecies,1)); +% rho_i = sym(zeros(5,1)); +% rho = 0; +% +% % Conservative Variables +% for ispecies = 1:nspecies +% rho_i(ispecies) = u(ispecies); %subspecies density +% rho = rho + rho_i(ispecies); %total mixture density +% end +% +% rhou = u(nspecies+1); +% rhoE = u(nspecies+2); +% +% rhoinv = 1/ rho; +% u = rhou * rhoinv; %velocity +% E = rhoE*rhoinv; %energy +% +% % Mutation outputs +% for ispecies = 1:nspecies +% omega_i(ispecies) = w(ispecies); +% end +% p = w(nspecies + 1); %pressure +% +% H = E+p*rhoinv; %enthalpy +% +% % Sources +% for ispecies = 1:nspecies +% s(ispecies) = omega_i(ispecies); +% end +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 1; + ub = sym(zeros(nspecies+2, 2)); + +% rhoL = mu(1:nspecies); +% rhouL = mu(nspecies+1); +% rhoEL = mu(nspecies+2); +% +% rho_post = mu(nspecies+3:2*nspecies+2); +% rhou_post = mu(2*nspecies+3); +% rhoE_post = mu(2*nspecies+4); + +% ub(:,1) = [rhoL(:); rhouL; rhoEL]; + +% ub(:,1) = mu(8:14); +% rho_post = mu(nspecies + 3: 2*nspecies + 2); +% rhou_post = mu(2*nspecies + 3); +% rhoE_post = mu(2*nspecies + 4); + ub(:,1) = mu(nspecies + 3: 2*nspecies + 4); +% ub(:,1) = u(:); + ub(:,2) = u(:); +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 1; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + uinflow = mu(nspecies + 3: 2*nspecies + 4); + finflow = flux(uinflow, q, w, v, x, t, mu, eta); + fb(:,1) = finflow*n(1) + tau(1)*(uinflow-uhat); +% fb(:,1) = f*n(1) + tau.*(u-uhat); + fb(:,2) = f*n(1) + tau(1)*(u-uhat); +end + +function u0 = initu(x, mu, eta) + % To be manually modified + nspecies = 1; + u0 = sym(zeros(nspecies+2,1)); + + rho_pre = mu(1:nspecies); + rhou_pre = mu(nspecies+1); + rhoE_pre = mu(nspecies+2); + + rho_post = mu(nspecies+3:2*nspecies+2); + rhou_post = mu(2*nspecies+3); + rhoE_post = mu(2*nspecies+4); + u0 = mu(1:nspecies+2); +% for i = 1:nspecies +% u0(i) = smoothstep(x, rho_post(i), rho_pre(i), 1/1000); +% end +% u0(1) = smoothstep_up(x, rho_post(1), rho_pre(1), 1/1000); +% u0(2) = smoothstep_up(x, rho_post(2), rho_pre(2), 1/100); +% u0(3) = smoothstep_up(x, rho_post(3), rho_pre(3), 1/100); +% u0(4) = smoothstep_down(x, rho_post(4), rho_pre(4), 1/100); +% u0(5) = smoothstep_down(x, rho_post(5), rho_pre(5), 1/100); +% u0(nspecies+1) = smoothstep_down(x, rhou_post, rhou_pre, 1/1000); +% u0(nspecies+2) = smoothstep_down(x, rhoE_post, rhoE_pre, 1/1000); +% u0 = [rhoL(:) + rhoR(:); rhouL + rhouR; rhoEL + rhoER]; +end + +% function sw = sourcew(u, q, w, v, x, t, mu, eta) +% nspecies = 5; +% +% sw = sym(zeros(nspecies + 2,1)); +% rho_i = sym(zeros(5,1)); +% rho = sym(0); +% +% % Conservative Variables +% for ispecies = 1:nspecies +% rho_i(ispecies) = u(ispecies); %subspecies density +% rho = rho + rho_i(ispecies); %total mixture density +% end +% +% rhou = u(nspecies+1); +% rhoE = u(nspecies+2); +% +% rhoinv = 1.0 / rho; +% u = rhou * rhoinv; %velocity +% E = rhoE*rhoinv; %energy +% +% % Mutation inputs +% rhoe = rhoE - 0.5 * rho * u^2; +% for i = 1:nspecies +% sw(i) = rho_i(i); +% end +% sw(nspecies + 1) = rhoe; +% end +% +% function w0 = initw(x, mu, eta) +% nspecies = 5; +% w0 = sym(zeros(nspecies + 1,1)); +% end \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m index f42c2a43..97aed2aa 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m @@ -38,8 +38,11 @@ E = rhoE*rhoinv; %energy % Mutation outputs + rho_inf = 0.0085; + u_inf = 542.0; + rhoe_inf = rho_inf * u_inf^2; - p = w(nspecies + 1); %pressure + p = w(nspecies + 1)/rhoe_inf; %pressure H = E+p*rhoinv; %enthalpy @@ -58,33 +61,37 @@ s = sym(zeros(nspecies + 2,1)); omega_i = sym(zeros(nspecies,1)); - rho_i = sym(zeros(5,1)); - rho = 0; - - % Conservative Variables - for ispecies = 1:nspecies - rho_i(ispecies) = u(ispecies); %subspecies density - rho = rho + rho_i(ispecies); %total mixture density - end - - rhou = u(nspecies+1); - rhoE = u(nspecies+2); - - rhoinv = 1/ rho; - u = rhou * rhoinv; %velocity - E = rhoE*rhoinv; %energy +% rho_i = sym(zeros(5,1)); +% rho = 0; +% +% % Conservative Variables +% for ispecies = 1:nspecies +% rho_i(ispecies) = u(ispecies); %subspecies density +% rho = rho + rho_i(ispecies); %total mixture density +% end +% +% rhou = u(nspecies+1); +% rhoE = u(nspecies+2); +% rhoinv = 1/ rho; +% u = rhou * rhoinv; %velocity +% E = rhoE*rhoinv; %energy +% % Mutation outputs for ispecies = 1:nspecies omega_i(ispecies) = w(ispecies); end - p = w(nspecies + 1); %pressure +% p = w(nspecies + 1); %pressure +% +% H = E+p*rhoinv; %enthalpy - H = E+p*rhoinv; %enthalpy + rho_inf = 0.0085; +% u_inf = 542.0; +% rhoe_inf = rho_inf * u_inf^2; % Sources for ispecies = 1:nspecies - s(ispecies) = omega_i(ispecies); + s(ispecies) = omega_i(ispecies)/rho_inf; end end @@ -130,17 +137,17 @@ rho_post = mu(nspecies+3:2*nspecies+2); rhou_post = mu(2*nspecies+3); rhoE_post = mu(2*nspecies+4); - + u0 = mu(1:nspecies + 2); % for i = 1:nspecies % u0(i) = smoothstep(x, rho_post(i), rho_pre(i), 1/1000); % end - u0(1) = smoothstep_up(x, rho_post(1), rho_pre(1), 1/100); - u0(2) = smoothstep_up(x, rho_post(2), rho_pre(2), 1/100); - u0(3) = smoothstep_up(x, rho_post(3), rho_pre(3), 1/100); - u0(4) = smoothstep_down(x, rho_post(4), rho_pre(4), 1/100); - u0(5) = smoothstep_down(x, rho_post(5), rho_pre(5), 1/100); - u0(nspecies+1) = smoothstep_down(x, rhou_post, rhou_pre, 1/100); - u0(nspecies+2) = smoothstep_down(x, rhoE_post, rhoE_pre, 1/100); +% u0(1) = smoothstep_up(x, rho_post(1), rho_pre(1), 1/10); +% u0(2) = smoothstep_up(x, rho_post(2), rho_pre(2), 1/10); +% u0(3) = smoothstep_up(x, rho_post(3), rho_pre(3), 1/10); +% u0(4) = smoothstep_down(x, rho_post(4), rho_pre(4), 1/10); +% u0(5) = smoothstep_down(x, rho_post(5), rho_pre(5), 1/10); +% u0(nspecies+1) = smoothstep_down(x, rhou_post, rhou_pre, 1/10); +% u0(nspecies+2) = smoothstep_down(x, rhoE_post, rhoE_pre, 1/10); % u0 = [rhoL(:) + rhoR(:); rhouL + rhouR; rhoEL + rhoER]; end From 64f0c64c26f0b679dc248f7cbd1e2301baad910a Mon Sep 17 00:00:00 2001 From: rloekvh Date: Mon, 28 Feb 2022 15:08:27 -0500 Subject: [PATCH 07/23] [WIP] add nondimensionalized app files --- .../1DShockTube/app/opuFbou_MPP.cpp | 128 ++++++++++++++++++ .../1DShockTube/app/opuFlux_MPP.cpp | 35 +++++ .../1DShockTube/app/opuInitwdgMPP.cpp | 8 +- .../1DShockTube/app/opuSource_MPP.cpp | 43 ++++++ .../1DShockTube/app/opuSourcewMPP.cpp | 8 +- 5 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp diff --git a/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp new file mode 100644 index 00000000..7a97e2c6 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp @@ -0,0 +1,128 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + + T wdg6 = mix->P()/rhoe_inf; + + T nlg1 = nlg[0*ng+i]; + T t2 = param8+param9+param10+param11+param12; + T t3 = 1.0/t2; + f[0*ng+i] = tau1*(param8-uhg1)+nlg1*param8*param13*t3; + f[1*ng+i] = tau2*(param9-uhg2)+nlg1*param9*param13*t3; + f[2*ng+i] = tau3*(param10-uhg3)+nlg1*param10*param13*t3; + f[3*ng+i] = tau4*(param11-uhg4)+nlg1*param11*param13*t3; + f[4*ng+i] = tau5*(param12-uhg5)+nlg1*param12*param13*t3; + f[5*ng+i] = nlg1*(wdg6+(param13*param13)*t3)+tau6*(param13-uhg6); + f[6*ng+i] = tau7*(param14-uhg7)+nlg1*param13*(param14*t3+t3*wdg6); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + + T wdg6 = mix->P()/rhoe_inf; + // T wdg6 = wdg[5*ng+i]; + T nlg1 = nlg[0*ng+i]; + T t2 = udg1+udg2+udg3+udg4+udg5; + T t3 = 1.0/t2; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t3*udg1*udg6; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t3*udg2*udg6; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t3*udg3*udg6; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t3*udg4*udg6; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t3*udg5*udg6; + f[5*ng+i] = nlg1*(wdg6+t3*(udg6*udg6))+tau6*(udg6-uhg6); + f[6*ng+i] = tau7*(udg7-uhg7)+nlg1*udg6*(t3*udg7+t3*wdg6); + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp new file mode 100644 index 00000000..c7c70e46 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp @@ -0,0 +1,35 @@ +template void opuFlux(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + + T wdg6 = mix->P() / (rho_inf * u_inf * u_inf); + T t2 = udg1+udg2+udg3+udg4+udg5; + T t3 = 1.0/t2; + f[0*ng+i] = t3*udg1*udg6; + f[1*ng+i] = t3*udg2*udg6; + f[2*ng+i] = t3*udg3*udg6; + f[3*ng+i] = t3*udg4*udg6; + f[4*ng+i] = t3*udg5*udg6; + f[5*ng+i] = wdg6+t3*(udg6*udg6); + f[6*ng+i] = udg6*(t3*udg7+t3*wdg6); + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp index 7cc3510e..e215e861 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp @@ -82,10 +82,16 @@ template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int model T udg6 = t7+t14+t17*(t7-t14); T udg7 = t8+t15+t17*(t8-t15); int nspecies = 5; - double rhovec[5] = {udg1, udg2, udg3, udg4, udg5}; + T rho_inf = 0.0085; + T u_inf = 542.0; + T rhoe_inf = rho_inf * u_inf * u_inf; + double rhovec[5] = {udg1*rho_inf, udg2*rho_inf, udg3*rho_inf, udg4*rho_inf, udg5*rho_inf}; + + // double rhovec[5] = {udg1, udg2, udg3, udg4, udg5}; double wdot[5]; double rhoe = udg7-(udg6*udg6)*(udg1/2.0+udg2/2.0+udg3/2.0+udg4/2.0+udg5/2.0)*1.0/pow(udg1+udg2+udg3+udg4+udg5,2.0); // std::cout << rhoe << std::endl; + rhoe = rhoe * rhoe_inf; mix->setState(rhovec, &rhoe, 0); mix->netProductionRates(wdot); for (int ispecies = 0; ispecies < nspecies; ispecies++ ) diff --git a/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp new file mode 100644 index 00000000..16161ff6 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp @@ -0,0 +1,43 @@ +template void opuSource(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/rho_inf; + f[1*ng+i] = wdot[1]/rho_inf; + f[2*ng+i] = wdot[2]/rho_inf; + f[3*ng+i] = wdot[3]/rho_inf; + f[4*ng+i] = wdot[4]/rho_inf; + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + } +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp index 5abcdcb7..cb2a6d8d 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp @@ -19,13 +19,19 @@ template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u T wdg6 = wdg[j+npe*5+npe*ncw*k]; int nspecies = 5; - double rhovec[5] = {udg1, udg2, udg3, udg4, udg5}; + T rho_inf = 0.0085; + T u_inf = 542.0; + T rhoe_inf = rho_inf * u_inf * u_inf; + double rhovec[5] = {abs(udg1*rho_inf), abs(udg2*rho_inf), abs(udg3*rho_inf), abs(udg4*rho_inf), abs(udg5*rho_inf)}; + + // double rhovec[5] = {udg1, udg2, udg3, udg4, udg5}; double wdot[5]; double rhoe = abs(udg7-(udg6*udg6)*(udg1/2.0+udg2/2.0+udg3/2.0+udg4/2.0+udg5/2.0)*1.0/pow(udg1+udg2+udg3+udg4+udg5,2.0)); // std::cout << rhoe << std::endl; // if (rhoe < 0){ // std::cout << xdg1 << std::endl; // } + rhoe = rhoe * rhoe_inf; mix->setState(rhovec, &rhoe, 0); mix->netProductionRates(wdot); for (int ispecies = 0; ispecies < nspecies; ispecies++ ) From e0de6df4c901fe50c0b1ba5b1cb7201b3d2e481f Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 1 Mar 2022 09:17:55 -0500 Subject: [PATCH 08/23] [WIP] change where nondimensionalization happens --- .../Hypersonics/1DShockTube/app/opuFlux_MPP.cpp | 2 +- .../Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp | 4 ++-- .../Hypersonics/1DShockTube/app/opuSource_MPP.cpp | 10 +++++----- .../Hypersonics/1DShockTube/app/opuSourcewMPP.cpp | 10 ++++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp index c7c70e46..b1998a42 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp @@ -18,7 +18,7 @@ template void opuFlux(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf rhoe = rhoe * rho_inf * u_inf * u_inf; mix->setState(rhovec, &rhoe, 0); - T wdg6 = mix->P() / (rho_inf * u_inf * u_inf); + T wdg6 = mix->P(); T t2 = udg1+udg2+udg3+udg4+udg5; T t3 = 1.0/t2; f[0*ng+i] = t3*udg1*udg6; diff --git a/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp index e215e861..cdcd9177 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuInitwdgMPP.cpp @@ -96,9 +96,9 @@ template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int model mix->netProductionRates(wdot); for (int ispecies = 0; ispecies < nspecies; ispecies++ ) { - f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]; + f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]/(rho_inf*u_inf); } - f[j+npe*nspecies+npe*nce*k] = mix->P(); + f[j+npe*nspecies+npe*nce*k] = mix->P()/rhoe_inf; } } diff --git a/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp index 16161ff6..515e49a4 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp @@ -29,11 +29,11 @@ template void opuSource(T *f, T *xdg, T *udg, T *odg, T *wdg, T *ui mix->setState(rhovec, &rhoe, 0); mix->netProductionRates(wdot); - f[0*ng+i] = wdot[0]/rho_inf; - f[1*ng+i] = wdot[1]/rho_inf; - f[2*ng+i] = wdot[2]/rho_inf; - f[3*ng+i] = wdot[3]/rho_inf; - f[4*ng+i] = wdot[4]/rho_inf; + f[0*ng+i] = wdot[0]; + f[1*ng+i] = wdot[1]; + f[2*ng+i] = wdot[2]; + f[3*ng+i] = wdot[3]; + f[4*ng+i] = wdot[4]; f[5*ng+i] = 0.0; f[6*ng+i] = 0.0; } diff --git a/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp index cb2a6d8d..455e7755 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp @@ -22,23 +22,25 @@ template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u T rho_inf = 0.0085; T u_inf = 542.0; T rhoe_inf = rho_inf * u_inf * u_inf; - double rhovec[5] = {abs(udg1*rho_inf), abs(udg2*rho_inf), abs(udg3*rho_inf), abs(udg4*rho_inf), abs(udg5*rho_inf)}; + double rhovec[5] = {udg1*rho_inf, udg2*rho_inf, udg3*rho_inf, udg4*rho_inf, udg5*rho_inf}; // double rhovec[5] = {udg1, udg2, udg3, udg4, udg5}; double wdot[5]; double rhoe = abs(udg7-(udg6*udg6)*(udg1/2.0+udg2/2.0+udg3/2.0+udg4/2.0+udg5/2.0)*1.0/pow(udg1+udg2+udg3+udg4+udg5,2.0)); // std::cout << rhoe << std::endl; // if (rhoe < 0){ - // std::cout << xdg1 << std::endl; + // std::cout << xdg1 << std::endl; // } rhoe = rhoe * rhoe_inf; + rhoe = fmax(rhoe,200.0); + // std::cout << rhoe << std::endl; mix->setState(rhovec, &rhoe, 0); mix->netProductionRates(wdot); for (int ispecies = 0; ispecies < nspecies; ispecies++ ) { - f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]; + f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]/(rho_inf*u_inf); } - f[j+npe*nspecies+npe*nce*k] = mix->P(); + f[j+npe*nspecies+npe*nce*k] = mix->P()/rhoe_inf; } } From e14dd8e5ad3e2cde67b193f484f1aafa7f95e3fa Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 1 Mar 2022 09:18:33 -0500 Subject: [PATCH 09/23] [WIP] add missing pdefiles --- Applications/Hypersonics/1DShockTube/pdeapp.m | 31 +++++++------ .../Hypersonics/1DShockTube/pdeapp_euler.m | 43 ++++++++++--------- .../Hypersonics/1DShockTube/pdemodel_euler.m | 2 +- .../Hypersonics/1DShockTube/pdemodel_inflow.m | 8 ++-- 4 files changed, 46 insertions(+), 38 deletions(-) diff --git a/Applications/Hypersonics/1DShockTube/pdeapp.m b/Applications/Hypersonics/1DShockTube/pdeapp.m index bc3c9727..57e37abe 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -9,7 +9,7 @@ pde.mutationopts = {}; pde.mutationopts{1} = "air_5"; pde.mutationopts{2} = "ChemNonEq1T"; -pde.mutationopts{3} = "NASA-9"; +pde.mutationopts{3} = "RRHO"; pde.mutationpath = "/Users/rloekvh/Mutationpp"; pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; @@ -29,16 +29,16 @@ pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages -nt = 10; -pde.dt = 1e-3*ones(1,nt); % time step sizes -pde.saveSolFreq = 10000; +nt = 2e5; +pde.dt = 1e-7*ones(1,nt); % time step sizes +pde.saveSolFreq = nt/10; % pde.soltime = 1:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected %Solver params pde.linearsolveriter = 40; pde.GMRESrestart = 20; -pde.linearsolvertol = 1e-1; -pde.matvectol = 1e-1; +pde.linearsolvertol = 1e-3; +pde.matvectol = 1e-5; pde.NLiter = 5; pde.RBdim = 5; @@ -60,22 +60,27 @@ u_inf = rhou_post/rho_inf; % pde.physicsparam = [rho_pre(:)', rhou_pre, rhoE_pre, rho_post(:)', rhou_post, rhoE_post]; -pde.physicsparam = [rho_pre(:)'/rho_inf, rhou_pre/(rho_inf * u_inf), rhoE_pre/(rho_inf * u_inf * u_inf), rho_post(:)'/rho_inf, rhou_post/(rho_inf*u_inf), rhoE_post/(rho_inf * u_inf * u_inf)]; +pde.physicsparam = [rho_pre(:)'/rho_inf,... + rhou_pre/(rho_inf * u_inf),... + rhoE_pre/(rho_inf * u_inf * u_inf),... + rho_post(:)'/rho_inf,... + rhou_post/(rho_inf*u_inf),... + rhoE_post/(rho_inf * u_inf * u_inf)]; pde.externalparam = [rho_inf, u_inf]; % pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 % pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 10, 50000]; % DG stabilization parameter -pde.tau = 0.02; +pde.tau = 2; pde.dae_alpha = 0; pde.dae_beta = 1; % create a grid of 8 by 8 on the unit square -nDiv = 2^9; +nDiv = 2^8; [mesh.p,mesh.t] = linemesh(nDiv-1); a = 0; b = 2; mesh.p = a + (b-a)*mesh.p; -mesh.p = loginc(mesh.p, 10); +mesh.p = loginc(mesh.p, 15); % expressions for domain boundaries mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary @@ -117,15 +122,15 @@ u = sol(:,i,:); subplot(1,3,1) hold on - plot(dgnodes(:),u(:),'LineWidth',1.3) + semilogx(dgnodes(:),u(:),'LineWidth',1.3) end u = sol(:,6,:); subplot(1,3,2) -plot(dgnodes(:),u(:),'LineWidth',1.3); +semilogx(dgnodes(:),u(:),'LineWidth',1.3); u = sol(:,7,:); subplot(1,3,3) -plot(dgnodes(:), u(:),'LineWidth',1.3) +semilogx(dgnodes(:), u(:),'LineWidth',1.3) % solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); % w = solw(:,6,:); diff --git a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m index 1e403c9f..e9bad697 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m @@ -13,6 +13,7 @@ % pde.mutationpath = "/Users/rloekvh/Mutationpp"; pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +% pde.enzyme = "ClangEnzyme-12.dylib" % pde.cpuappflags = "-arch x86_64"; % pde.cpulibflags = "-arch x86_64"; % pde.cpuflags = "-arch x86_64"; @@ -26,20 +27,20 @@ pde.mpiprocs = 1; % number of MPI processors % TODO: THINK ABOUT MACH NUMBER, MAKE SURE SCALING IS CORRECT!!! % Set discretization parameters, physical parameters, and solver parameters -pde.porder = 1; % polynomial degree -% pde.torder = 2; % time-stepping order of accuracy -% pde.nstage = 2; % time-stepping number of stages -% nt = 100000; -% pde.dt = 1e-4*ones(1,nt); % time step sizes -% pde.saveSolFreq = 10000; +pde.porder = 2; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages +nt = 100; +pde.dt = 1e-6*ones(1,nt); % time step sizes +pde.saveSolFreq = nt/10; pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected %Solver params -% pde.linearsolveriter = 40; +pde.linearsolveriter = 40; % pde.linearsolvertol = 1e-1; -% pde.GMRESrestart = 20; -% pde.matvectol = 1e-2; -% pde.NLiter = 10; +pde.GMRESrestart = 20; +pde.matvectol = 1e-6; +pde.NLiter = 5; % pde.RBdim = 10; % rhoL = [0 0 0.000936356 0.000248905 0]; @@ -68,7 +69,7 @@ rhoE_pre/(rho_inf*u_inf^2),... rho_post(:)'/rho_inf,... rhou_post/(rho_inf*u_inf),... - rhoE_post/(rho_inf*u_inf^2)/3]; + rhoE_post/(rho_inf*u_inf^2)]; % pde.physicsparam = [rho_pre(:)',... % rhou_pre,... % rhoE_pre,... @@ -78,18 +79,20 @@ % pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 % pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 10, 50000]; % DG stabilization parameter -pde.tau = 15; +pde.tau = 2.5; % pde.dae_alpha = 0; % pde.dae_beta = 1; % create a grid of 8 by 8 on the unit square -nDiv = 2^12; +nDiv = 2^10; [mesh.p,mesh.t] = linemesh(nDiv-1); a = 0; b = 1; mesh.p = a + (b-a)*mesh.p; -mesh.p = loginc(mesh.p, 10); +mesh.p = loginc(mesh.p, 5); +disp(mesh.p(2)-mesh.p(1)) + % expressions for domain boundaries -mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-8, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary %% call exasim to generate and run C++ code to solve the PDE model @@ -122,10 +125,10 @@ %% plot solution % sol = fetchsolution(pde,master,dmd, 'dataout'); -% for ti = pde.soltime +for ti = pde.soltime % ti = nt; -% sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); -sol = getsolution(['dataout/out'],dmd,master.npe); +sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +% sol = getsolution(['dataout/out'],dmd,master.npe); nspecies=1; dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); for i = 1:nspecies @@ -142,8 +145,8 @@ u = rhou./rho; % subplot(1,3,3) -plot(dgnodes(:), u(:),'LineWidth',1.3); drawnow -% end +semilogx(dgnodes(:), u(:),'LineWidth',1.3); drawnow +end % plot diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m index d1f57c82..67e5112d 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m @@ -1,6 +1,6 @@ function pde = pdemodel_inflow -% pde.mass = @mass; + pde.mass = @mass; pde.flux = @flux; pde.source = @source; pde.fbou = @fbou; diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m index 97aed2aa..0b610457 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m @@ -42,7 +42,7 @@ u_inf = 542.0; rhoe_inf = rho_inf * u_inf^2; - p = w(nspecies + 1)/rhoe_inf; %pressure + p = w(nspecies + 1); %pressure H = E+p*rhoinv; %enthalpy @@ -91,7 +91,7 @@ % Sources for ispecies = 1:nspecies - s(ispecies) = omega_i(ispecies)/rho_inf; + s(ispecies) = omega_i(ispecies); end end @@ -120,9 +120,9 @@ f = flux(u, q, w, v, x, t, mu, eta); finflow = flux(mu(8:14), q, w, v, x, t, mu, eta); - fb(:,1) = finflow*n(1) + tau.*(mu(8:14)-uhat); + fb(:,1) = finflow*n(1) + tau(1)*(mu(8:14)-uhat); % fb(:,1) = f*n(1) + tau.*(u-uhat); - fb(:,2) = f*n(1) + tau.*(u-uhat); + fb(:,2) = f*n(1) + tau(1)*(u-uhat); end function u0 = initu(x, mu, eta) From 6aea01b7adee8498e35e49dda0470725152487f4 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 8 Mar 2022 15:45:50 -0500 Subject: [PATCH 10/23] [WIP] shock tube --- Applications/Hypersonics/1DShockTube/pdeapp.m | 53 +++--- .../Hypersonics/1DShockTube/pdeapp_euler.m | 125 +++++-------- .../Hypersonics/1DShockTube/pdemodel_euler.m | 176 +++++------------- .../Hypersonics/1DShockTube/pdemodel_inflow.m | 44 +++-- 4 files changed, 144 insertions(+), 254 deletions(-) diff --git a/Applications/Hypersonics/1DShockTube/pdeapp.m b/Applications/Hypersonics/1DShockTube/pdeapp.m index 57e37abe..748959cb 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -29,9 +29,9 @@ pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages -nt = 2e5; -pde.dt = 1e-7*ones(1,nt); % time step sizes -pde.saveSolFreq = nt/10; +nt = 1e2; +pde.dt = 1e-6*ones(1,nt); % time step sizes +pde.saveSolFreq = nt/100; % pde.soltime = 1:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected %Solver params @@ -48,24 +48,31 @@ % rhoR = [0 0 0.00691678 0.00183864 0]; % rhouR = 4.74544; % rhoER = 72810.4; -rho_pre = [0 0 0 0.000911061 0.000242181 ]; -rhou_pre = 4.61296; -rhoE_pre = 9128.09; +% rho_pre = [0 0 0 0.000911061 0.000242181 ]; +% rhou_pre = 4.61296; +% rhoE_pre = 9128.09; -rho_post = [0 0 0 0.00672992 0.00178897 ]; -rhou_post = 4.61724; -rhoE_post = 52157.2; +p_outflow = 16894.1; + +% rho_post = [0 0 0 0.00672992 0.00178897 ]; +rho_post = [0 0 0 0.00655326 0.00199076 ]; +rhou_post = 4.63086; +rhoE_post = 52267.1; rho_inf = sum(rho_post); u_inf = rhou_post/rho_inf; % pde.physicsparam = [rho_pre(:)', rhou_pre, rhoE_pre, rho_post(:)', rhou_post, rhoE_post]; -pde.physicsparam = [rho_pre(:)'/rho_inf,... - rhou_pre/(rho_inf * u_inf),... - rhoE_pre/(rho_inf * u_inf * u_inf),... - rho_post(:)'/rho_inf,... +% pde.physicsparam = [rho_pre(:)'/rho_inf,... +% rhou_pre/(rho_inf * u_inf),... +% rhoE_pre/(rho_inf * u_inf * u_inf),... +% rho_post(:)'/rho_inf,... +% rhou_post/(rho_inf*u_inf),... +% rhoE_post/(rho_inf * u_inf * u_inf)]; +pde.physicsparam = [rho_post(:)'/rho_inf,... rhou_post/(rho_inf*u_inf),... - rhoE_post/(rho_inf * u_inf * u_inf)]; + rhoE_post/(rho_inf * u_inf * u_inf),... + p_outflow/(rho_inf * u_inf * u_inf)]; pde.externalparam = [rho_inf, u_inf]; % pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; @@ -75,12 +82,13 @@ pde.dae_alpha = 0; pde.dae_beta = 1; % create a grid of 8 by 8 on the unit square -nDiv = 2^8; +% nDiv = 2^10; +nDiv = 1200; [mesh.p,mesh.t] = linemesh(nDiv-1); -a = 0; b = 2; +a = 0; b = 1; mesh.p = a + (b-a)*mesh.p; -mesh.p = loginc(mesh.p, 15); +% mesh.p = loginc(mesh.p, 15); % expressions for domain boundaries mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary @@ -100,8 +108,9 @@ eval('!./fixargsMPP_Mac.sh'); % eval('!./movefiles.sh'); % eval('!cp opuInituMPP.cpp opuInitu.cpp'); -eval('!cp opuInitwdgMPP.cpp opuInitwdg.cpp'); -eval('!cp opuSourcewMPP.cpp opuSourcew.cpp'); +eval('!cp opuInitwdg_MPP.cpp opuInitwdg.cpp'); +eval('!cp opuSourcew_MPP.cpp opuSourcew.cpp'); +eval('!cp opuUbou_MPP.cpp opuUbou.cpp'); % eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); % eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); % eval('!cp opuSource_MPP.cpp opuSource.cpp'); @@ -122,15 +131,15 @@ u = sol(:,i,:); subplot(1,3,1) hold on - semilogx(dgnodes(:),u(:),'LineWidth',1.3) + plot(dgnodes(:),u(:),'LineWidth',1.3) end u = sol(:,6,:); subplot(1,3,2) -semilogx(dgnodes(:),u(:),'LineWidth',1.3); +plot(dgnodes(:),u(:),'LineWidth',1.3); u = sol(:,7,:); subplot(1,3,3) -semilogx(dgnodes(:), u(:),'LineWidth',1.3) +plot(dgnodes(:), u(:),'LineWidth',1.3) % solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); % w = solw(:,6,:); diff --git a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m index e9bad697..a2ca0d6e 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m @@ -5,18 +5,7 @@ % initialize pde structure and mesh structure [pde,mesh] = initializeexasim(); -% pde.mutationflag = 1; -% pde.mutationopts = {}; -% pde.mutationopts{1} = "air_5"; -% pde.mutationopts{2} = "ChemNonEq1T"; -% pde.mutationopts{3} = "NASA-9"; -% pde.mutationpath = "/Users/rloekvh/Mutationpp"; - pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; -% pde.enzyme = "ClangEnzyme-12.dylib" -% pde.cpuappflags = "-arch x86_64"; -% pde.cpulibflags = "-arch x86_64"; -% pde.cpuflags = "-arch x86_64"; % Define a PDE model: governing equations, initial solutions, and boundary conditions pde.model = "ModelC"; % ModelC, ModelD, ModelW @@ -25,75 +14,56 @@ % Choose computing platform and set number of processors %pde.platform = "gpu"; % choose this option if NVIDIA GPUs are available pde.mpiprocs = 1; % number of MPI processors -% TODO: THINK ABOUT MACH NUMBER, MAKE SURE SCALING IS CORRECT!!! -% Set discretization parameters, physical parameters, and solver parameters -pde.porder = 2; % polynomial degree + +%% Set discretization parameters +pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy -pde.nstage = 1; % time-stepping number of stages -nt = 100; -pde.dt = 1e-6*ones(1,nt); % time step sizes -pde.saveSolFreq = nt/10; +pde.nstage = 1; % time-stepping number of stages +nt = 2000 ; +pde.dt = 5e-4*ones(1,nt); % time step sizes +pde.saveSolFreq = nt/100; pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +pde.tau = 2; + +%% Mesh +nDiv = 1024; -%Solver params +[mesh.p,mesh.t] = linemesh(nDiv-1); +a = 0; b = 2; +mesh.p = a + (b-a)*mesh.p; +% mesh.p = loginc(mesh.p, 10); +% expressions for domain boundaries +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary + + +%% Solver params pde.linearsolveriter = 40; -% pde.linearsolvertol = 1e-1; pde.GMRESrestart = 20; pde.matvectol = 1e-6; -pde.NLiter = 5; -% pde.RBdim = 10; - -% rhoL = [0 0 0.000936356 0.000248905 0]; -% rhouL = 4.74105; -% rhoEL = 12226.7; -% rhoR = [0 0 0.00691678 0.00183864 0]; -% rhouR = 4.74544; -% rhoER = 72810.4; -% rho_pre = [0 0 0 0.000911061 0.000242181 ]; -rho_pre = 0.0012; -rhou_pre = 4.61296; -rhoE_pre = 9128.09; -u_pre = 4000.0; - -% rho_post = [0 0 0 0.00672992 0.00178897 ]; +pde.NLiter = 3; + +%% Problem params + +% Postshock flow conditions rho_post = 0.0085; -rhou_post = 4.61724; -rhoE_post = 52157.2; u_post = 542.0; +rhou_post = rho_post*u_post; +rhoE_post = 52157.2; rho_inf = rho_post; u_inf = u_post; -%% -pde.physicsparam = [rho_pre(:)'/rho_inf,... - rhou_pre/(rho_inf*u_inf),... - rhoE_pre/(rho_inf*u_inf^2),... - rho_post(:)'/rho_inf,... - rhou_post/(rho_inf*u_inf),... - rhoE_post/(rho_inf*u_inf^2)]; -% pde.physicsparam = [rho_pre(:)',... -% rhou_pre,... -% rhoE_pre,... -% rho_post(:)',... -% rhou_post,... -% rhoE_post]; -% pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; - % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 -% pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 10, 50000]; % DG stabilization parameter -pde.tau = 2.5; -% pde.dae_alpha = 0; -% pde.dae_beta = 1; -% create a grid of 8 by 8 on the unit square -nDiv = 2^10; +% pde.physicsparam = [rho_post(:)'/rho_inf,... +% rhou_post/(rho_inf*u_inf),... +% rhoE_post/(rho_inf*u_inf^2)]; +% pout = 2.104849700000000e+04/(rho_inf*u_inf^2); -[mesh.p,mesh.t] = linemesh(nDiv-1); -a = 0; b = 1; -mesh.p = a + (b-a)*mesh.p; -mesh.p = loginc(mesh.p, 5); -disp(mesh.p(2)-mesh.p(1)) +%%% Initial conditions roughly correspond to a nondimensionalition of the +%%% original parameters...TODO: maybe this is not sensible? +pde.physicsparam = [1, 1, 20.88]; +pout = 8.5; -% expressions for domain boundaries -mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries -mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary +pde.externalparam = [rho_inf, u_inf, pout]; %% call exasim to generate and run C++ code to solve the PDE model % [sol,pde,mesh,master,dmd] = exasim(pde,mesh); @@ -106,18 +76,7 @@ % generate source codes and store them in app folder gencode(pde); -cd("app"); -% eval('!./fixargsMPP_Mac.sh'); -% eval('!./movefiles.sh'); -% eval('!cp opuInituMPP.cpp opuInitu.cpp'); -% eval('!cp opuInitwdgMPP.cpp opuInitwdg.cpp'); -% eval('!cp opuSourcewMPP.cpp opuSourcew.cpp'); -% eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); -% eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); -% eval('!cp opuSource_MPP.cpp opuSource.cpp'); -% eval('!./compileMutation.sh'); -cd(".."); -% compile source codes to build an executable file and store it in app folder + compilerstr = compilecode(pde); % run executable file to compute solution and store it in dataout folder @@ -142,10 +101,12 @@ % plot(dgnodes(:),u(:),'LineWidth',1.3); rhoE = sol(:,nspecies+2,:); - -u = rhou./rho; + +% u = rhou./rho; % subplot(1,3,3) -semilogx(dgnodes(:), u(:),'LineWidth',1.3); drawnow +p = eulereval(sol,'p',1.4,0.55); +% p = rho; +figure(1); plot(dgnodes(:),rho(:),'LineWidth',1.3); drawnow; waitforbuttonpress end % plot diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m index 67e5112d..c64ba692 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m @@ -19,165 +19,81 @@ nspecies = 1; f = sym(zeros(nspecies + 2,1)); - rho_i = sym(zeros(1,1)); - rho = sym(0); - - % Conservative Variables - for ispecies = 1:nspecies - rho_i(ispecies) = u(ispecies); %subspecies density - rho = rho + rho_i(ispecies); %total mixture density - end - - rhou = u(nspecies+1); - rhoE = u(nspecies+2); + + rho = u(1); + rhou = u(2); + rhoE = u(3); rhoinv = 1.0 / rho; - u = rhou * rhoinv; %velocity + uv = rhou * rhoinv; %velocity E = rhoE * rhoinv; %energy - % Mutation outputs - -% p = w(nspecies + 1); %pressure gamma = 1.4; gammam1 = gamma-1; - p = gammam1 * (rhoE - 0.5 * rho * u^2); + p = gammam1 * (rhoE - 0.5 * rho * uv^2); H = E+p*rhoinv; %enthalpy - % Fluxes - for ispecies = 1:nspecies - f(ispecies) = rho_i(ispecies) * u; - end - f(nspecies + 1) = rhou * u + p; + f(1) = rhou; + f(nspecies + 1) = rhou * uv + p; f(nspecies + 2) = rhou * H; -% f(nspecies + 2) = (rhoE + p)*u; end function s = source(u, q, w, v, x, t, mu, eta) - nspecies = 1; - s = sym(zeros(nspecies + 2,1)); -% omega_i = sym(zeros(nspecies,1)); -% rho_i = sym(zeros(5,1)); -% rho = 0; -% -% % Conservative Variables -% for ispecies = 1:nspecies -% rho_i(ispecies) = u(ispecies); %subspecies density -% rho = rho + rho_i(ispecies); %total mixture density -% end -% -% rhou = u(nspecies+1); -% rhoE = u(nspecies+2); -% -% rhoinv = 1/ rho; -% u = rhou * rhoinv; %velocity -% E = rhoE*rhoinv; %energy -% -% % Mutation outputs -% for ispecies = 1:nspecies -% omega_i(ispecies) = w(ispecies); -% end -% p = w(nspecies + 1); %pressure -% -% H = E+p*rhoinv; %enthalpy -% -% % Sources -% for ispecies = 1:nspecies -% s(ispecies) = omega_i(ispecies); -% end end function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) nspecies = 1; ub = sym(zeros(nspecies+2, 2)); -% rhoL = mu(1:nspecies); -% rhouL = mu(nspecies+1); -% rhoEL = mu(nspecies+2); -% -% rho_post = mu(nspecies+3:2*nspecies+2); -% rhou_post = mu(2*nspecies+3); -% rhoE_post = mu(2*nspecies+4); + uin = uinflow(u, mu, eta); + ub(:,1) = uin; -% ub(:,1) = [rhoL(:); rhouL; rhoEL]; - -% ub(:,1) = mu(8:14); -% rho_post = mu(nspecies + 3: 2*nspecies + 2); -% rhou_post = mu(2*nspecies + 3); -% rhoE_post = mu(2*nspecies + 4); - ub(:,1) = mu(nspecies + 3: 2*nspecies + 4); -% ub(:,1) = u(:); - ub(:,2) = u(:); -end + uout = uoutflow(u, mu, eta); + ub(:,2) = uout; +end function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) nspecies = 1; fb = sym(zeros(nspecies+2, 2)); - f = flux(u, q, w, v, x, t, mu, eta); - uinflow = mu(nspecies + 3: 2*nspecies + 4); - finflow = flux(uinflow, q, w, v, x, t, mu, eta); - fb(:,1) = finflow*n(1) + tau(1)*(uinflow-uhat); -% fb(:,1) = f*n(1) + tau.*(u-uhat); - fb(:,2) = f*n(1) + tau(1)*(u-uhat); + uin = uinflow(u, mu, eta); + fin = flux(uin, q, w, v, x, t, mu, eta); + fb(:,1) = fin *n(1) + tau(1)*(uin-uhat); + + uout = uoutflow(u, mu, eta); + fout = flux(uout, q, w, v, x, t, mu, eta); + fb(:,2) = fout*n(1) + tau(1)*(uout-uhat); end function u0 = initu(x, mu, eta) - % To be manually modified nspecies = 1; - u0 = sym(zeros(nspecies+2,1)); - - rho_pre = mu(1:nspecies); - rhou_pre = mu(nspecies+1); - rhoE_pre = mu(nspecies+2); - - rho_post = mu(nspecies+3:2*nspecies+2); - rhou_post = mu(2*nspecies+3); - rhoE_post = mu(2*nspecies+4); - u0 = mu(1:nspecies+2); -% for i = 1:nspecies -% u0(i) = smoothstep(x, rho_post(i), rho_pre(i), 1/1000); -% end -% u0(1) = smoothstep_up(x, rho_post(1), rho_pre(1), 1/1000); -% u0(2) = smoothstep_up(x, rho_post(2), rho_pre(2), 1/100); -% u0(3) = smoothstep_up(x, rho_post(3), rho_pre(3), 1/100); -% u0(4) = smoothstep_down(x, rho_post(4), rho_pre(4), 1/100); -% u0(5) = smoothstep_down(x, rho_post(5), rho_pre(5), 1/100); -% u0(nspecies+1) = smoothstep_down(x, rhou_post, rhou_pre, 1/1000); -% u0(nspecies+2) = smoothstep_down(x, rhoE_post, rhoE_pre, 1/1000); -% u0 = [rhoL(:) + rhoR(:); rhouL + rhouR; rhoEL + rhoER]; + u0 = uinflow(mu,mu,eta); +% u0 = uoutflow(mu,mu,eta); +end + +function uin = uinflow(u, mu, eta) + nspecies = 1; + + rho = mu(1); + rhou = mu(2); + rhoE = mu(3); + uin = [rho; rhou; rhoE]; end -% function sw = sourcew(u, q, w, v, x, t, mu, eta) -% nspecies = 5; -% -% sw = sym(zeros(nspecies + 2,1)); -% rho_i = sym(zeros(5,1)); -% rho = sym(0); -% -% % Conservative Variables -% for ispecies = 1:nspecies -% rho_i(ispecies) = u(ispecies); %subspecies density -% rho = rho + rho_i(ispecies); %total mixture density -% end -% -% rhou = u(nspecies+1); -% rhoE = u(nspecies+2); -% -% rhoinv = 1.0 / rho; -% u = rhou * rhoinv; %velocity -% E = rhoE*rhoinv; %energy -% -% % Mutation inputs -% rhoe = rhoE - 0.5 * rho * u^2; -% for i = 1:nspecies -% sw(i) = rho_i(i); -% end -% sw(nspecies + 1) = rhoe; -% end -% -% function w0 = initw(x, mu, eta) -% nspecies = 5; -% w0 = sym(zeros(nspecies + 1,1)); -% end \ No newline at end of file +function uout = uoutflow(u, mu, eta) + nspecies = 1; + + gamma = 1.4; + gammam1 = gamma-1; + p = eta(3); + + rho = u(1); + rhou = u(2); + rhoinv = 1/rho; + uv = rhou * rhoinv; + + rhoE = p/gammam1 + 0.5 * rho * uv^2; + uout = [rho; rhou; rhoE]; +end diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m index 0b610457..fe1f2306 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m @@ -38,9 +38,8 @@ E = rhoE*rhoinv; %energy % Mutation outputs - rho_inf = 0.0085; - u_inf = 542.0; - rhoe_inf = rho_inf * u_inf^2; + rho_inf = eta(1); + u_inf = eta(2); p = w(nspecies + 1); %pressure @@ -85,7 +84,7 @@ % % H = E+p*rhoinv; %enthalpy - rho_inf = 0.0085; +% rho_inf = 0.0085; % u_inf = 542.0; % rhoe_inf = rho_inf * u_inf^2; @@ -98,7 +97,7 @@ function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) nspecies = 5; ub = sym(zeros(nspecies+2, 2)); - +% [rho_pre, rhou_pre, rhoE_pre, rho_post, rhou_postshock, rhoE_post] % rhoL = mu(1:nspecies); % rhouL = mu(nspecies+1); % rhoEL = mu(nspecies+2); @@ -109,9 +108,11 @@ % ub(:,1) = [rhoL(:); rhouL; rhoEL]; - ub(:,1) = mu(8:14); +% ub(:,1) = mu(8:14); + ub(:,1) = mu(1:nspecies+2); % ub(:,1) = u(:); - ub(:,2) = u(:); + p_outflow = mu(nspecies+3); + ub(:,2) = [u(1:nspecies);u(nspecies+1);p_outflow]; end function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) @@ -119,25 +120,28 @@ fb = sym(zeros(nspecies+2, 2)); f = flux(u, q, w, v, x, t, mu, eta); - finflow = flux(mu(8:14), q, w, v, x, t, mu, eta); - fb(:,1) = finflow*n(1) + tau(1)*(mu(8:14)-uhat); -% fb(:,1) = f*n(1) + tau.*(u-uhat); + + uinflow = mu(1:nspecies+2); + finflow = flux(uinflow, q, w, v, x, t, mu, eta); +% fb(:,1) = finflow*n(1) + tau(1)*(uinflow-uhat); + fb(:,1) = f*n(1) + tau(1)*(u-uhat); fb(:,2) = f*n(1) + tau(1)*(u-uhat); end function u0 = initu(x, mu, eta) % To be manually modified nspecies = 5; - u0 = sym(zeros(nspecies+2,1)); - - rho_pre = mu(1:nspecies); - rhou_pre = mu(nspecies+1); - rhoE_pre = mu(nspecies+2); - - rho_post = mu(nspecies+3:2*nspecies+2); - rhou_post = mu(2*nspecies+3); - rhoE_post = mu(2*nspecies+4); - u0 = mu(1:nspecies + 2); +% u0 = sym(zeros(nspecies+2,1)); +% +% rho_pre = mu(1:nspecies); +% rhou_pre = mu(nspecies+1); +% rhoE_pre = mu(nspecies+2); +% +% rho_post = mu(nspecies+3:2*nspecies+2); +% rhou_post = mu(2*nspecies+3); +% rhoE_post = mu(2*nspecies+4); +% u0 = mu(nspecies + 3:2*nspecies + 2); + u0 = mu(1:nspecies+2); % for i = 1:nspecies % u0(i) = smoothstep(x, rho_post(i), rho_pre(i), 1/1000); % end From 181357a63b6fe44cc902df763b348da0ea430b5a Mon Sep 17 00:00:00 2001 From: rloekvh Date: Mon, 14 Mar 2022 13:06:55 -0400 Subject: [PATCH 11/23] [WIP] trying out subsonic BCs --- .../Hypersonics/1DShockTube/app/opuAppMPP.cpp | 238 ++++++++++++++++++ .../1DShockTube/app/opuFbouSubsonicMPP.cpp | 129 ++++++++++ .../1DShockTube/app/opuFbou_MPP.cpp | 2 + .../app/opuFbou_pressureOutMPP.cpp | 97 +++++++ .../1DShockTube/app/opuInitu_MPP.cpp | 45 ++++ .../1DShockTube/app/opuInitwdg_MPP.cpp | 52 ++++ .../1DShockTube/app/opuInitwdg_stepMPP.cpp | 107 ++++++++ .../1DShockTube/app/opuSourcew_MPP.cpp | 49 ++++ .../1DShockTube/app/opuUbouSubsonicMPP.cpp | 81 ++++++ .../1DShockTube/app/opuUbou_MPP.cpp | 72 ++++++ Applications/Hypersonics/1DShockTube/pdeapp.m | 69 ++--- .../Hypersonics/1DShockTube/pdeapp_euler.m | 23 +- .../Hypersonics/1DShockTube/pdemodel_euler.m | 23 +- .../Hypersonics/1DShockTube/pdemodel_inflow.m | 48 +--- 14 files changed, 962 insertions(+), 73 deletions(-) create mode 100644 Applications/Hypersonics/1DShockTube/app/opuAppMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuFbou_pressureOutMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuInitu_MPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuInitwdg_MPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuInitwdg_stepMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuSourcew_MPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuUbou_MPP.cpp diff --git a/Applications/Hypersonics/1DShockTube/app/opuAppMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuAppMPP.cpp new file mode 100644 index 00000000..730e9a6e --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuAppMPP.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dup, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne, mix); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +#endif + +#endif + diff --git a/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp new file mode 100644 index 00000000..23aeed09 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp @@ -0,0 +1,129 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + // printf("opuubou1: wdg6 = %f; p = %f\n", wdg6, mix->P()/rhoe_inf); + T wdg6 = mix->P()/rhoe_inf; + // printf("opufbou1: wdg6 = %f\n", wdg6); + //// Given Tinf, Yinf, uinf and pressure from solution, calculates rhoi, rhou, rhoE + T Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; + // for (int ii = 0; ii<7; ii++) + // { + // printf("fbou1 before uinflow: Ucons = %f\n", Ucons[ii*ng+i]); + // } + uinflow((double*) Ucons, (double) wdg6, (double*)param, (double*)uinf, mix); + + udg1 = Ucons[0]; + udg2 = Ucons[1]; + udg3 = Ucons[2]; + udg4 = Ucons[3]; + udg5 = Ucons[4]; + udg6 = Ucons[5]; + udg7 = Ucons[6]; + //// + // for (int ii = 0; ii<7; ii++) + // { + // printf("fbou1 after uinflow: Ucons = %f\n", Ucons[ii*ng+i]); + // } + + T uhg1 = uhg[0*ng+i]; + T uhg2 = uhg[1*ng+i]; + T uhg3 = uhg[2*ng+i]; + T uhg4 = uhg[3*ng+i]; + T uhg5 = uhg[4*ng+i]; + T uhg6 = uhg[5*ng+i]; + T uhg7 = uhg[6*ng+i]; + T nlg1 = nlg[0*ng+i]; + T t2 = udg1+udg2+udg3+udg4+udg5; + T t3 = 1.0/t2; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t3*udg1*udg6; + f[1*ng+i] = tau1*(udg2-uhg2)+nlg1*t3*udg2*udg6; + f[2*ng+i] = tau1*(udg3-uhg3)+nlg1*t3*udg3*udg6; + f[3*ng+i] = tau1*(udg4-uhg4)+nlg1*t3*udg4*udg6; + f[4*ng+i] = tau1*(udg5-uhg5)+nlg1*t3*udg5*udg6; + f[5*ng+i] = nlg1*(wdg6+t3*(udg6*udg6))+tau1*(udg6-uhg6); + f[6*ng+i] = tau1*(udg7-uhg7)+nlg1*udg6*(t3*udg7+t3*wdg6); + + // for (int ii = 0; ii<7; ii++) + // { + // printf("fbou1: %f\n", f[ii*ng+i]); + // } + + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp index 7a97e2c6..37aaa4a8 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp @@ -1,3 +1,5 @@ +#include "mutationUtils.cpp" + template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) { for (int i = 0; i void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + + T wdg6 = mix->P()/rhoe_inf; + // T wdg6 = wdg[5*ng+i]; + T nlg1 = nlg[0*ng+i]; + T t2 = udg1+udg2+udg3+udg4+udg5; + T t3 = 1.0/t2; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t3*udg1*udg6; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t3*udg2*udg6; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t3*udg3*udg6; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t3*udg4*udg6; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t3*udg5*udg6; + f[5*ng+i] = nlg1*(wdg6+t3*(udg6*udg6))+tau6*(udg6-uhg6); + f[6*ng+i] = tau7*(udg7-uhg7)+nlg1*udg6*(t3*udg7+t3*wdg6); + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuInitu_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuInitu_MPP.cpp new file mode 100644 index 00000000..339e8d1e --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuInitu_MPP.cpp @@ -0,0 +1,45 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + for (int ispecies = 0; ispecies < nspecies; ispecies++ ) + { + f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]/(rho_inf*u_inf); + } + f[j+npe*nspecies+npe*nce*k] = mix->P()/rhoe_inf; + + } +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuInitwdg_stepMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuInitwdg_stepMPP.cpp new file mode 100644 index 00000000..cdcd9177 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuInitwdg_stepMPP.cpp @@ -0,0 +1,107 @@ +template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + for (int ispecies = 0; ispecies < nspecies; ispecies++ ) + { + f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]/(rho_inf*u_inf); + } + f[j+npe*nspecies+npe*nce*k] = mix->P()/rhoe_inf; + + } +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuSourcew_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSourcew_MPP.cpp new file mode 100644 index 00000000..2b15b839 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuSourcew_MPP.cpp @@ -0,0 +1,49 @@ +template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + for (int ispecies = 0; ispecies < nspecies; ispecies++ ) + { + f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]/(rho_inf*u_inf); + } + f[j+npe*nspecies+npe*nce*k] = mix->P()/rhoe_inf; + // printf("sourcew: p=%f\n", mix->P()/rhoe_inf); + } +} + +template void opuSourcew(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSourcew(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp new file mode 100644 index 00000000..c0f51c97 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp @@ -0,0 +1,81 @@ +template void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + + for (int i = 0; i setState(rhovec, &rhoe, 0); + // printf("opuubou1: wdg6 = %f; p = %f\n", wdg6, mix->P()/rhoe_inf); + T wdg6 = mix->P()/rhoe_inf; + //// Given Tinf, Yinf, uinf and pressure from solution, calculates rhoi, rhou, rhoE + T Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; + uinflow((double*) Ucons, (double) wdg6, (double*) param, (double*) uinf, mix); + //// + f[0*ng+i] = Ucons[0]; + f[1*ng+i] = Ucons[1]; + f[2*ng+i] = Ucons[2]; + f[3*ng+i] = Ucons[3]; + f[4*ng+i] = Ucons[4]; + f[5*ng+i] = Ucons[5]; + f[6*ng+i] = Ucons[6]; + // for (int ii = 0; ii<7; ii++) + // { + // printf("ubou1: %f\n", f[ii*ng+i]); + // } + } +} + +template void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuUbou_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuUbou_MPP.cpp new file mode 100644 index 00000000..cdfab343 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuUbou_MPP.cpp @@ -0,0 +1,72 @@ +template void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &Tout, 1); + T rhoeDim = mix->mixtureEnergyMass() * rho_dim; + + T rhoe = rhoeDim / rhoe_inf; + + T rhoE = rhoe + rhou2; + // std::cout << rhoE*rhoe_inf << std::endl; + // std::cout << mix->T() << std::endl; + f[6*ng+i] = rhoE; + } +} + +template void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/pdeapp.m b/Applications/Hypersonics/1DShockTube/pdeapp.m index 748959cb..118df650 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -29,18 +29,19 @@ pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages -nt = 1e2; -pde.dt = 1e-6*ones(1,nt); % time step sizes +nt = 50000 ; +pde.dt = 1e-7*ones(1,nt); % time step sizes pde.saveSolFreq = nt/100; -% pde.soltime = 1:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected %Solver params pde.linearsolveriter = 40; pde.GMRESrestart = 20; pde.linearsolvertol = 1e-3; pde.matvectol = 1e-5; -pde.NLiter = 5; +pde.NLiter = 2; pde.RBdim = 5; +pde.NLtol = 1e-11; % rhoL = [0 0 0.000936356 0.000248905 0]; % rhouL = 4.74105; @@ -53,6 +54,9 @@ % rhoE_pre = 9128.09; p_outflow = 16894.1; +T_inflow = 6539.17131979989; +Xi_inflow = [0, 0, 0, 0.76708248854242, 0.23291751145758]; +T_outflow = 3943.65524717381; % rho_post = [0 0 0 0.00672992 0.00178897 ]; rho_post = [0 0 0 0.00655326 0.00199076 ]; @@ -74,16 +78,16 @@ rhoE_post/(rho_inf * u_inf * u_inf),... p_outflow/(rho_inf * u_inf * u_inf)]; -pde.externalparam = [rho_inf, u_inf]; +pde.externalparam = [rho_inf, u_inf, T_inflow, Xi_inflow, T_outflow]; % pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 % pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 10, 50000]; % DG stabilization parameter -pde.tau = 2; +pde.tau = 1.5; pde.dae_alpha = 0; pde.dae_beta = 1; % create a grid of 8 by 8 on the unit square % nDiv = 2^10; -nDiv = 1200; +nDiv = 512; [mesh.p,mesh.t] = linemesh(nDiv-1); a = 0; b = 1; @@ -108,10 +112,11 @@ eval('!./fixargsMPP_Mac.sh'); % eval('!./movefiles.sh'); % eval('!cp opuInituMPP.cpp opuInitu.cpp'); +eval('!cp opuAppMPP.cpp opuApp.cpp'); eval('!cp opuInitwdg_MPP.cpp opuInitwdg.cpp'); eval('!cp opuSourcew_MPP.cpp opuSourcew.cpp'); -eval('!cp opuUbou_MPP.cpp opuUbou.cpp'); -% eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); +eval('!cp opuUbouSubsonicMPP.cpp opuUbou.cpp'); +eval('!cp opuFbouSubsonicMPP.cpp opuFbou.cpp'); % eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); % eval('!cp opuSource_MPP.cpp opuSource.cpp'); % eval('!./compileMutation.sh'); @@ -124,27 +129,33 @@ %% plot solution % sol = fetchsolution(pde,master,dmd, 'dataout'); -ti = nt; -sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); -dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); -for i = 1:5 - u = sol(:,i,:); - subplot(1,3,1) - hold on - plot(dgnodes(:),u(:),'LineWidth',1.3) +for ti = pde.saveSolFreq:pde.saveSolFreq:nt + sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); + dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); + clf + + for i = 1:5 + u = sol(:,i,:); +% subplot(1,3,1) + hold on + plot(dgnodes(:),u(:),'LineWidth',1.3) + end +% u = sol(:,6,:); +% subplot(1,3,2) +% plot(dgnodes(:),u(:),'LineWidth',1.3); +% +% u = sol(:,7,:); +% subplot(1,3,3) +% plot(dgnodes(:), u(:),'LineWidth',1.3); +% +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); +% w = solw(:,6,:) * rho_inf * u_inf^2; +% disp(w(1)); +% figure(2); +% semilogx(dgnodes(:),w(:)); + set(gca, 'Xscale','log') + waitforbuttonpress end -u = sol(:,6,:); -subplot(1,3,2) -plot(dgnodes(:),u(:),'LineWidth',1.3); - -u = sol(:,7,:); -subplot(1,3,3) -plot(dgnodes(:), u(:),'LineWidth',1.3) - -% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); -% w = solw(:,6,:); -% figure(2); -% plot(dgnodes(:),w(:)) diff --git a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m index a2ca0d6e..b19eab09 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m @@ -19,17 +19,17 @@ pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages -nt = 2000 ; +nt = 50000 ; pde.dt = 5e-4*ones(1,nt); % time step sizes pde.saveSolFreq = nt/100; pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected pde.tau = 2; %% Mesh -nDiv = 1024; +nDiv = 256; [mesh.p,mesh.t] = linemesh(nDiv-1); -a = 0; b = 2; +a = 0; b = 10; mesh.p = a + (b-a)*mesh.p; % mesh.p = loginc(mesh.p, 10); % expressions for domain boundaries @@ -61,9 +61,18 @@ %%% Initial conditions roughly correspond to a nondimensionalition of the %%% original parameters...TODO: maybe this is not sensible? pde.physicsparam = [1, 1, 20.88]; -pout = 8.5; -pde.externalparam = [rho_inf, u_inf, pout]; +rhoin = pde.physicsparam(1); +uin = pde.physicsparam(2)./rhoin; +rhoEin = pde.physicsparam(3); +pin = 0.4 * (rhoEin - 1/2 * rhoin * uin^2); + +pout = 9; +Minf = 0.444658; + +Tin = 1.4 * Minf^2 * pin/rhoin; + +pde.externalparam = [rho_inf, u_inf, pout, Minf, Tin]; %% call exasim to generate and run C++ code to solve the PDE model % [sol,pde,mesh,master,dmd] = exasim(pde,mesh); @@ -106,7 +115,9 @@ % subplot(1,3,3) p = eulereval(sol,'p',1.4,0.55); % p = rho; -figure(1); plot(dgnodes(:),rho(:),'LineWidth',1.3); drawnow; waitforbuttonpress + +u = rho(:); +figure(1); plot(dgnodes(:),u,'LineWidth',1.3); ylim([min(u), max(u)]); drawnow; waitforbuttonpress; end % plot diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m index c64ba692..8f759572 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m @@ -78,7 +78,28 @@ rho = mu(1); rhou = mu(2); - rhoE = mu(3); + rhoE = u(3); + +% +% rho = u(1); +% rhou = u(2); +% rhoE = u(3); +% +% rhoinv = 1.0 / rho; +% uv = rhou * rhoinv; %velocity +% E = rhoE * rhoinv; %energy +% +% gamma = 1.4; +% gammam1 = gamma-1; +% p = gammam1 * (rhoE - 0.5 * rho * uv^2); +% +% uvin = mu(2); +% Minf = eta(4); +% Tin = eta(5); +% +% rho = 1.4 * Minf^2 * p/Tin; +% rhou = uvin * rho; +% rhoE = p/gammam1 + 0.5 * rho * uvin^2; uin = [rho; rhou; rhoE]; end diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m index fe1f2306..beb49bc0 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m @@ -34,7 +34,7 @@ rhoE = u(nspecies+2); rhoinv = 1.0 / rho; - u = rhou * rhoinv; %velocity + uv = rhou * rhoinv; %velocity E = rhoE*rhoinv; %energy % Mutation outputs @@ -47,9 +47,9 @@ % Fluxes for ispecies = 1:nspecies - f(ispecies) = rho_i(ispecies) * u; + f(ispecies) = rho_i(ispecies) * uv; end - f(nspecies + 1) = rhou * u + p; + f(nspecies + 1) = rhou * uv + p; f(nspecies + 2) = rhou * H; % f(nspecies + 2) = (rhoE + p)*u; end @@ -60,37 +60,9 @@ s = sym(zeros(nspecies + 2,1)); omega_i = sym(zeros(nspecies,1)); -% rho_i = sym(zeros(5,1)); -% rho = 0; -% -% % Conservative Variables -% for ispecies = 1:nspecies -% rho_i(ispecies) = u(ispecies); %subspecies density -% rho = rho + rho_i(ispecies); %total mixture density -% end -% -% rhou = u(nspecies+1); -% rhoE = u(nspecies+2); - -% rhoinv = 1/ rho; -% u = rhou * rhoinv; %velocity -% E = rhoE*rhoinv; %energy -% - % Mutation outputs - for ispecies = 1:nspecies - omega_i(ispecies) = w(ispecies); - end -% p = w(nspecies + 1); %pressure -% -% H = E+p*rhoinv; %enthalpy - -% rho_inf = 0.0085; -% u_inf = 542.0; -% rhoe_inf = rho_inf * u_inf^2; - % Sources for ispecies = 1:nspecies - s(ispecies) = omega_i(ispecies); + s(ispecies) = w(ispecies); end end @@ -109,10 +81,12 @@ % ub(:,1) = [rhoL(:); rhouL; rhoEL]; % ub(:,1) = mu(8:14); - ub(:,1) = mu(1:nspecies+2); +% ub(:,1) = mu(1:nspecies+2); % ub(:,1) = u(:); - p_outflow = mu(nspecies+3); - ub(:,2) = [u(1:nspecies);u(nspecies+1);p_outflow]; +% p_outflow = mu(nspecies+3); +% ub(:,2) = [u(1:nspecies);u(nspecies+1);p_outflow]; + ub(:,1) = u(:); + ub(:,2) = u(:); % TO BE MANUALLY MODIFIED end function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) @@ -121,8 +95,8 @@ f = flux(u, q, w, v, x, t, mu, eta); - uinflow = mu(1:nspecies+2); - finflow = flux(uinflow, q, w, v, x, t, mu, eta); +% uinflow = mu(1:nspecies+2); +% finflow = flux(u, q, w, v, x, t, mu, eta); % fb(:,1) = finflow*n(1) + tau(1)*(uinflow-uhat); fb(:,1) = f*n(1) + tau(1)*(u-uhat); fb(:,2) = f*n(1) + tau(1)*(u-uhat); From 4499c07de40f1a515594b904bf05469548bd573e Mon Sep 17 00:00:00 2001 From: rloekvh Date: Mon, 14 Mar 2022 13:07:31 -0400 Subject: [PATCH 12/23] App file to allow utilities --- src/Kernel/AppDriver/opuApp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Kernel/AppDriver/opuApp.cpp b/src/Kernel/AppDriver/opuApp.cpp index 7beec236..ac3d1e5a 100644 --- a/src/Kernel/AppDriver/opuApp.cpp +++ b/src/Kernel/AppDriver/opuApp.cpp @@ -5,6 +5,7 @@ #ifdef _MUTATIONPP #include +#include "mutationUtils.cpp" #endif #include "opuFlux.cpp" From ba6c56e14d5f8482893e6dc74ac80ebd3b1c8321 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Sun, 22 May 2022 14:36:36 -0400 Subject: [PATCH 13/23] minimal working example of interface --- .../1DShockTube/app/mutationUtils.cpp | 193 ++++++++++++++ .../app/opuFbouSubsonicVectorTau.cpp | 237 ++++++++++++++++++ .../1DShockTube/app/opuFlux_MPP.cpp | 65 +++-- .../1DShockTube/app/opuOutput_MPP.cpp | 35 +++ .../1DShockTube/app/opuSource_MPP.cpp | 50 ++-- .../1DShockTube/app/opuUbouSubsonicMPP.cpp | 65 +++-- Applications/Hypersonics/1DShockTube/pdeapp.m | 170 +++++-------- .../Hypersonics/1DShockTube/pdemodel_inflow.m | 132 +++++----- .../Hypersonics/1DShockTube/plotnonequil.m | 62 +++++ .../1DShockTube/plotnonequilfunction.m | 93 +++++++ src/Matlab/Preprocessing/preprocessing.m | 2 + 11 files changed, 843 insertions(+), 261 deletions(-) create mode 100644 Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp create mode 100644 Applications/Hypersonics/1DShockTube/app/opuOutput_MPP.cpp create mode 100644 Applications/Hypersonics/1DShockTube/plotnonequil.m create mode 100644 Applications/Hypersonics/1DShockTube/plotnonequilfunction.m diff --git a/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp b/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp new file mode 100644 index 00000000..1abdd26e --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp @@ -0,0 +1,193 @@ +void nondimensionalizeConsVars(double* Ucons, double* uinf, int nspecies, int nd) +{ + // Modifies Ucons vector in place to have nondimensional quantities + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + for (int i=0; isetState(Yinf, pt_arr, 2); + + // Get conservative quantities + double rho_i[5]; // memory for densities + mix->densities(rho_i); + double rho = mix->density(); + double rhoe = mix->mixtureEnergyMass() * rho; + double Ustate[6] = {rho_i[0],rho_i[1],rho_i[2],rho_i[3],rho_i[4],rhoe}; + + stateToConsVars(Ucons, uv_inflow, Ustate, uinf, nspecies); + nondimensionalizeConsVars(Ucons, uinf, nspecies, 1); +} + +void uoutflow(double* Ucons, double* param, double* uinf, Mutation::Mixture *mix) +{ + // Subsonic outflow: use rho_i, rhou from solution + // given Pout, solve for energy rhoE + int nspecies = 5; + // scaling information + double rho_inf = uinf[0]; + double uv_inf = uinf[1]; + double rhoe_inf = uinf[2]; + double RU = Mutation::RU; + + double Ustate[6]; + double rho_i[5]; // If kept around, these arrays should be initialized as + // some member of temp (maybe tmpapp array so it's separate from tmpg?) + double rho = 0.0; + + dimensionalizeConsVars(Ucons, uinf, nspecies, 1); + conservativeToState(Ucons, Ustate, uinf, nspecies); + + // Pressure outlet + double P_out = param[3*nspecies+6]; + + // Use pressure and rho from solution to get Temperature + double denom = 0.0; + for (int i = 0; i < nspecies; i++) + { + rho_i[i] = Ustate[i]; + rho = rho + rho_i[i]; + // Ucons[i] = rho_i[i]; + denom = denom + RU * Ustate[i]/mix->speciesMw(i); + } + double T_out = P_out / denom; + double u_out = Ucons[nspecies]/rho; + // double u_out = 370.0; + // printf("Tout: %f\n", T_out); + // Set state with desnities and temperature + mix->setState(rho_i, &T_out, 1); + + // Update energy + double rhoe = mix->mixtureEnergyMass() * rho; + Ustate[nspecies] = rhoe; + + // printf("rhou before update: %f\n", Ucons[5]); + stateToConsVars(Ucons, u_out, Ustate, uinf, nspecies); + // printf("rhou after update: %f\n", Ucons[5]); + nondimensionalizeConsVars(Ucons, uinf, nspecies, 1); + + // Here I can check that Ustate is the same mix.densities? + // and that rho u doesn't change ? ? ? + // double rhotest[5]; + // mix->densities(rhotest); + // for (int i = 0; i< nspecies; i++) + // { + // printf("rho mix %i: %f\n", i, rhotest[i]/rho_inf); + // printf("rho state %i: %f\n", i, Ucons[i]); + // } +} \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp new file mode 100644 index 00000000..54c52891 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp @@ -0,0 +1,237 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + T uinf4 = mix->P()/rhoe_scale; + // T uinf4 = 16894.0/rhoe_scale; + + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+3; + T t4 = udg2*1.0E+3; + T t5 = udg3*1.0E+3; + T t6 = udg4*1.0E+3; + T t7 = udg5*1.0E+3; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + T t29 = 1.0/t28; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t29*udg6*(t23+3.183097800805168E-4); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t29*udg6*(t24+3.183097800805168E-4); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t29*udg6*(t25+3.183097800805168E-4); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t29*udg6*(t26+3.183097800805168E-4); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t29*udg6*(t27+3.183097800805168E-4); + f[5*ng+i] = nlg1*(uinf4+t29*(udg6*udg6))+tau6*(udg6-uhg6); + f[6*ng+i] = tau7*(udg7-uhg7)+nlg1*udg6*(t29*udg7+t29*uinf4); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + // T uinf4 = param[3*nspecies+6]/rhoe_scale; + T uinf4 = mix->P()/rhoe_scale; + + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+3; + T t4 = udg2*1.0E+3; + T t5 = udg3*1.0E+3; + T t6 = udg4*1.0E+3; + T t7 = udg5*1.0E+3; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + T t29 = 1.0/t28; + + T fnudg1 = nlg1*t29*udg6*(t23+3.183097800805168E-4); + T fnudg2 = nlg1*t29*udg6*(t24+3.183097800805168E-4); + T fnudg3 = nlg1*t29*udg6*(t25+3.183097800805168E-4); + T fnudg4 = nlg1*t29*udg6*(t26+3.183097800805168E-4); + T fnudg5 = nlg1*t29*udg6*(t27+3.183097800805168E-4); + T fnudg6 = nlg1*(uinf4+t29*(udg6*udg6)); + T fnudg7 = nlg1*udg6*(t29*udg7+t29*uinf4); + + T t3h = uhg1*1.0E+3; + T t4h = uhg2*1.0E+3; + T t5h = uhg3*1.0E+3; + T t6h = uhg4*1.0E+3; + T t7h = uhg5*1.0E+3; + T t8h = atan(t3h); + T t9h = atan(t4h); + T t10h = atan(t5h); + T t11h = atan(t6h); + T t12h = atan(t7h); + T t13h = t2*t8h; + T t14h = t2*t9h; + T t15h = t2*t10h; + T t16h = t2*t11h; + T t17h = t2*t12h; + T t18h = t13h+1.0/2.0; + T t19h = t14h+1.0/2.0; + T t20h = t15h+1.0/2.0; + T t21h = t16h+1.0/2.0; + T t22h = t17h+1.0/2.0; + T t23h = t18h*uhg1; + T t24h = t19h*uhg2; + T t25h = t20h*uhg3; + T t26h = t21h*uhg4; + T t27h = t22h*uhg5; + T t28h = t23h+t24h+t25h+t26h+t27h+1.591548900402584E-3; + T t29h = 1.0/t28h; + + // T fnug1 = nlg1*t3*udg1*udg6; + // T fnudg2 = nlg1*t3*udg2*udg6; + // T fnudg3 = nlg1*t3*udg3*udg6; + // T fnudg4 = nlg1*t3*udg4*udg6; + // T fnudg5 = nlg1*t3*udg5*udg6; + // T fnudg6 = nlg1*(wdg6+t3*(udg6*udg6)); + // T fnudg7 = nlg1*udg6*(t3*udg7+t3*wdg6); + uinf4 = param[3*nspecies+6]/rhoe_scale; + T fnuhg1 = nlg1*t29h*uhg6*(t23h+3.183097800805168E-4); + T fnuhg2 = nlg1*t29h*uhg6*(t24h+3.183097800805168E-4); + T fnuhg3 = nlg1*t29h*uhg6*(t25h+3.183097800805168E-4); + T fnuhg4 = nlg1*t29h*uhg6*(t26h+3.183097800805168E-4); + T fnuhg5 = nlg1*t29h*uhg6*(t27h+3.183097800805168E-4); + T fnuhg6 = nlg1*(uinf4+t29h*(uhg6*uhg6)); + T fnuhg7 = nlg1*uhg6*(t29h*uhg7+t29h*uinf4); + + // f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t29*udg6*(t23+3.183097800805168E-4); + // f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t29*udg6*(t24+3.183097800805168E-4); + // f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t29*udg6*(t25+3.183097800805168E-4); + // f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t29*udg6*(t26+3.183097800805168E-4); + // f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t29*udg6*(t27+3.183097800805168E-4); + // f[5*ng+i] = nlg1*(uinf4+t29*(udg6*udg6))+tau6*(udg6-uhg6); + // f[6*ng+i] = tau7*(udg7-uhg7)+nlg1*udg6*(t29*udg7+t29*uinf4); + + f[0*ng+i] = tau1*(udg1-uhg1)+ 0.5 * (fnudg1 + fnuhg1); + f[1*ng+i] = tau2*(udg2-uhg2)+0.5 * (fnudg2 + fnuhg2); + f[2*ng+i] = tau3*(udg3-uhg3)+0.5 * (fnudg3 + fnuhg3); + f[3*ng+i] = tau4*(udg4-uhg4)+0.5 * (fnudg4 + fnuhg4); + f[4*ng+i] = tau5*(udg5-uhg5)+0.5 * (fnudg5 + fnuhg5); + f[5*ng+i] = 0.5 * (fnudg6 + fnuhg6) +tau6*(udg6-uhg6); + f[6*ng+i] = tau7*(udg7-uhg7)+0.5 * (fnudg7 + fnuhg7); + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp index b1998a42..ccf972bd 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp @@ -8,26 +8,57 @@ template void opuFlux(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf T udg5 = udg[4*ng+i]; T udg6 = udg[5*ng+i]; T udg7 = udg[6*ng+i]; - + int nspecies = 5; - T rho_inf = 0.0085; - T u_inf = 542.0; - double rhovec[5] = {udg1*rho_inf, udg2*rho_inf, udg3*rho_inf, udg4*rho_inf, udg5*rho_inf}; - double wdot[5]; - double rhoe = abs(udg7-(udg6*udg6)*(udg1/2.0+udg2/2.0+udg3/2.0+udg4/2.0+udg5/2.0)*1.0/pow(udg1+udg2+udg3+udg4+udg5,2.0)); - rhoe = rhoe * rho_inf * u_inf * u_inf; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; + double Ustate[6]; + dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; + double rhoe = Ustate[nspecies]; + mix->setState(rhovec, &rhoe, 0); + T wdg6 = mix->P()/rhoe_scale; - T wdg6 = mix->P(); - T t2 = udg1+udg2+udg3+udg4+udg5; - T t3 = 1.0/t2; - f[0*ng+i] = t3*udg1*udg6; - f[1*ng+i] = t3*udg2*udg6; - f[2*ng+i] = t3*udg3*udg6; - f[3*ng+i] = t3*udg4*udg6; - f[4*ng+i] = t3*udg5*udg6; - f[5*ng+i] = wdg6+t3*(udg6*udg6); - f[6*ng+i] = udg6*(t3*udg7+t3*wdg6); + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+3; + T t4 = udg2*1.0E+3; + T t5 = udg3*1.0E+3; + T t6 = udg4*1.0E+3; + T t7 = udg5*1.0E+3; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + T t29 = 1.0/t28; + f[0*ng+i] = t29*udg6*(t23+3.183097800805168E-4); + f[1*ng+i] = t29*udg6*(t24+3.183097800805168E-4); + f[2*ng+i] = t29*udg6*(t25+3.183097800805168E-4); + f[3*ng+i] = t29*udg6*(t26+3.183097800805168E-4); + f[4*ng+i] = t29*udg6*(t27+3.183097800805168E-4); + f[5*ng+i] = wdg6+t29*(udg6*udg6); + f[6*ng+i] = udg6*(t29*udg7+t29*wdg6); } } diff --git a/Applications/Hypersonics/1DShockTube/app/opuOutput_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuOutput_MPP.cpp new file mode 100644 index 00000000..602a28fa --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuOutput_MPP.cpp @@ -0,0 +1,35 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + + f[j+npe*0+npe*nce*k] = mix->P(); + f[j+npe*1+npe*nce*k] = mix->T(); + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp index 515e49a4..51da47f1 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp @@ -1,39 +1,37 @@ template void opuSource(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) { for (int i = 0; i setState(rhovec, &rhoe, 0); mix->netProductionRates(wdot); - f[0*ng+i] = wdot[0]; - f[1*ng+i] = wdot[1]; - f[2*ng+i] = wdot[2]; - f[3*ng+i] = wdot[3]; - f[4*ng+i] = wdot[4]; + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); f[5*ng+i] = 0.0; f[6*ng+i] = 0.0; } diff --git a/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp index c0f51c97..62991c41 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp @@ -2,31 +2,34 @@ template void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg { for (int i = 0; i setState(rhovec, &rhoe, 0); - // printf("opuubou1: wdg6 = %f; p = %f\n", wdg6, mix->P()/rhoe_inf); - T wdg6 = mix->P()/rhoe_inf; - //// Given Tinf, Yinf, uinf and pressure from solution, calculates rhoi, rhou, rhoE - T Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; + + T wdg6 = mix->P()/rhoe_scale; + uinflow((double*) Ucons, (double) wdg6, (double*) param, (double*) uinf, mix); - //// + f[0*ng+i] = Ucons[0]; f[1*ng+i] = Ucons[1]; f[2*ng+i] = Ucons[2]; @@ -34,26 +37,22 @@ template void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg f[4*ng+i] = Ucons[4]; f[5*ng+i] = Ucons[5]; f[6*ng+i] = Ucons[6]; - // for (int ii = 0; ii<7; ii++) - // { - // printf("ubou1: %f\n", f[ii*ng+i]); - // } + } } template void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) { for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg f[3*ng+i] = Ucons[3]; f[4*ng+i] = Ucons[4]; f[5*ng+i] = Ucons[5]; + uoutflow((double*) Ucons, (double*) param, (double*) uinf, mix); + f[6*ng+i] = Ucons[6]; - // for (int ii = 0; ii<7; ii++) - // { - // printf("ubou2: %f\n", f[ii*ng+i]); - // } } } diff --git a/Applications/Hypersonics/1DShockTube/pdeapp.m b/Applications/Hypersonics/1DShockTube/pdeapp.m index 118df650..47ed0300 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -5,101 +5,82 @@ % initialize pde structure and mesh structure [pde,mesh] = initializeexasim(); -pde.mutationflag = 1; -pde.mutationopts = {}; -pde.mutationopts{1} = "air_5"; -pde.mutationopts{2} = "ChemNonEq1T"; -pde.mutationopts{3} = "RRHO"; -pde.mutationpath = "/Users/rloekvh/Mutationpp"; - pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; -% pde.cpuappflags = "-arch x86_64"; -% pde.cpulibflags = "-arch x86_64"; -% pde.cpuflags = "-arch x86_64"; % Define a PDE model: governing equations, initial solutions, and boundary conditions pde.model = "ModelC"; % ModelC, ModelD, ModelW pde.modelfile = "pdemodel_inflow"; % name of a file defining the PDE model % Choose computing platform and set number of processors -%pde.platform = "gpu"; % choose this option if NVIDIA GPUs are available pde.mpiprocs = 1; % number of MPI processors -% Set discretization parameters, physical parameters, and solver parameters +%% Set discretization parameters, physical parameters, and solver parameters pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages -nt = 50000 ; -pde.dt = 1e-7*ones(1,nt); % time step sizes -pde.saveSolFreq = nt/100; + +tfinal = 0.01; % 1 with 1e-4 doesn't work super well +nt = 1000; +pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; +pde.saveSolFreq = 500; pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected -%Solver params +% Solver params pde.linearsolveriter = 40; -pde.GMRESrestart = 20; -pde.linearsolvertol = 1e-3; -pde.matvectol = 1e-5; -pde.NLiter = 2; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-5; +pde.matvectol = 1e-7; +pde.NLiter = 5; pde.RBdim = 5; pde.NLtol = 1e-11; -% rhoL = [0 0 0.000936356 0.000248905 0]; -% rhouL = 4.74105; -% rhoEL = 12226.7; -% rhoR = [0 0 0.00691678 0.00183864 0]; -% rhouR = 4.74544; -% rhoER = 72810.4; -% rho_pre = [0 0 0 0.000911061 0.000242181 ]; -% rhou_pre = 4.61296; -% rhoE_pre = 9128.09; - -p_outflow = 16894.1; -T_inflow = 6539.17131979989; -Xi_inflow = [0, 0, 0, 0.76708248854242, 0.23291751145758]; -T_outflow = 3943.65524717381; - -% rho_post = [0 0 0 0.00672992 0.00178897 ]; -rho_post = [0 0 0 0.00655326 0.00199076 ]; -rhou_post = 4.63086; -rhoE_post = 52267.1; - -rho_inf = sum(rho_post); -u_inf = rhou_post/rho_inf; - -% pde.physicsparam = [rho_pre(:)', rhou_pre, rhoE_pre, rho_post(:)', rhou_post, rhoE_post]; -% pde.physicsparam = [rho_pre(:)'/rho_inf,... -% rhou_pre/(rho_inf * u_inf),... -% rhoE_pre/(rho_inf * u_inf * u_inf),... -% rho_post(:)'/rho_inf,... -% rhou_post/(rho_inf*u_inf),... -% rhoE_post/(rho_inf * u_inf * u_inf)]; -pde.physicsparam = [rho_post(:)'/rho_inf,... - rhou_post/(rho_inf*u_inf),... - rhoE_post/(rho_inf * u_inf * u_inf),... - p_outflow/(rho_inf * u_inf * u_inf)]; - -pde.externalparam = [rho_inf, u_inf, T_inflow, Xi_inflow, T_outflow]; -% pde.physicsparam = [rhoL(:)', rhouL, rhoEL, rhoR(:)', rhouR, rhoER]; - % 1:ns ns+1 ns+2 ns+3:2*ns+2 2*ns+3 2*ns+4 -% pde.tau = [0.1, 0.1, 0.1, 0.1, 0.1, 10, 50000]; % DG stabilization parameter -pde.tau = 1.5; -pde.dae_alpha = 0; -pde.dae_beta = 1; -% create a grid of 8 by 8 on the unit square -% nDiv = 2^10; -nDiv = 512; +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +% Inflow BC: specify temperature, velocity, and mass fractions +T_inflow = 6.539171319799890e+03; +Xi_inflow = [0, 0, 0, 0.76708248854242, 0.23291751145758]; +u_inflow = 5.415214474186620e+02; +% Outflow BC: specify pressure +p_outflow = 1.689038973365919e+04; + +% Inflow state variables if needed +rho_post = [6.523630530137378e-81 3.418389973844208e-42 2.304461955409462e-18 6.553622130237057e-03 1.989946818507937e-03 ]; +rhou_post = 4.626525823245526e+00; +rhoE_post = 5.226378663945407e+04; + +% Scaling parameters +rho_scale = sum(rho_post); +u_scale = u_inflow; +rhoe_scale = rho_scale * u_scale * u_scale; + +% Dimensional equilibrium state; used as initial conditions for outflow +rho_equil = [2.097903177177863e-05 2.595607445498073e-03 3.266988117157821e-04 9.417156962182115e-03 1.423035901034682e-04 ]; +rhou_equil = 4.626525823245757e+00; +rhoE_equil = 8.315126885726860e+04; + +pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow]; +% 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 +pde.externalparam = [rho_scale, u_scale, rhoe_scale, NaN]; +% Inf is a placeholder variable that's replaced with Mutation outputs +%% Stabilization and mesh +pde.tau = [5,5,5,5,5,5,5]; +nDiv = 1024; [mesh.p,mesh.t] = linemesh(nDiv-1); -a = 0; b = 1; +a = 0; b = 1.5; mesh.p = a + (b-a)*mesh.p; -% mesh.p = loginc(mesh.p, 15); +mesh.p = loginc(mesh.p, 6); % expressions for domain boundaries mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary -%% call exasim to generate and run C++ code to solve the PDE model -% [sol,pde,mesh,master,dmd] = exasim(pde,mesh); - +%% Call Exasim % search compilers and set options pde = setcompilers(pde); @@ -110,52 +91,17 @@ gencode(pde); cd("app"); eval('!./fixargsMPP_Mac.sh'); -% eval('!./movefiles.sh'); -% eval('!cp opuInituMPP.cpp opuInitu.cpp'); eval('!cp opuAppMPP.cpp opuApp.cpp'); -eval('!cp opuInitwdg_MPP.cpp opuInitwdg.cpp'); -eval('!cp opuSourcew_MPP.cpp opuSourcew.cpp'); eval('!cp opuUbouSubsonicMPP.cpp opuUbou.cpp'); -eval('!cp opuFbouSubsonicMPP.cpp opuFbou.cpp'); -% eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); -% eval('!cp opuSource_MPP.cpp opuSource.cpp'); -% eval('!./compileMutation.sh'); +% eval('!cp opuFbouSubsonicMPP.cpp opuFbou.cpp'); +eval('!cp opuFbouSubsconicVectorTau.cpp opuFbou.cpp'); +eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); +eval('!cp opuSource_MPP.cpp opuSource.cpp'); +eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); cd(".."); + % compile source codes to build an executable file and store it in app folder compilerstr = compilecode(pde); % run executable file to compute solution and store it in dataout folder -runstr = runcode(pde); - -%% plot solution -% sol = fetchsolution(pde,master,dmd, 'dataout'); -for ti = pde.saveSolFreq:pde.saveSolFreq:nt - sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); - dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); - clf - - for i = 1:5 - u = sol(:,i,:); -% subplot(1,3,1) - hold on - plot(dgnodes(:),u(:),'LineWidth',1.3) - end -% u = sol(:,6,:); -% subplot(1,3,2) -% plot(dgnodes(:),u(:),'LineWidth',1.3); -% -% u = sol(:,7,:); -% subplot(1,3,3) -% plot(dgnodes(:), u(:),'LineWidth',1.3); -% -% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); -% w = solw(:,6,:) * rho_inf * u_inf^2; -% disp(w(1)); -% figure(2); -% semilogx(dgnodes(:),w(:)); - set(gca, 'Xscale','log') - waitforbuttonpress -end - - - +runstr = runcode(pde); diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m index beb49bc0..f4a8f460 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m @@ -6,19 +6,19 @@ pde.fbou = @fbou; pde.ubou = @ubou; pde.initu = @initu; - pde.sourcew = @sourcew; - pde.initw = @initw; + pde.output = @output; end function m = mass(u, q, w, v, x, t, mu, eta) nspecies = 5; m = sym(ones(nspecies + 2, 1)); - m = sym([1.0; 1.0; 1.0; 1.0; 1.0]); end function f = flux(u, q, w, v, x, t, mu, eta) nspecies = 5; + alpha = 1.0e3; + rmin = 0.0; f = sym(zeros(nspecies + 2,1)); rho_i = sym(zeros(5,1)); @@ -26,7 +26,7 @@ % Conservative Variables for ispecies = 1:nspecies - rho_i(ispecies) = u(ispecies); %subspecies density + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density rho = rho + rho_i(ispecies); %total mixture density end @@ -37,12 +37,7 @@ uv = rhou * rhoinv; %velocity E = rhoE*rhoinv; %energy - % Mutation outputs - rho_inf = eta(1); - u_inf = eta(2); - - p = w(nspecies + 1); %pressure - + p = eta(4); % MANUALLY MODIFIED H = E+p*rhoinv; %enthalpy % Fluxes @@ -62,31 +57,16 @@ omega_i = sym(zeros(nspecies,1)); for ispecies = 1:nspecies - s(ispecies) = w(ispecies); + s(ispecies) = 1; % MANUALLY MODIFIED end end function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) nspecies = 5; ub = sym(zeros(nspecies+2, 2)); -% [rho_pre, rhou_pre, rhoE_pre, rho_post, rhou_postshock, rhoE_post] -% rhoL = mu(1:nspecies); -% rhouL = mu(nspecies+1); -% rhoEL = mu(nspecies+2); -% -% rho_post = mu(nspecies+3:2*nspecies+2); -% rhou_post = mu(2*nspecies+3); -% rhoE_post = mu(2*nspecies+4); - -% ub(:,1) = [rhoL(:); rhouL; rhoEL]; - -% ub(:,1) = mu(8:14); -% ub(:,1) = mu(1:nspecies+2); -% ub(:,1) = u(:); -% p_outflow = mu(nspecies+3); -% ub(:,2) = [u(1:nspecies);u(nspecies+1);p_outflow]; +%%%%%% C-CODE MANUALLY WRITTEN ub(:,1) = u(:); - ub(:,2) = u(:); % TO BE MANUALLY MODIFIED + ub(:,2) = u(:); end function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) @@ -94,51 +74,68 @@ fb = sym(zeros(nspecies+2, 2)); f = flux(u, q, w, v, x, t, mu, eta); - -% uinflow = mu(1:nspecies+2); -% finflow = flux(u, q, w, v, x, t, mu, eta); -% fb(:,1) = finflow*n(1) + tau(1)*(uinflow-uhat); - fb(:,1) = f*n(1) + tau(1)*(u-uhat); - fb(:,2) = f*n(1) + tau(1)*(u-uhat); + fn = f*n(1); +%%%%% C-CODE MANUALLY MODIFIED + for i = 1:(nspecies+2) + fb(i,1) = fn(i) + tau(i)*(u(i)-uhat(i)); + end + fb(:,2) = fb(:,1); end function u0 = initu(x, mu, eta) - % To be manually modified nspecies = 5; -% u0 = sym(zeros(nspecies+2,1)); -% -% rho_pre = mu(1:nspecies); -% rhou_pre = mu(nspecies+1); -% rhoE_pre = mu(nspecies+2); -% -% rho_post = mu(nspecies+3:2*nspecies+2); -% rhou_post = mu(2*nspecies+3); -% rhoE_post = mu(2*nspecies+4); -% u0 = mu(nspecies + 3:2*nspecies + 2); - u0 = mu(1:nspecies+2); -% for i = 1:nspecies -% u0(i) = smoothstep(x, rho_post(i), rho_pre(i), 1/1000); -% end -% u0(1) = smoothstep_up(x, rho_post(1), rho_pre(1), 1/10); -% u0(2) = smoothstep_up(x, rho_post(2), rho_pre(2), 1/10); -% u0(3) = smoothstep_up(x, rho_post(3), rho_pre(3), 1/10); -% u0(4) = smoothstep_down(x, rho_post(4), rho_pre(4), 1/10); -% u0(5) = smoothstep_down(x, rho_post(5), rho_pre(5), 1/10); -% u0(nspecies+1) = smoothstep_down(x, rhou_post, rhou_pre, 1/10); -% u0(nspecies+2) = smoothstep_down(x, rhoE_post, rhoE_pre, 1/10); -% u0 = [rhoL(:) + rhoR(:); rhouL + rhouR; rhoEL + rhoER]; + + % pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow]; + % % 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 + % pde.externalparam = [rho_scale, u_scale, rhoe_scale]; + + rho_post_vec = mu(1:nspecies); + rhou_post = mu(nspecies + 1); + rhoE_post = mu(nspecies + 2); + + rho_equil_vec = mu(nspecies+3:2*nspecies+2); + rhou_equil = mu(2*nspecies + 3); + rhoE_equil = mu(2*nspecies + 4); + + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + + rho_equil_vec_nondim = rho_equil_vec/rho_scale; + rhou_equil_nondim = rhou_equil/(u_scale * rho_scale); + rhoE_equil_nondim = rhoE_equil/rhoe_scale; + + rho_post_vec_nondim = rho_post_vec/rho_scale; + rhou_post_nondim = rhou_post/(u_scale * rho_scale); + rhoE_post_nondim = rhoE_post/rhoe_scale; +% Smooth step +% stepsize = 0.01; +% u0(1) = smoothstep_up(x-stepsize, rho_post_vec_nondim(1), rho_equil_vec_nondim(1), stepsize); +% u0(2) = smoothstep_up(x-stepsize, rho_post_vec_nondim(2), rho_equil_vec_nondim(2), stepsize); +% u0(3) = smoothstep_up(x-stepsize, rho_post_vec_nondim(3), rho_equil_vec_nondim(3), stepsize); +% u0(4) = smoothstep_down(x-stepsize, rho_post_vec_nondim(4), rho_equil_vec_nondim(4), stepsize); +% u0(5) = smoothstep_down(x-stepsize, rho_post_vec_nondim(5), rho_equil_vec_nondim(5), stepsize); +% u0(nspecies+1) = smoothstep_down(x-stepsize, rhou_post_nondim, rhou_equil_nondim, stepsize); +% u0(nspecies+2) = smoothstep_up(x-stepsize, rhoE_post_nondim, rhoE_equil_nondim, stepsize); + u0 = [rho_equil_vec_nondim(:); rhou_equil_nondim; rhoE_equil_nondim]; end -function sw = sourcew(u, q, w, v, x, t, mu, eta) +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(2,1)); nspecies = 5; + alpha = 1.0e3; + rmin = 0.0; - sw = sym(zeros(nspecies + 2,1)); + f = sym(zeros(nspecies + 2,1)); rho_i = sym(zeros(5,1)); rho = sym(0); % Conservative Variables for ispecies = 1:nspecies - rho_i(ispecies) = u(ispecies); %subspecies density + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density rho = rho + rho_i(ispecies); %total mixture density end @@ -146,18 +143,9 @@ rhoE = u(nspecies+2); rhoinv = 1.0 / rho; - u = rhou * rhoinv; %velocity + uv = rhou * rhoinv; %velocity E = rhoE*rhoinv; %energy - % Mutation inputs - rhoe = rhoE - 0.5 * rho * u^2; - for i = 1:nspecies - sw(i) = rho_i(i); - end - sw(nspecies + 1) = rhoe; -end - -function w0 = initw(x, mu, eta) - nspecies = 5; - w0 = sym(zeros(nspecies + 1,1)); + o(1) = u(1); + o(2) = u(2); end \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/plotnonequil.m b/Applications/Hypersonics/1DShockTube/plotnonequil.m new file mode 100644 index 00000000..219918f5 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/plotnonequil.m @@ -0,0 +1,62 @@ +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +% for ti = pde.saveSolFreq:pde.saveSolFreq:(length(pde.dt)*6) +for ti = pde.saveSolFreq:pde.saveSolFreq:(50000) +% sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +sol = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); + dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); + +% rho = sum(sol(:,1:5,:),2); + for i = 1 + u = sol(:,i,:); +% subplot(1,3,1); + figure(i) + clf + + + hold on + +% plot(dgnodes(:),u(:)./rho(:),'LineWidth',1.3); +% +plot(dgnodes(:),u(:),'LineWidth',1.3); +set(gca, 'Xscale','log'); +% waitforbuttonpress + end +% rhou = sol(:,6,:); +% plot(dgnodes(:),rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log'); + +% rhoE = sol(:,7,:); +% p = solw(:,6,:); +% for i = 1:5 +% u = solw(:,i,:); +% hold on +% plot(dgnodes(:),u(:),'LineWidth',1.3); set(gca, 'Xscale','log'); +% title("\omega_i") +% end +% subplot(1,3,2); +% plot(dgnodes(:), rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log') +% subplot(1,3,3); +% plot(dgnodes(:), rhoE(:),'LineWidth',1.3); +% set(gca, 'Xscale','log') + +% u = sol(:,6,:); +% subplot(1,3,2) +% plot(dgnodes(:),u(:),'LineWidth',1.3); +% +% u = sol(:,7,:); +% subplot(1,3,3) +% plot(dgnodes(:), u(:),'LineWidth',1.3); +% +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); +% w = solw(:,6,:) * rho_inf * u_inf^2; +% disp(w(1)); +% figure(2); +% semilogx(dgnodes(:),w(:)); + drawnow + waitforbuttonpress +% disp(ti) +end + + + diff --git a/Applications/Hypersonics/1DShockTube/plotnonequilfunction.m b/Applications/Hypersonics/1DShockTube/plotnonequilfunction.m new file mode 100644 index 00000000..393b2f9f --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/plotnonequilfunction.m @@ -0,0 +1,93 @@ +function [] = plotnonequilfunction(pde, master, mesh, dmd, str) + dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); + for ti = pde.saveSolFreq:pde.saveSolFreq:2e5 + % sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); + if strcmp(str,'P') + sol = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); + u = sol(:,1,:); + figure(1); + ay = 1.6e4; by = 1.7e4; + elseif strcmp(str,'T') + sol = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); + u = sol(:,2,:); + figure(2) + ay = 3500; by = 6500; + else + sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); + rho = sum(sol(:,1:5,:),2); + if strcmp(str,'Y1') + u = sol(:,1,:); + u = u./rho; + figure(1); + ay = 0; by = 1.8e-3; + end + if strcmp(str,'Y2') + u = sol(:,2,:); + u = u./rho; + figure(2); + ay = 0; by = 0.25; + end + if strcmp(str,'Y3') + u = sol(:,3,:); + u = u./rho; + figure(3); + ay = 0; by = 8e-2; + end + if strcmp(str,'Y4') + u = sol(:,4,:); + u = u./rho; + figure(4); + ay = 0.73; by = 0.78; + end + if strcmp(str,'Y5') + u = sol(:,5,:); + u = u./rho; + figure(5); + ay = 0; b = 0.25; + end + if strcmp(str,'r1') + u = sol(:,1,:); + figure(1); + end + if strcmp(str,'r2') + u = sol(:,2,:); + figure(2); + end + if strcmp(str,'r3') + u = sol(:,3,:); + figure(3); + end + if strcmp(str,'r4') + u = sol(:,4,:); + figure(4); + end + if strcmp(str,'r5') + u = sol(:,1,:); + figure(5); + end + if strcmp(str,'r') + u = rho; + figure(6); + end + if strcmp(str,'u') + u = sol(:,6,:); + u = u./rho; + figure(7); + end + if strcmp(str,'ru') + u = sol(:,6,:); + figure(8); + end + end + clf; hold on + plot(dgnodes(:),u(:),'LineWidth',1.3); + set(gca,'Xscale','log'); + ylim([ay by]) + xlim([1e-6 1.5]) + drawnow +% waitforbuttonpress + end +end + + + \ No newline at end of file diff --git a/src/Matlab/Preprocessing/preprocessing.m b/src/Matlab/Preprocessing/preprocessing.m index 2d6fe434..b2d2d650 100644 --- a/src/Matlab/Preprocessing/preprocessing.m +++ b/src/Matlab/Preprocessing/preprocessing.m @@ -131,6 +131,8 @@ ndims(10) = app.nco; ndims(11) = app.nch; ndims(12) = app.ncx; + app.nce=2; + ndims(13) = app.nce; nsize = zeros(20,1); nsize(1) = length(ndims(:)); From 49a8da854260a31d0d1a1165a48ed062d17be1b0 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Mon, 19 Sep 2022 09:59:39 -0400 Subject: [PATCH 14/23] laplacian AV --- .../Hypersonics/shocktests/EulerResults.png | Bin 0 -> 33846 bytes .../shocktests/app/fixargsMPP_Mac.sh | 6 + .../shocktests/app/mutationUtils.cpp | 353 ++++++++++++++++++ .../Hypersonics/shocktests/app/opuApp_MPP.cpp | 238 ++++++++++++ .../shocktests/app/opuAvfield_MPP.cpp | 137 +++++++ .../shocktests/app/opuAvfield_old_MPP.cpp | 140 +++++++ .../shocktests/app/opuFbou_MPP.cpp | 204 ++++++++++ .../shocktests/app/opuFlux_MPP.cpp | 86 +++++ .../shocktests/app/opuInitu_MPP.cpp | 51 +++ .../shocktests/app/opuOutput_MPP.cpp | 55 +++ .../shocktests/app/opuSource_MPP.cpp | 50 +++ .../shocktests/app/opuUbou_MPP.cpp | 90 +++++ .../Hypersonics/shocktests/getStates.py | 86 +++++ Applications/Hypersonics/shocktests/htr_out.m | 48 +++ Applications/Hypersonics/shocktests/pdeapp.m | 158 ++++++++ .../Hypersonics/shocktests/pdeapp_euler.m | 147 ++++++++ .../Hypersonics/shocktests/pdemodel.m | 343 +++++++++++++++++ .../Hypersonics/shocktests/pdemodel_euler.m | 338 +++++++++++++++++ .../Hypersonics/shocktests/plotting.m | 96 +++++ .../Hypersonics/shocktests/plotting_euler.m | 109 ++++++ .../Hypersonics/shocktests/smoothstep_down.m | 16 + .../Hypersonics/shocktests/smoothstep_up.m | 15 + 22 files changed, 2766 insertions(+) create mode 100644 Applications/Hypersonics/shocktests/EulerResults.png create mode 100755 Applications/Hypersonics/shocktests/app/fixargsMPP_Mac.sh create mode 100644 Applications/Hypersonics/shocktests/app/mutationUtils.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuApp_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuAvfield_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuAvfield_old_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuInitu_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuOutput_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuUbou_MPP.cpp create mode 100644 Applications/Hypersonics/shocktests/getStates.py create mode 100644 Applications/Hypersonics/shocktests/htr_out.m create mode 100644 Applications/Hypersonics/shocktests/pdeapp.m create mode 100644 Applications/Hypersonics/shocktests/pdeapp_euler.m create mode 100644 Applications/Hypersonics/shocktests/pdemodel.m create mode 100644 Applications/Hypersonics/shocktests/pdemodel_euler.m create mode 100644 Applications/Hypersonics/shocktests/plotting.m create mode 100644 Applications/Hypersonics/shocktests/plotting_euler.m create mode 100644 Applications/Hypersonics/shocktests/smoothstep_down.m create mode 100644 Applications/Hypersonics/shocktests/smoothstep_up.m diff --git a/Applications/Hypersonics/shocktests/EulerResults.png b/Applications/Hypersonics/shocktests/EulerResults.png new file mode 100644 index 0000000000000000000000000000000000000000..64851f9e234f2e67624020158e5cfcc5b530f143 GIT binary patch literal 33846 zcmc$`cRZKx-#&gJQ4$&y*`<{<97mp<>$ec#{v^Zot){9TX7`|;+L*EP=bc|M=V^Ei(43OIULopCk$YJwmbH8oUp z2!h^(AgC4Ssqu;AEB9;o-zsMfqYDJVu%7&niinEdgb(RlG__Ufey&=-hEDbcpSK7; z+UlZu+(p;P%EkTEc}qfDQSXqVk`RxcjU|uvDHj_%8DR(2u&45J&)+2&PyhG zu8Xr{($s=qM0u$PX>SBY2^bp<8y{*Hyw}+BuF0WuxA;WPrsRT>65qBLb@wc2?Y5Qh zod|0-wq>`KZCaGrnb@{YTR=jqB~O9j=*j3V?l>7aM*j}0dK0sT1JmbbqZ`&ZRXgmD zo!B2Y(_U?tPY%xVL3wQd$o-#R2%=s=XT?9idC-RQ{qu9xuFwrs|NLThC5ir@pGQ}3 zRsH8@iXqQVa*UUcGHOkhe}3-Xs1f+j&qUV$50{7!i4?akNPlGCk}2Kk^06sZx6q+I z*~z2Dj*Vhn7IdBWk$Cl<>D!+aEmX@CGIyd}P^6J&Ac5xX`p162x5QKYgPtU~ft|c?h zrOA&+O5H~a^n>HRKvzacRrMcd?r5D_b@xe>I2bPS=FXoHzmM=`VTjjQ%m1>BUKM{dx=dvC8 zoZU8t(>NTl)nwu3jw>ChXiq(5%EiD(#9PMf^Bn*7DhNZeZQHg6`I+d-%1U9(@3}dQnXA@4 zq0KVR@zWe#mqyBc{`7EjdriJ~@A7I%)_%~~*f={oo2vVGy6?TR_Wc7si#|)g%~=9M zLb#r2b z4tW1beH=TFX<}etprN73D*hSe>+8E}y+Bj!T(hCMrG>=?9IUKvgP(*21qZIsaruXY z7+M=KQxR)FJkpAwLj+Y_q2Z8r+z__3I8%Ax&!}>tW9M1X!TK1v!n3V8*XWpTaUWR3 zRl;uw2N{-ilzxl$$l(9vR9{ktElLa>jQ&>>1)47uq9{*u@WvPX^Fm5 zZ|>}DGaReEy?wa;i(9)xTkDbib1ICPCdE0fgP+{Yd*m-pekPv^17R(>iJN<*r{|2E zFb_|6_p@tuZ8sP>jPujZJU-b~;T04V)Er$?qaj&z@)>n{v)zp28)YW>q|Uq&gj0U^ z(nQ>n%>}c|W2)-jNF_7k4s8++k-H-g**SNXxVClc9+7{fUGc5Wy71&q4ym(!jS0%b zckL(p-XliK9dx%!CfBc`yrGZJT%CEI?!fs&rBAdD9{j-i49{!K z@l?o|!>!o;)n4N@>4sUKzIZOoPuVrLv>0-nwaO#n8Qxe^QFfKge7Th0gY_3wW1m%C zfScAYEps3FqU^U;-@5YmuhOoCU+&iR(b-;e)5Gl<2I&q#ZGnNS^Eun?^6MW+k6>>2 z&SRzTAA7l;Y5(lW-_ygY-?89>*hDkMV~-`ObzU6IXbWjUh^8D%T)Adb{IE@H`6YK- z+f><4ZxUPvnrz?R-=n>>fgoa2>Q@`PeyX=?YJ0rbW3(HwHv93&fdGy60tctEvDb}_ zM_mUp3co~&Ti=qJz`tO{EXkNEiHdMj`L0%)?UlRRA`)GetGQr zbiHWhpPYHuT?SA3Fa*`NIDgNKWU1L5@c2Dk*kvdB_T4-EYXu_(wjTu~H?3cvsK({d zO;zpfPY}|2`udMD%)RC(vyC$l+SfigO}A7o=0|<1%Fmj<>WTqQ3;R-j$v)(z!1nF- z4ELrf15Q4_Pe^{qwQhL$kZ(%MkBK{TB?kXQ@9$hBR`$B-fsw`EBXN@UpW>GO^p5pZ zyAOWS=BOOZEN!wF&N-}dacbahY-|OF#_RXAq=nJhnjdD$KP65*)>!|LmMDL!yMiz| zhOx^(V{YEnu>bea_uAWh-+Fq)Z9gROtKY&>H83!E{rYveZ{b%i{s;krK8#iC>Ul82|kF^Q&y)uF$h-gqJ&Qrq*QS7eMnIDYYYA)=h7F7nsMijOS?ni-2A-M-|?w4 zTPL;Mm}q1O{zO%^5r=K{%4>?d4m#!=`!RADTv|kmJ?qoNWxp|uSNR4K=n``n7DAwg zv-2qT(rh)G`Q>B57M7N&J|VbccVwLlKi`t^l&BOVVfz88Y6oAb+pw(ruV@3omnV1I zFtt+?C+*3y(;1p^qR_4`+F|&~>rAhMr%olL(ed#~cU{hv`cmM~j%jtodH5d2h9Xy` zNPR50+cMQ+UTOO=S>R8?ab!{LGZO65XFoHuvRX-d&vd%a47KWVN;@yldyx4$slDWL z$*B@m8*Ljh12t4sd<|m$oKH(jJ9zM59=Ahjz={>Ix@$xFlP8x^5%M371_T5IU*skzGn@9FPb$!}w6^a3`7^DD z1FPAva{jKY<51hc&sSski0JH#b*R zRi$TD7~3lYDO?!;uIbwF>TraJDf{fAx3~B0?MGr!v*#vywFN$AnwBokHTb0Y6jUJT zUB7-E;c4TMhor2fq2V!{-=eZrUVZ`TUhwcQDk?(cvGxP0MD>vR+FF*dp6U?$9^+vl zmj15FN?DtxHtSNuaa=brFz|!-K1|23oVvQY{bQ7%hn>M<58fd`9IdXqCu~2<9Y_nH z#oY5cm|^W&$C^X!(Oxei$OL72?r^%nfdi@;8L>LLp~aSow1g?SCMVrd43Mt5_h0tF zSnS-nQ!Vk>uD-Ft%7qNmQnza>8OO)QSXfYb#3D)rW`@!ce=Kiy73p} z=c**x+M6FedNhPfzG*aTnE&erG-c#wnI!jw(Bk$cSKu%`lkV4w# zxN_yn)Y48e2J7EfS!VM_Tw;v8(5!Em+JgkIz-dzEaV&jJtIqp^n(Z`%cGY1FNZcpK z`ok_RlYl0wNrqWww*|Cy+SLWLqb8p-h~C_?cO2Q@>+5wk5tAYwK2$I#8lM)#q|bc+ zc9yxm#E_qFBPSY_nT#?%y?uMg^;1K`k-_!$)de%Z&5{N^=@4lip;jH!t3|_J!jNzZpub#E&Os(E2bQaGq2aefeh&AtSfb=l|^PQ zPWGL9wHJ|W7owr4_$*%W8t~NOKzdfJ{G|eNvOAAc5f|?R_$_oboOyk74il0$hdP|v z>3L)idoZ5-sc}Y(oVx)(S=-HuycaG?_5s+aoejGEIa1R8UR2^;Zlk9suS^@bQEf%d zc-*AD?GaM_fyLQGI9$)y?6Y@O$^Hq!W1U&4+30PG|r5L+0a;%8Tg?{8^1E2;YWB&9qu?K?aiZXCs#n^HLdOAx z(!8_Y|G

LnW1h7`k#Kd;qy;Y-S#(20xJj+kDs*-9nt#bnDH{;%Bw;(O>M@yLS%P zwELL+?uU1n!{ELjuh`80w0A9j%C$by{tP3OoSbaO^ug|H>+8tdx5X`LLS=pGMtqho z4bNtl{u*dZc<}=mUtzPH+mqoC1nr$0PrUNko)}~p|M>Yc)2!Th*Fr-5>*{Ks#kpQ! zTBkfklsMdrJTQzgr!dRd#KZ$Bhp1YM0kk$TBcek71Vt^!RK?CbUh*i7=qltKpekVN znKyTLIkbFwpQujay0c?8R0?eSKSg~jCWu1k{tu6`D&_|O1mrJGOKe($sM5X^H!v{p z?b~VnHS#htpHJ?dMQQnd9l?esE5kT{;7fVwG}C-uUY_T~&(t0SY8TL`cF<~q(iT-V z9V6>HfGEd$djI~t>;7Bub3Y$ARs0#Ri;w5I_Uz;do^&qUDq$+IT&=!r?7egMuGf73 zjTA@Kmc2B6Rzsskvc=@gZwqe9#iu;fzrLZ$B3*7j98J&2SUx|H z-WxAWDU3z;BL3pfW&!CxpVlZgFI39sOd>17dlth2Dl7UU+GSXCA zh(lYRC)RWk)runipjY9sv5S8u8cqnYN`655fh^s=QHJ{Hc2g1+IXpEDIfd4a}%2o-3gz3|A$4q~Re zx3{JI(hM4|oe~n07|7V&r=DXSPOe?8po{Z8IZ-IW!*lXOlBQ{iODmeoD>QUEIy%o^ zybx`XqoUlPWpVb}yLT^A`RK%i)}cc;Z{B>{(0~r$caCKpH4TkZ<$~LCE<$Fo$TuD- z>bZrKxRI6Bu{CF#u&}UaihHHdd7^`Ga6BEt;hW)!0F@$=R9?2` zT2I}gR$w?@=osU_@Apuy^cRmr|3j!-&wW<`FxBGE!ATgtyh>jrgFy=m}3Q)^aPQ95MC>qJSM+qYDK1M;G`9pQJI>$br#WH`Fq0h%uD$qo|dGiKk zJv5ZrK?#r$;WYzrw}FkV{T2)2VM zjjYefwqe8lcRvfeynipubaC%KNzf{zyN~x-TFlQH&&kPAu>dQ;_fW8#mX@~l-LWHU zE-x+2)cda^2pL*U76p~>)!aVO2YkFwo;(R~lxXHLQa+PLXGf<6O>|NRwT<**G@TcxFE-br`e1i>KdVq;_!=}%U96`)DXUR$1R zPj9u)P6|zDNr3|A{kMUmeByanaY^#UizuuDoy5 z@6sURR|&Cd;o;TP)DUfl4!!LH8GtpHri&qD4MWV7Mv&-Vj)5Td(G*^!ngiXXYJtY6 zz0j$U(`UNXnyfWVO-%FuBxWA);>^{;K$upyE3FJ{`I2VNY(2iLuDfUumvfcw$yAD=jT8CUzbaz_Vx1 z+^m(Al-dfN%nb~tQCrub1TdnkP7h{PPLGYPVq$W?SmtH)5Om|UQ`M} zJ?R_Qz5;@z#2!-J#&=r6WlwX*Y5twmGUj@EP2e}d6p5jM#o1S^Tf{LY0R?ZR9l0{#=R{U}3pyz-vTZRl61grLX^^w|Az7Kjd@F z>a}alDlQlMzs1-Ai_gu?6?UAjdwS{xy5-#U+Yf_td;388NJuEkPoi@GL(?;mFTc%+ zwT~R5Qy*Bm?mxGtYAa~)mcW(;6eH*;nB;y*{G;#jZ>MU!s81@XDJo&0=3JeXnr7&ZfaPiA{SlHpfvAqz@Ns z+#((o21CiCi?E=iV*gU0lE@_(wjo&C^aO*-zN|vL{AiPl{*gG&h!sCer}Gt zpIYAkbn(?IsaNOcW?ZJnEyN;{W#d~0J5np6O!w`u zM%A#2L)_P^os_{tAKQLC65n|D^LACe;g=n!^8*=`p%>FGV+&J?fO6q%gQ*;L_h=;yk-Lhl19soGnEE(Dz@D+a%o8GrZ7 zvi9M;(KyJpoMuec&i+=dNn0Mf3DIbwrrgpLb}E(s#S`1g{Nx3nHYcQrv9DrbFMC$Fp~!~Vc0xh(_{bsgf3g0Ins-{GO#y^2GK@b2)Y zdn}0wLA53W;_ghTE(GQG^2pIiex#~;l#-@>)}S$L&((wBgh?kNzxf`^;vOc#*_>2= zWOD}vl!RT0#_MhIRbHNkRTC|QNu=PTM*}uvUbKX>I{8PLSF3MRDTo^Pm>gsu@Mq$t zlpghDxm`T@DWCRYH8r7-i1LSM9u+U`yhIR9n)c;~yIcuMJ1`zT_9#V)=6mSqr0A|U zK-bNxqkbc`V(>f8`)m1mxLqb`2{uJl54LAgoP?wG$lC-#(T8_WtsttV{+_rjsz8+2 zbt{+}BKS5tn*bl?w>F3%Isi=wiv6Br;uzV^CaZ&lGXv)Im82(20T(sVLCRQ^{d(gs zHYuhu6OEf0ae{XVQ9=GS;U-wSLxMMX95p`xemI=b?rGq=$ z%LyuC-;FjQrD{we0~tt|LjH_!Ug>XC9uJ^PMVMXe?Z!6iA0^X{RrLnskq#PfO)q zSXcnEi;9kZqJA@$M^fZ%UV(zEiFF3n)LJ(TnM=I!Z)(CtCBl_3OL_9-kfn-UTpJo0 zTo`N!dKh1*CAYZb+p4RrhuiYef~HOMOs-K=HY8`+gqfUW$D;LggzUpQSt4uv%cT(z z8XYblwb3o5UU&|qr273C9k)q|OFszRSo9bN{(NQP8-LB=BqMpWA)JgkyIlV-*<_Ia zovN0vKko#6l&v6ac0ztEDUp?skl44cqao{-@i$Vq@CWYE;3)ojgF_`L$yfAk@|j#D z3R-f`injb(K}AV?Z^=n13a#&JGy>iZO!7EjC-BVZ(n95udtW2(wP(9+KWr^mzTkv= zt~DvyTKHM!w$omu_RnN^UP;X?=jm8QO*~G(XngJm-lz%VSG8DLTo`Q0Ish8j|0cU+ znsr00;bjMx;F~ws_|XmA_$)--9VjLy_Ryh^bM3w@168u8Ry3CwqZ%fY%IZ zsHp`2^G;S#FbRUYcG;sBgG})1LW8{Fl6}aQz2BmFIyXE}1p{Rg*j5?d5&WhL}bcCLso>}G7ZHo)P>)yP{lvyHi znQ`4r&*fWE|9Anqd`5haQe{2YXD0fBLPm5l63P9CvW$oXYcJi_83@SiAv5Kg&*SVQd?+2*rS?Tqyx+NOtEZ>>ggtLn$f zBHYNX9~wh7*QK*#-(Df2i>E%F01JWs-3;w7U=py}0B5{kJQ;x-LpNNpep6d(ROo1` zpiq^hc^h|?gVvaaZY>%kUq3&l&08bODR)0 z-{>LGVC%!slo;f{dH^;WOK$(%_uF8jOhsys>FHTy9|tp7;rvzU@$1!S)K!cbmBl_1 zWd`VgVtSx4WmJ|BQBLPfKBH9UR1yT|d)*aWegCO(52!02s1vQ+5azuwzn52um`V(l zC1ehpz4O{J0K^l0M5|WR(~q2LFEGtqHUF(K2eZKz2KvJEm%jR~Ei7ReM3Q%^4&i26 zy*e-;VDmnYr-_NQWk(+_P2;SWQy5X?C{#~j2p`lMN&y6EmS|$b`CMGsNdt#Iejoi4K z2`3le=jWG~HwBC1l;GC0IW>lsXk0b?iHevAFHc zatUJo6xN6WKu`A-tg;CR1CaYj8J**1K){|&YtUr~@7R&j>9_z97#t=<9JgWR68DkC zPWP^u{a#T3XjSDTm3BP)c|(Kfo;`bzGY=f_K{pQZgJI2@GDN`O<=R(4Y*^T=8#YMT zHSK60gLEdd%|d2l$d3}4KuzjV5476?7j`0167}jjE4Whf@+M&!SojtsdiFLSpN@fn z03QhJl!b7T!<}qY#v;84+B5$dsKqUEZiiInr-ug{DO7}w5o^#ketu;YgG`gi&`=&e zC^sXWr87~I_Bpw^q7fT*3JT^N7lOQEUgVsh`{Md~)FnV&lyTvDVb(D8DrET-&;KAt z#Qz|fQW3`|`6QWzcE^7^5WV(}k4c8u>lg!^E46*`KJ#c)d4g!&JCDgT`qvR?=G z97$o}3`n*Zimh8;w)(8BN=!X*p4ie0DtGTPzp6oUYBFv^$60m?36*uEW2I@a^tWWi zt>^PK>&y8yKif{#Ew2}D_DBt^7P}i3ma3|1F!Cx!6-o*Fp3^EPPj-_z<>*l!zSPuI zq*%Tj&|BcGOjPuCg@uNO!XzRsCnvXO&sagbBebXe=%ah%e146LRJ!!*crD3L9)H_w zS#|DBUEPZpFZ|YQhV+}r7)!cOWZi~5iVZpUo>x)1I6X9nb|07Cw`0c+0RbxzXNT!w zAoJjDb~IHp z6w0f7PsnH;C+G0n8cbRRD$Pho@khtqyLM@*3}~KDNvet7djVup-ZOYee$+*@Pjy^< zAQtKKB}E;uh_WlbQLwqGJT3RFw^tfuGqlmY`(=^% z1`xj}L2V_j>6Mi}U>bfTrzX|FZ332N(}oRsPF)pP!AKcX1I_8Nh5`Q5#6S5+$|Enn zEb2?=zF>x;C{VzYlP=|nz-UrIjgE+%L(5olUu5f9vpkz)s2>Un3KuV4R8dih`6$F% zN5izQF-<=mZVj-1K{a3wP@sF?M&6E$jJ$KlqO|*(siB+T;M z3L*Hh(S{R6Puxi8UT^FrM_4F8WMF}1RW8m00bMSxt*EFVjZJ_GkHz@j^u15KG}(8| z$jB4=inYobI&_%y!Z8FPq9%MOIcoSOxJ`C4wsTF#uKMlbi=V^ra(T~wg#?fTsWU`= z`Z!DvptlDjeL&ZOB?b3hItIBfs0O3U$tD=B=2gnh@3EGR=vD$CX}a?1Hwu>D-|ox( z2jOR2e$f?7nT5r7@HVeQNE40j(jTl@Mo!tuFm3mbmv!P|A#XL4$)`4*edapp~%?ng$>)ys{f=t8wI%CXRNamnjZ zUWvl@&Zh6QSj0GG15ve#Y@Y~^DA@1-`=2iEB|}@xGH}>GF0P9VZS4m?YZ~J@bdLr2 zZz3zCvu5hKQ_1ZuB_6*oc{0(-KsXx}41bymM#tH@d_TmOtAfJ-=*faM@5%T- z`nQ+DY#z{8)Y|cfo^am!w`K4{0BXGJ0hLiCw0u3vzpkgpx$ex0e3YNeTW**Wb&?fw zPTRM71r6oGIo(x6x0+2Mx-<#$G=?vQ_o3%7mXf_UZUjG|LMc{1$v+c)%9mEGA-cC* z9wS>{^6uBF;_jD^%&X*ymje?cD25Sgy2E#cBY}afTLv~1(eg=Ba2nWm3H&pn6YG8$ zJ;C9%YuL#f-BNvI1gDwh9_XY|2-1~o4Q6Sor>4Zo{~tY_mX;PO{~U~bCo&8qPfM`J zT^vZIPzd?wlXk|n)hH!DxTy%?AlMbiqiPq#y40H*F^_)%62Z*2cGGSi2%%`thCe(C zssLXb zB0CPK_l2GlRsbL@#Xs(yNIo1xvV#l5PCgT3W9J;pLeWZpY@^m!3>r~`b&6cF&VpQ1 z)P(hic^zlDRg{Qa;|!Q@kiz-KVJk5-G;G)YT;WyfFJzRXVyU9?9Zj22na4Q@Na#NE z6lH=7&I{KHOVwL!q#^P)El)X~@x?132v~-CHj7(kKUxn%6Q%ArXdjROQVQ#mAX z`_<{WsVpC_7mU)R+=EW?4SXucOidTQ-#+qbX}qt`#&tJ?F}3xh}0 zB<|^Go!j8N8Z|Mx>F=c*?ihZIyr*tY74MD6-53VZ2BKH%Ek9ph{~F-o$yE$|O4dR^ zgv-lHQ1=}t3LsIXI*HN@c^@ba*UI4(6%_Y|DJ^B?=+u-XdoW+l`5$l4FiMj49aIfJ;2`M^=WDUgJmryMNgQCqD`5-_UA0M( zmyK|i$=@52Wg=}UD5weI#eD;XEfNF@>DNTx^x)l3DA8Y0wb9gP`X72AH4G8pgPg4Y z)BY_)qY@ea57k!M|uAI`7;bXi_qaa^6d>_xElXaXZ`m6*FW^9)b$(Jv4BD( zqC%Ee8-?y$0SjSrc)5jIdF?CAzwYOE+tBMP)>(*{lI>aTS`9)Wm-O3o2abPcXCmGu zdWF6IK>of+rXQP~f5+j7mBgruFi|yZTeq1^GVfHDlgy|>^22p3dvdh#_dAa_5ri;W z2i$P?l|xOuE+;ysXehGB6d8y{J~C@Y_XZk@HhEA{?pfaKzO<3(=0)X8xXMbzd;U$T zu{YFl^ISJOLkY^yzDDG1rgmybfC0#f$Us8#`qmZ_?MEm0rUkb?9+C`A{0A${Xsg%y3U5WqIt8Uq}rCYJ+2;GUzn>Y9O_g_>eZ?iCroz2Sl1P`CU zg;i{9c-&>_|NqicE`^iQ?sh3+R8Lb=vp~~QxOGjuEy-@KHzp|Rx*PKj{rs@4_|@x3 zG8%&wj<9sIorcBn+c&F**mAV%q~qoLcX&(tIYE&q@TVB_y{7-g3{G=7TD9SV4~6U} zWSrLrD_Az?-@Xn>0ATVW?Me^vsr%x%X|UMoQL5xvC4$>e`rCdXzhrcJkkYP8U!!73 zJpL?7>5{S3awR_U*iQ8W06^mo+!<+0_lIAUYoEtajt*cG2+rWf9zJ|H$-s!2J2zgm zX9Y3Jju`&DZ#}Zn#`lo}Q z?-Hbzes!&Za8@NdbO|c=OH?dj2t_#Frv_U_K4&WjZ(4H$FA^Ph!YZVd#;u$0iMPS+62^ucbtZAgD9d~u6MJo@T@R_iiE4{7j{>`Cv(y7np)yJ zA)<;Q)ol{ca@3r^pgj>B!+0cknF|#t~KR zXdQryS&WL$|9Gex1Uy~|BLZqfpoW`U!I$?KUXv?n@!RymVKOJR0Z`(krXMYTNecG2 z{rk;0&|5ztCw731js2aT9-riqI%=X@emOzPkYmt$>VRB#)ZZ4;sia?ko15F=sH8Eb zCDHp_!uzI{Cws1v^N^)X1{V#coxHIr>_u@K34QWJh=t^pxL9y261P4b+0|eInU+wH zC-c9v6xXShCLKT=5u^?*&-SnudjW@hHl*jO$WmUFKn zw(LFsa@Ccuf#Y@uH;j7-b-ST#mhp4QqV{di>?PmUxD2SL*owu>nUoYQO4LV(%6GR&}7)g2m@et$trO`<|bXrd| z)!OA77#jNBxN*bJ@AsVP^s4vh71g;sle~UUqc^)?q2XlJI`qF7R(7x8HiluKE%@oP&vIJNYHYFV$9q8Z1_wV-xE(UXtgH6;f;f!#VVy+nQQ2|2(T1_GZcV~@|`Wfo6(9AFnIv8-eL zuPY4$1SUUNVPGSf5ot zNMRR3AxFL<5g!RY2#13@#u~KMkle4LYp?qq1JPPh>Jlzv>Vad}b>f%_LNr0@XxckI z54o*_Y6P!1&s3`pQ27PMt=;AbT$H2+@#3G$UsF%{mqF$cp7SIuQ&FRj$g6` zqhGo9k)Tav;K95Vt3bZvc8XX_R?sM%!AB}DHHL+bC~lSjI76pP!kj8mvK5qB^#E>t z#X~=JcvHcJ3a53J_zTqvlkPLfo&SQ8M8ivxR^eP8(nO}+L>|vDE0ZL)eWhrZ&YvWS z(7yt1(VoEd)WlJ=vvn^6R}suCzkbx-{Tn!nyyh-_r}+kV@G!VWM%A^$c1@4sRdop@@rf+$0&#H~~b+ZLWb zy%W_-;ac`TA5((96$=w7=CQ?koHh<9h6>8dU)j9;6@1HM*(f4C@llSbx>6r^!2I}e zk8dvnP_JQ_FTp~YYFI)GP*+zsys{M47+Zz>Ug4n{RhA(&8RL}K?Q$3310V&jX%lLS zA!eol7R%h6oDUy9Kxk{$K*YmFvwr>hLC6@-M?iO20QFwK_Z-(m?#7jh^=O@A42mg|6jTgx0r>$uF}eV zajD7E^5kswi9o+418a0Y$)W>ptEt`ae_~QB2J5E^N^TdpD(uj)u(mcA*{SnC)Sep* zcxVra8?;z!WK4VsP#YXo=z{GM<}28@u>SI&VUtmy#;H?Zf0#}Eh%gV-sPtZlX6EgF zmwEi>wtL@ZiAKUxvVCN>ZSth&*_;&w9qP||GLzNHxtP!qPQVWy@z{PjIywr{9d;#~ zYv=&j!mv%$?EgjSSx*fz%0}#s7w(Ysjlk^!69QW=Yc+ex(==*|G*%T;Q>D)mMDaF8 zD@)4&4SCJA|4H4E6Tq%!ih$V0WBW0$tf8`EZ}s#@Q^6?LorbHur7ry+kk2Yy2Mv6D zmVn~wv~@MZV8qQd&KH!Ey9Ch!q61u@Fr1q%jBuMOONvnu5~Mbk$5{S?s^eO%i6Ebv z9nxLnS<*$2^&C$u^S?Ze{<4pOhUmCF;!zl3+?t%3S(dw0)zs=E#kY%#i-UlL#B#n; z$x;_an0r8&ckU!DXqc_ADcU7vM~y|NLf*CD(1t73P!Q1fcR-w6y?Qn9xEX|7ko$Az zZ+m%pk%AY*nIo1ecVPIP0WX`AGY)OB-XE-a{Ha4$%QqWNDh{M`VOue|$eB>XVpG%7 z2B2$skJoMo_c;Na2W&ryOdmT3PbtD4`)=|$;6p3*kKXUqb}j*TC1F4=#FskDqZ^LV zT_zB}luVx?fvODikKFD^gDkU{2M;(lZ!U%|*xlW|tG)}^0Bi%)m=tVrGv@g3w5)=k>{1tmdjayo8Q}8NP`q~MIDy)CKyiJ^X&^k zN~UL)q}A`m>YT^!K9#>jDm>@`HQS8|P-ZnW{MWyr+qeF% z86uA7yeTDdBO9B~=rcO^j&tfjx5J13lbGfbz${C8Kf+GK8D;$|76B^knp;uN@KE+6 z4c}=&yT<0*{bHi->c}ZhbxKr?ESgvd5Pi`q!Nn&(Uc>M9`2V1N9|`P)N_id(o0YZo zb^(DeaOT5GNyo(X2R3!MHZTbTe-2>K737=B*YShGjMt3y{29q9=cb~nYI`%6^ocSVkteag28|1pEoIJ5Y>vH? z=PZHeun_s04FwG7or~NS`aisX*$eMsEtE5RdQ$P^$&=WsjV)P;hZ#4ES=5GagYEYg z(`HN>OOrP1nHAD&(Q?6tD+Mnl0BhUh^XJdQp82)6H{$;NO`A7I#>G_v$ywIjqg}c3 zi}&y0dZvx@Ivgsjy{z_2=_%XSMc*5?X`*4iwdki<=O&i>&Zp^)(5~HB`sOPr>oMna z#zl97wO|wf_lH?c?%~ z3!!aZrj>ksSFmh8;C&g9-SWifc1(=6&P%yRx7Lu3or0S-*BCYZK3jXm+YnX#0{T3LfZ0iQD z_S_#oeqeVG2>h|JvG*%MtBCR;5L~RHowbcir|u1u-fH_7v6g4yC;md$L6&40DY4iH^6WAtHj z4j9LH6UsbA{QI%Ztb{Q&EpU(`VC&C%h~JXG}V`z6zey^5!cev;`sgl zT(jqNjuR?LKh5QcZkc6px6i=Hs1>FG?8JE=S_{y>4^-UIqm9@%eYToZVDI;#;Hm>c zbk<-=LH9|~+D%A69k);+WJseaK`>3C+avce!J1L&F?O29{NJde-jp}OQtYEUm>>Y4 z>!jdCaMk>eUQV)a?|p1x)=`KL!CY@O;a(Vi|+Ja{hC&f^D|czDQH~XsOKy_|MZ#qj{ z8W)AXmD#0)0acP=30#9Tip^0d4A^RynU;1DEfuz%NF$-??t2P7z%3D6R$1A;jrmrE zV%FA*ud#8%1gW@5pCBw~6X=Q5?vL+6f3mZ)!w>cuJ9e-Xe*XAzof(xNC@_$;$3yZk zGmCxj;I~mo@S~kc3a;-en3Y<2;@h++uWSzf1=H1tF&*;JpKFPhOI)5EMJdVc|Avn6%q5li znGtSH{pdSP$57|;?jK!2@NhUl*m#dT!YUl-1zod|`8iBRWgt{PA3SrW2dozpr!1sS zl1nj4z<_L~)1cP0Y=lBDWsEJA;69b;*9#n?=f(RUIy`!UVPe3N|D$hc+Wh!P9D3mk z*t7u88Psf_rdR8p2e{KkE2ATDmcnEbn?f#G&h%^+|)PtoIn3^izH<$3lgG55lZ3DAY2CfnYub$$SsoaP()#~ zc-jCSlA5`mKgHt8Y}J?uV13Ok4dN zUvri%^Ij2ta0hxRGFYi!DC$E%z+KHO_sA;aK?@_6mRwF{;hPWc51{DI5JVH0(yjx>}8wg?6rCm*Q z+fj(?W0z0YvK$QLli{vpPLR=ngJ;)r6j@gi(WwK%mz3!(7Z-7H8%FZqHO!kOe=E`B z*`PHOjjPFp#>wrEMxn-PEZdIA$nz!o0Tt%FV2Xq&h+uZQNpSv`DbyzWsb`uE@!dUfsaMZ zEB??Om{o+guyS!KOWl+#%^C5TnZKa;k{e4Obme0Wz-CjJoqet;=5JsO%g2n=006H{kJkYNEad!#F#G!|gNO%qazqH95WrkN)G4=g+HJck zUXt8W!-Oq%q=NFjChWHN3)BK&50oQ0Y!v?dhL+6)8}OKfOp1;os3Kp+yV8@df&s#2 zSiM>;gp1R>>{rR45D6rf0vwRK=4H35!Q0;gUPO{a_&JTX)Y55<$b`{`B!nT znjsrGG-q(LqS4Mj?ivboklwWU`FXeqVfuQ>Cg(aJ0s9fNl7oZ8L3>&vymripS)^?A zIkpM&o;n8z%j>HpQoJ<~>s871-Ive7VTeqP99S#;n8zn3)_=M*HLy|XGqwk>kfb7N zc{f~9LH#2uz7GV!-XA}-BgKAPsKomN{++99n-$v)4Ek1VI{Yvv=lrv)w8spoY`1$) z$5-y73LnN!Azt6IvNGQ(jOq<$yfNm;f^*hts`_xl>q+59S1caV)_zw$^W`_F3in?f zp7=g?($07Io&8d_m-af9#Zz?E$xhray9}^2f{*X`V4|$7OrOxNS-1U%K5t$L*3U@k zMTI8)P+7B$;RlsiW)s1u0xTgLVPuecU7)EU?n6p;5ImRkomx4Rc3f~{RTy_g-{9*E zpOx-MAv*r2sIV4RsY}fYne5$UOk1X zmh}N=4x9~`>txZDXZSxoXke!z+A`gau@Sak{oweb z|DeO?r@R$Ka4F&(XhY$+-u=9dr~R`4!`25!S3JiOC`0dlp?3QGA$Vu-vw}8IK$jFHIW1Pd*CB6(OtlGC4u8uWar+tA5cf5+ayF>a{~?kq5xz}Yx^V6roT#jTU06nVGeLK8Z!7~@ln%x1 zFVD-9_(4leXl~tb#hGmG;o(NW5To0hPfV}0wxijKcV+$1Y{9nY3iwtxu+b1n_al*B zO@}h%iNogq9)9H5JOMHRCq>NOAx-SY5l2^0Hk_khQ)L@?#E84!=`aS`VA}>N9&PAIKgaUhNW-Es)>ISh{i>x!Y7R>?K5C2w|#SiT9i^uudTvD+r& zwiMQ(Y7jibcQ(qNXC`Xw+#0Dh$?8RMIfj%*pYT?S46X0XxqJChkb4Qj7Z`pRFPxekeZd4*{yJA- zoSn@5$TmPQ0Bi7%awvUZkC5EQ&1KUnt3P>^+Yh$A6{}?-lt2 z(NFEf5x2Cz5A=PAgbfztC^{Pel$@4^5&>N-Q8;;6?8>SfBSg~a0=d?&5^GU+_eP>q^@y+=`CAh=xBg?`6&#n5$?j#ZY&ShxQ7YQ>w5lW3` z_z;o(0-qCkdxF=#dk5OxBZhlqqwyv&}G#4F;T<4%q zC=9Lx0^!@=L*t+d38QJ7MNH%_J79+T`iGG~H|#r-UIQooxyJp62e|;-Wh?t027Lkk zBe&G3ADBM|uOazz1~pXHM!UCU#N+|ST3Hq#XMCm%eKwvb`x#|lfkB79hpo4}4jeepwwj9a=`_%K?M6A)m6Y4dNorPz z(pQF!6|SzXcukJ~c0OKTprX%{Q?s_lgu=?@wLD2i=c_pSTAo+fRIyHpG&Db-$GaN7 z%>b1=8#A(~XlrZ3FnR$T^}>FTT6qB&27KC~=6|asTj(sJG>ABnNdqy zTl@Jp*tF5FN97F=lqXhiWEEsVr@g@Y$)?Ijyqxgnn2`PReTEg|cL6W(N~xUe>@n`8 zF>cg4PS-1;!D)p<{Q3G|Uq{tNLP>3x9oLB25#nt^?0adQ7W<|15|M27vR z(Io*cc>~h94}Bhk)6I_=R(Wr{U#ipj1>>=ZmCJ=8vOgc$sQU`t{y(EH;QomIsa$Zj z^+RK$^W2Y!E>s=O3`T;->QhjDHpfa0BIz0!Q=qxbppw-DPcfc5`QPYG+V?4n^Ut2~ zs7vs(DbvGKc=+Nug7B$dPU%g|fuWIVu=68neIAA-qZ04#i2EIimkRnZqcvQ>hBPmX zHQHWsMQ)2Q3GYy%q6lHcko5vrsdk6_#~#`_kPh_tOGk8k=v=qwYfx_L85tFye0DV@ zokD*fd8yIF=v2$+EKQ=8XTy~Pf!F!Kl5LiAJBznAKy^+}OCv!Cxaeij#!Y{jwX$x! z7|HU%jW=UY!DABfuB%jed`Zy!|JhG-xCRpnYJcn2RGX?Pk#rpbD_%QDZg|U9+4_?- zNj0Y%dU-8iaVG9!6!U#?ir63YH<$8nxWcRi;ru^!%mmNvSIbE>6zC0I0tU$z?_?x# z%EwnEGMo0F9O*g`o<>mCuyPbjOxV*r6hZFb38Gi6(ZSvTlRUgwK{e>KIf7ckcN8}I zEWC20;KS$7GT6ZckOChLUQVQ9u*0HI|3)6^$ZEW}#(29{1`@}YGEZJ?6%z1e27Tv< zw=99K#SVZ)_~ZsYK5l^AK(hH*_t=bhVBjr&`ROUN<9KbJ=KoXPx5q=BzV8n@3@Q>yMm1<<2~>9GtYBB z*L~gBeLZVWQRqxf!3KGXy#K#u$k}HEV-WP%dEqmzTNqVf>@GYM@if)(s@SsmjD=?^IGp#%Q=)fRMI1-uJARCq+_S z({3{*f2K0o1fKi>X6glC=5kKw-MzCXTHp$XtI6LP+#a3Z0_f98CLBeQhW{|)-nUuh zueTTDaQkwV#c+0Sbh+Ih6g~*7ZW@} zgkT$6QnW{aQM3pay4tBesfnmI6P^mNj?A6{^BFf6XJ2#Rp2BZ!)JGp@ht>5_j3l5} z36@ z3114+#v53OQk1uwnJu#_<`DX0JvI_B^kgz2mSP9c>uWwb8kf-EXt-kh8xcx)8|epy zuh&rPu8~%>O+X`}Pc_^5Q!8xsdVq?DEBXC;Fp<5WAxW{DB^WT?p94mZVUexd3VR>c z9)~1@0RA75xgcFTu~3-ebWSkXrTdEb!|%{OQwLiF)Q4v2xcmqb2)e%lKoaNtm&a1q zA5CYnb86$%6P^n8*c+o`UUeXVVox0PXdH|hWZZC|?L#(~^~u@$)eP7S?E+&ynqT1N z{6llWwiEv_Z-mV;?;2$Rh*Vf>{Oy ziC&mqOg7XgiZ;dTBKcX~p^tsx?;F|Ht*%Nx58Ik+mugS;*ZNel(08%Nt9X8Y{Hvd3 z*#{q^{#*zF8B}-iE3i(VNn+B|$FcHVtnfi7aDp12Y;mJGK%8{RfxY%+s-R{0G_qa- z1J8TCHL|)CT}hwp-&+fmB*{Q=4;ts8a0fTtZstTf#W;x`P`c%vb(JoY?CeWVL z*2W7yv^1OsKBl~~au*tOupQ)7>Na5Ap;#B!q9^MmuWXw@by@Lk1CHKyzq0bG!1v}Y z+@pMZqT)G{NRS3M@q0JH=9T>|*`|csTPGU2A+4uz;^N|>UMz*M2xv2G)=KTu$tO>r zhOa6Lff*n@z@5XM=JL|Lt3=jPs&+xpz#rJfSL>XQ#84CaO0UdHw{beAS=E_fna*DG zMNI4~5OsBPQ{HgarP^fK(#Bn`uxR`Y_yDE~?UP0emR*!1n@Tv7Al_&t?UgntC545B znbeMw9ilXN65qST!WIh%OM3bc`R>YM z3KRfY;hCUB(Do|@S@R!w^7!W=OHLlahf_M%;ZDNsal2RZTS6p@A=i8LaV>ymHDKL` z5?P1<=5nr~Fh)3Z7FWgN9dZ)KS;=jQaS*?IohF- zgMcDAismy7a+yU)7eTuuH=Tx*pon}b{6%x1SbzyoXya0pngLp%rc2823$;oh**#Cd zz9*xuun<&g&f5ZknO%QdvKk}}@o+;$H+JMM7IP8V5#%REs|pA2b8v`9cgrTdVXaPv zd|FA9zE;L8yDlsW?EP~*Lg*L%3i>Z(qU|7UPiE>w+QXq|{;5!wA!~+2L+^50+RyV8 zw#W+0S)VfM0L6agdfj3WBpGEJ36}dOAwZ9noulH~^pw<4xsO1PZ&Vn|I(JS%l0n7S zgS@2+7V4mo(KtVqp|&!%$=YcdK8=!)d-$U)gK9;HfggSeZ6t=H$N;B1t@hs}BIFb^ zIzd29(PQSTb+gzx&TS#A-!6+dtsf$k0i`Nz^Oy=I)Zg9fAc(-?<(ANucKp=ve#gR^ z3d=1PzmLgSU^>%X=n-pl6qYe2>sSb=gE6J%bH#6-mhlMViEVY-`(*6x9j+czDYxrg z;xxmdv7uC%0gz-j3~9%?8;_`Wis94zCp^_4MGtwmyW>N2h=-Q^M8rhHsUlTJ(p%r? zRh*B2TW3$e$~((eH)Xxjt!ZcQb|QcO#jlk1R++PB#j!6#9By2 zgA$&HMXb0UBpUEj&}|>H2BO*vPbN$Ik(i+15I#cQVpcC-eeB4?b^+U>y@srjjC&}2 zU=0c&=H3T_e>e$>CKbj*-RTj5?28$wVnq=e&0Ul}ZuBWs)U?)OI>={`9icfLLm~eW zz(<)Ro~Vsp1dzA0#TZ6j;N8>SE3bC9vO?2(mi%rlZS9cUlF*ifJUQI*-XsyZbd)~G)1`qi@BwR0*vIAVaZ}uBUsj+*ugwHs#)7JpyD+uGrPF3+OW3Rc=GH8mGxGj8a?3QZ zCg}9gtN!h~wC=ixJtg|;H{yIv9?AG`%l+&;MM!?hb3_dY7}Bp?8EBC$I-Go>5w%%O zW8u=-&_tN%w;ryWfW%Ko{>FW=n`_y^^z4%|9`0ba$C+nYmk`M`bWw1RL~PdJxM1B# z5@$q+HPCikS6J|66GdL%t`j`k9)kE*u1s?be=aLOh0qZ+(hH1ea;szD1hKD&<1zwK z)1ktT=Yoty1mGEXp1_xfi%_WKyzE3t#}A4gG;xogG?ReMR583y075H5CwC>0x=8AJ z|MW%hYsFnGV-tf)w9l}sczg1zqdCkM+6y{arCXma^}48m z=g~Y)!tch+4wZ;(M!S$Oh~JB6j|k}C+eX`JyNBTNP<7uOy;4y$nrNL zc3sxNr4O%8oVKIx>1?v#L#-fBHF|BDNw?7IDtT5nJ3=zRfJFBwqA9pN2i;116jd4u zeTbbJn4sstQx6OQenRv?PCxk`apon;n^#5Nlv|XCM#97}MAv5kJDO5wXJjUC&%1P)+^mTT_e=Kl(6_qeE3X^97Ct>N_2s7O|A$Pzbr@#u(l;@?YX*TIO4me5cG zGcaSP5wyWD-=1?7cvJR$O+vI{uX8R5FZqE_R4oAd7WVJx&FNSKJ@xE>6RDo;LEh zVM{H;SccH>^l>E5wz-LxQ`F*mdZcQQI!$AwUcGuEA-QI=N6Vd0G>-WgS8KK;qrs)= zsR+4P5dKb0DkQw@^SdTK1S?KWg#=iGp?V9Sgv&*K-xGm)UyjfNI7c1)wPeND#yHs7 zQE5@8ZOy9K4Mq8RMtf48PqE zUV0Cfd%cj|Mi=WlI*v{_{WMYGjP)vvJ+K#OBr_JA4T{wOKmfF>hkL7m*WQ7Kfdq8p zKsYvjM`$wi^!VU6)Ku)9~!D0FKu$xVT~q)VPvAwO@NL@ zkfwD=1@1C6@|y#oPyG>Ex_FroXpk=<4FqLW1OT?xT$N&Q6 zKqd>!`=G204Ol;NTd^MK4)(IZ3Ij-QkSEMwoYgsC?R|hSlPlb>T)s@K9gXIELVNph z$#D|1<6;zOIooTy#c3xeX8$Jl>=<|>wak14&LWgN`@AFIY6G7qOY|3$M1xBjN$r+; zgoGc#O>cptGR7Rfp?%iKpl~%};GBn7hv##|I(;gZwr}U<6vA_YE(M0}ja;u`#BQWW zp2Jsxqc>bpaYhPdYj58HSI(PA(tx5uc6==6VDM=PeO7NoL0&SbC{HREI6(f6N1Xu%bb*N~ zoPp=hkI{Bw;S&J&_V0hYcevf!UQE&q#nVnHyWQXNuu&pZj=OPO$T<)9KkLCJ;jytR zLFvTq=Uwg?i6qTP$T2^C`UH)%iS>=}8#9H0>nL=V;7N1zQPrx!OgmVRm!}=)SYt?i z3AzN+sC-im?5Mq{R+uSeS5Qzy=-o#C=KnVvqUEGtsh1U$At^3k2Q@e2;bhD#Co|5% zLe;yFczR$|Gz$A#0C6~yIGZ6~z>rQYd5c8Yj`|W5!%hgj9WOyqfpa8Ad6W4nDnZTm z^ae9#ojTwprFlX(wvn)9FZ${$ee=-6gChD5Y_QG);7*soI?BEE{wef672v!f^yoJs zS3$zj{`&QEIKO8(oBzK`l1^44Nc+EbaCEfHwkd<$=~erDzn9{>;N5;7BY9DM0>zGv zr>*{P#bs{Cby$<%b0&8KG62}g6N%yOL&!HBL6$*;sj7kg5`SqgfKW(L__NDiZ@R8`AO26T>jlxD!{d5C59ZE;MgoD8YX7A* z$FM7aTVmEN?POr+xLD7CvJI@j9BSkY9b#2Ta<{&&a zJl?%vBl!b5>T7|?fGnd9t{ey5@$r>__^chH&;*iDB3MASJZXmZ0yz5?PMg8?{VEN4 zG$24s^$Gj2M^h*%t#J7F2Fj9}dIlaajQrP;>o25I`z~%@I(T2KfH#H}C7=kKH<8nR zpdud`YS*hoaR9^J?(6sGGW;nrO{A0#za#Of3xarJ*@1vZHQNM>2r;%5B+*+$ZYU;h zqVFB=nFhb}c3m4J$Eqq5vO^ka^~rxJn<aW5#iM6ecU$0{rwsan4f1nYhn z7F^U28-@F<>iLA{wmV9&I*xw1YM#{sZWNYC1J?^bWhCp@3i*f90D)Bn1 zrHd45oiD(jBbU(xiBe(w<;xkfZQBgkYtw>fc^{1YR6W@3*WIvjpxoqRBtYZ5dC^yR zZLjq({Qy`eaTHvbydwT{A2U5^+-94Wp7-P4uy@;)6~YfExQ2u&i5@y72Sk=lxRR;dCp0-gvGAH&PZRz}rHucf_=?OqyGPx#2{n8dj0cRBhTlhz% z#yuoYM~?v-bh@Kz9a+8VfLfeRjnRfk#jI=l+G-WailQW`CQ=_UOLj-LlWd!?h|`i|XQJ&#)ls2!AIjQ?@@ zd~45mlEswTD2Evp2Y1Ml0(8-jxwE|t$X^<|F(%93ysH_>Nm5L<-&tk3U`>CH-&6S? z9ET$o6Y&E#6R6KSWHQP0Z_im;zCI>rqA-5HRmoS^&AohQ{2dWigkW}33{7*GPb$Q6 zNj-ED$y4wx?!+iBt>8QF>VIr8>G6F=$rf4q9s(2b>L}Hz?B*`%6fSinSq#3qStz$q zmgweeE-PBg7LvbRu&guTcRce)!*f)9)8GC{?Af zog!zcVRs-#`Uqg)2~Y48pv~C(xRji%WOV@k2hc5mS$AJ&4nMA4VX`W`KDnv2n^OAXmvWL_e9h( zyv;Idj0V-dIIXy*MZ#TJHfedS;t_FS)zj5=b<^A@N*0jKfj`p32XY@pn+R@%rH4a2 zl#(OT67ZiQ0&C-ajx#L7$7mS3Wf}=Cle9g~-k||SZa@Az{xHhWvDm!ihK~>Njhh1$ zUDm|7nMmc!m)}r|cz@+uZod4to52M{jcik>oPVe9<=FO=M^fr`PH33&rCMRARn?>@ zRmaT&DdDRjH~c5Yw055Gw5DdA*>nomK%8aK?PmTJVghbnhcXnES!LU?B6Kbp>u#$@ zD>(mIKX`kG-5Q6V0~KJQw9>QJ&ieo~{eZG>LCQ)wjP=)Q-cF;~NF-7@|4e!GN_GQM z;0U%zGYgB?e~y4Csw@{Z63ZO~7yd8hZfU-H#;e@}L4nxU<@^V?Zo0|?J_$ybMJXF`h~fL=5Wy~EFGo!X-l?CLI5~lXM^~F; zZDu116T9DyKlKmt{Y%ciM`A*yl$|od^v{wZ^q_NMu4HqN03|)@DqVTGgk1$lM4Q~R0q4% zvujrR-ha(=IJrW%RYC5&T*!YOD7$l7#jRZUIju)Qz6e_4SdG~@HwpJh<6w0w4+c}d zP6tRvft$TbWXw2{=vSGcXXNn@Nn%A^2R9D_A5domm(n=Un;ete>D%9mC0kN>KZw??Jqh-ByYg}VW`*W?2d1EMqCYW2uz@) zw)2abj6R%rScI$(85n7y141Bp4ou|7o*rnhAc}b(6hDEY7*9rNo-6E9h zVujBZ?{EytHIzD$kKv+h+%hTbs(-kV@jE(UpkMYwi;kdzL*oz%4k($0+y-c%3FR^@ zYD>?KOXxTWby5IyX(uZ{l(^pF<)8i|fev^H1m)xhI+O5$tmtcZs?BsvqN-PPkln5i=N>;px)#ckZ;B^PA!WLSyJX(=*FkHliD#VUiChS|9% zcoaLYf9IQyEb(apse}_aqj4$-S}Pn|#dq})yFs-0#)r6?w&3Qc&zQkS(cBivBXk{z z0Y-bGFINYMXa8%_exv6N)yDx2*$~n~?41uj^t0{Goi9LI0PCJis*RcbS1tR`ys5fT z%xQyL)h4j4mawecSTCci#2UtAEc$$jIgMMqXY>&-$wWHBGcuZ(-Xg<<@&#q!d%w(z zjgRN^N1FH+fPO%;h+-EqHG*01?~-F?aJteUh8_CZL5yjC;6iV5z8A3p#*sPD32(LZ z(~N7CxPy}J$Sb{(xtvATcY`p$U)RPSRL_@3K1t52MJtKh6PZ(nbuLfGx-vx}@42M&CI0U zTB!J`X~yKM1o<@BbEe4B(sBqze$B!@XZ~kr7{kHmNWbcVNpMcT)nO>A5Pz^J&P!>>!xlwgeaNci>L>AR2a zxnT$uQ2d*By~YqnKs zvFHf1E{=IPhRfJmmf)@5so&6O=&-ciwZoG8eNdYgRNj7G_`b~K->JqevF-z4@%E@#6 zs@Q;M=t{_R1iBp7vM1_qPKvv*}`H5+rI2+fU+-k zCM1(1;lW}15-AsDW1B!-(?)~iJ4T#y=(j5;<<2S;d#p6&>L=U)58m)^! z9Cqj-O#|fkHE_sqZi`}Dh2%B|-1X(BWoGWTv+Ki(BI^KiMQ~@3j~sw_70O+e{_V-Kd%)TzK4Kj{E4?A}p5~vaE`Eqe~m(9DW{o z<2ce1LYEM=N$TT5Eco8YVtxdTz|C{C3PoN5^k0{ULz ze^b{OGZB)r=R|^&9qQhz*Y*6yM+{F9A`-^6$N~fq)))_=(U1SdZgxJxM+v4}FZvW> zOlBE6GkkI2FCiBogg|JeaX>M1B=HNDnOQAVNZPB7(#Ogwj!bX1(~1Vt>RNEL+ehe0a(FyX0I%}vZ2b`Ija{Q#BJMjf;xFF=ZM7VC z(q4IwwpWPd*x_O`e_OZP*2Q99{S-ZrLj1lt{8x#`XX6mOS6>Rh6rhtzbGPr8iRwHh zSRpd0R{cG#cQ)li!^)tN^O!IKBTyoxTzH#g|LfQeC^D&unCqe!$LEaZ&U%D-EhZ#3FKofV z>Zmt(fh5P)268Gi@78Pk`YHT>&@rm%%VbzCCJ1q;mip#)+=q)eNez)8Ar5`+s$D4K zu55w@ilR&NzQ-Dv z)ZZZw+Uj~$;k`r~|3{yUug2@YaHIw-w$!{Qh6z=Ut^d zoP|=D78ZkHP~e@;m4H8=$PY#aYqlYdA{hKdqmqMf2d~t$^%p9ATA}m6BdT29k^-f2q76hsospWVf@8kzJIWpdU13Y~>pSjO zhqb7F?mJu2WBAd>JiY>ypJa$Q`%|Jp3*Y8(9i_6x;&Xik$U+P}wHm9&nH)J7?M6dsmpaww4@_O!8F-Qb^|_))P^7lSCe2S#AFO ztvh|SG}|^AjQf5wt`nB~sH||*K9FS<_Z4e69trKAvgTQ~=@^zBHdyo!Zo$SrCHaW$ zt#qH3l;#*kyI;rJ+u5aFzFbyWsRyVY$+FmnWkS$)7v>>R7dvXrNlHu~Zdm9L-=~_d z#P?fy$WfR=9kb>dKeL?wtNHWjNm}m%#*R15k7g8}^cl_`U*w{ERQ34=+AaOB43Ctz rz#tFZDnSC8j6x3}6>Gfyum57E#bL>9&!Uj?;bpXTqd_L)$AJFsetState(Yinf, pt_arr, 2); + +// // Get conservative quantities +// double rho_i[5]; // memory for densities +// mix->densities(rho_i); +// double rho = mix->density(); +// double rhoe = mix->mixtureEnergyMass() * rho; +// double Ustate[6] = {rho_i[0],rho_i[1],rho_i[2],rho_i[3],rho_i[4],rhoe}; + +// stateToConsVars(Ucons, uv_inflow, Ustate, uinf, nspecies); +// nondimensionalizeConsVars(Ucons, uinf, nspecies, 1); +// } + +// void uoutflow(double* Ucons, double* param, double* uinf, Mutation::Mixture *mix) +// { +// // Subsonic outflow: use rho_i, rhou from solution +// // given Pout, solve for energy rhoE +// int nspecies = 5; +// // scaling information +// double rho_inf = uinf[0]; +// double uv_inf = uinf[1]; +// double rhoe_inf = uinf[2]; +// double RU = Mutation::RU; + +// double Ustate[6]; +// double rho_i[5]; // If kept around, these arrays should be initialized as +// // some member of temp (maybe tmpapp array so it's separate from tmpg?) +// double rho = 0.0; + +// dimensionalizeConsVars(Ucons, uinf, nspecies, 1); +// conservativeToState(Ucons, Ustate, uinf, nspecies); + +// // Pressure outlet +// double P_out = param[3*nspecies+6]; + +// // Use pressure and rho from solution to get Temperature +// double denom = 0.0; +// for (int i = 0; i < nspecies; i++) +// { +// rho_i[i] = Ustate[i]; +// rho = rho + rho_i[i]; +// // Ucons[i] = rho_i[i]; +// denom = denom + RU * Ustate[i]/mix->speciesMw(i); +// } +// double T_out = P_out / denom; +// double u_out = Ucons[nspecies]/rho; +// // double u_out = 370.0; +// // printf("Tout: %f\n", T_out); +// // Set state with desnities and temperature +// mix->setState(rho_i, &T_out, 1); + +// // Update energy +// double rhoe = mix->mixtureEnergyMass() * rho; +// Ustate[nspecies] = rhoe; + +// // printf("rhou before update: %f\n", Ucons[5]); +// stateToConsVars(Ucons, u_out, Ustate, uinf, nspecies); +// // printf("rhou after update: %f\n", Ucons[5]); +// nondimensionalizeConsVars(Ucons, uinf, nspecies, 1); + +// // Here I can check that Ustate is the same mix.densities? +// // and that rho u doesn't change ? ? ? +// // double rhotest[5]; +// // mix->densities(rhotest); +// // for (int i = 0; i< nspecies; i++) +// // { +// // printf("rho mix %i: %f\n", i, rhotest[i]/rho_inf); +// // printf("rho state %i: %f\n", i, Ucons[i]); +// // } +// } + +void uinflow(double* Ucons, double p, double T_inf, double uv_inflow, double* Yinf, double* scales, Mutation::Mixture *mix) +{ // Subsonic inflow: use pressure from solution + // and given Tinf, Yinf, uinf to solve for rho, rhou, rhoE + int nspecies = 5; + // Scaling information + double rho_inf = scales[0]; + double uv_inf = scales[1]; + double rhoe_inf = scales[2]; + + // Known values from prescribed inflow + // double T_inf = datainflow[0]; + // double Yinf[5]; + // double uv_inflow = datainflow[1]; //inflow; here same as scaling but not necessarily true + // for (int ispecies = 0; ispeciessetState(Yinf, pt_arr, 2); + + // Get conservative quantities + double rho_i[5]; // memory for densities + mix->densities(rho_i); + double rho = mix->density(); + double rhoe = mix->mixtureEnergyMass() * rho; + double Ustate[6] = {rho_i[0],rho_i[1],rho_i[2],rho_i[3],rho_i[4],rhoe}; + + stateToConsVars(Ucons, uv_inflow, Ustate, scales, nspecies); + nondimensionalizeConsVars(Ucons, scales, nspecies, 1); +} + +void uoutflow(double* Ucons, double outP, double* scales, Mutation::Mixture *mix) +{ + // Subsonic outflow: use rho_i, rhou from solution + // given Pout, solve for energy rhoE + int nspecies = 5; + // scaling information + double rho_inf = scales[0]; + double uv_inf = scales[1]; + double rhoe_inf = scales[2]; + double RU = Mutation::RU; + + double Ustate[6]; + double rho_i[5]; // If kept around, these arrays should be initialized as + // some member of temp (maybe tmpapp array so it's separate from tmpg?) + double rho = 0.0; + + dimensionalizeConsVars(Ucons, scales, nspecies, 1); + conservativeToState(Ucons, Ustate, scales, nspecies); + + // Pressure outlet + double P_out = outP; + + // Use pressure and rho from solution to get Temperature + double denom = 0.0; + for (int i = 0; i < nspecies; i++) + { + rho_i[i] = Ustate[i]; + rho = rho + rho_i[i]; + // Ucons[i] = rho_i[i]; + denom = denom + RU * Ustate[i]/mix->speciesMw(i); + } + double T_out = P_out / denom; + // double T_out = 300.0; + // double u_out = Ucons[nspecies]/rho; + double u_out = 0.0; + // printf("u_out: %f\n", u_out); + // double u_out = 370.0; + // printf("Tout: %f\n", T_out); + // Set state with desnities and temperature + mix->setState(rho_i, &T_out, 1); + + // Update energy + double rhoe = mix->mixtureEnergyMass() * rho; + Ustate[nspecies] = rhoe; + + // printf("rhou before update: %f\n", Ucons[5]); + stateToConsVars(Ucons, u_out, Ustate, scales, nspecies); + // printf("rhou after update: %f\n", Ucons[5]); + nondimensionalizeConsVars(Ucons, scales, nspecies, 1); +} + +// void getdTdU(double* dTdU, double* Ucons, double* Uwork, Mutation::Mixture *mix, int nspecies, int ndim) +// { +// // Uwork is a temporary array for storing things +// double rho = 0.0; +// for (int i=0; imixtureEnergyMass() // OKAY SHOULD I DO THIS ALL IN DIMENSIONAL OR NONDIM COORDS...what did I do last time? +// double rhou = Ucons[nspecies]; +// double rhoE = Ucons[nspecies+1]; + +// } + +// void getdPdU() +// { + +// } + +// double getdTdr(double* dTdr_i, double* Ucons, Mutation::Mixture *mix, int nspecies, int ndim) +// { +// double rho = 0.0; +// for (int i=0; imixtureEquilibriumCvMass()); +// // return -e/denom; +// } + +// double getdTdr(Mutation::Mixture *mix) +// { +// // double e = mixture->mixtureEnergyMass(); +// // double rho = mixture->density(); +// // double denom = (rho*mixture->mixtureEquilibriumCvMass()); +// // return -e/denom; +// } + +// double dTdru(double* rho_i, double* rhou) + +// double getdTdre(double rho, Mutation::Mixture *mix) +// { +// // double Cv = mixture->mixtureEquilibriumCvMass(); +// // double denom = rho * Cv; +// // return 1.0/denom; +// } + +// double getdTdre(Mutation::Mixture *mix) +// { +// // double Cv = mixture->mixtureEquilibriumCvMass(); +// // double rho = mixture->density(); +// // double denom = rho * Cv; +// // return 1.0/denom; +// } + +// double getP() +// { + +// } + +// double getKineticSource() +// { + +// } \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/app/opuApp_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuApp_MPP.cpp new file mode 100644 index 00000000..730e9a6e --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuApp_MPP.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dup, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne, mix); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +#endif + +#endif + diff --git a/Applications/Hypersonics/shocktests/app/opuAvfield_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP.cpp new file mode 100644 index 00000000..e065d7ea --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP.cpp @@ -0,0 +1,137 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + // std::cout << "begin avfield" << std::endl; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + T uinf1 = mix->P()/rhoe_scale; // pressure + T uinf2 = mix->mixtureFrozenGamma(); // gamma + + T t2 = uinf2*2.0; + T t3 = uinf2+1.0; + T t4 = 1.0/3.141592653589793; + T t5 = 1.0/param15; + T t8 = udg8+udg9+udg10+udg11+udg12; + T t9 = param17*1.0E+3; + T t10 = udg1*1.0E+3; + T t11 = udg2*1.0E+3; + T t12 = udg3*1.0E+3; + T t13 = udg4*1.0E+3; + T t14 = udg5*1.0E+3; + T t6 = t2-2.0; + T t7 = 1.0/t3; + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = t4*t15; + T t21 = t4*t16; + T t22 = t4*t17; + T t23 = t4*t18; + T t24 = t4*t19; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25*udg1; + T t31 = t26*udg2; + T t32 = t27*udg3; + T t33 = t28*udg4; + T t34 = t29*udg5; + T t35 = t30+t31+t32+t33+t34+1.591548900402584E-3; + T t36 = 1.0/t35; + T t37 = t36*udg7; + T t38 = t36*uinf1; + T t41 = t8*t36*udg6; + T t39 = t37*1.0E+3; + T t40 = t38*1.0E+3; + T t42 = -t41; + T t44 = -t36*(t41-udg13); + T t45 = t37+t38-1.0E-4; + T t46 = t36*(t41-udg13)*-1.0E+3; + T t43 = t42+udg13; + T t47 = t39+t40-1.0/1.0E+1; + T t49 = t44-1.0E+4; + T t51 = t46-1.0E+7; + T t48 = atan(t47); + T t52 = atan(t51); + T t50 = t4*t48; + T t54 = t4*t52; + T t53 = t50+1.0/2.0; + T t55 = t54-1.0/2.0; + T t56 = t45*t53; + T t57 = -t55*(t36*(t41-udg13)+1.0E+4); + T t58 = t55*(t36*(t41-udg13)+1.0E+4); + T t59 = t58*-1.0E+3; + T t60 = t56+4.183097800805168E-4; + T t63 = t57-1.999999968169022E+4; + T t61 = t6*t7*t60; + T t64 = t59-1.999999968169022E+7; + T t62 = 1.0/sqrt(t61); + T t65 = atan(t64); + T t66 = t4*t65; + T t67 = t66+1.0/2.0; + T t68 = -t67*(t58+1.999999968169022E+4); + T t69 = t58+t68+1.0E+4; + T t70 = odg2*t5*t62*t69; + T t71 = -t70; + T t73 = t70*1.0E+3; + T t72 = param17+t71; + T t74 = -t73; + T t75 = t9+t74; + T t76 = atan(t75); + T t77 = t4*t76; + T t78 = t77-1.0/2.0; + T t79 = t72*t78; + f[j+npe*0+npe*nce*k] = odg2*param16*t5*(fabs(udg6)/fabs(t35)+sqrt(fabs(t6*t60)/fabs(t3)))*(t79-(t4*atan(param18*-1.0E+3+t79*1.0E+3+3.183097800805168E-1)+1.0/2.0)*(-param18+t79+3.183097800805168E-4)); + } + // std::cout << "end avfield" << std::endl; +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuAvfield_old_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuAvfield_old_MPP.cpp new file mode 100644 index 00000000..b634f7f3 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_old_MPP.cpp @@ -0,0 +1,140 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + // std::cout << "begin avfield" << std::endl; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + T uinf1 = mix->P()/rhoe_scale; // pressure + T uinf2 = mix->mixtureFrozenGamma(); // gamma + + T t2 = uinf2*2.0; + T t3 = uinf2+1.0; + T t4 = uinf2*uinf2; + T t5 = 1.0/3.141592653589793; + T t6 = 1.0/param15; + T t10 = udg8+udg9+udg10+udg11+udg12; + T t11 = param17*1.0E+3; + T t12 = udg1*1.0E+3; + T t13 = udg2*1.0E+3; + T t14 = udg3*1.0E+3; + T t15 = udg4*1.0E+3; + T t16 = udg5*1.0E+3; + T t7 = t2-2.0; + T t8 = 1.0/t3; + T t9 = t4-1.0; + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = 1.0/sqrt(t9); + T t23 = t5*t17; + T t24 = t5*t18; + T t25 = t5*t19; + T t26 = t5*t20; + T t27 = t5*t21; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28*udg1; + T t34 = t29*udg2; + T t35 = t30*udg3; + T t36 = t31*udg4; + T t37 = t32*udg5; + T t38 = t33+t34+t35+t36+t37+1.591548900402584E-3; + T t39 = 1.0/t38; + T t40 = t39*udg7; + T t41 = t39*uinf1; + T t44 = t10*t39*udg6; + T t42 = t40*1.0E+3; + T t43 = t41*1.0E+3; + T t45 = -t44; + T t47 = -t39*(t44-udg13); + T t48 = t40+t41-1.0E-4; + T t49 = t39*(t44-udg13)*-1.0E+3; + T t46 = t45+udg13; + T t50 = t42+t43-1.0/1.0E+1; + T t52 = t47-1.0E+4; + T t54 = t49-1.0E+7; + T t51 = atan(t50); + T t55 = atan(t54); + T t53 = t5*t51; + T t57 = t5*t55; + T t56 = t53+1.0/2.0; + T t58 = t57-1.0/2.0; + T t59 = t48*t56; + T t60 = -t58*(t39*(t44-udg13)+1.0E+4); + T t61 = t58*(t39*(t44-udg13)+1.0E+4); + T t62 = t61*-1.0E+3; + T t63 = t59+4.183097800805168E-4; + T t66 = t60-1.999999968169022E+4; + T t64 = t7*t8*t63; + T t67 = t62-1.999999968169022E+7; + T t65 = 1.0/sqrt(t64); + T t68 = atan(t67); + T t69 = t5*t68; + T t70 = t69+1.0/2.0; + T t71 = -t70*(t61+1.999999968169022E+4); + T t72 = t61+t71+1.0E+4; + T t73 = odg2*t6*t65*t72; + T t74 = -t73; + T t76 = t73*1.0E+3; + T t75 = param17+t74; + T t77 = -t76; + T t78 = t11+t77; + T t79 = atan(t78); + T t80 = t5*t79; + T t81 = t80-1.0/2.0; + T t82 = t75*t81; + f[j+npe*0+npe*nce*k] = odg2*param16*t6*(t39*udg6+1.0/t65)*(t82-(t5*atan(t82*1.0E+3-param18*t22*1.0E+3+3.183097800805168E-1)+1.0/2.0)*(t82-param18*t22+3.183097800805168E-4)); + } + // std::cout << "end avfield" << std::endl; +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp new file mode 100644 index 00000000..efd881ae --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp @@ -0,0 +1,204 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + T uinf1 = mix->P()/rhoe_scale; + + T uhg1 = uhg[0*ng+i]; + T uhg2 = uhg[1*ng+i]; + T uhg3 = uhg[2*ng+i]; + T uhg4 = uhg[3*ng+i]; + T uhg5 = uhg[4*ng+i]; + T uhg6 = uhg[5*ng+i]; + T uhg7 = uhg[6*ng+i]; + T odg1 = odg[0*ng+i]; + T nlg1 = nlg[0*ng+i]; + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+3; + T t4 = udg2*1.0E+3; + T t5 = udg3*1.0E+3; + T t6 = udg4*1.0E+3; + T t7 = udg5*1.0E+3; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + T t29 = 1.0/t28; + f[0*ng+i] = nlg1*(odg1*udg8*(t18+(t2*t3)/((udg1*udg1)*1.0E+6+1.0))+t29*udg6*(t23+3.183097800805168E-4))+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(odg1*udg9*(t19+(t2*t4)/((udg2*udg2)*1.0E+6+1.0))+t29*udg6*(t24+3.183097800805168E-4))+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(odg1*udg10*(t20+(t2*t5)/((udg3*udg3)*1.0E+6+1.0))+t29*udg6*(t25+3.183097800805168E-4))+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(odg1*udg11*(t21+(t2*t6)/((udg4*udg4)*1.0E+6+1.0))+t29*udg6*(t26+3.183097800805168E-4))+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(odg1*udg12*(t22+(t2*t7)/((udg5*udg5)*1.0E+6+1.0))+t29*udg6*(t27+3.183097800805168E-4))+tau5*(udg5-uhg5); + f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg13+t29*(udg6*udg6)); + f[6*ng+i] = nlg1*(odg1*udg14+udg6*(t29*udg7+t29*uinf1))+tau7*(udg7-uhg7); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + T uinf1 = mix->P()/rhoe_scale; + + T uhg1 = uhg[0*ng+i]; + T uhg2 = uhg[1*ng+i]; + T uhg3 = uhg[2*ng+i]; + T uhg4 = uhg[3*ng+i]; + T uhg5 = uhg[4*ng+i]; + T uhg6 = uhg[5*ng+i]; + T uhg7 = uhg[6*ng+i]; + T odg1 = odg[0*ng+i]; + T nlg1 = nlg[0*ng+i]; + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+3; + T t4 = udg2*1.0E+3; + T t5 = udg3*1.0E+3; + T t6 = udg4*1.0E+3; + T t7 = udg5*1.0E+3; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + T t29 = 1.0/t28; + f[0*ng+i] = nlg1*(odg1*udg8*(t18+(t2*t3)/((udg1*udg1)*1.0E+6+1.0))+t29*udg6*(t23+3.183097800805168E-4))+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(odg1*udg9*(t19+(t2*t4)/((udg2*udg2)*1.0E+6+1.0))+t29*udg6*(t24+3.183097800805168E-4))+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(odg1*udg10*(t20+(t2*t5)/((udg3*udg3)*1.0E+6+1.0))+t29*udg6*(t25+3.183097800805168E-4))+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(odg1*udg11*(t21+(t2*t6)/((udg4*udg4)*1.0E+6+1.0))+t29*udg6*(t26+3.183097800805168E-4))+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(odg1*udg12*(t22+(t2*t7)/((udg5*udg5)*1.0E+6+1.0))+t29*udg6*(t27+3.183097800805168E-4))+tau5*(udg5-uhg5); + f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg13+t29*(udg6*udg6)); + f[6*ng+i] = nlg1*(odg1*udg14+udg6*(t29*udg7+t29*uinf1))+tau7*(udg7-uhg7); + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // std::cout << "begin fbou" << std::endl; + + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + // std::cout << "end fboui" << std::endl; + +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp new file mode 100644 index 00000000..61496dad --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp @@ -0,0 +1,86 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // std::cout << "begin flux" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + T uinf1 = mix->P()/rhoe_scale; + + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+3; + T t4 = udg2*1.0E+3; + T t5 = udg3*1.0E+3; + T t6 = udg4*1.0E+3; + T t7 = udg5*1.0E+3; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + T t29 = 1.0/t28; + f[0*ng+i] = odg1*udg8*(t18+(t2*t3)/((udg1*udg1)*1.0E+6+1.0))+t29*udg6*(t23+3.183097800805168E-4); + f[1*ng+i] = odg1*udg9*(t19+(t2*t4)/((udg2*udg2)*1.0E+6+1.0))+t29*udg6*(t24+3.183097800805168E-4); + f[2*ng+i] = odg1*udg10*(t20+(t2*t5)/((udg3*udg3)*1.0E+6+1.0))+t29*udg6*(t25+3.183097800805168E-4); + f[3*ng+i] = odg1*udg11*(t21+(t2*t6)/((udg4*udg4)*1.0E+6+1.0))+t29*udg6*(t26+3.183097800805168E-4); + f[4*ng+i] = odg1*udg12*(t22+(t2*t7)/((udg5*udg5)*1.0E+6+1.0))+t29*udg6*(t27+3.183097800805168E-4); + f[5*ng+i] = uinf1+odg1*udg13+t29*(udg6*udg6); + f[6*ng+i] = odg1*udg14+udg6*(t29*udg7+t29*uinf1); + } + // std::cout << "end flux" << std::endl; + +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuInitu_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuInitu_MPP.cpp new file mode 100644 index 00000000..d94b7614 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuInitu_MPP.cpp @@ -0,0 +1,51 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + // std::cout << "begin output" << std::endl; + for (int i = 0; i setState(rhovec, &rhoe, 0); + T uinf1 = mix->P(); + + f[j+npe*0+npe*nce*k] = uinf1; + f[j+npe*1+npe*nce*k] = odg1; + } + // std::cout << "end output" << std::endl; +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp new file mode 100644 index 00000000..6aabd380 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp @@ -0,0 +1,50 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // std::cout << "begin source" << std::endl; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + double wdot[5]; + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + } + // std::cout << "end source " << std::endl; +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuUbou_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuUbou_MPP.cpp new file mode 100644 index 00000000..8e3f171d --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuUbou_MPP.cpp @@ -0,0 +1,90 @@ +template void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/getStates.py b/Applications/Hypersonics/shocktests/getStates.py new file mode 100644 index 00000000..85edcfe6 --- /dev/null +++ b/Applications/Hypersonics/shocktests/getStates.py @@ -0,0 +1,86 @@ +import sys +import os +mppPyDir = os.environ.get('MPP_LOCALPY') +sys.path.append(mppPyDir) +import _mutationpp as mpp +import numpy as np + + +def print_equil_vals(mix, T, P): + mix.equilibrate(T, P) + rhovec = mix.densities() + rho = np.sum(rhovec) + e = mix.mixtureEnergyMass() + rhoE = rho * e + 0.0 + + print("To check") + print("(T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + print("Initial conditions (dimensional): ") + print("(rho_i, rhou, rhoE) = (" + str(rhovec) + " 0.0 " + str(rhoE) + ")") + +def init_mixture(): + opt = mpp.MixtureOptions("air_5") + opt.setStateModel("ChemNonEq1T") + opt.setViscosityAlgorithm("Gupta-Yos") + + mix = mpp.Mixture(opt) + return mix + +def test_range(): + TL = 300.0 + PL = 1.0e4 + + opt = mpp.MixtureOptions("air_5") + opt.setStateModel("ChemNonEq1T") + opt.setViscosityAlgorithm("Gupta-Yos") + opt.setThermodynamicDatabase("RRHO") + + mix = mpp.Mixture(opt) + + for i in range(0,1000): + TL += i + mix.equilibrate(TL, PL) + print(mix.mixtureEnergyMass()) + + + + +if __name__=="__main__": + TL = 9000.0 + 298.17 + PL = 1.95256e5 + + TR = 300.0 + 298.17 + PR = 1.0e4 + + opt = mpp.MixtureOptions("air_5") + opt.setStateModel("ChemNonEq1T") + opt.setViscosityAlgorithm("Gupta-Yos") + opt.setTeh + + mix = mpp.Mixture(opt) + + print("=============") + print(" LEFT STATE ") + print("=============") + print_equil_vals(mix, TL, PL) + + print("=============") + print(" RIGHT STATE ") + print("=============") + print_equil_vals(mix, TR, PR) + + print() + print("PRINT SCALING TERMS using right side of domain") + print("Just to make sure once again: (T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + rho_inf = mix.density() + u_inf = mix.frozenSoundSpeed() + print("rho_inf = " + str(rho_inf)) + print("u_inf = " + str(u_inf)) + print("rhoE_inf = " + str(rho_inf * u_inf * u_inf)) + + cp = mix.mixtureFrozenCpMass() + gam = mix.mixtureFrozenGamma() + print("cp = " + str(cp)) + print("gam = " + str(gam)) + + diff --git a/Applications/Hypersonics/shocktests/htr_out.m b/Applications/Hypersonics/shocktests/htr_out.m new file mode 100644 index 00000000..9966b48a --- /dev/null +++ b/Applications/Hypersonics/shocktests/htr_out.m @@ -0,0 +1,48 @@ +rhoTrue = [0.10899 0.33511 +0.24852 0.33339 +0.28227 0.32315 +0.2985 0.31068 +0.30917 0.29335 +0.32284 0.27845 +0.34035 0.2635 +0.36042 0.23624 +0.40956 0.23564 +0.51897 0.23675 +0.58838 4.25358 +0.60205 4.2485 +0.61051 0.98956 +0.80709 0.98714]; + +uTrue = [0.11036 -0.0042 +0.2488 0.00173 +0.28334 0.20722 +0.29429 0.47531 +0.30457 0.75149 +0.31388 1.04617 +0.32456 1.35933 +0.33696 1.68057 +0.34836 2.01569 +0.36015 2.38087 +0.41017 2.53308 +0.52017 2.5369 +0.58752 2.53063 +0.60106 2.53053 +0.60927 0.00604 +0.80424 0.0104]; + +pTrue = [0.11079 19.4942 +0.24817 19.5081 +0.28393 18.8441 +0.29259 17.9949 +0.30259 17.1456 +0.31396 16.2963 +0.32532 15.4315 +0.336 14.5823 +0.34737 13.7638 +0.36076 12.8837 +0.40944 12.5285 +0.5191 12.5285 +0.58679 12.5285 +0.60236 12.5285 +0.60988 1.0245 +0.80552 1.0554]; \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/pdeapp.m b/Applications/Hypersonics/shocktests/pdeapp.m new file mode 100644 index 00000000..39f481ee --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdeapp.m @@ -0,0 +1,158 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 2; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +% tfinal = 0.000005; % 1 with 1e-4 doesn't work super well +tfinal = 0.0324; +% nt = 3240/10; +% dt = tfinal/nt; +% dt = 10*1e-5; +nt = 500; +dt = tfinal / nt; +% pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; +pde.dt = [dt*ones(1,nt)]; +pde.saveSolFreq = ceil(nt/100); +pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +% pde.timestepOffset = 2700; + +% Solver params +pde.linearsolveriter = 40; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-5; +pde.matvectol = 1e-7; +pde.NLiter = 5; +pde.RBdim = 5; +pde.NLtol = 1e-8; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +nspecies = 5; + +%% Stabilization and mesh +ndim = 1; +pde.tau = [5, 5, 5, 5, 5, 5, 5]; +nDiv = 400; +[mesh.p,mesh.t] = linemesh(nDiv-1); +a = 0; b = 1.0; +mesh.p = a + (b-a)*mesh.p; + +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary + +%% Initial conditions and parameters +% TL=9000 +Xi_inflow = [0,0,0,0,0]; +u_inflow = 0.0; +T_inflow = 9000.0; +p_outflow = 1e4; +pde.physicsparam = [ + 2.79122095e-02 % . + 8.94162529e-03 % . + 3.49305942e-05 % rho_i_L + 1.58251700e-03 % . + 5.01765831e-07 % . + 0.0 % rhou_L + 1425938.1573890178 % rhoE_L + 8.83171348e-81 % . + 4.62782812e-42 % . + 3.11978853e-17 % rho_i_R + 8.87231621e-02 % . + 2.69399686e-02 % . + 0.0 % rhou_R + -9783.724551855581 % rhoE_R + pde.porder % p for h/p scaling + 1.5 % bulk viscosity scaling parameter + 0.02 % cutoff dilitation + 2.5 % maximum dilitation 18 + Xi_inflow(:) % 19 20 21 22 23 + u_inflow % 24 + T_inflow % 25 + p_outflow % 26 + ]; +% T = 4000; +% pde.physicsparam = [ +% 8.79041126e-05 +% 2.18935322e-02 +% 8.84111098e-03 +% 1.10501923e-01 +% 8.22504485e-03 +% 0.0 % rhou_L +% 863520.4456544879 % rhoE_L +% 8.83171348e-81 % . +% 4.62782812e-42 % . +% 3.11978853e-17 % rho_i_R +% 8.87231621e-02 % . +% 2.69399686e-02 % . +% 0.0 % rhou_R +% -9783.724551855581 % rhoE_R +% pde.porder % p for h/p scaling +% 1.5 % bulk viscosity scaling parameter +% 0.02 % cutoff dilitation +% 2.5 % maximum dilitation +% Xi_inflow(:) % 19 20 21 22 23 +% u_inflow % 24 +% T_inflow % 25 +% p_outflow % 26 +% ]; + + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = 0.11566313067881752; % rho_inf +pde.externalparam(2) = 347.764810747843; % u_inf +pde.externalparam(3) = 13988.341078772399; % rhoE_inf + +% mesh size +mesh.dgnodes = createnodes(mesh.p, mesh.t, pde.porder); +mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = (1.0 / (2*nDiv)) * ones(size(mesh.dgnodes,1), 1, size(mesh.dgnodes,3)); + +pde.AV = 1; +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +eval('!cp opuApp_MPP.cpp opuApp.cpp'); +eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); %X manually switch these +eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); %X +eval('!cp opuSource_MPP.cpp opuSource.cpp'); %X +eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); %X +eval('!cp opuAvfield_MPP.cpp opuAvfield.cpp') %X +eval('!cp opuInitu_MPP.cpp opuInitu.cpp') %X +% eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +runstr = runcode(pde); diff --git a/Applications/Hypersonics/shocktests/pdeapp_euler.m b/Applications/Hypersonics/shocktests/pdeapp_euler.m new file mode 100644 index 00000000..28f03996 --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdeapp_euler.m @@ -0,0 +1,147 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_euler"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 2; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +% tfinal = 0.000005; % 1 with 1e-4 doesn't work super well +tfinal = 0.324; +% nt = 3240/10; +% dt = tfinal/nt; +% dt = 10*1e-5; +nt = 1000; +dt = tfinal / nt; +% pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; +pde.dt = [dt*ones(1,nt)]; +% pde.saveSolFreq = ceil(nt/100); +pde.saveSolFreq = 1; +pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +% pde.timestepOffset = 2700; + +% Solver params +pde.linearsolveriter = 40; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-5; +pde.matvectol = 1e-7; +pde.NLiter = 5; +pde.RBdim = 5; +pde.NLtol = 1e-8; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +nspecies = 5; + +%% Stabilization and mesh +ndim = 1; +pde.tau = [5, 5, 5]; +nDiv = 400; +[mesh.p,mesh.t] = linemesh(nDiv-1); +a = 0; b = 1.0; +mesh.p = a + (b-a)*mesh.p; + +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary + +%% Initial conditions and parameters +% TL=9000 +Xi_inflow = [0,0,0,0,0]; +u_inflow = 0.0; +T_inflow = 9000.0; +p_outflow = 1e4; +pde.physicsparam = [ + 0.33 + 0.0 % rhou_L + 48.75 % rhoE_L + 1.0 % rhou_R + 0.0 + 2.5 % rhoE_R + pde.porder % p for h/p scaling + 1.5 % bulk viscosity scaling parameter + 0.02 % cutoff dilitation + 2.5 % maximum dilitation 18 + ]; +% T = 4000; +% pde.physicsparam = [ +% 8.79041126e-05 +% 2.18935322e-02 +% 8.84111098e-03 +% 1.10501923e-01 +% 8.22504485e-03 +% 0.0 % rhou_L +% 863520.4456544879 % rhoE_L +% 8.83171348e-81 % . +% 4.62782812e-42 % . +% 3.11978853e-17 % rho_i_R +% 8.87231621e-02 % . +% 2.69399686e-02 % . +% 0.0 % rhou_R +% -9783.724551855581 % rhoE_R +% pde.porder % p for h/p scaling +% 1.5 % bulk viscosity scaling parameter +% 0.02 % cutoff dilitation +% 2.5 % maximum dilitation +% Xi_inflow(:) % 19 20 21 22 23 +% u_inflow % 24 +% T_inflow % 25 +% p_outflow % 26 +% ]; + + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = 1.0; % rho_inf +pde.externalparam(2) = 1.0; % u_inf +pde.externalparam(3) = 1.0; % rhoE_inf + +% mesh size +mesh.dgnodes = createnodes(mesh.p, mesh.t, pde.porder); +mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = (1.0 / (2*nDiv)) * ones(size(mesh.dgnodes,1), 1, size(mesh.dgnodes,3)); + +pde.AV = 1; +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +% eval('!cp opuApp_MPP.cpp opuApp.cpp'); +% eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); %X manually switch these +% eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); %X +% eval('!cp opuSource_MPP.cpp opuSource.cpp'); %X +% eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); %X +% eval('!cp opuAvfield_MPP.cpp opuAvfield.cpp') %X +% eval('!cp opuInitu_MPP.cpp opuInitu.cpp') %X +% eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +runstr = runcode(pde); diff --git a/Applications/Hypersonics/shocktests/pdemodel.m b/Applications/Hypersonics/shocktests/pdemodel.m new file mode 100644 index 00000000..d222eae8 --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdemodel.m @@ -0,0 +1,343 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 1; + f = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function avField = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); + gam1 = gam - 1; + + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e3; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(2); + + % Get base variables + rvec = u(1:nspecies); + ru = u(nspecies+1); + % rv = udg(3); + rE = u(nspecies+nd+1); + + rx = sum(-q(1:nspecies)); + rux = -q(nspecies+1); + + % Regularization + rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here + + % Simple derived working quantities + r = sum(rvec); + r1 = 1./r; + uv = ru.*r1; + E = rE * r1; %energy + H = E + p*r1; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + ux = (rux - rx.*uv).*r1; + div_v = (ux); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + + % % Dilatation Sensor sb + sb = - (hm./porder) .* (div_v./c_star); + sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be +% sb = log(1 + exp(alpha * (sb - 0.01)))/alpha; + % Artificial Bulk viscosity + avb = (kb.*hm./(porder)) .* (abs(uv) + abs(c_star)) .* sb; + + % Assign artificial viscosities + avField(1) = avb; % bulk +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + m = sym(ones(nspecies + 2, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 1; + % % Clipper utilities + % alpha = 1.0e3; + % rmin = 0.0; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + % fv = fluxviscous(u, q, w, v, x, t, mu, eta) + fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv; +end + +function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) + rmin = 0.0; + alpha = 1.0e3; + eps_av = v(1); +% hm = v(2); + %TODO: CHECK GAS OUTPUTS TO INPUTS USED BY HTR GROUP + %TODO: CHECK NONDIM USED BY HTR GROUP ! + r_vec = u(1:nspecies); + dr = dlmax(r_vec-rmin,alpha); % Regularize derivative + fv(1:nspecies) = eps_av*-q(1:nspecies) .* dr; % drho_i + fv(nspecies+1) = eps_av*-q(nspecies+1); % drhou + fv(nspecies+2) = eps_av*-q(nspecies+2); % drhoE +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = 1.0e3; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + % if ndim == 2 + % rhov = u(nspecies+2) + % end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies) = rho_i(ispecies) * uv; + end + fi(nspecies + 1) = rhou * uv + p; + fi(nspecies + 2) = rhou * H; +end + + + +function fv = fluxviscous(u, q, w, v, x, t, mu, eta) + %TODO for thursday: + % - double check with papers: consistent with may, gnoffo. Maybe typo in su2mpp? + % - double check with NS code (TODO: REALLY CONFUSED ABOUT SIGN OF STRESS TENSOR) + % - add AV options: tomorrow, be clear about shear, bulk, thermal, and how density should come into this (let's discuss) + % - try to generate + nspecies = 5; + nenergy = 1; + ndim = 1; + + rho_i = sym(zeros(nspecies,1)); + drhodx_i = sym(zeros(nspecies,1)); + Y_i = sym(zeros(nspecies,1)); + drhodx_i = sym(zeros(nspecies,1)); + rho = sym(0); + drhodx = sym(0); + Tx = sym(0); + J_i = sym(zeros(nspecies,1)); + dTdr_i = sym(zeros(nspecies,1)); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + D_vec = eta(1:nspecies); + h_vec = eta(nspecies+1:2*nspecies); + viscshear = eta(2*nspecies+1); + kappa = eta(2*nspecies+2); + dTdr_i = eta(2*nspecies+3:3*nspecies+2); + dTdrhou = eta(3*nspecies+2:3*nspecies+2+ndim); + dTdrhoE = eta(3*nspecies+3+ndim); + + % Conservative variables and their gradients + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + drhodx_i(ispecies) = q(ispecies) * dlmax(u(ispecies)-rmin,alpha) %TODO: do we need to regularize? It seems like they were in the previous case + rho = rho + rho_i(ispecies); %total mixture density + drhodx = drhodx + drhodx_i(ispecies); + end + + rhou = u(nspecies+1); + drhoudx = q(nspecies+1); + rhoE = u(nspecies+ndim+1); + drhoEdx = q(nspecies+ndim+2); + % if nenergy == 2 + % rhoev = u(nspecies+ndim+nenergy) + % end + + rhoinv = 1.0 / rho; + drhodxinv = 1.0 / drhodx; + uv = rhou * rhoinv; %velocity + dudx = (drhoudx - drhodx*uv)*rinv; + + %%%%%%%% Modify appropriate coefficients + kappa = kappa + avk; + viscshear = viscshear + avs; + viscbulk = 0 + avb; + D_vec = D_vec + avDvec; + + %%%%%%%% Calculation of J_i + for ispecies = 1:nspecies + Y_i(ispecies) = rho_i(ispecies) / rho; + dYdx_i(ispecies) = (q(ispecies) * rho - rho_i(ispecies) * drhodx) * drhodxinv^2; + end + + for ispecies = 1:nspecies + J_i(ispecies) = -rho * D_vec(ispecies) * dYdx_i(ispecies) + rho_i(ispecies) * sum(D_vec .* dYdx_i); + end + + %%%%%%%% Stress tensor tau + txx = viscshear * 4.0/3.0 * dudx + viscbulk * dudx; %TODO: check sign + + Tx = sum(dTdr_i .* drhodx_i) + dTdrhou * drhoudx + dTdrhoE * drhoEdx; + + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + f(ispecies) = -J_i(ispecies); + end + + fv(nspecies + 1) = txx; + fv(nspecies + 2) = uv * txx - (sum(h_vec.*J_i) - kappa * Tx); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = 1.0e3; + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ub = sym(zeros(nspecies+2, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + ub(:,1) = initu(x, mu, eta); + ub(:,2) = initu(x, mu, eta); +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f*n(1); +%%%%% C-CODE MANUALLY MODIFIED + for i = 1:(nspecies+2) + fb(i,1) = fn(i) + tau(i)*(u(i)-uhat(i)); + end + fb(:,2) = fb(:,1); +end + +function u0 = initu(x, mu, eta) + nspecies = 1; + + % pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow]; + % % 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 + % pde.externalparam = [rho_scale, u_scale, rhoe_scale]; + % oh let's just modify this manually + rho_L_vec = mu(1:nspecies); + rhou_L = mu(nspecies + 1); + rhoE_L = mu(nspecies + 2); + + rho_R_vec = mu(nspecies+3:2*nspecies+2); + rhou_R = mu(2*nspecies + 3); + rhoE_R = mu(2*nspecies + 4); + %%% TODO: Cinnella scales this with right region. And uses speed of sound. BUT WHY IS ENERGY IN THE RIGHT REGION NEGATIVE??? + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + + rho_R_vec_nondim = rho_R_vec/rho_scale; + rhou_R_nondim = rhou_R/(u_scale * rho_scale); + rhoE_R_nondim = rhoE_R/rhoe_scale; + + rho_L_vec_nondim = rho_L_vec/rho_scale; + rhou_L_nondim = rhou_L/(u_scale * rho_scale); + rhoE_L_nondim = rhoE_L/rhoe_scale; + +% u0 = [rho_R_vec_nondim(:) + rho_L_vec_nondim(:); rhou_R_nondim + rhou_L_nondim; rhoE_R_nondim + rhoE_L_nondim]; + stepsize = 0.000001; + midpoint = 0.5; + u0(1) = smoothstep_down(x-midpoint, rho_L_vec_nondim(1), rho_R_vec_nondim(1), stepsize); + u0(2) = smoothstep_down(x-midpoint, rho_L_vec_nondim(2), rho_R_vec_nondim(2), stepsize); + u0(3) = smoothstep_down(x-midpoint, rho_L_vec_nondim(3), rho_R_vec_nondim(3), stepsize); + u0(4) = smoothstep_down(x-midpoint, rho_L_vec_nondim(4), rho_R_vec_nondim(4), stepsize); + u0(5) = smoothstep_up(x-midpoint, rho_L_vec_nondim(5), rho_R_vec_nondim(5), stepsize); + u0(nspecies+1) = 0.0; + u0(nspecies+2) = smoothstep_down(x-midpoint, rhoE_L_nondim, rhoE_R_nondim, stepsize); + +end + +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(2,1)); + nspecies = 5; + alpha = 1.0e3; + rmin = 0.0; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + o(1) = u(1); + o(2) = u(2); +end + +function dout = dlmax(x, alpha) + dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +end \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/pdemodel_euler.m b/Applications/Hypersonics/shocktests/pdemodel_euler.m new file mode 100644 index 00000000..bbf8e395 --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdemodel_euler.m @@ -0,0 +1,338 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 1; + nd = 1; + f = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function avField = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + gam = 1.4; + gam1 = gam - 1; + + % artificial viscosity + porder = mu(7); + + % regularization parameters for the bulk viscosity + kb = mu(8); + sb0 = mu(9); %0.02 + sbmin = 0.0; + sbmax = mu(10);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e3; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(2); + + % Get base variables + rvec = u(1:nspecies); + ru = u(nspecies+1); + % rv = udg(3); + rE = u(nspecies+nd+1); + + rx = sum(-q(1:nspecies)); + rux = -q(nspecies+1); + + % Regularization + rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here + + % Simple derived working quantities + r = sum(rvec); + r1 = 1./r; + uv = ru.*r1; + E = rE * r1; %energy + p = gam1*(rE-r*0.5*(uv*uv)); + p = 1e-16 + lmax(p-1e-16,alpha); + H = E + p*r1; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + ux = (rux - rx.*uv).*r1; + div_v = (ux); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + + % % Dilatation Sensor sb + sb = - (hm./porder) .* (div_v./c_star); + sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be +% sb = log(1 + exp(alpha * (sb - 0.01)))/alpha; + % Artificial Bulk viscosity + avb = (kb.*hm./(porder)) .* (abs(uv) + abs(c_star)) .* sb; + + % Assign artificial viscosities + avField(1) = avb; % bulk +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 1; + m = sym(ones(nspecies + 2, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 1; + nd = 1; + % % Clipper utilities + % alpha = 1.0e3; + % rmin = 0.0; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + % fv = fluxviscous(u, q, w, v, x, t, mu, eta) + fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv; +end + +function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) + rmin = 0.0; + alpha = 1.0e3; + eps_av = v(1); +% hm = v(2); + %TODO: CHECK GAS OUTPUTS TO INPUTS USED BY HTR GROUP + %TODO: CHECK NONDIM USED BY HTR GROUP ! + r_vec = u(1:nspecies); + dr = dlmax(r_vec-rmin,alpha); % Regularize derivative + fv(1:nspecies) = eps_av*-q(1:nspecies) .* dr; % drho_i + fv(nspecies+1) = eps_av*-q(nspecies+1); % drhou + fv(nspecies+2) = eps_av*-q(nspecies+2); % drhoE +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + gam = 1.4; + gam1 = gam-1; + nenergy = 1; + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = 1.0e3; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + % if ndim == 2 + % rhov = u(nspecies+2) + % end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE * rhoinv; %energy + + p = gam1*(rhoE-rho*0.5*(uv*uv)); + p = 1e-16 + lmax(p-1e-16,alpha); + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies) = rho_i(ispecies) * uv; + end + fi(nspecies + 1) = rhou * uv + p; + fi(nspecies + 2) = rhou * H; +end + + + +function fv = fluxviscous(u, q, w, v, x, t, mu, eta) + %TODO for thursday: + % - double check with papers: consistent with may, gnoffo. Maybe typo in su2mpp? + % - double check with NS code (TODO: REALLY CONFUSED ABOUT SIGN OF STRESS TENSOR) + % - add AV options: tomorrow, be clear about shear, bulk, thermal, and how density should come into this (let's discuss) + % - try to generate + nspecies = 5; + nenergy = 1; + ndim = 1; + + rho_i = sym(zeros(nspecies,1)); + drhodx_i = sym(zeros(nspecies,1)); + Y_i = sym(zeros(nspecies,1)); + drhodx_i = sym(zeros(nspecies,1)); + rho = sym(0); + drhodx = sym(0); + Tx = sym(0); + J_i = sym(zeros(nspecies,1)); + dTdr_i = sym(zeros(nspecies,1)); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + D_vec = eta(1:nspecies); + h_vec = eta(nspecies+1:2*nspecies); + viscshear = eta(2*nspecies+1); + kappa = eta(2*nspecies+2); + dTdr_i = eta(2*nspecies+3:3*nspecies+2); + dTdrhou = eta(3*nspecies+2:3*nspecies+2+ndim); + dTdrhoE = eta(3*nspecies+3+ndim); + + % Conservative variables and their gradients + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + drhodx_i(ispecies) = q(ispecies) * dlmax(u(ispecies)-rmin,alpha) %TODO: do we need to regularize? It seems like they were in the previous case + rho = rho + rho_i(ispecies); %total mixture density + drhodx = drhodx + drhodx_i(ispecies); + end + + rhou = u(nspecies+1); + drhoudx = q(nspecies+1); + rhoE = u(nspecies+ndim+1); + drhoEdx = q(nspecies+ndim+2); + % if nenergy == 2 + % rhoev = u(nspecies+ndim+nenergy) + % end + + rhoinv = 1.0 / rho; + drhodxinv = 1.0 / drhodx; + uv = rhou * rhoinv; %velocity + dudx = (drhoudx - drhodx*uv)*rinv; + + %%%%%%%% Modify appropriate coefficients + kappa = kappa + avk; + viscshear = viscshear + avs; + viscbulk = 0 + avb; + D_vec = D_vec + avDvec; + + %%%%%%%% Calculation of J_i + for ispecies = 1:nspecies + Y_i(ispecies) = rho_i(ispecies) / rho; + dYdx_i(ispecies) = (q(ispecies) * rho - rho_i(ispecies) * drhodx) * drhodxinv^2; + end + + for ispecies = 1:nspecies + J_i(ispecies) = -rho * D_vec(ispecies) * dYdx_i(ispecies) + rho_i(ispecies) * sum(D_vec .* dYdx_i); + end + + %%%%%%%% Stress tensor tau + txx = viscshear * 4.0/3.0 * dudx + viscbulk * dudx; %TODO: check sign + + Tx = sum(dTdr_i .* drhodx_i) + dTdrhou * drhoudx + dTdrhoE * drhoEdx; + + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + f(ispecies) = -J_i(ispecies); + end + + fv(nspecies + 1) = txx; + fv(nspecies + 2) = uv * txx - (sum(h_vec.*J_i) - kappa * Tx); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + nspecies = 1; + s = sym(zeros(nspecies + 2, 1)); +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 1; + ub = sym(zeros(nspecies+2, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + ub(:,1) = initu(x, mu, eta); + ub(:,2) = initu(x, mu, eta); +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 1; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f*n(1); +%%%%% C-CODE MANUALLY MODIFIED + for i = 1:(nspecies+2) + fb(i,1) = fn(i) + tau(i)*(u(i)-uhat(i)); + end + fb(:,2) = fb(:,1); +end + +function u0 = initu(x, mu, eta) + nspecies = 1; + + % pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow]; + % % 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 + % pde.externalparam = [rho_scale, u_scale, rhoe_scale]; + % oh let's just modify this manually + rho_L_vec = mu(1:nspecies); + rhou_L = mu(nspecies + 1); + rhoE_L = mu(nspecies + 2); + + rho_R_vec = mu(nspecies+3:2*nspecies+2); + rhou_R = mu(2*nspecies + 3); + rhoE_R = mu(2*nspecies + 4); + %%% TODO: Cinnella scales this with right region. And uses speed of sound. BUT WHY IS ENERGY IN THE RIGHT REGION NEGATIVE??? + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + + rho_R_vec_nondim = rho_R_vec/rho_scale; + rhou_R_nondim = rhou_R/(u_scale * rho_scale); + rhoE_R_nondim = rhoE_R/rhoe_scale; + + rho_L_vec_nondim = rho_L_vec/rho_scale; + rhou_L_nondim = rhou_L/(u_scale * rho_scale); + rhoE_L_nondim = rhoE_L/rhoe_scale; + +% u0 = [rho_R_vec_nondim(:) + rho_L_vec_nondim(:); rhou_R_nondim + rhou_L_nondim; rhoE_R_nondim + rhoE_L_nondim]; + stepsize = 0.000001; + midpoint = 0.5; + u0(1) = smoothstep_up(x-midpoint, rho_L_vec_nondim(1), rho_R_vec_nondim(1), stepsize); + u0(nspecies+1) = 0.0; + u0(nspecies+2) = smoothstep_down(x-midpoint, rhoE_L_nondim, rhoE_R_nondim, stepsize); + +end + +% function o = output(u, q, w, v, x, t, mu, eta) +% +% nspecies = 5; +% +% o = sym(zeros(2,1)); +% nspecies = 5; +% alpha = 1.0e3; +% rmin = 0.0; +% +% f = sym(zeros(nspecies + 2,1)); +% rho_i = sym(zeros(5,1)); +% rho = sym(0); +% +% % Conservative Variables +% for ispecies = 1:nspecies +% rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density +% rho = rho + rho_i(ispecies); %total mixture density +% end +% +% rhou = u(nspecies+1); +% rhoE = u(nspecies+2); +% +% rhoinv = 1.0 / rho; +% uv = rhou * rhoinv; %velocity +% E = rhoE*rhoinv; %energy +% +% o(1) = u(1); +% o(2) = u(2); +% end + +function dout = dlmax(x, alpha) + dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +end \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/plotting.m b/Applications/Hypersonics/shocktests/plotting.m new file mode 100644 index 00000000..c0cd27a2 --- /dev/null +++ b/Applications/Hypersonics/shocktests/plotting.m @@ -0,0 +1,96 @@ +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +% for ti = pde.saveSolFreq:pde.saveSolFreq:(length(pde.dt)*6) +for ti = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt) + sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); + sol_output = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); + dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); + +% rho = sum(sol(:,1:5,:),2); +% AV = sol_output(:,1,:); + u = sol(:,1,:); + figure(1) + clf + hold on + plot(dgnodes(:),u(:),'LineWidth',1.3); +% figure(2) +% clf +% hold on +% plot(dgnodes(:),AV(:),'LineWidth',1.3); +% set(gca, 'Xscale','log'); +% waitforbuttonpress +% end +% rhou = sol(:,6,:); +% plot(dgnodes(:),rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log'); + +% rhoE = sol(:,7,:); +% p = solw(:,6,:); +% for i = 1:5 +% u = solw(:,i,:); +% hold on +% plot(dgnodes(:),u(:),'LineWidth',1.3); set(gca, 'Xscale','log'); +% title("\omega_i") +% end +% subplot(1,3,2); +% plot(dgnodes(:), rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log') +% subplot(1,3,3); +% plot(dgnodes(:), rhoE(:),'LineWidth',1.3); +% set(gca, 'Xscale','log') + +% u = sol(:,6,:); +% subplot(1,3,2) +% plot(dgnodes(:),u(:),'LineWidth',1.3); +% +% u = sol(:,7,:); +% subplot(1,3,3) +% plot(dgnodes(:), u(:),'LineWidth',1.3); +% +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); +% w = solw(:,6,:) * rho_inf * u_inf^2; +% disp(w(1)); +% figure(2); +% semilogx(dgnodes(:),w(:)); + drawnow +% waitforbuttonpress + disp(ti) +end +% final +%% +% ttst = 27*120; +% ttst = 324 +ttst = 500; +sol = getsolution(['dataout/out_t' num2str(ttst)],dmd,master.npe); +sol_output = getsolution(['dataout/out_outputCG_t' num2str(ttst)],dmd,master.npe); + +htr_out +figure(10) +rho = sum(sol(:,1:5,:),2); +rhou = sol(:,6,:); +figure(10); hold on +plot(dgnodes(:),rho(:),'LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)) + +figure(11); hold on +plot(dgnodes(:),rhou(:)./rho(:),'LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2)) + + +figure(12); hold on +p = sol_output(:,1,:); +plot(dgnodes(:),p(:),'LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4) + +figure(13); hold on +rho1 = sol(:,1,:); +rho2 = sol(:,2,:); +rho3 = sol(:,3,:); +rho4 = sol(:,4,:); +rho5 = sol(:,5,:); +plot(dgnodes(:),rho1(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho2(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho3(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho4(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho5(:)./rho(:),'LineWidth',1.3); + + diff --git a/Applications/Hypersonics/shocktests/plotting_euler.m b/Applications/Hypersonics/shocktests/plotting_euler.m new file mode 100644 index 00000000..6d80e443 --- /dev/null +++ b/Applications/Hypersonics/shocktests/plotting_euler.m @@ -0,0 +1,109 @@ +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +% for ti = pde.saveSolFreq:pde.saveSolFreq:(length(pde.dt)*6) +gam1 = 1.4-1; +for ti = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt)/10 + sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); + sol_output = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); + dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); + +% rho = sum(sol(:,1:5,:),2); +% AV = sol_output(:,1,:); + ru = sol(:,2,:); + r = sol(:,1,:); + r1 = 1./r; + rE = sol(:,3,:); + uv = ru.*r1; + E = rE .* r1; %energy + p = gam1*(rE- r .* 0.5 .* (uv.*uv)); + + subplot(1,3,1) + plot(dgnodes(:),r(:),'LineWidth',1.3); + title("Density") + subplot(1,3,2) + plot(dgnodes(:),uv(:),'LineWidth',1.3); + title("Velocity") + subplot(1,3,3) + plot(dgnodes(:),p(:),'LineWidth',1.3); + title("Pressure") +% figure(2) +% clf +% hold on +% plot(dgnodes(:),AV(:),'LineWidth',1.3); +% set(gca, 'Xscale','log'); +% waitforbuttonpress +% end +% rhou = sol(:,6,:); +% plot(dgnodes(:),rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log'); + +% rhoE = sol(:,7,:); +% p = solw(:,6,:); +% for i = 1:5 +% u = solw(:,i,:); +% hold on +% plot(dgnodes(:),u(:),'LineWidth',1.3); set(gca, 'Xscale','log'); +% title("\omega_i") +% end +% subplot(1,3,2); +% plot(dgnodes(:), rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log') +% subplot(1,3,3); +% plot(dgnodes(:), rhoE(:),'LineWidth',1.3); +% set(gca, 'Xscale','log') + +% u = sol(:,6,:); +% subplot(1,3,2) +% plot(dgnodes(:),u(:),'LineWidth',1.3); +% +% u = sol(:,7,:); +% subplot(1,3,3) +% plot(dgnodes(:), u(:),'LineWidth',1.3); +% +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); +% w = solw(:,6,:) * rho_inf * u_inf^2; +% disp(w(1)); +% figure(2); +% semilogx(dgnodes(:),w(:)); + drawnow +% waitforbuttonpress + disp(ti) +end +% final +%% +% ttst = 27*120; +% ttst = 324 +ttst = 500; +sol = getsolution(['dataout/out_t' num2str(ttst)],dmd,master.npe); +sol_output = getsolution(['dataout/out_outputCG_t' num2str(ttst)],dmd,master.npe); + +htr_out +figure(10) +rho = sum(sol(:,1:5,:),2); +rhou = sol(:,6,:); +figure(10); hold on +plot(dgnodes(:),rho(:),'LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)) + +figure(11); hold on +plot(dgnodes(:),rhou(:)./rho(:),'LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2)) + + +figure(12); hold on +p = sol_output(:,1,:); +plot(dgnodes(:),p(:),'LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4) + +figure(13); hold on +rho1 = sol(:,1,:); +rho2 = sol(:,2,:); +rho3 = sol(:,3,:); +rho4 = sol(:,4,:); +rho5 = sol(:,5,:); +plot(dgnodes(:),rho1(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho2(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho3(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho4(:)./rho(:),'LineWidth',1.3); +plot(dgnodes(:),rho5(:)./rho(:),'LineWidth',1.3); + + diff --git a/Applications/Hypersonics/shocktests/smoothstep_down.m b/Applications/Hypersonics/shocktests/smoothstep_down.m new file mode 100644 index 00000000..73e9fb8a --- /dev/null +++ b/Applications/Hypersonics/shocktests/smoothstep_down.m @@ -0,0 +1,16 @@ +function [out] = smoothstep_down(x,yminus,yplus,b) +% if yminus < yplus +% flip = 1; +% ymin = yminus; +% ymax = yplus; +% else + flip = -1; + ymin = yplus; + ymax = yminus; +% end +height = ymax - ymin; +scale = (height/2); +out = flip*scale*tanh(x/b); +% out = out + (ymin - min(out(:))); +out = out + (ymin + scale); +end diff --git a/Applications/Hypersonics/shocktests/smoothstep_up.m b/Applications/Hypersonics/shocktests/smoothstep_up.m new file mode 100644 index 00000000..486a6dc5 --- /dev/null +++ b/Applications/Hypersonics/shocktests/smoothstep_up.m @@ -0,0 +1,15 @@ +function [out] = smoothstep_up(x,yminus,yplus,b) +% if yminus < yplus + flip = 1; + ymin = yminus; + ymax = yplus; +% else +% flip = -1; +% ymin = yplus; +% ymax = yminus; +% end +height = ymax - ymin; +scale = (height/2); +out = flip*scale*tanh(x/b); +out = out + (ymin + scale); +end From 429643e4c0e3eda3ddb3d3398042e745b8d6013c Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 4 Oct 2022 14:46:39 -0400 Subject: [PATCH 15/23] add old shock relaxation files --- .../1DShockTube/app/mutationUtils.cpp | 78 ++++- .../1DShockTube/app/opuFbouSubsonicMPP.cpp | 65 ++-- .../app/opuFbouSubsonicVectorTau.cpp | 32 +- .../1DShockTube/app/opuInitwdg_MPP.cpp | 39 ++- .../1DShockTube/app/opuSourcew_MPP.cpp | 1 + .../1DShockTube/app/opuUbouSubsonicMPP.cpp | 2 +- .../Hypersonics/1DShockTube/digitizefigs.m | 293 ++++++++++++++++++ Applications/Hypersonics/1DShockTube/pdeapp.m | 13 +- .../Hypersonics/1DShockTube/pdeapp_euler.m | 69 ++--- .../Hypersonics/1DShockTube/pdeapp_scratch.m | 155 +++++++++ .../Hypersonics/1DShockTube/pdemodel.m | 2 +- .../Hypersonics/1DShockTube/pdemodel_euler.m | 95 ++++-- .../1DShockTube/pdemodel_inflow_dae.m | 194 ++++++++++++ .../Hypersonics/1DShockTube/ploteuler.m | 43 +++ .../Hypersonics/1DShockTube/plotnonequil.m | 2 +- .../Hypersonics/1DShockTube/posterplots.m | 61 ++++ .../Hypersonics/1DShockTube/shockingoutput.m | 171 ++++++++++ src/Matlab/Gencode/runcode.m | 5 +- 18 files changed, 1153 insertions(+), 167 deletions(-) create mode 100644 Applications/Hypersonics/1DShockTube/digitizefigs.m create mode 100644 Applications/Hypersonics/1DShockTube/pdeapp_scratch.m create mode 100644 Applications/Hypersonics/1DShockTube/pdemodel_inflow_dae.m create mode 100644 Applications/Hypersonics/1DShockTube/ploteuler.m create mode 100644 Applications/Hypersonics/1DShockTube/posterplots.m create mode 100644 Applications/Hypersonics/1DShockTube/shockingoutput.m diff --git a/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp b/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp index 1abdd26e..d4527158 100644 --- a/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp +++ b/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp @@ -82,7 +82,6 @@ void stateToConsVars(double* Ucons, double u, double* Ustate, double* uinf, int // Maps from state variables (r, re) and velocity (u) to cons vars (r, ru, rE) //Ucons[nspecies+2]: state variables rho_i, rhou, rhoE (dimensional) //Ustate[nspecies+1]: inputs for mutation: rho_i, rhoe (dimensional) - // TODO: currently for 1D double rho = 0.0; for (int i=0; imixtureEnergyMass() // OKAY SHOULD I DO THIS ALL IN DIMENSIONAL OR NONDIM COORDS...what did I do last time? + double rhou = Ucons[nspecies]; + double rhoE = Ucons[nspecies+1]; + +} + +// void getdPdU() +// { + +// } + +// double getdTdr(double* dTdr_i, double* Ucons, Mutation::Mixture *mix, int nspecies, int ndim) +// { +// double rho = 0.0; +// for (int i=0; imixtureEquilibriumCvMass()); +// // return -e/denom; +// } + +// double getdTdr(Mutation::Mixture *mix) +// { +// // double e = mixture->mixtureEnergyMass(); +// // double rho = mixture->density(); +// // double denom = (rho*mixture->mixtureEquilibriumCvMass()); +// // return -e/denom; +// } + +// double dTdru(double* rho_i, double* rhou) + +// double getdTdre(double rho, Mutation::Mixture *mix) +// { +// // double Cv = mixture->mixtureEquilibriumCvMass(); +// // double denom = rho * Cv; +// // return 1.0/denom; +// } + +// double getdTdre(Mutation::Mixture *mix) +// { +// // double Cv = mixture->mixtureEquilibriumCvMass(); +// // double rho = mixture->density(); +// // double denom = rho * Cv; +// // return 1.0/denom; +// } + +// double getP() +// { + +// } + +// double getKineticSource() +// { + +// } \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp index 23aeed09..4f1959ae 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp @@ -1,6 +1,8 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) { for (int i = 0; i void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg T udg6 = udg[5*ng+i]; T udg7 = udg[6*ng+i]; - T rho_inf = uinf[0]; - T u_inf = uinf[1]; - T rhoe_inf = rho_inf * u_inf * u_inf; - double rhovec[5] = {udg1*rho_inf, udg2*rho_inf, udg3*rho_inf, udg4*rho_inf, udg5*rho_inf}; - double rhoe = abs(udg7-(udg6*udg6)*(udg1/2.0+udg2/2.0+udg3/2.0+udg4/2.0+udg5/2.0)*1.0/pow(udg1+udg2+udg3+udg4+udg5,2.0)); - rhoe = rhoe * rhoe_inf; - // printf("rho_inf: %f\n", rhoe_inf); + T rho_scale = uinf[0]; + T u_scale = uinf[1]; + T rhoe_scale = uinf[2]; + + double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; + double Ustate[6]; + + dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; + double rhoe = Ustate[nspecies]; + mix->setState(rhovec, &rhoe, 0); - // printf("opuubou1: wdg6 = %f; p = %f\n", wdg6, mix->P()/rhoe_inf); - T wdg6 = mix->P()/rhoe_inf; - // printf("opufbou1: wdg6 = %f\n", wdg6); - //// Given Tinf, Yinf, uinf and pressure from solution, calculates rhoi, rhou, rhoE - T Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; - // for (int ii = 0; ii<7; ii++) - // { - // printf("fbou1 before uinflow: Ucons = %f\n", Ucons[ii*ng+i]); - // } - uinflow((double*) Ucons, (double) wdg6, (double*)param, (double*)uinf, mix); + + T wdg6 = mix->P()/rhoe_scale; + + uinflow((double*) Ucons, (double) wdg6, (double*) param, (double*) uinf, mix); udg1 = Ucons[0]; udg2 = Ucons[1]; @@ -36,11 +37,6 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg udg5 = Ucons[4]; udg6 = Ucons[5]; udg7 = Ucons[6]; - //// - // for (int ii = 0; ii<7; ii++) - // { - // printf("fbou1 after uinflow: Ucons = %f\n", Ucons[ii*ng+i]); - // } T uhg1 = uhg[0*ng+i]; T uhg2 = uhg[1*ng+i]; @@ -60,23 +56,20 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg f[5*ng+i] = nlg1*(wdg6+t3*(udg6*udg6))+tau1*(udg6-uhg6); f[6*ng+i] = tau1*(udg7-uhg7)+nlg1*udg6*(t3*udg7+t3*wdg6); - // for (int ii = 0; ii<7; ii++) - // { - // printf("fbou1: %f\n", f[ii*ng+i]); - // } - + } } template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) { for (int i = 0; i void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg T uhg5 = uhg[4*ng+i]; T uhg6 = uhg[5*ng+i]; T uhg7 = uhg[6*ng+i]; - T wdg6 = wdg[5*ng+i]; + T wdg6 = param[3*nspecies+6]/uinf[2]; + T nlg1 = nlg[0*ng+i]; T t2 = udg1+udg2+udg3+udg4+udg5; T t3 = 1.0/t2; @@ -109,11 +103,6 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg f[4*ng+i] = tau1*(udg5-uhg5)+nlg1*t3*udg5*udg6; f[5*ng+i] = nlg1*(wdg6+t3*(udg6*udg6))+tau1*(udg6-uhg6); f[6*ng+i] = tau1*(udg7-uhg7)+nlg1*udg6*(t3*udg7+t3*wdg6); - // for (int ii = 0; ii<7; ii++) - // { - // printf("fbou2: %f\n", f[ii*ng+i]); - // } - } } diff --git a/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp index 54c52891..c9c876ca 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp @@ -1,10 +1,6 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) { for (int i = 0; i void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg mix->setState(rhovec, &rhoe, 0); T uinf4 = mix->P()/rhoe_scale; - // T uinf4 = 16894.0/rhoe_scale; T t2 = 1.0/3.141592653589793; T t3 = udg1*1.0E+3; @@ -115,7 +110,6 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg double rhoe_scale = uinf[2]; double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; - // double Ucons[7] = {uhg1, uhg2, uhg3, uhg4, uhg5, uhg6, uhg7}; double Ustate[6]; dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); @@ -123,7 +117,6 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg double rhoe = Ustate[nspecies]; mix->setState(rhovec, &rhoe, 0); - // T uinf4 = param[3*nspecies+6]/rhoe_scale; T uinf4 = mix->P()/rhoe_scale; T t2 = 1.0/3.141592653589793; @@ -191,13 +184,6 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg T t28h = t23h+t24h+t25h+t26h+t27h+1.591548900402584E-3; T t29h = 1.0/t28h; - // T fnug1 = nlg1*t3*udg1*udg6; - // T fnudg2 = nlg1*t3*udg2*udg6; - // T fnudg3 = nlg1*t3*udg3*udg6; - // T fnudg4 = nlg1*t3*udg4*udg6; - // T fnudg5 = nlg1*t3*udg5*udg6; - // T fnudg6 = nlg1*(wdg6+t3*(udg6*udg6)); - // T fnudg7 = nlg1*udg6*(t3*udg7+t3*wdg6); uinf4 = param[3*nspecies+6]/rhoe_scale; T fnuhg1 = nlg1*t29h*uhg6*(t23h+3.183097800805168E-4); T fnuhg2 = nlg1*t29h*uhg6*(t24h+3.183097800805168E-4); @@ -207,20 +193,12 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg T fnuhg6 = nlg1*(uinf4+t29h*(uhg6*uhg6)); T fnuhg7 = nlg1*uhg6*(t29h*uhg7+t29h*uinf4); - // f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t29*udg6*(t23+3.183097800805168E-4); - // f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t29*udg6*(t24+3.183097800805168E-4); - // f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t29*udg6*(t25+3.183097800805168E-4); - // f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t29*udg6*(t26+3.183097800805168E-4); - // f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t29*udg6*(t27+3.183097800805168E-4); - // f[5*ng+i] = nlg1*(uinf4+t29*(udg6*udg6))+tau6*(udg6-uhg6); - // f[6*ng+i] = tau7*(udg7-uhg7)+nlg1*udg6*(t29*udg7+t29*uinf4); - f[0*ng+i] = tau1*(udg1-uhg1)+ 0.5 * (fnudg1 + fnuhg1); - f[1*ng+i] = tau2*(udg2-uhg2)+0.5 * (fnudg2 + fnuhg2); - f[2*ng+i] = tau3*(udg3-uhg3)+0.5 * (fnudg3 + fnuhg3); - f[3*ng+i] = tau4*(udg4-uhg4)+0.5 * (fnudg4 + fnuhg4); - f[4*ng+i] = tau5*(udg5-uhg5)+0.5 * (fnudg5 + fnuhg5); - f[5*ng+i] = 0.5 * (fnudg6 + fnuhg6) +tau6*(udg6-uhg6); + f[1*ng+i] = tau2*(udg2-uhg2)+ 0.5 * (fnudg2 + fnuhg2); + f[2*ng+i] = tau3*(udg3-uhg3)+ 0.5 * (fnudg3 + fnuhg3); + f[3*ng+i] = tau4*(udg4-uhg4)+ 0.5 * (fnudg4 + fnuhg4); + f[4*ng+i] = tau5*(udg5-uhg5)+ 0.5 * (fnudg5 + fnuhg5); + f[5*ng+i] = 0.5 * (fnudg6 + fnuhg6) + tau6*(udg6-uhg6); f[6*ng+i] = tau7*(udg7-uhg7)+0.5 * (fnudg7 + fnuhg7); } } diff --git a/Applications/Hypersonics/1DShockTube/app/opuInitwdg_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuInitwdg_MPP.cpp index fa4121f7..30fbcdf7 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuInitwdg_MPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuInitwdg_MPP.cpp @@ -3,28 +3,33 @@ template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int model for (int i = 0; i void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u for (int ispecies = 0; ispecies < nspecies; ispecies++ ) { f[j+npe*ispecies+npe*nce*k] = wdot[ispecies]/(rho_inf*u_inf); + // printf("w[%i]: %f\n", ispecies, f[j+npe*ispecies+npe*nce*k]); } f[j+npe*nspecies+npe*nce*k] = mix->P()/rhoe_inf; // printf("sourcew: p=%f\n", mix->P()/rhoe_inf); diff --git a/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp index 62991c41..c413750c 100644 --- a/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp +++ b/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp @@ -60,7 +60,7 @@ template void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg f[3*ng+i] = Ucons[3]; f[4*ng+i] = Ucons[4]; f[5*ng+i] = Ucons[5]; - uoutflow((double*) Ucons, (double*) param, (double*) uinf, mix); + uoutflow((double*) Ucons, (double*) param[25], (double*) uinf, mix); f[6*ng+i] = Ucons[6]; } diff --git a/Applications/Hypersonics/1DShockTube/digitizefigs.m b/Applications/Hypersonics/1DShockTube/digitizefigs.m new file mode 100644 index 00000000..558a38e3 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/digitizefigs.m @@ -0,0 +1,293 @@ +Y2dig = [0.000001259373251009453, 0.0016356832559905887 +0.000001940371514687366, 0.0016025340305349522 +0.0000029896204820625454, 0.0015878010414437094 +0.000004606266811721296, 0.0016191086432628399 +0.000007097162099250899, 0.0017148730723568206 +0.000010935067674552048, 0.001838261855997031 +0.000016425277673761178, 0.001900754284726358 +0.000026404127033029627, 0.0024515225269256813 +0.000040684964135886944, 0.003202904970585868 +0.00006269341914220248, 0.0045951724397209626 +0.00009661151089441488, 0.006455212312507286 +0.00014889449868739623, 0.009376027399872727 +0.00022949861531119172, 0.013574929290915111 +0.00035379848646591367, 0.019617296442016013 +0.0005409312613321087, 0.02791745658721459 +0.0007894575190711522, 0.03736000500180639 +0.001081227347832378, 0.04702986427015876 +0.0014375808419734757, 0.05696085143796081 +0.0018554936933736727, 0.06678056320782266 +0.002344529657527944, 0.07589687120575878 +0.0030521342928085966, 0.0866988269729213 +0.0040136500475999775, 0.09677657805001036 +0.0050843218828736225, 0.10571917356711236 +0.006760471742639133, 0.11636072931788329 +0.008874571290805638, 0.1257137688012191 +0.0118992451225351, 0.135044789565823 +0.01671725005158139, 0.145064269471123 +0.02398865337157055, 0.1549121197871557 +0.03471499530388527, 0.16449257733511669 +0.050459468167906765, 0.17382922974911083 +0.07455511898899843, 0.18294851580001803 +0.11353093255938604, 0.19160624283429284 +0.17503867132652096, 0.1987351767005191 +0.26679231016973654, 0.20340996843753306 +0.4064259511021543, 0.206019534832023 +0.7030855313803712, 0.2071766116159234]; + +Y1dig = [0.000001373529692170367, -8.560447239697871e-7 +0.0000025331837480962662, -8.560447239697871e-7 +0.000004671919317214954, -9.544607500588248e-7 +0.000008660796396777242, 0.0000032050722105748074 +0.000017260095942577926, 0.000004410668530165519 +0.00002752408120930954, 0.00000532703599283443 +0.00005177276615169792, 0.000014358888500658369 +0.00009186117900785602, 0.00003338814512404871 +0.00014986522527850034, 0.00006915400836122283 +0.00023611530301419464, 0.00014773813529345733 +0.0003323978845358271, 0.00025447449336128496 +0.0004047661880469069, 0.00033881983960600253 +0.0004860328341762603, 0.00044311601649744395 +0.000578917462013169, 0.000558498469268909 +0.0006720451003031337, 0.0006743481914079396 +0.0007721692103973206, 0.0007915595154903328 +0.0008781300388381325, 0.0009076879027874833 +0.0009935079179363452, 0.0010249054905272146 +0.001118278505890224, 0.0011382647226986847 +0.0012587185206672858, 0.0012522447533637258 +0.0014314460205828397, 0.0013693221523410203 +0.0016447088788256528, 0.001485099414328974 +0.00191978937739215, 0.0015962392266480317 +0.0023454434784245127, 0.0017048030385381889 +0.0034673516194610233, 0.0017929588865595158 +0.006305516378237161, 0.0017168316639490644 +0.011139859000503386, 0.0016146877580839845 +0.01902845820167395, 0.0015537727113906358 +0.034379283794653895, 0.0015224764150943394 +0.06404523155549899, 0.0015150788104666508 +0.11655544406190319, 0.001540965207631874 +0.199157434682314, 0.0015937890069640229 +0.3548035159937796, 0.0016516193304715312 +0.603649244190338, 0.0016732344956103355 +0.9684298167840083, 0.0016771372000931744]; + +Tdig = [0.000001486020665739492, 6535.360339148868 +0.0000026693317322194124, 6535.102680625038 +0.000004885073958422841, 6533.891994450791 +0.000009651826184622128, 6534.859101743134 +0.000017638267021713327, 6529.801025356456 +0.000031124758042887185, 6518.24156219475 +0.00005534605902206883, 6504.528286156587 +0.00010163412588665602, 6472.902851731788 +0.00020123599307959693, 6406.553237687353 +0.00037208015352153614, 6304.351502632943 +0.0006737160319316617, 6138.942250012088 +0.0011422915409454574, 5926.274442504731 +0.0017491818618681277, 5709.909354976367 +0.002481930727822536, 5515.893343435618 +0.0034474471001450513, 5324.289264887642 +0.004834889364850496, 5135.8250782222185 +0.007051982427248698, 4941.66496361918 +0.011452234089091781, 4725.399172189993 +0.02045635261107896, 4522.6609730043365 +0.03887342871702687, 4344.933174206664 +0.07840944050502596, 4180.01625890343 +0.16097404943934857, 4047.602602544821 +0.316819542054135, 3975.9795835634777 +0.5822344453956471, 3956.0540646691497 +0.8506751866516096, 3953.255902243101]; + +Y3dig = [0.0000013381465146014085, 0.00010102118030992646 +0.000002497931148127742, 0.00010935231583383831 +0.000004662912433505359, 0.00010102118030992646 +0.000008566044908320071, 0.00009945909239919559 +0.000016072982550257615, 0.00010102118030992646 +0.000029527016065504108, 0.0000955018030253385 +0.00005482001715078239, 0.00014496792019856597 +0.00010177913927181578, 0.00020828455018030712 +0.00018799186244202492, 0.0003973550424868355 +0.0003488553500146733, 0.0010647550360939478 +0.000645781169586477, 0.0031729538394292683 +0.001033859605269182, 0.006888189013253401 +0.0013625790155550408, 0.010384171511530663 +0.0016908055096465987, 0.01439022034374561 +0.0020553681344951517, 0.018769290810034492 +0.002450899021242965, 0.023322811782887642 +0.002890573255808896, 0.028113770118172315 +0.0033567929299176107, 0.03273154993276288 +0.003858215339050831, 0.037210462230131594 +0.004411731211116071, 0.04172481618507938 +0.005070735486479669, 0.04633991432005763 +0.005858307958427839, 0.051042493192659445 +0.0068031926527416815, 0.05573037356187265 +0.00794131953639804, 0.06022340454001111 +0.009511942649598572, 0.064766514072964 +0.012507398455071024, 0.06963704219101588 +0.019972878710371553, 0.0720063060073017 +0.028077360536849134, 0.06833910925865219 +0.03470092624185773, 0.06443261778204468 +0.042620220484702626, 0.06003062801479886 +0.05184540056217382, 0.055548338250675164 +0.06343700689180617, 0.05100009366365382 +0.078370968912051, 0.04653577658876973 +0.098329931929582, 0.0421258722427762 +0.12659393842052538, 0.03781572456641535 +0.1780445151254225, 0.03312633665839304 +0.2798231547172986, 0.029084898027734132 +0.4789711490829157, 0.026773568116892237 +0.7747546727911325, 0.026291218512100825]; + +Y4dig = [0.0000013804917624169693, 0.767085296358538 +0.0000025451592728545583, 0.7670903473308884 +0.00000469241171918051, 0.7670944305539147 +0.000008783523860888947, 0.7671051829199451 +0.00001619780797265008, 0.7671135455323943 +0.000029724694991710478, 0.7671060318228612 +0.0000590406733794615, 0.7670595760638075 +0.0000985140073733879, 0.767088654518603 +0.0001795001249644273, 0.7669557161792773 +0.00030824304942479085, 0.766577689200535 +0.000515171067204771, 0.7657658103224654 +0.0008442785734011159, 0.7640594945354093 +0.0012266167830984295, 0.7618071987466546 +0.0015969358133596093, 0.7595518055358937 +0.00196162985522644, 0.7573495603664336 +0.0023355793735014307, 0.75520946960233 +0.002753203421348333, 0.7529764057767707 +0.003228861044178472, 0.7506325977179781 +0.0037479620149177785, 0.7484275461767785 +0.004328210671306096, 0.7461938042569005 +0.004998291749127807, 0.7439553382999168 +0.005801862439693299, 0.7416510854189947 +0.006769332829380963, 0.7394157408495092 +0.00797975462429123, 0.737233102668728 +0.009706265262904273, 0.7350557719650436 +0.012825897909859142, 0.7327716112025626 +0.019519311261860302, 0.7319922696263312 +0.02841954365416361, 0.7339374505009948 +0.03615477139657785, 0.7360776651549179 +0.044405295893134314, 0.7381877321454504 +0.05401597182000986, 0.7402993182057724 +0.06490840812566664, 0.7422420507917243 +0.07781043362098004, 0.7440039237469619 +0.09705999538477644, 0.7460130687679999 +0.1262326002301976, 0.7480863290028903 +0.17445323227945145, 0.7501430914904997 +0.27182676535726585, 0.7520424820895617 +0.4531226506379431, 0.7530582993096332 +0.760180761468406, 0.7532656000915857]; + +Y5dig = [0.0000013573969026810786, 0.23283337249937464 +0.000002554942793821503, 0.23292854056500897 +0.000004644499296144421, 0.23268512993559803 +0.00000914625523212119, 0.23283221950165633 +0.00001546886248802708, 0.23240796909286543 +0.000024542202210391633, 0.23193403427913006 +0.000044569493263329365, 0.23079658298655847 +0.00007550844265111659, 0.22897043473931467 +0.00012654042011916585, 0.22626256661385566 +0.00024213755420047692, 0.2201089140827006 +0.000438185320027859, 0.2104562015565904 +0.0007339377053618982, 0.1975803280125744 +0.0010664899715854372, 0.18445408644998157 +0.0014282975506011235, 0.17183338766042278 +0.0018683218956565037, 0.15851057019860124 +0.00237711784199452, 0.14532423685303006 +0.0030171609187653495, 0.13146414924892605 +0.0037800347005203074, 0.11804355305903619 +0.004793462467363275, 0.10434534147808616 +0.00607307519412244, 0.09090764290737172 +0.007806843322153937, 0.07789770272216612 +0.010359525801634984, 0.06487185334549575 +0.015111515474991188, 0.05089981276105421 +0.02532744735423996, 0.03821325075615717 +0.04598736615021887, 0.02908372941571835 +0.07901867647193762, 0.022710427768975833 +0.13804039348602679, 0.01721377319209666 +0.2492880295865353, 0.013286010762965872 +0.4712068879973204, 0.011488618204014811 +0.801569943180251, 0.01115537746136891]; + +pressdig = [0.0000016137995335261743, 16100.558215998775 +0.0000029247717727710753, 16099.6093996007 +0.000005375021284502547, 16102.632416642824 +0.000010547998595208255, 16102.158048207668 +0.000018296550405480608, 16103.393689872099 +0.000033014935181139985, 16106.82370366309 +0.000056525606405778854, 16110.546260501862 +0.00010911120467011142, 16118.951691133672 +0.00020241685590565394, 16134.334517285108 +0.00038524915176157623, 16162.265205652202 +0.0006657155267443786, 16202.239796967546 +0.001073787469679705, 16253.957663421252 +0.0015599900378435966, 16306.886377401062 +0.0022019998263270177, 16363.842562117741 +0.003072852155270264, 16420.364141249083 +0.004040710357537967, 16471.778174767536 +0.0052109719524503885, 16517.871189965994 +0.007406882784576277, 16575.77374444402 +0.01077293160421322, 16633.330064882124 +0.015509095729443367, 16679.337003447527 +0.02490428232634487, 16727.942811496654 +0.049081940593058225, 16784.72181595364 +0.09714712489740719, 16834.269939514517 +0.17717609419523925, 16868.66606532415 +0.3273278712595124, 16888.71608852977 +0.5917932584050248, 16896.20583455165 +0.9547055568919267, 16896.46194792101]; + +Tdig = [0.0000013772538735651438, 6534.813831863243 +0.00000254501215692538, 6534.905441504263 +0.000004702899736365569, 6532.752614940286 +0.000009535154992719135, 6533.593591444852 +0.000017420731494481997, 6528.2515902309715 +0.00003027624701028886, 6516.825029626529 +0.00005492367360189519, 6502.548916295892 +0.00010163412588665591, 6470.194681328546 +0.00020123599307959674, 6403.445606640127 +0.00037208015352153576, 6300.884449443305 +0.0006737160319316603, 6135.128014987121 +0.001142291540945455, 5922.151455129707 +0.0017491818618681242, 5705.537187164305 +0.002481930727822531, 5511.316568769027 +0.0034474471001450444, 5319.520334087894 +0.004834889364850487, 5130.858361610198 +0.007051982427248698, 4936.477522571749 +0.011452234089091781, 4719.928186714543 +0.02045635261107896, 4516.850753258919 +0.03887342871702687, 4338.747517324522 +0.07840944050502612, 4173.420302864726 +0.16097404943934857, 4040.5860169985267 +0.31681954205413565, 3968.5670517524013 +0.5822344453956483, 3948.285672086336 +0.8506751866516112, 3945.265787214114]; + +xY2true = Y2dig(:,1); +Y2true2 = Y2dig(:,2); + +xY1true = Y1dig(:,1); +Y1true2 = Y1dig(:,2)*1e-3; + +xY3true = Y3dig(:,1); +Y3true2 = Y3dig(:,2); + +xY4true = Y4dig(:,1); +Y4true2 = Y4dig(:,2); + +xY5true = Y5dig(:,1); +Y5true2 = Y5dig(:,2); + +xPtrue = pressdig(:,1); +Ptrue2 = pressdig(:,2); + +xTtrue = Tdig(:,1); +Ttrue2 = Tdig(:,2); + +figure(10) +hold on +% scatter(xY1true,Y1true2,'LineWidth',1.3) +% scatter(xY2true,Y2true2,'LineWidth',1.3) +% scatter(xY3true,Y3true2,'LineWidth',1.3) +% scatter(xY4true,Y4true2,'LineWidth',1.3) +scatter(xY5true,Y5true2,'LineWidth',1.3) +set(gca,'Xscale','log'); \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/pdeapp.m b/Applications/Hypersonics/1DShockTube/pdeapp.m index 47ed0300..c1a28457 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -21,6 +21,7 @@ tfinal = 0.01; % 1 with 1e-4 doesn't work super well nt = 1000; +dt = tfinal/nt; pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; pde.saveSolFreq = 500; pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected @@ -94,14 +95,14 @@ eval('!cp opuAppMPP.cpp opuApp.cpp'); eval('!cp opuUbouSubsonicMPP.cpp opuUbou.cpp'); % eval('!cp opuFbouSubsonicMPP.cpp opuFbou.cpp'); -eval('!cp opuFbouSubsconicVectorTau.cpp opuFbou.cpp'); +eval('!cp opuFbouSubsonicVectorTau.cpp opuFbou.cpp'); eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); eval('!cp opuSource_MPP.cpp opuSource.cpp'); eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); cd(".."); -% compile source codes to build an executable file and store it in app folder -compilerstr = compilecode(pde); - -% run executable file to compute solution and store it in dataout folder -runstr = runcode(pde); +% % compile source codes to build an executable file and store it in app folder +% compilerstr = compilecode(pde); +% +% % run executable file to compute solution and store it in dataout folder +% runstr = runcode(pde); diff --git a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m index b19eab09..7d2c05cc 100644 --- a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m @@ -19,19 +19,19 @@ pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages -nt = 50000 ; +nt = 10000; pde.dt = 5e-4*ones(1,nt); % time step sizes pde.saveSolFreq = nt/100; pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected -pde.tau = 2; +pde.tau = 4.0; %% Mesh -nDiv = 256; +nDiv = 1024; [mesh.p,mesh.t] = linemesh(nDiv-1); -a = 0; b = 10; +a = 0; b = 1; mesh.p = a + (b-a)*mesh.p; -% mesh.p = loginc(mesh.p, 10); +% mesh.p = loginc(mesh.p, 5); % expressions for domain boundaries mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary @@ -40,39 +40,41 @@ %% Solver params pde.linearsolveriter = 40; pde.GMRESrestart = 20; -pde.matvectol = 1e-6; +pde.matvectol = 1e-3; pde.NLiter = 3; - +pde.NLtol = 1e-11; %% Problem params % Postshock flow conditions +% Dimensional quantities used in nonequilibrium case rho_post = 0.0085; u_post = 542.0; rhou_post = rho_post*u_post; rhoE_post = 52157.2; -rho_inf = rho_post; -u_inf = u_post; +p_post = 16101; +p_outflow = 16894; % pde.physicsparam = [rho_post(:)'/rho_inf,... % rhou_post/(rho_inf*u_inf),... % rhoE_post/(rho_inf*u_inf^2)]; % pout = 2.104849700000000e+04/(rho_inf*u_inf^2); -%%% Initial conditions roughly correspond to a nondimensionalition of the -%%% original parameters...TODO: maybe this is not sensible? -pde.physicsparam = [1, 1, 20.88]; +% Assumed equilibrium conditions used for outflow and initial conditions. +pde.physicsparam = [1, 0, 16.8925]; -rhoin = pde.physicsparam(1); -uin = pde.physicsparam(2)./rhoin; -rhoEin = pde.physicsparam(3); +rhoin = 1.0; +uin = 1.0; +rhoEin = 20.888; pin = 0.4 * (rhoEin - 1/2 * rhoin * uin^2); -pout = 9; +% pout = p_outflow/(rho_post*u_post*u_post); +pout = 2.0; +% pout = 3.0; Minf = 0.444658; Tin = 1.4 * Minf^2 * pin/rhoin; -pde.externalparam = [rho_inf, u_inf, pout, Minf, Tin]; +pde.externalparam = [rho_post, 1.0, pout, Minf, Tin]; %% call exasim to generate and run C++ code to solve the PDE model % [sol,pde,mesh,master,dmd] = exasim(pde,mesh); @@ -91,36 +93,3 @@ % run executable file to compute solution and store it in dataout folder runstr = runcode(pde); -%% plot solution -% sol = fetchsolution(pde,master,dmd, 'dataout'); -for ti = pde.soltime -% ti = nt; -sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); -% sol = getsolution(['dataout/out'],dmd,master.npe); -nspecies=1; -dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); -for i = 1:nspecies - rho = sol(:,i,:); -% subplot(1,3,1) -% hold on -% plot(dgnodes(:),u(:),'LineWidth',1.3) -end -rhou = sol(:,nspecies+1,:); -% subplot(1,3,2) -% plot(dgnodes(:),u(:),'LineWidth',1.3); - -rhoE = sol(:,nspecies+2,:); - -% u = rhou./rho; -% subplot(1,3,3) -p = eulereval(sol,'p',1.4,0.55); -% p = rho; - -u = rho(:); -figure(1); plot(dgnodes(:),u,'LineWidth',1.3); ylim([min(u), max(u)]); drawnow; waitforbuttonpress; -end -% plot - - - - diff --git a/Applications/Hypersonics/1DShockTube/pdeapp_scratch.m b/Applications/Hypersonics/1DShockTube/pdeapp_scratch.m new file mode 100644 index 00000000..bce88f8c --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdeapp_scratch.m @@ -0,0 +1,155 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelC"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_inflow"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 1; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages +% time history +% 1000 to 0.01 +% 1000 to 0.01 +% 1000 to 0.01...no these don't work super well -__- +tfinal = 0.1; % 1 with 1e-4 doesn't work super well +% nt = 1000; +% dt = tfinal/nt; +% dt = 1e-4 +% pde.dt = [dt/100*ones(1,nt/2), dt*ones(1,nt/2)];%, dt*2*ones(1,nt)]; % time step sizes +pde.dt = [(1e-3)*ones(1,20e4)]; +% time history: +% 5e-6 x 5000 steps +% 5e-4 x 5000 steps +% Total so far: 2.525 +% 5e-4 x 10000 steps +% 7.525 +% 5e-3 x 10000 steps NOT GREAT: Oscillations and not stabilized yet +% 5e-2 x 4000 this does not seem right! +% 1e-2 x 1000 +% 5e-2 x 1000 +% 1e-3 x 10e3 +% let's just keep going +% 1e-3 x ~85000 +% pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; +% pde.dt = [5*dt*ones(1,nt)] +% pde.saveSolFreq = nt/100; +pde.saveSolFreq = 500; +% pde.saveSolFreq = 1; +% pde.saveSolFreq=1; +pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +pde.timestepOffset = 130000; +% Solver params +pde.linearsolveriter = 40; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-5; +pde.matvectol = 1e-7; +pde.NLiter = 5; +pde.RBdim = 5; +pde.NLtol = 1e-11; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; + +% Inflow BC: specify temperature, velocity, and mass fractions +T_inflow = 6.539171319799890e+03; +Xi_inflow = [0, 0, 0, 0.76708248854242, 0.23291751145758]; +u_inflow = 5.415214474186620e+02; +% Outflow BC: specify pressure +% p_outflow = 16894.1; +p_outflow = 1.689038973365919e+04; + +% Dimensional "postshock" state; used as initial conditions for inflow +% rho_post = [0 0 0 0.00655326 0.00199076]; +% rhou_post = 4.63086; +% rhoE_post = 52267.1; + +% rho_post = [0.000000000000000e+00 0.000000000000000e+00 0.000000000000000e+00 6.553264087414407e-03 1.990756887050269e-03 ]; +% rho_post = [0.000000000000000 0.000000000000000 0.000000000000000 0.006553622130237 0.001989946818508]; +% rho_post = [6.843577361516948e-81 3.586042485049209e-42 2.417482657189227e-18 6.875039878366979e-03 2.087542348520588e-03 ]; +rho_post = [6.523630530137378e-81 3.418389973844208e-42 2.304461955409462e-18 6.553622130237057e-03 1.989946818507937e-03 ]; +% rhou_post = 4.630859368159855e+00; +% rhou_post = 4.626525823245757e+00; +rhou_post = 4.626525823245526e+00; +% rhoE_post = 5.226378663945410e+04; +rhoE_post = 5.226378663945407e+04; + +% Scaling parameters +rho_scale = sum(rho_post); +u_scale = u_inflow; +rhoe_scale = rho_scale * u_scale * u_scale; + +% Dimensional equilibrium state; used as initial conditions for outflow +% rho_equil = [2.0979e-05 0.00259561 0.000326699 0.00941716 0.000142304]; +% rhou_equil = 4.62653; +% rhoE_equil = 83151.3; +rho_equil = [2.097903177177863e-05 2.595607445498073e-03 3.266988117157821e-04 9.417156962182115e-03 1.423035901034682e-04 ]; +rhou_equil = 4.626525823245757e+00; +rhoE_equil = 8.315126885726860e+04; + +pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow]; +% 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 +pde.externalparam = [rho_scale, u_scale, rhoe_scale, NaN]; +% Inf is a placeholder variable that's replaced with Mutation outputs +%% Stabilization and mesh +pde.tau = [5,5,5,5,5,5,5]; +nDiv = 1024; +[mesh.p,mesh.t] = linemesh(nDiv-1); +a = 0; b = 1.5; +% B=10; +% dx = 5e-6; +% b1 = 1e-3; +% p1 = 0:dx:(b1-dx); +% n1 = length(p1); +% mesh.p = [p1, linspace(b1, 1.5, nDiv-n1)]; +mesh.p = a + (b-a)*mesh.p; +mesh.p = loginc(mesh.p, 6); +% mesh.p = [mesh.p, 1.6:0.1:B]; +% m = length(mesh.p); +% mesh.t = [1:1:(m-1); 2:1:m]; +disp(mesh.p(2)) +% expressions for domain boundaries +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary + +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +% gencode(pde); +% cd("app"); +% eval('!./fixargsMPP_Mac.sh'); +% eval('!cp opuAppMPP.cpp opuApp.cpp'); +% eval('!cp opuUbouSubsonicMPP.cpp opuUbou.cpp'); +% % eval('!cp opuFbouSubsonicMPP.cpp opuFbou.cpp'); +% eval('!cp opuFbouSubsconicVectorTau.cpp opuFbou.cpp'); +% eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); +% eval('!cp opuSource_MPP.cpp opuSource.cpp'); +% eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); +% cd(".."); +% +% % compile source codes to build an executable file and store it in app folder +% compilerstr = compilecode(pde); +% +% % run executable file to compute solution and store it in dataout folder +% runstr = runcode(pde); diff --git a/Applications/Hypersonics/1DShockTube/pdemodel.m b/Applications/Hypersonics/1DShockTube/pdemodel.m index e40c7b0c..d24577f0 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel.m @@ -1,6 +1,6 @@ function pde = pdemodel - pde.mass = @mass; +% pde.mass = @mass; pde.flux = @flux; pde.source = @source; pde.fbou = @fbou; diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m index 8f759572..e9dcdf7f 100644 --- a/Applications/Hypersonics/1DShockTube/pdemodel_euler.m +++ b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m @@ -47,7 +47,42 @@ nspecies = 1; ub = sym(zeros(nspecies+2, 2)); +% rho = abs(u(1)); +% rhou = u(2); +% rhoE = u(3); +% +% rhoinv = 1.0 / rho; +% uv = rhou * rhoinv; %velocity +% E = rhoE * rhoinv; %energy +% +% gamma = 1.4; +% gammam1 = gamma-1; +% p = gammam1 * (rhoE - 0.5 * rho * uv^2); +% H = E+p*rhoinv; %enthalpy +% a = sqrt(gamma * p / rho); +% un = uv*n; %variable in case we u * n; dont think it's necessary for 1d +% +% % From Toro p. 90 +% K = [1.0, 1.0, 1.0; +% un-a, un, un+a; +% H - un * a, 0.5 * un^2, H + un*a]; +% +% % From Toro p. 276 +% Kinv = (gammam1)/(2*a^2) * [0.5 * un^2 + (un * a)/(gammam1), -un - a/gammam1, 1.0;... +% 2*a^2/gammam1 - un^2, 2*un, -2.0;... +% 0.5*un^2 - un*a/gammam1, a/gammam1 - un, 1.0]; +% +% % Taken from cylinder pdemodel; picks sign of eigenvalue +% Lambda = [tanh(1e3 * (un - a)), 0, 0; +% 0, tanh(1e3*un), 0; +% 0, 0, tanh(1e3*(un+a))]; +% A = K * Lambda * Kinv; +% +% Minf = eta(4); +% uinf = [1.0; 1.0; 1.0/(gamma * gammam1 * Minf^2) + 0.5]; + uin = uinflow(u, mu, eta); +% uin = 0.5 * ((u + uinf) + A * (u - uinf)); ub(:,1) = uin; uout = uoutflow(u, mu, eta); @@ -58,33 +93,57 @@ nspecies = 1; fb = sym(zeros(nspecies+2, 2)); - uin = uinflow(u, mu, eta); - fin = flux(uin, q, w, v, x, t, mu, eta); - fb(:,1) = fin *n(1) + tau(1)*(uin-uhat); - - uout = uoutflow(u, mu, eta); - fout = flux(uout, q, w, v, x, t, mu, eta); - fb(:,2) = fout*n(1) + tau(1)*(uout-uhat); +% uin = uinflow(u, mu, eta); +% fin = flux(uin, q, w, v, x, t, mu, eta); + f = flux(u, q, w, v, x, t, mu, eta); + fb(:,1) = f *n(1) + tau(1)*(u-uhat); + fb(:,2) = f *n(1) + tau(1)*(u-uhat); +% uout = uoutflow(u, mu, eta); +% fout = flux(uout, q, w, v, x, t, mu, eta); +% fb(:,2) = fout*n(1) + tau(1)*(uout-uhat); end function u0 = initu(x, mu, eta) nspecies = 1; - u0 = uinflow(mu,mu,eta); +% u0 = uinflow(mu,mu,eta); % u0 = uoutflow(mu,mu,eta); +% u0 = mu(1:3); + gamma = 1.4; + gammam1 = gamma - 1.0; + Minf = eta(4); + u0 = [1.0; 1.0; 1.0/(gamma * gammam1 * Minf^2) + 0.5]; end function uin = uinflow(u, mu, eta) nspecies = 1; + % Typical subsonic inflow: given u, rho, grab E - rho = mu(1); - rhou = mu(2); - rhoE = u(3); - -% + uin = [1; 1; u(3)]; + % Equivalent to nonequil formulation; given u, T, X=1 % rho = u(1); % rhou = u(2); % rhoE = u(3); % +% rhoinv = 1.0/rho; +% uv = rhou * rhoinv; +% gamma = 1.4; +% gammam1 = gamma - 1.0; +% +% p = gammam1 * (rhoE - 0.5 * rho * uv^2); +% +% T_in = eta(5); +% u_in = eta(2); +% +% rho_in = p / (gammam1 * T_in); +% rhou_in = rho_in * u_in; +% rhoE_in = p/gammam1 + 0.5 * rho_in * u_in^2; +% +% uin = [rho_in; rhou_in; rhoE_in]; + +% rhou = eta(2)*rho; +% % rhou = eta(2)*rho; +% rhoE = u(3); +% % rhoinv = 1.0 / rho; % uv = rhou * rhoinv; %velocity % E = rhoE * rhoinv; %energy @@ -93,14 +152,8 @@ % gammam1 = gamma-1; % p = gammam1 * (rhoE - 0.5 * rho * uv^2); % -% uvin = mu(2); -% Minf = eta(4); -% Tin = eta(5); -% -% rho = 1.4 * Minf^2 * p/Tin; -% rhou = uvin * rho; -% rhoE = p/gammam1 + 0.5 * rho * uvin^2; - uin = [rho; rhou; rhoE]; +% uv_inflow = mu(2); +% uin = [rho; rhou; rhoE]; end function uout = uoutflow(u, mu, eta) diff --git a/Applications/Hypersonics/1DShockTube/pdemodel_inflow_dae.m b/Applications/Hypersonics/1DShockTube/pdemodel_inflow_dae.m new file mode 100644 index 00000000..36b0569e --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow_dae.m @@ -0,0 +1,194 @@ + +function pde = pdemodel_inflow + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.sourcew = @sourcew; + pde.initw = @initw; +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + m = sym(ones(nspecies + 2, 1)); +% m = sym([1.0; 1.0; 1.0; 1.0; 1.0]); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + alpha = 1.0e3; + rmin = 0.0; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % % Mutation outputs + % rho_inf = eta(1); + % u_inf = eta(2); + + p = w(nspecies + 1); %pressure, assume nondimensionalized + + H = E+p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + f(ispecies) = rho_i(ispecies) * uv; + end + f(nspecies + 1) = rhou * uv + p; + f(nspecies + 2) = rhou * H; +% f(nspecies + 2) = (rhoE + p)*u; +end + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + s = sym(zeros(nspecies + 2,1)); + omega_i = sym(zeros(nspecies,1)); + + for ispecies = 1:nspecies + s(ispecies) = w(ispecies); + end +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ub = sym(zeros(nspecies+2, 2)); +% [rho_pre, rhou_pre, rhoE_pre, rho_post, rhou_postshock, rhoE_post] +% rhoL = mu(1:nspecies); +% rhouL = mu(nspecies+1); +% rhoEL = mu(nspecies+2); +% +% rho_post = mu(nspecies+3:2*nspecies+2); +% rhou_post = mu(2*nspecies+3); +% rhoE_post = mu(2*nspecies+4); + +% ub(:,1) = [rhoL(:); rhouL; rhoEL]; + +% ub(:,1) = mu(8:14); +% ub(:,1) = mu(1:nspecies+2); +% ub(:,1) = u(:); +% p_outflow = mu(nspecies+3); +% ub(:,2) = [u(1:nspecies);u(nspecies+1);p_outflow]; +%%%%%% C-CODE MANUALLY WRITTEN + ub(:,1) = u(:); + ub(:,2) = u(:); +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + +%%%%% C-CODE MANUALLY WRITTEN + fb(:,1) = f*n(1) + tau(1)*(u-uhat); + fb(:,2) = f*n(1) + tau(1)*(u-uhat); +end + +function u0 = initu(x, mu, eta) + % To be manually modified + nspecies = 5; + % TODO: +% u0 = sym(zeros(nspecies+2,1)); +% +% rho_pre = mu(1:nspecies); +% rhou_pre = mu(nspecies+1); +% rhoE_pre = mu(nspecies+2); +% +% rho_post = mu(nspecies+3:2*nspecies+2); +% rhou_post = mu(2*nspecies+3); +% rhoE_post = mu(2*nspecies+4); +% u0 = mu(nspecies + 3:2*nspecies + 2); + % u0 = mu(1:nspecies+2); + +% pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow] +% 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 + + rho_post_vec = mu(1:nspecies); + rhou_post = mu(nspecies + 1); + rhoE_post = mu(nspecies + 2); + + rho_inf = eta(1); + u_inf = eta(2); + rhoe_inf = eta(3); + + rho_equil_vec = mu(nspecies+3:2*nspecies+2); + rhou_equil = mu(2*nspecies + 3); + rhoE_equil = mu(2*nspecies + 4); + + rho_equil_vec_nondim = rho_equil_vec/rho_inf; + rhou_equil_nondim = rhou_equil/(u_inf * rho_inf); + rhoE_equil_nondim = rhoE_equil/rhoe_inf; + + rho_post_vec_nondim = rho_post_vec/rho_inf; + rhou_post_nondim = rhou_post/(u_inf * rho_inf); + rhoE_post_nondim = rhoE_post/rhoe_inf; + +% u0 = [rho_equil_vec_nondim(:); rhou_equil_nondim; rhoE_equil_nondim]; +% u0 = [rho_post_vec_nondim(:); rhou_post_nondim; rhoE_post_nondim]; +% for i = 1:nspecies +% u0(i) = smoothstep(x, rho_post(i), rho_pre(i), 1/1000); +% end + stepsize = 0.01; + u0(1) = smoothstep_up(x-stepsize, rho_post_vec(1)/rho_inf, rho_equil_vec_nondim(1), stepsize); + u0(2) = smoothstep_up(x-stepsize, rho_post_vec(2)/rho_inf, rho_equil_vec_nondim(2), stepsize); + u0(3) = smoothstep_up(x-stepsize, rho_post_vec(3)/rho_inf, rho_equil_vec_nondim(3), stepsize); + u0(4) = smoothstep_down(x-stepsize, rho_post_vec(4)/rho_inf, rho_equil_vec_nondim(4), stepsize); + u0(5) = smoothstep_down(x-stepsize, rho_post_vec(5)/rho_inf, rho_equil_vec_nondim(5), stepsize); + u0(nspecies+1) = smoothstep_down(x-stepsize, rhou_post/(rho_inf*u_inf), rhou_equil_nondim, stepsize); + u0(nspecies+2) = smoothstep_down(x-stepsize, rhoE_post/rhoe_inf, rhoE_equil_nondim, stepsize); +% u0 = [rhoL(:) + rhoR(:); rhouL + rhouR; rhoEL + rhoER]; +end + +function sw = sourcew(u, q, w, v, x, t, mu, eta) + % MODIFIED MANUALLY + nspecies = 5; + + sw = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = u(ispecies); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + u = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + % Mutation inputs + rhoe = rhoE - 0.5 * rho * u^2; + for i = 1:nspecies + sw(i) = rho_i(i); + end + sw(nspecies + 1) = rhoe; +end + +function w0 = initw(x, mu, eta) + % MODIFIED MANUALLY: could be specified but it's a nice test of the initial conditions. + nspecies = 5; + w0 = sym(zeros(nspecies + 1,1)); +end \ No newline at end of file diff --git a/Applications/Hypersonics/1DShockTube/ploteuler.m b/Applications/Hypersonics/1DShockTube/ploteuler.m new file mode 100644 index 00000000..3d7e75cb --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/ploteuler.m @@ -0,0 +1,43 @@ +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +for ti = pde.soltime +% ti = nt; +sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +% sol = getsolution(['dataout/out'],dmd,master.npe); +nspecies=1; +dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); +for i = 1:nspecies + rho = sol(:,i,:); +% subplot(1,3,1) +% hold on +% plot(dgnodes(:),u(:),'LineWidth',1.3) +end +rhou = sol(:,nspecies+1,:); +% subplot(1,3,2) +% plot(dgnodes(:),u(:),'LineWidth',1.3); + +rhoE = sol(:,nspecies+2,:); + +% u = rhou./rho; +% subplot(1,3,3) +p = eulereval(sol,'p',1.4,0.55); +% p = rho; + +u = rhou(:)./rho(:); +figure(1); +subplot(1,3,1); plot(dgnodes(:),rho(:),'LineWidth',1.3); title("rho") +subplot(1,3,2); plot(dgnodes(:),rhou(:),'LineWidth',1.3) ; title("rho u") +subplot(1,3,3); plot(dgnodes(:),p(:),'LineWidth',1.3) ; title("p") + +gamma=1.4; +a = sqrt(gamma * p ./ rho); +figure(2); +plot(dgnodes(:),u(:) + a(:),dgnodes(:),u(:), dgnodes(:),u(:)-a(:),"LineWidth",1.3) +legend("u+a","u","u-a") + +drawnow; +% waitforbuttonpress; +end +% plot + + diff --git a/Applications/Hypersonics/1DShockTube/plotnonequil.m b/Applications/Hypersonics/1DShockTube/plotnonequil.m index 219918f5..11d24f7c 100644 --- a/Applications/Hypersonics/1DShockTube/plotnonequil.m +++ b/Applications/Hypersonics/1DShockTube/plotnonequil.m @@ -19,7 +19,7 @@ % plot(dgnodes(:),u(:)./rho(:),'LineWidth',1.3); % -plot(dgnodes(:),u(:),'LineWidth',1.3); +plot(dgnodes(:),rho(:),'LineWidth',1.3); set(gca, 'Xscale','log'); % waitforbuttonpress end diff --git a/Applications/Hypersonics/1DShockTube/posterplots.m b/Applications/Hypersonics/1DShockTube/posterplots.m new file mode 100644 index 00000000..4329215e --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/posterplots.m @@ -0,0 +1,61 @@ +figure(10) +ti = 129000; + +dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); +sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +rho = sum(sol(:,1:5,:),2); +Y1 = sol(:,1,:)./rho; +Y2 = sol(:,2,:)./rho; +Y3 = sol(:,3,:)./rho; +Y4 = sol(:,4,:)./rho; +Y5 = sol(:,5,:)./rho; +cgsol = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +Pout = cgsol(:,1,:); +Tout = cgsol(:,2,:); + + +subplot(1,3,1) +hold on +plot(dgnodes(:),Y1(:),'b','LineWidth',1.3); +plot(dgnodes(:),Y2(:),'r','LineWidth',1.3); +plot(dgnodes(:),Y3(:),'g','LineWidth',1.3); +plot(dgnodes(:),Y4(:),'k','LineWidth',1.3); +plot(dgnodes(:),Y5(:),'m','LineWidth',1.3); + +scatter(xY1true,Y1true2,'bo','LineWidth',1.3) +scatter(xY2true,Y2true2,'ro','LineWidth',1.3) +scatter(xY3true,Y3true2,'go','LineWidth',1.3) +scatter(xY4true,Y4true2,'ko','LineWidth',1.3) +scatter(xY5true,Y5true2,'mo','LineWidth',1.3) +set(gca,'Xscale','log'); +xlim([3e-5, 1.0]) +ylabel("Y_i") +xlabel("x (m)") +title("Mass Fractions") +legend("Y_N","Y_O","Y_{NO}","Y_{N2}","Y_{O2}") +grid on + +subplot(1,3,2) +hold on +plot(dgnodes(:),Tout(:),'b','LineWidth',1.3) +scatter(xTtrue,Ttrue2,'bo','LineWidth',1.3) +set(gca,'Xscale','log'); +xlim([3e-5, 1.0]) +ylabel("T (K)") +xlabel("x (m)") +title("Temperature") +legend("Temperature", "Reference Temperature") +grid on + +subplot(1,3,3) +hold on +plot(dgnodes(:),Pout(:),'b','LineWidth',1.3) +scatter(xPtrue,Ptrue2,'bo','LineWidth',1.3) +set(gca,'Xscale','log'); +xlim([3e-5, 1.0]) +title("Pressure") +xlabel("x (m)") +legend("Pressure", "Reference Pressure") +ylabel("P (Pa)") +grid on + diff --git a/Applications/Hypersonics/1DShockTube/shockingoutput.m b/Applications/Hypersonics/1DShockTube/shockingoutput.m new file mode 100644 index 00000000..c5a87402 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/shockingoutput.m @@ -0,0 +1,171 @@ +truesol = [0 7.63572058617923e-79 4.00112645470761e-40 2.69730597275507e-16 0.76708248854242 0.23291751145758 541.521447418662 6539.17131979989 +5.6251337887501e-07 4.173558440077e-08 7.73208046394881e-05 5.39462447166474e-09 0.767082444288651 0.2328401877765 541.474005345285 6538.23148525277 +1.07717930786742e-06 8.45197159873143e-08 0.000147989830645281 2.07769960299033e-08 0.767082394324104 0.232769510548538 541.430624646736 6537.37237058243 +4.16517488182185e-06 4.29282272564093e-07 0.00057049937286549 3.15790676402885e-07 0.767081911850612 0.232346843703581 541.170871963506 6532.2333906941 +2.26048848172304e-05 5.41078579813672e-06 0.00304106295327731 9.2888055964109e-06 0.767072741787823 0.22987149566741 539.638666237506 6502.09721832818 +3.99759747138305e-05 1.41272696603035e-05 0.00528967007365342 2.89450182270279e-05 0.767054849880516 0.227612407757779 538.224552967614 6474.54410276265 +6.95222034128451e-05 3.61230439590319e-05 0.00895038220558306 8.67834215077949e-05 0.767005855423841 0.223920855904819 535.883290407702 6429.44829790148 +9.65297546591921e-05 6.22983109561288e-05 0.0121290741748653 0.000165600207709711 0.766942888868429 0.22070013843777 533.811856886102 6390.06446610747 +0.000125998751851393 9.56187588714485e-05 0.0154298691663568 0.000278447828232686 0.7668568917059 0.217339172540391 531.623933977515 6348.96119848303 +0.000154126806642963 0.000130673758413209 0.0184299950334084 0.000410782839764054 0.766760063373402 0.214268484994781 529.603388076634 6311.43162088212 +0.000179009638375753 0.000163468560298718 0.0209704941674531 0.000546643403896703 0.766663849527934 0.211655544340185 527.86910857828 6279.53289538736 +0.000212784995783498 0.000209608669861088 0.0242611858619315 0.000757282431063117 0.766519384155781 0.208252538881135 525.591596159442 6238.06324649447 +0.000248206555172114 0.000258930811878758 0.0275323941322354 0.00100798857124049 0.76635303361975 0.20484765286466 523.293437227967 6196.68083800701 +0.000284431447549918 0.000309408733744928 0.030703430742684 0.00129291036042877 0.766169555607081 0.201524694555835 521.033824519338 6156.42563502817 +0.00032205899741347 0.000361128211849542 0.0338263476592886 0.00161623707499253 0.765966908807769 0.198229378245875 518.778443387181 6116.65572954171 +0.000360806461761541 0.000413056183597653 0.0368755102123901 0.00197509239789273 0.765747468935065 0.194988872270831 516.548034730157 6077.71263003011 +0.000400774433188117 0.000464788655661362 0.0398583563484659 0.00236951157493879 0.765511623529726 0.191795719890987 514.339497348539 6039.51554688702 +0.000441975194864957 0.00051588775450633 0.0427750225861072 0.00279861090569015 0.76526022297231 0.188650255781164 512.154817007329 6002.07469414451 +0.000478743074984306 0.000559445152601696 0.0452530710714098 0.00319834133626001 0.765030073373901 0.185959069065605 510.279364583779 5970.19692796907 +0.000522244035841481 0.000608419142753888 0.0480449322621867 0.00368891017337381 0.76475210426173 0.182905634159732 508.145333989408 5934.21103515459 +0.000561325732588657 0.00065004923946732 0.0504335554369227 0.00414364411193879 0.764498206597512 0.180274544613932 506.301938088619 5903.36495401933 +0.000607424430764412 0.000696325458337873 0.0531169767639642 0.00469436591257311 0.764194856148903 0.177297475716004 504.211794892959 5868.65023030762 +0.000656856163823857 0.000742663697777831 0.055846002499085 0.00529916133968602 0.763866202376657 0.174245970086574 502.065334671179 5833.28008147184 +0.000703636053764878 0.000783536468995098 0.0582986881376117 0.0058824467329135 0.763553054850729 0.171482273809527 500.118376778458 5801.43608093175 +0.000754384958804555 0.000824792061739838 0.0608281946361249 0.00652462332898596 0.763212034379236 0.168610355593688 498.09274719002 5768.54012134146 +0.000801341908510863 0.000860288033273112 0.0630564427912025 0.00712545427955148 0.762896073473063 0.166061741422686 496.293473514042 5739.51615475034 +0.000855238993507598 0.000898086043939005 0.0654914905584088 0.00782071363320332 0.762533731813313 0.163255977950913 494.311219404705 5707.74910154842 +0.000909856109005176 0.000933426412312703 0.0678359061947619 0.00852924366447403 0.762167653108767 0.160533770619459 492.386904624171 5677.11507716809 +0.000967310150429555 0.000967657118439358 0.0701790841349657 0.00927676646207513 0.761784482434795 0.157792009849502 490.44799659236 5646.44799578783 +0.00102685152621003 0.00100023079102715 0.0724850494734757 0.0100517927868599 0.761390130283053 0.15507279666536 488.52454519503 5616.21878531292 +0.00108724523527128 0.00103053793144152 0.0747070864283002 0.0108364418868087 0.760993552799333 0.15243238095389 486.656600303881 5587.04244262511 +0.00115085237933082 0.00105977261814031 0.0769303121633114 0.0116595161068839 0.760580111112113 0.149770287999321 484.773286655642 5557.80251261046 +0.00121480451782262 0.00108666708084131 0.0790542465033243 0.0124821045388995 0.76016923641237 0.147207745464335 482.960537474294 5529.82221792199 +0.00128279958081907 0.00111279875544531 0.0811998727426981 0.0133498319020793 0.759738053869514 0.144599442730034 481.115692845012 5501.50862013083 +0.00135085359915754 0.00113667937951893 0.0832404666541 0.014210011762066 0.759312645514582 0.142100196689502 479.34836184997 5474.53515139439 +0.00142359033943608 0.00115996199763839 0.0853127881766995 0.0151190736422485 0.758865017278833 0.139543158904349 477.540639612529 5447.09479916435 +0.0014952713257125 0.00118088915806343 0.0872539122419655 0.0160036087482855 0.758431193478401 0.137130396373054 475.835431690664 5421.34672513205 +0.00157308795091833 0.00120159564669924 0.0892567110415159 0.0169502925990447 0.757968579621182 0.134622821091325 474.063804458254 5394.73328900722 +0.00164974041529879 0.00122017563085941 0.091131657468171 0.0178683621739486 0.75752144927177 0.13225835545502 472.393881647336 5369.77376075615 +0.00173306682841582 0.00123856553763616 0.093068550496983 0.0188495440991724 0.757045048464808 0.129798291401168 470.657083968394 5343.942267762 +0.00181610543373748 0.00125523664276673 0.0949021717515923 0.0198095088475061 0.756580270533383 0.12745281222452 469.001814966492 5319.44233381261 +0.00190544273884478 0.00127154766132081 0.0967759841499713 0.0208221364984098 0.756091269904452 0.125039061785613 467.299013888787 5294.35794964663 +0.00199554350308447 0.00128649714565344 0.0985703868406212 0.021822122579108 0.755609531832582 0.122711461601802 465.657612792091 5270.29038463572 +0.00209143250367357 0.00130095399777379 0.100383448041958 0.0228628545869808 0.755109266394385 0.120343476978669 463.98834630158 5245.92534593537 +0.00218925619840642 0.00131434867271425 0.102138839295206 0.0238997524926352 0.754611852873439 0.118035206665772 462.36175057122 5222.28901223006 +0.00229229176052128 0.00132716287402877 0.103893345544527 0.024965048871339 0.754101763558478 0.115712679151393 460.725648170577 5198.61806663039 +0.00239863818851422 0.00133917128282307 0.105611075907359 0.0260361061776333 0.753589790863353 0.113423855768598 459.113778537211 5175.39739512678 +0.00250948049750108 0.00135053779728586 0.107309130738322 0.0271222207164396 0.753071431420429 0.111146679327291 457.510542566142 5152.39740479087 +0.00262449270136288 0.00136124929428171 0.108979828299643 0.0282172840908084 0.752549549722515 0.108892088592519 455.923570445808 5129.72351742644 +0.00274748190689732 0.0013716412686979 0.110672330241184 0.0293532298339292 0.752008903858384 0.106593894797572 454.306205497406 5106.70847175455 +0.00287153605408677 0.00138115435995888 0.112289397971649 0.0304633059096597 0.751481212710997 0.104384929047503 452.751834687049 5084.67656915524 +0.00299562737114729 0.00138982185633247 0.113824089705818 0.0315389027586304 0.750970461892083 0.102276723786904 451.268465607936 5063.72865431176 +0.00312910835770902 0.00139831747972676 0.115390170480734 0.0326582481315897 0.750439461350174 0.100113802557542 449.746598389353 5042.31414603258 +0.00326779779646147 0.00140635033576829 0.116932176003084 0.0337813384985224 0.749907175430838 0.0979729597315538 448.240152390666 5021.19179454347 +0.00340943666314981 0.00141382542389434 0.118425002443 0.0348878129913393 0.749383203487788 0.0958901556537448 446.774320823643 5000.70897328899 +0.0035590413839202 0.00142102239405532 0.119919524070993 0.0360137460472524 0.748850426501088 0.0937952809863767 445.2996339479 4980.17041028207 +0.00371457014163609 0.00142783882716443 0.121391318216678 0.0371395137944322 0.748318107216745 0.0917232219447465 443.840499742765 4959.9138326556 +0.00387628006559775 0.00143429765651599 0.12284073422919 0.0382636432285836 0.747786910292628 0.089674414592848 442.397076373659 4939.93755353067 +0.004057418591538 0.00144086973467738 0.124375111501779 0.0394691522261018 0.747217612539503 0.0874972539977046 440.862297494981 4918.76272431151 +0.00422756031126005 0.0014464852432319 0.125738120614785 0.0405521450735719 0.74670646129266 0.0855567877755176 439.493367685307 4899.93140127447 +0.00440483652740208 0.00145183369418059 0.127084795662496 0.0416320648168134 0.746197011613372 0.0836342942129044 438.135975786236 4881.30852974904 +0.00459445492983253 0.00145705479024115 0.12844940194631 0.0427349515533303 0.745676968409395 0.0816816233004904 436.755884457017 4862.42315937536 +0.00479103734953171 0.00146198866264451 0.129788632527713 0.0438241157167144 0.745163618058766 0.0797616450339277 435.397279187628 4843.87807005017 +0.00499672007643454 0.00146669198595938 0.131114899073484 0.0449075733586353 0.744653162033397 0.0778576735482898 434.048136156978 4825.50556774204 +0.00521107990086632 0.00147115400398895 0.132422830091212 0.0459788204908571 0.744148647119227 0.0759785482944808 432.714474925448 4807.38437953114 +0.00542977789312759 0.0014752994764196 0.133686073226409 0.0470140516971844 0.743661260807845 0.0741633147919081 431.423839446114 4789.88409002045 +0.00566261919150895 0.00147931401985996 0.134959116671999 0.0480556726245395 0.743171022735083 0.0723348739482851 430.121157229517 4772.25450988465 +0.00590552551162699 0.00148311577080867 0.13621530683809 0.0490794838012217 0.742689310958891 0.0705327826307542 428.834254578191 4754.86984264046 +0.00615916850346046 0.00148671443797441 0.13745584832455 0.0500840378871797 0.742216791381784 0.0687566079682776 427.562532145699 4737.71854252344 +0.00642411001851729 0.00149011519117903 0.138681158331557 0.051067165501569 0.741754471490256 0.0670070894852063 426.306209629649 4720.80016082875 +0.00670100204582204 0.00149332366656853 0.139891900534 0.0520268171242044 0.741303302354108 0.0652846563208856 425.065267936494 4704.11103406136 +0.00698765151810667 0.00149631808874487 0.141077109762443 0.0529518646105578 0.740868500311911 0.0636062072261098 423.851603109851 4687.80747723149 +0.00729041929970544 0.00149916160300859 0.142260684468636 0.0538582499038072 0.740442560597643 0.0619393434266719 422.641428145331 4671.5665825792 +0.00760455369438398 0.00150180645951875 0.14342152858719 0.0547270359897283 0.740034370666309 0.0603152582970204 421.457006925669 4655.68383439602 +0.00793652811707267 0.00150430320271909 0.144581035067414 0.0555713603403258 0.739637747466104 0.0587055539232032 420.277226606783 4639.87275930923 +0.00828118671992991 0.00150661034967335 0.145718707314838 0.0563734106148375 0.739261047193086 0.0571402245273316 419.123657355522 4624.41911100162 +0.00864624144393353 0.00150877534268262 0.146857337565359 0.0571462246146282 0.738898136423356 0.0555895260537408 417.973931255432 4609.01988861962 +0.00902610139873007 0.00151076173025752 0.147976715770263 0.0578729836731596 0.73855690247928 0.0540826363468068 416.849207181031 4593.95517700042 +0.00942889110824721 0.00151260776454411 0.149097950435279 0.058564202702718 0.738232398799337 0.0525928402978878 415.729046908142 4578.94786698049 +0.00984953268894109 0.00151428674347318 0.150203840295331 0.0592059450920569 0.737931157627229 0.0511447702416753 414.63142806858 4564.23547277472 +0.0102956932494397 0.00151582514812381 0.151311501536418 0.0598047989585692 0.737650077181057 0.0497177971755974 413.540160402266 4549.59761601935 +0.0107638362322577 0.00151720767013054 0.152408771781869 0.0603506236693053 0.737393906366808 0.0483294905116525 412.468060732832 4535.20282727191 +0.0112602459169088 0.00151844908532541 0.153507085772998 0.0608456249744331 0.737161600775311 0.0469672393916981 411.404777127545 4520.90874592507 +0.0117836231285623 0.0015195442596828 0.154599916666425 0.0612831500165877 0.736956271061712 0.0456411179953575 410.357486519305 4506.8084404537 +0.0123386751992987 0.00152049987916325 0.15569350048332 0.0616621199270828 0.736778414150649 0.0443454655595487 409.321045457716 4492.82931834896 +0.012926942583963 0.00152131563157838 0.156786870680105 0.0619783772055156 0.736629971055067 0.0430834654274988 408.297245419149 4478.99213816406 +0.013549701231491 0.00152199519363114 0.157878644833459 0.0622281276364169 0.736512709219393 0.0418585231168643 407.288162242617 4465.32180050931 +0.0142127393094823 0.00152254329088641 0.158974852434663 0.0624092249288012 0.736427625796146 0.0406657535492674 406.289029967081 4451.75057866159 +0.0149184358444399 0.0015229613298939 0.160074869554165 0.0625178724643548 0.736376491621545 0.0395078050298055 405.301248152781 4438.29431543688 +0.0156700814038343 0.00152325573418552 0.16117928819768 0.0625508484009525 0.736360804212126 0.0383858034548196 404.325018704423 4424.95290997426 +0.0164718930887032 0.00152342960493765 0.162289609510954 0.062505211802832 0.736381933281073 0.0372998157999679 403.359684727805 4411.71480396447 +0.017328300483922 0.00152348772795328 0.163407045032374 0.0623782399168503 0.736441145010367 0.0362500823122203 402.404783422665 4398.57140044095 +0.0182444629452085 0.00152343944202223 0.164533152839151 0.0621674704618201 0.736539579441974 0.0352363578147972 401.459474079414 4385.50928711831 +0.0192219978769817 0.00152329170068693 0.165664886190012 0.0618721456681782 0.73667758334546 0.0342620930954276 400.526599291143 4372.56668442798 +0.0202668815582813 0.00152305350902423 0.166804215110026 0.0614914176786849 0.73685554349134 0.0333257702106896 399.604594361348 4359.72170708958 +0.0213838264386107 0.0015227395241226 0.16795113032451 0.0610256654080416 0.737073268347005 0.0324271963960857 398.693352283848 4346.97343728189 +0.0225733946477036 0.00152236424743461 0.169101418109267 0.0604783779730236 0.737329114708441 0.0315687249615982 397.795803584104 4334.36465459991 +0.0238417378423661 0.00152194218575339 0.17025644733377 0.059851896257065 0.737621975355974 0.0307477388672026 396.910190604083 4321.87358565096 +0.0251923058367904 0.00152149404650685 0.171414727195445 0.0591508604130875 0.737949663581598 0.0299632547631279 396.036766087288 4309.50762045247 +0.0266207466369561 0.00152104351002456 0.172568645803395 0.0583852329437319 0.738307505257715 0.0292175724848981 395.180054257231 4297.33593795658 +0.0281486032402485 0.00152060503900172 0.173731123747975 0.0575518962734883 0.738696941190558 0.0284994337487416 394.329210389351 4285.20995215838 +0.0297744671338046 0.00152020495634788 0.174895851418063 0.0566607315667578 0.739113332578238 0.0278098794803571 393.487594879204 4273.18327623205 +0.0315208035851738 0.0015198686227098 0.176073039544594 0.0557094211106381 0.739557735957101 0.0271399347647211 392.646520211382 4261.13786024326 +0.0333616190092844 0.00151962599871856 0.177240168235972 0.0547225822739198 0.740018630099759 0.0264989933913941 391.82059204919 4249.28958917595 +0.0353170412849309 0.00151950077160149 0.178405971879066 0.0536998938132925 0.740496141273782 0.0258784922620212 391.002020394227 4237.53374725115 +0.0373881651785357 0.00151952371619352 0.179566393412239 0.0526513336819298 0.740985581044837 0.0252771681445648 390.1921662751 4225.89648654462 +0.039471508494268 0.00151970580980353 0.180664362708102 0.0516362914360922 0.741459215682651 0.0247204243631153 389.429217626117 4214.93266784966 +0.0417444384418678 0.00152008104570622 0.181790893596982 0.0505764992988941 0.741953546207513 0.024158979850669 388.64863870964 4203.72011415359 +0.0441200278950371 0.00152066247957298 0.182896500338441 0.0495225712552438 0.742444933204365 0.0236153327221408 387.883723923761 4192.74175650494 +0.046586375245575 0.00152146225764473 0.183974208525649 0.0484856576783393 0.742928159587562 0.0230905119505696 387.138345931883 4182.05654105375 +0.0491241295010279 0.00152247690886132 0.185015583564744 0.0474776234076601 0.743397690379409 0.02258662573909 386.417609166733 4171.73972581049 +0.0517375075314231 0.00152370887745501 0.186022998090566 0.0464990654073695 0.743853244475738 0.0221009831486362 385.719347414276 4161.76136139669 +0.0544278931883806 0.00152515976559351 0.186997407397264 0.045551151272905 0.744294275246569 0.0216320063174324 385.042544015388 4152.10729586741 +0.0571947267095691 0.00152682375170508 0.187939025523559 0.0446351619594094 0.744720190569909 0.0211787981951816 384.386840374476 4142.77220801468 +0.0600458694734059 0.00152870068037349 0.188850749364555 0.0437492878255468 0.745131835332856 0.0207394267964335 383.750106595491 4133.72521187083 +0.0629868542938234 0.00153079042130058 0.189734235243943 0.0428925608204641 0.745529661547087 0.020312751966969 383.131142250715 4124.94847983524 +0.06602092770237 0.00153308722436218 0.190590208671101 0.0420646523430549 0.74591382835211 0.0198982234091366 382.529457752532 4116.43410016766 +0.0691619877366552 0.00153559351002557 0.191422020349947 0.0412625074254049 0.746285759371462 0.0194941193429246 381.942747959045 4108.14843260347 +0.0724160902504414 0.00153830631032991 0.192230368310353 0.0404855012251299 0.746645749246461 0.0191000749074909 381.370590329933 4100.08448464876 +0.0757845977194072 0.00154121838554554 0.193014707186565 0.0397340898549038 0.746993592305679 0.0187163922670708 380.813466479417 4092.24793054397 +0.0792884592026284 0.00154433551171054 0.193778744829915 0.0390045973449474 0.747330998697706 0.0183413236154856 380.268849946448 4084.60214545838 +0.0829349283480123 0.00154765237285264 0.194522524163334 0.0382968217435457 0.747658068008581 0.0179749337114516 379.736813285915 4077.14714345273 +0.0867338305554587 0.00155116491430033 0.195246440086344 0.0376101904860175 0.747975071563354 0.0176171329497483 379.2171842404 4069.87949999739 +0.0906920616221346 0.00155486578459891 0.195950160895839 0.0369447937335877 0.748281974626665 0.0172682049590747 378.710316512641 4062.80314563785 +0.0948315906959396 0.00155875707148987 0.196635722866928 0.0362984861270909 0.748579776553884 0.0169272573803716 378.214860688459 4055.89826708405 +0.0991660047532154 0.00156283256488698 0.197303209489784 0.0356709737856624 0.748868620737242 0.016594363422189 377.730864236792 4049.16462836407 +0.103711460627051 0.00156708614976147 0.197952811744482 0.0350618640360025 0.749148696589734 0.0162695414797843 377.258296047231 4042.60092064376 +0.108487615467517 0.00157151340999558 0.198584861200504 0.0344706364788953 0.749420251447274 0.0159527374630962 376.797018524219 4036.20439054692 +0.113548216086819 0.00157613574075713 0.199203309293389 0.0338934088312656 0.749685076145352 0.0156420699890016 376.344239727712 4029.93559217149 +0.118868211697119 0.0015808986063973 0.199802005658159 0.0333357435297704 0.749940628701524 0.0153407235039137 375.904558961203 4023.85744783537 +0.1244977516856 0.00158581246758911 0.200383692170132 0.0327949095112158 0.750188173501995 0.0150474123488341 375.476068142746 4017.94276957722 +0.130480337031099 0.0015908752758629 0.200949256631809 0.0322699258933472 0.750428170466247 0.0147617717324995 375.058204847627 4012.18308878384 +0.136866827723954 0.00159608447086895 0.201499342953483 0.0317600514791114 0.750660968141773 0.0144835529545289 374.650577097337 4006.5723531377 +0.143713571797463 0.0016014316669438 0.202034081162681 0.0312650355289465 0.750886691958232 0.0142127596829626 374.253170843027 4001.10974867584 +0.151121058894858 0.00160692941691246 0.202555641092618 0.0307827598624874 0.751106318118981 0.0139483515087664 373.86444668674 3995.77356351643 +0.159200279569168 0.00161257976029663 0.20306484234965 0.0303123694285412 0.751320243718193 0.0136899647430835 373.48385475089 3990.55577628113 +0.168121923688797 0.00161840058586903 0.203563730995688 0.0298518877558729 0.751529373474155 0.0134366071881798 373.109916976306 3985.43571810455 +0.17815400955948 0.0016244311438261 0.204055716883228 0.0293980929568539 0.751735172097978 0.0131865869178786 372.740110804866 3980.37855915158 +0.189738091715709 0.00163074393341157 0.204546026080807 0.0289460960613202 0.751939849237663 0.0129372846865635 372.370511340248 3975.33050960649 +0.203862873697898 0.00163755333828847 0.205049316604876 0.0284823348793341 0.75214952127315 0.0126812739041157 371.990010292505 3970.14011417209 +0.218588461057262 0.00164370122714851 0.205482932494441 0.0280828969972329 0.752329829024418 0.0124606402565241 371.661256384404 3965.66095245202 +0.233108067515202 0.00164891172257631 0.205836227126785 0.027757503435533 0.752476510644282 0.0122808470705882 371.392749226379 3962.00631793271 +0.247852433984784 0.00165343915690884 0.206133332662421 0.027483881614127 0.75259970853133 0.0121296380349772 371.166484960544 3958.92922473733 +0.262819408611887 0.00165734743417949 0.206382838025764 0.027254101295847 0.752703060577262 0.0120026526667115 370.9761398946 3956.34244341594 +0.278136580027644 0.00166072736499647 0.206593653079451 0.0270599488380728 0.752790310059475 0.0118953606577695 370.815071945927 3954.15484237005 +0.293904295515494 0.00166364642061005 0.206772167813232 0.0268955371469163 0.75286413757321 0.0118045110457968 370.678508579579 3952.30099755146 +0.310219930163974 0.00166616020801433 0.206923348050918 0.0267562933622582 0.752926622100101 0.0117275762784734 370.562730066981 3950.72998213361 +0.327181130174946 0.00166831572871227 0.207051156579486 0.0266385694236209 0.752979419535345 0.0116625387326 370.464759322022 3949.40108756063 +0.344890036741919 0.00167015408345455 0.207158841505272 0.0265393741957667 0.753023885025421 0.0116077451898508 370.382148528655 3948.28088443202 +0.363413324389482 0.00167170776729323 0.20724893698494 0.0264563762083694 0.753061074394164 0.0115619046449983 370.312985532036 3947.34327604184 +0.382960658765674 0.0016730164424191 0.207324186467807 0.0263870511334208 0.753092126323291 0.0115236196328269 370.255186824284 3946.5598978261 +0.403626113938298 0.00167410546188476 0.207386367465682 0.0263297631365157 0.75311777905921 0.011491984876472 370.207403544768 3945.9123814219 +0.425572273421374 0.00167500191821087 0.207437258388534 0.0262828750158986 0.753138769747133 0.0114660949299877 370.168281025103 3945.38230688887 +0.448989424625179 0.00167573060882231 0.207478431020516 0.0262449395686092 0.753155749136864 0.0114451496649534 370.136619448784 3944.95337343051 +0.474105796267415 0.00167631433878484 0.207511288290609 0.0262146648732719 0.753169297485884 0.0114284350112144 370.111345903589 3944.61101492564 +0.501200060263093 0.00167677406675365 0.207537088048273 0.0261908924487298 0.75317993460885 0.0114153108271582 370.091496919627 3944.34215901412 +0.530618824292029 0.00167712899753681 0.207556960069015 0.0261725816421765 0.753188127072569 0.0114052022184682 370.076206010987 3944.13505505978 +0.562801817956262 0.00167739663939191 0.207571918191156 0.0261587984947584 0.753194293336184 0.0113975933382744 370.064694807605 3943.9791515736 +0.5983193568983 0.00167759283918591 0.207582868962469 0.026148707814028 0.75319880741656 0.0113920229675223 370.056266752379 3943.86500901838 +0.637930052556503 0.00167773180381891 0.207590617754351 0.0261415675712498 0.753202001482161 0.0113880813881837 370.050302653455 3943.78423823197 +0.682673280128359 0.00167782611361847 0.207595873046558 0.0261367249766862 0.753204167671703 0.0113854081911998 370.046257571556 3943.7294573126 +0.734024496129632 0.0016778867321432 0.207599249440417 0.026133613719934 0.753205559372538 0.0113836907347333 370.043658629631 3943.69426128844 +0.794171367804767 0.00167792301566282 0.207601269838219 0.026131751973248 0.753206392143221 0.0113826630294141 370.042103421532 3943.67320012142 +0.866540332519906 0.00167794272521003 0.207602367161627 0.0261307408155198 0.753206844437132 0.0113821048602768 370.041258743931 3943.66176125211 +0.956893672215236 0.00167795204468117 0.207602885977512 0.0261302627385364 0.753207058281647 0.0113818409573889 370.040859377048 3943.65635292162 +1 0.0016779539501253 0.207602992050709 0.0261301649944192 0.753207102002676 0.0113817870018356 370.040777725356 3943.65524717381 ]; + +xtrue = truesol(:,1); +Y1true = truesol(:,2); +Y2true = truesol(:,3); +Y3true = truesol(:,4); diff --git a/src/Matlab/Gencode/runcode.m b/src/Matlab/Gencode/runcode.m index 48cbd479..04d26b5b 100644 --- a/src/Matlab/Gencode/runcode.m +++ b/src/Matlab/Gencode/runcode.m @@ -17,10 +17,11 @@ mpirun = app.mpirun; if app.platform == "cpu" if app.mpiprocs==1 - runstr = "!./app/serial" + mystr; + runstr = "./app/serial" + mystr; else - runstr = "!" + mpirun + " -np " + string(app.mpiprocs) + " ./app/mpi" + mystr; + runstr = mpirun + " -np " + string(app.mpiprocs) + " ./app/mpi" + mystr; end + runstr = "!source ~/.zprofile; " + runstr; eval(char(runstr)); elseif app.platform == "gpu" if app.mpiprocs==1 From bd7ba09dfd5226673d78b1ac9e7abe13143ed3df Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 4 Oct 2022 14:51:43 -0400 Subject: [PATCH 16/23] sensor checks + regularization fixes + prepare for 2d --- .../shocktests/app/mutationUtils.cpp | 92 +++++-- .../shocktests/app/opuAvfield_MPP.cpp | 168 +++++++++--- .../shocktests/app/opuFbou_MPP.cpp | 4 +- .../shocktests/app/opuFlux_MPP.cpp | 88 +++++-- .../shocktests/app/opuOutput_MPP.cpp | 39 ++- .../shocktests/app/opuOutput_MPP_sensors.cpp | 245 ++++++++++++++++++ .../shocktests/app/opuSource_MPP.cpp | 23 +- Applications/Hypersonics/shocktests/dlmax.m | 3 + .../Hypersonics/shocktests/getStates.py | 50 +++- Applications/Hypersonics/shocktests/pdeapp.m | 28 +- .../Hypersonics/shocktests/pdemodel.m | 156 +++++------ .../Hypersonics/shocktests/plotting.m | 131 ++++++---- .../shocktests/plotting_dT_check.m | 77 ++++++ .../Hypersonics/shocktests/sensor_outputs.m | 107 ++++++++ 14 files changed, 976 insertions(+), 235 deletions(-) create mode 100644 Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors.cpp create mode 100644 Applications/Hypersonics/shocktests/dlmax.m create mode 100644 Applications/Hypersonics/shocktests/plotting_dT_check.m create mode 100644 Applications/Hypersonics/shocktests/sensor_outputs.m diff --git a/Applications/Hypersonics/shocktests/app/mutationUtils.cpp b/Applications/Hypersonics/shocktests/app/mutationUtils.cpp index 534a5125..2b029a29 100644 --- a/Applications/Hypersonics/shocktests/app/mutationUtils.cpp +++ b/Applications/Hypersonics/shocktests/app/mutationUtils.cpp @@ -15,6 +15,47 @@ void nondimensionalizeConsVars(double* Ucons, double* uinf, int nspecies, int nd Ucons[nspecies+nd] = Ucons[nspecies+nd] / (rhoe_scale); } +void nondimensionalize_dT_dUstate(double* dTdU, double* uinf, int nspecies, int nd) +{ + // Modifies Ucons vector in place to have nondimensional quantities + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double T_scale = uinf[3]; + for (int i=0; imixtureEnergyMass() // OKAY SHOULD I DO THIS ALL IN DIMENSIONAL OR NONDIM COORDS...what did I do last time? -// double rhou = Ucons[nspecies]; -// double rhoE = Ucons[nspecies+1]; - -// } +void dT_dUstate(double* dTdU, double* Ustate, double* Uwork, int nspecies, int ndim, Mutation::Mixture *mix) +{ + // Uwork is a temporary array for storing things + // Ustate = (rho_i, rhoe, rhoev) + // Works entirely in dimensional variables, must be nondimensionalized after the fact. + double denom = mix->density() * mix->mixtureFrozenCvMass(); + mix->getEnergiesMass(Uwork); + for (int i = 0; i void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u T odg2 = odg[j+npe*1+npe*nco*k]; T t1pi = 1.0/3.141592653589793; - udg1 = udg1*(t1pi*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg2 = udg2*(t1pi*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg3 = udg3*(t1pi*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg4 = udg4*(t1pi*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg5 = udg5*(t1pi*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg1 = udg1*(t2*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg2 = udg2*(t2*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg3 = udg3*(t2*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg4 = udg4*(t2*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg5 = udg5*(t2*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg1 = fmax(0.0, udg1); + // udg2 = fmax(0.0, udg2); + // udg3 = fmax(0.0, udg3); + // udg4 = fmax(0.0, udg4); + // udg5 = fmax(0.0, udg5); + udg1 = udg1*(t1pi*atan(udg1*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg2 = udg2*(t1pi*atan(udg2*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg3 = udg3*(t1pi*atan(udg3*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg4 = udg4*(t1pi*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg5 = udg5*(t1pi*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + int nspecies = 5; double rho_scale = uinf[0]; @@ -42,7 +53,7 @@ template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; double Ustate[6]; dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); - conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, 1); double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; double rhoe = Ustate[nspecies]; mix->setState(rhovec, &rhoe, 0); @@ -55,12 +66,12 @@ template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u T t4 = 1.0/3.141592653589793; T t5 = 1.0/param15; T t8 = udg8+udg9+udg10+udg11+udg12; - T t9 = param17*1.0E+3; - T t10 = udg1*1.0E+3; - T t11 = udg2*1.0E+3; - T t12 = udg3*1.0E+3; - T t13 = udg4*1.0E+3; - T t14 = udg5*1.0E+3; + T t9 = param17*1.0E+12; + T t10 = udg1*1.0E+12; + T t11 = udg2*1.0E+12; + T t12 = udg3*1.0E+12; + T t13 = udg4*1.0E+12; + T t14 = udg5*1.0E+12; T t6 = t2-2.0; T t7 = 1.0/t3; T t15 = atan(t10); @@ -83,44 +94,44 @@ template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u T t32 = t27*udg3; T t33 = t28*udg4; T t34 = t29*udg5; - T t35 = t30+t31+t32+t33+t34+1.591548900402584E-3; + T t35 = t30+t31+t32+t33+t34+1.591227150044006E-12; T t36 = 1.0/t35; T t37 = t36*udg7; T t38 = t36*uinf1; - T t41 = t8*t36*udg6; - T t39 = t37*1.0E+3; - T t40 = t38*1.0E+3; - T t42 = -t41; - T t44 = -t36*(t41-udg13); + T t39 = t8*t36*udg6; + T t40 = -t39; + T t42 = t37*1.0E+12; + T t43 = t38*1.0E+12; + T t44 = -t36*(t39-udg13); T t45 = t37+t38-1.0E-4; - T t46 = t36*(t41-udg13)*-1.0E+3; - T t43 = t42+udg13; - T t47 = t39+t40-1.0/1.0E+1; - T t49 = t44-1.0E+4; - T t51 = t46-1.0E+7; - T t48 = atan(t47); - T t52 = atan(t51); - T t50 = t4*t48; - T t54 = t4*t52; - T t53 = t50+1.0/2.0; + T t47 = t36*(t39-udg13)*-1.0E+12; + T t41 = t40+udg13; + T t46 = t44-1.0E+4; + T t48 = t42+t43-1.0E+8; + T t50 = t47-1.0E+16; + T t49 = atan(t48); + T t51 = atan(t50); + T t52 = t4*t49; + T t54 = t4*t51; + T t53 = t52+1.0/2.0; T t55 = t54-1.0/2.0; T t56 = t45*t53; - T t57 = -t55*(t36*(t41-udg13)+1.0E+4); - T t58 = t55*(t36*(t41-udg13)+1.0E+4); - T t59 = t58*-1.0E+3; - T t60 = t56+4.183097800805168E-4; - T t63 = t57-1.999999968169022E+4; + T t57 = -t55*(t36*(t39-udg13)+1.0E+4); + T t58 = t55*(t36*(t39-udg13)+1.0E+4); + T t59 = t58*-1.0E+12; + T t60 = t56+1.000000003182454E-4; + T t62 = t57-2.0E+4; T t61 = t6*t7*t60; - T t64 = t59-1.999999968169022E+7; - T t62 = 1.0/sqrt(t61); + T t64 = t59-2.0E+16; + T t63 = 1.0/sqrt(t61); T t65 = atan(t64); T t66 = t4*t65; T t67 = t66+1.0/2.0; - T t68 = -t67*(t58+1.999999968169022E+4); + T t68 = -t67*(t58+2.0E+4); T t69 = t58+t68+1.0E+4; - T t70 = odg2*t5*t62*t69; + T t70 = odg2*t5*t63*t69; T t71 = -t70; - T t73 = t70*1.0E+3; + T t73 = t70*1.0E+12; T t72 = param17+t71; T t74 = -t73; T t75 = t9+t74; @@ -128,7 +139,86 @@ template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u T t77 = t4*t76; T t78 = t77-1.0/2.0; T t79 = t72*t78; - f[j+npe*0+npe*nce*k] = odg2*param16*t5*(fabs(udg6)/fabs(t35)+sqrt(fabs(t6*t60)/fabs(t3)))*(t79-(t4*atan(param18*-1.0E+3+t79*1.0E+3+3.183097800805168E-1)+1.0/2.0)*(-param18+t79+3.183097800805168E-4)); + f[j+npe*0+npe*nce*k] = odg2*param16*t5*(fabs(udg6)/fabs(t35)+sqrt(fabs(t6*t60)/fabs(t3)))*(t79-(t4*atan(param18*-1.0E+12+t79*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t79+3.182454300088011E-13)); + // T t2 = uinf2*2.0; + // T t3 = uinf2+1.0; + // T t4 = 1.0/3.141592653589793; + // T t5 = 1.0/param15; + // T t8 = udg8+udg9+udg10+udg11+udg12; + // T t9 = param17*1.0E+3; + // T t10 = udg1*1.0E+3; + // T t11 = udg2*1.0E+3; + // T t12 = udg3*1.0E+3; + // T t13 = udg4*1.0E+3; + // T t14 = udg5*1.0E+3; + // T t6 = t2-2.0; + // T t7 = 1.0/t3; + // T t15 = atan(t10); + // T t16 = atan(t11); + // T t17 = atan(t12); + // T t18 = atan(t13); + // T t19 = atan(t14); + // T t20 = t4*t15; + // T t21 = t4*t16; + // T t22 = t4*t17; + // T t23 = t4*t18; + // T t24 = t4*t19; + // T t25 = t20+1.0/2.0; + // T t26 = t21+1.0/2.0; + // T t27 = t22+1.0/2.0; + // T t28 = t23+1.0/2.0; + // T t29 = t24+1.0/2.0; + // T t30 = t25*udg1; + // T t31 = t26*udg2; + // T t32 = t27*udg3; + // T t33 = t28*udg4; + // T t34 = t29*udg5; + // T t35 = t30+t31+t32+t33+t34+1.591548900402584E-3; + // T t36 = 1.0/t35; + // T t37 = t36*udg7; + // T t38 = t36*uinf1; + // T t41 = t8*t36*udg6; + // T t39 = t37*1.0E+3; + // T t40 = t38*1.0E+3; + // T t42 = -t41; + // T t44 = -t36*(t41-udg13); + // T t45 = t37+t38-1.0E-4; + // T t46 = t36*(t41-udg13)*-1.0E+3; + // T t43 = t42+udg13; + // T t47 = t39+t40-1.0/1.0E+1; + // T t49 = t44-1.0E+4; + // T t51 = t46-1.0E+7; + // T t48 = atan(t47); + // T t52 = atan(t51); + // T t50 = t4*t48; + // T t54 = t4*t52; + // T t53 = t50+1.0/2.0; + // T t55 = t54-1.0/2.0; + // T t56 = t45*t53; + // T t57 = -t55*(t36*(t41-udg13)+1.0E+4); + // T t58 = t55*(t36*(t41-udg13)+1.0E+4); + // T t59 = t58*-1.0E+3; + // T t60 = t56+4.183097800805168E-4; + // T t63 = t57-1.999999968169022E+4; + // T t61 = t6*t7*t60; + // T t64 = t59-1.999999968169022E+7; + // T t62 = 1.0/sqrt(t61); + // T t65 = atan(t64); + // T t66 = t4*t65; + // T t67 = t66+1.0/2.0; + // T t68 = -t67*(t58+1.999999968169022E+4); + // T t69 = t58+t68+1.0E+4; + // T t70 = odg2*t5*t62*t69; + // T t71 = -t70; + // T t73 = t70*1.0E+3; + // T t72 = param17+t71; + // T t74 = -t73; + // T t75 = t9+t74; + // T t76 = atan(t75); + // T t77 = t4*t76; + // T t78 = t77-1.0/2.0; + // T t79 = t72*t78; + // f[j+npe*0+npe*nce*k] = odg2*param16*t5*(fabs(udg6)/fabs(t35)+sqrt(fabs(t6*t60)/fabs(t3)))*(t79-(t4*atan(param18*-1.0E+3+t79*1.0E+3+3.183097800805168E-1)+1.0/2.0)*(-param18+t79+3.183097800805168E-4)); } // std::cout << "end avfield" << std::endl; } diff --git a/Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp index efd881ae..577c39fb 100644 --- a/Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp +++ b/Applications/Hypersonics/shocktests/app/opuFbou_MPP.cpp @@ -39,7 +39,7 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; double Ustate[6]; dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); - conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, 1); double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; double rhoe = Ustate[nspecies]; @@ -134,7 +134,7 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; double Ustate[6]; dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); - conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, 1); double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; double rhoe = Ustate[nspecies]; diff --git a/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp index 61496dad..91fc91ba 100644 --- a/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp +++ b/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp @@ -21,11 +21,21 @@ template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __ T odg2 = odg[1*ng+i]; T t1pi = 1.0/3.141592653589793; - udg1 = udg1*(t1pi*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg2 = udg2*(t1pi*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg3 = udg3*(t1pi*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg4 = udg4*(t1pi*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg5 = udg5*(t1pi*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg1 = udg1*(t2*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg2 = udg2*(t2*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg3 = udg3*(t2*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg4 = udg4*(t2*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg5 = udg5*(t2*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg1 = fmax(0.0, udg1); + // udg2 = fmax(0.0, udg2); + // udg3 = fmax(0.0, udg3); + // udg4 = fmax(0.0, udg4); + // udg5 = fmax(0.0, udg5); + udg1 = udg1*(t1pi*atan(udg1*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg2 = udg2*(t1pi*atan(udg2*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg3 = udg3*(t1pi*atan(udg3*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg4 = udg4*(t1pi*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg5 = udg5*(t1pi*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011e-13; int nspecies = 5; double rho_scale = uinf[0]; @@ -35,19 +45,61 @@ template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __ double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; double Ustate[6]; dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); - conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, 1); double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; double rhoe = Ustate[nspecies]; mix->setState(rhovec, &rhoe, 0); T uinf1 = mix->P()/rhoe_scale; - T t2 = 1.0/3.141592653589793; - T t3 = udg1*1.0E+3; - T t4 = udg2*1.0E+3; - T t5 = udg3*1.0E+3; - T t6 = udg4*1.0E+3; - T t7 = udg5*1.0E+3; + // T t2 = 1.0/3.141592653589793; + // T t3 = udg1*1.0E+3; + // T t4 = udg2*1.0E+3; + // T t5 = udg3*1.0E+3; + // T t6 = udg4*1.0E+3; + // T t7 = udg5*1.0E+3; + // T t8 = atan(t3); + // T t9 = atan(t4); + // T t10 = atan(t5); + // T t11 = atan(t6); + // T t12 = atan(t7); + // T t13 = t2*t8; + // T t14 = t2*t9; + // T t15 = t2*t10; + // T t16 = t2*t11; + // T t17 = t2*t12; + // T t18 = t13+1.0/2.0; + // T t19 = t14+1.0/2.0; + // T t20 = t15+1.0/2.0; + // T t21 = t16+1.0/2.0; + // T t22 = t17+1.0/2.0; + // T t23 = t18*udg1; + // T t24 = t19*udg2; + // T t25 = t20*udg3; + // T t26 = t21*udg4; + // T t27 = t22*udg5; + // T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + // T t29 = 1.0/t28; + // // f[0*ng+i] = odg1*udg8*(t18+(t2*t3)/((udg1*udg1)*1.0E+6+1.0))+t29*udg6*(t23+3.183097800805168E-4); + // // f[1*ng+i] = odg1*udg9*(t19+(t2*t4)/((udg2*udg2)*1.0E+6+1.0))+t29*udg6*(t24+3.183097800805168E-4); + // // f[2*ng+i] = odg1*udg10*(t20+(t2*t5)/((udg3*udg3)*1.0E+6+1.0))+t29*udg6*(t25+3.183097800805168E-4); + // // f[3*ng+i] = odg1*udg11*(t21+(t2*t6)/((udg4*udg4)*1.0E+6+1.0))+t29*udg6*(t26+3.183097800805168E-4); + // // f[4*ng+i] = odg1*udg12*(t22+(t2*t7)/((udg5*udg5)*1.0E+6+1.0))+t29*udg6*(t27+3.183097800805168E-4); + // // f[5*ng+i] = uinf1+odg1*udg13+t29*(udg6*udg6); + // // f[6*ng+i] = odg1*udg14+udg6*(t29*udg7+t29*uinf1); + // f[0*ng+i] = odg1*udg8*(t18+(t2*t3)/((udg1*udg1)*1.0E+6+1.0))+t29*udg6*(t23+3.183097800805168E-4); + // f[1*ng+i] = odg1*udg9*(t19+(t2*t4)/((udg2*udg2)*1.0E+6+1.0))+t29*udg6*(t24+3.183097800805168E-4); + // f[2*ng+i] = odg1*udg10*(t20+(t2*t5)/((udg3*udg3)*1.0E+6+1.0))+t29*udg6*(t25+3.183097800805168E-4); + // f[3*ng+i] = odg1*udg11*(t21+(t2*t6)/((udg4*udg4)*1.0E+6+1.0))+t29*udg6*(t26+3.183097800805168E-4); + // f[4*ng+i] = odg1*udg12*(t22+(t2*t7)/((udg5*udg5)*1.0E+6+1.0))+t29*udg6*(t27+3.183097800805168E-4); + // f[5*ng+i] = uinf1+odg1*udg13+t29*(udg6*udg6); + // f[6*ng+i] = odg1*udg14+udg6*(t29*udg7+t29*uinf1); + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+12; + T t4 = udg2*1.0E+12; + T t5 = udg3*1.0E+12; + T t6 = udg4*1.0E+12; + T t7 = udg5*1.0E+12; T t8 = atan(t3); T t9 = atan(t4); T t10 = atan(t5); @@ -68,13 +120,13 @@ template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __ T t25 = t20*udg3; T t26 = t21*udg4; T t27 = t22*udg5; - T t28 = t23+t24+t25+t26+t27+1.591548900402584E-3; + T t28 = t23+t24+t25+t26+t27+1.591227150044006E-12; T t29 = 1.0/t28; - f[0*ng+i] = odg1*udg8*(t18+(t2*t3)/((udg1*udg1)*1.0E+6+1.0))+t29*udg6*(t23+3.183097800805168E-4); - f[1*ng+i] = odg1*udg9*(t19+(t2*t4)/((udg2*udg2)*1.0E+6+1.0))+t29*udg6*(t24+3.183097800805168E-4); - f[2*ng+i] = odg1*udg10*(t20+(t2*t5)/((udg3*udg3)*1.0E+6+1.0))+t29*udg6*(t25+3.183097800805168E-4); - f[3*ng+i] = odg1*udg11*(t21+(t2*t6)/((udg4*udg4)*1.0E+6+1.0))+t29*udg6*(t26+3.183097800805168E-4); - f[4*ng+i] = odg1*udg12*(t22+(t2*t7)/((udg5*udg5)*1.0E+6+1.0))+t29*udg6*(t27+3.183097800805168E-4); + f[0*ng+i] = t29*udg6*(t23+3.182454300088011E-13)+odg1*udg8;//*(t18+(t2*t3)/((udg1*udg1)*1.0E+24+1.0)); + f[1*ng+i] = t29*udg6*(t24+3.182454300088011E-13)+odg1*udg9;//*(t19+(t2*t4)/((udg2*udg2)*1.0E+24+1.0)); + f[2*ng+i] = t29*udg6*(t25+3.182454300088011E-13)+odg1*udg10;//*(t20+(t2*t5)/((udg3*udg3)*1.0E+24+1.0)); + f[3*ng+i] = t29*udg6*(t26+3.182454300088011E-13)+odg1*udg11;//*(t21+(t2*t6)/((udg4*udg4)*1.0E+24+1.0)); + f[4*ng+i] = t29*udg6*(t27+3.182454300088011E-13)+odg1*udg12;//*(t22+(t2*t7)/((udg5*udg5)*1.0E+24+1.0)); f[5*ng+i] = uinf1+odg1*udg13+t29*(udg6*udg6); f[6*ng+i] = odg1*udg14+udg6*(t29*udg7+t29*uinf1); } diff --git a/Applications/Hypersonics/shocktests/app/opuOutput_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuOutput_MPP.cpp index e4837280..087249b8 100644 --- a/Applications/Hypersonics/shocktests/app/opuOutput_MPP.cpp +++ b/Applications/Hypersonics/shocktests/app/opuOutput_MPP.cpp @@ -23,30 +23,57 @@ template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *ui T odg2 = odg[j+npe*1+npe*nco*k]; T t1pi = 1.0/3.141592653589793; - udg1 = udg1*(t1pi*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg2 = udg2*(t1pi*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg3 = udg3*(t1pi*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg4 = udg4*(t1pi*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg5 = udg5*(t1pi*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + + // // udg1 = udg1*(t2*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // // udg2 = udg2*(t2*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // // udg3 = udg3*(t2*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // // udg4 = udg4*(t2*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // // udg5 = udg5*(t2*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg1 = fmax(0.0, udg1); + // udg2 = fmax(0.0, udg2); + // udg3 = fmax(0.0, udg3); + // udg4 = fmax(0.0, udg4); + // udg5 = fmax(0.0, udg5); + udg1 = udg1*(t1pi*atan(udg1*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg2 = udg2*(t1pi*atan(udg2*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg3 = udg3*(t1pi*atan(udg3*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg4 = udg4*(t1pi*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg5 = udg5*(t1pi*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011e-13; int nspecies = 5; double rho_scale = uinf[0]; double u_scale = uinf[1]; double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; double Ustate[6]; dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); - conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, 1); double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; double rhoe = Ustate[nspecies]; mix->setState(rhovec, &rhoe, 0); T uinf1 = mix->P(); + double wdot[5]; + mix->netProductionRates(wdot); + + // f[0*ng+i] = wdot[0]/(omega_scale); + // f[1*ng+i] = wdot[1]/(omega_scale); + // f[2*ng+i] = wdot[2]/(omega_scale); + // f[3*ng+i] = wdot[3]/(omega_scale); + // f[4*ng+i] = wdot[4]/(omega_scale); + // std::cout << wdot[4]/omega_scale << std::endl; f[j+npe*0+npe*nce*k] = uinf1; f[j+npe*1+npe*nce*k] = odg1; + f[j+npe*2+npe*nce*k] = wdot[0]/(omega_scale); + f[j+npe*3+npe*nce*k] = wdot[1]/(omega_scale); + f[j+npe*4+npe*nce*k] = wdot[2]/(omega_scale); + f[j+npe*5+npe*nce*k] = wdot[3]/(omega_scale); + f[j+npe*6+npe*nce*k] = wdot[4]/(omega_scale); + } // std::cout << "end output" << std::endl; } diff --git a/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors.cpp b/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors.cpp new file mode 100644 index 00000000..a950e3d1 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors.cpp @@ -0,0 +1,245 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Uwork[5]; + double dTdU[6]; + int nspecies = 5; + int ndim = 1; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P()/rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf13 = dTdU[0]; // dT_drho_1 + uinf14 = dTdU[1]; // dT_drho_2 + uinf15 = dTdU[2]; // dT_drho_3 + uinf16 = dTdU[3]; // dT_drho_4 + uinf17 = dTdU[4]; // dT_drho_5 + uinf18 = dTdU[5]; // dT_drhoe + + // T t2 = udg1*udg1; + // T t3 = udg2*udg2; + // T t4 = udg3*udg3; + // T t5 = udg4*udg4; + // T t6 = udg5*udg5; + // T t7 = 1.0/3.141592653589793; + // T t8 = 1.0/param15; + // T t9 = udg1*1.0E+12; + // T t10 = udg2*1.0E+12; + // T t11 = udg3*1.0E+12; + // T t12 = udg4*1.0E+12; + // T t13 = udg5*1.0E+12; + // T t14 = atan(t9); + // T t15 = atan(t10); + // T t16 = atan(t11); + // T t17 = atan(t12); + // T t18 = atan(t13); + // T t34 = t2*1.0E+24; + // T t35 = t3*1.0E+24; + // T t36 = t4*1.0E+24; + // T t37 = t5*1.0E+24; + // T t38 = t6*1.0E+24; + // T t19 = t7*t14; + // T t20 = t7*t15; + // T t21 = t7*t16; + // T t22 = t7*t17; + // T t23 = t7*t18; + // T t39 = t34+1.0; + // T t40 = t35+1.0; + // T t41 = t36+1.0; + // T t42 = t37+1.0; + // T t43 = t38+1.0; + // T t24 = t19+1.0/2.0; + // T t25 = t20+1.0/2.0; + // T t26 = t21+1.0/2.0; + // T t27 = t22+1.0/2.0; + // T t28 = t23+1.0/2.0; + // T t44 = 1.0/t39; + // T t45 = 1.0/t40; + // T t46 = 1.0/t41; + // T t47 = 1.0/t42; + // T t48 = 1.0/t43; + // T t29 = t24*udg1; + // T t30 = t25*udg2; + // T t31 = t26*udg3; + // T t32 = t27*udg4; + // T t33 = t28*udg5; + // T t49 = t7*t9*t44; + // T t50 = t7*t10*t45; + // T t51 = t7*t11*t46; + // T t52 = t7*t12*t47; + // T t53 = t7*t13*t48; + // T t54 = t24+t49; + // T t55 = t25+t50; + // T t56 = t26+t51; + // T t57 = t27+t52; + // T t58 = t28+t53; + // T t64 = t29+t30+t31+t32+t33+1.591227150044006E-12; + // T t59 = t54*udg8; + // T t60 = t55*udg9; + // T t61 = t56*udg10; + // T t62 = t57*udg11; + // T t63 = t58*udg12; + // T t65 = 1.0/t64; + // T t66 = t59+t60+t61+t62+t63; + // T t67 = t65*t66*udg6; + // T t68 = -t67; + // T t70 = -t65*(t67-udg13); + // T t72 = t65*(t67-udg13)*-1.0E+12; + // T t69 = t68+udg13; + // T t71 = t70-1.0E+4; + // T t73 = t72-1.0E+16; + // T t74 = atan(t73); + // T t75 = t7*t74; + // T t76 = t75-1.0/2.0; + // T t77 = -t76*(t65*(t67-udg13)+1.0E+4); + // f[j+npe*0+npe*nce*k] = odg2*t8*(-(t76*(t65*(t67-udg13)+1.0E+4)+2.0E+4)*(t7*atan(t76*(t65*(t67-udg13)+1.0E+4)*-1.0E+12-2.0E+16)+1.0/2.0)+t76*(t65*(t67-udg13)+1.0E+4)+1.0E+4)*1.0/sqrt(((uinf2*2.0-2.0)*((t7*atan(t65*udg7*1.0E+12+t65*uinf1*1.0E+12-1.0E+8)+1.0/2.0)*(t65*udg7+t65*uinf1-1.0E-4)+1.000000003182454E-4))/(uinf2+1.0)); + // f[j+npe*1+npe*nce*k] = -odg2*t8*(t59*uinf13+t60*uinf14+t61*uinf15+t62*uinf16+t63*uinf17+uinf18*(udg6+udg14-(t65*t67*udg6)/2.0)); + // f[j+npe*2+npe*nce*k] = -odg2*t8*t65*(t59-t65*t66*(t29+3.182454300088011E-13)); + // f[j+npe*3+npe*nce*k] = -odg2*t8*t65*(t60-t65*t66*(t30+3.182454300088011E-13)); + // f[j+npe*4+npe*nce*k] = -odg2*t8*t65*(t61-t65*t66*(t31+3.182454300088011E-13)); + // f[j+npe*5+npe*nce*k] = -odg2*t8*t65*(t62-t65*t66*(t32+3.182454300088011E-13)); + // f[j+npe*6+npe*nce*k] = -odg2*t8*t65*(t63-t65*t66*(t33+3.182454300088011E-13)); + // f[j+npe*7+npe*nce*k] = mix->T() / uinf[3]; + // f[j+npe*8+npe*nce*k] = mix->mixtureFrozenCpMass() * mix->viscosity() / mix->frozenThermalConductivity(); + // f[j+npe*9+npe*nce*k] = mix->frozenThermalConductivity() / mix->viscosity() ; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = 1.0/3.141592653589793; + T t8 = 1.0/param15; + T t9 = udg1*1.0E+12; + T t10 = udg2*1.0E+12; + T t11 = udg3*1.0E+12; + T t12 = udg4*1.0E+12; + T t13 = udg5*1.0E+12; + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t34 = t2*1.0E+24; + T t35 = t3*1.0E+24; + T t36 = t4*1.0E+24; + T t37 = t5*1.0E+24; + T t38 = t6*1.0E+24; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t23 = t7*t18; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t43 = t38+1.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t48 = 1.0/t43; + T t29 = t24*udg1; + T t30 = t25*udg2; + T t31 = t26*udg3; + T t32 = t27*udg4; + T t33 = t28*udg5; + T t49 = t7*t9*t44; + T t50 = t7*t10*t45; + T t51 = t7*t11*t46; + T t52 = t7*t12*t47; + T t53 = t7*t13*t48; + T t54 = t24+t49; + T t55 = t25+t50; + T t56 = t26+t51; + T t57 = t27+t52; + T t58 = t28+t53; + T t64 = t29+t30+t31+t32+t33+1.591227150044006E-12; + T t59 = t54*udg8; + T t60 = t55*udg9; + T t61 = t56*udg10; + T t62 = t57*udg11; + T t63 = t58*udg12; + T t65 = 1.0/t64; + T t66 = t59+t60+t61+t62+t63; + T t67 = t65*t66*udg6; + T t68 = -t67; + T t70 = -t65*(t67-udg13); + T t72 = t65*(t67-udg13)*-1.0E+12; + T t69 = t68+udg13; + T t71 = t70-1.0E+4; + T t73 = t72-1.0E+16; + T t74 = atan(t73); + T t75 = t7*t74; + T t76 = t75-1.0/2.0; + T t77 = -t76*(t65*(t67-udg13)+1.0E+4); + f[j+npe*0+npe*nce*k] = odg2*t8*(-(t76*(t65*(t67-udg13)+1.0E+4)+2.0E+4)*(t7*atan(t76*(t65*(t67-udg13)+1.0E+4)*-1.0E+12-2.0E+16)+1.0/2.0)+t76*(t65*(t67-udg13)+1.0E+4)+1.0E+4)*1.0/sqrt(((uinf2*2.0-2.0)*((t7*atan(t65*udg7*1.0E+12+t65*uinf1*1.0E+12-1.0E+8)+1.0/2.0)*(t65*udg7+t65*uinf1-1.0E-4)+1.000000003182454E-4))/(uinf2+1.0)); + f[j+npe*1+npe*nce*k] = -odg2*t8*(t59*uinf13+t60*uinf14+t61*uinf15+t62*uinf16+t63*uinf17+uinf18*(udg14-(t65*t67*udg6)/2.0+t65*udg6*(t67-udg13))); + f[j+npe*2+npe*nce*k] = -odg2*t8*t65*(t59-t65*t66*(t29+3.182454300088011E-13)); + f[j+npe*3+npe*nce*k] = -odg2*t8*t65*(t60-t65*t66*(t30+3.182454300088011E-13)); + f[j+npe*4+npe*nce*k] = -odg2*t8*t65*(t61-t65*t66*(t31+3.182454300088011E-13)); + f[j+npe*5+npe*nce*k] = -odg2*t8*t65*(t62-t65*t66*(t32+3.182454300088011E-13)); + f[j+npe*6+npe*nce*k] = -odg2*t8*t65*(t63-t65*t66*(t33+3.182454300088011E-13)); + f[j+npe*7+npe*nce*k] = mix->T() / uinf[3]; + f[j+npe*8+npe*nce*k] = mix->mixtureFrozenCpMass() * mix->viscosity() / mix->frozenThermalConductivity(); + f[j+npe*9+npe*nce*k] = mix->frozenThermalConductivity() / mix->viscosity() ; + + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp index 6aabd380..68e1ad1d 100644 --- a/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp +++ b/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp @@ -11,11 +11,21 @@ template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* T udg7 = udg[6*ng+i]; T t2 = 1.0/3.141592653589793; - udg1 = udg1*(t2*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg2 = udg2*(t2*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg3 = udg3*(t2*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg4 = udg4*(t2*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; - udg5 = udg5*(t2*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg1 = udg1*(t2*atan(udg1*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg2 = udg2*(t2*atan(udg2*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg3 = udg3*(t2*atan(udg3*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg4 = udg4*(t2*atan(udg4*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg5 = udg5*(t2*atan(udg5*1.0E+3)+1.0/2.0)+3.183097800805168E-4; + // udg1 = fmax(0.0, udg1); + // udg2 = fmax(0.0, udg2); + // udg3 = fmax(0.0, udg3); + // udg4 = fmax(0.0, udg4); + // udg5 = fmax(0.0, udg5); + udg1 = udg1*(t2*atan(udg1*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg2 = udg2*(t2*atan(udg2*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg3 = udg3*(t2*atan(udg3*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg4 = udg4*(t2*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011e-13; + udg5 = udg5*(t2*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011e-13; int nspecies = 5; double rho_scale = uinf[0]; @@ -26,7 +36,7 @@ template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; double Ustate[6]; dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, 1); - conservativeToState(Ucons, Ustate, (double*)uinf, nspecies); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, 1); double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; double rhoe = Ustate[nspecies]; @@ -40,6 +50,7 @@ template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* f[2*ng+i] = wdot[2]/(omega_scale); f[3*ng+i] = wdot[3]/(omega_scale); f[4*ng+i] = wdot[4]/(omega_scale); + // std::cout << wdot[4]/omega_scale << std::endl; f[5*ng+i] = 0.0; f[6*ng+i] = 0.0; } diff --git a/Applications/Hypersonics/shocktests/dlmax.m b/Applications/Hypersonics/shocktests/dlmax.m new file mode 100644 index 00000000..cb02a589 --- /dev/null +++ b/Applications/Hypersonics/shocktests/dlmax.m @@ -0,0 +1,3 @@ +function dout = dlmax(x, alpha) + dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +end \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/getStates.py b/Applications/Hypersonics/shocktests/getStates.py index 85edcfe6..657275f1 100644 --- a/Applications/Hypersonics/shocktests/getStates.py +++ b/Applications/Hypersonics/shocktests/getStates.py @@ -12,16 +12,19 @@ def print_equil_vals(mix, T, P): rho = np.sum(rhovec) e = mix.mixtureEnergyMass() rhoE = rho * e + 0.0 + w = mix.netProductionRates() print("To check") print("(T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") print("Initial conditions (dimensional): ") print("(rho_i, rhou, rhoE) = (" + str(rhovec) + " 0.0 " + str(rhoE) + ")") + print("omega: " + str(w)) def init_mixture(): opt = mpp.MixtureOptions("air_5") opt.setStateModel("ChemNonEq1T") opt.setViscosityAlgorithm("Gupta-Yos") + opt.setThermodynamicDatabase("RRHO") mix = mpp.Mixture(opt) return mix @@ -32,7 +35,7 @@ def test_range(): opt = mpp.MixtureOptions("air_5") opt.setStateModel("ChemNonEq1T") - opt.setViscosityAlgorithm("Gupta-Yos") + # opt.setViscosityAlgorithm("Gupta-Yos") opt.setThermodynamicDatabase("RRHO") mix = mpp.Mixture(opt) @@ -46,18 +49,17 @@ def test_range(): if __name__=="__main__": - TL = 9000.0 + 298.17 + TL = 9000.0 PL = 1.95256e5 - TR = 300.0 + 298.17 + TR = 300.0 PR = 1.0e4 - opt = mpp.MixtureOptions("air_5") - opt.setStateModel("ChemNonEq1T") - opt.setViscosityAlgorithm("Gupta-Yos") - opt.setTeh - - mix = mpp.Mixture(opt) + # opt = mpp.MixtureOptions("air_5") + # opt.setStateModel("ChemNonEq1T") + # opt.setViscosityAlgorithm("Gupta-Yos") + # mix = mpp.Mixture(opt) + mix = init_mixture() print("=============") print(" LEFT STATE ") @@ -83,4 +85,34 @@ def test_range(): print("cp = " + str(cp)) print("gam = " + str(gam)) + # opt2 = mpp.MixtureOptions("air_5") + # opt2.setStateModel("ChemNonEq1T") + # opt2.setThermodynamicDatabase("NASA-9") + # opt2.setViscosityAlgorithm("Gupta-Yos") + # mix2 = mpp.Mixture(opt2) + + # print("=============") + # print(" LEFT STATE ") + # print("=============") + # print_equil_vals(mix2, TL, PL) + + # print("=============") + # print(" RIGHT STATE ") + # print("=============") + # print_equil_vals(mix2, TR, PR) + + # print() + # print("PRINT SCALING TERMS using right side of domain") + # print("Just to make sure once again: (T, P) = (" + str(mix2.T()) + ", " + str(mix2.P()) + ")") + # rho_inf = mix2.density() + # u_inf = mix2.frozenSoundSpeed() + # print("rho_inf = " + str(rho_inf)) + # print("u_inf = " + str(u_inf)) + # print("rhoE_inf = " + str(rho_inf * u_inf * u_inf)) + + # cp = mix2.mixtureFrozenCpMass() + # gam = mix2.mixtureFrozenGamma() + # print("cp = " + str(cp)) + # print("gam = " + str(gam)) + diff --git a/Applications/Hypersonics/shocktests/pdeapp.m b/Applications/Hypersonics/shocktests/pdeapp.m index 39f481ee..6309e346 100644 --- a/Applications/Hypersonics/shocktests/pdeapp.m +++ b/Applications/Hypersonics/shocktests/pdeapp.m @@ -24,13 +24,16 @@ % nt = 3240/10; % dt = tfinal/nt; % dt = 10*1e-5; -nt = 500; -dt = tfinal / nt; +nt = 10000; +% nt = 150 +% dt = tfinal / nt; +dt = 3.240000000000000e-06; % pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; pde.dt = [dt*ones(1,nt)]; pde.saveSolFreq = ceil(nt/100); +% pde.saveSolFreq = 1; pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected -% pde.timestepOffset = 2700; +% pde.timestepOffset = 10000; % Solver params pde.linearsolveriter = 40; @@ -54,9 +57,9 @@ %% Stabilization and mesh ndim = 1; pde.tau = [5, 5, 5, 5, 5, 5, 5]; -nDiv = 400; -[mesh.p,mesh.t] = linemesh(nDiv-1); -a = 0; b = 1.0; +nDiv = 600; +[mesh.p,mesh.t] = linemesh(nDiv); +a = 0.2; b = 0.645; mesh.p = a + (b-a)*mesh.p; mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries @@ -84,8 +87,8 @@ 0.0 % rhou_R -9783.724551855581 % rhoE_R pde.porder % p for h/p scaling - 1.5 % bulk viscosity scaling parameter - 0.02 % cutoff dilitation + 1.5 % bulk viscosity scaling parameter + 0.0002 % cutoff dilitation 2.5 % maximum dilitation 18 Xi_inflow(:) % 19 20 21 22 23 u_inflow % 24 @@ -123,13 +126,17 @@ pde.externalparam(1) = 0.11566313067881752; % rho_inf pde.externalparam(2) = 347.764810747843; % u_inf pde.externalparam(3) = 13988.341078772399; % rhoE_inf +pde.externalparam(4) = 300; +pde.externalparam(5) = 1.9423965904207942e-05; +pde.externalparam(6) = 0.028469303787820466; % mesh size mesh.dgnodes = createnodes(mesh.p, mesh.t, pde.porder); mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); -mesh.vdg(:,2,:) = (1.0 / (2*nDiv)) * ones(size(mesh.dgnodes,1), 1, size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = (1.0 / (nDiv)) * ones(size(mesh.dgnodes,1), 1, size(mesh.dgnodes,3)); pde.AV = 1; +pde.nco = 10; %% Call Exasim % search compilers and set options pde = setcompilers(pde); @@ -145,7 +152,8 @@ eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); %X manually switch these eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); %X eval('!cp opuSource_MPP.cpp opuSource.cpp'); %X -eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); %X +% eval('!cp opuOutput_MPP_sensors.cpp opuOutput.cpp'); %X +eval('!cp opuOutput_viscTerms.cpp opuOutput.cpp'); eval('!cp opuAvfield_MPP.cpp opuAvfield.cpp') %X eval('!cp opuInitu_MPP.cpp opuInitu.cpp') %X % eval('!cp opuUbou_MPP.cpp opuUbou.cpp') diff --git a/Applications/Hypersonics/shocktests/pdemodel.m b/Applications/Hypersonics/shocktests/pdemodel.m index d222eae8..57434b82 100644 --- a/Applications/Hypersonics/shocktests/pdemodel.m +++ b/Applications/Hypersonics/shocktests/pdemodel.m @@ -32,7 +32,7 @@ sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing % regularization parameters - alpha = 1.0e3; + alpha = 1.0e12; rmin = 0.0; Hmin = 1.0e-4; @@ -101,7 +101,7 @@ function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) rmin = 0.0; - alpha = 1.0e3; + alpha = 1.0e12; eps_av = v(1); % hm = v(2); %TODO: CHECK GAS OUTPUTS TO INPUTS USED BY HTR GROUP @@ -120,7 +120,7 @@ rho = sym(0); rmin = 0.0; - alpha = 1.0e3; + alpha = 1.0e12; % Conservative Variables for ispecies = 1:nspecies @@ -163,16 +163,15 @@ nspecies = 5; nenergy = 1; ndim = 1; + alpha = 1e9; - rho_i = sym(zeros(nspecies,1)); - drhodx_i = sym(zeros(nspecies,1)); - Y_i = sym(zeros(nspecies,1)); - drhodx_i = sym(zeros(nspecies,1)); - rho = sym(0); - drhodx = sym(0); - Tx = sym(0); - J_i = sym(zeros(nspecies,1)); - dTdr_i = sym(zeros(nspecies,1)); + Pr = mu(18); + Re = mu(19); + + avb = v(1); + avs = v(2); + avk = v(3); + avDvec = v(4:3+nspecies); % Data layout % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] @@ -180,31 +179,32 @@ h_vec = eta(nspecies+1:2*nspecies); viscshear = eta(2*nspecies+1); kappa = eta(2*nspecies+2); - dTdr_i = eta(2*nspecies+3:3*nspecies+2); - dTdrhou = eta(3*nspecies+2:3*nspecies+2+ndim); - dTdrhoE = eta(3*nspecies+3+ndim); - - % Conservative variables and their gradients - for ispecies = 1:nspecies - rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density - drhodx_i(ispecies) = q(ispecies) * dlmax(u(ispecies)-rmin,alpha) %TODO: do we need to regularize? It seems like they were in the previous case - rho = rho + rho_i(ispecies); %total mixture density - drhodx = drhodx + drhodx_i(ispecies); - end - - rhou = u(nspecies+1); - drhoudx = q(nspecies+1); - rhoE = u(nspecies+ndim+1); - drhoEdx = q(nspecies+ndim+2); - % if nenergy == 2 - % rhoev = u(nspecies+ndim+nenergy) - % end - - rhoinv = 1.0 / rho; - drhodxinv = 1.0 / drhodx; - uv = rhou * rhoinv; %velocity - dudx = (drhoudx - drhodx*uv)*rinv; - + dT_drho_i = eta(2*nspecies+3:3*nspecies+2); + dT_drhoe = eta(3*nspecies+3); + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha) + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + rhou = u(nspecies+1); + drhou_dx = -q(nspecies+1); + rhoE = u(nspecies+ndim+1); + drhoE_dx = -q(nspecies+ndim+1); + + % Some useful derived quantities + rho_inv = 1.0 / rho; + drho_dx_inv = 1.0 / drho_dx; + uv = rhou * rho_inv; %velocity + dudx = (drhou_dx - drho_dx*uv)*rho_inv; + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * uv * uv; + duTu2_dx = uv; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + Tx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + %%%%%%%% Modify appropriate coefficients kappa = kappa + avk; viscshear = viscshear + avs; @@ -212,19 +212,20 @@ D_vec = D_vec + avDvec; %%%%%%%% Calculation of J_i - for ispecies = 1:nspecies - Y_i(ispecies) = rho_i(ispecies) / rho; - dYdx_i(ispecies) = (q(ispecies) * rho - rho_i(ispecies) * drhodx) * drhodxinv^2; - end + % for ispecies = 1:nspecies + % Y_i(ispecies) = rho_i(ispecies) / rho; + % dYdx_i(ispecies) = (q(ispecies) * rho - rho_i(ispecies) * drhodx) * drhodxinv^2; + % end + Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; - for ispecies = 1:nspecies - J_i(ispecies) = -rho * D_vec(ispecies) * dYdx_i(ispecies) + rho_i(ispecies) * sum(D_vec .* dYdx_i); - end + % for ispecies = 1:nspecies + % J_i(ispecies) = -rho * D_vec(ispecies) * dYdx_i(ispecies) + rho_i(ispecies) * sum(D_vec .* dYdx_i); + % end + J_i = -rho * D_vec .* dY_dx_i + rho_i .* sum(D_vec .* dY_dx_i); %%%%%%%% Stress tensor tau - txx = viscshear * 4.0/3.0 * dudx + viscbulk * dudx; %TODO: check sign - - Tx = sum(dTdr_i .* drhodx_i) + dTdrhou * drhoudx + dTdrhoE * drhoEdx; + txx = 1.0 / Re * viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign %%%%%%%% Final viscous fluxes for ispecies = 1:nspecies @@ -232,7 +233,7 @@ end fv(nspecies + 1) = txx; - fv(nspecies + 2) = uv * txx - (sum(h_vec.*J_i) - kappa * Tx); + fv(nspecies + 2) = uv * txx - (sum(h_vec.*J_i) - kappa * dT_dx * 1.0 / (Re * Pr)); end @@ -240,7 +241,7 @@ nspecies = 5; rmin = 0.0; - alpha = 1.0e3; + alpha = 1.0e12; rvec = u(1:nspecies); s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); end @@ -269,7 +270,7 @@ end function u0 = initu(x, mu, eta) - nspecies = 1; + nspecies = 5; % pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow]; % % 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 @@ -296,12 +297,12 @@ rhoE_L_nondim = rhoE_L/rhoe_scale; % u0 = [rho_R_vec_nondim(:) + rho_L_vec_nondim(:); rhou_R_nondim + rhou_L_nondim; rhoE_R_nondim + rhoE_L_nondim]; - stepsize = 0.000001; + stepsize = 0.001; midpoint = 0.5; u0(1) = smoothstep_down(x-midpoint, rho_L_vec_nondim(1), rho_R_vec_nondim(1), stepsize); u0(2) = smoothstep_down(x-midpoint, rho_L_vec_nondim(2), rho_R_vec_nondim(2), stepsize); u0(3) = smoothstep_down(x-midpoint, rho_L_vec_nondim(3), rho_R_vec_nondim(3), stepsize); - u0(4) = smoothstep_down(x-midpoint, rho_L_vec_nondim(4), rho_R_vec_nondim(4), stepsize); + u0(4) = smoothstep_up(x-midpoint, rho_L_vec_nondim(4), rho_R_vec_nondim(4), stepsize); u0(5) = smoothstep_up(x-midpoint, rho_L_vec_nondim(5), rho_R_vec_nondim(5), stepsize); u0(nspecies+1) = 0.0; u0(nspecies+2) = smoothstep_down(x-midpoint, rhoE_L_nondim, rhoE_R_nondim, stepsize); @@ -310,34 +311,39 @@ function o = output(u, q, w, v, x, t, mu, eta) - nspecies = 5; + % nspecies = 5; - o = sym(zeros(2,1)); - nspecies = 5; - alpha = 1.0e3; - rmin = 0.0; + % o = sym(zeros(10,1)); + % nspecies = 5; + % alpha = 1.0e3; + % rmin = 0.0; - f = sym(zeros(nspecies + 2,1)); - rho_i = sym(zeros(5,1)); - rho = sym(0); + % f = sym(zeros(nspecies + 2,1)); + % rho_i = sym(zeros(5,1)); + % rho = sym(0); - % Conservative Variables - for ispecies = 1:nspecies - rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density - rho = rho + rho_i(ispecies); %total mixture density - end + % % Conservative Variables + % for ispecies = 1:nspecies + % rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + % rho = rho + rho_i(ispecies); %total mixture density + % end - rhou = u(nspecies+1); - rhoE = u(nspecies+2); + % rhou = u(nspecies+1); + % rhoE = u(nspecies+2); - rhoinv = 1.0 / rho; - uv = rhou * rhoinv; %velocity - E = rhoE*rhoinv; %energy + % rhoinv = 1.0 / rho; + % uv = rhou * rhoinv; %velocity + % E = rhoE*rhoinv; %energy - o(1) = u(1); - o(2) = u(2); + % o(1) = u(1); + % o(2) = u(2); + % o(3) = u(3); + % o(4) = u(4); + % o(5) = u(5); + hm = v(2); + o = sensor_outputs(u, q, w, v, x, t, mu, eta, hm); end -function dout = dlmax(x, alpha) - dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; -end \ No newline at end of file +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/plotting.m b/Applications/Hypersonics/shocktests/plotting.m index c0cd27a2..d73d774b 100644 --- a/Applications/Hypersonics/shocktests/plotting.m +++ b/Applications/Hypersonics/shocktests/plotting.m @@ -2,55 +2,79 @@ % sol = fetchsolution(pde,master,dmd, 'dataout'); % for ti = pde.saveSolFreq:pde.saveSolFreq:(length(pde.dt)*6) for ti = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt) +% for ti = 100:100:10000 +% for ti = 10000:10:12000 sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); sol_output = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); % solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); - -% rho = sum(sol(:,1:5,:),2); + rho = sum(sol(:,1:5,:),2); + rho1 = sol(:,1,:); + rho2 = sol(:,2,:); + rho3 = sol(:,3,:); + rho4 = sol(:,4,:); + rho5 = sol(:,5,:); + rhou = sol(:,6,:); + rhoE = sol(:,7,:); + drho = sum(sol(:,8:12,:),2); % AV = sol_output(:,1,:); - u = sol(:,1,:); - figure(1) - clf - hold on - plot(dgnodes(:),u(:),'LineWidth',1.3); -% figure(2) -% clf -% hold on -% plot(dgnodes(:),AV(:),'LineWidth',1.3); -% set(gca, 'Xscale','log'); -% waitforbuttonpress -% end -% rhou = sol(:,6,:); -% plot(dgnodes(:),rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log'); - -% rhoE = sol(:,7,:); -% p = solw(:,6,:); -% for i = 1:5 -% u = solw(:,i,:); -% hold on -% plot(dgnodes(:),u(:),'LineWidth',1.3); set(gca, 'Xscale','log'); -% title("\omega_i") -% end -% subplot(1,3,2); -% plot(dgnodes(:), rhou(:)./rho(:),'LineWidth',1.3); set(gca, 'Xscale','log') -% subplot(1,3,3); -% plot(dgnodes(:), rhoE(:),'LineWidth',1.3); -% set(gca, 'Xscale','log') - -% u = sol(:,6,:); -% subplot(1,3,2) -% plot(dgnodes(:),u(:),'LineWidth',1.3); -% -% u = sol(:,7,:); -% subplot(1,3,3) -% plot(dgnodes(:), u(:),'LineWidth',1.3); -% -% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); -% w = solw(:,6,:) * rho_inf * u_inf^2; -% disp(w(1)); -% figure(2); -% semilogx(dgnodes(:),w(:)); + uplt = sol(:,6,:); + du1 = sol(:, 8,:); + figure(11); clf; hold on + plot(dgnodes(:),uplt(:),'LineWidth',1.3); +% plot(dgnodes(:),abs(sT(:))/max(abs(sT(:))),'LineWidth',1.3); +% ylim([0 1.2]) +% w1 = sol_output(:,3,:); +% w2 = sol_output(:,4,:); +% w3 = sol_output(:,5,:); +% w4 = sol_output(:,6,:); +% w5 = sol_output(:,end,:); + + + sb = sol_output(:,1,:); + sT = sol_output(:,2,:); + sY1 = sol_output(:,3,:); + sY2 = sol_output(:,4,:); + sY3 = sol_output(:,5,:); + sY4 = sol_output(:,6,:); + sY5 = sol_output(:,7,:); + figure(1); clf; hold on + plot(dgnodes(:),abs(sb(:)),'LineWidth',1.3); + plot(dgnodes(:),abs(sT(:))/5,'-r','LineWidth',1.3); + ylim([0 2]) + +% figure(3); clf; hold on; + plot(dgnodes(:),abs(sY1(:)),'-k','LineWidth',1.3); + plot(dgnodes(:),abs(sY2(:)),'-k','LineWidth',1.3); + plot(dgnodes(:),abs(sY3(:)),'-k','LineWidth',1.3); + plot(dgnodes(:),abs(sY4(:)),'-k','LineWidth',1.3); + plot(dgnodes(:),abs(sY5(:)),'-k','LineWidth',1.3); +% ylim([0, 10000]) +xlim([0.45, 0.65]) +legend("div v", "dTdx", "dYdx") + +% scatter(rhoTrue(:,1), rhoTrue(:,2)) + figure(50); + clf; + hold on; + rho1 = sol(:,1,:); + rho2 = sol(:,2,:); + rho3 = sol(:,3,:); + rho4 = sol(:,4,:); + rho5 = sol(:,5,:); + plot(dgnodes(:),rho1(:)./rho(:),'LineWidth',1.3); + plot(dgnodes(:),rho2(:)./rho(:),'LineWidth',1.3); + plot(dgnodes(:),rho3(:)./rho(:),'LineWidth',1.3); + plot(dgnodes(:),rho4(:)./rho(:),'LineWidth',1.3); + plot(dgnodes(:),rho5(:)./rho(:),'LineWidth',1.3); + ylim([-0.1 1]) + + +% figure(12); clf; hold on +% p = sol_output(:,1,:); +% plot(dgnodes(:),p(:),'LineWidth',1.3); +% scatter(pTrue(:,1), pTrue(:,2)*1e4) + drawnow % waitforbuttonpress disp(ti) @@ -59,7 +83,7 @@ %% % ttst = 27*120; % ttst = 324 -ttst = 500; +ttst = ti; sol = getsolution(['dataout/out_t' num2str(ttst)],dmd,master.npe); sol_output = getsolution(['dataout/out_outputCG_t' num2str(ttst)],dmd,master.npe); @@ -93,4 +117,21 @@ plot(dgnodes(:),rho4(:)./rho(:),'LineWidth',1.3); plot(dgnodes(:),rho5(:)./rho(:),'LineWidth',1.3); +figure(14); +subplot(1,3,1); hold on +plot(dgnodes(:),rho(:)*pde.externalparam(1),'LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)*pde.externalparam(1)) +title("\rho") + +subplot(1,3,2); hold on +plot(dgnodes(:),rhou(:)./rho(:),'LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2)) +title("u") + +subplot(1,3,3); hold on +plot(dgnodes(:),p(:),'LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4) +title("p") + + diff --git a/Applications/Hypersonics/shocktests/plotting_dT_check.m b/Applications/Hypersonics/shocktests/plotting_dT_check.m new file mode 100644 index 00000000..89c8f05b --- /dev/null +++ b/Applications/Hypersonics/shocktests/plotting_dT_check.m @@ -0,0 +1,77 @@ +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +% for ti = pde.saveSolFreq:pde.saveSolFreq:(length(pde.dt)*6) +hoverp = mesh.vdg(1,2,1) / pde.porder; +hmat = (mesh.dgnodes(2:end) - mesh.dgnodes(1:end-1)); +for ti = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt) +% for ti = 100:100:10000 +% for ti = 10000:10:12000 + sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); + sol_output = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); + dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); +% rho = sum(sol(:,1:5,:),2); +% drho = sum(sol(:,8:12,:),2); +% % AV = sol_output(:,1,:); +% u = sol(:,1,:); +% du1 = sol(:, 8,:); +% figure(11); clf; hold on +% plot(dgnodes(:),drho(:),'LineWidth',1.3); +% plot(dgnodes(:),abs(sT(:))/max(abs(sT(:))),'LineWidth',1.3); +% ylim([0 1.2]) +% w1 = sol_output(:,3,:); +% w2 = sol_output(:,4,:); +% w3 = sol_output(:,5,:); +% w4 = sol_output(:,6,:); +% w5 = sol_output(:,end,:); + +% Why don't we check the nondimensional version. +% sb = sol_output(:,1,:); + sT = sol_output(:,2,:); + T = sol_output(:,8,:); + dTdx = sT / hoverp; + dTdxFD = (T(2:end) - T(1:end-1)) ./ (hmat);% * mesh.vdg(1,2,1); + figure(1); clf + plot(dgnodes(:),dTdx(:),'LineWidth',1.3); + + figure(2); clf + plot(dgnodes(:),T(:),'LineWidth',1.3); + + figure(3); clf; hold on + plot(dgnodes(1:end-1),dTdx(1:end-1),'LineWidth',1.3); + plot(dgnodes(1:end-1),dTdxFD(:),'LineWidth',1.3); + + Pr = sol_output(:,10,:); + figure(4); clf; hold on + plot(dgnodes(:), Pr(:), 'LineWidth',1.4) +% drawnow +% waitforbuttonpress + +% sY1 = sol_output(:,3,:); +% sY2 = sol_output(:,4,:); +% sY3 = sol_output(:,5,:); +% sY4 = sol_output(:,6,:); +% sY5 = sol_output(:,7,:); +% figure(1); clf; hold on +% plot(dgnodes(:),abs(sb(:))/max(abs(sb(:))),'LineWidth',1.3); +% plot(dgnodes(:),abs(sT(:))/max(abs(sT(:))),'-*r','LineWidth',1.3); +% ylim([0 1.2]) +% +% % figure(3); clf; hold on; +% plot(dgnodes(:),abs(sY1(:))/max(abs(sY1(:))),'-.k','LineWidth',1.3); +% plot(dgnodes(:),abs(sY2(:))/max(abs(sY2(:))),'-.k','LineWidth',1.3); +% plot(dgnodes(:),abs(sY3(:))/max(abs(sY3(:))),'-.k','LineWidth',1.3); +% plot(dgnodes(:),abs(sY4(:))/max(abs(sY4(:))),'-.k','LineWidth',1.3); +% plot(dgnodes(:),abs(sY5(:))/max(abs(sY5(:))),'-.k','LineWidth',1.3); +% ylim([0, 10000]) +% xlim([0.45, 0.65]) + + drawnow + waitforbuttonpress + disp(ti) +end +% final + + + + diff --git a/Applications/Hypersonics/shocktests/sensor_outputs.m b/Applications/Hypersonics/shocktests/sensor_outputs.m new file mode 100644 index 00000000..d6290a00 --- /dev/null +++ b/Applications/Hypersonics/shocktests/sensor_outputs.m @@ -0,0 +1,107 @@ +function o = sensor_outputs(u, q, w, v, x, t, mu, eta, hm) + % Mutation outputs + nspecies = 5; + nenergy = 1; + ndim = 1; + p = eta(1); + gam = eta(2); + gam1 = gam - 1; + + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e12; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size +% hm = v(2); + + % % Get base variables + % rvec = u(1:nspecies); + % ru = u(nspecies+1); + % % rv = udg(3); + % rE = u(nspecies+nd+1); + + % rx = sum(-q(1:nspecies)); + % rux = -q(nspecies+1); + + % % Regularization + % rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here + + dT_drho_i = eta(2*nspecies+3:3*nspecies+2); + dT_drhoe = eta(3*nspecies+3); + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha) + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + + rhou = u(nspecies+1); + drhou_dx = -q(nspecies+1); + rhoE = u(nspecies+ndim+1); + drhoE_dx = -q(nspecies+ndim+1); + + % Some useful derived quantities + rho_inv = 1.0 / rho; + drho_dx_inv = 1.0 / drho_dx; + uv = rhou * rho_inv; %velocity + dudx = (drhou_dx - drho_dx*uv)*rho_inv; + + % Simple derived working quantities + uv = rhou.*rho_inv; + E = rhoE * rho_inv; %energy + H = E + p*rho_inv; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + duv_dx = (drhou_dx - drho_dx.*uv).*rho_inv; + div_v = (duv_dx); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + sb = - (hm./porder) .* (div_v./c_star); + + % % Dilatation Sensor sb + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * uv * uv; + duTu2_dx = uv .* duv_dx; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + Tx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + sT = hm./porder .* (Tx) + + %%%%%%%% Modify appropriate coefficients + % kappa = kappa + avk; + % viscshear = viscshear + avs; + % viscbulk = 0 + avb; + % D_vec = D_vec + avDvec; + + %%%%%%%% Calculation of J_i + % for ispecies = 1:nspecies + % Y_i(ispecies) = rho_i(ispecies) / rho; + % dYdx_i(ispecies) = (q(ispecies) * rho - rho_i(ispecies) * drhodx) * drhodxinv^2; + % end + Y_i = rho_i ./ rho; +% dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + dY_dx_i = (drho_dx_i - Y_i * drho_dx) * rho_inv; + + sY = hm./porder .* dY_dx_i + o(1) = sb; + o(2) = sT; + o(2+1:2+nspecies) = sY; + +end From aae915eb98b947d219e65d18bbce3e2486520d9b Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 4 Oct 2022 14:54:46 -0400 Subject: [PATCH 17/23] physics based and 2d --- .../shocktests/app/opuAvfield_MPP_PB.cpp | 172 ++++++ .../shocktests/app/opuFbou_MPP_PB.cpp | 523 ++++++++++++++++++ .../shocktests/app/opuFlux_MPP_PB.cpp | 501 +++++++++++++++++ .../app/opuOutput_MPP_sensors_PB.cpp | 179 ++++++ .../shocktests/app/opuOutput_viscTerms.cpp | 115 ++++ .../shocktests/avfieldPhysical1d.m | 71 +++ .../Hypersonics/shocktests/getStates2d.py | 135 +++++ .../shocktests/pdeapp_physicsbased.m | 179 ++++++ .../Hypersonics/shocktests/pdemodel_2d.m | 361 ++++++++++++ .../shocktests/pdemodel_physicsbased.m | 337 +++++++++++ .../shocktests/plotting_visc_test.m | 80 +++ 11 files changed, 2653 insertions(+) create mode 100644 Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuFlux_MPP_PB.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors_PB.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuOutput_viscTerms.cpp create mode 100644 Applications/Hypersonics/shocktests/avfieldPhysical1d.m create mode 100644 Applications/Hypersonics/shocktests/getStates2d.py create mode 100644 Applications/Hypersonics/shocktests/pdeapp_physicsbased.m create mode 100644 Applications/Hypersonics/shocktests/pdemodel_2d.m create mode 100644 Applications/Hypersonics/shocktests/pdemodel_physicsbased.m create mode 100644 Applications/Hypersonics/shocktests/plotting_visc_test.m diff --git a/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp new file mode 100644 index 00000000..304157c6 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp @@ -0,0 +1,172 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P()/rhoe_scale; // pressure + uinf2 = mix->mixtureFrozenGamma(); // gamma + // uinf3 = (mix->frozenThermalConductivity() / uinf[5]) / (mix->viscosity() / uinf[4]); // cp / Pr^* + // uinf3 = 0.0; + uinf3 = 1.0/0.9; + + T t2 = udg6*udg6; + T t3 = uinf2*2.0; + T t4 = uinf2+1.0; + T t5 = 1.0/3.141592653589793; + T t6 = -param18; + T t7 = 1.0/param15; + T t10 = udg8+udg9+udg10+udg11+udg12; + T t11 = param17*1.0E+12; + T t12 = param18*1.0E+12; + T t13 = udg1*1.0E+12; + T t14 = udg2*1.0E+12; + T t15 = udg3*1.0E+12; + T t16 = udg4*1.0E+12; + T t17 = udg5*1.0E+12; + T t8 = t3-2.0; + T t9 = 1.0/t4; + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = -t12; + T t24 = t5*t18; + T t25 = t5*t19; + T t26 = t5*t20; + T t27 = t5*t21; + T t28 = t5*t22; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t39 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t40 = 1.0/t39; + T t41 = t40*t40; + T t42 = t40*udg7; + T t43 = t40*uinf1; + T t45 = t10*t40*udg6; + T t44 = t2*t41; + T t46 = -t45; + T t48 = t42*1.0E+12; + T t49 = t43*1.0E+12; + T t50 = -t40*(t45-udg13); + T t51 = t42+t43-1.0E-4; + T t53 = t40*(t45-udg13)*-1.0E+12; + T t47 = t46+udg13; + T t52 = t50-1.0E+4; + T t54 = t48+t49-1.0E+8; + T t56 = t53-1.0E+16; + T t55 = atan(t54); + T t57 = atan(t56); + T t58 = t5*t55; + T t60 = t5*t57; + T t59 = t58+1.0/2.0; + T t61 = t60-1.0/2.0; + T t62 = t51*t59; + T t63 = -t61*(t40*(t45-udg13)+1.0E+4); + T t64 = t61*(t40*(t45-udg13)+1.0E+4); + T t65 = t64*-1.0E+12; + T t66 = t62+1.000000003182454E-4; + T t68 = t63-2.0E+4; + T t67 = t8*t9*t66; + T t70 = t65-2.0E+16; + T t69 = 1.0/sqrt(t67); + T t71 = atan(t70); + T t74 = t44+t67; + T t72 = t5*t71; + T t75 = sqrt(t74); + T t73 = t72+1.0/2.0; + T t76 = -t73*(t64+2.0E+4); + T t77 = t64+t76+1.0E+4; + T t78 = odg9*t7*t69*t77; + T t79 = -t78; + T t81 = t78*1.0E+12; + T t80 = param17+t79; + T t82 = -t81; + T t83 = t11+t82; + T t84 = atan(t83); + T t85 = t5*t84; + T t86 = t85-1.0/2.0; + T t87 = t80*t86; + T t88 = t87*1.0E+12; + T t89 = t6+t87+3.182454300088011E-13; + T t90 = t23+t88+3.182454300088011E-1; + T t91 = atan(t90); + T t92 = t5*t91; + T t93 = t92+1.0/2.0; + T t94 = t89*t93; + T t95 = -t94; + T t96 = t87+t95; + f[j+npe*0+npe*nce*k] = odg9*param16*t7*t39*t75*t96; + f[j+npe*1+npe*nce*k] = 1e-3; + f[j+npe*2+npe*nce*k] = odg9*param16*t7*t39*t75*t96*uinf3; + f[j+npe*3+npe*nce*k] = 1e-4; + f[j+npe*4+npe*nce*k] = 1e-4; + f[j+npe*5+npe*nce*k] = 1e-4; + f[j+npe*6+npe*nce*k] = 1e-4; + f[j+npe*7+npe*nce*k] = 1e-4; + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp new file mode 100644 index 00000000..94660035 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp @@ -0,0 +1,523 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Uwork[5]; + double dTdU[6]; + int nspecies = 5; + int ndim = 1; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + + uinf1 = mix->P()/rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + + T t2 = odg4+uinf2; + T t3 = odg5+uinf3; + T t4 = odg6+uinf4; + T t5 = odg7+uinf5; + T t6 = odg2+uinf12; + T t7 = odg8+uinf6; + T t8 = udg1*udg1; + T t9 = udg2*udg2; + T t10 = udg3*udg3; + T t11 = udg4*udg4; + T t12 = udg5*udg5; + T t13 = udg6*udg6; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = udg1*1.0E+9; + T t17 = udg2*1.0E+9; + T t18 = udg3*1.0E+9; + T t19 = udg4*1.0E+9; + T t20 = udg5*1.0E+9; + T t26 = udg1*1.0E+12; + T t27 = udg2*1.0E+12; + T t28 = udg3*1.0E+12; + T t29 = udg4*1.0E+12; + T t30 = udg5*1.0E+12; + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t25 = atan(t20); + T t31 = atan(t26); + T t32 = atan(t27); + T t33 = atan(t28); + T t34 = atan(t29); + T t35 = atan(t30); + T t51 = t8*1.0E+18; + T t52 = t9*1.0E+18; + T t53 = t10*1.0E+18; + T t54 = t11*1.0E+18; + T t55 = t12*1.0E+18; + T t36 = t14*t21; + T t37 = t14*t22; + T t38 = t14*t23; + T t39 = t14*t24; + T t40 = t14*t25; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t61 = t51+1.0; + T t62 = t52+1.0; + T t63 = t53+1.0; + T t64 = t54+1.0; + T t65 = t55+1.0; + T t46 = t36+1.0/2.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t66 = t41+1.0/2.0; + T t67 = t42+1.0/2.0; + T t68 = t43+1.0/2.0; + T t69 = t44+1.0/2.0; + T t70 = t45+1.0/2.0; + T t76 = 1.0/t61; + T t77 = 1.0/t62; + T t78 = 1.0/t63; + T t79 = 1.0/t64; + T t80 = 1.0/t65; + T t56 = t46*udg1; + T t57 = t47*udg2; + T t58 = t48*udg3; + T t59 = t49*udg4; + T t60 = t50*udg5; + T t71 = t66*udg1; + T t72 = t67*udg2; + T t73 = t68*udg3; + T t74 = t69*udg4; + T t75 = t70*udg5; + T t81 = t14*t16*t76; + T t82 = t14*t17*t77; + T t83 = t14*t18*t78; + T t84 = t14*t19*t79; + T t85 = t14*t20*t80; + T t86 = t56+3.183098229442294E-10; + T t87 = t57+3.183098229442294E-10; + T t88 = t58+3.183098229442294E-10; + T t89 = t59+3.183098229442294E-10; + T t90 = t60+3.183098229442294E-10; + T t91 = t46+t81; + T t92 = t47+t82; + T t93 = t48+t83; + T t94 = t49+t84; + T t95 = t50+t85; + T t101 = t56+t57+t58+t59+t60+1.591549114721147E-9; + T t104 = t71+t72+t73+t74+t75+1.591227150044006E-12; + T t96 = t91*udg8; + T t97 = t92*udg9; + T t98 = t93*udg10; + T t99 = t94*udg11; + T t100 = t95*udg12; + T t102 = 1.0/t101; + T t105 = 1.0/t104; + T t103 = t102*t102; + T t106 = t96*t101; + T t107 = t97*t101; + T t108 = t98*t101; + T t109 = t99*t101; + T t110 = t100*t101; + T t116 = t96+t97+t98+t99+t100; + T t111 = -t106; + T t112 = -t107; + T t113 = -t108; + T t114 = -t109; + T t115 = -t110; + T t117 = t86*t116; + T t118 = t87*t116; + T t119 = t88*t116; + T t120 = t89*t116; + T t121 = t90*t116; + T t122 = t102*t116*udg6; + T t123 = -t122; + T t125 = t111+t117; + T t126 = t112+t118; + T t127 = t113+t119; + T t128 = t114+t120; + T t129 = t115+t121; + T t130 = -odg1*t102*(t122-udg13); + T t131 = t6*t15*t102*(t122-udg13)*(-4.0/3.0); + T t132 = -t2*t103*(t106-t117); + T t133 = -t3*t103*(t107-t118); + T t134 = -t4*t103*(t108-t119); + T t135 = -t5*t103*(t109-t120); + T t136 = -t7*t103*(t110-t121); + T t124 = t123+udg13; + T t137 = t132+t133+t134+t135+t136; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t105*udg6*(t71+3.182454300088011E-13); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t105*udg6*(t72+3.182454300088011E-13); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t105*udg6*(t73+3.182454300088011E-13); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t105*udg6*(t74+3.182454300088011E-13); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t105*udg6*(t75+3.182454300088011E-13); + f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(t130+t131+uinf1+t13*t105); + f[6*ng+i] = -nlg1*(-udg6*(t105*udg7+t105*uinf1)+uinf7*(t86*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t2*t102*(t106-t117))+uinf8*(t87*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t3*t102*(t107-t118))+uinf9*(t88*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t4*t102*(t108-t119))+uinf10*(t89*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t5*t102*(t109-t120))+uinf11*(t90*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t7*t102*(t110-t121))+t102*udg6*(odg1*t102*(t122-udg13)+t6*t15*t102*(t122-udg13)*(4.0/3.0))-(t15*(odg3+uinf13)*(t96*uinf14+t97*uinf15+t98*uinf16+t99*uinf17+t100*uinf18+uinf19*(udg6+udg14-(t13*t103*t116)/2.0)))/param18)+tau7*(udg7-uhg7); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Uwork[5]; + double dTdU[6]; + int nspecies = 5; + int ndim = 1; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + + uinf1 = mix->P()/rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + + + T t2 = odg4+uinf2; + T t3 = odg5+uinf3; + T t4 = odg6+uinf4; + T t5 = odg7+uinf5; + T t6 = odg2+uinf12; + T t7 = odg8+uinf6; + T t8 = udg1*udg1; + T t9 = udg2*udg2; + T t10 = udg3*udg3; + T t11 = udg4*udg4; + T t12 = udg5*udg5; + T t13 = udg6*udg6; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = udg1*1.0E+9; + T t17 = udg2*1.0E+9; + T t18 = udg3*1.0E+9; + T t19 = udg4*1.0E+9; + T t20 = udg5*1.0E+9; + T t26 = udg1*1.0E+12; + T t27 = udg2*1.0E+12; + T t28 = udg3*1.0E+12; + T t29 = udg4*1.0E+12; + T t30 = udg5*1.0E+12; + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t25 = atan(t20); + T t31 = atan(t26); + T t32 = atan(t27); + T t33 = atan(t28); + T t34 = atan(t29); + T t35 = atan(t30); + T t51 = t8*1.0E+18; + T t52 = t9*1.0E+18; + T t53 = t10*1.0E+18; + T t54 = t11*1.0E+18; + T t55 = t12*1.0E+18; + T t36 = t14*t21; + T t37 = t14*t22; + T t38 = t14*t23; + T t39 = t14*t24; + T t40 = t14*t25; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t61 = t51+1.0; + T t62 = t52+1.0; + T t63 = t53+1.0; + T t64 = t54+1.0; + T t65 = t55+1.0; + T t46 = t36+1.0/2.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t66 = t41+1.0/2.0; + T t67 = t42+1.0/2.0; + T t68 = t43+1.0/2.0; + T t69 = t44+1.0/2.0; + T t70 = t45+1.0/2.0; + T t76 = 1.0/t61; + T t77 = 1.0/t62; + T t78 = 1.0/t63; + T t79 = 1.0/t64; + T t80 = 1.0/t65; + T t56 = t46*udg1; + T t57 = t47*udg2; + T t58 = t48*udg3; + T t59 = t49*udg4; + T t60 = t50*udg5; + T t71 = t66*udg1; + T t72 = t67*udg2; + T t73 = t68*udg3; + T t74 = t69*udg4; + T t75 = t70*udg5; + T t81 = t14*t16*t76; + T t82 = t14*t17*t77; + T t83 = t14*t18*t78; + T t84 = t14*t19*t79; + T t85 = t14*t20*t80; + T t86 = t56+3.183098229442294E-10; + T t87 = t57+3.183098229442294E-10; + T t88 = t58+3.183098229442294E-10; + T t89 = t59+3.183098229442294E-10; + T t90 = t60+3.183098229442294E-10; + T t91 = t46+t81; + T t92 = t47+t82; + T t93 = t48+t83; + T t94 = t49+t84; + T t95 = t50+t85; + T t101 = t56+t57+t58+t59+t60+1.591549114721147E-9; + T t104 = t71+t72+t73+t74+t75+1.591227150044006E-12; + T t96 = t91*udg8; + T t97 = t92*udg9; + T t98 = t93*udg10; + T t99 = t94*udg11; + T t100 = t95*udg12; + T t102 = 1.0/t101; + T t105 = 1.0/t104; + T t103 = t102*t102; + T t106 = t96*t101; + T t107 = t97*t101; + T t108 = t98*t101; + T t109 = t99*t101; + T t110 = t100*t101; + T t116 = t96+t97+t98+t99+t100; + T t111 = -t106; + T t112 = -t107; + T t113 = -t108; + T t114 = -t109; + T t115 = -t110; + T t117 = t86*t116; + T t118 = t87*t116; + T t119 = t88*t116; + T t120 = t89*t116; + T t121 = t90*t116; + T t122 = t102*t116*udg6; + T t123 = -t122; + T t125 = t111+t117; + T t126 = t112+t118; + T t127 = t113+t119; + T t128 = t114+t120; + T t129 = t115+t121; + T t130 = -odg1*t102*(t122-udg13); + T t131 = t6*t15*t102*(t122-udg13)*(-4.0/3.0); + T t132 = -t2*t103*(t106-t117); + T t133 = -t3*t103*(t107-t118); + T t134 = -t4*t103*(t108-t119); + T t135 = -t5*t103*(t109-t120); + T t136 = -t7*t103*(t110-t121); + T t124 = t123+udg13; + T t137 = t132+t133+t134+t135+t136; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t105*udg6*(t71+3.182454300088011E-13); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t105*udg6*(t72+3.182454300088011E-13); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t105*udg6*(t73+3.182454300088011E-13); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t105*udg6*(t74+3.182454300088011E-13); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t105*udg6*(t75+3.182454300088011E-13); + f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(t130+t131+uinf1+t13*t105); + f[6*ng+i] = -nlg1*(-udg6*(t105*udg7+t105*uinf1)+uinf7*(t86*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t2*t102*(t106-t117))+uinf8*(t87*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t3*t102*(t107-t118))+uinf9*(t88*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t4*t102*(t108-t119))+uinf10*(t89*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t5*t102*(t109-t120))+uinf11*(t90*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t7*t102*(t110-t121))+t102*udg6*(odg1*t102*(t122-udg13)+t6*t15*t102*(t122-udg13)*(4.0/3.0))-(t15*(odg3+uinf13)*(t96*uinf14+t97*uinf15+t98*uinf16+t99*uinf17+t100*uinf18+uinf19*(udg6+udg14-(t13*t103*t116)/2.0)))/param18)+tau7*(udg7-uhg7); + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuFlux_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuFlux_MPP_PB.cpp new file mode 100644 index 00000000..8ca61d26 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuFlux_MPP_PB.cpp @@ -0,0 +1,501 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Uwork[5]; + double dTdU[6]; + int nspecies = 5; + int ndim = 1; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + + uinf1 = mix->P()/rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = h_i[0]; // h_1 + uinf8 = h_i[1]; // h_2 + uinf9 = h_i[2]; // h_3 + uinf10 = h_i[3]; // h_4 + uinf11 = h_i[4]; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + + T t2 = odg4+uinf2; + T t3 = odg5+uinf3; + T t4 = odg6+uinf4; + T t5 = odg7+uinf5; + T t6 = odg2+uinf12; + T t7 = odg8+uinf6; + T t8 = udg1*udg1; + T t9 = udg2*udg2; + T t10 = udg3*udg3; + T t11 = udg4*udg4; + T t12 = udg5*udg5; + T t13 = udg6*udg6; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = udg1*1.0E+12; + T t17 = udg2*1.0E+12; + T t18 = udg3*1.0E+12; + T t19 = udg4*1.0E+12; + T t20 = udg5*1.0E+12; + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t25 = atan(t20); + T t41 = t8*1.0E+24; + T t42 = t9*1.0E+24; + T t43 = t10*1.0E+24; + T t44 = t11*1.0E+24; + T t45 = t12*1.0E+24; + T t26 = t14*t21; + T t27 = t14*t22; + T t28 = t14*t23; + T t29 = t14*t24; + T t30 = t14*t25; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t49 = t44+1.0; + T t50 = t45+1.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t35 = t30+1.0/2.0; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t54 = 1.0/t49; + T t55 = 1.0/t50; + T t36 = t31*udg1; + T t37 = t32*udg2; + T t38 = t33*udg3; + T t39 = t34*udg4; + T t40 = t35*udg5; + T t61 = t14*t16*t51; + T t62 = t14*t17*t52; + T t63 = t14*t18*t53; + T t64 = t14*t19*t54; + T t65 = t14*t20*t55; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t58 = t38+3.182454300088011E-13; + T t59 = t39+3.182454300088011E-13; + T t60 = t40+3.182454300088011E-13; + T t66 = t31+t61; + T t67 = t32+t62; + T t68 = t33+t63; + T t69 = t34+t64; + T t70 = t35+t65; + T t76 = t36+t37+t38+t39+t40+1.591227150044006E-12; + T t71 = t66*udg8; + T t72 = t67*udg9; + T t73 = t68*udg10; + T t74 = t69*udg11; + T t75 = t70*udg12; + T t77 = 1.0/t76; + T t78 = t77*t77; + T t79 = t71*t76; + T t80 = t72*t76; + T t81 = t73*t76; + T t82 = t74*t76; + T t83 = t75*t76; + T t89 = t71+t72+t73+t74+t75; + T t84 = -t79; + T t85 = -t80; + T t86 = -t81; + T t87 = -t82; + T t88 = -t83; + T t90 = t56*t89; + T t91 = t57*t89; + T t92 = t58*t89; + T t93 = t59*t89; + T t94 = t60*t89; + T t95 = t77*t89*udg6; + T t96 = -t95; + T t98 = t84+t90; + T t99 = t85+t91; + T t100 = t86+t92; + T t101 = t87+t93; + T t102 = t88+t94; + T t103 = -odg1*t77*(t95-udg13); + T t104 = t6*t15*t77*(t95-udg13)*(-4.0/3.0); + T t105 = -t2*t77*(t79-t90); + T t106 = -t2*t78*(t79-t90); + T t107 = -t3*t77*(t80-t91); + T t108 = -t3*t78*(t80-t91); + T t109 = -t4*t77*(t81-t92); + T t110 = -t4*t78*(t81-t92); + T t111 = -t5*t77*(t82-t93); + T t112 = -t5*t78*(t82-t93); + T t113 = -t7*t77*(t83-t94); + T t114 = -t7*t78*(t83-t94); + T t115 = t2*t77*(t79-t90); + T t116 = t3*t77*(t80-t91); + T t117 = t4*t77*(t81-t92); + T t118 = t5*t77*(t82-t93); + T t119 = t7*t77*(t83-t94); + T t121 = -t56*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)); + T t122 = -t57*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)); + T t123 = -t58*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)); + T t124 = -t59*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)); + T t125 = -t60*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)); + T t97 = t96+udg13; + T t120 = t106+t108+t110+t112+t114; + f[0*ng+i] = t115+t121+t56*t77*udg6; + f[1*ng+i] = t116+t122+t57*t77*udg6; + f[2*ng+i] = t117+t123+t58*t77*udg6; + f[3*ng+i] = t118+t124+t59*t77*udg6; + f[4*ng+i] = t119+t125+t60*t77*udg6; + f[5*ng+i] = t103+t104+uinf1+t13*t77; + f[6*ng+i] = -uinf7*(t105+t56*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)))-uinf8*(t107+t57*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)))-uinf9*(t109+t58*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)))-uinf10*(t111+t59*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)))-uinf11*(t113+t60*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94)))+udg6*(t77*udg7+t77*uinf1)-t77*udg6*(odg1*t77*(t95-udg13)+t6*t15*t77*(t95-udg13)*(4.0/3.0))+(t15*(odg3+uinf13)*(t71*uinf14+t72*uinf15+t73*uinf16+t74*uinf17+t75*uinf18+uinf19*(udg14-(t13*t78*t89)/2.0+t77*udg6*(t95-udg13))))/param18; + + // T t2 = odg4+uinf2; + // T t3 = odg5+uinf3; + // T t4 = odg6+uinf4; + // T t5 = odg7+uinf5; + // T t6 = odg2+uinf12; + // T t7 = odg8+uinf6; + // T t8 = udg1*udg1; + // T t9 = udg2*udg2; + // T t10 = udg3*udg3; + // T t11 = udg4*udg4; + // T t12 = udg5*udg5; + // T t13 = udg6*udg6; + // T t14 = 1.0/3.141592653589793; + // T t15 = 1.0/param19; + // T t16 = udg1*1.0E+12; + // T t17 = udg2*1.0E+12; + // T t18 = udg3*1.0E+12; + // T t19 = udg4*1.0E+12; + // T t20 = udg5*1.0E+12; + // T t21 = atan(t16); + // T t22 = atan(t17); + // T t23 = atan(t18); + // T t24 = atan(t19); + // T t25 = atan(t20); + // T t41 = t8*1.0E+24; + // T t42 = t9*1.0E+24; + // T t43 = t10*1.0E+24; + // T t44 = t11*1.0E+24; + // T t45 = t12*1.0E+24; + // T t26 = t14*t21; + // T t27 = t14*t22; + // T t28 = t14*t23; + // T t29 = t14*t24; + // T t30 = t14*t25; + // T t46 = t41+1.0; + // T t47 = t42+1.0; + // T t48 = t43+1.0; + // T t49 = t44+1.0; + // T t50 = t45+1.0; + // T t31 = t26+1.0/2.0; + // T t32 = t27+1.0/2.0; + // T t33 = t28+1.0/2.0; + // T t34 = t29+1.0/2.0; + // T t35 = t30+1.0/2.0; + // T t51 = 1.0/t46; + // T t52 = 1.0/t47; + // T t53 = 1.0/t48; + // T t54 = 1.0/t49; + // T t55 = 1.0/t50; + // T t36 = t31*udg1; + // T t37 = t32*udg2; + // T t38 = t33*udg3; + // T t39 = t34*udg4; + // T t40 = t35*udg5; + // T t61 = t14*t16*t51; + // T t62 = t14*t17*t52; + // T t63 = t14*t18*t53; + // T t64 = t14*t19*t54; + // T t65 = t14*t20*t55; + // T t56 = t36+3.182454300088011E-13; + // T t57 = t37+3.182454300088011E-13; + // T t58 = t38+3.182454300088011E-13; + // T t59 = t39+3.182454300088011E-13; + // T t60 = t40+3.182454300088011E-13; + // T t66 = t31+t61; + // T t67 = t32+t62; + // T t68 = t33+t63; + // T t69 = t34+t64; + // T t70 = t35+t65; + // T t76 = t36+t37+t38+t39+t40+1.591227150044006E-12; + // T t71 = t66*udg8; + // T t72 = t67*udg9; + // T t73 = t68*udg10; + // T t74 = t69*udg11; + // T t75 = t70*udg12; + // T t77 = 1.0/t76; + // T t78 = t77*t77; + // T t79 = t71*t76; + // T t80 = t72*t76; + // T t81 = t73*t76; + // T t82 = t74*t76; + // T t83 = t75*t76; + // T t89 = t71+t72+t73+t74+t75; + // T t84 = -t79; + // T t85 = -t80; + // T t86 = -t81; + // T t87 = -t82; + // T t88 = -t83; + // T t90 = t56*t89; + // T t91 = t57*t89; + // T t92 = t58*t89; + // T t93 = t59*t89; + // T t94 = t60*t89; + // T t95 = t77*t89*udg6; + // T t96 = -t95; + // T t98 = t84+t90; + // T t99 = t85+t91; + // T t100 = t86+t92; + // T t101 = t87+t93; + // T t102 = t88+t94; + // T t103 = -odg1*t77*(t95-udg13); + // T t104 = t6*t15*t77*(t95-udg13)*(-4.0/3.0); + // T t105 = -t2*t78*(t79-t90); + // T t106 = -t3*t78*(t80-t91); + // T t107 = -t4*t78*(t81-t92); + // T t108 = -t5*t78*(t82-t93); + // T t109 = -t7*t78*(t83-t94); + // T t97 = t96+udg13; + // T t110 = t105+t106+t107+t108+t109; + // f[0*ng+i] = t56*t77*udg6; + // f[1*ng+i] = t57*t77*udg6; + // f[2*ng+i] = t58*t77*udg6; + // f[3*ng+i] = t59*t77*udg6; + // f[4*ng+i] = t60*t77*udg6; + // f[5*ng+i] = t103+t104+uinf1+t13*t77; + // f[6*ng+i] = udg6*(t77*udg7+t77*uinf1)-uinf7*(t56*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94))-t2*t77*(t79-t90))-uinf8*(t57*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94))-t3*t77*(t80-t91))-uinf9*(t58*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94))-t4*t77*(t81-t92))-uinf10*(t59*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94))-t5*t77*(t82-t93))-uinf11*(t60*(t2*t78*(t79-t90)+t3*t78*(t80-t91)+t4*t78*(t81-t92)+t5*t78*(t82-t93)+t7*t78*(t83-t94))-t7*t77*(t83-t94))-t77*udg6*(odg1*t77*(t95-udg13)+t6*t15*t77*(t95-udg13)*(4.0/3.0))+(t15*(odg3+uinf13)*(t71*uinf14+t72*uinf15+t73*uinf16+t74*uinf17+t75*uinf18+uinf19*(udg6+udg14-(t13*t78*t89)/2.0)))/param18; + + // T t2 = odg4+uinf2; + // T t3 = odg5+uinf3; + // T t4 = odg6+uinf4; + // T t5 = odg7+uinf5; + // T t6 = odg2+uinf12; + // T t7 = odg8+uinf6; + // T t8 = udg1*udg1; + // T t9 = udg2*udg2; + // T t10 = udg3*udg3; + // T t11 = udg4*udg4; + // T t12 = udg5*udg5; + // T t13 = udg6*udg6; + // T t14 = 1.0/3.141592653589793; + // T t15 = 1.0/param19; + // T t16 = udg1*1.0E+9; + // T t17 = udg2*1.0E+9; + // T t18 = udg3*1.0E+9; + // T t19 = udg4*1.0E+9; + // T t20 = udg5*1.0E+9; + // T t26 = udg1*1.0E+12; + // T t27 = udg2*1.0E+12; + // T t28 = udg3*1.0E+12; + // T t29 = udg4*1.0E+12; + // T t30 = udg5*1.0E+12; + // T t21 = atan(t16); + // T t22 = atan(t17); + // T t23 = atan(t18); + // T t24 = atan(t19); + // T t25 = atan(t20); + // T t31 = atan(t26); + // T t32 = atan(t27); + // T t33 = atan(t28); + // T t34 = atan(t29); + // T t35 = atan(t30); + // T t51 = t8*1.0E+18; + // T t52 = t9*1.0E+18; + // T t53 = t10*1.0E+18; + // T t54 = t11*1.0E+18; + // T t55 = t12*1.0E+18; + // T t36 = t14*t21; + // T t37 = t14*t22; + // T t38 = t14*t23; + // T t39 = t14*t24; + // T t40 = t14*t25; + // T t41 = t14*t31; + // T t42 = t14*t32; + // T t43 = t14*t33; + // T t44 = t14*t34; + // T t45 = t14*t35; + // T t61 = t51+1.0; + // T t62 = t52+1.0; + // T t63 = t53+1.0; + // T t64 = t54+1.0; + // T t65 = t55+1.0; + // T t46 = t36+1.0/2.0; + // T t47 = t37+1.0/2.0; + // T t48 = t38+1.0/2.0; + // T t49 = t39+1.0/2.0; + // T t50 = t40+1.0/2.0; + // T t66 = t41+1.0/2.0; + // T t67 = t42+1.0/2.0; + // T t68 = t43+1.0/2.0; + // T t69 = t44+1.0/2.0; + // T t70 = t45+1.0/2.0; + // T t76 = 1.0/t61; + // T t77 = 1.0/t62; + // T t78 = 1.0/t63; + // T t79 = 1.0/t64; + // T t80 = 1.0/t65; + // T t56 = t46*udg1; + // T t57 = t47*udg2; + // T t58 = t48*udg3; + // T t59 = t49*udg4; + // T t60 = t50*udg5; + // T t71 = t66*udg1; + // T t72 = t67*udg2; + // T t73 = t68*udg3; + // T t74 = t69*udg4; + // T t75 = t70*udg5; + // T t81 = t14*t16*t76; + // T t82 = t14*t17*t77; + // T t83 = t14*t18*t78; + // T t84 = t14*t19*t79; + // T t85 = t14*t20*t80; + // T t86 = t56+3.183098229442294E-10; + // T t87 = t57+3.183098229442294E-10; + // T t88 = t58+3.183098229442294E-10; + // T t89 = t59+3.183098229442294E-10; + // T t90 = t60+3.183098229442294E-10; + // T t91 = t46+t81; + // T t92 = t47+t82; + // T t93 = t48+t83; + // T t94 = t49+t84; + // T t95 = t50+t85; + // T t101 = t56+t57+t58+t59+t60+1.591549114721147E-9; + // T t104 = t71+t72+t73+t74+t75+1.591227150044006E-12; + // T t96 = t91*udg8; + // T t97 = t92*udg9; + // T t98 = t93*udg10; + // T t99 = t94*udg11; + // T t100 = t95*udg12; + // T t102 = 1.0/t101; + // T t105 = 1.0/t104; + // T t103 = t102*t102; + // T t106 = t96*t101; + // T t107 = t97*t101; + // T t108 = t98*t101; + // T t109 = t99*t101; + // T t110 = t100*t101; + // T t116 = t96+t97+t98+t99+t100; + // T t111 = -t106; + // T t112 = -t107; + // T t113 = -t108; + // T t114 = -t109; + // T t115 = -t110; + // T t117 = t86*t116; + // T t118 = t87*t116; + // T t119 = t88*t116; + // T t120 = t89*t116; + // T t121 = t90*t116; + // T t122 = t102*t116*udg6; + // T t123 = -t122; + // T t125 = t111+t117; + // T t126 = t112+t118; + // T t127 = t113+t119; + // T t128 = t114+t120; + // T t129 = t115+t121; + // T t130 = -odg1*t102*(t122-udg13); + // T t131 = t6*t15*t102*(t122-udg13)*(-4.0/3.0); + // T t132 = -t2*t103*(t106-t117); + // T t133 = -t3*t103*(t107-t118); + // T t134 = -t4*t103*(t108-t119); + // T t135 = -t5*t103*(t109-t120); + // T t136 = -t7*t103*(t110-t121); + // T t124 = t123+udg13; + // T t137 = t132+t133+t134+t135+t136; + // f[0*ng+i] = t105*udg6*(t71+3.182454300088011E-13); + // f[1*ng+i] = t105*udg6*(t72+3.182454300088011E-13); + // f[2*ng+i] = t105*udg6*(t73+3.182454300088011E-13); + // f[3*ng+i] = t105*udg6*(t74+3.182454300088011E-13); + // f[4*ng+i] = t105*udg6*(t75+3.182454300088011E-13); + // f[5*ng+i] = t130+t131+uinf1+t13*t105; + // f[6*ng+i] = udg6*(t105*udg7+t105*uinf1)-uinf7*(t86*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t2*t102*(t106-t117))-uinf8*(t87*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t3*t102*(t107-t118))-uinf9*(t88*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t4*t102*(t108-t119))-uinf10*(t89*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t5*t102*(t109-t120))-uinf11*(t90*(t2*t103*(t106-t117)+t3*t103*(t107-t118)+t4*t103*(t108-t119)+t5*t103*(t109-t120)+t7*t103*(t110-t121))-t7*t102*(t110-t121))-t102*udg6*(odg1*t102*(t122-udg13)+t6*t15*t102*(t122-udg13)*(4.0/3.0))+(t15*(odg3+uinf13)*(t96*uinf14+t97*uinf15+t98*uinf16+t99*uinf17+t100*uinf18+uinf19*(udg6+udg14-(t13*t103*t116)/2.0)))/param18; + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors_PB.cpp b/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors_PB.cpp new file mode 100644 index 00000000..29b6043d --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors_PB.cpp @@ -0,0 +1,179 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Uwork[5]; + double dTdU[6]; + int nspecies = 5; + int ndim = 1; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P()/rhoe_scale; // pressure + uinf2 = mix->mixtureFrozenGamma(); // gamma + uinf3 = 1.0 / 0.9; // cp / Pr^* + + T t2 = udg6*udg6; + T t3 = uinf2*2.0; + T t4 = uinf2+1.0; + T t5 = 1.0/3.141592653589793; + T t6 = -param18; + T t7 = 1.0/param15; + T t10 = udg8+udg9+udg10+udg11+udg12; + T t11 = param17*1.0E+12; + T t12 = param18*1.0E+12; + T t13 = udg1*1.0E+12; + T t14 = udg2*1.0E+12; + T t15 = udg3*1.0E+12; + T t16 = udg4*1.0E+12; + T t17 = udg5*1.0E+12; + T t8 = t3-2.0; + T t9 = 1.0/t4; + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = -t12; + T t24 = t5*t18; + T t25 = t5*t19; + T t26 = t5*t20; + T t27 = t5*t21; + T t28 = t5*t22; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t39 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t40 = 1.0/t39; + T t41 = t40*t40; + T t42 = t40*udg7; + T t43 = t40*uinf1; + T t45 = t10*t40*udg6; + T t44 = t2*t41; + T t46 = -t45; + T t48 = t42*1.0E+12; + T t49 = t43*1.0E+12; + T t50 = -t40*(t45-udg13); + T t51 = t42+t43-1.0E-4; + T t53 = t40*(t45-udg13)*-1.0E+12; + T t47 = t46+udg13; + T t52 = t50-1.0E+4; + T t54 = t48+t49-1.0E+8; + T t56 = t53-1.0E+16; + T t55 = atan(t54); + T t57 = atan(t56); + T t58 = t5*t55; + T t60 = t5*t57; + T t59 = t58+1.0/2.0; + T t61 = t60-1.0/2.0; + T t62 = t51*t59; + T t63 = -t61*(t40*(t45-udg13)+1.0E+4); + T t64 = t61*(t40*(t45-udg13)+1.0E+4); + T t65 = t64*-1.0E+12; + T t66 = t62+1.000000003182454E-4; + T t68 = t63-2.0E+4; + T t67 = t8*t9*t66; + T t70 = t65-2.0E+16; + T t69 = 1.0/sqrt(t67); + T t71 = atan(t70); + T t74 = t44+t67; + T t72 = t5*t71; + T t75 = sqrt(t74); + T t73 = t72+1.0/2.0; + T t76 = -t73*(t64+2.0E+4); + T t77 = t64+t76+1.0E+4; + T t78 = odg9*t7*t69*t77; + T t79 = -t78; + T t81 = t78*1.0E+12; + T t80 = param17+t79; + T t82 = -t81; + T t83 = t11+t82; + T t84 = atan(t83); + T t85 = t5*t84; + T t86 = t85-1.0/2.0; + T t87 = t80*t86; + T t88 = t87*1.0E+12; + T t89 = t6+t87+3.182454300088011E-13; + T t90 = t23+t88+3.182454300088011E-1; + T t91 = atan(t90); + T t92 = t5*t91; + T t93 = t92+1.0/2.0; + T t94 = t89*t93; + T t95 = -t94; + T t96 = t87+t95; + // std::cout << odg9*param16*t7*t39*t75*t96 << std::endl; + + f[j+npe*0+npe*nce*k] = odg9*param16*t7*t39*t75*t96; + f[j+npe*1+npe*nce*k] = 0.0; + f[j+npe*2+npe*nce*k] = odg9*param16*t7*t39*t75*t96*uinf3; + f[j+npe*3+npe*nce*k] = 0.0; + f[j+npe*4+npe*nce*k] = 0.0; + f[j+npe*5+npe*nce*k] = 0.0; + f[j+npe*6+npe*nce*k] = 0.0; + f[j+npe*7+npe*nce*k] = 0.0; + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuOutput_viscTerms.cpp b/Applications/Hypersonics/shocktests/app/opuOutput_viscTerms.cpp new file mode 100644 index 00000000..2936b0ed --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuOutput_viscTerms.cpp @@ -0,0 +1,115 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + int nspecies = 5; + int ndim = 1; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P()/rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, ndim); + uinf13 = dTdU[0]; // dT_drho_1 + uinf14 = dTdU[1]; // dT_drho_2 + uinf15 = dTdU[2]; // dT_drho_3 + uinf16 = dTdU[3]; // dT_drho_4 + uinf17 = dTdU[4]; // dT_drho_5 + uinf18 = dTdU[5]; // dT_drhoe + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf2 = D_i[0]; // D_1 + uinf3 = D_i[1]; // D_2 + uinf4 = D_i[2]; // D_3 + uinf5 = D_i[3]; // D_4 + uinf6 = D_i[4]; // D_5 + uinf7 = h_i[0]; // h_1 + uinf8 = h_i[1]; // h_2 + uinf9 = h_i[2]; // h_3 + uinf10 = h_i[3]; // h_4 + uinf11 = h_i[4]; // h_5 + uinf12 = mix->viscosity() / uinf[4]; // mu + uinf13 = mix->frozenThermalConductivity() / uinf[5]; // kappa + + + f[j+npe*0+npe*nce*k] = uinf2; + f[j+npe*1+npe*nce*k] = uinf3; + f[j+npe*2+npe*nce*k] = uinf4; + f[j+npe*3+npe*nce*k] = uinf5; + f[j+npe*4+npe*nce*k] = uinf6; + f[j+npe*5+npe*nce*k] = uinf7; + f[j+npe*6+npe*nce*k] = uinf8; + f[j+npe*7+npe*nce*k] = uinf9; + f[j+npe*8+npe*nce*k] = uinf10; + f[j+npe*9+npe*nce*k] = uinf11; + f[j+npe*10+npe*nce*k] = uinf12; + f[j+npe*11+npe*nce*k] = uinf13; + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/avfieldPhysical1d.m b/Applications/Hypersonics/shocktests/avfieldPhysical1d.m new file mode 100644 index 00000000..4e18cddc --- /dev/null +++ b/Applications/Hypersonics/shocktests/avfieldPhysical1d.m @@ -0,0 +1,71 @@ +function avField = avfieldPhysical1d(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); + gam1 = gam - 1; + avk_b_coeff = eta(3); % placeholder for avk coefficient. Something with units cp / Pr + + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e12; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(4+nspecies); + + % Get base variables + rvec = u(1:nspecies); + ru = u(nspecies+1); + % rv = udg(3); + rE = u(nspecies+nd+1); + + rx = sum(-q(1:nspecies)); + rux = -q(nspecies+1); + + % Regularization + rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here + + % Simple derived working quantities + r = sum(rvec); + r1 = 1./r; + uv = ru.*r1; + E = rE * r1; %energy + H = E + p*r1; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + ux = (rux - rx.*uv).*r1; + div_v = (ux); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + + % Dilatation Sensor sb + sb = - (hm./porder) .* (div_v./c_star); + sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be + + % Artificial Bulk viscosity + avb = r * (kb.*hm./(porder)) .* sqrt(uv^2 + c_star^2) .* sb; + + % Artificial conductivity + avk_T = 0.0; % Triggered by temperature sensor + avk_b = avk_b_coeff * avb; % Triggered by bulk viscosity + % Assign artificial viscosities + avField(1) = avb; % bulk + avField(2) = 0.0; % shear + avField(3) = avk_b + avk_T; % thermal + avField(4:3+nspecies) = 0.0; % species +end diff --git a/Applications/Hypersonics/shocktests/getStates2d.py b/Applications/Hypersonics/shocktests/getStates2d.py new file mode 100644 index 00000000..93ecf542 --- /dev/null +++ b/Applications/Hypersonics/shocktests/getStates2d.py @@ -0,0 +1,135 @@ +import sys +import os +mppPyDir = os.environ.get('MPP_LOCALPY') +sys.path.append(mppPyDir) +import _mutationpp as mpp +import numpy as np + + +def print_equil_vals(mix, T, P): + mix.equilibrate(T, P) + rhovec = mix.densities() + rho = np.sum(rhovec) + e = mix.mixtureEnergyMass() + rhoE = rho * e + 0.0 + w = mix.netProductionRates() + + print("To check") + print("(T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + print("Initial conditions (dimensional): ") + print("(rho_i, rhou, rhoE) = (" + str(rhovec) + " 0.0 " + str(rhoE) + ")") + print("omega: " + str(w)) + +def init_mixture(): + opt = mpp.MixtureOptions("air_5") + opt.setStateModel("ChemNonEq1T") + opt.setViscosityAlgorithm("Gupta-Yos") + opt.setThermodynamicDatabase("NASA-9") + + mix = mpp.Mixture(opt) + return mix + +def rhoe(mix, u): + e = mix.mixtureEnergyMass() + rho = mix.density() + uTu2 = 0.5 * u**2 # Assumes scalar density + rhoe = rho * e - rho * uTu2 + return rhoe + +# def return_farfield(): +u_inf = 5956 +rho_inf = 1.547e-3 +# p_inf = 476 +T_inf = 901 +# Mach_inf = 8.98 +Y_N = 6.5e-7 +Y_O = 0.22830098 +Y_NO = 0.01026010 +Y_N2 = 0.75430704 +Y_O2 = 0.00713123 +Y_vec = np.array([Y_N, Y_O, Y_NO, Y_N2, Y_O2]) + # return rho_inf, + +if __name__=="__main__": + + print('hi') + + mix = init_mixture() + + print("=============") + print(" Inf state ") + print("=============") + mix.setState(rho_inf * Y_vec, T_inf, 1) + a_inf = mix.frozenSoundSpeed() + u_scale = a_inf + p_inf = mix.P() + Ma_inf = u_inf / a_inf + mu_inf = mix.viscosity() + kappa_inf = mix.frozenThermalConductivity() + rhoE_inf = rho_inf * u_scale**2 + rho_vec_string = ' '.join(map(str, rho_inf * Y_vec)) + print("U0dim = [rho_i_inf, (rhou)_inf, (rhov)_inf, rhoE] = [" + rho_vec_string + " " + str(u_inf * rho_inf) + " " + str(0.0) + " " + str(rhoe(mix, u_inf)) + "]") + print("U0nondim = [rho_i_inf, (rhou)_inf, (rhov)_inf, rhoE] = [" + " ".join(map(str, Y_vec)) + " " + str(u_inf * rho_inf / (rho_inf * a_inf)) + " " + str(0.0) + " " + str(rhoe(mix, u_inf) / rhoE_inf) + "]") + + print("PRINT SCALING TERMS") + print("Just to make sure once again: (T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + + print("rho_ref = " + str(rho_inf)) + print("u_ref = " + str(u_scale)) + print("rhoE_ref = " + str(rhoE_inf)) + print("T_ref = " + str(T_inf)) + print("mu_ref = " + str(mu_inf)) + print("kappa_ref = " + str(kappa_inf)) + + print("MISC Terms") + print("T_ref from cp: " + str(u_scale**2 / mix.mixtureFrozenCpMass())) + print("Re = " + str(rho_inf * u_scale / mu_inf)) + print("Pr = " + str(mu_inf * mix.mixtureFrozenCpMass() / kappa_inf)) + + + + + # print("PRINT SCALING TERMS using inf domain") + # print("Just to make sure once again: (T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + # rho_inf = mix.density() + # u_inf = mix.frozenSoundSpeed() + # print("rho_inf = " + str(rho_inf)) + # print("u_inf = " + str(u_inf)) + # print("rhoE_inf = " + str(rho_inf * u_inf * u_inf)) + + # cp = mix.mixtureFrozenCpMass() + # gam = mix.mixtureFrozenGamma() + # print("cp = " + str(cp)) + # print("gam = " + str(gam)) + + # opt2 = mpp.MixtureOptions("air_5") + # opt2.setStateModel("ChemNonEq1T") + # opt2.setThermodynamicDatabase("NASA-9") + # opt2.setViscosityAlgorithm("Gupta-Yos") + # mix2 = mpp.Mixture(opt2) + + # print("=============") + # print(" LEFT STATE ") + # print("=============") + # print_equil_vals(mix2, TL, PL) + + # print("=============") + # print(" RIGHT STATE ") + # print("=============") + # print_equil_vals(mix2, TR, PR) + + # print() + # print("PRINT SCALING TERMS using right side of domain") + # print("Just to make sure once again: (T, P) = (" + str(mix2.T()) + ", " + str(mix2.P()) + ")") + # rho_inf = mix2.density() + # u_inf = mix2.frozenSoundSpeed() + # print("rho_inf = " + str(rho_inf)) + # print("u_inf = " + str(u_inf)) + # print("rhoE_inf = " + str(rho_inf * u_inf * u_inf)) + + # cp = mix2.mixtureFrozenCpMass() + # gam = mix2.mixtureFrozenGamma() + # print("cp = " + str(cp)) + # print("gam = " + str(gam)) + + diff --git a/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m b/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m new file mode 100644 index 00000000..f65f09d8 --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m @@ -0,0 +1,179 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_physicsbased"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 3; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +% tfinal = 0.000005; % 1 with 1e-4 doesn't work super well +tfinal = 0.0324; +% nt = 3240/10; +% dt = tfinal/nt; +% dt = 10*1e-5; +nt = 10000; +% dt = tfinal / nt; +dt = 3.240000000000000e-06; +% pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; +pde.dt = [dt*ones(1,nt)]; +pde.saveSolFreq = ceil(nt/100); +% pde.saveSolFreq = ceil(nt/10); + +% pde.saveSolFreq = 1; +pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +% pde.timestepOffset = 10000; + +% Solver params +pde.linearsolveriter = 40; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-5; +pde.matvectol = 1e-7; +pde.NLiter = 5; +pde.RBdim = 5; +pde.NLtol = 1e-8; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +nspecies = 5; + +%% Stabilization and mesh +ndim = 1; +pde.tau = [5, 5, 5, 5, 5, 5, 5]; +nDiv = 600; +[mesh.p,mesh.t] = linemesh(nDiv); +a = 0.2; b = 0.645; +mesh.p = a + (b-a)*mesh.p; + +mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries +mesh.boundarycondition = [1;2]; % Set boundary condition for each boundary + +%% Initial conditions and parameters +% TL=9000 +Xi_inflow = [0,0,0,0,0]; +u_inflow = 0.0; +T_inflow = 9000.0; +p_outflow = 1e4; +pde.physicsparam = [ + 2.79122095e-02 % . + 8.94162529e-03 % . + 3.49305942e-05 % rho_i_L + 1.58251700e-03 % . + 5.01765831e-07 % . + 0.0 % rhou_L + 1425938.1573890178 % rhoE_L + 8.83171348e-81 % . + 4.62782812e-42 % . + 3.11978853e-17 % rho_i_R + 8.87231621e-02 % . + 2.69399686e-02 % . + 0.0 % rhou_R + -9783.724551855581 % rhoE_R + pde.porder % p for h/p scaling + 1.5 % bulk viscosity scaling parameter + 0.001 % cutoff dilitation + 2.5 % maximum dilitation 18 + Xi_inflow(:) % 19 20 21 22 23 + u_inflow % 24 + T_inflow % 25 + p_outflow % 26 + ]; +% T = 4000; +% pde.physicsparam = [ +% 8.79041126e-05 +% 2.18935322e-02 +% 8.84111098e-03 +% 1.10501923e-01 +% 8.22504485e-03 +% 0.0 % rhou_L +% 863520.4456544879 % rhoE_L +% 8.83171348e-81 % . +% 4.62782812e-42 % . +% 3.11978853e-17 % rho_i_R +% 8.87231621e-02 % . +% 2.69399686e-02 % . +% 0.0 % rhou_R +% -9783.724551855581 % rhoE_R +% pde.porder % p for h/p scaling +% 1.5 % bulk viscosity scaling parameter +% 0.02 % cutoff dilitation +% 2.5 % maximum dilitation +% Xi_inflow(:) % 19 20 21 22 23 +% u_inflow % 24 +% T_inflow % 25 +% p_outflow % 26 +% ]; + +L_ref = 1.0; +rho_ref = 0.11566313067881752; +u_ref = 347.764810747843; +rhoE_ref = 13988.341078772399; +mu_ref = 1.9423965904207942e-05; +kappa_ref = 0.028469303787820466; +cp_ref = 1010.7825217371519; +T_ref = u_ref^2 / cp_ref; +Re = rho_ref * u_ref / mu_ref; +Pr = mu_ref * cp_ref / kappa_ref; + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = rho_ref; % rho_inf +pde.externalparam(2) = u_ref; % u_inf +pde.externalparam(3) = rhoE_ref; % rhoE_inf +pde.externalparam(4) = T_ref; % T_ref +pde.externalparam(5) = mu_ref; +pde.externalparam(6) = kappa_ref; +pde.externalparam(7) = cp_ref; +pde.physicsparam(19) = Pr; +pde.physicsparam(20) = Re; + +% mesh size +mesh.dgnodes = createnodes(mesh.p, mesh.t, pde.porder); +mesh.vdg = zeros(size(mesh.dgnodes,1),4+nspecies,size(mesh.dgnodes,3)); +mesh.vdg(:,4+nspecies,:) = (1.0 / (nDiv)) * ones(size(mesh.dgnodes,1), 1, size(mesh.dgnodes,3)); + +pde.AV = 1; +pde.nco = 10; +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +eval('!cp opuApp_MPP.cpp opuApp.cpp'); +eval('!cp opuFlux_MPP_PB.cpp opuFlux.cpp'); %X manually switch these +eval('!cp opuFbou_MPP_PB.cpp opuFbou.cpp'); %X +eval('!cp opuSource_MPP.cpp opuSource.cpp'); %X +eval('!cp opuOutput_MPP_sensors_PB.cpp opuOutput.cpp'); %X +eval('!cp opuAvfield_MPP_PB.cpp opuAvfield.cpp') %X +% eval('!cp opuInitu_MPP.cpp opuInitu.cpp') %X +% eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +runstr = runcode(pde); diff --git a/Applications/Hypersonics/shocktests/pdemodel_2d.m b/Applications/Hypersonics/shocktests/pdemodel_2d.m new file mode 100644 index 00000000..e44d488f --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdemodel_2d.m @@ -0,0 +1,361 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + f = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function avField = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); + gam1 = gam - 1; + + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e12; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(2); + + % Get base variables + rvec = u(1:nspecies); + ru = u(nspecies+1); + rv = u(nspecies+nd); + rE = u(nspecies+nd+1); + + rx = sum(-q(1:nspecies)); + rux = -q(nspecies+1); + rvx = -q(nspecies+nd); + + % Regularization + rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here + + % Simple derived working quantities + r = sum(rvec); + r1 = 1./r; + uv = ru.*r1; + vv = rv.*r1; + E = rE * r1; %energy + H = E + p*r1; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + ux = (rux - rx.*uv).*r1; + vx = (rvx - rx.*vv).*r1; + div_v = (ux + vx); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + + % % Dilatation Sensor sb + sb = - (hm./porder) .* (div_v./c_star); + sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be +% sb = log(1 + exp(alpha * (sb - 0.01)))/alpha; + % Artificial Bulk viscosity + avb = (kb.*hm./(porder)) .* (abs(uv) + abs(vv) + abs(c_star)) .* sb; + + % Assign artificial viscosities + avField(1) = avb; % bulk +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + ndim = 2; + m = sym(ones(nspecies + ndim + 1, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + % % Clipper utilities + % alpha = 1.0e3; + % rmin = 0.0; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + % fv = fluxviscous(u, q, w, v, x, t, mu, eta) + fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv; +end + +function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) + rmin = 0.0; + alpha = 1.0e12; + eps_av = v(1); +% hm = v(2); + %TODO: CHECK GAS OUTPUTS TO INPUTS USED BY HTR GROUP + %TODO: CHECK NONDIM USED BY HTR GROUP ! + r_vec = u(1:nspecies); + dr = dlmax(r_vec-rmin,alpha); % Regularize derivative + fv(1:nspecies) = eps_av*-q(1:nspecies) .* dr; % drho_i + fv(nspecies+1) = eps_av*-q(nspecies+1); % drhou + fv(nspecies+2) = eps_av*-q(nspecies+2); % drhov + fv(nspecies+3) = eps_av*-q(nspecies+3); % drhoE +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + % ndim = 2; + fi = sym(zeros(nspecies+ndim+1),2); + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = 1.0e8; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + if ndim == 2 + rhov = u(nspecies+2) + end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + vv = rhov * rhoinv; + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies,1) = rho_i(ispecies) * uv; + end + fi(nspecies + 1,1) = rhou * uv + p; + fi(nspecies + 2,1) = rhov * uv; + fi(nspecies + ndim + 1,1) = rhou * H; + + for ispecies = 1:nspecies + fi(ispecies,2) = rho_i(ispecies) * vv; + end + fi(nspecies + 1,2) = rhou * vv; + fi(nspecies + 2,2) = rhov * vv + p; + fi(nspecies + ndim + 1,2) = rhov * H; + + % fi = [ru, ru*uv+p, rv*uv, ru*h, ... + % rv, ru*vv, rv*vv+p, rv*h]; + % fi = reshape(fi,[4,2]); +end + + + +function fv = fluxviscous(u, q, w, v, x, t, mu, eta, nspecies, ndim) + %TODO for thursday: + % - double check with papers: consistent with may, gnoffo. Maybe typo in su2mpp? + % - double check with NS code (TODO: REALLY CONFUSED ABOUT SIGN OF STRESS TENSOR) + % - add AV options: tomorrow, be clear about shear, bulk, thermal, and how density should come into this (let's discuss) + % - try to generate + rmin = 0.0; + alpha = 1e12; + nenergy=1; + ncu = nspecies + ndim + nenergy; + + Pr = mu(18); + Re = mu(19); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = eta(2:nspecies+1); + h_vec = eta(nspecies+2:2*nspecies+1); + viscshear = eta(2*nspecies+2); + kappa = eta(2*nspecies+3); + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+ndim+1); + + drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha) + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2) + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha) + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2) + drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Some useful derived quantities + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + rho_inv = 1.0 / rho; + drho_dx_inv = 1.0 / drho_dx; + drho_dy_inv = 1.0 / drho_dy + uv = rhou * rho_inv; %velocity + vv = rhov * rho_inv; + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * (uv * uv + vv * vv); + duTu2_dx = uv * du_dx + vv * dv_dx; + duTu2_dy = uv * du_dy + vv * dv_dy; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dre_dy = dre_drho * drho_dy + dre_duTu2 * duTu2_dy + dre_drhoE * drhoE_dy; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + dT_dy = sum(dT_drho_i .* drho_dy_i) + dT_drhoe * dre_dy; + + %%%%%%%% Modify appropriate coefficients + kappa = kappa + avk; % thermal conductivity + mu_d = mu_d + avs; % dynamic viscosity + beta = 0 + avb; % bulk viscosity + D_vec = D_vec + avDvec; % Species diffusion velocities + + %%%%%%%% Calculation of J_i + Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + dY_dy_i = (drho_dy_i * rho - rho_i * drho_dy) * rho_inv * rho_inv; + + J_i_x = -rho * D_vec .* dY_dx_i + rho_i .* sum(D_vec .* dY_dx_i); + J_i_y = -rho * D_vec .* dY_dy_i + rho_i .* sum(D_vec .* dY_dy_i); + + %%%%%%%% Stress tensor tau + % txx = viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + txx = mu_d * 2.0/3.0 * (2 * du_dx - dv_dy) / Re + beta * (du_dx + dv_dy); + txy = mu_d * (du_dy + dv_dx) / Re; + tyy = mu_d * 2.0/3.0 * (2 * dv_dy - du_dx) / Re + beta * (du_dx + dv+dy) + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies,1) = -J_i_x(ispecies); + fv(ispecies,2) = -J_i_y(ispecies); + end + + fv(nspecies + 1, 1) = txx; + fv(nspecies + 2, 1) = txy; + fv(nspecies + ndim + 1,1) = uv * txx + vv * txy - (sum(h_vec.*J_i_x) - kappa * dT_dx / (Re * Pr)); + fv(nspecies + 1, 2) = txy; + fv(nspecies + 2, 2) = tyy + fv(nspecies + ndim + 1,2) = uv * txy + vv * tyy - (sum(h_vec.*J_i_y) - kappa * dT_dy / (Re * Pr)); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = 1.0e12; + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + ub = sym(zeros(nspecies+2, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + + uinflow = mu(1:nspecies+2+1); + + uoutflow = u; + + uadiabatic = u; + uadiabatic(nspecies+1:nspecies+ndim) = 0.0; + + ub(:,1) = uinflow; + ub(:,2) = uoutflow; + ub(:,3) = uadiabatic; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); + + fadiabatic = fi; + fadiabatic(1:nspecies) = 0.0; + fadiabatic(nspecies+ndim+2) 0.0; + fb(:,1) = fn; + fb(:,2) = fn; + fb(:,3) = fadiabatic; +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + u0 = mu(1:nspecies+2+1); +end + +function o = output(u, q, w, v, x, t, mu, eta) + + % nspecies = 5; + + % o = sym(zeros(10,1)); + % nspecies = 5; + % alpha = 1.0e3; + % rmin = 0.0; + + % f = sym(zeros(nspecies + 2,1)); + % rho_i = sym(zeros(5,1)); + % rho = sym(0); + + % % Conservative Variables + % for ispecies = 1:nspecies + % rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + % rho = rho + rho_i(ispecies); %total mixture density + % end + + % rhou = u(nspecies+1); + % rhoE = u(nspecies+2); + + % rhoinv = 1.0 / rho; + % uv = rhou * rhoinv; %velocity + % E = rhoE*rhoinv; %energy + + % o(1) = u(1); + % o(2) = u(2); + % o(3) = u(3); + % o(4) = u(4); + % o(5) = u(5); + o = sensor_outputs(u, q, w, v, x, t, mu, eta); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/pdemodel_physicsbased.m b/Applications/Hypersonics/shocktests/pdemodel_physicsbased.m new file mode 100644 index 00000000..4558628b --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdemodel_physicsbased.m @@ -0,0 +1,337 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 1; + f = avfieldPhysical1d(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function avField = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); + gam1 = gam - 1; + + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e12; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(2); + + % Get base variables + rvec = u(1:nspecies); + ru = u(nspecies+1); + % rv = udg(3); + rE = u(nspecies+nd+1); + + rx = sum(-q(1:nspecies)); + rux = -q(nspecies+1); + + % Regularization + rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here + + % Simple derived working quantities + r = sum(rvec); + r1 = 1./r; + uv = ru.*r1; + E = rE * r1; %energy + H = E + p*r1; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + ux = (rux - rx.*uv).*r1; + div_v = (ux); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + + % % Dilatation Sensor sb + sb = - (hm./porder) .* (div_v./c_star); + sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be +% sb = log(1 + exp(alpha * (sb - 0.01)))/alpha; + % Artificial Bulk viscosity + avb = (kb.*hm./(porder)) .* (abs(uv) + abs(c_star)) .* sb; + + % Assign artificial viscosities + avField(1) = avb; % bulk +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + m = sym(ones(nspecies + 2, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 1; + % % Clipper utilities + % alpha = 1.0e3; + % rmin = 0.0; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + fv = fluxviscous(u, q, w, v, x, t, mu, eta, nspecies, nd); +% fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv; +end + + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = 1.0e12; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + % if ndim == 2 + % rhov = u(nspecies+2) + % end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies) = rho_i(ispecies) * uv; + end + fi(nspecies + 1) = rhou * uv + p; + fi(nspecies + 2) = rhou * H; +end + + + +function fv = fluxviscous(u, q, w, v, x, t, mu, eta, nspecies, ndim) + %TODO for thursday: + % - double check with papers: consistent with may, gnoffo. Maybe typo in su2mpp? + % - double check with NS code (TODO: REALLY CONFUSED ABOUT SIGN OF STRESS TENSOR) + % - add AV options: tomorrow, be clear about shear, bulk, thermal, and how density should come into this (let's discuss) + % - try to generate + nenergy = 1; + rmin = 0.0; + alpha = 1e12; + + Pr = mu(18); + Re = mu(19); + + avb = v(1); + avs = v(2); + avk = v(3); + avDvec = v(4:3+nspecies); + + % Data layout + % [p, D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = eta(2:nspecies+1); + h_vec = eta(nspecies+2:2*nspecies+1); + viscshear = eta(2*nspecies+2); + kappa = eta(2*nspecies+3); + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha); + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + rhou = u(nspecies+1); + drhou_dx = -q(nspecies+1); + rhoE = u(nspecies+ndim+1); + drhoE_dx = -q(nspecies+ndim+1); + + % Some useful derived quantities + rho_inv = 1.0 / rho; + drho_dx_inv = 1.0 / drho_dx; + uv = rhou * rho_inv; %velocity + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * uv * uv; + duTu2_dx = uv * du_dx; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + + %%%%%%%% Modify appropriate coefficients + kappa = kappa + avk; + viscshear = viscshear + avs; + viscbulk = 0 + avb; + D_vec = D_vec + avDvec; + + %%%%%%%% Calculation of J_i + % for ispecies = 1:nspecies + % Y_i(ispecies) = rho_i(ispecies) / rho; + % dYdx_i(ispecies) = (q(ispecies) * rho - rho_i(ispecies) * drhodx) * drhodxinv^2; + % end + Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + + % for ispecies = 1:nspecies + % J_i(ispecies) = -rho * D_vec(ispecies) * dYdx_i(ispecies) + rho_i(ispecies) * sum(D_vec .* dYdx_i); + % end + J_i = -rho * D_vec .* dY_dx_i + rho_i .* sum(D_vec .* dY_dx_i); + + %%%%%%%% Stress tensor tau + txx = 1.0 / Re * viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies) = -J_i(ispecies); + end + + fv(nspecies + 1) = txx; + fv(nspecies + 2) = uv * txx - (sum(h_vec.*J_i) - kappa * dT_dx * 1.0 / (Re * Pr)); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = 1.0e12; + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ub = sym(zeros(nspecies+2, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + ub(:,1) = initu(x, mu, eta); + ub(:,2) = initu(x, mu, eta); +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + fb = sym(zeros(nspecies+2, 2)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f*n(1); +%%%%% C-CODE MANUALLY MODIFIED + for i = 1:(nspecies+2) + fb(i,1) = fn(i) + tau(i)*(u(i)-uhat(i)); + end + fb(:,2) = fb(:,1); +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + + % pde.physicsparam = [rho_post(:)', rhou_post, rhoE_post, rho_equil(:)', rhou_equil, rhoE_equil, Xi_inflow, u_inflow, T_inflow, p_outflow]; + % % 1:N N+1 N+2 N+3:2*N+2 2*N+3 2*N+4 2*N+5:3*N+4 3*N+5 3*N+6 3*N+7 + % pde.externalparam = [rho_scale, u_scale, rhoe_scale]; + % oh let's just modify this manually + rho_L_vec = mu(1:nspecies); + rhou_L = mu(nspecies + 1); + rhoE_L = mu(nspecies + 2); + + rho_R_vec = mu(nspecies+3:2*nspecies+2); + rhou_R = mu(2*nspecies + 3); + rhoE_R = mu(2*nspecies + 4); + %%% TODO: Cinnella scales this with right region. And uses speed of sound. BUT WHY IS ENERGY IN THE RIGHT REGION NEGATIVE??? + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + + rho_R_vec_nondim = rho_R_vec/rho_scale; + rhou_R_nondim = rhou_R/(u_scale * rho_scale); + rhoE_R_nondim = rhoE_R/rhoe_scale; + + rho_L_vec_nondim = rho_L_vec/rho_scale; + rhou_L_nondim = rhou_L/(u_scale * rho_scale); + rhoE_L_nondim = rhoE_L/rhoe_scale; + +% u0 = [rho_R_vec_nondim(:) + rho_L_vec_nondim(:); rhou_R_nondim + rhou_L_nondim; rhoE_R_nondim + rhoE_L_nondim]; + stepsize = 0.001; + midpoint = 0.5; + u0(1) = smoothstep_down(x-midpoint, rho_L_vec_nondim(1), rho_R_vec_nondim(1), stepsize); + u0(2) = smoothstep_down(x-midpoint, rho_L_vec_nondim(2), rho_R_vec_nondim(2), stepsize); + u0(3) = smoothstep_down(x-midpoint, rho_L_vec_nondim(3), rho_R_vec_nondim(3), stepsize); + u0(4) = smoothstep_up(x-midpoint, rho_L_vec_nondim(4), rho_R_vec_nondim(4), stepsize); + u0(5) = smoothstep_up(x-midpoint, rho_L_vec_nondim(5), rho_R_vec_nondim(5), stepsize); + u0(nspecies+1) = 0.0; + u0(nspecies+2) = smoothstep_down(x-midpoint, rhoE_L_nondim, rhoE_R_nondim, stepsize); + +end + +function o = output(u, q, w, v, x, t, mu, eta) + + % nspecies = 5; + + % o = sym(zeros(10,1)); + % nspecies = 5; + % alpha = 1.0e3; + % rmin = 0.0; + + % f = sym(zeros(nspecies + 2,1)); + % rho_i = sym(zeros(5,1)); + % rho = sym(0); + + % % Conservative Variables + % for ispecies = 1:nspecies + % rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + % rho = rho + rho_i(ispecies); %total mixture density + % end + + % rhou = u(nspecies+1); + % rhoE = u(nspecies+2); + + % rhoinv = 1.0 / rho; + % uv = rhou * rhoinv; %velocity + % E = rhoE*rhoinv; %energy + + % o(1) = u(1); + % o(2) = u(2); + % o(3) = u(3); + % o(4) = u(4); + % o(5) = u(5); + nspecies=5; + hm = v(nspecies+4); + o = sensor_outputs(u, q, w, v, x, t, mu, eta, hm); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/shocktests/plotting_visc_test.m b/Applications/Hypersonics/shocktests/plotting_visc_test.m new file mode 100644 index 00000000..e390b8e3 --- /dev/null +++ b/Applications/Hypersonics/shocktests/plotting_visc_test.m @@ -0,0 +1,80 @@ +%% plot solution +% sol = fetchsolution(pde,master,dmd, 'dataout'); +% for ti = pde.saveSolFreq:pde.saveSolFreq:(length(pde.dt)*6) +hoverp = mesh.vdg(1,2,1) / pde.porder; +hmat = (mesh.dgnodes(2:end) - mesh.dgnodes(1:end-1)); +for ti = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt) +% for ti = 100:100:10000 +% for ti = 10000:10:12000 + sol = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); + sol_output = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +% solw = getsolution(['dataout/out_wdg_t' num2str(ti)],dmd,master.npe); + dgnodes = createdgnodes(mesh.p,mesh.t,mesh.f,mesh.curvedboundary,mesh.curvedboundaryexpr,pde.porder); + + D1 = sol_output(:,1,:); + D2 = sol_output(:,2,:); + D3 = sol_output(:,3,:); + D4 = sol_output(:,4,:); + D5 = sol_output(:,5,:); + h1 = sol_output(:,6,:); + h2 = sol_output(:,7,:); + h3 = sol_output(:,8,:); + h4 = sol_output(:,9,:); + h5 = sol_output(:,10,:); + mu = sol_output(:,11,:); + kappa = sol_output(:,12,:); + + +% T = sol_output(:,8,:); + dTdx = sT / hoverp; + dTdxFD = (T(2:end) - T(1:end-1)) ./ (hmat);% * mesh.vdg(1,2,1); + figure(1); clf + subplot(5, 1, 1) + plot(dgnodes(:),D1(:),'LineWidth',1.3); + subplot(5, 1, 2) + plot(dgnodes(:),D2(:),'LineWidth',1.3); + subplot(5, 1, 3) + plot(dgnodes(:),D3(:),'LineWidth',1.3); + subplot(5, 1, 4) + plot(dgnodes(:),D4(:),'LineWidth',1.3); + subplot(5, 1, 5) + plot(dgnodes(:),D5(:),'LineWidth',1.3); + + figure(2); clf + subplot(5, 1, 1) + plot(dgnodes(:),h1(:),'LineWidth',1.3); + subplot(5, 1, 2) + plot(dgnodes(:),h2(:),'LineWidth',1.3); + subplot(5, 1, 3) + plot(dgnodes(:),h3(:),'LineWidth',1.3); + subplot(5, 1, 4) + plot(dgnodes(:),h4(:),'LineWidth',1.3); + subplot(5, 1, 5) + plot(dgnodes(:),h5(:),'LineWidth',1.3); + + figure(3); clf + plot(dgnodes(:),mu(:),'LineWidth',1.3); + figure(4); clf + plot(dgnodes(:), kappa(:),'LineWidth',1.3); + +% +% figure(2); clf +% plot(dgnodes(:),T(:),'LineWidth',1.3); +% +% figure(3); clf; hold on +% plot(dgnodes(1:end-1),dTdx(1:end-1),'LineWidth',1.3); +% plot(dgnodes(1:end-1),dTdxFD(:),'LineWidth',1.3); +% +% Pr = sol_output(:,10,:); +% figure(4); clf; hold on +% plot(dgnodes(:), Pr(:), 'LineWidth',1.4) + + drawnow +% waitforbuttonpress + disp(ti) +end +% final + + + + From dda351866de655bd4b1912e09267cc0c89e79c85 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Sun, 9 Oct 2022 14:19:29 -0400 Subject: [PATCH 18/23] reacting cylinder --- .../app/opuAvfield_2d_MPP.cpp | 200 ++++ .../ReactingCylinder/app/opuFbou_2d_MPP.cpp | 1042 +++++++++++++++++ .../ReactingCylinder/app/opuFlux_2d_MPP.cpp | 390 ++++++ .../ReactingCylinder/app/opuOutput_2d_MPP.cpp | 213 ++++ .../ReactingCylinder/app/opuSource_2d_MPP.cpp | 53 + .../ReactingCylinder/avfieldLaplacian2d.m | 77 ++ .../Hypersonics/ReactingCylinder/dlmax.m | 3 + .../ReactingCylinder/getStates2d.py | 135 +++ .../mkmesh_circincirc_Ma17b.m | 124 ++ .../ReactingCylinder/pdeapp_cylinder.m | 176 +++ .../ReactingCylinder/pdemodel_2d.m | 386 ++++++ .../Hypersonics/ReactingCylinder/plotsol.m | 97 ++ 12 files changed, 2896 insertions(+) create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m create mode 100644 Applications/Hypersonics/ReactingCylinder/dlmax.m create mode 100644 Applications/Hypersonics/ReactingCylinder/getStates2d.py create mode 100644 Applications/Hypersonics/ReactingCylinder/mkmesh_circincirc_Ma17b.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m create mode 100644 Applications/Hypersonics/ReactingCylinder/plotsol.m diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp new file mode 100644 index 00000000..d6144220 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp @@ -0,0 +1,200 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + // std::cout << "IN AVFIELD" << std::endl; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = uinf2*2.0; + T t8 = uinf2+1.0; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param15; + T t13 = param17*1.0E+12; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t11 = t7-2.0; + T t12 = 1.0/t8; + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t39 = t2*1.0E+24; + T t40 = t3*1.0E+24; + T t41 = t4*1.0E+24; + T t42 = t5*1.0E+24; + T t43 = t6*1.0E+24; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t54 = t9*t14*t49; + T t55 = t9*t15*t50; + T t56 = t9*t16*t51; + T t57 = t9*t17*t52; + T t58 = t9*t18*t53; + T t59 = t29+t54; + T t60 = t30+t55; + T t61 = t31+t56; + T t62 = t32+t57; + T t63 = t33+t58; + T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t64 = t59*udg9; + T t65 = t60*udg10; + T t66 = t61*udg11; + T t67 = t59*udg17; + T t68 = t62*udg12; + T t69 = t60*udg18; + T t70 = t63*udg13; + T t71 = t61*udg19; + T t72 = t62*udg20; + T t73 = t63*udg21; + T t75 = 1.0/t74; + T t76 = t75*t75; + T t77 = t75*udg8; + T t78 = t75*uinf1; + T t86 = t64+t65+t66+t68+t70; + T t87 = t67+t69+t71+t72+t73; + T t79 = t77*1.0E+12; + T t80 = t78*1.0E+12; + T t81 = t77+t78-1.0E-4; + T t88 = t75*t86*udg6; + T t89 = t75*t87*udg7; + T t82 = t79+t80-1.0E+8; + T t90 = -t88; + T t91 = -t89; + T t95 = -t75*(t88-udg14); + T t96 = -t75*(t89-udg23); + T t97 = t75*(t88-udg14)*-1.0E+12; + T t98 = t75*(t89-udg23)*-1.0E+12; + T t83 = atan(t82); + T t92 = t90+udg14; + T t93 = t91+udg23; + T t102 = t95+t96-1.0E+4; + T t103 = t97+t98-1.0E+16; + T t84 = t9*t83; + T t104 = atan(t103); + T t85 = t84+1.0/2.0; + T t105 = t9*t104; + T t94 = t81*t85; + T t106 = t105-1.0/2.0; + T t99 = t94+1.000000003182454E-4; + T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t100 = t11*t12*t99; + T t109 = t108*-1.0E+12; + T t110 = t107-2.0E+4; + T t101 = 1.0/sqrt(t100); + T t111 = t109-2.0E+16; + T t112 = atan(t111); + T t113 = t9*t112; + T t114 = t113+1.0/2.0; + T t115 = -t114*(t108+2.0E+4); + T t116 = t108+t115+1.0E+4; + T t117 = odg2*t10*t101*t116; + T t118 = -t117; + T t120 = t117*1.0E+12; + T t119 = param17+t118; + T t121 = -t120; + T t122 = t13+t121; + T t123 = atan(t122); + T t124 = t9*t123; + T t125 = t124-1.0/2.0; + T t126 = t119*t125; + f[j+npe*0+npe*nce*k] = odg2*param16*t10*(sqrt(t76*(udg6*udg6)+t76*(udg7*udg7))+1.0/t101)*(t126-(t9*atan(param18*-1.0E+12+t126*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t126+3.182454300088011E-13)); + // f[j+npe*0+npe*nce*k] = 0.0; + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp new file mode 100644 index 00000000..0d7b6ca4 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp @@ -0,0 +1,1042 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = udg17*udg17; + T t10 = udg18*udg18; + T t11 = udg19*udg19; + T t12 = udg20*udg20; + T t13 = udg21*udg21; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = 1.0/param20; + T t17 = udg1*1.0E+12; + T t18 = udg2*1.0E+12; + T t19 = udg3*1.0E+12; + T t20 = udg4*1.0E+12; + T t21 = udg5*1.0E+12; + T t22 = udg17*1.0E+12; + T t23 = udg18*1.0E+12; + T t24 = udg19*1.0E+12; + T t25 = udg20*1.0E+12; + T t26 = udg21*1.0E+12; + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t34 = atan(t24); + T t35 = atan(t25); + T t36 = atan(t26); + T t57 = t2*1.0E+24; + T t58 = t3*1.0E+24; + T t59 = t4*1.0E+24; + T t60 = t5*1.0E+24; + T t61 = t6*1.0E+24; + T t62 = t9*1.0E+24; + T t63 = t10*1.0E+24; + T t64 = t11*1.0E+24; + T t65 = t12*1.0E+24; + T t66 = t13*1.0E+24; + T t37 = t14*t27; + T t38 = t14*t28; + T t39 = t14*t29; + T t40 = t14*t30; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t46 = t14*t36; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t74 = t64+1.0; + T t75 = t65+1.0; + T t76 = t66+1.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t51 = t41+1.0/2.0; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t84 = 1.0/t74; + T t85 = 1.0/t75; + T t86 = 1.0/t76; + T t52 = t47*udg1; + T t53 = t48*udg2; + T t54 = t49*udg3; + T t55 = t50*udg4; + T t56 = t51*udg5; + T t92 = t14*t17*t77; + T t93 = t14*t18*t78; + T t94 = t14*t19*t79; + T t95 = t14*t20*t80; + T t96 = t14*t21*t81; + T t97 = t14*t22*t82; + T t98 = t14*t23*t83; + T t99 = t14*t24*t84; + T t100 = t14*t25*t85; + T t101 = t14*t26*t86; + T t87 = t52+3.182454300088011E-13; + T t88 = t53+3.182454300088011E-13; + T t89 = t54+3.182454300088011E-13; + T t90 = t55+3.182454300088011E-13; + T t91 = t56+3.182454300088011E-13; + T t102 = t47+t92; + T t103 = t48+t93; + T t104 = t49+t94; + T t105 = t50+t95; + T t106 = t51+t96; + T t107 = t42+t97+1.0/2.0; + T t108 = t43+t98+1.0/2.0; + T t109 = t44+t99+1.0/2.0; + T t110 = t45+t100+1.0/2.0; + T t111 = t46+t101+1.0/2.0; + T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + T t112 = t102*udg9; + T t113 = t103*udg10; + T t114 = t104*udg11; + T t115 = t105*udg12; + T t116 = t106*udg13; + T t117 = t107*udg17; + T t118 = t108*udg18; + T t119 = t109*udg19; + T t120 = t110*udg20; + T t121 = t111*udg21; + T t123 = 1.0/t122; + T t124 = t123*t123; + T t125 = t123*udg8; + T t126 = t123*uinf1; + T t127 = t123*udg6*udg7; + T t130 = t112*t122; + T t131 = t113*t122; + T t132 = t114*t122; + T t133 = t115*t122; + T t134 = t116*t122; + T t135 = t117*t122; + T t136 = t118*t122; + T t137 = t119*t122; + T t138 = t120*t122; + T t139 = t121*t122; + T t152 = t112+t113+t114+t115+t116; + T t153 = t117+t118+t119+t120+t121; + T t128 = (t7*t124)/2.0; + T t129 = (t8*t124)/2.0; + T t140 = -t130; + T t141 = -t131; + T t142 = -t132; + T t143 = -t133; + T t144 = -t134; + T t145 = -t135; + T t146 = -t136; + T t147 = -t137; + T t148 = -t138; + T t149 = -t139; + T t150 = t125+t126; + T t154 = t87*t152; + T t155 = t88*t152; + T t156 = t89*t152; + T t157 = t90*t152; + T t158 = t91*t152; + T t159 = t87*t153; + T t160 = t88*t153; + T t161 = t89*t153; + T t162 = t90*t153; + T t163 = t91*t153; + T t164 = t123*t152*udg6; + T t165 = t123*t152*udg7; + T t166 = t123*t153*udg6; + T t167 = t123*t153*udg7; + T t151 = t128+t129; + T t168 = -t164; + T t169 = -t165; + T t170 = -t166; + T t171 = -t167; + T t176 = t140+t154; + T t177 = t141+t155; + T t178 = t142+t156; + T t179 = t143+t157; + T t180 = t144+t158; + T t181 = t145+t159; + T t182 = t146+t160; + T t183 = t147+t161; + T t184 = t148+t162; + T t185 = t149+t163; + T t186 = -t123*(t164-udg14); + T t187 = -t123*(t165-udg15); + T t188 = -t123*(t166-udg22); + T t189 = -t123*(t167-udg23); + T t190 = t123*(t164-udg14)*-2.0; + T t191 = t123*(t167-udg23)*-2.0; + T t192 = t123*(t167-udg23); + T t194 = -t123*uinf2*(t130-t154); + T t195 = -t124*uinf2*(t130-t154); + T t196 = -t123*uinf3*(t131-t155); + T t197 = -t124*uinf3*(t131-t155); + T t198 = -t123*uinf4*(t132-t156); + T t199 = -t124*uinf4*(t132-t156); + T t200 = -t123*uinf5*(t133-t157); + T t201 = -t124*uinf5*(t133-t157); + T t202 = -t123*uinf6*(t134-t158); + T t203 = -t124*uinf6*(t134-t158); + T t204 = -t123*uinf2*(t135-t159); + T t205 = -t124*uinf2*(t135-t159); + T t206 = -t123*uinf3*(t136-t160); + T t207 = -t124*uinf3*(t136-t160); + T t208 = -t123*uinf4*(t137-t161); + T t209 = -t124*uinf4*(t137-t161); + T t210 = -t123*uinf5*(t138-t162); + T t211 = -t124*uinf5*(t138-t162); + T t212 = -t123*uinf6*(t139-t163); + T t213 = -t124*uinf6*(t139-t163); + T t214 = t123*uinf2*(t130-t154); + T t215 = t123*uinf3*(t131-t155); + T t216 = t123*uinf4*(t132-t156); + T t217 = t123*uinf5*(t133-t157); + T t218 = t123*uinf6*(t134-t158); + T t219 = t123*uinf2*(t135-t159); + T t220 = t123*uinf3*(t136-t160); + T t221 = t123*uinf4*(t137-t161); + T t222 = t123*uinf5*(t138-t162); + T t223 = t123*uinf6*(t139-t163); + T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t172 = t168+udg14; + T t173 = t169+udg15; + T t174 = t170+udg22; + T t175 = t171+udg23; + T t193 = t192*2.0; + T t224 = t187+t188; + T t226 = t190+t192; + T t228 = t195+t197+t199+t201+t203; + T t229 = t205+t207+t209+t211+t213; + f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = udg17*udg17; + T t10 = udg18*udg18; + T t11 = udg19*udg19; + T t12 = udg20*udg20; + T t13 = udg21*udg21; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = 1.0/param20; + T t17 = udg1*1.0E+12; + T t18 = udg2*1.0E+12; + T t19 = udg3*1.0E+12; + T t20 = udg4*1.0E+12; + T t21 = udg5*1.0E+12; + T t22 = udg17*1.0E+12; + T t23 = udg18*1.0E+12; + T t24 = udg19*1.0E+12; + T t25 = udg20*1.0E+12; + T t26 = udg21*1.0E+12; + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t34 = atan(t24); + T t35 = atan(t25); + T t36 = atan(t26); + T t57 = t2*1.0E+24; + T t58 = t3*1.0E+24; + T t59 = t4*1.0E+24; + T t60 = t5*1.0E+24; + T t61 = t6*1.0E+24; + T t62 = t9*1.0E+24; + T t63 = t10*1.0E+24; + T t64 = t11*1.0E+24; + T t65 = t12*1.0E+24; + T t66 = t13*1.0E+24; + T t37 = t14*t27; + T t38 = t14*t28; + T t39 = t14*t29; + T t40 = t14*t30; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t46 = t14*t36; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t74 = t64+1.0; + T t75 = t65+1.0; + T t76 = t66+1.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t51 = t41+1.0/2.0; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t84 = 1.0/t74; + T t85 = 1.0/t75; + T t86 = 1.0/t76; + T t52 = t47*udg1; + T t53 = t48*udg2; + T t54 = t49*udg3; + T t55 = t50*udg4; + T t56 = t51*udg5; + T t92 = t14*t17*t77; + T t93 = t14*t18*t78; + T t94 = t14*t19*t79; + T t95 = t14*t20*t80; + T t96 = t14*t21*t81; + T t97 = t14*t22*t82; + T t98 = t14*t23*t83; + T t99 = t14*t24*t84; + T t100 = t14*t25*t85; + T t101 = t14*t26*t86; + T t87 = t52+3.182454300088011E-13; + T t88 = t53+3.182454300088011E-13; + T t89 = t54+3.182454300088011E-13; + T t90 = t55+3.182454300088011E-13; + T t91 = t56+3.182454300088011E-13; + T t102 = t47+t92; + T t103 = t48+t93; + T t104 = t49+t94; + T t105 = t50+t95; + T t106 = t51+t96; + T t107 = t42+t97+1.0/2.0; + T t108 = t43+t98+1.0/2.0; + T t109 = t44+t99+1.0/2.0; + T t110 = t45+t100+1.0/2.0; + T t111 = t46+t101+1.0/2.0; + T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + T t112 = t102*udg9; + T t113 = t103*udg10; + T t114 = t104*udg11; + T t115 = t105*udg12; + T t116 = t106*udg13; + T t117 = t107*udg17; + T t118 = t108*udg18; + T t119 = t109*udg19; + T t120 = t110*udg20; + T t121 = t111*udg21; + T t123 = 1.0/t122; + T t124 = t123*t123; + T t125 = t123*udg8; + T t126 = t123*uinf1; + T t127 = t123*udg6*udg7; + T t130 = t112*t122; + T t131 = t113*t122; + T t132 = t114*t122; + T t133 = t115*t122; + T t134 = t116*t122; + T t135 = t117*t122; + T t136 = t118*t122; + T t137 = t119*t122; + T t138 = t120*t122; + T t139 = t121*t122; + T t152 = t112+t113+t114+t115+t116; + T t153 = t117+t118+t119+t120+t121; + T t128 = (t7*t124)/2.0; + T t129 = (t8*t124)/2.0; + T t140 = -t130; + T t141 = -t131; + T t142 = -t132; + T t143 = -t133; + T t144 = -t134; + T t145 = -t135; + T t146 = -t136; + T t147 = -t137; + T t148 = -t138; + T t149 = -t139; + T t150 = t125+t126; + T t154 = t87*t152; + T t155 = t88*t152; + T t156 = t89*t152; + T t157 = t90*t152; + T t158 = t91*t152; + T t159 = t87*t153; + T t160 = t88*t153; + T t161 = t89*t153; + T t162 = t90*t153; + T t163 = t91*t153; + T t164 = t123*t152*udg6; + T t165 = t123*t152*udg7; + T t166 = t123*t153*udg6; + T t167 = t123*t153*udg7; + T t151 = t128+t129; + T t168 = -t164; + T t169 = -t165; + T t170 = -t166; + T t171 = -t167; + T t176 = t140+t154; + T t177 = t141+t155; + T t178 = t142+t156; + T t179 = t143+t157; + T t180 = t144+t158; + T t181 = t145+t159; + T t182 = t146+t160; + T t183 = t147+t161; + T t184 = t148+t162; + T t185 = t149+t163; + T t186 = -t123*(t164-udg14); + T t187 = -t123*(t165-udg15); + T t188 = -t123*(t166-udg22); + T t189 = -t123*(t167-udg23); + T t190 = t123*(t164-udg14)*-2.0; + T t191 = t123*(t167-udg23)*-2.0; + T t192 = t123*(t167-udg23); + T t194 = -t123*uinf2*(t130-t154); + T t195 = -t124*uinf2*(t130-t154); + T t196 = -t123*uinf3*(t131-t155); + T t197 = -t124*uinf3*(t131-t155); + T t198 = -t123*uinf4*(t132-t156); + T t199 = -t124*uinf4*(t132-t156); + T t200 = -t123*uinf5*(t133-t157); + T t201 = -t124*uinf5*(t133-t157); + T t202 = -t123*uinf6*(t134-t158); + T t203 = -t124*uinf6*(t134-t158); + T t204 = -t123*uinf2*(t135-t159); + T t205 = -t124*uinf2*(t135-t159); + T t206 = -t123*uinf3*(t136-t160); + T t207 = -t124*uinf3*(t136-t160); + T t208 = -t123*uinf4*(t137-t161); + T t209 = -t124*uinf4*(t137-t161); + T t210 = -t123*uinf5*(t138-t162); + T t211 = -t124*uinf5*(t138-t162); + T t212 = -t123*uinf6*(t139-t163); + T t213 = -t124*uinf6*(t139-t163); + T t214 = t123*uinf2*(t130-t154); + T t215 = t123*uinf3*(t131-t155); + T t216 = t123*uinf4*(t132-t156); + T t217 = t123*uinf5*(t133-t157); + T t218 = t123*uinf6*(t134-t158); + T t219 = t123*uinf2*(t135-t159); + T t220 = t123*uinf3*(t136-t160); + T t221 = t123*uinf4*(t137-t161); + T t222 = t123*uinf5*(t138-t162); + T t223 = t123*uinf6*(t139-t163); + T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t172 = t168+udg14; + T t173 = t169+udg15; + T t174 = t170+udg22; + T t175 = t171+udg23; + T t193 = t192*2.0; + T t224 = t187+t188; + T t226 = t190+t192; + T t228 = t195+t197+t199+t201+t203; + T t229 = t205+t207+t209+t211+t213; + f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + uinf12 = 0.0; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg17*udg17; + T t8 = udg18*udg18; + T t9 = udg19*udg19; + T t10 = udg20*udg20; + T t11 = udg21*udg21; + T t12 = 1.0/3.141592653589793; + T t13 = 1.0/param20; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t19 = udg17*1.0E+12; + T t20 = udg18*1.0E+12; + T t21 = udg19*1.0E+12; + T t22 = udg20*1.0E+12; + T t23 = udg21*1.0E+12; + T t24 = atan(t14); + T t25 = atan(t15); + T t26 = atan(t16); + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t54 = t2*1.0E+24; + T t55 = t3*1.0E+24; + T t56 = t4*1.0E+24; + T t57 = t5*1.0E+24; + T t58 = t6*1.0E+24; + T t59 = t7*1.0E+24; + T t60 = t8*1.0E+24; + T t61 = t9*1.0E+24; + T t62 = t10*1.0E+24; + T t63 = t11*1.0E+24; + T t34 = t12*t24; + T t35 = t12*t25; + T t36 = t12*t26; + T t37 = t12*t27; + T t38 = t12*t28; + T t39 = t12*t29; + T t40 = t12*t30; + T t41 = t12*t31; + T t42 = t12*t32; + T t43 = t12*t33; + T t64 = t54+1.0; + T t65 = t55+1.0; + T t66 = t56+1.0; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t44 = t34+1.0/2.0; + T t45 = t35+1.0/2.0; + T t46 = t36+1.0/2.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t74 = 1.0/t64; + T t75 = 1.0/t65; + T t76 = 1.0/t66; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t49 = t44*udg1; + T t50 = t45*udg2; + T t51 = t46*udg3; + T t52 = t47*udg4; + T t53 = t48*udg5; + T t84 = t12*t14*t74; + T t85 = t12*t15*t75; + T t86 = t12*t16*t76; + T t87 = t12*t17*t77; + T t88 = t12*t18*t78; + T t89 = t12*t19*t79; + T t90 = t12*t20*t80; + T t91 = t12*t21*t81; + T t92 = t12*t22*t82; + T t93 = t12*t23*t83; + T t94 = t44+t84; + T t95 = t45+t85; + T t96 = t46+t86; + T t97 = t47+t87; + T t98 = t48+t88; + T t99 = t39+t89+1.0/2.0; + T t100 = t40+t90+1.0/2.0; + T t101 = t41+t91+1.0/2.0; + T t102 = t42+t92+1.0/2.0; + T t103 = t43+t93+1.0/2.0; + T t114 = t49+t50+t51+t52+t53+1.591227150044006E-12; + T t104 = t94*udg9; + T t105 = t95*udg10; + T t106 = t96*udg11; + T t107 = t97*udg12; + T t108 = t98*udg13; + T t109 = t99*udg17; + T t110 = t100*udg18; + T t111 = t101*udg19; + T t112 = t102*udg20; + T t113 = t103*udg21; + T t115 = 1.0/t114; + T t116 = t115*udg6*udg7; + T t117 = t104+t105+t106+t107+t108; + T t118 = t109+t110+t111+t112+t113; + T t119 = t115*t117*udg6; + T t120 = t115*t117*udg7; + T t121 = t115*t118*udg6; + T t122 = t115*t118*udg7; + T t123 = -t119; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t131 = -t115*(t120-udg15); + T t132 = -t115*(t121-udg22); + T t134 = -t13*uinf12*(t115*(t120-udg15)+t115*(t121-udg22)); + T t127 = t123+udg14; + T t128 = t124+udg15; + T t129 = t125+udg22; + T t130 = t126+udg23; + T t133 = t131+t132; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg1*(uinf1+odg1*udg14+t115*(udg6*udg6)-t13*uinf12*(t115*(t119-udg14)*2.0-t115*(t122-udg23))*(2.0/3.0))+nlg2*(t116+t134+odg1*udg22)+tau6*(udg6-uhg6); + f[6*ng+i] = nlg2*(uinf1+odg1*udg23+t115*(udg7*udg7)+t13*uinf12*(t115*(t119-udg14)-t115*(t122-udg23)*2.0)*(2.0/3.0))+nlg1*(t116+t134+odg1*udg15)+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + { + // std::cout << "START FBOU1" << std::endl; + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + // std::cout << "END FBOU1" << std::endl; + } + else if (ib == 2) + { + // std::cout << "START FBOU2" << std::endl; + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + // std::cout << "END FBOU2" << std::endl; + + } + else if (ib == 3) + { + // std::cout << "START FBOU3" << std::endl; + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + // std::cout << "END FBOU3" << std::endl; + + } +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_MPP.cpp new file mode 100644 index 00000000..7144b6b8 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_MPP.cpp @@ -0,0 +1,390 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + // std::cout << "START FLUX" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + uinf14 = 0.0; + uinf15 = 0.0; + uinf16 = 0.0; + uinf17 = 0.0; + uinf18 = 0.0; + uinf19 = 0.0; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = udg17*udg17; + T t10 = udg18*udg18; + T t11 = udg19*udg19; + T t12 = udg20*udg20; + T t13 = udg21*udg21; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = 1.0/param20; + T t17 = udg1*1.0E+12; + T t18 = udg2*1.0E+12; + T t19 = udg3*1.0E+12; + T t20 = udg4*1.0E+12; + T t21 = udg5*1.0E+12; + T t22 = udg17*1.0E+12; + T t23 = udg18*1.0E+12; + T t24 = udg19*1.0E+12; + T t25 = udg20*1.0E+12; + T t26 = udg21*1.0E+12; + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t34 = atan(t24); + T t35 = atan(t25); + T t36 = atan(t26); + T t57 = t2*1.0E+24; + T t58 = t3*1.0E+24; + T t59 = t4*1.0E+24; + T t60 = t5*1.0E+24; + T t61 = t6*1.0E+24; + T t62 = t9*1.0E+24; + T t63 = t10*1.0E+24; + T t64 = t11*1.0E+24; + T t65 = t12*1.0E+24; + T t66 = t13*1.0E+24; + T t37 = t14*t27; + T t38 = t14*t28; + T t39 = t14*t29; + T t40 = t14*t30; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t46 = t14*t36; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t74 = t64+1.0; + T t75 = t65+1.0; + T t76 = t66+1.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t51 = t41+1.0/2.0; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t84 = 1.0/t74; + T t85 = 1.0/t75; + T t86 = 1.0/t76; + T t52 = t47*udg1; + T t53 = t48*udg2; + T t54 = t49*udg3; + T t55 = t50*udg4; + T t56 = t51*udg5; + T t92 = t14*t17*t77; + T t93 = t14*t18*t78; + T t94 = t14*t19*t79; + T t95 = t14*t20*t80; + T t96 = t14*t21*t81; + T t97 = t14*t22*t82; + T t98 = t14*t23*t83; + T t99 = t14*t24*t84; + T t100 = t14*t25*t85; + T t101 = t14*t26*t86; + T t87 = t52+3.182454300088011E-13; + T t88 = t53+3.182454300088011E-13; + T t89 = t54+3.182454300088011E-13; + T t90 = t55+3.182454300088011E-13; + T t91 = t56+3.182454300088011E-13; + T t102 = t47+t92; + T t103 = t48+t93; + T t104 = t49+t94; + T t105 = t50+t95; + T t106 = t51+t96; + T t107 = t42+t97+1.0/2.0; + T t108 = t43+t98+1.0/2.0; + T t109 = t44+t99+1.0/2.0; + T t110 = t45+t100+1.0/2.0; + T t111 = t46+t101+1.0/2.0; + T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + T t112 = t102*udg9; + T t113 = t103*udg10; + T t114 = t104*udg11; + T t115 = t105*udg12; + T t116 = t106*udg13; + T t117 = t107*udg17; + T t118 = t108*udg18; + T t119 = t109*udg19; + T t120 = t110*udg20; + T t121 = t111*udg21; + T t123 = 1.0/t122; + T t124 = t123*t123; + T t125 = t123*udg8; + T t126 = t123*uinf1; + T t127 = t123*udg6*udg7; + T t130 = t112*t122; + T t131 = t113*t122; + T t132 = t114*t122; + T t133 = t115*t122; + T t134 = t116*t122; + T t135 = t117*t122; + T t136 = t118*t122; + T t137 = t119*t122; + T t138 = t120*t122; + T t139 = t121*t122; + T t152 = t112+t113+t114+t115+t116; + T t153 = t117+t118+t119+t120+t121; + T t128 = (t7*t124)/2.0; + T t129 = (t8*t124)/2.0; + T t140 = -t130; + T t141 = -t131; + T t142 = -t132; + T t143 = -t133; + T t144 = -t134; + T t145 = -t135; + T t146 = -t136; + T t147 = -t137; + T t148 = -t138; + T t149 = -t139; + T t150 = t125+t126; + T t154 = t87*t152; + T t155 = t88*t152; + T t156 = t89*t152; + T t157 = t90*t152; + T t158 = t91*t152; + T t159 = t87*t153; + T t160 = t88*t153; + T t161 = t89*t153; + T t162 = t90*t153; + T t163 = t91*t153; + T t164 = t123*t152*udg6; + T t165 = t123*t152*udg7; + T t166 = t123*t153*udg6; + T t167 = t123*t153*udg7; + T t151 = t128+t129; + T t168 = -t164; + T t169 = -t165; + T t170 = -t166; + T t171 = -t167; + T t176 = t140+t154; + T t177 = t141+t155; + T t178 = t142+t156; + T t179 = t143+t157; + T t180 = t144+t158; + T t181 = t145+t159; + T t182 = t146+t160; + T t183 = t147+t161; + T t184 = t148+t162; + T t185 = t149+t163; + T t186 = -t123*(t164-udg14); + T t187 = -t123*(t165-udg15); + T t188 = -t123*(t166-udg22); + T t189 = -t123*(t167-udg23); + T t190 = t123*(t164-udg14)*-2.0; + T t191 = t123*(t167-udg23)*-2.0; + T t192 = t123*(t167-udg23); + T t194 = -t123*uinf2*(t130-t154); + T t195 = -t124*uinf2*(t130-t154); + T t196 = -t123*uinf3*(t131-t155); + T t197 = -t124*uinf3*(t131-t155); + T t198 = -t123*uinf4*(t132-t156); + T t199 = -t124*uinf4*(t132-t156); + T t200 = -t123*uinf5*(t133-t157); + T t201 = -t124*uinf5*(t133-t157); + T t202 = -t123*uinf6*(t134-t158); + T t203 = -t124*uinf6*(t134-t158); + T t204 = -t123*uinf2*(t135-t159); + T t205 = -t124*uinf2*(t135-t159); + T t206 = -t123*uinf3*(t136-t160); + T t207 = -t124*uinf3*(t136-t160); + T t208 = -t123*uinf4*(t137-t161); + T t209 = -t124*uinf4*(t137-t161); + T t210 = -t123*uinf5*(t138-t162); + T t211 = -t124*uinf5*(t138-t162); + T t212 = -t123*uinf6*(t139-t163); + T t213 = -t124*uinf6*(t139-t163); + T t214 = t123*uinf2*(t130-t154); + T t215 = t123*uinf3*(t131-t155); + T t216 = t123*uinf4*(t132-t156); + T t217 = t123*uinf5*(t133-t157); + T t218 = t123*uinf6*(t134-t158); + T t219 = t123*uinf2*(t135-t159); + T t220 = t123*uinf3*(t136-t160); + T t221 = t123*uinf4*(t137-t161); + T t222 = t123*uinf5*(t138-t162); + T t223 = t123*uinf6*(t139-t163); + T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t172 = t168+udg14; + T t173 = t169+udg15; + T t174 = t170+udg22; + T t175 = t171+udg23; + T t193 = t192*2.0; + T t224 = t187+t188; + T t226 = t190+t192; + T t228 = t195+t197+t199+t201+t203; + T t229 = t205+t207+t209+t211+t213; + f[0*ng+i] = t214+t230+odg1*t112+t87*t123*udg6; + f[1*ng+i] = t215+t231+odg1*t113+t88*t123*udg6; + f[2*ng+i] = t216+t232+odg1*t114+t89*t123*udg6; + f[3*ng+i] = t217+t233+odg1*t115+t90*t123*udg6; + f[4*ng+i] = t218+t234+odg1*t116+t91*t123*udg6; + f[5*ng+i] = uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); + f[6*ng+i] = t127+t227+odg1*udg15; + f[7*ng+i] = odg1*udg16+t150*udg6-uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+t123*t227*udg7+t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)-t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); + f[8*ng+i] = t219+t235+odg1*t117+t87*t123*udg7; + f[9*ng+i] = t220+t236+odg1*t118+t88*t123*udg7; + f[10*ng+i] = t221+t237+odg1*t119+t89*t123*udg7; + f[11*ng+i] = t222+t238+odg1*t120+t90*t123*udg7; + f[12*ng+i] = t223+t239+odg1*t121+t91*t123*udg7; + f[13*ng+i] = t127+t227+odg1*udg22; + f[14*ng+i] = uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); + f[15*ng+i] = odg1*udg24+t150*udg7-uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+t123*t227*udg6+t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)+t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); + } + // std::cout << "END FLUX" << std::endl; + +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp new file mode 100644 index 00000000..17dc6e69 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp @@ -0,0 +1,213 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double wdot[5]; + // std::cout << "START OUTPUT" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + // uinf1 = mix->P() / rhoe_scale; + // uinf2 = mix->mixtureFrozenGamma(); + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = uinf2*2.0; + T t8 = uinf2+1.0; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param15; + T t13 = param17*1.0E+12; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t11 = t7-2.0; + T t12 = 1.0/t8; + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t39 = t2*1.0E+24; + T t40 = t3*1.0E+24; + T t41 = t4*1.0E+24; + T t42 = t5*1.0E+24; + T t43 = t6*1.0E+24; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t54 = t9*t14*t49; + T t55 = t9*t15*t50; + T t56 = t9*t16*t51; + T t57 = t9*t17*t52; + T t58 = t9*t18*t53; + T t59 = t29+t54; + T t60 = t30+t55; + T t61 = t31+t56; + T t62 = t32+t57; + T t63 = t33+t58; + T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t64 = t59*udg9; + T t65 = t60*udg10; + T t66 = t61*udg11; + T t67 = t59*udg17; + T t68 = t62*udg12; + T t69 = t60*udg18; + T t70 = t63*udg13; + T t71 = t61*udg19; + T t72 = t62*udg20; + T t73 = t63*udg21; + T t75 = 1.0/t74; + T t76 = t75*t75; + T t77 = t75*udg8; + T t78 = t75*uinf1; + T t86 = t64+t65+t66+t68+t70; + T t87 = t67+t69+t71+t72+t73; + T t79 = t77*1.0E+12; + T t80 = t78*1.0E+12; + T t81 = t77+t78-1.0E-4; + T t88 = t75*t86*udg6; + T t89 = t75*t87*udg7; + T t82 = t79+t80-1.0E+8; + T t90 = -t88; + T t91 = -t89; + T t95 = -t75*(t88-udg14); + T t96 = -t75*(t89-udg23); + T t97 = t75*(t88-udg14)*-1.0E+12; + T t98 = t75*(t89-udg23)*-1.0E+12; + T t83 = atan(t82); + T t92 = t90+udg14; + T t93 = t91+udg23; + T t102 = t95+t96-1.0E+4; + T t103 = t97+t98-1.0E+16; + T t84 = t9*t83; + T t104 = atan(t103); + T t85 = t84+1.0/2.0; + T t105 = t9*t104; + T t94 = t81*t85; + T t106 = t105-1.0/2.0; + T t99 = t94+1.000000003182454E-4; + T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t100 = t11*t12*t99; + T t109 = t108*-1.0E+12; + T t110 = t107-2.0E+4; + T t101 = 1.0/sqrt(t100); + T t111 = t109-2.0E+16; + T t112 = atan(t111); + T t113 = t9*t112; + T t114 = t113+1.0/2.0; + T t115 = -t114*(t108+2.0E+4); + T t116 = t108+t115+1.0E+4; + T t117 = odg2*t10*t101*t116; + T t118 = -t117; + T t120 = t117*1.0E+12; + T t119 = param17+t118; + T t121 = -t120; + T t122 = t13+t121; + T t123 = atan(t122); + T t124 = t9*t123; + T t125 = t124-1.0/2.0; + T t126 = t119*t125; + + f[j+npe*0+npe*nce*k] = wdot[0]/omega_scale; + f[j+npe*1+npe*nce*k] = wdot[1]/omega_scale; + f[j+npe*2+npe*nce*k] = wdot[2]/omega_scale; + f[j+npe*3+npe*nce*k] = wdot[3]/omega_scale; + f[j+npe*4+npe*nce*k] = wdot[4]/omega_scale; + f[j+npe*5+npe*nce*k] = mix->P(); + f[j+npe*6+npe*nce*k] = mix->T(); + f[j+npe*7+npe*nce*k] = mix->mixtureFrozenGamma(); + f[j+npe*8+npe*nce*k] = rhoe; + f[j+npe*9+npe*nce*k] = odg1; + } + // std::cout << "END OUTPUT" << std::endl; + +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp new file mode 100644 index 00000000..996c4cc8 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp @@ -0,0 +1,53 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + // std::cout << "START SOURCE" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + double wdot[5]; + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + f[7*ng+i] = 0.0; + } + // std::cout << "END SOURCE" << std::endl; + +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m b/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m new file mode 100644 index 00000000..a358f697 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m @@ -0,0 +1,77 @@ +function avField = avfieldLaplacian2d(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); + gam1 = gam - 1; + nenergy = 1; + ncu = nspecies + nd + nenergy; + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e12; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(2); + + % Get base variables + rho_i = u(1:nspecies); + rhou = u(nspecies+1); + rhov = u(nspecies+nd); + rhoE = u(nspecies+nd+1); + +% drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha); + drho_dx_i = -q(1:nspecies); + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); +% drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies); + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); +% drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Regularization + rho_i = rmin + lmax(rho_i-rmin,alpha); % need to double check regularizatino here + drho_dx_i = drho_dx_i .* dlmax(u(1:nspecies)-rmin,alpha); + drho_dy_i = drho_dy_i .* dlmax(u(1:nspecies)-rmin,alpha); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + % Simple derived working quantities + rho = sum(rho_i); + rhoinv = 1./rho; + uv = rhou.*rhoinv; + vv = rhov.*rhoinv; + E = rhoE * rhoinv; %energy + H = E + p*rhoinv; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + du_dx = (drhou_dx - drho_dx.*uv).*rhoinv; + dv_dy = (drhov_dy - drho_dy.*vv).*rhoinv; + div_v = (du_dx + dv_dy); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Trhouly don't understand the signs + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + + % % Dilatation Sensor sb + sb = - (hm./porder) .* (div_v./c_star); + sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be + + % Artificial Bulk viscosity + avb = (kb.*hm./(porder)) .* (sqrt(uv.^2 + vv.^2) + c_star) .* sb; + + % Assign artificial viscosities + avField(1) = avb; % bulk +end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/dlmax.m b/Applications/Hypersonics/ReactingCylinder/dlmax.m new file mode 100644 index 00000000..cb02a589 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/dlmax.m @@ -0,0 +1,3 @@ +function dout = dlmax(x, alpha) + dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/getStates2d.py b/Applications/Hypersonics/ReactingCylinder/getStates2d.py new file mode 100644 index 00000000..cdc486ac --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/getStates2d.py @@ -0,0 +1,135 @@ +import sys +import os +mppPyDir = os.environ.get('MPP_LOCALPY') +sys.path.append(mppPyDir) +import _mutationpp as mpp +import numpy as np + + +def print_equil_vals(mix, T, P): + mix.equilibrate(T, P) + rhovec = mix.densities() + rho = np.sum(rhovec) + e = mix.mixtureEnergyMass() + rhoE = rho * e + 0.0 + w = mix.netProductionRates() + + print("To check") + print("(T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + print("Initial conditions (dimensional): ") + print("(rho_i, rhou, rhoE) = (" + str(rhovec) + " 0.0 " + str(rhoE) + ")") + print("omega: " + str(w)) + +def init_mixture(): + opt = mpp.MixtureOptions("air_5") + opt.setStateModel("ChemNonEq1T") + opt.setViscosityAlgorithm("Gupta-Yos") + opt.setThermodynamicDatabase("NASA-9") + + mix = mpp.Mixture(opt) + return mix + +def rhoE(mix, u): + e = mix.mixtureEnergyMass() + rho = mix.density() + uTu2 = 0.5 * u**2 # Assumes scalar density + rhoe = rho * e + rho * uTu2 + return rhoe + +# def return_farfield(): +u_inf = 5956 +rho_inf = 1.547e-3 +# p_inf = 476 +T_inf = 901 +# Mach_inf = 8.98 +Y_N = 6.5e-7 +Y_O = 0.22830098 +Y_NO = 0.01026010 +Y_N2 = 0.75430704 +Y_O2 = 0.00713123 +Y_vec = np.array([Y_N, Y_O, Y_NO, Y_N2, Y_O2]) + # return rho_inf, + +if __name__=="__main__": + + print('hi') + + mix = init_mixture() + + print("=============") + print(" Inf state ") + print("=============") + mix.setState(rho_inf * Y_vec, T_inf, 1) + a_inf = mix.frozenSoundSpeed() + u_scale = a_inf + p_inf = mix.P() + Ma_inf = u_inf / a_inf + mu_inf = mix.viscosity() + kappa_inf = mix.frozenThermalConductivity() + rhoE_inf = rho_inf * u_scale**2 + rho_vec_string = ' '.join(map(str, rho_inf * Y_vec)) + print("U0dim = [rho_i_inf, (rhou)_inf, (rhov)_inf, rhoE] = [" + rho_vec_string + " " + str(u_inf * rho_inf) + " " + str(0.0) + " " + str(rhoE(mix, u_inf)) + "]") + print("U0nondim = [rho_i_inf, (rhou)_inf, (rhov)_inf, rhoE] = [" + " ".join(map(str, Y_vec)) + " " + str(u_inf * rho_inf / (rho_inf * a_inf)) + " " + str(0.0) + " " + str(rhoE(mix, u_inf) / rhoE_inf) + "]") + + print("PRINT SCALING TERMS") + print("Just to make sure once again: (T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + + print("rho_ref = " + str(rho_inf)) + print("u_ref = " + str(u_scale)) + print("rhoE_ref = " + str(rhoE_inf)) + print("T_ref = " + str(T_inf)) + print("mu_ref = " + str(mu_inf)) + print("kappa_ref = " + str(kappa_inf)) + + print("MISC Terms") + print("T_ref from cp: " + str(u_scale**2 / mix.mixtureFrozenCpMass())) + print("Re = " + str(rho_inf * u_scale / mu_inf)) + print("Pr = " + str(mu_inf * mix.mixtureFrozenCpMass() / kappa_inf)) + + + + + # print("PRINT SCALING TERMS using inf domain") + # print("Just to make sure once again: (T, P) = (" + str(mix.T()) + ", " + str(mix.P()) + ")") + # rho_inf = mix.density() + # u_inf = mix.frozenSoundSpeed() + # print("rho_inf = " + str(rho_inf)) + # print("u_inf = " + str(u_inf)) + # print("rhoE_inf = " + str(rho_inf * u_inf * u_inf)) + + # cp = mix.mixtureFrozenCpMass() + # gam = mix.mixtureFrozenGamma() + # print("cp = " + str(cp)) + # print("gam = " + str(gam)) + + # opt2 = mpp.MixtureOptions("air_5") + # opt2.setStateModel("ChemNonEq1T") + # opt2.setThermodynamicDatabase("NASA-9") + # opt2.setViscosityAlgorithm("Gupta-Yos") + # mix2 = mpp.Mixture(opt2) + + # print("=============") + # print(" LEFT STATE ") + # print("=============") + # print_equil_vals(mix2, TL, PL) + + # print("=============") + # print(" RIGHT STATE ") + # print("=============") + # print_equil_vals(mix2, TR, PR) + + # print() + # print("PRINT SCALING TERMS using right side of domain") + # print("Just to make sure once again: (T, P) = (" + str(mix2.T()) + ", " + str(mix2.P()) + ")") + # rho_inf = mix2.density() + # u_inf = mix2.frozenSoundSpeed() + # print("rho_inf = " + str(rho_inf)) + # print("u_inf = " + str(u_inf)) + # print("rhoE_inf = " + str(rho_inf * u_inf * u_inf)) + + # cp = mix2.mixtureFrozenCpMass() + # gam = mix2.mixtureFrozenGamma() + # print("cp = " + str(cp)) + # print("gam = " + str(gam)) + + diff --git a/Applications/Hypersonics/ReactingCylinder/mkmesh_circincirc_Ma17b.m b/Applications/Hypersonics/ReactingCylinder/mkmesh_circincirc_Ma17b.m new file mode 100644 index 00000000..0e6625b8 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/mkmesh_circincirc_Ma17b.m @@ -0,0 +1,124 @@ +function [p,t,dgnodes] = mkmesh_circincirc_Ma17b(porder,m,n,r1,r2,alpha) +% This routine is inspired from mkmesh_circincirc_half, but adapted to the +% Ma = 17.605 case presented in Barter Thesis. + +elemtype = 1; +[p,t] = squaremesh(m-1,n-1,1,elemtype); +p=p'; + +%%%%%%%%%%% Defines 3 regions with different refining speeds %%%%%%%%%%%%%% +% Number of element in radial direction for each region +nn1 = ceil(5.5*n/10); nn2 = ceil(3.05*n/10); nn3 = n-nn1-nn2; +% Position of transition between refinement areas +x12 = 0.1; x23 = 0.375; +ln1 = loginc(linspace(0.00,x12,nn1+1),alpha); +ln2 = loginc(linspace(x12, x23,nn2+1),1); +ln3 = loginc(linspace(x23,1.00,nn3),2); +ln = [ln1(1:end-1) ln2(1:end-1) ln3]; +ln = reshape(ones(m,1)*ln,[m*n,1]); + +% Assign mesh point positions +p(:,2) = ln; +%p(:,2) = loginc(p(:,2),alpha); % OLD VERSION +%plot(ln,ln,'.'); % A SUPPRIMER +ind = p(:,1)<=0.5; +p(ind,1) = logdec(p(ind,1),1); +ind = p(:,1)>=0.5; +p(ind,1) = loginc(p(ind,1),1); + +dgnodes = mkdgnodes(p',t,porder); + +pnew = p; +pnew(:,1) = -(r1+(r2-r1)*p(:,2)).*sin(pi*p(:,1)); +pnew(:,2) = -(r1+(r2-r1)*p(:,2)).*cos(pi*p(:,1)); +[p,t] = fixmesh(pnew,t'); +p = p'; +t = t'; + +pnew = zeros(size(dgnodes)); +pnew(:,1,:) = -(r1+(r2-r1)*dgnodes(:,2,:)).*sin(pi*dgnodes(:,1,:)); +pnew(:,2,:) = -(r1+(r2-r1)*dgnodes(:,2,:)).*cos(pi*dgnodes(:,1,:)); +dgnodes = pnew; + + +function dgnodes = mkdgnodes(p,t,porder) +%CREATEDGNODES Computes the Coordinates of the DG nodes. +% DGNODES=CREATENODES(MESH,FD,FPARAMS) +% +% MESH: Mesh Data Structure +% FD: Distance Function d(x,y) +% FPARAMS: Additional parameters passed to FD +% DGNODES: Triangle indices (NPL,2,NT). The nodes on +% the curved boundaries are projected to the +% true boundary using the distance function FD +% + +% npv : number of nodes per volume element +% nfv : number of faces per volume element +% npf : number of nodes per face element + +% if porder>4 +% error("app.porder must be less than or equal to 4."); +% end + +[nve,ne]=size(t); +nd=size(p,1); + +elemtype = 0; +if (nd==2) && (nve==4) + elemtype=1; +end +if (nd==3) && (nve==8) + elemtype=1; +end + +plocal = masternodes(porder,nd,elemtype); + +npl=size(plocal,1); +if nd==1 + xi = plocal(:,1); + philocal(:,1) = 1 - xi; + philocal(:,2) = xi; +elseif nd==2 && nve==3 % tri + xi = plocal(:,1); + eta = plocal(:,2); + philocal(:,1) = 1 - xi - eta; + philocal(:,2) = xi; + philocal(:,3) = eta; +elseif nd==2 && nve==4 % quad + xi = plocal(:,1); + eta = plocal(:,2); + philocal(:,1) = (1-xi).*(1-eta); + philocal(:,2) = xi.*(1-eta); + philocal(:,3) = xi.*eta; + philocal(:,4) = (1-xi).*eta; +elseif nd==3 && nve==4 % tet + xi = plocal(:,1); + eta = plocal(:,2); + zeta = plocal(:,3); + philocal(:,1) = 1 - xi - eta - zeta; + philocal(:,2) = xi; + philocal(:,3) = eta; + philocal(:,4) = zeta; +elseif nd==3 && nve==8 % hex + xi = plocal(:,1); + eta = plocal(:,2); + zeta = plocal(:,3); + philocal(:,1) = (1-xi).*(1-eta).*(1-zeta); + philocal(:,2) = xi.*(1-eta).*(1-zeta); + philocal(:,3) = xi.*eta.*(1-zeta); + philocal(:,4) = (1-xi).*eta.*(1-zeta); + philocal(:,5) = (1-xi).*(1-eta).*(zeta); + philocal(:,6) = xi.*(1-eta).*(zeta); + philocal(:,7) = xi.*eta.*(zeta); + philocal(:,8) = (1-xi).*eta.*(zeta); +end + +% Allocate nodes +dgnodes=zeros(npl,nd,ne); +for dim=1:nd + for node=1:nve + dp=reshape(philocal(:,node),[npl 1])*reshape(p(dim,t(node,:)),[1 ne]); + dgnodes(:,dim,:)=dgnodes(:,dim,:)+reshape(dp,[npl 1 ne]); + end +end diff --git a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m new file mode 100644 index 00000000..bada3847 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m @@ -0,0 +1,176 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +% pde.metis = "/opt/homebrew/Cellar/metis/5.1.0/bin/mpmetis"; +% pde.mpicompiler = "/usr/local/Cellar/open-mpi/4.1.2/bin/mpicxx "; +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; +% pde.cpulibflags = "-arch x86_64"; +% pde.cpuappflags = "-arch x86_64"; +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_2d"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 2; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +% tfinal = 0.000005; % 1 with 1e-4 doesn't work super well +tfinal = 0.0324; +% nt = 3240/10; +% dt = tfinal/nt; +% dt = 10*1e-5; +nt = 1000; +% nt = 150 +% dt = tfinal / nt; +dt = 1.0000000000000e-5; +pde.dt = [dt*ones(1,5*nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; +% tfinal = dt*nt + 10*dt*nt + 100*dt*8*nt +% pde.dt = [dt*ones(1,nt)]; +pde.saveSolFreq = ceil(nt/100); +% pde.saveSolFreq = 100; +% pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +pde.timestepOffset = 600; + +% Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 19; +pde.linearsolvertol = 1e-5; +pde.matvectol = 1e-7; +pde.NLiter = 4; +pde.RBdim = 40; +pde.NLtol = 1e-9; + +pde.AV = 1; +% pde.nce = 12; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +nspecies = 5; + +%% Stabilization and mesh +ndim = 2; +pde.tau = [5, 5, 5, 5, 5, 5, 5, 5]; + +% mesh size +rbody = 0.045; +rdomain = 0.12; +[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_circincirc_Ma17b(pde.porder,61,61,rbody,rdomain,1); +mesh.boundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1e-7, @(p) abs(p(1,:))<20}; +% adiabatic wall, supersonic outflow, supersonic inflow +mesh.boundarycondition = [3;2;1]; + +pde.pgauss = 2*(pde.porder); +pde.nd = ndim; +pde.elemtype = 1; +master = Master(pde); +[~, ~, jac] = volgeom(master.shapent,permute(mesh.dgnodes,[1 3 2])); +hsz = reshape(sqrt(jac),[],1,size(mesh.dgnodes,3)); +[~,cgelcon,rowent2elem,colent2elem,~] = mkcgent2dgent(mesh.dgnodes,1e-8); +hh = dg2cg2(max(hsz,0e-5), cgelcon, colent2elem, rowent2elem); +hh = dg2cg2(hh, cgelcon, colent2elem, rowent2elem); + +% distance to the wall +mesh.f = facenumbering(mesh.p,mesh.t,pde.elemtype,mesh.boundaryexpr,mesh.periodicexpr); +f = mkf(mesh.t,mesh.f,2); +dist = meshdist(f,mesh.dgnodes,master.perm,[1]); % distance to the wall + +mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = hh.*tanh(1000*dist); + +%% Initial conditions and parameters +% TL=9000 + +% Dimensional inflow quantities +rho_inf = [1.0055500000000001e-09 0.00035318161606 1.5872374699999997e-05 0.00116691299088 1.103201281e-05]; +rhou_inf = 9.213932; +rhov_inf = 0.0; +rhoE_inf = 33563.20282790763; + +% Reference quantities for nondimensionalizing +rho_ref = 0.001547; +% u_ref = 665.5369622053455; +u_ref = 5956; +% rhoE_ref = 685.2273261511706; +rhoE_ref = rho_ref * u_ref^2; +T_ref = 374.6764014579334; +mu_ref = 4.415107627874723e-05; +kappa_ref = 0.07663957108841235; + +% Nondimensional quantities +Re = 23319.605484391683; +Pr = 0.681045690355942; + +% Av params +kb = 1.5; +sb0 = 0.001; +sbmax = 2.5; + +% Load into Exasim data structures +pde.physicsparam(1:nspecies) = rho_inf; +pde.physicsparam(nspecies+1) = rhou_inf; +pde.physicsparam(nspecies+2) = rhov_inf; +pde.physicsparam(nspecies+3) = rhoE_inf; +pde.physicsparam(15) = pde.porder; +pde.physicsparam(16) = kb; +pde.physicsparam(17) = sb0; +pde.physicsparam(18) = sbmax; +pde.physicsparam(19) = Re; +pde.physicsparam(20) = Pr; + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = rho_ref; % rho_inf +pde.externalparam(2) = u_ref; % u_inf +pde.externalparam(3) = rhoE_ref; % rhoE_inf +pde.externalparam(4) = T_ref; +pde.externalparam(5) = mu_ref; +pde.externalparam(6) = kappa_ref; + +% intial solution +ui = [rho_inf(:)'/rho_ref rhou_inf/(rho_ref*u_ref) rhov_inf/(rho_ref*u_ref) rhoE_inf/rhoE_ref]; +UDG = initu(mesh,{ui(1),ui(2),ui(3),ui(4),ui(5),ui(6),ui(7),ui(8),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); % freestream +UDG(:,nspecies+1,:) = UDG(:,nspecies+1,:).*tanh(100*dist); +UDG(:,nspecies+2,:) = UDG(:,nspecies+2,:).*tanh(100*dist); +mesh.udg = UDG; + +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +eval('!cp opuApp_MPP.cpp opuApp.cpp'); +eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +eval('!cp opuFbou_2d_MPP.cpp opuFbou.cpp'); %TODO +eval('!cp opuSource_2d_MPP.cpp opuSource.cpp'); %X +eval('!cp opuOutput_2d_MPP.cpp opuOutput.cpp'); %TODO +eval('!cp opuAvfield_2d_MPP.cpp opuAvfield.cpp') %X +% eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +runstr = runcode(pde); diff --git a/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m b/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m new file mode 100644 index 00000000..b9713142 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m @@ -0,0 +1,386 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + f = avfieldLaplacian2d(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +% function avField = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd) +% % Mutation outputs +% p = eta(1); +% gam = eta(2); +% gam1 = gam - 1; +% +% % artificial viscosity +% porder = mu(15); +% +% % regularization parameters for the bulk viscosity +% kb = mu(16); +% sb0 = mu(17); %0.02 +% sbmin = 0.0; +% sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing +% +% % regularization parameters +% alpha = 1.0e12; +% rmin = 0.0; +% Hmin = 1.0e-4; +% +% % mesh size +% hm = v(2); +% +% % Get base variables +% rvec = u(1:nspecies); +% ru = u(nspecies+1); +% rv = u(nspecies+nd); +% rE = u(nspecies+nd+1); +% +% rx = sum(-q(1:nspecies)); +% rux = -q(nspecies+1); +% rvx = -q(nspecies+nd); +% +% % Regularization +% rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here +% +% % Simple derived working quantities +% r = sum(rvec); +% r1 = 1./r; +% uv = ru.*r1; +% vv = rv.*r1; +% E = rE * r1; %energy +% H = E + p*r1; %enthalpy +% H = Hmin + lmax(H - Hmin, alpha); +% +% % Critical speed of Sound +% c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 +% +% % Computing derivatives for the sensors +% ux = (rux - rx.*uv).*r1; +% vx = (rvx - rx.*vv).*r1; +% div_v = (ux + vx); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation +% % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs +% % limit divergence and vorticity +% sigm = 1e4; +% div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); +% +% % % Dilatation Sensor sb +% sb = - (hm./porder) .* (div_v./c_star); +% sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be +% % sb = log(1 + exp(alpha * (sb - 0.01)))/alpha; +% % Artificial Bulk viscosity +% avb = (kb.*hm./(porder)) .* (abs(uv) + abs(vv) + abs(c_star)) .* sb; +% +% % Assign artificial viscosities +% avField(1) = avb; % bulk +% end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + ndim = 2; + m = sym(ones(nspecies + ndim + 1, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + % % Clipper utilities + % alpha = 1.0e3; + % rmin = 0.0; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + fv = fluxviscous(u, q, w, v, x, t, mu, eta, nspecies, nd); + fl = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv - fl; +end + +function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) + rmin = 0.0; + alpha = 1.0e12; + eps_av = v(1); + nenergy = 1; + ncu = nspecies + ndim + nenergy; +% hm = v(2); + %TODO: CHECK GAS OUTPUTS TO INPUTS USED BY HTR GROUP + %TODO: CHECK NONDIM USED BY HTR GROUP ! + r_vec = u(1:nspecies); + dr = dlmax(r_vec-rmin,alpha); % Regularize derivative + + drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha); + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha); + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + fv(1:nspecies,1) = eps_av*drho_dx_i; % dxrho_i + fv(nspecies+1,1) = eps_av*drhou_dx; % dxrhou + fv(nspecies+2,1) = eps_av*drhov_dx; % dxrhov + fv(nspecies+3,1) = eps_av*drhoE_dx; % dxrhoE + fv(1:nspecies,2) = eps_av*drho_dy_i; % dxrho_i + fv(nspecies+1,2) = eps_av*drhou_dy; % dxrhou + fv(nspecies+2,2) = eps_av*drhov_dy; % dxrhov + fv(nspecies+3,2) = eps_av*drhoE_dy; % dxrhoE +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + % ndim = 2; + fi = sym(zeros(nspecies+ndim+1,2)); + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = 1.0e12; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + if ndim == 2 + rhov = u(nspecies+2); + end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + vv = rhov * rhoinv; + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies,1) = rho_i(ispecies) * uv; + end + fi(nspecies + 1,1) = rhou * uv + p; + fi(nspecies + 2,1) = rhov * uv; + fi(nspecies + ndim + 1,1) = rhou * H; + + for ispecies = 1:nspecies + fi(ispecies,2) = rho_i(ispecies) * vv; + end + fi(nspecies + 1,2) = rhou * vv; + fi(nspecies + 2,2) = rhov * vv + p; + fi(nspecies + ndim + 1,2) = rhov * H; + + % fi = [ru, ru*uv+p, rv*uv, ru*h, ... + % rv, ru*vv, rv*vv+p, rv*h]; + % fi = reshape(fi,[4,2]); +end + + + +function fv = fluxviscous(u, q, w, v, x, t, mu, eta, nspecies, ndim) + %TODO for thursday: + % - double check with papers: consistent with may, gnoffo. Maybe typo in su2mpp? + % - double check with NS code (TODO: REALLY CONFUSED ABOUT SIGN OF STRESS TENSOR) + % - add AV options: tomorrow, be clear about shear, bulk, thermal, and how density should come into this (let's discuss) + % - try to generate + rmin = 0.0; + alpha = 1e12; + nenergy=1; + ncu = nspecies + ndim + nenergy; + + Pr = mu(19); + Re = mu(20); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = eta(2:nspecies+1); + h_vec = eta(nspecies+2:2*nspecies+1); + mu_d = eta(2*nspecies+2); + kappa = eta(2*nspecies+3); + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + beta = 0.0; + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+ndim+1); + + drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha); + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha); + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Some useful derived quantities + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + rho_inv = 1.0 / rho; +% drho_dx_inv = 1.0 / drho_dx; +% drho_dy_inv = 1.0 / drho_dy + uv = rhou * rho_inv; %velocity + vv = rhov * rho_inv; + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * (uv * uv + vv * vv); + duTu2_dx = uv * du_dx + vv * dv_dx; + duTu2_dy = uv * du_dy + vv * dv_dy; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dre_dy = dre_drho * drho_dy + dre_duTu2 * duTu2_dy + dre_drhoE * drhoE_dy; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + dT_dy = sum(dT_drho_i .* drho_dy_i) + dT_drhoe * dre_dy; + +% %%%%%%%% Modify appropriate coefficients +% NOTE: for Laplacian AV, we don't want to add additional viscosity to anything here +% kappa = kappa + avk; % thermal conductivity +% mu_d = mu_d + avs; % dynamic viscosity +% beta = 0; % bulk viscosity +% D_vec = D_vec + avDvec; % Species diffusion velocities + + %%%%%%%% Calculation of J_i +% Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + dY_dy_i = (drho_dy_i * rho - rho_i * drho_dy) * rho_inv * rho_inv; + + J_i_x = -rho * D_vec .* dY_dx_i + rho_i .* sum(D_vec .* dY_dx_i); + J_i_y = -rho * D_vec .* dY_dy_i + rho_i .* sum(D_vec .* dY_dy_i); + + %%%%%%%% Stress tensor tau + % txx = viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + txx = mu_d * 2.0/3.0 * (2 * du_dx - dv_dy) / Re + beta * (du_dx + dv_dy); + txy = mu_d * (du_dy + dv_dx) / Re; + tyy = mu_d * 2.0/3.0 * (2 * dv_dy - du_dx) / Re + beta * (du_dx + dv_dy); + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies,1) = -J_i_x(ispecies); + fv(ispecies,2) = -J_i_y(ispecies); + end + + fv(nspecies + 1, 1) = txx; + fv(nspecies + 2, 1) = txy; + fv(nspecies + ndim + 1,1) = uv * txx + vv * txy - (sum(h_vec.*J_i_x) - kappa * dT_dx / (Re * Pr)); + fv(nspecies + 1, 2) = txy; + fv(nspecies + 2, 2) = tyy; + fv(nspecies + ndim + 1,2) = uv * txy + vv * tyy - (sum(h_vec.*J_i_y) - kappa * dT_dy / (Re * Pr)); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = 1.0e12; + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); + s(nspecies+1) = 0.0; + s(nspecies+2) = 0.0; + s(nspecies+3) = 0.0; +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + ub = sym(zeros(nspecies+ndim+1, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + + uinflow = initu(x, mu, eta); + + uoutflow = u; + + uadiabatic = u; + uadiabatic(nspecies+1:nspecies+ndim) = 0.0; + + ub(:,1) = uinflow; + ub(:,2) = uoutflow; + ub(:,3) = uadiabatic; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + fb = sym(zeros(nspecies+ndim+1, 3)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); + + fadiabatic = fn; + fadiabatic(1:nspecies) = 0.0; + fadiabatic(nspecies+ndim+1) = 0.0; + fb(:,1) = fn; + fb(:,2) = fn; + fb(:,3) = fadiabatic; +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + +% u0 = mu(1:nspecies+2+1); + u0(1:nspecies) = mu(1:nspecies) / rho_scale; + u0(nspecies+1:nspecies+2) = mu(nspecies+1:nspecies+2) / (rho_scale * u_scale); + u0(nspecies+2+1) = mu(nspecies + 2 + 1) / rhoe_scale; +end + +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(10,1)); + nspecies = 5; + alpha = 1.0e3; + rmin = 0.0; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + o(1:8) = u(1:8); + o(1) = v(1); +% o = sensor_outputs(u, q, w, v, x, t, mu, eta); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/plotsol.m b/Applications/Hypersonics/ReactingCylinder/plotsol.m new file mode 100644 index 00000000..4a1dfa99 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/plotsol.m @@ -0,0 +1,97 @@ +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +ti = 2000; +% Uout = getsolution(['dataout/out'],dmd,master.npe); +Uout = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +UCGout = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +% out = eulereval(Uout,'r',gam,Minf); +rho = sum(Uout(:,1:5,:),2); +out = Uout(:,1,:); +% out = rho; +% out = rho; +% outCG = +[om,ind] = max(abs(out(:))); +figure(100); clf; scaplot(mesh,out,[],1); +x = mesh.dgnodes(:,1,:); +y = mesh.dgnodes(:,2,:); +hold on; +plot(x(ind),y(ind),'o'); +colormap('jet'); +%% +titles = ["w1","w2","w3","w4","w5","p","t","gam","rhoe","sb0"]; +for i = 1:10 +% if i ~= 9 + figure(i); clf + wcurr = UCGout(:,i,:); + scaplot(mesh,wcurr,[],1); + title(titles(i)) +% waitforbuttonpress +% end +end +% figure(7); clf +P = UCGout(:,6,:); +T = UCGout(:,7,:); +gam = UCGout(:,8,:); +sb0 = UCGout(:,10,:); +% figure(1) +% out = Uout(:,8,:); +% % outCG = +% [om,ind] = max(abs(out(:))); +% figure(1); clf; scaplot(mesh,out,[],1); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% colormap('jet'); + +% +% Uout = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% figure(2); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% Uout = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% figure(4); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% udg = getsolution(['dataout/out_udg' num2str(ti)],dmd,master.npe); +% vdg = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% sdg = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% avField = getavfield2dmatlab(udg(:,1:4,:),udg(:,5:12,:),vdg,pde.physicsparam); +% avc = getavfield2dc(udg,vdg,pde.physicsparam); +% +% figure(1); clf; scaplot(mesh,avField(:,1,:),[],1); colormap('jet'); +% figure(2); clf; scaplot(mesh,avc(:,1,:),[],1); colormap('jet'); +% figure(3); clf; scaplot(mesh,vdg(:,1,:),[],1); colormap('jet'); +% figure(4); clf; scaplot(mesh,sdg(:,1,:),[],1); colormap('jet'); +% +% +% % figure(1); clf; hold on; +% % for ib=1:3 +% % f = mkf(mesh.t,mesh.f,2); +% % if ib==1 +% % pars={'facecolor',[.8,1,.8],'edgecolor','b','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % elseif ib==2 +% % pars={'facecolor',[.8,1,.8],'edgecolor','r','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % else +% % pars={'facecolor',[.8,1,.8],'edgecolor','k','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % end +% % ind = find(f(end,:)==-ib); +% % patch('faces',f(1:end-4,ind)','vertices',mesh.p',pars{:}); +% % end +% % axis equal; axis tight; +% % +% % +% +% From a43c921986be04f0bd7757dfa02193408e45305c Mon Sep 17 00:00:00 2001 From: rloekvh Date: Sun, 9 Oct 2022 15:01:57 -0400 Subject: [PATCH 19/23] add files to avoid cluster slow codegen --- .../app/opuApp-33e42e37.o.tmp | 0 .../app/opuApp-e1c02cfd.o.tmp | 0 .../Hypersonics/ReactingCylinder/app/opuApp.a | Bin 0 -> 68208 bytes .../ReactingCylinder/app/opuApp.cpp | 238 ++++ .../ReactingCylinder/app/opuApp_MPP.cpp | 238 ++++ .../ReactingCylinder/app/opuAvfield.cpp | 200 ++++ .../ReactingCylinder/app/opuFbou.cpp | 1042 +++++++++++++++++ .../ReactingCylinder/app/opuFhat.cpp | 6 + .../ReactingCylinder/app/opuFlux.cpp | 390 ++++++ .../ReactingCylinder/app/opuInitodg.cpp | 6 + .../ReactingCylinder/app/opuInitq.cpp | 6 + .../ReactingCylinder/app/opuInitu.cpp | 33 + .../ReactingCylinder/app/opuInitu_MPP.cpp | 51 + .../ReactingCylinder/app/opuInitudg.cpp | 6 + .../ReactingCylinder/app/opuInitwdg.cpp | 6 + .../ReactingCylinder/app/opuOutput.cpp | 213 ++++ .../ReactingCylinder/app/opuSource.cpp | 53 + .../ReactingCylinder/app/opuSourcew.cpp | 6 + .../ReactingCylinder/app/opuStab.cpp | 6 + .../ReactingCylinder/app/opuTdfunc.cpp | 16 + .../ReactingCylinder/app/opuUbou.cpp | 81 ++ .../ReactingCylinder/app/opuUhat.cpp | 6 + 22 files changed, 2603 insertions(+) create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuApp-33e42e37.o.tmp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuApp-e1c02cfd.o.tmp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuApp.a create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuApp.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuApp_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFlux.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuInitodg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuInitq.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuInitu.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuInitu_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuInitudg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuInitwdg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuOutput.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuSource.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuSourcew.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuStab.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuTdfunc.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuUbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuUhat.cpp diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuApp-33e42e37.o.tmp b/Applications/Hypersonics/ReactingCylinder/app/opuApp-33e42e37.o.tmp new file mode 100644 index 00000000..e69de29b diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuApp-e1c02cfd.o.tmp b/Applications/Hypersonics/ReactingCylinder/app/opuApp-e1c02cfd.o.tmp new file mode 100644 index 00000000..e69de29b diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuApp.a b/Applications/Hypersonics/ReactingCylinder/app/opuApp.a new file mode 100644 index 0000000000000000000000000000000000000000..5489272a56207aa9ccd78b47f027061e09fae0ed GIT binary patch literal 68208 zcmeFa4|tWumH7YOdjq+DfCK^t2u>0La+837Q4^sy_ui*2E&Z;$wcmPg5=bEY4+^Py%lC8M_q|E@ zXSLhi=l6Uc^6)Ze&di;eciuT?&YW{*CjCn#OM+!zc4v$qd)v6Q?!WPO-g(DucieGj z?pfFAG1I46;rFcY4^}v$k5xWlQPJ1O zkDD{2XwD;5OG}o{ojPZF(e$G7@~M;a9$E&XymDdgL**-$E?YA9UNdjyqGkTa=9SM~ zFz10e_dYgtM$z=~SN$7D30;4mtEhSZ^`ahFSiZD!PU)4cGTZT)jfnm7ibj0SUoQKL z>y%&qWpyt9i|dqMe(^e|S1wx;oV)zWzU}_>pZ|-;in^i^U$m$@jNv+?vY>Kd)uSa# zs;15{N3JnQ?+SvQyW}y(?_+akR8H?XvL(Z9x6LUJ&0Sc<=q_1M{>{1Fg~-@9a^zf| z!zjY6hb%^pI~Gg+=KQ1d@IB!Aaa(JN01+O>2@+@K>|2alS zcOU)v(*FG0eE!mI`>VF?w(HZ<7wF(vzvcW@+m`cJYnuo#i?3|kXNxcLO6Je5_;{c1 zXIIS^pZ8~9thQy9%a&RrdwS9J#^GJO%9LeG7cKjYiK2V_(a_IP&=t-6g3^h!$dq%g z{3zEd=(Cz*mGU{7^I4_Lm@{wL!r*_kEmkRiX09^nrZT|-& z%$u=anxXajT}aBS3@s`NE-hNNaC!N{IYmWZxu+`;;H$Jp{(P))*GI}CI!d-A&(an8wZ zpSHfu;o5o6->-UQO=oc7HlBO_KL3>mS8MAl`fF$XmoCl7w>jH*xf$+0u3D$f^-h7! zrw0d@sDh`pPTuS6YVxe2u6L*_-8ox5@GaklR)-^Nl~t#kIuoeVO`XH3(?dBGer^2; zhkIvm{i;`jowFCN;R&wKf2D$Yzhl)~M7?R$`+&_=>oV$gzcZY=1JpgdN8M$b-Q#@X zi4C^0vd*-@#Y!vlcJ6Z&{d-!RKO}w7M!SYJR`d?@y zMwbOW=%WDo_$;~%ShNx7@!e(oT}2lbZ}_6^i1o|oX@~U5wc63MKeT48(#9jaqXJqI zo+0sL4sGXghi#`p>%7bGr+uC2-q}icjnGsX{AH7jWqxza5tk+9*b^5hcOPeM0eR<8 zchEVj=oR{8X7Bp*Q{wCOmCkzI zVPF5T!?E+c!@l$WVOu7*Qzxp?7o0Xu#o{yxZi9Q4lNnX3*t%hX(D4<+)h2c3&}%8X~9w^$Vq)%0fqzR-HN@SS-oz$4|A z5I$wVw$Nt6xAef7sO z?hUnN-xH!Q*Gr$uJ701*-akFDSLkF;Z_?uFUnl+R;x}&k*Hf<_u&=+YKSyaD!iO^G z)3|}YP&VHy%Q;thyjm!3pg%N*_-NvN$Js(McH^A;?)JwGUU&<9ptrO7Zrfn`2wJuc z*7W;t_jR--X?m(nI~(e&&G?va=+bw5`~Gph4jVLhJXzE88FSTrv>EnZKK*10ahG;h zBkpkd^b@JX`;zX_X2kXN=|?k&Gv{f<&ol02EcD_#%*~vuwt46Cgm@OHAM#zKuSQbG zp(G{%$0c-qH!s>sqpq1$Ys{jN&Y;@Ee0X>WT- z=<+QWyuev$JU(l@Jk`$^TElpmJ7l)Hk7w>sEwqjB83VS3j_?ivczQbFT*}b~&oRf# zsH?||-!9{&kZ=DWI*8)B@)#?1?io%P6RFQgM9bG{HH+%m|d zDPvp}*xo;uVPh=WDbK-Jii1{d>pyYy;=4F@%C|nx_lXdf{AR!0WWXAI5aF9d95?NZ zTC~|jKdkDFY(yJd9Z6ZM255^NjBnT3Cl2qlyK0MU1KV882hRcL+Xl7OlTT!{Y|_7N z_tfs<5t*wPex&)BOZa9!i@ysm)DjmOxa!~Kbm}Ybq0I&KL4ZE+LoYVty+zh5W=`1| z(AL-ToIu|5Key_Y^ox;&0iN{E;)Ma8lIN`X#gf6Ie==piNav*)zrS=T`Siq}(Wf^0 z)(*WnLY(P8)pQvHjqhms9Kv3_YaMcpTRZcc zfUWfV?&Rue9#_^z_f6H)+=R!+4z73eEe+hj7%sWqon+w##Bev&yZf8C2Zy<8kB=Qx z?@p+m)`v3s+9!(Y)nwI_0u>OF*Q z6W#S5PxZ8ZuI!B-TlU7bDOyMNFTJ%3PJZj~X6Wk{c#6>UaA>bF#Tj}?>r;Dj;(+=- zgeUT~j?7^6 ztCSrXtLe=Ny&@~V_2txAEqOiFcNbD;+bXNv z1gZO58`>PsEawv|H++S8PUgB+kJfQNzj+Y&_?~|C1}j7}UAh5%<2(lbtc*;9;rxn_fJ&;?>x|~a${5fo zzn8p?@TJo!Ha*={uA;RnWOtRR)=@TnvnxdW=FrJhn|{ExP#wJahm%hg*>t~azKWLG z^wq8fDq3OFqs#sJaOQxzE&;asR%52c2pv;4Zji#OWzHgG$67V!9ZB0-z}JYkyp z@nm_INVZLn+`QX_$J+F?o9j(D!=~5W{E7)D+jQ;b9R@6Xs`%zzCO*lg`)=N8!U;CL z`sRN&VGm^nX@is>4=vIU0?Rxq^IB8w--ZIbZ;78(vhf?CgA($bJuoYj z=q^#?dD`FkdT1J93C|#CH{e~SwhW!EI&yt_yTh+nxgS@v-NKG!`Ld1RUT!O(fC{gTfpW1f4SY5})>XsN0qPpP|9 zC1x#CKN`A7O((v{y-1BG{^OyG)du2=-HX*U;y)R>M78t2(vBtWCCrV>)aIcj>M(hv z&F$G{S_*SmRn|&%KE zsuSA!1+-;@H~v#riF!KgG4(6LZQkXo)d*K8S9Xc|3eRTmHxTibZ|MrdFLa5`{+M zlj@GV*^ITv)GD=Sa{EV`?f^G4FQ{sqkE!9%&N1j~1h^%6b5s+!)zHKVc)(h4Re7cA ze3ecAV}VVdl)Y4)U2fA`yo;5lel+>aN`V*g&NjW7ew;+zFL>st6M2i&A@@=>)ip;I zKx?Os_+phv{Fnh3tEu$wNdum%#sN1^wCSfL?xBx1`SnC+sfyJ2b=w4FbqDlFo=Cf< z|8av~pX!ly0sTc<KT5ub;g3c>_+mO~!ngKOcA|5I>V$u;_f)9F35(T{DSrK@e47`@ zvzj(X;VUydB}V*5^Yc0roy$}c{ACW`F>%5i^;5=?>6$oriW;yCr{#YJvuLFm9dXsevCf!TY}9395g} zhR4VII)?EZCvt-m+W0+dmm1Fs_4l4-e5>W^yPhR#BlP&9XMsA;eDI>DQk{ptzUV1e z=f_GIQs;9dT&T|H+Vmu6l^WO8z^k8>$}gzrWBB26mv4Zh)q>?+>d*O5f~CVBYYll*!c>(h9d%b|}J=vwF^i9Ty# zykB5kMB3q>Zt%5!y;#0KbJSt_xP6k05#o%IRasT)xeh%rEGZSiAg>^(&W>hXWX3d@*a#mX-5ldk5=Y$$s75=r;o~{ zjzV}CX`T6g{Q=Ln)ZpxLwHTTh?=DmQvlpwaS**Y5=Zq}Y!dW8Am#Nv_*~$+eN(c5s z^Ru((8+cih9H8GC;r#*dXHNTczh{ve!8^GapP#xHsWT40z6jhJXzgw0gg9vaIDF+j z#`hX%W)0sU(&mF^%2gb7|A=oVVdSH3T!b+aOMk&_rvGWIPk$SFeTp_T7y9(?(a-lV zHrCL_HGI!CjKctR$vV|8@1Nq=?LwCyvW|qOoGkF`KO&z|7kv8+-$mfo9A8JAaj_U|K-k|#ypWdJMIt8!&34Qah&~=7i zKSzFnTl0M#{iXb%U+*vN`P8Qm$Xl#B;JL3dAN(Y1iHaoq_4DNaE^zAF??rD#=uMq$G8*RImV~tJy+q^?_*4B z-g)XMWAh;4ImYpQ6Xr3m&QsIetIRTInZIwJ&bVc+JLmqEfj=_JuWzCMWsGQqjoE%( z`n)SXR^p4g<2e#v+#S!AcxhKW0Nu+vvypj5^wEu_etovbTodniBabi!8z=G`)}`ru z!*s^X7I>a9Cav%-D;&-^68sj%i-gB#`t|+rBAIWa?iI#wWe!VcoCvP9$b84a8QS_) z_Q7rY25K{&oxh^}y(>$R@3;0?ev7Q6{~tp&s1TWc+t zIjD7=1?K~Auwdqn)|V_89@V~a3Sz63tkSq+k&fr_gFCV zTkC5Uyb|~g3uaDkeba*10w1v8THr$#Jl&>i$kMHc(U0)X(J91{D>Znh2iZ#VGUvl{ zypGcE_w|;kYVyX?C9Rq?4SZxBa_$vrX{7ZbZQm96ec=0nKgJln)^B=|b~Nd0q20*J z)zEJg-jIphzS>!$o@MTT3jY3U#$CfZxSD-&ztPUD+=7a65 zFLv4V#@#l(X%Dhc-dxrE8sS#(8GY9`I{KpTyJ;tDAVdEbaU}0dx8Pqqiq3Fb_1+zh zi@B~iQ-|h{(`LvzyY0nGGi(~Xi#1tYf#ZGY*Dalwl6N>Bz1VYIo{!#bGkOTt?d$cG z53rWMpEdm?*7oPMOeQkV0WK6=VbS}g5 zyV76$LVAS*eco^S;QD%n>}N06E7UoCVQt@V6{*zp{n`U#`k-5IVJrGJYxuuoeZK4C zCl7Dw;|slvUa+}#2tUQGM$a^aPruyfdR-VCq$TO(^dDi4o>!1M?V{RW)jA5TP@sl zt>gLLR=!OZ4xPee*6>rbezm7Jf+IXtNWNZHol@2$t>YEG^<+)jGoZdN;mHE6W3;VL z?RR)rL+^loA*Oc_okHE^o)~eRd>A)1PL2a0K~F@)>ZgrhmsF z^^M-x$2NN7iLqKoWVsejbEYBt(9biqaPzueUHXSU=nzg?I)usS3{K@InmPmY+xOF+ z2We|e|1eo|*SdL*qkDJ|oyzfv3H5FX(K$Sbp5*v)t-~!L`UXS)P^EPk`Ui9lqJJ2| zvxhRT)ID^5mad^oPw-#RHH^Jl*AT7r8EbjXHyb(49*(RFgf;poa=;dj6j|^g;8_;@ z4)9D1e%BU0oy>1sV^!n>Te!|OMn$IB!zHe46`c;gG!V8?R`jqf+*|arK`Z{DE!<1u z6;}KsTR2YQRaU&o7Pd>g(u%j)!Vcn5Sga0K2d{2`KL56AQjkpz3VOGn|c zhr4td@%C^`j}dX$!(Fs22AAZrDqrU6DO$F$qfcMMlt(4*F{HG@V zDfe&{1Rn%{ASFXBb>*O8ph zZo;I1(cX^}0^wI__a~k}_}>XH#0SC`2roJU;lZ99)p5ZezKigW?f&rB2|qpU53eNb zZ1IQxiBNOqpqI%}>9i%Cw(L(yNB@$pQWHn34O#i>JhZdaeLH=YqxKO082Wj_eFy!M zqYg_P8hVU)ka)Yqp`+!**AP$2CY~G!uOPmS_(AVoyzd0wZzAvWC1kcV#=_In${yXe z#Kt$+n3YbQcdLKSPG_xlr}{s{tFm%cC*e?VC0ThYHhz*AKj~g{JK2Ho<9xGoqXOZt z@{JlZ0^ym?4Aqz#2v2v8K;Ih(-|HNy-ty+FCTMpVe6mqs=yr+lUD|vn?;eG2Gl(Bd zxs!EwJ~B@}`jtRJ5a$H+EE;301BNR{TfQgQ^o*(f6ieK58(Ib;FSaT z{W+&?dav2(j>f>va_H9;fG$gfFx z%nu*CGF9`+K=|beBUJMgd-#9TpC6C4hhKebxOx>G@!RxuGjqvzm@{6Uus{tWjO6(A z?>JfOSvr*zL#MJ*y-ND4@JZ3<45AGm)1M!^?ocPHeBlUl$#-07lsQ_x>$+W?&b-6W zza&Uoa|7W7+IR^*)z6c!PG#Q8xEiA_xWBAE$jnvxYyR+_>>O1^yd55R;SGN{3O`C` ze3cNkGpChijY9waW%wr{^I0Rb6fok$vAd5}%h8WYe@FRtP0Uk$=-;)j@k(d@XkxDV zG4U4fc*?j_#Z$&Hc-F)8O-r8OCaCq$#VG2CFvs>MF7S8@_psZH|JcH}&-8^$nMb6q zmgT;1C;c7o`I6DT7W%KoS!(dmAiBeJFE(CyU+Y*|8`2ldl{Ut2gtYoOr(VDR}RC_pN4InQxlOzlQe_eF^%Q29d+!B)>=U zk5DJGCI1*RKl9XC^2@um7WhQp)gZE3yyQ=ivBdkszrRbKhqK13Bh1%F7=zpBx7JC% zj$Y(H!Wi8~{HdPj7}D7*J4Cz<+|w87ep>iH`g9;jH+@GMVj zm5i$u4N>MM(Y+XOEin2Q1FivHWx=a}*IF?1gXm(6Jj_+1b1`7}wCG$6nE6a}E(XlJ zCOQ`bW{wq|ivhz+MCW3_Il$X3I2Rb5i-9i%M(1L{@O{y_7%;qFbS?%A{}-K$0apUQ zX~D~Z(YYA-mB5EAINu)bLqDA~WP9|#A6WQ_%m>Kbr)qt==&HN)FX%gB_M<-VGtu`M zGWODYmuhJ^le_ekO^r-EY?@cnc|D7p5{1bc|j^iWo&}!%UujJ&)mop@~m)G4qP1qZ862YvT+b3_}m{nxj4wT~N&b!tjmQW3P7^ zeh>H_qgOb#$7c9Sd<}Rgj}yJdEc6+}cpgEAA?r!aM!6nM?}Fns{ZVaD?O>i`dwe0G zwaWR+JAcKquwr@V7@pQ7ba&;1ypK)743S@!qjz_P#D-wN1)3hgK4;RO&|QU!px=zq zYl126_q|jz3 zI&tV_E41@6`qMi47TcVD^riblz3?^bjomJ$4;^RFO}8#IF{}8`>O-ToeL_te`i7$D zLD4Vi(J4F`4*b*X>mw7H`(u8PHN0Vp7~xnmyf9o_|E4{;t>oOL8Q0X88h(mjWBh)VaXgdp z{3zr45p<<9(3MVSyia4?Ka8$)Y6v=r`JlacsX%BVfwV;O^oJ$}Kod#)b|7U8qO6-J zGZ~tIE*#gViNfToX`(L9H%9oK@Hq$HNN8j;W4|Yz)S|yL>7-YEKYW!88et5ZK1p$= zPZIjMEzn6cp|?plwf2xfBk0$}hbTr9;v>`@*Xqkj@1~I_x@iQw&_y3;M8dv=G1_oJ z7sd0JH~bsV{EFob**qdcCzKOHA9e|$3+SUE>PZ~anr*?WG;6+yjcw*AFZ2NqkI{zM zd&PEO%w;RJ@V_xXbkjmCzszZ6hR*9j(tTZHKbDR?f^?bdDo8KBDjoX;=`x3%COvXh zI`m|Tz3K}aQ4o#Re z_CTmHSLkQ9(WlT_Lz)FcZw)35T4}^%Y0zCmWLEd@%yn9BgU}!}_qs)UueXje;}-^) zwC6wlS+w_6=wv4J@+frk2=p@p+M5pTO@po;hQ6jkdsFa(?4~`jS;%w3;oG|j`-tp^ za5A5)hfYp9`ecc}+;jNKxzW9U8(%*Uy7gLUq#raRdiCegu_vHYPyAEMZ~71HU)$%s z(Y1+X-iv3-y%%5Ld5>q@eDB3Ygi{6Pai;Sw*jM)BPbqbur0zGVTm0{(?$eIGS`m4>+X z8x%S|t4G?*o@oO^zy4i$=ke*jy_vl8KH$hZntp6MV`#W5W%Y+;oy8LvE1NXE_{+>o zHA6$i0iRx1)4#L$KJXuD`fkV6&N_UUV(S!R4Fca4nI<+Lh;N+81y)#@rK~@-DL^B7`z9(?+UyRyc>Ml75FspF7Va8eW9oDb$_L1YNx}AuLx_7 zUf6$oBR|E<`iFUXbHS33jZkwgQa^G$+!-JgTk^Hm9OIp3UF(ZK>O}A0MQ+(3tuf|QR zo$%*x+^FeWYUG_N!D;#~`sq77JBk02=Om9kaS{3i<_-1}MB)d8y6iv|e4m(qYANz< z%x^WQb^E*)A=6uSprfN08_Y9?PX=wU4Z+U{Uo1a;+gQn-2YfXG;H6zP;AcB$tEMXU zGlCC-cMJ)td%)LV2X0>O)7OAs13qrZ95oXB%g#CKNR1Ew%z5a2%2cl*bJY*Pi%-DO z3VdIXhh;r@5WB#3zIO}x(!Kb_l$vRRKQn0xKC;pd@W`U_8^MnU7ZhAkH}2e8pFR!z z8t}4S7oW$YtlbYHZ`aY+N4(-sfL{UQV4M8*kfgD0-SkK(O4xG1hhM^MLykD}CcaR} z66X%h2xSnSeZ!}ZN3OVs=iF;j5B_3XefZ`S)1Fcu_W4luLCThIW9aJe%W2H;8U8xb zhg%t|LCSAlCw(P(*bl__43cjRq4;J#d**k)X}#^@xj2LN=Acu>HieJ2(U+{R*C6BH zYvB5Ko=z?Zm3!whzA3wAT4xFG(8PK?9be4{>H9*)%~!zvokeRUnIYAfM7npj^3XqN z(6o%-zI+2olRgvw9($tr8Zj0V%)Eh2^c~v!zbPBsdd@|=0?3VS>TGmO3u%NxlYXgV zANEfflOCTgv=!qm8gwmn7-bA?HGFRUnL@uM#{MdiLyv#JUZ0IV{Kx0hh6R2bjK zNuJ{$v1g2SZ-y79W2=?&qw$pGrET;}>!?RE&2fZp=UwwvBRUX+?)YsQ`*<|!Yn|sz zsr#L`^Xu_i|9sofip{^ez6^Hhfb)y$6uy|h2l|8S$suipSIZ$6*iUkq9J0}pLtZlF zkUIQ9Oj)GAA&ZFY9VyUsLncA)5SipMS)@{Ak$%^ZMfzkOuhsTmE{}Ljd1R&~k4#4% zskl-eab>n4qg*bJID5z={k!B5ncKQ#lhhtEMNhe-r_Ay>Wst5i9n7zrw7nvW3_%uo z#4)6BhaFi2nIdzQDT^R`G}POXMb?>fHS$Np@!GC=8-2YN?jd6|;CmYGAy+ii)eLBe z$rZ>b4Rr^ITe5@^cM$KEH5wwRw(#+8`Jy3`LcCkPXow^ex8w`?eI$u^w~WycNg!^? z7)JUi;@xrvb|K=(7$R30>G8y;m~mvHhU0}j($=PqIX@x=|jy$ndKt zkD+I6^M&2C#n&UBS&po8L+a#9nl5Wy{ERJ~ZFhaKcA9!y_$&EZbB2uROTFuO7V(@x zZYW1yXv-ctrjYr18n`6tJ2$0Y$k>PUuI6O!??1pGQ6_Fy$jdhwzaWj>$+8w_%@-Zq>q1xkjsW>>Q2p$zx{Y zr{l*?-WWf4jLnOG0sbDE*Q**Y_`>!f=%1mHEd}N~2biD4*Q1f~vW4&Qkidk65+cV) z`d0)-MiKY{fssoDeh}E6I1b*Aej7T}hNOw_f45J}9JgNx-hX1-~S}6PwQ)K0}Xg$W-JFkXPO>NV?c* zo8I(=gM3#*wjw=9x?>3bDx}vqGgR{dUw94ahKxn}8q(v2j6lvBt6p}FP)9a>)zFC; zvKHyvNbfadBzs)PB5#dUNB8)`2c2X2=A)5Oa?~N`DB63AI=b7$3+~LJuZ?+6Y)69M z)s252J8w{M+q-e+KJbNqgDrgxc#U$!C*tUbzHo2nEy!AF$XerQ!+4(Cc=&CqpZc+J zda%bzn1X$h_dXNv58K^@$=K_#ubw+pG$w=aY?2>a-3a8Z5!mJZ;c4zP)&8k3TugWn z8{0w37aQF{%9n2{_O*2H2(^ViYD(dodzt&`2kGOj&`glJnm_V|@1d{KXk-QA+l7XIkVZMqH7`y3#Y=ma#PJO!{x-kgRx_=^=<8Ab@S41l$YJ2%$@1M!B?m%5 z=%<|W(!p;%Fs-44_iW0*p9y>3gVZZJtRQ2tf;?X#Z8h<9;$w&lk1NR>W9TAda+i!L z4}IG$r;SEV8)Ni$x-*mU{3Y5(8Pwm1%w@=({3eh&+OYq{WHyH(vq9hF^T8LyHx2*) zaAOnxp0rh?Em^e14=qWZ+P-w;xHOeU{w{e)@U+qV*0h1NE9E(n*@Vv1?t+fBXQw@T zV29x+q1$~w*DDUo_=}d|I&f5@^2Uq{g zXUK!-xxb+QF#7O#^x;Y9>jt8?8-zamCiLOS=<^1n*BgR6mwtxCzd=|FM6q6=%tX!487D8!en#{g~)e7AAY#(Kc3D$C*rX*eUqky)y4#eDidV&0W~GH7@hGA@8|8tr^^+TkMmu#X{|+@J8vp#z_Ap$i&V_$Bl{_y_EL_DN?-ro-vk zjUMDV!d-;N@_l=ANk3+HdUi;BqHpg+;^n0Ov&3_KdvhdC`eupeAg4%vbWWKzr)P`c z##*>NCaw-##N!Gb8)e~N)AoAFTlc%N&M3+X{1Wy)%X)yaJJSBMjQu0%2-q88j%8C` zh|p&-d8MZj0YgeRcQU+<&SKzC`_W|F=9DKd< zr_zE>rG@nOiO2l)kFw5gOz0bGPVN^<&zq+rE76;yn}`-*pTb7fQ^z8Dmx$Pz;4^hK z(>tTAokiDzf5zSy`NnrS1|o;vg^p%Mr{JG8;@-}>8Z+K%mvrLniGIrN?9v z{0JDc=5M-id#-_dtp~2ur(;vu>t!5CU9A}=94YeYMjZJ&m381g&W{ov(34)KaxTF2 zZDZenZf8NiUx$vr20ecj{rpVy^N&L3k3jD;(9cgtKOf(18~cLx;v?99ueUxdRG0IB zox%flUxx=^Q`CBO+s=eP3Lhxz;sYMf0{FlQ_`r8;9+MC3>6KXqALwKA6rO+&v>ANB zWAK6F@PYgP3?C34b_`x6wqduy58Pe+V3@%Vh7}5Z8~gzMx9|h#wL$3p6~dnU0RGS* z{2)gE@P`KB2eZK|>cmSZCtk8-|Uoiyxpn7k;q$cV!Jx>}>`= zD0QZk{0H%uv~U9RQMbJdzTkx?AiH154-DBE``atbPjy}Pu~>fA5zx5!k6&(Ii>1r@ zhP^_hJ7s>m>i6hBNtgA}<@UYU?^(Z)E^Ua}-?mUrkS9*c;~lQFzqK+R67The2EbQr z?yK!^iSETJW`~>fnKn4iZ-I|=@B5kG#YaS67xlO~gU4gq;DYdwDLmM;4Lf%aU9H%@ zV|*k6y~g;6yp!;fe`0*xnuX`TjFN{2yK7Ib)jIlOS2gxS)v$*NpPc>dV@hz1-FTYw zMy6=C+S4nwj@=Tn$0xx-NPj1|#%(;!9-jyC&5?aV39j)QPghEQckSs4$oBB%B6VRoch{ui%Xoz70GS3h*VVCS1vhbP6REAt*#p~8qh0L>w%31fY zzk4wIY1b_c1%LyvP zrwYtEP4FoKv*r^xSzyue04L!~$NJbOdU^-2ll{tqPXPW%_G=d_V_(!^&Qbu5vd_=h z7xjS|ckpieSSLo-4i24SA11!q#&2x$&gjx3m#{fv`;vYAkvIH$Z^}5jN7H*t`fIYE z8X0r9rpHTskL=&ZPop+Dlqm7tetjVE{sQk}&o%J5!#9NnNPH{%podDIQ!aZ;w~=<_ z15JO9u#D%|^z&%KU-6vcNpKgdY#twv>-Ph52gN zxiDup&NR-25nGg;4by!t%%ffB!pQfR^HgSYF3czFp>4-zQssWkI2UFhX+iH&RWmfm zSul@TXTvO2Yd9MwiTE71oDH*7J#Cx~^O$uu%u@9XXTxkD-8>g&sangqFw=>bGEXOF zEmbdYF3e%#=D9FS)q2i_X(zszIei-G-{oAGD&ppuFiX|yp(QGXwzTu!(zX)hfp+XO z0?U~U?H_$3ByeIDaFdB2FEF+k!A}F$oR6`F=evFIH`tdRQ|I6PTjMt`lKv{sCp^ib z`}HnoztM8_BG0Ql|IQQOcNZAP5x)Bh>T6;gSE1AV2j0DjF}&2dRQ)e6XKifv>vNsU z&>uafni#{&s3#_e-Gsg*8NApJpUiqpCGp$m2&?dA-3k6>;JNH~kZ&scn)ZWYaTf*C&kg&7LatN@{qr&UkKO zPqds9k)1c2JwR2elkxr*`~61~w-F!C+V56@>7M}b1mOK{&i0UfP|(&>@Q)GTn%~v* z%~_8toqdSu=#Y=H=UVKvN8YgMn$#M-FJ5sW?|X#cyxt%%-!uZF)ZVOYdma&ra;?Taveg$D$%L!Maa*Pp@P`YrElb(A(WAM)#K zovd$(N8Io}_M``0D^!rYYoUoIbdaas@$0glJ^*~S#;*@|vxo42A75(pli-?i8LNy} z2R7TI6aD%D@Utn;UNNy#_~l^6=mE-<{q^i8(PvY3W3EmAp&MF9chy<}U&|{~k&kTp zR?7YX<9;^nZ#<;Ymbq#l=P$?^H`1nOT;DR=_ql zgJ56Y#5qgN*>kYf&r@%E=P0p%H#2{Tow_;SuOES?UgqqdqXmBbZSXa`M{B(7F`3vI zbg{1jU0RT}elxVNhBJI5eS~Y7N+qxGd8uYN;B$wLPfHR)yw3shCZau z2;ZbwXl0ULZ-#bj=%eOBLi$MX;`gXgXR+&>>Km#5YjOegHsL3(Nj~UN>Xx$Zk-Fi3 zQvSVC?+2V4aKNXpV$5Hf$XNx@-1q6LKV+{m>R;o1l0A9F#yg8mzIh7o48M?fzA&A( zP?nV2D!K~lKLQ{A3A7nq{j~axiE4)b#p-{VZ>adqKI-4*q<-ejCu!>+q;B}Y zChGoE_LJAHdnR?mpNzVTden`tr_|kxbCop4Vjc6}C!;t&1={!nb-m5FkE6YjSuLHNc!&k?k6edNyXa8sH^3I4_;HM7`Y-%W&cgXm z4|OvK{f_WM&r0=s&guC-9>!#goOweUbJ#}`;sfvw;Xe3iWI1w`(AS$b{ri5xRes&+ zd{Wi(jh%OutCn`3ephy>aW2nYo^mxL^KtfA`ZyO0UlaTmTD*^|dD-wQVBtqm8QY`< ziHmQ`=4^aPfcx-G#h+v=bJsll9Jafbs&l!1{UW^UAajAt-Mz^#{9>S!eam@E)v*M> zehc&~=ir?G)CZoqK5L%(G?jC4PW$wwoZ}?%&J@x&`Z=%3OxKf%Z{nOAE8dz!oUuHR zIwk*k4|$n?Uvw{EPc(Kf==>n#?^SrotKeRDFH(c~CN|zf_{TxM-;qN;{XdX11(z3) zGmTcL*P+8duJ!9*b2WeD$6pB=hK5=Q4I3!Dr2rn(yqj}v zz|Cgd4`si)_BHe=Cq&1RAYp;8!zE#%PtF-BOAL-F`{BA5dar!cv4~!1R zfF}XxTksU%Nfta4xYUAY0WY`UQs5~TTnoJ2f>#2wUNy?B0nWDI1I$yb3tC@-uR6;N z|0wY%C}unra<-4LZ{;KUindBVb59rkk)-z#es~2w0zLtJ_xU}d=Mz6mIoqc~9b^1o zE6qt-%;&NRT9NU8;;;=Kyg;4)z=q6OiSOk?d@sdsk~!{>UpIU(fX}?+*F7@-h>d_T z{n>t)_)wwSlYL&MA0~QC;KD~}EUe5J#4EUmU zxoe)=^WS!^&kbGH4PDj^UDgd<)~Fl0tUau==OSkvL>F>HmvuvzbwihRLzi_!mvuvz zbwihRLzi_!mvuvzbwihhUh9S~>xM4t|F36M*Ytfql9E{8gm2UJe6tECo4#3cb^`kq ze{)REFTxi~&ZlzF0H0j#oXt zjylmnv)?e`#J3LnId395UF+CPXp|f8s*l$AI}Q4+7k-=GgZSp9m9*?2#BTle&;_e%JN zt=@UY^t1BfV`bbuh0j;(?l{s3@sXNHy|Tw`2X;&R?>k=4@O2Eqzv>%WO0C!j2HH|; zbAgYedv9}SdXbHLr@DNp9`Evj+QQvaoAI$WeW?a@n)gl(zOFBol%Zk&FnqESdiZ2< z|I}v3G^-rBd&=BTUxSVE#I9lHp8149p(uN-H2g6|pKrrgJ&t>tTJdEt{E*@Y;)jIY zA7A*^nds6nIx+zqPP3v9YES^l@WB4&mCM@9*TY=omBlZa=>3#5dk-J8!#jgr~fvz)~ z@e_*ew~ydc(d8S2??IQ(5dIZid-d^o=-O|F4PShW#P%;XfPT{MeBKdQd?q3V7W`(n z?^2hak>`U4BL_Dbu^}pDLKveg9P9!(Dzx0q+9!6#LcBJGeXL4e`raYWNrh z!Pl_ozx_267sQUX2HYC<`&VHfti>0_^fOwZo@TFqJ2+D}gROALJp78VUt%+qJ5tsT zDOK%z%yLX$qXp`PA&a=TYN_RGv_P#Ng0B(pEA^ZHMhnz;hj0%S?=3jf=V*ai&AA0h z{I1*AXsH^)IIqHI<@^WV2zA{97z@8}gen}t8-CfeJ?0?gxKijcwoBjB>YG=%w{Rhl=H~qAL z8SiGF0W;R6ugv|e#2NF&*zW__l#RPX@Zpj36`HWWN?*qIhZfULxx?(-EWchrd(ISL zuP01{Ztmgt8qe7r>^|J3^05bhhrDIRUQ@Z(M9z2+U!4)ySEY{g8Q5Qw@L#|VeIb{; zy!U;yNzPx8^BRKq7Gz+1nn#;HNnu>)J!aH%5S!@_ptG2NK|D75gV^%dV0XR`-<;lz zr!Ca;7B<}WQGTPJe!$p}J6S(Y_3J+%UCKY2VBWEEF4??)Mf_UCPMKOh;o_zF6E2GX ziooJiVubKWBTSaFP$zW0O_|c>-q^SI)8^G)d@kvqV%k?ne`vHxzH1$Ql1^UPiznkz zaM5ghCnsR<9oud1Jr1vFO%Z$LgwEC^v#zhpJt&T$ZToK0X8h~?Z+1Rk@y*Uw>|6=u zgxC!=Lg9g8uQXt>R~A^X*dh&kFL{c9b1Xdk$+YW&j|VpFo0K=vN?)5AGHsjS3S&4G zGHt~CCW+q|He%o$;0i0xOyHmePX}f$(H>$hg!hTfvg9UgtI60{hZ2q@y;SU;-!x^> zN(;tzYo0j@UTmy}Efv@Uywb{(0&Lh}!6yJuvGCczt1LJJnEA^nAD#GW`YxIZe>Uu< zvLB+{u$#vG`}#75{P3KW=aRe`;?-LErbAQm((Zq3s{9 zy|bk6lj^@M`xE58SVHr@*a7vm$i{B&gOT$PYmto& z88@eYeIjrh=dH>8CH;|aU*HaxM8Y$Z66;?;W`2bodseiO9y9 z_>DmKiR^DUQ`7@DOVj%!LnjWpl{UHSoh7$!Y(*a5!Ealq$i4$YWbXSptByUc;0Y%Q zo-j%9eQI0TyRbt-WOb*5(Ad9#+>Ok>L*#GdbEkul{R{Vtylw1PAY{LSlYJK=f8S0& z#P&5zF!nVJtZmJf-xH2vU&D4E`x=0e&7BTHht{!z{S5oMWbhuc^OgG<3|hVZeg-Kc zCWAL7JlZA8H^$%eirmdAvU~&{5ZkvPGIt-5xvhN*PLVxhFg)zqdm1=v%h=OU)?-gY znYE{(tjC@P&VoW--p0A22l-})dhBPAxmA2b-eOJ<5FS7#2oj2)=^Dak{P^BZw}+1) zU&uZ&*&BtQQ8-OP?hEiq$lVLY5^`@qwS?RoP$%IY?m1Z=2y4zX{33x@T5u8YDhmz* z*H~~VXX_W*!^NCY5vc^f*1}J*hvocbqnw$*6@jpE$4rGS954M;YQ?K;#+@-;cg`%g z?wBdE(pOn`(9E*pHRc^PQRJ3=_=oo4ER06(9C%93!QdVWJMYlALGHLQ@0DrY$om4z zUci&NffHTe{ftF;>ko#$hEm)I&m`=Y~aXAa1u4mdz?zFMu##z*y#a}IFWxPvW z!?u|FCU$cNhILmiKF{4}Xl$q7V|yRAl0SC-*e1%f)-c?^89q7P-~F3f+8sMzW34UB z8m_zSmGrr_uY&u2ufB_>$ix|U(F9G{xQnLLgpIpsDoxn9i>AVajk{>7OxU=KX1NI) zchRge;qmxZMr%wsb{EaGtkJALuDFM0!(QNmdchPM1n|IM{@|$U(2`a_-3LtO?vnGeP~9=VP9mvM1on$=xB)WV$n#bprP_ zK$BJOT-G4Bs|(QNi@rX}+#O=xMU%`K9b>$?$lN(%Xur! z1rm->i{w6E_|{M__jh>iQlCOoo4Ff6?tRQYZp`9N0{Y%B_tBKv!vW4(5xquBg+2UL&S1G1w1*q{ zo!pJ{vMWzb;&*Qm{{(t}oA@;1TZn%QZ)zs~72?B&+n{Wn704bJDin{)HIj|Uk$ z;>ki^k*0Rg|8mYw8KFIMICqDep_4R;JDsE0lW?0#&CCZLZH3up$h|a9#+BF2IXjH; z<|=r%Yb56!N|>RV;oWiE>(UI*j&qGu&G4=`*C_n{CAXT=3bJ+jHlwPG;}AURr^L;IB`ObYKNW{WsPIsPdfB4PF>7q{L!!NDcn0_ zjlbwe{;=GuVVjVy&a`ot2zV(|tC-mE5%pE)aW@ioR|sxD^}J1bHSpW=Ud!#_d$WMe& z$)KKnlo5s2WA&u>c&8EaPOI$UId^fE67+o(x__H@G5ha|cRI~G!HF6>JG~h9+bDM~bIVBYNZET4-VaS2P3GQ*yj#$3j6z0$57GZervx~+ zX*}(?MIB}Sl)2~A3~+f9)ot!<^~hW1-9NeDTY>+1LYcY)KD(OdS>%wI-bT)ibfTku zm2~F;e#8E%ZRFXOg&YTu6dgz}-X#j%kEH%BwC_klApG=%k?P|l?untTa({}nd$wm3 zeMG;(D+kfGN8nM7@c6)l;p!)}VGaFbp667qzU$?zPwJTiewurZx;IuIdL60nh%a4z zI*Pl+JR?;U{{O$}$7vJpfd6nlRi!^X$UBO*W-(8JLrzG77ORLa$$}TI;>;>&E0K7j z#E};qjL)Dmi}`CDdt{MiyqwWQT<%k9K~^~69>rO0+3F?27UtJ;g!0=&_~fE&?r>rb zndb3wPxo!=(jGYzD_{NTHQK@)d=6Ti3Qg;85ML?ryN!6~o5Z1?bIvar@lOvBXPlpd zM@arZ9wIM%Uf`B@A} z-l3f_RYkh&i%crut~Y_5RcZr$_VHNr8*Ss>tLRpLxP7BPoWmR?eI<9vMYn^4*Tish zv*_<#;NT6H;gC(*q2tSNAAp12F2gau1{u#s8Fz9vS&+G8YZmk!3;Z=tV@Jka7T%((&=AfpN2X=FUfnR|Y8G_xhllQS-E zHE_n6TdYkqaM7GVxN%(|?1u+6<`U9AkvTLkxU#~QrnJwn}QSBg$j_G`$R>+*XQJnXx@5a#qY~=KE9B*~VNPB0SDm zlXf1fG4DJ|05;agd3|TXv&->_x&M>A2y`eL_p)-u$&>7y)8Q#ztHbe{1ca>WDt{XZ-QwMlMXLv(r zsBs<{erk39FX#+w-1r&xudn9}W$~l9@~%_Q*Sq)WSa*y4CL15a1wYTM4gE3`e>PXv zWW&eM!yc2w`Ye12`{7@BE53QB*#Gl9{)OxCksF5}p@CZo4&OopUT*HkG2kk#LwpLK z$IsA+SCWQrp#ihE$2!;8^d-#D^yl$4G}7=HoSfLF_7wht&*NKY;P4ad7lUVk$KSAU zAbW6TvKNPTwXvT^?tuOd-*7Vif2Z&lycPe)Q}_w~khpOtdaBm(6?_IyOmxwF!<*t;``cw0PYb+T`#y31$qFWd)lKJj*igj=6dh~oxrBZPFcx#1__^hnIKz)F*Mto}x`{n>V)-U)_|X-Z zu;E8H$%G9*xoo$s^9bG0ws&G^l2$hupdzu*rqb>EI3LJmH3cdL&t z`NPZHci;z+qYe}QM-;ZnoL0l3K@UWCuVc-q(A;twyzZ$*<; zkJ86)Ku>vh81-u4WS`PO=iDxTm!A8S&K>fH?|aL0U3$~s`*|0`=g4dBSJG&w>{p8UCak7y;wPNWZ^YloPa9)t(Rbj*_zyL{>%ZEc zAyxdHCNzj&gS6-C_%#^&mxgfmUN&hDVULI3?wkM32C=)l$_cT#J0-+-f&DtBe}Q3p z2gZ&s{tIqN$JV|8Ut%NAr{D{%{P0iHe}Vklfekx6@K)eiR-R43hA#v7jle+*{}QmV zMghMYxWdAVFGGz5w*yyN@M&APAKygg2lg|Cqp#V*>}Lu`-z86#m8S`KxdpcXueIPd zV8bVZx^@8@J`uog02}@VzC`(4D= zk6(cJ6U6p4^)q}3u<JyRgPq24L5-zsnaY=#%QHJyOMHH2r)}_(|6AMH0L67(cl^D_%EA_skRsPqAr6ie2PGi0d`PI( zwb2JQim;6>lHx?`WyP+~%~U zCPAJ}XEUYl#w9J1$rN`;yUkFm|Fh>jgb)bpBRkst-TyoHo_p@S=e^x0E-bF!U%S&l z`Av|1PxXD+-$!{n%0EI`Uyr{X4{p2*`>pg_KR7mXvD}95pP~I6hcF%*1HQNIHTwP% zYg^F^^t~x75c>*zhEGB4DSFnQ(|yHCjAa$>1#;S2Us#RL>t%Rm{y6jG8q`nL)|`A4 z&%4{&UeL9qlRNRW;4^zMo<-H}nOE`LkLTSr?imZ7Z@b+y8pd-B&(GkQg!snse8s&n z{tTXfA@SM~ul~`+a;wDq!7`3_T;e^6cpdoNtvdO>mlVXg0`Vr}J6f{ww+K>j@9_|x zKSzwKa8L0Fp5H?Jsb;+RTLEUgUq|c~Z5d)-cJda){h-ADE5v;U&ni4OAogD)_V3`i zT*mMt#D5&myYaNtY{b|$&YZyW;G8l1=>IO3(|7fl`Q(#)3eCxjR-yGrx(hlAaW^)TnZwWg2<&Haw&*h3L=++$fY21 zDTrJOBA14cOGC(|M7(A$j!2YQ7$d?{GkQs^m45{S@S)1J_+AL{q*uregWS% zcSyf=PZqwH?v#G(ioXKy#rM)pp-k7HH7kFz-jQ5XTa~)K)|IxS_F&P@+DA)@YWF5z zx(01Wd+SmCle)fUg&w_&uSfWfx4SgfbX__&N7HrbIF7w4#|*Tg>(sC2X!Cldz4!Cn&`_qle|n@^F!Q#ZvP#hQ`bJ`P3D-hG3IQHIU8fn#+b7)=Gk*) z-kABkxfEC8{FyW6#QAd^=gOQh2kCs8Gv?XzYR;H1onLc&(|I;$%)$9%UTE#-9(&@* z@q@;z8AbT4bf#;4?T%-Me^Q%ckK8}_@-L6T|Tc3a7_#}?s&-&4~w6bT`eddYC{iZ)~!FaCMpBdkL z|E4zW^W(o+_Ql3y`oCU#eS@pf;jM4X+^Fqx)it?x*1HZIXxiaua&4;C+;vV@OU8XF zBPZjYdooyU%V=^x>B&r{FRqcf>(LnP!o;tFGo#tJ{o+d3?7O{7VeX;(# zlenROk@gvutK0j;-o8lttYvJdT*TfX_6m$MDM=G=T$x_SZ{czU#*wu8O8YkaXDU6? zsXg9=SY3Lpz!%!lqXNGe{^{FuUy2Q{s`Lx zfS#&d5r0tZBWoA-@88eu7qgc)v%Pnb_~Xy8Jpe4!f47hA`Rf+$f28Z`cI_R z7Mh>5zh!$FkNk@9SN|Q`OBS&Y{5{(j%b&p|>_bb~gG<;$OW4Cp*oVbF&BM52{K4#|6851b?7=1Mp(X6$CG5jX*hiMIuS5QPL({TTL0qG=lfl)RR%&4?4O|61 zGnk-?gDat@nQ988b`u~{v~--QV&DqsF{X-wIE6|hOw|QGuW6o6rmY=31wZBBQLqHW zH7UFN4NW@<<_MF8zjm^lKU}Ev0d$ngl!GCnk&t!@@yfpRh;R zDQp+E2uohqw08JQ1ASn_YnoP!{ya=o4eo+=GSxPm$IoNDg-qK_AJ2Onr1_fyY2GK9 zY67HrA7`oF=-}74`@-do*n){BK~YiEnG#4(M^Fih>>RHzEuQ2ZRA(m(VY46E+B) zLhnnOb`1WU;Im)_cmgZ|6YBxedaV01P1}w*QkhBvi=by-Oi(3*G!GW0ZMciqBMkb{ zJ_yo!3^COpNb51cRQ({WM;}x5g4C`Dr1j`#sxFY$qm!vRKw1w!QE|>JAM#75m}>Crnsy)b08{mXv>x3;zpzc{5mpMz zg(bpm!W>}{7J=3y2c-4bfEQYibs(+B_;Fs37%JgrsC0~}M!;>*!%P*yqR~8zGHo4T z9ol=q2Cx+LfYW%trR&ucNb@}b(mIVZRScwc8e^&`Nb3|~s!@>I4TH2!VWtX!v`#^$ z8UksZ2ARqWQhW_en-ipU$_HtkGC?|T_Ce4(Z4;&osS+I@dz#ttl&1YL{QH?If)7}K z1U<@BBOuie2?vFJ!fs)Q&?oc?tA+c7olo+5RDzhw?196YwiW&LGgSaAgzjOgu4W!@ zC(~92(!7^~G=IB5n)f26+6L0R7cx~oNb{b*R_f)1D z^>Q2|Oj`(~dG7!*rP)4^<~`WN^A!;Kg$=?IVTxPRw!nWfQxzW6w9U}@OqB!Dyl)Vu z2~&icaQXn(n-Go(M}=Wwp^MLtOpwlxbnpb23ex!zbMktOS7}-S;)pR-6wHT?FjaUz z&qIi5YX@mPd?3wh3rOqXWvT{{*2BY8)gY~hlc_2}YF7c$dXzI&8A$6<%2XvFt;a5= zvVe3RXiVF*gV!Sj(s~Snv>sEHJU3BWsiq#_xF(slevsnw$nk19o(7)8 z@$O=N|H=~f?PBd0=I>ygDNGlp3N1qCb{=ObNb|l6q;ZuOaX(o?i*WpYKHe+baG$1q z0prMEsx6Xo%vAIyoC!UHH$hNMgP((*VyX%79_VqV8UsHI9c8Lfa0B!R zQ-#61p+ihH1bzm3kg1~EB;S~}9+2jBpB%4{<7ptx>j2)2i2H=}=0th|Z%V{C-W-UN z!k92392ORV$5Af}qD1yyKoV_3*+cyDnFP3-Of~P;HRNm zn5qH16WYU6PViIEl}uFurbCxARVnyM=n|$X0@p)tW2$`c5216IDichD-oR94`8=*NFiSY|}2{#C*ad9DgFL(#~3oum=_y^G4OcljR z{yeU~5vHvNOsuOMuaM)@IQgmn36T0P0m*-kFil7o2|6CdNlI)7Z%2PVrfLD#L3^1h zjFXr84>4_ikos>2{a_oo8ueS4$_uW7ZeS`8xDvXWshl9S+XtrLcm-3HgDarRn5q=K z4Z4J>l0k~Y!nDP|!0$uD;8FMsf;8^%=XqQKVT-Urm?5l2(tQH{olKR9BwGu;fvM8K z4){wEQWBD$Lh=#Eg;C*%FeDrl_6dDRQaV4%K_6IwBwd64%9*MZOoh&3s!1g2^BC_0 z)7B5ty!U}Le*uu@y@#o~L7Mk2rs@P~-aDAe4^lfHn1bVNOw|I?ynC6d0lW>`!&F%y z#gWOhrGuy7XA&pPQ7{I!f$PANU>qk8F(wQPdxcpT+NweFyAPyz%fM&A z5|HLMhM*0!A7iQ%klH6RZ7~eu8>lx3((wVNEe$+@<0&BdrNNTlX#`8hC&A~y7)bpD zL25t5v}K^aPE#bLdZa_bfY2wb6c!0HgqkphNlCO9282FgrLahtA=HF1Ok$$FFd*~^ zD}_bE4522BVGYSSc(LW(YN542=`*g#n>YSSc(LW(YN5Oq2G)fY2wb6c!0H zgaEm?#ga6za&YC)N=wqvir|XS3QLlIRmZB%RhFdKn(;LgYYby-b!_!=qi=2h+T})I zZ7*KC*Y>QnBz4~2b$j>ih7rAE><--+y(4;uf!7FL`!f17P)?7eTaxg+DMhkVLzc5m0;B^GA<2xpH z7)I}XefL?C+AI7O9Tm%sXvG*_M=K(D9j+L`YrJ9xuTvG%c%7)2tgs}79uGf0{J3HG zzS{m(-I)H0@2du0<6p5PMV}aZBKCwODPoV>$Lxj?aP&HKquUX17f9_l)z8|{ZW4;gs%qa3ekM>$?IQ==P`HSrn)uTv<;Y9>*R)r_MYsfnQ+ zsfnUIToXZgxMl?9V9hYf!I}`t12sXE2WkdU?yVU>xwodT1~ImbwZvKw$&u)hu_K7F zt+!1#y4nJ5241^S_P2GR>~HHpd8XBm@=U7_<*C-0Rs*lot-3MZI)(Ch>jcWt)^U`h ztz#&Uv_?@LX&ps5)H;H4s5Ol8U~35F!PcQxtVoAG*`ZH$=$53(Q~J~?efpG+zEA7j zr*-sxT1OH6pVm80qsnxb9`Dj;x~TY~9)D4vc@fs0m-N6(sNMOJjw0sqCB5qVSSVs4(r3j>98IrPKNa<;&@n}2%~A}Z9V+9KKwSk;Vb$GhO*&-9_6p~=X3ee}E@IS(&^3wrMbu=|4EL+reucM(Gu^e}Pgf*vFeT+jzE zplRm^de;Yf_XqIS{~LYaH(<|i^Z?QSTfO7A=za7<9YvfmAL@}0(PZi)eflFk{t>){ zFY3b=!Qe$bL>#=R4-v;N>J!AVi+YS0xu{1kqUq={BXZ1$9y4&>K5O6)_aWb&HAaY2 zr;X{;;J`^^@T6f$3ilbqea1+ifw7!5dd`BKXN@kR|E$qL96D z&Il1F&lyw1@pHxmaqOHCJBOx2?;62(jnKRBHW@LdA_j6fLPdCw7!$;v_l&@MVEmWH z%rDWT^Sse@-snD0-p(5n#If^6j2Jm@M2YPe4F3gi=Dgt}PM6OkA^u~c4bc;#&)~xx z^)V&-74iRH;_m?2;s1A{u{SNDE&ssr{0Tk}k$sKmJH?(ZI!W|rMe7n@T>A4$JX(BdP4Le(Nm)TMRZ(rnP^S&Yf9ot z7Tqa2Rdht^r-^=0bcX2vkouXTpA(%U`lnLAQ1pGGi$uRC^-Dw_6=7|hMTk1xCWT}NzUT)^J?9vnfoXH5ub-i2e$F~dL~idrstZ-3$mS}T-&cnDbB)hpEp;Y{t`wu#$KXbpu zw9KEmzv7J4H}^vXq>e@;=Nf1hUVXKIl7HTN%_5WBhG=)0ypkNv-n{E($i9C(oL@7Rdf@6FSG9GhGJ z*YoU_dHS7s^>@tE_ruv-e<|}c!oSRZbe{hs^Xi|Pr$3xGzUSuIFU+&Ud|7{*z1CG* z)o?_!+rRSgp2CNky$-LtzRsFoj*Wt~_0A)8j#_tB(|o>$vt9%CEgi8Jc+Po0`0hm^M2` z?rQYf8@+X!-QjiM)oyR{I;sxYtEvy#4>;T&RJPj>G}l$x?VGSZ1;y@zuDUI<19bPp zd+m8B6AQLCHad>%c9y#9ti`2ndgkCMqBtQ@ZS!7lquc4)&DNY^dQiD|XKrzsbAESw zxIb&bydA0^x5MHpPqBycBe$TgzRu~crJSj+b9k^>b!UBD)0Z8MO=Zr#cDFlGDR-$F zd3jg3u{+%d4m6Wj-atFYUE!6LU3K1Sho`~qn%nIH^_=B)=a;Y&Ue_gm)~!_t+0}R$ z=f`1JdHr6~JRAS!D>_WnnH^u>gtaW6f`Ba8;p~l1C1^8Xqf1XM1z)bN`V;YfgPb^WOUA#wyp7yAKo}E-Sb1 zwO;Wr2gyDAD7&+X z4e!QWZNZd(X@7n5;~Y=58PC5iP#n$;&sJ#^SpVQTNa8@*}i%$M^c(dM=*b>*OYR6UH9A-nCEi9e2iOm1Kc*Vz#{U2kAuQApyQLIZZ&NX^{ z;P>J+F#|U>Ryq@R*SWn{ykYT&i>sZ$)a+~X*W>EV5^uEB?n&pt>ulM4-7V{{wdJL` znK$KEAEeprYxA?}>dh{jn``QDwk6HY^|hqAxyF{4-^SlNtoALY2?aLE5vzT(X_A7~USJ+Ufh)@qt3BT| zp}-~-ytNH^e0-~23R}#=X0uQr1#6yJ$dy8#)vRL{@^Z{0i30rRn*OD*#V&=-W}!d| z@Xsb|t`y*3Dw_rPmm`S+{98@`QrKdb!e+BjAO-7eA>TCRnI^N4n`<613y47+ngzrl zM-l~|OdLTlIc6|Y*kYH$X0uQr1q8z;Yrbj9Gmn@B1S56K0)i2TW&y#-5wl>Wf;|2o DW#?=M literal 0 HcmV?d00001 diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuApp.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuApp.cpp new file mode 100644 index 00000000..b7986bec --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuApp.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup, enzyme_dupnoneed; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dupnoneed, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuApp_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuApp_MPP.cpp new file mode 100644 index 00000000..730e9a6e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuApp_MPP.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dup, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne, mix); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield.cpp new file mode 100644 index 00000000..d6144220 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield.cpp @@ -0,0 +1,200 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + // std::cout << "IN AVFIELD" << std::endl; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = uinf2*2.0; + T t8 = uinf2+1.0; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param15; + T t13 = param17*1.0E+12; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t11 = t7-2.0; + T t12 = 1.0/t8; + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t39 = t2*1.0E+24; + T t40 = t3*1.0E+24; + T t41 = t4*1.0E+24; + T t42 = t5*1.0E+24; + T t43 = t6*1.0E+24; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t54 = t9*t14*t49; + T t55 = t9*t15*t50; + T t56 = t9*t16*t51; + T t57 = t9*t17*t52; + T t58 = t9*t18*t53; + T t59 = t29+t54; + T t60 = t30+t55; + T t61 = t31+t56; + T t62 = t32+t57; + T t63 = t33+t58; + T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t64 = t59*udg9; + T t65 = t60*udg10; + T t66 = t61*udg11; + T t67 = t59*udg17; + T t68 = t62*udg12; + T t69 = t60*udg18; + T t70 = t63*udg13; + T t71 = t61*udg19; + T t72 = t62*udg20; + T t73 = t63*udg21; + T t75 = 1.0/t74; + T t76 = t75*t75; + T t77 = t75*udg8; + T t78 = t75*uinf1; + T t86 = t64+t65+t66+t68+t70; + T t87 = t67+t69+t71+t72+t73; + T t79 = t77*1.0E+12; + T t80 = t78*1.0E+12; + T t81 = t77+t78-1.0E-4; + T t88 = t75*t86*udg6; + T t89 = t75*t87*udg7; + T t82 = t79+t80-1.0E+8; + T t90 = -t88; + T t91 = -t89; + T t95 = -t75*(t88-udg14); + T t96 = -t75*(t89-udg23); + T t97 = t75*(t88-udg14)*-1.0E+12; + T t98 = t75*(t89-udg23)*-1.0E+12; + T t83 = atan(t82); + T t92 = t90+udg14; + T t93 = t91+udg23; + T t102 = t95+t96-1.0E+4; + T t103 = t97+t98-1.0E+16; + T t84 = t9*t83; + T t104 = atan(t103); + T t85 = t84+1.0/2.0; + T t105 = t9*t104; + T t94 = t81*t85; + T t106 = t105-1.0/2.0; + T t99 = t94+1.000000003182454E-4; + T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t100 = t11*t12*t99; + T t109 = t108*-1.0E+12; + T t110 = t107-2.0E+4; + T t101 = 1.0/sqrt(t100); + T t111 = t109-2.0E+16; + T t112 = atan(t111); + T t113 = t9*t112; + T t114 = t113+1.0/2.0; + T t115 = -t114*(t108+2.0E+4); + T t116 = t108+t115+1.0E+4; + T t117 = odg2*t10*t101*t116; + T t118 = -t117; + T t120 = t117*1.0E+12; + T t119 = param17+t118; + T t121 = -t120; + T t122 = t13+t121; + T t123 = atan(t122); + T t124 = t9*t123; + T t125 = t124-1.0/2.0; + T t126 = t119*t125; + f[j+npe*0+npe*nce*k] = odg2*param16*t10*(sqrt(t76*(udg6*udg6)+t76*(udg7*udg7))+1.0/t101)*(t126-(t9*atan(param18*-1.0E+12+t126*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t126+3.182454300088011E-13)); + // f[j+npe*0+npe*nce*k] = 0.0; + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou.cpp new file mode 100644 index 00000000..0d7b6ca4 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou.cpp @@ -0,0 +1,1042 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = udg17*udg17; + T t10 = udg18*udg18; + T t11 = udg19*udg19; + T t12 = udg20*udg20; + T t13 = udg21*udg21; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = 1.0/param20; + T t17 = udg1*1.0E+12; + T t18 = udg2*1.0E+12; + T t19 = udg3*1.0E+12; + T t20 = udg4*1.0E+12; + T t21 = udg5*1.0E+12; + T t22 = udg17*1.0E+12; + T t23 = udg18*1.0E+12; + T t24 = udg19*1.0E+12; + T t25 = udg20*1.0E+12; + T t26 = udg21*1.0E+12; + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t34 = atan(t24); + T t35 = atan(t25); + T t36 = atan(t26); + T t57 = t2*1.0E+24; + T t58 = t3*1.0E+24; + T t59 = t4*1.0E+24; + T t60 = t5*1.0E+24; + T t61 = t6*1.0E+24; + T t62 = t9*1.0E+24; + T t63 = t10*1.0E+24; + T t64 = t11*1.0E+24; + T t65 = t12*1.0E+24; + T t66 = t13*1.0E+24; + T t37 = t14*t27; + T t38 = t14*t28; + T t39 = t14*t29; + T t40 = t14*t30; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t46 = t14*t36; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t74 = t64+1.0; + T t75 = t65+1.0; + T t76 = t66+1.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t51 = t41+1.0/2.0; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t84 = 1.0/t74; + T t85 = 1.0/t75; + T t86 = 1.0/t76; + T t52 = t47*udg1; + T t53 = t48*udg2; + T t54 = t49*udg3; + T t55 = t50*udg4; + T t56 = t51*udg5; + T t92 = t14*t17*t77; + T t93 = t14*t18*t78; + T t94 = t14*t19*t79; + T t95 = t14*t20*t80; + T t96 = t14*t21*t81; + T t97 = t14*t22*t82; + T t98 = t14*t23*t83; + T t99 = t14*t24*t84; + T t100 = t14*t25*t85; + T t101 = t14*t26*t86; + T t87 = t52+3.182454300088011E-13; + T t88 = t53+3.182454300088011E-13; + T t89 = t54+3.182454300088011E-13; + T t90 = t55+3.182454300088011E-13; + T t91 = t56+3.182454300088011E-13; + T t102 = t47+t92; + T t103 = t48+t93; + T t104 = t49+t94; + T t105 = t50+t95; + T t106 = t51+t96; + T t107 = t42+t97+1.0/2.0; + T t108 = t43+t98+1.0/2.0; + T t109 = t44+t99+1.0/2.0; + T t110 = t45+t100+1.0/2.0; + T t111 = t46+t101+1.0/2.0; + T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + T t112 = t102*udg9; + T t113 = t103*udg10; + T t114 = t104*udg11; + T t115 = t105*udg12; + T t116 = t106*udg13; + T t117 = t107*udg17; + T t118 = t108*udg18; + T t119 = t109*udg19; + T t120 = t110*udg20; + T t121 = t111*udg21; + T t123 = 1.0/t122; + T t124 = t123*t123; + T t125 = t123*udg8; + T t126 = t123*uinf1; + T t127 = t123*udg6*udg7; + T t130 = t112*t122; + T t131 = t113*t122; + T t132 = t114*t122; + T t133 = t115*t122; + T t134 = t116*t122; + T t135 = t117*t122; + T t136 = t118*t122; + T t137 = t119*t122; + T t138 = t120*t122; + T t139 = t121*t122; + T t152 = t112+t113+t114+t115+t116; + T t153 = t117+t118+t119+t120+t121; + T t128 = (t7*t124)/2.0; + T t129 = (t8*t124)/2.0; + T t140 = -t130; + T t141 = -t131; + T t142 = -t132; + T t143 = -t133; + T t144 = -t134; + T t145 = -t135; + T t146 = -t136; + T t147 = -t137; + T t148 = -t138; + T t149 = -t139; + T t150 = t125+t126; + T t154 = t87*t152; + T t155 = t88*t152; + T t156 = t89*t152; + T t157 = t90*t152; + T t158 = t91*t152; + T t159 = t87*t153; + T t160 = t88*t153; + T t161 = t89*t153; + T t162 = t90*t153; + T t163 = t91*t153; + T t164 = t123*t152*udg6; + T t165 = t123*t152*udg7; + T t166 = t123*t153*udg6; + T t167 = t123*t153*udg7; + T t151 = t128+t129; + T t168 = -t164; + T t169 = -t165; + T t170 = -t166; + T t171 = -t167; + T t176 = t140+t154; + T t177 = t141+t155; + T t178 = t142+t156; + T t179 = t143+t157; + T t180 = t144+t158; + T t181 = t145+t159; + T t182 = t146+t160; + T t183 = t147+t161; + T t184 = t148+t162; + T t185 = t149+t163; + T t186 = -t123*(t164-udg14); + T t187 = -t123*(t165-udg15); + T t188 = -t123*(t166-udg22); + T t189 = -t123*(t167-udg23); + T t190 = t123*(t164-udg14)*-2.0; + T t191 = t123*(t167-udg23)*-2.0; + T t192 = t123*(t167-udg23); + T t194 = -t123*uinf2*(t130-t154); + T t195 = -t124*uinf2*(t130-t154); + T t196 = -t123*uinf3*(t131-t155); + T t197 = -t124*uinf3*(t131-t155); + T t198 = -t123*uinf4*(t132-t156); + T t199 = -t124*uinf4*(t132-t156); + T t200 = -t123*uinf5*(t133-t157); + T t201 = -t124*uinf5*(t133-t157); + T t202 = -t123*uinf6*(t134-t158); + T t203 = -t124*uinf6*(t134-t158); + T t204 = -t123*uinf2*(t135-t159); + T t205 = -t124*uinf2*(t135-t159); + T t206 = -t123*uinf3*(t136-t160); + T t207 = -t124*uinf3*(t136-t160); + T t208 = -t123*uinf4*(t137-t161); + T t209 = -t124*uinf4*(t137-t161); + T t210 = -t123*uinf5*(t138-t162); + T t211 = -t124*uinf5*(t138-t162); + T t212 = -t123*uinf6*(t139-t163); + T t213 = -t124*uinf6*(t139-t163); + T t214 = t123*uinf2*(t130-t154); + T t215 = t123*uinf3*(t131-t155); + T t216 = t123*uinf4*(t132-t156); + T t217 = t123*uinf5*(t133-t157); + T t218 = t123*uinf6*(t134-t158); + T t219 = t123*uinf2*(t135-t159); + T t220 = t123*uinf3*(t136-t160); + T t221 = t123*uinf4*(t137-t161); + T t222 = t123*uinf5*(t138-t162); + T t223 = t123*uinf6*(t139-t163); + T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t172 = t168+udg14; + T t173 = t169+udg15; + T t174 = t170+udg22; + T t175 = t171+udg23; + T t193 = t192*2.0; + T t224 = t187+t188; + T t226 = t190+t192; + T t228 = t195+t197+t199+t201+t203; + T t229 = t205+t207+t209+t211+t213; + f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = udg17*udg17; + T t10 = udg18*udg18; + T t11 = udg19*udg19; + T t12 = udg20*udg20; + T t13 = udg21*udg21; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = 1.0/param20; + T t17 = udg1*1.0E+12; + T t18 = udg2*1.0E+12; + T t19 = udg3*1.0E+12; + T t20 = udg4*1.0E+12; + T t21 = udg5*1.0E+12; + T t22 = udg17*1.0E+12; + T t23 = udg18*1.0E+12; + T t24 = udg19*1.0E+12; + T t25 = udg20*1.0E+12; + T t26 = udg21*1.0E+12; + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t34 = atan(t24); + T t35 = atan(t25); + T t36 = atan(t26); + T t57 = t2*1.0E+24; + T t58 = t3*1.0E+24; + T t59 = t4*1.0E+24; + T t60 = t5*1.0E+24; + T t61 = t6*1.0E+24; + T t62 = t9*1.0E+24; + T t63 = t10*1.0E+24; + T t64 = t11*1.0E+24; + T t65 = t12*1.0E+24; + T t66 = t13*1.0E+24; + T t37 = t14*t27; + T t38 = t14*t28; + T t39 = t14*t29; + T t40 = t14*t30; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t46 = t14*t36; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t74 = t64+1.0; + T t75 = t65+1.0; + T t76 = t66+1.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t51 = t41+1.0/2.0; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t84 = 1.0/t74; + T t85 = 1.0/t75; + T t86 = 1.0/t76; + T t52 = t47*udg1; + T t53 = t48*udg2; + T t54 = t49*udg3; + T t55 = t50*udg4; + T t56 = t51*udg5; + T t92 = t14*t17*t77; + T t93 = t14*t18*t78; + T t94 = t14*t19*t79; + T t95 = t14*t20*t80; + T t96 = t14*t21*t81; + T t97 = t14*t22*t82; + T t98 = t14*t23*t83; + T t99 = t14*t24*t84; + T t100 = t14*t25*t85; + T t101 = t14*t26*t86; + T t87 = t52+3.182454300088011E-13; + T t88 = t53+3.182454300088011E-13; + T t89 = t54+3.182454300088011E-13; + T t90 = t55+3.182454300088011E-13; + T t91 = t56+3.182454300088011E-13; + T t102 = t47+t92; + T t103 = t48+t93; + T t104 = t49+t94; + T t105 = t50+t95; + T t106 = t51+t96; + T t107 = t42+t97+1.0/2.0; + T t108 = t43+t98+1.0/2.0; + T t109 = t44+t99+1.0/2.0; + T t110 = t45+t100+1.0/2.0; + T t111 = t46+t101+1.0/2.0; + T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + T t112 = t102*udg9; + T t113 = t103*udg10; + T t114 = t104*udg11; + T t115 = t105*udg12; + T t116 = t106*udg13; + T t117 = t107*udg17; + T t118 = t108*udg18; + T t119 = t109*udg19; + T t120 = t110*udg20; + T t121 = t111*udg21; + T t123 = 1.0/t122; + T t124 = t123*t123; + T t125 = t123*udg8; + T t126 = t123*uinf1; + T t127 = t123*udg6*udg7; + T t130 = t112*t122; + T t131 = t113*t122; + T t132 = t114*t122; + T t133 = t115*t122; + T t134 = t116*t122; + T t135 = t117*t122; + T t136 = t118*t122; + T t137 = t119*t122; + T t138 = t120*t122; + T t139 = t121*t122; + T t152 = t112+t113+t114+t115+t116; + T t153 = t117+t118+t119+t120+t121; + T t128 = (t7*t124)/2.0; + T t129 = (t8*t124)/2.0; + T t140 = -t130; + T t141 = -t131; + T t142 = -t132; + T t143 = -t133; + T t144 = -t134; + T t145 = -t135; + T t146 = -t136; + T t147 = -t137; + T t148 = -t138; + T t149 = -t139; + T t150 = t125+t126; + T t154 = t87*t152; + T t155 = t88*t152; + T t156 = t89*t152; + T t157 = t90*t152; + T t158 = t91*t152; + T t159 = t87*t153; + T t160 = t88*t153; + T t161 = t89*t153; + T t162 = t90*t153; + T t163 = t91*t153; + T t164 = t123*t152*udg6; + T t165 = t123*t152*udg7; + T t166 = t123*t153*udg6; + T t167 = t123*t153*udg7; + T t151 = t128+t129; + T t168 = -t164; + T t169 = -t165; + T t170 = -t166; + T t171 = -t167; + T t176 = t140+t154; + T t177 = t141+t155; + T t178 = t142+t156; + T t179 = t143+t157; + T t180 = t144+t158; + T t181 = t145+t159; + T t182 = t146+t160; + T t183 = t147+t161; + T t184 = t148+t162; + T t185 = t149+t163; + T t186 = -t123*(t164-udg14); + T t187 = -t123*(t165-udg15); + T t188 = -t123*(t166-udg22); + T t189 = -t123*(t167-udg23); + T t190 = t123*(t164-udg14)*-2.0; + T t191 = t123*(t167-udg23)*-2.0; + T t192 = t123*(t167-udg23); + T t194 = -t123*uinf2*(t130-t154); + T t195 = -t124*uinf2*(t130-t154); + T t196 = -t123*uinf3*(t131-t155); + T t197 = -t124*uinf3*(t131-t155); + T t198 = -t123*uinf4*(t132-t156); + T t199 = -t124*uinf4*(t132-t156); + T t200 = -t123*uinf5*(t133-t157); + T t201 = -t124*uinf5*(t133-t157); + T t202 = -t123*uinf6*(t134-t158); + T t203 = -t124*uinf6*(t134-t158); + T t204 = -t123*uinf2*(t135-t159); + T t205 = -t124*uinf2*(t135-t159); + T t206 = -t123*uinf3*(t136-t160); + T t207 = -t124*uinf3*(t136-t160); + T t208 = -t123*uinf4*(t137-t161); + T t209 = -t124*uinf4*(t137-t161); + T t210 = -t123*uinf5*(t138-t162); + T t211 = -t124*uinf5*(t138-t162); + T t212 = -t123*uinf6*(t139-t163); + T t213 = -t124*uinf6*(t139-t163); + T t214 = t123*uinf2*(t130-t154); + T t215 = t123*uinf3*(t131-t155); + T t216 = t123*uinf4*(t132-t156); + T t217 = t123*uinf5*(t133-t157); + T t218 = t123*uinf6*(t134-t158); + T t219 = t123*uinf2*(t135-t159); + T t220 = t123*uinf3*(t136-t160); + T t221 = t123*uinf4*(t137-t161); + T t222 = t123*uinf5*(t138-t162); + T t223 = t123*uinf6*(t139-t163); + T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t172 = t168+udg14; + T t173 = t169+udg15; + T t174 = t170+udg22; + T t175 = t171+udg23; + T t193 = t192*2.0; + T t224 = t187+t188; + T t226 = t190+t192; + T t228 = t195+t197+t199+t201+t203; + T t229 = t205+t207+t209+t211+t213; + f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + uinf12 = 0.0; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg17*udg17; + T t8 = udg18*udg18; + T t9 = udg19*udg19; + T t10 = udg20*udg20; + T t11 = udg21*udg21; + T t12 = 1.0/3.141592653589793; + T t13 = 1.0/param20; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t19 = udg17*1.0E+12; + T t20 = udg18*1.0E+12; + T t21 = udg19*1.0E+12; + T t22 = udg20*1.0E+12; + T t23 = udg21*1.0E+12; + T t24 = atan(t14); + T t25 = atan(t15); + T t26 = atan(t16); + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t54 = t2*1.0E+24; + T t55 = t3*1.0E+24; + T t56 = t4*1.0E+24; + T t57 = t5*1.0E+24; + T t58 = t6*1.0E+24; + T t59 = t7*1.0E+24; + T t60 = t8*1.0E+24; + T t61 = t9*1.0E+24; + T t62 = t10*1.0E+24; + T t63 = t11*1.0E+24; + T t34 = t12*t24; + T t35 = t12*t25; + T t36 = t12*t26; + T t37 = t12*t27; + T t38 = t12*t28; + T t39 = t12*t29; + T t40 = t12*t30; + T t41 = t12*t31; + T t42 = t12*t32; + T t43 = t12*t33; + T t64 = t54+1.0; + T t65 = t55+1.0; + T t66 = t56+1.0; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t44 = t34+1.0/2.0; + T t45 = t35+1.0/2.0; + T t46 = t36+1.0/2.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t74 = 1.0/t64; + T t75 = 1.0/t65; + T t76 = 1.0/t66; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t49 = t44*udg1; + T t50 = t45*udg2; + T t51 = t46*udg3; + T t52 = t47*udg4; + T t53 = t48*udg5; + T t84 = t12*t14*t74; + T t85 = t12*t15*t75; + T t86 = t12*t16*t76; + T t87 = t12*t17*t77; + T t88 = t12*t18*t78; + T t89 = t12*t19*t79; + T t90 = t12*t20*t80; + T t91 = t12*t21*t81; + T t92 = t12*t22*t82; + T t93 = t12*t23*t83; + T t94 = t44+t84; + T t95 = t45+t85; + T t96 = t46+t86; + T t97 = t47+t87; + T t98 = t48+t88; + T t99 = t39+t89+1.0/2.0; + T t100 = t40+t90+1.0/2.0; + T t101 = t41+t91+1.0/2.0; + T t102 = t42+t92+1.0/2.0; + T t103 = t43+t93+1.0/2.0; + T t114 = t49+t50+t51+t52+t53+1.591227150044006E-12; + T t104 = t94*udg9; + T t105 = t95*udg10; + T t106 = t96*udg11; + T t107 = t97*udg12; + T t108 = t98*udg13; + T t109 = t99*udg17; + T t110 = t100*udg18; + T t111 = t101*udg19; + T t112 = t102*udg20; + T t113 = t103*udg21; + T t115 = 1.0/t114; + T t116 = t115*udg6*udg7; + T t117 = t104+t105+t106+t107+t108; + T t118 = t109+t110+t111+t112+t113; + T t119 = t115*t117*udg6; + T t120 = t115*t117*udg7; + T t121 = t115*t118*udg6; + T t122 = t115*t118*udg7; + T t123 = -t119; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t131 = -t115*(t120-udg15); + T t132 = -t115*(t121-udg22); + T t134 = -t13*uinf12*(t115*(t120-udg15)+t115*(t121-udg22)); + T t127 = t123+udg14; + T t128 = t124+udg15; + T t129 = t125+udg22; + T t130 = t126+udg23; + T t133 = t131+t132; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg1*(uinf1+odg1*udg14+t115*(udg6*udg6)-t13*uinf12*(t115*(t119-udg14)*2.0-t115*(t122-udg23))*(2.0/3.0))+nlg2*(t116+t134+odg1*udg22)+tau6*(udg6-uhg6); + f[6*ng+i] = nlg2*(uinf1+odg1*udg23+t115*(udg7*udg7)+t13*uinf12*(t115*(t119-udg14)-t115*(t122-udg23)*2.0)*(2.0/3.0))+nlg1*(t116+t134+odg1*udg15)+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + { + // std::cout << "START FBOU1" << std::endl; + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + // std::cout << "END FBOU1" << std::endl; + } + else if (ib == 2) + { + // std::cout << "START FBOU2" << std::endl; + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + // std::cout << "END FBOU2" << std::endl; + + } + else if (ib == 3) + { + // std::cout << "START FBOU3" << std::endl; + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + // std::cout << "END FBOU3" << std::endl; + + } +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFhat.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFhat.cpp new file mode 100644 index 00000000..cba1b474 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFhat.cpp @@ -0,0 +1,6 @@ +template void opuFhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuFhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFlux.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFlux.cpp new file mode 100644 index 00000000..7144b6b8 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFlux.cpp @@ -0,0 +1,390 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + // std::cout << "START FLUX" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + uinf14 = 0.0; + uinf15 = 0.0; + uinf16 = 0.0; + uinf17 = 0.0; + uinf18 = 0.0; + uinf19 = 0.0; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = udg17*udg17; + T t10 = udg18*udg18; + T t11 = udg19*udg19; + T t12 = udg20*udg20; + T t13 = udg21*udg21; + T t14 = 1.0/3.141592653589793; + T t15 = 1.0/param19; + T t16 = 1.0/param20; + T t17 = udg1*1.0E+12; + T t18 = udg2*1.0E+12; + T t19 = udg3*1.0E+12; + T t20 = udg4*1.0E+12; + T t21 = udg5*1.0E+12; + T t22 = udg17*1.0E+12; + T t23 = udg18*1.0E+12; + T t24 = udg19*1.0E+12; + T t25 = udg20*1.0E+12; + T t26 = udg21*1.0E+12; + T t27 = atan(t17); + T t28 = atan(t18); + T t29 = atan(t19); + T t30 = atan(t20); + T t31 = atan(t21); + T t32 = atan(t22); + T t33 = atan(t23); + T t34 = atan(t24); + T t35 = atan(t25); + T t36 = atan(t26); + T t57 = t2*1.0E+24; + T t58 = t3*1.0E+24; + T t59 = t4*1.0E+24; + T t60 = t5*1.0E+24; + T t61 = t6*1.0E+24; + T t62 = t9*1.0E+24; + T t63 = t10*1.0E+24; + T t64 = t11*1.0E+24; + T t65 = t12*1.0E+24; + T t66 = t13*1.0E+24; + T t37 = t14*t27; + T t38 = t14*t28; + T t39 = t14*t29; + T t40 = t14*t30; + T t41 = t14*t31; + T t42 = t14*t32; + T t43 = t14*t33; + T t44 = t14*t34; + T t45 = t14*t35; + T t46 = t14*t36; + T t67 = t57+1.0; + T t68 = t58+1.0; + T t69 = t59+1.0; + T t70 = t60+1.0; + T t71 = t61+1.0; + T t72 = t62+1.0; + T t73 = t63+1.0; + T t74 = t64+1.0; + T t75 = t65+1.0; + T t76 = t66+1.0; + T t47 = t37+1.0/2.0; + T t48 = t38+1.0/2.0; + T t49 = t39+1.0/2.0; + T t50 = t40+1.0/2.0; + T t51 = t41+1.0/2.0; + T t77 = 1.0/t67; + T t78 = 1.0/t68; + T t79 = 1.0/t69; + T t80 = 1.0/t70; + T t81 = 1.0/t71; + T t82 = 1.0/t72; + T t83 = 1.0/t73; + T t84 = 1.0/t74; + T t85 = 1.0/t75; + T t86 = 1.0/t76; + T t52 = t47*udg1; + T t53 = t48*udg2; + T t54 = t49*udg3; + T t55 = t50*udg4; + T t56 = t51*udg5; + T t92 = t14*t17*t77; + T t93 = t14*t18*t78; + T t94 = t14*t19*t79; + T t95 = t14*t20*t80; + T t96 = t14*t21*t81; + T t97 = t14*t22*t82; + T t98 = t14*t23*t83; + T t99 = t14*t24*t84; + T t100 = t14*t25*t85; + T t101 = t14*t26*t86; + T t87 = t52+3.182454300088011E-13; + T t88 = t53+3.182454300088011E-13; + T t89 = t54+3.182454300088011E-13; + T t90 = t55+3.182454300088011E-13; + T t91 = t56+3.182454300088011E-13; + T t102 = t47+t92; + T t103 = t48+t93; + T t104 = t49+t94; + T t105 = t50+t95; + T t106 = t51+t96; + T t107 = t42+t97+1.0/2.0; + T t108 = t43+t98+1.0/2.0; + T t109 = t44+t99+1.0/2.0; + T t110 = t45+t100+1.0/2.0; + T t111 = t46+t101+1.0/2.0; + T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + T t112 = t102*udg9; + T t113 = t103*udg10; + T t114 = t104*udg11; + T t115 = t105*udg12; + T t116 = t106*udg13; + T t117 = t107*udg17; + T t118 = t108*udg18; + T t119 = t109*udg19; + T t120 = t110*udg20; + T t121 = t111*udg21; + T t123 = 1.0/t122; + T t124 = t123*t123; + T t125 = t123*udg8; + T t126 = t123*uinf1; + T t127 = t123*udg6*udg7; + T t130 = t112*t122; + T t131 = t113*t122; + T t132 = t114*t122; + T t133 = t115*t122; + T t134 = t116*t122; + T t135 = t117*t122; + T t136 = t118*t122; + T t137 = t119*t122; + T t138 = t120*t122; + T t139 = t121*t122; + T t152 = t112+t113+t114+t115+t116; + T t153 = t117+t118+t119+t120+t121; + T t128 = (t7*t124)/2.0; + T t129 = (t8*t124)/2.0; + T t140 = -t130; + T t141 = -t131; + T t142 = -t132; + T t143 = -t133; + T t144 = -t134; + T t145 = -t135; + T t146 = -t136; + T t147 = -t137; + T t148 = -t138; + T t149 = -t139; + T t150 = t125+t126; + T t154 = t87*t152; + T t155 = t88*t152; + T t156 = t89*t152; + T t157 = t90*t152; + T t158 = t91*t152; + T t159 = t87*t153; + T t160 = t88*t153; + T t161 = t89*t153; + T t162 = t90*t153; + T t163 = t91*t153; + T t164 = t123*t152*udg6; + T t165 = t123*t152*udg7; + T t166 = t123*t153*udg6; + T t167 = t123*t153*udg7; + T t151 = t128+t129; + T t168 = -t164; + T t169 = -t165; + T t170 = -t166; + T t171 = -t167; + T t176 = t140+t154; + T t177 = t141+t155; + T t178 = t142+t156; + T t179 = t143+t157; + T t180 = t144+t158; + T t181 = t145+t159; + T t182 = t146+t160; + T t183 = t147+t161; + T t184 = t148+t162; + T t185 = t149+t163; + T t186 = -t123*(t164-udg14); + T t187 = -t123*(t165-udg15); + T t188 = -t123*(t166-udg22); + T t189 = -t123*(t167-udg23); + T t190 = t123*(t164-udg14)*-2.0; + T t191 = t123*(t167-udg23)*-2.0; + T t192 = t123*(t167-udg23); + T t194 = -t123*uinf2*(t130-t154); + T t195 = -t124*uinf2*(t130-t154); + T t196 = -t123*uinf3*(t131-t155); + T t197 = -t124*uinf3*(t131-t155); + T t198 = -t123*uinf4*(t132-t156); + T t199 = -t124*uinf4*(t132-t156); + T t200 = -t123*uinf5*(t133-t157); + T t201 = -t124*uinf5*(t133-t157); + T t202 = -t123*uinf6*(t134-t158); + T t203 = -t124*uinf6*(t134-t158); + T t204 = -t123*uinf2*(t135-t159); + T t205 = -t124*uinf2*(t135-t159); + T t206 = -t123*uinf3*(t136-t160); + T t207 = -t124*uinf3*(t136-t160); + T t208 = -t123*uinf4*(t137-t161); + T t209 = -t124*uinf4*(t137-t161); + T t210 = -t123*uinf5*(t138-t162); + T t211 = -t124*uinf5*(t138-t162); + T t212 = -t123*uinf6*(t139-t163); + T t213 = -t124*uinf6*(t139-t163); + T t214 = t123*uinf2*(t130-t154); + T t215 = t123*uinf3*(t131-t155); + T t216 = t123*uinf4*(t132-t156); + T t217 = t123*uinf5*(t133-t157); + T t218 = t123*uinf6*(t134-t158); + T t219 = t123*uinf2*(t135-t159); + T t220 = t123*uinf3*(t136-t160); + T t221 = t123*uinf4*(t137-t161); + T t222 = t123*uinf5*(t138-t162); + T t223 = t123*uinf6*(t139-t163); + T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + T t172 = t168+udg14; + T t173 = t169+udg15; + T t174 = t170+udg22; + T t175 = t171+udg23; + T t193 = t192*2.0; + T t224 = t187+t188; + T t226 = t190+t192; + T t228 = t195+t197+t199+t201+t203; + T t229 = t205+t207+t209+t211+t213; + f[0*ng+i] = t214+t230+odg1*t112+t87*t123*udg6; + f[1*ng+i] = t215+t231+odg1*t113+t88*t123*udg6; + f[2*ng+i] = t216+t232+odg1*t114+t89*t123*udg6; + f[3*ng+i] = t217+t233+odg1*t115+t90*t123*udg6; + f[4*ng+i] = t218+t234+odg1*t116+t91*t123*udg6; + f[5*ng+i] = uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); + f[6*ng+i] = t127+t227+odg1*udg15; + f[7*ng+i] = odg1*udg16+t150*udg6-uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+t123*t227*udg7+t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)-t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); + f[8*ng+i] = t219+t235+odg1*t117+t87*t123*udg7; + f[9*ng+i] = t220+t236+odg1*t118+t88*t123*udg7; + f[10*ng+i] = t221+t237+odg1*t119+t89*t123*udg7; + f[11*ng+i] = t222+t238+odg1*t120+t90*t123*udg7; + f[12*ng+i] = t223+t239+odg1*t121+t91*t123*udg7; + f[13*ng+i] = t127+t227+odg1*udg22; + f[14*ng+i] = uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); + f[15*ng+i] = odg1*udg24+t150*udg7-uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+t123*t227*udg6+t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)+t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); + } + // std::cout << "END FLUX" << std::endl; + +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuInitodg.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuInitodg.cpp new file mode 100644 index 00000000..1e0174b0 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuInitodg.cpp @@ -0,0 +1,6 @@ +template void opuInitodg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitodg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitodg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuInitq.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuInitq.cpp new file mode 100644 index 00000000..c557795d --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuInitq.cpp @@ -0,0 +1,6 @@ +template void opuInitq(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitq(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitq(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuInitu.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuInitu.cpp new file mode 100644 index 00000000..e007a61e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuInitu.cpp @@ -0,0 +1,33 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitudg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitudg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitudg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuInitwdg.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuInitwdg.cpp new file mode 100644 index 00000000..5217d5ee --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuInitwdg.cpp @@ -0,0 +1,6 @@ +template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuOutput.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuOutput.cpp new file mode 100644 index 00000000..17dc6e69 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuOutput.cpp @@ -0,0 +1,213 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double wdot[5]; + // std::cout << "START OUTPUT" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + // uinf1 = mix->P() / rhoe_scale; + // uinf2 = mix->mixtureFrozenGamma(); + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = uinf2*2.0; + T t8 = uinf2+1.0; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param15; + T t13 = param17*1.0E+12; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t11 = t7-2.0; + T t12 = 1.0/t8; + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t39 = t2*1.0E+24; + T t40 = t3*1.0E+24; + T t41 = t4*1.0E+24; + T t42 = t5*1.0E+24; + T t43 = t6*1.0E+24; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t54 = t9*t14*t49; + T t55 = t9*t15*t50; + T t56 = t9*t16*t51; + T t57 = t9*t17*t52; + T t58 = t9*t18*t53; + T t59 = t29+t54; + T t60 = t30+t55; + T t61 = t31+t56; + T t62 = t32+t57; + T t63 = t33+t58; + T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t64 = t59*udg9; + T t65 = t60*udg10; + T t66 = t61*udg11; + T t67 = t59*udg17; + T t68 = t62*udg12; + T t69 = t60*udg18; + T t70 = t63*udg13; + T t71 = t61*udg19; + T t72 = t62*udg20; + T t73 = t63*udg21; + T t75 = 1.0/t74; + T t76 = t75*t75; + T t77 = t75*udg8; + T t78 = t75*uinf1; + T t86 = t64+t65+t66+t68+t70; + T t87 = t67+t69+t71+t72+t73; + T t79 = t77*1.0E+12; + T t80 = t78*1.0E+12; + T t81 = t77+t78-1.0E-4; + T t88 = t75*t86*udg6; + T t89 = t75*t87*udg7; + T t82 = t79+t80-1.0E+8; + T t90 = -t88; + T t91 = -t89; + T t95 = -t75*(t88-udg14); + T t96 = -t75*(t89-udg23); + T t97 = t75*(t88-udg14)*-1.0E+12; + T t98 = t75*(t89-udg23)*-1.0E+12; + T t83 = atan(t82); + T t92 = t90+udg14; + T t93 = t91+udg23; + T t102 = t95+t96-1.0E+4; + T t103 = t97+t98-1.0E+16; + T t84 = t9*t83; + T t104 = atan(t103); + T t85 = t84+1.0/2.0; + T t105 = t9*t104; + T t94 = t81*t85; + T t106 = t105-1.0/2.0; + T t99 = t94+1.000000003182454E-4; + T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t100 = t11*t12*t99; + T t109 = t108*-1.0E+12; + T t110 = t107-2.0E+4; + T t101 = 1.0/sqrt(t100); + T t111 = t109-2.0E+16; + T t112 = atan(t111); + T t113 = t9*t112; + T t114 = t113+1.0/2.0; + T t115 = -t114*(t108+2.0E+4); + T t116 = t108+t115+1.0E+4; + T t117 = odg2*t10*t101*t116; + T t118 = -t117; + T t120 = t117*1.0E+12; + T t119 = param17+t118; + T t121 = -t120; + T t122 = t13+t121; + T t123 = atan(t122); + T t124 = t9*t123; + T t125 = t124-1.0/2.0; + T t126 = t119*t125; + + f[j+npe*0+npe*nce*k] = wdot[0]/omega_scale; + f[j+npe*1+npe*nce*k] = wdot[1]/omega_scale; + f[j+npe*2+npe*nce*k] = wdot[2]/omega_scale; + f[j+npe*3+npe*nce*k] = wdot[3]/omega_scale; + f[j+npe*4+npe*nce*k] = wdot[4]/omega_scale; + f[j+npe*5+npe*nce*k] = mix->P(); + f[j+npe*6+npe*nce*k] = mix->T(); + f[j+npe*7+npe*nce*k] = mix->mixtureFrozenGamma(); + f[j+npe*8+npe*nce*k] = rhoe; + f[j+npe*9+npe*nce*k] = odg1; + } + // std::cout << "END OUTPUT" << std::endl; + +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuSource.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuSource.cpp new file mode 100644 index 00000000..996c4cc8 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuSource.cpp @@ -0,0 +1,53 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + // std::cout << "START SOURCE" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + double wdot[5]; + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + f[7*ng+i] = 0.0; + } + // std::cout << "END SOURCE" << std::endl; + +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuSourcew.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuSourcew.cpp new file mode 100644 index 00000000..e97b7257 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuSourcew.cpp @@ -0,0 +1,6 @@ +template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuSourcew(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSourcew(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuStab.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuStab.cpp new file mode 100644 index 00000000..7fd61560 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuStab.cpp @@ -0,0 +1,6 @@ +template void opuStab(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuStab(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuStab(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuTdfunc.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuTdfunc.cpp new file mode 100644 index 00000000..f20d744b --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuTdfunc.cpp @@ -0,0 +1,16 @@ +template void opuTdfunc(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuUbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuUhat.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuUhat.cpp new file mode 100644 index 00000000..ba30d409 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuUhat.cpp @@ -0,0 +1,6 @@ +template void opuUhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuUhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); From b4d9c2f1a7597c009162885f4e9dd24d9ae82dba Mon Sep 17 00:00:00 2001 From: rloekvh Date: Sun, 9 Oct 2022 15:09:06 -0400 Subject: [PATCH 20/23] add mutationutils --- .../ReactingCylinder/app/mutationUtils.cpp | 395 ++++++++++++++++++ 1 file changed, 395 insertions(+) create mode 100644 Applications/Hypersonics/ReactingCylinder/app/mutationUtils.cpp diff --git a/Applications/Hypersonics/ReactingCylinder/app/mutationUtils.cpp b/Applications/Hypersonics/ReactingCylinder/app/mutationUtils.cpp new file mode 100644 index 00000000..2b029a29 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/mutationUtils.cpp @@ -0,0 +1,395 @@ +void nondimensionalizeConsVars(double* Ucons, double* uinf, int nspecies, int nd) +{ + // Modifies Ucons vector in place to have nondimensional quantities + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + for (int i=0; isetState(Yinf, pt_arr, 2); + +// // Get conservative quantities +// double rho_i[5]; // memory for densities +// mix->densities(rho_i); +// double rho = mix->density(); +// double rhoe = mix->mixtureEnergyMass() * rho; +// double Ustate[6] = {rho_i[0],rho_i[1],rho_i[2],rho_i[3],rho_i[4],rhoe}; + +// stateToConsVars(Ucons, uv_inflow, Ustate, uinf, nspecies); +// nondimensionalizeConsVars(Ucons, uinf, nspecies, 1); +// } + +// void uoutflow(double* Ucons, double* param, double* uinf, Mutation::Mixture *mix) +// { +// // Subsonic outflow: use rho_i, rhou from solution +// // given Pout, solve for energy rhoE +// int nspecies = 5; +// // scaling information +// double rho_inf = uinf[0]; +// double uv_inf = uinf[1]; +// double rhoe_inf = uinf[2]; +// double RU = Mutation::RU; + +// double Ustate[6]; +// double rho_i[5]; // If kept around, these arrays should be initialized as +// // some member of temp (maybe tmpapp array so it's separate from tmpg?) +// double rho = 0.0; + +// dimensionalizeConsVars(Ucons, uinf, nspecies, 1); +// conservativeToState(Ucons, Ustate, uinf, nspecies); + +// // Pressure outlet +// double P_out = param[3*nspecies+6]; + +// // Use pressure and rho from solution to get Temperature +// double denom = 0.0; +// for (int i = 0; i < nspecies; i++) +// { +// rho_i[i] = Ustate[i]; +// rho = rho + rho_i[i]; +// // Ucons[i] = rho_i[i]; +// denom = denom + RU * Ustate[i]/mix->speciesMw(i); +// } +// double T_out = P_out / denom; +// double u_out = Ucons[nspecies]/rho; +// // double u_out = 370.0; +// // printf("Tout: %f\n", T_out); +// // Set state with desnities and temperature +// mix->setState(rho_i, &T_out, 1); + +// // Update energy +// double rhoe = mix->mixtureEnergyMass() * rho; +// Ustate[nspecies] = rhoe; + +// // printf("rhou before update: %f\n", Ucons[5]); +// stateToConsVars(Ucons, u_out, Ustate, uinf, nspecies); +// // printf("rhou after update: %f\n", Ucons[5]); +// nondimensionalizeConsVars(Ucons, uinf, nspecies, 1); + +// // Here I can check that Ustate is the same mix.densities? +// // and that rho u doesn't change ? ? ? +// // double rhotest[5]; +// // mix->densities(rhotest); +// // for (int i = 0; i< nspecies; i++) +// // { +// // printf("rho mix %i: %f\n", i, rhotest[i]/rho_inf); +// // printf("rho state %i: %f\n", i, Ucons[i]); +// // } +// } + +void uinflow(double* Ucons, double p, double T_inf, double uv_inflow, double* Yinf, double* scales, Mutation::Mixture *mix) +{ // Subsonic inflow: use pressure from solution + // and given Tinf, Yinf, uinf to solve for rho, rhou, rhoE + int nspecies = 5; + // Scaling information + double rho_inf = scales[0]; + double uv_inf = scales[1]; + double rhoe_inf = scales[2]; + + // Known values from prescribed inflow + // double T_inf = datainflow[0]; + // double Yinf[5]; + // double uv_inflow = datainflow[1]; //inflow; here same as scaling but not necessarily true + // for (int ispecies = 0; ispeciessetState(Yinf, pt_arr, 2); + + // Get conservative quantities + double rho_i[5]; // memory for densities + mix->densities(rho_i); + double rho = mix->density(); + double rhoe = mix->mixtureEnergyMass() * rho; + double Ustate[6] = {rho_i[0],rho_i[1],rho_i[2],rho_i[3],rho_i[4],rhoe}; + + stateToConsVars(Ucons, uv_inflow, Ustate, scales, nspecies); + nondimensionalizeConsVars(Ucons, scales, nspecies, 1); +} + +void uoutflow(double* Ucons, double outP, double* scales, Mutation::Mixture *mix) +{ + // Subsonic outflow: use rho_i, rhou from solution + // given Pout, solve for energy rhoE + int nspecies = 5; + // scaling information + double rho_inf = scales[0]; + double uv_inf = scales[1]; + double rhoe_inf = scales[2]; + double RU = Mutation::RU; + + double Ustate[6]; + double rho_i[5]; // If kept around, these arrays should be initialized as + // some member of temp (maybe tmpapp array so it's separate from tmpg?) + double rho = 0.0; + + dimensionalizeConsVars(Ucons, scales, nspecies, 1); + conservativeToState(Ucons, Ustate, scales, nspecies, 1); + + // Pressure outlet + double P_out = outP; + + // Use pressure and rho from solution to get Temperature + double denom = 0.0; + for (int i = 0; i < nspecies; i++) + { + rho_i[i] = Ustate[i]; + rho = rho + rho_i[i]; + // Ucons[i] = rho_i[i]; + denom = denom + RU * Ustate[i]/mix->speciesMw(i); + } + double T_out = P_out / denom; + // double T_out = 300.0; + // double u_out = Ucons[nspecies]/rho; + double u_out = 0.0; + // printf("u_out: %f\n", u_out); + // double u_out = 370.0; + // printf("Tout: %f\n", T_out); + // Set state with desnities and temperature + mix->setState(rho_i, &T_out, 1); + + // Update energy + double rhoe = mix->mixtureEnergyMass() * rho; + Ustate[nspecies] = rhoe; + + // printf("rhou before update: %f\n", Ucons[5]); + stateToConsVars(Ucons, u_out, Ustate, scales, nspecies); + // printf("rhou after update: %f\n", Ucons[5]); + nondimensionalizeConsVars(Ucons, scales, nspecies, 1); +} + +void dT_dUstate(double* dTdU, double* Ustate, double* Uwork, int nspecies, int ndim, Mutation::Mixture *mix) +{ + // Uwork is a temporary array for storing things + // Ustate = (rho_i, rhoe, rhoev) + // Works entirely in dimensional variables, must be nondimensionalized after the fact. + double denom = mix->density() * mix->mixtureFrozenCvMass(); + mix->getEnergiesMass(Uwork); + for (int i = 0; imixtureEquilibriumCvMass()); +// // return -e/denom; +// } + +// double getdTdr(Mutation::Mixture *mix) +// { +// // double e = mixture->mixtureEnergyMass(); +// // double rho = mixture->density(); +// // double denom = (rho*mixture->mixtureEquilibriumCvMass()); +// // return -e/denom; +// } + +// double dTdru(double* rho_i, double* rhou) + +// double getdTdre(double rho, Mutation::Mixture *mix) +// { +// // double Cv = mixture->mixtureEquilibriumCvMass(); +// // double denom = rho * Cv; +// // return 1.0/denom; +// } + +// double getdTdre(Mutation::Mixture *mix) +// { +// // double Cv = mixture->mixtureEquilibriumCvMass(); +// // double rho = mixture->density(); +// // double denom = rho * Cv; +// // return 1.0/denom; +// } + +// double getP() +// { + +// } + +// double getKineticSource() +// { + +// } \ No newline at end of file From 67c02763448a6d418d3dab20ac07d6adbb5cef84 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Sun, 9 Oct 2022 16:11:52 -0400 Subject: [PATCH 21/23] fix debug issue --- src/Kernel/Discretization/qresidual.cpp | 8 ++++---- src/Kernel/Discretization/readbinaryfiles.cpp | 2 ++ src/Kernel/Discretization/uresidual.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Kernel/Discretization/qresidual.cpp b/src/Kernel/Discretization/qresidual.cpp index 13286197..f8fe6a42 100644 --- a/src/Kernel/Discretization/qresidual.cpp +++ b/src/Kernel/Discretization/qresidual.cpp @@ -28,7 +28,7 @@ void RqElemBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct &m Gauss2Node(handle, &res.Rqe[npe*ncq*e1], &tmp.tempg[n1], &master.shapegw[npe*nge], nge*nd, npe, ncq*ne, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + "RqElem_uge.bin", &tmp.tempg[n0], nge*ncu*ne, backend); writearray2file(common.fileout + "RqElem_fge.bin", &tmp.tempg[n1], nge*ncq*ne, backend); writearray2file(common.fileout + "RqElem_rqe.bin", res.Rqe, npe*ncq*common.ne1, backend); @@ -80,7 +80,7 @@ void RqFaceBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct &m // _F = _T = v * (uhg * jac * nlg) Gauss2Node(handle, &res.Rh[npf*ncq*f1], &tmp.tempg[n4], master.shapfgw, ngf, npf, nf*ncq, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + NumberToString(ib) + "RqFace_uhgf.bin", &tmp.tempg[n3], ngf*ncu*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RqFace_fgf.bin", &tmp.tempg[n4], ngf*ncq*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RqFace_rnf.bin", tmp.tempn, npf*ncq*nf, backend); @@ -135,7 +135,7 @@ void dRqElemBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct & Gauss2Node(handle, &res.dRqe[npe*ncq*e1], &tmp.tempg[n1], &master.shapegw[npe*nge], nge*nd, npe, ncq*ne, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + "RqElem_uge.bin", &tmp.tempg[n0], nge*ncu*ne, backend); writearray2file(common.fileout + "RqElem_fge.bin", &tmp.tempg[n1], nge*ncq*ne, backend); writearray2file(common.fileout + "RqElem_rqe.bin", res.Rqe, npe*ncq*common.ne1, backend); @@ -187,7 +187,7 @@ void dRqFaceBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct & // _F = _T = v * (uhg * jac * nlg) Gauss2Node(handle, &res.dRh[npf*ncq*f1], &tmp.tempg[n4], master.shapfgw, ngf, npf, nf*ncq, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + NumberToString(ib) + "RqFace_uhgf.bin", &tmp.tempg[n3], ngf*ncu*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RqFace_fgf.bin", &tmp.tempg[n4], ngf*ncq*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RqFace_rnf.bin", tmp.tempn, npf*ncq*nf, backend); diff --git a/src/Kernel/Discretization/readbinaryfiles.cpp b/src/Kernel/Discretization/readbinaryfiles.cpp index 622a1249..cadb3cff 100644 --- a/src/Kernel/Discretization/readbinaryfiles.cpp +++ b/src/Kernel/Discretization/readbinaryfiles.cpp @@ -55,6 +55,8 @@ void readappstruct(string filename, appstruct &app) Mutation::MixtureOptions opts(MixtureName); opts.setStateModel(StateModel); opts.setThermodynamicDatabase(ThermoDB); + opts.setViscosityAlgorithm("Gupta-Yos"); + opts.setThermalConductivityAlgorithm("Wilke"); app.mix = new Mutation::Mixture(opts); printf("Mutation mixture initialized\n"); diff --git a/src/Kernel/Discretization/uresidual.cpp b/src/Kernel/Discretization/uresidual.cpp index c84fb8e2..5775fab1 100644 --- a/src/Kernel/Discretization/uresidual.cpp +++ b/src/Kernel/Discretization/uresidual.cpp @@ -84,7 +84,7 @@ void RuElemBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct &m // = dw/dxi_i * (sum_j Flux_j(u) * Xx(:,j,i)) Gauss2Node(handle, &res.Rue[npe*ncu*e1], &tmp.tempg[n3], master.shapegw, nge*(nd+1), npe, ncu*ne, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + "RuElem_uge.bin", &tmp.tempg[n3], nge*nc*ne, backend); writearray2file(common.fileout + "RuElem_fge.bin", &tmp.tempg[n4], nge*ncu*nd*ne, backend); writearray2file(common.fileout + "RuElem_rne.bin", tmp.tempn, npe*ncu*ne, backend); @@ -194,7 +194,7 @@ void dRuElemBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct & nge, nd, ncu, ne, backend); Gauss2Node(handle, &res.dRue[npe*ncu*e1], &tmp.tempg[n9], master.shapegw, nge*(nd+1), npe, ncu*ne, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + "EnzymeRuElem_uge.bin", &tmp.tempg[n3], nge*nc*ne, backend); writearray2file(common.fileout + "EnzymeRuElem_fge.bin", &tmp.tempg[n4], nge*ncu*nd*ne, backend); writearray2file(common.fileout + "EnzymeRuElem_rne.bin", tmp.tempn, npe*ncu*ne, backend); @@ -284,7 +284,7 @@ void RuFaceBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct &m // _F = _T = w * (fhg * jac): npf*ncu*nf Gauss2Node(handle, &res.Rh[npf*ncu*f1], &tmp.tempg[n3], master.shapfgw, ngf, npf, nf*ncu, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + NumberToString(ib) + "RuFace_uhgf.bin", &tmp.tempg[n3], ngf*ncu*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RuFace_fgf.bin", &tmp.tempg[n4], ngf*ncu*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RuFace_rnf.bin", tmp.tempn, npf*ncu*nf, backend); @@ -404,7 +404,7 @@ void dRuFaceBlock(solstruct &sol, resstruct &res, appstruct &app, masterstruct & // evaluate dfhg * jac ApplyJac(&tmp.tempg[n9], &tmp.tempg[n14], &sol.faceg[nm+n2], nga, ncu, ngf, backend); Gauss2Node(handle, &res.dRh[npf*ncu*f1], &tmp.tempg[n9], master.shapfgw, ngf, npf, nf*ncu, backend); -#ifdef DEBUG +#ifdef EXADEBUG writearray2file(common.fileout + NumberToString(ib) + "RuFace_uhgf.bin", &tmp.tempg[n3], ngf*ncu*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RuFace_fgf.bin", &tmp.tempg[n4], ngf*ncu*nf, backend); writearray2file(common.fileout + NumberToString(ib) + "RuFace_rnf.bin", tmp.tempn, npf*ncu*nf, backend); From 365918c9d1e4e4178038da7f49506225837463a5 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Mon, 12 Dec 2022 21:48:48 -0500 Subject: [PATCH 22/23] add shock tube problem --- .../shocktests/app/opuAvfield_MPP_PB.cpp | 19 +- .../app/opuAvfield_MPP_PB_Dsensors.cpp | 238 +++++++++++++ .../app/opuAvfield_changeCutoffDir.cpp | 148 ++++++++ .../shocktests/app/opuFbou_MPP_PB.cpp | 8 +- .../shocktests/app/opuFlux_MPP_PB.cpp | 4 +- .../app/opuOutput_MPP_sensors_PB.cpp | 277 +++++++++------ .../shocktests/avfieldPhysical1d.m | 40 ++- Applications/Hypersonics/shocktests/pdeapp.m | 16 +- .../shocktests/pdeapp_physicsbased.m | 35 +- .../Hypersonics/shocktests/pdemodel.m | 2 +- .../Hypersonics/shocktests/plotting_scitech.m | 321 ++++++++++++++++++ 11 files changed, 954 insertions(+), 154 deletions(-) create mode 100644 Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB_Dsensors.cpp create mode 100644 Applications/Hypersonics/shocktests/app/opuAvfield_changeCutoffDir.cpp create mode 100644 Applications/Hypersonics/shocktests/plotting_scitech.m diff --git a/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp index 304157c6..d787581e 100644 --- a/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp @@ -60,7 +60,7 @@ template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u uinf2 = mix->mixtureFrozenGamma(); // gamma // uinf3 = (mix->frozenThermalConductivity() / uinf[5]) / (mix->viscosity() / uinf[4]); // cp / Pr^* // uinf3 = 0.0; - uinf3 = 1.0/0.9; + uinf3 = (mix->mixtureFrozenCpMass() / 1010.7825217371519) /0.9; T t2 = udg6*udg6; T t3 = uinf2*2.0; @@ -157,14 +157,15 @@ template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u T t94 = t89*t93; T t95 = -t94; T t96 = t87+t95; - f[j+npe*0+npe*nce*k] = odg9*param16*t7*t39*t75*t96; - f[j+npe*1+npe*nce*k] = 1e-3; - f[j+npe*2+npe*nce*k] = odg9*param16*t7*t39*t75*t96*uinf3; - f[j+npe*3+npe*nce*k] = 1e-4; - f[j+npe*4+npe*nce*k] = 1e-4; - f[j+npe*5+npe*nce*k] = 1e-4; - f[j+npe*6+npe*nce*k] = 1e-4; - f[j+npe*7+npe*nce*k] = 1e-4; + f[j+npe*0+npe*nce*k] = odg9*param16*t7*t39*t75*t96; // bulk + f[j+npe*1+npe*nce*k] = 0.0; // shear + f[j+npe*2+npe*nce*k] = odg9*param16*t7*t39*t75*t96*uinf3; // kappa + // f[j+npe*2+npe*nce*k] = 0.0; // kappa + f[j+npe*3+npe*nce*k] = 0.0; // D1 + f[j+npe*4+npe*nce*k] = 0.0; // D2 + f[j+npe*5+npe*nce*k] = 0.0; // D3 + f[j+npe*6+npe*nce*k] = 0.0; // D4 + f[j+npe*7+npe*nce*k] = 0.0; // D5 } } diff --git a/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB_Dsensors.cpp b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB_Dsensors.cpp new file mode 100644 index 00000000..85b257de --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB_Dsensors.cpp @@ -0,0 +1,238 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P()/rhoe_scale; // pressure + uinf2 = mix->mixtureFrozenGamma(); // gamma + uinf3 = (mix->frozenThermalConductivity() / uinf[5]) / (mix->viscosity() / uinf[4]); // cp / Pr^* + // uinf3 = 0.0; + // uinf3 = 1.0/0.9; + + + T t2 = udg6*udg6; + T t3 = uinf2*2.0; + T t4 = uinf2+1.0; + T t5 = 1.0/3.141592653589793; + T t6 = -param18; + T t7 = 1.0/param15; + T t10 = udg8+udg9+udg10+udg11+udg12; + T t11 = param17*1.0E+12; + T t12 = param18*1.0E+12; + T t13 = udg1*1.0E+12; + T t14 = udg2*1.0E+12; + T t15 = udg3*1.0E+12; + T t16 = udg4*1.0E+12; + T t17 = udg5*1.0E+12; + T t8 = t3-2.0; + T t9 = 1.0/t4; + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = -t12; + T t24 = t5*t18; + T t25 = t5*t19; + T t26 = t5*t20; + T t27 = t5*t21; + T t28 = t5*t22; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t39 = t34+3.182454300088011E-13; + T t40 = t35+3.182454300088011E-13; + T t41 = t36+3.182454300088011E-13; + T t42 = t37+3.182454300088011E-13; + T t43 = t38+3.182454300088011E-13; + T t44 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t45 = 1.0/t44; + T t46 = t45*t45; + T t47 = t45*udg7; + T t48 = t45*uinf1; + T t50 = t10*t45*udg6; + T t55 = t10*t39*t45; + T t56 = t10*t40*t45; + T t57 = t10*t41*t45; + T t58 = t10*t42*t45; + T t59 = t10*t43*t45; + T t49 = t2*t46; + T t51 = -t50; + T t53 = t47*1.0E+12; + T t54 = t48*1.0E+12; + T t60 = -t55; + T t61 = -t56; + T t62 = -t57; + T t63 = -t58; + T t64 = -t59; + T t70 = -t45*(t50-udg13); + T t71 = t47+t48-1.0E-4; + T t73 = t45*(t50-udg13)*-1.0E+12; + T t82 = -odg9*t7*t45*(t55-udg8); + T t83 = -odg9*t7*t45*(t56-udg9); + T t84 = -odg9*t7*t45*(t57-udg10); + T t85 = -odg9*t7*t45*(t58-udg11); + T t86 = -odg9*t7*t45*(t59-udg12); + T t92 = odg9*t7*t45*(t55-udg8)*-1.0E+12; + T t93 = odg9*t7*t45*(t56-udg9)*-1.0E+12; + T t94 = odg9*t7*t45*(t57-udg10)*-1.0E+12; + T t95 = odg9*t7*t45*(t58-udg11)*-1.0E+12; + T t96 = odg9*t7*t45*(t59-udg12)*-1.0E+12; + T t52 = t51+udg13; + T t65 = t60+udg8; + T t66 = t61+udg9; + T t67 = t62+udg10; + T t68 = t63+udg11; + T t69 = t64+udg12; + T t72 = t70-1.0E+4; + T t74 = t53+t54-1.0E+8; + T t76 = t73-1.0E+16; + T t87 = param17+t82; + T t88 = param17+t83; + T t89 = param17+t84; + T t90 = param17+t85; + T t91 = param17+t86; + T t97 = t11+t92; + T t98 = t11+t93; + T t99 = t11+t94; + T t100 = t11+t95; + T t101 = t11+t96; + T t75 = atan(t74); + T t77 = atan(t76); + T t102 = atan(t97); + T t103 = atan(t98); + T t104 = atan(t99); + T t105 = atan(t100); + T t106 = atan(t101); + T t78 = t5*t75; + T t80 = t5*t77; + T t107 = t5*t102; + T t108 = t5*t103; + T t109 = t5*t104; + T t110 = t5*t105; + T t111 = t5*t106; + T t79 = t78+1.0/2.0; + T t81 = t80-1.0/2.0; + T t112 = t107-1.0/2.0; + T t113 = t108-1.0/2.0; + T t114 = t109-1.0/2.0; + T t115 = t110-1.0/2.0; + T t116 = t111-1.0/2.0; + T t117 = t71*t79; + T t118 = -t81*(t45*(t50-udg13)+1.0E+4); + T t119 = t81*(t45*(t50-udg13)+1.0E+4); + T t129 = t87*t112; + T t130 = t88*t113; + T t131 = t89*t114; + T t132 = t90*t115; + T t133 = t91*t116; + T t120 = t119*-1.0E+12; + T t121 = t117+1.000000003182454E-4; + T t123 = t118-2.0E+4; + T t122 = t8*t9*t121; + T t125 = t120-2.0E+16; + T t124 = 1.0/sqrt(t122); + T t126 = atan(t125); + T t134 = t49+t122; + T t127 = t5*t126; + T t135 = sqrt(t134); + T t128 = t127+1.0/2.0; + T t136 = -t128*(t119+2.0E+4); + T t137 = t119+t136+1.0E+4; + T t138 = odg9*t7*t124*t137; + T t139 = -t138; + T t141 = t138*1.0E+12; + T t140 = param17+t139; + T t142 = -t141; + T t143 = t11+t142; + T t144 = atan(t143); + T t145 = t5*t144; + T t146 = t145-1.0/2.0; + T t147 = t140*t146; + T t148 = t147*1.0E+12; + T t149 = t6+t147+3.182454300088011E-13; + T t150 = t23+t148+3.182454300088011E-1; + T t151 = atan(t150); + T t152 = t5*t151; + T t153 = t152+1.0/2.0; + T t154 = t149*t153; + T t155 = -t154; + T t156 = t147+t155; + f[j+npe*0+npe*nce*k] = odg9*param16*t7*t44*t135*t156; + f[j+npe*1+npe*nce*k] = 0.0; + f[j+npe*2+npe*nce*k] = odg9*param16*t7*t44*t135*t156*uinf3; + f[j+npe*3+npe*nce*k] = odg9*t7*t44*t135*(t129-(t5*atan(t23+t129*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t129+3.182454300088011E-13)); + f[j+npe*4+npe*nce*k] = odg9*t7*t44*t135*(t130-(t5*atan(t23+t130*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t130+3.182454300088011E-13)); + f[j+npe*5+npe*nce*k] = odg9*t7*t44*t135*(t131-(t5*atan(t23+t131*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t131+3.182454300088011E-13)); + f[j+npe*6+npe*nce*k] = odg9*t7*t44*t135*(t132-(t5*atan(t23+t132*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t132+3.182454300088011E-13)); + f[j+npe*7+npe*nce*k] = odg9*t7*t44*t135*(t133-(t5*atan(t23+t133*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t133+3.182454300088011E-13)); + + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuAvfield_changeCutoffDir.cpp b/Applications/Hypersonics/shocktests/app/opuAvfield_changeCutoffDir.cpp new file mode 100644 index 00000000..aa97e466 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_changeCutoffDir.cpp @@ -0,0 +1,148 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + // std::cout << "begin avfield" << std::endl; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + T uinf1 = mix->P()/rhoe_scale; // pressure + T uinf2 = mix->mixtureFrozenGamma(); // gamma + + T t2 = uinf2*2.0; + T t3 = uinf2+1.0; + T t4 = 1.0/3.141592653589793; + T t5 = 1.0/param15; + T t8 = udg8+udg9+udg10+udg11+udg12; + T t9 = param17*1.0E+3; + T t10 = udg1*1.0E+3; + T t11 = udg2*1.0E+3; + T t12 = udg3*1.0E+3; + T t13 = udg4*1.0E+3; + T t14 = udg5*1.0E+3; + T t6 = t2-2.0; + T t7 = 1.0/t3; + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = t4*t15; + T t21 = t4*t16; + T t22 = t4*t17; + T t23 = t4*t18; + T t24 = t4*t19; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25*udg1; + T t31 = t26*udg2; + T t32 = t27*udg3; + T t33 = t28*udg4; + T t34 = t29*udg5; + T t35 = t30+t31+t32+t33+t34+1.591548900402584E-3; + T t36 = 1.0/t35; + T t37 = t36*udg7; + T t38 = t36*uinf1; + T t41 = t8*t36*udg6; + T t39 = t37*1.0E+3; + T t40 = t38*1.0E+3; + T t42 = -t41; + T t44 = -t36*(t41-udg13); + T t45 = t37+t38-1.0E-4; + T t46 = t36*(t41-udg13)*-1.0E+3; + T t43 = t42+udg13; + T t47 = t39+t40-1.0/1.0E+1; + T t49 = t44-1.0E+4; + T t51 = t46-1.0E+7; + T t48 = atan(t47); + T t52 = atan(t51); + T t50 = t4*t48; + T t54 = t4*t52; + T t53 = t50+1.0/2.0; + T t55 = t54-1.0/2.0; + T t56 = t45*t53; + T t57 = -t55*(t36*(t41-udg13)+1.0E+4); + T t58 = t55*(t36*(t41-udg13)+1.0E+4); + T t59 = t58*-1.0E+3; + T t60 = t56+4.183097800805168E-4; + T t63 = t57-1.999999968169022E+4; + T t61 = t6*t7*t60; + T t64 = t59-1.999999968169022E+7; + T t62 = 1.0/sqrt(t61); + T t65 = atan(t64); + T t66 = t4*t65; + T t67 = t66+1.0/2.0; + T t68 = -t67*(t58+1.999999968169022E+4); + T t69 = t58+t68+1.0E+4; + T t70 = odg2*t5*t62*t69; + T t71 = -t70; + T t73 = t70*1.0E+3; + T t72 = param17+t71; + T t74 = -t73; + T t75 = t9+t74; + T t76 = atan(t75); + T t77 = t4*t76; + T t78 = t77-1.0/2.0; + T t79 = t72*t78; + f[j+npe*0+npe*nce*k] = odg2*param16*t5*(fabs(udg6)/fabs(t35)+sqrt(fabs(t6*t60)/fabs(t3)))*(t79-(t4*atan(param18*-1.0E+3+t79*1.0E+3+3.183097800805168E-1)+1.0/2.0)*(-param18+t79+3.183097800805168E-4)); + } + // std::cout << "end avfield" << std::endl; +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp index 94660035..c62da494 100644 --- a/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp +++ b/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp @@ -10,8 +10,8 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg for (int i = 0; i void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg for (int i = 0; i void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __ for (int i = 0; i void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *ui int j = i%npe; int k = (i-j)/npe; T param1 = param[0]; + T param2 = param[1]; + T param3 = param[2]; + T param4 = param[3]; + T param5 = param[4]; T param15 = param[14]; T param16 = param[15]; T param17 = param[16]; @@ -50,10 +54,10 @@ template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *ui udg4 = udg4*(t1pi*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011e-13; udg5 = udg5*(t1pi*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011e-13; - // int nspecies = 5; - // double rho_scale = uinf[0]; - // double u_scale = uinf[1]; - // double rhoe_scale = uinf[2]; + int nspecies = 5; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; double Ucons[7] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7}; double Ustate[6]; @@ -65,113 +69,180 @@ template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *ui uinf1 = mix->P()/rhoe_scale; // pressure uinf2 = mix->mixtureFrozenGamma(); // gamma - uinf3 = 1.0 / 0.9; // cp / Pr^* + uinf3 = (mix->frozenThermalConductivity() / uinf[5]) / (mix->viscosity() / uinf[4]); // cp / Pr^* + // uinf3 = 0.0; + // uinf3 = 1.0/0.9; + T t2 = udg6*udg6; T t3 = uinf2*2.0; T t4 = uinf2+1.0; T t5 = 1.0/3.141592653589793; T t6 = -param18; - T t7 = 1.0/param15; - T t10 = udg8+udg9+udg10+udg11+udg12; - T t11 = param17*1.0E+12; - T t12 = param18*1.0E+12; - T t13 = udg1*1.0E+12; - T t14 = udg2*1.0E+12; - T t15 = udg3*1.0E+12; - T t16 = udg4*1.0E+12; - T t17 = udg5*1.0E+12; - T t8 = t3-2.0; - T t9 = 1.0/t4; - T t18 = atan(t13); - T t19 = atan(t14); - T t20 = atan(t15); - T t21 = atan(t16); - T t22 = atan(t17); - T t23 = -t12; - T t24 = t5*t18; - T t25 = t5*t19; - T t26 = t5*t20; - T t27 = t5*t21; - T t28 = t5*t22; - T t29 = t24+1.0/2.0; - T t30 = t25+1.0/2.0; - T t31 = t26+1.0/2.0; - T t32 = t27+1.0/2.0; - T t33 = t28+1.0/2.0; - T t34 = t29*udg1; - T t35 = t30*udg2; - T t36 = t31*udg3; - T t37 = t32*udg4; - T t38 = t33*udg5; - T t39 = t34+t35+t36+t37+t38+1.591227150044006E-12; - T t40 = 1.0/t39; - T t41 = t40*t40; - T t42 = t40*udg7; - T t43 = t40*uinf1; - T t45 = t10*t40*udg6; - T t44 = t2*t41; - T t46 = -t45; - T t48 = t42*1.0E+12; - T t49 = t43*1.0E+12; - T t50 = -t40*(t45-udg13); - T t51 = t42+t43-1.0E-4; - T t53 = t40*(t45-udg13)*-1.0E+12; - T t47 = t46+udg13; - T t52 = t50-1.0E+4; - T t54 = t48+t49-1.0E+8; - T t56 = t53-1.0E+16; - T t55 = atan(t54); - T t57 = atan(t56); - T t58 = t5*t55; - T t60 = t5*t57; - T t59 = t58+1.0/2.0; - T t61 = t60-1.0/2.0; - T t62 = t51*t59; - T t63 = -t61*(t40*(t45-udg13)+1.0E+4); - T t64 = t61*(t40*(t45-udg13)+1.0E+4); - T t65 = t64*-1.0E+12; - T t66 = t62+1.000000003182454E-4; - T t68 = t63-2.0E+4; - T t67 = t8*t9*t66; - T t70 = t65-2.0E+16; - T t69 = 1.0/sqrt(t67); - T t71 = atan(t70); - T t74 = t44+t67; - T t72 = t5*t71; - T t75 = sqrt(t74); - T t73 = t72+1.0/2.0; - T t76 = -t73*(t64+2.0E+4); - T t77 = t64+t76+1.0E+4; - T t78 = odg9*t7*t69*t77; - T t79 = -t78; - T t81 = t78*1.0E+12; - T t80 = param17+t79; - T t82 = -t81; - T t83 = t11+t82; - T t84 = atan(t83); - T t85 = t5*t84; + T t7 = 1.0/param1; + T t8 = 1.0/param2; + T t9 = 1.0/param3; + T t10 = 1.0/param4; + T t11 = 1.0/param5; + T t12 = 1.0/param15; + T t15 = udg8+udg9+udg10+udg11+udg12; + T t16 = param17*1.0E+12; + T t17 = param18*1.0E+12; + T t18 = udg1*1.0E+12; + T t19 = udg2*1.0E+12; + T t20 = udg3*1.0E+12; + T t21 = udg4*1.0E+12; + T t22 = udg5*1.0E+12; + T t13 = t3-2.0; + T t14 = 1.0/t4; + T t23 = atan(t18); + T t24 = atan(t19); + T t25 = atan(t20); + T t26 = atan(t21); + T t27 = atan(t22); + T t28 = -t17; + T t29 = t5*t23; + T t30 = t5*t24; + T t31 = t5*t25; + T t32 = t5*t26; + T t33 = t5*t27; + T t34 = t29+1.0/2.0; + T t35 = t30+1.0/2.0; + T t36 = t31+1.0/2.0; + T t37 = t32+1.0/2.0; + T t38 = t33+1.0/2.0; + T t39 = t34*udg1; + T t40 = t35*udg2; + T t41 = t36*udg3; + T t42 = t37*udg4; + T t43 = t38*udg5; + T t44 = t39+3.182454300088011E-13; + T t45 = t40+3.182454300088011E-13; + T t46 = t41+3.182454300088011E-13; + T t47 = t42+3.182454300088011E-13; + T t48 = t43+3.182454300088011E-13; + T t49 = t39+t40+t41+t42+t43+1.591227150044006E-12; + T t50 = 1.0/t49; + T t51 = t50*t50; + T t52 = t50*udg7; + T t53 = t50*uinf1; + T t55 = t15*t50*udg6; + T t60 = t15*t44*t50; + T t61 = t15*t45*t50; + T t62 = t15*t46*t50; + T t63 = t15*t47*t50; + T t64 = t15*t48*t50; + T t54 = t2*t51; + T t56 = -t55; + T t58 = t52*1.0E+12; + T t59 = t53*1.0E+12; + T t65 = -t60; + T t66 = -t61; + T t67 = -t62; + T t68 = -t63; + T t69 = -t64; + T t75 = -t50*(t55-udg13); + T t76 = t52+t53-1.0E-4; + T t78 = t50*(t55-udg13)*-1.0E+12; + T t87 = odg9*t7*t12*t50*(t60-udg8)*(-1.15663130678818E-1); + T t88 = odg9*t8*t12*t50*(t61-udg9)*(-1.15663130678818E-1); + T t89 = odg9*t9*t12*t50*(t62-udg10)*(-1.15663130678818E-1); + T t90 = odg9*t10*t12*t50*(t63-udg11)*(-1.15663130678818E-1); + T t91 = odg9*t11*t12*t50*(t64-udg12)*(-1.15663130678818E-1); + T t97 = odg9*t7*t12*t50*(t60-udg8)*(-1.15663130678818E+11); + T t98 = odg9*t8*t12*t50*(t61-udg9)*(-1.15663130678818E+11); + T t99 = odg9*t9*t12*t50*(t62-udg10)*(-1.15663130678818E+11); + T t100 = odg9*t10*t12*t50*(t63-udg11)*(-1.15663130678818E+11); + T t101 = odg9*t11*t12*t50*(t64-udg12)*(-1.15663130678818E+11); + T t57 = t56+udg13; + T t70 = t65+udg8; + T t71 = t66+udg9; + T t72 = t67+udg10; + T t73 = t68+udg11; + T t74 = t69+udg12; + T t77 = t75-1.0E+4; + T t79 = t58+t59-1.0E+8; + T t81 = t78-1.0E+16; + T t92 = param17+t87; + T t93 = param17+t88; + T t94 = param17+t89; + T t95 = param17+t90; + T t96 = param17+t91; + T t102 = t16+t97; + T t103 = t16+t98; + T t104 = t16+t99; + T t105 = t16+t100; + T t106 = t16+t101; + T t80 = atan(t79); + T t82 = atan(t81); + T t107 = atan(t102); + T t108 = atan(t103); + T t109 = atan(t104); + T t110 = atan(t105); + T t111 = atan(t106); + T t83 = t5*t80; + T t85 = t5*t82; + T t112 = t5*t107; + T t113 = t5*t108; + T t114 = t5*t109; + T t115 = t5*t110; + T t116 = t5*t111; + T t84 = t83+1.0/2.0; T t86 = t85-1.0/2.0; - T t87 = t80*t86; - T t88 = t87*1.0E+12; - T t89 = t6+t87+3.182454300088011E-13; - T t90 = t23+t88+3.182454300088011E-1; - T t91 = atan(t90); - T t92 = t5*t91; - T t93 = t92+1.0/2.0; - T t94 = t89*t93; - T t95 = -t94; - T t96 = t87+t95; - // std::cout << odg9*param16*t7*t39*t75*t96 << std::endl; - - f[j+npe*0+npe*nce*k] = odg9*param16*t7*t39*t75*t96; + T t117 = t112-1.0/2.0; + T t118 = t113-1.0/2.0; + T t119 = t114-1.0/2.0; + T t120 = t115-1.0/2.0; + T t121 = t116-1.0/2.0; + T t122 = t76*t84; + T t123 = -t86*(t50*(t55-udg13)+1.0E+4); + T t124 = t86*(t50*(t55-udg13)+1.0E+4); + T t134 = t92*t117; + T t135 = t93*t118; + T t136 = t94*t119; + T t137 = t95*t120; + T t138 = t96*t121; + T t125 = t124*-1.0E+12; + T t126 = t122+1.000000003182454E-4; + T t128 = t123-2.0E+4; + T t127 = t13*t14*t126; + T t130 = t125-2.0E+16; + T t129 = 1.0/sqrt(t127); + T t131 = atan(t130); + T t139 = t54+t127; + T t132 = t5*t131; + T t140 = sqrt(t139); + T t133 = t132+1.0/2.0; + T t141 = -t133*(t124+2.0E+4); + T t142 = t124+t141+1.0E+4; + T t143 = odg9*t12*t129*t142; + T t144 = -t143; + T t146 = t143*1.0E+12; + T t145 = param17+t144; + T t147 = -t146; + T t148 = t16+t147; + T t149 = atan(t148); + T t150 = t5*t149; + T t151 = t150-1.0/2.0; + T t152 = t145*t151; + T t153 = t152*1.0E+12; + T t154 = t6+t152+3.182454300088011E-13; + T t155 = t28+t153+3.182454300088011E-1; + T t156 = atan(t155); + T t157 = t5*t156; + T t158 = t157+1.0/2.0; + T t159 = t154*t158; + T t160 = -t159; + T t161 = t152+t160; + f[j+npe*0+npe*nce*k] = odg9*param16*t12*t49*t140*t161; f[j+npe*1+npe*nce*k] = 0.0; - f[j+npe*2+npe*nce*k] = odg9*param16*t7*t39*t75*t96*uinf3; - f[j+npe*3+npe*nce*k] = 0.0; - f[j+npe*4+npe*nce*k] = 0.0; - f[j+npe*5+npe*nce*k] = 0.0; - f[j+npe*6+npe*nce*k] = 0.0; - f[j+npe*7+npe*nce*k] = 0.0; + f[j+npe*2+npe*nce*k] = odg9*param16*t12*t49*t140*t161*uinf3; + f[j+npe*3+npe*nce*k] = odg9*param16*t12*t49*t140*(t134-(t5*atan(t28+t134*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t134+3.182454300088011E-13)); + f[j+npe*4+npe*nce*k] = odg9*param16*t12*t49*t140*(t135-(t5*atan(t28+t135*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t135+3.182454300088011E-13)); + f[j+npe*5+npe*nce*k] = odg9*param16*t12*t49*t140*(t136-(t5*atan(t28+t136*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t136+3.182454300088011E-13)); + f[j+npe*6+npe*nce*k] = odg9*param16*t12*t49*t140*(t137-(t5*atan(t28+t137*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t137+3.182454300088011E-13)); + f[j+npe*7+npe*nce*k] = odg9*param16*t12*t49*t140*(t138-(t5*atan(t28+t138*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(t6+t138+3.182454300088011E-13)); + } } diff --git a/Applications/Hypersonics/shocktests/avfieldPhysical1d.m b/Applications/Hypersonics/shocktests/avfieldPhysical1d.m index 4e18cddc..193d37ad 100644 --- a/Applications/Hypersonics/shocktests/avfieldPhysical1d.m +++ b/Applications/Hypersonics/shocktests/avfieldPhysical1d.m @@ -14,6 +14,7 @@ sbmin = 0.0; sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + kD = kb * ones(5,1); % regularization parameters alpha = 1.0e12; rmin = 0.0; @@ -23,30 +24,31 @@ hm = v(4+nspecies); % Get base variables - rvec = u(1:nspecies); - ru = u(nspecies+1); + rho_i = u(1:nspecies); + rhou = u(nspecies+1); % rv = udg(3); - rE = u(nspecies+nd+1); + rhoE = u(nspecies+nd+1); - rx = sum(-q(1:nspecies)); - rux = -q(nspecies+1); + drho_dx_i = -q(1:nspecies); + drho_dx = sum(drho_dx_i); + drhou_dx = -q(nspecies+1); % Regularization - rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here + rho_i = rmin + lmax(rho_i-rmin,alpha); % need to double check regularizatino here % Simple derived working quantities - r = sum(rvec); - r1 = 1./r; - uv = ru.*r1; - E = rE * r1; %energy - H = E + p*r1; %enthalpy + rho = sum(rho_i); + rhoinv = 1./rho; + uv = rhou.*rhoinv; + E = rhoE * rhoinv; %energy + H = E + p*rhoinv; %enthalpy H = Hmin + lmax(H - Hmin, alpha); % Critical speed of Sound c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 % Computing derivatives for the sensors - ux = (rux - rx.*uv).*r1; + ux = (drhou_dx - drho_dx.*uv).*rhoinv; div_v = (ux); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs % limit divergence and vorticity @@ -58,14 +60,24 @@ sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be % Artificial Bulk viscosity - avb = r * (kb.*hm./(porder)) .* sqrt(uv^2 + c_star^2) .* sb; + avb = rho * (kb.*hm./(porder)) .* sqrt(uv^2 + c_star^2) .* sb; % Artificial conductivity avk_T = 0.0; % Triggered by temperature sensor avk_b = avk_b_coeff * avb; % Triggered by bulk viscosity + + % Artificial species diffusion + Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i - Y_i * drho_dx) * rhoinv; + + sY = hm./porder .* dY_dx_i; % divide by free stream Yi's + for i = 1:5 + sY(i) = limiting(sY(i), sbmin, sbmax, alpha, sb0); + end + avY = rho * (kD.*hm./porder) .* sqrt(uv^2 + c_star^2) .* sY % Assign artificial viscosities avField(1) = avb; % bulk avField(2) = 0.0; % shear avField(3) = avk_b + avk_T; % thermal - avField(4:3+nspecies) = 0.0; % species + avField(4:3+nspecies) = avY; % species end diff --git a/Applications/Hypersonics/shocktests/pdeapp.m b/Applications/Hypersonics/shocktests/pdeapp.m index 6309e346..59b4aba0 100644 --- a/Applications/Hypersonics/shocktests/pdeapp.m +++ b/Applications/Hypersonics/shocktests/pdeapp.m @@ -15,7 +15,7 @@ pde.mpiprocs = 1; % number of MPI processors %% Set discretization parameters, physical parameters, and solver parameters -pde.porder = 2; % polynomial degree +pde.porder = 3; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages @@ -24,10 +24,10 @@ % nt = 3240/10; % dt = tfinal/nt; % dt = 10*1e-5; -nt = 10000; +nt = 1000; % nt = 150 % dt = tfinal / nt; -dt = 3.240000000000000e-06; +dt = 3.240000000000000e-06*10; % pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; pde.dt = [dt*ones(1,nt)]; pde.saveSolFreq = ceil(nt/100); @@ -43,6 +43,8 @@ pde.NLiter = 5; pde.RBdim = 5; pde.NLtol = 1e-8; +pde.precMatrixType = 2; +pde.ptcMatrixType = 0; %% Mutation information % Mutation configuration @@ -57,9 +59,9 @@ %% Stabilization and mesh ndim = 1; pde.tau = [5, 5, 5, 5, 5, 5, 5]; -nDiv = 600; +nDiv = 400; [mesh.p,mesh.t] = linemesh(nDiv); -a = 0.2; b = 0.645; +a = 0; b = 1; mesh.p = a + (b-a)*mesh.p; mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries @@ -152,8 +154,8 @@ eval('!cp opuFlux_MPP.cpp opuFlux.cpp'); %X manually switch these eval('!cp opuFbou_MPP.cpp opuFbou.cpp'); %X eval('!cp opuSource_MPP.cpp opuSource.cpp'); %X -% eval('!cp opuOutput_MPP_sensors.cpp opuOutput.cpp'); %X -eval('!cp opuOutput_viscTerms.cpp opuOutput.cpp'); +eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); %X +% eval('!cp opuOutput_viscTerms.cpp opuOutput.cpp'); eval('!cp opuAvfield_MPP.cpp opuAvfield.cpp') %X eval('!cp opuInitu_MPP.cpp opuInitu.cpp') %X % eval('!cp opuUbou_MPP.cpp opuUbou.cpp') diff --git a/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m b/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m index f65f09d8..213728f6 100644 --- a/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m +++ b/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m @@ -24,9 +24,9 @@ % nt = 3240/10; % dt = tfinal/nt; % dt = 10*1e-5; -nt = 10000; +nt = 1000; % dt = tfinal / nt; -dt = 3.240000000000000e-06; +dt = 10*3.240000000000000e-06; % pde.dt = [dt/100*ones(1,nt*10), dt*ones(1,nt*9/10)]; pde.dt = [dt*ones(1,nt)]; pde.saveSolFreq = ceil(nt/100); @@ -39,11 +39,13 @@ % Solver params pde.linearsolveriter = 40; pde.GMRESrestart = 39; -pde.linearsolvertol = 1e-5; +pde.linearsolvertol = 1e-4; pde.matvectol = 1e-7; -pde.NLiter = 5; +pde.NLiter = 3; pde.RBdim = 5; -pde.NLtol = 1e-8; +pde.NLtol = 1e-9; +pde.precMatrixType = 2; +pde.ptcMatrixType = 0; %% Mutation information % Mutation configuration @@ -58,9 +60,9 @@ %% Stabilization and mesh ndim = 1; pde.tau = [5, 5, 5, 5, 5, 5, 5]; -nDiv = 600; +nDiv = 400; [mesh.p,mesh.t] = linemesh(nDiv); -a = 0.2; b = 0.645; +a = 0; b = 1; mesh.p = a + (b-a)*mesh.p; mesh.boundaryexpr = {@(p) abs(p(1,:)-a)<1e-16, @(p) abs(p(1,:) - b)<1e-8}; %TODO: double check boundaries @@ -88,8 +90,8 @@ 0.0 % rhou_R -9783.724551855581 % rhoE_R pde.porder % p for h/p scaling - 1.5 % bulk viscosity scaling parameter - 0.001 % cutoff dilitation + 1.5 % bulk viscosity scaling parameter + 0.02 % cutoff dilitation 2.5 % maximum dilitation 18 Xi_inflow(:) % 19 20 21 22 23 u_inflow % 24 @@ -130,9 +132,9 @@ kappa_ref = 0.028469303787820466; cp_ref = 1010.7825217371519; T_ref = u_ref^2 / cp_ref; -Re = rho_ref * u_ref / mu_ref; -Pr = mu_ref * cp_ref / kappa_ref; - +% Re = rho_ref * u_ref / mu_ref; +% Pr = mu_ref * cp_ref / kappa_ref; +Re = 1; Pr = 1; pde.externalparam = zeros(3*nspecies + 3 + ndim); pde.externalparam(1) = rho_ref; % rho_inf pde.externalparam(2) = u_ref; % u_inf @@ -151,6 +153,9 @@ pde.AV = 1; pde.nco = 10; +[pde,mesh,master,dmd] = preprocessing(pde,mesh); +sol = getsolution(['laplacian_snapshots/out_t' num2str(20)],dmd,master.npe); +mesh.udg = sol; %% Call Exasim % search compilers and set options pde = setcompilers(pde); @@ -166,9 +171,11 @@ eval('!cp opuFlux_MPP_PB.cpp opuFlux.cpp'); %X manually switch these eval('!cp opuFbou_MPP_PB.cpp opuFbou.cpp'); %X eval('!cp opuSource_MPP.cpp opuSource.cpp'); %X -eval('!cp opuOutput_MPP_sensors_PB.cpp opuOutput.cpp'); %X +% eval('!cp opuOutput_MPP_sensors_PB.cpp opuOutput.cpp'); %X +eval('!cp opuOutput_MPP.cpp opuOutput.cpp'); %X eval('!cp opuAvfield_MPP_PB.cpp opuAvfield.cpp') %X -% eval('!cp opuInitu_MPP.cpp opuInitu.cpp') %X +% eval('!cp opuAvfield_MPP_PB_Dsensors.cpp opuAvfield.cpp') %X +eval('!cp opuInitu_MPP.cpp opuInitu.cpp') %X % eval('!cp opuUbou_MPP.cpp opuUbou.cpp') cd(".."); diff --git a/Applications/Hypersonics/shocktests/pdemodel.m b/Applications/Hypersonics/shocktests/pdemodel.m index 57434b82..3651d840 100644 --- a/Applications/Hypersonics/shocktests/pdemodel.m +++ b/Applications/Hypersonics/shocktests/pdemodel.m @@ -6,7 +6,7 @@ pde.fbou = @fbou; pde.ubou = @ubou; pde.initu = @initu; - pde.output = @output; +% pde.output = @output; pde.avfield = @avfield; end diff --git a/Applications/Hypersonics/shocktests/plotting_scitech.m b/Applications/Hypersonics/shocktests/plotting_scitech.m new file mode 100644 index 00000000..696659b6 --- /dev/null +++ b/Applications/Hypersonics/shocktests/plotting_scitech.m @@ -0,0 +1,321 @@ +%% laplacian +ttst = 0.96 * length(pde.dt); +solLa = getsolution(['laplacian_snapshots/out_t' num2str(ttst)],dmd,master.npe); +solLa_output = getsolution(['laplacian_snapshots/out_outputCG_t' num2str(ttst)],dmd,master.npe); + +solPb1_5 = getsolution(['PB_snapshots_av15/out_t' num2str(ttst-20)],dmd,master.npe); +solPb1_5_output = getsolution(['PB_snapshots_av15/out_outputCG_t' num2str(ttst-20)],dmd,master.npe); + +solPb10 = getsolution(['PB_snapshots/out_t' num2str(ttst-20)],dmd,master.npe); +solPb10_output = getsolution(['PB_snapshots/out_outputCG_t' num2str(ttst-20)],dmd,master.npe); +% +solPbDi = getsolution(['PB_Di_snapshots/out_t' num2str(ttst-20)],dmd,master.npe); +solPbDi_output = getsolution(['PB_Di_snapshots/out_outputCG_t' num2str(ttst-20)],dmd,master.npe); +htr_out + +%% Plot Lap +figure(10) +rhoLa = sum(solLa(:,1:5,:),2); +rhouLa = solLa(:,6,:); + +pLa = solLa_output(:,1,:); + +figure(13); hold on +rho1La = solLa(:,1,:); +rho2La = solLa(:,2,:); +rho3La = solLa(:,3,:); +rho4La = solLa(:,4,:); +rho5La = solLa(:,5,:); +plot(dgnodes(:),rho1La(:)./rhoLa(:),'LineWidth',1.3); +plot(dgnodes(:),rho2La(:)./rhoLa(:),'LineWidth',1.3); +plot(dgnodes(:),rho3La(:)./rhoLa(:),'LineWidth',1.3); +plot(dgnodes(:),rho4La(:)./rhoLa(:),'LineWidth',1.3); +plot(dgnodes(:),rho5La(:)./rhoLa(:),'LineWidth',1.3); +title("Species Mass Fractions"); +grid on +legend(["Y_N" "Y_O" "Y_{NO}" "Y_{N2}" "Y_{O2}"]) + +figure(14); +subplot(1,3,1); hold on +plot(dgnodes(:),rhoLa(:)*pde.externalparam(1),'LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)*pde.externalparam(1)) +xlim([0 1]) +ylabel("\rho (kg / m^3)") +% title("Density") +legend(["p=3 sol", "reference sol"]) +grid on + +subplot(1,3,2); hold on +plot(dgnodes(:),rhouLa(:)./rhoLa(:),'LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2)) +xlim([0 1]) +ylabel("u (m/s)") +% title("Velocity") +grid on + +subplot(1,3,3); hold on +plot(dgnodes(:),pLa(:),'LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4) +xlim([0 1]) +grid on +% title("Pressure") +ylabel("p (Pa)") + +%% Plot PB 15 +figure(100) +rhoPb1_5 = sum(solPb1_5(:,1:5,:),2); +rhouPb1_5 = solPb1_5(:,6,:); + +pPb1_5 = solPb1_5_output(:,1,:); + +figure(130); hold on +rho1Pb1_5 = solPb1_5(:,1,:); +rho2Pb1_5 = solPb1_5(:,2,:); +rho3Pb1_5 = solPb1_5(:,3,:); +rho4Pb1_5 = solPb1_5(:,4,:); +rho5Pb1_5 = solPb1_5(:,5,:); +plot(dgnodes(:),rho1Pb1_5(:)./rhoPb1_5(:),'LineWidth',1.3); +plot(dgnodes(:),rho2Pb1_5(:)./rhoPb1_5(:),'LineWidth',1.3); +plot(dgnodes(:),rho3Pb1_5(:)./rhoPb1_5(:),'LineWidth',1.3); +plot(dgnodes(:),rho4Pb1_5(:)./rhoPb1_5(:),'LineWidth',1.3); +plot(dgnodes(:),rho5Pb1_5(:)./rhoPb1_5(:),'LineWidth',1.3); +title("Species Mass Fractions"); +grid on +legend(["Y_N" "Y_O" "Y_{NO}" "Y_{N2}" "Y_{O2}"]) + +figure(140); +subplot(1,3,1); hold on +plot(dgnodes(:),rhoPb1_5(:)*pde.externalparam(1),'LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)*pde.externalparam(1)) +xlim([0 1]) +ylabel("\rho (kg / m^3)") +% title("Density") +legend(["p=3 sol", "reference sol"]) +grid on + +subplot(1,3,2); hold on +plot(dgnodes(:),rhouPb1_5(:)./rhoPb1_5(:),'LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2)) +xlim([0 1]) +ylabel("u (m/s)") +% title("Velocity") +grid on + +subplot(1,3,3); hold on +plot(dgnodes(:),pPb1_5(:),'LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4) +xlim([0 1]) +grid on +% title("Pressure") +ylabel("p (Pa)") + +%% Plot PB 10 +figure(1000) +rhoPb10 = sum(solPb10(:,1:5,:),2); +rhouPb10 = solPb10(:,6,:); + +pPb10 = solPb10_output(:,1,:); + +figure(1300); hold on +rho1Pb10 = solPb10(:,1,:); +rho2Pb10 = solPb10(:,2,:); +rho3Pb10 = solPb10(:,3,:); +rho4Pb10 = solPb10(:,4,:); +rho5Pb10 = solPb10(:,5,:); +plot(dgnodes(:),rho1Pb10(:)./rhoPb10(:),'LineWidth',1.3); +plot(dgnodes(:),rho2Pb10(:)./rhoPb10(:),'LineWidth',1.3); +plot(dgnodes(:),rho3Pb10(:)./rhoPb10(:),'LineWidth',1.3); +plot(dgnodes(:),rho4Pb10(:)./rhoPb10(:),'LineWidth',1.3); +plot(dgnodes(:),rho5Pb10(:)./rhoPb10(:),'LineWidth',1.3); +title("Species Mass Fractions"); +grid on +legend(["Y_N" "Y_O" "Y_{NO}" "Y_{N2}" "Y_{O2}"]) + +figure(1400); +subplot(1,3,1); hold on +plot(dgnodes(:),rhoPb10(:)*pde.externalparam(1),'LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)*pde.externalparam(1)) +xlim([0.2 0.7]) +ylabel("\rho (kg / m^3)") +% title("Density") +legend(["p=3 sol", "reference sol"]) +grid on + +subplot(1,3,2); hold on +plot(dgnodes(:),rhouPb10(:)./rhoPb10(:),'LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2)) +xlim([0.2 0.7]) +ylabel("u (m/s)") +% title("Velocity") +grid on + +subplot(1,3,3); hold on +plot(dgnodes(:),pPb10(:),'LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4) +xlim([0.2 0.7]) +grid on +% title("Pressure") +ylabel("p (Pa)") + +%% Plot PB 10 +figure(10000) +rhoPbDi = sum(solPbDi(:,1:5,:),2); +rhouPbDi = solPbDi(:,6,:); + +pPbDi = solPbDi_output(:,1,:); + +figure(13000); hold on +rho1PbDi = solPbDi(:,1,:); +rho2PbDi = solPbDi(:,2,:); +rho3PbDi = solPbDi(:,3,:); +rho4PbDi = solPbDi(:,4,:); +rho5PbDi = solPbDi(:,5,:); +plot(dgnodes(:),rho1PbDi(:)./rhoPbDi(:),'LineWidth',1.3); +plot(dgnodes(:),rho2PbDi(:)./rhoPbDi(:),'LineWidth',1.3); +plot(dgnodes(:),rho3PbDi(:)./rhoPbDi(:),'LineWidth',1.3); +plot(dgnodes(:),rho4PbDi(:)./rhoPbDi(:),'LineWidth',1.3); +plot(dgnodes(:),rho5PbDi(:)./rhoPbDi(:),'LineWidth',1.3); +title("Species Mass Fractions"); +grid on +legend(["Y_N" "Y_O" "Y_{NO}" "Y_{N2}" "Y_{O2}"]) + +figure(1400); +subplot(1,3,1); hold on +plot(dgnodes(:),rhoPbDi(:)*pde.externalparam(1),'--r','LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)*pde.externalparam(1)) +% xlim([0 1]) +ylabel("\rho (kg / m^3)") +% title("Density") +legend(["p=3 sol", "reference sol"]) +grid on + +subplot(1,3,2); hold on +plot(dgnodes(:),rhouPbDi(:)./rhoPbDi(:),'--r','LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2)) +% xlim([0 1]) +ylabel("u (m/s)") +% title("Velocity") +grid on + +subplot(1,3,3); hold on +plot(dgnodes(:),pPbDi(:),'--r','LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4) +% xlim([0 1]) +grid on +% title("Pressure") +ylabel("p (Pa)") + + +%% misc + +figure(15) +subplot(1,2,1); +plot(dgnodes(:),rhouPb1_5(:)./rhoPb1_5(:),'LineWidth',1.3); +xlim([0 1]) +grid on +ylabel("u (m/s)") +title("k_{\beta} = 1.5") +subplot(1,2,2) +plot(dgnodes(:),rhouPb10(:)./rhoPb10(:),'LineWidth',1.3); +xlim([0 1]) +grid on +title("k_{\beta} = 10") +ylabel("u (m/s)") + + +figure(16); +subplot(1,3,1); +plot(dgnodes(:),rho2La(:)./rhoLa(:),'LineWidth',1.3); +% xlim([0.25 0.75]) +grid on +ylabel("Y_{O}") +ylim([0 0.33]) +subplot(1,3,2); +plot(dgnodes(:),rho2Pb10(:)./rhoPb10(:),'LineWidth',1.3); +ylim([0 0.33]) +ylabel("Y_{O}") + +grid on +% xlim([0.25 0.75]) +subplot(1,3,3); +plot(dgnodes(:),rho2PbDi(:)./rhoPbDi(:),'LineWidth',1.3); +ylim([0 0.33]) +ylabel("Y_{O}") + +grid on +% xlim([0.25 0.75]) + +figure(17); +subplot(1,3,1); +plot(dgnodes(:),rho3La(:)./rhoLa(:),'LineWidth',1.3); +% xlim([0.25 0.75]) +grid on +ylim([0 0.05]) +ylabel("Y_{NO}") +subplot(1,3,2); +plot(dgnodes(:),rho3Pb10(:)./rhoPb10(:),'LineWidth',1.3); +ylim([0 0.05]) +ylabel("Y_{NO}") +grid on +% xlim([0.25 0.75]) +subplot(1,3,3); +plot(dgnodes(:),rho3PbDi(:)./rhoPbDi(:),'LineWidth',1.3); +ylim([0 0.05]) +ylabel("Y_{NO}") +grid on + +%% +figure(19); +Atmp = get(gca,'colororder'); +subplot(1,3,1); hold on +plot(dgnodes(:),rhoPb10(:)*pde.externalparam(1),'LineWidth',1.3); +plot(dgnodes(:),rhoPbDi(:)*pde.externalparam(1),'--r','LineWidth',1.3); +scatter(rhoTrue(:,1), rhoTrue(:,2)*pde.externalparam(1),'MarkerEdgeColor', Atmp(2,:)) +xlim([0.2 0.7]) +ylabel("\rho (kg / m^3)") +% title("Density") +legend(["AV \beta^*", "AV \beta^*, D_i^*","reference sol"]) +grid on + +subplot(1,3,2); hold on +plot(dgnodes(:),rhouPb10(:)./rhoPb10(:),'LineWidth',1.3); +plot(dgnodes(:),rhouPbDi(:)./rhoPbDi(:),'--r','LineWidth',1.3); +scatter(uTrue(:,1), uTrue(:,2),'MarkerEdgeColor', Atmp(2,:)) +xlim([0.2 0.7]) +ylabel("u (m/s)") +% title("Velocity") +grid on + +subplot(1,3,3); hold on +plot(dgnodes(:),pPb10(:),'LineWidth',1.3); +plot(dgnodes(:),pPbDi(:),'--r','LineWidth',1.3); +scatter(pTrue(:,1), pTrue(:,2)*1e4,'MarkerEdgeColor', Atmp(2,:)) +xlim([0.2 0.7]) +grid on +% title("Pressure") +ylabel("p (Pa)") +% +% subplot(1,3,1); hold on +% plot(dgnodes(:),rhoPbDi(:)*pde.externalparam(1),'--r','LineWidth',1.3); +% scatter(rhoTrue(:,1), rhoTrue(:,2)*pde.externalparam(1)) +% % xlim([0 1]) +% ylabel("\rho (kg / m^3)") +% % title("Density") +% legend(["p=3 sol", "reference sol"]) +% grid on + +% subplot(1,3,2); hold on +% plot(dgnodes(:),rhouPbDi(:)./rhoPbDi(:),'--r','LineWidth',1.3); +% scatter(uTrue(:,1), uTrue(:,2)) +% % xlim([0 1]) +% ylabel("u (m/s)") +% % title("Velocity") +% grid on +% +% subplot(1,3,3); hold on +% plot(dgnodes(:),pPbDi(:),'--r','LineWidth',1.3); +% scatter(pTrue(:,1), pTrue(:,2)*1e4) +% % xlim([0 1]) +% grid on +% % title("Pressure") +% ylabel("p (Pa)") From 91c0edd0135ed2e09b67a2a399dddf5bba1d7c14 Mon Sep 17 00:00:00 2001 From: rloekvh Date: Tue, 13 Dec 2022 11:53:52 -0500 Subject: [PATCH 23/23] reacting cylinder cases --- .../ReactingCylinder/app/fixargsMPP_Mac.sh | 6 + .../app/opuAvfield_2d_MPP.cpp | 331 ++-- .../app/opuAvfield_2d_MPP_ducros.cpp | 189 ++ .../app/opuAvfield_2d_PB_MPP.cpp | 210 +++ .../app/opuAvfield_2d_PB_MPP_2.cpp | 157 ++ .../app/opuAvfield_2d_PB_MPP_2_ducros.cpp | 187 ++ .../app/opuAvfield_2d_PB_MPP_noducros.cpp | 180 ++ .../app/opuAvfield_noducros.cpp | 202 ++ .../ReactingCylinder/app/opuAvfield_noreg.cpp | 191 ++ .../ReactingCylinder/app/opuFbou_2d_MPP.cpp | 1620 ++++++++++------- .../app/opuFbou_2d_PB_MPP.cpp | 928 ++++++++++ .../app/opuFbou_2d_PB_MPP_2.cpp | 865 +++++++++ .../app/opuFbou_2d_PB_MPP_2_manual.cpp | 780 ++++++++ .../app/opuFbou_2d_inviscid_MPP.cpp | 333 ++++ .../app/opuFbou_2d_visc_MPP.cpp | 905 +++++++++ .../app/opuFlux_2d_La_MPP_manual.cpp | 210 +++ .../ReactingCylinder/app/opuFlux_2d_MPP.cpp | 641 ++++--- .../app/opuFlux_2d_PB_MPP.cpp | 350 ++++ .../app/opuFlux_2d_PB_MPP_2.cpp | 331 ++++ .../app/opuFlux_2d_PB_MPP_2_manual.cpp | 380 ++++ .../app/opuFlux_2d_visc_MPP.cpp | 342 ++++ .../ReactingCylinder/app/opuOutput_2d_MPP.cpp | 3 +- .../app/opuOutput_2d_PB_MPP.cpp | 215 +++ .../app/opuOutput_2d_PB_MPP_2.cpp | 214 +++ .../ReactingCylinder/app/opuSource_2d_MPP.cpp | 13 +- .../app/opuSource_2d_MPP_2.cpp | 52 + .../app_inv_pb_regen/opuApp.cpp | 238 +++ .../app_inv_pb_regen/opuApp_MPP.cpp | 238 +++ .../app_inv_pb_regen/opuAvfield.cpp | 234 +++ .../app_inv_pb_regen/opuAvfield_noducros.cpp | 203 +++ .../app_inv_pb_regen/opuFbou.cpp | 480 +++++ .../app_inv_pb_regen/opuFbou_jordi.cpp | 480 +++++ .../app_inv_pb_regen/opuFhat.cpp | 6 + .../app_inv_pb_regen/opuFlux.cpp | 222 +++ .../app_inv_pb_regen/opuInitodg.cpp | 6 + .../app_inv_pb_regen/opuInitq.cpp | 6 + .../app_inv_pb_regen/opuInitu.cpp | 33 + .../app_inv_pb_regen/opuInitudg.cpp | 6 + .../app_inv_pb_regen/opuInitwdg.cpp | 6 + .../app_inv_pb_regen/opuOutput.cpp | 175 ++ .../app_inv_pb_regen/opuSource.cpp | 52 + .../app_inv_pb_regen/opuSourcew.cpp | 6 + .../app_inv_pb_regen/opuStab.cpp | 6 + .../app_inv_pb_regen/opuTdfunc.cpp | 16 + .../app_inv_pb_regen/opuUbou.cpp | 88 + .../app_inv_pb_regen/opuUbou_jordi.cpp | 88 + .../app_inv_pb_regen/opuUhat.cpp | 6 + .../app_visc_la_regen/opuApp.cpp | 238 +++ .../app_visc_la_regen/opuAvfield.cpp | 168 ++ .../app_visc_la_regen/opuFbou.cpp | 844 +++++++++ .../app_visc_la_regen/opuFhat.cpp | 6 + .../app_visc_la_regen/opuFlux.cpp | 320 ++++ .../app_visc_la_regen/opuInitodg.cpp | 6 + .../app_visc_la_regen/opuInitq.cpp | 6 + .../app_visc_la_regen/opuInitu.cpp | 33 + .../app_visc_la_regen/opuInitudg.cpp | 6 + .../app_visc_la_regen/opuInitwdg.cpp | 6 + .../app_visc_la_regen/opuOutput.cpp | 82 + .../app_visc_la_regen/opuSource.cpp | 68 + .../app_visc_la_regen/opuSourcew.cpp | 6 + .../app_visc_la_regen/opuStab.cpp | 6 + .../app_visc_la_regen/opuTdfunc.cpp | 16 + .../app_visc_la_regen/opuUbou.cpp | 81 + .../app_visc_la_regen/opuUhat.cpp | 6 + .../app_visc_pb_Di_regen/opuApp.cpp | 238 +++ .../app_visc_pb_Di_regen/opuAvfield.cpp | 373 ++++ .../app_visc_pb_Di_regen/opuFbou.cpp | 897 +++++++++ .../app_visc_pb_Di_regen/opuFhat.cpp | 6 + .../app_visc_pb_Di_regen/opuFlux.cpp | 344 ++++ .../app_visc_pb_Di_regen/opuInitodg.cpp | 6 + .../app_visc_pb_Di_regen/opuInitq.cpp | 6 + .../app_visc_pb_Di_regen/opuInitu.cpp | 33 + .../app_visc_pb_Di_regen/opuInitudg.cpp | 6 + .../app_visc_pb_Di_regen/opuInitwdg.cpp | 6 + .../app_visc_pb_Di_regen/opuOutput.cpp | 87 + .../app_visc_pb_Di_regen/opuSource.cpp | 67 + .../app_visc_pb_Di_regen/opuSourcew.cpp | 6 + .../app_visc_pb_Di_regen/opuStab.cpp | 6 + .../app_visc_pb_Di_regen/opuTdfunc.cpp | 16 + .../app_visc_pb_Di_regen/opuUbou.cpp | 81 + .../app_visc_pb_Di_regen/opuUhat.cpp | 6 + .../app_visc_pb_regen/opuApp.cpp | 238 +++ .../app_visc_pb_regen/opuApp_MPP.cpp | 238 +++ .../app_visc_pb_regen/opuAvfield.cpp | 233 +++ .../app_visc_pb_regen/opuAvfield_noducros.cpp | 202 ++ .../app_visc_pb_regen/opuAvfield_noreg.cpp | 191 ++ .../app_visc_pb_regen/opuFbou.cpp | 877 +++++++++ .../app_visc_pb_regen/opuFhat.cpp | 6 + .../app_visc_pb_regen/opuFlux.cpp | 334 ++++ .../app_visc_pb_regen/opuInitodg.cpp | 6 + .../app_visc_pb_regen/opuInitq.cpp | 6 + .../app_visc_pb_regen/opuInitu.cpp | 33 + .../app_visc_pb_regen/opuInitu_MPP.cpp | 51 + .../app_visc_pb_regen/opuInitudg.cpp | 6 + .../app_visc_pb_regen/opuInitwdg.cpp | 6 + .../app_visc_pb_regen/opuOutput.cpp | 81 + .../app_visc_pb_regen/opuSource.cpp | 72 + .../app_visc_pb_regen/opuSourcew.cpp | 6 + .../app_visc_pb_regen/opuStab.cpp | 6 + .../app_visc_pb_regen/opuTdfunc.cpp | 16 + .../app_visc_pb_regen/opuUbou.cpp | 81 + .../app_visc_pb_regen/opuUhat.cpp | 6 + .../ReactingCylinder/avfieldLaplacian2d.m | 31 +- .../ReactingCylinder/avfieldPhysical2d.m | 90 + .../ReactingCylinder/avfieldPhysical2d_Di.m | 97 + .../ReactingCylinder/avfieldPhysical2d_new.m | 86 + .../ReactingCylinder/getStates2d.py | 4 +- .../ReactingCylinder/mkmesh_uniform.m | 124 ++ .../ReactingCylinder/pdeapp_cylinder.m | 93 +- .../pdeapp_cylinder_Ma5_inv.m | 214 +++ .../ReactingCylinder/pdeapp_cylinder_PB_new.m | 204 +++ .../pdeapp_cylinder_visc_La.m | 197 ++ .../pdeapp_cylinder_visc_PB.m | 204 +++ .../pdeapp_cylinder_visc_PB_Di.m | 202 ++ .../ReactingCylinder/pdemodel_2d.m | 93 +- .../ReactingCylinder/pdemodel_2d_PB_new.m | 364 ++++ .../ReactingCylinder/pdemodel_inviscid.m | 223 +++ .../ReactingCylinder/pdemodel_visc_la.m | 319 ++++ .../ReactingCylinder/pdemodel_visc_pb.m | 286 +++ .../ReactingCylinder/pdemodel_visc_pb_di.m | 287 +++ .../Hypersonics/ReactingCylinder/plotsol.m | 53 +- .../Hypersonics/ReactingCylinder/plotsol2.m | 144 ++ .../Hypersonics/ReactingCylinder/plotsol_2.m | 284 +++ .../Hypersonics/ReactingCylinder/plotsol_3.m | 181 ++ .../Hypersonics/ReactingCylinder/plotsol_dT.m | 134 ++ 125 files changed, 21961 insertions(+), 1160 deletions(-) create mode 100755 Applications/Hypersonics/ReactingCylinder/app/fixargsMPP_Mac.sh create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP_ducros.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2_ducros.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_noducros.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noducros.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noreg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2_manual.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_inviscid_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_visc_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_La_MPP_manual.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2_manual.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_visc_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP_2.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP_2.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield_noducros.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou_jordi.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFlux.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitodg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitq.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitu.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitudg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitwdg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuOutput.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSource.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSourcew.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuStab.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuTdfunc.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUbou_jordi.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuApp.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuAvfield.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFlux.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitodg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitq.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitu.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitudg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitwdg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuOutput.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSource.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSourcew.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuStab.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuTdfunc.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuUbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuUhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuApp.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuAvfield.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFlux.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitodg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitq.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitu.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitudg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitwdg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuOutput.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSource.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSourcew.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuStab.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuTdfunc.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuUbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuUhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noducros.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noreg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFlux.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitodg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitq.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitu.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitu_MPP.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitudg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitwdg.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuOutput.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSource.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSourcew.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuStab.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuTdfunc.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuUbou.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuUhat.cpp create mode 100644 Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d.m create mode 100644 Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_Di.m create mode 100644 Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_new.m create mode 100644 Applications/Hypersonics/ReactingCylinder/mkmesh_uniform.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_Ma5_inv.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_PB_new.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_La.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB_Di.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdemodel_2d_PB_new.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdemodel_inviscid.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdemodel_visc_la.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb.m create mode 100644 Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb_di.m create mode 100644 Applications/Hypersonics/ReactingCylinder/plotsol2.m create mode 100644 Applications/Hypersonics/ReactingCylinder/plotsol_2.m create mode 100644 Applications/Hypersonics/ReactingCylinder/plotsol_3.m create mode 100644 Applications/Hypersonics/ReactingCylinder/plotsol_dT.m diff --git a/Applications/Hypersonics/ReactingCylinder/app/fixargsMPP_Mac.sh b/Applications/Hypersonics/ReactingCylinder/app/fixargsMPP_Mac.sh new file mode 100755 index 00000000..91968410 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/fixargsMPP_Mac.sh @@ -0,0 +1,6 @@ +#!/bin/bash +sed -i '' 's/int ncw)/int ncw, Mutation::Mixture *mix)/g' opu*.cpp +sed -i '' 's/int ne)/int ne, Mutation::Mixture *mix)/g' opu*.cpp +sed -i '' 's/, ncw)/, ncw, mix)/g' opu*.cpp +sed -i '' 's/, ne)/, ne, mix)/g' opu*.cpp +sed -i '' 's/int)/int, Mutation::Mixture *)/g' opu*.cpp \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp index d6144220..80dac622 100644 --- a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp @@ -65,133 +65,220 @@ template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *u mix->setState(rhovec, &rhoe, 0); uinf1 = mix->P() / rhoe_scale; uinf2 = mix->mixtureFrozenGamma(); - - T t2 = udg1*udg1; - T t3 = udg2*udg2; - T t4 = udg3*udg3; - T t5 = udg4*udg4; - T t6 = udg5*udg5; - T t7 = uinf2*2.0; - T t8 = uinf2+1.0; - T t9 = 1.0/3.141592653589793; - T t10 = 1.0/param15; - T t13 = param17*1.0E+12; - T t14 = udg1*1.0E+12; - T t15 = udg2*1.0E+12; - T t16 = udg3*1.0E+12; - T t17 = udg4*1.0E+12; - T t18 = udg5*1.0E+12; - T t11 = t7-2.0; - T t12 = 1.0/t8; +// uinf2 = 1.4; + T t2 = uinf2*2.0; + T t3 = uinf2+1.0; + T t4 = 1.0/3.141592653589793; + T t5 = 1.0/param15; + T t8 = udg9+udg10+udg11+udg12+udg13; + T t9 = udg17+udg18+udg19+udg20+udg21; + T t10 = param17*1.0E+12; + T t11 = udg1*1.0E+12; + T t12 = udg2*1.0E+12; + T t13 = udg3*1.0E+12; + T t14 = udg4*1.0E+12; + T t15 = udg5*1.0E+12; + T t6 = t2-2.0; + T t7 = 1.0/t3; + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); T t19 = atan(t14); T t20 = atan(t15); - T t21 = atan(t16); - T t22 = atan(t17); - T t23 = atan(t18); - T t39 = t2*1.0E+24; - T t40 = t3*1.0E+24; - T t41 = t4*1.0E+24; - T t42 = t5*1.0E+24; - T t43 = t6*1.0E+24; - T t24 = t9*t19; - T t25 = t9*t20; - T t26 = t9*t21; - T t27 = t9*t22; - T t28 = t9*t23; - T t44 = t39+1.0; - T t45 = t40+1.0; - T t46 = t41+1.0; - T t47 = t42+1.0; - T t48 = t43+1.0; + T t21 = t4*t16; + T t22 = t4*t17; + T t23 = t4*t18; + T t24 = t4*t19; + T t25 = t4*t20; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; T t29 = t24+1.0/2.0; T t30 = t25+1.0/2.0; - T t31 = t26+1.0/2.0; - T t32 = t27+1.0/2.0; - T t33 = t28+1.0/2.0; - T t49 = 1.0/t44; - T t50 = 1.0/t45; - T t51 = 1.0/t46; - T t52 = 1.0/t47; - T t53 = 1.0/t48; - T t34 = t29*udg1; - T t35 = t30*udg2; - T t36 = t31*udg3; - T t37 = t32*udg4; - T t38 = t33*udg5; - T t54 = t9*t14*t49; - T t55 = t9*t15*t50; - T t56 = t9*t16*t51; - T t57 = t9*t17*t52; - T t58 = t9*t18*t53; - T t59 = t29+t54; - T t60 = t30+t55; - T t61 = t31+t56; - T t62 = t32+t57; - T t63 = t33+t58; - T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; - T t64 = t59*udg9; - T t65 = t60*udg10; - T t66 = t61*udg11; - T t67 = t59*udg17; - T t68 = t62*udg12; - T t69 = t60*udg18; - T t70 = t63*udg13; - T t71 = t61*udg19; - T t72 = t62*udg20; - T t73 = t63*udg21; - T t75 = 1.0/t74; - T t76 = t75*t75; - T t77 = t75*udg8; - T t78 = t75*uinf1; - T t86 = t64+t65+t66+t68+t70; - T t87 = t67+t69+t71+t72+t73; - T t79 = t77*1.0E+12; - T t80 = t78*1.0E+12; - T t81 = t77+t78-1.0E-4; - T t88 = t75*t86*udg6; - T t89 = t75*t87*udg7; - T t82 = t79+t80-1.0E+8; - T t90 = -t88; - T t91 = -t89; - T t95 = -t75*(t88-udg14); - T t96 = -t75*(t89-udg23); - T t97 = t75*(t88-udg14)*-1.0E+12; - T t98 = t75*(t89-udg23)*-1.0E+12; + T t31 = t26*udg1; + T t32 = t27*udg2; + T t33 = t28*udg3; + T t34 = t29*udg4; + T t35 = t30*udg5; + T t36 = t31+t32+t33+t34+t35+1.591227150044006E-12; + T t37 = 1.0/t36; + T t38 = t37*t37; + T t39 = t37*udg8; + T t40 = t37*uinf1; + T t41 = t8*t37*udg6; + T t42 = t9*t37*udg7; + T t43 = -t41; + T t44 = -t42; + T t47 = t39*1.0E+12; + T t48 = t40*1.0E+12; + T t49 = -t37*(t41-udg14); + T t50 = -t37*(t42-udg23); + T t51 = t39+t40-1.0E-4; + T t52 = t37*(t41-udg14)*-1.0E+12; + T t53 = t37*(t42-udg23)*-1.0E+12; + T t45 = t43+udg14; + T t46 = t44+udg23; + T t54 = t47+t48-1.0E+8; + T t58 = t49+t50-1.0E+4; + T t60 = t52+t53-1.0E+16; + T t55 = atan(t54); + T t61 = atan(t60); + T t56 = t4*t55; + T t62 = t4*t61; + T t57 = t56+1.0/2.0; + T t63 = t62-1.0/2.0; + T t59 = t51*t57; + T t67 = -t63*(t37*(t41-udg14)+t37*(t42-udg23)+1.0E+4); + T t68 = t63*(t37*(t41-udg14)+t37*(t42-udg23)+1.0E+4); + T t64 = t59+1.000000003182454E-4; + T t69 = t68*-1.0E+12; + T t70 = t67-2.0E+4; + T t65 = t6*t7*t64; + T t71 = t69-2.0E+16; + T t66 = 1.0/sqrt(t65); + T t72 = atan(t71); + T t73 = t4*t72; + T t74 = t73+1.0/2.0; + T t75 = -t74*(t68+2.0E+4); + T t76 = t68+t75+1.0E+4; + T t77 = odg2*t5*t66*t76; + T t78 = -t77; + T t80 = t77*1.0E+12; + T t79 = param17+t78; + T t81 = -t80; + T t82 = t10+t81; T t83 = atan(t82); - T t92 = t90+udg14; - T t93 = t91+udg23; - T t102 = t95+t96-1.0E+4; - T t103 = t97+t98-1.0E+16; - T t84 = t9*t83; - T t104 = atan(t103); - T t85 = t84+1.0/2.0; - T t105 = t9*t104; - T t94 = t81*t85; - T t106 = t105-1.0/2.0; - T t99 = t94+1.000000003182454E-4; - T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); - T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); - T t100 = t11*t12*t99; - T t109 = t108*-1.0E+12; - T t110 = t107-2.0E+4; - T t101 = 1.0/sqrt(t100); - T t111 = t109-2.0E+16; - T t112 = atan(t111); - T t113 = t9*t112; - T t114 = t113+1.0/2.0; - T t115 = -t114*(t108+2.0E+4); - T t116 = t108+t115+1.0E+4; - T t117 = odg2*t10*t101*t116; - T t118 = -t117; - T t120 = t117*1.0E+12; - T t119 = param17+t118; - T t121 = -t120; - T t122 = t13+t121; - T t123 = atan(t122); - T t124 = t9*t123; - T t125 = t124-1.0/2.0; - T t126 = t119*t125; - f[j+npe*0+npe*nce*k] = odg2*param16*t10*(sqrt(t76*(udg6*udg6)+t76*(udg7*udg7))+1.0/t101)*(t126-(t9*atan(param18*-1.0E+12+t126*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t126+3.182454300088011E-13)); + T t84 = t4*t83; + T t85 = t84-1.0/2.0; + T t86 = t79*t85; + f[j+npe*0+npe*nce*k] = odg2*param16*t5*(sqrt(t38*(udg6*udg6)+t38*(udg7*udg7))+1.0/t66)*(t86-(t4*atan(param18*-1.0E+12+t86*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t86+3.182454300088011E-13)); + + // T t2 = udg1*udg1; + // T t3 = udg2*udg2; + // T t4 = udg3*udg3; + // T t5 = udg4*udg4; + // T t6 = udg5*udg5; + // T t7 = uinf2*2.0; + // T t8 = uinf2+1.0; + // T t9 = 1.0/3.141592653589793; + // T t10 = 1.0/param15; + // T t13 = param17*1.0E+12; + // T t14 = udg1*1.0E+12; + // T t15 = udg2*1.0E+12; + // T t16 = udg3*1.0E+12; + // T t17 = udg4*1.0E+12; + // T t18 = udg5*1.0E+12; + // T t11 = t7-2.0; + // T t12 = 1.0/t8; + // T t19 = atan(t14); + // T t20 = atan(t15); + // T t21 = atan(t16); + // T t22 = atan(t17); + // T t23 = atan(t18); + // T t39 = t2*1.0E+24; + // T t40 = t3*1.0E+24; + // T t41 = t4*1.0E+24; + // T t42 = t5*1.0E+24; + // T t43 = t6*1.0E+24; + // T t24 = t9*t19; + // T t25 = t9*t20; + // T t26 = t9*t21; + // T t27 = t9*t22; + // T t28 = t9*t23; + // T t44 = t39+1.0; + // T t45 = t40+1.0; + // T t46 = t41+1.0; + // T t47 = t42+1.0; + // T t48 = t43+1.0; + // T t29 = t24+1.0/2.0; + // T t30 = t25+1.0/2.0; + // T t31 = t26+1.0/2.0; + // T t32 = t27+1.0/2.0; + // T t33 = t28+1.0/2.0; + // T t49 = 1.0/t44; + // T t50 = 1.0/t45; + // T t51 = 1.0/t46; + // T t52 = 1.0/t47; + // T t53 = 1.0/t48; + // T t34 = t29*udg1; + // T t35 = t30*udg2; + // T t36 = t31*udg3; + // T t37 = t32*udg4; + // T t38 = t33*udg5; + // T t54 = t9*t14*t49; + // T t55 = t9*t15*t50; + // T t56 = t9*t16*t51; + // T t57 = t9*t17*t52; + // T t58 = t9*t18*t53; + // T t59 = t29+t54; + // T t60 = t30+t55; + // T t61 = t31+t56; + // T t62 = t32+t57; + // T t63 = t33+t58; + // T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; + // T t64 = t59*udg9; + // T t65 = t60*udg10; + // T t66 = t61*udg11; + // T t67 = t59*udg17; + // T t68 = t62*udg12; + // T t69 = t60*udg18; + // T t70 = t63*udg13; + // T t71 = t61*udg19; + // T t72 = t62*udg20; + // T t73 = t63*udg21; + // T t75 = 1.0/t74; + // T t76 = t75*t75; + // T t77 = t75*udg8; + // T t78 = t75*uinf1; + // T t86 = t64+t65+t66+t68+t70; + // T t87 = t67+t69+t71+t72+t73; + // T t79 = t77*1.0E+12; + // T t80 = t78*1.0E+12; + // T t81 = t77+t78-1.0E-4; + // T t88 = t75*t86*udg6; + // T t89 = t75*t87*udg7; + // T t82 = t79+t80-1.0E+8; + // T t90 = -t88; + // T t91 = -t89; + // T t95 = -t75*(t88-udg14); + // T t96 = -t75*(t89-udg23); + // T t97 = t75*(t88-udg14)*-1.0E+12; + // T t98 = t75*(t89-udg23)*-1.0E+12; + // T t83 = atan(t82); + // T t92 = t90+udg14; + // T t93 = t91+udg23; + // T t102 = t95+t96-1.0E+4; + // T t103 = t97+t98-1.0E+16; + // T t84 = t9*t83; + // T t104 = atan(t103); + // T t85 = t84+1.0/2.0; + // T t105 = t9*t104; + // T t94 = t81*t85; + // T t106 = t105-1.0/2.0; + // T t99 = t94+1.000000003182454E-4; + // T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + // T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + // T t100 = t11*t12*t99; + // T t109 = t108*-1.0E+12; + // T t110 = t107-2.0E+4; + // T t101 = 1.0/sqrt(t100); + // T t111 = t109-2.0E+16; + // T t112 = atan(t111); + // T t113 = t9*t112; + // T t114 = t113+1.0/2.0; + // T t115 = -t114*(t108+2.0E+4); + // T t116 = t108+t115+1.0E+4; + // T t117 = odg2*t10*t101*t116; + // T t118 = -t117; + // T t120 = t117*1.0E+12; + // T t119 = param17+t118; + // T t121 = -t120; + // T t122 = t13+t121; + // T t123 = atan(t122); + // T t124 = t9*t123; + // T t125 = t124-1.0/2.0; + // T t126 = t119*t125; + // f[j+npe*0+npe*nce*k] = odg2*param16*t10*(sqrt(t76*(udg6*udg6)+t76*(udg7*udg7))+1.0/t101)*(t126-(t9*atan(param18*-1.0E+12+t126*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t126+3.182454300088011E-13)); // f[j+npe*0+npe*nce*k] = 0.0; } } diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP_ducros.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP_ducros.cpp new file mode 100644 index 00000000..83a97a09 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP_ducros.cpp @@ -0,0 +1,189 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = uinf2*2.0; + T t3 = uinf2+1.0; + T t4 = 1.0/3.141592653589793; + T t5 = 1.0/param15; + T t8 = udg9+udg10+udg11+udg12+udg13; + T t9 = udg17+udg18+udg19+udg20+udg21; + T t10 = param17*1.0E+12; + T t11 = udg1*1.0E+12; + T t12 = udg2*1.0E+12; + T t13 = udg3*1.0E+12; + T t14 = udg4*1.0E+12; + T t15 = udg5*1.0E+12; + T t6 = t2-2.0; + T t7 = 1.0/t3; + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = t4*t16; + T t22 = t4*t17; + T t23 = t4*t18; + T t24 = t4*t19; + T t25 = t4*t20; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26*udg1; + T t32 = t27*udg2; + T t33 = t28*udg3; + T t34 = t29*udg4; + T t35 = t30*udg5; + T t36 = t31+t32+t33+t34+t35+1.591227150044006E-12; + T t37 = 1.0/t36; + T t38 = t37*t37; + T t39 = t37*udg8; + T t40 = t37*uinf1; + T t41 = t8*t37*udg6; + T t42 = t8*t37*udg7; + T t43 = t9*t37*udg6; + T t44 = t9*t37*udg7; + T t45 = -t41; + T t46 = -t42; + T t47 = -t43; + T t48 = -t44; + T t53 = t39*1.0E+12; + T t54 = t40*1.0E+12; + T t55 = -t37*(t41-udg14); + T t56 = -t37*(t42-udg15); + T t57 = -t37*(t43-udg22); + T t58 = -t37*(t44-udg23); + T t59 = t39+t40-1.0E-4; + T t60 = t37*(t43-udg22); + T t61 = t37*(t41-udg14)*-1.0E+12; + T t62 = t37*(t44-udg23)*-1.0E+12; + T t49 = t45+udg14; + T t50 = t46+udg15; + T t51 = t47+udg22; + T t52 = t48+udg23; + T t63 = t53+t54-1.0E+8; + T t67 = t56+t60; + T t68 = pow(t57+t37*(t42-udg15),2.0); + T t69 = t55+t58-1.0E+4; + T t76 = t61+t62-1.0E+16; + T t64 = atan(t63); + T t70 = sqrt(t68); + T t77 = atan(t76); + T t65 = t4*t64; + T t71 = t70*1.0E+12; + T t78 = t4*t77; + T t66 = t65+1.0/2.0; + T t72 = atan(t71); + T t79 = t78-1.0/2.0; + T t73 = t4*t72; + T t75 = t59*t66; + T t86 = -t79*(t37*(t41-udg14)+t37*(t44-udg23)+1.0E+4); + T t87 = t79*(t37*(t41-udg14)+t37*(t44-udg23)+1.0E+4); + T t74 = t73+1.0/2.0; + T t80 = t75+1.000000003182454E-4; + T t88 = t87*-1.0E+12; + T t92 = t86-2.0E+4; + T t81 = t6*t7*t80; + T t83 = t70*t74; + T t85 = t71*t74; + T t95 = t88-2.0E+16; + T t82 = 1.0/sqrt(t81); + T t84 = -t83; + T t89 = t83-1.0E+4; + T t90 = t85-1.0E+16; + T t96 = atan(t95); + T t91 = atan(t90); + T t97 = t4*t96; + T t93 = t4*t91; + T t98 = t97+1.0/2.0; + T t94 = t93+1.0/2.0; + T t100 = -t98*(t87+2.0E+4); + T t99 = t89*t94; + T t103 = t87+t100+1.0E+4; + T t101 = t84+t99; + T t102 = pow(t83-t99,2.0); + T t104 = t103*t103; + T t105 = t103*t103*t103; + T t106 = t102+t104+1.0E-16; + T t107 = 1.0/t106; + T t108 = odg2*t5*t82*t105*t107; + T t109 = -t108; + T t111 = t108*1.0E+12; + T t110 = param17+t109; + T t112 = -t111; + T t113 = t10+t112; + T t114 = atan(t113); + T t115 = t4*t114; + T t116 = t115-1.0/2.0; + T t117 = t110*t116; + f[j+npe*0+npe*nce*k] = odg2*param16*t5*(sqrt(t38*(udg6*udg6)+t38*(udg7*udg7))+1.0/t82)*(t117-(t4*atan(param18*-1.0E+12+t117*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t117+3.182454300088011E-13)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP.cpp new file mode 100644 index 00000000..4cc6648f --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP.cpp @@ -0,0 +1,210 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + uinf3 = (mix->frozenThermalConductivity() / uinf[5]) / (mix->viscosity() / uinf[4]); // cp / Pr^* + + T t2 = udg6*udg6; + T t3 = udg7*udg7; + T t4 = uinf2*2.0; + T t5 = uinf2+1.0; + T t6 = 1.0/3.141592653589793; + T t7 = -param18; + T t8 = 1.0/param15; + T t11 = udg9+udg10+udg11+udg12+udg13; + T t12 = udg17+udg18+udg19+udg20+udg21; + T t13 = param17*1.0E+12; + T t14 = param18*1.0E+12; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t9 = t4-2.0; + T t10 = 1.0/t5; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t25 = -t14; + T t26 = t6*t20; + T t27 = t6*t21; + T t28 = t6*t22; + T t29 = t6*t23; + T t30 = t6*t24; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t35 = t30+1.0/2.0; + T t36 = t31*udg1; + T t37 = t32*udg2; + T t38 = t33*udg3; + T t39 = t34*udg4; + T t40 = t35*udg5; + T t41 = t36+t37+t38+t39+t40+1.591227150044006E-12; + T t42 = 1.0/t41; + T t43 = t42*t42; + T t44 = t42*udg8; + T t45 = t42*uinf1; + T t48 = t11*t42*udg6; + T t49 = t11*t42*udg7; + T t50 = t12*t42*udg6; + T t51 = t12*t42*udg7; + T t46 = t2*t43; + T t47 = t3*t43; + T t52 = -t48; + T t53 = -t49; + T t54 = -t50; + T t55 = -t51; + T t60 = t44*1.0E+12; + T t61 = t45*1.0E+12; + T t62 = -t42*(t48-udg14); + T t63 = -t42*(t49-udg15); + T t64 = -t42*(t50-udg22); + T t65 = -t42*(t51-udg23); + T t66 = t44+t45-1.0E-4; + T t67 = t42*(t50-udg22); + T t68 = t42*(t48-udg14)*-1.0E+12; + T t69 = t42*(t51-udg23)*-1.0E+12; + T t56 = t52+udg14; + T t57 = t53+udg15; + T t58 = t54+udg22; + T t59 = t55+udg23; + T t70 = t60+t61-1.0E+8; + T t74 = t63+t67; + T t75 = pow(t64+t42*(t49-udg15),2.0); + T t76 = t62+t65-1.0E+4; + T t83 = t68+t69-1.0E+16; + T t71 = atan(t70); + T t77 = sqrt(t75); + T t84 = atan(t83); + T t72 = t6*t71; + T t78 = t77*1.0E+12; + T t85 = t6*t84; + T t73 = t72+1.0/2.0; + T t79 = atan(t78); + T t86 = t85-1.0/2.0; + T t80 = t6*t79; + T t82 = t66*t73; + T t95 = -t86*(t42*(t48-udg14)+t42*(t51-udg23)+1.0E+4); + T t96 = t86*(t42*(t48-udg14)+t42*(t51-udg23)+1.0E+4); + T t81 = t80+1.0/2.0; + T t87 = t82+1.000000003182454E-4; + T t97 = t96*-1.0E+12; + T t101 = t95-2.0E+4; + T t88 = t9*t10*t87; + T t92 = t77*t81; + T t94 = t78*t81; + T t104 = t97-2.0E+16; + T t89 = 1.0/sqrt(t88); + T t90 = t46+t47+t88; + T t93 = -t92; + T t98 = t92-1.0E+4; + T t99 = t94-1.0E+16; + T t105 = atan(t104); + T t91 = sqrt(t90); + T t100 = atan(t99); + T t106 = t6*t105; + T t102 = t6*t100; + T t107 = t106+1.0/2.0; + T t103 = t102+1.0/2.0; + T t109 = -t107*(t96+2.0E+4); + T t108 = t98*t103; + T t112 = t96+t109+1.0E+4; + T t110 = t93+t108; + T t111 = pow(t92-t108,2.0); + T t113 = t112*t112; + T t114 = t112*t112*t112; + T t115 = t111+t113+1.0E-16; + T t116 = 1.0/t115; + T t117 = odg3*t8*t89*t114*t116; + T t118 = -t117; + T t120 = t117*1.0E+12; + T t119 = param17+t118; + T t121 = -t120; + T t122 = t13+t121; + T t123 = atan(t122); + T t124 = t6*t123; + T t125 = t124-1.0/2.0; + T t126 = t119*t125; + T t127 = -t126; + T t128 = t126*1.0E+12; + T t129 = t7+t126+3.182454300088011E-13; + T t130 = t25+t128+3.182454300088011E-1; + T t131 = atan(t130); + T t132 = t6*t131; + T t133 = t132+1.0/2.0; + T t134 = t129*t133; + T t135 = t127+t134; + f[j+npe*0+npe*nce*k] = odg3*param16*t8*t41*t91*(t126-t134); + f[j+npe*1+npe*nce*k] = odg3*param16*t8*t41*t91*uinf3*(t126-t134); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2.cpp new file mode 100644 index 00000000..0bb03b92 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2.cpp @@ -0,0 +1,157 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = uinf2*2.0; + T t3 = uinf2+1.0; + T t4 = 1.0/3.141592653589793; + T t5 = 1.0/param15; + T t8 = udg9+udg10+udg11+udg12+udg13; + T t9 = udg17+udg18+udg19+udg20+udg21; + T t10 = param17*1.0E+12; + T t11 = udg1*1.0E+12; + T t12 = udg2*1.0E+12; + T t13 = udg3*1.0E+12; + T t14 = udg4*1.0E+12; + T t15 = udg5*1.0E+12; + T t6 = t2-2.0; + T t7 = 1.0/t3; + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = t4*t16; + T t22 = t4*t17; + T t23 = t4*t18; + T t24 = t4*t19; + T t25 = t4*t20; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26*udg1; + T t32 = t27*udg2; + T t33 = t28*udg3; + T t34 = t29*udg4; + T t35 = t30*udg5; + T t36 = t31+t32+t33+t34+t35+1.591227150044006E-12; + T t37 = 1.0/t36; + T t38 = t37*t37; + T t39 = t37*udg8; + T t40 = t37*uinf1; + T t41 = t8*t37*udg6; + T t42 = t9*t37*udg7; + T t43 = -t41; + T t44 = -t42; + T t47 = t39*1.0E+12; + T t48 = t40*1.0E+12; + T t49 = -t37*(t41-udg14); + T t50 = -t37*(t42-udg23); + T t51 = t39+t40-1.0E-4; + T t52 = t37*(t41-udg14)*-1.0E+12; + T t53 = t37*(t42-udg23)*-1.0E+12; + T t45 = t43+udg14; + T t46 = t44+udg23; + T t54 = t47+t48-1.0E+8; + T t58 = t49+t50-1.0E+4; + T t60 = t52+t53-1.0E+16; + T t55 = atan(t54); + T t61 = atan(t60); + T t56 = t4*t55; + T t62 = t4*t61; + T t57 = t56+1.0/2.0; + T t63 = t62-1.0/2.0; + T t59 = t51*t57; + T t67 = -t63*(t37*(t41-udg14)+t37*(t42-udg23)+1.0E+4); + T t68 = t63*(t37*(t41-udg14)+t37*(t42-udg23)+1.0E+4); + T t64 = t59+1.000000003182454E-4; + T t69 = t68*-1.0E+12; + T t70 = t67-2.0E+4; + T t65 = t6*t7*t64; + T t71 = t69-2.0E+16; + T t66 = 1.0/sqrt(t65); + T t72 = atan(t71); + T t73 = t4*t72; + T t74 = t73+1.0/2.0; + T t75 = -t74*(t68+2.0E+4); + T t76 = t68+t75+1.0E+4; + T t77 = odg2*t5*t66*t76; + T t78 = -t77; + T t80 = t77*1.0E+12; + T t79 = param17+t78; + T t81 = -t80; + T t82 = t10+t81; + T t83 = atan(t82); + T t84 = t4*t83; + T t85 = t84-1.0/2.0; + T t86 = t79*t85; + f[j+npe*0+npe*nce*k] = odg2*param16*t5*t36*(t86-(t4*atan(param18*-1.0E+12+t86*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t86+3.182454300088011E-13))*sqrt(t65+t38*(udg6*udg6)+t38*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2_ducros.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2_ducros.cpp new file mode 100644 index 00000000..b1598b3d --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_2_ducros.cpp @@ -0,0 +1,187 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = uinf2*2.0; + T t3 = uinf2+1.0; + T t4 = 1.0/3.141592653589793; + T t5 = 1.0/param15; + T t8 = udg9+udg10+udg11+udg12+udg13; + T t9 = udg17+udg18+udg19+udg20+udg21; + T t10 = param17*1.0E+12; + T t11 = udg1*1.0E+12; + T t12 = udg2*1.0E+12; + T t13 = udg3*1.0E+12; + T t14 = udg4*1.0E+12; + T t15 = udg5*1.0E+12; + T t6 = t2-2.0; + T t7 = 1.0/t3; + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = t4*t16; + T t22 = t4*t17; + T t23 = t4*t18; + T t24 = t4*t19; + T t25 = t4*t20; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26*udg1; + T t32 = t27*udg2; + T t33 = t28*udg3; + T t34 = t29*udg4; + T t35 = t30*udg5; + T t36 = t31+t32+t33+t34+t35+1.591227150044006E-12; + T t37 = 1.0/t36; + T t38 = t37*t37; + T t39 = t37*udg8; + T t40 = t37*uinf1; + T t41 = t8*t37*udg6; + T t42 = t8*t37*udg7; + T t43 = t9*t37*udg6; + T t44 = t9*t37*udg7; + T t45 = -t41; + T t46 = -t42; + T t47 = -t43; + T t48 = -t44; + T t53 = t39*1.0E+12; + T t54 = t40*1.0E+12; + T t55 = -t37*(t41-udg14); + T t56 = -t37*(t42-udg15); + T t57 = -t37*(t43-udg22); + T t58 = -t37*(t44-udg23); + T t59 = t39+t40-1.0E-4; + T t60 = t37*(t43-udg22); + T t61 = t37*(t41-udg14)*-1.0E+12; + T t62 = t37*(t44-udg23)*-1.0E+12; + T t49 = t45+udg14; + T t50 = t46+udg15; + T t51 = t47+udg22; + T t52 = t48+udg23; + T t63 = t53+t54-1.0E+8; + T t67 = t56+t60; + T t68 = pow(t57+t37*(t42-udg15),2.0); + T t69 = t55+t58-1.0E+4; + T t76 = t61+t62-1.0E+16; + T t64 = atan(t63); + T t70 = sqrt(t68); + T t77 = atan(t76); + T t65 = t4*t64; + T t71 = t70*1.0E+12; + T t78 = t4*t77; + T t66 = t65+1.0/2.0; + T t72 = atan(t71); + T t79 = t78-1.0/2.0; + T t73 = t4*t72; + T t75 = t59*t66; + T t86 = -t79*(t37*(t41-udg14)+t37*(t44-udg23)+1.0E+4); + T t87 = t79*(t37*(t41-udg14)+t37*(t44-udg23)+1.0E+4); + T t74 = t73+1.0/2.0; + T t80 = t75+1.000000003182454E-4; + T t88 = t87*-1.0E+12; + T t92 = t86-2.0E+4; + T t81 = t6*t7*t80; + T t83 = t70*t74; + T t85 = t71*t74; + T t95 = t88-2.0E+16; + T t82 = 1.0/sqrt(t81); + T t84 = -t83; + T t89 = t83-1.0E+4; + T t90 = t85-1.0E+16; + T t96 = atan(t95); + T t91 = atan(t90); + T t97 = t4*t96; + T t93 = t4*t91; + T t98 = t97+1.0/2.0; + T t94 = t93+1.0/2.0; + T t100 = -t98*(t87+2.0E+4); + T t99 = t89*t94; + T t103 = t87+t100+1.0E+4; + T t101 = t84+t99; + T t102 = pow(t83-t99,2.0); + T t104 = t103*t103; + T t105 = t103*t103*t103; + T t106 = t102+t104+1.0E-16; + T t107 = 1.0/t106; + T t108 = odg2*t5*t82*t105*t107; + T t109 = -t108; + T t111 = t108*1.0E+12; + T t110 = param17+t109; + T t112 = -t111; + T t113 = t10+t112; + T t114 = atan(t113); + T t115 = t4*t114; + T t116 = t115-1.0/2.0; + T t117 = t110*t116; + f[j+npe*0+npe*nce*k] = odg2*param16*t5*t36*(t117-(t4*atan(param18*-1.0E+12+t117*1.0E+12+3.182454300088011E-1)+1.0/2.0)*(-param18+t117+3.182454300088011E-13))*sqrt(t81+t38*(udg6*udg6)+t38*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_noducros.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_noducros.cpp new file mode 100644 index 00000000..8f9b8e19 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_PB_MPP_noducros.cpp @@ -0,0 +1,180 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + // uinf3 = (mix->frozenThermalConductivity() / uinf[5]) / (mix->viscosity() / uinf[4]); // cp / Pr^* + uinf3 = (mix->mixtureFrozenCpMass() / 1182.1920097928833) / 0.9; + + T t2 = udg6*udg6; + T t3 = udg7*udg7; + T t4 = uinf2*2.0; + T t5 = uinf2+1.0; + T t6 = 1.0/3.141592653589793; + T t7 = -param18; + T t8 = 1.0/param15; + T t11 = udg9+udg10+udg11+udg12+udg13; + T t12 = udg17+udg18+udg19+udg20+udg21; + T t13 = param17*1.0E+12; + T t14 = param18*1.0E+12; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t9 = t4-2.0; + T t10 = 1.0/t5; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t25 = -t14; + T t26 = t6*t20; + T t27 = t6*t21; + T t28 = t6*t22; + T t29 = t6*t23; + T t30 = t6*t24; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t35 = t30+1.0/2.0; + T t36 = t31*udg1; + T t37 = t32*udg2; + T t38 = t33*udg3; + T t39 = t34*udg4; + T t40 = t35*udg5; + T t41 = t36+t37+t38+t39+t40+1.591227150044006E-12; + T t42 = 1.0/t41; + T t43 = t42*t42; + T t44 = t42*udg8; + T t45 = t42*uinf1; + T t48 = t11*t42*udg6; + T t49 = t12*t42*udg7; + T t46 = t2*t43; + T t47 = t3*t43; + T t50 = -t48; + T t51 = -t49; + T t54 = t44*1.0E+12; + T t55 = t45*1.0E+12; + T t56 = -t42*(t48-udg14); + T t57 = -t42*(t49-udg23); + T t58 = t44+t45-1.0E-4; + T t59 = t42*(t48-udg14)*-1.0E+12; + T t60 = t42*(t49-udg23)*-1.0E+12; + T t52 = t50+udg14; + T t53 = t51+udg23; + T t61 = t54+t55-1.0E+8; + T t65 = t56+t57-1.0E+4; + T t67 = t59+t60-1.0E+16; + T t62 = atan(t61); + T t68 = atan(t67); + T t63 = t6*t62; + T t69 = t6*t68; + T t64 = t63+1.0/2.0; + T t70 = t69-1.0/2.0; + T t66 = t58*t64; + T t76 = -t70*(t42*(t48-udg14)+t42*(t49-udg23)+1.0E+4); + T t77 = t70*(t42*(t48-udg14)+t42*(t49-udg23)+1.0E+4); + T t71 = t66+1.000000003182454E-4; + T t78 = t77*-1.0E+12; + T t79 = t76-2.0E+4; + T t72 = t9*t10*t71; + T t80 = t78-2.0E+16; + T t73 = 1.0/sqrt(t72); + T t74 = t46+t47+t72; + T t81 = atan(t80); + T t75 = sqrt(t74); + T t82 = t6*t81; + T t83 = t82+1.0/2.0; + T t84 = -t83*(t77+2.0E+4); + T t85 = t77+t84+1.0E+4; + T t86 = odg3*t8*t73*t85; + T t87 = -t86; + T t89 = t86*1.0E+12; + T t88 = param17+t87; + T t90 = -t89; + T t91 = t13+t90; + T t92 = atan(t91); + T t93 = t6*t92; + T t94 = t93-1.0/2.0; + T t95 = t88*t94; + T t96 = t95*1.0E+12; + T t97 = t7+t95+3.182454300088011E-13; + T t98 = t25+t96+3.182454300088011E-1; + T t99 = atan(t98); + T t100 = t6*t99; + T t101 = t100+1.0/2.0; + T t102 = t97*t101; + T t103 = -t102; + T t104 = t95+t103; + f[j+npe*0+npe*nce*k] = odg3*param16*t8*t41*t75*t104; + f[j+npe*1+npe*nce*k] = 0.5 * odg3*param16*t8*t41*t75*t104*uinf3; + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noducros.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noducros.cpp new file mode 100644 index 00000000..33924ce4 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noducros.cpp @@ -0,0 +1,202 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = param22*param22; + T t10 = udg1*udg1; + T t11 = udg2*udg2; + T t12 = udg3*udg3; + T t13 = udg4*udg4; + T t14 = udg5*udg5; + T t15 = uinf2*2.0; + T t16 = uinf2+1.0; + T t22 = 1.0/3.141592653589793; + T t23 = -param23; + T t24 = 1.0/param15; + T t17 = atan(t3); + T t18 = atan(t4); + T t19 = atan(t5); + T t20 = atan(t6); + T t21 = atan(t7); + T t25 = t15-2.0; + T t26 = 1.0/t16; + T t27 = t3*t3; + T t28 = t4*t4; + T t29 = t5*t5; + T t30 = t6*t6; + T t31 = t7*t7; + T t32 = t2*t22; + T t33 = t32*5.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t17*t22; + T t40 = t18*t22; + T t41 = t19*t22; + T t42 = t20*t22; + T t43 = t21*t22; + T t44 = -t32; + T t45 = -t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = 1.0/t36; + T t49 = 1.0/t37; + T t50 = 1.0/t38; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t41+1.0/2.0; + T t54 = t42+1.0/2.0; + T t55 = t43+1.0/2.0; + T t56 = t51*udg1; + T t57 = t52*udg2; + T t58 = t53*udg3; + T t59 = t54*udg4; + T t60 = t55*udg5; + T t61 = t3*t22*t46; + T t62 = t4*t22*t47; + T t63 = t5*t22*t48; + T t64 = t6*t22*t49; + T t65 = t7*t22*t50; + T t66 = t51+t61; + T t67 = t52+t62; + T t68 = t53+t63; + T t69 = t54+t64; + T t70 = t55+t65; + T t81 = t45+t56+t57+t58+t59+t60+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t86 = t71+t72+t73+t75+t77; + T t87 = t74+t76+t78+t79+t80; + T t88 = t84+t85-1.0E-4; + T t93 = t82*t86*udg6; + T t94 = t82*t87*udg7; + T t89 = param22*t88; + T t95 = -t93; + T t96 = -t94; + T t99 = -t82*(t93-udg14); + T t100 = -t82*(t94-udg23); + T t106 = -param22*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t90 = atan(t89); + T t97 = t95+udg14; + T t98 = t96+udg23; + T t105 = t23+t99+t100; + T t107 = atan(t106); + T t91 = t22*t90; + T t108 = t22*t107; + T t92 = t91+1.0/2.0; + T t109 = t108-1.0/2.0; + T t101 = t88*t92; + T t110 = -t109*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t111 = t109*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t102 = t44+t101+5.001E-1; + T t112 = t8+t32+t111-1.0/2.0; + T t103 = t25*t26*t102; + T t113 = param22*t112; + T t104 = 1.0/sqrt(t103); + T t114 = atan(t113); + T t115 = t22*t114; + T t116 = t115-1.0/2.0; + T t117 = t112*t116; + T t118 = param23+t111+t117; + T t119 = odg2*t24*t104*t118; + T t120 = -t119; + T t121 = param17+t120; + T t122 = param22*t121; + T t123 = atan(t122); + T t124 = t22*t123; + T t125 = t124-1.0/2.0; + T t126 = t121*t125; + T t127 = -t126; + T t128 = param18+t32+t127-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t24*t81*(t126-t128*(t22*atan(param22*t128)-1.0/2.0))*sqrt(t103+t83*(udg6*udg6)+t83*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noreg.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noreg.cpp new file mode 100644 index 00000000..6be0e43a --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_noreg.cpp @@ -0,0 +1,191 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = uinf2*2.0; + T t10 = uinf2+1.0; + T t16 = 1.0/3.141592653589793; + T t17 = -param23; + T t18 = 1.0/param15; + T t21 = udg9+udg10+udg11+udg12+udg13; + T t22 = udg17+udg18+udg19+udg20+udg21; + T t11 = atan(t3); + T t12 = atan(t4); + T t13 = atan(t5); + T t14 = atan(t6); + T t15 = atan(t7); + T t19 = t9-2.0; + T t20 = 1.0/t10; + T t23 = t2*t16; + T t24 = t23*5.0; + T t25 = t11*t16; + T t26 = t12*t16; + T t27 = t13*t16; + T t28 = t14*t16; + T t29 = t15*t16; + T t30 = -t23; + T t31 = -t24; + T t32 = t25+1.0/2.0; + T t33 = t26+1.0/2.0; + T t34 = t27+1.0/2.0; + T t35 = t28+1.0/2.0; + T t36 = t29+1.0/2.0; + T t37 = t32*udg1; + T t38 = t33*udg2; + T t39 = t34*udg3; + T t40 = t35*udg4; + T t41 = t36*udg5; + T t42 = t31+t37+t38+t39+t40+t41+5.0/2.0; + T t43 = 1.0/t42; + T t44 = t43*t43; + T t45 = t43*udg8; + T t46 = t43*uinf1; + T t47 = t21*t43*udg6; + T t48 = t21*t43*udg7; + T t49 = t22*t43*udg6; + T t50 = t22*t43*udg7; + T t51 = -t47; + T t52 = -t48; + T t53 = -t49; + T t54 = -t50; + T t59 = -t43*(t47-udg14); + T t60 = -t43*(t48-udg15); + T t61 = -t43*(t49-udg22); + T t62 = -t43*(t50-udg23); + T t63 = t45+t46-1.0E-4; + T t64 = t43*(t49-udg22); + T t72 = -param22*(-t17+t43*(t47-udg14)+t43*(t50-udg23)); + T t55 = t51+udg14; + T t56 = t52+udg15; + T t57 = t53+udg22; + T t58 = t54+udg23; + T t65 = param22*t63; + T t69 = t60+t64; + T t70 = t17+t59+t62; + T t71 = pow(t61+t43*(t48-udg15),2.0); + T t73 = atan(t72); + T t66 = atan(t65); + T t74 = sqrt(t71); + T t77 = t16*t73; + T t67 = t16*t66; + T t75 = param22*t74; + T t80 = t77-1.0/2.0; + T t68 = t67+1.0/2.0; + T t76 = atan(t75); + T t85 = -t80*(-t17+t43*(t47-udg14)+t43*(t50-udg23)); + T t86 = t80*(-t17+t43*(t47-udg14)+t43*(t50-udg23)); + T t78 = t63*t68; + T t79 = t16*t76; + T t89 = t8+t23+t86-1.0/2.0; + T t81 = t79+1.0/2.0; + T t82 = t30+t78+5.001E-1; + T t90 = param22*t89; + T t83 = t19*t20*t82; + T t87 = t74*t81; + T t91 = atan(t90); + T t84 = 1.0/sqrt(t83); + T t88 = -t87; + T t94 = t16*t91; + T t92 = param23+t23+t88-1.0/2.0; + T t96 = t94-1.0/2.0; + T t93 = param22*t92; + T t99 = t89*t96; + T t95 = atan(t93); + T t101 = param23+t86+t99; + T t97 = t16*t95; + T t102 = t101*t101; + T t103 = t101*t101*t101; + T t98 = t97-1.0/2.0; + T t100 = t92*t98; + T t104 = t88+t100; + T t105 = pow(t87-t100,2.0); + T t106 = t102+t105+1.0E-16; + T t107 = 1.0/t106; + T t108 = odg2*t18*t84*t103*t107; + T t109 = -t108; + T t110 = param17+t109; + T t111 = param22*t110; + T t112 = atan(t111); + T t113 = t16*t112; + T t114 = t113-1.0/2.0; + T t115 = t110*t114; + T t116 = -t115; + T t117 = param18+t23+t116-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t18*t42*(t115-t117*(t16*atan(param22*t117)-1.0/2.0))*sqrt(t83+t44*(udg6*udg6)+t44*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp index 0d7b6ca4..196662ee 100644 --- a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp @@ -98,10 +98,10 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg mix->setState(rhovec, &rhoe, 0); - mix->averageDiffusionCoeffs(D_i); - nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); - mix->speciesHOverRT(h_i); - nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); uinf1 = mix->P()/rhoe_scale; @@ -130,260 +130,388 @@ template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg // uinf12 = mix->viscosity() / mu_scale; // mu // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa - dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); - nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); - uinf14 = dTdU[0]; - uinf15 = dTdU[1]; - uinf16 = dTdU[2]; - uinf17 = dTdU[3]; - uinf18 = dTdU[4]; - uinf19 = dTdU[5]; + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + uinf14 = 0.0; + uinf15 = 0.0; + uinf16 = 0.0; + uinf17 = 0.0; + uinf18 = 0.0; + uinf19 = 0.0; - T t2 = udg1*udg1; + T t2 = udg1*udg1; T t3 = udg2*udg2; T t4 = udg3*udg3; T t5 = udg4*udg4; T t6 = udg5*udg5; - T t7 = udg6*udg6; - T t8 = udg7*udg7; - T t9 = udg17*udg17; - T t10 = udg18*udg18; - T t11 = udg19*udg19; - T t12 = udg20*udg20; - T t13 = udg21*udg21; - T t14 = 1.0/3.141592653589793; - T t15 = 1.0/param19; - T t16 = 1.0/param20; - T t17 = udg1*1.0E+12; - T t18 = udg2*1.0E+12; - T t19 = udg3*1.0E+12; - T t20 = udg4*1.0E+12; - T t21 = udg5*1.0E+12; - T t22 = udg17*1.0E+12; - T t23 = udg18*1.0E+12; - T t24 = udg19*1.0E+12; - T t25 = udg20*1.0E+12; - T t26 = udg21*1.0E+12; - T t27 = atan(t17); - T t28 = atan(t18); - T t29 = atan(t19); - T t30 = atan(t20); - T t31 = atan(t21); - T t32 = atan(t22); - T t33 = atan(t23); - T t34 = atan(t24); - T t35 = atan(t25); - T t36 = atan(t26); - T t57 = t2*1.0E+24; - T t58 = t3*1.0E+24; - T t59 = t4*1.0E+24; - T t60 = t5*1.0E+24; - T t61 = t6*1.0E+24; - T t62 = t9*1.0E+24; - T t63 = t10*1.0E+24; - T t64 = t11*1.0E+24; - T t65 = t12*1.0E+24; - T t66 = t13*1.0E+24; - T t37 = t14*t27; - T t38 = t14*t28; - T t39 = t14*t29; - T t40 = t14*t30; - T t41 = t14*t31; - T t42 = t14*t32; - T t43 = t14*t33; - T t44 = t14*t34; - T t45 = t14*t35; - T t46 = t14*t36; - T t67 = t57+1.0; - T t68 = t58+1.0; - T t69 = t59+1.0; - T t70 = t60+1.0; - T t71 = t61+1.0; - T t72 = t62+1.0; - T t73 = t63+1.0; - T t74 = t64+1.0; - T t75 = t65+1.0; - T t76 = t66+1.0; - T t47 = t37+1.0/2.0; - T t48 = t38+1.0/2.0; - T t49 = t39+1.0/2.0; - T t50 = t40+1.0/2.0; - T t51 = t41+1.0/2.0; - T t77 = 1.0/t67; - T t78 = 1.0/t68; - T t79 = 1.0/t69; - T t80 = 1.0/t70; - T t81 = 1.0/t71; - T t82 = 1.0/t72; - T t83 = 1.0/t73; - T t84 = 1.0/t74; - T t85 = 1.0/t75; - T t86 = 1.0/t76; - T t52 = t47*udg1; - T t53 = t48*udg2; - T t54 = t49*udg3; - T t55 = t50*udg4; - T t56 = t51*udg5; - T t92 = t14*t17*t77; - T t93 = t14*t18*t78; - T t94 = t14*t19*t79; - T t95 = t14*t20*t80; - T t96 = t14*t21*t81; - T t97 = t14*t22*t82; - T t98 = t14*t23*t83; - T t99 = t14*t24*t84; - T t100 = t14*t25*t85; - T t101 = t14*t26*t86; - T t87 = t52+3.182454300088011E-13; - T t88 = t53+3.182454300088011E-13; - T t89 = t54+3.182454300088011E-13; - T t90 = t55+3.182454300088011E-13; - T t91 = t56+3.182454300088011E-13; - T t102 = t47+t92; - T t103 = t48+t93; - T t104 = t49+t94; - T t105 = t50+t95; - T t106 = t51+t96; - T t107 = t42+t97+1.0/2.0; - T t108 = t43+t98+1.0/2.0; - T t109 = t44+t99+1.0/2.0; - T t110 = t45+t100+1.0/2.0; - T t111 = t46+t101+1.0/2.0; - T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; - T t112 = t102*udg9; - T t113 = t103*udg10; - T t114 = t104*udg11; - T t115 = t105*udg12; - T t116 = t106*udg13; - T t117 = t107*udg17; - T t118 = t108*udg18; - T t119 = t109*udg19; - T t120 = t110*udg20; - T t121 = t111*udg21; - T t123 = 1.0/t122; - T t124 = t123*t123; - T t125 = t123*udg8; - T t126 = t123*uinf1; - T t127 = t123*udg6*udg7; - T t130 = t112*t122; - T t131 = t113*t122; - T t132 = t114*t122; - T t133 = t115*t122; - T t134 = t116*t122; - T t135 = t117*t122; - T t136 = t118*t122; - T t137 = t119*t122; - T t138 = t120*t122; - T t139 = t121*t122; - T t152 = t112+t113+t114+t115+t116; - T t153 = t117+t118+t119+t120+t121; - T t128 = (t7*t124)/2.0; - T t129 = (t8*t124)/2.0; - T t140 = -t130; - T t141 = -t131; - T t142 = -t132; - T t143 = -t133; - T t144 = -t134; - T t145 = -t135; - T t146 = -t136; - T t147 = -t137; - T t148 = -t138; - T t149 = -t139; - T t150 = t125+t126; - T t154 = t87*t152; - T t155 = t88*t152; - T t156 = t89*t152; - T t157 = t90*t152; - T t158 = t91*t152; - T t159 = t87*t153; - T t160 = t88*t153; - T t161 = t89*t153; - T t162 = t90*t153; - T t163 = t91*t153; - T t164 = t123*t152*udg6; - T t165 = t123*t152*udg7; - T t166 = t123*t153*udg6; - T t167 = t123*t153*udg7; - T t151 = t128+t129; - T t168 = -t164; - T t169 = -t165; - T t170 = -t166; - T t171 = -t167; - T t176 = t140+t154; - T t177 = t141+t155; - T t178 = t142+t156; - T t179 = t143+t157; - T t180 = t144+t158; - T t181 = t145+t159; - T t182 = t146+t160; - T t183 = t147+t161; - T t184 = t148+t162; - T t185 = t149+t163; - T t186 = -t123*(t164-udg14); - T t187 = -t123*(t165-udg15); - T t188 = -t123*(t166-udg22); - T t189 = -t123*(t167-udg23); - T t190 = t123*(t164-udg14)*-2.0; - T t191 = t123*(t167-udg23)*-2.0; - T t192 = t123*(t167-udg23); - T t194 = -t123*uinf2*(t130-t154); - T t195 = -t124*uinf2*(t130-t154); - T t196 = -t123*uinf3*(t131-t155); - T t197 = -t124*uinf3*(t131-t155); - T t198 = -t123*uinf4*(t132-t156); - T t199 = -t124*uinf4*(t132-t156); - T t200 = -t123*uinf5*(t133-t157); - T t201 = -t124*uinf5*(t133-t157); - T t202 = -t123*uinf6*(t134-t158); - T t203 = -t124*uinf6*(t134-t158); - T t204 = -t123*uinf2*(t135-t159); - T t205 = -t124*uinf2*(t135-t159); - T t206 = -t123*uinf3*(t136-t160); - T t207 = -t124*uinf3*(t136-t160); - T t208 = -t123*uinf4*(t137-t161); - T t209 = -t124*uinf4*(t137-t161); - T t210 = -t123*uinf5*(t138-t162); - T t211 = -t124*uinf5*(t138-t162); - T t212 = -t123*uinf6*(t139-t163); - T t213 = -t124*uinf6*(t139-t163); - T t214 = t123*uinf2*(t130-t154); - T t215 = t123*uinf3*(t131-t155); - T t216 = t123*uinf4*(t132-t156); - T t217 = t123*uinf5*(t133-t157); - T t218 = t123*uinf6*(t134-t158); - T t219 = t123*uinf2*(t135-t159); - T t220 = t123*uinf3*(t136-t160); - T t221 = t123*uinf4*(t137-t161); - T t222 = t123*uinf5*(t138-t162); - T t223 = t123*uinf6*(t139-t163); - T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); - T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t172 = t168+udg14; - T t173 = t169+udg15; - T t174 = t170+udg22; - T t175 = t171+udg23; - T t193 = t192*2.0; - T t224 = t187+t188; - T t226 = t190+t192; - T t228 = t195+t197+t199+t201+t203; - T t229 = t205+t207+t209+t211+t213; - f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); - f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); - f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); - f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); - f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); - f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); - f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); - f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); + T t7 = 1.0/3.141592653589793; + T t8 = udg1*1.0E+12; + T t9 = udg2*1.0E+12; + T t10 = udg3*1.0E+12; + T t11 = udg4*1.0E+12; + T t12 = udg5*1.0E+12; + T t13 = atan(t8); + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t33 = t2*1.0E+24; + T t34 = t3*1.0E+24; + T t35 = t4*1.0E+24; + T t36 = t5*1.0E+24; + T t37 = t6*1.0E+24; + T t18 = t7*t13; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t38 = t33+1.0; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t23 = t18+1.0/2.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t43 = 1.0/t38; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t28 = t23*udg1; + T t29 = t24*udg2; + T t30 = t25*udg3; + T t31 = t26*udg4; + T t32 = t27*udg5; + T t53 = t7*t8*t43; + T t54 = t7*t9*t44; + T t55 = t7*t10*t45; + T t56 = t7*t11*t46; + T t57 = t7*t12*t47; + T t48 = t28+3.182454300088011E-13; + T t49 = t29+3.182454300088011E-13; + T t50 = t30+3.182454300088011E-13; + T t51 = t31+3.182454300088011E-13; + T t52 = t32+3.182454300088011E-13; + T t58 = t23+t53; + T t59 = t24+t54; + T t60 = t25+t55; + T t61 = t26+t56; + T t62 = t27+t57; + T t63 = t28+t29+t30+t31+t32+1.591227150044006E-12; + T t64 = 1.0/t63; + T t65 = t64*udg8; + T t66 = t64*uinf1; + T t67 = t64*udg6*udg7; + T t68 = t65+t66; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(odg1*t58*udg9+t48*t64*udg6)+nlg2*(odg1*t58*udg17+t48*t64*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(odg1*t59*udg10+t49*t64*udg6)+nlg2*(odg1*t59*udg18+t49*t64*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(odg1*t60*udg11+t50*t64*udg6)+nlg2*(odg1*t60*udg19+t50*t64*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(odg1*t61*udg12+t51*t64*udg6)+nlg2*(odg1*t61*udg20+t51*t64*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(odg1*t62*udg13+t52*t64*udg6)+nlg2*(odg1*t62*udg21+t52*t64*udg7); + f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t64*(udg6*udg6))+nlg2*(t67+odg1*udg22); + f[6*ng+i] = tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t64*(udg7*udg7))+nlg1*(t67+odg1*udg15); + f[7*ng+i] = tau8*(udg8-uhg8)+nlg1*(odg1*udg16+t68*udg6)+nlg2*(odg1*udg24+t68*udg7); + + // T t2 = 1.0/3.141592653589793; + // T t3 = udg1*1.0E+12; + // T t4 = udg2*1.0E+12; + // T t5 = udg3*1.0E+12; + // T t6 = udg4*1.0E+12; + // T t7 = udg5*1.0E+12; + // T t8 = atan(t3); + // T t9 = atan(t4); + // T t10 = atan(t5); + // T t11 = atan(t6); + // T t12 = atan(t7); + // T t13 = t2*t8; + // T t14 = t2*t9; + // T t15 = t2*t10; + // T t16 = t2*t11; + // T t17 = t2*t12; + // T t18 = t13+1.0/2.0; + // T t19 = t14+1.0/2.0; + // T t20 = t15+1.0/2.0; + // T t21 = t16+1.0/2.0; + // T t22 = t17+1.0/2.0; + // T t23 = t18*udg1; + // T t24 = t19*udg2; + // T t25 = t20*udg3; + // T t26 = t21*udg4; + // T t27 = t22*udg5; + // T t28 = t23+3.182454300088011E-13; + // T t29 = t24+3.182454300088011E-13; + // T t30 = t25+3.182454300088011E-13; + // T t31 = t26+3.182454300088011E-13; + // T t32 = t27+3.182454300088011E-13; + // T t33 = t23+t24+t25+t26+t27+1.591227150044006E-12; + // T t34 = 1.0/t33; + // T t35 = t34*udg8; + // T t36 = t34*uinf1; + // T t37 = t34*udg6*udg7; + // T t38 = t35+t36; + // f[0*ng+i] = nlg2*(odg1*udg17*(t2*atan(udg17*1.0E+12)+(t2*udg17*1.0E+12)/((udg17*udg17)*1.0E+24+1.0)+1.0/2.0)+t28*t34*udg7)+tau1*(udg1-uhg1)+nlg1*(t28*t34*udg6+odg1*udg9*(t18+(t2*t3)/((udg1*udg1)*1.0E+24+1.0))); + // f[1*ng+i] = nlg2*(odg1*udg18*(t2*atan(udg18*1.0E+12)+(t2*udg18*1.0E+12)/((udg18*udg18)*1.0E+24+1.0)+1.0/2.0)+t29*t34*udg7)+tau2*(udg2-uhg2)+nlg1*(t29*t34*udg6+odg1*udg10*(t19+(t2*t4)/((udg2*udg2)*1.0E+24+1.0))); + // f[2*ng+i] = nlg2*(odg1*udg19*(t2*atan(udg19*1.0E+12)+(t2*udg19*1.0E+12)/((udg19*udg19)*1.0E+24+1.0)+1.0/2.0)+t30*t34*udg7)+tau3*(udg3-uhg3)+nlg1*(t30*t34*udg6+odg1*udg11*(t20+(t2*t5)/((udg3*udg3)*1.0E+24+1.0))); + // f[3*ng+i] = nlg2*(odg1*udg20*(t2*atan(udg20*1.0E+12)+(t2*udg20*1.0E+12)/((udg20*udg20)*1.0E+24+1.0)+1.0/2.0)+t31*t34*udg7)+tau4*(udg4-uhg4)+nlg1*(t31*t34*udg6+odg1*udg12*(t21+(t2*t6)/((udg4*udg4)*1.0E+24+1.0))); + // f[4*ng+i] = nlg2*(odg1*udg21*(t2*atan(udg21*1.0E+12)+(t2*udg21*1.0E+12)/((udg21*udg21)*1.0E+24+1.0)+1.0/2.0)+t32*t34*udg7)+tau5*(udg5-uhg5)+nlg1*(t32*t34*udg6+odg1*udg13*(t22+(t2*t7)/((udg5*udg5)*1.0E+24+1.0))); + // f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t34*(udg6*udg6))+nlg2*(t37+odg1*udg22); + // f[6*ng+i] = tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t34*(udg7*udg7))+nlg1*(t37+odg1*udg15); + // f[7*ng+i] = tau8*(udg8-uhg8)+nlg1*(odg1*udg16+t38*udg6)+nlg2*(odg1*udg24+t38*udg7); + + // T t2 = udg1*udg1; + // T t3 = udg2*udg2; + // T t4 = udg3*udg3; + // T t5 = udg4*udg4; + // T t6 = udg5*udg5; + // T t7 = udg6*udg6; + // T t8 = udg7*udg7; + // T t9 = udg17*udg17; + // T t10 = udg18*udg18; + // T t11 = udg19*udg19; + // T t12 = udg20*udg20; + // T t13 = udg21*udg21; + // T t14 = 1.0/3.141592653589793; + // T t15 = 1.0/param19; + // T t16 = 1.0/param20; + // T t17 = udg1*1.0E+12; + // T t18 = udg2*1.0E+12; + // T t19 = udg3*1.0E+12; + // T t20 = udg4*1.0E+12; + // T t21 = udg5*1.0E+12; + // T t22 = udg17*1.0E+12; + // T t23 = udg18*1.0E+12; + // T t24 = udg19*1.0E+12; + // T t25 = udg20*1.0E+12; + // T t26 = udg21*1.0E+12; + // T t27 = atan(t17); + // T t28 = atan(t18); + // T t29 = atan(t19); + // T t30 = atan(t20); + // T t31 = atan(t21); + // T t32 = atan(t22); + // T t33 = atan(t23); + // T t34 = atan(t24); + // T t35 = atan(t25); + // T t36 = atan(t26); + // T t57 = t2*1.0E+24; + // T t58 = t3*1.0E+24; + // T t59 = t4*1.0E+24; + // T t60 = t5*1.0E+24; + // T t61 = t6*1.0E+24; + // T t62 = t9*1.0E+24; + // T t63 = t10*1.0E+24; + // T t64 = t11*1.0E+24; + // T t65 = t12*1.0E+24; + // T t66 = t13*1.0E+24; + // T t37 = t14*t27; + // T t38 = t14*t28; + // T t39 = t14*t29; + // T t40 = t14*t30; + // T t41 = t14*t31; + // T t42 = t14*t32; + // T t43 = t14*t33; + // T t44 = t14*t34; + // T t45 = t14*t35; + // T t46 = t14*t36; + // T t67 = t57+1.0; + // T t68 = t58+1.0; + // T t69 = t59+1.0; + // T t70 = t60+1.0; + // T t71 = t61+1.0; + // T t72 = t62+1.0; + // T t73 = t63+1.0; + // T t74 = t64+1.0; + // T t75 = t65+1.0; + // T t76 = t66+1.0; + // T t47 = t37+1.0/2.0; + // T t48 = t38+1.0/2.0; + // T t49 = t39+1.0/2.0; + // T t50 = t40+1.0/2.0; + // T t51 = t41+1.0/2.0; + // T t77 = 1.0/t67; + // T t78 = 1.0/t68; + // T t79 = 1.0/t69; + // T t80 = 1.0/t70; + // T t81 = 1.0/t71; + // T t82 = 1.0/t72; + // T t83 = 1.0/t73; + // T t84 = 1.0/t74; + // T t85 = 1.0/t75; + // T t86 = 1.0/t76; + // T t52 = t47*udg1; + // T t53 = t48*udg2; + // T t54 = t49*udg3; + // T t55 = t50*udg4; + // T t56 = t51*udg5; + // T t92 = t14*t17*t77; + // T t93 = t14*t18*t78; + // T t94 = t14*t19*t79; + // T t95 = t14*t20*t80; + // T t96 = t14*t21*t81; + // T t97 = t14*t22*t82; + // T t98 = t14*t23*t83; + // T t99 = t14*t24*t84; + // T t100 = t14*t25*t85; + // T t101 = t14*t26*t86; + // T t87 = t52+3.182454300088011E-13; + // T t88 = t53+3.182454300088011E-13; + // T t89 = t54+3.182454300088011E-13; + // T t90 = t55+3.182454300088011E-13; + // T t91 = t56+3.182454300088011E-13; + // T t102 = t47+t92; + // T t103 = t48+t93; + // T t104 = t49+t94; + // T t105 = t50+t95; + // T t106 = t51+t96; + // T t107 = t42+t97+1.0/2.0; + // T t108 = t43+t98+1.0/2.0; + // T t109 = t44+t99+1.0/2.0; + // T t110 = t45+t100+1.0/2.0; + // T t111 = t46+t101+1.0/2.0; + // T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + // T t112 = t102*udg9; + // T t113 = t103*udg10; + // T t114 = t104*udg11; + // T t115 = t105*udg12; + // T t116 = t106*udg13; + // T t117 = t107*udg17; + // T t118 = t108*udg18; + // T t119 = t109*udg19; + // T t120 = t110*udg20; + // T t121 = t111*udg21; + // T t123 = 1.0/t122; + // T t124 = t123*t123; + // T t125 = t123*udg8; + // T t126 = t123*uinf1; + // T t127 = t123*udg6*udg7; + // T t130 = t112*t122; + // T t131 = t113*t122; + // T t132 = t114*t122; + // T t133 = t115*t122; + // T t134 = t116*t122; + // T t135 = t117*t122; + // T t136 = t118*t122; + // T t137 = t119*t122; + // T t138 = t120*t122; + // T t139 = t121*t122; + // T t152 = t112+t113+t114+t115+t116; + // T t153 = t117+t118+t119+t120+t121; + // T t128 = (t7*t124)/2.0; + // T t129 = (t8*t124)/2.0; + // T t140 = -t130; + // T t141 = -t131; + // T t142 = -t132; + // T t143 = -t133; + // T t144 = -t134; + // T t145 = -t135; + // T t146 = -t136; + // T t147 = -t137; + // T t148 = -t138; + // T t149 = -t139; + // T t150 = t125+t126; + // T t154 = t87*t152; + // T t155 = t88*t152; + // T t156 = t89*t152; + // T t157 = t90*t152; + // T t158 = t91*t152; + // T t159 = t87*t153; + // T t160 = t88*t153; + // T t161 = t89*t153; + // T t162 = t90*t153; + // T t163 = t91*t153; + // T t164 = t123*t152*udg6; + // T t165 = t123*t152*udg7; + // T t166 = t123*t153*udg6; + // T t167 = t123*t153*udg7; + // T t151 = t128+t129; + // T t168 = -t164; + // T t169 = -t165; + // T t170 = -t166; + // T t171 = -t167; + // T t176 = t140+t154; + // T t177 = t141+t155; + // T t178 = t142+t156; + // T t179 = t143+t157; + // T t180 = t144+t158; + // T t181 = t145+t159; + // T t182 = t146+t160; + // T t183 = t147+t161; + // T t184 = t148+t162; + // T t185 = t149+t163; + // T t186 = -t123*(t164-udg14); + // T t187 = -t123*(t165-udg15); + // T t188 = -t123*(t166-udg22); + // T t189 = -t123*(t167-udg23); + // T t190 = t123*(t164-udg14)*-2.0; + // T t191 = t123*(t167-udg23)*-2.0; + // T t192 = t123*(t167-udg23); + // T t194 = -t123*uinf2*(t130-t154); + // T t195 = -t124*uinf2*(t130-t154); + // T t196 = -t123*uinf3*(t131-t155); + // T t197 = -t124*uinf3*(t131-t155); + // T t198 = -t123*uinf4*(t132-t156); + // T t199 = -t124*uinf4*(t132-t156); + // T t200 = -t123*uinf5*(t133-t157); + // T t201 = -t124*uinf5*(t133-t157); + // T t202 = -t123*uinf6*(t134-t158); + // T t203 = -t124*uinf6*(t134-t158); + // T t204 = -t123*uinf2*(t135-t159); + // T t205 = -t124*uinf2*(t135-t159); + // T t206 = -t123*uinf3*(t136-t160); + // T t207 = -t124*uinf3*(t136-t160); + // T t208 = -t123*uinf4*(t137-t161); + // T t209 = -t124*uinf4*(t137-t161); + // T t210 = -t123*uinf5*(t138-t162); + // T t211 = -t124*uinf5*(t138-t162); + // T t212 = -t123*uinf6*(t139-t163); + // T t213 = -t124*uinf6*(t139-t163); + // T t214 = t123*uinf2*(t130-t154); + // T t215 = t123*uinf3*(t131-t155); + // T t216 = t123*uinf4*(t132-t156); + // T t217 = t123*uinf5*(t133-t157); + // T t218 = t123*uinf6*(t134-t158); + // T t219 = t123*uinf2*(t135-t159); + // T t220 = t123*uinf3*(t136-t160); + // T t221 = t123*uinf4*(t137-t161); + // T t222 = t123*uinf5*(t138-t162); + // T t223 = t123*uinf6*(t139-t163); + // T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + // T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t172 = t168+udg14; + // T t173 = t169+udg15; + // T t174 = t170+udg22; + // T t175 = t171+udg23; + // T t193 = t192*2.0; + // T t224 = t187+t188; + // T t226 = t190+t192; + // T t228 = t195+t197+t199+t201+t203; + // T t229 = t205+t207+t209+t211+t213; + // f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); + // f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); + // f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); + // f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); + // f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); + // f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); + // f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); + // f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); } } @@ -487,10 +615,10 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg mix->setState(rhovec, &rhoe, 0); - mix->averageDiffusionCoeffs(D_i); - nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); - mix->speciesHOverRT(h_i); - nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); uinf1 = mix->P() / rhoe_scale; uinf2 = 0.0; // D_1 @@ -517,260 +645,387 @@ template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg // uinf11 = h_i[4]; // h_5 // uinf12 = mix->viscosity() / mu_scale; // mu // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa - dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); - nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); - uinf14 = dTdU[0]; - uinf15 = dTdU[1]; - uinf16 = dTdU[2]; - uinf17 = dTdU[3]; - uinf18 = dTdU[4]; - uinf19 = dTdU[5]; + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + uinf14 = 0.0; + uinf15 = 0.0; + uinf16 = 0.0; + uinf17 = 0.0; + uinf18 = 0.0; + uinf19 = 0.0; - T t2 = udg1*udg1; + T t2 = udg1*udg1; T t3 = udg2*udg2; T t4 = udg3*udg3; T t5 = udg4*udg4; T t6 = udg5*udg5; - T t7 = udg6*udg6; - T t8 = udg7*udg7; - T t9 = udg17*udg17; - T t10 = udg18*udg18; - T t11 = udg19*udg19; - T t12 = udg20*udg20; - T t13 = udg21*udg21; - T t14 = 1.0/3.141592653589793; - T t15 = 1.0/param19; - T t16 = 1.0/param20; - T t17 = udg1*1.0E+12; - T t18 = udg2*1.0E+12; - T t19 = udg3*1.0E+12; - T t20 = udg4*1.0E+12; - T t21 = udg5*1.0E+12; - T t22 = udg17*1.0E+12; - T t23 = udg18*1.0E+12; - T t24 = udg19*1.0E+12; - T t25 = udg20*1.0E+12; - T t26 = udg21*1.0E+12; - T t27 = atan(t17); - T t28 = atan(t18); - T t29 = atan(t19); - T t30 = atan(t20); - T t31 = atan(t21); - T t32 = atan(t22); - T t33 = atan(t23); - T t34 = atan(t24); - T t35 = atan(t25); - T t36 = atan(t26); - T t57 = t2*1.0E+24; - T t58 = t3*1.0E+24; - T t59 = t4*1.0E+24; - T t60 = t5*1.0E+24; - T t61 = t6*1.0E+24; - T t62 = t9*1.0E+24; - T t63 = t10*1.0E+24; - T t64 = t11*1.0E+24; - T t65 = t12*1.0E+24; - T t66 = t13*1.0E+24; - T t37 = t14*t27; - T t38 = t14*t28; - T t39 = t14*t29; - T t40 = t14*t30; - T t41 = t14*t31; - T t42 = t14*t32; - T t43 = t14*t33; - T t44 = t14*t34; - T t45 = t14*t35; - T t46 = t14*t36; - T t67 = t57+1.0; - T t68 = t58+1.0; - T t69 = t59+1.0; - T t70 = t60+1.0; - T t71 = t61+1.0; - T t72 = t62+1.0; - T t73 = t63+1.0; - T t74 = t64+1.0; - T t75 = t65+1.0; - T t76 = t66+1.0; - T t47 = t37+1.0/2.0; - T t48 = t38+1.0/2.0; - T t49 = t39+1.0/2.0; - T t50 = t40+1.0/2.0; - T t51 = t41+1.0/2.0; - T t77 = 1.0/t67; - T t78 = 1.0/t68; - T t79 = 1.0/t69; - T t80 = 1.0/t70; - T t81 = 1.0/t71; - T t82 = 1.0/t72; - T t83 = 1.0/t73; - T t84 = 1.0/t74; - T t85 = 1.0/t75; - T t86 = 1.0/t76; - T t52 = t47*udg1; - T t53 = t48*udg2; - T t54 = t49*udg3; - T t55 = t50*udg4; - T t56 = t51*udg5; - T t92 = t14*t17*t77; - T t93 = t14*t18*t78; - T t94 = t14*t19*t79; - T t95 = t14*t20*t80; - T t96 = t14*t21*t81; - T t97 = t14*t22*t82; - T t98 = t14*t23*t83; - T t99 = t14*t24*t84; - T t100 = t14*t25*t85; - T t101 = t14*t26*t86; - T t87 = t52+3.182454300088011E-13; - T t88 = t53+3.182454300088011E-13; - T t89 = t54+3.182454300088011E-13; - T t90 = t55+3.182454300088011E-13; - T t91 = t56+3.182454300088011E-13; - T t102 = t47+t92; - T t103 = t48+t93; - T t104 = t49+t94; - T t105 = t50+t95; - T t106 = t51+t96; - T t107 = t42+t97+1.0/2.0; - T t108 = t43+t98+1.0/2.0; - T t109 = t44+t99+1.0/2.0; - T t110 = t45+t100+1.0/2.0; - T t111 = t46+t101+1.0/2.0; - T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; - T t112 = t102*udg9; - T t113 = t103*udg10; - T t114 = t104*udg11; - T t115 = t105*udg12; - T t116 = t106*udg13; - T t117 = t107*udg17; - T t118 = t108*udg18; - T t119 = t109*udg19; - T t120 = t110*udg20; - T t121 = t111*udg21; - T t123 = 1.0/t122; - T t124 = t123*t123; - T t125 = t123*udg8; - T t126 = t123*uinf1; - T t127 = t123*udg6*udg7; - T t130 = t112*t122; - T t131 = t113*t122; - T t132 = t114*t122; - T t133 = t115*t122; - T t134 = t116*t122; - T t135 = t117*t122; - T t136 = t118*t122; - T t137 = t119*t122; - T t138 = t120*t122; - T t139 = t121*t122; - T t152 = t112+t113+t114+t115+t116; - T t153 = t117+t118+t119+t120+t121; - T t128 = (t7*t124)/2.0; - T t129 = (t8*t124)/2.0; - T t140 = -t130; - T t141 = -t131; - T t142 = -t132; - T t143 = -t133; - T t144 = -t134; - T t145 = -t135; - T t146 = -t136; - T t147 = -t137; - T t148 = -t138; - T t149 = -t139; - T t150 = t125+t126; - T t154 = t87*t152; - T t155 = t88*t152; - T t156 = t89*t152; - T t157 = t90*t152; - T t158 = t91*t152; - T t159 = t87*t153; - T t160 = t88*t153; - T t161 = t89*t153; - T t162 = t90*t153; - T t163 = t91*t153; - T t164 = t123*t152*udg6; - T t165 = t123*t152*udg7; - T t166 = t123*t153*udg6; - T t167 = t123*t153*udg7; - T t151 = t128+t129; - T t168 = -t164; - T t169 = -t165; - T t170 = -t166; - T t171 = -t167; - T t176 = t140+t154; - T t177 = t141+t155; - T t178 = t142+t156; - T t179 = t143+t157; - T t180 = t144+t158; - T t181 = t145+t159; - T t182 = t146+t160; - T t183 = t147+t161; - T t184 = t148+t162; - T t185 = t149+t163; - T t186 = -t123*(t164-udg14); - T t187 = -t123*(t165-udg15); - T t188 = -t123*(t166-udg22); - T t189 = -t123*(t167-udg23); - T t190 = t123*(t164-udg14)*-2.0; - T t191 = t123*(t167-udg23)*-2.0; - T t192 = t123*(t167-udg23); - T t194 = -t123*uinf2*(t130-t154); - T t195 = -t124*uinf2*(t130-t154); - T t196 = -t123*uinf3*(t131-t155); - T t197 = -t124*uinf3*(t131-t155); - T t198 = -t123*uinf4*(t132-t156); - T t199 = -t124*uinf4*(t132-t156); - T t200 = -t123*uinf5*(t133-t157); - T t201 = -t124*uinf5*(t133-t157); - T t202 = -t123*uinf6*(t134-t158); - T t203 = -t124*uinf6*(t134-t158); - T t204 = -t123*uinf2*(t135-t159); - T t205 = -t124*uinf2*(t135-t159); - T t206 = -t123*uinf3*(t136-t160); - T t207 = -t124*uinf3*(t136-t160); - T t208 = -t123*uinf4*(t137-t161); - T t209 = -t124*uinf4*(t137-t161); - T t210 = -t123*uinf5*(t138-t162); - T t211 = -t124*uinf5*(t138-t162); - T t212 = -t123*uinf6*(t139-t163); - T t213 = -t124*uinf6*(t139-t163); - T t214 = t123*uinf2*(t130-t154); - T t215 = t123*uinf3*(t131-t155); - T t216 = t123*uinf4*(t132-t156); - T t217 = t123*uinf5*(t133-t157); - T t218 = t123*uinf6*(t134-t158); - T t219 = t123*uinf2*(t135-t159); - T t220 = t123*uinf3*(t136-t160); - T t221 = t123*uinf4*(t137-t161); - T t222 = t123*uinf5*(t138-t162); - T t223 = t123*uinf6*(t139-t163); - T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); - T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t172 = t168+udg14; - T t173 = t169+udg15; - T t174 = t170+udg22; - T t175 = t171+udg23; - T t193 = t192*2.0; - T t224 = t187+t188; - T t226 = t190+t192; - T t228 = t195+t197+t199+t201+t203; - T t229 = t205+t207+t209+t211+t213; - f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); - f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); - f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); - f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); - f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); - f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); - f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); - f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); + T t7 = 1.0/3.141592653589793; + T t8 = udg1*1.0E+12; + T t9 = udg2*1.0E+12; + T t10 = udg3*1.0E+12; + T t11 = udg4*1.0E+12; + T t12 = udg5*1.0E+12; + T t13 = atan(t8); + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t33 = t2*1.0E+24; + T t34 = t3*1.0E+24; + T t35 = t4*1.0E+24; + T t36 = t5*1.0E+24; + T t37 = t6*1.0E+24; + T t18 = t7*t13; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t38 = t33+1.0; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t23 = t18+1.0/2.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t43 = 1.0/t38; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t28 = t23*udg1; + T t29 = t24*udg2; + T t30 = t25*udg3; + T t31 = t26*udg4; + T t32 = t27*udg5; + T t53 = t7*t8*t43; + T t54 = t7*t9*t44; + T t55 = t7*t10*t45; + T t56 = t7*t11*t46; + T t57 = t7*t12*t47; + T t48 = t28+3.182454300088011E-13; + T t49 = t29+3.182454300088011E-13; + T t50 = t30+3.182454300088011E-13; + T t51 = t31+3.182454300088011E-13; + T t52 = t32+3.182454300088011E-13; + T t58 = t23+t53; + T t59 = t24+t54; + T t60 = t25+t55; + T t61 = t26+t56; + T t62 = t27+t57; + T t63 = t28+t29+t30+t31+t32+1.591227150044006E-12; + T t64 = 1.0/t63; + T t65 = t64*udg8; + T t66 = t64*uinf1; + T t67 = t64*udg6*udg7; + T t68 = t65+t66; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(odg1*t58*udg9+t48*t64*udg6)+nlg2*(odg1*t58*udg17+t48*t64*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(odg1*t59*udg10+t49*t64*udg6)+nlg2*(odg1*t59*udg18+t49*t64*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(odg1*t60*udg11+t50*t64*udg6)+nlg2*(odg1*t60*udg19+t50*t64*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(odg1*t61*udg12+t51*t64*udg6)+nlg2*(odg1*t61*udg20+t51*t64*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(odg1*t62*udg13+t52*t64*udg6)+nlg2*(odg1*t62*udg21+t52*t64*udg7); + f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t64*(udg6*udg6))+nlg2*(t67+odg1*udg22); + f[6*ng+i] = tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t64*(udg7*udg7))+nlg1*(t67+odg1*udg15); + f[7*ng+i] = tau8*(udg8-uhg8)+nlg1*(odg1*udg16+t68*udg6)+nlg2*(odg1*udg24+t68*udg7); + + // T t2 = 1.0/3.141592653589793; + // T t3 = udg1*1.0E+12; + // T t4 = udg2*1.0E+12; + // T t5 = udg3*1.0E+12; + // T t6 = udg4*1.0E+12; + // T t7 = udg5*1.0E+12; + // T t8 = atan(t3); + // T t9 = atan(t4); + // T t10 = atan(t5); + // T t11 = atan(t6); + // T t12 = atan(t7); + // T t13 = t2*t8; + // T t14 = t2*t9; + // T t15 = t2*t10; + // T t16 = t2*t11; + // T t17 = t2*t12; + // T t18 = t13+1.0/2.0; + // T t19 = t14+1.0/2.0; + // T t20 = t15+1.0/2.0; + // T t21 = t16+1.0/2.0; + // T t22 = t17+1.0/2.0; + // T t23 = t18*udg1; + // T t24 = t19*udg2; + // T t25 = t20*udg3; + // T t26 = t21*udg4; + // T t27 = t22*udg5; + // T t28 = t23+3.182454300088011E-13; + // T t29 = t24+3.182454300088011E-13; + // T t30 = t25+3.182454300088011E-13; + // T t31 = t26+3.182454300088011E-13; + // T t32 = t27+3.182454300088011E-13; + // T t33 = t23+t24+t25+t26+t27+1.591227150044006E-12; + // T t34 = 1.0/t33; + // T t35 = t34*udg8; + // T t36 = t34*uinf1; + // T t37 = t34*udg6*udg7; + // T t38 = t35+t36; + // f[0*ng+i] = nlg2*(odg1*udg17*(t2*atan(udg17*1.0E+12)+(t2*udg17*1.0E+12)/((udg17*udg17)*1.0E+24+1.0)+1.0/2.0)+t28*t34*udg7)+tau1*(udg1-uhg1)+nlg1*(t28*t34*udg6+odg1*udg9*(t18+(t2*t3)/((udg1*udg1)*1.0E+24+1.0))); + // f[1*ng+i] = nlg2*(odg1*udg18*(t2*atan(udg18*1.0E+12)+(t2*udg18*1.0E+12)/((udg18*udg18)*1.0E+24+1.0)+1.0/2.0)+t29*t34*udg7)+tau2*(udg2-uhg2)+nlg1*(t29*t34*udg6+odg1*udg10*(t19+(t2*t4)/((udg2*udg2)*1.0E+24+1.0))); + // f[2*ng+i] = nlg2*(odg1*udg19*(t2*atan(udg19*1.0E+12)+(t2*udg19*1.0E+12)/((udg19*udg19)*1.0E+24+1.0)+1.0/2.0)+t30*t34*udg7)+tau3*(udg3-uhg3)+nlg1*(t30*t34*udg6+odg1*udg11*(t20+(t2*t5)/((udg3*udg3)*1.0E+24+1.0))); + // f[3*ng+i] = nlg2*(odg1*udg20*(t2*atan(udg20*1.0E+12)+(t2*udg20*1.0E+12)/((udg20*udg20)*1.0E+24+1.0)+1.0/2.0)+t31*t34*udg7)+tau4*(udg4-uhg4)+nlg1*(t31*t34*udg6+odg1*udg12*(t21+(t2*t6)/((udg4*udg4)*1.0E+24+1.0))); + // f[4*ng+i] = nlg2*(odg1*udg21*(t2*atan(udg21*1.0E+12)+(t2*udg21*1.0E+12)/((udg21*udg21)*1.0E+24+1.0)+1.0/2.0)+t32*t34*udg7)+tau5*(udg5-uhg5)+nlg1*(t32*t34*udg6+odg1*udg13*(t22+(t2*t7)/((udg5*udg5)*1.0E+24+1.0))); + // f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t34*(udg6*udg6))+nlg2*(t37+odg1*udg22); + // f[6*ng+i] = tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t34*(udg7*udg7))+nlg1*(t37+odg1*udg15); + // f[7*ng+i] = tau8*(udg8-uhg8)+nlg1*(odg1*udg16+t38*udg6)+nlg2*(odg1*udg24+t38*udg7); + // T t2 = udg1*udg1; + // T t3 = udg2*udg2; + // T t4 = udg3*udg3; + // T t5 = udg4*udg4; + // T t6 = udg5*udg5; + // T t7 = udg6*udg6; + // T t8 = udg7*udg7; + // T t9 = udg17*udg17; + // T t10 = udg18*udg18; + // T t11 = udg19*udg19; + // T t12 = udg20*udg20; + // T t13 = udg21*udg21; + // T t14 = 1.0/3.141592653589793; + // T t15 = 1.0/param19; + // T t16 = 1.0/param20; + // T t17 = udg1*1.0E+12; + // T t18 = udg2*1.0E+12; + // T t19 = udg3*1.0E+12; + // T t20 = udg4*1.0E+12; + // T t21 = udg5*1.0E+12; + // T t22 = udg17*1.0E+12; + // T t23 = udg18*1.0E+12; + // T t24 = udg19*1.0E+12; + // T t25 = udg20*1.0E+12; + // T t26 = udg21*1.0E+12; + // T t27 = atan(t17); + // T t28 = atan(t18); + // T t29 = atan(t19); + // T t30 = atan(t20); + // T t31 = atan(t21); + // T t32 = atan(t22); + // T t33 = atan(t23); + // T t34 = atan(t24); + // T t35 = atan(t25); + // T t36 = atan(t26); + // T t57 = t2*1.0E+24; + // T t58 = t3*1.0E+24; + // T t59 = t4*1.0E+24; + // T t60 = t5*1.0E+24; + // T t61 = t6*1.0E+24; + // T t62 = t9*1.0E+24; + // T t63 = t10*1.0E+24; + // T t64 = t11*1.0E+24; + // T t65 = t12*1.0E+24; + // T t66 = t13*1.0E+24; + // T t37 = t14*t27; + // T t38 = t14*t28; + // T t39 = t14*t29; + // T t40 = t14*t30; + // T t41 = t14*t31; + // T t42 = t14*t32; + // T t43 = t14*t33; + // T t44 = t14*t34; + // T t45 = t14*t35; + // T t46 = t14*t36; + // T t67 = t57+1.0; + // T t68 = t58+1.0; + // T t69 = t59+1.0; + // T t70 = t60+1.0; + // T t71 = t61+1.0; + // T t72 = t62+1.0; + // T t73 = t63+1.0; + // T t74 = t64+1.0; + // T t75 = t65+1.0; + // T t76 = t66+1.0; + // T t47 = t37+1.0/2.0; + // T t48 = t38+1.0/2.0; + // T t49 = t39+1.0/2.0; + // T t50 = t40+1.0/2.0; + // T t51 = t41+1.0/2.0; + // T t77 = 1.0/t67; + // T t78 = 1.0/t68; + // T t79 = 1.0/t69; + // T t80 = 1.0/t70; + // T t81 = 1.0/t71; + // T t82 = 1.0/t72; + // T t83 = 1.0/t73; + // T t84 = 1.0/t74; + // T t85 = 1.0/t75; + // T t86 = 1.0/t76; + // T t52 = t47*udg1; + // T t53 = t48*udg2; + // T t54 = t49*udg3; + // T t55 = t50*udg4; + // T t56 = t51*udg5; + // T t92 = t14*t17*t77; + // T t93 = t14*t18*t78; + // T t94 = t14*t19*t79; + // T t95 = t14*t20*t80; + // T t96 = t14*t21*t81; + // T t97 = t14*t22*t82; + // T t98 = t14*t23*t83; + // T t99 = t14*t24*t84; + // T t100 = t14*t25*t85; + // T t101 = t14*t26*t86; + // T t87 = t52+3.182454300088011E-13; + // T t88 = t53+3.182454300088011E-13; + // T t89 = t54+3.182454300088011E-13; + // T t90 = t55+3.182454300088011E-13; + // T t91 = t56+3.182454300088011E-13; + // T t102 = t47+t92; + // T t103 = t48+t93; + // T t104 = t49+t94; + // T t105 = t50+t95; + // T t106 = t51+t96; + // T t107 = t42+t97+1.0/2.0; + // T t108 = t43+t98+1.0/2.0; + // T t109 = t44+t99+1.0/2.0; + // T t110 = t45+t100+1.0/2.0; + // T t111 = t46+t101+1.0/2.0; + // T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + // T t112 = t102*udg9; + // T t113 = t103*udg10; + // T t114 = t104*udg11; + // T t115 = t105*udg12; + // T t116 = t106*udg13; + // T t117 = t107*udg17; + // T t118 = t108*udg18; + // T t119 = t109*udg19; + // T t120 = t110*udg20; + // T t121 = t111*udg21; + // T t123 = 1.0/t122; + // T t124 = t123*t123; + // T t125 = t123*udg8; + // T t126 = t123*uinf1; + // T t127 = t123*udg6*udg7; + // T t130 = t112*t122; + // T t131 = t113*t122; + // T t132 = t114*t122; + // T t133 = t115*t122; + // T t134 = t116*t122; + // T t135 = t117*t122; + // T t136 = t118*t122; + // T t137 = t119*t122; + // T t138 = t120*t122; + // T t139 = t121*t122; + // T t152 = t112+t113+t114+t115+t116; + // T t153 = t117+t118+t119+t120+t121; + // T t128 = (t7*t124)/2.0; + // T t129 = (t8*t124)/2.0; + // T t140 = -t130; + // T t141 = -t131; + // T t142 = -t132; + // T t143 = -t133; + // T t144 = -t134; + // T t145 = -t135; + // T t146 = -t136; + // T t147 = -t137; + // T t148 = -t138; + // T t149 = -t139; + // T t150 = t125+t126; + // T t154 = t87*t152; + // T t155 = t88*t152; + // T t156 = t89*t152; + // T t157 = t90*t152; + // T t158 = t91*t152; + // T t159 = t87*t153; + // T t160 = t88*t153; + // T t161 = t89*t153; + // T t162 = t90*t153; + // T t163 = t91*t153; + // T t164 = t123*t152*udg6; + // T t165 = t123*t152*udg7; + // T t166 = t123*t153*udg6; + // T t167 = t123*t153*udg7; + // T t151 = t128+t129; + // T t168 = -t164; + // T t169 = -t165; + // T t170 = -t166; + // T t171 = -t167; + // T t176 = t140+t154; + // T t177 = t141+t155; + // T t178 = t142+t156; + // T t179 = t143+t157; + // T t180 = t144+t158; + // T t181 = t145+t159; + // T t182 = t146+t160; + // T t183 = t147+t161; + // T t184 = t148+t162; + // T t185 = t149+t163; + // T t186 = -t123*(t164-udg14); + // T t187 = -t123*(t165-udg15); + // T t188 = -t123*(t166-udg22); + // T t189 = -t123*(t167-udg23); + // T t190 = t123*(t164-udg14)*-2.0; + // T t191 = t123*(t167-udg23)*-2.0; + // T t192 = t123*(t167-udg23); + // T t194 = -t123*uinf2*(t130-t154); + // T t195 = -t124*uinf2*(t130-t154); + // T t196 = -t123*uinf3*(t131-t155); + // T t197 = -t124*uinf3*(t131-t155); + // T t198 = -t123*uinf4*(t132-t156); + // T t199 = -t124*uinf4*(t132-t156); + // T t200 = -t123*uinf5*(t133-t157); + // T t201 = -t124*uinf5*(t133-t157); + // T t202 = -t123*uinf6*(t134-t158); + // T t203 = -t124*uinf6*(t134-t158); + // T t204 = -t123*uinf2*(t135-t159); + // T t205 = -t124*uinf2*(t135-t159); + // T t206 = -t123*uinf3*(t136-t160); + // T t207 = -t124*uinf3*(t136-t160); + // T t208 = -t123*uinf4*(t137-t161); + // T t209 = -t124*uinf4*(t137-t161); + // T t210 = -t123*uinf5*(t138-t162); + // T t211 = -t124*uinf5*(t138-t162); + // T t212 = -t123*uinf6*(t139-t163); + // T t213 = -t124*uinf6*(t139-t163); + // T t214 = t123*uinf2*(t130-t154); + // T t215 = t123*uinf3*(t131-t155); + // T t216 = t123*uinf4*(t132-t156); + // T t217 = t123*uinf5*(t133-t157); + // T t218 = t123*uinf6*(t134-t158); + // T t219 = t123*uinf2*(t135-t159); + // T t220 = t123*uinf3*(t136-t160); + // T t221 = t123*uinf4*(t137-t161); + // T t222 = t123*uinf5*(t138-t162); + // T t223 = t123*uinf6*(t139-t163); + // T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + // T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t172 = t168+udg14; + // T t173 = t169+udg15; + // T t174 = t170+udg22; + // T t175 = t171+udg23; + // T t193 = t192*2.0; + // T t224 = t187+t188; + // T t226 = t190+t192; + // T t228 = t195+t197+t199+t201+t203; + // T t229 = t205+t207+t209+t211+t213; + // f[0*ng+i] = nlg1*(t214+t230+odg1*t112+t87*t123*udg6)+nlg2*(t219+t235+odg1*t117+t87*t123*udg7)+tau1*(udg1-uhg1); + // f[1*ng+i] = nlg1*(t215+t231+odg1*t113+t88*t123*udg6)+nlg2*(t220+t236+odg1*t118+t88*t123*udg7)+tau2*(udg2-uhg2); + // f[2*ng+i] = nlg1*(t216+t232+odg1*t114+t89*t123*udg6)+nlg2*(t221+t237+odg1*t119+t89*t123*udg7)+tau3*(udg3-uhg3); + // f[3*ng+i] = nlg1*(t217+t233+odg1*t115+t90*t123*udg6)+nlg2*(t222+t238+odg1*t120+t90*t123*udg7)+tau4*(udg4-uhg4); + // f[4*ng+i] = nlg1*(t218+t234+odg1*t116+t91*t123*udg6)+nlg2*(t223+t239+odg1*t121+t91*t123*udg7)+tau5*(udg5-uhg5); + // f[5*ng+i] = nlg2*(t127+t227+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)); + // f[6*ng+i] = nlg1*(t127+t227+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)); + // f[7*ng+i] = -nlg1*(-odg1*udg16-t150*udg6+uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)+t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0)+t16*t123*udg7*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))-nlg2*(-odg1*udg24-t150*udg7+uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)-t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0)+t16*t123*udg6*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)))+tau8*(udg8-uhg8); } } @@ -841,10 +1096,10 @@ template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg mix->setState(rhovec, &rhoe, 0); - mix->averageDiffusionCoeffs(D_i); - nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); - mix->speciesHOverRT(h_i); - nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); uinf1 = mix->P()/rhoe_scale; @@ -870,147 +1125,222 @@ template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg // uinf18 = dTdU[4]; // uinf19 = dTdU[5]; - T t2 = udg1*udg1; - T t3 = udg2*udg2; - T t4 = udg3*udg3; - T t5 = udg4*udg4; - T t6 = udg5*udg5; - T t7 = udg17*udg17; - T t8 = udg18*udg18; - T t9 = udg19*udg19; - T t10 = udg20*udg20; - T t11 = udg21*udg21; - T t12 = 1.0/3.141592653589793; - T t13 = 1.0/param20; - T t14 = udg1*1.0E+12; - T t15 = udg2*1.0E+12; - T t16 = udg3*1.0E+12; - T t17 = udg4*1.0E+12; - T t18 = udg5*1.0E+12; - T t19 = udg17*1.0E+12; - T t20 = udg18*1.0E+12; - T t21 = udg19*1.0E+12; - T t22 = udg20*1.0E+12; - T t23 = udg21*1.0E+12; - T t24 = atan(t14); - T t25 = atan(t15); - T t26 = atan(t16); - T t27 = atan(t17); - T t28 = atan(t18); - T t29 = atan(t19); - T t30 = atan(t20); - T t31 = atan(t21); - T t32 = atan(t22); - T t33 = atan(t23); - T t54 = t2*1.0E+24; - T t55 = t3*1.0E+24; - T t56 = t4*1.0E+24; - T t57 = t5*1.0E+24; - T t58 = t6*1.0E+24; - T t59 = t7*1.0E+24; - T t60 = t8*1.0E+24; - T t61 = t9*1.0E+24; - T t62 = t10*1.0E+24; - T t63 = t11*1.0E+24; - T t34 = t12*t24; - T t35 = t12*t25; - T t36 = t12*t26; - T t37 = t12*t27; - T t38 = t12*t28; - T t39 = t12*t29; - T t40 = t12*t30; - T t41 = t12*t31; - T t42 = t12*t32; - T t43 = t12*t33; - T t64 = t54+1.0; - T t65 = t55+1.0; - T t66 = t56+1.0; - T t67 = t57+1.0; - T t68 = t58+1.0; - T t69 = t59+1.0; - T t70 = t60+1.0; - T t71 = t61+1.0; - T t72 = t62+1.0; - T t73 = t63+1.0; - T t44 = t34+1.0/2.0; - T t45 = t35+1.0/2.0; - T t46 = t36+1.0/2.0; - T t47 = t37+1.0/2.0; - T t48 = t38+1.0/2.0; - T t74 = 1.0/t64; - T t75 = 1.0/t65; - T t76 = 1.0/t66; - T t77 = 1.0/t67; - T t78 = 1.0/t68; - T t79 = 1.0/t69; - T t80 = 1.0/t70; - T t81 = 1.0/t71; - T t82 = 1.0/t72; - T t83 = 1.0/t73; - T t49 = t44*udg1; - T t50 = t45*udg2; - T t51 = t46*udg3; - T t52 = t47*udg4; - T t53 = t48*udg5; - T t84 = t12*t14*t74; - T t85 = t12*t15*t75; - T t86 = t12*t16*t76; - T t87 = t12*t17*t77; - T t88 = t12*t18*t78; - T t89 = t12*t19*t79; - T t90 = t12*t20*t80; - T t91 = t12*t21*t81; - T t92 = t12*t22*t82; - T t93 = t12*t23*t83; - T t94 = t44+t84; - T t95 = t45+t85; - T t96 = t46+t86; - T t97 = t47+t87; - T t98 = t48+t88; - T t99 = t39+t89+1.0/2.0; - T t100 = t40+t90+1.0/2.0; - T t101 = t41+t91+1.0/2.0; - T t102 = t42+t92+1.0/2.0; - T t103 = t43+t93+1.0/2.0; - T t114 = t49+t50+t51+t52+t53+1.591227150044006E-12; - T t104 = t94*udg9; - T t105 = t95*udg10; - T t106 = t96*udg11; - T t107 = t97*udg12; - T t108 = t98*udg13; - T t109 = t99*udg17; - T t110 = t100*udg18; - T t111 = t101*udg19; - T t112 = t102*udg20; - T t113 = t103*udg21; - T t115 = 1.0/t114; - T t116 = t115*udg6*udg7; - T t117 = t104+t105+t106+t107+t108; - T t118 = t109+t110+t111+t112+t113; - T t119 = t115*t117*udg6; - T t120 = t115*t117*udg7; - T t121 = t115*t118*udg6; - T t122 = t115*t118*udg7; - T t123 = -t119; - T t124 = -t120; - T t125 = -t121; - T t126 = -t122; - T t131 = -t115*(t120-udg15); - T t132 = -t115*(t121-udg22); - T t134 = -t13*uinf12*(t115*(t120-udg15)+t115*(t121-udg22)); - T t127 = t123+udg14; - T t128 = t124+udg15; - T t129 = t125+udg22; - T t130 = t126+udg23; - T t133 = t131+t132; + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+12; + T t4 = udg2*1.0E+12; + T t5 = udg3*1.0E+12; + T t6 = udg4*1.0E+12; + T t7 = udg5*1.0E+12; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591227150044006E-12; + T t29 = 1.0/t28; + T t30 = t29*udg6*udg7; f[0*ng+i] = 0.0; f[1*ng+i] = 0.0; f[2*ng+i] = 0.0; f[3*ng+i] = 0.0; f[4*ng+i] = 0.0; - f[5*ng+i] = nlg1*(uinf1+odg1*udg14+t115*(udg6*udg6)-t13*uinf12*(t115*(t119-udg14)*2.0-t115*(t122-udg23))*(2.0/3.0))+nlg2*(t116+t134+odg1*udg22)+tau6*(udg6-uhg6); - f[6*ng+i] = nlg2*(uinf1+odg1*udg23+t115*(udg7*udg7)+t13*uinf12*(t115*(t119-udg14)-t115*(t122-udg23)*2.0)*(2.0/3.0))+nlg1*(t116+t134+odg1*udg15)+tau7*(udg7-uhg7); + f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t29*(udg6*udg6))+nlg2*(t30+odg1*udg22); + f[6*ng+i] = tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t29*(udg7*udg7))+nlg1*(t30+odg1*udg15); f[7*ng+i] = 0.0; + + // T t2 = 1.0/3.141592653589793; + // T t3 = udg1*1.0E+12; + // T t4 = udg2*1.0E+12; + // T t5 = udg3*1.0E+12; + // T t6 = udg4*1.0E+12; + // T t7 = udg5*1.0E+12; + // T t8 = atan(t3); + // T t9 = atan(t4); + // T t10 = atan(t5); + // T t11 = atan(t6); + // T t12 = atan(t7); + // T t13 = t2*t8; + // T t14 = t2*t9; + // T t15 = t2*t10; + // T t16 = t2*t11; + // T t17 = t2*t12; + // T t18 = t13+1.0/2.0; + // T t19 = t14+1.0/2.0; + // T t20 = t15+1.0/2.0; + // T t21 = t16+1.0/2.0; + // T t22 = t17+1.0/2.0; + // T t23 = t18*udg1; + // T t24 = t19*udg2; + // T t25 = t20*udg3; + // T t26 = t21*udg4; + // T t27 = t22*udg5; + // T t28 = t23+t24+t25+t26+t27+1.591227150044006E-12; + // T t29 = 1.0/t28; + // T t30 = t29*udg6*udg7; + // f[0*ng+i] = 0.0; + // f[1*ng+i] = 0.0; + // f[2*ng+i] = 0.0; + // f[3*ng+i] = 0.0; + // f[4*ng+i] = 0.0; + // f[5*ng+i] = tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t29*(udg6*udg6))+nlg2*(t30+odg1*udg22); + // f[6*ng+i] = tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t29*(udg7*udg7))+nlg1*(t30+odg1*udg15); + // f[7*ng+i] = 0.0; + // T t2 = udg1*udg1; + // T t3 = udg2*udg2; + // T t4 = udg3*udg3; + // T t5 = udg4*udg4; + // T t6 = udg5*udg5; + // T t7 = udg17*udg17; + // T t8 = udg18*udg18; + // T t9 = udg19*udg19; + // T t10 = udg20*udg20; + // T t11 = udg21*udg21; + // T t12 = 1.0/3.141592653589793; + // T t13 = 1.0/param20; + // T t14 = udg1*1.0E+12; + // T t15 = udg2*1.0E+12; + // T t16 = udg3*1.0E+12; + // T t17 = udg4*1.0E+12; + // T t18 = udg5*1.0E+12; + // T t19 = udg17*1.0E+12; + // T t20 = udg18*1.0E+12; + // T t21 = udg19*1.0E+12; + // T t22 = udg20*1.0E+12; + // T t23 = udg21*1.0E+12; + // T t24 = atan(t14); + // T t25 = atan(t15); + // T t26 = atan(t16); + // T t27 = atan(t17); + // T t28 = atan(t18); + // T t29 = atan(t19); + // T t30 = atan(t20); + // T t31 = atan(t21); + // T t32 = atan(t22); + // T t33 = atan(t23); + // T t54 = t2*1.0E+24; + // T t55 = t3*1.0E+24; + // T t56 = t4*1.0E+24; + // T t57 = t5*1.0E+24; + // T t58 = t6*1.0E+24; + // T t59 = t7*1.0E+24; + // T t60 = t8*1.0E+24; + // T t61 = t9*1.0E+24; + // T t62 = t10*1.0E+24; + // T t63 = t11*1.0E+24; + // T t34 = t12*t24; + // T t35 = t12*t25; + // T t36 = t12*t26; + // T t37 = t12*t27; + // T t38 = t12*t28; + // T t39 = t12*t29; + // T t40 = t12*t30; + // T t41 = t12*t31; + // T t42 = t12*t32; + // T t43 = t12*t33; + // T t64 = t54+1.0; + // T t65 = t55+1.0; + // T t66 = t56+1.0; + // T t67 = t57+1.0; + // T t68 = t58+1.0; + // T t69 = t59+1.0; + // T t70 = t60+1.0; + // T t71 = t61+1.0; + // T t72 = t62+1.0; + // T t73 = t63+1.0; + // T t44 = t34+1.0/2.0; + // T t45 = t35+1.0/2.0; + // T t46 = t36+1.0/2.0; + // T t47 = t37+1.0/2.0; + // T t48 = t38+1.0/2.0; + // T t74 = 1.0/t64; + // T t75 = 1.0/t65; + // T t76 = 1.0/t66; + // T t77 = 1.0/t67; + // T t78 = 1.0/t68; + // T t79 = 1.0/t69; + // T t80 = 1.0/t70; + // T t81 = 1.0/t71; + // T t82 = 1.0/t72; + // T t83 = 1.0/t73; + // T t49 = t44*udg1; + // T t50 = t45*udg2; + // T t51 = t46*udg3; + // T t52 = t47*udg4; + // T t53 = t48*udg5; + // T t84 = t12*t14*t74; + // T t85 = t12*t15*t75; + // T t86 = t12*t16*t76; + // T t87 = t12*t17*t77; + // T t88 = t12*t18*t78; + // T t89 = t12*t19*t79; + // T t90 = t12*t20*t80; + // T t91 = t12*t21*t81; + // T t92 = t12*t22*t82; + // T t93 = t12*t23*t83; + // T t94 = t44+t84; + // T t95 = t45+t85; + // T t96 = t46+t86; + // T t97 = t47+t87; + // T t98 = t48+t88; + // T t99 = t39+t89+1.0/2.0; + // T t100 = t40+t90+1.0/2.0; + // T t101 = t41+t91+1.0/2.0; + // T t102 = t42+t92+1.0/2.0; + // T t103 = t43+t93+1.0/2.0; + // T t114 = t49+t50+t51+t52+t53+1.591227150044006E-12; + // T t104 = t94*udg9; + // T t105 = t95*udg10; + // T t106 = t96*udg11; + // T t107 = t97*udg12; + // T t108 = t98*udg13; + // T t109 = t99*udg17; + // T t110 = t100*udg18; + // T t111 = t101*udg19; + // T t112 = t102*udg20; + // T t113 = t103*udg21; + // T t115 = 1.0/t114; + // T t116 = t115*udg6*udg7; + // T t117 = t104+t105+t106+t107+t108; + // T t118 = t109+t110+t111+t112+t113; + // T t119 = t115*t117*udg6; + // T t120 = t115*t117*udg7; + // T t121 = t115*t118*udg6; + // T t122 = t115*t118*udg7; + // T t123 = -t119; + // T t124 = -t120; + // T t125 = -t121; + // T t126 = -t122; + // T t131 = -t115*(t120-udg15); + // T t132 = -t115*(t121-udg22); + // T t134 = -t13*uinf12*(t115*(t120-udg15)+t115*(t121-udg22)); + // T t127 = t123+udg14; + // T t128 = t124+udg15; + // T t129 = t125+udg22; + // T t130 = t126+udg23; + // T t133 = t131+t132; + // f[0*ng+i] = 0.0; + // f[1*ng+i] = 0.0; + // f[2*ng+i] = 0.0; + // f[3*ng+i] = 0.0; + // f[4*ng+i] = 0.0; + // f[5*ng+i] = nlg1*(uinf1+odg1*udg14+t115*(udg6*udg6)-t13*uinf12*(t115*(t119-udg14)*2.0-t115*(t122-udg23))*(2.0/3.0))+nlg2*(t116+t134+odg1*udg22)+tau6*(udg6-uhg6); + // f[6*ng+i] = nlg2*(uinf1+odg1*udg23+t115*(udg7*udg7)+t13*uinf12*(t115*(t119-udg14)-t115*(t122-udg23)*2.0)*(2.0/3.0))+nlg1*(t116+t134+odg1*udg15)+tau7*(udg7-uhg7); + // f[7*ng+i] = 0.0; } } diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP.cpp new file mode 100644 index 00000000..14597eff --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP.cpp @@ -0,0 +1,928 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + // uinf14 = 0.0; + // uinf15 = 0.0; + // uinf16 = 0.0; + // uinf17 = 0.0; + // uinf18 = 0.0; + // uinf19 = 0.0; + + T t2 = odg2+uinf13; + T t3 = udg1*udg1; + T t4 = udg2*udg2; + T t5 = udg3*udg3; + T t6 = udg4*udg4; + T t7 = udg5*udg5; + T t8 = udg6*udg6; + T t9 = udg7*udg7; + T t10 = 1.0/3.141592653589793; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t13 = udg1*1.0E+12; + T t14 = udg2*1.0E+12; + T t15 = udg3*1.0E+12; + T t16 = udg4*1.0E+12; + T t17 = udg5*1.0E+12; + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t38 = t3*1.0E+24; + T t39 = t4*1.0E+24; + T t40 = t5*1.0E+24; + T t41 = t6*1.0E+24; + T t42 = t7*1.0E+24; + T t23 = t10*t18; + T t24 = t10*t19; + T t25 = t10*t20; + T t26 = t10*t21; + T t27 = t10*t22; + T t43 = t38+1.0; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t48 = 1.0/t43; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t33 = t28*udg1; + T t34 = t29*udg2; + T t35 = t30*udg3; + T t36 = t31*udg4; + T t37 = t32*udg5; + T t58 = t10*t13*t48; + T t59 = t10*t14*t49; + T t60 = t10*t15*t50; + T t61 = t10*t16*t51; + T t62 = t10*t17*t52; + T t53 = t33+3.182454300088011E-13; + T t54 = t34+3.182454300088011E-13; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t63 = t28+t58; + T t64 = t29+t59; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t78 = t33+t34+t35+t36+t37+1.591227150044006E-12; + T t68 = t63*udg9; + T t69 = t64*udg10; + T t70 = t65*udg11; + T t71 = t63*udg17; + T t72 = t66*udg12; + T t73 = t64*udg18; + T t74 = t67*udg13; + T t75 = t65*udg19; + T t76 = t66*udg20; + T t77 = t67*udg21; + T t79 = 1.0/t78; + T t80 = t79*t79; + T t81 = t79*udg8; + T t82 = t79*uinf1; + T t83 = t79*udg6*udg7; + T t86 = t68*t78; + T t87 = t69*t78; + T t88 = t70*t78; + T t89 = t71*t78; + T t90 = t72*t78; + T t91 = t73*t78; + T t92 = t74*t78; + T t93 = t75*t78; + T t94 = t76*t78; + T t95 = t77*t78; + T t108 = t68+t69+t70+t72+t74; + T t109 = t71+t73+t75+t76+t77; + T t84 = (t8*t80)/2.0; + T t85 = (t9*t80)/2.0; + T t96 = -t86; + T t97 = -t87; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = t81+t82; + T t110 = t53*t108; + T t111 = t54*t108; + T t112 = t55*t108; + T t113 = t56*t108; + T t114 = t57*t108; + T t115 = t53*t109; + T t116 = t54*t109; + T t117 = t55*t109; + T t118 = t56*t109; + T t119 = t57*t109; + T t120 = t79*t108*udg6; + T t121 = t79*t108*udg7; + T t122 = t79*t109*udg6; + T t123 = t79*t109*udg7; + T t107 = t84+t85; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t127 = -t123; + T t132 = t96+t110; + T t133 = t97+t111; + T t134 = t98+t112; + T t135 = t100+t113; + T t136 = t102+t114; + T t137 = t99+t115; + T t138 = t101+t116; + T t139 = t103+t117; + T t140 = t104+t118; + T t141 = t105+t119; + T t142 = -t79*(t120-udg14); + T t143 = -t79*(t121-udg15); + T t144 = -t79*(t122-udg22); + T t145 = -t79*(t123-udg23); + T t146 = t79*(t120-udg14)*-2.0; + T t147 = t79*(t123-udg23)*-2.0; + T t148 = t79*(t123-udg23); + T t150 = -t79*uinf2*(t86-t110); + T t151 = -t80*uinf2*(t86-t110); + T t152 = -t79*uinf3*(t87-t111); + T t153 = -t80*uinf3*(t87-t111); + T t154 = -t79*uinf4*(t88-t112); + T t155 = -t80*uinf4*(t88-t112); + T t156 = -t79*uinf5*(t90-t113); + T t157 = -t80*uinf5*(t90-t113); + T t158 = -t79*uinf6*(t92-t114); + T t159 = -t80*uinf6*(t92-t114); + T t160 = -t79*uinf2*(t89-t115); + T t161 = -t80*uinf2*(t89-t115); + T t162 = -t79*uinf3*(t91-t116); + T t163 = -t80*uinf3*(t91-t116); + T t164 = -t79*uinf4*(t93-t117); + T t165 = -t80*uinf4*(t93-t117); + T t166 = -t79*uinf5*(t94-t118); + T t167 = -t80*uinf5*(t94-t118); + T t168 = -t79*uinf6*(t95-t119); + T t169 = -t80*uinf6*(t95-t119); + T t170 = t79*uinf2*(t86-t110); + T t171 = t79*uinf3*(t87-t111); + T t172 = t79*uinf4*(t88-t112); + T t173 = t79*uinf5*(t90-t113); + T t174 = t79*uinf6*(t92-t114); + T t175 = t79*uinf2*(t89-t115); + T t176 = t79*uinf3*(t91-t116); + T t177 = t79*uinf4*(t93-t117); + T t178 = t79*uinf5*(t94-t118); + T t179 = t79*uinf6*(t95-t119); + T t185 = -t12*uinf12*(t79*(t121-udg15)+t79*(t122-udg22)); + T t192 = -t53*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t193 = -t54*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t194 = -t55*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t195 = -t56*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t196 = -t57*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t197 = -t53*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t198 = -t54*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t199 = -t55*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t200 = -t56*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t201 = -t57*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t128 = t124+udg14; + T t129 = t125+udg15; + T t130 = t126+udg22; + T t131 = t127+udg23; + T t149 = t148*2.0; + T t180 = t142+t145; + T t181 = t143+t144; + T t182 = -odg1*(t148+t79*(t120-udg14)); + T t184 = t146+t148; + T t186 = t12*uinf12*(t147+t79*(t120-udg14))*(-2.0/3.0); + T t187 = t12*uinf12*(t147+t79*(t120-udg14))*(2.0/3.0); + T t188 = t12*uinf12*(t145+t79*(t120-udg14)*2.0)*(-2.0/3.0); + T t189 = t83+t185; + T t190 = t151+t153+t155+t157+t159; + T t191 = t161+t163+t165+t167+t169; + T t183 = t142+t149; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t170+t192+t53*t79*udg6)+nlg2*(t175+t197+t53*t79*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t171+t193+t54*t79*udg6)+nlg2*(t176+t198+t54*t79*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t172+t194+t55*t79*udg6)+nlg2*(t177+t199+t55*t79*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t173+t195+t56*t79*udg6)+nlg2*(t178+t200+t56*t79*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t174+t196+t57*t79*udg6)+nlg2*(t179+t201+t57*t79*udg7); + f[5*ng+i] = nlg2*t189+tau6*(udg6-uhg6)+nlg1*(t182+t188+uinf1+t8*t79); + f[6*ng+i] = nlg1*t189+tau7*(udg7-uhg7)+nlg2*(t182+t187+uinf1+t9*t79); + f[7*ng+i] = -nlg2*(-t106*udg7+uinf7*(t160+t53*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf8*(t162+t54*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf9*(t164+t55*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf10*(t166+t56*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf11*(t168+t57*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+t79*udg7*(t186+odg1*(t148+t79*(t120-udg14)))-t2*t11*t12*(uinf19*(udg24+t78*(t80*udg6*(t122-udg22)+t80*udg7*(t123-udg23))-t107*t109)+t71*uinf14+t73*uinf15+t75*uinf16+t76*uinf17+t77*uinf18)+t12*t79*udg6*uinf12*(t79*(t121-udg15)+t79*(t122-udg22)))+tau8*(udg8-uhg8)-nlg1*(-t106*udg6+uinf7*(t150+t53*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf8*(t152+t54*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf9*(t154+t55*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf10*(t156+t56*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf11*(t158+t57*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+t79*udg6*(odg1*(t148+t79*(t120-udg14))+t12*uinf12*(t145+t79*(t120-udg14)*2.0)*(2.0/3.0))-t2*t11*t12*(uinf19*(udg16+t78*(t80*udg6*(t120-udg14)+t80*udg7*(t121-udg15))-t107*t108)+t68*uinf14+t69*uinf15+t70*uinf16+t72*uinf17+t74*uinf18)+t12*t79*udg7*uinf12*(t79*(t121-udg15)+t79*(t122-udg22))); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + // uinf14 = 0.0; + // uinf15 = 0.0; + // uinf16 = 0.0; + // uinf17 = 0.0; + // uinf18 = 0.0; + // uinf19 = 0.0; + + T t2 = odg2+uinf13; + T t3 = udg1*udg1; + T t4 = udg2*udg2; + T t5 = udg3*udg3; + T t6 = udg4*udg4; + T t7 = udg5*udg5; + T t8 = udg6*udg6; + T t9 = udg7*udg7; + T t10 = 1.0/3.141592653589793; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t13 = udg1*1.0E+12; + T t14 = udg2*1.0E+12; + T t15 = udg3*1.0E+12; + T t16 = udg4*1.0E+12; + T t17 = udg5*1.0E+12; + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t38 = t3*1.0E+24; + T t39 = t4*1.0E+24; + T t40 = t5*1.0E+24; + T t41 = t6*1.0E+24; + T t42 = t7*1.0E+24; + T t23 = t10*t18; + T t24 = t10*t19; + T t25 = t10*t20; + T t26 = t10*t21; + T t27 = t10*t22; + T t43 = t38+1.0; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t48 = 1.0/t43; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t33 = t28*udg1; + T t34 = t29*udg2; + T t35 = t30*udg3; + T t36 = t31*udg4; + T t37 = t32*udg5; + T t58 = t10*t13*t48; + T t59 = t10*t14*t49; + T t60 = t10*t15*t50; + T t61 = t10*t16*t51; + T t62 = t10*t17*t52; + T t53 = t33+3.182454300088011E-13; + T t54 = t34+3.182454300088011E-13; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t63 = t28+t58; + T t64 = t29+t59; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t78 = t33+t34+t35+t36+t37+1.591227150044006E-12; + T t68 = t63*udg9; + T t69 = t64*udg10; + T t70 = t65*udg11; + T t71 = t63*udg17; + T t72 = t66*udg12; + T t73 = t64*udg18; + T t74 = t67*udg13; + T t75 = t65*udg19; + T t76 = t66*udg20; + T t77 = t67*udg21; + T t79 = 1.0/t78; + T t80 = t79*t79; + T t81 = t79*udg8; + T t82 = t79*uinf1; + T t83 = t79*udg6*udg7; + T t86 = t68*t78; + T t87 = t69*t78; + T t88 = t70*t78; + T t89 = t71*t78; + T t90 = t72*t78; + T t91 = t73*t78; + T t92 = t74*t78; + T t93 = t75*t78; + T t94 = t76*t78; + T t95 = t77*t78; + T t108 = t68+t69+t70+t72+t74; + T t109 = t71+t73+t75+t76+t77; + T t84 = (t8*t80)/2.0; + T t85 = (t9*t80)/2.0; + T t96 = -t86; + T t97 = -t87; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = t81+t82; + T t110 = t53*t108; + T t111 = t54*t108; + T t112 = t55*t108; + T t113 = t56*t108; + T t114 = t57*t108; + T t115 = t53*t109; + T t116 = t54*t109; + T t117 = t55*t109; + T t118 = t56*t109; + T t119 = t57*t109; + T t120 = t79*t108*udg6; + T t121 = t79*t108*udg7; + T t122 = t79*t109*udg6; + T t123 = t79*t109*udg7; + T t107 = t84+t85; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t127 = -t123; + T t132 = t96+t110; + T t133 = t97+t111; + T t134 = t98+t112; + T t135 = t100+t113; + T t136 = t102+t114; + T t137 = t99+t115; + T t138 = t101+t116; + T t139 = t103+t117; + T t140 = t104+t118; + T t141 = t105+t119; + T t142 = -t79*(t120-udg14); + T t143 = -t79*(t121-udg15); + T t144 = -t79*(t122-udg22); + T t145 = -t79*(t123-udg23); + T t146 = t79*(t120-udg14)*-2.0; + T t147 = t79*(t123-udg23)*-2.0; + T t148 = t79*(t123-udg23); + T t150 = -t79*uinf2*(t86-t110); + T t151 = -t80*uinf2*(t86-t110); + T t152 = -t79*uinf3*(t87-t111); + T t153 = -t80*uinf3*(t87-t111); + T t154 = -t79*uinf4*(t88-t112); + T t155 = -t80*uinf4*(t88-t112); + T t156 = -t79*uinf5*(t90-t113); + T t157 = -t80*uinf5*(t90-t113); + T t158 = -t79*uinf6*(t92-t114); + T t159 = -t80*uinf6*(t92-t114); + T t160 = -t79*uinf2*(t89-t115); + T t161 = -t80*uinf2*(t89-t115); + T t162 = -t79*uinf3*(t91-t116); + T t163 = -t80*uinf3*(t91-t116); + T t164 = -t79*uinf4*(t93-t117); + T t165 = -t80*uinf4*(t93-t117); + T t166 = -t79*uinf5*(t94-t118); + T t167 = -t80*uinf5*(t94-t118); + T t168 = -t79*uinf6*(t95-t119); + T t169 = -t80*uinf6*(t95-t119); + T t170 = t79*uinf2*(t86-t110); + T t171 = t79*uinf3*(t87-t111); + T t172 = t79*uinf4*(t88-t112); + T t173 = t79*uinf5*(t90-t113); + T t174 = t79*uinf6*(t92-t114); + T t175 = t79*uinf2*(t89-t115); + T t176 = t79*uinf3*(t91-t116); + T t177 = t79*uinf4*(t93-t117); + T t178 = t79*uinf5*(t94-t118); + T t179 = t79*uinf6*(t95-t119); + T t185 = -t12*uinf12*(t79*(t121-udg15)+t79*(t122-udg22)); + T t192 = -t53*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t193 = -t54*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t194 = -t55*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t195 = -t56*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t196 = -t57*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t197 = -t53*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t198 = -t54*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t199 = -t55*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t200 = -t56*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t201 = -t57*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t128 = t124+udg14; + T t129 = t125+udg15; + T t130 = t126+udg22; + T t131 = t127+udg23; + T t149 = t148*2.0; + T t180 = t142+t145; + T t181 = t143+t144; + T t182 = -odg1*(t148+t79*(t120-udg14)); + T t184 = t146+t148; + T t186 = t12*uinf12*(t147+t79*(t120-udg14))*(-2.0/3.0); + T t187 = t12*uinf12*(t147+t79*(t120-udg14))*(2.0/3.0); + T t188 = t12*uinf12*(t145+t79*(t120-udg14)*2.0)*(-2.0/3.0); + T t189 = t83+t185; + T t190 = t151+t153+t155+t157+t159; + T t191 = t161+t163+t165+t167+t169; + T t183 = t142+t149; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t170+t192+t53*t79*udg6)+nlg2*(t175+t197+t53*t79*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t171+t193+t54*t79*udg6)+nlg2*(t176+t198+t54*t79*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t172+t194+t55*t79*udg6)+nlg2*(t177+t199+t55*t79*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t173+t195+t56*t79*udg6)+nlg2*(t178+t200+t56*t79*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t174+t196+t57*t79*udg6)+nlg2*(t179+t201+t57*t79*udg7); + f[5*ng+i] = nlg2*t189+tau6*(udg6-uhg6)+nlg1*(t182+t188+uinf1+t8*t79); + f[6*ng+i] = nlg1*t189+tau7*(udg7-uhg7)+nlg2*(t182+t187+uinf1+t9*t79); + f[7*ng+i] = -nlg2*(-t106*udg7+uinf7*(t160+t53*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf8*(t162+t54*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf9*(t164+t55*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf10*(t166+t56*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+uinf11*(t168+t57*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))+t79*udg7*(t186+odg1*(t148+t79*(t120-udg14)))-t2*t11*t12*(uinf19*(udg24+t78*(t80*udg6*(t122-udg22)+t80*udg7*(t123-udg23))-t107*t109)+t71*uinf14+t73*uinf15+t75*uinf16+t76*uinf17+t77*uinf18)+t12*t79*udg6*uinf12*(t79*(t121-udg15)+t79*(t122-udg22)))+tau8*(udg8-uhg8)-nlg1*(-t106*udg6+uinf7*(t150+t53*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf8*(t152+t54*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf9*(t154+t55*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf10*(t156+t56*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+uinf11*(t158+t57*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))+t79*udg6*(odg1*(t148+t79*(t120-udg14))+t12*uinf12*(t145+t79*(t120-udg14)*2.0)*(2.0/3.0))-t2*t11*t12*(uinf19*(udg16+t78*(t80*udg6*(t120-udg14)+t80*udg7*(t121-udg15))-t107*t108)+t68*uinf14+t69*uinf15+t70*uinf16+t72*uinf17+t74*uinf18)+t12*t79*udg7*uinf12*(t79*(t121-udg15)+t79*(t122-udg22))); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + uinf12 = 0.0; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = 1.0/3.141592653589793; + T t8 = 1.0/param20; + T t9 = udg1*1.0E+12; + T t10 = udg2*1.0E+12; + T t11 = udg3*1.0E+12; + T t12 = udg4*1.0E+12; + T t13 = udg5*1.0E+12; + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t34 = t2*1.0E+24; + T t35 = t3*1.0E+24; + T t36 = t4*1.0E+24; + T t37 = t5*1.0E+24; + T t38 = t6*1.0E+24; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t23 = t7*t18; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t43 = t38+1.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t48 = 1.0/t43; + T t29 = t24*udg1; + T t30 = t25*udg2; + T t31 = t26*udg3; + T t32 = t27*udg4; + T t33 = t28*udg5; + T t49 = t7*t9*t44; + T t50 = t7*t10*t45; + T t51 = t7*t11*t46; + T t52 = t7*t12*t47; + T t53 = t7*t13*t48; + T t54 = t24+t49; + T t55 = t25+t50; + T t56 = t26+t51; + T t57 = t27+t52; + T t58 = t28+t53; + T t69 = t29+t30+t31+t32+t33+1.591227150044006E-12; + T t59 = t54*udg9; + T t60 = t55*udg10; + T t61 = t56*udg11; + T t62 = t54*udg17; + T t63 = t57*udg12; + T t64 = t55*udg18; + T t65 = t58*udg13; + T t66 = t56*udg19; + T t67 = t57*udg20; + T t68 = t58*udg21; + T t70 = 1.0/t69; + T t71 = t70*udg6*udg7; + T t72 = t59+t60+t61+t63+t65; + T t73 = t62+t64+t66+t67+t68; + T t74 = t70*t72*udg6; + T t75 = t70*t72*udg7; + T t76 = t70*t73*udg6; + T t77 = t70*t73*udg7; + T t78 = -t74; + T t79 = -t75; + T t80 = -t76; + T t81 = -t77; + T t86 = -t70*(t74-udg14); + T t87 = -t70*(t75-udg15); + T t88 = -t70*(t76-udg22); + T t89 = -t70*(t77-udg23); + T t92 = -odg1*(t70*(t74-udg14)+t70*(t77-udg23)); + T t93 = -t8*uinf12*(t70*(t75-udg15)+t70*(t76-udg22)); + T t82 = t78+udg14; + T t83 = t79+udg15; + T t84 = t80+udg22; + T t85 = t81+udg23; + T t90 = t86+t89; + T t91 = t87+t88; + T t94 = t71+t93; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg2*t94+nlg1*(t92+uinf1+t70*(udg6*udg6)-t8*uinf12*(t89+t70*(t74-udg14)*2.0)*(2.0/3.0))+tau6*(udg6-uhg6); + f[6*ng+i] = nlg1*t94+nlg2*(t92+uinf1+t70*(udg7*udg7)+t8*uinf12*(t70*(t74-udg14)-t70*(t77-udg23)*2.0)*(2.0/3.0))+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2.cpp new file mode 100644 index 00000000..ac926eb6 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2.cpp @@ -0,0 +1,865 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = 0.0; uinf3 = 0.0; uinf4 = 0.0; uinf5 = 0.0; uinf6 = 0.0; + // uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = 0.0; uinf8 = 0.0; uinf9 = 0.0; uinf10 = 0.0; uinf11 = 0.0; + // uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = 0.0; uinf13 = 0.0; // kappa + // uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = odg1*param21*uinf20; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t13 = t11*t12*uinf13; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t40 = t2*1.0E+24; + T t41 = t3*1.0E+24; + T t42 = t4*1.0E+24; + T t43 = t5*1.0E+24; + T t44 = t6*1.0E+24; + T t14 = t10+t13; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t29 = t9*t24; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t49 = t44+1.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t54 = 1.0/t49; + T t35 = t30*udg1; + T t36 = t31*udg2; + T t37 = t32*udg3; + T t38 = t33*udg4; + T t39 = t34*udg5; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t62 = t9*t17*t52; + T t63 = t9*t18*t53; + T t64 = t9*t19*t54; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t58 = t38+3.182454300088011E-13; + T t59 = t39+3.182454300088011E-13; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t68 = t33+t63; + T t69 = t34+t64; + T t80 = t35+t36+t37+t38+t39+1.591227150044006E-12; + T t70 = t65*udg9; + T t71 = t66*udg10; + T t72 = t67*udg11; + T t73 = t65*udg17; + T t74 = t68*udg12; + T t75 = t66*udg18; + T t76 = t69*udg13; + T t77 = t67*udg19; + T t78 = t68*udg20; + T t79 = t69*udg21; + T t81 = 1.0/t80; + T t82 = t81*t81; + T t83 = t81*udg8; + T t84 = t81*uinf1; + T t85 = t81*udg6*udg7; + T t88 = t70*t80; + T t89 = t71*t80; + T t90 = t72*t80; + T t91 = t73*t80; + T t92 = t74*t80; + T t93 = t75*t80; + T t94 = t76*t80; + T t95 = t77*t80; + T t96 = t78*t80; + T t97 = t79*t80; + T t110 = t70+t71+t72+t74+t76; + T t111 = t73+t75+t77+t78+t79; + T t86 = (t7*t82)/2.0; + T t87 = (t8*t82)/2.0; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = t83+t84; + T t112 = t55*t110; + T t113 = t56*t110; + T t114 = t57*t110; + T t115 = t58*t110; + T t116 = t59*t110; + T t117 = t55*t111; + T t118 = t56*t111; + T t119 = t57*t111; + T t120 = t58*t111; + T t121 = t59*t111; + T t122 = t81*t110*udg6; + T t123 = t81*t110*udg7; + T t124 = t81*t111*udg6; + T t125 = t81*t111*udg7; + T t109 = t86+t87; + T t126 = -t122; + T t127 = -t123; + T t128 = -t124; + T t129 = -t125; + T t134 = t98+t112; + T t135 = t99+t113; + T t136 = t100+t114; + T t137 = t102+t115; + T t138 = t104+t116; + T t139 = t101+t117; + T t140 = t103+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t107+t121; + T t144 = -t81*(t122-udg14); + T t145 = -t81*(t123-udg15); + T t146 = -t81*(t124-udg22); + T t147 = -t81*(t125-udg23); + T t148 = t81*(t122-udg14)*-2.0; + T t149 = t81*(t125-udg23)*-2.0; + T t150 = t81*(t125-udg23); + T t152 = -t81*uinf2*(t88-t112); + T t153 = -t82*uinf2*(t88-t112); + T t154 = -t81*uinf3*(t89-t113); + T t155 = -t82*uinf3*(t89-t113); + T t156 = -t81*uinf4*(t90-t114); + T t157 = -t82*uinf4*(t90-t114); + T t158 = -t81*uinf5*(t92-t115); + T t159 = -t82*uinf5*(t92-t115); + T t160 = -t81*uinf6*(t94-t116); + T t161 = -t82*uinf6*(t94-t116); + T t162 = -t81*uinf2*(t91-t117); + T t163 = -t82*uinf2*(t91-t117); + T t164 = -t81*uinf3*(t93-t118); + T t165 = -t82*uinf3*(t93-t118); + T t166 = -t81*uinf4*(t95-t119); + T t167 = -t82*uinf4*(t95-t119); + T t168 = -t81*uinf5*(t96-t120); + T t169 = -t82*uinf5*(t96-t120); + T t170 = -t81*uinf6*(t97-t121); + T t171 = -t82*uinf6*(t97-t121); + T t172 = t81*uinf2*(t88-t112); + T t173 = t81*uinf3*(t89-t113); + T t174 = t81*uinf4*(t90-t114); + T t175 = t81*uinf5*(t92-t115); + T t176 = t81*uinf6*(t94-t116); + T t177 = t81*uinf2*(t91-t117); + T t178 = t81*uinf3*(t93-t118); + T t179 = t81*uinf4*(t95-t119); + T t180 = t81*uinf5*(t96-t120); + T t181 = t81*uinf6*(t97-t121); + T t187 = -t12*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)); + T t194 = -t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t195 = -t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t196 = -t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t197 = -t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t198 = -t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t199 = -t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t200 = -t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t201 = -t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t202 = -t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t203 = -t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t130 = t126+udg14; + T t131 = t127+udg15; + T t132 = t128+udg22; + T t133 = t129+udg23; + T t151 = t150*2.0; + T t182 = t144+t147; + T t183 = t145+t146; + T t184 = -odg1*(t150+t81*(t122-udg14)); + T t186 = t148+t150; + T t188 = t12*uinf12*(t149+t81*(t122-udg14))*(-2.0/3.0); + T t189 = t12*uinf12*(t149+t81*(t122-udg14))*(2.0/3.0); + T t190 = t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(-2.0/3.0); + T t191 = t85+t187; + T t192 = t153+t155+t157+t159+t161; + T t193 = t163+t165+t167+t169+t171; + T t185 = t144+t151; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t172+t194+t55*t81*udg6)+nlg2*(t177+t199+t55*t81*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t173+t195+t56*t81*udg6)+nlg2*(t178+t200+t56*t81*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t174+t196+t57*t81*udg6)+nlg2*(t179+t201+t57*t81*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t175+t197+t58*t81*udg6)+nlg2*(t180+t202+t58*t81*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t176+t198+t59*t81*udg6)+nlg2*(t181+t203+t59*t81*udg7); + f[5*ng+i] = nlg2*t191+tau6*(udg6-uhg6)+nlg1*(t184+t190+uinf1+t7*t81); + f[6*ng+i] = nlg1*t191+tau7*(udg7-uhg7)+nlg2*(t184+t189+uinf1+t8*t81); + f[7*ng+i] = tau8*(udg8-uhg8)-nlg2*(-t108*udg7+uinf7*(t162+t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf8*(t164+t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf9*(t166+t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf10*(t168+t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf11*(t170+t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-t14*(uinf19*(udg24+t80*(t82*udg6*(t124-udg22)+t82*udg7*(t125-udg23))-t109*t111)+t73*uinf14+t75*uinf15+t77*uinf16+t78*uinf17+t79*uinf18)+t81*udg7*(t188+odg1*(t150+t81*(t122-udg14)))+t12*t81*udg6*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)))-nlg1*(-t108*udg6+uinf7*(t152+t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf8*(t154+t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf9*(t156+t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf10*(t158+t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf11*(t160+t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-t14*(uinf19*(udg16+t80*(t82*udg6*(t122-udg14)+t82*udg7*(t123-udg15))-t109*t110)+t70*uinf14+t71*uinf15+t72*uinf16+t74*uinf17+t76*uinf18)+t81*udg6*(odg1*(t150+t81*(t122-udg14))+t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(2.0/3.0))+t12*t81*udg7*uinf12*(t81*(t123-udg15)+t81*(t124-udg22))); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = 0.0; uinf3 = 0.0; uinf4 = 0.0; uinf5 = 0.0; uinf6 = 0.0; + // uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = 0.0; uinf8 = 0.0; uinf9 = 0.0; uinf10 = 0.0; uinf11 = 0.0; + // uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = 0.0; uinf13 = 0.0; // kappa + // uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = odg1*param21*uinf20; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t13 = t11*t12*uinf13; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t40 = t2*1.0E+24; + T t41 = t3*1.0E+24; + T t42 = t4*1.0E+24; + T t43 = t5*1.0E+24; + T t44 = t6*1.0E+24; + T t14 = t10+t13; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t29 = t9*t24; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t49 = t44+1.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t54 = 1.0/t49; + T t35 = t30*udg1; + T t36 = t31*udg2; + T t37 = t32*udg3; + T t38 = t33*udg4; + T t39 = t34*udg5; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t62 = t9*t17*t52; + T t63 = t9*t18*t53; + T t64 = t9*t19*t54; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t58 = t38+3.182454300088011E-13; + T t59 = t39+3.182454300088011E-13; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t68 = t33+t63; + T t69 = t34+t64; + T t80 = t35+t36+t37+t38+t39+1.591227150044006E-12; + T t70 = t65*udg9; + T t71 = t66*udg10; + T t72 = t67*udg11; + T t73 = t65*udg17; + T t74 = t68*udg12; + T t75 = t66*udg18; + T t76 = t69*udg13; + T t77 = t67*udg19; + T t78 = t68*udg20; + T t79 = t69*udg21; + T t81 = 1.0/t80; + T t82 = t81*t81; + T t83 = t81*udg8; + T t84 = t81*uinf1; + T t85 = t81*udg6*udg7; + T t88 = t70*t80; + T t89 = t71*t80; + T t90 = t72*t80; + T t91 = t73*t80; + T t92 = t74*t80; + T t93 = t75*t80; + T t94 = t76*t80; + T t95 = t77*t80; + T t96 = t78*t80; + T t97 = t79*t80; + T t110 = t70+t71+t72+t74+t76; + T t111 = t73+t75+t77+t78+t79; + T t86 = (t7*t82)/2.0; + T t87 = (t8*t82)/2.0; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = t83+t84; + T t112 = t55*t110; + T t113 = t56*t110; + T t114 = t57*t110; + T t115 = t58*t110; + T t116 = t59*t110; + T t117 = t55*t111; + T t118 = t56*t111; + T t119 = t57*t111; + T t120 = t58*t111; + T t121 = t59*t111; + T t122 = t81*t110*udg6; + T t123 = t81*t110*udg7; + T t124 = t81*t111*udg6; + T t125 = t81*t111*udg7; + T t109 = t86+t87; + T t126 = -t122; + T t127 = -t123; + T t128 = -t124; + T t129 = -t125; + T t134 = t98+t112; + T t135 = t99+t113; + T t136 = t100+t114; + T t137 = t102+t115; + T t138 = t104+t116; + T t139 = t101+t117; + T t140 = t103+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t107+t121; + T t144 = -t81*(t122-udg14); + T t145 = -t81*(t123-udg15); + T t146 = -t81*(t124-udg22); + T t147 = -t81*(t125-udg23); + T t148 = t81*(t122-udg14)*-2.0; + T t149 = t81*(t125-udg23)*-2.0; + T t150 = t81*(t125-udg23); + T t152 = -t81*uinf2*(t88-t112); + T t153 = -t82*uinf2*(t88-t112); + T t154 = -t81*uinf3*(t89-t113); + T t155 = -t82*uinf3*(t89-t113); + T t156 = -t81*uinf4*(t90-t114); + T t157 = -t82*uinf4*(t90-t114); + T t158 = -t81*uinf5*(t92-t115); + T t159 = -t82*uinf5*(t92-t115); + T t160 = -t81*uinf6*(t94-t116); + T t161 = -t82*uinf6*(t94-t116); + T t162 = -t81*uinf2*(t91-t117); + T t163 = -t82*uinf2*(t91-t117); + T t164 = -t81*uinf3*(t93-t118); + T t165 = -t82*uinf3*(t93-t118); + T t166 = -t81*uinf4*(t95-t119); + T t167 = -t82*uinf4*(t95-t119); + T t168 = -t81*uinf5*(t96-t120); + T t169 = -t82*uinf5*(t96-t120); + T t170 = -t81*uinf6*(t97-t121); + T t171 = -t82*uinf6*(t97-t121); + T t172 = t81*uinf2*(t88-t112); + T t173 = t81*uinf3*(t89-t113); + T t174 = t81*uinf4*(t90-t114); + T t175 = t81*uinf5*(t92-t115); + T t176 = t81*uinf6*(t94-t116); + T t177 = t81*uinf2*(t91-t117); + T t178 = t81*uinf3*(t93-t118); + T t179 = t81*uinf4*(t95-t119); + T t180 = t81*uinf5*(t96-t120); + T t181 = t81*uinf6*(t97-t121); + T t187 = -t12*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)); + T t194 = -t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t195 = -t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t196 = -t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t197 = -t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t198 = -t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t199 = -t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t200 = -t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t201 = -t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t202 = -t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t203 = -t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t130 = t126+udg14; + T t131 = t127+udg15; + T t132 = t128+udg22; + T t133 = t129+udg23; + T t151 = t150*2.0; + T t182 = t144+t147; + T t183 = t145+t146; + T t184 = -odg1*(t150+t81*(t122-udg14)); + T t186 = t148+t150; + T t188 = t12*uinf12*(t149+t81*(t122-udg14))*(-2.0/3.0); + T t189 = t12*uinf12*(t149+t81*(t122-udg14))*(2.0/3.0); + T t190 = t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(-2.0/3.0); + T t191 = t85+t187; + T t192 = t153+t155+t157+t159+t161; + T t193 = t163+t165+t167+t169+t171; + T t185 = t144+t151; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t172+t194+t55*t81*udg6)+nlg2*(t177+t199+t55*t81*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t173+t195+t56*t81*udg6)+nlg2*(t178+t200+t56*t81*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t174+t196+t57*t81*udg6)+nlg2*(t179+t201+t57*t81*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t175+t197+t58*t81*udg6)+nlg2*(t180+t202+t58*t81*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t176+t198+t59*t81*udg6)+nlg2*(t181+t203+t59*t81*udg7); + f[5*ng+i] = nlg2*t191+tau6*(udg6-uhg6)+nlg1*(t184+t190+uinf1+t7*t81); + f[6*ng+i] = nlg1*t191+tau7*(udg7-uhg7)+nlg2*(t184+t189+uinf1+t8*t81); + f[7*ng+i] = tau8*(udg8-uhg8)-nlg2*(-t108*udg7+uinf7*(t162+t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf8*(t164+t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf9*(t166+t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf10*(t168+t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf11*(t170+t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-t14*(uinf19*(udg24+t80*(t82*udg6*(t124-udg22)+t82*udg7*(t125-udg23))-t109*t111)+t73*uinf14+t75*uinf15+t77*uinf16+t78*uinf17+t79*uinf18)+t81*udg7*(t188+odg1*(t150+t81*(t122-udg14)))+t12*t81*udg6*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)))-nlg1*(-t108*udg6+uinf7*(t152+t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf8*(t154+t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf9*(t156+t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf10*(t158+t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf11*(t160+t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-t14*(uinf19*(udg16+t80*(t82*udg6*(t122-udg14)+t82*udg7*(t123-udg15))-t109*t110)+t70*uinf14+t71*uinf15+t72*uinf16+t74*uinf17+t76*uinf18)+t81*udg6*(odg1*(t150+t81*(t122-udg14))+t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(2.0/3.0))+t12*t81*udg7*uinf12*(t81*(t123-udg15)+t81*(t124-udg22))); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf12 = 0.0; + // uinf12 = mix->viscosity() / mu_scale; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = 1.0/3.141592653589793; + T t8 = 1.0/param20; + T t9 = udg1*1.0E+12; + T t10 = udg2*1.0E+12; + T t11 = udg3*1.0E+12; + T t12 = udg4*1.0E+12; + T t13 = udg5*1.0E+12; + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t34 = t2*1.0E+24; + T t35 = t3*1.0E+24; + T t36 = t4*1.0E+24; + T t37 = t5*1.0E+24; + T t38 = t6*1.0E+24; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t23 = t7*t18; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t43 = t38+1.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t48 = 1.0/t43; + T t29 = t24*udg1; + T t30 = t25*udg2; + T t31 = t26*udg3; + T t32 = t27*udg4; + T t33 = t28*udg5; + T t49 = t7*t9*t44; + T t50 = t7*t10*t45; + T t51 = t7*t11*t46; + T t52 = t7*t12*t47; + T t53 = t7*t13*t48; + T t54 = t24+t49; + T t55 = t25+t50; + T t56 = t26+t51; + T t57 = t27+t52; + T t58 = t28+t53; + T t69 = t29+t30+t31+t32+t33+1.591227150044006E-12; + T t59 = t54*udg9; + T t60 = t55*udg10; + T t61 = t56*udg11; + T t62 = t54*udg17; + T t63 = t57*udg12; + T t64 = t55*udg18; + T t65 = t58*udg13; + T t66 = t56*udg19; + T t67 = t57*udg20; + T t68 = t58*udg21; + T t70 = 1.0/t69; + T t71 = t70*udg6*udg7; + T t72 = t59+t60+t61+t63+t65; + T t73 = t62+t64+t66+t67+t68; + T t74 = t70*t72*udg6; + T t75 = t70*t72*udg7; + T t76 = t70*t73*udg6; + T t77 = t70*t73*udg7; + T t78 = -t74; + T t79 = -t75; + T t80 = -t76; + T t81 = -t77; + T t86 = -t70*(t74-udg14); + T t87 = -t70*(t75-udg15); + T t88 = -t70*(t76-udg22); + T t89 = -t70*(t77-udg23); + T t92 = -odg1*(t70*(t74-udg14)+t70*(t77-udg23)); + T t93 = -t8*uinf12*(t70*(t75-udg15)+t70*(t76-udg22)); + T t82 = t78+udg14; + T t83 = t79+udg15; + T t84 = t80+udg22; + T t85 = t81+udg23; + T t90 = t86+t89; + T t91 = t87+t88; + T t94 = t71+t93; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg2*t94+nlg1*(t92+uinf1+t70*(udg6*udg6)-t8*uinf12*(t89+t70*(t74-udg14)*2.0)*(2.0/3.0))+tau6*(udg6-uhg6); + f[6*ng+i] = nlg1*t94+nlg2*(t92+uinf1+t70*(udg7*udg7)+t8*uinf12*(t70*(t74-udg14)-t70*(t77-udg23)*2.0)*(2.0/3.0))+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2_manual.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2_manual.cpp new file mode 100644 index 00000000..2fe05f14 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_PB_MPP_2_manual.cpp @@ -0,0 +1,780 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = 0.0; uinf3 = 0.0; uinf4 = 0.0; uinf5 = 0.0; uinf6 = 0.0; + // uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = 0.0; uinf8 = 0.0; uinf9 = 0.0; uinf10 = 0.0; uinf11 = 0.0; + // uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = 0.0; uinf13 = 0.0; // kappa + // uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = odg1*param21*uinf20; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t13 = t11*t12*uinf13; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t40 = t2*1.0E+24; + T t41 = t3*1.0E+24; + T t42 = t4*1.0E+24; + T t43 = t5*1.0E+24; + T t44 = t6*1.0E+24; + T t14 = t10+t13; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t29 = t9*t24; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t49 = t44+1.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t54 = 1.0/t49; + T t35 = t30*udg1; + T t36 = t31*udg2; + T t37 = t32*udg3; + T t38 = t33*udg4; + T t39 = t34*udg5; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t62 = t9*t17*t52; + T t63 = t9*t18*t53; + T t64 = t9*t19*t54; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t58 = t38+3.182454300088011E-13; + T t59 = t39+3.182454300088011E-13; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t68 = t33+t63; + T t69 = t34+t64; + T t80 = t35+t36+t37+t38+t39+1.591227150044006E-12; + T t70 = t65*udg9; + T t71 = t66*udg10; + T t72 = t67*udg11; + T t73 = t65*udg17; + T t74 = t68*udg12; + T t75 = t66*udg18; + T t76 = t69*udg13; + T t77 = t67*udg19; + T t78 = t68*udg20; + T t79 = t69*udg21; + T t81 = 1.0/t80; + T t82 = t81*t81; + T t83 = t81*udg8; + T t84 = t81*uinf1; + T t85 = t81*udg6*udg7; + T t88 = t70*t80; + T t89 = t71*t80; + T t90 = t72*t80; + T t91 = t73*t80; + T t92 = t74*t80; + T t93 = t75*t80; + T t94 = t76*t80; + T t95 = t77*t80; + T t96 = t78*t80; + T t97 = t79*t80; + T t110 = t70+t71+t72+t74+t76; + T t111 = t73+t75+t77+t78+t79; + T t86 = (t7*t82)/2.0; + T t87 = (t8*t82)/2.0; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = t83+t84; + T t112 = t55*t110; + T t113 = t56*t110; + T t114 = t57*t110; + T t115 = t58*t110; + T t116 = t59*t110; + T t117 = t55*t111; + T t118 = t56*t111; + T t119 = t57*t111; + T t120 = t58*t111; + T t121 = t59*t111; + T t122 = t81*t110*udg6; + T t123 = t81*t110*udg7; + T t124 = t81*t111*udg6; + T t125 = t81*t111*udg7; + T t109 = t86+t87; + T t126 = -t122; + T t127 = -t123; + T t128 = -t124; + T t129 = -t125; + T t134 = t98+t112; + T t135 = t99+t113; + T t136 = t100+t114; + T t137 = t102+t115; + T t138 = t104+t116; + T t139 = t101+t117; + T t140 = t103+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t107+t121; + T t144 = -t81*(t122-udg14); + T t145 = -t81*(t123-udg15); + T t146 = -t81*(t124-udg22); + T t147 = -t81*(t125-udg23); + T t148 = t81*(t122-udg14)*-2.0; + T t149 = t81*(t125-udg23)*-2.0; + T t150 = t81*(t125-udg23); + T t152 = -t81*uinf2*(t88-t112); + T t153 = -t82*uinf2*(t88-t112); + T t154 = -t81*uinf3*(t89-t113); + T t155 = -t82*uinf3*(t89-t113); + T t156 = -t81*uinf4*(t90-t114); + T t157 = -t82*uinf4*(t90-t114); + T t158 = -t81*uinf5*(t92-t115); + T t159 = -t82*uinf5*(t92-t115); + T t160 = -t81*uinf6*(t94-t116); + T t161 = -t82*uinf6*(t94-t116); + T t162 = -t81*uinf2*(t91-t117); + T t163 = -t82*uinf2*(t91-t117); + T t164 = -t81*uinf3*(t93-t118); + T t165 = -t82*uinf3*(t93-t118); + T t166 = -t81*uinf4*(t95-t119); + T t167 = -t82*uinf4*(t95-t119); + T t168 = -t81*uinf5*(t96-t120); + T t169 = -t82*uinf5*(t96-t120); + T t170 = -t81*uinf6*(t97-t121); + T t171 = -t82*uinf6*(t97-t121); + T t172 = t81*uinf2*(t88-t112); + T t173 = t81*uinf3*(t89-t113); + T t174 = t81*uinf4*(t90-t114); + T t175 = t81*uinf5*(t92-t115); + T t176 = t81*uinf6*(t94-t116); + T t177 = t81*uinf2*(t91-t117); + T t178 = t81*uinf3*(t93-t118); + T t179 = t81*uinf4*(t95-t119); + T t180 = t81*uinf5*(t96-t120); + T t181 = t81*uinf6*(t97-t121); + T t187 = -t12*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)); + T t194 = -t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t195 = -t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t196 = -t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t197 = -t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t198 = -t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t199 = -t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t200 = -t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t201 = -t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t202 = -t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t203 = -t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t130 = t126+udg14; + T t131 = t127+udg15; + T t132 = t128+udg22; + T t133 = t129+udg23; + T t151 = t150*2.0; + T t182 = t144+t147; + T t183 = t145+t146; + T t184 = -odg1*(t150+t81*(t122-udg14)); + T t186 = t148+t150; + T t188 = t12*uinf12*(t149+t81*(t122-udg14))*(-2.0/3.0); + T t189 = t12*uinf12*(t149+t81*(t122-udg14))*(2.0/3.0); + T t190 = t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(-2.0/3.0); + T t191 = t85+t187; + T t192 = t153+t155+t157+t159+t161; + T t193 = t163+t165+t167+t169+t171; + T t185 = t144+t151; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t172+t194+t55*t81*udg6)+nlg2*(t177+t199+t55*t81*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t173+t195+t56*t81*udg6)+nlg2*(t178+t200+t56*t81*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t174+t196+t57*t81*udg6)+nlg2*(t179+t201+t57*t81*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t175+t197+t58*t81*udg6)+nlg2*(t180+t202+t58*t81*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t176+t198+t59*t81*udg6)+nlg2*(t181+t203+t59*t81*udg7); + f[5*ng+i] = nlg2*t191+tau6*(udg6-uhg6)+nlg1*(t184+t190+uinf1+t7*t81); + f[6*ng+i] = nlg1*t191+tau7*(udg7-uhg7)+nlg2*(t184+t189+uinf1+t8*t81); + f[7*ng+i] = tau8*(udg8-uhg8)-nlg2*(-t108*udg7+uinf7*(t162+t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf8*(t164+t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf9*(t166+t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf10*(t168+t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf11*(t170+t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-t14*(uinf19*(udg24+t80*(t82*udg6*(t124-udg22)+t82*udg7*(t125-udg23))-t109*t111)+t73*uinf14+t75*uinf15+t77*uinf16+t78*uinf17+t79*uinf18)+t81*udg7*(t188+odg1*(t150+t81*(t122-udg14)))+t12*t81*udg6*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)))-nlg1*(-t108*udg6+uinf7*(t152+t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf8*(t154+t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf9*(t156+t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf10*(t158+t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf11*(t160+t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-t14*(uinf19*(udg16+t80*(t82*udg6*(t122-udg14)+t82*udg7*(t123-udg15))-t109*t110)+t70*uinf14+t71*uinf15+t72*uinf16+t74*uinf17+t76*uinf18)+t81*udg6*(odg1*(t150+t81*(t122-udg14))+t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(2.0/3.0))+t12*t81*udg7*uinf12*(t81*(t123-udg15)+t81*(t124-udg22))); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = 0.0; uinf3 = 0.0; uinf4 = 0.0; uinf5 = 0.0; uinf6 = 0.0; + // uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = 0.0; uinf8 = 0.0; uinf9 = 0.0; uinf10 = 0.0; uinf11 = 0.0; + // uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = 0.0; uinf13 = 0.0; // kappa + // uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = odg1*param21*uinf20; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t13 = t11*t12*uinf13; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t40 = t2*1.0E+24; + T t41 = t3*1.0E+24; + T t42 = t4*1.0E+24; + T t43 = t5*1.0E+24; + T t44 = t6*1.0E+24; + T t14 = t10+t13; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t29 = t9*t24; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t49 = t44+1.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t54 = 1.0/t49; + T t35 = t30*udg1; + T t36 = t31*udg2; + T t37 = t32*udg3; + T t38 = t33*udg4; + T t39 = t34*udg5; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t62 = t9*t17*t52; + T t63 = t9*t18*t53; + T t64 = t9*t19*t54; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t58 = t38+3.182454300088011E-13; + T t59 = t39+3.182454300088011E-13; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t68 = t33+t63; + T t69 = t34+t64; + T t80 = t35+t36+t37+t38+t39+1.591227150044006E-12; + T t70 = t65*udg9; + T t71 = t66*udg10; + T t72 = t67*udg11; + T t73 = t65*udg17; + T t74 = t68*udg12; + T t75 = t66*udg18; + T t76 = t69*udg13; + T t77 = t67*udg19; + T t78 = t68*udg20; + T t79 = t69*udg21; + T t81 = 1.0/t80; + T t82 = t81*t81; + T t83 = t81*udg8; + T t84 = t81*uinf1; + T t85 = t81*udg6*udg7; + T t88 = t70*t80; + T t89 = t71*t80; + T t90 = t72*t80; + T t91 = t73*t80; + T t92 = t74*t80; + T t93 = t75*t80; + T t94 = t76*t80; + T t95 = t77*t80; + T t96 = t78*t80; + T t97 = t79*t80; + T t110 = t70+t71+t72+t74+t76; + T t111 = t73+t75+t77+t78+t79; + T t86 = (t7*t82)/2.0; + T t87 = (t8*t82)/2.0; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = t83+t84; + T t112 = t55*t110; + T t113 = t56*t110; + T t114 = t57*t110; + T t115 = t58*t110; + T t116 = t59*t110; + T t117 = t55*t111; + T t118 = t56*t111; + T t119 = t57*t111; + T t120 = t58*t111; + T t121 = t59*t111; + T t122 = t81*t110*udg6; + T t123 = t81*t110*udg7; + T t124 = t81*t111*udg6; + T t125 = t81*t111*udg7; + T t109 = t86+t87; + T t126 = -t122; + T t127 = -t123; + T t128 = -t124; + T t129 = -t125; + T t134 = t98+t112; + T t135 = t99+t113; + T t136 = t100+t114; + T t137 = t102+t115; + T t138 = t104+t116; + T t139 = t101+t117; + T t140 = t103+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t107+t121; + T t144 = -t81*(t122-udg14); + T t145 = -t81*(t123-udg15); + T t146 = -t81*(t124-udg22); + T t147 = -t81*(t125-udg23); + T t148 = t81*(t122-udg14)*-2.0; + T t149 = t81*(t125-udg23)*-2.0; + T t150 = t81*(t125-udg23); + T t152 = -t81*uinf2*(t88-t112); + T t153 = -t82*uinf2*(t88-t112); + T t154 = -t81*uinf3*(t89-t113); + T t155 = -t82*uinf3*(t89-t113); + T t156 = -t81*uinf4*(t90-t114); + T t157 = -t82*uinf4*(t90-t114); + T t158 = -t81*uinf5*(t92-t115); + T t159 = -t82*uinf5*(t92-t115); + T t160 = -t81*uinf6*(t94-t116); + T t161 = -t82*uinf6*(t94-t116); + T t162 = -t81*uinf2*(t91-t117); + T t163 = -t82*uinf2*(t91-t117); + T t164 = -t81*uinf3*(t93-t118); + T t165 = -t82*uinf3*(t93-t118); + T t166 = -t81*uinf4*(t95-t119); + T t167 = -t82*uinf4*(t95-t119); + T t168 = -t81*uinf5*(t96-t120); + T t169 = -t82*uinf5*(t96-t120); + T t170 = -t81*uinf6*(t97-t121); + T t171 = -t82*uinf6*(t97-t121); + T t172 = t81*uinf2*(t88-t112); + T t173 = t81*uinf3*(t89-t113); + T t174 = t81*uinf4*(t90-t114); + T t175 = t81*uinf5*(t92-t115); + T t176 = t81*uinf6*(t94-t116); + T t177 = t81*uinf2*(t91-t117); + T t178 = t81*uinf3*(t93-t118); + T t179 = t81*uinf4*(t95-t119); + T t180 = t81*uinf5*(t96-t120); + T t181 = t81*uinf6*(t97-t121); + T t187 = -t12*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)); + T t194 = -t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t195 = -t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t196 = -t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t197 = -t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t198 = -t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t199 = -t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t200 = -t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t201 = -t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t202 = -t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t203 = -t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t130 = t126+udg14; + T t131 = t127+udg15; + T t132 = t128+udg22; + T t133 = t129+udg23; + T t151 = t150*2.0; + T t182 = t144+t147; + T t183 = t145+t146; + T t184 = -odg1*(t150+t81*(t122-udg14)); + T t186 = t148+t150; + T t188 = t12*uinf12*(t149+t81*(t122-udg14))*(-2.0/3.0); + T t189 = t12*uinf12*(t149+t81*(t122-udg14))*(2.0/3.0); + T t190 = t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(-2.0/3.0); + T t191 = t85+t187; + T t192 = t153+t155+t157+t159+t161; + T t193 = t163+t165+t167+t169+t171; + T t185 = t144+t151; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t172+t194+t55*t81*udg6)+nlg2*(t177+t199+t55*t81*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t173+t195+t56*t81*udg6)+nlg2*(t178+t200+t56*t81*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t174+t196+t57*t81*udg6)+nlg2*(t179+t201+t57*t81*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t175+t197+t58*t81*udg6)+nlg2*(t180+t202+t58*t81*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t176+t198+t59*t81*udg6)+nlg2*(t181+t203+t59*t81*udg7); + f[5*ng+i] = nlg2*t191+tau6*(udg6-uhg6)+nlg1*(t184+t190+uinf1+t7*t81); + f[6*ng+i] = nlg1*t191+tau7*(udg7-uhg7)+nlg2*(t184+t189+uinf1+t8*t81); + f[7*ng+i] = tau8*(udg8-uhg8)-nlg2*(-t108*udg7+uinf7*(t162+t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf8*(t164+t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf9*(t166+t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf10*(t168+t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+uinf11*(t170+t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-t14*(uinf19*(udg24+t80*(t82*udg6*(t124-udg22)+t82*udg7*(t125-udg23))-t109*t111)+t73*uinf14+t75*uinf15+t77*uinf16+t78*uinf17+t79*uinf18)+t81*udg7*(t188+odg1*(t150+t81*(t122-udg14)))+t12*t81*udg6*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)))-nlg1*(-t108*udg6+uinf7*(t152+t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf8*(t154+t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf9*(t156+t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf10*(t158+t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+uinf11*(t160+t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-t14*(uinf19*(udg16+t80*(t82*udg6*(t122-udg14)+t82*udg7*(t123-udg15))-t109*t110)+t70*uinf14+t71*uinf15+t72*uinf16+t74*uinf17+t76*uinf18)+t81*udg6*(odg1*(t150+t81*(t122-udg14))+t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(2.0/3.0))+t12*t81*udg7*uinf12*(t81*(t123-udg15)+t81*(t124-udg22))); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + T fstate[16]; + T fwall[16]; + T Ustate[24]; + T Uwall[24]; + for (int i = 0; i void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_inviscid_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_inviscid_MPP.cpp new file mode 100644 index 00000000..df7cbda5 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_inviscid_MPP.cpp @@ -0,0 +1,333 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+12; + T t4 = udg2*1.0E+12; + T t5 = udg3*1.0E+12; + T t6 = udg4*1.0E+12; + T t7 = udg5*1.0E+12; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+3.182454300088011E-13; + T t29 = t24+3.182454300088011E-13; + T t30 = t25+3.182454300088011E-13; + T t31 = t26+3.182454300088011E-13; + T t32 = t27+3.182454300088011E-13; + T t33 = t23+t24+t25+t26+t27+1.591227150044006E-12; + T t34 = 1.0/t33; + T t35 = t34*udg8; + T t36 = t34*uinf1; + T t37 = t35+t36; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t28*t34*udg6+nlg2*t28*t34*udg7; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t29*t34*udg6+nlg2*t29*t34*udg7; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t30*t34*udg6+nlg2*t30*t34*udg7; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t31*t34*udg6+nlg2*t31*t34*udg7; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t32*t34*udg6+nlg2*t32*t34*udg7; + f[5*ng+i] = nlg1*(uinf1+t34*(udg6*udg6))+tau6*(udg6-uhg6)+nlg2*t34*udg6*udg7; + f[6*ng+i] = nlg2*(uinf1+t34*(udg7*udg7))+tau7*(udg7-uhg7)+nlg1*t34*udg6*udg7; + f[7*ng+i] = tau8*(udg8-uhg8)+nlg1*t37*udg6+nlg2*t37*udg7; + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+12; + T t4 = udg2*1.0E+12; + T t5 = udg3*1.0E+12; + T t6 = udg4*1.0E+12; + T t7 = udg5*1.0E+12; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+3.182454300088011E-13; + T t29 = t24+3.182454300088011E-13; + T t30 = t25+3.182454300088011E-13; + T t31 = t26+3.182454300088011E-13; + T t32 = t27+3.182454300088011E-13; + T t33 = t23+t24+t25+t26+t27+1.591227150044006E-12; + T t34 = 1.0/t33; + T t35 = t34*udg8; + T t36 = t34*uinf1; + T t37 = t35+t36; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t28*t34*udg6+nlg2*t28*t34*udg7; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t29*t34*udg6+nlg2*t29*t34*udg7; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t30*t34*udg6+nlg2*t30*t34*udg7; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t31*t34*udg6+nlg2*t31*t34*udg7; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t32*t34*udg6+nlg2*t32*t34*udg7; + f[5*ng+i] = nlg1*(uinf1+t34*(udg6*udg6))+tau6*(udg6-uhg6)+nlg2*t34*udg6*udg7; + f[6*ng+i] = nlg2*(uinf1+t34*(udg7*udg7))+tau7*(udg7-uhg7)+nlg1*t34*udg6*udg7; + f[7*ng+i] = tau8*(udg8-uhg8)+nlg1*t37*udg6+nlg2*t37*udg7; + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + T t2 = 1.0/3.141592653589793; + T t3 = udg1*1.0E+12; + T t4 = udg2*1.0E+12; + T t5 = udg3*1.0E+12; + T t6 = udg4*1.0E+12; + T t7 = udg5*1.0E+12; + T t8 = atan(t3); + T t9 = atan(t4); + T t10 = atan(t5); + T t11 = atan(t6); + T t12 = atan(t7); + T t13 = t2*t8; + T t14 = t2*t9; + T t15 = t2*t10; + T t16 = t2*t11; + T t17 = t2*t12; + T t18 = t13+1.0/2.0; + T t19 = t14+1.0/2.0; + T t20 = t15+1.0/2.0; + T t21 = t16+1.0/2.0; + T t22 = t17+1.0/2.0; + T t23 = t18*udg1; + T t24 = t19*udg2; + T t25 = t20*udg3; + T t26 = t21*udg4; + T t27 = t22*udg5; + T t28 = t23+t24+t25+t26+t27+1.591227150044006E-12; + T t29 = 1.0/t28; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg1*(uinf1+t29*(udg6*udg6))+tau6*(udg6-uhg6)+nlg2*t29*udg6*udg7; + f[6*ng+i] = nlg2*(uinf1+t29*(udg7*udg7))+tau7*(udg7-uhg7)+nlg1*t29*udg6*udg7; + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_visc_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_visc_MPP.cpp new file mode 100644 index 00000000..cfce4fa1 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_visc_MPP.cpp @@ -0,0 +1,905 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + // uinf2 = 0.0; // D_1 + // uinf3 = 0.0; // D_2 + // uinf4 = 0.0; // D_3 + // uinf5 = 0.0; // D_4 + // uinf6 = 0.0; // D_5 + // uinf7 = 0.0; // h_1 + // uinf8 = 0.0; // h_2 + // uinf9 = 0.0; // h_3 + // uinf10 = 0.0; // h_4 + // uinf11 = 0.0; // h_5 + // uinf12 = 0.0; // mu + // uinf13 = 0.0; // kappa + uinf2 = D_i[0]; // D_1 + uinf3 = D_i[1]; // D_2 + uinf4 = D_i[2]; // D_3 + uinf5 = D_i[3]; // D_4 + uinf6 = D_i[4]; // D_5 + uinf7 = h_i[0]; // h_1 + uinf8 = h_i[1]; // h_2 + uinf9 = h_i[2]; // h_3 + uinf10 = h_i[3]; // h_4 + uinf11 = h_i[4]; // h_5 + uinf12 = mix->viscosity() / mu_scale; // mu + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + // uinf14 = 0.0; + // uinf15 = 0.0; + // uinf16 = 0.0; + // uinf17 = 0.0; + // uinf18 = 0.0; + // uinf19 = 0.0; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param19; + T t11 = 1.0/param20; + T t12 = udg1*1.0E+12; + T t13 = udg2*1.0E+12; + T t14 = udg3*1.0E+12; + T t15 = udg4*1.0E+12; + T t16 = udg5*1.0E+12; + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t37 = t2*1.0E+24; + T t38 = t3*1.0E+24; + T t39 = t4*1.0E+24; + T t40 = t5*1.0E+24; + T t41 = t6*1.0E+24; + T t22 = t9*t17; + T t23 = t9*t18; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t42 = t37+1.0; + T t43 = t38+1.0; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t47 = 1.0/t42; + T t48 = 1.0/t43; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t32 = t27*udg1; + T t33 = t28*udg2; + T t34 = t29*udg3; + T t35 = t30*udg4; + T t36 = t31*udg5; + T t57 = t9*t12*t47; + T t58 = t9*t13*t48; + T t59 = t9*t14*t49; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t52 = t32+3.182454300088011E-13; + T t53 = t33+3.182454300088011E-13; + T t54 = t34+3.182454300088011E-13; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t62 = t27+t57; + T t63 = t28+t58; + T t64 = t29+t59; + T t65 = t30+t60; + T t66 = t31+t61; + T t77 = t32+t33+t34+t35+t36+1.591227150044006E-12; + T t67 = t62*udg9; + T t68 = t63*udg10; + T t69 = t64*udg11; + T t70 = t62*udg17; + T t71 = t65*udg12; + T t72 = t63*udg18; + T t73 = t66*udg13; + T t74 = t64*udg19; + T t75 = t65*udg20; + T t76 = t66*udg21; + T t78 = 1.0/t77; + T t79 = t78*t78; + T t80 = t78*udg8; + T t81 = t78*uinf1; + T t82 = t78*udg6*udg7; + T t85 = t67*t77; + T t86 = t68*t77; + T t87 = t69*t77; + T t88 = t70*t77; + T t89 = t71*t77; + T t90 = t72*t77; + T t91 = t73*t77; + T t92 = t74*t77; + T t93 = t75*t77; + T t94 = t76*t77; + T t107 = t67+t68+t69+t71+t73; + T t108 = t70+t72+t74+t75+t76; + T t83 = (t7*t79)/2.0; + T t84 = (t8*t79)/2.0; + T t95 = -t85; + T t96 = -t86; + T t97 = -t87; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = t80+t81; + T t109 = t52*t107; + T t110 = t53*t107; + T t111 = t54*t107; + T t112 = t55*t107; + T t113 = t56*t107; + T t114 = t52*t108; + T t115 = t53*t108; + T t116 = t54*t108; + T t117 = t55*t108; + T t118 = t56*t108; + T t119 = t78*t107*udg6; + T t120 = t78*t107*udg7; + T t121 = t78*t108*udg6; + T t122 = t78*t108*udg7; + T t106 = t83+t84; + T t123 = -t119; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t131 = t95+t109; + T t132 = t96+t110; + T t133 = t97+t111; + T t134 = t99+t112; + T t135 = t101+t113; + T t136 = t98+t114; + T t137 = t100+t115; + T t138 = t102+t116; + T t139 = t103+t117; + T t140 = t104+t118; + T t141 = -t78*(t119-udg14); + T t142 = -t78*(t120-udg15); + T t143 = -t78*(t121-udg22); + T t144 = -t78*(t122-udg23); + T t145 = t78*(t119-udg14)*-2.0; + T t146 = t78*(t122-udg23)*-2.0; + T t147 = t78*(t122-udg23); + T t149 = -t78*uinf2*(t85-t109); + T t150 = -t79*uinf2*(t85-t109); + T t151 = -t78*uinf3*(t86-t110); + T t152 = -t79*uinf3*(t86-t110); + T t153 = -t78*uinf4*(t87-t111); + T t154 = -t79*uinf4*(t87-t111); + T t155 = -t78*uinf5*(t89-t112); + T t156 = -t79*uinf5*(t89-t112); + T t157 = -t78*uinf6*(t91-t113); + T t158 = -t79*uinf6*(t91-t113); + T t159 = -t78*uinf2*(t88-t114); + T t160 = -t79*uinf2*(t88-t114); + T t161 = -t78*uinf3*(t90-t115); + T t162 = -t79*uinf3*(t90-t115); + T t163 = -t78*uinf4*(t92-t116); + T t164 = -t79*uinf4*(t92-t116); + T t165 = -t78*uinf5*(t93-t117); + T t166 = -t79*uinf5*(t93-t117); + T t167 = -t78*uinf6*(t94-t118); + T t168 = -t79*uinf6*(t94-t118); + T t169 = t78*uinf2*(t85-t109); + T t170 = t78*uinf3*(t86-t110); + T t171 = t78*uinf4*(t87-t111); + T t172 = t78*uinf5*(t89-t112); + T t173 = t78*uinf6*(t91-t113); + T t174 = t78*uinf2*(t88-t114); + T t175 = t78*uinf3*(t90-t115); + T t176 = t78*uinf4*(t92-t116); + T t177 = t78*uinf5*(t93-t117); + T t178 = t78*uinf6*(t94-t118); + T t182 = -t11*uinf12*(t78*(t120-udg15)+t78*(t121-udg22)); + T t185 = -t52*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t186 = -t53*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t187 = -t54*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t188 = -t55*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t189 = -t56*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t190 = -t52*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t191 = -t53*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t192 = -t54*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t193 = -t55*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t194 = -t56*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t127 = t123+udg14; + T t128 = t124+udg15; + T t129 = t125+udg22; + T t130 = t126+udg23; + T t148 = t147*2.0; + T t179 = t142+t143; + T t181 = t145+t147; + T t183 = t150+t152+t154+t156+t158; + T t184 = t160+t162+t164+t166+t168; + f[0*ng+i] = nlg1*(t169+t185+odg1*t67+t52*t78*udg6)+nlg2*(t174+t190+odg1*t70+t52*t78*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t170+t186+odg1*t68+t53*t78*udg6)+nlg2*(t175+t191+odg1*t72+t53*t78*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t171+t187+odg1*t69+t54*t78*udg6)+nlg2*(t176+t192+odg1*t74+t54*t78*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t172+t188+odg1*t71+t55*t78*udg6)+nlg2*(t177+t193+odg1*t75+t55*t78*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t173+t189+odg1*t73+t56*t78*udg6)+nlg2*(t178+t194+odg1*t76+t56*t78*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t82+t182+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t78-t11*uinf12*(t144+t78*(t119-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t82+t182+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t78+t11*uinf12*(t146+t78*(t119-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t105*udg6+uinf7*(t149+t52*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf8*(t151+t53*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf9*(t153+t54*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf10*(t155+t55*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf11*(t157+t56*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))-t10*t11*uinf13*(uinf19*(udg16+t77*(t79*udg6*(t119-udg14)+t79*udg7*(t120-udg15))-t106*t107)+t67*uinf14+t68*uinf15+t69*uinf16+t71*uinf17+t73*uinf18)+t11*t78*udg6*uinf12*(t144+t78*(t119-udg14)*2.0)*(2.0/3.0)+t11*t78*udg7*uinf12*(t78*(t120-udg15)+t78*(t121-udg22)))-nlg2*(-odg1*udg24-t105*udg7+uinf7*(t159+t52*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf8*(t161+t53*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf9*(t163+t54*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf10*(t165+t55*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf11*(t167+t56*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))-t10*t11*uinf13*(uinf19*(udg24+t77*(t79*udg6*(t121-udg22)+t79*udg7*(t122-udg23))-t106*t108)+t70*uinf14+t72*uinf15+t74*uinf16+t75*uinf17+t76*uinf18)-t11*t78*udg7*uinf12*(t146+t78*(t119-udg14))*(2.0/3.0)+t11*t78*udg6*uinf12*(t78*(t120-udg15)+t78*(t121-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + // uinf2 = 0.0; // D_1 + // uinf3 = 0.0; // D_2 + // uinf4 = 0.0; // D_3 + // uinf5 = 0.0; // D_4 + // uinf6 = 0.0; // D_5 + // uinf7 = 0.0; // h_1 + // uinf8 = 0.0; // h_2 + // uinf9 = 0.0; // h_3 + // uinf10 = 0.0; // h_4 + // uinf11 = 0.0; // h_5 + // uinf12 = 0.0; // mu + // uinf13 = 0.0; // kappa + uinf2 = D_i[0]; // D_1 + uinf3 = D_i[1]; // D_2 + uinf4 = D_i[2]; // D_3 + uinf5 = D_i[3]; // D_4 + uinf6 = D_i[4]; // D_5 + uinf7 = h_i[0]; // h_1 + uinf8 = h_i[1]; // h_2 + uinf9 = h_i[2]; // h_3 + uinf10 = h_i[3]; // h_4 + uinf11 = h_i[4]; // h_5 + uinf12 = mix->viscosity() / mu_scale; // mu + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + // uinf14 = 0.0; + // uinf15 = 0.0; + // uinf16 = 0.0; + // uinf17 = 0.0; + // uinf18 = 0.0; + // uinf19 = 0.0; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param19; + T t11 = 1.0/param20; + T t12 = udg1*1.0E+12; + T t13 = udg2*1.0E+12; + T t14 = udg3*1.0E+12; + T t15 = udg4*1.0E+12; + T t16 = udg5*1.0E+12; + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t37 = t2*1.0E+24; + T t38 = t3*1.0E+24; + T t39 = t4*1.0E+24; + T t40 = t5*1.0E+24; + T t41 = t6*1.0E+24; + T t22 = t9*t17; + T t23 = t9*t18; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t42 = t37+1.0; + T t43 = t38+1.0; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t47 = 1.0/t42; + T t48 = 1.0/t43; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t32 = t27*udg1; + T t33 = t28*udg2; + T t34 = t29*udg3; + T t35 = t30*udg4; + T t36 = t31*udg5; + T t57 = t9*t12*t47; + T t58 = t9*t13*t48; + T t59 = t9*t14*t49; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t52 = t32+3.182454300088011E-13; + T t53 = t33+3.182454300088011E-13; + T t54 = t34+3.182454300088011E-13; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t62 = t27+t57; + T t63 = t28+t58; + T t64 = t29+t59; + T t65 = t30+t60; + T t66 = t31+t61; + T t77 = t32+t33+t34+t35+t36+1.591227150044006E-12; + T t67 = t62*udg9; + T t68 = t63*udg10; + T t69 = t64*udg11; + T t70 = t62*udg17; + T t71 = t65*udg12; + T t72 = t63*udg18; + T t73 = t66*udg13; + T t74 = t64*udg19; + T t75 = t65*udg20; + T t76 = t66*udg21; + T t78 = 1.0/t77; + T t79 = t78*t78; + T t80 = t78*udg8; + T t81 = t78*uinf1; + T t82 = t78*udg6*udg7; + T t85 = t67*t77; + T t86 = t68*t77; + T t87 = t69*t77; + T t88 = t70*t77; + T t89 = t71*t77; + T t90 = t72*t77; + T t91 = t73*t77; + T t92 = t74*t77; + T t93 = t75*t77; + T t94 = t76*t77; + T t107 = t67+t68+t69+t71+t73; + T t108 = t70+t72+t74+t75+t76; + T t83 = (t7*t79)/2.0; + T t84 = (t8*t79)/2.0; + T t95 = -t85; + T t96 = -t86; + T t97 = -t87; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = t80+t81; + T t109 = t52*t107; + T t110 = t53*t107; + T t111 = t54*t107; + T t112 = t55*t107; + T t113 = t56*t107; + T t114 = t52*t108; + T t115 = t53*t108; + T t116 = t54*t108; + T t117 = t55*t108; + T t118 = t56*t108; + T t119 = t78*t107*udg6; + T t120 = t78*t107*udg7; + T t121 = t78*t108*udg6; + T t122 = t78*t108*udg7; + T t106 = t83+t84; + T t123 = -t119; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t131 = t95+t109; + T t132 = t96+t110; + T t133 = t97+t111; + T t134 = t99+t112; + T t135 = t101+t113; + T t136 = t98+t114; + T t137 = t100+t115; + T t138 = t102+t116; + T t139 = t103+t117; + T t140 = t104+t118; + T t141 = -t78*(t119-udg14); + T t142 = -t78*(t120-udg15); + T t143 = -t78*(t121-udg22); + T t144 = -t78*(t122-udg23); + T t145 = t78*(t119-udg14)*-2.0; + T t146 = t78*(t122-udg23)*-2.0; + T t147 = t78*(t122-udg23); + T t149 = -t78*uinf2*(t85-t109); + T t150 = -t79*uinf2*(t85-t109); + T t151 = -t78*uinf3*(t86-t110); + T t152 = -t79*uinf3*(t86-t110); + T t153 = -t78*uinf4*(t87-t111); + T t154 = -t79*uinf4*(t87-t111); + T t155 = -t78*uinf5*(t89-t112); + T t156 = -t79*uinf5*(t89-t112); + T t157 = -t78*uinf6*(t91-t113); + T t158 = -t79*uinf6*(t91-t113); + T t159 = -t78*uinf2*(t88-t114); + T t160 = -t79*uinf2*(t88-t114); + T t161 = -t78*uinf3*(t90-t115); + T t162 = -t79*uinf3*(t90-t115); + T t163 = -t78*uinf4*(t92-t116); + T t164 = -t79*uinf4*(t92-t116); + T t165 = -t78*uinf5*(t93-t117); + T t166 = -t79*uinf5*(t93-t117); + T t167 = -t78*uinf6*(t94-t118); + T t168 = -t79*uinf6*(t94-t118); + T t169 = t78*uinf2*(t85-t109); + T t170 = t78*uinf3*(t86-t110); + T t171 = t78*uinf4*(t87-t111); + T t172 = t78*uinf5*(t89-t112); + T t173 = t78*uinf6*(t91-t113); + T t174 = t78*uinf2*(t88-t114); + T t175 = t78*uinf3*(t90-t115); + T t176 = t78*uinf4*(t92-t116); + T t177 = t78*uinf5*(t93-t117); + T t178 = t78*uinf6*(t94-t118); + T t182 = -t11*uinf12*(t78*(t120-udg15)+t78*(t121-udg22)); + T t185 = -t52*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t186 = -t53*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t187 = -t54*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t188 = -t55*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t189 = -t56*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t190 = -t52*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t191 = -t53*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t192 = -t54*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t193 = -t55*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t194 = -t56*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t127 = t123+udg14; + T t128 = t124+udg15; + T t129 = t125+udg22; + T t130 = t126+udg23; + T t148 = t147*2.0; + T t179 = t142+t143; + T t181 = t145+t147; + T t183 = t150+t152+t154+t156+t158; + T t184 = t160+t162+t164+t166+t168; + f[0*ng+i] = nlg1*(t169+t185+odg1*t67+t52*t78*udg6)+nlg2*(t174+t190+odg1*t70+t52*t78*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t170+t186+odg1*t68+t53*t78*udg6)+nlg2*(t175+t191+odg1*t72+t53*t78*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t171+t187+odg1*t69+t54*t78*udg6)+nlg2*(t176+t192+odg1*t74+t54*t78*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t172+t188+odg1*t71+t55*t78*udg6)+nlg2*(t177+t193+odg1*t75+t55*t78*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t173+t189+odg1*t73+t56*t78*udg6)+nlg2*(t178+t194+odg1*t76+t56*t78*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t82+t182+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t7*t78-t11*uinf12*(t144+t78*(t119-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t82+t182+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t8*t78+t11*uinf12*(t146+t78*(t119-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t105*udg6+uinf7*(t149+t52*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf8*(t151+t53*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf9*(t153+t54*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf10*(t155+t55*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+uinf11*(t157+t56*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))-t10*t11*uinf13*(uinf19*(udg16+t77*(t79*udg6*(t119-udg14)+t79*udg7*(t120-udg15))-t106*t107)+t67*uinf14+t68*uinf15+t69*uinf16+t71*uinf17+t73*uinf18)+t11*t78*udg6*uinf12*(t144+t78*(t119-udg14)*2.0)*(2.0/3.0)+t11*t78*udg7*uinf12*(t78*(t120-udg15)+t78*(t121-udg22)))-nlg2*(-odg1*udg24-t105*udg7+uinf7*(t159+t52*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf8*(t161+t53*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf9*(t163+t54*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf10*(t165+t55*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+uinf11*(t167+t56*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))-t10*t11*uinf13*(uinf19*(udg24+t77*(t79*udg6*(t121-udg22)+t79*udg7*(t122-udg23))-t106*t108)+t70*uinf14+t72*uinf15+t74*uinf16+t75*uinf17+t76*uinf18)-t11*t78*udg7*uinf12*(t146+t78*(t119-udg14))*(2.0/3.0)+t11*t78*udg6*uinf12*(t78*(t120-udg15)+t78*(t121-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + + uinf1 = mix->P()/rhoe_scale; + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + // uinf7 = h_i[0]; // h_1 + // uinf8 = h_i[1]; // h_2 + // uinf9 = h_i[2]; // h_3 + // uinf10 = h_i[3]; // h_4 + // uinf11 = h_i[4]; // h_5 + uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + // dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + // nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + // uinf14 = dTdU[0]; + // uinf15 = dTdU[1]; + // uinf16 = dTdU[2]; + // uinf17 = dTdU[3]; + // uinf18 = dTdU[4]; + // uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = 1.0/3.141592653589793; + T t8 = 1.0/param20; + T t9 = udg1*1.0E+12; + T t10 = udg2*1.0E+12; + T t11 = udg3*1.0E+12; + T t12 = udg4*1.0E+12; + T t13 = udg5*1.0E+12; + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t18 = atan(t13); + T t34 = t2*1.0E+24; + T t35 = t3*1.0E+24; + T t36 = t4*1.0E+24; + T t37 = t5*1.0E+24; + T t38 = t6*1.0E+24; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t23 = t7*t18; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t43 = t38+1.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t48 = 1.0/t43; + T t29 = t24*udg1; + T t30 = t25*udg2; + T t31 = t26*udg3; + T t32 = t27*udg4; + T t33 = t28*udg5; + T t49 = t7*t9*t44; + T t50 = t7*t10*t45; + T t51 = t7*t11*t46; + T t52 = t7*t12*t47; + T t53 = t7*t13*t48; + T t54 = t24+t49; + T t55 = t25+t50; + T t56 = t26+t51; + T t57 = t27+t52; + T t58 = t28+t53; + T t69 = t29+t30+t31+t32+t33+1.591227150044006E-12; + T t59 = t54*udg9; + T t60 = t55*udg10; + T t61 = t56*udg11; + T t62 = t54*udg17; + T t63 = t57*udg12; + T t64 = t55*udg18; + T t65 = t58*udg13; + T t66 = t56*udg19; + T t67 = t57*udg20; + T t68 = t58*udg21; + T t70 = 1.0/t69; + T t71 = t70*udg6*udg7; + T t72 = t59+t60+t61+t63+t65; + T t73 = t62+t64+t66+t67+t68; + T t74 = t70*t72*udg6; + T t75 = t70*t72*udg7; + T t76 = t70*t73*udg6; + T t77 = t70*t73*udg7; + T t78 = -t74; + T t79 = -t75; + T t80 = -t76; + T t81 = -t77; + T t86 = -t70*(t75-udg15); + T t87 = -t70*(t76-udg22); + T t89 = -t8*uinf12*(t70*(t75-udg15)+t70*(t76-udg22)); + T t82 = t78+udg14; + T t83 = t79+udg15; + T t84 = t80+udg22; + T t85 = t81+udg23; + T t88 = t86+t87; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg1*(uinf1+odg1*udg14+t70*(udg6*udg6)-t8*uinf12*(t70*(t74-udg14)*2.0-t70*(t77-udg23))*(2.0/3.0))+nlg2*(t71+t89+odg1*udg22)+tau6*(udg6-uhg6); + f[6*ng+i] = nlg2*(uinf1+odg1*udg23+t70*(udg7*udg7)+t8*uinf12*(t70*(t74-udg14)-t70*(t77-udg23)*2.0)*(2.0/3.0))+nlg1*(t71+t89+odg1*udg15)+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_La_MPP_manual.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_La_MPP_manual.cpp new file mode 100644 index 00000000..d0f3a217 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_La_MPP_manual.cpp @@ -0,0 +1,210 @@ +template void opuFluxKernel(int i, T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + T param1 = param[0]; + T param2 = param[1]; + T param19 = param[18]; + T param20 = param[19]; + T uinf1 = uinf[0]; + T uinf2 = uinf[1]; + T uinf3 = uinf[2]; + T uinf4 = uinf[3]; + T uinf5 = uinf[4]; + T uinf6 = uinf[5]; + T uinf7 = uinf[6]; + T uinf8 = uinf[7]; + T uinf9 = uinf[8]; + T uinf10 = uinf[9]; + T uinf11 = uinf[10]; + T uinf12 = uinf[11]; + T uinf13 = uinf[12]; + T uinf14 = uinf[13]; + T uinf15 = uinf[14]; + T uinf16 = uinf[15]; + T uinf17 = uinf[16]; + T uinf18 = uinf[17]; + T uinf19 = uinf[18]; + T udg1 = udg[0]; + T udg2 = udg[1]; + T udg3 = udg[2]; + T udg4 = udg[3]; + T udg5 = udg[4]; + T udg6 = udg[5]; + T udg7 = udg[6]; + T udg8 = udg[7]; + T udg9 = udg[8]; + T udg10 = udg[9]; + T udg11 = udg[10]; + T udg12 = udg[11]; + T udg13 = udg[12]; + T udg14 = udg[13]; + T udg15 = udg[14]; + T udg16 = udg[15]; + T udg17 = udg[16]; + T udg18 = udg[17]; + T udg19 = udg[18]; + T udg20 = udg[19]; + T udg21 = udg[20]; + T udg22 = udg[21]; + T udg23 = udg[22]; + T udg24 = udg[23]; + T odg1 = odg[0*ng+i]; + + T t1pi = 1.0/3.141592653589793; + + udg1 = udg1*(t1pi*atan(udg1*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg2 = udg2*(t1pi*atan(udg2*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg3 = udg3*(t1pi*atan(udg3*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg4 = udg4*(t1pi*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg5 = udg5*(t1pi*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + + double Ucons[8] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7, udg8}; + dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, ndim); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, ndim); + double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; + double rhoe = Ustate[nspecies]; + + mix->setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = 0.0; // D_1 + uinf3 = 0.0; // D_2 + uinf4 = 0.0; // D_3 + uinf5 = 0.0; // D_4 + uinf6 = 0.0; // D_5 + uinf7 = 0.0; // h_1 + uinf8 = 0.0; // h_2 + uinf9 = 0.0; // h_3 + uinf10 = 0.0; // h_4 + uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + + uinf14 = 0.0; + uinf15 = 0.0; + uinf16 = 0.0; + uinf17 = 0.0; + uinf18 = 0.0; + uinf19 = 0.0; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = 1.0/3.141592653589793; + T t8 = udg1*1.0E+12; + T t9 = udg2*1.0E+12; + T t10 = udg3*1.0E+12; + T t11 = udg4*1.0E+12; + T t12 = udg5*1.0E+12; + T t13 = atan(t8); + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t33 = t2*1.0E+24; + T t34 = t3*1.0E+24; + T t35 = t4*1.0E+24; + T t36 = t5*1.0E+24; + T t37 = t6*1.0E+24; + T t18 = t7*t13; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t38 = t33+1.0; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t23 = t18+1.0/2.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t43 = 1.0/t38; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t28 = t23*udg1; + T t29 = t24*udg2; + T t30 = t25*udg3; + T t31 = t26*udg4; + T t32 = t27*udg5; + T t53 = t7*t8*t43; + T t54 = t7*t9*t44; + T t55 = t7*t10*t45; + T t56 = t7*t11*t46; + T t57 = t7*t12*t47; + T t48 = t28+3.182454300088011E-13; + T t49 = t29+3.182454300088011E-13; + T t50 = t30+3.182454300088011E-13; + T t51 = t31+3.182454300088011E-13; + T t52 = t32+3.182454300088011E-13; + T t58 = t23+t53; + T t59 = t24+t54; + T t60 = t25+t55; + T t61 = t26+t56; + T t62 = t27+t57; + T t63 = t28+t29+t30+t31+t32+1.591227150044006E-12; + T t64 = 1.0/t63; + T t65 = t64*udg8; + T t66 = t64*uinf1; + T t67 = t64*udg6*udg7; + T t68 = t65+t66; + f[0] = odg1*t58*udg9+t48*t64*udg6; + f[1] = odg1*t59*udg10+t49*t64*udg6; + f[2] = odg1*t60*udg11+t50*t64*udg6; + f[3] = odg1*t61*udg12+t51*t64*udg6; + f[4] = odg1*t62*udg13+t52*t64*udg6; + f[5] = uinf1+odg1*udg14+t64*(udg6*udg6); + f[6] = t67+odg1*udg15; + f[7] = odg1*udg16+t68*udg6; + f[8] = odg1*t58*udg17+t48*t64*udg7; + f[9] = odg1*t59*udg18+t49*t64*udg7; + f[10] = odg1*t60*udg19+t50*t64*udg7; + f[11] = odg1*t61*udg20+t51*t64*udg7; + f[12] = odg1*t62*udg21+t52*t64*udg7; + f[13] = t67+odg1*udg22; + f[14] = uinf1+odg1*udg23+t64*(udg7*udg7); + f[15] = odg1*udg24+t68*udg7; +} + +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + T ftmp[16]; + T utmp[16]; + + for (int i = 0; i void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __ mix->setState(rhovec, &rhoe, 0); - mix->averageDiffusionCoeffs(D_i); - nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); - mix->speciesHOverRT(h_i); - nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + // mix->speciesHOverRT(h_i); + // nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); uinf1 = mix->P() / rhoe_scale; uinf2 = 0.0; // D_1 @@ -133,254 +133,391 @@ template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __ T t4 = udg3*udg3; T t5 = udg4*udg4; T t6 = udg5*udg5; - T t7 = udg6*udg6; - T t8 = udg7*udg7; - T t9 = udg17*udg17; - T t10 = udg18*udg18; - T t11 = udg19*udg19; - T t12 = udg20*udg20; - T t13 = udg21*udg21; - T t14 = 1.0/3.141592653589793; - T t15 = 1.0/param19; - T t16 = 1.0/param20; - T t17 = udg1*1.0E+12; - T t18 = udg2*1.0E+12; - T t19 = udg3*1.0E+12; - T t20 = udg4*1.0E+12; - T t21 = udg5*1.0E+12; - T t22 = udg17*1.0E+12; - T t23 = udg18*1.0E+12; - T t24 = udg19*1.0E+12; - T t25 = udg20*1.0E+12; - T t26 = udg21*1.0E+12; - T t27 = atan(t17); - T t28 = atan(t18); - T t29 = atan(t19); - T t30 = atan(t20); - T t31 = atan(t21); - T t32 = atan(t22); - T t33 = atan(t23); - T t34 = atan(t24); - T t35 = atan(t25); - T t36 = atan(t26); - T t57 = t2*1.0E+24; - T t58 = t3*1.0E+24; - T t59 = t4*1.0E+24; - T t60 = t5*1.0E+24; - T t61 = t6*1.0E+24; - T t62 = t9*1.0E+24; - T t63 = t10*1.0E+24; - T t64 = t11*1.0E+24; - T t65 = t12*1.0E+24; - T t66 = t13*1.0E+24; - T t37 = t14*t27; - T t38 = t14*t28; - T t39 = t14*t29; - T t40 = t14*t30; - T t41 = t14*t31; - T t42 = t14*t32; - T t43 = t14*t33; - T t44 = t14*t34; - T t45 = t14*t35; - T t46 = t14*t36; - T t67 = t57+1.0; - T t68 = t58+1.0; - T t69 = t59+1.0; - T t70 = t60+1.0; - T t71 = t61+1.0; - T t72 = t62+1.0; - T t73 = t63+1.0; - T t74 = t64+1.0; - T t75 = t65+1.0; - T t76 = t66+1.0; - T t47 = t37+1.0/2.0; - T t48 = t38+1.0/2.0; - T t49 = t39+1.0/2.0; - T t50 = t40+1.0/2.0; - T t51 = t41+1.0/2.0; - T t77 = 1.0/t67; - T t78 = 1.0/t68; - T t79 = 1.0/t69; - T t80 = 1.0/t70; - T t81 = 1.0/t71; - T t82 = 1.0/t72; - T t83 = 1.0/t73; - T t84 = 1.0/t74; - T t85 = 1.0/t75; - T t86 = 1.0/t76; - T t52 = t47*udg1; - T t53 = t48*udg2; - T t54 = t49*udg3; - T t55 = t50*udg4; - T t56 = t51*udg5; - T t92 = t14*t17*t77; - T t93 = t14*t18*t78; - T t94 = t14*t19*t79; - T t95 = t14*t20*t80; - T t96 = t14*t21*t81; - T t97 = t14*t22*t82; - T t98 = t14*t23*t83; - T t99 = t14*t24*t84; - T t100 = t14*t25*t85; - T t101 = t14*t26*t86; - T t87 = t52+3.182454300088011E-13; - T t88 = t53+3.182454300088011E-13; - T t89 = t54+3.182454300088011E-13; - T t90 = t55+3.182454300088011E-13; - T t91 = t56+3.182454300088011E-13; - T t102 = t47+t92; - T t103 = t48+t93; - T t104 = t49+t94; - T t105 = t50+t95; - T t106 = t51+t96; - T t107 = t42+t97+1.0/2.0; - T t108 = t43+t98+1.0/2.0; - T t109 = t44+t99+1.0/2.0; - T t110 = t45+t100+1.0/2.0; - T t111 = t46+t101+1.0/2.0; - T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; - T t112 = t102*udg9; - T t113 = t103*udg10; - T t114 = t104*udg11; - T t115 = t105*udg12; - T t116 = t106*udg13; - T t117 = t107*udg17; - T t118 = t108*udg18; - T t119 = t109*udg19; - T t120 = t110*udg20; - T t121 = t111*udg21; - T t123 = 1.0/t122; - T t124 = t123*t123; - T t125 = t123*udg8; - T t126 = t123*uinf1; - T t127 = t123*udg6*udg7; - T t130 = t112*t122; - T t131 = t113*t122; - T t132 = t114*t122; - T t133 = t115*t122; - T t134 = t116*t122; - T t135 = t117*t122; - T t136 = t118*t122; - T t137 = t119*t122; - T t138 = t120*t122; - T t139 = t121*t122; - T t152 = t112+t113+t114+t115+t116; - T t153 = t117+t118+t119+t120+t121; - T t128 = (t7*t124)/2.0; - T t129 = (t8*t124)/2.0; - T t140 = -t130; - T t141 = -t131; - T t142 = -t132; - T t143 = -t133; - T t144 = -t134; - T t145 = -t135; - T t146 = -t136; - T t147 = -t137; - T t148 = -t138; - T t149 = -t139; - T t150 = t125+t126; - T t154 = t87*t152; - T t155 = t88*t152; - T t156 = t89*t152; - T t157 = t90*t152; - T t158 = t91*t152; - T t159 = t87*t153; - T t160 = t88*t153; - T t161 = t89*t153; - T t162 = t90*t153; - T t163 = t91*t153; - T t164 = t123*t152*udg6; - T t165 = t123*t152*udg7; - T t166 = t123*t153*udg6; - T t167 = t123*t153*udg7; - T t151 = t128+t129; - T t168 = -t164; - T t169 = -t165; - T t170 = -t166; - T t171 = -t167; - T t176 = t140+t154; - T t177 = t141+t155; - T t178 = t142+t156; - T t179 = t143+t157; - T t180 = t144+t158; - T t181 = t145+t159; - T t182 = t146+t160; - T t183 = t147+t161; - T t184 = t148+t162; - T t185 = t149+t163; - T t186 = -t123*(t164-udg14); - T t187 = -t123*(t165-udg15); - T t188 = -t123*(t166-udg22); - T t189 = -t123*(t167-udg23); - T t190 = t123*(t164-udg14)*-2.0; - T t191 = t123*(t167-udg23)*-2.0; - T t192 = t123*(t167-udg23); - T t194 = -t123*uinf2*(t130-t154); - T t195 = -t124*uinf2*(t130-t154); - T t196 = -t123*uinf3*(t131-t155); - T t197 = -t124*uinf3*(t131-t155); - T t198 = -t123*uinf4*(t132-t156); - T t199 = -t124*uinf4*(t132-t156); - T t200 = -t123*uinf5*(t133-t157); - T t201 = -t124*uinf5*(t133-t157); - T t202 = -t123*uinf6*(t134-t158); - T t203 = -t124*uinf6*(t134-t158); - T t204 = -t123*uinf2*(t135-t159); - T t205 = -t124*uinf2*(t135-t159); - T t206 = -t123*uinf3*(t136-t160); - T t207 = -t124*uinf3*(t136-t160); - T t208 = -t123*uinf4*(t137-t161); - T t209 = -t124*uinf4*(t137-t161); - T t210 = -t123*uinf5*(t138-t162); - T t211 = -t124*uinf5*(t138-t162); - T t212 = -t123*uinf6*(t139-t163); - T t213 = -t124*uinf6*(t139-t163); - T t214 = t123*uinf2*(t130-t154); - T t215 = t123*uinf3*(t131-t155); - T t216 = t123*uinf4*(t132-t156); - T t217 = t123*uinf5*(t133-t157); - T t218 = t123*uinf6*(t134-t158); - T t219 = t123*uinf2*(t135-t159); - T t220 = t123*uinf3*(t136-t160); - T t221 = t123*uinf4*(t137-t161); - T t222 = t123*uinf5*(t138-t162); - T t223 = t123*uinf6*(t139-t163); - T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); - T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); - T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); - T t172 = t168+udg14; - T t173 = t169+udg15; - T t174 = t170+udg22; - T t175 = t171+udg23; - T t193 = t192*2.0; - T t224 = t187+t188; - T t226 = t190+t192; - T t228 = t195+t197+t199+t201+t203; - T t229 = t205+t207+t209+t211+t213; - f[0*ng+i] = t214+t230+odg1*t112+t87*t123*udg6; - f[1*ng+i] = t215+t231+odg1*t113+t88*t123*udg6; - f[2*ng+i] = t216+t232+odg1*t114+t89*t123*udg6; - f[3*ng+i] = t217+t233+odg1*t115+t90*t123*udg6; - f[4*ng+i] = t218+t234+odg1*t116+t91*t123*udg6; - f[5*ng+i] = uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); - f[6*ng+i] = t127+t227+odg1*udg15; - f[7*ng+i] = odg1*udg16+t150*udg6-uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+t123*t227*udg7+t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)-t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); - f[8*ng+i] = t219+t235+odg1*t117+t87*t123*udg7; - f[9*ng+i] = t220+t236+odg1*t118+t88*t123*udg7; - f[10*ng+i] = t221+t237+odg1*t119+t89*t123*udg7; - f[11*ng+i] = t222+t238+odg1*t120+t90*t123*udg7; - f[12*ng+i] = t223+t239+odg1*t121+t91*t123*udg7; - f[13*ng+i] = t127+t227+odg1*udg22; - f[14*ng+i] = uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); - f[15*ng+i] = odg1*udg24+t150*udg7-uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+t123*t227*udg6+t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)+t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); + T t7 = 1.0/3.141592653589793; + T t8 = udg1*1.0E+12; + T t9 = udg2*1.0E+12; + T t10 = udg3*1.0E+12; + T t11 = udg4*1.0E+12; + T t12 = udg5*1.0E+12; + T t13 = atan(t8); + T t14 = atan(t9); + T t15 = atan(t10); + T t16 = atan(t11); + T t17 = atan(t12); + T t33 = t2*1.0E+24; + T t34 = t3*1.0E+24; + T t35 = t4*1.0E+24; + T t36 = t5*1.0E+24; + T t37 = t6*1.0E+24; + T t18 = t7*t13; + T t19 = t7*t14; + T t20 = t7*t15; + T t21 = t7*t16; + T t22 = t7*t17; + T t38 = t33+1.0; + T t39 = t34+1.0; + T t40 = t35+1.0; + T t41 = t36+1.0; + T t42 = t37+1.0; + T t23 = t18+1.0/2.0; + T t24 = t19+1.0/2.0; + T t25 = t20+1.0/2.0; + T t26 = t21+1.0/2.0; + T t27 = t22+1.0/2.0; + T t43 = 1.0/t38; + T t44 = 1.0/t39; + T t45 = 1.0/t40; + T t46 = 1.0/t41; + T t47 = 1.0/t42; + T t28 = t23*udg1; + T t29 = t24*udg2; + T t30 = t25*udg3; + T t31 = t26*udg4; + T t32 = t27*udg5; + T t53 = t7*t8*t43; + T t54 = t7*t9*t44; + T t55 = t7*t10*t45; + T t56 = t7*t11*t46; + T t57 = t7*t12*t47; + T t48 = t28+3.182454300088011E-13; + T t49 = t29+3.182454300088011E-13; + T t50 = t30+3.182454300088011E-13; + T t51 = t31+3.182454300088011E-13; + T t52 = t32+3.182454300088011E-13; + T t58 = t23+t53; + T t59 = t24+t54; + T t60 = t25+t55; + T t61 = t26+t56; + T t62 = t27+t57; + T t63 = t28+t29+t30+t31+t32+1.591227150044006E-12; + T t64 = 1.0/t63; + T t65 = t64*udg8; + T t66 = t64*uinf1; + T t67 = t64*udg6*udg7; + T t68 = t65+t66; + f[0*ng+i] = odg1*t58*udg9+t48*t64*udg6; + f[1*ng+i] = odg1*t59*udg10+t49*t64*udg6; + f[2*ng+i] = odg1*t60*udg11+t50*t64*udg6; + f[3*ng+i] = odg1*t61*udg12+t51*t64*udg6; + f[4*ng+i] = odg1*t62*udg13+t52*t64*udg6; + f[5*ng+i] = uinf1+odg1*udg14+t64*(udg6*udg6); + f[6*ng+i] = t67+odg1*udg15; + f[7*ng+i] = odg1*udg16+t68*udg6; + f[8*ng+i] = odg1*t58*udg17+t48*t64*udg7; + f[9*ng+i] = odg1*t59*udg18+t49*t64*udg7; + f[10*ng+i] = odg1*t60*udg19+t50*t64*udg7; + f[11*ng+i] = odg1*t61*udg20+t51*t64*udg7; + f[12*ng+i] = odg1*t62*udg21+t52*t64*udg7; + f[13*ng+i] = t67+odg1*udg22; + f[14*ng+i] = uinf1+odg1*udg23+t64*(udg7*udg7); + f[15*ng+i] = odg1*udg24+t68*udg7; + + // T t2 = 1.0/3.141592653589793; + // T t3 = udg1*1.0E+12; + // T t4 = udg2*1.0E+12; + // T t5 = udg3*1.0E+12; + // T t6 = udg4*1.0E+12; + // T t7 = udg5*1.0E+12; + // T t8 = atan(t3); + // T t9 = atan(t4); + // T t10 = atan(t5); + // T t11 = atan(t6); + // T t12 = atan(t7); + // T t13 = t2*t8; + // T t14 = t2*t9; + // T t15 = t2*t10; + // T t16 = t2*t11; + // T t17 = t2*t12; + // T t18 = t13+1.0/2.0; + // T t19 = t14+1.0/2.0; + // T t20 = t15+1.0/2.0; + // T t21 = t16+1.0/2.0; + // T t22 = t17+1.0/2.0; + // T t23 = t18*udg1; + // T t24 = t19*udg2; + // T t25 = t20*udg3; + // T t26 = t21*udg4; + // T t27 = t22*udg5; + // T t28 = t23+3.182454300088011E-13; + // T t29 = t24+3.182454300088011E-13; + // T t30 = t25+3.182454300088011E-13; + // T t31 = t26+3.182454300088011E-13; + // T t32 = t27+3.182454300088011E-13; + // T t33 = t23+t24+t25+t26+t27+1.591227150044006E-12; + // T t34 = 1.0/t33; + // T t35 = t34*udg8; + // T t36 = t34*uinf1; + // T t37 = t34*udg6*udg7; + // T t38 = t35+t36; + // f[0*ng+i] = t28*t34*udg6+odg1*udg9*(t18+(t2*t3)/((udg1*udg1)*1.0E+24+1.0)); + // f[1*ng+i] = t29*t34*udg6+odg1*udg10*(t19+(t2*t4)/((udg2*udg2)*1.0E+24+1.0)); + // f[2*ng+i] = t30*t34*udg6+odg1*udg11*(t20+(t2*t5)/((udg3*udg3)*1.0E+24+1.0)); + // f[3*ng+i] = t31*t34*udg6+odg1*udg12*(t21+(t2*t6)/((udg4*udg4)*1.0E+24+1.0)); + // f[4*ng+i] = t32*t34*udg6+odg1*udg13*(t22+(t2*t7)/((udg5*udg5)*1.0E+24+1.0)); + // f[5*ng+i] = uinf1+odg1*udg14+t34*(udg6*udg6); + // f[6*ng+i] = t37+odg1*udg15; + // f[7*ng+i] = odg1*udg16+t38*udg6; + // f[8*ng+i] = odg1*udg17*(t2*atan(udg17*1.0E+12)+(t2*udg17*1.0E+12)/((udg17*udg17)*1.0E+24+1.0)+1.0/2.0)+t28*t34*udg7; + // f[9*ng+i] = odg1*udg18*(t2*atan(udg18*1.0E+12)+(t2*udg18*1.0E+12)/((udg18*udg18)*1.0E+24+1.0)+1.0/2.0)+t29*t34*udg7; + // f[10*ng+i] = odg1*udg19*(t2*atan(udg19*1.0E+12)+(t2*udg19*1.0E+12)/((udg19*udg19)*1.0E+24+1.0)+1.0/2.0)+t30*t34*udg7; + // f[11*ng+i] = odg1*udg20*(t2*atan(udg20*1.0E+12)+(t2*udg20*1.0E+12)/((udg20*udg20)*1.0E+24+1.0)+1.0/2.0)+t31*t34*udg7; + // f[12*ng+i] = odg1*udg21*(t2*atan(udg21*1.0E+12)+(t2*udg21*1.0E+12)/((udg21*udg21)*1.0E+24+1.0)+1.0/2.0)+t32*t34*udg7; + // f[13*ng+i] = t37+odg1*udg22; + // f[14*ng+i] = uinf1+odg1*udg23+t34*(udg7*udg7); + // f[15*ng+i] = odg1*udg24+t38*udg7; + // T t2 = udg1*udg1; + // T t3 = udg2*udg2; + // T t4 = udg3*udg3; + // T t5 = udg4*udg4; + // T t6 = udg5*udg5; + // T t7 = udg6*udg6; + // T t8 = udg7*udg7; + // T t9 = udg17*udg17; + // T t10 = udg18*udg18; + // T t11 = udg19*udg19; + // T t12 = udg20*udg20; + // T t13 = udg21*udg21; + // T t14 = 1.0/3.141592653589793; + // T t15 = 1.0/param19; + // T t16 = 1.0/param20; + // T t17 = udg1*1.0E+12; + // T t18 = udg2*1.0E+12; + // T t19 = udg3*1.0E+12; + // T t20 = udg4*1.0E+12; + // T t21 = udg5*1.0E+12; + // T t22 = udg17*1.0E+12; + // T t23 = udg18*1.0E+12; + // T t24 = udg19*1.0E+12; + // T t25 = udg20*1.0E+12; + // T t26 = udg21*1.0E+12; + // T t27 = atan(t17); + // T t28 = atan(t18); + // T t29 = atan(t19); + // T t30 = atan(t20); + // T t31 = atan(t21); + // T t32 = atan(t22); + // T t33 = atan(t23); + // T t34 = atan(t24); + // T t35 = atan(t25); + // T t36 = atan(t26); + // T t57 = t2*1.0E+24; + // T t58 = t3*1.0E+24; + // T t59 = t4*1.0E+24; + // T t60 = t5*1.0E+24; + // T t61 = t6*1.0E+24; + // T t62 = t9*1.0E+24; + // T t63 = t10*1.0E+24; + // T t64 = t11*1.0E+24; + // T t65 = t12*1.0E+24; + // T t66 = t13*1.0E+24; + // T t37 = t14*t27; + // T t38 = t14*t28; + // T t39 = t14*t29; + // T t40 = t14*t30; + // T t41 = t14*t31; + // T t42 = t14*t32; + // T t43 = t14*t33; + // T t44 = t14*t34; + // T t45 = t14*t35; + // T t46 = t14*t36; + // T t67 = t57+1.0; + // T t68 = t58+1.0; + // T t69 = t59+1.0; + // T t70 = t60+1.0; + // T t71 = t61+1.0; + // T t72 = t62+1.0; + // T t73 = t63+1.0; + // T t74 = t64+1.0; + // T t75 = t65+1.0; + // T t76 = t66+1.0; + // T t47 = t37+1.0/2.0; + // T t48 = t38+1.0/2.0; + // T t49 = t39+1.0/2.0; + // T t50 = t40+1.0/2.0; + // T t51 = t41+1.0/2.0; + // T t77 = 1.0/t67; + // T t78 = 1.0/t68; + // T t79 = 1.0/t69; + // T t80 = 1.0/t70; + // T t81 = 1.0/t71; + // T t82 = 1.0/t72; + // T t83 = 1.0/t73; + // T t84 = 1.0/t74; + // T t85 = 1.0/t75; + // T t86 = 1.0/t76; + // T t52 = t47*udg1; + // T t53 = t48*udg2; + // T t54 = t49*udg3; + // T t55 = t50*udg4; + // T t56 = t51*udg5; + // T t92 = t14*t17*t77; + // T t93 = t14*t18*t78; + // T t94 = t14*t19*t79; + // T t95 = t14*t20*t80; + // T t96 = t14*t21*t81; + // T t97 = t14*t22*t82; + // T t98 = t14*t23*t83; + // T t99 = t14*t24*t84; + // T t100 = t14*t25*t85; + // T t101 = t14*t26*t86; + // T t87 = t52+3.182454300088011E-13; + // T t88 = t53+3.182454300088011E-13; + // T t89 = t54+3.182454300088011E-13; + // T t90 = t55+3.182454300088011E-13; + // T t91 = t56+3.182454300088011E-13; + // T t102 = t47+t92; + // T t103 = t48+t93; + // T t104 = t49+t94; + // T t105 = t50+t95; + // T t106 = t51+t96; + // T t107 = t42+t97+1.0/2.0; + // T t108 = t43+t98+1.0/2.0; + // T t109 = t44+t99+1.0/2.0; + // T t110 = t45+t100+1.0/2.0; + // T t111 = t46+t101+1.0/2.0; + // T t122 = t52+t53+t54+t55+t56+1.591227150044006E-12; + // T t112 = t102*udg9; + // T t113 = t103*udg10; + // T t114 = t104*udg11; + // T t115 = t105*udg12; + // T t116 = t106*udg13; + // T t117 = t107*udg17; + // T t118 = t108*udg18; + // T t119 = t109*udg19; + // T t120 = t110*udg20; + // T t121 = t111*udg21; + // T t123 = 1.0/t122; + // T t124 = t123*t123; + // T t125 = t123*udg8; + // T t126 = t123*uinf1; + // T t127 = t123*udg6*udg7; + // T t130 = t112*t122; + // T t131 = t113*t122; + // T t132 = t114*t122; + // T t133 = t115*t122; + // T t134 = t116*t122; + // T t135 = t117*t122; + // T t136 = t118*t122; + // T t137 = t119*t122; + // T t138 = t120*t122; + // T t139 = t121*t122; + // T t152 = t112+t113+t114+t115+t116; + // T t153 = t117+t118+t119+t120+t121; + // T t128 = (t7*t124)/2.0; + // T t129 = (t8*t124)/2.0; + // T t140 = -t130; + // T t141 = -t131; + // T t142 = -t132; + // T t143 = -t133; + // T t144 = -t134; + // T t145 = -t135; + // T t146 = -t136; + // T t147 = -t137; + // T t148 = -t138; + // T t149 = -t139; + // T t150 = t125+t126; + // T t154 = t87*t152; + // T t155 = t88*t152; + // T t156 = t89*t152; + // T t157 = t90*t152; + // T t158 = t91*t152; + // T t159 = t87*t153; + // T t160 = t88*t153; + // T t161 = t89*t153; + // T t162 = t90*t153; + // T t163 = t91*t153; + // T t164 = t123*t152*udg6; + // T t165 = t123*t152*udg7; + // T t166 = t123*t153*udg6; + // T t167 = t123*t153*udg7; + // T t151 = t128+t129; + // T t168 = -t164; + // T t169 = -t165; + // T t170 = -t166; + // T t171 = -t167; + // T t176 = t140+t154; + // T t177 = t141+t155; + // T t178 = t142+t156; + // T t179 = t143+t157; + // T t180 = t144+t158; + // T t181 = t145+t159; + // T t182 = t146+t160; + // T t183 = t147+t161; + // T t184 = t148+t162; + // T t185 = t149+t163; + // T t186 = -t123*(t164-udg14); + // T t187 = -t123*(t165-udg15); + // T t188 = -t123*(t166-udg22); + // T t189 = -t123*(t167-udg23); + // T t190 = t123*(t164-udg14)*-2.0; + // T t191 = t123*(t167-udg23)*-2.0; + // T t192 = t123*(t167-udg23); + // T t194 = -t123*uinf2*(t130-t154); + // T t195 = -t124*uinf2*(t130-t154); + // T t196 = -t123*uinf3*(t131-t155); + // T t197 = -t124*uinf3*(t131-t155); + // T t198 = -t123*uinf4*(t132-t156); + // T t199 = -t124*uinf4*(t132-t156); + // T t200 = -t123*uinf5*(t133-t157); + // T t201 = -t124*uinf5*(t133-t157); + // T t202 = -t123*uinf6*(t134-t158); + // T t203 = -t124*uinf6*(t134-t158); + // T t204 = -t123*uinf2*(t135-t159); + // T t205 = -t124*uinf2*(t135-t159); + // T t206 = -t123*uinf3*(t136-t160); + // T t207 = -t124*uinf3*(t136-t160); + // T t208 = -t123*uinf4*(t137-t161); + // T t209 = -t124*uinf4*(t137-t161); + // T t210 = -t123*uinf5*(t138-t162); + // T t211 = -t124*uinf5*(t138-t162); + // T t212 = -t123*uinf6*(t139-t163); + // T t213 = -t124*uinf6*(t139-t163); + // T t214 = t123*uinf2*(t130-t154); + // T t215 = t123*uinf3*(t131-t155); + // T t216 = t123*uinf4*(t132-t156); + // T t217 = t123*uinf5*(t133-t157); + // T t218 = t123*uinf6*(t134-t158); + // T t219 = t123*uinf2*(t135-t159); + // T t220 = t123*uinf3*(t136-t160); + // T t221 = t123*uinf4*(t137-t161); + // T t222 = t123*uinf5*(t138-t162); + // T t223 = t123*uinf6*(t139-t163); + // T t227 = -t16*uinf12*(t123*(t165-udg15)+t123*(t166-udg22)); + // T t230 = -t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t231 = -t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t232 = -t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t233 = -t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t234 = -t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)); + // T t235 = -t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t236 = -t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t237 = -t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t238 = -t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t239 = -t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)); + // T t172 = t168+udg14; + // T t173 = t169+udg15; + // T t174 = t170+udg22; + // T t175 = t171+udg23; + // T t193 = t192*2.0; + // T t224 = t187+t188; + // T t226 = t190+t192; + // T t228 = t195+t197+t199+t201+t203; + // T t229 = t205+t207+t209+t211+t213; + // f[0*ng+i] = t214+t230+odg1*t112+t87*t123*udg6; + // f[1*ng+i] = t215+t231+odg1*t113+t88*t123*udg6; + // f[2*ng+i] = t216+t232+odg1*t114+t89*t123*udg6; + // f[3*ng+i] = t217+t233+odg1*t115+t90*t123*udg6; + // f[4*ng+i] = t218+t234+odg1*t116+t91*t123*udg6; + // f[5*ng+i] = uinf1+odg1*udg14+t7*t123-t16*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); + // f[6*ng+i] = t127+t227+odg1*udg15; + // f[7*ng+i] = odg1*udg16+t150*udg6-uinf7*(t194+t87*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf8*(t196+t88*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf9*(t198+t89*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf10*(t200+t90*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))-uinf11*(t202+t91*(t124*uinf2*(t130-t154)+t124*uinf3*(t131-t155)+t124*uinf4*(t132-t156)+t124*uinf5*(t133-t157)+t124*uinf6*(t134-t158)))+t123*t227*udg7+t15*t16*uinf13*(uinf19*(udg16+t122*(t124*udg6*(t164-udg14)+t124*udg7*(t165-udg15))-t151*t152)+t112*uinf14+t113*uinf15+t114*uinf16+t115*uinf17+t116*uinf18)-t16*t123*udg6*uinf12*(t189+t123*(t164-udg14)*2.0)*(2.0/3.0); + // f[8*ng+i] = t219+t235+odg1*t117+t87*t123*udg7; + // f[9*ng+i] = t220+t236+odg1*t118+t88*t123*udg7; + // f[10*ng+i] = t221+t237+odg1*t119+t89*t123*udg7; + // f[11*ng+i] = t222+t238+odg1*t120+t90*t123*udg7; + // f[12*ng+i] = t223+t239+odg1*t121+t91*t123*udg7; + // f[13*ng+i] = t127+t227+odg1*udg22; + // f[14*ng+i] = uinf1+odg1*udg23+t8*t123+t16*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); + // f[15*ng+i] = odg1*udg24+t150*udg7-uinf7*(t204+t87*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf8*(t206+t88*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf9*(t208+t89*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf10*(t210+t90*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))-uinf11*(t212+t91*(t124*uinf2*(t135-t159)+t124*uinf3*(t136-t160)+t124*uinf4*(t137-t161)+t124*uinf5*(t138-t162)+t124*uinf6*(t139-t163)))+t123*t227*udg6+t15*t16*uinf13*(uinf19*(udg24+t122*(t124*udg6*(t166-udg22)+t124*udg7*(t167-udg23))-t151*t153)+t117*uinf14+t118*uinf15+t119*uinf16+t120*uinf17+t121*uinf18)+t16*t123*udg7*uinf12*(t191+t123*(t164-udg14))*(2.0/3.0); } // std::cout << "END FLUX" << std::endl; diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP.cpp new file mode 100644 index 00000000..ba47dda0 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP.cpp @@ -0,0 +1,350 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = 1e-4; // D_1 + uinf3 = 1e-4; // D_2 + uinf4 = 1e-4; // D_3 + uinf5 = 1e-4; // D_4 + uinf6 = 1e-4; // D_5 + // uinf7 = 0.0; // h_1 + // uinf8 = 0.0; // h_2 + // uinf9 = 0.0; // h_3 + // uinf10 = 0.0; // h_4 + // uinf11 = 0.0; // h_5 + uinf12 = 0.0; // mu + uinf13 = 0.0; // kappa + // uinf2 = D_i[0]; // D_1 + // uinf3 = D_i[1]; // D_2 + // uinf4 = D_i[2]; // D_3 + // uinf5 = D_i[3]; // D_4 + // uinf6 = D_i[4]; // D_5 + uinf7 = h_i[0]; // h_1 + uinf8 = h_i[1]; // h_2 + uinf9 = h_i[2]; // h_3 + uinf10 = h_i[3]; // h_4 + uinf11 = h_i[4]; // h_5 + // uinf12 = mix->viscosity() / mu_scale; // mu + // uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + // uinf14 = 0.0; + // uinf15 = 0.0; + // uinf16 = 0.0; + // uinf17 = 0.0; + // uinf18 = 0.0; + // uinf19 = 0.0; + + T t2 = odg2+uinf13; + T t3 = udg1*udg1; + T t4 = udg2*udg2; + T t5 = udg3*udg3; + T t6 = udg4*udg4; + T t7 = udg5*udg5; + T t8 = udg6*udg6; + T t9 = udg7*udg7; + T t10 = 1.0/3.141592653589793; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t13 = udg1*1.0E+12; + T t14 = udg2*1.0E+12; + T t15 = udg3*1.0E+12; + T t16 = udg4*1.0E+12; + T t17 = udg5*1.0E+12; + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t38 = t3*1.0E+24; + T t39 = t4*1.0E+24; + T t40 = t5*1.0E+24; + T t41 = t6*1.0E+24; + T t42 = t7*1.0E+24; + T t23 = t10*t18; + T t24 = t10*t19; + T t25 = t10*t20; + T t26 = t10*t21; + T t27 = t10*t22; + T t43 = t38+1.0; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t48 = 1.0/t43; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t33 = t28*udg1; + T t34 = t29*udg2; + T t35 = t30*udg3; + T t36 = t31*udg4; + T t37 = t32*udg5; + T t58 = t10*t13*t48; + T t59 = t10*t14*t49; + T t60 = t10*t15*t50; + T t61 = t10*t16*t51; + T t62 = t10*t17*t52; + T t53 = t33+3.182454300088011E-13; + T t54 = t34+3.182454300088011E-13; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t63 = t28+t58; + T t64 = t29+t59; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t78 = t33+t34+t35+t36+t37+1.591227150044006E-12; + T t68 = t63*udg9; + T t69 = t64*udg10; + T t70 = t65*udg11; + T t71 = t63*udg17; + T t72 = t66*udg12; + T t73 = t64*udg18; + T t74 = t67*udg13; + T t75 = t65*udg19; + T t76 = t66*udg20; + T t77 = t67*udg21; + T t79 = 1.0/t78; + T t80 = t79*t79; + T t81 = t79*udg8; + T t82 = t79*uinf1; + T t83 = t79*udg6*udg7; + T t86 = t68*t78; + T t87 = t69*t78; + T t88 = t70*t78; + T t89 = t71*t78; + T t90 = t72*t78; + T t91 = t73*t78; + T t92 = t74*t78; + T t93 = t75*t78; + T t94 = t76*t78; + T t95 = t77*t78; + T t108 = t68+t69+t70+t72+t74; + T t109 = t71+t73+t75+t76+t77; + T t84 = (t8*t80)/2.0; + T t85 = (t9*t80)/2.0; + T t96 = -t86; + T t97 = -t87; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = t81+t82; + T t110 = t53*t108; + T t111 = t54*t108; + T t112 = t55*t108; + T t113 = t56*t108; + T t114 = t57*t108; + T t115 = t53*t109; + T t116 = t54*t109; + T t117 = t55*t109; + T t118 = t56*t109; + T t119 = t57*t109; + T t120 = t79*t108*udg6; + T t121 = t79*t108*udg7; + T t122 = t79*t109*udg6; + T t123 = t79*t109*udg7; + T t107 = t84+t85; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t127 = -t123; + T t132 = t96+t110; + T t133 = t97+t111; + T t134 = t98+t112; + T t135 = t100+t113; + T t136 = t102+t114; + T t137 = t99+t115; + T t138 = t101+t116; + T t139 = t103+t117; + T t140 = t104+t118; + T t141 = t105+t119; + T t142 = -t79*(t120-udg14); + T t143 = -t79*(t121-udg15); + T t144 = -t79*(t122-udg22); + T t145 = -t79*(t123-udg23); + T t146 = t79*(t120-udg14)*-2.0; + T t147 = t79*(t123-udg23)*-2.0; + T t148 = t79*(t123-udg23); + T t150 = -t79*uinf2*(t86-t110); + T t151 = -t80*uinf2*(t86-t110); + T t152 = -t79*uinf3*(t87-t111); + T t153 = -t80*uinf3*(t87-t111); + T t154 = -t79*uinf4*(t88-t112); + T t155 = -t80*uinf4*(t88-t112); + T t156 = -t79*uinf5*(t90-t113); + T t157 = -t80*uinf5*(t90-t113); + T t158 = -t79*uinf6*(t92-t114); + T t159 = -t80*uinf6*(t92-t114); + T t160 = -t79*uinf2*(t89-t115); + T t161 = -t80*uinf2*(t89-t115); + T t162 = -t79*uinf3*(t91-t116); + T t163 = -t80*uinf3*(t91-t116); + T t164 = -t79*uinf4*(t93-t117); + T t165 = -t80*uinf4*(t93-t117); + T t166 = -t79*uinf5*(t94-t118); + T t167 = -t80*uinf5*(t94-t118); + T t168 = -t79*uinf6*(t95-t119); + T t169 = -t80*uinf6*(t95-t119); + T t170 = t79*uinf2*(t86-t110); + T t171 = t79*uinf3*(t87-t111); + T t172 = t79*uinf4*(t88-t112); + T t173 = t79*uinf5*(t90-t113); + T t174 = t79*uinf6*(t92-t114); + T t175 = t79*uinf2*(t89-t115); + T t176 = t79*uinf3*(t91-t116); + T t177 = t79*uinf4*(t93-t117); + T t178 = t79*uinf5*(t94-t118); + T t179 = t79*uinf6*(t95-t119); + T t185 = -t12*uinf12*(t79*(t121-udg15)+t79*(t122-udg22)); + T t192 = -t53*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t193 = -t54*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t194 = -t55*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t195 = -t56*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t196 = -t57*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)); + T t197 = -t53*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t198 = -t54*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t199 = -t55*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t200 = -t56*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t201 = -t57*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)); + T t128 = t124+udg14; + T t129 = t125+udg15; + T t130 = t126+udg22; + T t131 = t127+udg23; + T t149 = t148*2.0; + T t180 = t142+t145; + T t181 = t143+t144; + T t182 = -odg1*(t148+t79*(t120-udg14)); + T t184 = t146+t148; + T t186 = t12*uinf12*(t147+t79*(t120-udg14))*(-2.0/3.0); + T t187 = t12*uinf12*(t147+t79*(t120-udg14))*(2.0/3.0); + T t188 = t12*uinf12*(t145+t79*(t120-udg14)*2.0)*(-2.0/3.0); + T t189 = t83+t185; + T t190 = t151+t153+t155+t157+t159; + T t191 = t161+t163+t165+t167+t169; + T t183 = t142+t149; + f[0*ng+i] = t170+t192+t53*t79*udg6; + f[1*ng+i] = t171+t193+t54*t79*udg6; + f[2*ng+i] = t172+t194+t55*t79*udg6; + f[3*ng+i] = t173+t195+t56*t79*udg6; + f[4*ng+i] = t174+t196+t57*t79*udg6; + f[5*ng+i] = t182+t188+uinf1+t8*t79; + f[6*ng+i] = t189; + f[7*ng+i] = t106*udg6-uinf7*(t150+t53*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))-uinf8*(t152+t54*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))-uinf9*(t154+t55*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))-uinf10*(t156+t56*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))-uinf11*(t158+t57*(t80*uinf2*(t86-t110)+t80*uinf3*(t87-t111)+t80*uinf4*(t88-t112)+t80*uinf5*(t90-t113)+t80*uinf6*(t92-t114)))-t79*udg6*(odg1*(t148+t79*(t120-udg14))+t12*uinf12*(t145+t79*(t120-udg14)*2.0)*(2.0/3.0))+t79*t185*udg7+t2*t11*t12*(uinf19*(udg16+t78*(t80*udg6*(t120-udg14)+t80*udg7*(t121-udg15))-t107*t108)+t68*uinf14+t69*uinf15+t70*uinf16+t72*uinf17+t74*uinf18); + f[8*ng+i] = t175+t197+t53*t79*udg7; + f[9*ng+i] = t176+t198+t54*t79*udg7; + f[10*ng+i] = t177+t199+t55*t79*udg7; + f[11*ng+i] = t178+t200+t56*t79*udg7; + f[12*ng+i] = t179+t201+t57*t79*udg7; + f[13*ng+i] = t189; + f[14*ng+i] = t182+t187+uinf1+t9*t79; + f[15*ng+i] = t106*udg7-uinf7*(t160+t53*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))-uinf8*(t162+t54*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))-uinf9*(t164+t55*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))-uinf10*(t166+t56*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))-uinf11*(t168+t57*(t80*uinf2*(t89-t115)+t80*uinf3*(t91-t116)+t80*uinf4*(t93-t117)+t80*uinf5*(t94-t118)+t80*uinf6*(t95-t119)))-t79*udg7*(t186+odg1*(t148+t79*(t120-udg14)))+t79*t185*udg6+t2*t11*t12*(uinf19*(udg24+t78*(t80*udg6*(t122-udg22)+t80*udg7*(t123-udg23))-t107*t109)+t71*uinf14+t73*uinf15+t75*uinf16+t76*uinf17+t77*uinf18); + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2.cpp new file mode 100644 index 00000000..4303705d --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2.cpp @@ -0,0 +1,331 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = 0.0; uinf3 = 0.0; uinf4 = 0.0; uinf5 = 0.0; uinf6 = 0.0; + // uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = 0.0; uinf8 = 0.0; uinf9 = 0.0; uinf10 = 0.0; uinf11 = 0.0; + // uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = 0.0; uinf13 = 0.0; // kappa + // uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = odg1*param21*uinf20; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t13 = t11*t12*uinf13; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t40 = t2*1.0E+24; + T t41 = t3*1.0E+24; + T t42 = t4*1.0E+24; + T t43 = t5*1.0E+24; + T t44 = t6*1.0E+24; + T t14 = t10+t13; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t29 = t9*t24; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t49 = t44+1.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t54 = 1.0/t49; + T t35 = t30*udg1; + T t36 = t31*udg2; + T t37 = t32*udg3; + T t38 = t33*udg4; + T t39 = t34*udg5; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t62 = t9*t17*t52; + T t63 = t9*t18*t53; + T t64 = t9*t19*t54; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t58 = t38+3.182454300088011E-13; + T t59 = t39+3.182454300088011E-13; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t68 = t33+t63; + T t69 = t34+t64; + T t80 = t35+t36+t37+t38+t39+1.591227150044006E-12; + T t70 = t65*udg9; + T t71 = t66*udg10; + T t72 = t67*udg11; + T t73 = t65*udg17; + T t74 = t68*udg12; + T t75 = t66*udg18; + T t76 = t69*udg13; + T t77 = t67*udg19; + T t78 = t68*udg20; + T t79 = t69*udg21; + T t81 = 1.0/t80; + T t82 = t81*t81; + T t83 = t81*udg8; + T t84 = t81*uinf1; + T t85 = t81*udg6*udg7; + T t88 = t70*t80; + T t89 = t71*t80; + T t90 = t72*t80; + T t91 = t73*t80; + T t92 = t74*t80; + T t93 = t75*t80; + T t94 = t76*t80; + T t95 = t77*t80; + T t96 = t78*t80; + T t97 = t79*t80; + T t110 = t70+t71+t72+t74+t76; + T t111 = t73+t75+t77+t78+t79; + T t86 = (t7*t82)/2.0; + T t87 = (t8*t82)/2.0; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = t83+t84; + T t112 = t55*t110; + T t113 = t56*t110; + T t114 = t57*t110; + T t115 = t58*t110; + T t116 = t59*t110; + T t117 = t55*t111; + T t118 = t56*t111; + T t119 = t57*t111; + T t120 = t58*t111; + T t121 = t59*t111; + T t122 = t81*t110*udg6; + T t123 = t81*t110*udg7; + T t124 = t81*t111*udg6; + T t125 = t81*t111*udg7; + T t109 = t86+t87; + T t126 = -t122; + T t127 = -t123; + T t128 = -t124; + T t129 = -t125; + T t134 = t98+t112; + T t135 = t99+t113; + T t136 = t100+t114; + T t137 = t102+t115; + T t138 = t104+t116; + T t139 = t101+t117; + T t140 = t103+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t107+t121; + T t144 = -t81*(t122-udg14); + T t145 = -t81*(t123-udg15); + T t146 = -t81*(t124-udg22); + T t147 = -t81*(t125-udg23); + T t148 = t81*(t122-udg14)*-2.0; + T t149 = t81*(t125-udg23)*-2.0; + T t150 = t81*(t125-udg23); + T t152 = -t81*uinf2*(t88-t112); + T t153 = -t82*uinf2*(t88-t112); + T t154 = -t81*uinf3*(t89-t113); + T t155 = -t82*uinf3*(t89-t113); + T t156 = -t81*uinf4*(t90-t114); + T t157 = -t82*uinf4*(t90-t114); + T t158 = -t81*uinf5*(t92-t115); + T t159 = -t82*uinf5*(t92-t115); + T t160 = -t81*uinf6*(t94-t116); + T t161 = -t82*uinf6*(t94-t116); + T t162 = -t81*uinf2*(t91-t117); + T t163 = -t82*uinf2*(t91-t117); + T t164 = -t81*uinf3*(t93-t118); + T t165 = -t82*uinf3*(t93-t118); + T t166 = -t81*uinf4*(t95-t119); + T t167 = -t82*uinf4*(t95-t119); + T t168 = -t81*uinf5*(t96-t120); + T t169 = -t82*uinf5*(t96-t120); + T t170 = -t81*uinf6*(t97-t121); + T t171 = -t82*uinf6*(t97-t121); + T t172 = t81*uinf2*(t88-t112); + T t173 = t81*uinf3*(t89-t113); + T t174 = t81*uinf4*(t90-t114); + T t175 = t81*uinf5*(t92-t115); + T t176 = t81*uinf6*(t94-t116); + T t177 = t81*uinf2*(t91-t117); + T t178 = t81*uinf3*(t93-t118); + T t179 = t81*uinf4*(t95-t119); + T t180 = t81*uinf5*(t96-t120); + T t181 = t81*uinf6*(t97-t121); + T t187 = -t12*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)); + T t194 = -t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t195 = -t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t196 = -t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t197 = -t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t198 = -t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t199 = -t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t200 = -t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t201 = -t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t202 = -t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t203 = -t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t130 = t126+udg14; + T t131 = t127+udg15; + T t132 = t128+udg22; + T t133 = t129+udg23; + T t151 = t150*2.0; + T t182 = t144+t147; + T t183 = t145+t146; + T t184 = -odg1*(t150+t81*(t122-udg14)); + T t186 = t148+t150; + T t188 = t12*uinf12*(t149+t81*(t122-udg14))*(-2.0/3.0); + T t189 = t12*uinf12*(t149+t81*(t122-udg14))*(2.0/3.0); + T t190 = t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(-2.0/3.0); + T t191 = t85+t187; + T t192 = t153+t155+t157+t159+t161; + T t193 = t163+t165+t167+t169+t171; + T t185 = t144+t151; + f[0*ng+i] = t172+t194+t55*t81*udg6; + f[1*ng+i] = t173+t195+t56*t81*udg6; + f[2*ng+i] = t174+t196+t57*t81*udg6; + f[3*ng+i] = t175+t197+t58*t81*udg6; + f[4*ng+i] = t176+t198+t59*t81*udg6; + f[5*ng+i] = t184+t190+uinf1+t7*t81; + f[6*ng+i] = t191; + f[7*ng+i] = t108*udg6-uinf7*(t152+t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf8*(t154+t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf9*(t156+t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf10*(t158+t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf11*(t160+t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+t14*(uinf19*(udg16+t80*(t82*udg6*(t122-udg14)+t82*udg7*(t123-udg15))-t109*t110)+t70*uinf14+t71*uinf15+t72*uinf16+t74*uinf17+t76*uinf18)-t81*udg6*(odg1*(t150+t81*(t122-udg14))+t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(2.0/3.0))+t81*t187*udg7; + f[8*ng+i] = t177+t199+t55*t81*udg7; + f[9*ng+i] = t178+t200+t56*t81*udg7; + f[10*ng+i] = t179+t201+t57*t81*udg7; + f[11*ng+i] = t180+t202+t58*t81*udg7; + f[12*ng+i] = t181+t203+t59*t81*udg7; + f[13*ng+i] = t191; + f[14*ng+i] = t184+t189+uinf1+t8*t81; + f[15*ng+i] = t108*udg7-uinf7*(t162+t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf8*(t164+t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf9*(t166+t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf10*(t168+t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf11*(t170+t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+t14*(uinf19*(udg24+t80*(t82*udg6*(t124-udg22)+t82*udg7*(t125-udg23))-t109*t111)+t73*uinf14+t75*uinf15+t77*uinf16+t78*uinf17+t79*uinf18)-t81*udg7*(t188+odg1*(t150+t81*(t122-udg14)))+t81*t187*udg6; + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2_manual.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2_manual.cpp new file mode 100644 index 00000000..94087f3a --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFlux_2d_PB_MPP_2_manual.cpp @@ -0,0 +1,380 @@ +template void opuFluxKernel(int i, T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + T param1 = param[0]; + T param2 = param[1]; + T param19 = param[18]; + T param20 = param[19]; + T param21 = param[20]; + T uinf1 = uinf[0]; + T uinf2 = uinf[1]; + T uinf3 = uinf[2]; + T uinf4 = uinf[3]; + T uinf5 = uinf[4]; + T uinf6 = uinf[5]; + T uinf7 = uinf[6]; + T uinf8 = uinf[7]; + T uinf9 = uinf[8]; + T uinf10 = uinf[9]; + T uinf11 = uinf[10]; + T uinf12 = uinf[11]; + T uinf13 = uinf[12]; + T uinf14 = uinf[13]; + T uinf15 = uinf[14]; + T uinf16 = uinf[15]; + T uinf17 = uinf[16]; + T uinf18 = uinf[17]; + T uinf19 = uinf[18]; + T uinf20 = uinf[19]; + T udg1 = udg[0]; + T udg2 = udg[1]; + T udg3 = udg[2]; + T udg4 = udg[3]; + T udg5 = udg[4]; + T udg6 = udg[5]; + T udg7 = udg[6]; + T udg8 = udg[7]; + T udg9 = udg[8]; + T udg10 = udg[9]; + T udg11 = udg[10]; + T udg12 = udg[11]; + T udg13 = udg[12]; + T udg14 = udg[13]; + T udg15 = udg[14]; + T udg16 = udg[15]; + T udg17 = udg[16]; + T udg18 = udg[17]; + T udg19 = udg[18]; + T udg20 = udg[19]; + T udg21 = udg[20]; + T udg22 = udg[21]; + T udg23 = udg[22]; + T udg24 = udg[23]; + T odg1 = odg[0*ng+i]; + + T t1pi = 1.0/3.141592653589793; + + udg1 = udg1*(t1pi*atan(udg1*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg2 = udg2*(t1pi*atan(udg2*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg3 = udg3*(t1pi*atan(udg3*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg4 = udg4*(t1pi*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg5 = udg5*(t1pi*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + + double Ucons[8] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7, udg8}; + dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, ndim); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, ndim); + double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; + double rhoe = Ustate[nspecies]; + + mix->setState(rhovec, &rhoe, 0); + + // mix->averageDiffusionCoeffs(D_i); + // nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = 0.0; uinf3 = 0.0; uinf4 = 0.0; uinf5 = 0.0; uinf6 = 0.0; + // uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = 0.0; uinf8 = 0.0; uinf9 = 0.0; uinf10 = 0.0; uinf11 = 0.0; + // uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = 0.0; uinf13 = 0.0; // kappa + // uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = odg1*param21*uinf20; + T t11 = 1.0/param19; + T t12 = 1.0/param20; + T t15 = udg1*1.0E+12; + T t16 = udg2*1.0E+12; + T t17 = udg3*1.0E+12; + T t18 = udg4*1.0E+12; + T t19 = udg5*1.0E+12; + T t13 = t11*t12*uinf13; + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t24 = atan(t19); + T t40 = t2*1.0E+24; + T t41 = t3*1.0E+24; + T t42 = t4*1.0E+24; + T t43 = t5*1.0E+24; + T t44 = t6*1.0E+24; + T t14 = t10+t13; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t29 = t9*t24; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t49 = t44+1.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t34 = t29+1.0/2.0; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t54 = 1.0/t49; + T t35 = t30*udg1; + T t36 = t31*udg2; + T t37 = t32*udg3; + T t38 = t33*udg4; + T t39 = t34*udg5; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t62 = t9*t17*t52; + T t63 = t9*t18*t53; + T t64 = t9*t19*t54; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t57 = t37+3.182454300088011E-13; + T t58 = t38+3.182454300088011E-13; + T t59 = t39+3.182454300088011E-13; + T t65 = t30+t60; + T t66 = t31+t61; + T t67 = t32+t62; + T t68 = t33+t63; + T t69 = t34+t64; + T t80 = t35+t36+t37+t38+t39+1.591227150044006E-12; + T t70 = t65*udg9; + T t71 = t66*udg10; + T t72 = t67*udg11; + T t73 = t65*udg17; + T t74 = t68*udg12; + T t75 = t66*udg18; + T t76 = t69*udg13; + T t77 = t67*udg19; + T t78 = t68*udg20; + T t79 = t69*udg21; + T t81 = 1.0/t80; + T t82 = t81*t81; + T t83 = t81*udg8; + T t84 = t81*uinf1; + T t85 = t81*udg6*udg7; + T t88 = t70*t80; + T t89 = t71*t80; + T t90 = t72*t80; + T t91 = t73*t80; + T t92 = t74*t80; + T t93 = t75*t80; + T t94 = t76*t80; + T t95 = t77*t80; + T t96 = t78*t80; + T t97 = t79*t80; + T t110 = t70+t71+t72+t74+t76; + T t111 = t73+t75+t77+t78+t79; + T t86 = (t7*t82)/2.0; + T t87 = (t8*t82)/2.0; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = t83+t84; + T t112 = t55*t110; + T t113 = t56*t110; + T t114 = t57*t110; + T t115 = t58*t110; + T t116 = t59*t110; + T t117 = t55*t111; + T t118 = t56*t111; + T t119 = t57*t111; + T t120 = t58*t111; + T t121 = t59*t111; + T t122 = t81*t110*udg6; + T t123 = t81*t110*udg7; + T t124 = t81*t111*udg6; + T t125 = t81*t111*udg7; + T t109 = t86+t87; + T t126 = -t122; + T t127 = -t123; + T t128 = -t124; + T t129 = -t125; + T t134 = t98+t112; + T t135 = t99+t113; + T t136 = t100+t114; + T t137 = t102+t115; + T t138 = t104+t116; + T t139 = t101+t117; + T t140 = t103+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t107+t121; + T t144 = -t81*(t122-udg14); + T t145 = -t81*(t123-udg15); + T t146 = -t81*(t124-udg22); + T t147 = -t81*(t125-udg23); + T t148 = t81*(t122-udg14)*-2.0; + T t149 = t81*(t125-udg23)*-2.0; + T t150 = t81*(t125-udg23); + T t152 = -t81*uinf2*(t88-t112); + T t153 = -t82*uinf2*(t88-t112); + T t154 = -t81*uinf3*(t89-t113); + T t155 = -t82*uinf3*(t89-t113); + T t156 = -t81*uinf4*(t90-t114); + T t157 = -t82*uinf4*(t90-t114); + T t158 = -t81*uinf5*(t92-t115); + T t159 = -t82*uinf5*(t92-t115); + T t160 = -t81*uinf6*(t94-t116); + T t161 = -t82*uinf6*(t94-t116); + T t162 = -t81*uinf2*(t91-t117); + T t163 = -t82*uinf2*(t91-t117); + T t164 = -t81*uinf3*(t93-t118); + T t165 = -t82*uinf3*(t93-t118); + T t166 = -t81*uinf4*(t95-t119); + T t167 = -t82*uinf4*(t95-t119); + T t168 = -t81*uinf5*(t96-t120); + T t169 = -t82*uinf5*(t96-t120); + T t170 = -t81*uinf6*(t97-t121); + T t171 = -t82*uinf6*(t97-t121); + T t172 = t81*uinf2*(t88-t112); + T t173 = t81*uinf3*(t89-t113); + T t174 = t81*uinf4*(t90-t114); + T t175 = t81*uinf5*(t92-t115); + T t176 = t81*uinf6*(t94-t116); + T t177 = t81*uinf2*(t91-t117); + T t178 = t81*uinf3*(t93-t118); + T t179 = t81*uinf4*(t95-t119); + T t180 = t81*uinf5*(t96-t120); + T t181 = t81*uinf6*(t97-t121); + T t187 = -t12*uinf12*(t81*(t123-udg15)+t81*(t124-udg22)); + T t194 = -t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t195 = -t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t196 = -t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t197 = -t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t198 = -t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)); + T t199 = -t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t200 = -t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t201 = -t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t202 = -t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t203 = -t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)); + T t130 = t126+udg14; + T t131 = t127+udg15; + T t132 = t128+udg22; + T t133 = t129+udg23; + T t151 = t150*2.0; + T t182 = t144+t147; + T t183 = t145+t146; + T t184 = -odg1*(t150+t81*(t122-udg14)); + T t186 = t148+t150; + T t188 = t12*uinf12*(t149+t81*(t122-udg14))*(-2.0/3.0); + T t189 = t12*uinf12*(t149+t81*(t122-udg14))*(2.0/3.0); + T t190 = t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(-2.0/3.0); + T t191 = t85+t187; + T t192 = t153+t155+t157+t159+t161; + T t193 = t163+t165+t167+t169+t171; + T t185 = t144+t151; + f[0] = t172+t194+t55*t81*udg6; + f[1] = t173+t195+t56*t81*udg6; + f[2] = t174+t196+t57*t81*udg6; + f[3] = t175+t197+t58*t81*udg6; + f[4] = t176+t198+t59*t81*udg6; + f[5] = t184+t190+uinf1+t7*t81; + f[6] = t191; + f[7] = t108*udg6-uinf7*(t152+t55*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf8*(t154+t56*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf9*(t156+t57*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf10*(t158+t58*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))-uinf11*(t160+t59*(t82*uinf2*(t88-t112)+t82*uinf3*(t89-t113)+t82*uinf4*(t90-t114)+t82*uinf5*(t92-t115)+t82*uinf6*(t94-t116)))+t14*(uinf19*(udg16+t80*(t82*udg6*(t122-udg14)+t82*udg7*(t123-udg15))-t109*t110)+t70*uinf14+t71*uinf15+t72*uinf16+t74*uinf17+t76*uinf18)-t81*udg6*(odg1*(t150+t81*(t122-udg14))+t12*uinf12*(t147+t81*(t122-udg14)*2.0)*(2.0/3.0))+t81*t187*udg7; + f[8] = t177+t199+t55*t81*udg7; + f[9] = t178+t200+t56*t81*udg7; + f[10] = t179+t201+t57*t81*udg7; + f[11] = t180+t202+t58*t81*udg7; + f[12] = t181+t203+t59*t81*udg7; + f[13] = t191; + f[14] = t184+t189+uinf1+t8*t81; + f[15] = t108*udg7-uinf7*(t162+t55*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf8*(t164+t56*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf9*(t166+t57*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf10*(t168+t58*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))-uinf11*(t170+t59*(t82*uinf2*(t91-t117)+t82*uinf3*(t93-t118)+t82*uinf4*(t95-t119)+t82*uinf5*(t96-t120)+t82*uinf6*(t97-t121)))+t14*(uinf19*(udg24+t80*(t82*udg6*(t124-udg22)+t82*udg7*(t125-udg23))-t109*t111)+t73*uinf14+t75*uinf15+t77*uinf16+t78*uinf17+t79*uinf18)-t81*udg7*(t188+odg1*(t150+t81*(t122-udg14)))+t81*t187*udg6; +} + +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + T ftmp[16]; + T utmp[24]; + for (int i = 0; i void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + // uinf2 = 0.0; // D_1 + // uinf3 = 0.0; // D_2 + // uinf4 = 0.0; // D_3 + // uinf5 = 0.0; // D_4 + // uinf6 = 0.0; // D_5 + // uinf7 = 0.0; // h_1 + // uinf8 = 0.0; // h_2 + // uinf9 = 0.0; // h_3 + // uinf10 = 0.0; // h_4 + // uinf11 = 0.0; // h_5 + // uinf12 = 0.0; // mu + // uinf13 = 0.0; // kappa + uinf2 = D_i[0]; // D_1 + uinf3 = D_i[1]; // D_2 + uinf4 = D_i[2]; // D_3 + uinf5 = D_i[3]; // D_4 + uinf6 = D_i[4]; // D_5 + uinf7 = h_i[0]; // h_1 + uinf8 = h_i[1]; // h_2 + uinf9 = h_i[2]; // h_3 + uinf10 = h_i[3]; // h_4 + uinf11 = h_i[4]; // h_5 + uinf12 = mix->viscosity() / mu_scale; // mu + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; + uinf15 = dTdU[1]; + uinf16 = dTdU[2]; + uinf17 = dTdU[3]; + uinf18 = dTdU[4]; + uinf19 = dTdU[5]; + // uinf14 = 0.0; + // uinf15 = 0.0; + // uinf16 = 0.0; + // uinf17 = 0.0; + // uinf18 = 0.0; + // uinf19 = 0.0; + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = udg6*udg6; + T t8 = udg7*udg7; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param19; + T t11 = 1.0/param20; + T t12 = udg1*1.0E+12; + T t13 = udg2*1.0E+12; + T t14 = udg3*1.0E+12; + T t15 = udg4*1.0E+12; + T t16 = udg5*1.0E+12; + T t17 = atan(t12); + T t18 = atan(t13); + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t37 = t2*1.0E+24; + T t38 = t3*1.0E+24; + T t39 = t4*1.0E+24; + T t40 = t5*1.0E+24; + T t41 = t6*1.0E+24; + T t22 = t9*t17; + T t23 = t9*t18; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t42 = t37+1.0; + T t43 = t38+1.0; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t27 = t22+1.0/2.0; + T t28 = t23+1.0/2.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t47 = 1.0/t42; + T t48 = 1.0/t43; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t32 = t27*udg1; + T t33 = t28*udg2; + T t34 = t29*udg3; + T t35 = t30*udg4; + T t36 = t31*udg5; + T t57 = t9*t12*t47; + T t58 = t9*t13*t48; + T t59 = t9*t14*t49; + T t60 = t9*t15*t50; + T t61 = t9*t16*t51; + T t52 = t32+3.182454300088011E-13; + T t53 = t33+3.182454300088011E-13; + T t54 = t34+3.182454300088011E-13; + T t55 = t35+3.182454300088011E-13; + T t56 = t36+3.182454300088011E-13; + T t62 = t27+t57; + T t63 = t28+t58; + T t64 = t29+t59; + T t65 = t30+t60; + T t66 = t31+t61; + T t77 = t32+t33+t34+t35+t36+1.591227150044006E-12; + T t67 = t62*udg9; + T t68 = t63*udg10; + T t69 = t64*udg11; + T t70 = t62*udg17; + T t71 = t65*udg12; + T t72 = t63*udg18; + T t73 = t66*udg13; + T t74 = t64*udg19; + T t75 = t65*udg20; + T t76 = t66*udg21; + T t78 = 1.0/t77; + T t79 = t78*t78; + T t80 = t78*udg8; + T t81 = t78*uinf1; + T t82 = t78*udg6*udg7; + T t85 = t67*t77; + T t86 = t68*t77; + T t87 = t69*t77; + T t88 = t70*t77; + T t89 = t71*t77; + T t90 = t72*t77; + T t91 = t73*t77; + T t92 = t74*t77; + T t93 = t75*t77; + T t94 = t76*t77; + T t107 = t67+t68+t69+t71+t73; + T t108 = t70+t72+t74+t75+t76; + T t83 = (t7*t79)/2.0; + T t84 = (t8*t79)/2.0; + T t95 = -t85; + T t96 = -t86; + T t97 = -t87; + T t98 = -t88; + T t99 = -t89; + T t100 = -t90; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = t80+t81; + T t109 = t52*t107; + T t110 = t53*t107; + T t111 = t54*t107; + T t112 = t55*t107; + T t113 = t56*t107; + T t114 = t52*t108; + T t115 = t53*t108; + T t116 = t54*t108; + T t117 = t55*t108; + T t118 = t56*t108; + T t119 = t78*t107*udg6; + T t120 = t78*t107*udg7; + T t121 = t78*t108*udg6; + T t122 = t78*t108*udg7; + T t106 = t83+t84; + T t123 = -t119; + T t124 = -t120; + T t125 = -t121; + T t126 = -t122; + T t131 = t95+t109; + T t132 = t96+t110; + T t133 = t97+t111; + T t134 = t99+t112; + T t135 = t101+t113; + T t136 = t98+t114; + T t137 = t100+t115; + T t138 = t102+t116; + T t139 = t103+t117; + T t140 = t104+t118; + T t141 = -t78*(t119-udg14); + T t142 = -t78*(t120-udg15); + T t143 = -t78*(t121-udg22); + T t144 = -t78*(t122-udg23); + T t145 = t78*(t119-udg14)*-2.0; + T t146 = t78*(t122-udg23)*-2.0; + T t147 = t78*(t122-udg23); + T t149 = -t78*uinf2*(t85-t109); + T t150 = -t79*uinf2*(t85-t109); + T t151 = -t78*uinf3*(t86-t110); + T t152 = -t79*uinf3*(t86-t110); + T t153 = -t78*uinf4*(t87-t111); + T t154 = -t79*uinf4*(t87-t111); + T t155 = -t78*uinf5*(t89-t112); + T t156 = -t79*uinf5*(t89-t112); + T t157 = -t78*uinf6*(t91-t113); + T t158 = -t79*uinf6*(t91-t113); + T t159 = -t78*uinf2*(t88-t114); + T t160 = -t79*uinf2*(t88-t114); + T t161 = -t78*uinf3*(t90-t115); + T t162 = -t79*uinf3*(t90-t115); + T t163 = -t78*uinf4*(t92-t116); + T t164 = -t79*uinf4*(t92-t116); + T t165 = -t78*uinf5*(t93-t117); + T t166 = -t79*uinf5*(t93-t117); + T t167 = -t78*uinf6*(t94-t118); + T t168 = -t79*uinf6*(t94-t118); + T t169 = t78*uinf2*(t85-t109); + T t170 = t78*uinf3*(t86-t110); + T t171 = t78*uinf4*(t87-t111); + T t172 = t78*uinf5*(t89-t112); + T t173 = t78*uinf6*(t91-t113); + T t174 = t78*uinf2*(t88-t114); + T t175 = t78*uinf3*(t90-t115); + T t176 = t78*uinf4*(t92-t116); + T t177 = t78*uinf5*(t93-t117); + T t178 = t78*uinf6*(t94-t118); + T t182 = -t11*uinf12*(t78*(t120-udg15)+t78*(t121-udg22)); + T t185 = -t52*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t186 = -t53*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t187 = -t54*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t188 = -t55*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t189 = -t56*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)); + T t190 = -t52*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t191 = -t53*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t192 = -t54*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t193 = -t55*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t194 = -t56*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)); + T t127 = t123+udg14; + T t128 = t124+udg15; + T t129 = t125+udg22; + T t130 = t126+udg23; + T t148 = t147*2.0; + T t179 = t142+t143; + T t181 = t145+t147; + T t183 = t150+t152+t154+t156+t158; + T t184 = t160+t162+t164+t166+t168; + f[0*ng+i] = t169+t185+odg1*t67+t52*t78*udg6; + f[1*ng+i] = t170+t186+odg1*t68+t53*t78*udg6; + f[2*ng+i] = t171+t187+odg1*t69+t54*t78*udg6; + f[3*ng+i] = t172+t188+odg1*t71+t55*t78*udg6; + f[4*ng+i] = t173+t189+odg1*t73+t56*t78*udg6; + f[5*ng+i] = uinf1+odg1*udg14+t7*t78-t11*uinf12*(t144+t78*(t119-udg14)*2.0)*(2.0/3.0); + f[6*ng+i] = t82+t182+odg1*udg15; + f[7*ng+i] = odg1*udg16+t105*udg6-uinf7*(t149+t52*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))-uinf8*(t151+t53*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))-uinf9*(t153+t54*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))-uinf10*(t155+t55*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))-uinf11*(t157+t56*(t79*uinf2*(t85-t109)+t79*uinf3*(t86-t110)+t79*uinf4*(t87-t111)+t79*uinf5*(t89-t112)+t79*uinf6*(t91-t113)))+t78*t182*udg7+t10*t11*uinf13*(uinf19*(udg16+t77*(t79*udg6*(t119-udg14)+t79*udg7*(t120-udg15))-t106*t107)+t67*uinf14+t68*uinf15+t69*uinf16+t71*uinf17+t73*uinf18)-t11*t78*udg6*uinf12*(t144+t78*(t119-udg14)*2.0)*(2.0/3.0); + f[8*ng+i] = t174+t190+odg1*t70+t52*t78*udg7; + f[9*ng+i] = t175+t191+odg1*t72+t53*t78*udg7; + f[10*ng+i] = t176+t192+odg1*t74+t54*t78*udg7; + f[11*ng+i] = t177+t193+odg1*t75+t55*t78*udg7; + f[12*ng+i] = t178+t194+odg1*t76+t56*t78*udg7; + f[13*ng+i] = t82+t182+odg1*udg22; + f[14*ng+i] = uinf1+odg1*udg23+t8*t78+t11*uinf12*(t146+t78*(t119-udg14))*(2.0/3.0); + f[15*ng+i] = odg1*udg24+t105*udg7-uinf7*(t159+t52*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))-uinf8*(t161+t53*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))-uinf9*(t163+t54*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))-uinf10*(t165+t55*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))-uinf11*(t167+t56*(t79*uinf2*(t88-t114)+t79*uinf3*(t90-t115)+t79*uinf4*(t92-t116)+t79*uinf5*(t93-t117)+t79*uinf6*(t94-t118)))+t78*t182*udg6+t10*t11*uinf13*(uinf19*(udg24+t77*(t79*udg6*(t121-udg22)+t79*udg7*(t122-udg23))-t106*t108)+t70*uinf14+t72*uinf15+t74*uinf16+t75*uinf17+t76*uinf18)+t11*t78*udg7*uinf12*(t146+t78*(t119-udg14))*(2.0/3.0); + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp index 17dc6e69..dea075cd 100644 --- a/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp +++ b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp @@ -6,7 +6,8 @@ template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *ui double rho_scale = uinf[0]; double u_scale = uinf[1]; double rhoe_scale = uinf[2]; - double omega_scale = rho_scale*u_scale; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; double wdot[5]; // std::cout << "START OUTPUT" << std::endl; diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP.cpp new file mode 100644 index 00000000..34887465 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP.cpp @@ -0,0 +1,215 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + double wdot[5]; + // std::cout << "START OUTPUT" << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + // mix->netProductionRates(wdot); + // uinf1 = mix->P() / rhoe_scale; + // uinf2 = mix->mixtureFrozenGamma(); + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = uinf2*2.0; + T t8 = uinf2+1.0; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param15; + T t13 = param17*1.0E+12; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t11 = t7-2.0; + T t12 = 1.0/t8; + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t39 = t2*1.0E+24; + T t40 = t3*1.0E+24; + T t41 = t4*1.0E+24; + T t42 = t5*1.0E+24; + T t43 = t6*1.0E+24; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t54 = t9*t14*t49; + T t55 = t9*t15*t50; + T t56 = t9*t16*t51; + T t57 = t9*t17*t52; + T t58 = t9*t18*t53; + T t59 = t29+t54; + T t60 = t30+t55; + T t61 = t31+t56; + T t62 = t32+t57; + T t63 = t33+t58; + T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t64 = t59*udg9; + T t65 = t60*udg10; + T t66 = t61*udg11; + T t67 = t59*udg17; + T t68 = t62*udg12; + T t69 = t60*udg18; + T t70 = t63*udg13; + T t71 = t61*udg19; + T t72 = t62*udg20; + T t73 = t63*udg21; + T t75 = 1.0/t74; + T t76 = t75*t75; + T t77 = t75*udg8; + T t78 = t75*uinf1; + T t86 = t64+t65+t66+t68+t70; + T t87 = t67+t69+t71+t72+t73; + T t79 = t77*1.0E+12; + T t80 = t78*1.0E+12; + T t81 = t77+t78-1.0E-4; + T t88 = t75*t86*udg6; + T t89 = t75*t87*udg7; + T t82 = t79+t80-1.0E+8; + T t90 = -t88; + T t91 = -t89; + T t95 = -t75*(t88-udg14); + T t96 = -t75*(t89-udg23); + T t97 = t75*(t88-udg14)*-1.0E+12; + T t98 = t75*(t89-udg23)*-1.0E+12; + T t83 = atan(t82); + T t92 = t90+udg14; + T t93 = t91+udg23; + T t102 = t95+t96-1.0E+4; + T t103 = t97+t98-1.0E+16; + T t84 = t9*t83; + T t104 = atan(t103); + T t85 = t84+1.0/2.0; + T t105 = t9*t104; + T t94 = t81*t85; + T t106 = t105-1.0/2.0; + T t99 = t94+1.000000003182454E-4; + T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t100 = t11*t12*t99; + T t109 = t108*-1.0E+12; + T t110 = t107-2.0E+4; + T t101 = 1.0/sqrt(t100); + T t111 = t109-2.0E+16; + T t112 = atan(t111); + T t113 = t9*t112; + T t114 = t113+1.0/2.0; + T t115 = -t114*(t108+2.0E+4); + T t116 = t108+t115+1.0E+4; + T t117 = odg2*t10*t101*t116; + T t118 = -t117; + T t120 = t117*1.0E+12; + T t119 = param17+t118; + T t121 = -t120; + T t122 = t13+t121; + T t123 = atan(t122); + T t124 = t9*t123; + T t125 = t124-1.0/2.0; + T t126 = t119*t125; + + f[j+npe*0+npe*nce*k] = mix->mixtureFrozenCpMass() / 1182.1920097928833; + f[j+npe*1+npe*nce*k] = odg1; + f[j+npe*2+npe*nce*k] = odg2; + // f[j+npe*3+npe*nce*k] = wdot[3]/omega_scale; + // f[j+npe*4+npe*nce*k] = wdot[4]/omega_scale; + f[j+npe*5+npe*nce*k] = mix->P(); + f[j+npe*6+npe*nce*k] = mix->T(); + f[j+npe*7+npe*nce*k] = mix->mixtureFrozenGamma(); + f[j+npe*8+npe*nce*k] = rhoe; + f[j+npe*9+npe*nce*k] = odg3; + } + // std::cout << "END OUTPUT" << std::endl; + +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP_2.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP_2.cpp new file mode 100644 index 00000000..54dde158 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_PB_MPP_2.cpp @@ -0,0 +1,214 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + double wdot[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + // uinf1 = mix->P() / rhoe_scale; + // uinf2 = mix->mixtureFrozenGamma(); + + T t2 = udg1*udg1; + T t3 = udg2*udg2; + T t4 = udg3*udg3; + T t5 = udg4*udg4; + T t6 = udg5*udg5; + T t7 = uinf2*2.0; + T t8 = uinf2+1.0; + T t9 = 1.0/3.141592653589793; + T t10 = 1.0/param15; + T t13 = param17*1.0E+12; + T t14 = udg1*1.0E+12; + T t15 = udg2*1.0E+12; + T t16 = udg3*1.0E+12; + T t17 = udg4*1.0E+12; + T t18 = udg5*1.0E+12; + T t11 = t7-2.0; + T t12 = 1.0/t8; + T t19 = atan(t14); + T t20 = atan(t15); + T t21 = atan(t16); + T t22 = atan(t17); + T t23 = atan(t18); + T t39 = t2*1.0E+24; + T t40 = t3*1.0E+24; + T t41 = t4*1.0E+24; + T t42 = t5*1.0E+24; + T t43 = t6*1.0E+24; + T t24 = t9*t19; + T t25 = t9*t20; + T t26 = t9*t21; + T t27 = t9*t22; + T t28 = t9*t23; + T t44 = t39+1.0; + T t45 = t40+1.0; + T t46 = t41+1.0; + T t47 = t42+1.0; + T t48 = t43+1.0; + T t29 = t24+1.0/2.0; + T t30 = t25+1.0/2.0; + T t31 = t26+1.0/2.0; + T t32 = t27+1.0/2.0; + T t33 = t28+1.0/2.0; + T t49 = 1.0/t44; + T t50 = 1.0/t45; + T t51 = 1.0/t46; + T t52 = 1.0/t47; + T t53 = 1.0/t48; + T t34 = t29*udg1; + T t35 = t30*udg2; + T t36 = t31*udg3; + T t37 = t32*udg4; + T t38 = t33*udg5; + T t54 = t9*t14*t49; + T t55 = t9*t15*t50; + T t56 = t9*t16*t51; + T t57 = t9*t17*t52; + T t58 = t9*t18*t53; + T t59 = t29+t54; + T t60 = t30+t55; + T t61 = t31+t56; + T t62 = t32+t57; + T t63 = t33+t58; + T t74 = t34+t35+t36+t37+t38+1.591227150044006E-12; + T t64 = t59*udg9; + T t65 = t60*udg10; + T t66 = t61*udg11; + T t67 = t59*udg17; + T t68 = t62*udg12; + T t69 = t60*udg18; + T t70 = t63*udg13; + T t71 = t61*udg19; + T t72 = t62*udg20; + T t73 = t63*udg21; + T t75 = 1.0/t74; + T t76 = t75*t75; + T t77 = t75*udg8; + T t78 = t75*uinf1; + T t86 = t64+t65+t66+t68+t70; + T t87 = t67+t69+t71+t72+t73; + T t79 = t77*1.0E+12; + T t80 = t78*1.0E+12; + T t81 = t77+t78-1.0E-4; + T t88 = t75*t86*udg6; + T t89 = t75*t87*udg7; + T t82 = t79+t80-1.0E+8; + T t90 = -t88; + T t91 = -t89; + T t95 = -t75*(t88-udg14); + T t96 = -t75*(t89-udg23); + T t97 = t75*(t88-udg14)*-1.0E+12; + T t98 = t75*(t89-udg23)*-1.0E+12; + T t83 = atan(t82); + T t92 = t90+udg14; + T t93 = t91+udg23; + T t102 = t95+t96-1.0E+4; + T t103 = t97+t98-1.0E+16; + T t84 = t9*t83; + T t104 = atan(t103); + T t85 = t84+1.0/2.0; + T t105 = t9*t104; + T t94 = t81*t85; + T t106 = t105-1.0/2.0; + T t99 = t94+1.000000003182454E-4; + T t107 = -t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t108 = t106*(t75*(t88-udg14)+t75*(t89-udg23)+1.0E+4); + T t100 = t11*t12*t99; + T t109 = t108*-1.0E+12; + T t110 = t107-2.0E+4; + T t101 = 1.0/sqrt(t100); + T t111 = t109-2.0E+16; + T t112 = atan(t111); + T t113 = t9*t112; + T t114 = t113+1.0/2.0; + T t115 = -t114*(t108+2.0E+4); + T t116 = t108+t115+1.0E+4; + T t117 = odg2*t10*t101*t116; + T t118 = -t117; + T t120 = t117*1.0E+12; + T t119 = param17+t118; + T t121 = -t120; + T t122 = t13+t121; + T t123 = atan(t122); + T t124 = t9*t123; + T t125 = t124-1.0/2.0; + T t126 = t119*t125; + + f[j+npe*0+npe*nce*k] = wdot[0]/omega_scale; + f[j+npe*1+npe*nce*k] = wdot[1]/omega_scale; + f[j+npe*2+npe*nce*k] = wdot[2]/omega_scale; + f[j+npe*3+npe*nce*k] = wdot[3]/omega_scale; + f[j+npe*4+npe*nce*k] = wdot[4]/omega_scale; + f[j+npe*5+npe*nce*k] = mix->P(); + f[j+npe*6+npe*nce*k] = mix->T(); + f[j+npe*7+npe*nce*k] = mix->mixtureFrozenGamma(); + f[j+npe*8+npe*nce*k] = rhoe; + f[j+npe*9+npe*nce*k] = odg1; + } + // std::cout << "END OUTPUT" << std::endl; + +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp index 996c4cc8..b59f52ca 100644 --- a/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp +++ b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp @@ -6,8 +6,9 @@ template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* double rho_scale = uinf[0]; double u_scale = uinf[1]; double rhoe_scale = uinf[2]; - double omega_scale = rho_scale*u_scale; - // std::cout << "START SOURCE" << std::endl; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; +// std::cout << "START SOURCE: " << L_scale << std::endl; for (int i = 0; i void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* double wdot[5]; mix->netProductionRates(wdot); + // f[0*ng+i] = 0.0; + // f[1*ng+i] = 0.0; + // f[2*ng+i] = 0.0; + // f[3*ng+i] = 0.0; + // f[4*ng+i] = 0.0; +// f[5*ng+i] = 0.0; +// f[6*ng+i] = 0.0; +// f[7*ng+i] = 0.0; f[0*ng+i] = wdot[0]/(omega_scale); f[1*ng+i] = wdot[1]/(omega_scale); f[2*ng+i] = wdot[2]/(omega_scale); diff --git a/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP_2.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP_2.cpp new file mode 100644 index 00000000..52f69936 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP_2.cpp @@ -0,0 +1,52 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + double wdot[5]; + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + f[7*ng+i] = 0.0; + } +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp.cpp new file mode 100644 index 00000000..b7986bec --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup, enzyme_dupnoneed; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dupnoneed, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp_MPP.cpp new file mode 100644 index 00000000..730e9a6e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuApp_MPP.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dup, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne, mix); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield.cpp new file mode 100644 index 00000000..ec0f6ae0 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield.cpp @@ -0,0 +1,234 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = param22*param22; + T t10 = udg1*udg1; + T t11 = udg2*udg2; + T t12 = udg3*udg3; + T t13 = udg4*udg4; + T t14 = udg5*udg5; + T t15 = uinf2*2.0; + T t16 = uinf2+1.0; + T t22 = 1.0/3.141592653589793; + T t23 = -param23; + T t24 = 1.0/param15; + T t17 = atan(t3); + T t18 = atan(t4); + T t19 = atan(t5); + T t20 = atan(t6); + T t21 = atan(t7); + T t25 = t15-2.0; + T t26 = 1.0/t16; + T t27 = t3*t3; + T t28 = t4*t4; + T t29 = t5*t5; + T t30 = t6*t6; + T t31 = t7*t7; + T t32 = t2*t22; + T t33 = t32*5.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t17*t22; + T t40 = t18*t22; + T t41 = t19*t22; + T t42 = t20*t22; + T t43 = t21*t22; + T t44 = -t32; + T t45 = -t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = 1.0/t36; + T t49 = 1.0/t37; + T t50 = 1.0/t38; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t41+1.0/2.0; + T t54 = t42+1.0/2.0; + T t55 = t43+1.0/2.0; + T t56 = t51*udg1; + T t57 = t52*udg2; + T t58 = t53*udg3; + T t59 = t54*udg4; + T t60 = t55*udg5; + T t61 = t3*t22*t46; + T t62 = t4*t22*t47; + T t63 = t5*t22*t48; + T t64 = t6*t22*t49; + T t65 = t7*t22*t50; + T t66 = t51+t61; + T t67 = t52+t62; + T t68 = t53+t63; + T t69 = t54+t64; + T t70 = t55+t65; + T t81 = t45+t56+t57+t58+t59+t60+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t86 = t71+t72+t73+t75+t77; + T t87 = t74+t76+t78+t79+t80; + T t88 = t84+t85-1.0E-4; + T t93 = t82*t86*udg6; + T t94 = t82*t86*udg7; + T t95 = t82*t87*udg6; + T t96 = t82*t87*udg7; + T t89 = param22*t88; + T t97 = -t93; + T t98 = -t94; + T t99 = -t95; + T t100 = -t96; + T t105 = -t82*(t93-udg14); + T t106 = -t82*(t94-udg15); + T t107 = -t82*(t95-udg22); + T t108 = -t82*(t96-udg23); + T t109 = t82*(t95-udg22); + T t117 = -param22*(-t23+t82*(t93-udg14)+t82*(t96-udg23)); + T t90 = atan(t89); + T t101 = t97+udg14; + T t102 = t98+udg15; + T t103 = t99+udg22; + T t104 = t100+udg23; + T t114 = t106+t109; + T t115 = t23+t105+t108; + T t116 = pow(t107+t82*(t94-udg15),2.0); + T t118 = atan(t117); + T t91 = t22*t90; + T t119 = sqrt(t116); + T t122 = t22*t118; + T t92 = t91+1.0/2.0; + T t120 = param22*t119; + T t124 = t122-1.0/2.0; + T t110 = t88*t92; + T t121 = atan(t120); + T t126 = -t124*(-t23+t82*(t93-udg14)+t82*(t96-udg23)); + T t127 = t124*(-t23+t82*(t93-udg14)+t82*(t96-udg23)); + T t111 = t44+t110+5.001E-1; + T t123 = t22*t121; + T t130 = t8+t32+t127-1.0/2.0; + T t112 = t25*t26*t111; + T t125 = t123+1.0/2.0; + T t131 = param22*t130; + T t113 = 1.0/sqrt(t112); + T t128 = t119*t125; + T t132 = atan(t131); + T t129 = -t128; + T t135 = t22*t132; + T t133 = param23+t32+t129-1.0/2.0; + T t138 = t135-1.0/2.0; + T t134 = param22*t133; + T t140 = t130*t138; + T t136 = atan(t134); + T t143 = param23+t127+t140; + T t137 = t22*t136; + T t144 = t143*t143; + T t145 = t143*t143*t143; + T t139 = t137-1.0/2.0; + T t141 = t133*t139; + T t142 = -t141; + T t146 = t128+t142; + T t147 = t146*t146; + T t148 = t144+t147+1.0E-16; + T t149 = 1.0/t148; + T t150 = odg2*t24*t113*t145*t149; + T t151 = -t150; + T t152 = param17+t151; + T t153 = param22*t152; + T t154 = atan(t153); + T t155 = t22*t154; + T t156 = t155-1.0/2.0; + T t157 = t152*t156; + T t158 = -t157; + T t159 = param18+t32+t158-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t24*t81*(t157-t159*(t22*atan(param22*t159)-1.0/2.0))*sqrt(t112+t83*(udg6*udg6)+t83*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield_noducros.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield_noducros.cpp new file mode 100644 index 00000000..e8639bcc --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuAvfield_noducros.cpp @@ -0,0 +1,203 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = param22*param22; + T t10 = udg1*udg1; + T t11 = udg2*udg2; + T t12 = udg3*udg3; + T t13 = udg4*udg4; + T t14 = udg5*udg5; + T t15 = uinf2*2.0; + T t16 = uinf2+1.0; + T t22 = 1.0/3.141592653589793; + T t23 = -param23; + T t24 = 1.0/param15; + T t17 = atan(t3); + T t18 = atan(t4); + T t19 = atan(t5); + T t20 = atan(t6); + T t21 = atan(t7); + T t25 = t15-2.0; + T t26 = 1.0/t16; + T t27 = t3*t3; + T t28 = t4*t4; + T t29 = t5*t5; + T t30 = t6*t6; + T t31 = t7*t7; + T t32 = t2*t22; + T t33 = t32*5.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t17*t22; + T t40 = t18*t22; + T t41 = t19*t22; + T t42 = t20*t22; + T t43 = t21*t22; + T t44 = -t32; + T t45 = -t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = 1.0/t36; + T t49 = 1.0/t37; + T t50 = 1.0/t38; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t41+1.0/2.0; + T t54 = t42+1.0/2.0; + T t55 = t43+1.0/2.0; + T t56 = t51*udg1; + T t57 = t52*udg2; + T t58 = t53*udg3; + T t59 = t54*udg4; + T t60 = t55*udg5; + T t61 = t3*t22*t46; + T t62 = t4*t22*t47; + T t63 = t5*t22*t48; + T t64 = t6*t22*t49; + T t65 = t7*t22*t50; + T t66 = t51+t61; + T t67 = t52+t62; + T t68 = t53+t63; + T t69 = t54+t64; + T t70 = t55+t65; + T t81 = t45+t56+t57+t58+t59+t60+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t86 = t71+t72+t73+t75+t77; + T t87 = t74+t76+t78+t79+t80; + T t88 = t84+t85-1.0E-4; + T t93 = t82*t86*udg6; + T t94 = t82*t87*udg7; + T t89 = param22*t88; + T t95 = -t93; + T t96 = -t94; + T t99 = -t82*(t93-udg14); + T t100 = -t82*(t94-udg23); + T t106 = -param22*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t90 = atan(t89); + T t97 = t95+udg14; + T t98 = t96+udg23; + T t105 = t23+t99+t100; + T t107 = atan(t106); + T t91 = t22*t90; + T t108 = t22*t107; + T t92 = t91+1.0/2.0; + T t109 = t108-1.0/2.0; + T t101 = t88*t92; + T t110 = -t109*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t111 = t109*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t102 = t44+t101+5.001E-1; + T t112 = t8+t32+t111-1.0/2.0; + T t103 = t25*t26*t102; + T t113 = param22*t112; + T t104 = 1.0/sqrt(t103); + T t114 = atan(t113); + T t115 = t22*t114; + T t116 = t115-1.0/2.0; + T t117 = t112*t116; + T t118 = param23+t111+t117; + T t119 = odg2*t24*t104*t118; + T t120 = -t119; + T t121 = param17+t120; + T t122 = param22*t121; + T t123 = atan(t122); + T t124 = t22*t123; + T t125 = t124-1.0/2.0; + T t126 = t121*t125; + T t127 = -t126; + T t128 = param18+t32+t127-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t24*t81*(t126-t128*(t22*atan(param22*t128)-1.0/2.0))*sqrt(t103+t83*(udg6*udg6)+t83*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou.cpp new file mode 100644 index 00000000..bb80add7 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou.cpp @@ -0,0 +1,480 @@ + +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf20 = 1.0/0.9; + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t22 = t3*t3; + T t23 = t4*t4; + T t24 = t5*t5; + T t25 = t6*t6; + T t26 = t7*t7; + T t27 = t2*t21; + T t28 = t27*5.0; + T t29 = t22+1.0; + T t30 = t23+1.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t16*t21; + T t35 = t17*t21; + T t36 = t18*t21; + T t37 = t19*t21; + T t38 = t20*t21; + T t39 = -t27; + T t40 = -t28; + T t41 = 1.0/t29; + T t42 = 1.0/t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = t34+1.0/2.0; + T t47 = t35+1.0/2.0; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t46*udg1; + T t52 = t47*udg2; + T t53 = t48*udg3; + T t54 = t49*udg4; + T t55 = t50*udg5; + T t56 = t3*t21*t41; + T t57 = t4*t21*t42; + T t58 = t5*t21*t43; + T t59 = t6*t21*t44; + T t60 = t7*t21*t45; + T t61 = t39+t51+1.0/2.0; + T t62 = t39+t52+1.0/2.0; + T t63 = t39+t53+1.0/2.0; + T t64 = t39+t54+1.0/2.0; + T t65 = t39+t55+1.0/2.0; + T t66 = t46+t56; + T t67 = t47+t57; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t81 = t40+t51+t52+t53+t54+t55+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t88 = t71+t72+t73+t75+t77; + T t89 = t74+t76+t78+t79+t80; + T t86 = (t14*t83)/2.0; + T t87 = (t15*t83)/2.0; + T t90 = t84+t85; + T t92 = t82*t88*udg6; + T t93 = t82*t89*udg7; + T t91 = t86+t87; + T t94 = -t92; + T t95 = -t93; + T t98 = -t82*(t92-udg14); + T t99 = -t82*(t93-udg23); + T t101 = -odg1*(t82*(t92-udg14)+t82*(t93-udg23)); + T t96 = t94+udg14; + T t97 = t95+udg23; + T t100 = t98+t99; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t61*t82*udg6+nlg2*t61*t82*udg7; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t62*t82*udg6+nlg2*t62*t82*udg7; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t63*t82*udg6+nlg2*t63*t82*udg7; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t64*t82*udg6+nlg2*t64*t82*udg7; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t65*t82*udg6+nlg2*t65*t82*udg7; + f[5*ng+i] = nlg1*(t101+uinf1+t14*t82)+tau6*(udg6-uhg6)+nlg2*t82*udg6*udg7; + f[6*ng+i] = nlg2*(t101+uinf1+t15*t82)+tau7*(udg7-uhg7)+nlg1*t82*udg6*udg7; + f[7*ng+i] = nlg1*(t90*udg6+t82*t101*udg6+odg1*param21*uinf20*(t71*uinf14+t72*uinf15+t73*uinf16+t75*uinf17+t77*uinf18-uinf19*(-udg16+t88*t91+t81*(t83*udg7*(udg15-t82*t88*udg7)-t83*udg6*(t92-udg14)))))+nlg2*(t90*udg7+t82*t101*udg7+odg1*param21*uinf20*(t74*uinf14+t76*uinf15+t78*uinf16+t79*uinf17+t80*uinf18-uinf19*(-udg24+t89*t91+t81*(t83*udg6*(udg22-t82*t89*udg6)-t83*udg7*(t93-udg23)))))+tau8*(udg8-uhg8); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf20 = 1.0/0.9; + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t22 = t3*t3; + T t23 = t4*t4; + T t24 = t5*t5; + T t25 = t6*t6; + T t26 = t7*t7; + T t27 = t2*t21; + T t28 = t27*5.0; + T t29 = t22+1.0; + T t30 = t23+1.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t16*t21; + T t35 = t17*t21; + T t36 = t18*t21; + T t37 = t19*t21; + T t38 = t20*t21; + T t39 = -t27; + T t40 = -t28; + T t41 = 1.0/t29; + T t42 = 1.0/t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = t34+1.0/2.0; + T t47 = t35+1.0/2.0; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t46*udg1; + T t52 = t47*udg2; + T t53 = t48*udg3; + T t54 = t49*udg4; + T t55 = t50*udg5; + T t56 = t3*t21*t41; + T t57 = t4*t21*t42; + T t58 = t5*t21*t43; + T t59 = t6*t21*t44; + T t60 = t7*t21*t45; + T t61 = t39+t51+1.0/2.0; + T t62 = t39+t52+1.0/2.0; + T t63 = t39+t53+1.0/2.0; + T t64 = t39+t54+1.0/2.0; + T t65 = t39+t55+1.0/2.0; + T t66 = t46+t56; + T t67 = t47+t57; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t81 = t40+t51+t52+t53+t54+t55+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t88 = t71+t72+t73+t75+t77; + T t89 = t74+t76+t78+t79+t80; + T t86 = (t14*t83)/2.0; + T t87 = (t15*t83)/2.0; + T t90 = t84+t85; + T t92 = t82*t88*udg6; + T t93 = t82*t89*udg7; + T t91 = t86+t87; + T t94 = -t92; + T t95 = -t93; + T t98 = -t82*(t92-udg14); + T t99 = -t82*(t93-udg23); + T t101 = -odg1*(t82*(t92-udg14)+t82*(t93-udg23)); + T t96 = t94+udg14; + T t97 = t95+udg23; + T t100 = t98+t99; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t61*t82*udg6+nlg2*t61*t82*udg7; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t62*t82*udg6+nlg2*t62*t82*udg7; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t63*t82*udg6+nlg2*t63*t82*udg7; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t64*t82*udg6+nlg2*t64*t82*udg7; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t65*t82*udg6+nlg2*t65*t82*udg7; + f[5*ng+i] = nlg1*(t101+uinf1+t14*t82)+tau6*(udg6-uhg6)+nlg2*t82*udg6*udg7; + f[6*ng+i] = nlg2*(t101+uinf1+t15*t82)+tau7*(udg7-uhg7)+nlg1*t82*udg6*udg7; + f[7*ng+i] = nlg1*(t90*udg6+t82*t101*udg6+odg1*param21*uinf20*(t71*uinf14+t72*uinf15+t73*uinf16+t75*uinf17+t77*uinf18-uinf19*(-udg16+t88*t91+t81*(t83*udg7*(udg15-t82*t88*udg7)-t83*udg6*(t92-udg14)))))+nlg2*(t90*udg7+t82*t101*udg7+odg1*param21*uinf20*(t74*uinf14+t76*uinf15+t78*uinf16+t79*uinf17+t80*uinf18-uinf19*(-udg24+t89*t91+t81*(t83*udg6*(udg22-t82*t89*udg6)-t83*udg7*(t93-udg23)))))+tau8*(udg8-uhg8); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + T fstate[16]; + T fwall[16]; + T Ustate[24]; + T Uwall[24]; + for (int i = 0; i void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou_jordi.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou_jordi.cpp new file mode 100644 index 00000000..b666b87e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFbou_jordi.cpp @@ -0,0 +1,480 @@ + +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf20 = 1.0/0.9; + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t22 = t3*t3; + T t23 = t4*t4; + T t24 = t5*t5; + T t25 = t6*t6; + T t26 = t7*t7; + T t27 = t2*t21; + T t28 = t27*5.0; + T t29 = t22+1.0; + T t30 = t23+1.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t16*t21; + T t35 = t17*t21; + T t36 = t18*t21; + T t37 = t19*t21; + T t38 = t20*t21; + T t39 = -t27; + T t40 = -t28; + T t41 = 1.0/t29; + T t42 = 1.0/t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = t34+1.0/2.0; + T t47 = t35+1.0/2.0; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t46*udg1; + T t52 = t47*udg2; + T t53 = t48*udg3; + T t54 = t49*udg4; + T t55 = t50*udg5; + T t56 = t3*t21*t41; + T t57 = t4*t21*t42; + T t58 = t5*t21*t43; + T t59 = t6*t21*t44; + T t60 = t7*t21*t45; + T t61 = t39+t51+1.0/2.0; + T t62 = t39+t52+1.0/2.0; + T t63 = t39+t53+1.0/2.0; + T t64 = t39+t54+1.0/2.0; + T t65 = t39+t55+1.0/2.0; + T t66 = t46+t56; + T t67 = t47+t57; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t81 = t40+t51+t52+t53+t54+t55+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t88 = t71+t72+t73+t75+t77; + T t89 = t74+t76+t78+t79+t80; + T t86 = (t14*t83)/2.0; + T t87 = (t15*t83)/2.0; + T t90 = t84+t85; + T t92 = t82*t88*udg6; + T t93 = t82*t89*udg7; + T t91 = t86+t87; + T t94 = -t92; + T t95 = -t93; + T t98 = -t82*(t92-udg14); + T t99 = -t82*(t93-udg23); + T t101 = -odg1*(t82*(t92-udg14)+t82*(t93-udg23)); + T t96 = t94+udg14; + T t97 = t95+udg23; + T t100 = t98+t99; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t61*t82*udg6+nlg2*t61*t82*udg7; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t62*t82*udg6+nlg2*t62*t82*udg7; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t63*t82*udg6+nlg2*t63*t82*udg7; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t64*t82*udg6+nlg2*t64*t82*udg7; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t65*t82*udg6+nlg2*t65*t82*udg7; + f[5*ng+i] = nlg1*(t101+uinf1+t14*t82)+tau6*(udg6-uhg6)+nlg2*t82*udg6*udg7; + f[6*ng+i] = nlg2*(t101+uinf1+t15*t82)+tau7*(udg7-uhg7)+nlg1*t82*udg6*udg7; + f[7*ng+i] = nlg1*(t90*udg6+t82*t101*udg6+odg1*param21*uinf20*(t71*uinf14+t72*uinf15+t73*uinf16+t75*uinf17+t77*uinf18-uinf19*(-udg16+t88*t91+t81*(t83*udg7*(udg15-t82*t88*udg7)-t83*udg6*(t92-udg14)))))+nlg2*(t90*udg7+t82*t101*udg7+odg1*param21*uinf20*(t74*uinf14+t76*uinf15+t78*uinf16+t79*uinf17+t80*uinf18-uinf19*(-udg24+t89*t91+t81*(t83*udg6*(udg22-t82*t89*udg6)-t83*udg7*(t93-udg23)))))+tau8*(udg8-uhg8); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf20 = 1.0/0.9; + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + //uinf14 = 0.0; uinf15 = 0.0; uinf16 = 0.0; uinf17 = 0.0; uinf18 = 0.0; uinf19 = 0.0; // LAPLACIAN + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t22 = t3*t3; + T t23 = t4*t4; + T t24 = t5*t5; + T t25 = t6*t6; + T t26 = t7*t7; + T t27 = t2*t21; + T t28 = t27*5.0; + T t29 = t22+1.0; + T t30 = t23+1.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t16*t21; + T t35 = t17*t21; + T t36 = t18*t21; + T t37 = t19*t21; + T t38 = t20*t21; + T t39 = -t27; + T t40 = -t28; + T t41 = 1.0/t29; + T t42 = 1.0/t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = t34+1.0/2.0; + T t47 = t35+1.0/2.0; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t46*udg1; + T t52 = t47*udg2; + T t53 = t48*udg3; + T t54 = t49*udg4; + T t55 = t50*udg5; + T t56 = t3*t21*t41; + T t57 = t4*t21*t42; + T t58 = t5*t21*t43; + T t59 = t6*t21*t44; + T t60 = t7*t21*t45; + T t61 = t39+t51+1.0/2.0; + T t62 = t39+t52+1.0/2.0; + T t63 = t39+t53+1.0/2.0; + T t64 = t39+t54+1.0/2.0; + T t65 = t39+t55+1.0/2.0; + T t66 = t46+t56; + T t67 = t47+t57; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t81 = t40+t51+t52+t53+t54+t55+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t88 = t71+t72+t73+t75+t77; + T t89 = t74+t76+t78+t79+t80; + T t86 = (t14*t83)/2.0; + T t87 = (t15*t83)/2.0; + T t90 = t84+t85; + T t92 = t82*t88*udg6; + T t93 = t82*t89*udg7; + T t91 = t86+t87; + T t94 = -t92; + T t95 = -t93; + T t98 = -t82*(t92-udg14); + T t99 = -t82*(t93-udg23); + T t101 = -odg1*(t82*(t92-udg14)+t82*(t93-udg23)); + T t96 = t94+udg14; + T t97 = t95+udg23; + T t100 = t98+t99; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*t61*t82*udg6+nlg2*t61*t82*udg7; + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*t62*t82*udg6+nlg2*t62*t82*udg7; + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*t63*t82*udg6+nlg2*t63*t82*udg7; + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*t64*t82*udg6+nlg2*t64*t82*udg7; + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*t65*t82*udg6+nlg2*t65*t82*udg7; + f[5*ng+i] = nlg1*(t101+uinf1+t14*t82)+tau6*(udg6-uhg6)+nlg2*t82*udg6*udg7; + f[6*ng+i] = nlg2*(t101+uinf1+t15*t82)+tau7*(udg7-uhg7)+nlg1*t82*udg6*udg7; + f[7*ng+i] = nlg1*(t90*udg6+t82*t101*udg6+odg1*param21*uinf20*(t71*uinf14+t72*uinf15+t73*uinf16+t75*uinf17+t77*uinf18-uinf19*(-udg16+t88*t91+t81*(t83*udg7*(udg15-t82*t88*udg7)-t83*udg6*(t92-udg14)))))+nlg2*(t90*udg7+t82*t101*udg7+odg1*param21*uinf20*(t74*uinf14+t76*uinf15+t78*uinf16+t79*uinf17+t80*uinf18-uinf19*(-udg24+t89*t91+t81*(t83*udg6*(udg22-t82*t89*udg6)-t83*udg7*(t93-udg23)))))+tau8*(udg8-uhg8); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + T fstate[16]; + T fwall[16]; + T Ustate[24]; + T Uwall[24]; + for (int i = 0; i void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFhat.cpp new file mode 100644 index 00000000..cba1b474 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFhat.cpp @@ -0,0 +1,6 @@ +template void opuFhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuFhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFlux.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFlux.cpp new file mode 100644 index 00000000..fa2036c5 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuFlux.cpp @@ -0,0 +1,222 @@ + + +template void opuFluxKernel(int i, T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + T param2 = param[1]; + T param21 = param[20]; + T param22 = param[21]; + T uinf1 = uinf[0]; + T uinf2 = uinf[1]; + T uinf14 = uinf[13]; + T uinf15 = uinf[14]; + T uinf16 = uinf[15]; + T uinf17 = uinf[16]; + T uinf18 = uinf[17]; + T uinf19 = uinf[18]; + T uinf20 = uinf[19]; + T udg1 = udg[0]; + T udg2 = udg[1]; + T udg3 = udg[2]; + T udg4 = udg[3]; + T udg5 = udg[4]; + T udg6 = udg[5]; + T udg7 = udg[6]; + T udg8 = udg[7]; + T udg9 = udg[8]; + T udg10 = udg[9]; + T udg11 = udg[10]; + T udg12 = udg[11]; + T udg13 = udg[12]; + T udg14 = udg[13]; + T udg15 = udg[14]; + T udg16 = udg[15]; + T udg17 = udg[16]; + T udg18 = udg[17]; + T udg19 = udg[18]; + T udg20 = udg[19]; + T udg21 = udg[20]; + T udg22 = udg[21]; + T udg23 = udg[22]; + T udg24 = udg[23]; + T odg1 = odg[0*ng+i]; + + T t1pi = 1.0/3.141592653589793; + + udg1 = udg1*(t1pi*atan(udg1*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg2 = udg2*(t1pi*atan(udg2*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg3 = udg3*(t1pi*atan(udg3*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg4 = udg4*(t1pi*atan(udg4*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + udg5 = udg5*(t1pi*atan(udg5*1.0E+12)+1.0/2.0)+3.182454300088011E-13; + + double Ucons[8] = {udg1, udg2, udg3, udg4, udg5, udg6, udg7, udg8}; + dimensionalizeConsVars(Ucons, (double*)uinf, nspecies, ndim); + conservativeToState(Ucons, Ustate, (double*)uinf, nspecies, ndim); + double rhovec[5] = {Ustate[0],Ustate[1],Ustate[2],Ustate[3],Ustate[4]}; + double rhoe = Ustate[nspecies]; + + mix->setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf20 = 1.0/0.9; + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t22 = t3*t3; + T t23 = t4*t4; + T t24 = t5*t5; + T t25 = t6*t6; + T t26 = t7*t7; + T t27 = t2*t21; + T t28 = t27*5.0; + T t29 = t22+1.0; + T t30 = t23+1.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t16*t21; + T t35 = t17*t21; + T t36 = t18*t21; + T t37 = t19*t21; + T t38 = t20*t21; + T t39 = -t27; + T t40 = -t28; + T t41 = 1.0/t29; + T t42 = 1.0/t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = t34+1.0/2.0; + T t47 = t35+1.0/2.0; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t46*udg1; + T t52 = t47*udg2; + T t53 = t48*udg3; + T t54 = t49*udg4; + T t55 = t50*udg5; + T t56 = t3*t21*t41; + T t57 = t4*t21*t42; + T t58 = t5*t21*t43; + T t59 = t6*t21*t44; + T t60 = t7*t21*t45; + T t61 = t39+t51+1.0/2.0; + T t62 = t39+t52+1.0/2.0; + T t63 = t39+t53+1.0/2.0; + T t64 = t39+t54+1.0/2.0; + T t65 = t39+t55+1.0/2.0; + T t66 = t46+t56; + T t67 = t47+t57; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t81 = t40+t51+t52+t53+t54+t55+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t86 = t82*udg6*udg7; + T t89 = t71+t72+t73+t75+t77; + T t90 = t74+t76+t78+t79+t80; + T t87 = (t14*t83)/2.0; + T t88 = (t15*t83)/2.0; + T t91 = t84+t85; + T t93 = t82*t89*udg6; + T t94 = t82*t90*udg7; + T t92 = t87+t88; + T t95 = -t93; + T t96 = -t94; + T t99 = -t82*(t93-udg14); + T t100 = -t82*(t94-udg23); + T t102 = -odg1*(t82*(t93-udg14)+t82*(t94-udg23)); + T t97 = t95+udg14; + T t98 = t96+udg23; + T t101 = t99+t100; + f[0] = t61*t82*udg6; + f[1] = t62*t82*udg6; + f[2] = t63*t82*udg6; + f[3] = t64*t82*udg6; + f[4] = t65*t82*udg6; + f[5] = t102+uinf1+t14*t82; + f[6] = t86; + f[7] = t91*udg6+t82*t102*udg6+odg1*param21*uinf20*(t71*uinf14+t72*uinf15+t73*uinf16+t75*uinf17+t77*uinf18-uinf19*(-udg16+t89*t92+t81*(t83*udg7*(udg15-t82*t89*udg7)-t83*udg6*(t93-udg14)))); + f[8] = t61*t82*udg7; + f[9] = t62*t82*udg7; + f[10] = t63*t82*udg7; + f[11] = t64*t82*udg7; + f[12] = t65*t82*udg7; + f[13] = t86; + f[14] = t102+uinf1+t15*t82; + f[15] = t91*udg7+t82*t102*udg7+odg1*param21*uinf20*(t74*uinf14+t76*uinf15+t78*uinf16+t79*uinf17+t80*uinf18-uinf19*(-udg24+t90*t92+t81*(t83*udg6*(udg22-t82*t90*udg6)-t83*udg7*(t94-udg23)))); +} + +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + T ftmp[16]; + T utmp[24]; + + for (int i = 0; i void opuInitodg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitodg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitodg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitq.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitq.cpp new file mode 100644 index 00000000..c557795d --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitq.cpp @@ -0,0 +1,6 @@ +template void opuInitq(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitq(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitq(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitu.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitu.cpp new file mode 100644 index 00000000..e007a61e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitu.cpp @@ -0,0 +1,33 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitudg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitudg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitudg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitwdg.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitwdg.cpp new file mode 100644 index 00000000..5217d5ee --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuInitwdg.cpp @@ -0,0 +1,6 @@ +template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuOutput.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuOutput.cpp new file mode 100644 index 00000000..ea913c5f --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuOutput.cpp @@ -0,0 +1,175 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t22 = t3*t3; + T t23 = t4*t4; + T t24 = t5*t5; + T t25 = t6*t6; + T t26 = t7*t7; + T t27 = t2*t21*5.0; + T t28 = t22+1.0; + T t29 = t23+1.0; + T t30 = t24+1.0; + T t31 = t25+1.0; + T t32 = t26+1.0; + T t33 = t16*t21; + T t34 = t17*t21; + T t35 = t18*t21; + T t36 = t19*t21; + T t37 = t20*t21; + T t38 = -t27; + T t39 = 1.0/t28; + T t40 = 1.0/t29; + T t41 = 1.0/t30; + T t42 = 1.0/t31; + T t43 = 1.0/t32; + T t44 = t33+1.0/2.0; + T t45 = t34+1.0/2.0; + T t46 = t35+1.0/2.0; + T t47 = t36+1.0/2.0; + T t48 = t37+1.0/2.0; + T t49 = t44*udg1; + T t50 = t45*udg2; + T t51 = t46*udg3; + T t52 = t47*udg4; + T t53 = t48*udg5; + T t54 = t3*t21*t39; + T t55 = t4*t21*t40; + T t56 = t5*t21*t41; + T t57 = t6*t21*t42; + T t58 = t7*t21*t43; + T t59 = t44+t54; + T t60 = t45+t55; + T t61 = t46+t56; + T t62 = t47+t57; + T t63 = t48+t58; + T t74 = t38+t49+t50+t51+t52+t53+5.0/2.0; + T t64 = t59*udg9; + T t65 = t60*udg10; + T t66 = t61*udg11; + T t67 = t59*udg17; + T t68 = t62*udg12; + T t69 = t60*udg18; + T t70 = t63*udg13; + T t71 = t61*udg19; + T t72 = t62*udg20; + T t73 = t63*udg21; + T t75 = 1.0/t74; + T t76 = t75*t75; + T t79 = t64+t65+t66+t68+t70; + T t80 = t67+t69+t71+t72+t73; + T t77 = (t14*t76)/2.0; + T t78 = (t15*t76)/2.0; + T t81 = t77+t78; + f[j+npe*0+npe*nce*k] = odg1; + f[j+npe*1+npe*nce*k] = uinf19*(-udg16+t79*t81+t74*(t76*udg6*(udg14-t75*t79*udg6)+t76*udg7*(udg15-t75*t79*udg7)))-t64*uinf14-t65*uinf15-t66*uinf16-t68*uinf17-t70*uinf18; + f[j+npe*2+npe*nce*k] = uinf19*(-udg24+t80*t81+t74*(t76*udg6*(udg22-t75*t80*udg6)+t76*udg7*(udg23-t75*t80*udg7)))-t67*uinf14-t69*uinf15-t71*uinf16-t72*uinf17-t73*uinf18; + f[j+npe*3+npe*nce*k] = uinf1; + f[j+npe*4+npe*nce*k] = mix->T(); + f[j+npe*5+npe*nce*k] = udg6; + f[j+npe*6+npe*nce*k] = udg7; + f[j+npe*7+npe*nce*k] = udg8; + f[j+npe*8+npe*nce*k] = 0.0; + f[j+npe*9+npe*nce*k] = 0.0; + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSource.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSource.cpp new file mode 100644 index 00000000..48213920 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSource.cpp @@ -0,0 +1,52 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + double wdot[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + f[7*ng+i] = 0.0; + } +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSourcew.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSourcew.cpp new file mode 100644 index 00000000..e97b7257 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuSourcew.cpp @@ -0,0 +1,6 @@ +template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuSourcew(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSourcew(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuStab.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuStab.cpp new file mode 100644 index 00000000..7fd61560 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuStab.cpp @@ -0,0 +1,6 @@ +template void opuStab(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuStab(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuStab(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuTdfunc.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuTdfunc.cpp new file mode 100644 index 00000000..f20d744b --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuTdfunc.cpp @@ -0,0 +1,16 @@ +template void opuTdfunc(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuUbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUbou_jordi.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUbou_jordi.cpp new file mode 100644 index 00000000..f1408e9c --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUbou_jordi.cpp @@ -0,0 +1,88 @@ +template void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuUbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUhat.cpp new file mode 100644 index 00000000..ba30d409 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_inv_pb_regen/opuUhat.cpp @@ -0,0 +1,6 @@ +template void opuUhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuUhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuApp.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuApp.cpp new file mode 100644 index 00000000..730e9a6e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuApp.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dup, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne, mix); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuAvfield.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuAvfield.cpp new file mode 100644 index 00000000..987dbe54 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuAvfield.cpp @@ -0,0 +1,168 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = uinf2*2.0; + T t10 = uinf2+1.0; + T t16 = 1.0/3.141592653589793; + T t17 = -param23; + T t18 = 1.0/param15; + T t21 = udg9+udg10+udg11+udg12+udg13; + T t22 = udg17+udg18+udg19+udg20+udg21; + T t11 = atan(t3); + T t12 = atan(t4); + T t13 = atan(t5); + T t14 = atan(t6); + T t15 = atan(t7); + T t19 = t9-2.0; + T t20 = 1.0/t10; + T t23 = t2*t16; + T t24 = t23*5.0; + T t25 = t11*t16; + T t26 = t12*t16; + T t27 = t13*t16; + T t28 = t14*t16; + T t29 = t15*t16; + T t30 = -t23; + T t31 = -t24; + T t32 = t25+1.0/2.0; + T t33 = t26+1.0/2.0; + T t34 = t27+1.0/2.0; + T t35 = t28+1.0/2.0; + T t36 = t29+1.0/2.0; + T t37 = t32*udg1; + T t38 = t33*udg2; + T t39 = t34*udg3; + T t40 = t35*udg4; + T t41 = t36*udg5; + T t42 = t31+t37+t38+t39+t40+t41+5.0/2.0; + T t43 = 1.0/t42; + T t44 = t43*t43; + T t45 = t43*udg8; + T t46 = t43*uinf1; + T t47 = t21*t43*udg6; + T t48 = t22*t43*udg7; + T t49 = -t47; + T t50 = -t48; + T t53 = -t43*(t47-udg14); + T t54 = -t43*(t48-udg23); + T t55 = t45+t46-1.0E-4; + T t61 = -param22*(-t17+t43*(t47-udg14)+t43*(t48-udg23)); + T t51 = t49+udg14; + T t52 = t50+udg23; + T t56 = param22*t55; + T t60 = t17+t53+t54; + T t62 = atan(t61); + T t57 = atan(t56); + T t63 = t16*t62; + T t58 = t16*t57; + T t65 = t63-1.0/2.0; + T t59 = t58+1.0/2.0; + T t69 = -t65*(-t17+t43*(t47-udg14)+t43*(t48-udg23)); + T t70 = t65*(-t17+t43*(t47-udg14)+t43*(t48-udg23)); + T t64 = t55*t59; + T t71 = t8+t23+t70-1.0/2.0; + T t66 = t30+t64+5.001E-1; + T t72 = param22*t71; + T t67 = t19*t20*t66; + T t73 = atan(t72); + T t68 = 1.0/sqrt(t67); + T t74 = t16*t73; + T t75 = t74-1.0/2.0; + T t76 = t71*t75; + T t77 = param23+t70+t76; + T t78 = odg2*t18*t68*t77; + T t79 = -t78; + T t80 = param17+t79; + T t81 = param22*t80; + T t82 = atan(t81); + T t83 = t16*t82; + T t84 = t83-1.0/2.0; + T t85 = t80*t84; + T t86 = -t85; + T t87 = param18+t23+t86-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t18*(sqrt(t44*(udg6*udg6)+t44*(udg7*udg7))+1.0/t68)*(t85-t87*(t16*atan(param22*t87)-1.0/2.0)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFbou.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFbou.cpp new file mode 100644 index 00000000..d6d48871 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFbou.cpp @@ -0,0 +1,844 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t22 = 1.0/param19; + T t23 = 1.0/param20; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t24 = t3*t3; + T t25 = t4*t4; + T t26 = t5*t5; + T t27 = t6*t6; + T t28 = t7*t7; + T t29 = t2*t21; + T t30 = t29*5.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t16*t21; + T t37 = t17*t21; + T t38 = t18*t21; + T t39 = t19*t21; + T t40 = t20*t21; + T t41 = -t29; + T t42 = -t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t48*udg1; + T t54 = t49*udg2; + T t55 = t50*udg3; + T t56 = t51*udg4; + T t57 = t52*udg5; + T t58 = t3*t21*t43; + T t59 = t4*t21*t44; + T t60 = t5*t21*t45; + T t61 = t6*t21*t46; + T t62 = t7*t21*t47; + T t63 = t41+t53+1.0/2.0; + T t64 = t41+t54+1.0/2.0; + T t65 = t41+t55+1.0/2.0; + T t66 = t41+t56+1.0/2.0; + T t67 = t41+t57+1.0/2.0; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t71 = t51+t61; + T t72 = t52+t62; + T t83 = t42+t53+t54+t55+t56+t57+5.0/2.0; + T t73 = t68*udg9; + T t74 = t69*udg10; + T t75 = t70*udg11; + T t76 = t68*udg17; + T t77 = t71*udg12; + T t78 = t69*udg18; + T t79 = t72*udg13; + T t80 = t70*udg19; + T t81 = t71*udg20; + T t82 = t72*udg21; + T t84 = 1.0/t83; + T t85 = t84*t84; + T t86 = t84*udg8; + T t87 = t84*uinf1; + T t88 = t84*udg6*udg7; + T t91 = t73*t83; + T t92 = t74*t83; + T t93 = t75*t83; + T t94 = t76*t83; + T t95 = t77*t83; + T t96 = t78*t83; + T t97 = t79*t83; + T t98 = t80*t83; + T t99 = t81*t83; + T t100 = t82*t83; + T t111 = t73+t74+t75+t77+t79; + T t112 = t76+t78+t80+t81+t82; + T t89 = (t14*t85)/2.0; + T t90 = (t15*t85)/2.0; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = -t98; + T t109 = -t99; + T t110 = -t100; + T t113 = t86+t87; + T t115 = t63*t111; + T t116 = t64*t111; + T t117 = t65*t111; + T t118 = t66*t111; + T t119 = t67*t111; + T t120 = t63*t112; + T t121 = t64*t112; + T t122 = t65*t112; + T t123 = t66*t112; + T t124 = t67*t112; + T t125 = t84*t111*udg6; + T t126 = t84*t111*udg7; + T t127 = t84*t112*udg6; + T t128 = t84*t112*udg7; + T t114 = t89+t90; + T t129 = -t125; + T t130 = -t126; + T t131 = -t127; + T t132 = -t128; + T t137 = t101+t115; + T t138 = t102+t116; + T t139 = t103+t117; + T t140 = t105+t118; + T t141 = t107+t119; + T t142 = t104+t120; + T t143 = t106+t121; + T t144 = t108+t122; + T t145 = t109+t123; + T t146 = t110+t124; + T t147 = -t84*(t125-udg14); + T t148 = -t84*(t126-udg15); + T t149 = -t84*(t127-udg22); + T t150 = -t84*(t128-udg23); + T t151 = t84*(t125-udg14)*-2.0; + T t152 = t84*(t128-udg23)*-2.0; + T t153 = t84*(t128-udg23); + T t155 = -t84*uinf2*(t91-t115); + T t156 = -t85*uinf2*(t91-t115); + T t157 = -t84*uinf3*(t92-t116); + T t158 = -t85*uinf3*(t92-t116); + T t159 = -t84*uinf4*(t93-t117); + T t160 = -t85*uinf4*(t93-t117); + T t161 = -t84*uinf5*(t95-t118); + T t162 = -t85*uinf5*(t95-t118); + T t163 = -t84*uinf6*(t97-t119); + T t164 = -t85*uinf6*(t97-t119); + T t165 = -t84*uinf2*(t94-t120); + T t166 = -t85*uinf2*(t94-t120); + T t167 = -t84*uinf3*(t96-t121); + T t168 = -t85*uinf3*(t96-t121); + T t169 = -t84*uinf4*(t98-t122); + T t170 = -t85*uinf4*(t98-t122); + T t171 = -t84*uinf5*(t99-t123); + T t172 = -t85*uinf5*(t99-t123); + T t173 = -t84*uinf6*(t100-t124); + T t174 = -t85*uinf6*(t100-t124); + T t175 = t84*uinf2*(t91-t115); + T t176 = t84*uinf3*(t92-t116); + T t177 = t84*uinf4*(t93-t117); + T t178 = t84*uinf5*(t95-t118); + T t179 = t84*uinf6*(t97-t119); + T t180 = t84*uinf2*(t94-t120); + T t181 = t84*uinf3*(t96-t121); + T t182 = t84*uinf4*(t98-t122); + T t183 = t84*uinf5*(t99-t123); + T t184 = t84*uinf6*(t100-t124); + T t188 = -t23*uinf12*(t84*(t126-udg15)+t84*(t127-udg22)); + T t191 = -t63*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t192 = -t64*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t193 = -t65*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t194 = -t66*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t195 = -t67*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t196 = -t63*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t197 = -t64*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t198 = -t65*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t199 = -t66*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t200 = -t67*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t133 = t129+udg14; + T t134 = t130+udg15; + T t135 = t131+udg22; + T t136 = t132+udg23; + T t154 = t153*2.0; + T t185 = t148+t149; + T t187 = t151+t153; + T t189 = t156+t158+t160+t162+t164; + T t190 = t166+t168+t170+t172+t174; + f[0*ng+i] = nlg1*(t175+t191+odg1*t73+t63*t84*udg6)+nlg2*(t180+t196+odg1*t76+t63*t84*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t176+t192+odg1*t74+t64*t84*udg6)+nlg2*(t181+t197+odg1*t78+t64*t84*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t177+t193+odg1*t75+t65*t84*udg6)+nlg2*(t182+t198+odg1*t80+t65*t84*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t178+t194+odg1*t77+t66*t84*udg6)+nlg2*(t183+t199+odg1*t81+t66*t84*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t179+t195+odg1*t79+t67*t84*udg6)+nlg2*(t184+t200+odg1*t82+t67*t84*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t88+t188+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t14*t84-t23*uinf12*(t150+t84*(t125-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t88+t188+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t15*t84+t23*uinf12*(t152+t84*(t125-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t113*udg6+uinf7*(t155+t63*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf8*(t157+t64*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf9*(t159+t65*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf10*(t161+t66*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf11*(t163+t67*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))-t22*t23*uinf13*(uinf19*(udg16+t83*(t85*udg6*(t125-udg14)+t85*udg7*(t126-udg15))-t111*t114)+t73*uinf14+t74*uinf15+t75*uinf16+t77*uinf17+t79*uinf18)+t23*t84*udg6*uinf12*(t150+t84*(t125-udg14)*2.0)*(2.0/3.0)+t23*t84*udg7*uinf12*(t84*(t126-udg15)+t84*(t127-udg22)))-nlg2*(-odg1*udg24-t113*udg7+uinf7*(t165+t63*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf8*(t167+t64*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf9*(t169+t65*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf10*(t171+t66*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf11*(t173+t67*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))-t22*t23*uinf13*(uinf19*(udg24+t83*(t85*udg6*(t127-udg22)+t85*udg7*(t128-udg23))-t112*t114)+t76*uinf14+t78*uinf15+t80*uinf16+t81*uinf17+t82*uinf18)-t23*t84*udg7*uinf12*(t152+t84*(t125-udg14))*(2.0/3.0)+t23*t84*udg6*uinf12*(t84*(t126-udg15)+t84*(t127-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t22 = 1.0/param19; + T t23 = 1.0/param20; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t24 = t3*t3; + T t25 = t4*t4; + T t26 = t5*t5; + T t27 = t6*t6; + T t28 = t7*t7; + T t29 = t2*t21; + T t30 = t29*5.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t16*t21; + T t37 = t17*t21; + T t38 = t18*t21; + T t39 = t19*t21; + T t40 = t20*t21; + T t41 = -t29; + T t42 = -t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t48*udg1; + T t54 = t49*udg2; + T t55 = t50*udg3; + T t56 = t51*udg4; + T t57 = t52*udg5; + T t58 = t3*t21*t43; + T t59 = t4*t21*t44; + T t60 = t5*t21*t45; + T t61 = t6*t21*t46; + T t62 = t7*t21*t47; + T t63 = t41+t53+1.0/2.0; + T t64 = t41+t54+1.0/2.0; + T t65 = t41+t55+1.0/2.0; + T t66 = t41+t56+1.0/2.0; + T t67 = t41+t57+1.0/2.0; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t71 = t51+t61; + T t72 = t52+t62; + T t83 = t42+t53+t54+t55+t56+t57+5.0/2.0; + T t73 = t68*udg9; + T t74 = t69*udg10; + T t75 = t70*udg11; + T t76 = t68*udg17; + T t77 = t71*udg12; + T t78 = t69*udg18; + T t79 = t72*udg13; + T t80 = t70*udg19; + T t81 = t71*udg20; + T t82 = t72*udg21; + T t84 = 1.0/t83; + T t85 = t84*t84; + T t86 = t84*udg8; + T t87 = t84*uinf1; + T t88 = t84*udg6*udg7; + T t91 = t73*t83; + T t92 = t74*t83; + T t93 = t75*t83; + T t94 = t76*t83; + T t95 = t77*t83; + T t96 = t78*t83; + T t97 = t79*t83; + T t98 = t80*t83; + T t99 = t81*t83; + T t100 = t82*t83; + T t111 = t73+t74+t75+t77+t79; + T t112 = t76+t78+t80+t81+t82; + T t89 = (t14*t85)/2.0; + T t90 = (t15*t85)/2.0; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = -t98; + T t109 = -t99; + T t110 = -t100; + T t113 = t86+t87; + T t115 = t63*t111; + T t116 = t64*t111; + T t117 = t65*t111; + T t118 = t66*t111; + T t119 = t67*t111; + T t120 = t63*t112; + T t121 = t64*t112; + T t122 = t65*t112; + T t123 = t66*t112; + T t124 = t67*t112; + T t125 = t84*t111*udg6; + T t126 = t84*t111*udg7; + T t127 = t84*t112*udg6; + T t128 = t84*t112*udg7; + T t114 = t89+t90; + T t129 = -t125; + T t130 = -t126; + T t131 = -t127; + T t132 = -t128; + T t137 = t101+t115; + T t138 = t102+t116; + T t139 = t103+t117; + T t140 = t105+t118; + T t141 = t107+t119; + T t142 = t104+t120; + T t143 = t106+t121; + T t144 = t108+t122; + T t145 = t109+t123; + T t146 = t110+t124; + T t147 = -t84*(t125-udg14); + T t148 = -t84*(t126-udg15); + T t149 = -t84*(t127-udg22); + T t150 = -t84*(t128-udg23); + T t151 = t84*(t125-udg14)*-2.0; + T t152 = t84*(t128-udg23)*-2.0; + T t153 = t84*(t128-udg23); + T t155 = -t84*uinf2*(t91-t115); + T t156 = -t85*uinf2*(t91-t115); + T t157 = -t84*uinf3*(t92-t116); + T t158 = -t85*uinf3*(t92-t116); + T t159 = -t84*uinf4*(t93-t117); + T t160 = -t85*uinf4*(t93-t117); + T t161 = -t84*uinf5*(t95-t118); + T t162 = -t85*uinf5*(t95-t118); + T t163 = -t84*uinf6*(t97-t119); + T t164 = -t85*uinf6*(t97-t119); + T t165 = -t84*uinf2*(t94-t120); + T t166 = -t85*uinf2*(t94-t120); + T t167 = -t84*uinf3*(t96-t121); + T t168 = -t85*uinf3*(t96-t121); + T t169 = -t84*uinf4*(t98-t122); + T t170 = -t85*uinf4*(t98-t122); + T t171 = -t84*uinf5*(t99-t123); + T t172 = -t85*uinf5*(t99-t123); + T t173 = -t84*uinf6*(t100-t124); + T t174 = -t85*uinf6*(t100-t124); + T t175 = t84*uinf2*(t91-t115); + T t176 = t84*uinf3*(t92-t116); + T t177 = t84*uinf4*(t93-t117); + T t178 = t84*uinf5*(t95-t118); + T t179 = t84*uinf6*(t97-t119); + T t180 = t84*uinf2*(t94-t120); + T t181 = t84*uinf3*(t96-t121); + T t182 = t84*uinf4*(t98-t122); + T t183 = t84*uinf5*(t99-t123); + T t184 = t84*uinf6*(t100-t124); + T t188 = -t23*uinf12*(t84*(t126-udg15)+t84*(t127-udg22)); + T t191 = -t63*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t192 = -t64*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t193 = -t65*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t194 = -t66*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t195 = -t67*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t196 = -t63*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t197 = -t64*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t198 = -t65*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t199 = -t66*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t200 = -t67*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t133 = t129+udg14; + T t134 = t130+udg15; + T t135 = t131+udg22; + T t136 = t132+udg23; + T t154 = t153*2.0; + T t185 = t148+t149; + T t187 = t151+t153; + T t189 = t156+t158+t160+t162+t164; + T t190 = t166+t168+t170+t172+t174; + f[0*ng+i] = nlg1*(t175+t191+odg1*t73+t63*t84*udg6)+nlg2*(t180+t196+odg1*t76+t63*t84*udg7)+tau1*(udg1-uhg1); + f[1*ng+i] = nlg1*(t176+t192+odg1*t74+t64*t84*udg6)+nlg2*(t181+t197+odg1*t78+t64*t84*udg7)+tau2*(udg2-uhg2); + f[2*ng+i] = nlg1*(t177+t193+odg1*t75+t65*t84*udg6)+nlg2*(t182+t198+odg1*t80+t65*t84*udg7)+tau3*(udg3-uhg3); + f[3*ng+i] = nlg1*(t178+t194+odg1*t77+t66*t84*udg6)+nlg2*(t183+t199+odg1*t81+t66*t84*udg7)+tau4*(udg4-uhg4); + f[4*ng+i] = nlg1*(t179+t195+odg1*t79+t67*t84*udg6)+nlg2*(t184+t200+odg1*t82+t67*t84*udg7)+tau5*(udg5-uhg5); + f[5*ng+i] = nlg2*(t88+t188+odg1*udg22)+tau6*(udg6-uhg6)+nlg1*(uinf1+odg1*udg14+t14*t84-t23*uinf12*(t150+t84*(t125-udg14)*2.0)*(2.0/3.0)); + f[6*ng+i] = nlg1*(t88+t188+odg1*udg15)+tau7*(udg7-uhg7)+nlg2*(uinf1+odg1*udg23+t15*t84+t23*uinf12*(t152+t84*(t125-udg14))*(2.0/3.0)); + f[7*ng+i] = -nlg1*(-odg1*udg16-t113*udg6+uinf7*(t155+t63*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf8*(t157+t64*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf9*(t159+t65*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf10*(t161+t66*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+uinf11*(t163+t67*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))-t22*t23*uinf13*(uinf19*(udg16+t83*(t85*udg6*(t125-udg14)+t85*udg7*(t126-udg15))-t111*t114)+t73*uinf14+t74*uinf15+t75*uinf16+t77*uinf17+t79*uinf18)+t23*t84*udg6*uinf12*(t150+t84*(t125-udg14)*2.0)*(2.0/3.0)+t23*t84*udg7*uinf12*(t84*(t126-udg15)+t84*(t127-udg22)))-nlg2*(-odg1*udg24-t113*udg7+uinf7*(t165+t63*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf8*(t167+t64*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf9*(t169+t65*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf10*(t171+t66*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+uinf11*(t173+t67*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))-t22*t23*uinf13*(uinf19*(udg24+t83*(t85*udg6*(t127-udg22)+t85*udg7*(t128-udg23))-t112*t114)+t76*uinf14+t78*uinf15+t80*uinf16+t81*uinf17+t82*uinf18)-t23*t84*udg7*uinf12*(t152+t84*(t125-udg14))*(2.0/3.0)+t23*t84*udg6*uinf12*(t84*(t126-udg15)+t84*(t127-udg22)))+tau8*(udg8-uhg8); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + uinf12 = mix->viscosity() / mu_scale; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t19 = 1.0/3.141592653589793; + T t20 = 1.0/param20; + T t14 = atan(t3); + T t15 = atan(t4); + T t16 = atan(t5); + T t17 = atan(t6); + T t18 = atan(t7); + T t21 = t3*t3; + T t22 = t4*t4; + T t23 = t5*t5; + T t24 = t6*t6; + T t25 = t7*t7; + T t26 = t2*t19*5.0; + T t27 = t21+1.0; + T t28 = t22+1.0; + T t29 = t23+1.0; + T t30 = t24+1.0; + T t31 = t25+1.0; + T t32 = t14*t19; + T t33 = t15*t19; + T t34 = t16*t19; + T t35 = t17*t19; + T t36 = t18*t19; + T t37 = -t26; + T t38 = 1.0/t27; + T t39 = 1.0/t28; + T t40 = 1.0/t29; + T t41 = 1.0/t30; + T t42 = 1.0/t31; + T t43 = t32+1.0/2.0; + T t44 = t33+1.0/2.0; + T t45 = t34+1.0/2.0; + T t46 = t35+1.0/2.0; + T t47 = t36+1.0/2.0; + T t48 = t43*udg1; + T t49 = t44*udg2; + T t50 = t45*udg3; + T t51 = t46*udg4; + T t52 = t47*udg5; + T t53 = t3*t19*t38; + T t54 = t4*t19*t39; + T t55 = t5*t19*t40; + T t56 = t6*t19*t41; + T t57 = t7*t19*t42; + T t58 = t43+t53; + T t59 = t44+t54; + T t60 = t45+t55; + T t61 = t46+t56; + T t62 = t47+t57; + T t73 = t37+t48+t49+t50+t51+t52+5.0/2.0; + T t63 = t58*udg9; + T t64 = t59*udg10; + T t65 = t60*udg11; + T t66 = t58*udg17; + T t67 = t61*udg12; + T t68 = t59*udg18; + T t69 = t62*udg13; + T t70 = t60*udg19; + T t71 = t61*udg20; + T t72 = t62*udg21; + T t74 = 1.0/t73; + T t75 = t74*udg6*udg7; + T t76 = t63+t64+t65+t67+t69; + T t77 = t66+t68+t70+t71+t72; + T t78 = t74*t76*udg6; + T t79 = t74*t76*udg7; + T t80 = t74*t77*udg6; + T t81 = t74*t77*udg7; + T t82 = -t78; + T t83 = -t79; + T t84 = -t80; + T t85 = -t81; + T t90 = -t74*(t79-udg15); + T t91 = -t74*(t80-udg22); + T t93 = -t20*uinf12*(t74*(t79-udg15)+t74*(t80-udg22)); + T t86 = t82+udg14; + T t87 = t83+udg15; + T t88 = t84+udg22; + T t89 = t85+udg23; + T t92 = t90+t91; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg1*(uinf1+odg1*udg14+t74*(udg6*udg6)-t20*uinf12*(t74*(t78-udg14)*2.0-t74*(t81-udg23))*(2.0/3.0))+nlg2*(t75+t93+odg1*udg22)+tau6*(udg6-uhg6); + f[6*ng+i] = nlg2*(uinf1+odg1*udg23+t74*(udg7*udg7)+t20*uinf12*(t74*(t78-udg14)-t74*(t81-udg23)*2.0)*(2.0/3.0))+nlg1*(t75+t93+odg1*udg15)+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFhat.cpp new file mode 100644 index 00000000..cba1b474 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFhat.cpp @@ -0,0 +1,6 @@ +template void opuFhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuFhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFlux.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFlux.cpp new file mode 100644 index 00000000..240a2c04 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuFlux.cpp @@ -0,0 +1,320 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf12 = mix->viscosity() / mu_scale; uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t22 = 1.0/param19; + T t23 = 1.0/param20; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t24 = t3*t3; + T t25 = t4*t4; + T t26 = t5*t5; + T t27 = t6*t6; + T t28 = t7*t7; + T t29 = t2*t21; + T t30 = t29*5.0; + T t31 = t24+1.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t16*t21; + T t37 = t17*t21; + T t38 = t18*t21; + T t39 = t19*t21; + T t40 = t20*t21; + T t41 = -t29; + T t42 = -t30; + T t43 = 1.0/t31; + T t44 = 1.0/t32; + T t45 = 1.0/t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = t36+1.0/2.0; + T t49 = t37+1.0/2.0; + T t50 = t38+1.0/2.0; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t48*udg1; + T t54 = t49*udg2; + T t55 = t50*udg3; + T t56 = t51*udg4; + T t57 = t52*udg5; + T t58 = t3*t21*t43; + T t59 = t4*t21*t44; + T t60 = t5*t21*t45; + T t61 = t6*t21*t46; + T t62 = t7*t21*t47; + T t63 = t41+t53+1.0/2.0; + T t64 = t41+t54+1.0/2.0; + T t65 = t41+t55+1.0/2.0; + T t66 = t41+t56+1.0/2.0; + T t67 = t41+t57+1.0/2.0; + T t68 = t48+t58; + T t69 = t49+t59; + T t70 = t50+t60; + T t71 = t51+t61; + T t72 = t52+t62; + T t83 = t42+t53+t54+t55+t56+t57+5.0/2.0; + T t73 = t68*udg9; + T t74 = t69*udg10; + T t75 = t70*udg11; + T t76 = t68*udg17; + T t77 = t71*udg12; + T t78 = t69*udg18; + T t79 = t72*udg13; + T t80 = t70*udg19; + T t81 = t71*udg20; + T t82 = t72*udg21; + T t84 = 1.0/t83; + T t85 = t84*t84; + T t86 = t84*udg8; + T t87 = t84*uinf1; + T t88 = t84*udg6*udg7; + T t91 = t73*t83; + T t92 = t74*t83; + T t93 = t75*t83; + T t94 = t76*t83; + T t95 = t77*t83; + T t96 = t78*t83; + T t97 = t79*t83; + T t98 = t80*t83; + T t99 = t81*t83; + T t100 = t82*t83; + T t111 = t73+t74+t75+t77+t79; + T t112 = t76+t78+t80+t81+t82; + T t89 = (t14*t85)/2.0; + T t90 = (t15*t85)/2.0; + T t101 = -t91; + T t102 = -t92; + T t103 = -t93; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = -t98; + T t109 = -t99; + T t110 = -t100; + T t113 = t86+t87; + T t115 = t63*t111; + T t116 = t64*t111; + T t117 = t65*t111; + T t118 = t66*t111; + T t119 = t67*t111; + T t120 = t63*t112; + T t121 = t64*t112; + T t122 = t65*t112; + T t123 = t66*t112; + T t124 = t67*t112; + T t125 = t84*t111*udg6; + T t126 = t84*t111*udg7; + T t127 = t84*t112*udg6; + T t128 = t84*t112*udg7; + T t114 = t89+t90; + T t129 = -t125; + T t130 = -t126; + T t131 = -t127; + T t132 = -t128; + T t137 = t101+t115; + T t138 = t102+t116; + T t139 = t103+t117; + T t140 = t105+t118; + T t141 = t107+t119; + T t142 = t104+t120; + T t143 = t106+t121; + T t144 = t108+t122; + T t145 = t109+t123; + T t146 = t110+t124; + T t147 = -t84*(t125-udg14); + T t148 = -t84*(t126-udg15); + T t149 = -t84*(t127-udg22); + T t150 = -t84*(t128-udg23); + T t151 = t84*(t125-udg14)*-2.0; + T t152 = t84*(t128-udg23)*-2.0; + T t153 = t84*(t128-udg23); + T t155 = -t84*uinf2*(t91-t115); + T t156 = -t85*uinf2*(t91-t115); + T t157 = -t84*uinf3*(t92-t116); + T t158 = -t85*uinf3*(t92-t116); + T t159 = -t84*uinf4*(t93-t117); + T t160 = -t85*uinf4*(t93-t117); + T t161 = -t84*uinf5*(t95-t118); + T t162 = -t85*uinf5*(t95-t118); + T t163 = -t84*uinf6*(t97-t119); + T t164 = -t85*uinf6*(t97-t119); + T t165 = -t84*uinf2*(t94-t120); + T t166 = -t85*uinf2*(t94-t120); + T t167 = -t84*uinf3*(t96-t121); + T t168 = -t85*uinf3*(t96-t121); + T t169 = -t84*uinf4*(t98-t122); + T t170 = -t85*uinf4*(t98-t122); + T t171 = -t84*uinf5*(t99-t123); + T t172 = -t85*uinf5*(t99-t123); + T t173 = -t84*uinf6*(t100-t124); + T t174 = -t85*uinf6*(t100-t124); + T t175 = t84*uinf2*(t91-t115); + T t176 = t84*uinf3*(t92-t116); + T t177 = t84*uinf4*(t93-t117); + T t178 = t84*uinf5*(t95-t118); + T t179 = t84*uinf6*(t97-t119); + T t180 = t84*uinf2*(t94-t120); + T t181 = t84*uinf3*(t96-t121); + T t182 = t84*uinf4*(t98-t122); + T t183 = t84*uinf5*(t99-t123); + T t184 = t84*uinf6*(t100-t124); + T t188 = -t23*uinf12*(t84*(t126-udg15)+t84*(t127-udg22)); + T t191 = -t63*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t192 = -t64*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t193 = -t65*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t194 = -t66*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t195 = -t67*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)); + T t196 = -t63*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t197 = -t64*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t198 = -t65*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t199 = -t66*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t200 = -t67*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)); + T t133 = t129+udg14; + T t134 = t130+udg15; + T t135 = t131+udg22; + T t136 = t132+udg23; + T t154 = t153*2.0; + T t185 = t148+t149; + T t187 = t151+t153; + T t189 = t156+t158+t160+t162+t164; + T t190 = t166+t168+t170+t172+t174; + f[0*ng+i] = t175+t191+odg1*t73+t63*t84*udg6; + f[1*ng+i] = t176+t192+odg1*t74+t64*t84*udg6; + f[2*ng+i] = t177+t193+odg1*t75+t65*t84*udg6; + f[3*ng+i] = t178+t194+odg1*t77+t66*t84*udg6; + f[4*ng+i] = t179+t195+odg1*t79+t67*t84*udg6; + f[5*ng+i] = uinf1+odg1*udg14+t14*t84-t23*uinf12*(t150+t84*(t125-udg14)*2.0)*(2.0/3.0); + f[6*ng+i] = t88+t188+odg1*udg15; + f[7*ng+i] = odg1*udg16+t113*udg6-uinf7*(t155+t63*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))-uinf8*(t157+t64*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))-uinf9*(t159+t65*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))-uinf10*(t161+t66*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))-uinf11*(t163+t67*(t85*uinf2*(t91-t115)+t85*uinf3*(t92-t116)+t85*uinf4*(t93-t117)+t85*uinf5*(t95-t118)+t85*uinf6*(t97-t119)))+t84*t188*udg7+t22*t23*uinf13*(uinf19*(udg16+t83*(t85*udg6*(t125-udg14)+t85*udg7*(t126-udg15))-t111*t114)+t73*uinf14+t74*uinf15+t75*uinf16+t77*uinf17+t79*uinf18)-t23*t84*udg6*uinf12*(t150+t84*(t125-udg14)*2.0)*(2.0/3.0); + f[8*ng+i] = t180+t196+odg1*t76+t63*t84*udg7; + f[9*ng+i] = t181+t197+odg1*t78+t64*t84*udg7; + f[10*ng+i] = t182+t198+odg1*t80+t65*t84*udg7; + f[11*ng+i] = t183+t199+odg1*t81+t66*t84*udg7; + f[12*ng+i] = t184+t200+odg1*t82+t67*t84*udg7; + f[13*ng+i] = t88+t188+odg1*udg22; + f[14*ng+i] = uinf1+odg1*udg23+t15*t84+t23*uinf12*(t152+t84*(t125-udg14))*(2.0/3.0); + f[15*ng+i] = odg1*udg24+t113*udg7-uinf7*(t165+t63*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))-uinf8*(t167+t64*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))-uinf9*(t169+t65*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))-uinf10*(t171+t66*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))-uinf11*(t173+t67*(t85*uinf2*(t94-t120)+t85*uinf3*(t96-t121)+t85*uinf4*(t98-t122)+t85*uinf5*(t99-t123)+t85*uinf6*(t100-t124)))+t84*t188*udg6+t22*t23*uinf13*(uinf19*(udg24+t83*(t85*udg6*(t127-udg22)+t85*udg7*(t128-udg23))-t112*t114)+t76*uinf14+t78*uinf15+t80*uinf16+t81*uinf17+t82*uinf18)+t23*t84*udg7*uinf12*(t152+t84*(t125-udg14))*(2.0/3.0); + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitodg.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitodg.cpp new file mode 100644 index 00000000..1e0174b0 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitodg.cpp @@ -0,0 +1,6 @@ +template void opuInitodg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitodg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitodg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitq.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitq.cpp new file mode 100644 index 00000000..c557795d --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitq.cpp @@ -0,0 +1,6 @@ +template void opuInitq(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitq(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitq(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitu.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitu.cpp new file mode 100644 index 00000000..e007a61e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitu.cpp @@ -0,0 +1,33 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitudg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitudg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitudg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitwdg.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitwdg.cpp new file mode 100644 index 00000000..5217d5ee --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuInitwdg.cpp @@ -0,0 +1,6 @@ +template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuOutput.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuOutput.cpp new file mode 100644 index 00000000..f07d51da --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuOutput.cpp @@ -0,0 +1,82 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + double wdot[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + + f[j+npe*0+npe*nce*k] = wdot[0]/omega_scale; + f[j+npe*1+npe*nce*k] = wdot[1]/omega_scale; + f[j+npe*2+npe*nce*k] = wdot[2]/omega_scale; + f[j+npe*3+npe*nce*k] = wdot[3]/omega_scale; + f[j+npe*4+npe*nce*k] = wdot[4]/omega_scale; + f[j+npe*5+npe*nce*k] = mix->P(); + f[j+npe*6+npe*nce*k] = mix->T(); + f[j+npe*7+npe*nce*k] = mix->mixtureFrozenGamma(); + f[j+npe*8+npe*nce*k] = rhoe; + f[j+npe*9+npe*nce*k] = odg1; + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSource.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSource.cpp new file mode 100644 index 00000000..2c9224b4 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSource.cpp @@ -0,0 +1,68 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + for (int i = 0; i setState(rhovec, &rhoe, 0); + double wdot[5]; + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + f[7*ng+i] = 0.0; + // T t2 = atan(param22); + // T t3 = 1.0/3.141592653589793; + // T t4 = t2*t3; + // T t5 = -t4; + // // f[0*ng+i] = t5+udg1*(t3*atan(param22*udg1)+1.0/2.0)+1.0/2.0; + // // f[1*ng+i] = t5+udg2*(t3*atan(param22*udg2)+1.0/2.0)+1.0/2.0; + // // f[2*ng+i] = t5+udg3*(t3*atan(param22*udg3)+1.0/2.0)+1.0/2.0; + // // f[3*ng+i] = t5+udg4*(t3*atan(param22*udg4)+1.0/2.0)+1.0/2.0; + // // f[4*ng+i] = t5+udg5*(t3*atan(param22*udg5)+1.0/2.0)+1.0/2.0; + } +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSourcew.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSourcew.cpp new file mode 100644 index 00000000..e97b7257 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuSourcew.cpp @@ -0,0 +1,6 @@ +template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuSourcew(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSourcew(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuStab.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuStab.cpp new file mode 100644 index 00000000..7fd61560 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuStab.cpp @@ -0,0 +1,6 @@ +template void opuStab(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuStab(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuStab(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuTdfunc.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuTdfunc.cpp new file mode 100644 index 00000000..f20d744b --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuTdfunc.cpp @@ -0,0 +1,16 @@ +template void opuTdfunc(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuUbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuUhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuUhat.cpp new file mode 100644 index 00000000..ba30d409 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_la_regen/opuUhat.cpp @@ -0,0 +1,6 @@ +template void opuUhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuUhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuApp.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuApp.cpp new file mode 100644 index 00000000..b7986bec --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuApp.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup, enzyme_dupnoneed; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dupnoneed, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuAvfield.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuAvfield.cpp new file mode 100644 index 00000000..60bb1cb0 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuAvfield.cpp @@ -0,0 +1,373 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = param22*param22; + T t10 = udg1*udg1; + T t11 = udg2*udg2; + T t12 = udg3*udg3; + T t13 = udg4*udg4; + T t14 = udg5*udg5; + T t15 = udg6*udg6; + T t16 = uinf2*2.0; + T t17 = uinf2+1.0; + T t23 = 1.0/3.141592653589793; + T t24 = -param23; + T t25 = 1.0/param15; + T t18 = atan(t3); + T t19 = atan(t4); + T t20 = atan(t5); + T t21 = atan(t6); + T t22 = atan(t7); + T t26 = t16-2.0; + T t27 = 1.0/t17; + T t28 = t3*t3; + T t29 = t4*t4; + T t30 = t5*t5; + T t31 = t6*t6; + T t32 = t7*t7; + T t33 = t2*t23; + T t34 = t33*5.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t32+1.0; + T t40 = t18*t23; + T t41 = t19*t23; + T t42 = t20*t23; + T t43 = t21*t23; + T t44 = t22*t23; + T t45 = -t33; + T t46 = -t34; + T t47 = 1.0/t35; + T t48 = 1.0/t36; + T t49 = 1.0/t37; + T t50 = 1.0/t38; + T t51 = 1.0/t39; + T t52 = t40+1.0/2.0; + T t53 = t41+1.0/2.0; + T t54 = t42+1.0/2.0; + T t55 = t43+1.0/2.0; + T t56 = t44+1.0/2.0; + T t57 = t52*udg1; + T t58 = t53*udg2; + T t59 = t54*udg3; + T t60 = t55*udg4; + T t61 = t56*udg5; + T t62 = t3*t23*t47; + T t63 = t4*t23*t48; + T t64 = t5*t23*t49; + T t65 = t6*t23*t50; + T t66 = t7*t23*t51; + T t67 = t45+t57+1.0/2.0; + T t68 = t45+t58+1.0/2.0; + T t69 = t45+t59+1.0/2.0; + T t70 = t45+t60+1.0/2.0; + T t71 = t45+t61+1.0/2.0; + T t72 = t52+t62; + T t73 = t53+t63; + T t74 = t54+t64; + T t75 = t55+t65; + T t76 = t56+t66; + T t87 = t46+t57+t58+t59+t60+t61+5.0/2.0; + T t77 = t72*udg9; + T t78 = t73*udg10; + T t79 = t74*udg11; + T t80 = t72*udg17; + T t81 = t75*udg12; + T t82 = t73*udg18; + T t83 = t76*udg13; + T t84 = t74*udg19; + T t85 = t75*udg20; + T t86 = t76*udg21; + T t88 = 1.0/t87; + T t89 = t88*t88; + T t91 = t88*udg8; + T t92 = t88*uinf1; + T t94 = t77*t87; + T t95 = t78*t87; + T t96 = t79*t87; + T t97 = t80*t87; + T t98 = t81*t87; + T t99 = t82*t87; + T t100 = t83*t87; + T t101 = t84*t87; + T t102 = t85*t87; + T t103 = t86*t87; + T t114 = t77+t78+t79+t81+t83; + T t115 = t80+t82+t84+t85+t86; + T t90 = t89*t89; + T t93 = t15*t89; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = -t98; + T t109 = -t99; + T t110 = -t100; + T t111 = -t101; + T t112 = -t102; + T t113 = -t103; + T t116 = t91+t92-1.0E-4; + T t119 = t67*t114; + T t120 = t68*t114; + T t121 = t69*t114; + T t122 = t70*t114; + T t123 = t71*t114; + T t124 = t67*t115; + T t125 = t68*t115; + T t126 = t69*t115; + T t127 = t70*t115; + T t128 = t71*t115; + T t131 = t88*t114*udg6; + T t132 = t88*t114*udg7; + T t133 = t88*t115*udg6; + T t134 = t88*t115*udg7; + T t117 = param22*t116; + T t135 = -t131; + T t136 = -t132; + T t137 = -t133; + T t138 = -t134; + T t143 = t104+t119; + T t144 = t105+t120; + T t145 = t106+t121; + T t146 = t108+t122; + T t147 = t110+t123; + T t148 = t107+t124; + T t149 = t109+t125; + T t150 = t111+t126; + T t151 = t112+t127; + T t152 = t113+t128; + T t153 = pow(t94-t119,2.0); + T t154 = pow(t95-t120,2.0); + T t155 = pow(t96-t121,2.0); + T t156 = pow(t98-t122,2.0); + T t157 = pow(t100-t123,2.0); + T t158 = pow(t97-t124,2.0); + T t159 = pow(t99-t125,2.0); + T t160 = pow(t101-t126,2.0); + T t161 = pow(t102-t127,2.0); + T t162 = pow(t103-t128,2.0); + T t163 = -t88*(t131-udg14); + T t164 = -t88*(t132-udg15); + T t165 = -t88*(t133-udg22); + T t166 = -t88*(t134-udg23); + T t167 = t88*(t133-udg22); + T t187 = -param22*(-t24+t88*(t131-udg14)+t88*(t134-udg23)); + T t118 = atan(t117); + T t139 = t135+udg14; + T t140 = t136+udg15; + T t141 = t137+udg22; + T t142 = t138+udg23; + T t169 = t90*t153; + T t170 = t90*t154; + T t171 = t90*t155; + T t172 = t90*t156; + T t173 = t90*t157; + T t174 = t90*t158; + T t175 = t90*t159; + T t176 = t90*t160; + T t177 = t90*t161; + T t178 = t90*t162; + T t184 = t164+t167; + T t185 = t24+t163+t166; + T t186 = pow(t165+t88*(t132-udg15),2.0); + T t188 = atan(t187); + T t129 = t23*t118; + T t189 = sqrt(t186); + T t192 = t23*t188; + T t196 = t169+t174; + T t197 = t170+t175; + T t198 = t171+t176; + T t199 = t172+t177; + T t200 = t173+t178; + T t130 = t129+1.0/2.0; + T t190 = param22*t189; + T t194 = t192-1.0/2.0; + T t201 = sqrt(t196); + T t202 = sqrt(t197); + T t203 = sqrt(t198); + T t204 = sqrt(t199); + T t205 = sqrt(t200); + T t168 = t116*t130; + T t191 = atan(t190); + T t206 = odg7*t25*t201; + T t207 = odg7*t25*t202; + T t208 = odg7*t25*t203; + T t209 = odg7*t25*t204; + T t210 = odg7*t25*t205; + T t241 = -t194*(-t24+t88*(t131-udg14)+t88*(t134-udg23)); + T t242 = t194*(-t24+t88*(t131-udg14)+t88*(t134-udg23)); + T t179 = t45+t168+5.001E-1; + T t193 = t23*t191; + T t211 = -t206; + T t212 = -t207; + T t213 = -t208; + T t214 = -t209; + T t215 = -t210; + T t245 = t8+t33+t242-1.0/2.0; + T t180 = t26*t27*t179; + T t195 = t193+1.0/2.0; + T t216 = param17+t211; + T t217 = param17+t212; + T t218 = param17+t213; + T t219 = param17+t214; + T t220 = param17+t215; + T t246 = param22*t245; + T t181 = 1.0/sqrt(t180); + T t182 = t93+t180; + T t221 = param22*t216; + T t222 = param22*t217; + T t223 = param22*t218; + T t224 = param22*t219; + T t225 = param22*t220; + T t243 = t189*t195; + T t247 = atan(t246); + T t183 = sqrt(t182); + T t226 = atan(t221); + T t227 = atan(t222); + T t228 = atan(t223); + T t229 = atan(t224); + T t230 = atan(t225); + T t244 = -t243; + T t250 = t23*t247; + T t231 = t23*t226; + T t232 = t23*t227; + T t233 = t23*t228; + T t234 = t23*t229; + T t235 = t23*t230; + T t248 = param23+t33+t244-1.0/2.0; + T t253 = t250-1.0/2.0; + T t236 = t231-1.0/2.0; + T t237 = t232-1.0/2.0; + T t238 = t233-1.0/2.0; + T t239 = t234-1.0/2.0; + T t240 = t235-1.0/2.0; + T t249 = param22*t248; + T t270 = t245*t253; + T t251 = atan(t249); + T t255 = t216*t236; + T t256 = t217*t237; + T t257 = t218*t238; + T t258 = t219*t239; + T t259 = t220*t240; + T t273 = param23+t242+t270; + T t252 = t23*t251; + T t260 = -t255; + T t261 = -t256; + T t262 = -t257; + T t263 = -t258; + T t264 = -t259; + T t274 = t273*t273; + T t275 = t273*t273*t273; + T t254 = t252-1.0/2.0; + T t265 = param18+t33+t260-1.0/2.0; + T t266 = param18+t33+t261-1.0/2.0; + T t267 = param18+t33+t262-1.0/2.0; + T t268 = param18+t33+t263-1.0/2.0; + T t269 = param18+t33+t264-1.0/2.0; + T t271 = t248*t254; + T t272 = -t271; + T t276 = t243+t272; + T t277 = t276*t276; + T t278 = t274+t277+1.0E-16; + T t279 = 1.0/t278; + T t280 = odg7*t25*t181*t275*t279; + T t281 = -t280; + T t282 = param17+t281; + T t283 = param22*t282; + T t284 = atan(t283); + T t285 = t23*t284; + T t286 = t285-1.0/2.0; + T t287 = t282*t286; + T t288 = -t287; + T t289 = param18+t33+t288-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg7*param16*t25*t87*sqrt(t182+t89*(udg7*udg7))*(t287-t289*(t23*atan(param22*t289)-1.0/2.0)); + f[j+npe*1+npe*nce*k] = odg7*t25*t87*t183*(t255-t265*(t23*atan(param22*t265)-1.0/2.0)); + f[j+npe*2+npe*nce*k] = odg7*t25*t87*t183*(t256-t266*(t23*atan(param22*t266)-1.0/2.0)); + f[j+npe*3+npe*nce*k] = odg7*t25*t87*t183*(t257-t267*(t23*atan(param22*t267)-1.0/2.0)); + f[j+npe*4+npe*nce*k] = odg7*t25*t87*t183*(t258-t268*(t23*atan(param22*t268)-1.0/2.0)); + f[j+npe*5+npe*nce*k] = odg7*t25*t87*t183*(t259-t269*(t23*atan(param22*t269)-1.0/2.0)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFbou.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFbou.cpp new file mode 100644 index 00000000..0b8a4296 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFbou.cpp @@ -0,0 +1,897 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = mix->viscosity() / mu_scale; + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = odg2+uinf2; + T t4 = odg3+uinf3; + T t5 = odg4+uinf4; + T t6 = odg5+uinf5; + T t7 = odg6+uinf6; + T t8 = param22*udg1; + T t9 = param22*udg2; + T t10 = param22*udg3; + T t11 = param22*udg4; + T t12 = param22*udg5; + T t13 = param22*param22; + T t14 = udg1*udg1; + T t15 = udg2*udg2; + T t16 = udg3*udg3; + T t17 = udg4*udg4; + T t18 = udg5*udg5; + T t19 = udg6*udg6; + T t20 = udg7*udg7; + T t26 = 1.0/3.141592653589793; + T t27 = odg1*param21*uinf20; + T t28 = 1.0/param19; + T t29 = 1.0/param20; + T t21 = atan(t8); + T t22 = atan(t9); + T t23 = atan(t10); + T t24 = atan(t11); + T t25 = atan(t12); + T t30 = t8*t8; + T t31 = t9*t9; + T t32 = t10*t10; + T t33 = t11*t11; + T t34 = t12*t12; + T t35 = t2*t26; + T t49 = t28*t29*uinf13; + T t36 = t35*5.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t32+1.0; + T t40 = t33+1.0; + T t41 = t34+1.0; + T t42 = t21*t26; + T t43 = t22*t26; + T t44 = t23*t26; + T t45 = t24*t26; + T t46 = t25*t26; + T t47 = -t35; + T t60 = t27+t49; + T t48 = -t36; + T t50 = 1.0/t37; + T t51 = 1.0/t38; + T t52 = 1.0/t39; + T t53 = 1.0/t40; + T t54 = 1.0/t41; + T t55 = t42+1.0/2.0; + T t56 = t43+1.0/2.0; + T t57 = t44+1.0/2.0; + T t58 = t45+1.0/2.0; + T t59 = t46+1.0/2.0; + T t61 = t55*udg1; + T t62 = t56*udg2; + T t63 = t57*udg3; + T t64 = t58*udg4; + T t65 = t59*udg5; + T t66 = t8*t26*t50; + T t67 = t9*t26*t51; + T t68 = t10*t26*t52; + T t69 = t11*t26*t53; + T t70 = t12*t26*t54; + T t71 = t47+t61+1.0/2.0; + T t72 = t47+t62+1.0/2.0; + T t73 = t47+t63+1.0/2.0; + T t74 = t47+t64+1.0/2.0; + T t75 = t47+t65+1.0/2.0; + T t76 = t55+t66; + T t77 = t56+t67; + T t78 = t57+t68; + T t79 = t58+t69; + T t80 = t59+t70; + T t91 = t48+t61+t62+t63+t64+t65+5.0/2.0; + T t81 = t76*udg9; + T t82 = t77*udg10; + T t83 = t78*udg11; + T t84 = t76*udg17; + T t85 = t79*udg12; + T t86 = t77*udg18; + T t87 = t80*udg13; + T t88 = t78*udg19; + T t89 = t79*udg20; + T t90 = t80*udg21; + T t92 = 1.0/t91; + T t93 = t92*t92; + T t94 = t92*udg8; + T t95 = t92*uinf1; + T t96 = t92*udg6*udg7; + T t99 = t81*t91; + T t100 = t82*t91; + T t101 = t83*t91; + T t102 = t84*t91; + T t103 = t85*t91; + T t104 = t86*t91; + T t105 = t87*t91; + T t106 = t88*t91; + T t107 = t89*t91; + T t108 = t90*t91; + T t119 = t81+t82+t83+t85+t87; + T t120 = t84+t86+t88+t89+t90; + T t97 = (t19*t93)/2.0; + T t98 = (t20*t93)/2.0; + T t109 = -t99; + T t110 = -t100; + T t111 = -t101; + T t112 = -t102; + T t113 = -t103; + T t114 = -t104; + T t115 = -t105; + T t116 = -t106; + T t117 = -t107; + T t118 = -t108; + T t121 = t94+t95; + T t123 = t71*t119; + T t124 = t72*t119; + T t125 = t73*t119; + T t126 = t74*t119; + T t127 = t75*t119; + T t128 = t71*t120; + T t129 = t72*t120; + T t130 = t73*t120; + T t131 = t74*t120; + T t132 = t75*t120; + T t133 = t92*t119*udg6; + T t134 = t92*t119*udg7; + T t135 = t92*t120*udg6; + T t136 = t92*t120*udg7; + T t122 = t97+t98; + T t137 = -t133; + T t138 = -t134; + T t139 = -t135; + T t140 = -t136; + T t145 = t109+t123; + T t146 = t110+t124; + T t147 = t111+t125; + T t148 = t113+t126; + T t149 = t115+t127; + T t150 = t112+t128; + T t151 = t114+t129; + T t152 = t116+t130; + T t153 = t117+t131; + T t154 = t118+t132; + T t155 = -t92*(t133-udg14); + T t156 = -t92*(t134-udg15); + T t157 = -t92*(t135-udg22); + T t158 = -t92*(t136-udg23); + T t159 = t92*(t133-udg14)*-2.0; + T t160 = t92*(t136-udg23)*-2.0; + T t161 = t92*(t136-udg23); + T t163 = -t3*t92*(t99-t123); + T t164 = -t3*t93*(t99-t123); + T t165 = -t4*t92*(t100-t124); + T t166 = -t4*t93*(t100-t124); + T t167 = -t5*t92*(t101-t125); + T t168 = -t5*t93*(t101-t125); + T t169 = -t6*t92*(t103-t126); + T t170 = -t6*t93*(t103-t126); + T t171 = -t7*t92*(t105-t127); + T t172 = -t7*t93*(t105-t127); + T t173 = -t3*t92*(t102-t128); + T t174 = -t3*t93*(t102-t128); + T t175 = -t4*t92*(t104-t129); + T t176 = -t4*t93*(t104-t129); + T t177 = -t5*t92*(t106-t130); + T t178 = -t5*t93*(t106-t130); + T t179 = -t6*t92*(t107-t131); + T t180 = -t6*t93*(t107-t131); + T t181 = -t7*t92*(t108-t132); + T t182 = -t7*t93*(t108-t132); + T t183 = t3*t92*(t99-t123); + T t184 = t4*t92*(t100-t124); + T t185 = t5*t92*(t101-t125); + T t186 = t6*t92*(t103-t126); + T t187 = t7*t92*(t105-t127); + T t188 = t3*t92*(t102-t128); + T t189 = t4*t92*(t104-t129); + T t190 = t5*t92*(t106-t130); + T t191 = t6*t92*(t107-t131); + T t192 = t7*t92*(t108-t132); + T t198 = -t29*uinf12*(t92*(t134-udg15)+t92*(t135-udg22)); + T t205 = -t71*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t206 = -t72*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t207 = -t73*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t208 = -t74*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t209 = -t75*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t210 = -t71*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t211 = -t72*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t212 = -t73*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t213 = -t74*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t214 = -t75*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t141 = t137+udg14; + T t142 = t138+udg15; + T t143 = t139+udg22; + T t144 = t140+udg23; + T t162 = t161*2.0; + T t193 = t155+t158; + T t194 = t156+t157; + T t195 = -odg1*(t161+t92*(t133-udg14)); + T t197 = t159+t161; + T t199 = t29*uinf12*(t160+t92*(t133-udg14))*(-2.0/3.0); + T t200 = t29*uinf12*(t160+t92*(t133-udg14))*(2.0/3.0); + T t201 = t29*uinf12*(t158+t92*(t133-udg14)*2.0)*(-2.0/3.0); + T t202 = t96+t198; + T t203 = t164+t166+t168+t170+t172; + T t204 = t174+t176+t178+t180+t182; + T t196 = t155+t162; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t183+t205+t71*t92*udg6)+nlg2*(t188+t210+t71*t92*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t184+t206+t72*t92*udg6)+nlg2*(t189+t211+t72*t92*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t185+t207+t73*t92*udg6)+nlg2*(t190+t212+t73*t92*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t186+t208+t74*t92*udg6)+nlg2*(t191+t213+t74*t92*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t187+t209+t75*t92*udg6)+nlg2*(t192+t214+t75*t92*udg7); + f[5*ng+i] = nlg2*t202+tau6*(udg6-uhg6)+nlg1*(t195+t201+uinf1+t19*t92); + f[6*ng+i] = nlg1*t202+tau7*(udg7-uhg7)+nlg2*(t195+t200+uinf1+t20*t92); + f[7*ng+i] = -nlg2*(-t121*udg7+uinf7*(t173+t71*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf8*(t175+t72*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf9*(t177+t73*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf10*(t179+t74*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf11*(t181+t75*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))-t60*(uinf19*(udg24+t91*(t93*udg6*(t135-udg22)+t93*udg7*(t136-udg23))-t120*t122)+t84*uinf14+t86*uinf15+t88*uinf16+t89*uinf17+t90*uinf18)+t92*udg7*(t199+odg1*(t161+t92*(t133-udg14)))+t29*t92*udg6*uinf12*(t92*(t134-udg15)+t92*(t135-udg22)))+tau8*(udg8-uhg8)-nlg1*(-t121*udg6+uinf7*(t163+t71*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf8*(t165+t72*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf9*(t167+t73*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf10*(t169+t74*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf11*(t171+t75*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))-t60*(uinf19*(udg16+t91*(t93*udg6*(t133-udg14)+t93*udg7*(t134-udg15))-t119*t122)+t81*uinf14+t82*uinf15+t83*uinf16+t85*uinf17+t87*uinf18)+t92*udg6*(odg1*(t161+t92*(t133-udg14))+t29*uinf12*(t158+t92*(t133-udg14)*2.0)*(2.0/3.0))+t29*t92*udg7*uinf12*(t92*(t134-udg15)+t92*(t135-udg22))); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = mix->viscosity() / mu_scale; + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = odg2+uinf2; + T t4 = odg3+uinf3; + T t5 = odg4+uinf4; + T t6 = odg5+uinf5; + T t7 = odg6+uinf6; + T t8 = param22*udg1; + T t9 = param22*udg2; + T t10 = param22*udg3; + T t11 = param22*udg4; + T t12 = param22*udg5; + T t13 = param22*param22; + T t14 = udg1*udg1; + T t15 = udg2*udg2; + T t16 = udg3*udg3; + T t17 = udg4*udg4; + T t18 = udg5*udg5; + T t19 = udg6*udg6; + T t20 = udg7*udg7; + T t26 = 1.0/3.141592653589793; + T t27 = odg1*param21*uinf20; + T t28 = 1.0/param19; + T t29 = 1.0/param20; + T t21 = atan(t8); + T t22 = atan(t9); + T t23 = atan(t10); + T t24 = atan(t11); + T t25 = atan(t12); + T t30 = t8*t8; + T t31 = t9*t9; + T t32 = t10*t10; + T t33 = t11*t11; + T t34 = t12*t12; + T t35 = t2*t26; + T t49 = t28*t29*uinf13; + T t36 = t35*5.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t32+1.0; + T t40 = t33+1.0; + T t41 = t34+1.0; + T t42 = t21*t26; + T t43 = t22*t26; + T t44 = t23*t26; + T t45 = t24*t26; + T t46 = t25*t26; + T t47 = -t35; + T t60 = t27+t49; + T t48 = -t36; + T t50 = 1.0/t37; + T t51 = 1.0/t38; + T t52 = 1.0/t39; + T t53 = 1.0/t40; + T t54 = 1.0/t41; + T t55 = t42+1.0/2.0; + T t56 = t43+1.0/2.0; + T t57 = t44+1.0/2.0; + T t58 = t45+1.0/2.0; + T t59 = t46+1.0/2.0; + T t61 = t55*udg1; + T t62 = t56*udg2; + T t63 = t57*udg3; + T t64 = t58*udg4; + T t65 = t59*udg5; + T t66 = t8*t26*t50; + T t67 = t9*t26*t51; + T t68 = t10*t26*t52; + T t69 = t11*t26*t53; + T t70 = t12*t26*t54; + T t71 = t47+t61+1.0/2.0; + T t72 = t47+t62+1.0/2.0; + T t73 = t47+t63+1.0/2.0; + T t74 = t47+t64+1.0/2.0; + T t75 = t47+t65+1.0/2.0; + T t76 = t55+t66; + T t77 = t56+t67; + T t78 = t57+t68; + T t79 = t58+t69; + T t80 = t59+t70; + T t91 = t48+t61+t62+t63+t64+t65+5.0/2.0; + T t81 = t76*udg9; + T t82 = t77*udg10; + T t83 = t78*udg11; + T t84 = t76*udg17; + T t85 = t79*udg12; + T t86 = t77*udg18; + T t87 = t80*udg13; + T t88 = t78*udg19; + T t89 = t79*udg20; + T t90 = t80*udg21; + T t92 = 1.0/t91; + T t93 = t92*t92; + T t94 = t92*udg8; + T t95 = t92*uinf1; + T t96 = t92*udg6*udg7; + T t99 = t81*t91; + T t100 = t82*t91; + T t101 = t83*t91; + T t102 = t84*t91; + T t103 = t85*t91; + T t104 = t86*t91; + T t105 = t87*t91; + T t106 = t88*t91; + T t107 = t89*t91; + T t108 = t90*t91; + T t119 = t81+t82+t83+t85+t87; + T t120 = t84+t86+t88+t89+t90; + T t97 = (t19*t93)/2.0; + T t98 = (t20*t93)/2.0; + T t109 = -t99; + T t110 = -t100; + T t111 = -t101; + T t112 = -t102; + T t113 = -t103; + T t114 = -t104; + T t115 = -t105; + T t116 = -t106; + T t117 = -t107; + T t118 = -t108; + T t121 = t94+t95; + T t123 = t71*t119; + T t124 = t72*t119; + T t125 = t73*t119; + T t126 = t74*t119; + T t127 = t75*t119; + T t128 = t71*t120; + T t129 = t72*t120; + T t130 = t73*t120; + T t131 = t74*t120; + T t132 = t75*t120; + T t133 = t92*t119*udg6; + T t134 = t92*t119*udg7; + T t135 = t92*t120*udg6; + T t136 = t92*t120*udg7; + T t122 = t97+t98; + T t137 = -t133; + T t138 = -t134; + T t139 = -t135; + T t140 = -t136; + T t145 = t109+t123; + T t146 = t110+t124; + T t147 = t111+t125; + T t148 = t113+t126; + T t149 = t115+t127; + T t150 = t112+t128; + T t151 = t114+t129; + T t152 = t116+t130; + T t153 = t117+t131; + T t154 = t118+t132; + T t155 = -t92*(t133-udg14); + T t156 = -t92*(t134-udg15); + T t157 = -t92*(t135-udg22); + T t158 = -t92*(t136-udg23); + T t159 = t92*(t133-udg14)*-2.0; + T t160 = t92*(t136-udg23)*-2.0; + T t161 = t92*(t136-udg23); + T t163 = -t3*t92*(t99-t123); + T t164 = -t3*t93*(t99-t123); + T t165 = -t4*t92*(t100-t124); + T t166 = -t4*t93*(t100-t124); + T t167 = -t5*t92*(t101-t125); + T t168 = -t5*t93*(t101-t125); + T t169 = -t6*t92*(t103-t126); + T t170 = -t6*t93*(t103-t126); + T t171 = -t7*t92*(t105-t127); + T t172 = -t7*t93*(t105-t127); + T t173 = -t3*t92*(t102-t128); + T t174 = -t3*t93*(t102-t128); + T t175 = -t4*t92*(t104-t129); + T t176 = -t4*t93*(t104-t129); + T t177 = -t5*t92*(t106-t130); + T t178 = -t5*t93*(t106-t130); + T t179 = -t6*t92*(t107-t131); + T t180 = -t6*t93*(t107-t131); + T t181 = -t7*t92*(t108-t132); + T t182 = -t7*t93*(t108-t132); + T t183 = t3*t92*(t99-t123); + T t184 = t4*t92*(t100-t124); + T t185 = t5*t92*(t101-t125); + T t186 = t6*t92*(t103-t126); + T t187 = t7*t92*(t105-t127); + T t188 = t3*t92*(t102-t128); + T t189 = t4*t92*(t104-t129); + T t190 = t5*t92*(t106-t130); + T t191 = t6*t92*(t107-t131); + T t192 = t7*t92*(t108-t132); + T t198 = -t29*uinf12*(t92*(t134-udg15)+t92*(t135-udg22)); + T t205 = -t71*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t206 = -t72*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t207 = -t73*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t208 = -t74*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t209 = -t75*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t210 = -t71*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t211 = -t72*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t212 = -t73*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t213 = -t74*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t214 = -t75*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t141 = t137+udg14; + T t142 = t138+udg15; + T t143 = t139+udg22; + T t144 = t140+udg23; + T t162 = t161*2.0; + T t193 = t155+t158; + T t194 = t156+t157; + T t195 = -odg1*(t161+t92*(t133-udg14)); + T t197 = t159+t161; + T t199 = t29*uinf12*(t160+t92*(t133-udg14))*(-2.0/3.0); + T t200 = t29*uinf12*(t160+t92*(t133-udg14))*(2.0/3.0); + T t201 = t29*uinf12*(t158+t92*(t133-udg14)*2.0)*(-2.0/3.0); + T t202 = t96+t198; + T t203 = t164+t166+t168+t170+t172; + T t204 = t174+t176+t178+t180+t182; + T t196 = t155+t162; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t183+t205+t71*t92*udg6)+nlg2*(t188+t210+t71*t92*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t184+t206+t72*t92*udg6)+nlg2*(t189+t211+t72*t92*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t185+t207+t73*t92*udg6)+nlg2*(t190+t212+t73*t92*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t186+t208+t74*t92*udg6)+nlg2*(t191+t213+t74*t92*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t187+t209+t75*t92*udg6)+nlg2*(t192+t214+t75*t92*udg7); + f[5*ng+i] = nlg2*t202+tau6*(udg6-uhg6)+nlg1*(t195+t201+uinf1+t19*t92); + f[6*ng+i] = nlg1*t202+tau7*(udg7-uhg7)+nlg2*(t195+t200+uinf1+t20*t92); + f[7*ng+i] = -nlg2*(-t121*udg7+uinf7*(t173+t71*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf8*(t175+t72*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf9*(t177+t73*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf10*(t179+t74*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+uinf11*(t181+t75*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))-t60*(uinf19*(udg24+t91*(t93*udg6*(t135-udg22)+t93*udg7*(t136-udg23))-t120*t122)+t84*uinf14+t86*uinf15+t88*uinf16+t89*uinf17+t90*uinf18)+t92*udg7*(t199+odg1*(t161+t92*(t133-udg14)))+t29*t92*udg6*uinf12*(t92*(t134-udg15)+t92*(t135-udg22)))+tau8*(udg8-uhg8)-nlg1*(-t121*udg6+uinf7*(t163+t71*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf8*(t165+t72*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf9*(t167+t73*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf10*(t169+t74*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+uinf11*(t171+t75*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))-t60*(uinf19*(udg16+t91*(t93*udg6*(t133-udg14)+t93*udg7*(t134-udg15))-t119*t122)+t81*uinf14+t82*uinf15+t83*uinf16+t85*uinf17+t87*uinf18)+t92*udg6*(odg1*(t161+t92*(t133-udg14))+t29*uinf12*(t158+t92*(t133-udg14)*2.0)*(2.0/3.0))+t29*t92*udg7*uinf12*(t92*(t134-udg15)+t92*(t135-udg22))); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf12 = mix->viscosity() / mu_scale; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t19 = 1.0/3.141592653589793; + T t20 = 1.0/param20; + T t14 = atan(t3); + T t15 = atan(t4); + T t16 = atan(t5); + T t17 = atan(t6); + T t18 = atan(t7); + T t21 = t3*t3; + T t22 = t4*t4; + T t23 = t5*t5; + T t24 = t6*t6; + T t25 = t7*t7; + T t26 = t2*t19*5.0; + T t27 = t21+1.0; + T t28 = t22+1.0; + T t29 = t23+1.0; + T t30 = t24+1.0; + T t31 = t25+1.0; + T t32 = t14*t19; + T t33 = t15*t19; + T t34 = t16*t19; + T t35 = t17*t19; + T t36 = t18*t19; + T t37 = -t26; + T t38 = 1.0/t27; + T t39 = 1.0/t28; + T t40 = 1.0/t29; + T t41 = 1.0/t30; + T t42 = 1.0/t31; + T t43 = t32+1.0/2.0; + T t44 = t33+1.0/2.0; + T t45 = t34+1.0/2.0; + T t46 = t35+1.0/2.0; + T t47 = t36+1.0/2.0; + T t48 = t43*udg1; + T t49 = t44*udg2; + T t50 = t45*udg3; + T t51 = t46*udg4; + T t52 = t47*udg5; + T t53 = t3*t19*t38; + T t54 = t4*t19*t39; + T t55 = t5*t19*t40; + T t56 = t6*t19*t41; + T t57 = t7*t19*t42; + T t58 = t43+t53; + T t59 = t44+t54; + T t60 = t45+t55; + T t61 = t46+t56; + T t62 = t47+t57; + T t73 = t37+t48+t49+t50+t51+t52+5.0/2.0; + T t63 = t58*udg9; + T t64 = t59*udg10; + T t65 = t60*udg11; + T t66 = t58*udg17; + T t67 = t61*udg12; + T t68 = t59*udg18; + T t69 = t62*udg13; + T t70 = t60*udg19; + T t71 = t61*udg20; + T t72 = t62*udg21; + T t74 = 1.0/t73; + T t75 = t74*udg6*udg7; + T t76 = t63+t64+t65+t67+t69; + T t77 = t66+t68+t70+t71+t72; + T t78 = t74*t76*udg6; + T t79 = t74*t76*udg7; + T t80 = t74*t77*udg6; + T t81 = t74*t77*udg7; + T t82 = -t78; + T t83 = -t79; + T t84 = -t80; + T t85 = -t81; + T t90 = -t74*(t78-udg14); + T t91 = -t74*(t79-udg15); + T t92 = -t74*(t80-udg22); + T t93 = -t74*(t81-udg23); + T t96 = -odg1*(t74*(t78-udg14)+t74*(t81-udg23)); + T t97 = -t20*uinf12*(t74*(t79-udg15)+t74*(t80-udg22)); + T t86 = t82+udg14; + T t87 = t83+udg15; + T t88 = t84+udg22; + T t89 = t85+udg23; + T t94 = t90+t93; + T t95 = t91+t92; + T t98 = t75+t97; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg2*t98+nlg1*(t96+uinf1+t74*(udg6*udg6)-t20*uinf12*(t93+t74*(t78-udg14)*2.0)*(2.0/3.0))+tau6*(udg6-uhg6); + f[6*ng+i] = nlg1*t98+nlg2*(t96+uinf1+t74*(udg7*udg7)+t20*uinf12*(t74*(t78-udg14)-t74*(t81-udg23)*2.0)*(2.0/3.0))+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFhat.cpp new file mode 100644 index 00000000..cba1b474 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFhat.cpp @@ -0,0 +1,6 @@ +template void opuFhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuFhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFlux.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFlux.cpp new file mode 100644 index 00000000..ff50890b --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuFlux.cpp @@ -0,0 +1,344 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = mix->viscosity() / mu_scale; + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = odg2+uinf2; + T t4 = odg3+uinf3; + T t5 = odg4+uinf4; + T t6 = odg5+uinf5; + T t7 = odg6+uinf6; + T t8 = param22*udg1; + T t9 = param22*udg2; + T t10 = param22*udg3; + T t11 = param22*udg4; + T t12 = param22*udg5; + T t13 = param22*param22; + T t14 = udg1*udg1; + T t15 = udg2*udg2; + T t16 = udg3*udg3; + T t17 = udg4*udg4; + T t18 = udg5*udg5; + T t19 = udg6*udg6; + T t20 = udg7*udg7; + T t26 = 1.0/3.141592653589793; + T t27 = odg1*param21*uinf20; + T t28 = 1.0/param19; + T t29 = 1.0/param20; + T t21 = atan(t8); + T t22 = atan(t9); + T t23 = atan(t10); + T t24 = atan(t11); + T t25 = atan(t12); + T t30 = t8*t8; + T t31 = t9*t9; + T t32 = t10*t10; + T t33 = t11*t11; + T t34 = t12*t12; + T t35 = t2*t26; + T t49 = t28*t29*uinf13; + T t36 = t35*5.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t32+1.0; + T t40 = t33+1.0; + T t41 = t34+1.0; + T t42 = t21*t26; + T t43 = t22*t26; + T t44 = t23*t26; + T t45 = t24*t26; + T t46 = t25*t26; + T t47 = -t35; + T t60 = t27+t49; + T t48 = -t36; + T t50 = 1.0/t37; + T t51 = 1.0/t38; + T t52 = 1.0/t39; + T t53 = 1.0/t40; + T t54 = 1.0/t41; + T t55 = t42+1.0/2.0; + T t56 = t43+1.0/2.0; + T t57 = t44+1.0/2.0; + T t58 = t45+1.0/2.0; + T t59 = t46+1.0/2.0; + T t61 = t55*udg1; + T t62 = t56*udg2; + T t63 = t57*udg3; + T t64 = t58*udg4; + T t65 = t59*udg5; + T t66 = t8*t26*t50; + T t67 = t9*t26*t51; + T t68 = t10*t26*t52; + T t69 = t11*t26*t53; + T t70 = t12*t26*t54; + T t71 = t47+t61+1.0/2.0; + T t72 = t47+t62+1.0/2.0; + T t73 = t47+t63+1.0/2.0; + T t74 = t47+t64+1.0/2.0; + T t75 = t47+t65+1.0/2.0; + T t76 = t55+t66; + T t77 = t56+t67; + T t78 = t57+t68; + T t79 = t58+t69; + T t80 = t59+t70; + T t91 = t48+t61+t62+t63+t64+t65+5.0/2.0; + T t81 = t76*udg9; + T t82 = t77*udg10; + T t83 = t78*udg11; + T t84 = t76*udg17; + T t85 = t79*udg12; + T t86 = t77*udg18; + T t87 = t80*udg13; + T t88 = t78*udg19; + T t89 = t79*udg20; + T t90 = t80*udg21; + T t92 = 1.0/t91; + T t93 = t92*t92; + T t94 = t92*udg8; + T t95 = t92*uinf1; + T t96 = t92*udg6*udg7; + T t99 = t81*t91; + T t100 = t82*t91; + T t101 = t83*t91; + T t102 = t84*t91; + T t103 = t85*t91; + T t104 = t86*t91; + T t105 = t87*t91; + T t106 = t88*t91; + T t107 = t89*t91; + T t108 = t90*t91; + T t119 = t81+t82+t83+t85+t87; + T t120 = t84+t86+t88+t89+t90; + T t97 = (t19*t93)/2.0; + T t98 = (t20*t93)/2.0; + T t109 = -t99; + T t110 = -t100; + T t111 = -t101; + T t112 = -t102; + T t113 = -t103; + T t114 = -t104; + T t115 = -t105; + T t116 = -t106; + T t117 = -t107; + T t118 = -t108; + T t121 = t94+t95; + T t123 = t71*t119; + T t124 = t72*t119; + T t125 = t73*t119; + T t126 = t74*t119; + T t127 = t75*t119; + T t128 = t71*t120; + T t129 = t72*t120; + T t130 = t73*t120; + T t131 = t74*t120; + T t132 = t75*t120; + T t133 = t92*t119*udg6; + T t134 = t92*t119*udg7; + T t135 = t92*t120*udg6; + T t136 = t92*t120*udg7; + T t122 = t97+t98; + T t137 = -t133; + T t138 = -t134; + T t139 = -t135; + T t140 = -t136; + T t145 = t109+t123; + T t146 = t110+t124; + T t147 = t111+t125; + T t148 = t113+t126; + T t149 = t115+t127; + T t150 = t112+t128; + T t151 = t114+t129; + T t152 = t116+t130; + T t153 = t117+t131; + T t154 = t118+t132; + T t155 = -t92*(t133-udg14); + T t156 = -t92*(t134-udg15); + T t157 = -t92*(t135-udg22); + T t158 = -t92*(t136-udg23); + T t159 = t92*(t133-udg14)*-2.0; + T t160 = t92*(t136-udg23)*-2.0; + T t161 = t92*(t136-udg23); + T t163 = -t3*t92*(t99-t123); + T t164 = -t3*t93*(t99-t123); + T t165 = -t4*t92*(t100-t124); + T t166 = -t4*t93*(t100-t124); + T t167 = -t5*t92*(t101-t125); + T t168 = -t5*t93*(t101-t125); + T t169 = -t6*t92*(t103-t126); + T t170 = -t6*t93*(t103-t126); + T t171 = -t7*t92*(t105-t127); + T t172 = -t7*t93*(t105-t127); + T t173 = -t3*t92*(t102-t128); + T t174 = -t3*t93*(t102-t128); + T t175 = -t4*t92*(t104-t129); + T t176 = -t4*t93*(t104-t129); + T t177 = -t5*t92*(t106-t130); + T t178 = -t5*t93*(t106-t130); + T t179 = -t6*t92*(t107-t131); + T t180 = -t6*t93*(t107-t131); + T t181 = -t7*t92*(t108-t132); + T t182 = -t7*t93*(t108-t132); + T t183 = t3*t92*(t99-t123); + T t184 = t4*t92*(t100-t124); + T t185 = t5*t92*(t101-t125); + T t186 = t6*t92*(t103-t126); + T t187 = t7*t92*(t105-t127); + T t188 = t3*t92*(t102-t128); + T t189 = t4*t92*(t104-t129); + T t190 = t5*t92*(t106-t130); + T t191 = t6*t92*(t107-t131); + T t192 = t7*t92*(t108-t132); + T t198 = -t29*uinf12*(t92*(t134-udg15)+t92*(t135-udg22)); + T t205 = -t71*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t206 = -t72*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t207 = -t73*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t208 = -t74*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t209 = -t75*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)); + T t210 = -t71*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t211 = -t72*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t212 = -t73*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t213 = -t74*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t214 = -t75*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)); + T t141 = t137+udg14; + T t142 = t138+udg15; + T t143 = t139+udg22; + T t144 = t140+udg23; + T t162 = t161*2.0; + T t193 = t155+t158; + T t194 = t156+t157; + T t195 = -odg1*(t161+t92*(t133-udg14)); + T t197 = t159+t161; + T t199 = t29*uinf12*(t160+t92*(t133-udg14))*(-2.0/3.0); + T t200 = t29*uinf12*(t160+t92*(t133-udg14))*(2.0/3.0); + T t201 = t29*uinf12*(t158+t92*(t133-udg14)*2.0)*(-2.0/3.0); + T t202 = t96+t198; + T t203 = t164+t166+t168+t170+t172; + T t204 = t174+t176+t178+t180+t182; + T t196 = t155+t162; + f[0*ng+i] = t183+t205+t71*t92*udg6; + f[1*ng+i] = t184+t206+t72*t92*udg6; + f[2*ng+i] = t185+t207+t73*t92*udg6; + f[3*ng+i] = t186+t208+t74*t92*udg6; + f[4*ng+i] = t187+t209+t75*t92*udg6; + f[5*ng+i] = t195+t201+uinf1+t19*t92; + f[6*ng+i] = t202; + f[7*ng+i] = t121*udg6-uinf7*(t163+t71*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))-uinf8*(t165+t72*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))-uinf9*(t167+t73*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))-uinf10*(t169+t74*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))-uinf11*(t171+t75*(t3*t93*(t99-t123)+t4*t93*(t100-t124)+t5*t93*(t101-t125)+t6*t93*(t103-t126)+t7*t93*(t105-t127)))+t60*(uinf19*(udg16+t91*(t93*udg6*(t133-udg14)+t93*udg7*(t134-udg15))-t119*t122)+t81*uinf14+t82*uinf15+t83*uinf16+t85*uinf17+t87*uinf18)-t92*udg6*(odg1*(t161+t92*(t133-udg14))+t29*uinf12*(t158+t92*(t133-udg14)*2.0)*(2.0/3.0))+t92*t198*udg7; + f[8*ng+i] = t188+t210+t71*t92*udg7; + f[9*ng+i] = t189+t211+t72*t92*udg7; + f[10*ng+i] = t190+t212+t73*t92*udg7; + f[11*ng+i] = t191+t213+t74*t92*udg7; + f[12*ng+i] = t192+t214+t75*t92*udg7; + f[13*ng+i] = t202; + f[14*ng+i] = t195+t200+uinf1+t20*t92; + f[15*ng+i] = t121*udg7-uinf7*(t173+t71*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))-uinf8*(t175+t72*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))-uinf9*(t177+t73*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))-uinf10*(t179+t74*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))-uinf11*(t181+t75*(t3*t93*(t102-t128)+t4*t93*(t104-t129)+t5*t93*(t106-t130)+t6*t93*(t107-t131)+t7*t93*(t108-t132)))+t60*(uinf19*(udg24+t91*(t93*udg6*(t135-udg22)+t93*udg7*(t136-udg23))-t120*t122)+t84*uinf14+t86*uinf15+t88*uinf16+t89*uinf17+t90*uinf18)-t92*udg7*(t199+odg1*(t161+t92*(t133-udg14)))+t92*t198*udg6; + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitodg.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitodg.cpp new file mode 100644 index 00000000..1e0174b0 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitodg.cpp @@ -0,0 +1,6 @@ +template void opuInitodg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitodg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitodg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitq.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitq.cpp new file mode 100644 index 00000000..c557795d --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitq.cpp @@ -0,0 +1,6 @@ +template void opuInitq(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitq(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitq(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitu.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitu.cpp new file mode 100644 index 00000000..e007a61e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitu.cpp @@ -0,0 +1,33 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitudg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitudg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitudg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitwdg.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitwdg.cpp new file mode 100644 index 00000000..5217d5ee --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuInitwdg.cpp @@ -0,0 +1,6 @@ +template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuOutput.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuOutput.cpp new file mode 100644 index 00000000..d4694117 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuOutput.cpp @@ -0,0 +1,87 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + double wdot[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + + f[j+npe*0+npe*nce*k] = odg2; + f[j+npe*1+npe*nce*k] = odg3; + f[j+npe*2+npe*nce*k] = odg4; + f[j+npe*3+npe*nce*k] = odg5; + f[j+npe*4+npe*nce*k] = odg6; + f[j+npe*5+npe*nce*k] = mix->P(); + f[j+npe*6+npe*nce*k] = mix->T(); + f[j+npe*7+npe*nce*k] = mix->mixtureFrozenGamma(); + f[j+npe*8+npe*nce*k] = rhoe; + f[j+npe*9+npe*nce*k] = odg1; + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSource.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSource.cpp new file mode 100644 index 00000000..3a181845 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSource.cpp @@ -0,0 +1,67 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + double wdot[5]; + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + f[7*ng+i] = 0.0; + + // T t2 = atan(param22); + // T t3 = 1.0/3.141592653589793; + // T t4 = t2*t3; + // T t5 = -t4; + // f[0*ng+i] = t5+udg1*(t3*atan(param22*udg1)+1.0/2.0)+1.0/2.0; + // f[1*ng+i] = t5+udg2*(t3*atan(param22*udg2)+1.0/2.0)+1.0/2.0; + // f[2*ng+i] = t5+udg3*(t3*atan(param22*udg3)+1.0/2.0)+1.0/2.0; + // f[3*ng+i] = t5+udg4*(t3*atan(param22*udg4)+1.0/2.0)+1.0/2.0; + // f[4*ng+i] = t5+udg5*(t3*atan(param22*udg5)+1.0/2.0)+1.0/2.0; + // f[5*ng+i] = 0.0; + // f[6*ng+i] = 0.0; + // f[7*ng+i] = 0.0; + } +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSourcew.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSourcew.cpp new file mode 100644 index 00000000..e97b7257 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuSourcew.cpp @@ -0,0 +1,6 @@ +template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuSourcew(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSourcew(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuStab.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuStab.cpp new file mode 100644 index 00000000..7fd61560 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuStab.cpp @@ -0,0 +1,6 @@ +template void opuStab(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuStab(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuStab(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuTdfunc.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuTdfunc.cpp new file mode 100644 index 00000000..f20d744b --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuTdfunc.cpp @@ -0,0 +1,16 @@ +template void opuTdfunc(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuUbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuUhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuUhat.cpp new file mode 100644 index 00000000..ba30d409 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_Di_regen/opuUhat.cpp @@ -0,0 +1,6 @@ +template void opuUhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuUhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp.cpp new file mode 100644 index 00000000..b7986bec --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup, enzyme_dupnoneed; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dupnoneed, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dupnoneed, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp_MPP.cpp new file mode 100644 index 00000000..730e9a6e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuApp_MPP.cpp @@ -0,0 +1,238 @@ +#ifndef __OPUAPP +#define __OPUAPP +#include +#include + +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#endif + +#include "opuFlux.cpp" +#include "opuSource.cpp" +#include "opuSourcew.cpp" +//#include "opuEoS.cpp" +#include "opuTdfunc.cpp" +#include "opuAvfield.cpp" +#include "opuOutput.cpp" +#include "opuFbou.cpp" +#include "opuUbou.cpp" +#include "opuFhat.cpp" +#include "opuUhat.cpp" +#include "opuStab.cpp" +#include "opuInitu.cpp" +#include "opuInitq.cpp" +#include "opuInitudg.cpp" +#include "opuInitwdg.cpp" +#include "opuInitodg.cpp" + +#ifdef _ENZYME +template +void __enzyme_autodiff(void*, Args... args); +void __enzyme_fwddiff(void*, ...); +int enzyme_const, enzyme_dup; + +template void opuFluxEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + // printf("Calling opuFLUXEnzyme\n"); + __enzyme_fwddiff((void*)opuFlux, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFluxEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuSourceEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuSource, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuSourceEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuUbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuUbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuUbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFbouEnzyme(T *f, T *df, T *xg, T *udg, T *dudg, T *odg, T *dodg, T *wdg, T *dwdg, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFbou, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg, dudg, + enzyme_dup, odg, dodg, + enzyme_dup, wdg, dwdg, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ib, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} +template void opuFbouEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuFhatEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuFhat, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); +} + +template void opuFhatEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + + +template void opuStabEnzyme(T *f, T *df, T *xg, T *udg1, T *dudg1, T *udg2, T *dudg2, + T *odg1, T *dodg1, T *odg2, T *dodg2, T *wdg1, T *dwdg1, T *wdg2, T *dwdg2, T *uhg, T *duhg, T *nlg, T *tau, T *uinf, T *param, + T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuStab, + enzyme_dup, f, df, + enzyme_const, xg, + enzyme_dup, udg1, dudg1, + enzyme_dup, udg2, dudg2, + enzyme_dup, odg1, dodg1, + enzyme_dup, odg2, dodg2, + enzyme_dup, wdg1, dwdg1, + enzyme_dup, wdg2, dwdg2, + enzyme_dup, uhg, duhg, + enzyme_const, nlg, + enzyme_const, tau, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, mix); + +} +template void opuStabEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, + double, int, int, int, int, int, int, int, int, Mutation::Mixture *); + +template void opuAvfieldEnzyme(T *f, T *df, T *xdg, T *udg, T *dudg, T *odg, T *wdg, T *dwdg, + T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + __enzyme_fwddiff((void*)opuAvfield, + enzyme_dup, f, df, + enzyme_const, xdg, + enzyme_dup, udg, dudg, + enzyme_const, odg, + enzyme_dup, wdg, dwdg, + enzyme_const, uinf, + enzyme_const, param, + enzyme_const, time, + enzyme_const, modelnumber, + enzyme_const, ng, + enzyme_const, nc, + enzyme_const, ncu, + enzyme_const, nd, + enzyme_const, ncx, + enzyme_const, nco, + enzyme_const, ncw, + enzyme_const, nce, + enzyme_const, npe, + enzyme_const, ne, mix); + +} +template void opuAvfieldEnzyme(double *, double *, double *, double *, double *, double *, double *, double *, + double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +#endif + +#endif + diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield.cpp new file mode 100644 index 00000000..9e184233 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield.cpp @@ -0,0 +1,233 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = param22*param22; + T t10 = udg1*udg1; + T t11 = udg2*udg2; + T t12 = udg3*udg3; + T t13 = udg4*udg4; + T t14 = udg5*udg5; + T t15 = uinf2*2.0; + T t16 = uinf2+1.0; + T t22 = 1.0/3.141592653589793; + T t23 = -param23; + T t24 = 1.0/param15; + T t17 = atan(t3); + T t18 = atan(t4); + T t19 = atan(t5); + T t20 = atan(t6); + T t21 = atan(t7); + T t25 = t15-2.0; + T t26 = 1.0/t16; + T t27 = t3*t3; + T t28 = t4*t4; + T t29 = t5*t5; + T t30 = t6*t6; + T t31 = t7*t7; + T t32 = t2*t22; + T t33 = t32*5.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t17*t22; + T t40 = t18*t22; + T t41 = t19*t22; + T t42 = t20*t22; + T t43 = t21*t22; + T t44 = -t32; + T t45 = -t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = 1.0/t36; + T t49 = 1.0/t37; + T t50 = 1.0/t38; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t41+1.0/2.0; + T t54 = t42+1.0/2.0; + T t55 = t43+1.0/2.0; + T t56 = t51*udg1; + T t57 = t52*udg2; + T t58 = t53*udg3; + T t59 = t54*udg4; + T t60 = t55*udg5; + T t61 = t3*t22*t46; + T t62 = t4*t22*t47; + T t63 = t5*t22*t48; + T t64 = t6*t22*t49; + T t65 = t7*t22*t50; + T t66 = t51+t61; + T t67 = t52+t62; + T t68 = t53+t63; + T t69 = t54+t64; + T t70 = t55+t65; + T t81 = t45+t56+t57+t58+t59+t60+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t86 = t71+t72+t73+t75+t77; + T t87 = t74+t76+t78+t79+t80; + T t88 = t84+t85-1.0E-4; + T t93 = t82*t86*udg6; + T t94 = t82*t86*udg7; + T t95 = t82*t87*udg6; + T t96 = t82*t87*udg7; + T t89 = param22*t88; + T t97 = -t93; + T t98 = -t94; + T t99 = -t95; + T t100 = -t96; + T t105 = -t82*(t93-udg14); + T t106 = -t82*(t94-udg15); + T t107 = -t82*(t95-udg22); + T t108 = -t82*(t96-udg23); + T t109 = t82*(t95-udg22); + T t117 = -param22*(-t23+t82*(t93-udg14)+t82*(t96-udg23)); + T t90 = atan(t89); + T t101 = t97+udg14; + T t102 = t98+udg15; + T t103 = t99+udg22; + T t104 = t100+udg23; + T t114 = t106+t109; + T t115 = t23+t105+t108; + T t116 = pow(t107+t82*(t94-udg15),2.0); + T t118 = atan(t117); + T t91 = t22*t90; + T t119 = sqrt(t116); + T t122 = t22*t118; + T t92 = t91+1.0/2.0; + T t120 = param22*t119; + T t124 = t122-1.0/2.0; + T t110 = t88*t92; + T t121 = atan(t120); + T t126 = -t124*(-t23+t82*(t93-udg14)+t82*(t96-udg23)); + T t127 = t124*(-t23+t82*(t93-udg14)+t82*(t96-udg23)); + T t111 = t44+t110+5.001E-1; + T t123 = t22*t121; + T t130 = t8+t32+t127-1.0/2.0; + T t112 = t25*t26*t111; + T t125 = t123+1.0/2.0; + T t131 = param22*t130; + T t113 = 1.0/sqrt(t112); + T t128 = t119*t125; + T t132 = atan(t131); + T t129 = -t128; + T t135 = t22*t132; + T t133 = param23+t32+t129-1.0/2.0; + T t138 = t135-1.0/2.0; + T t134 = param22*t133; + T t140 = t130*t138; + T t136 = atan(t134); + T t143 = param23+t127+t140; + T t137 = t22*t136; + T t144 = t143*t143; + T t145 = t143*t143*t143; + T t139 = t137-1.0/2.0; + T t141 = t133*t139; + T t142 = -t141; + T t146 = t128+t142; + T t147 = t146*t146; + T t148 = t144+t147+1.0E-16; + T t149 = 1.0/t148; + T t150 = odg2*t24*t113*t145*t149; + T t151 = -t150; + T t152 = param17+t151; + T t153 = param22*t152; + T t154 = atan(t153); + T t155 = t22*t154; + T t156 = t155-1.0/2.0; + T t157 = t152*t156; + T t158 = -t157; + T t159 = param18+t32+t158-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t24*t81*(t157-t159*(t22*atan(param22*t159)-1.0/2.0))*sqrt(t112+t83*(udg6*udg6)+t83*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noducros.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noducros.cpp new file mode 100644 index 00000000..33924ce4 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noducros.cpp @@ -0,0 +1,202 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = param22*param22; + T t10 = udg1*udg1; + T t11 = udg2*udg2; + T t12 = udg3*udg3; + T t13 = udg4*udg4; + T t14 = udg5*udg5; + T t15 = uinf2*2.0; + T t16 = uinf2+1.0; + T t22 = 1.0/3.141592653589793; + T t23 = -param23; + T t24 = 1.0/param15; + T t17 = atan(t3); + T t18 = atan(t4); + T t19 = atan(t5); + T t20 = atan(t6); + T t21 = atan(t7); + T t25 = t15-2.0; + T t26 = 1.0/t16; + T t27 = t3*t3; + T t28 = t4*t4; + T t29 = t5*t5; + T t30 = t6*t6; + T t31 = t7*t7; + T t32 = t2*t22; + T t33 = t32*5.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t30+1.0; + T t38 = t31+1.0; + T t39 = t17*t22; + T t40 = t18*t22; + T t41 = t19*t22; + T t42 = t20*t22; + T t43 = t21*t22; + T t44 = -t32; + T t45 = -t33; + T t46 = 1.0/t34; + T t47 = 1.0/t35; + T t48 = 1.0/t36; + T t49 = 1.0/t37; + T t50 = 1.0/t38; + T t51 = t39+1.0/2.0; + T t52 = t40+1.0/2.0; + T t53 = t41+1.0/2.0; + T t54 = t42+1.0/2.0; + T t55 = t43+1.0/2.0; + T t56 = t51*udg1; + T t57 = t52*udg2; + T t58 = t53*udg3; + T t59 = t54*udg4; + T t60 = t55*udg5; + T t61 = t3*t22*t46; + T t62 = t4*t22*t47; + T t63 = t5*t22*t48; + T t64 = t6*t22*t49; + T t65 = t7*t22*t50; + T t66 = t51+t61; + T t67 = t52+t62; + T t68 = t53+t63; + T t69 = t54+t64; + T t70 = t55+t65; + T t81 = t45+t56+t57+t58+t59+t60+5.0/2.0; + T t71 = t66*udg9; + T t72 = t67*udg10; + T t73 = t68*udg11; + T t74 = t66*udg17; + T t75 = t69*udg12; + T t76 = t67*udg18; + T t77 = t70*udg13; + T t78 = t68*udg19; + T t79 = t69*udg20; + T t80 = t70*udg21; + T t82 = 1.0/t81; + T t83 = t82*t82; + T t84 = t82*udg8; + T t85 = t82*uinf1; + T t86 = t71+t72+t73+t75+t77; + T t87 = t74+t76+t78+t79+t80; + T t88 = t84+t85-1.0E-4; + T t93 = t82*t86*udg6; + T t94 = t82*t87*udg7; + T t89 = param22*t88; + T t95 = -t93; + T t96 = -t94; + T t99 = -t82*(t93-udg14); + T t100 = -t82*(t94-udg23); + T t106 = -param22*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t90 = atan(t89); + T t97 = t95+udg14; + T t98 = t96+udg23; + T t105 = t23+t99+t100; + T t107 = atan(t106); + T t91 = t22*t90; + T t108 = t22*t107; + T t92 = t91+1.0/2.0; + T t109 = t108-1.0/2.0; + T t101 = t88*t92; + T t110 = -t109*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t111 = t109*(-t23+t82*(t93-udg14)+t82*(t94-udg23)); + T t102 = t44+t101+5.001E-1; + T t112 = t8+t32+t111-1.0/2.0; + T t103 = t25*t26*t102; + T t113 = param22*t112; + T t104 = 1.0/sqrt(t103); + T t114 = atan(t113); + T t115 = t22*t114; + T t116 = t115-1.0/2.0; + T t117 = t112*t116; + T t118 = param23+t111+t117; + T t119 = odg2*t24*t104*t118; + T t120 = -t119; + T t121 = param17+t120; + T t122 = param22*t121; + T t123 = atan(t122); + T t124 = t22*t123; + T t125 = t124-1.0/2.0; + T t126 = t121*t125; + T t127 = -t126; + T t128 = param18+t32+t127-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t24*t81*(t126-t128*(t22*atan(param22*t128)-1.0/2.0))*sqrt(t103+t83*(udg6*udg6)+t83*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noreg.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noreg.cpp new file mode 100644 index 00000000..6be0e43a --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuAvfield_noreg.cpp @@ -0,0 +1,191 @@ +template void opuAvfield(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + uinf1 = mix->P() / rhoe_scale; + uinf2 = mix->mixtureFrozenGamma(); + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param23*2.0; + T t9 = uinf2*2.0; + T t10 = uinf2+1.0; + T t16 = 1.0/3.141592653589793; + T t17 = -param23; + T t18 = 1.0/param15; + T t21 = udg9+udg10+udg11+udg12+udg13; + T t22 = udg17+udg18+udg19+udg20+udg21; + T t11 = atan(t3); + T t12 = atan(t4); + T t13 = atan(t5); + T t14 = atan(t6); + T t15 = atan(t7); + T t19 = t9-2.0; + T t20 = 1.0/t10; + T t23 = t2*t16; + T t24 = t23*5.0; + T t25 = t11*t16; + T t26 = t12*t16; + T t27 = t13*t16; + T t28 = t14*t16; + T t29 = t15*t16; + T t30 = -t23; + T t31 = -t24; + T t32 = t25+1.0/2.0; + T t33 = t26+1.0/2.0; + T t34 = t27+1.0/2.0; + T t35 = t28+1.0/2.0; + T t36 = t29+1.0/2.0; + T t37 = t32*udg1; + T t38 = t33*udg2; + T t39 = t34*udg3; + T t40 = t35*udg4; + T t41 = t36*udg5; + T t42 = t31+t37+t38+t39+t40+t41+5.0/2.0; + T t43 = 1.0/t42; + T t44 = t43*t43; + T t45 = t43*udg8; + T t46 = t43*uinf1; + T t47 = t21*t43*udg6; + T t48 = t21*t43*udg7; + T t49 = t22*t43*udg6; + T t50 = t22*t43*udg7; + T t51 = -t47; + T t52 = -t48; + T t53 = -t49; + T t54 = -t50; + T t59 = -t43*(t47-udg14); + T t60 = -t43*(t48-udg15); + T t61 = -t43*(t49-udg22); + T t62 = -t43*(t50-udg23); + T t63 = t45+t46-1.0E-4; + T t64 = t43*(t49-udg22); + T t72 = -param22*(-t17+t43*(t47-udg14)+t43*(t50-udg23)); + T t55 = t51+udg14; + T t56 = t52+udg15; + T t57 = t53+udg22; + T t58 = t54+udg23; + T t65 = param22*t63; + T t69 = t60+t64; + T t70 = t17+t59+t62; + T t71 = pow(t61+t43*(t48-udg15),2.0); + T t73 = atan(t72); + T t66 = atan(t65); + T t74 = sqrt(t71); + T t77 = t16*t73; + T t67 = t16*t66; + T t75 = param22*t74; + T t80 = t77-1.0/2.0; + T t68 = t67+1.0/2.0; + T t76 = atan(t75); + T t85 = -t80*(-t17+t43*(t47-udg14)+t43*(t50-udg23)); + T t86 = t80*(-t17+t43*(t47-udg14)+t43*(t50-udg23)); + T t78 = t63*t68; + T t79 = t16*t76; + T t89 = t8+t23+t86-1.0/2.0; + T t81 = t79+1.0/2.0; + T t82 = t30+t78+5.001E-1; + T t90 = param22*t89; + T t83 = t19*t20*t82; + T t87 = t74*t81; + T t91 = atan(t90); + T t84 = 1.0/sqrt(t83); + T t88 = -t87; + T t94 = t16*t91; + T t92 = param23+t23+t88-1.0/2.0; + T t96 = t94-1.0/2.0; + T t93 = param22*t92; + T t99 = t89*t96; + T t95 = atan(t93); + T t101 = param23+t86+t99; + T t97 = t16*t95; + T t102 = t101*t101; + T t103 = t101*t101*t101; + T t98 = t97-1.0/2.0; + T t100 = t92*t98; + T t104 = t88+t100; + T t105 = pow(t87-t100,2.0); + T t106 = t102+t105+1.0E-16; + T t107 = 1.0/t106; + T t108 = odg2*t18*t84*t103*t107; + T t109 = -t108; + T t110 = param17+t109; + T t111 = param22*t110; + T t112 = atan(t111); + T t113 = t16*t112; + T t114 = t113-1.0/2.0; + T t115 = t110*t114; + T t116 = -t115; + T t117 = param18+t23+t116-1.0/2.0; + f[j+npe*0+npe*nce*k] = odg2*param16*t18*t42*(t115-t117*(t16*atan(param22*t117)-1.0/2.0))*sqrt(t83+t44*(udg6*udg6)+t44*(udg7*udg7)); + } +} + +template void opuAvfield(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuAvfield(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFbou.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFbou.cpp new file mode 100644 index 00000000..d408a735 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFbou.cpp @@ -0,0 +1,877 @@ +template void opuFbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = mix->viscosity() / mu_scale; + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t22 = odg1*param21*uinf20; + T t23 = 1.0/param19; + T t24 = 1.0/param20; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t25 = t3*t3; + T t26 = t4*t4; + T t27 = t5*t5; + T t28 = t6*t6; + T t29 = t7*t7; + T t30 = t2*t21; + T t44 = t23*t24*uinf13; + T t31 = t30*5.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t16*t21; + T t38 = t17*t21; + T t39 = t18*t21; + T t40 = t19*t21; + T t41 = t20*t21; + T t42 = -t30; + T t55 = t22+t44; + T t43 = -t31; + T t45 = 1.0/t32; + T t46 = 1.0/t33; + T t47 = 1.0/t34; + T t48 = 1.0/t35; + T t49 = 1.0/t36; + T t50 = t37+1.0/2.0; + T t51 = t38+1.0/2.0; + T t52 = t39+1.0/2.0; + T t53 = t40+1.0/2.0; + T t54 = t41+1.0/2.0; + T t56 = t50*udg1; + T t57 = t51*udg2; + T t58 = t52*udg3; + T t59 = t53*udg4; + T t60 = t54*udg5; + T t61 = t3*t21*t45; + T t62 = t4*t21*t46; + T t63 = t5*t21*t47; + T t64 = t6*t21*t48; + T t65 = t7*t21*t49; + T t66 = t42+t56+1.0/2.0; + T t67 = t42+t57+1.0/2.0; + T t68 = t42+t58+1.0/2.0; + T t69 = t42+t59+1.0/2.0; + T t70 = t42+t60+1.0/2.0; + T t71 = t50+t61; + T t72 = t51+t62; + T t73 = t52+t63; + T t74 = t53+t64; + T t75 = t54+t65; + T t86 = t43+t56+t57+t58+t59+t60+5.0/2.0; + T t76 = t71*udg9; + T t77 = t72*udg10; + T t78 = t73*udg11; + T t79 = t71*udg17; + T t80 = t74*udg12; + T t81 = t72*udg18; + T t82 = t75*udg13; + T t83 = t73*udg19; + T t84 = t74*udg20; + T t85 = t75*udg21; + T t87 = 1.0/t86; + T t88 = t87*t87; + T t89 = t87*udg8; + T t90 = t87*uinf1; + T t91 = t87*udg6*udg7; + T t94 = t76*t86; + T t95 = t77*t86; + T t96 = t78*t86; + T t97 = t79*t86; + T t98 = t80*t86; + T t99 = t81*t86; + T t100 = t82*t86; + T t101 = t83*t86; + T t102 = t84*t86; + T t103 = t85*t86; + T t114 = t76+t77+t78+t80+t82; + T t115 = t79+t81+t83+t84+t85; + T t92 = (t14*t88)/2.0; + T t93 = (t15*t88)/2.0; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = -t98; + T t109 = -t99; + T t110 = -t100; + T t111 = -t101; + T t112 = -t102; + T t113 = -t103; + T t116 = t89+t90; + T t118 = t66*t114; + T t119 = t67*t114; + T t120 = t68*t114; + T t121 = t69*t114; + T t122 = t70*t114; + T t123 = t66*t115; + T t124 = t67*t115; + T t125 = t68*t115; + T t126 = t69*t115; + T t127 = t70*t115; + T t128 = t87*t114*udg6; + T t129 = t87*t114*udg7; + T t130 = t87*t115*udg6; + T t131 = t87*t115*udg7; + T t117 = t92+t93; + T t132 = -t128; + T t133 = -t129; + T t134 = -t130; + T t135 = -t131; + T t140 = t104+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t108+t121; + T t144 = t110+t122; + T t145 = t107+t123; + T t146 = t109+t124; + T t147 = t111+t125; + T t148 = t112+t126; + T t149 = t113+t127; + T t150 = -t87*(t128-udg14); + T t151 = -t87*(t129-udg15); + T t152 = -t87*(t130-udg22); + T t153 = -t87*(t131-udg23); + T t154 = t87*(t128-udg14)*-2.0; + T t155 = t87*(t131-udg23)*-2.0; + T t156 = t87*(t131-udg23); + T t158 = -t87*uinf2*(t94-t118); + T t159 = -t88*uinf2*(t94-t118); + T t160 = -t87*uinf3*(t95-t119); + T t161 = -t88*uinf3*(t95-t119); + T t162 = -t87*uinf4*(t96-t120); + T t163 = -t88*uinf4*(t96-t120); + T t164 = -t87*uinf5*(t98-t121); + T t165 = -t88*uinf5*(t98-t121); + T t166 = -t87*uinf6*(t100-t122); + T t167 = -t88*uinf6*(t100-t122); + T t168 = -t87*uinf2*(t97-t123); + T t169 = -t88*uinf2*(t97-t123); + T t170 = -t87*uinf3*(t99-t124); + T t171 = -t88*uinf3*(t99-t124); + T t172 = -t87*uinf4*(t101-t125); + T t173 = -t88*uinf4*(t101-t125); + T t174 = -t87*uinf5*(t102-t126); + T t175 = -t88*uinf5*(t102-t126); + T t176 = -t87*uinf6*(t103-t127); + T t177 = -t88*uinf6*(t103-t127); + T t178 = t87*uinf2*(t94-t118); + T t179 = t87*uinf3*(t95-t119); + T t180 = t87*uinf4*(t96-t120); + T t181 = t87*uinf5*(t98-t121); + T t182 = t87*uinf6*(t100-t122); + T t183 = t87*uinf2*(t97-t123); + T t184 = t87*uinf3*(t99-t124); + T t185 = t87*uinf4*(t101-t125); + T t186 = t87*uinf5*(t102-t126); + T t187 = t87*uinf6*(t103-t127); + T t193 = -t24*uinf12*(t87*(t129-udg15)+t87*(t130-udg22)); + T t200 = -t66*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t201 = -t67*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t202 = -t68*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t203 = -t69*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t204 = -t70*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t205 = -t66*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t206 = -t67*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t207 = -t68*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t208 = -t69*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t209 = -t70*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t136 = t132+udg14; + T t137 = t133+udg15; + T t138 = t134+udg22; + T t139 = t135+udg23; + T t157 = t156*2.0; + T t188 = t150+t153; + T t189 = t151+t152; + T t190 = -odg1*(t156+t87*(t128-udg14)); + T t192 = t154+t156; + T t194 = t24*uinf12*(t155+t87*(t128-udg14))*(-2.0/3.0); + T t195 = t24*uinf12*(t155+t87*(t128-udg14))*(2.0/3.0); + T t196 = t24*uinf12*(t153+t87*(t128-udg14)*2.0)*(-2.0/3.0); + T t197 = t91+t193; + T t198 = t159+t161+t163+t165+t167; + T t199 = t169+t171+t173+t175+t177; + T t191 = t150+t157; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t178+t200+t66*t87*udg6)+nlg2*(t183+t205+t66*t87*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t179+t201+t67*t87*udg6)+nlg2*(t184+t206+t67*t87*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t180+t202+t68*t87*udg6)+nlg2*(t185+t207+t68*t87*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t181+t203+t69*t87*udg6)+nlg2*(t186+t208+t69*t87*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t182+t204+t70*t87*udg6)+nlg2*(t187+t209+t70*t87*udg7); + f[5*ng+i] = nlg2*t197+tau6*(udg6-uhg6)+nlg1*(t190+t196+uinf1+t14*t87); + f[6*ng+i] = nlg1*t197+tau7*(udg7-uhg7)+nlg2*(t190+t195+uinf1+t15*t87); + f[7*ng+i] = tau8*(udg8-uhg8)-nlg2*(-t116*udg7+uinf7*(t168+t66*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf8*(t170+t67*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf9*(t172+t68*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf10*(t174+t69*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf11*(t176+t70*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))-t55*(uinf19*(udg24+t86*(t88*udg6*(t130-udg22)+t88*udg7*(t131-udg23))-t115*t117)+t79*uinf14+t81*uinf15+t83*uinf16+t84*uinf17+t85*uinf18)+t87*udg7*(t194+odg1*(t156+t87*(t128-udg14)))+t24*t87*udg6*uinf12*(t87*(t129-udg15)+t87*(t130-udg22)))-nlg1*(-t116*udg6+uinf7*(t158+t66*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf8*(t160+t67*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf9*(t162+t68*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf10*(t164+t69*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf11*(t166+t70*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))-t55*(uinf19*(udg16+t86*(t88*udg6*(t128-udg14)+t88*udg7*(t129-udg15))-t114*t117)+t76*uinf14+t77*uinf15+t78*uinf16+t80*uinf17+t82*uinf18)+t87*udg6*(odg1*(t156+t87*(t128-udg14))+t24*uinf12*(t153+t87*(t128-udg14)*2.0)*(2.0/3.0))+t24*t87*udg7*uinf12*(t87*(t129-udg15)+t87*(t130-udg22))); + } +} + +template void opuFbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = mix->viscosity() / mu_scale; + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t22 = odg1*param21*uinf20; + T t23 = 1.0/param19; + T t24 = 1.0/param20; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t25 = t3*t3; + T t26 = t4*t4; + T t27 = t5*t5; + T t28 = t6*t6; + T t29 = t7*t7; + T t30 = t2*t21; + T t44 = t23*t24*uinf13; + T t31 = t30*5.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t16*t21; + T t38 = t17*t21; + T t39 = t18*t21; + T t40 = t19*t21; + T t41 = t20*t21; + T t42 = -t30; + T t55 = t22+t44; + T t43 = -t31; + T t45 = 1.0/t32; + T t46 = 1.0/t33; + T t47 = 1.0/t34; + T t48 = 1.0/t35; + T t49 = 1.0/t36; + T t50 = t37+1.0/2.0; + T t51 = t38+1.0/2.0; + T t52 = t39+1.0/2.0; + T t53 = t40+1.0/2.0; + T t54 = t41+1.0/2.0; + T t56 = t50*udg1; + T t57 = t51*udg2; + T t58 = t52*udg3; + T t59 = t53*udg4; + T t60 = t54*udg5; + T t61 = t3*t21*t45; + T t62 = t4*t21*t46; + T t63 = t5*t21*t47; + T t64 = t6*t21*t48; + T t65 = t7*t21*t49; + T t66 = t42+t56+1.0/2.0; + T t67 = t42+t57+1.0/2.0; + T t68 = t42+t58+1.0/2.0; + T t69 = t42+t59+1.0/2.0; + T t70 = t42+t60+1.0/2.0; + T t71 = t50+t61; + T t72 = t51+t62; + T t73 = t52+t63; + T t74 = t53+t64; + T t75 = t54+t65; + T t86 = t43+t56+t57+t58+t59+t60+5.0/2.0; + T t76 = t71*udg9; + T t77 = t72*udg10; + T t78 = t73*udg11; + T t79 = t71*udg17; + T t80 = t74*udg12; + T t81 = t72*udg18; + T t82 = t75*udg13; + T t83 = t73*udg19; + T t84 = t74*udg20; + T t85 = t75*udg21; + T t87 = 1.0/t86; + T t88 = t87*t87; + T t89 = t87*udg8; + T t90 = t87*uinf1; + T t91 = t87*udg6*udg7; + T t94 = t76*t86; + T t95 = t77*t86; + T t96 = t78*t86; + T t97 = t79*t86; + T t98 = t80*t86; + T t99 = t81*t86; + T t100 = t82*t86; + T t101 = t83*t86; + T t102 = t84*t86; + T t103 = t85*t86; + T t114 = t76+t77+t78+t80+t82; + T t115 = t79+t81+t83+t84+t85; + T t92 = (t14*t88)/2.0; + T t93 = (t15*t88)/2.0; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = -t98; + T t109 = -t99; + T t110 = -t100; + T t111 = -t101; + T t112 = -t102; + T t113 = -t103; + T t116 = t89+t90; + T t118 = t66*t114; + T t119 = t67*t114; + T t120 = t68*t114; + T t121 = t69*t114; + T t122 = t70*t114; + T t123 = t66*t115; + T t124 = t67*t115; + T t125 = t68*t115; + T t126 = t69*t115; + T t127 = t70*t115; + T t128 = t87*t114*udg6; + T t129 = t87*t114*udg7; + T t130 = t87*t115*udg6; + T t131 = t87*t115*udg7; + T t117 = t92+t93; + T t132 = -t128; + T t133 = -t129; + T t134 = -t130; + T t135 = -t131; + T t140 = t104+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t108+t121; + T t144 = t110+t122; + T t145 = t107+t123; + T t146 = t109+t124; + T t147 = t111+t125; + T t148 = t112+t126; + T t149 = t113+t127; + T t150 = -t87*(t128-udg14); + T t151 = -t87*(t129-udg15); + T t152 = -t87*(t130-udg22); + T t153 = -t87*(t131-udg23); + T t154 = t87*(t128-udg14)*-2.0; + T t155 = t87*(t131-udg23)*-2.0; + T t156 = t87*(t131-udg23); + T t158 = -t87*uinf2*(t94-t118); + T t159 = -t88*uinf2*(t94-t118); + T t160 = -t87*uinf3*(t95-t119); + T t161 = -t88*uinf3*(t95-t119); + T t162 = -t87*uinf4*(t96-t120); + T t163 = -t88*uinf4*(t96-t120); + T t164 = -t87*uinf5*(t98-t121); + T t165 = -t88*uinf5*(t98-t121); + T t166 = -t87*uinf6*(t100-t122); + T t167 = -t88*uinf6*(t100-t122); + T t168 = -t87*uinf2*(t97-t123); + T t169 = -t88*uinf2*(t97-t123); + T t170 = -t87*uinf3*(t99-t124); + T t171 = -t88*uinf3*(t99-t124); + T t172 = -t87*uinf4*(t101-t125); + T t173 = -t88*uinf4*(t101-t125); + T t174 = -t87*uinf5*(t102-t126); + T t175 = -t88*uinf5*(t102-t126); + T t176 = -t87*uinf6*(t103-t127); + T t177 = -t88*uinf6*(t103-t127); + T t178 = t87*uinf2*(t94-t118); + T t179 = t87*uinf3*(t95-t119); + T t180 = t87*uinf4*(t96-t120); + T t181 = t87*uinf5*(t98-t121); + T t182 = t87*uinf6*(t100-t122); + T t183 = t87*uinf2*(t97-t123); + T t184 = t87*uinf3*(t99-t124); + T t185 = t87*uinf4*(t101-t125); + T t186 = t87*uinf5*(t102-t126); + T t187 = t87*uinf6*(t103-t127); + T t193 = -t24*uinf12*(t87*(t129-udg15)+t87*(t130-udg22)); + T t200 = -t66*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t201 = -t67*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t202 = -t68*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t203 = -t69*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t204 = -t70*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t205 = -t66*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t206 = -t67*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t207 = -t68*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t208 = -t69*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t209 = -t70*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t136 = t132+udg14; + T t137 = t133+udg15; + T t138 = t134+udg22; + T t139 = t135+udg23; + T t157 = t156*2.0; + T t188 = t150+t153; + T t189 = t151+t152; + T t190 = -odg1*(t156+t87*(t128-udg14)); + T t192 = t154+t156; + T t194 = t24*uinf12*(t155+t87*(t128-udg14))*(-2.0/3.0); + T t195 = t24*uinf12*(t155+t87*(t128-udg14))*(2.0/3.0); + T t196 = t24*uinf12*(t153+t87*(t128-udg14)*2.0)*(-2.0/3.0); + T t197 = t91+t193; + T t198 = t159+t161+t163+t165+t167; + T t199 = t169+t171+t173+t175+t177; + T t191 = t150+t157; + f[0*ng+i] = tau1*(udg1-uhg1)+nlg1*(t178+t200+t66*t87*udg6)+nlg2*(t183+t205+t66*t87*udg7); + f[1*ng+i] = tau2*(udg2-uhg2)+nlg1*(t179+t201+t67*t87*udg6)+nlg2*(t184+t206+t67*t87*udg7); + f[2*ng+i] = tau3*(udg3-uhg3)+nlg1*(t180+t202+t68*t87*udg6)+nlg2*(t185+t207+t68*t87*udg7); + f[3*ng+i] = tau4*(udg4-uhg4)+nlg1*(t181+t203+t69*t87*udg6)+nlg2*(t186+t208+t69*t87*udg7); + f[4*ng+i] = tau5*(udg5-uhg5)+nlg1*(t182+t204+t70*t87*udg6)+nlg2*(t187+t209+t70*t87*udg7); + f[5*ng+i] = nlg2*t197+tau6*(udg6-uhg6)+nlg1*(t190+t196+uinf1+t14*t87); + f[6*ng+i] = nlg1*t197+tau7*(udg7-uhg7)+nlg2*(t190+t195+uinf1+t15*t87); + f[7*ng+i] = tau8*(udg8-uhg8)-nlg2*(-t116*udg7+uinf7*(t168+t66*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf8*(t170+t67*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf9*(t172+t68*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf10*(t174+t69*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+uinf11*(t176+t70*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))-t55*(uinf19*(udg24+t86*(t88*udg6*(t130-udg22)+t88*udg7*(t131-udg23))-t115*t117)+t79*uinf14+t81*uinf15+t83*uinf16+t84*uinf17+t85*uinf18)+t87*udg7*(t194+odg1*(t156+t87*(t128-udg14)))+t24*t87*udg6*uinf12*(t87*(t129-udg15)+t87*(t130-udg22)))-nlg1*(-t116*udg6+uinf7*(t158+t66*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf8*(t160+t67*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf9*(t162+t68*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf10*(t164+t69*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+uinf11*(t166+t70*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))-t55*(uinf19*(udg16+t86*(t88*udg6*(t128-udg14)+t88*udg7*(t129-udg15))-t114*t117)+t76*uinf14+t77*uinf15+t78*uinf16+t80*uinf17+t82*uinf18)+t87*udg6*(odg1*(t156+t87*(t128-udg14))+t24*uinf12*(t153+t87*(t128-udg14)*2.0)*(2.0/3.0))+t24*t87*udg7*uinf12*(t87*(t129-udg15)+t87*(t130-udg22))); + } +} + +template void opuFbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double omega_scale = rho_scale*u_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + uinf1 = mix->P() / rhoe_scale; + + uinf12 = mix->viscosity() / mu_scale; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t19 = 1.0/3.141592653589793; + T t20 = 1.0/param20; + T t14 = atan(t3); + T t15 = atan(t4); + T t16 = atan(t5); + T t17 = atan(t6); + T t18 = atan(t7); + T t21 = t3*t3; + T t22 = t4*t4; + T t23 = t5*t5; + T t24 = t6*t6; + T t25 = t7*t7; + T t26 = t2*t19*5.0; + T t27 = t21+1.0; + T t28 = t22+1.0; + T t29 = t23+1.0; + T t30 = t24+1.0; + T t31 = t25+1.0; + T t32 = t14*t19; + T t33 = t15*t19; + T t34 = t16*t19; + T t35 = t17*t19; + T t36 = t18*t19; + T t37 = -t26; + T t38 = 1.0/t27; + T t39 = 1.0/t28; + T t40 = 1.0/t29; + T t41 = 1.0/t30; + T t42 = 1.0/t31; + T t43 = t32+1.0/2.0; + T t44 = t33+1.0/2.0; + T t45 = t34+1.0/2.0; + T t46 = t35+1.0/2.0; + T t47 = t36+1.0/2.0; + T t48 = t43*udg1; + T t49 = t44*udg2; + T t50 = t45*udg3; + T t51 = t46*udg4; + T t52 = t47*udg5; + T t53 = t3*t19*t38; + T t54 = t4*t19*t39; + T t55 = t5*t19*t40; + T t56 = t6*t19*t41; + T t57 = t7*t19*t42; + T t58 = t43+t53; + T t59 = t44+t54; + T t60 = t45+t55; + T t61 = t46+t56; + T t62 = t47+t57; + T t73 = t37+t48+t49+t50+t51+t52+5.0/2.0; + T t63 = t58*udg9; + T t64 = t59*udg10; + T t65 = t60*udg11; + T t66 = t58*udg17; + T t67 = t61*udg12; + T t68 = t59*udg18; + T t69 = t62*udg13; + T t70 = t60*udg19; + T t71 = t61*udg20; + T t72 = t62*udg21; + T t74 = 1.0/t73; + T t75 = t74*udg6*udg7; + T t76 = t63+t64+t65+t67+t69; + T t77 = t66+t68+t70+t71+t72; + T t78 = t74*t76*udg6; + T t79 = t74*t76*udg7; + T t80 = t74*t77*udg6; + T t81 = t74*t77*udg7; + T t82 = -t78; + T t83 = -t79; + T t84 = -t80; + T t85 = -t81; + T t90 = -t74*(t78-udg14); + T t91 = -t74*(t79-udg15); + T t92 = -t74*(t80-udg22); + T t93 = -t74*(t81-udg23); + T t96 = -odg1*(t74*(t78-udg14)+t74*(t81-udg23)); + T t97 = -t20*uinf12*(t74*(t79-udg15)+t74*(t80-udg22)); + T t86 = t82+udg14; + T t87 = t83+udg15; + T t88 = t84+udg22; + T t89 = t85+udg23; + T t94 = t90+t93; + T t95 = t91+t92; + T t98 = t75+t97; + f[0*ng+i] = 0.0; + f[1*ng+i] = 0.0; + f[2*ng+i] = 0.0; + f[3*ng+i] = 0.0; + f[4*ng+i] = 0.0; + f[5*ng+i] = nlg2*t98+nlg1*(t96+uinf1+t74*(udg6*udg6)-t20*uinf12*(t93+t74*(t78-udg14)*2.0)*(2.0/3.0))+tau6*(udg6-uhg6); + f[6*ng+i] = nlg1*t98+nlg2*(t96+uinf1+t74*(udg7*udg7)+t20*uinf12*(t74*(t78-udg14)-t74*(t81-udg23)*2.0)*(2.0/3.0))+tau7*(udg7-uhg7); + f[7*ng+i] = 0.0; + } +} + +template void opuFbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuFbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuFbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuFbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuFbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFhat.cpp new file mode 100644 index 00000000..cba1b474 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFhat.cpp @@ -0,0 +1,6 @@ +template void opuFhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuFhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFlux.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFlux.cpp new file mode 100644 index 00000000..7ca2bcb7 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuFlux.cpp @@ -0,0 +1,334 @@ +template void opuFlux(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + + mix->averageDiffusionCoeffs(D_i); + nondimensionalize_diffusionCoeffs(D_i, (double*)uinf, nspecies, ndim); + mix->speciesHOverRT(h_i); + nondimensionalize_enthalpies(h_i, (double*)uinf, nspecies, ndim); + + uinf1 = mix->P() / rhoe_scale; + + //D_i + uinf2 = D_i[0]; uinf3 = D_i[1]; uinf4 = D_i[2]; uinf5 = D_i[3]; uinf6 = D_i[4]; + + //h_i + uinf7 = h_i[0]; uinf8 = h_i[1]; uinf9 = h_i[2]; uinf10 = h_i[3]; uinf11 = h_i[4]; // h_5 + + uinf20 = 1.0/0.9; + uinf12 = mix->viscosity() / mu_scale; + uinf13 = mix->frozenThermalConductivity() / kappa_scale; // kappa + + dT_dUstate(dTdU, Ustate, Uwork, nspecies, ndim, mix); + nondimensionalize_dT_dUstate(dTdU, (double*)uinf, nspecies, nd); + uinf14 = dTdU[0]; uinf15 = dTdU[1]; uinf16 = dTdU[2]; uinf17 = dTdU[3]; uinf18 = dTdU[4]; uinf19 = dTdU[5]; + + T t2 = atan(param22); + T t3 = param22*udg1; + T t4 = param22*udg2; + T t5 = param22*udg3; + T t6 = param22*udg4; + T t7 = param22*udg5; + T t8 = param22*param22; + T t9 = udg1*udg1; + T t10 = udg2*udg2; + T t11 = udg3*udg3; + T t12 = udg4*udg4; + T t13 = udg5*udg5; + T t14 = udg6*udg6; + T t15 = udg7*udg7; + T t21 = 1.0/3.141592653589793; + T t22 = odg1*param21*uinf20; + T t23 = 1.0/param19; + T t24 = 1.0/param20; + T t16 = atan(t3); + T t17 = atan(t4); + T t18 = atan(t5); + T t19 = atan(t6); + T t20 = atan(t7); + T t25 = t3*t3; + T t26 = t4*t4; + T t27 = t5*t5; + T t28 = t6*t6; + T t29 = t7*t7; + T t30 = t2*t21; + T t44 = t23*t24*uinf13; + T t31 = t30*5.0; + T t32 = t25+1.0; + T t33 = t26+1.0; + T t34 = t27+1.0; + T t35 = t28+1.0; + T t36 = t29+1.0; + T t37 = t16*t21; + T t38 = t17*t21; + T t39 = t18*t21; + T t40 = t19*t21; + T t41 = t20*t21; + T t42 = -t30; + T t55 = t22+t44; + T t43 = -t31; + T t45 = 1.0/t32; + T t46 = 1.0/t33; + T t47 = 1.0/t34; + T t48 = 1.0/t35; + T t49 = 1.0/t36; + T t50 = t37+1.0/2.0; + T t51 = t38+1.0/2.0; + T t52 = t39+1.0/2.0; + T t53 = t40+1.0/2.0; + T t54 = t41+1.0/2.0; + T t56 = t50*udg1; + T t57 = t51*udg2; + T t58 = t52*udg3; + T t59 = t53*udg4; + T t60 = t54*udg5; + T t61 = t3*t21*t45; + T t62 = t4*t21*t46; + T t63 = t5*t21*t47; + T t64 = t6*t21*t48; + T t65 = t7*t21*t49; + T t66 = t42+t56+1.0/2.0; + T t67 = t42+t57+1.0/2.0; + T t68 = t42+t58+1.0/2.0; + T t69 = t42+t59+1.0/2.0; + T t70 = t42+t60+1.0/2.0; + T t71 = t50+t61; + T t72 = t51+t62; + T t73 = t52+t63; + T t74 = t53+t64; + T t75 = t54+t65; + T t86 = t43+t56+t57+t58+t59+t60+5.0/2.0; + T t76 = t71*udg9; + T t77 = t72*udg10; + T t78 = t73*udg11; + T t79 = t71*udg17; + T t80 = t74*udg12; + T t81 = t72*udg18; + T t82 = t75*udg13; + T t83 = t73*udg19; + T t84 = t74*udg20; + T t85 = t75*udg21; + T t87 = 1.0/t86; + T t88 = t87*t87; + T t89 = t87*udg8; + T t90 = t87*uinf1; + T t91 = t87*udg6*udg7; + T t94 = t76*t86; + T t95 = t77*t86; + T t96 = t78*t86; + T t97 = t79*t86; + T t98 = t80*t86; + T t99 = t81*t86; + T t100 = t82*t86; + T t101 = t83*t86; + T t102 = t84*t86; + T t103 = t85*t86; + T t114 = t76+t77+t78+t80+t82; + T t115 = t79+t81+t83+t84+t85; + T t92 = (t14*t88)/2.0; + T t93 = (t15*t88)/2.0; + T t104 = -t94; + T t105 = -t95; + T t106 = -t96; + T t107 = -t97; + T t108 = -t98; + T t109 = -t99; + T t110 = -t100; + T t111 = -t101; + T t112 = -t102; + T t113 = -t103; + T t116 = t89+t90; + T t118 = t66*t114; + T t119 = t67*t114; + T t120 = t68*t114; + T t121 = t69*t114; + T t122 = t70*t114; + T t123 = t66*t115; + T t124 = t67*t115; + T t125 = t68*t115; + T t126 = t69*t115; + T t127 = t70*t115; + T t128 = t87*t114*udg6; + T t129 = t87*t114*udg7; + T t130 = t87*t115*udg6; + T t131 = t87*t115*udg7; + T t117 = t92+t93; + T t132 = -t128; + T t133 = -t129; + T t134 = -t130; + T t135 = -t131; + T t140 = t104+t118; + T t141 = t105+t119; + T t142 = t106+t120; + T t143 = t108+t121; + T t144 = t110+t122; + T t145 = t107+t123; + T t146 = t109+t124; + T t147 = t111+t125; + T t148 = t112+t126; + T t149 = t113+t127; + T t150 = -t87*(t128-udg14); + T t151 = -t87*(t129-udg15); + T t152 = -t87*(t130-udg22); + T t153 = -t87*(t131-udg23); + T t154 = t87*(t128-udg14)*-2.0; + T t155 = t87*(t131-udg23)*-2.0; + T t156 = t87*(t131-udg23); + T t158 = -t87*uinf2*(t94-t118); + T t159 = -t88*uinf2*(t94-t118); + T t160 = -t87*uinf3*(t95-t119); + T t161 = -t88*uinf3*(t95-t119); + T t162 = -t87*uinf4*(t96-t120); + T t163 = -t88*uinf4*(t96-t120); + T t164 = -t87*uinf5*(t98-t121); + T t165 = -t88*uinf5*(t98-t121); + T t166 = -t87*uinf6*(t100-t122); + T t167 = -t88*uinf6*(t100-t122); + T t168 = -t87*uinf2*(t97-t123); + T t169 = -t88*uinf2*(t97-t123); + T t170 = -t87*uinf3*(t99-t124); + T t171 = -t88*uinf3*(t99-t124); + T t172 = -t87*uinf4*(t101-t125); + T t173 = -t88*uinf4*(t101-t125); + T t174 = -t87*uinf5*(t102-t126); + T t175 = -t88*uinf5*(t102-t126); + T t176 = -t87*uinf6*(t103-t127); + T t177 = -t88*uinf6*(t103-t127); + T t178 = t87*uinf2*(t94-t118); + T t179 = t87*uinf3*(t95-t119); + T t180 = t87*uinf4*(t96-t120); + T t181 = t87*uinf5*(t98-t121); + T t182 = t87*uinf6*(t100-t122); + T t183 = t87*uinf2*(t97-t123); + T t184 = t87*uinf3*(t99-t124); + T t185 = t87*uinf4*(t101-t125); + T t186 = t87*uinf5*(t102-t126); + T t187 = t87*uinf6*(t103-t127); + T t193 = -t24*uinf12*(t87*(t129-udg15)+t87*(t130-udg22)); + T t200 = -t66*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t201 = -t67*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t202 = -t68*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t203 = -t69*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t204 = -t70*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)); + T t205 = -t66*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t206 = -t67*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t207 = -t68*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t208 = -t69*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t209 = -t70*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)); + T t136 = t132+udg14; + T t137 = t133+udg15; + T t138 = t134+udg22; + T t139 = t135+udg23; + T t157 = t156*2.0; + T t188 = t150+t153; + T t189 = t151+t152; + T t190 = -odg1*(t156+t87*(t128-udg14)); + T t192 = t154+t156; + T t194 = t24*uinf12*(t155+t87*(t128-udg14))*(-2.0/3.0); + T t195 = t24*uinf12*(t155+t87*(t128-udg14))*(2.0/3.0); + T t196 = t24*uinf12*(t153+t87*(t128-udg14)*2.0)*(-2.0/3.0); + T t197 = t91+t193; + T t198 = t159+t161+t163+t165+t167; + T t199 = t169+t171+t173+t175+t177; + T t191 = t150+t157; + f[0*ng+i] = t178+t200+t66*t87*udg6; + f[1*ng+i] = t179+t201+t67*t87*udg6; + f[2*ng+i] = t180+t202+t68*t87*udg6; + f[3*ng+i] = t181+t203+t69*t87*udg6; + f[4*ng+i] = t182+t204+t70*t87*udg6; + f[5*ng+i] = t190+t196+uinf1+t14*t87; + f[6*ng+i] = t197; + f[7*ng+i] = t116*udg6-uinf7*(t158+t66*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))-uinf8*(t160+t67*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))-uinf9*(t162+t68*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))-uinf10*(t164+t69*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))-uinf11*(t166+t70*(t88*uinf2*(t94-t118)+t88*uinf3*(t95-t119)+t88*uinf4*(t96-t120)+t88*uinf5*(t98-t121)+t88*uinf6*(t100-t122)))+t55*(uinf19*(udg16+t86*(t88*udg6*(t128-udg14)+t88*udg7*(t129-udg15))-t114*t117)+t76*uinf14+t77*uinf15+t78*uinf16+t80*uinf17+t82*uinf18)-t87*udg6*(odg1*(t156+t87*(t128-udg14))+t24*uinf12*(t153+t87*(t128-udg14)*2.0)*(2.0/3.0))+t87*t193*udg7; + f[8*ng+i] = t183+t205+t66*t87*udg7; + f[9*ng+i] = t184+t206+t67*t87*udg7; + f[10*ng+i] = t185+t207+t68*t87*udg7; + f[11*ng+i] = t186+t208+t69*t87*udg7; + f[12*ng+i] = t187+t209+t70*t87*udg7; + f[13*ng+i] = t197; + f[14*ng+i] = t190+t195+uinf1+t15*t87; + f[15*ng+i] = t116*udg7-uinf7*(t168+t66*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))-uinf8*(t170+t67*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))-uinf9*(t172+t68*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))-uinf10*(t174+t69*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))-uinf11*(t176+t70*(t88*uinf2*(t97-t123)+t88*uinf3*(t99-t124)+t88*uinf4*(t101-t125)+t88*uinf5*(t102-t126)+t88*uinf6*(t103-t127)))+t55*(uinf19*(udg24+t86*(t88*udg6*(t130-udg22)+t88*udg7*(t131-udg23))-t115*t117)+t79*uinf14+t81*uinf15+t83*uinf16+t84*uinf17+t85*uinf18)-t87*udg7*(t194+odg1*(t156+t87*(t128-udg14)))+t87*t193*udg6; + } +} + +template void opuFlux(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuFlux(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitodg.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitodg.cpp new file mode 100644 index 00000000..1e0174b0 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitodg.cpp @@ -0,0 +1,6 @@ +template void opuInitodg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitodg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitodg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitq.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitq.cpp new file mode 100644 index 00000000..c557795d --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitq.cpp @@ -0,0 +1,6 @@ +template void opuInitq(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitq(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitq(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitu.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitu.cpp new file mode 100644 index 00000000..e007a61e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitu.cpp @@ -0,0 +1,33 @@ +template void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitu(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuInitudg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitudg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitudg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitwdg.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitwdg.cpp new file mode 100644 index 00000000..5217d5ee --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuInitwdg.cpp @@ -0,0 +1,6 @@ +template void opuInitwdg(T *f, T *xdg, T *uinf, T *param, int modelnumber, int ng, int ncx, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuInitwdg(double *, double *, double *, double *, int, int, int, int, int, int, Mutation::Mixture *); +template void opuInitwdg(float *, float *, float *, float *, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuOutput.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuOutput.cpp new file mode 100644 index 00000000..c83535ec --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuOutput.cpp @@ -0,0 +1,81 @@ +template void opuOutput(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + double mu_scale = uinf[4]; + double kappa_scale = uinf[5]; + double Uwork[5]; + double dTdU[6]; + double D_i[5]; + double h_i[5]; + double wdot[5]; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + mix->netProductionRates(wdot); + + f[j+npe*0+npe*nce*k] = wdot[0]/omega_scale; + f[j+npe*1+npe*nce*k] = wdot[1]/omega_scale; + f[j+npe*2+npe*nce*k] = wdot[2]/omega_scale; + f[j+npe*3+npe*nce*k] = wdot[3]/omega_scale; + f[j+npe*4+npe*nce*k] = wdot[4]/omega_scale; + f[j+npe*5+npe*nce*k] = mix->P(); + f[j+npe*6+npe*nce*k] = mix->T(); + f[j+npe*7+npe*nce*k] = mix->mixtureFrozenGamma(); + f[j+npe*8+npe*nce*k] = rhoe; + f[j+npe*9+npe*nce*k] = odg1; + } +} + +template void opuOutput(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuOutput(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSource.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSource.cpp new file mode 100644 index 00000000..a5536d08 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSource.cpp @@ -0,0 +1,72 @@ +template void opuSource(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + double Ustate[6]; + int nspecies = 5; + int ndim = 2; + double rho_scale = uinf[0]; + double u_scale = uinf[1]; + double rhoe_scale = uinf[2]; + double L_scale = uinf[6]; + double omega_scale = rho_scale*u_scale/L_scale; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + double wdot[5]; + mix->netProductionRates(wdot); + + f[0*ng+i] = wdot[0]/(omega_scale); + f[1*ng+i] = wdot[1]/(omega_scale); + f[2*ng+i] = wdot[2]/(omega_scale); + f[3*ng+i] = wdot[3]/(omega_scale); + f[4*ng+i] = wdot[4]/(omega_scale); + f[5*ng+i] = 0.0; + f[6*ng+i] = 0.0; + f[7*ng+i] = 0.0; + // T udg1 = udg[0*ng+i]; + // T udg2 = udg[1*ng+i]; + // T udg3 = udg[2*ng+i]; + // T udg4 = udg[3*ng+i]; + // T udg5 = udg[4*ng+i]; + // T t2 = atan(param22); + // T t3 = 1.0/3.141592653589793; + // T t4 = t2*t3; + // T t5 = -t4; + // f[0*ng+i] = t5+udg1*(t3*atan(param22*udg1)+1.0/2.0)+1.0/2.0; + // f[1*ng+i] = t5+udg2*(t3*atan(param22*udg2)+1.0/2.0)+1.0/2.0; + // f[2*ng+i] = t5+udg3*(t3*atan(param22*udg3)+1.0/2.0)+1.0/2.0; + // f[3*ng+i] = t5+udg4*(t3*atan(param22*udg4)+1.0/2.0)+1.0/2.0; + // f[4*ng+i] = t5+udg5*(t3*atan(param22*udg5)+1.0/2.0)+1.0/2.0; + // f[5*ng+i] = 0.0; + // f[6*ng+i] = 0.0; + // f[7*ng+i] = 0.0; + } +} + +template void opuSource(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSource(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSourcew.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSourcew.cpp new file mode 100644 index 00000000..e97b7257 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuSourcew.cpp @@ -0,0 +1,6 @@ +template void opuSourcew(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, int nce, int npe, int ne, Mutation::Mixture *mix) +{ +} + +template void opuSourcew(double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuSourcew(float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuStab.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuStab.cpp new file mode 100644 index 00000000..7fd61560 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuStab.cpp @@ -0,0 +1,6 @@ +template void opuStab(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuStab(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuStab(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuTdfunc.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuTdfunc.cpp new file mode 100644 index 00000000..f20d744b --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuTdfunc.cpp @@ -0,0 +1,16 @@ +template void opuTdfunc(T* __restrict__ f, T* __restrict__ xdg, T* __restrict__ udg, T*__restrict__ odg, T*__restrict__ wdg, T*__restrict__ uinf, T*__restrict__ param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou1(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou2(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou3(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + for (int i = 0; i void opuUbou(T *f, T *xdg, T *udg, T *odg, T *wdg, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ib, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ + if (ib == 1) + opuUbou1(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 2) + opuUbou2(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); + else if (ib == 3) + opuUbou3(f, xdg, udg, odg, wdg, uhg, nlg, tau, uinf, param, time, modelnumber, ng, nc, ncu, nd, ncx, nco, ncw, mix); +} + +template void opuUbou(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUbou(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuUhat.cpp b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuUhat.cpp new file mode 100644 index 00000000..ba30d409 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app_visc_pb_regen/opuUhat.cpp @@ -0,0 +1,6 @@ +template void opuUhat(T *f, T *xdg, T *udg1, T *udg2, T *odg1, T *odg2, T *wdg1, T *wdg2, T *uhg, T *nlg, T *tau, T *uinf, T *param, T time, int modelnumber, int ng, int nc, int ncu, int nd, int ncx, int nco, int ncw, Mutation::Mixture *mix) +{ +} + +template void opuUhat(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double, int, int, int, int, int, int, int, int, Mutation::Mixture *); +template void opuUhat(float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float, int, int, int, int, int, int, int, int, Mutation::Mixture *); diff --git a/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m b/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m index a358f697..42b21f67 100644 --- a/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m +++ b/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m @@ -15,7 +15,8 @@ sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing % regularization parameters - alpha = 1.0e12; + alpha = mu(22); + sigm = mu(23); rmin = 0.0; Hmin = 1.0e-4; @@ -40,33 +41,35 @@ % Regularization rho_i = rmin + lmax(rho_i-rmin,alpha); % need to double check regularizatino here - drho_dx_i = drho_dx_i .* dlmax(u(1:nspecies)-rmin,alpha); - drho_dy_i = drho_dy_i .* dlmax(u(1:nspecies)-rmin,alpha); +% drho_dx_i = drho_dx_i .* dlmax(u(1:nspecies)-rmin,alpha); +% drho_dy_i = drho_dy_i .* dlmax(u(1:nspecies)-rmin,alpha); drho_dx = sum(drho_dx_i); drho_dy = sum(drho_dy_i); % Simple derived working quantities rho = sum(rho_i); - rhoinv = 1./rho; - uv = rhou.*rhoinv; - vv = rhov.*rhoinv; - E = rhoE * rhoinv; %energy - H = E + p*rhoinv; %enthalpy + rho_inv = 1./rho; + uv = rhou.*rho_inv; + vv = rhov.*rho_inv; + E = rhoE * rho_inv; %energy + H = E + p*rho_inv; %enthalpy H = Hmin + lmax(H - Hmin, alpha); % Critical speed of Sound c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 % Computing derivatives for the sensors - du_dx = (drhou_dx - drho_dx.*uv).*rhoinv; - dv_dy = (drhov_dy - drho_dy.*vv).*rhoinv; + du_dx = (drhou_dx - drho_dx.*uv).*rho_inv; + dv_dy = (drhov_dy - drho_dy.*vv).*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + div_v = (du_dx + dv_dy); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation - % pretty sure my signs are okay. There is something strange about the code I was given. Trhouly don't understand the signs + % pretty sure my signs are okay. There is something strange about the code I was given. Trhouly don't understand the signs % limit divergence and vorticity - sigm = 1e4; div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); - % % Dilatation Sensor sb - sb = - (hm./porder) .* (div_v./c_star); + DucrosRatio = 1; + sb = - (hm./porder) .* (div_v./c_star) .* DucrosRatio; sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be % Artificial Bulk viscosity diff --git a/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d.m b/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d.m new file mode 100644 index 00000000..5cec7b9f --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d.m @@ -0,0 +1,90 @@ +function avField = avfieldPhysical2d(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); + avk_b_coeff = eta(3); + + gam1 = gam - 1; + nenergy = 1; + ncu = nspecies + nd + nenergy; + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = 1.0e12; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(3); + + % Get base variables + rho_i = u(1:nspecies); + rhou = u(nspecies+1); + rhov = u(nspecies+nd); + rhoE = u(nspecies+nd+1); + +% drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha); + drho_dx_i = -q(1:nspecies); + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); +% drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies); + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); +% drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Regularization + rho_i = rmin + lmax(rho_i-rmin,alpha); % need to double check regularizatino here +% drho_dx_i = drho_dx_i .* dlmax(u(1:nspecies)-rmin,alpha); +% drho_dy_i = drho_dy_i .* dlmax(u(1:nspecies)-rmin,alpha); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + % Simple derived working quantities + rho = sum(rho_i); + rho_inv = 1./rho; + uv = rhou.*rho_inv; + vv = rhov.*rho_inv; + E = rhoE * rho_inv; %energy + H = E + p*rho_inv; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + + div_v = (du_dx + dv_dy); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Trhouly don't understand the signs + vort = (dv_dx - du_dy); %TODO: sign here is a little weird + vort = sqrt(vort.*vort); + + % limit divergence and vorticity + sigm = 1e4; + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + vort = limiting(vort,0.0,sigm,alpha,0.0); + + % % Dilatation Sensor sb +% DucrosRatio = div_v.*div_v ./ (div_v.*div_v + vort.*vort + 1.0e-16); + DucrosRatio=1; + sb = - (hm./porder) .* (div_v./c_star) .* DucrosRatio; + sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be + + % Artificial Bulk viscosity + avb = rho * (kb.*hm./(porder)) .* sqrt(uv.^2 + vv.^2 + c_star.^2) .* sb; + avk_b = avk_b_coeff * avb; + + % Assign artificial viscosities + avField(1) = avb; % bulk + avField(2) = avk_b; +end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_Di.m b/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_Di.m new file mode 100644 index 00000000..1da52b92 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_Di.m @@ -0,0 +1,97 @@ +function avField = avfieldPhysical2d_Di(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); +% avk_b_coeff = eta(3); + + gam1 = gam - 1; + nenergy = 1; + ncu = nspecies + nd + nenergy; + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + kD = 1.0; + + % regularization parameters + alpha = mu(22); + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(7); + + % Get base variables + rho_i = u(1:nspecies); + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+3); + + % Regularization + rho_i = rmin + lmax(rho_i-rmin,alpha); % need to double check regularizatino here + dr = dlmax(u(1:nspecies)-rmin,alpha); + + drho_dx_i = -q(1:nspecies).*dr; + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + + drho_dy_i = -q(ncu+1:ncu+nspecies).*dr; + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + % Simple derived working quantities + rho = sum(rho_i); + rho_inv = 1./rho; + uv = rhou.*rho_inv; + vv = rhov.*rho_inv; + E = rhoE * rho_inv; %energy + H = E + p*rho_inv; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + + div_v = (du_dx + dv_dy); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Trhouly don't understand the signs + vort = (dv_dx - du_dy); %TODO: sign here is a little weird + vort = sqrt(vort.*vort); + + % limit divergence and vorticity + sigm = mu(23); + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + vort = limiting(vort,0.0,sigm,alpha,0.0); + + % % Dilatation Sensor sb + DucrosRatio = div_v.*div_v ./ (div_v.*div_v + vort.*vort + 1.0e-16); +% DucrosRatio=1; + sb = - (hm./porder) .* (div_v./c_star) .* DucrosRatio; + sb = limiting(sb,sbmin,sbmax,alpha,sb0); + + % Artificial Bulk viscosity + avb = rho * (kb.*hm./(porder)) .* sqrt(uv.^2 + vv.^2 + c_star.^2) .* sb; + + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + dY_dy_i = (drho_dy_i * rho - rho_i * drho_dy) * rho_inv * rho_inv; + + sY = hm./porder .* sqrt((dY_dx_i).^2 + (dY_dy_i).^2); % divide by free stream Yi's + for i = 1:5 + sY(i) = limiting(sY(i), sbmin, sbmax, alpha, sb0); + end + avY = rho * (kD.*hm./porder) .* sqrt(uv^2 + c_star^2) .* sY; + + % Assign artificial viscosities + avField(1) = avb; % bulk + avField(2:6) = avY; +end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_new.m b/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_new.m new file mode 100644 index 00000000..90109ff2 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/avfieldPhysical2d_new.m @@ -0,0 +1,86 @@ +function avField = avfieldPhysical2d(u, q, w, v, x, t, mu, eta, nspecies, nd) + % Mutation outputs + p = eta(1); + gam = eta(2); +% avk_b_coeff = eta(3); + + gam1 = gam - 1; + nenergy = 1; + ncu = nspecies + nd + nenergy; + % artificial viscosity + porder = mu(15); + + % regularization parameters for the bulk viscosity + kb = mu(16); + sb0 = mu(17); %0.02 + sbmin = 0.0; + sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing + + % regularization parameters + alpha = mu(22); + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(2); + + % Get base variables + rho_i = u(1:nspecies); + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+3); + + % Regularization + rho_i = rmin + lmax(rho_i-rmin,alpha); % need to double check regularizatino here + % dr = dlmax(u(1:nspecies)-rmin,alpha); + dr = 1; + drho_dx_i = -q(1:nspecies).*dr; + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + + drho_dy_i = -q(ncu+1:ncu+nspecies).*dr; + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + % Simple derived working quantities + rho = sum(rho_i); + rho_inv = 1./rho; + uv = rhou.*rho_inv; + vv = rhov.*rho_inv; + E = rhoE * rho_inv; %energy + H = E + p*rho_inv; %enthalpy + H = Hmin + lmax(H - Hmin, alpha); + + % Critical speed of Sound + c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 + + % Computing derivatives for the sensors + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + + div_v = (du_dx + dv_dy); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation + % pretty sure my signs are okay. There is something strange about the code I was given. Trhouly don't understand the signs + vort = (dv_dx - du_dy); %TODO: sign here is a little weird + vort = sqrt(vort.*vort); + + % limit divergence and vorticity + sigm = mu(23); + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + vort = limiting(vort,0.0,sigm,alpha,0.0); + + % % Dilatation Sensor sb + DucrosRatio = div_v.*div_v ./ (div_v.*div_v + vort.*vort + 1.0e-16); + % DucrosRatio=1; + sb = - (hm./porder) .* (div_v./c_star) .* DucrosRatio; + sb = limiting(sb,sbmin,sbmax,alpha,sb0); + + % Artificial Bulk viscosity + avb = rho * (kb.*hm./(porder)) .* sqrt(uv.^2 + vv.^2 + c_star.^2) .* sb; + + % Assign artificial viscosities + avField(1) = avb; % bulk +end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/getStates2d.py b/Applications/Hypersonics/ReactingCylinder/getStates2d.py index cdc486ac..4f619655 100644 --- a/Applications/Hypersonics/ReactingCylinder/getStates2d.py +++ b/Applications/Hypersonics/ReactingCylinder/getStates2d.py @@ -82,10 +82,12 @@ def rhoE(mix, u): print("kappa_ref = " + str(kappa_inf)) print("MISC Terms") + print("cp: " + str(mix.mixtureFrozenCpMass())) + print("gamma: " + str(mix.mixtureFrozenGamma())) print("T_ref from cp: " + str(u_scale**2 / mix.mixtureFrozenCpMass())) print("Re = " + str(rho_inf * u_scale / mu_inf)) print("Pr = " + str(mu_inf * mix.mixtureFrozenCpMass() / kappa_inf)) - + print("Ma = " + str(u_inf / a_inf)) diff --git a/Applications/Hypersonics/ReactingCylinder/mkmesh_uniform.m b/Applications/Hypersonics/ReactingCylinder/mkmesh_uniform.m new file mode 100644 index 00000000..61ffa542 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/mkmesh_uniform.m @@ -0,0 +1,124 @@ +function [p,t,dgnodes] = mkmesh_circincirc_Ma17b(porder,m,n,r1,r2,alpha) +% This routine is inspired from mkmesh_circincirc_half, but adapted to the +% Ma = 17.605 case presented in Barter Thesis. + +elemtype = 1; +[p,t] = squaremesh(m-1,n-1,1,elemtype); +p=p'; + +%%%%%%%%%%% Defines 3 regions with different refining speeds %%%%%%%%%%%%%% +% Number of element in radial direction for each region +nn1 = ceil(3.33*n/10); nn2 = ceil(3.33*n/10); nn3 = n-nn1-nn2; +% Position of transition between refinement areas +x12 = 0.1; x23 = 0.375; +ln1 = loginc(linspace(0.00,x12,nn1+1),alpha); +ln2 = loginc(linspace(x12, x23,nn2+1),1); +ln3 = loginc(linspace(x23,1.00,nn3),1); +ln = [ln1(1:end-1) ln2(1:end-1) ln3]; +ln = reshape(ones(m,1)*ln,[m*n,1]); + +% Assign mesh point positions +p(:,2) = ln; +%p(:,2) = loginc(p(:,2),alpha); % OLD VERSION +%plot(ln,ln,'.'); % A SUPPRIMER +ind = p(:,1)<=0.5; +p(ind,1) = logdec(p(ind,1),1); +ind = p(:,1)>=0.5; +p(ind,1) = loginc(p(ind,1),1); + +dgnodes = mkdgnodes(p',t,porder); + +pnew = p; +pnew(:,1) = -(r1+(r2-r1)*p(:,2)).*sin(pi*p(:,1)); +pnew(:,2) = -(r1+(r2-r1)*p(:,2)).*cos(pi*p(:,1)); +[p,t] = fixmesh(pnew,t'); +p = p'; +t = t'; + +pnew = zeros(size(dgnodes)); +pnew(:,1,:) = -(r1+(r2-r1)*dgnodes(:,2,:)).*sin(pi*dgnodes(:,1,:)); +pnew(:,2,:) = -(r1+(r2-r1)*dgnodes(:,2,:)).*cos(pi*dgnodes(:,1,:)); +dgnodes = pnew; + + +function dgnodes = mkdgnodes(p,t,porder) +%CREATEDGNODES Computes the Coordinates of the DG nodes. +% DGNODES=CREATENODES(MESH,FD,FPARAMS) +% +% MESH: Mesh Data Structure +% FD: Distance Function d(x,y) +% FPARAMS: Additional parameters passed to FD +% DGNODES: Triangle indices (NPL,2,NT). The nodes on +% the curved boundaries are projected to the +% true boundary using the distance function FD +% + +% npv : number of nodes per volume element +% nfv : number of faces per volume element +% npf : number of nodes per face element + +% if porder>4 +% error("app.porder must be less than or equal to 4."); +% end + +[nve,ne]=size(t); +nd=size(p,1); + +elemtype = 0; +if (nd==2) && (nve==4) + elemtype=1; +end +if (nd==3) && (nve==8) + elemtype=1; +end + +plocal = masternodes(porder,nd,elemtype); + +npl=size(plocal,1); +if nd==1 + xi = plocal(:,1); + philocal(:,1) = 1 - xi; + philocal(:,2) = xi; +elseif nd==2 && nve==3 % tri + xi = plocal(:,1); + eta = plocal(:,2); + philocal(:,1) = 1 - xi - eta; + philocal(:,2) = xi; + philocal(:,3) = eta; +elseif nd==2 && nve==4 % quad + xi = plocal(:,1); + eta = plocal(:,2); + philocal(:,1) = (1-xi).*(1-eta); + philocal(:,2) = xi.*(1-eta); + philocal(:,3) = xi.*eta; + philocal(:,4) = (1-xi).*eta; +elseif nd==3 && nve==4 % tet + xi = plocal(:,1); + eta = plocal(:,2); + zeta = plocal(:,3); + philocal(:,1) = 1 - xi - eta - zeta; + philocal(:,2) = xi; + philocal(:,3) = eta; + philocal(:,4) = zeta; +elseif nd==3 && nve==8 % hex + xi = plocal(:,1); + eta = plocal(:,2); + zeta = plocal(:,3); + philocal(:,1) = (1-xi).*(1-eta).*(1-zeta); + philocal(:,2) = xi.*(1-eta).*(1-zeta); + philocal(:,3) = xi.*eta.*(1-zeta); + philocal(:,4) = (1-xi).*eta.*(1-zeta); + philocal(:,5) = (1-xi).*(1-eta).*(zeta); + philocal(:,6) = xi.*(1-eta).*(zeta); + philocal(:,7) = xi.*eta.*(zeta); + philocal(:,8) = (1-xi).*eta.*(zeta); +end + +% Allocate nodes +dgnodes=zeros(npl,nd,ne); +for dim=1:nd + for node=1:nve + dp=reshape(philocal(:,node),[npl 1])*reshape(p(dim,t(node,:)),[1 ne]); + dgnodes(:,dim,:)=dgnodes(:,dim,:)+reshape(dp,[npl 1 ne]); + end +end diff --git a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m index bada3847..a9f47dde 100644 --- a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m @@ -15,13 +15,13 @@ % Define a PDE model: governing equations, initial solutions, and boundary conditions pde.model = "ModelD"; % ModelC, ModelD, ModelW -pde.modelfile = "pdemodel_2d"; % name of a file defining the PDE model +pde.modelfile = "pdemodel_inviscid"; % name of a file defining the PDE model % Choose computing platform and set number of processors pde.mpiprocs = 1; % number of MPI processors %% Set discretization parameters, physical parameters, and solver parameters -pde.porder = 2; % polynomial degree +pde.porder = 1; % polynomial degree pde.torder = 1; % time-stepping order of accuracy pde.nstage = 1; % time-stepping number of stages @@ -30,29 +30,32 @@ % nt = 3240/10; % dt = tfinal/nt; % dt = 10*1e-5; -nt = 1000; +nt = 2200; % nt = 150 % dt = tfinal / nt; -dt = 1.0000000000000e-5; -pde.dt = [dt*ones(1,5*nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; +dt = 2.500000000000e-5 * 10; +pde.dt = [dt*ones(1,nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; % tfinal = dt*nt + 10*dt*nt + 100*dt*8*nt % pde.dt = [dt*ones(1,nt)]; -pde.saveSolFreq = ceil(nt/100); +% pde.saveSolFreq = ceil(nt/100); +pde.saveSolFreq = 1; % pde.saveSolFreq = 100; % pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected -pde.timestepOffset = 600; +% pde.timestepOffset = 1400; % Solver params pde.linearsolveriter = 80; -pde.GMRESrestart = 19; -pde.linearsolvertol = 1e-5; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-4; pde.matvectol = 1e-7; -pde.NLiter = 4; -pde.RBdim = 40; +pde.NLiter = 2; +pde.RBdim = 5; pde.NLtol = 1e-9; +% pde.matvecorder = 1; pde.AV = 1; -% pde.nce = 12; +% pde.frozenAVflag = 0; +pde.nce = 12; %% Mutation information % Mutation configuration @@ -60,7 +63,7 @@ pde.mutationopts = {}; pde.mutationopts{1} = "air_5"; pde.mutationopts{2} = "ChemNonEq1T"; -pde.mutationopts{3} = "RRHO"; +pde.mutationopts{3} = "NASA-9"; pde.mutationpath = "/Users/rloekvh/Mutationpp"; nspecies = 5; @@ -69,9 +72,12 @@ pde.tau = [5, 5, 5, 5, 5, 5, 5, 5]; % mesh size -rbody = 0.045; -rdomain = 0.12; -[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_circincirc_Ma17b(pde.porder,61,61,rbody,rdomain,1); +% rbody = 0.045; +% rdomain = 0.12; +L_ref = 0.045; +rbody = 1; +rdomain = 3; +[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_uniform(pde.porder,81,81,rbody,rdomain,1); mesh.boundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1e-7, @(p) abs(p(1,:))<20}; % adiabatic wall, supersonic outflow, supersonic inflow mesh.boundarycondition = [3;2;1]; @@ -99,29 +105,35 @@ % Dimensional inflow quantities rho_inf = [1.0055500000000001e-09 0.00035318161606 1.5872374699999997e-05 0.00116691299088 1.103201281e-05]; -rhou_inf = 9.213932; +% rhou_inf = 9.213932; +rhou_inf = 6.1199319999999995; rhov_inf = 0.0; -rhoE_inf = 33563.20282790763; +% rhoE_inf = 33563.20282790763; +rhoE_inf = 18229.338827907628; % Reference quantities for nondimensionalizing rho_ref = 0.001547; % u_ref = 665.5369622053455; -u_ref = 5956; +% u_ref = 5956; +u_ref = 3956; % rhoE_ref = 685.2273261511706; rhoE_ref = rho_ref * u_ref^2; -T_ref = 374.6764014579334; +T_ref = 374.6764014579334 * (0.4); mu_ref = 4.415107627874723e-05; kappa_ref = 0.07663957108841235; % Nondimensional quantities -Re = 23319.605484391683; -Pr = 0.681045690355942; +cp = 1182.1920097928833; +% Re = 23319.605484391683; +% Pr = 0.681045690355942; +Re = rho_ref * L_ref * u_ref / mu_ref; +Pr = mu_ref * cp / kappa_ref; % Av params kb = 1.5; -sb0 = 0.001; +sb0 = 0.01; sbmax = 2.5; - +% pde.frozenAVflag=0; % Load into Exasim data structures pde.physicsparam(1:nspecies) = rho_inf; pde.physicsparam(nspecies+1) = rhou_inf; @@ -131,8 +143,8 @@ pde.physicsparam(16) = kb; pde.physicsparam(17) = sb0; pde.physicsparam(18) = sbmax; -pde.physicsparam(19) = Re; -pde.physicsparam(20) = Pr; +pde.physicsparam(19) = Pr; +pde.physicsparam(20) = Re; pde.externalparam = zeros(3*nspecies + 3 + ndim); pde.externalparam(1) = rho_ref; % rho_inf @@ -141,13 +153,22 @@ pde.externalparam(4) = T_ref; pde.externalparam(5) = mu_ref; pde.externalparam(6) = kappa_ref; +pde.externalparam(7) = L_ref; % intial solution ui = [rho_inf(:)'/rho_ref rhou_inf/(rho_ref*u_ref) rhov_inf/(rho_ref*u_ref) rhoE_inf/rhoE_ref]; UDG = initu(mesh,{ui(1),ui(2),ui(3),ui(4),ui(5),ui(6),ui(7),ui(8),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); % freestream UDG(:,nspecies+1,:) = UDG(:,nspecies+1,:).*tanh(100*dist); UDG(:,nspecies+2,:) = UDG(:,nspecies+2,:).*tanh(100*dist); +rhoe_dim = rhoE_inf - 1/2 * sum(rho_inf) * u_ref^2; +rhoe = rhoe_dim / (rhoE_ref); +% UDG(:,nspecies+ndim+1,:) = rhoe + 1/2 * (UDG(:,nspecies+1,:).^2 + UDG(:,nspecies+2,:).^2) ./ sum( UDG(:,1:nspecies,:), 2 ); mesh.udg = UDG; +% +% tmp = load('/Users/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/supercloud_data/Oct10Test/dmdn80.mat'); +% dmdtmp = getfield(tmp, 'dmd'); +% Uout = getsolution( '/Users/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/supercloud_data/Oct10Test/p1n80Ma8/out_t20000',dmdtmp,master.npe); +% mesh.udg = Uout; %% Call Exasim % search compilers and set options @@ -161,16 +182,26 @@ cd("app"); eval('!./fixargsMPP_Mac.sh'); eval('!cp opuApp_MPP.cpp opuApp.cpp'); -eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO -eval('!cp opuFbou_2d_MPP.cpp opuFbou.cpp'); %TODO -eval('!cp opuSource_2d_MPP.cpp opuSource.cpp'); %X +% % eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% % eval('!cp opuFbou_2d_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% eval('!cp opuFbou_2d_inviscid_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuSource_2d_MPP.cpp opuSource.cpp'); %X eval('!cp opuOutput_2d_MPP.cpp opuOutput.cpp'); %TODO -eval('!cp opuAvfield_2d_MPP.cpp opuAvfield.cpp') %X +% eval('!cp opuAvfield_2d_MPP.cpp opuAvfield.cpp') %X % eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +eval('!cp ../app_inviscid_regen/opuFlux_laplacian_manual.cpp opuFlux.cpp'); %TODO +eval('!cp ../app_inviscid_regen/opuFbou.cpp opuFbou.cpp'); +eval('!cp ../app_inviscid_regen/opuSource.cpp opuSource.cpp'); %X +eval('!cp ../app_inviscid_regen/opuAvfield.cpp opuAvfield.cpp') %X +eval('!cp ../app_inviscid_regen/opuUbou.cpp opuUbou.cpp'); + + cd(".."); % compile source codes to build an executable file and store it in app folder compilerstr = compilecode(pde); % run executable file to compute solution and store it in dataout folder -runstr = runcode(pde); +% runstr = runcode(pde); +disp("Done!"); diff --git a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_Ma5_inv.m b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_Ma5_inv.m new file mode 100644 index 00000000..71e914f4 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_Ma5_inv.m @@ -0,0 +1,214 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +%pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +pde.metis="/home/gridsan/rloekvh/.conda/envs/my_env/bin/mpmetis"; +pde.mpicompiler="/usr/local/pkg/openmpi/4.1.3/bin/mpicxx"; + +% pde.metis = "/opt/homebrew/Cellar/metis/5.1.0/bin/mpmetis"; +% pde.mpicompiler = "/usr/local/Cellar/open-mpi/4.1.2/bin/mpicxx "; +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; +% pde.cpulibflags = "-arch x86_64"; +% pde.cpuappflags = "-arch x86_64"; +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_2d"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 1; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +% tfinal = 0.000005; % 1 with 1e-4 doesn't work super well +tfinal = 0.0324; +% nt = 3240/10; +% dt = tfinal/nt; +% dt = 10*1e-5; +nt = 1000; +% nt = 150 +% dt = tfinal / nt; +dt = 2.5000000000000e-5; +%pde.dt = [dt*ones(1,50*nt),2*dt*ones(1, 50*nt), 5*dt*ones(1, 5*nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; + +pde.dt = [dt*ones(1,50*nt),2*dt*ones(1, 50*nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; +%pde.dt = [dt*ones(1,50*nt), 2*dt*ones(1, 50*nt)]; +% pde.dt = [dt*ones(1, nt)]; +% tfinal = dt*nt + 10*dt*nt + 100*dt*8*nt +% pde.dt = [dt*ones(1,nt)]; +pde.saveSolFreq = ceil(20*nt/20); +% pde.saveSolFreq = 100; +% pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +%pde.timestepOffset = 5000; + +% Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-6; +pde.matvectol = 1e-7; +pde.NLiter = 5; +pde.RBdim = 10; +pde.NLtol = 1e-9; + +pde.AV = 1; +pde.nce = 10; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +%pde.mutationpath = "/Users/rloekvh/Mutationpp"; +pde.mutationpath="/home/gridsan/rloekvh/Mutationpp"; + +nspecies = 5; + +%% Stabilization and mesh +ndim = 2; +pde.tau = [5, 5, 5, 5, 5, 5, 5, 5]; + +% mesh size +%rbody = 0.045; +%rdomain = 0.12; +L_ref = 0.045; +rbody = 1; +rdomain = 3; +%[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_circincirc_Ma17b(pde.porder,121,121,rbody,rdomain,1); +[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_uniform(pde.porder,81,81,1,3,1); +mesh.boundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1e-7, @(p) abs(p(1,:))<20}; +% adiabatic wall, supersonic outflow, supersonic inflow +mesh.boundarycondition = [3;2;1]; + +pde.pgauss = 2*(pde.porder); +pde.nd = ndim; +pde.elemtype = 1; +master = Master(pde); +[~, ~, jac] = volgeom(master.shapent,permute(mesh.dgnodes,[1 3 2])); +hsz = reshape(sqrt(jac),[],1,size(mesh.dgnodes,3)); +[~,cgelcon,rowent2elem,colent2elem,~] = mkcgent2dgent(mesh.dgnodes,1e-8); +hh = dg2cg2(max(hsz,0e-5), cgelcon, colent2elem, rowent2elem); +hh = dg2cg2(hh, cgelcon, colent2elem, rowent2elem); + +% distance to the wall +mesh.f = facenumbering(mesh.p,mesh.t,pde.elemtype,mesh.boundaryexpr,mesh.periodicexpr); +f = mkf(mesh.t,mesh.f,2); +dist = meshdist(f,mesh.dgnodes,master.perm,[1]); % distance to the wall + +mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = hh.*tanh(1000*dist); + +%% Initial conditions and parameters +% TL=9000 + +% Dimensional inflow quantities +rho_inf = [1.0055500000000001e-09 0.00035318161606 1.5872374699999997e-05 0.00116691299088 1.103201281e-05]; +%rhou_inf = 9.213932; +rhou_inf = 6.1199319999999995; +rhov_inf = 0.0; +%rhoE_inf = 33563.20282790763; +rhoE_inf = 18229.338827907628; +% Reference quantities for nondimensionalizing +rho_ref = 0.001547; + +%u_ref = 665.5369622053455; +%u_ref = 5956; +u_ref = 3956; +% rhoE_ref = 685.2273261511706; +rhoE_ref = rho_ref * u_ref^2; +T_ref = 374.6764014579334; +mu_ref = 4.415107627874723e-05; +kappa_ref = 0.07663957108841235; + +% Nondimensional quantities +%Re = 23319.605484391683; +%Pr = 0.681045690355942; +cp = 1182.1920097928833; +Re = rho_ref * u_ref * 1.0 / mu_ref; +Pr = mu_ref * cp / kappa_ref; + +% Av params +kb = 1.5; +sb0 = 0.001; +sbmax = 2.5; +%pde.frozenAVflag = 0; +% Load into Exasim data structures +pde.physicsparam(1:nspecies) = rho_inf; +pde.physicsparam(nspecies+1) = rhou_inf; +pde.physicsparam(nspecies+2) = rhov_inf; +pde.physicsparam(nspecies+3) = rhoE_inf; +pde.physicsparam(15) = pde.porder; +pde.physicsparam(16) = kb; +pde.physicsparam(17) = sb0; +pde.physicsparam(18) = sbmax; +pde.physicsparam(19) = Pr; +pde.physicsparam(20) = Re; + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = rho_ref; % rho_inf +pde.externalparam(2) = u_ref; % u_inf +pde.externalparam(3) = rhoE_ref; % rhoE_inf +pde.externalparam(4) = T_ref; +pde.externalparam(5) = mu_ref; +pde.externalparam(6) = kappa_ref; +pde.externalparam(7) = L_ref; + +% intial solution +ui = [rho_inf(:)'/rho_ref rhou_inf/(rho_ref*u_ref) rhov_inf/(rho_ref*u_ref) rhoE_inf/rhoE_ref]; +UDG = initu(mesh,{ui(1),ui(2),ui(3),ui(4),ui(5),ui(6),ui(7),ui(8),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); % freestream +UDG(:,nspecies+1,:) = UDG(:,nspecies+1,:).*tanh(100*dist); +UDG(:,nspecies+2,:) = UDG(:,nspecies+2,:).*tanh(100*dist); +rhoe_dim = rhoE_inf - 1/2 * sum(rho_inf) * u_ref^2; +rhoe = rhoe_dim / (rhoE_ref); +UDG(:,nspecies+ndim+1,:) = rhoe + 1/2 * (UDG(:,nspecies+1,:).^2 + UDG(:,nspecies+2,:).^2) ./ sum( UDG(:,1:nspecies,:), 2 ); + + +mesh.udg = UDG; + + +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +% gencode(pde); +cd("app"); +eval('!./fixargsMPP_Linux.sh'); +eval('!cp opuApp_MPP.cpp opuApp.cpp'); +%eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +%eval('!cp opuFbou_2d_inviscid_MPP.cpp opuFbou.cpp'); +%eval('!cp opuFbou_2d_MPP.cpp opuFbou.cpp'); %TODO +%eval('!cp opuFlux_2d_visc_MPP.cpp opuFlux.cpp'); %TODO +%eval('!cp opuFbou_2d_visc_MPP.cpp opuFbou.cpp'); %TODO +%eval('!cp opuSource_2d_MPP.cpp opuSource.cpp'); %X +%eval('!cp opuOutput_2d_MPP.cpp opuOutput.cpp'); %TODO +%eval('!cp opuAvfield_2d_MPP.cpp opuAvfield.cpp') %X +%eval('!cp opuAvfield_2d_MPP_ducros.cpp opuAvfield.cpp'); +%eval('!cp opuUbou_2d_inviscid_MPP.cpp opuUbou.cpp') +%eval('!cp opuUbou_2d_inv_test.cpp opuUbou.cpp'); +eval('!cp ../app_inviscid_regen/opuFlux.cpp opuFlux.cpp'); %TODO +eval('!cp ../app_inviscid_regen/opuFbou.cpp opuFbou.cpp'); +eval('!cp ../app_inviscid_regen/opuSource.cpp opuSource.cpp'); %X +eval('!cp ../app_inviscid_regen/opuAvfield.cpp opuAvfield.cpp') %X +eval('!cp ../app_inviscid_regen/opuUbou.cpp opuUbou.cpp'); + +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +%runstr = runcode(pde); +disp("Done!"); diff --git a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_PB_new.m b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_PB_new.m new file mode 100644 index 00000000..9897d456 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_PB_new.m @@ -0,0 +1,204 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +% % pde.enzyme = "ClangEnzyme-12.dylib"; +pde.metis = "/opt/homebrew/Cellar/metis/5.1.0/bin/mpmetis"; +pde.mpicompiler = "/usr/local/Cellar/open-mpi/4.1.2/bin/mpicxx"; + +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; +% pde.cpulibflags = "-arch x86_64"; +% pde.cpuappflags = "-arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_2d_PB_new"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 1; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +tfinal = 0.0324; +nt = 1000; +% dt = 10*2.5000000000000e-5; +dt = 1.0e-3; +pde.dt = dt*ones(1,nt); +pde.saveSolFreq=1; +% pde.timestepOffset = 650; +% Can start from 180 if we feel like it. + +% Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 29; +pde.linearsolvertol = 1e-4; +pde.matvectol = 1e-7; +pde.NLiter = 3; +% pde.RBdim = 10; +pde.NLtol = 1e-9; +pde.precMatrixType=2; +pde.ptcMatrixType=0; +pde.AV = 1; +pde.nce = 10; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +% pde.mutationpath="/home/gridsan/rloekvh/Mutationpp"; + +nspecies = 5; + +%% Stabilization and mesh +ndim = 2; +pde.tau =[5, 5, 5, 5, 5, 5, 5, 5]*2/5; + +% mesh size +%rbody = 0.045; +%rdomain = 0.12; +L_ref = 0.045; +rbody = 1; +rdomain = 3; +[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_uniform(pde.porder,81,81,rbody,rdomain,1); +mesh.boundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1e-7, @(p) abs(p(1,:))<20}; +% adiabatic wall, supersonic outflow, supersonic inflow +mesh.boundarycondition = [3;2;1]; + +pde.pgauss = 2*(pde.porder); +pde.nd = ndim; +pde.elemtype = 1; +master = Master(pde); +[~, ~, jac] = volgeom(master.shapent,permute(mesh.dgnodes,[1 3 2])); +hsz = reshape(sqrt(jac),[],1,size(mesh.dgnodes,3)); +[~,cgelcon,rowent2elem,colent2elem,~] = mkcgent2dgent(mesh.dgnodes,1e-8); +hh = dg2cg2(max(hsz,0e-5), cgelcon, colent2elem, rowent2elem); +hh = dg2cg2(hh, cgelcon, colent2elem, rowent2elem); + +% distance to the wall +mesh.f = facenumbering(mesh.p,mesh.t,pde.elemtype,mesh.boundaryexpr,mesh.periodicexpr); +f = mkf(mesh.t,mesh.f,2); +dist = meshdist(f,mesh.dgnodes,master.perm,[1]); % distance to the wall + +mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = hh.*tanh(50*dist); + +%% Initial conditions and parameters +% TL=9000 + +% Dimensional inflow quantities +rho_inf = [1.0055500000000001e-09 0.00035318161606 1.5872374699999997e-05 0.00116691299088 1.103201281e-05]; +% rhou_inf = 9.213932; +rhou_inf = 6.1199319999999995; +rhov_inf = 0.0; +% rhoE_inf = 33563.20282790763; +rhoE_inf = 18229.338827907628; +% Reference quantities for nondimensionalizing +rho_ref = 0.001547; + +% u_ref = 665.5369622053455; +% u_ref = 5956; +u_ref = 3956; +% rhoE_ref = 685.2273261511706; +rhoE_ref = rho_ref * u_ref^2; +T_ref = 374.6764014579334 / 0.4; +mu_ref = 4.415107627874723e-05; +kappa_ref = 0.07663957108841235; + +% Nondimensional quantities +%Re = 23319.605484391683; +%Pr = 0.681045690355942; +cp = 1182.1920097928833; +Re = rho_ref * u_ref * 1.0 / mu_ref; +Pr = mu_ref * cp / kappa_ref; + +% Av params +kb = 10; %TODO: note i changed these +sb0 = 0.1; +sbmax = 2.5; +kk = 0.5; +%pde.frozenAVflag = 0; +% Load into Exasim data structures +pde.physicsparam(1:nspecies) = rho_inf; +pde.physicsparam(nspecies+1) = rhou_inf; +pde.physicsparam(nspecies+2) = rhov_inf; +pde.physicsparam(nspecies+3) = rhoE_inf; +pde.physicsparam(15) = pde.porder; +pde.physicsparam(16) = kb; +pde.physicsparam(17) = sb0; +pde.physicsparam(18) = sbmax; +pde.physicsparam(19) = Pr; +pde.physicsparam(20) = Re; +pde.physicsparam(21) = kk; %avk +pde.physicsparam(22) = 1.0e8; +pde.physicsparam(23) = 1.0e4; + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = rho_ref; % rho_inf +pde.externalparam(2) = u_ref; % u_inf +pde.externalparam(3) = rhoE_ref; % rhoE_inf +pde.externalparam(4) = T_ref; +pde.externalparam(5) = mu_ref; +pde.externalparam(6) = kappa_ref; +pde.externalparam(7) = L_ref; + +% intial solution +ui = [rho_inf(:)'/rho_ref rhou_inf/(rho_ref*u_ref) rhov_inf/(rho_ref*u_ref) rhoE_inf/rhoE_ref]; +UDG = initu(mesh,{ui(1),ui(2),ui(3),ui(4),ui(5),ui(6),ui(7),ui(8),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); % freestream +UDG(:,nspecies+1,:) = UDG(:,nspecies+1,:).*tanh(10*dist); +UDG(:,nspecies+2,:) = UDG(:,nspecies+2,:).*tanh(10*dist); +rhoe_dim = rhoE_inf - 1/2 * sum(rho_inf) * u_ref^2; +rhoe = rhoe_dim / (rhoE_ref); +UDG(:,nspecies+ndim+1,:) = rhoe + 1/2 * (UDG(:,nspecies+1,:).^2 + UDG(:,nspecies+2,:).^2) ./ sum( UDG(:,1:nspecies,:), 2 ); + + +mesh.udg = UDG; + +tmp = load('/Users/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/supercloud_data/lastweektests/check_av_near_bou/dmd.mat'); +dmdtmp = getfield(tmp, 'dmd'); +Uout = getsolution( '/Users/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/supercloud_data/lastweektests/check_av_near_bou/out_t900',dmdtmp,master.npe); +mesh.udg = Uout; + + +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +% eval('!./fixargsMPP_Linux.sh'); +eval('!./fixargsMPP_Mac.sh'); +eval('!cp opuApp_MPP.cpp opuApp.cpp'); +% eval('!cp opuFlux_2d_PB_MPP_2_manual.cpp opuFlux.cpp'); %TODO +% eval('!cp opuFbou_2d_PB_MPP_2_manual.cpp opuFbou.cpp'); %TODO +% eval('!cp opuSource_2d_MPP_2.cpp opuSource.cpp'); %X +% eval('!cp opuOutput_2d_PB_MPP_2.cpp opuOutput.cpp'); %TODO +% eval('!cp opuAvfield_2d_PB_MPP_2.cpp opuAvfield.cpp'); +eval('!cp ../app_inv_pb_regen/opuFlux.cpp opuFlux.cpp'); %TODO +eval('!cp ../app_inv_pb_regen/opuFbou.cpp opuFbou.cpp'); +eval('!cp ../app_inv_pb_regen/opuSource.cpp opuSource.cpp'); %X +eval('!cp ../app_inv_pb_regen/opuAvfield.cpp opuAvfield.cpp') %X +eval('!cp ../app_inv_pb_regen/opuUbou.cpp opuUbou.cpp'); +eval('!cp ../app_inv_pb_regen/opuOutput.cpp opuOutput.cpp'); +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +%runstr = runcode(pde); +disp("Done!"); diff --git a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_La.m b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_La.m new file mode 100644 index 00000000..bf7c28be --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_La.m @@ -0,0 +1,197 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; + +% pde.metis="/home/gridsan/rloekvh/.conda/envs/my_env/bin/mpmetis"; +% pde.mpicompiler="/usr/local/pkg/openmpi/4.1.3/bin/mpicxx"; +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_visc_la"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +% pde.mpiprocs = 96; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 2; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +tfinal = 0.0324; + +nt = 100; +dt = 2.500000000000e-5 * 10 +pde.dt = [dt*ones(1,nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; +pde.saveSolFreq = 1; + +% Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-4; +pde.matvectol = 1e-7; +pde.NLiter = 3; +pde.NLtol = 1e-9; +pde.precMatrixType=2; +pde.ptcMatrixType=0; + +pde.AV = 1; +pde.nce = 12; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +nspecies = 5; + +%% Stabilization and mesh +ndim = 2; +pde.tau = [5, 5, 5, 5, 5, 5, 5, 5]; + +L_ref = 0.045; +rbody = 1; +rdomain = 3; +[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_uniform(pde.porder,61,61,rbody,rdomain,1); +mesh.boundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1e-7, @(p) abs(p(1,:))<20}; +% adiabatic wall, supersonic outflow, supersonic inflow +mesh.curvedboundary = [1 0 1]; +mesh.curvedboundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1, @(p) p(1,:), @(p) sqrt(p(1,:).^2 + sqrt(1-p(2,:)).^2/9)}; + +mesh.boundarycondition = [3;2;1]; + +pde.pgauss = 2*(pde.porder); +pde.nd = ndim; +pde.elemtype = 1; +master = Master(pde); +[~, ~, jac] = volgeom(master.shapent,permute(mesh.dgnodes,[1 3 2])); +hsz = reshape(sqrt(jac),[],1,size(mesh.dgnodes,3)); +[~,cgelcon,rowent2elem,colent2elem,~] = mkcgent2dgent(mesh.dgnodes,1e-8); +hh = dg2cg2(max(hsz,0e-5), cgelcon, colent2elem, rowent2elem); +hh = dg2cg2(hh, cgelcon, colent2elem, rowent2elem); + +% distance to the wall +mesh.f = facenumbering(mesh.p,mesh.t,pde.elemtype,mesh.boundaryexpr,mesh.periodicexpr); +f = mkf(mesh.t,mesh.f,2); +dist = meshdist(f,mesh.dgnodes,master.perm,[1]); % distance to the wall + +mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = hh.*tanh(1000*dist); + +%% Initial conditions and parameters +% TL=9000 + +% Dimensional inflow quantities +rho_inf = [1.0055500000000001e-09 0.00035318161606 1.5872374699999997e-05 0.00116691299088 1.103201281e-05]; +rhou_inf = 6.1199319999999995; +rhov_inf = 0.0; +rhoE_inf = 18229.338827907628; + +% Reference quantities for nondimensionalizing +rho_ref = 0.001547; +u_ref = 3956; + +rhoE_ref = rho_ref * u_ref^2; +T_ref = 374.6764014579334 * (0.4); +mu_ref = 4.415107627874723e-05; +kappa_ref = 0.07663957108841235; + +% Nondimensional quantities +cp = 1182.1920097928833; +Re = rho_ref * L_ref * u_ref / mu_ref; +Pr = mu_ref * cp / kappa_ref; + +% Av params +kb = 1.5; +sb0 = 0.02; +sbmax = 2.5; +kk = Inf; + +% Load into Exasim data structures +pde.physicsparam(1:nspecies) = rho_inf; +pde.physicsparam(nspecies+1) = rhou_inf; +pde.physicsparam(nspecies+2) = rhov_inf; +pde.physicsparam(nspecies+3) = rhoE_inf; +pde.physicsparam(15) = pde.porder; +pde.physicsparam(16) = kb; +pde.physicsparam(17) = sb0; +pde.physicsparam(18) = sbmax; +pde.physicsparam(19) = Pr; +pde.physicsparam(20) = Re; +pde.physicsparam(21) = kk; %avk +pde.physicsparam(22) = 1.0e8; %alpha +pde.physicsparam(23) = 1.0e4; %sigma + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = rho_ref; % rho_inf +pde.externalparam(2) = u_ref; % u_inf +pde.externalparam(3) = rhoE_ref; % rhoE_inf +pde.externalparam(4) = T_ref; +pde.externalparam(5) = mu_ref; +pde.externalparam(6) = kappa_ref; +pde.externalparam(7) = L_ref; + +% intial solution +ui = [rho_inf(:)'/rho_ref rhou_inf/(rho_ref*u_ref) rhov_inf/(rho_ref*u_ref) rhoE_inf/rhoE_ref]; +UDG = initu(mesh,{ui(1),ui(2),ui(3),ui(4),ui(5),ui(6),ui(7),ui(8),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); % freestream +UDG(:,nspecies+1,:) = UDG(:,nspecies+1,:).*tanh(10*dist); +UDG(:,nspecies+2,:) = UDG(:,nspecies+2,:).*tanh(10*dist); +rhoe_dim = rhoE_inf - 1/2 * sum(rho_inf) * u_ref^2; +rhoe = rhoe_dim / (rhoE_ref); +UDG(:,nspecies+ndim+1,:) = rhoe + 1/2 * (UDG(:,nspecies+1,:).^2 + UDG(:,nspecies+2,:).^2) ./ sum( UDG(:,1:nspecies,:), 2 ); +mesh.udg = UDG; + +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +% [pde,mesh,master,dmd] = preprocessing(pde,mesh); +dmdtmp = load('supercloud_data/visc_tests/t0to2_5/dmd.mat'); +%Uout = getsolution(['/home/gridsan/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/laplacian_snapshots/out_t' num2str(10000)],dmd,master.npe); +Uout = getsolution(['/Users/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/supercloud_data/visc_tests/t0to2_5/out_t' num2str(10000)],dmdtmp.dmd,master.npe); +mesh.udg = Uout; + +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +eval('!cp ../app_visc_la_regen/* .'); +eval('!cp opuApp_MPP.cpp opuApp.cpp'); +% % eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% % eval('!cp opuFbou_2d_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% eval('!cp opuFbou_2d_inviscid_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuSource_2d_MPP.cpp opuSource.cpp'); %X +% eval('!cp opuOutput_2d_MPP.cpp opuOutput.cpp'); %TODO +% eval('!cp opuAvfield_2d_MPP.cpp opuAvfield.cpp') %X +% eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +% eval('!cp ../app_inviscid_regen/opuFlux_laplacian_manual.cpp opuFlux.cpp'); %TODO +% eval('!cp ../app_inviscid_regen/opuFbou.cpp opuFbou.cpp'); +% eval('!cp ../app_inviscid_regen/opuSource.cpp opuSource.cpp'); %X +% eval('!cp ../app_inviscid_regen/opuAvfield.cpp opuAvfield.cpp') %X +% eval('!cp ../app_inviscid_regen/opuUbou.cpp opuUbou.cpp'); + + +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +% runstr = runcode(pde); +disp("Done!"); diff --git a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB.m b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB.m new file mode 100644 index 00000000..e0a559d2 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB.m @@ -0,0 +1,204 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +% pde.metis = "/opt/homebrew/Cellar/metis/5.1.0/bin/mpmetis"; +% pde.mpicompiler = "/usr/local/Cellar/open-mpi/4.1.2/bin/mpicxx"; +% pde.metis="/home/gridsan/rloekvh/.conda/envs/my_env/bin/mpmetis"; +% pde.mpicompiler="/usr/local/pkg/openmpi/4.1.3/bin/mpicxx"; +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_visc_pb"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 2; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +tfinal = 0.0324; + +nt = 10000; +dt = 2.500000000000e-5 * 10; +pde.dt = [dt*ones(1,nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; +pde.saveSolFreq = 5; +% pde.timestepOffset = 250 +% Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-4; +pde.matvectol = 1e-7; +pde.NLiter = 3; +pde.NLtol = 1e-9; +pde.precMatrixType=2; +pde.ptcMatrixType=0; + +pde.AV = 1; +pde.nce = 12; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +% pde.mutationpath="/home/gridsan/rloekvh/Mutationpp"; +nspecies = 5; + +%% Stabilization and mesh +ndim = 2; +pde.tau = [5, 5, 5, 5, 5, 5, 5, 5]; + +L_ref = 0.045; +rbody = 1; +rdomain = 3; +[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_uniform(pde.porder,61,61,rbody,rdomain,1); +mesh.boundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1e-7, @(p) abs(p(1,:))<20}; +% adiabatic wall, supersonic outflow, supersonic inflow +mesh.curvedboundary = [1 0 1]; +mesh.curvedboundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1, @(p) p(1,:), @(p) sqrt(p(1,:).^2 + sqrt(1-p(2,:)).^2/9)}; + +mesh.boundarycondition = [3;2;1]; + +pde.pgauss = 2*(pde.porder); +pde.nd = ndim; +pde.elemtype = 1; +master = Master(pde); +[~, ~, jac] = volgeom(master.shapent,permute(mesh.dgnodes,[1 3 2])); +hsz = reshape(sqrt(jac),[],1,size(mesh.dgnodes,3)); +[~,cgelcon,rowent2elem,colent2elem,~] = mkcgent2dgent(mesh.dgnodes,1e-8); +hh = dg2cg2(max(hsz,0e-5), cgelcon, colent2elem, rowent2elem); +hh = dg2cg2(hh, cgelcon, colent2elem, rowent2elem); + +% distance to the wall +mesh.f = facenumbering(mesh.p,mesh.t,pde.elemtype,mesh.boundaryexpr,mesh.periodicexpr); +f = mkf(mesh.t,mesh.f,2); +dist = meshdist(f,mesh.dgnodes,master.perm,[1]); % distance to the wall + +mesh.vdg = zeros(size(mesh.dgnodes,1),2,size(mesh.dgnodes,3)); +mesh.vdg(:,2,:) = hh.*tanh(1000*dist); + +%% Initial conditions and parameters +% TL=9000 + +% Dimensional inflow quantities +rho_inf = [1.0055500000000001e-09 0.00035318161606 1.5872374699999997e-05 0.00116691299088 1.103201281e-05]; +rhou_inf = 6.1199319999999995; +rhov_inf = 0.0; +rhoE_inf = 18229.338827907628; + +% Reference quantities for nondimensionalizing +rho_ref = 0.001547; +u_ref = 3956; + +rhoE_ref = rho_ref * u_ref^2; +% T_ref = 374.6764014579334 * (0.4); +T_ref = 360.4; +mu_ref = 4.415107627874723e-05; +kappa_ref = 0.07663957108841235; + +% Nondimensional quantities +cp = 1182.1920097928833; +Re = rho_ref * L_ref * u_ref / mu_ref; +Pr = mu_ref * cp / kappa_ref; + +% Av params +kb = 1.5; +sb0 = 0.02; +sbmax = 2.5; +kk = 1.0; + +% Load into Exasim data structures +pde.physicsparam(1:nspecies) = rho_inf; +pde.physicsparam(nspecies+1) = rhou_inf; +pde.physicsparam(nspecies+2) = rhov_inf; +pde.physicsparam(nspecies+3) = rhoE_inf; +pde.physicsparam(15) = pde.porder; +pde.physicsparam(16) = kb; +pde.physicsparam(17) = sb0; +pde.physicsparam(18) = sbmax; +pde.physicsparam(19) = Pr; +pde.physicsparam(20) = Re; +pde.physicsparam(21) = kk; %avk +pde.physicsparam(22) = 1.0e8; %alpha +pde.physicsparam(23) = 1.0e4; %sigma + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = rho_ref; % rho_inf +pde.externalparam(2) = u_ref; % u_inf +pde.externalparam(3) = rhoE_ref; % rhoE_inf +pde.externalparam(4) = T_ref; +pde.externalparam(5) = mu_ref; +pde.externalparam(6) = kappa_ref; +pde.externalparam(7) = L_ref; + +% intial solution +ui = [rho_inf(:)'/rho_ref rhou_inf/(rho_ref*u_ref) rhov_inf/(rho_ref*u_ref) rhoE_inf/rhoE_ref]; +UDG = initu(mesh,{ui(1),ui(2),ui(3),ui(4),ui(5),ui(6),ui(7),ui(8),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); % freestream +UDG(:,nspecies+1,:) = UDG(:,nspecies+1,:).*tanh(10*dist); +UDG(:,nspecies+2,:) = UDG(:,nspecies+2,:).*tanh(10*dist); +rhoe_dim = rhoE_inf - 1/2 * sum(rho_inf) * u_ref^2; +rhoe = rhoe_dim / (rhoE_ref); +UDG(:,nspecies+ndim+1,:) = rhoe + 1/2 * (UDG(:,nspecies+1,:).^2 + UDG(:,nspecies+2,:).^2) ./ sum( UDG(:,1:nspecies,:), 2 ); +mesh.udg = UDG; + +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +% [pde,mesh,master,dmd] = preprocessing(pde,mesh); +dmdtmp = load('supercloud_data/visc_tests/t0to2_5/dmd.mat'); +%Uout = getsolution(['/home/gridsan/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/laplacian_snapshots/out_t' num2str(10000)],dmd,master.npe); +Uout = getsolution(['/Users/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/supercloud_data/visc_tests/t0to2_5/out_t' num2str(10000)],dmdtmp.dmd,master.npe); +mesh.udg = Uout; + + +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +% eval('!./fixargsMPP_Linux.sh'); +eval('!cp ../app_visc_pb_regen/* .'); +% eval('!cp ../app_visc_pb_regen/opuAvfield_noreg.cpp opuAvfield.cpp') +% eval('!cp ../app_visc_la_regen/* .'); +% eval('!cp opuApp_MPP.cpp opuApp.cpp'); +% % eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% % eval('!cp opuFbou_2d_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% eval('!cp opuFbou_2d_inviscid_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuSource_2d_MPP.cpp opuSource.cpp'); %X +% eval('!cp opuOutput_2d_MPP.cpp opuOutput.cpp'); %TODO +% eval('!cp opuAvfield_2d_MPP.cpp opuAvfield.cpp') %X +% eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +% eval('!cp ../app_inviscid_regen/opuFlux_laplacian_manual.cpp opuFlux.cpp'); %TODO +% eval('!cp ../app_inviscid_regen/opuFbou.cpp opuFbou.cpp'); +% eval('!cp ../app_inviscid_regen/opuSource.cpp opuSource.cpp'); %X +% eval('!cp ../app_inviscid_regen/opuAvfield.cpp opuAvfield.cpp') %X +% eval('!cp ../app_inviscid_regen/opuUbou.cpp opuUbou.cpp'); + + +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +% runstr = runcode(pde); +disp("Done!"); diff --git a/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB_Di.m b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB_Di.m new file mode 100644 index 00000000..bd051851 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder_visc_PB_Di.m @@ -0,0 +1,202 @@ +% Add Exasim to Matlab search path +cdir = pwd(); ii = strfind(cdir, "Exasim"); +run(cdir(1:(ii+5)) + "/Installation/setpath.m"); + +% initialize pde structure and mesh structure +[pde,mesh] = initializeexasim(); + +pde.cpucompiler="/opt/homebrew/Cellar/llvm@12/12.0.1_1/bin/clang++"; +% pde.metis = "/opt/homebrew/Cellar/metis/5.1.0/bin/mpmetis"; +% pde.mpicompiler = "/usr/local/Cellar/open-mpi/4.1.2/bin/mpicxx"; +% pde.metis="/home/gridsan/rloekvh/.conda/envs/my_env/bin/mpmetis"; +% pde.mpicompiler="/usr/local/pkg/openmpi/4.1.3/bin/mpicxx"; +% pde.cpuflags = pde.cpuflags + " -arch x86_64"; + +% Define a PDE model: governing equations, initial solutions, and boundary conditions +pde.model = "ModelD"; % ModelC, ModelD, ModelW +pde.modelfile = "pdemodel_visc_pb_di"; % name of a file defining the PDE model + +% Choose computing platform and set number of processors +pde.mpiprocs = 1; % number of MPI processors + +%% Set discretization parameters, physical parameters, and solver parameters +pde.porder = 2; % polynomial degree +pde.torder = 1; % time-stepping order of accuracy +pde.nstage = 1; % time-stepping number of stages + +tfinal = 0.0324; + +nt = 10000; +dt = 2.500000000000e-5 * 10 * 5; +pde.dt = [dt*ones(1,nt)]; %, 10*dt*ones(1, nt), 100*dt*ones(1,8*nt)]; +pde.saveSolFreq = 5; +% pde.timestepOffset = 250 +% Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-4; +pde.matvectol = 1e-7; +pde.NLiter = 3; +pde.NLtol = 1e-9; +pde.precMatrixType=2; +pde.ptcMatrixType=0; + +pde.AV = 1; +pde.nce = 12; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "RRHO"; +pde.mutationpath = "/Users/rloekvh/Mutationpp"; +% pde.mutationpath="/home/gridsan/rloekvh/Mutationpp"; +nspecies = 5; + +%% Stabilization and mesh +ndim = 2; +pde.tau = [5, 5, 5, 5, 5, 5, 5, 5]; + +L_ref = 0.045; +rbody = 1; +rdomain = 3; +[mesh.p,mesh.t,mesh.dgnodes] = mkmesh_uniform(pde.porder,61,61,rbody,rdomain,1); +mesh.boundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1e-7, @(p) abs(p(1,:))<20}; +% adiabatic wall, supersonic outflow, supersonic inflow +mesh.curvedboundary = [1 0 1]; +mesh.curvedboundaryexpr = {@(p) sqrt(p(1,:).^2+p(2,:).^2)-1, @(p) p(1,:), @(p) sqrt(p(1,:).^2 + sqrt(1-p(2,:)).^2/9)}; + +mesh.boundarycondition = [3;2;1]; + +pde.pgauss = 2*(pde.porder); +pde.nd = ndim; +pde.elemtype = 1; +master = Master(pde); +[~, ~, jac] = volgeom(master.shapent,permute(mesh.dgnodes,[1 3 2])); +hsz = reshape(sqrt(jac),[],1,size(mesh.dgnodes,3)); +[~,cgelcon,rowent2elem,colent2elem,~] = mkcgent2dgent(mesh.dgnodes,1e-8); +hh = dg2cg2(max(hsz,0e-5), cgelcon, colent2elem, rowent2elem); +hh = dg2cg2(hh, cgelcon, colent2elem, rowent2elem); + +% distance to the wall +mesh.f = facenumbering(mesh.p,mesh.t,pde.elemtype,mesh.boundaryexpr,mesh.periodicexpr); +f = mkf(mesh.t,mesh.f,2); +dist = meshdist(f,mesh.dgnodes,master.perm,[1]); % distance to the wall + +mesh.vdg = zeros(size(mesh.dgnodes,1),7,size(mesh.dgnodes,3)); +mesh.vdg(:,7,:) = hh.*tanh(1000*dist); + +%% Initial conditions and parameters +% TL=9000 + +% Dimensional inflow quantities +rho_inf = [1.0055500000000001e-09 0.00035318161606 1.5872374699999997e-05 0.00116691299088 1.103201281e-05]; +rhou_inf = 6.1199319999999995; +rhov_inf = 0.0; +rhoE_inf = 18229.338827907628; + +% Reference quantities for nondimensionalizing +rho_ref = 0.001547; +u_ref = 3956; + +rhoE_ref = rho_ref * u_ref^2; +T_ref = 374.6764014579334 * (0.4); +mu_ref = 4.415107627874723e-05; +kappa_ref = 0.07663957108841235; + +% Nondimensional quantities +cp = 1182.1920097928833; +Re = rho_ref * L_ref * u_ref / mu_ref; +Pr = mu_ref * cp / kappa_ref; + +% Av params +kb = 1.5; +sb0 = 0.005; +sbmax = 2.5; +kk = 1.0; + +% Load into Exasim data structures +pde.physicsparam(1:nspecies) = rho_inf; +pde.physicsparam(nspecies+1) = rhou_inf; +pde.physicsparam(nspecies+2) = rhov_inf; +pde.physicsparam(nspecies+3) = rhoE_inf; +pde.physicsparam(15) = pde.porder; +pde.physicsparam(16) = kb; +pde.physicsparam(17) = sb0; +pde.physicsparam(18) = sbmax; +pde.physicsparam(19) = Pr; +pde.physicsparam(20) = Re; +pde.physicsparam(21) = kk; %avk +pde.physicsparam(22) = 1.0e8; %alpha +pde.physicsparam(23) = 1.0e4; %sigma + +pde.externalparam = zeros(3*nspecies + 3 + ndim); +pde.externalparam(1) = rho_ref; % rho_inf +pde.externalparam(2) = u_ref; % u_inf +pde.externalparam(3) = rhoE_ref; % rhoE_inf +pde.externalparam(4) = T_ref; +pde.externalparam(5) = mu_ref; +pde.externalparam(6) = kappa_ref; +pde.externalparam(7) = L_ref; + +% intial solution +ui = [rho_inf(:)'/rho_ref rhou_inf/(rho_ref*u_ref) rhov_inf/(rho_ref*u_ref) rhoE_inf/rhoE_ref]; +UDG = initu(mesh,{ui(1),ui(2),ui(3),ui(4),ui(5),ui(6),ui(7),ui(8),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); % freestream +UDG(:,nspecies+1,:) = UDG(:,nspecies+1,:).*tanh(10*dist); +UDG(:,nspecies+2,:) = UDG(:,nspecies+2,:).*tanh(10*dist); +rhoe_dim = rhoE_inf - 1/2 * sum(rho_inf) * u_ref^2; +rhoe = rhoe_dim / (rhoE_ref); +UDG(:,nspecies+ndim+1,:) = rhoe + 1/2 * (UDG(:,nspecies+1,:).^2 + UDG(:,nspecies+2,:).^2) ./ sum( UDG(:,1:nspecies,:), 2 ); +mesh.udg = UDG; + +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +% [pde,mesh,master,dmd] = preprocessing(pde,mesh); +dmdtmp = load('supercloud_data/visc_tests/t0to2_5/dmd.mat'); +%Uout = getsolution(['/home/gridsan/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/laplacian_snapshots/out_t' num2str(10000)],dmd,master.npe); +Uout = getsolution(['/Users/rloekvh/Exasim/Applications/Hypersonics/ReactingCylinder/supercloud_data/visc_tests/t0to2_5/out_t' num2str(10000)],dmdtmp.dmd,master.npe); +mesh.udg = Uout; + + +%% Call Exasim +% search compilers and set options +pde = setcompilers(pde); + +% generate input files and store them in datain folder +[pde,mesh,master,dmd] = preprocessing(pde,mesh); + +% generate source codes and store them in app folder +% gencode(pde); +cd("app"); +eval('!./fixargsMPP_Mac.sh'); +% eval('!./fixargsMPP_Linux.sh'); +eval('!cp ../app_visc_pb_Di_regen/* .'); +% eval('!cp ../app_visc_la_regen/* .'); +% eval('!cp opuApp_MPP.cpp opuApp.cpp'); +% % eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% % eval('!cp opuFbou_2d_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuFlux_2d_MPP.cpp opuFlux.cpp'); %TODO +% eval('!cp opuFbou_2d_inviscid_MPP.cpp opuFbou.cpp'); %TODO +% eval('!cp opuSource_2d_MPP.cpp opuSource.cpp'); %X +% eval('!cp opuOutput_2d_MPP.cpp opuOutput.cpp'); %TODO +% eval('!cp opuAvfield_2d_MPP.cpp opuAvfield.cpp') %X +% eval('!cp opuUbou_MPP.cpp opuUbou.cpp') +% eval('!cp ../app_inviscid_regen/opuFlux_laplacian_manual.cpp opuFlux.cpp'); %TODO +% eval('!cp ../app_inviscid_regen/opuFbou.cpp opuFbou.cpp'); +% eval('!cp ../app_inviscid_regen/opuSource.cpp opuSource.cpp'); %X +% eval('!cp ../app_inviscid_regen/opuAvfield.cpp opuAvfield.cpp') %X +% eval('!cp ../app_inviscid_regen/opuUbou.cpp opuUbou.cpp'); + + +cd(".."); + +% compile source codes to build an executable file and store it in app folder +compilerstr = compilecode(pde); + +% run executable file to compute solution and store it in dataout folder +% runstr = runcode(pde); +disp("Done!"); diff --git a/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m b/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m index b9713142..0689e865 100644 --- a/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m @@ -16,74 +16,6 @@ f = avfieldLaplacian2d(u, q, w, v, x, t, mu, eta, nspecies, nd); end -% function avField = avfieldLaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd) -% % Mutation outputs -% p = eta(1); -% gam = eta(2); -% gam1 = gam - 1; -% -% % artificial viscosity -% porder = mu(15); -% -% % regularization parameters for the bulk viscosity -% kb = mu(16); -% sb0 = mu(17); %0.02 -% sbmin = 0.0; -% sbmax = mu(18);% / sqrt(gam*gam - 1.0); %2.5 TODO: unsure that this should be changing -% -% % regularization parameters -% alpha = 1.0e12; -% rmin = 0.0; -% Hmin = 1.0e-4; -% -% % mesh size -% hm = v(2); -% -% % Get base variables -% rvec = u(1:nspecies); -% ru = u(nspecies+1); -% rv = u(nspecies+nd); -% rE = u(nspecies+nd+1); -% -% rx = sum(-q(1:nspecies)); -% rux = -q(nspecies+1); -% rvx = -q(nspecies+nd); -% -% % Regularization -% rvec = rmin + lmax(rvec-rmin,alpha); % need to double check regularizatino here -% -% % Simple derived working quantities -% r = sum(rvec); -% r1 = 1./r; -% uv = ru.*r1; -% vv = rv.*r1; -% E = rE * r1; %energy -% H = E + p*r1; %enthalpy -% H = Hmin + lmax(H - Hmin, alpha); -% -% % Critical speed of Sound -% c_star = sqrt((2.*gam1.*H) ./ (gam+1)); %TODO: this is fine for 1 temp but not 2 -% -% % Computing derivatives for the sensors -% ux = (rux - rx.*uv).*r1; -% vx = (rvx - rx.*vv).*r1; -% div_v = (ux + vx); %TODO: check signs. Actually this probably is important, we want to make sure it's applied in negative v. pos dilitation -% % pretty sure my signs are okay. There is something strange about the code I was given. Truly don't understand the signs -% % limit divergence and vorticity -% sigm = 1e4; -% div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); -% -% % % Dilatation Sensor sb -% sb = - (hm./porder) .* (div_v./c_star); -% sb = limiting(sb,sbmin,sbmax,alpha,sb0); % TODO: what should sbmin, sbmax, alpha, and sb0 be -% % sb = log(1 + exp(alpha * (sb - 0.01)))/alpha; -% % Artificial Bulk viscosity -% avb = (kb.*hm./(porder)) .* (abs(uv) + abs(vv) + abs(c_star)) .* sb; -% -% % Assign artificial viscosities -% avField(1) = avb; % bulk -% end - function m = mass(u, q, w, v, x, t, mu, eta) nspecies = 5; ndim = 2; @@ -93,19 +25,16 @@ function f = flux(u, q, w, v, x, t, mu, eta) nspecies = 5; nd = 2; - % % Clipper utilities - % alpha = 1.0e3; - % rmin = 0.0; fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); - fv = fluxviscous(u, q, w, v, x, t, mu, eta, nspecies, nd); + fv = fluxviscousLa(u, q, w, v, x, t, mu, eta, nspecies, nd); fl = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); f = fi - fv - fl; end function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) rmin = 0.0; - alpha = 1.0e12; + alpha = mu(21); eps_av = v(1); nenergy = 1; ncu = nspecies + ndim + nenergy; @@ -115,11 +44,11 @@ r_vec = u(1:nspecies); dr = dlmax(r_vec-rmin,alpha); % Regularize derivative - drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha); + drho_dx_i = -q(1:nspecies).*dr; %.* dlmax(u(1:nspecies)-rmin,alpha); drhou_dx = -q(nspecies+1); drhov_dx = -q(nspecies+2); drhoE_dx = -q(nspecies+ndim+1); - drho_dy_i = -q(ncu+1:ncu+nspecies) .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha); + drho_dy_i = -q(ncu+1:ncu+nspecies) .*dr;% .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha); drhou_dy = -q(ncu+nspecies+1); drhov_dy = -q(ncu+nspecies+2); drhoE_dy = -q(ncu+nspecies+ndim+1); @@ -143,7 +72,7 @@ rho = sym(0); rmin = 0.0; - alpha = 1.0e12; + alpha = mu(21); % Conservative Variables for ispecies = 1:nspecies @@ -190,14 +119,14 @@ -function fv = fluxviscous(u, q, w, v, x, t, mu, eta, nspecies, ndim) +function fv = fluxviscousLa(u, q, w, v, x, t, mu, eta, nspecies, ndim) %TODO for thursday: % - double check with papers: consistent with may, gnoffo. Maybe typo in su2mpp? % - double check with NS code (TODO: REALLY CONFUSED ABOUT SIGN OF STRESS TENSOR) % - add AV options: tomorrow, be clear about shear, bulk, thermal, and how density should come into this (let's discuss) % - try to generate rmin = 0.0; - alpha = 1e12; + alpha = mu(22); nenergy=1; ncu = nspecies + ndim + nenergy; @@ -216,16 +145,17 @@ beta = 0.0; rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + dr = dlmax(u(1:nspecies)-rmin,alpha); % Regularize derivative rhou = u(nspecies+1); rhov = u(nspecies+2); rhoE = u(nspecies+ndim+1); - drho_dx_i = -q(1:nspecies) .* dlmax(u(1:nspecies)-rmin,alpha); + drho_dx_i = -q(1:nspecies) .* dr; drhou_dx = -q(nspecies+1); drhov_dx = -q(nspecies+2); drhoE_dx = -q(nspecies+ndim+1); - drho_dy_i = -q(ncu+1:ncu+nspecies) .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dr; drhou_dy = -q(ncu+nspecies+1); drhov_dy = -q(ncu+nspecies+2); drhoE_dy = -q(ncu+nspecies+ndim+1); @@ -327,9 +257,10 @@ ndim = 2; fb = sym(zeros(nspecies+ndim+1, 3)); - f = flux(u, q, w, v, x, t, mu, eta); + f = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim); % maybe should be uhat here? fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); +% OH maybe I need to change fadiabatic = fn; fadiabatic(1:nspecies) = 0.0; fadiabatic(nspecies+ndim+1) = 0.0; diff --git a/Applications/Hypersonics/ReactingCylinder/pdemodel_2d_PB_new.m b/Applications/Hypersonics/ReactingCylinder/pdemodel_2d_PB_new.m new file mode 100644 index 00000000..cccc1dd9 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_2d_PB_new.m @@ -0,0 +1,364 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + f = avfieldPhysical2d_new(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + ndim = 2; + m = sym(ones(nspecies + ndim + 1, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + fv = fluxviscous_PB(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv ; +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + % ndim = 2; + fi = sym(zeros(nspecies+ndim+1,2)); + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = mu(22); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + if ndim == 2 + rhov = u(nspecies+2); + end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + vv = rhov * rhoinv; + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies,1) = rho_i(ispecies) * uv; + end + fi(nspecies + 1,1) = rhou * uv + p; + fi(nspecies + 2,1) = rhov * uv; + fi(nspecies + ndim + 1,1) = rhou * H; + + for ispecies = 1:nspecies + fi(ispecies,2) = rho_i(ispecies) * vv; + end + fi(nspecies + 1,2) = rhou * vv; + fi(nspecies + 2,2) = rhov * vv + p; + fi(nspecies + ndim + 1,2) = rhov * H; + + % fi = [ru, ru*uv+p, rv*uv, ru*h, ... + % rv, ru*vv, rv*vv+p, rv*h]; + % fi = reshape(fi,[4,2]); +end + + + +function fv = fluxviscous_PB(u, q, w, v, x, t, mu, eta, nspecies, ndim) + fv = sym(zeros(nspecies+ndim+1,2)); + rmin = 0.0; + alpha = mu(22); + nenergy=1; + ncu = nspecies + ndim + nenergy; + + Pr = mu(19); + Re = mu(20); + + avb = v(1); + avk = mu(21) * avb; + avk_b_coeff = eta(3*nspecies+5); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = zeros(nspecies,1); + h_vec = zeros(nspecies,1); + mu_d = 0.0; + kappa = 0.0; + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + beta = 0.0; + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + dr = dlmax(u(1:nspecies)-rmin,alpha); % Regularize derivative + + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+ndim+1); + + drho_dx_i = -q(1:nspecies) .* dr; + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dr; + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Some useful derived quantities + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + rho_inv = 1.0 / rho; + + uv = rhou * rho_inv; %velocity + vv = rhov * rho_inv; + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * (uv * uv + vv * vv); + duTu2_dx = uv * du_dx + vv * dv_dx; + duTu2_dy = uv * du_dy + vv * dv_dy; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dre_dy = dre_drho * drho_dy + dre_duTu2 * duTu2_dy + dre_drhoE * drhoE_dy; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + dT_dy = sum(dT_drho_i .* drho_dy_i) + dT_drhoe * dre_dy; + + %%%%%%%% Modify appropriate coefficients + kappa = 0 + avk * avk_b_coeff; % thermal conductivity + beta = 0 + avb; % bulk viscosity + + %%%%%%%% Stress tensor tau + % txx = viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + txx = mu_d * 2.0/3.0 * (2 * du_dx - dv_dy) / Re + beta * (du_dx + dv_dy); + txy = mu_d * (du_dy + dv_dx) / Re; + tyy = mu_d * 2.0/3.0 * (2 * dv_dy - du_dx) / Re + beta * (du_dx + dv_dy); + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies,1) = 0.0; + fv(ispecies,2) = 0.0; + end + + fv(nspecies + 1, 1) = txx; + fv(nspecies + 2, 1) = txy; + fv(nspecies + 3, 1) = uv * txx + vv * txy + kappa * dT_dx; + fv(nspecies + 1, 2) = txy; + fv(nspecies + 2, 2) = tyy; + fv(nspecies + 3, 2) = uv * txy + vv * tyy + kappa * dT_dy; +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = 1.0e12; + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); + s(nspecies+1) = 0.0; + s(nspecies+2) = 0.0; + s(nspecies+3) = 0.0; +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + ub = sym(zeros(nspecies+ndim+1, 2)); + + uinflow = initu(x, mu, eta); + + uoutflow = u; + + uadiabatic = u; +% uadiabatic(nspecies+1:nspecies+ndim) = 0.0; + nx = n(1); + ny = n(2); +% + uadiabatic(nspecies+1) = u(nspecies+1) - ... + 2*nx * (u(nspecies+1)*nx + u(nspecies+2)*ny); + uadiabatic(nspecies+2) = u(nspecies+2) -... + 2*ny * (u(nspecies+1)*nx + u(nspecies+2)*ny); + + uadiabatic = (uadiabatic + u)/2; + + ub(:,1) = uinflow; + ub(:,2) = uoutflow; + ub(:,3) = uadiabatic; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + fb = sym(zeros(nspecies+ndim+1, 3)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); + + + + fadiabatic = fn; + fadiabatic(1:nspecies) = 0.0; + fadiabatic(nspecies+ndim+1) = 0.0; + + fb(:,1) = fn; + fb(:,2) = fn; + fb(:,3) = fadiabatic; +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + +% u0 = mu(1:nspecies+2+1); + u0(1:nspecies) = mu(1:nspecies) / rho_scale; + u0(nspecies+1:nspecies+2) = mu(nspecies+1:nspecies+2) / (rho_scale * u_scale); + u0(nspecies+2+1) = mu(nspecies + 2 + 1) / rhoe_scale; +end + +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(10,1)); + nspecies = 5; +% alpha = 1.0e3; + rmin = 0.0; + +% f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + rmin = 0.0; + alpha = mu(22); + nenergy=1; + ndim = 2; + ncu = nspecies + ndim + nenergy; + + Pr = mu(19); + Re = mu(20); + + avb = v(1); + avk = mu(21) * avb; + avk_b_coeff = eta(3*nspecies+5); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = zeros(nspecies,1); + h_vec = zeros(nspecies,1); + mu_d = 0.0; + kappa = 0.0; + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + beta = 0.0; + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + dr = dlmax(u(1:nspecies)-rmin,alpha); % Regularize derivative + + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+ndim+1); + + drho_dx_i = -q(1:nspecies) .* dr; + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dr; + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Some useful derived quantities + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + rho_inv = 1.0 / rho; + + uv = rhou * rho_inv; %velocity + vv = rhov * rho_inv; + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * (uv * uv + vv * vv); + duTu2_dx = uv * du_dx + vv * dv_dx; + duTu2_dy = uv * du_dy + vv * dv_dy; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dre_dy = dre_drho * drho_dy + dre_duTu2 * duTu2_dy + dre_drhoE * drhoE_dy; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + dT_dy = sum(dT_drho_i .* drho_dy_i) + dT_drhoe * dre_dy; + + %%%%%%%% Modify appropriate coefficients + kappa = 0 + avk * avk_b_coeff; % thermal conductivity + beta = 0 + avb; % bulk viscosity + + %%%%%%%% Stress tensor tau + % txx = viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + txx = mu_d * 2.0/3.0 * (2 * du_dx - dv_dy) / Re + beta * (du_dx + dv_dy); + txy = mu_d * (du_dy + dv_dx) / Re; + tyy = mu_d * 2.0/3.0 * (2 * dv_dy - du_dx) / Re + beta * (du_dx + dv_dy); + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies,1) = 0.0; + fv(ispecies,2) = 0.0; + end + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + o(1:8) = u(1:8); + o(1) = v(1); + o(2) = dT_dx; + o(3) = dT_dy; +% o = sensor_outputs(u, q, w, v, x, t, mu, eta); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/pdemodel_inviscid.m b/Applications/Hypersonics/ReactingCylinder/pdemodel_inviscid.m new file mode 100644 index 00000000..a89f30fb --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_inviscid.m @@ -0,0 +1,223 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + f = avfieldLaplacian2d(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + ndim = 2; + m = sym(ones(nspecies + ndim + 1, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + % % Clipper utilities + % alpha = 1.0e3; + % rmin = 0.0; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + fl = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fl; +end + +function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) + rmin = 0.0; + alpha = 1.0e12; + eps_av = v(1); + nenergy = 1; + ncu = nspecies + ndim + nenergy; +% hm = v(2); + %TODO: CHECK GAS OUTPUTS TO INPUTS USED BY HTR GROUP + %TODO: CHECK NONDIM USED BY HTR GROUP ! + r_vec = u(1:nspecies); + dr = dlmax(r_vec-rmin,alpha); % Regularize derivative + + drho_dx_i = -q(1:nspecies).*dr; %.* dlmax(u(1:nspecies)-rmin,alpha); + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .*dr;% .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha); + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + fv(1:nspecies,1) = eps_av*drho_dx_i; % dxrho_i + fv(nspecies+1,1) = eps_av*drhou_dx; % dxrhou + fv(nspecies+2,1) = eps_av*drhov_dx; % dxrhov + fv(nspecies+3,1) = eps_av*drhoE_dx; % dxrhoE + fv(1:nspecies,2) = eps_av*drho_dy_i; % dxrho_i + fv(nspecies+1,2) = eps_av*drhou_dy; % dxrhou + fv(nspecies+2,2) = eps_av*drhov_dy; % dxrhov + fv(nspecies+3,2) = eps_av*drhoE_dy; % dxrhoE +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + % ndim = 2; + fi = sym(zeros(nspecies+ndim+1,2)); + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = 1.0e12; + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + if ndim == 2 + rhov = u(nspecies+2); + end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + vv = rhov * rhoinv; + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies,1) = rho_i(ispecies) * uv; + end + fi(nspecies + 1,1) = rhou * uv + p; + fi(nspecies + 2,1) = rhov * uv; + fi(nspecies + ndim + 1,1) = rhou * H; + + for ispecies = 1:nspecies + fi(ispecies,2) = rho_i(ispecies) * vv; + end + fi(nspecies + 1,2) = rhou * vv; + fi(nspecies + 2,2) = rhov * vv + p; + fi(nspecies + ndim + 1,2) = rhov * H; + + % fi = [ru, ru*uv+p, rv*uv, ru*h, ... + % rv, ru*vv, rv*vv+p, rv*h]; + % fi = reshape(fi,[4,2]); +end + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = 1.0e12; + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); + s(nspecies+1) = 0.0; + s(nspecies+2) = 0.0; + s(nspecies+3) = 0.0; +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + ub = sym(zeros(nspecies+ndim+1, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + + uinflow = initu(x, mu, eta); + + uoutflow = u; + + uadiabatic = u; + uadiabatic(nspecies+1:nspecies+ndim) = 0.0; + nx = n(1); + ny = n(2); +% % + uadiabatic(nspecies+1) = u(nspecies+1) - nx * (u(nspecies+1)*nx + u(nspecies+2)*ny); + uadiabatic(nspecies+2) = u(nspecies+2) - ny * (u(nspecies+1)*nx + u(nspecies+2)*ny); + + uadiabatic = 0.5*(uadiabatic + u); + ub(:,1) = uinflow; + ub(:,2) = uoutflow; + ub(:,3) = uadiabatic; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + fb = sym(zeros(nspecies+ndim+1, 3)); + + f = flux(u, q, w, v, x, t, mu, eta); % maybe should be uhat here? + fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); + +% OH maybe I need to change + fadiabatic = fn; + fadiabatic(1:nspecies) = 0.0; + fadiabatic(nspecies+ndim+1) = 0.0; + fb(:,1) = fn; + fb(:,2) = fn; + fb(:,3) = fadiabatic; +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + +% u0 = mu(1:nspecies+2+1); + u0(1:nspecies) = mu(1:nspecies) / rho_scale; + u0(nspecies+1:nspecies+2) = mu(nspecies+1:nspecies+2) / (rho_scale * u_scale); + u0(nspecies+2+1) = mu(nspecies + 2 + 1) / rhoe_scale; +end + +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(10,1)); + nspecies = 5; + alpha = 1.0e3; + rmin = 0.0; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + o(1:8) = u(1:8); + o(1) = v(1); +% o = sensor_outputs(u, q, w, v, x, t, mu, eta); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_la.m b/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_la.m new file mode 100644 index 00000000..55653304 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_la.m @@ -0,0 +1,319 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + f = avfieldLaplacian2d(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + ndim = 2; + m = sym(ones(nspecies + ndim + 1, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + fv = fluxviscousLa(u, q, w, v, x, t, mu, eta, nspecies, nd); + fl = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv - fl; +end + +function fv = fluxlaplacian(u, q, w, v, x, t, mu, eta, nspecies, ndim) + rmin = 0.0; + alpha = mu(22); + eps_av = v(1); + nenergy = 1; + ncu = nspecies + ndim + nenergy; +% hm = v(2); + %TODO: CHECK GAS OUTPUTS TO INPUTS USED BY HTR GROUP + %TODO: CHECK NONDIM USED BY HTR GROUP ! + r_vec = u(1:nspecies); + dr = dlmax(r_vec-rmin,alpha); % Regularize derivative + + drho_dx_i = -q(1:nspecies).*dr; %.* dlmax(u(1:nspecies)-rmin,alpha); + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .*dr;% .* dlmax(q(ncu+1:ncu+nspecies)-rmin,alpha); + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + fv(1:nspecies,1) = eps_av*drho_dx_i; % dxrho_i + fv(nspecies+1,1) = eps_av*drhou_dx; % dxrhou + fv(nspecies+2,1) = eps_av*drhov_dx; % dxrhov + fv(nspecies+3,1) = eps_av*drhoE_dx; % dxrhoE + fv(1:nspecies,2) = eps_av*drho_dy_i; % dxrho_i + fv(nspecies+1,2) = eps_av*drhou_dy; % dxrhou + fv(nspecies+2,2) = eps_av*drhov_dy; % dxrhov + fv(nspecies+3,2) = eps_av*drhoE_dy; % dxrhoE +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + % ndim = 2; + fi = sym(zeros(nspecies+ndim+1,2)); + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = mu(22); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + if ndim == 2 + rhov = u(nspecies+2); + end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + vv = rhov * rhoinv; + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies,1) = rho_i(ispecies) * uv; + end + fi(nspecies + 1,1) = rhou * uv + p; + fi(nspecies + 2,1) = rhov * uv; + fi(nspecies + ndim + 1,1) = rhou * H; + + for ispecies = 1:nspecies + fi(ispecies,2) = rho_i(ispecies) * vv; + end + fi(nspecies + 1,2) = rhou * vv; + fi(nspecies + 2,2) = rhov * vv + p; + fi(nspecies + ndim + 1,2) = rhov * H; + + % fi = [ru, ru*uv+p, rv*uv, ru*h, ... + % rv, ru*vv, rv*vv+p, rv*h]; + % fi = reshape(fi,[4,2]); +end + + + +function fv = fluxviscousLa(u, q, w, v, x, t, mu, eta, nspecies, ndim) + %TODO for thursday: + % - double check with papers: consistent with may, gnoffo. Maybe typo in su2mpp? + % - double check with NS code (TODO: REALLY CONFUSED ABOUT SIGN OF STRESS TENSOR) + % - add AV options: tomorrow, be clear about shear, bulk, thermal, and how density should come into this (let's discuss) + % - try to generate + fv = sym(zeros(nspecies+ndim+1,2)); + + rmin = 0.0; + alpha = mu(22); + nenergy=1; + ncu = nspecies + ndim + nenergy; + + Pr = mu(19); + Re = mu(20); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = eta(2:nspecies+1); + h_vec = eta(nspecies+2:2*nspecies+1); + mu_d = eta(2*nspecies+2); + kappa = eta(2*nspecies+3); + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + beta = 0.0; + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + dr = dlmax(u(1:nspecies)-rmin,alpha); % Regularize derivative + + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+ndim+1); + + drho_dx_i = -q(1:nspecies) .* dr; + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dr; + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Some useful derived quantities + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + rho_inv = 1.0 / rho; +% drho_dx_inv = 1.0 / drho_dx; +% drho_dy_inv = 1.0 / drho_dy + uv = rhou * rho_inv; %velocity + vv = rhov * rho_inv; + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * (uv * uv + vv * vv); + duTu2_dx = uv * du_dx + vv * dv_dx; + duTu2_dy = uv * du_dy + vv * dv_dy; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dre_dy = dre_drho * drho_dy + dre_duTu2 * duTu2_dy + dre_drhoE * drhoE_dy; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + dT_dy = sum(dT_drho_i .* drho_dy_i) + dT_drhoe * dre_dy; + +% %%%%%%%% Modify appropriate coefficients +% NOTE: for Laplacian AV, we don't want to add additional viscosity to anything here +% kappa = kappa + avk; % thermal conductivity +% mu_d = mu_d + avs; % dynamic viscosity +% beta = 0; % bulk viscosity +% D_vec = D_vec + avDvec; % Species diffusion velocities + + %%%%%%%% Calculation of J_i +% Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + dY_dy_i = (drho_dy_i * rho - rho_i * drho_dy) * rho_inv * rho_inv; + + J_i_x = -rho * D_vec .* dY_dx_i + rho_i .* sum(D_vec .* dY_dx_i); + J_i_y = -rho * D_vec .* dY_dy_i + rho_i .* sum(D_vec .* dY_dy_i); + + %%%%%%%% Stress tensor tau + % txx = viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + txx = mu_d * 2.0/3.0 * (2 * du_dx - dv_dy) / Re + beta * (du_dx + dv_dy); + txy = mu_d * (du_dy + dv_dx) / Re; + tyy = mu_d * 2.0/3.0 * (2 * dv_dy - du_dx) / Re + beta * (du_dx + dv_dy); + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies,1) = -J_i_x(ispecies); + fv(ispecies,2) = -J_i_y(ispecies); + end + + fv(nspecies + 1, 1) = txx; + fv(nspecies + 2, 1) = txy; + fv(nspecies + ndim + 1,1) = uv * txx + vv * txy - (sum(h_vec.*J_i_x) - kappa * dT_dx / (Re * Pr)); + fv(nspecies + 1, 2) = txy; + fv(nspecies + 2, 2) = tyy; + fv(nspecies + ndim + 1,2) = uv * txy + vv * tyy - (sum(h_vec.*J_i_y) - kappa * dT_dy / (Re * Pr)); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = mu(22); + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); + s(nspecies+1) = 0.0; + s(nspecies+2) = 0.0; + s(nspecies+3) = 0.0; +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + ub = sym(zeros(nspecies+ndim+1, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + + uinflow = initu(x, mu, eta); + + uoutflow = u; + + uadiabatic = u; + uadiabatic(nspecies+1:nspecies+ndim) = 0.0; + + ub(:,1) = uinflow; + ub(:,2) = uoutflow; + ub(:,3) = uadiabatic; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + fb = sym(zeros(nspecies+ndim+1, 3)); + + f = flux(u, q, w, v, x, t, mu, eta); % maybe should be uhat here? + fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); + +% OH maybe I need to change + fadiabatic = fn; + fadiabatic(1:nspecies) = 0.0; + fadiabatic(nspecies+ndim+1) = 0.0; + fb(:,1) = fn; + fb(:,2) = fn; + fb(:,3) = fadiabatic; +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + +% u0 = mu(1:nspecies+2+1); + u0(1:nspecies) = mu(1:nspecies) / rho_scale; + u0(nspecies+1:nspecies+2) = mu(nspecies+1:nspecies+2) / (rho_scale * u_scale); + u0(nspecies+2+1) = mu(nspecies + 2 + 1) / rhoe_scale; +end + +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(10,1)); + nspecies = 5; + alpha = mu(22); + rmin = 0.0; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + o(1:8) = u(1:8); + o(1) = v(1); +% o = sensor_outputs(u, q, w, v, x, t, mu, eta); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb.m b/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb.m new file mode 100644 index 00000000..e5634a9b --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb.m @@ -0,0 +1,286 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + f = avfieldPhysical2d_new(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + ndim = 2; + m = sym(ones(nspecies + ndim + 1, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + fv = fluxviscousPb(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv; +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + % ndim = 2; + fi = sym(zeros(nspecies+ndim+1,2)); + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = mu(22); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + if ndim == 2 + rhov = u(nspecies+2); + end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + vv = rhov * rhoinv; + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies,1) = rho_i(ispecies) * uv; + end + fi(nspecies + 1,1) = rhou * uv + p; + fi(nspecies + 2,1) = rhov * uv; + fi(nspecies + ndim + 1,1) = rhou * H; + + for ispecies = 1:nspecies + fi(ispecies,2) = rho_i(ispecies) * vv; + end + fi(nspecies + 1,2) = rhou * vv; + fi(nspecies + 2,2) = rhov * vv + p; + fi(nspecies + ndim + 1,2) = rhov * H; + + % fi = [ru, ru*uv+p, rv*uv, ru*h, ... + % rv, ru*vv, rv*vv+p, rv*h]; + % fi = reshape(fi,[4,2]); +end + + + +function fv = fluxviscousPb(u, q, w, v, x, t, mu, eta, nspecies, ndim) + fv = sym(zeros(nspecies+ndim+1,2)); + rmin = 0.0; + alpha = mu(22); + nenergy=1; + ncu = nspecies + ndim + nenergy; + + Pr = mu(19); + Re = mu(20); + + avb = v(1); + avk = mu(21) * avb; + avs = 0; + avk_b_coeff = eta(3*nspecies+5); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = eta(2:nspecies+1); + h_vec = eta(nspecies+2:2*nspecies+1); + mu_d = eta(2*nspecies+2); + kappa = eta(2*nspecies+3); + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + beta = 0.0; + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + dr = dlmax(u(1:nspecies)-rmin,alpha); % Regularize derivative + + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+ndim+1); + + drho_dx_i = -q(1:nspecies) .* dr; + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dr; + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Some useful derived quantities + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + rho_inv = 1.0 / rho; + + uv = rhou * rho_inv; %velocity + vv = rhov * rho_inv; + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * (uv * uv + vv * vv); + duTu2_dx = uv * du_dx + vv * dv_dx; + duTu2_dy = uv * du_dy + vv * dv_dy; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dre_dy = dre_drho * drho_dy + dre_duTu2 * duTu2_dy + dre_drhoE * drhoE_dy; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + dT_dy = sum(dT_drho_i .* drho_dy_i) + dT_drhoe * dre_dy; + + %%%%%%%% Modify appropriate coefficients + kappa = kappa / (Re * Pr) + avk * avk_b_coeff; % thermal conductivity + mu_d = mu_d / Re + avs; % dynamic viscosity + beta = 0 + avb; % bulk viscosity + D_vec = D_vec + 0; % Species diffusion velocities + + %%%%%%%% Calculation of J_i +% Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + dY_dy_i = (drho_dy_i * rho - rho_i * drho_dy) * rho_inv * rho_inv; + + J_i_x = -rho * D_vec .* dY_dx_i + rho_i .* sum(D_vec .* dY_dx_i); + J_i_y = -rho * D_vec .* dY_dy_i + rho_i .* sum(D_vec .* dY_dy_i); + + %%%%%%%% Stress tensor tau + % txx = viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + txx = mu_d * 2.0/3.0 * (2 * du_dx - dv_dy) + beta * (du_dx + dv_dy); + txy = mu_d * (du_dy + dv_dx); + tyy = mu_d * 2.0/3.0 * (2 * dv_dy - du_dx) + beta * (du_dx + dv_dy); + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies,1) = -J_i_x(ispecies); + fv(ispecies,2) = -J_i_y(ispecies); + end + + fv(nspecies + 1, 1) = txx; + fv(nspecies + 2, 1) = txy; + fv(nspecies + 3,1) = uv * txx + vv * txy - (sum(h_vec.*J_i_x) - kappa * dT_dx); + fv(nspecies + 1, 2) = txy; + fv(nspecies + 2, 2) = tyy; + fv(nspecies + 3,2) = uv * txy + vv * tyy - (sum(h_vec.*J_i_y) - kappa * dT_dy); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = mu(22); + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); + s(nspecies+1) = 0.0; + s(nspecies+2) = 0.0; + s(nspecies+3) = 0.0; +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + ub = sym(zeros(nspecies+ndim+1, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + + uinflow = initu(x, mu, eta); + + uoutflow = u; + + uadiabatic = u; + uadiabatic(nspecies+1:nspecies+ndim) = 0.0; + + ub(:,1) = uinflow; + ub(:,2) = uoutflow; + ub(:,3) = uadiabatic; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + fb = sym(zeros(nspecies+ndim+1, 3)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); + + + fadiabatic = fn; + fadiabatic(1:nspecies) = 0.0; + fadiabatic(nspecies+ndim+1) = 0.0; + + fb(:,1) = fn; + fb(:,2) = fn; + fb(:,3) = fadiabatic; +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + +% u0 = mu(1:nspecies+2+1); + u0(1:nspecies) = mu(1:nspecies) / rho_scale; + u0(nspecies+1:nspecies+2) = mu(nspecies+1:nspecies+2) / (rho_scale * u_scale); + u0(nspecies+2+1) = mu(nspecies + 2 + 1) / rhoe_scale; +end + +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(10,1)); + nspecies = 5; + alpha = mu(22); + rmin = 0.0; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + o(1:8) = u(1:8); + o(1) = v(1); +% o = sensor_outputs(u, q, w, v, x, t, mu, eta); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb_di.m b/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb_di.m new file mode 100644 index 00000000..8a5dce6c --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_visc_pb_di.m @@ -0,0 +1,287 @@ + +function pde = pdemodel + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; + pde.avfield = @avfield; +end + +function f = avfield(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + f = avfieldPhysical2d_Di(u, q, w, v, x, t, mu, eta, nspecies, nd); +end + +function m = mass(u, q, w, v, x, t, mu, eta) + nspecies = 5; + ndim = 2; + m = sym(ones(nspecies + ndim + 1, 1)); +end + +function f = flux(u, q, w, v, x, t, mu, eta) + nspecies = 5; + nd = 2; + + fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, nd); + fv = fluxviscousPb_Di(u, q, w, v, x, t, mu, eta, nspecies, nd); + f = fi - fv; +end + +function fi = fluxinviscid(u, q, w, v, x, t, mu, eta, nspecies, ndim) + nenergy = 1; + % ndim = 2; + fi = sym(zeros(nspecies+ndim+1,2)); + + rho_i = sym(zeros(nspecies,1)); + rho = sym(0); + + rmin = 0.0; + alpha = mu(22); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + if ndim == 2 + rhov = u(nspecies+2); + end + rhoE = u(nspecies+ndim+1); + if nenergy == 2 + rhoev = u(nspecies+ndim+nenergy); + end + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + vv = rhov * rhoinv; + E = rhoE * rhoinv; %energy + + p = eta(1); % MANUALLY MODIFIED + H = E + p*rhoinv; %enthalpy + + % Fluxes + for ispecies = 1:nspecies + fi(ispecies,1) = rho_i(ispecies) * uv; + end + fi(nspecies + 1,1) = rhou * uv + p; + fi(nspecies + 2,1) = rhov * uv; + fi(nspecies + ndim + 1,1) = rhou * H; + + for ispecies = 1:nspecies + fi(ispecies,2) = rho_i(ispecies) * vv; + end + fi(nspecies + 1,2) = rhou * vv; + fi(nspecies + 2,2) = rhov * vv + p; + fi(nspecies + ndim + 1,2) = rhov * H; + + % fi = [ru, ru*uv+p, rv*uv, ru*h, ... + % rv, ru*vv, rv*vv+p, rv*h]; + % fi = reshape(fi,[4,2]); +end + + + +function fv = fluxviscousPb_Di(u, q, w, v, x, t, mu, eta, nspecies, ndim) + fv = sym(zeros(nspecies+ndim+1,2)); + rmin = 0.0; + alpha = mu(22); + nenergy=1; + ncu = nspecies + ndim + nenergy; + + Pr = mu(19); + Re = mu(20); + + avb = v(1); + avDvec = v(2:6); + avk = mu(21) * avb; + avs = 0; + avk_b_coeff = eta(3*nspecies+5); + + % Data layout + % [D_1, ..., D_ns, h_1, ..., h_ns, mu, kappa, dTdri, dTdrhou, dTdrhoE] + p = eta(1); + D_vec = eta(2:nspecies+1); + h_vec = eta(nspecies+2:2*nspecies+1); + mu_d = eta(2*nspecies+2); + kappa = eta(2*nspecies+3); + dT_drho_i = eta(2*nspecies+4:3*nspecies+3); + dT_drhoe = eta(3*nspecies+4); + beta = 0.0; + + rho_i = rmin + lmax(u(1:nspecies) - rmin, alpha); + dr = dlmax(u(1:nspecies)-rmin,alpha); % Regularize derivative + + rhou = u(nspecies+1); + rhov = u(nspecies+2); + rhoE = u(nspecies+ndim+1); + + drho_dx_i = -q(1:nspecies) .* dr; + drhou_dx = -q(nspecies+1); + drhov_dx = -q(nspecies+2); + drhoE_dx = -q(nspecies+ndim+1); + drho_dy_i = -q(ncu+1:ncu+nspecies) .* dr; + drhou_dy = -q(ncu+nspecies+1); + drhov_dy = -q(ncu+nspecies+2); + drhoE_dy = -q(ncu+nspecies+ndim+1); + + % Some useful derived quantities + rho = sum(rho_i); + drho_dx = sum(drho_dx_i); + drho_dy = sum(drho_dy_i); + rho_inv = 1.0 / rho; + + uv = rhou * rho_inv; %velocity + vv = rhov * rho_inv; + du_dx = (drhou_dx - drho_dx*uv)*rho_inv; + dv_dx = (drhov_dx - drho_dx*vv)*rho_inv; + du_dy = (drhou_dy - drho_dy*uv)*rho_inv; + dv_dy = (drhov_dy - drho_dy*vv)*rho_inv; + + % re = rhoE - rho * (0.5 * uTu); + uTu2 = 0.5 * (uv * uv + vv * vv); + duTu2_dx = uv * du_dx + vv * dv_dx; + duTu2_dy = uv * du_dy + vv * dv_dy; + dre_drho = -uTu2; + dre_duTu2 = -rho; + dre_drhoE = 1.0; + dre_dx = dre_drho * drho_dx + dre_duTu2 * duTu2_dx + dre_drhoE * drhoE_dx; + dre_dy = dre_drho * drho_dy + dre_duTu2 * duTu2_dy + dre_drhoE * drhoE_dy; + dT_dx = sum(dT_drho_i .* drho_dx_i) + dT_drhoe * dre_dx; + dT_dy = sum(dT_drho_i .* drho_dy_i) + dT_drhoe * dre_dy; + + %%%%%%%% Modify appropriate coefficients + kappa = kappa / (Re * Pr) + avk * avk_b_coeff; % thermal conductivity + mu_d = mu_d / Re + avs; % dynamic viscosity + beta = 0 + avb; % bulk viscosity + D_vec = D_vec + avDvec; % Species diffusion velocities + + %%%%%%%% Calculation of J_i +% Y_i = rho_i ./ rho; + dY_dx_i = (drho_dx_i * rho - rho_i * drho_dx) * rho_inv * rho_inv; + dY_dy_i = (drho_dy_i * rho - rho_i * drho_dy) * rho_inv * rho_inv; + + J_i_x = -rho * D_vec .* dY_dx_i + rho_i .* sum(D_vec .* dY_dx_i); + J_i_y = -rho * D_vec .* dY_dy_i + rho_i .* sum(D_vec .* dY_dy_i); + + %%%%%%%% Stress tensor tau + % txx = viscshear * 4.0/3.0 * du_dx + viscbulk * du_dx; %TODO: check sign + txx = mu_d * 2.0/3.0 * (2 * du_dx - dv_dy) + beta * (du_dx + dv_dy); + txy = mu_d * (du_dy + dv_dx); + tyy = mu_d * 2.0/3.0 * (2 * dv_dy - du_dx) + beta * (du_dx + dv_dy); + %%%%%%%% Final viscous fluxes + for ispecies = 1:nspecies + fv(ispecies,1) = -J_i_x(ispecies); + fv(ispecies,2) = -J_i_y(ispecies); + end + + fv(nspecies + 1, 1) = txx; + fv(nspecies + 2, 1) = txy; + fv(nspecies + 3,1) = uv * txx + vv * txy - (sum(h_vec.*J_i_x) - kappa * dT_dx); + fv(nspecies + 1, 2) = txy; + fv(nspecies + 2, 2) = tyy; + fv(nspecies + 3,2) = uv * txy + vv * tyy - (sum(h_vec.*J_i_y) - kappa * dT_dy); +end + + +function s = source(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + rmin = 0.0; + alpha = mu(22); + rvec = u(1:nspecies); + s(1:nspecies) = rmin + lmax(rvec-rmin,alpha); + s(nspecies+1) = 0.0; + s(nspecies+2) = 0.0; + s(nspecies+3) = 0.0; +end + +function ub = ubou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + ub = sym(zeros(nspecies+ndim+1, 2)); +%%%%%% C-CODE MANUALLY WRITTEN +% ub(:,1) = u(:); +% ub(:,2) = u(:); + + uinflow = initu(x, mu, eta); + + uoutflow = u; + + uadiabatic = u; + uadiabatic(nspecies+1:nspecies+ndim) = 0.0; + + ub(:,1) = uinflow; + ub(:,2) = uoutflow; + ub(:,3) = uadiabatic; +end + +function fb = fbou(u, q, w, v, x, t, mu, eta, uhat, n, tau) + nspecies = 5; + ndim = 2; + fb = sym(zeros(nspecies+ndim+1, 3)); + + f = flux(u, q, w, v, x, t, mu, eta); + fn = f(:,1)*n(1) + f(:,2)*n(2) + tau.*(u-uhat); + + + fadiabatic = fn; + fadiabatic(1:nspecies) = 0.0; + fadiabatic(nspecies+ndim+1) = 0.0; + + fb(:,1) = fn; + fb(:,2) = fn; + fb(:,3) = fadiabatic; +end + +function u0 = initu(x, mu, eta) + nspecies = 5; + rho_scale = eta(1); + u_scale = eta(2); + rhoe_scale = eta(3); + +% u0 = mu(1:nspecies+2+1); + u0(1:nspecies) = mu(1:nspecies) / rho_scale; + u0(nspecies+1:nspecies+2) = mu(nspecies+1:nspecies+2) / (rho_scale * u_scale); + u0(nspecies+2+1) = mu(nspecies + 2 + 1) / rhoe_scale; +end + +function o = output(u, q, w, v, x, t, mu, eta) + + nspecies = 5; + + o = sym(zeros(10,1)); + nspecies = 5; + alpha = mu(22); + rmin = 0.0; + + f = sym(zeros(nspecies + 2,1)); + rho_i = sym(zeros(5,1)); + rho = sym(0); + + % Conservative Variables + for ispecies = 1:nspecies + rho_i(ispecies) = rmin + lmax(u(ispecies)-rmin,alpha); %subspecies density + rho = rho + rho_i(ispecies); %total mixture density + end + + rhou = u(nspecies+1); + rhoE = u(nspecies+2); + + rhoinv = 1.0 / rho; + uv = rhou * rhoinv; %velocity + E = rhoE*rhoinv; %energy + + o(1:8) = u(1:8); + o(1) = v(1); +% o = sensor_outputs(u, q, w, v, x, t, mu, eta); +end + +% function dout = dlmax(x, alpha) +% dout = atan(alpha*(x))/pi + (alpha*(x))./(pi*(alpha^2*(x).^2 + 1)) + 1/2; +% end \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/plotsol.m b/Applications/Hypersonics/ReactingCylinder/plotsol.m index 4a1dfa99..49a81902 100644 --- a/Applications/Hypersonics/ReactingCylinder/plotsol.m +++ b/Applications/Hypersonics/ReactingCylinder/plotsol.m @@ -2,31 +2,41 @@ mesh.plocal = master.xpe; mesh.tlocal = master.telem; mesh.porder = pde.porder; -ti = 2000; +ti = 100; + % Uout = getsolution(['dataout/out'],dmd,master.npe); Uout = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); UCGout = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); % out = eulereval(Uout,'r',gam,Minf); rho = sum(Uout(:,1:5,:),2); -out = Uout(:,1,:); +out = UCGout(:,10,:); +figure(1000); clf; scaplot(mesh,out,[0 1e-4],1); +xlim([-1 0]) +ylim([0 2]) +figure(1001); clf; scaplot(mesh, Uout(:,7,:)); % out = rho; % out = rho; % outCG = -[om,ind] = max(abs(out(:))); -figure(100); clf; scaplot(mesh,out,[],1); -x = mesh.dgnodes(:,1,:); -y = mesh.dgnodes(:,2,:); -hold on; -plot(x(ind),y(ind),'o'); -colormap('jet'); +% indBad = 172; +% for ii = 9 +% gammaTmp = UCGout(:,ii,:); +% [om,ind] = max(abs(gammaTmp(:))); +% figure(10); clf; scaplot(mesh,gammaTmp,[],1); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'x', 'MarkerSize',20, 'LineWidth',20); +% colormap('jet'); +% waitforbuttonpress +% end %% titles = ["w1","w2","w3","w4","w5","p","t","gam","rhoe","sb0"]; -for i = 1:10 +for i = 1:5 % if i ~= 9 figure(i); clf wcurr = UCGout(:,i,:); scaplot(mesh,wcurr,[],1); - title(titles(i)) + title(titles(i)); colormap('jet'); drawnow; % waitforbuttonpress % end end @@ -35,6 +45,27 @@ T = UCGout(:,7,:); gam = UCGout(:,8,:); sb0 = UCGout(:,10,:); +rhoe = UCGout(:,9,:); +%% +% ncu = 5 + 2 + 1; +% rhoinv = 1./rho; +% uv = Uout(:,6,:); +% vv = Uout(:,7,:); +% drhou_dx = Uout(:,ncu+5+1,:); +% drhov_dx = Uout(:,ncu+5+2,:); +% drhou_dy = Uout(:,ncu+ncu+5+1,:); +% drhov_dy = Uout(:,ncu+ncu+5+2,:); +% du_dx = (drhou_dx - drho_dx.*uv).*rhoinv; +% dv_dx = (drhov_dx - drho_dx.*vv).*rhoinv; +% du_dy = (drhou_dy - drho_dy.*uv).*rhoinv; +% dv_dy = (drhov_dy - drho_dy.*vv).*rhoinv; +% div_v = du_dx + dv_dy; +% vort = (dv_dx - du_dy); +% vort = sqrt(vort.*vort); +% DucrosRatio = div_v.*div_v ./ (div_v.*div_v + vort.*vort + 1.0e-16); +% figure(1); clf; scaplot(mesh, div_v, [], 1, 0); +% figure(2); clf; scaplot(mesh, vort, [], 1, 0); +% figure(3); clf; scaplot(mesh, DucrosRatio, [], 1, 0); % figure(1) % out = Uout(:,8,:); % % outCG = diff --git a/Applications/Hypersonics/ReactingCylinder/plotsol2.m b/Applications/Hypersonics/ReactingCylinder/plotsol2.m new file mode 100644 index 00000000..ecfbdf9f --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/plotsol2.m @@ -0,0 +1,144 @@ +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +ti = 10; +% with dt=2.5e-5: ti = 10->-0.95 +% ti = 100->-0.7558 +% with dt=1e-5: ti = 20->-0.9626 +% ti = 200->-0.7855 +% with dt=1e-6: ti = 200-> -0.9629 +% ti = 2000->-0.7873 +% +% soldir = 'nanSnapshots/dataout'; +% soldir = 'check10kOf100k'; +% soldir = 'checkSkChange'; +% soldir = 'checkRefineBoundaryLayer'; +soldir = 'dataout'; +% note: first 100k dt of 2.5e-5 +% next 10k dt of 2.5e-4 + +% -0.9635 +% +% -0.8788 +% +% -0.8804 +% +% -0.9596 +% +% -0.9616 +% +% -0.9616 + + + +% Uout = getsolution(['dataout/out'],dmd,master.npe); +Uout = getsolution([strcat(soldir,'/out_t') num2str(ti)],dmd,master.npe); +UCGout = getsolution([strcat(soldir,'/out_outputCG_t') num2str(ti)],dmd,master.npe); +% out = eulereval(Uout,'r',gam,Minf); +rho = sum(Uout(:,1:5,:),2); +drho_dx = sum(Uout(:,9:13,:),2); + +drho_dy = sum(Uout(:,17:21,:),2); +for i = 17:21 + out = Uout(:,i,:); + disp(max(out(:))/min(out(:)) ) +end +% out = drho_dy; +% out = rho; +% out = rho; +% outCG = +[om,ind] = max(abs(out(:))); +disp(max(out(:))/min(out(:)) ) +%% +% disp(max(drho_dx(:))/min(drho_dx(:)) ) +% disp(max(drho_dy(:))/min(drho_dy(:)) ) +figure(100); clf; scaplot(mesh,out,[],1); +% ylim([-1.1, 1.1]) +% xlim([-1 0.2]) +x = mesh.dgnodes(:,1,:); +y = mesh.dgnodes(:,2,:); +hold on; +plot(x(ind),y(ind),'o'); +colormap('jet'); +%% +titles = ["w1","w2","w3","w4","w5","p","t","gam","rhoe","sb0"]; +% for i = 1:10 +% % if i ~= 9 +% figure(i); clf +% wcurr = UCGout(:,i,:); +% scaplot(mesh,wcurr,[],1); +% title(titles(i)) +% % waitforbuttonpress +% % end +% end +% figure(7); clf +P = UCGout(:,6,:); +T = UCGout(:,7,:); +figure(2); scaplot(mesh,T / 901,[],1,0); +colormap('jet') +title("T") +gam = UCGout(:,8,:); +sb0 = UCGout(:,10,:); +figure(3); scaplot(mesh, sb0, [], 1, 0); +colormap('jet') +% figure(1) +% out = Uout(:,8,:); +% % outCG = +% [om,ind] = max(abs(out(:))); +% figure(1); clf; scaplot(mesh,out,[],1); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% colormap('jet'); + +% +% Uout = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% figure(2); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% Uout = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% figure(4); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% udg = getsolution(['dataout/out_udg' num2str(ti)],dmd,master.npe); +% vdg = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% sdg = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% avField = getavfield2dmatlab(udg(:,1:4,:),udg(:,5:12,:),vdg,pde.physicsparam); +% avc = getavfield2dc(udg,vdg,pde.physicsparam); +% +% figure(1); clf; scaplot(mesh,avField(:,1,:),[],1); colormap('jet'); +% figure(2); clf; scaplot(mesh,avc(:,1,:),[],1); colormap('jet'); +% figure(3); clf; scaplot(mesh,vdg(:,1,:),[],1); colormap('jet'); +% figure(4); clf; scaplot(mesh,sdg(:,1,:),[],1); colormap('jet'); +% +% +% % figure(1); clf; hold on; +% % for ib=1:3 +% % f = mkf(mesh.t,mesh.f,2); +% % if ib==1 +% % pars={'facecolor',[.8,1,.8],'edgecolor','b','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % elseif ib==2 +% % pars={'facecolor',[.8,1,.8],'edgecolor','r','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % else +% % pars={'facecolor',[.8,1,.8],'edgecolor','k','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % end +% % ind = find(f(end,:)==-ib); +% % patch('faces',f(1:end-4,ind)','vertices',mesh.p',pars{:}); +% % end +% % axis equal; axis tight; +% % +% % +% +% diff --git a/Applications/Hypersonics/ReactingCylinder/plotsol_2.m b/Applications/Hypersonics/ReactingCylinder/plotsol_2.m new file mode 100644 index 00000000..ffaa59a2 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/plotsol_2.m @@ -0,0 +1,284 @@ +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +% soldir = 'nanSnapshots/dataout'; +% soldir = 'check10kOf100k'; +% soldir = 'checkSkChange'; +% soldir = 'checkRefineBoundaryLayer'; +% soldir = 'checkUniRef'; +% soldir = 'checkHhChange'; +% note: first 100k dt of 2.5e-5 +% next 10k dt of 2.5e-4 +% +% soldir = 'overnightN80Run'; +% soldir = 'checkChangeLscale'; +% soldir = 'checkDomainChange'; +% soldir = 'checkDomainChangeAndLrefChange'; +% soldir = 'checkNoSource' +% soldir = 'checkp1' +% soldir = 'checkp1NoSource'; % note: i might have also changed hh here +% soldir = 'checkp1NoSourceN100'; +% soldir = 'checkp1NoSourceEinitChange'; +% soldir = 'checkp1NoSourceEinitChangeKbChange'; +% soldir = 'p1N100RegularGrid'; +% soldir = 'p1N200RegularGrid'; +% soldir = 'checkAppScp_AccidentalSource'; +% soldir = 'checkAppScp'; +% soldir = 'sourceTermTest' +% ti = 10000; +% soldir = 'sourceTermTest_halfdt' +% soldir = 'sourceTermTest_halfdt_sb0change' +% soldir = 'sourceTermTest_halfdt_n100' +% soldir = 'sourceTermTest_adaptdt' +% soldir = 'sourceTermTest_gmrestol' +% soldir = 'sourceTermTest_Mach59'; +% soldir = 'sourceTermTest_Mach59_testEps'; +% soldir = 'sourceTermTest_Mach59_testEps1e9'; +% soldir = 'sourceTermTest_Mach59_overnight' +% soldir = 'p2n80Ma8'; +% soldir = 'p2n80Ma8_smalldt'; +% soldir = 'p1n80Ma8'; +soldir = 'dataout' + +ti = 5; + +% 50k of 2.5e-5 +% 10k of 1.5e-4 + +% Uout = getsolution(['dataout/out'],dmd,master.npe); +Uout = getsolution([strcat(soldir,'/out_t') num2str(ti)],dmd,master.npe); +UCGout = getsolution([strcat(soldir,'/out_outputCG_t') num2str(ti)],dmd,master.npe); +% out = eulereval(Uout,'r',gam,Minf); +rho = sum(Uout(:,1:5,:),2); +rhou = Uout(:,6,:); +rhov = Uout(:,7,:); +rhoE = Uout(:,8,:); +drho_dx = sum(Uout(:,9:13,:),2); +drho_dy = sum(Uout(:,17:21,:),2); +for i = 17:21 + out = Uout(:,i,:); + disp(max(out(:))/min(out(:))); +end +disp(max(drho_dy(:))/min(drho_dy(:)) ) + +out = Uout(:,24,:)./rho; +% out = drho_dy; +% out = rho; +% out = rho; +% [om,ind] = max(abs(out(:))); +figure(100); clf; scaplot(mesh,out,[],1); +ylim([-1.1, 1.1]) +xlim([-1 0.2]) +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +colormap('jet'); +% %% +%% +figure(50); +species = ["N","O","NO","N2","O2"]; +for i = 1:5 +% if i ~= 9 + figure(i); clf +% subplot(1,5,i) + outcurr = Uout(:,i,:); + outcurr = outcurr(:)./rho(:); + scaplot(mesh,outcurr,[],1); colormap('jet') +% hold on; plot(linspace(-3, 1), 0*linspace(-3,1)) +% xlim([-3 0]) +% ylim([0 3]) +% set(gca, "visible", "off") +axis("off") + title(strcat("Y_{", string(species(i)), string("}"))) + drawnow + +% waitforbuttonpress +% end +end + +%% +titles = ["w1","w2","w3","w4","w5","p","t","gam","rhoe","sb0"]; +for i = 1:5 +% if i ~= 9 + figure(i); clf + wcurr = UCGout(:,i,:); + scaplot(mesh,wcurr*0.045,[],1); + title(titles(i)) +% waitforbuttonpress + drawnow +% end +end +%% +P = UCGout(:,6,:); +T = UCGout(:,7,:); +figure(200); scaplot(mesh,T,[],1,0); +% hold on; plot(linspace(-3, 1), 0*linspace(-3,1)) +colormap('jet') +title("Temperature") +gam = UCGout(:,8,:); +sb0 = UCGout(:,10,:); +rhoe = UCGout(:,9,:); +figure(300); scaplot(mesh, gam, [], 1, 0); +colormap('jet') +figure(301); scaplot(mesh, sb0, [], 1, 0); +colormap('jet') +figure(400); scaplot(mesh, rhoe, [], 1, 0); title('rhoe') +colormap('jet') + +%% +figure(5000); scaplot(mesh, rho, [], 1, 0); title("rho") +colormap('jet') +figure(6000); scaplot(mesh, rhou./rho, [], 1, 0); title("u"); +colormap('jet') +figure(7000); scaplot(mesh, rhov./rho, [], 1, 0); title("v"); +colormap('jet') +figure(8000); scaplot(mesh, Uout(:,8,:), [], 1, 0); title("rhoE"); + +disp("rho min/max") +disp(min(rho(:))) +disp(max(rho(:))) + +disp("u min/max") +disp(min(rhou(:)./rho(:))) +disp(max(rhou(:)./rho(:))) + +disp("v min/max") +disp(min(rhov(:)./rho(:))) +disp(max(rhov(:)./rho(:))) + +disp("rhoE min/max") +disp(min(rhoE(:))) +disp(max(rhoE(:))) + +disp("rhoe min/max") +disp(min(rhoe(:))) +disp(max(rhoe(:))) + +% figure(1) +% out = Uout(:,8,:); +% % outCG = +% [om,ind] = max(abs(out(:))); +% figure(1); clf; scaplot(mesh,out,[],1); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% colormap('jet'); + +% +% Uout = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% figure(2); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% Uout = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% figure(4); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% udg = getsolution(['dataout/out_udg' num2str(ti)],dmd,master.npe); +% vdg = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% sdg = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% avField = getavfield2dmatlab(udg(:,1:4,:),udg(:,5:12,:),vdg,pde.physicsparam); +% avc = getavfield2dc(udg,vdg,pde.physicsparam); +% +% figure(1); clf; scaplot(mesh,avField(:,1,:),[],1); colormap('jet'); +% figure(2); clf; scaplot(mesh,avc(:,1,:),[],1); colormap('jet'); +% figure(3); clf; scaplot(mesh,vdg(:,1,:),[],1); colormap('jet'); +% figure(4); clf; scaplot(mesh,sdg(:,1,:),[],1); colormap('jet'); +% +% +% % figure(1); clf; hold on; +% % for ib=1:3 +% % f = mkf(mesh.t,mesh.f,2); +% % if ib==1 +% % pars={'facecolor',[.8,1,.8],'edgecolor','b','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % elseif ib==2 +% % pars={'facecolor',[.8,1,.8],'edgecolor','r','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % else +% % pars={'facecolor',[.8,1,.8],'edgecolor','k','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % end +% % ind = find(f(end,:)==-ib); +% % patch('faces',f(1:end-4,ind)','vertices',mesh.p',pars{:}); +% % end +% % axis equal; axis tight; +% % +% % +% +% +% %% +% xtmp = [] +% tmp = [] +% dgtst = reshape(mesh.dgnodes, [6400*4 2]); +% Ttst = reshape(T, [6400*4 1]); +% for i = 1:size(dgtst,1) +% if abs(dgtst(i,2)) < 1e-4 +% disp(dgtst(i,1)) +% xtmp = [xtmp, dgtst(i,1)]; +% tmp = [tmp, Ttst(i)]; +% end +% end + +%%% +% no viscous: +% rho min/max +% 0.999999946808838 +% +% 1.000590779570255 +% +% u min/max +% 1.208341179345986e-04 +% +% 1.000000019931180 +% +% v min/max +% -4.684172697272210e-05 +% +% 4.684173134558622e-05 +% +% rhoE min/max +% 0.111810873353252 +% +% 0.611594698012404 +% +% rhoe min/max +% 6.117602744265359e+03 +% +% 6.231298010549617e+03 + +% rho min/max +% 0.999999913817226 +% +% 1.000420041679332 +% +% u min/max +% 0.041600470690700 +% +% 1.000085250338504 +% +% v min/max +% -0.023404378404112 +% +% 0.023404375771517 +% +% rhoE min/max +% 0.267275124566171 +% +% 0.611679971000627 +% +% rhoe min/max +% 6.122020659204081e+03 +% +% 1.771234360440572e+04 + + diff --git a/Applications/Hypersonics/ReactingCylinder/plotsol_3.m b/Applications/Hypersonics/ReactingCylinder/plotsol_3.m new file mode 100644 index 00000000..75173f85 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/plotsol_3.m @@ -0,0 +1,181 @@ +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; + +soldir = 'dataout'; +% ti = 52000; +ti = 4900+382; +% 50k of 2.5e-5 +% 10k of 1.5e-4 + +% Uout = getsolution(['dataout/out'],dmd,master.npe); +Uout = getsolution([strcat(soldir,'/out_t') num2str(ti)],dmd,master.npe); +UCGout = getsolution([strcat(soldir,'/out_outputCG_t') num2str(ti)],dmd,master.npe); +% out = eulereval(Uout,'r',gam,Minf); +rho = sum(Uout(:,1:5,:),2); +drho_dx = sum(Uout(:,9:13,:),2); +drho_dy = sum(Uout(:,17:21,:),2); +for i = 17:21 + out = Uout(:,i,:); + disp(max(out(:))/min(out(:))); +end +disp(max(drho_dy(:))/min(drho_dy(:)) ) + +% out = Uout(:,8,:); +% out = drho_dy; +out = rho; +% out = rho; +% [om,ind] = max(abs(out(:))); +figure(100); clf; scaplot(mesh,out,[]); +% ylim([-1.1, 1.1]) +% xlim([-1 0.2]) +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +colormap('jet'); +% %% +%% +figure(50); +species = ["N","O","NO","N2","O2"]; +for i = 1:5 +% if i ~= 9 + figure(i); clf +% subplot(1,5,i) + outcurr = Uout(:,i,:); + outcurr = outcurr(:)./rho(:); + scaplot(mesh,outcurr,[]); colormap('jet') +% hold on; plot(linspace(-3, 1), 0*linspace(-3,1)) +% xlim([-3 0]) +% ylim([0 3]) +% set(gca, "visible", "off") +axis("off") + title(strcat("Y_{", string(species(i)), string("}"))) + drawnow +% waitforbuttonpress +% end +end + +%% +titles = ["w1","w2","w3","w4","w5","p","t","gam","rhoe","sb0"]; +for i = 1:10 +% if i ~= 9 + figure(i); clf + wcurr = UCGout(:,i,:); + scaplot(mesh,wcurr,[],1); + colormap('jet') + title(titles(i)) + drawnow +% waitforbuttonpress +% end +end +%% +P = UCGout(:,6,:); +T = UCGout(:,7,:); +figure(200); scaplot(mesh,T,[],1,0); title("T") +% hold on; plot(linspace(-3, 1), 0*linspace(-3,1)) +colormap('jet') +title("Temperature") +gam = UCGout(:,8,:); +sb0 = UCGout(:,10,:); +rhoe = UCGout(:,9,:); +figure(300); scaplot(mesh, gam, [], 1, 0); title("gamma"); drawnow +colormap('jet') +figure(301); scaplot(mesh, sb0, [], 1, 0); title("sb0"); drawnow +colormap('jet') +figure(400); scaplot(mesh, rhoe, [], 1, 0); title("re"); drawnow +colormap('jet') + + +% figure(1) +% out = Uout(:,8,:); +% % outCG = +% [om,ind] = max(abs(out(:))); +% figure(1); clf; scaplot(mesh,out,[],1); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% colormap('jet'); + +% +% Uout = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% figure(2); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% Uout = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% figure(4); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% udg = getsolution(['dataout/out_udg' num2str(ti)],dmd,master.npe); +% vdg = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% sdg = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% avField = getavfield2dmatlab(udg(:,1:4,:),udg(:,5:12,:),vdg,pde.physicsparam); +% avc = getavfield2dc(udg,vdg,pde.physicsparam); +% +% figure(1); clf; scaplot(mesh,avField(:,1,:),[],1); colormap('jet'); +% figure(2); clf; scaplot(mesh,avc(:,1,:),[],1); colormap('jet'); +% figure(3); clf; scaplot(mesh,vdg(:,1,:),[],1); colormap('jet'); +% figure(4); clf; scaplot(mesh,sdg(:,1,:),[],1); colormap('jet'); +% +% +% % figure(1); clf; hold on; +% % for ib=1:3 +% % f = mkf(mesh.t,mesh.f,2); +% % if ib==1 +% % pars={'facecolor',[.8,1,.8],'edgecolor','b','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % elseif ib==2 +% % pars={'facecolor',[.8,1,.8],'edgecolor','r','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % else +% % pars={'facecolor',[.8,1,.8],'edgecolor','k','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % end +% % ind = find(f(end,:)==-ib); +% % patch('faces',f(1:end-4,ind)','vertices',mesh.p',pars{:}); +% % end +% % axis equal; axis tight; +% % +% % +% +% +%% +% xtmp = [] +% tmp = [] +% dgtst = reshape(mesh.dgnodes, [6400*4 2]); +% Ttst = reshape(T, [6400*4 1]); +% for i = 1:size(dgtst,1) +% if abs(dgtst(i,2)) < 1e-4 +% disp(dgtst(i,1)) +% xtmp = [xtmp, dgtst(i,1)]; +% tmp = [tmp, Ttst(i)]; +% end +% end +ncu = 5 + 2 + 1; +rhoinv = 1./rho; +uv = Uout(:,6,:); +vv = Uout(:,7,:); +drhou_dx = Uout(:,ncu+5+1,:); +drhov_dx = Uout(:,ncu+5+2,:); +drhou_dy = Uout(:,ncu+ncu+5+1,:); +drhov_dy = Uout(:,ncu+ncu+5+2,:); +du_dx = (drhou_dx - drho_dx.*uv).*rhoinv; +dv_dx = (drhov_dx - drho_dx.*vv).*rhoinv; +du_dy = (drhou_dy - drho_dy.*uv).*rhoinv; +dv_dy = (drhov_dy - drho_dy.*vv).*rhoinv; +div_v = du_dx + dv_dy; +vort = (dv_dx - du_dy); +vort = sqrt(vort.*vort); + DucrosRatio = div_v.*div_v ./ (div_v.*div_v + vort.*vort + 1.0e-16); +figure(1); clf; scaplot(mesh, div_v, [], 1, 0); +figure(2); clf; scaplot(mesh, vort, [], 1, 0); +figure(3); clf; scaplot(mesh, DucrosRatio, [], 1, 0); \ No newline at end of file diff --git a/Applications/Hypersonics/ReactingCylinder/plotsol_dT.m b/Applications/Hypersonics/ReactingCylinder/plotsol_dT.m new file mode 100644 index 00000000..c948865e --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/plotsol_dT.m @@ -0,0 +1,134 @@ +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +ti =20; +% Uout = getsolution(['dataout/out'],dmd,master.npe); +Uout = getsolution(['dataout/out_t' num2str(ti)],dmd,master.npe); +UCGout = getsolution(['dataout/out_outputCG_t' num2str(ti)],dmd,master.npe); +% out = eulereval(Uout,'r',gam,Minf); +rho = sum(Uout(:,1:5,:),2); +out = Uout(:,7,:); +% out = rho; +% out = rho; +% outCG = +species = ["N","O","NO","N2","O2"]; +for i = 1:5 +% if i ~= 9 + figure(i); clf +% subplot(1,5,i) + outcurr = Uout(:,i,:); + outcurr = outcurr(:); + scaplot(mesh,outcurr,[],1,1); colormap('jet') +% hold on; plot(linspace(-3, 1), 0*linspace(-3,1)) +% xlim([-3 0]) +% ylim([0 3]) +% set(gca, "visible", "off") +axis("off") + title(strcat("Y_{", string(species(i)), string("}"))) + drawnow +% waitforbuttonpress +% end +end +%% +titles = ["odg", "dtdx", "dtdy", "p", 't']; +for i = 1:5 +% if i ~= 9 + figure(i); clf + wcurr = UCGout(:,i,:); + scaplot(mesh,wcurr,[],1); + title(titles(i)); colormap('jet'); drawnow; +% waitforbuttonpress +% end +end +% figure(7); clf +avbField = UCGout(:,1,:); +dTdx = UCGout(:,2,:); +dTdy = UCGout(:,3,:); +P = UCGout(:,4,:); +T = UCGout(:,5,:); +% P = UCGout(:,6,:); +% T = UCGout(:,7,:); +% gam = UCGout(:,8,:); +% sb0 = UCGout(:,10,:); +% rhoe = UCGout(:,9,:); +%% +% ncu = 5 + 2 + 1; +% rhoinv = 1./rho; +% uv = Uout(:,6,:); +% vv = Uout(:,7,:); +% drhou_dx = Uout(:,ncu+5+1,:); +% drhov_dx = Uout(:,ncu+5+2,:); +% drhou_dy = Uout(:,ncu+ncu+5+1,:); +% drhov_dy = Uout(:,ncu+ncu+5+2,:); +% du_dx = (drhou_dx - drho_dx.*uv).*rhoinv; +% dv_dx = (drhov_dx - drho_dx.*vv).*rhoinv; +% du_dy = (drhou_dy - drho_dy.*uv).*rhoinv; +% dv_dy = (drhov_dy - drho_dy.*vv).*rhoinv; +% div_v = du_dx + dv_dy; +% vort = (dv_dx - du_dy); +% vort = sqrt(vort.*vort); +% DucrosRatio = div_v.*div_v ./ (div_v.*div_v + vort.*vort + 1.0e-16); +% figure(1); clf; scaplot(mesh, div_v, [], 1, 0); +% figure(2); clf; scaplot(mesh, vort, [], 1, 0); +% figure(3); clf; scaplot(mesh, DucrosRatio, [], 1, 0); +% figure(1) +% out = Uout(:,8,:); +% % outCG = +% [om,ind] = max(abs(out(:))); +% figure(1); clf; scaplot(mesh,out,[],1); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% colormap('jet'); + +% +% Uout = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% figure(2); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% Uout = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% figure(4); clf; scaplot(mesh,Uout(:,1,:),[],1); colormap('jet'); +% out=Uout(:,1,:); [om,ind] = max(abs(out(:))); +% x = mesh.dgnodes(:,1,:); +% y = mesh.dgnodes(:,2,:); +% hold on; +% plot(x(ind),y(ind),'o'); +% e=Uout(:,2,:)-mesh.vdg(:,2,:); max(abs(e(:))) +% +% udg = getsolution(['dataout/out_udg' num2str(ti)],dmd,master.npe); +% vdg = getsolution(['dataout/out_odg' num2str(ti)],dmd,master.npe); +% sdg = getsolution(['dataout/out_smoothedodg' num2str(ti)],dmd,master.npe); +% avField = getavfield2dmatlab(udg(:,1:4,:),udg(:,5:12,:),vdg,pde.physicsparam); +% avc = getavfield2dc(udg,vdg,pde.physicsparam); +% +% figure(1); clf; scaplot(mesh,avField(:,1,:),[],1); colormap('jet'); +% figure(2); clf; scaplot(mesh,avc(:,1,:),[],1); colormap('jet'); +% figure(3); clf; scaplot(mesh,vdg(:,1,:),[],1); colormap('jet'); +% figure(4); clf; scaplot(mesh,sdg(:,1,:),[],1); colormap('jet'); +% +% +% % figure(1); clf; hold on; +% % for ib=1:3 +% % f = mkf(mesh.t,mesh.f,2); +% % if ib==1 +% % pars={'facecolor',[.8,1,.8],'edgecolor','b','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % elseif ib==2 +% % pars={'facecolor',[.8,1,.8],'edgecolor','r','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % else +% % pars={'facecolor',[.8,1,.8],'edgecolor','k','Linew',1,'FaceAlpha',1,'EdgeAlpha',1}; +% % end +% % ind = find(f(end,:)==-ib); +% % patch('faces',f(1:end-4,ind)','vertices',mesh.p',pars{:}); +% % end +% % axis equal; axis tight; +% % +% % +% +%