TanhSolnForPoisson Namespace Reference

Namespace for exact solution for Poisson equation with "sharp step". More...

Functions

void get_exact_u (const Vector< double > &x, Vector< double > &u)
 Exact solution as a Vector. More...
 
void get_exact_u (const Vector< double > &x, double &u)
 Exact solution as a scalar. More...
 
void get_source (const Vector< double > &x, double &source)
 Source function to make it an exact solution. More...
 
void source_function (const Vector< double > &x, double &source)
 Source function required to make the solution above an exact solution. More...
 
void zero (const Vector< double > &x, Vector< double > &u)
 
void get_exact_gradient (const Vector< double > &x, Vector< double > &dudx)
 Exact gradient as a Vector. 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 =1.0
 Parameter for steepness of step. More...
 
double N_x =-1.0
 Orientation of non-normalised x-component of vector in plane direction. More...
 
double N_y =-1.0
 Orientation of non-normalised y-component of vector in plane direction. More...
 
double N_z =1.0
 Orientation of non-normalised z-component of vector in plane direction. More...
 
double X_0 =0.0
 Orientation (x-coordinate of step plane) More...
 
double Y_0 =0.0
 Orientation (y-coordinate of step plane) More...
 
double Z_0 =0.0
 Orientation (z-coordinate of step plane) More...
 
double TanPhi =0.0
 Parameter for angle Phi of "step". More...
 
double Beta
 Parameter for angle of step. More...
 
double X_shift =8.0
 Shift of step along x-direction. More...
 
bool TanhSoln =false
 Flag for zero TanhSolution. More...
 

Detailed Description

Namespace for exact solution for Poisson equation with "sharp step".

Namespace for exact solution for Poisson equation.

Namespace for exact solution for Poisson equation with sharp step.

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

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

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

Function Documentation

◆ get_exact_gradient()

void TanhSolnForPoisson::get_exact_gradient ( const Vector< double > &  x,
Vector< double > &  dudx 
)

Exact gradient as a Vector.

61  {
62  //dudx[0]=tanh(1.0-Alpha*(TanPhi*x[0]-x[1]));
63  double CoshTerm = cosh(1.0-Alpha*(TanPhi*x[0]-x[1]))
64  *cosh(1.0-Alpha*(TanPhi*x[0]-x[1]));
65  dudx[0] = -Alpha*TanPhi/CoshTerm;
66  dudx[1] = Alpha/CoshTerm;
67  }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 cosh(const bfloat16 &a)
Definition: BFloat16.h:638
double TanPhi
Parameter for angle of step.
Definition: two_d_adv_diff_adapt.cc:56
double Alpha
Parameter for steepness of step.
Definition: two_d_adv_diff_adapt.cc:53
list x
Definition: plotDoE.py:28

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

◆ get_exact_u() [1/2]

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

Exact solution as a scalar.

216  {
217  double d=std::sqrt(N_x*N_x+N_y*N_y+N_z*N_z);
218  u=std::tanh(Alpha*((x[0]-X_0)*N_x+
219  (x[1]-Y_0)*N_y+
220  (x[2]-Z_0)*N_z)/d);
221  } // End of get_exact_u
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 tanh(const bfloat16 &a)
Definition: BFloat16.h:639
double N_y
Orientation of non-normalised y-component of vector in plane direction.
Definition: extrude_with_macro_element_representation.cc:191
double Z_0
Orientation (z-coordinate of step plane)
Definition: extrude_with_macro_element_representation.cc:203
double N_x
Orientation of non-normalised x-component of vector in plane direction.
Definition: extrude_with_macro_element_representation.cc:188
double Y_0
Orientation (y-coordinate of step plane)
Definition: extrude_with_macro_element_representation.cc:200
double Alpha
Parameter for steepness of step.
Definition: extrude_with_macro_element_representation.cc:185
double N_z
Orientation of non-normalised z-component of vector in plane direction.
Definition: extrude_with_macro_element_representation.cc:194
double X_0
Orientation (x-coordinate of step plane)
Definition: extrude_with_macro_element_representation.cc:197

References Alpha, N_x, N_y, N_z, sqrt(), Eigen::bfloat16_impl::tanh(), plotDoE::x, X_0, Y_0, and Z_0.

Referenced by get_source().

◆ get_exact_u() [2/2]

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

Exact solution as a Vector.

207  {
208  double d=std::sqrt(N_x*N_x+N_y*N_y+N_z*N_z);
209  u[0]=std::tanh(Alpha*((x[0]-X_0)*N_x+
210  (x[1]-Y_0)*N_y+
211  (x[2]-Z_0)*N_z)/d);
212  } // End of get_exact_u

References Alpha, N_x, N_y, N_z, sqrt(), Eigen::bfloat16_impl::tanh(), plotDoE::x, X_0, Y_0, and Z_0.

Referenced by PoissonProblem< ELEMENT >::actions_before_newton_solve(), RefineableTwoDPoissonProblem< ELEMENT >::actions_before_newton_solve(), RefineableTwoMeshFluxPoissonProblem< ELEMENT >::actions_before_newton_solve(), FluxPoissonMGProblem< ELEMENT, MESH >::actions_before_newton_solve(), UnitCubePoissonMGProblem< ELEMENT, MESH >::actions_before_newton_solve(), RefineablePoissonProblem< ELEMENT >::actions_before_newton_solve(), EighthSpherePoissonProblem< ELEMENT >::actions_before_newton_solve(), FluxPoissonProblem< ELEMENT >::actions_before_newton_solve(), TwoMeshFluxPoissonProblem< ELEMENT >::actions_before_newton_solve(), ThreeDPoissonProblem< ELEMENT >::actions_before_newton_solve(), TestPoissonProblem< ELEMENT >::actions_before_newton_solve(), TestRefineablePoissonProblem< ELEMENT >::actions_before_newton_solve(), ExtrudedMovingCylinderProblem< TWO_D_ELEMENT, THREE_D_ELEMENT >::apply_boundary_conditions(), UnstructuredPoissonProblem< ELEMENT >::apply_boundary_conditions(), PoissonProblem< ELEMENT >::apply_boundary_conditions(), ExtrudedMovingCylinderProblem< TWO_D_ELEMENT, THREE_D_ELEMENT >::doc_solution(), UnstructuredPoissonProblem< ELEMENT >::doc_solution(), PoissonProblem< ELEMENT >::doc_solution(), RefineableTwoDPoissonProblem< ELEMENT >::doc_solution(), RefineableTwoMeshFluxPoissonProblem< ELEMENT >::doc_solution(), FluxPoissonMGProblem< ELEMENT, MESH >::doc_solution(), UnitCubePoissonMGProblem< ELEMENT, MESH >::doc_solution(), RefineablePoissonProblem< ELEMENT >::doc_solution(), EighthSpherePoissonProblem< ELEMENT >::doc_solution(), FluxPoissonProblem< ELEMENT >::doc_solution(), and TwoMeshFluxPoissonProblem< ELEMENT >::doc_solution().

◆ get_source()

void TanhSolnForPoisson::get_source ( const Vector< double > &  x,
double source 
)

Source function to make it an exact solution.

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

225  {
226  // Storage for the solution
227  double u=0.0;
228 
229  // Calculate the solution
230  get_exact_u(x,u);
231 
232  // Calculate the source value
233  source=-2.0*u*(1.0-pow(u,2.0))*Alpha*Alpha;
234  } // End of get_source
EIGEN_DEVICE_FUNC const GlobalUnaryPowReturnType< Derived, ScalarExponent > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
Definition: GlobalFunctions.h:137
void get_exact_u(const Vector< double > &x, double &u)
Exact solution as a scalar.
Definition: extrude_with_macro_element_representation.cc:215
void source(const Vector< double > &x, Vector< double > &f)
Source function.
Definition: unstructured_two_d_circle.cc:46

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

Referenced by UnstructuredPoissonProblem< ELEMENT >::complete_problem_setup(), oomph::BiharmonicEquations< DIM >::fill_in_generic_residual_contribution_biharmonic(), main(), UnitCubePoissonMGProblem< ELEMENT, MESH >::make_new_problem(), parallel_test(), run(), and run_test().

◆ prescribed_flux_on_fixed_x_boundary()

void TanhSolnForPoisson::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.

122  {
123  //The outer unit normal to the boundary is (1,0)
124  double N[2] = {1.0, 0.0};
125  //The flux in terms of the normal is
126  flux =
127  -(1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*Alpha*TanPhi*N[0]+(
128  1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*Alpha*N[1];
129  }
@ 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 TanhSolnForAdvectionDiffusion::Alpha, ProblemParameters::flux(), N, Eigen::bfloat16_impl::pow(), Eigen::bfloat16_impl::tanh(), TanhSolnForAdvectionDiffusion::TanPhi, and plotDoE::x.

Referenced by FluxPoissonMGProblem< ELEMENT, MESH >::create_flux_elements(), FluxPoissonProblem< ELEMENT >::FluxPoissonProblem(), RefineableTwoMeshFluxPoissonProblem< ELEMENT >::set_prescribed_flux_pt(), and TwoMeshFluxPoissonProblem< ELEMENT >::TwoMeshFluxPoissonProblem().

◆ source_function()

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

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

61  {
62  source = 2.0*tanh(-1.0+Alpha*(TanPhi*x[0]-x[1]))*
63  (1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*
64  Alpha*Alpha*TanPhi*TanPhi+2.0*tanh(-1.0+Alpha*(TanPhi*x[0]-x[1]))*
65  (1.0-pow(tanh(-1.0+Alpha*(TanPhi*x[0]-x[1])),2.0))*Alpha*Alpha;
66  }
double TanPhi
Parameter for angle Phi of "step".
Definition: HypreSolver_test.cc:51

References TanhSolnForAdvectionDiffusion::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().

◆ zero()

void TanhSolnForPoisson::zero ( const Vector< double > &  x,
Vector< double > &  u 
)

Zero function – used to compute norm of the computed solution by computing the norm of the error when compared against this.

73  {
74  u[0]=0.0;
75  }

Referenced by UnstructuredPoissonProblem< ELEMENT >::doc_solution().

Variable Documentation

◆ Alpha

◆ Beta

double TanhSolnForPoisson::Beta

Parameter for angle of step.

Referenced by main(), and PoissonProblem< ELEMENT >::PoissonProblem().

◆ N_x

double TanhSolnForPoisson::N_x =-1.0

Orientation of non-normalised x-component of vector in plane direction.

Orientation (non-normalised x-component of unit vector in direction of step plane)

Referenced by get_exact_u().

◆ N_y

double TanhSolnForPoisson::N_y =-1.0

Orientation of non-normalised y-component of vector in plane direction.

Orientation (non-normalised y-component of unit vector in direction of step plane)

Referenced by get_exact_u().

◆ N_z

double TanhSolnForPoisson::N_z =1.0

Orientation of non-normalised z-component of vector in plane direction.

Orientation (non-normalised z-component of unit vector in direction of step plane)

Referenced by get_exact_u().

◆ TanhSoln

bool TanhSolnForPoisson::TanhSoln =false

Flag for zero TanhSolution.

Referenced by main().

◆ TanPhi

double TanhSolnForPoisson::TanPhi =0.0

Parameter for angle Phi of "step".

Parameter for angle Phi of "step" (45 degrees)

Referenced by main(), run(), and source_function().

◆ X_0

◆ X_shift

double TanhSolnForPoisson::X_shift =8.0

Shift of step along x-direction.

◆ Y_0

double TanhSolnForPoisson::Y_0 =0.0

Orientation (y-coordinate of step plane)

Referenced by get_exact_u().

◆ Z_0

double TanhSolnForPoisson::Z_0 =0.0

Orientation (z-coordinate of step plane)

Referenced by get_exact_u().