v0.14.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
RK4 Struct Reference
Collaboration diagram for RK4:
[legend]

Public Member Functions

double operator() (const double u, const double v, const double dt) const
 
double operator() (const double u, const double v, const double dt) const
 

Public Attributes

RhsV rhs_v
 
DRhsV_v Drhs_v
 

Detailed Description

Definition at line 61 of file elec_phys_2D.cpp.

Member Function Documentation

◆ operator()() [1/2]

double RK4::operator() ( const double  u,
const double  v,
const double  dt 
) const
inline

Definition at line 64 of file elec_phys_2D.cpp.

64 {
65
66
67 double dv;
68
69 double vk = v;
70
71 double err = 1;
72
73 while (err > Tol){
74 double rhsv = rhs_v(u, vk);
75 double Drhsv = Drhs_v(u, vk);
76 dv = - 1.0 / (1 - dt * Drhsv) * (vk - v - dt * rhsv);
77 vk += dv;
78 err = abs(dv);
79 }
80
81 return vk;
82
83 // double k1 = dt * rhs_v(u, v);
84 // // double k2 = dt * rhs_v(u, v + 0.5 * k1);
85 // // double k3 = dt * rhs_v(u, v + 0.5 * k2);
86 // double k4 = dt * rhs_v(u, v + k1);
87 // return v + 0.5 * (k1 + k4);
88 }
const double Tol
double dt
Definition: heat_method.cpp:26
const double v
phase velocity of light in medium (cm/ns)
RhsV rhs_v
DRhsV_v Drhs_v

◆ operator()() [2/2]

double RK4::operator() ( const double  u,
const double  v,
const double  dt 
) const
inline

Definition at line 45 of file elec_pys_new.cpp.

45 {
46 double k1 = dt * rhs_v(u, v);
47 // double k2 = dt * rhs_v(u, v + 0.5 * k1);
48 // double k3 = dt * rhs_v(u, v + 0.5 * k2);
49 double k4 = dt * rhs_v(u, v + k1);
50 return v + 0.5 * (k1 + k4);
51 }

Member Data Documentation

◆ Drhs_v

DRhsV_v RK4::Drhs_v

Definition at line 63 of file elec_phys_2D.cpp.

◆ rhs_v

RhsV RK4::rhs_v

Definition at line 62 of file elec_phys_2D.cpp.


The documentation for this struct was generated from the following files: