SarahBL Namespace Reference

Sarah's boundary layer solution for flow in oscillating ring. More...

Functions

double Diss_sarah (double rho, double zeta, double t)
 
double Kin_energy_sarah (double t)
 
double P_sarah (double rho, double zeta, double t)
 
double Total_Diss_lead_sarah (double t)
 
double Total_Diss_sarah (double t)
 
double U_sarah (double rho, double zeta, double t)
 
double V_sarah (double rho, double zeta, double t)
 
double X_sarah (double rho, double zeta, double t)
 
double Y_sarah (double rho, double zeta, double t)
 
void buckled_ring_residual (const Vector< double > &params, const Vector< double > &unknowns, Vector< double > &residuals)
 Residual function for buckled ring. More...
 
void exact_soln (const double &time, const Vector< double > &x, Vector< double > &soln)
 Exact solution: x,y,u,v,p. More...
 
void full_exact_soln (const double &time, const Vector< double > &x, Vector< double > &soln)
 Full exact solution: x,y,u,v,p,du/dt,dv/dt,diss. More...
 

Variables

double epsilon
 
double alpha
 
double A
 
double Omega
 
double N
 

Detailed Description

Sarah's boundary layer solution for flow in oscillating ring.

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

Function Documentation

◆ buckled_ring_residual()

void SarahBL::buckled_ring_residual ( const Vector< double > &  params,
const Vector< double > &  unknowns,
Vector< double > &  residuals 
)

Residual function for buckled ring.

448  {
449 
450  // Parameters
451  double t=params[0];
452  double xx=params[1];
453  double yy=params[2];
454 
455  // Unknowns
456  double rho=unknowns[0];
457  double zeta=unknowns[1];
458 
459  // Residuals
460  residuals[0]=X_sarah(rho,zeta,t)-xx;
461  residuals[1]=Y_sarah(rho,zeta,t)-yy;
462 
463  }
EIGEN_STRONG_INLINE const Eigen::CwiseBinaryOp< Eigen::internal::scalar_zeta_op< typename DerivedX::Scalar >, const DerivedX, const DerivedQ > zeta(const Eigen::ArrayBase< DerivedX > &x, const Eigen::ArrayBase< DerivedQ > &q)
Definition: SpecialFunctionsArrayAPI.h:152
dictionary params
Definition: Particles2023AnalysisHung.py:35
double Y_sarah(double rho, double zeta, double t)
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:422
double X_sarah(double rho, double zeta, double t)
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:401
t
Definition: plotPSD.py:36

References Particles2023AnalysisHung::params, plotPSD::t, X_sarah(), Y_sarah(), and Eigen::zeta().

Referenced by exact_soln(), and full_exact_soln().

◆ Diss_sarah()

double SarahBL::Diss_sarah ( double  rho,
double  zeta,
double  t 
)
81 {
82  double t1;
83  double t10;
84  double t11;
85  double t13;
86  double t14;
87  double t19;
88  double t2;
89  double t20;
90  double t21;
91  double t22;
92  double t25;
93  double t26;
94  double t39;
95  double t43;
96  double t5;
97  double t6;
98  double t8;
99  {
100  t1 = alpha*alpha;
101  t2 = epsilon*epsilon;
102  t5 = sin(N*zeta);
103  t6 = t5*t5;
104  t8 = Omega*Omega;
105  t10 = 1.0+A;
106  t11 = t10*t10;
107  t13 = sqrt(2.0);
108  t14 = sqrt(Omega);
109  t19 = t13*t14*alpha*(1.0-rho)/2.0;
110  t20 = exp(-t19);
111  t21 = t20*t20;
112  t22 = Omega*t;
113  t25 = cos(-t19+t22+0.3141592653589793E1/4.0);
114  t26 = t25*t25;
115  t39 = cos(-t19+t22);
116  t43 = cos(t22);
117  return(t1*t2*t6*t8*Omega*t11*t21*t26+4.0*alpha*t2*t6*t14*Omega*t10*t20*t25*
118 (N-1.0)*(Omega*t10*t20*t39/2.0-Omega*t43));
119  }
120 }
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
@ N
Definition: constructor.cpp:22
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 exp(const bfloat16 &a)
Definition: BFloat16.h:615
double A
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:74
double alpha
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:74
double Omega
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:74
double epsilon
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:74

References A, alpha, cos(), epsilon, Eigen::bfloat16_impl::exp(), N, Omega, sin(), sqrt(), plotPSD::t, and Eigen::zeta().

Referenced by full_exact_soln().

◆ exact_soln()

void SarahBL::exact_soln ( const double time,
const Vector< double > &  x,
Vector< double > &  soln 
)

Exact solution: x,y,u,v,p.

473  {
474 
475 
476  // Primary variables only
477  soln.resize(3);
478 
479  // Get rho and zeta with black-box Newton method:
480 
481  // Parameters: time, x, y
483  params[0]=time;
484  params[1]=x[0];
485  params[2]=x[1];
486 
487 
488  // Unknowns rho, zeta
489  Vector<double> unknowns(2);
490 
491  // Initial guess:
492  double rho=sqrt(x[0]*x[0]+x[1]*x[1]);
493  double zeta=0.5*MathematicalConstants::Pi;
494  if (abs(x[0])>1e-4) zeta=atan(x[1]/x[0]);
495 
496  // Copy across
497  unknowns[0]=rho;
498  unknowns[1]=zeta;
499 
500  // Call Newton solver
502  buckled_ring_residual,params,unknowns);
503 
504  // Extract rho, zeta
505 
506  // Copy across
507  rho=unknowns[0];
508  zeta=unknowns[1];
509 
510 
511  // Double check the position
512  double dx=X_sarah(rho,zeta,time)-x[0];
513  double dy=Y_sarah(rho,zeta,time)-x[1];
514  double error=sqrt(dx*dx+dy*dy);
515  if (error>1.0e-6)
516  {
517  std::ostringstream warning_stream;
518  warning_stream << "Trafo error " << error << std::endl;
519 
520  OomphLibWarning(warning_stream.str(),
521  "Sarah_BL::exact_soln()",
523  }
524 
525  // Velocities
526  soln[0]=U_sarah(rho,zeta,time);
527  soln[1]=V_sarah(rho,zeta,time);
528 
529  // Pressure on viscous scale
530  soln[2]=P_sarah(rho,zeta,time)*(alpha*alpha);
531 
532  }
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Definition: oomph_definitions.h:267
double Pi
Definition: two_d_biharmonic.cc:235
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 atan(const bfloat16 &a)
Definition: BFloat16.h:636
void buckled_ring_residual(const Vector< double > &params, const Vector< double > &unknowns, Vector< double > &residuals)
Residual function for buckled ring.
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:445
double P_sarah(double rho, double zeta, double t)
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:179
double V_sarah(double rho, double zeta, double t)
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:332
double U_sarah(double rho, double zeta, double t)
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:263
int error
Definition: calibrate.py:297
void black_box_fd_newton_solve(ResidualFctPt residual_fct, const Vector< double > &params, Vector< double > &unknowns, JacobianFctPt jacobian_fct)
Definition: black_box_newton_solver.cc:67
list x
Definition: plotDoE.py:28
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61

References abs(), alpha, Eigen::bfloat16_impl::atan(), oomph::BlackBoxFDNewtonSolver::black_box_fd_newton_solve(), buckled_ring_residual(), e(), calibrate::error, OOMPH_EXCEPTION_LOCATION, P_sarah(), Particles2023AnalysisHung::params, BiharmonicTestFunctions2::Pi, sqrt(), U_sarah(), V_sarah(), plotDoE::x, X_sarah(), Y_sarah(), and Eigen::zeta().

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

◆ full_exact_soln()

void SarahBL::full_exact_soln ( const double time,
const Vector< double > &  x,
Vector< double > &  soln 
)

Full exact solution: x,y,u,v,p,du/dt,dv/dt,diss.

542  {
543 
544 
545  // Full solution
546  soln.resize(6);
547 
548  // Get rho and zeta with black-box Newton method:
549 
550  // Parameters: time, x, y
552  params[0]=time;
553  params[1]=x[0];
554  params[2]=x[1];
555 
556 
557  // Unknowns rho, zeta
558  Vector<double> unknowns(2);
559 
560  // Initial guess:
561  double rho=sqrt(x[0]*x[0]+x[1]*x[1]);
562  double zeta=0.5*MathematicalConstants::Pi;
563  if (abs(x[0])>1e-4) zeta=atan(x[1]/x[0]);
564 
565  // Copy across
566  unknowns[0]=rho;
567  unknowns[1]=zeta;
568 
569  // Call Newton solver
571  buckled_ring_residual,params,unknowns);
572 
573  // Extract rho, zeta
574 
575  // Copy across
576  rho=unknowns[0];
577  zeta=unknowns[1];
578 
579 
580  // Double check the position
581  double dx=X_sarah(rho,zeta,time)-x[0];
582  double dy=Y_sarah(rho,zeta,time)-x[1];
583  double error=sqrt(dx*dx+dy*dy);
584  if (error>1.0e-6)
585  {
586  std::ostringstream warning_stream;
587  warning_stream << "Trafo error " << error << std::endl;
588 
589  OomphLibWarning(warning_stream.str(),
590  "Sarah_BL::full_exact_soln()",
592  }
593 
594  // Velocities
595  soln[0]=U_sarah(rho,zeta,time);
596  soln[1]=V_sarah(rho,zeta,time);
597 
598  // Pressure on viscous scale
599  soln[2]=P_sarah(rho,zeta,time)*(alpha*alpha);
600 
601  // du/dt dv/dt not coded up yet...
602  soln[3]=0.0; //DUDT(xx,y,time);
603  soln[4]=0.0; //DVDT(xx,y,time);
604 
605  if (rho<1.0e-6)
606  {
607  rho=1e-6;
608  }
609  soln[5]=Diss_sarah(rho,zeta,time);
610 
611 
612  }
double Diss_sarah(double rho, double zeta, double t)
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:80

References abs(), alpha, Eigen::bfloat16_impl::atan(), oomph::BlackBoxFDNewtonSolver::black_box_fd_newton_solve(), buckled_ring_residual(), Diss_sarah(), e(), calibrate::error, OOMPH_EXCEPTION_LOCATION, P_sarah(), Particles2023AnalysisHung::params, BiharmonicTestFunctions2::Pi, sqrt(), U_sarah(), V_sarah(), plotDoE::x, X_sarah(), Y_sarah(), and Eigen::zeta().

Referenced by OscRingNStProblem< ELEMENT >::doc_solution(), OscRingNStProblem< ELEMENT >::doc_solution_historic(), and main().

◆ Kin_energy_sarah()

double SarahBL::Kin_energy_sarah ( double  t)
124 {
125  double t1;
126  double t11;
127  double t13;
128  double t16;
129  double t18;
130  double t2;
131  double t20;
132  double t27;
133  double t28;
134  double t31;
135  double t33;
136  double t5;
137  double t6;
138  double t7;
139  {
140  t1 = epsilon*epsilon;
141  t2 = Omega*Omega;
142  t5 = Omega*t;
143  t6 = cos(t5);
144  t7 = t6*t6;
145  t11 = 1/alpha;
146  t13 = sqrt(Omega);
147  t16 = 1.0+A;
148  t18 = 0.3141592653589793E1/4.0;
149  t20 = sin(t5+t18);
150  t27 = t16*t16;
151  t28 = 1/t13;
152  t31 = sin(2.0*t5+t18);
153  t33 = sqrt(2.0);
154  return(t1*(0.3141592653589793E1*t2/N*t7/2.0+t11*0.3141592653589793E1*t13*
155 Omega*t16*t6*t20)+0.3141592653589793E1*t1*t2*t11*(t27*(t28*t31/4.0+t33*t28/4.0
156 )-2.0*t28*t16*t6*t20)/2.0);
157  }
158 }

References A, alpha, cos(), epsilon, N, Omega, sin(), sqrt(), and plotPSD::t.

Referenced by OscRingNStProblem< ELEMENT >::doc_solution(), and OscRingNStProblem< ELEMENT >::doc_solution_historic().

◆ P_sarah()

double SarahBL::P_sarah ( double  rho,
double  zeta,
double  t 
)
180 {
181  double t1;
182  double t12;
183  double t19;
184  double t4;
185  double t6;
186  double t8;
187  double t9;
188  {
189  t1 = Omega*Omega;
190  t4 = pow(rho,1.0*N);
191  t6 = cos(N*zeta);
192  t8 = Omega*t;
193  t9 = sin(t8);
194  t12 = sqrt(Omega);
195  t19 = cos(t8+0.3141592653589793E1/4.0);
196  return(epsilon*(t1/N*t4*t6*t9-t12*Omega*(1.0+A)*t4*t6*t19/alpha));
197  }
198 }
EIGEN_DEVICE_FUNC const GlobalUnaryPowReturnType< Derived, ScalarExponent > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
Definition: GlobalFunctions.h:137
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186

References alpha, cos(), epsilon, N, Omega, Eigen::bfloat16_impl::pow(), sin(), sqrt(), plotPSD::t, and Eigen::zeta().

Referenced by exact_soln(), and full_exact_soln().

◆ Total_Diss_lead_sarah()

double SarahBL::Total_Diss_lead_sarah ( double  t)
203 {
204  double t1;
205  double t10;
206  double t11;
207  double t12;
208  double t13;
209  double t16;
210  double t4;
211  double t5;
212  double t6;
213  {
214  t1 = epsilon*epsilon;
215  t4 = sqrt(2.0);
216  t5 = Omega*Omega;
217  t6 = sqrt(Omega);
218  t10 = pow(1.0+A,2.0);
219  t11 = Omega*t;
220  t12 = sin(t11);
221  t13 = cos(t11);
222  t16 = t13*t13;
223  return(-alpha*t1*0.3141592653589793E1*t4*t6*t5*t10*(-1.0+2.0*t12*t13-2.0*
224 t16)/8.0);
225  }
226 }

References alpha, cos(), epsilon, Omega, Eigen::bfloat16_impl::pow(), sin(), sqrt(), and plotPSD::t.

◆ Total_Diss_sarah()

double SarahBL::Total_Diss_sarah ( double  t)
231 {
232  double t1;
233  double t14;
234  double t15;
235  double t18;
236  double t19;
237  double t2;
238  double t20;
239  double t4;
240  double t6;
241  double t7;
242  double t8;
243  {
244  t1 = Omega*Omega;
245  t2 = 0.3141592653589793E1*t1;
246  t4 = epsilon*epsilon;
247  t6 = Omega*t;
248  t7 = cos(t6);
249  t8 = t7*t7;
250  t14 = sqrt(2.0);
251  t15 = sqrt(Omega);
252  t18 = 1.0+A;
253  t19 = t18*t18;
254  t20 = sin(t6);
255  return(4.0*t2*(N-1.0)*t4*t8-alpha*t4*0.3141592653589793E1*t14*t15*t1*t19*(
256 -1.0+2.0*t20*t7-2.0*t8)/8.0+t4*t18*t2*(-10.0*A*t8-A+8.0*A*N*t8+22.0*t8-1.0-24.0
257 *N*t8)/8.0);
258  }
259 }

References A, alpha, cos(), epsilon, N, Omega, sin(), sqrt(), and plotPSD::t.

Referenced by OscRingNStProblem< ELEMENT >::doc_solution(), and OscRingNStProblem< ELEMENT >::doc_solution_historic().

◆ U_sarah()

double SarahBL::U_sarah ( double  rho,
double  zeta,
double  t 
)
264 {
265  double t1;
266  double t12;
267  double t14;
268  double t19;
269  double t21;
270  double t22;
271  double t23;
272  double t25;
273  double t3;
274  double t35;
275  double t4;
276  double t41;
277  double t43;
278  double t46;
279  double t47;
280  double t49;
281  double t5;
282  double t52;
283  double t55;
284  double t57;
285  double t59;
286  double t6;
287  double t62;
288  double t64;
289  double t8;
290  double t87;
291  double t89;
292  double t9;
293  {
294  t1 = cos(zeta);
295  t3 = N-1.0;
296  t4 = pow(rho,1.0*t3);
297  t5 = N*zeta;
298  t6 = cos(t5);
299  t8 = Omega*t;
300  t9 = cos(t8);
301  t12 = sin(zeta);
302  t14 = sin(t5);
303  t19 = sqrt(Omega);
304  t21 = 1.0+A;
305  t22 = t21*t4;
306  t23 = 0.3141592653589793E1/4.0;
307  t25 = sin(t8+t23);
308  t35 = 1/alpha;
309  t41 = sqrt(2.0);
310  t43 = 1.0-rho;
311  t46 = t41*t19*alpha*t43/2.0;
312  t47 = exp(-t46);
313  t49 = cos(-t46+t8);
314  t52 = Omega*t9;
315  t55 = N*t19;
316  t57 = sin(-t46+t8+t23);
317  t59 = t47*t57-t25;
318  t62 = Omega*alpha;
319  t64 = -t43*t3;
320  t87 = t9*(1.0+t64);
321  t89 = N*t35;
322  return(epsilon*(t1*Omega*t4*t6*t9+t12*Omega*t4*t14*t9+(t1*N*t19*t22*t6*t25+
323 t12*N*t19*t22*t14*t25)*t35)-epsilon*t12*(t14*(Omega*t21*t47*t49-t52)+t14*(t55*
324 t21*t59-t62*t64*t9)*t35)+epsilon*t1*(t52*t6+t6*(-t55*t21*t59-t62*t43*t3*t9)*t35
325 )-(-t12*(-Omega*t14*t87-t89*t19*t21*t14*t25)+t1*(Omega*t6*t87+t89*t6*t19*t21*
326 t25))*epsilon);
327  }
328 }

References A, alpha, cos(), epsilon, Eigen::bfloat16_impl::exp(), N, Omega, Eigen::bfloat16_impl::pow(), sin(), sqrt(), plotPSD::t, and Eigen::zeta().

Referenced by OscRingNStProblem< ELEMENT >::doc_solution_historic(), exact_soln(), and full_exact_soln().

◆ V_sarah()

double SarahBL::V_sarah ( double  rho,
double  zeta,
double  t 
)
333 {
334  double t1;
335  double t12;
336  double t14;
337  double t19;
338  double t21;
339  double t22;
340  double t23;
341  double t25;
342  double t3;
343  double t35;
344  double t4;
345  double t41;
346  double t43;
347  double t46;
348  double t47;
349  double t49;
350  double t5;
351  double t52;
352  double t55;
353  double t57;
354  double t59;
355  double t6;
356  double t62;
357  double t64;
358  double t8;
359  double t87;
360  double t89;
361  double t9;
362  {
363  t1 = sin(zeta);
364  t3 = N-1.0;
365  t4 = pow(rho,1.0*t3);
366  t5 = N*zeta;
367  t6 = cos(t5);
368  t8 = Omega*t;
369  t9 = cos(t8);
370  t12 = cos(zeta);
371  t14 = sin(t5);
372  t19 = sqrt(Omega);
373  t21 = 1.0+A;
374  t22 = t21*t4;
375  t23 = 0.3141592653589793E1/4.0;
376  t25 = sin(t8+t23);
377  t35 = 1/alpha;
378  t41 = sqrt(2.0);
379  t43 = 1.0-rho;
380  t46 = t41*t19*alpha*t43/2.0;
381  t47 = exp(-t46);
382  t49 = cos(-t46+t8);
383  t52 = Omega*t9;
384  t55 = N*t19;
385  t57 = sin(-t46+t8+t23);
386  t59 = t47*t57-t25;
387  t62 = Omega*alpha;
388  t64 = -t43*t3;
389  t87 = t9*(1.0+t64);
390  t89 = N*t35;
391  return(epsilon*(t1*Omega*t4*t6*t9-t12*Omega*t4*t14*t9+(t1*N*t19*t22*t6*t25-
392 t12*N*t19*t22*t14*t25)*t35)+epsilon*t12*(t14*(Omega*t21*t47*t49-t52)+t14*(t55*
393 t21*t59-t62*t64*t9)*t35)+epsilon*t1*(t52*t6+t6*(-t55*t21*t59-t62*t43*t3*t9)*t35
394 )-(t12*(-Omega*t14*t87-t89*t19*t21*t14*t25)+t1*(Omega*t6*t87+t89*t6*t19*t21*t25
395 ))*epsilon);
396  }
397 }

References A, alpha, cos(), epsilon, Eigen::bfloat16_impl::exp(), N, Omega, Eigen::bfloat16_impl::pow(), sin(), sqrt(), plotPSD::t, and Eigen::zeta().

Referenced by OscRingNStProblem< ELEMENT >::doc_solution_historic(), exact_soln(), and full_exact_soln().

◆ X_sarah()

double SarahBL::X_sarah ( double  rho,
double  zeta,
double  t 
)
402 {
403  double t1;
404  double t10;
405  double t3;
406  double t5;
407  double t6;
408  double t8;
409  {
410  t1 = cos(zeta);
411  t3 = sin(Omega*t);
412  t5 = N*zeta;
413  t6 = cos(t5);
414  t8 = sin(t5);
415  t10 = sin(zeta);
416  return(rho*(t1+epsilon*t3*(t6*t1-A*t8*t10)));
417  }
418 }

References cos(), epsilon, N, Omega, sin(), plotPSD::t, and Eigen::zeta().

Referenced by buckled_ring_residual(), OscRingNStProblem< ELEMENT >::doc_solution_historic(), exact_soln(), and full_exact_soln().

◆ Y_sarah()

double SarahBL::Y_sarah ( double  rho,
double  zeta,
double  t 
)
423 {
424  double t1;
425  double t10;
426  double t3;
427  double t5;
428  double t6;
429  double t8;
430  {
431  t1 = sin(zeta);
432  t3 = sin(Omega*t);
433  t5 = N*zeta;
434  t6 = cos(t5);
435  t8 = sin(t5);
436  t10 = cos(zeta);
437  return(rho*(t1+epsilon*t3*(t6*t1+A*t8*t10)));
438  }
439 }

References cos(), epsilon, N, Omega, sin(), plotPSD::t, and Eigen::zeta().

Referenced by buckled_ring_residual(), OscRingNStProblem< ELEMENT >::doc_solution_historic(), exact_soln(), and full_exact_soln().

Variable Documentation

◆ A

◆ alpha

◆ epsilon

◆ N

◆ Omega