ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_SolveTridiag.H File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SolveTridiag (int i, int j, int klo, int khi, const amrex::Array4< amrex::Real > &soln_a, const amrex::Array4< const amrex::Real > &coeffA_a, const amrex::Array4< amrex::Real > &coeffB_a, const amrex::Array4< amrex::Real > &inv_coeffB_a, const amrex::Array4< const amrex::Real > &coeffC_a, const amrex::Array4< const amrex::Real > &RHS_a)
 

Function Documentation

◆ SolveTridiag()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SolveTridiag ( int  i,
int  j,
int  klo,
int  khi,
const amrex::Array4< amrex::Real > &  soln_a,
const amrex::Array4< const amrex::Real > &  coeffA_a,
const amrex::Array4< amrex::Real > &  coeffB_a,
const amrex::Array4< amrex::Real > &  inv_coeffB_a,
const amrex::Array4< const amrex::Real > &  coeffC_a,
const amrex::Array4< const amrex::Real > &  RHS_a 
)
13 {
14  // Forward sweep
15 
16  amrex::Real bet = coeffB_a(i,j,klo);
17 
18  for (int k(klo+1); k<=khi; ++k) {
19  amrex::Real gam = coeffC_a(i,j,k-1) / bet;
20  bet = coeffB_a(i,j,k) - coeffA_a(i,j,k)*gam;
21  AMREX_ASSERT(bet != 0.0);
22  coeffB_a(i,j,k) = bet;
23  }
24 
25  for (int k(klo); k<=khi; ++k) {
26  inv_coeffB_a(i,j,k) = 1.0 / coeffB_a(i,j,k);
27  }
28 
29  //
30  // Tridiagonal solve
31  //
32  soln_a(i,j,klo) = RHS_a(i,j,klo) * inv_coeffB_a(i,j,klo);
33 
34  for (int k(klo+1); k<=khi; ++k) {
35  soln_a(i,j,k) = (RHS_a(i,j,k)-coeffA_a(i,j,k)*soln_a(i,j,k-1)) * inv_coeffB_a(i,j,k);
36  }
37 
38  for (int k(khi-1); k>=klo; --k) {
39  soln_a(i,j,k) -= ( coeffC_a(i,j,k) * inv_coeffB_a(i,j,k) ) * soln_a(i,j,k+1);
40  }
41 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19

Referenced by ImplicitDiffForMom_N(), ImplicitDiffForMom_S(), ImplicitDiffForMom_T(), ImplicitDiffForState_N(), ImplicitDiffForState_S(), and ImplicitDiffForState_T().

Here is the caller graph for this function: