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/mutationUtils.cpp b/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp new file mode 100644 index 00000000..d4527158 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/mutationUtils.cpp @@ -0,0 +1,265 @@ +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 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/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..4f1959ae --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicMPP.cpp @@ -0,0 +1,118 @@ +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_scale; + + 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]; + + 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); + + + } +} + +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/opuFbouSubsonicVectorTau.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp new file mode 100644 index 00000000..c9c876ca --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFbouSubsonicVectorTau.cpp @@ -0,0 +1,215 @@ +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 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 = 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; + + 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)+ 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/opuFbou_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp new file mode 100644 index 00000000..37aaa4a8 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFbou_MPP.cpp @@ -0,0 +1,130 @@ +#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 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/opuFbou_pressureOutMPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuFbou_pressureOutMPP.cpp new file mode 100644 index 00000000..bf806bd2 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFbou_pressureOutMPP.cpp @@ -0,0 +1,97 @@ +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 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..ccf972bd --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuFlux_MPP.cpp @@ -0,0 +1,66 @@ +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()/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] = 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); + } +} + +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/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 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_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuInitwdg_MPP.cpp new file mode 100644 index 00000000..30fbcdf7 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuInitwdg_MPP.cpp @@ -0,0 +1,57 @@ +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/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/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 new file mode 100644 index 00000000..51da47f1 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuSource_MPP.cpp @@ -0,0 +1,41 @@ +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]/(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; + } +} + +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 new file mode 100644 index 00000000..455e7755 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuSourcewMPP.cpp @@ -0,0 +1,48 @@ +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; + } +} + +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/opuSourcew_MPP.cpp b/Applications/Hypersonics/1DShockTube/app/opuSourcew_MPP.cpp new file mode 100644 index 00000000..362bf6fb --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuSourcew_MPP.cpp @@ -0,0 +1,50 @@ +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); + // 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); + } +} + +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..c413750c --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/app/opuUbouSubsonicMPP.cpp @@ -0,0 +1,78 @@ +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); + + 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]; + f[3*ng+i] = Ucons[3]; + f[4*ng+i] = Ucons[4]; + f[5*ng+i] = Ucons[5]; + f[6*ng+i] = Ucons[6]; + + } +} + +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/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 new file mode 100644 index 00000000..c1a28457 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdeapp.m @@ -0,0 +1,108 @@ +% 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 + +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 + +% 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 = 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.5; +mesh.p = a + (b-a)*mesh.p; +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 +% 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 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); diff --git a/Applications/Hypersonics/1DShockTube/pdeapp_euler.m b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m new file mode 100644 index 00000000..7d2c05cc --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdeapp_euler.m @@ -0,0 +1,95 @@ +% 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_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 + +%% 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 = 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 = 4.0; + +%% Mesh +nDiv = 1024; + +[mesh.p,mesh.t] = linemesh(nDiv-1); +a = 0; 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 + + +%% Solver params +pde.linearsolveriter = 40; +pde.GMRESrestart = 20; +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; + +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); + +% Assumed equilibrium conditions used for outflow and initial conditions. +pde.physicsparam = [1, 0, 16.8925]; + +rhoin = 1.0; +uin = 1.0; +rhoEin = 20.888; +pin = 0.4 * (rhoEin - 1/2 * rhoin * uin^2); + +% 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_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); + +% 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); + +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_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 new file mode 100644 index 00000000..d24577f0 --- /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_euler.m b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m new file mode 100644 index 00000000..e9dcdf7f --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdemodel_euler.m @@ -0,0 +1,173 @@ + +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 = 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 + + f(1) = rhou; + f(nspecies + 1) = rhou * uv + p; + f(nspecies + 2) = rhou * H; +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)); + +% 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); + 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)); + +% 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 = 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 + + 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 +% +% gamma = 1.4; +% gammam1 = gamma-1; +% p = gammam1 * (rhoE - 0.5 * rho * uv^2); +% +% uv_inflow = mu(2); +% uin = [rho; rhou; rhoE]; +end + +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 new file mode 100644 index 00000000..f4a8f460 --- /dev/null +++ b/Applications/Hypersonics/1DShockTube/pdemodel_inflow.m @@ -0,0 +1,151 @@ + +function pde = pdemodel_inflow + pde.mass = @mass; + pde.flux = @flux; + pde.source = @source; + pde.fbou = @fbou; + pde.ubou = @ubou; + pde.initu = @initu; + pde.output = @output; +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; + 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 + + p = eta(4); % MANUALLY MODIFIED + 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) = 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)); +%%%%%% 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); + 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]; + + 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 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 \ No newline at end of file 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 new file mode 100644 index 00000000..11d24f7c --- /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(:),rho(:),'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/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/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 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/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 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 00000000..5489272a Binary files /dev/null and b/Applications/Hypersonics/ReactingCylinder/app/opuApp.a differ 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/opuAvfield_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp new file mode 100644 index 00000000..80dac622 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuAvfield_2d_MPP.cpp @@ -0,0 +1,287 @@ +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(); +// 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 = 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*(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; + } +} + +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_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.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/opuFbou_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp new file mode 100644 index 00000000..196662ee --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuFbou_2d_MPP.cpp @@ -0,0 +1,1372 @@ +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 = 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); + } +} + +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 = 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); + } +} + +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 = 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 = 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; + } +} + +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/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/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/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* __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 = 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; + +} + +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.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/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/opuOutput_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.cpp new file mode 100644 index 00000000..dea075cd --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuOutput_2d_MPP.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]; + // 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/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.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/opuSource_2d_MPP.cpp b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp new file mode 100644 index 00000000..b59f52ca --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/app/opuSource_2d_MPP.cpp @@ -0,0 +1,62 @@ +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; +// std::cout << "START SOURCE: " << L_scale << std::endl; + + for (int i = 0; i setState(rhovec, &rhoe, 0); + 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); + 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/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/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 *); 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 new file mode 100644 index 00000000..42b21f67 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/avfieldLaplacian2d.m @@ -0,0 +1,80 @@ +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 = mu(22); + sigm = mu(23); + 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); + 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_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 + % limit divergence and vorticity + div_v = limiting(div_v,-sigm,sigm,alpha,-sigm); + + 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 = (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/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/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..4f619655 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/getStates2d.py @@ -0,0 +1,137 @@ +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("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)) + + + + # 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/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 new file mode 100644 index 00000000..a9f47dde --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdeapp_cylinder.m @@ -0,0 +1,207 @@ +% 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_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 = 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 = 2200; +% nt = 150 +% dt = tfinal / 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 = 1; +% pde.saveSolFreq = 100; +% pde.soltime = pde.saveSolFreq:pde.saveSolFreq:length(pde.dt); % steps at which solution are collected +% pde.timestepOffset = 1400; + +% Solver params +pde.linearsolveriter = 80; +pde.GMRESrestart = 39; +pde.linearsolvertol = 1e-4; +pde.matvectol = 1e-7; +pde.NLiter = 2; +pde.RBdim = 5; +pde.NLtol = 1e-9; +% pde.matvecorder = 1; + +pde.AV = 1; +% pde.frozenAVflag = 0; +pde.nce = 12; + +%% Mutation information +% Mutation configuration +pde.mutationflag = 1; +pde.mutationopts = {}; +pde.mutationopts{1} = "air_5"; +pde.mutationopts{2} = "ChemNonEq1T"; +pde.mutationopts{3} = "NASA-9"; +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; +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(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 * (0.4); +mu_ref = 4.415107627874723e-05; +kappa_ref = 0.07663957108841235; + +% Nondimensional quantities +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.01; +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; +% +% 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 +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 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_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 new file mode 100644 index 00000000..0689e865 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/pdemodel_2d.m @@ -0,0 +1,317 @@ + +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(21); + 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(21); + + % 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 + 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 = 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 = 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; + 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_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 new file mode 100644 index 00000000..49a81902 --- /dev/null +++ b/Applications/Hypersonics/ReactingCylinder/plotsol.m @@ -0,0 +1,128 @@ +mesh.nd = master.dim; +mesh.plocal = master.xpe; +mesh.tlocal = master.telem; +mesh.porder = pde.porder; +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 = 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 = +% 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: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 +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; +% % +% % +% +% 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; +% % +% % +% +% diff --git a/Applications/Hypersonics/shocktests/EulerResults.png b/Applications/Hypersonics/shocktests/EulerResults.png new file mode 100644 index 00000000..64851f9e Binary files /dev/null and b/Applications/Hypersonics/shocktests/EulerResults.png differ diff --git a/Applications/Hypersonics/shocktests/app/fixargsMPP_Mac.sh b/Applications/Hypersonics/shocktests/app/fixargsMPP_Mac.sh new file mode 100755 index 00000000..91968410 --- /dev/null +++ b/Applications/Hypersonics/shocktests/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/shocktests/app/mutationUtils.cpp b/Applications/Hypersonics/shocktests/app/mutationUtils.cpp new file mode 100644 index 00000000..2b029a29 --- /dev/null +++ b/Applications/Hypersonics/shocktests/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 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..b620d317 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP.cpp @@ -0,0 +1,227 @@ +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+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); + 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.591227150044006E-12; + T t36 = 1.0/t35; + T t37 = t36*udg7; + T t38 = t36*uinf1; + 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 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*(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-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+2.0E+4); + T t69 = t58+t68+1.0E+4; + T t70 = odg2*t5*t63*t69; + T t71 = -t70; + T t73 = t70*1.0E+12; + 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+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; +} + +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_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp new file mode 100644 index 00000000..d787581e --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuAvfield_MPP_PB.cpp @@ -0,0 +1,173 @@ +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 = (mix->mixtureFrozenCpMass() / 1010.7825217371519) /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; // 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 + } +} + +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_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/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..577c39fb --- /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/opuFbou_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuFbou_MPP_PB.cpp new file mode 100644 index 00000000..c62da494 --- /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.cpp b/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp new file mode 100644 index 00000000..91fc91ba --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuFlux_MPP.cpp @@ -0,0 +1,138 @@ +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); + // 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); + 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] = 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); + } + // 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/opuFlux_MPP_PB.cpp b/Applications/Hypersonics/shocktests/app/opuFlux_MPP_PB.cpp new file mode 100644 index 00000000..026e0f78 --- /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/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(); + + 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; +} + +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_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/opuOutput_MPP_sensors_PB.cpp b/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors_PB.cpp new file mode 100644 index 00000000..fe0156b3 --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuOutput_MPP_sensors_PB.cpp @@ -0,0 +1,250 @@ +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 = (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/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 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*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)); + + } +} + +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/app/opuSource_MPP.cpp b/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp new file mode 100644 index 00000000..68e1ad1d --- /dev/null +++ b/Applications/Hypersonics/shocktests/app/opuSource_MPP.cpp @@ -0,0 +1,61 @@ +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); + // std::cout << wdot[4]/omega_scale << std::endl; + 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/avfieldPhysical1d.m b/Applications/Hypersonics/shocktests/avfieldPhysical1d.m new file mode 100644 index 00000000..193d37ad --- /dev/null +++ b/Applications/Hypersonics/shocktests/avfieldPhysical1d.m @@ -0,0 +1,83 @@ +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 + + kD = kb * ones(5,1); + % regularization parameters + alpha = 1.0e12; + rmin = 0.0; + Hmin = 1.0e-4; + + % mesh size + hm = v(4+nspecies); + + % Get base variables + rho_i = u(1:nspecies); + rhou = u(nspecies+1); + % rv = udg(3); + rhoE = u(nspecies+nd+1); + + drho_dx_i = -q(1:nspecies); + drho_dx = sum(drho_dx_i); + drhou_dx = -q(nspecies+1); + + % Regularization + rho_i = rmin + lmax(rho_i-rmin,alpha); % need to double check regularizatino here + + % Simple derived working quantities + 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 = (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 + 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 = 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) = avY; % species +end 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 new file mode 100644 index 00000000..657275f1 --- /dev/null +++ b/Applications/Hypersonics/shocktests/getStates.py @@ -0,0 +1,118 @@ +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("RRHO") + + 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 + PL = 1.95256e5 + + TR = 300.0 + PR = 1.0e4 + + # opt = mpp.MixtureOptions("air_5") + # opt.setStateModel("ChemNonEq1T") + # opt.setViscosityAlgorithm("Gupta-Yos") + # mix = mpp.Mixture(opt) + mix = init_mixture() + + 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)) + + # 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/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/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..59b4aba0 --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdeapp.m @@ -0,0 +1,168 @@ +% 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 = 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 = 1000; +% nt = 150 +% dt = tfinal / nt; +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); +% 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; +pde.precMatrixType = 2; +pde.ptcMatrixType = 0; + +%% 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); +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 +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.0002 % 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 +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 / (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.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_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') +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/pdeapp_physicsbased.m b/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m new file mode 100644 index 00000000..213728f6 --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdeapp_physicsbased.m @@ -0,0 +1,186 @@ +% 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 = 1000; +% dt = tfinal / nt; +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); +% 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-4; +pde.matvectol = 1e-7; +pde.NLiter = 3; +pde.RBdim = 5; +pde.NLtol = 1e-9; +pde.precMatrixType = 2; +pde.ptcMatrixType = 0; + +%% 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); +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 +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 +% ]; + +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; +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 +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; +[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); + +% 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 opuOutput_MPP.cpp opuOutput.cpp'); %X +eval('!cp opuAvfield_MPP_PB.cpp opuAvfield.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(".."); + +% 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..3651d840 --- /dev/null +++ b/Applications/Hypersonics/shocktests/pdemodel.m @@ -0,0 +1,349 @@ + +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.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) + 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); % 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.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) + %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; + alpha = 1e9; + + 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] + D_vec = eta(1:nspecies); + h_vec = eta(nspecies+1:2*nspecies); + viscshear = eta(2*nspecies+1); + kappa = eta(2*nspecies+2); + 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; + 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 + f(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); + 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 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_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/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.m b/Applications/Hypersonics/shocktests/plotting.m new file mode 100644 index 00000000..d73d774b --- /dev/null +++ b/Applications/Hypersonics/shocktests/plotting.m @@ -0,0 +1,137 @@ +%% 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) +% 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); + 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,:); + 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) +end +% final +%% +% ttst = 27*120; +% ttst = 324 +ttst = ti; +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); + +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/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/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)") 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 + + + + 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 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 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/Julia/Gencode/compilecode.jl b/src/Julia/Gencode/compilecode.jl index b4ea04bb..e8fab1b3 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 cpuappflags = app.cpuappflags gpuappflags = app.gpuappflags @@ -47,12 +48,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" * " -stdlib=libc++ -Xclang -load -Xclang " * coredir * enzyme; else compilerstr[1] = cpucompiler * " -fPIC -O3 -c opuApp.cpp"; end + if mutationflag == 1 + compilerstr[1] = compilerstr[1] * mutationinclude + end if length(cpuappflags) > 0 compilerstr[1] = compilerstr[1] * " " * cpuappflags end @@ -92,6 +107,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) @@ -103,6 +121,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 37dc97e5..ad18b213 100644 --- a/src/Julia/Preprocessing/initializepde.jl +++ b/src/Julia/Preprocessing/initializepde.jl @@ -124,6 +124,10 @@ mutable struct PDEStruct dae_steps::IntP; dae_dt::Array{FloatP,1}; # dual time steps + mutationflag::IntP + mutationopts::Dict + mutationpath::String + PDEStruct() = new(); end @@ -255,6 +259,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 c564d841..3b7671c1 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/avfieldDriver.cpp b/src/Kernel/AppDriver/avfieldDriver.cpp index 900eb052..8c84abb7 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 6594dc38..f954c2bf 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 f1dcbc95..df5c0a26 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 10defebd..6582464b 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 9576c392..7ba89c3e 100644 --- a/src/Kernel/AppDriver/opuApp.cpp +++ b/src/Kernel/AppDriver/opuApp.cpp @@ -3,6 +3,11 @@ #include #include +#ifdef _MUTATIONPP +#include +#include "mutationUtils.cpp" +#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 ea582117..23abe750 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..f029b724 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); + #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 fe9e477e..1336be78 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); @@ -41,6 +44,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 *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); diff --git a/src/Kernel/Common/common.h b/src/Kernel/Common/common.h index be09e9d8..d3aa3a06 100644 --- a/src/Kernel/Common/common.h +++ b/src/Kernel/Common/common.h @@ -58,6 +58,10 @@ typedef int Int; // int enzyme_const, enzyme_dup; // #endif +#ifdef HAVE_MPP +#include +#endif + #define MKL_INT int #define CPUFREE(x) \ @@ -336,6 +340,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/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 42b4fb2d..cadb3cff 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 @@ -34,7 +39,29 @@ 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; + + char c[50]; + in.getline(c, 50, 'X'); + string ThermoDB = c; + + 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"); + #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/Discretization/uresidual.cpp b/src/Kernel/Discretization/uresidual.cpp index 9d4fd653..0e77fed8 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); diff --git a/src/Kernel/Main/main.cpp b/src/Kernel/Main/main.cpp index 6bd0b6b5..e07d103b 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 diff --git a/src/Matlab/Gencode/compilecode.m b/src/Matlab/Gencode/compilecode.m index d3bb3ab5..4cd43bc9 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; cpuappflags = app.cpuappflags; gpuappflags = app.gpuappflags; @@ -47,12 +48,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{1} = compilerstr{1} + " " + cpuappflags; compilerstr{2} = "ar -rvs opuApp.a opuApp.o"; end @@ -69,6 +84,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; @@ -79,6 +96,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) @@ -90,6 +110,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) 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 diff --git a/src/Matlab/Preprocessing/initializepde.m b/src/Matlab/Preprocessing/initializepde.m index 8be7ae8c..28dd4bac 100644 --- a/src/Matlab/Preprocessing/initializepde.m +++ b/src/Matlab/Preprocessing/initializepde.m @@ -121,6 +121,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/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(:)); diff --git a/src/Matlab/Preprocessing/writeapp.m b/src/Matlab/Preprocessing/writeapp.m index ec1ae563..f9bd8995 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); diff --git a/src/Python/Gencode/compilecode.py b/src/Python/Gencode/compilecode.py index d923490b..f0b8de9e 100644 --- a/src/Python/Gencode/compilecode.py +++ b/src/Python/Gencode/compilecode.py @@ -21,6 +21,8 @@ def compilecode(app): cpuappflags = app['cpuappflags'] gpuappflags = app['gpuappflags'] + mutationflag = app['mutationflag'] + # current directory cdir = os.getcwd(); ii = cdir.find(codename) @@ -45,6 +47,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"; @@ -52,6 +62,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[0] = compilerstr[0] + " " + cpuappflags compilerstr[1] = "ar -rvs opuApp.a opuApp.o"; else: @@ -78,6 +90,8 @@ 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): if (size(enzyme)>0): @@ -87,6 +101,8 @@ def compilecode(app): 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 bcad3c8f..c605051b 100644 --- a/src/Python/Preprocessing/initializepde.py +++ b/src/Python/Preprocessing/initializepde.py @@ -126,4 +126,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 fcaa7e36..d6862dc6 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;