1 #ifndef Dissipation2D_H
2 #define Dissipation2D_H
9 #include "xtensor-python/pyarray.hpp"
11 namespace py = pybind11;
36 double mu_fr_limiter){}
41 template<
class CompKernelType,
43 int nQuadraturePoints_element,
44 int nDOF_mesh_trial_element,
45 int nDOF_trial_element,
46 int nDOF_test_element,
47 int nQuadraturePoints_elementBoundary>
118 const double grad_k[nSpace],
119 const double grad_omega[nSpace],
120 const double grad_vx[nSpace],
121 const double grad_vy[nSpace],
123 double& inverse_sigma_k,
124 double& inverse_sigma_omega,
132 inverse_sigma_k = 2.0; inverse_sigma_omega=2.0; gamma = 13.0/25.0;
133 const double beta0_star = 0.09;
const double beta0 = 9.0/125.0;
134 double Omega[nSpace][nSpace] = {{0.,0.},
137 double S[nSpace][nSpace] = {{0.,0.},
141 Omega[0][1] = 0.5*(grad_vx[1]-grad_vy[0]);
142 Omega[1][0] =-Omega[0][1];
145 S[0][0] = grad_vx[0]; S[0][1] = 0.5*(grad_vx[1]+grad_vy[0]);
146 S[1][0] = S[0][1]; S[1][1] = grad_vy[1];
148 double chi_omega = 0.0;
149 for (
int i=0; i < nSpace; i++)
150 for (
int k=0; k < nSpace; k++)
151 for (
int j=0; j < nSpace; j++)
152 chi_omega += Omega[i][j]*Omega[j][k]*S[k][i];
153 if (fabs(omega) > div_eps)
155 chi_omega = fabs(chi_omega/(beta0_star*omega*beta0_star*omega*beta0_star*omega));
157 const double f_beta = (1.0+70.0*chi_omega)/(1.0 + 80.0*chi_omega);
164 double chi_k = grad_k[0]*grad_omega[0] + grad_k[1]*grad_omega[1];
165 double f_beta_star = 1.0;
167 const double omega3 = omega*omega*omega;
168 if (fabs(omega3) > div_eps)
170 chi_k = chi_k/omega3;
171 f_beta_star = (1.0 + 680.0*chi_k*chi_k)/(1.0 + 400.0*chi_k*chi_k);
173 else if (chi_k > 0.0)
174 f_beta_star = 680.0/400.0;
176 beta_star = beta0_star*f_beta_star;
181 beta = fmax(0.875*beta0,fmin(beta,beta0));
186 beta_star = fmax(beta0_star,fmin(beta_star,(680.0/400.0)*beta0_star));
198 const double sigma_e,
203 const double grad_vx[nSpace],
204 const double grad_vy[nSpace],
206 const double& dissipation,
207 const double& dissipation_old,
209 const double& porosity,
213 double q_vos_gradc[nSpace],
219 int dissipation_model_flag,
220 const double grad_k[nSpace],
221 const double grad_dissipation_old[nSpace],
231 double nu_t=0.0,dnu_t_de=0.0,PiD4=0.0,disp=0.0,ddisp_de=0.0;
233 double gamma_e=0.0,F_e=0.0, gamma_production=0.0,sigma_a=sigma_e,
234 dgamma_e_d_dissipation=0.0, dF_e_d_dissipation=0.0;
236 const double isKEpsilon = (dissipation_model_flag>=2) ? 0.0 : 1.0;
237 m = dissipation*porosity;
240 for (
int I=0; I < nSpace; I++)
242 f[I] =
v[I]*porosity*dissipation;
243 df[I] =
v[I]*porosity;
246 double nu = (1.0-H_mu)*
nu_0 + H_mu*
nu_1;
247 const double div_eps = 1.0e-2*fmin(
nu_0,
nu_1);
249 nu_t = isKEpsilon*c_mu*k*k/(fabs(dissipation_old)+div_eps)
250 + (1.0-isKEpsilon)*k/(fabs(dissipation_old)+div_eps);
257 nu_t = fmax(nu_t,1.e-4*nu);
259 nu_t = fmin(nu_t,1.0e6*nu);
262 PiD4 = 2.0*(grad_vx[0]*grad_vx[0] +
263 grad_vy[1]*grad_vy[1])
265 (grad_vx[1] + grad_vy[0])*(grad_vx[1] + grad_vy[0]);
268 double theta = 1e-10;
272 if (sedFlag == 1 && isKEpsilon > 0)
291 if (dissipation_model_flag==2)
294 double sigma_k=1.,beta_star=1.,beta=1.0;
299 grad_dissipation_old,
312 dgamma_e_d_dissipation = 0.0;
313 gamma_e = fmax(beta*k/nu_t,0.0);
319 dF_e_d_dissipation=0.0;
320 F_e = fmax(PiD4*gamma_production,0.0);
324 else if (dissipation_model_flag==3)
327 gamma_production = 5.0/9.0;
328 double beta = 3.0/40.0;
330 dgamma_e_d_dissipation = 0.0;
331 gamma_e = fmax(beta*k/nu_t,0.0);
334 dF_e_d_dissipation=0.0;
335 F_e = fmax(PiD4*gamma_production,0.0);
341 gamma_e = fmax(c_2*dissipation_old/(k+div_eps),0.0);
342 dgamma_e_d_dissipation = 0.0;
343 F_e = fmax(c_1*PiD4*k,0.0);
344 dF_e_d_dissipation=0.0;
348 a = porosity*(nu_t/sigma_a + nu);
349 da_de = porosity*dnu_t_de/sigma_a;
351 r = -porosity*F_e + porosity*gamma_e*dissipation+porosity*dSed*dissipation;
352 dr_de = -porosity*dF_e_d_dissipation + porosity*gamma_e + porosity*dgamma_e_d_dissipation+porosity*dSed;
359 const double dH[nSpace],
363 double h,nrm_v,oneByAbsdt;
366 for(
int I=0;I<nSpace;I++)
370 oneByAbsdt = fabs(dmt);
371 tau = 1.0/(2.0*nrm_v/h + oneByAbsdt + 1.0e-8);
377 const double G[nSpace*nSpace],
379 const double Ai[nSpace],
384 for(
int I=0;I<nSpace;I++)
385 for (
int J=0;J<nSpace;J++)
386 v_d_Gv += Ai[I]*G[I*nSpace+J]*Ai[J];
388 tau_v = 1.0/sqrt(Ct_sge*A0*A0 + v_d_Gv);
395 const double& elementDiameter,
396 const double& strong_residual,
397 const double grad_u[nSpace],
406 for (
int I=0;I<nSpace;I++)
407 n_grad_u += grad_u[I]*grad_u[I];
408 num = shockCapturingDiffusion*0.5*h*fabs(strong_residual);
409 den = sqrt(n_grad_u) + 1.0e-8;
415 const int& isAdvectiveFluxBoundary_u,
416 const double n[nSpace],
418 const double& bc_flux_u,
420 const double velocity[nSpace],
425 for (
int I=0; I < nSpace; I++)
426 flow +=
n[I]*velocity[I];
428 if (isDOFBoundary_u == 1)
442 else if (isAdvectiveFluxBoundary_u == 1)
475 H = 0.5*(1.0 +
phi/eps + sin(M_PI*
phi/eps)/M_PI);
481 const int& isAdvectiveFluxBoundary,
482 const double n[nSpace],
483 const double velocity[nSpace],
487 for (
int I=0; I < nSpace; I++)
488 flow +=
n[I]*velocity[I];
491 if (isDOFBoundary_u == 1)
502 else if (isAdvectiveFluxBoundary == 1)
516 const int& isDOFBoundary,
517 const int& isDiffusiveFluxBoundary,
521 double grad_psi[nSpace],
528 if (isDiffusiveFluxBoundary)
532 else if (isDOFBoundary)
535 for(
int I=0;I<nSpace;I++)
537 v_I = -a*grad_psi[I];
540 flux += penalty*(
u-bc_u);
550 const int& isDiffusiveFluxBoundary,
554 double grad_psi[nSpace],
555 const double grad_v[nSpace],
558 double& fluxJacobian)
560 if (isDiffusiveFluxBoundary == 0 && isDOFBoundary == 1)
563 for(
int I=0;I<nSpace;I++)
565 fluxJacobian -= (a*grad_v[I] + da*
v*grad_psi[I])*
n[I];
567 fluxJacobian += penalty*
v;
575 xt::pyarray<double>& mesh_trial_ref = args.
array<
double>(
"mesh_trial_ref");
576 xt::pyarray<double>& mesh_grad_trial_ref = args.
array<
double>(
"mesh_grad_trial_ref");
577 xt::pyarray<double>& mesh_dof = args.
array<
double>(
"mesh_dof");
578 xt::pyarray<double>& mesh_velocity_dof = args.
array<
double>(
"mesh_velocity_dof");
579 double MOVING_DOMAIN = args.
scalar<
double>(
"MOVING_DOMAIN");
580 xt::pyarray<int>& mesh_l2g = args.
array<
int>(
"mesh_l2g");
581 xt::pyarray<double>& dV_ref = args.
array<
double>(
"dV_ref");
582 xt::pyarray<double>& u_trial_ref = args.
array<
double>(
"u_trial_ref");
583 xt::pyarray<double>& u_grad_trial_ref = args.
array<
double>(
"u_grad_trial_ref");
584 xt::pyarray<double>& u_test_ref = args.
array<
double>(
"u_test_ref");
585 xt::pyarray<double>& u_grad_test_ref = args.
array<
double>(
"u_grad_test_ref");
586 xt::pyarray<double>& mesh_trial_trace_ref = args.
array<
double>(
"mesh_trial_trace_ref");
587 xt::pyarray<double>& mesh_grad_trial_trace_ref = args.
array<
double>(
"mesh_grad_trial_trace_ref");
588 xt::pyarray<double>& dS_ref = args.
array<
double>(
"dS_ref");
589 xt::pyarray<double>& u_trial_trace_ref = args.
array<
double>(
"u_trial_trace_ref");
590 xt::pyarray<double>& u_grad_trial_trace_ref = args.
array<
double>(
"u_grad_trial_trace_ref");
591 xt::pyarray<double>& u_test_trace_ref = args.
array<
double>(
"u_test_trace_ref");
592 xt::pyarray<double>& u_grad_test_trace_ref = args.
array<
double>(
"u_grad_test_trace_ref");
593 xt::pyarray<double>& normal_ref = args.
array<
double>(
"normal_ref");
594 xt::pyarray<double>& boundaryJac_ref = args.
array<
double>(
"boundaryJac_ref");
595 int nElements_global = args.
scalar<
int>(
"nElements_global");
598 double sigma_e = args.
scalar<
double>(
"sigma_e");
599 double c_mu = args.
scalar<
double>(
"c_mu");
600 double c_1 = args.
scalar<
double>(
"c_1");
601 double c_2 = args.
scalar<
double>(
"c_2");
602 double c_e = args.
scalar<
double>(
"c_e");
605 double sedFlag = args.
scalar<
int>(
"sedFlag");
606 xt::pyarray<double>& q_vos = args.
array<
double>(
"q_vos");
607 xt::pyarray<double>& q_vos_gradc = args.
array<
double>(
"q_vos_gradc");
608 xt::pyarray<double>& ebqe_q_vos = args.
array<
double>(
"ebqe_q_vos");
609 xt::pyarray<double>& ebqe_q_vos_gradc = args.
array<
double>(
"ebqe_q_vos_gradc");
610 double rho_f = args.
scalar<
double>(
"rho_f");
611 double rho_s = args.
scalar<
double>(
"rho_s");
612 xt::pyarray<double>& vs = args.
array<
double>(
"vs");
613 xt::pyarray<double>& ebqe_vs = args.
array<
double>(
"ebqe_vs");
614 xt::pyarray<double>& g = args.
array<
double>(
"g");
615 int dissipation_model_flag = args.
scalar<
int>(
"dissipation_model_flag");
616 double useMetrics = args.
scalar<
double>(
"useMetrics");
617 double alphaBDF = args.
scalar<
double>(
"alphaBDF");
618 int lag_shockCapturing = args.
scalar<
int>(
"lag_shockCapturing");
619 double shockCapturingDiffusion = args.
scalar<
double>(
"shockCapturingDiffusion");
620 double sc_uref = args.
scalar<
double>(
"sc_uref");
621 double sc_alpha = args.
scalar<
double>(
"sc_alpha");
622 xt::pyarray<int>& u_l2g = args.
array<
int>(
"u_l2g");
623 xt::pyarray<double>& elementDiameter = args.
array<
double>(
"elementDiameter");
624 xt::pyarray<double>& u_dof = args.
array<
double>(
"u_dof");
625 xt::pyarray<double>& u_dof_old = args.
array<
double>(
"u_dof_old");
626 xt::pyarray<double>& velocity = args.
array<
double>(
"velocity");
627 xt::pyarray<double>& phi_ls = args.
array<
double>(
"phi_ls");
628 xt::pyarray<double>& q_kappa = args.
array<
double>(
"q_kappa");
629 xt::pyarray<double>& q_grad_kappa = args.
array<
double>(
"q_grad_kappa");
630 xt::pyarray<double>& q_porosity = args.
array<
double>(
"q_porosity");
631 xt::pyarray<double>& velocity_dof_u = args.
array<
double>(
"velocity_dof_u");
632 xt::pyarray<double>& velocity_dof_v = args.
array<
double>(
"velocity_dof_v");
633 xt::pyarray<double>& velocity_dof_w = args.
array<
double>(
"velocity_dof_w");
634 xt::pyarray<double>& q_m = args.
array<
double>(
"q_m");
635 xt::pyarray<double>& q_u = args.
array<
double>(
"q_u");
636 xt::pyarray<double>& q_grad_u = args.
array<
double>(
"q_grad_u");
637 xt::pyarray<double>& q_m_betaBDF = args.
array<
double>(
"q_m_betaBDF");
638 xt::pyarray<double>& cfl = args.
array<
double>(
"cfl");
639 xt::pyarray<double>& q_numDiff_u = args.
array<
double>(
"q_numDiff_u");
640 xt::pyarray<double>& q_numDiff_u_last = args.
array<
double>(
"q_numDiff_u_last");
641 xt::pyarray<double>& ebqe_penalty_ext = args.
array<
double>(
"ebqe_penalty_ext");
642 int offset_u = args.
scalar<
int>(
"offset_u");
643 int stride_u = args.
scalar<
int>(
"stride_u");
644 xt::pyarray<double>& globalResidual = args.
array<
double>(
"globalResidual");
645 int nExteriorElementBoundaries_global = args.
scalar<
int>(
"nExteriorElementBoundaries_global");
646 xt::pyarray<int>& exteriorElementBoundariesArray = args.
array<
int>(
"exteriorElementBoundariesArray");
647 xt::pyarray<int>& elementBoundaryElementsArray = args.
array<
int>(
"elementBoundaryElementsArray");
648 xt::pyarray<int>& elementBoundaryLocalElementBoundariesArray = args.
array<
int>(
"elementBoundaryLocalElementBoundariesArray");
649 xt::pyarray<double>& ebqe_velocity_ext = args.
array<
double>(
"ebqe_velocity_ext");
650 xt::pyarray<int>& isDOFBoundary_u = args.
array<
int>(
"isDOFBoundary_u");
651 xt::pyarray<double>& ebqe_bc_u_ext = args.
array<
double>(
"ebqe_bc_u_ext");
652 xt::pyarray<int>& isAdvectiveFluxBoundary_u = args.
array<
int>(
"isAdvectiveFluxBoundary_u");
653 xt::pyarray<double>& ebqe_bc_advectiveFlux_u_ext = args.
array<
double>(
"ebqe_bc_advectiveFlux_u_ext");
654 xt::pyarray<int>& isDiffusiveFluxBoundary_u = args.
array<
int>(
"isDiffusiveFluxBoundary_u");
655 xt::pyarray<double>& ebqe_bc_diffusiveFlux_u_ext = args.
array<
double>(
"ebqe_bc_diffusiveFlux_u_ext");
656 xt::pyarray<double>& ebqe_phi = args.
array<
double>(
"ebqe_phi");
657 double epsFact = args.
scalar<
double>(
"epsFact");
658 xt::pyarray<double>& ebqe_kappa = args.
array<
double>(
"ebqe_kappa");
659 xt::pyarray<double>& ebqe_porosity = args.
array<
double>(
"ebqe_porosity");
660 xt::pyarray<double>& ebqe_u = args.
array<
double>(
"ebqe_u");
661 xt::pyarray<double>& ebqe_flux = args.
array<
double>(
"ebqe_flux");
674 for(
int eN=0;eN<nElements_global;eN++)
677 register double elementResidual_u[nDOF_test_element];
678 for (
int i=0;i<nDOF_test_element;i++)
680 elementResidual_u[i]=0.0;
683 for (
int k=0;k<nQuadraturePoints_element;k++)
686 register int eN_k = eN*nQuadraturePoints_element+k,
687 eN_k_nSpace = eN_k*nSpace,
688 eN_nDOF_trial_element = eN*nDOF_trial_element;
689 register double u=0.0,u_old=0.0,
690 grad_u[nSpace],grad_u_old[nSpace],
692 f[nSpace],
df[nSpace],df_minus_da_grad_u[nSpace],
696 grad_vx[nSpace],grad_vy[nSpace],
698 Lstar_u[nDOF_test_element],
700 tau=0.0,tau0=0.0,tau1=0.0,
701 numDiff0=0.0,numDiff1=0.0,
704 jacInv[nSpace*nSpace],
705 u_grad_trial[nDOF_trial_element*nSpace],
706 u_test_dV[nDOF_trial_element],
707 u_grad_test_dV[nDOF_test_element*nSpace],
709 G[nSpace*nSpace],G_dd_G,tr_G,norm_Rv;
729 ck.calculateMapping_element(eN,
733 mesh_trial_ref.data(),
734 mesh_grad_trial_ref.data(),
739 ck.calculateMappingVelocity_element(eN,
741 mesh_velocity_dof.data(),
743 mesh_trial_ref.data(),
746 dV = fabs(jacDet)*dV_ref.data()[k];
747 ck.calculateG(jacInv,G,G_dd_G,tr_G);
749 ck.gradTrialFromRef(&u_grad_trial_ref.data()[k*nDOF_trial_element*nSpace],jacInv,u_grad_trial);
751 ck.valFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_ref.data()[k*nDOF_trial_element],
u);
752 ck.valFromDOF(u_dof_old.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_ref.data()[k*nDOF_trial_element],u_old);
754 ck.gradFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_u);
755 ck.gradFromDOF(u_dof_old.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_u_old);
758 ck.gradFromDOF(velocity_dof_u.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_vx);
759 ck.gradFromDOF(velocity_dof_v.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_vy);
765 for (
int j=0;j<nDOF_trial_element;j++)
767 u_test_dV[j] = u_test_ref.data()[k*nDOF_trial_element+j]*dV;
768 for (
int I=0;I<nSpace;I++)
770 u_grad_test_dV[j*nSpace+I] = u_grad_trial[j*nSpace+I]*dV;
791 q_kappa.data()[eN_k],
792 q_porosity.data()[eN_k],
796 &q_vos_gradc.data()[eN_k_nSpace],
799 &vs.data()[eN_k_nSpace],
802 dissipation_model_flag,
803 &q_grad_kappa.data()[eN_k_nSpace],
816 f[0] -= MOVING_DOMAIN*m*
xt;
817 f[1] -= MOVING_DOMAIN*m*yt;
819 df[0] -= MOVING_DOMAIN*dm*
xt;
820 df[1] -= MOVING_DOMAIN*dm*yt;
824 df_minus_da_grad_u[0] =
df[0] - da*grad_u[0];
825 df_minus_da_grad_u[1] =
df[1] - da*grad_u[1];
831 q_m_betaBDF.data()[eN_k],
840 pdeResidual_u =
ck.Mass_strong(m_t) +
ck.Advection_strong(df_minus_da_grad_u,grad_u)
841 +
ck.Reaction_strong(
r);
843 for (
int i=0;i<nDOF_test_element;i++)
847 register int i_nSpace = i*nSpace;
848 Lstar_u[i] =
ck.Advection_adjoint(df_minus_da_grad_u,&u_grad_test_dV[i_nSpace]) +
849 ck.Reaction_adjoint(dr,u_test_dV[i]);
860 tau = useMetrics*tau1+(1.0-useMetrics)*tau0;
862 subgridError_u = -tau*pdeResidual_u;
868 ck.calculateNumericalDiffusion(shockCapturingDiffusion,elementDiameter.data()[eN],pdeResidual_u,grad_u,numDiff0);
869 ck.calculateNumericalDiffusion(shockCapturingDiffusion,sc_uref, sc_alpha,G,G_dd_G,pdeResidual_u,grad_u,numDiff1);
870 q_numDiff_u.data()[eN_k] = useMetrics*numDiff1+(1.0-useMetrics)*numDiff0;
875 for(
int i=0;i<nDOF_test_element;i++)
877 register int eN_k_i=eN_k*nDOF_test_element+i,
878 eN_k_i_nSpace = eN_k_i*nSpace,
881 elementResidual_u[i] +=
ck.Mass_weak(m_t,u_test_dV[i]) +
882 ck.Advection_weak(
f,&u_grad_test_dV[i_nSpace]) +
883 ck.SubgridError(subgridError_u,Lstar_u[i]) +
884 ck.NumericalDiffusion(a,grad_u,&u_grad_test_dV[i_nSpace]) +
885 ck.NumericalDiffusion(q_numDiff_u_last.data()[eN_k],grad_u,&u_grad_test_dV[i_nSpace]) +
886 ck.Reaction_weak(
r,u_test_dV[i]);
894 q_u.data()[eN_k] =
u;
895 q_m.data()[eN_k] = m;
896 for (
int I=0; I < nSpace; I++)
897 q_grad_u.data()[eN_k_nSpace+I] = grad_u[I];
902 for(
int i=0;i<nDOF_test_element;i++)
904 register int eN_i=eN*nDOF_test_element+i;
906 globalResidual.data()[offset_u+stride_u*u_l2g.data()[eN_i]] += elementResidual_u[i];
915 for (
int ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
917 register int ebN = exteriorElementBoundariesArray.data()[ebNE],
918 eN = elementBoundaryElementsArray.data()[ebN*2+0],
919 ebN_local = elementBoundaryLocalElementBoundariesArray.data()[ebN*2+0],
920 eN_nDOF_trial_element = eN*nDOF_trial_element;
921 register double elementResidual_u[nDOF_test_element];
922 for (
int i=0;i<nDOF_test_element;i++)
924 elementResidual_u[i]=0.0;
926 for (
int kb=0;kb<nQuadraturePoints_elementBoundary;kb++)
928 register int ebNE_kb = ebNE*nQuadraturePoints_elementBoundary+kb,
929 ebNE_kb_nSpace = ebNE_kb*nSpace,
930 ebN_local_kb = ebN_local*nQuadraturePoints_elementBoundary+kb,
931 ebN_local_kb_nSpace = ebN_local_kb*nSpace;
932 register double u_ext=0.0,u_old_ext=0.0,
933 grad_u_ext[nSpace],grad_vx_ext[nSpace],grad_vy_ext[nSpace],
934 grad_u_old_ext[nSpace],grad_kappa_ext_dummy[nSpace],
939 a_ext=0.0,da_ext=0.0,
940 r_ext=0.0,dr_ext=0.0,
942 diffusive_flux_ext=0.0,
944 bc_grad_u_ext[nSpace],
949 jac_ext[nSpace*nSpace],
951 jacInv_ext[nSpace*nSpace],
952 boundaryJac[nSpace*(nSpace-1)],
953 metricTensor[(nSpace-1)*(nSpace-1)],
956 u_test_dS[nDOF_test_element],
957 u_grad_trial_trace[nDOF_trial_element*nSpace],
958 normal[3],x_ext,y_ext,z_ext,xt_ext,yt_ext,zt_ext,integralScaling,
959 G[nSpace*nSpace],G_dd_G,tr_G;
964 ck.calculateMapping_elementBoundary(eN,
970 mesh_trial_trace_ref.data(),
971 mesh_grad_trial_trace_ref.data(),
972 boundaryJac_ref.data(),
982 ck.calculateMappingVelocity_elementBoundary(eN,
986 mesh_velocity_dof.data(),
988 mesh_trial_trace_ref.data(),
989 xt_ext,yt_ext,zt_ext,
994 dS = ((1.0-MOVING_DOMAIN)*metricTensorDetSqrt + MOVING_DOMAIN*integralScaling)*dS_ref.data()[kb];
997 ck.calculateG(jacInv_ext,G,G_dd_G,tr_G);
1000 ck.gradTrialFromRef(&u_grad_trial_trace_ref.data()[ebN_local_kb_nSpace*nDOF_trial_element],jacInv_ext,u_grad_trial_trace);
1002 ck.valFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_trace_ref.data()[ebN_local_kb*nDOF_test_element],u_ext);
1003 ck.valFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_trace_ref.data()[ebN_local_kb*nDOF_test_element],u_old_ext);
1004 ck.gradFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_u_ext);
1005 ck.gradFromDOF(u_dof_old.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_u_old_ext);
1008 grad_kappa_ext_dummy[0] = 0.0; grad_kappa_ext_dummy[1] = 0.0;
1012 ck.gradFromDOF(velocity_dof_u.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_vx_ext);
1013 ck.gradFromDOF(velocity_dof_v.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_vy_ext);
1018 for (
int j=0;j<nDOF_trial_element;j++)
1020 u_test_dS[j] = u_test_trace_ref.data()[ebN_local_kb*nDOF_test_element+j]*dS;
1025 bc_u_ext = isDOFBoundary_u.data()[ebNE_kb]*ebqe_bc_u_ext.data()[ebNE_kb]+(1-isDOFBoundary_u.data()[ebNE_kb])*u_ext;
1031 ebqe_phi.data()[ebNE_kb],
1044 ebqe_kappa.data()[ebNE_kb],
1045 ebqe_porosity.data()[ebNE_kb],
1048 ebqe_q_vos.data()[ebNE_kb],
1049 &ebqe_q_vos_gradc.data()[ebNE_kb_nSpace],
1052 &ebqe_vs.data()[ebNE_kb_nSpace],
1055 dissipation_model_flag,
1056 grad_kappa_ext_dummy,
1068 ebqe_phi.data()[ebNE_kb],
1081 ebqe_kappa.data()[ebNE_kb],
1082 ebqe_porosity.data()[ebNE_kb],
1085 ebqe_q_vos.data()[ebNE_kb],
1086 &ebqe_q_vos_gradc.data()[ebNE_kb_nSpace],
1089 &ebqe_vs.data()[ebNE_kb_nSpace],
1092 dissipation_model_flag,
1093 grad_kappa_ext_dummy,
1106 double velocity_ext[nSpace];
1107 velocity_ext[0] = ebqe_velocity_ext.data()[ebNE_kb_nSpace+0] - MOVING_DOMAIN*xt_ext;
1108 velocity_ext[1] = ebqe_velocity_ext.data()[ebNE_kb_nSpace+1] - MOVING_DOMAIN*yt_ext;
1114 isAdvectiveFluxBoundary_u.data()[ebNE_kb],
1117 ebqe_bc_advectiveFlux_u_ext.data()[ebNE_kb],
1123 const double bc_diffusive_flux = ebqe_bc_diffusiveFlux_u_ext.data()[ebNE_kb];
1125 isDOFBoundary_u.data()[ebNE_kb],
1126 isDiffusiveFluxBoundary_u.data()[ebNE_kb],
1132 ebqe_penalty_ext.data()[ebNE_kb],
1133 diffusive_flux_ext);
1136 flux_ext += diffusive_flux_ext;
1137 ebqe_flux.data()[ebNE_kb] = flux_ext;
1140 ebqe_u.data()[ebNE_kb] = u_ext;
1142 ebqe_u.data()[ebNE_kb] = bc_u_ext;
1146 for (
int i=0;i<nDOF_test_element;i++)
1148 int ebNE_kb_i = ebNE_kb*nDOF_test_element+i;
1150 elementResidual_u[i] +=
ck.ExteriorElementBoundaryFlux(flux_ext,u_test_dS[i]);
1156 for (
int i=0;i<nDOF_test_element;i++)
1158 int eN_i = eN*nDOF_test_element+i;
1160 globalResidual.data()[offset_u+stride_u*u_l2g.data()[eN_i]] += elementResidual_u[i];
1167 xt::pyarray<double>& mesh_trial_ref = args.
array<
double>(
"mesh_trial_ref");
1168 xt::pyarray<double>& mesh_grad_trial_ref = args.
array<
double>(
"mesh_grad_trial_ref");
1169 xt::pyarray<double>& mesh_dof = args.
array<
double>(
"mesh_dof");
1170 xt::pyarray<double>& mesh_velocity_dof = args.
array<
double>(
"mesh_velocity_dof");
1171 double MOVING_DOMAIN = args.
scalar<
double>(
"MOVING_DOMAIN");
1172 xt::pyarray<int>& mesh_l2g = args.
array<
int>(
"mesh_l2g");
1173 xt::pyarray<double>& dV_ref = args.
array<
double>(
"dV_ref");
1174 xt::pyarray<double>& u_trial_ref = args.
array<
double>(
"u_trial_ref");
1175 xt::pyarray<double>& u_grad_trial_ref = args.
array<
double>(
"u_grad_trial_ref");
1176 xt::pyarray<double>& u_test_ref = args.
array<
double>(
"u_test_ref");
1177 xt::pyarray<double>& u_grad_test_ref = args.
array<
double>(
"u_grad_test_ref");
1178 xt::pyarray<double>& mesh_trial_trace_ref = args.
array<
double>(
"mesh_trial_trace_ref");
1179 xt::pyarray<double>& mesh_grad_trial_trace_ref = args.
array<
double>(
"mesh_grad_trial_trace_ref");
1180 xt::pyarray<double>& dS_ref = args.
array<
double>(
"dS_ref");
1181 xt::pyarray<double>& u_trial_trace_ref = args.
array<
double>(
"u_trial_trace_ref");
1182 xt::pyarray<double>& u_grad_trial_trace_ref = args.
array<
double>(
"u_grad_trial_trace_ref");
1183 xt::pyarray<double>& u_test_trace_ref = args.
array<
double>(
"u_test_trace_ref");
1184 xt::pyarray<double>& u_grad_test_trace_ref = args.
array<
double>(
"u_grad_test_trace_ref");
1185 xt::pyarray<double>& normal_ref = args.
array<
double>(
"normal_ref");
1186 xt::pyarray<double>& boundaryJac_ref = args.
array<
double>(
"boundaryJac_ref");
1187 int nElements_global = args.
scalar<
int>(
"nElements_global");
1190 double sigma_e = args.
scalar<
double>(
"sigma_e");
1191 double c_mu = args.
scalar<
double>(
"c_mu");
1192 double c_1 = args.
scalar<
double>(
"c_1");
1193 double c_2 = args.
scalar<
double>(
"c_2");
1194 double c_e = args.
scalar<
double>(
"c_e");
1197 int dissipation_model_flag = args.
scalar<
int>(
"dissipation_model_flag");
1198 double useMetrics = args.
scalar<
double>(
"useMetrics");
1199 double alphaBDF = args.
scalar<
double>(
"alphaBDF");
1200 int lag_shockCapturing = args.
scalar<
int>(
"lag_shockCapturing");
1201 double shockCapturingDiffusion = args.
scalar<
double>(
"shockCapturingDiffusion");
1202 xt::pyarray<int>& u_l2g = args.
array<
int>(
"u_l2g");
1203 xt::pyarray<double>& elementDiameter = args.
array<
double>(
"elementDiameter");
1204 xt::pyarray<double>& u_dof = args.
array<
double>(
"u_dof");
1205 xt::pyarray<double>& u_dof_old = args.
array<
double>(
"u_dof_old");
1206 xt::pyarray<double>& velocity = args.
array<
double>(
"velocity");
1207 xt::pyarray<double>& phi_ls = args.
array<
double>(
"phi_ls");
1208 xt::pyarray<double>& q_kappa = args.
array<
double>(
"q_kappa");
1209 xt::pyarray<double>& q_grad_kappa = args.
array<
double>(
"q_grad_kappa");
1210 xt::pyarray<double>& q_porosity = args.
array<
double>(
"q_porosity");
1211 double sedFlag = args.
scalar<
int>(
"sedFlag");
1212 xt::pyarray<double>& q_vos = args.
array<
double>(
"q_vos");
1213 xt::pyarray<double>& q_vos_gradc = args.
array<
double>(
"q_vos_gradc");
1214 xt::pyarray<double>& ebqe_q_vos = args.
array<
double>(
"ebqe_q_vos");
1215 xt::pyarray<double>& ebqe_q_vos_gradc = args.
array<
double>(
"ebqe_q_vos_gradc");
1216 double rho_f = args.
scalar<
double>(
"rho_f");
1217 double rho_s = args.
scalar<
double>(
"rho_s");
1218 xt::pyarray<double>& vs = args.
array<
double>(
"vs");
1219 xt::pyarray<double>& ebqe_vs = args.
array<
double>(
"ebqe_vs");
1220 xt::pyarray<double>& g = args.
array<
double>(
"g");
1221 xt::pyarray<double>& velocity_dof_u = args.
array<
double>(
"velocity_dof_u");
1222 xt::pyarray<double>& velocity_dof_v = args.
array<
double>(
"velocity_dof_v");
1223 xt::pyarray<double>& velocity_dof_w = args.
array<
double>(
"velocity_dof_w");
1224 xt::pyarray<double>& q_m_betaBDF = args.
array<
double>(
"q_m_betaBDF");
1225 xt::pyarray<double>& cfl = args.
array<
double>(
"cfl");
1226 xt::pyarray<double>& q_numDiff_u_last = args.
array<
double>(
"q_numDiff_u_last");
1227 xt::pyarray<double>& ebqe_penalty_ext = args.
array<
double>(
"ebqe_penalty_ext");
1228 xt::pyarray<int>& csrRowIndeces_u_u = args.
array<
int>(
"csrRowIndeces_u_u");
1229 xt::pyarray<int>& csrColumnOffsets_u_u = args.
array<
int>(
"csrColumnOffsets_u_u");
1230 xt::pyarray<double>& globalJacobian = args.
array<
double>(
"globalJacobian");
1231 int nExteriorElementBoundaries_global = args.
scalar<
int>(
"nExteriorElementBoundaries_global");
1232 xt::pyarray<int>& exteriorElementBoundariesArray = args.
array<
int>(
"exteriorElementBoundariesArray");
1233 xt::pyarray<int>& elementBoundaryElementsArray = args.
array<
int>(
"elementBoundaryElementsArray");
1234 xt::pyarray<int>& elementBoundaryLocalElementBoundariesArray = args.
array<
int>(
"elementBoundaryLocalElementBoundariesArray");
1235 xt::pyarray<double>& ebqe_velocity_ext = args.
array<
double>(
"ebqe_velocity_ext");
1236 xt::pyarray<int>& isDOFBoundary_u = args.
array<
int>(
"isDOFBoundary_u");
1237 xt::pyarray<double>& ebqe_bc_u_ext = args.
array<
double>(
"ebqe_bc_u_ext");
1238 xt::pyarray<int>& isAdvectiveFluxBoundary_u = args.
array<
int>(
"isAdvectiveFluxBoundary_u");
1239 xt::pyarray<double>& ebqe_bc_advectiveFlux_u_ext = args.
array<
double>(
"ebqe_bc_advectiveFlux_u_ext");
1240 xt::pyarray<int>& isDiffusiveFluxBoundary_u = args.
array<
int>(
"isDiffusiveFluxBoundary_u");
1241 xt::pyarray<double>& ebqe_bc_diffusiveFlux_u_ext = args.
array<
double>(
"ebqe_bc_diffusiveFlux_u_ext");
1242 xt::pyarray<int>& csrColumnOffsets_eb_u_u = args.
array<
int>(
"csrColumnOffsets_eb_u_u");
1243 xt::pyarray<double>& ebqe_phi = args.
array<
double>(
"ebqe_phi");
1244 double epsFact = args.
scalar<
double>(
"epsFact");
1245 xt::pyarray<double>& ebqe_kappa = args.
array<
double>(
"ebqe_kappa");
1246 xt::pyarray<double>& ebqe_porosity = args.
array<
double>(
"ebqe_porosity");
1247 double Ct_sge = 4.0;
1252 for(
int eN=0;eN<nElements_global;eN++)
1254 register double elementJacobian_u_u[nDOF_test_element][nDOF_trial_element];
1255 for (
int i=0;i<nDOF_test_element;i++)
1256 for (
int j=0;j<nDOF_trial_element;j++)
1258 elementJacobian_u_u[i][j]=0.0;
1260 for (
int k=0;k<nQuadraturePoints_element;k++)
1262 int eN_k = eN*nQuadraturePoints_element+k,
1263 eN_k_nSpace = eN_k*nSpace,
1264 eN_nDOF_trial_element = eN*nDOF_trial_element;
1267 register double u=0.0,u_old=0.0,
1268 grad_u[nSpace],grad_vx[nSpace],grad_vy[nSpace],
1270 m=0.0,dm=0.0,a=0.0,da=0.0,
r=0.0,dr=0.0,
1271 f[nSpace],
df[nSpace],df_minus_da_grad_u[nSpace],
1273 dpdeResidual_u_u[nDOF_trial_element],
1274 Lstar_u[nDOF_test_element],
1275 dsubgridError_u_u[nDOF_trial_element],
1276 tau=0.0,tau0=0.0,tau1=0.0,
1279 jacInv[nSpace*nSpace],
1280 u_grad_trial[nDOF_trial_element*nSpace],
1282 u_test_dV[nDOF_test_element],
1283 u_grad_test_dV[nDOF_test_element*nSpace],
1285 G[nSpace*nSpace],G_dd_G,tr_G;
1307 ck.calculateMapping_element(eN,
1311 mesh_trial_ref.data(),
1312 mesh_grad_trial_ref.data(),
1317 ck.calculateMappingVelocity_element(eN,
1319 mesh_velocity_dof.data(),
1321 mesh_trial_ref.data(),
1324 dV = fabs(jacDet)*dV_ref.data()[k];
1325 ck.calculateG(jacInv,G,G_dd_G,tr_G);
1327 ck.gradTrialFromRef(&u_grad_trial_ref.data()[k*nDOF_trial_element*nSpace],jacInv,u_grad_trial);
1329 ck.valFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_ref.data()[k*nDOF_trial_element],
u);
1330 ck.valFromDOF(u_dof_old.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_ref.data()[k*nDOF_trial_element],u_old);
1332 ck.gradFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_u);
1333 ck.gradFromDOF(u_dof_old.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_u_old);
1336 ck.gradFromDOF(velocity_dof_u.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_vx);
1337 ck.gradFromDOF(velocity_dof_v.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial,grad_vy);
1342 for (
int j=0;j<nDOF_trial_element;j++)
1344 u_test_dV[j] = u_test_ref.data()[k*nDOF_trial_element+j]*dV;
1345 for (
int I=0;I<nSpace;I++)
1347 u_grad_test_dV[j*nSpace+I] = u_grad_trial[j*nSpace+I]*dV;
1355 phi_ls.data()[eN_k],
1368 q_kappa.data()[eN_k],
1369 q_porosity.data()[eN_k],
1373 &q_vos_gradc.data()[eN_k_nSpace],
1376 &vs.data()[eN_k_nSpace],
1379 dissipation_model_flag,
1380 &q_grad_kappa.data()[eN_k_nSpace],
1393 f[0] -= MOVING_DOMAIN*m*
xt;
1394 f[1] -= MOVING_DOMAIN*m*yt;
1396 df[0] -= MOVING_DOMAIN*dm*
xt;
1397 df[1] -= MOVING_DOMAIN*dm*yt;
1403 df_minus_da_grad_u[0] =
df[0] - da*grad_u[0];
1404 df_minus_da_grad_u[1] =
df[1] - da*grad_u[1];
1411 q_m_betaBDF.data()[eN_k],
1420 for (
int i=0;i<nDOF_test_element;i++)
1424 register int i_nSpace = i*nSpace;
1425 Lstar_u[i]=
ck.Advection_adjoint(df_minus_da_grad_u,&u_grad_test_dV[i_nSpace])
1426 +
ck.Reaction_adjoint(dr,u_test_dV[i]);
1429 for (
int j=0;j<nDOF_trial_element;j++)
1433 int j_nSpace = j*nSpace;
1434 dpdeResidual_u_u[j]=
ck.MassJacobian_strong(dm_t,u_trial_ref.data()[k*nDOF_trial_element+j]) +
1435 ck.AdvectionJacobian_strong(df_minus_da_grad_u,&u_grad_trial[j_nSpace]) +
1436 ck.ReactionJacobian_strong(dr,u_trial_ref.data()[k*nDOF_trial_element+j]);
1451 tau = useMetrics*tau1+(1.0-useMetrics)*tau0;
1453 for(
int j=0;j<nDOF_trial_element;j++)
1454 dsubgridError_u_u[j] = -tau*dpdeResidual_u_u[j];
1455 for(
int i=0;i<nDOF_test_element;i++)
1459 for(
int j=0;j<nDOF_trial_element;j++)
1463 int j_nSpace = j*nSpace;
1464 int i_nSpace = i*nSpace;
1465 elementJacobian_u_u[i][j] +=
ck.MassJacobian_weak(dm_t,u_trial_ref.data()[k*nDOF_trial_element+j],u_test_dV[i]) +
1466 ck.AdvectionJacobian_weak(df_minus_da_grad_u,u_trial_ref.data()[k*nDOF_trial_element+j],&u_grad_test_dV[i_nSpace]) +
1467 ck.SubgridErrorJacobian(dsubgridError_u_u[j],Lstar_u[i]) +
1468 ck.NumericalDiffusionJacobian(a,&u_grad_trial[j_nSpace],&u_grad_test_dV[i_nSpace]) +
1469 ck.NumericalDiffusionJacobian(q_numDiff_u_last.data()[eN_k],&u_grad_trial[j_nSpace],&u_grad_test_dV[i_nSpace]) +
1470 ck.ReactionJacobian_weak(dr,u_trial_ref.data()[k*nDOF_trial_element+j],u_test_dV[i]);
1477 for (
int i=0;i<nDOF_test_element;i++)
1479 int eN_i = eN*nDOF_test_element+i;
1480 for (
int j=0;j<nDOF_trial_element;j++)
1482 int eN_i_j = eN_i*nDOF_trial_element+j;
1483 globalJacobian[csrRowIndeces_u_u[eN_i] + csrColumnOffsets_u_u[eN_i_j]] += elementJacobian_u_u[i][j];
1490 for (
int ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
1492 register int ebN = exteriorElementBoundariesArray.data()[ebNE];
1493 register int eN = elementBoundaryElementsArray.data()[ebN*2+0],
1494 ebN_local = elementBoundaryLocalElementBoundariesArray.data()[ebN*2+0],
1495 eN_nDOF_trial_element = eN*nDOF_trial_element;
1496 for (
int kb=0;kb<nQuadraturePoints_elementBoundary;kb++)
1498 register int ebNE_kb = ebNE*nQuadraturePoints_elementBoundary+kb,
1499 ebNE_kb_nSpace = ebNE_kb*nSpace,
1500 ebN_local_kb = ebN_local*nQuadraturePoints_elementBoundary+kb,
1501 ebN_local_kb_nSpace = ebN_local_kb*nSpace;
1503 register double u_ext=0.0,u_old_ext=0.0,
1505 grad_vx_ext[nSpace],grad_vy_ext[nSpace],
1506 grad_u_old_ext[nSpace],grad_kappa_ext_dummy[nSpace],
1512 a_ext=0.0,da_ext=0.0,r_ext=0.0,dr_ext=0.0,
1519 fluxJacobian_u_u[nDOF_trial_element],
1520 diffusiveFluxJacobian_u_u[nDOF_trial_element],
1521 jac_ext[nSpace*nSpace],
1523 jacInv_ext[nSpace*nSpace],
1524 boundaryJac[nSpace*(nSpace-1)],
1525 metricTensor[(nSpace-1)*(nSpace-1)],
1526 metricTensorDetSqrt,
1528 u_test_dS[nDOF_test_element],
1529 u_grad_trial_trace[nDOF_trial_element*nSpace],
1530 normal[3],x_ext,y_ext,z_ext,xt_ext,yt_ext,zt_ext,integralScaling,
1531 G[nSpace*nSpace],G_dd_G,tr_G;
1553 ck.calculateMapping_elementBoundary(eN,
1559 mesh_trial_trace_ref.data(),
1560 mesh_grad_trial_trace_ref.data(),
1561 boundaryJac_ref.data(),
1567 metricTensorDetSqrt,
1571 ck.calculateMappingVelocity_elementBoundary(eN,
1575 mesh_velocity_dof.data(),
1577 mesh_trial_trace_ref.data(),
1578 xt_ext,yt_ext,zt_ext,
1583 dS = ((1.0-MOVING_DOMAIN)*metricTensorDetSqrt + MOVING_DOMAIN*integralScaling)*dS_ref.data()[kb];
1585 ck.calculateG(jacInv_ext,G,G_dd_G,tr_G);
1588 ck.gradTrialFromRef(&u_grad_trial_trace_ref.data()[ebN_local_kb_nSpace*nDOF_trial_element],jacInv_ext,u_grad_trial_trace);
1590 ck.valFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_trace_ref.data()[ebN_local_kb*nDOF_test_element],u_ext);
1591 ck.valFromDOF(u_dof_old.data(),&u_l2g.data()[eN_nDOF_trial_element],&u_trial_trace_ref.data()[ebN_local_kb*nDOF_test_element],u_old_ext);
1592 ck.gradFromDOF(u_dof.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_u_ext);
1593 ck.gradFromDOF(u_dof_old.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_u_old_ext);
1596 grad_kappa_ext_dummy[0] = 0.0; grad_kappa_ext_dummy[1] = 0.0;
1600 ck.gradFromDOF(velocity_dof_u.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_vx_ext);
1601 ck.gradFromDOF(velocity_dof_v.data(),&u_l2g.data()[eN_nDOF_trial_element],u_grad_trial_trace,grad_vy_ext);
1606 for (
int j=0;j<nDOF_trial_element;j++)
1608 u_test_dS[j] = u_test_trace_ref.data()[ebN_local_kb*nDOF_test_element+j]*dS;
1613 bc_u_ext = isDOFBoundary_u.data()[ebNE_kb]*ebqe_bc_u_ext.data()[ebNE_kb]+(1-isDOFBoundary_u.data()[ebNE_kb])*u_ext;
1619 ebqe_phi.data()[ebNE_kb],
1632 ebqe_kappa.data()[ebNE_kb],
1633 ebqe_porosity.data()[ebNE_kb],
1636 ebqe_q_vos.data()[ebNE_kb],
1637 &ebqe_q_vos_gradc.data()[ebNE_kb_nSpace],
1640 &ebqe_vs.data()[ebNE_kb_nSpace],
1643 dissipation_model_flag,
1644 grad_kappa_ext_dummy,
1656 ebqe_phi.data()[ebNE_kb],
1669 ebqe_kappa.data()[ebNE_kb],
1670 ebqe_porosity.data()[ebNE_kb],
1673 ebqe_q_vos.data()[ebNE_kb],
1674 &ebqe_q_vos_gradc.data()[ebNE_kb_nSpace],
1677 &ebqe_vs.data()[ebNE_kb_nSpace],
1680 dissipation_model_flag,
1681 grad_kappa_ext_dummy,
1694 double velocity_ext[nSpace];
1695 velocity_ext[0] = ebqe_velocity_ext.data()[ebNE_kb_nSpace+0] - MOVING_DOMAIN*xt_ext;
1696 velocity_ext[1] = ebqe_velocity_ext.data()[ebNE_kb_nSpace+1] - MOVING_DOMAIN*yt_ext;
1702 isAdvectiveFluxBoundary_u.data()[ebNE_kb],
1709 for (
int j=0;j<nDOF_trial_element;j++)
1712 register int ebN_local_kb_j=ebN_local_kb*nDOF_trial_element+j;
1715 isDiffusiveFluxBoundary_u.data()[ebNE_kb],
1720 &u_grad_trial_trace[j*nSpace],
1721 u_trial_trace_ref.data()[ebN_local_kb_j],
1722 ebqe_penalty_ext.data()[ebNE_kb],
1723 diffusiveFluxJacobian_u_u[j]);
1726 fluxJacobian_u_u[j]=
ck.ExteriorNumericalAdvectiveFluxJacobian(dflux_u_u_ext,u_trial_trace_ref.data()[ebN_local_kb_j]);
1731 for (
int i=0;i<nDOF_test_element;i++)
1733 register int eN_i = eN*nDOF_test_element+i;
1735 for (
int j=0;j<nDOF_trial_element;j++)
1739 globalJacobian[csrRowIndeces_u_u[eN_i] + csrColumnOffsets_eb_u_u[ebN_i_j]] += fluxJacobian_u_u[j]*u_test_dS[i]
1740 + diffusiveFluxJacobian_u_u[j]*u_test_dS[i];
1749 int nQuadraturePoints_elementIn,
1750 int nDOF_mesh_trial_elementIn,
1751 int nDOF_trial_elementIn,
1752 int nDOF_test_elementIn,
1753 int nQuadraturePoints_elementBoundaryIn,
1758 double packFraction,
1771 double mu_fr_limiter)
1775 proteus::chooseAndAllocateDiscretization2D<Dissipation2D_base,Dissipation2D,CompKernel>
1777 nQuadraturePoints_elementIn,
1778 nDOF_mesh_trial_elementIn,
1779 nDOF_trial_elementIn,
1780 nDOF_test_elementIn,
1781 nQuadraturePoints_elementBoundaryIn,