Skip to content

Commit

Permalink
Improve javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-punko committed Oct 14, 2024
1 parent 304eca0 commit 5278898
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 23 deletions.
34 changes: 23 additions & 11 deletions src/main/java/by/andd3dfx/math/pde/Equation.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Equation(double x1, double x2, double t2) {
}

/**
* Initial condition U0(x)
* Initial condition U(x,0) at moment t=0
*
* @param x coordinate
* @return U value in asked coordinate
Expand All @@ -60,7 +60,7 @@ protected double gU0(double x) {
}

/**
* Left border condition U_left(t) (for 1st border type)
* Left border condition U(0,t) (for 1st border type)
*
* @param t time
* @return U value in asked time moment on left border
Expand All @@ -70,7 +70,7 @@ protected double gLU(double t) {
}

/**
* Right border condition U_right(t) (for 1st border type)
* Right border condition U(d,t) (for 1st border type)
*
* @param t time
* @return U value in asked time moment on right border
Expand All @@ -80,7 +80,7 @@ protected double gRU(double t) {
}

/**
* Left border condition dU_dt_left(t) (for 2nd border type)
* Left border condition dU_dt(0,t) (for 2nd border type)
*
* @param t time
* @return dU_dt value in asked time moment on left border
Expand All @@ -90,7 +90,7 @@ protected double gLdU_dx(double t) {
}

/**
* Right border condition dU_dt_right(t) (for 2nd border type)
* Right border condition dU_dt(d,t) (for 2nd border type)
*
* @param t time
* @return dU_dt value in asked time moment on right border
Expand All @@ -115,18 +115,30 @@ protected double gRTeta(double t) {
return 0;
}

/**
* Coefficient M(x,t,U) of equation for 2nd-order time derivative
*/
protected double gM(double x, double t, double U) {
return 1;
}

/**
* Coefficient K(x,t,U) of equation for 2nd-order space derivative
*/
protected double gK(double x, double t, double U) {
return 1;
}

/**
* Coefficient V(x,t,U) of equation for 1st-order space derivative
*/
protected double gV(double x, double t, double U) {
return 0;
}

/**
* Free addendum F(x,t,U) of equation
*/
protected double gF(double x, double t, double U) {
return 0;
}
Expand All @@ -151,7 +163,7 @@ protected void prepare(double h, double tau) {
}

/**
* Save data U(x) for asked time moment
* Save data U(x,t*) for asked time moment t*
*
* @param fileName file name
* @param t time
Expand All @@ -161,7 +173,7 @@ public void sUt(String fileName, double t) {
}

/**
* Save data U(x) for asked time moments. So in result we get some set of slices for several time moments
* Save data U(x,t_i) for asked time moments [t_i]. So in result we get some set of slices for several time moments
*
* @param fileName file name
* @param t times array
Expand All @@ -184,7 +196,7 @@ public void sUt(String fileName, double t[]) {
}

/**
* Save data U(t) for asked space coordinate x
* Save data U(x*,t) for asked space coordinate x*
*
* @param fileName file name
* @param x space coordinate
Expand All @@ -194,7 +206,7 @@ public void sUx(String fileName, double x) {
}

/**
* Save data U(t) for asked space coordinates. So in result we get some set of slices for several space coordinates
* Save data U(x_i,t) for asked space coordinates [x_i]. So in result we get some set of slices for several space coordinates
*
* @param fileName file name
* @param x coordinates array
Expand Down Expand Up @@ -228,7 +240,7 @@ protected Matrix gUt(int it) {
}

/**
* Получение среза U(x) при заданном t
* Получение среза U(x,t*) при заданном t*
*/
protected Matrix gUt(double t) {
return gUt(area.t().i(t));
Expand All @@ -247,7 +259,7 @@ protected Matrix gUx(int ix) {
}

/**
* Получение среза U(t) при заданном x
* Получение среза U(x*,t) при заданном x*
*/
protected Matrix gUx(double x) {
return gUx(area.x().i(x));
Expand Down
20 changes: 15 additions & 5 deletions src/main/java/by/andd3dfx/math/pde/HyperbolicEquation.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package by.andd3dfx.math.pde;

/**
* Parabolic equation:
* M(x,t,U)*d2U_dt2 + L(x,t,U)*dU_dt = K(x,t,U)*d2U_dt2 + V(x,t,U)*dU_dt + F(x,t,U) where U = U(x,t)
*/
public class HyperbolicEquation extends Equation {

/**
* Create hyperbolic equation
*
* @param x1 left space coordinate
* @param x2 right space coordinate
* @param t2 right time coordinate
* @param x1 left space coordinate
* @param x2 right space coordinate
* @param t2 right time coordinate
* @param lbt type of left border condition (1/2/3)
* @param rbt type of right border condition (1/2/3)
* @param lH coefficient for 3rd border condition type of left border
* @param rH coefficient for 3rd border condition type of right border
* @param lH coefficient for 3rd border condition type of left border
* @param rH coefficient for 3rd border condition type of right border
*/
public HyperbolicEquation(double x1, double x2, double t2, int lbt, int rbt, double lH, double rH) {
super(x1, x2, t2, lbt, rbt, lH, rH);
Expand Down Expand Up @@ -130,10 +134,16 @@ public void solve(double h, double tau) {
}
}

/**
* Initial condition dU_dt(x,0) at moment t=0
*/
protected double gdU_dt(double x) {
return 0;
}

/**
* Coefficient L(x,t,U) of equation for 1st-order time derivative
*/
protected double gL(double x, double t, double U) {
return 0;
}
Expand Down
18 changes: 11 additions & 7 deletions src/main/java/by/andd3dfx/math/pde/ParabolicEquation.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package by.andd3dfx.math.pde;

/**
* Parabolic equation:
* M(x,t,U)*dU_dt = K(x,t,U)*d2U_dt2 + V(x,t,U)*dU_dt + F(x,t,U) where U = U(x,t)
*/
public class ParabolicEquation extends Equation {

/**
* Create parabolic equation
*
* @param x1 left space coordinate
* @param x2 right space coordinate
* @param t2 right time coordinate
* @param lbt type of left border condition (1/2/3)
* @param rbt type of right border condition (1/2/3)
* @param lH coefficient for 3rd border condition type of left border
* @param rH coefficient for 3rd border condition type of right border
* @param x1 left space coordinate
* @param x2 right space coordinate
* @param t2 right time coordinate
* @param lbt type of left border condition (1/2/3)
* @param rbt type of right border condition (1/2/3)
* @param lH coefficient for 3rd border condition type of left border
* @param rH coefficient for 3rd border condition type of right border
*/
public ParabolicEquation(double x1, double x2, double t2, int lbt, int rbt, double lH, double rH) {
super(x1, x2, t2, lbt, rbt, lH, rH);
Expand Down

0 comments on commit 5278898

Please sign in to comment.