SolnForPoisson Namespace Reference

Namespace for exact solution for Poisson equation. More...

Functions

void get_exact_u (const Vector< double > &x, Vector< double > &u)
 Exact solution as a Vector. More...
 
void source_function (const Vector< double > &x, double &source)
 Source function required to make the solution above an exact solution. More...
 
void prescribed_flux_on_fixed_x_boundary (const Vector< double > &x, double &flux)
 Flux required by the exact solution on a boundary on which x is fixed. More...
 

Variables

double Alpha =4.0
 Parameter for steepness of "step". More...
 
double TanPhi =1.0
 Parameter for angle Phi of "step". More...
 

Detailed Description

Namespace for exact solution for Poisson equation.

/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////

Function Documentation

◆ get_exact_u()

void SolnForPoisson::get_exact_u ( const Vector< double > &  x,
Vector< double > &  u 
)

Exact solution as a Vector.

181  {
182  u[0]=tanh(1.0-Alpha*(TanPhi*x[0]-x[1]));
183  }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 tanh(const bfloat16 &a)
Definition: BFloat16.h:639
double TanPhi
Parameter for angle Phi of "step".
Definition: two_d_poisson_tanh_flux_bc_validate.cc:177
double Alpha
Parameter for steepness of "step".
Definition: two_d_poisson_tanh_flux_bc_validate.cc:174
list x
Definition: plotDoE.py:28

References Alpha, Eigen::bfloat16_impl::tanh(), TanPhi, and plotDoE::x.

Referenced by FluxPoissonMGProblem< ELEMENT, MESH >::doc_solution().

◆ prescribed_flux_on_fixed_x_boundary()

void SolnForPoisson::prescribed_flux_on_fixed_x_boundary ( const Vector< double > &  x,
double flux 
)

Flux required by the exact solution on a boundary on which x is fixed.

197  {
198  // The outer unit normal to the boundary is (1,0)
199  double N[2] = {1.0,0.0};
200 
201  // The flux in terms of the normal is
202  flux = -(1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*
203  Alpha*TanPhi*N[0]+(1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*
204  Alpha*N[1];
205  }
EIGEN_DEVICE_FUNC const GlobalUnaryPowReturnType< Derived, ScalarExponent > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
Definition: GlobalFunctions.h:137
@ N
Definition: constructor.cpp:22
void flux(const double &time, const Vector< double > &x, double &flux)
Get flux applied along boundary x=0.
Definition: pretend_melt.cc:59

References Alpha, ProblemParameters::flux(), N, Eigen::bfloat16_impl::pow(), Eigen::bfloat16_impl::tanh(), TanPhi, and plotDoE::x.

Referenced by FluxPoissonMGProblem< ELEMENT, MESH >::create_flux_elements().

◆ source_function()

void SolnForPoisson::source_function ( const Vector< double > &  x,
double source 
)

Source function required to make the solution above an exact solution.

187  {
188  source = 2.0*tanh(-1.0+Alpha*(TanPhi*x[0]-x[1]))*
189  (1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*
190  Alpha*Alpha*TanPhi*TanPhi+2.0*tanh(-1.0+Alpha*(TanPhi*x[0]-x[1]))*
191  (1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*Alpha*Alpha;
192  }
void source(const Vector< double > &x, Vector< double > &f)
Source function.
Definition: unstructured_two_d_circle.cc:46

References Alpha, Eigen::bfloat16_impl::pow(), TestProblem::source(), Eigen::bfloat16_impl::tanh(), TanPhi, and plotDoE::x.

Referenced by main(), and FluxPoissonMGProblem< ELEMENT, MESH >::make_new_problem().

Variable Documentation

◆ Alpha

double SolnForPoisson::Alpha =4.0

Parameter for steepness of "step".

Referenced by get_exact_u(), prescribed_flux_on_fixed_x_boundary(), and source_function().

◆ TanPhi

double SolnForPoisson::TanPhi =1.0

Parameter for angle Phi of "step".

Referenced by get_exact_u(), prescribed_flux_on_fixed_x_boundary(), and source_function().