# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.differentialequation.pde.finitedifference.parabolic.dim1.convectiondiffusionequation

## Class ConvectionDiffusionEquation1D

• java.lang.Object
• com.numericalmethod.suanshu.analysis.differentialequation.pde.finitedifference.parabolic.dim1.convectiondiffusionequation.ConvectionDiffusionEquation1D
• All Implemented Interfaces:
PDE

public class ConvectionDiffusionEquation1D
extends Object
implements PDE
The convection–diffusion equation is a combination of the diffusion and convection (advection) equations, and describes physical phenomena where particles, energy, or other physical quantities are transferred inside a physical system due to two processes: diffusion and convection. Depending on context, the same equation can be called the advection–diffusion equation, drift–diffusion equation, Smoluchowski equation (after Marian Smoluchowski), or (generic) scalar transport equation.

A one-dimensional general convection-diffusion equation is of the following form. $\frac{\partial u}{\partial t} = \sigma(t,x) \frac{\partial^2 u}{\partial x^2} - \mu(t,x) \frac{\partial u}{\partial x} + R(t,x),$ The initial condition has this form: $u(0,x) = f(x), ~0 < x < a$ The mixed boundary conditions have this form: $(1-c_1)u(t,0) - c_1\frac{\partial u}{\partial x}(t,0) = g_1(t), \\ (1-c_2)u(t,a) + c_2\frac{\partial u}{\partial x}(t,a) = g_2(t)$ where $$0 \le c_k \le 1, k = 1, 2$$.

Wikipedia: Convection-diffusion equation
• ### Constructor Summary

Constructors
Constructor and Description
ConvectionDiffusionEquation1D(BivariateRealFunction sigma, BivariateRealFunction mu, BivariateRealFunction R, double a, double T, UnivariateRealFunction f, double c1, UnivariateRealFunction g1, double c2, UnivariateRealFunction g2)
Constructs a convection-diffusion equation problem.
• ### Method Summary

All Methods
Modifier and Type Method and Description
double a()
Gets the size of the one-dimensional space, that is, the range of x, (0 < x < a).
double c1()
Gets the coefficient c1 in the mixed boundary condition at the boundary x = 0.
double c2()
Gets the coefficient c2 in the mixed boundary condition at the boundary x = a.
double f(double x)
Gets the initial condition of u at a given position x.
double g1(double t)
The value of the linear combination of $$u$$ and $$\frac{\partial u}{\partial x}$$ at the boundary $$x = 0$$ at a given time $$t$$.
double g2(double t)
The value of the linear combination of $$u$$ and $$\frac{\partial u}{\partial x}$$ at the boundary $$x = a$$ at the given time $$t$$.
double mu(double t, double x)
Gets the convection coefficient at a given time t and a position x.
double R(double t, double x)
Gets the source (or sink) value at a given time t and a position x.
double sigma(double t, double x)
Gets the diffusion coefficient at a given time t and a position x.
double T()
Gets the time period of interest, that is, the range of t, (0 < t < T).
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### ConvectionDiffusionEquation1D

public ConvectionDiffusionEquation1D(BivariateRealFunction sigma,
BivariateRealFunction mu,
BivariateRealFunction R,
double a,
double T,
UnivariateRealFunction f,
double c1,
UnivariateRealFunction g1,
double c2,
UnivariateRealFunction g2)
Constructs a convection-diffusion equation problem.
Parameters:
sigma - the diffusion coefficient (or diffusivity) $$\sigma(t,x)$$
mu - the convection coefficient $$\mu(t,x)$$
R - the sources (or sinks) R(t,x)
a - the region of interest (0, a)
T - the time period of interest (0, T)
f - the initial condition of u, i.e., u(0,x)
c1 - the coefficient in the mixed boundary condition at x = 0
g1 - the mixed boundary condition at x = 0
c2 - the coefficient in the mixed boundary condition at x = a
g2 - the mixed boundary condition at x = a
• ### Method Detail

• #### sigma

public double sigma(double t,
double x)
Gets the diffusion coefficient at a given time t and a position x.
Parameters:
t - a time
x - a position
Returns:
the diffusion coefficient $$\sigma(t,x)$$
• #### mu

public double mu(double t,
double x)
Gets the convection coefficient at a given time t and a position x.
Parameters:
t - a time
x - a position
Returns:
the convection coefficient $$\mu(t,x)$$
• #### R

public double R(double t,
double x)
Gets the source (or sink) value at a given time t and a position x.
Parameters:
t - a time
x - a position
Returns:
the source (or sink) R(t,x)
• #### a

public double a()
Gets the size of the one-dimensional space, that is, the range of x, (0 < x < a).
Returns:
the size of the space
• #### T

public double T()
Gets the time period of interest, that is, the range of t, (0 < t < T).
Returns:
the time period of interest
• #### f

public double f(double x)
Gets the initial condition of u at a given position x.
Parameters:
x - a position
Returns:
u(0, x)
• #### c1

public double c1()
Gets the coefficient c1 in the mixed boundary condition at the boundary x = 0. $(1-c_1)u(t,0) - c_1\frac{\partial u}{\partial x}(t,0) = g_1(t)$ where $$0 \leq c_1 \leq 1$$. If $$c_1 = 0$$, this is the Dirichlet boundary condition. If $$c_1 = 1$$, this is the Neumann boundary condition.
Returns:
the coefficient c1
• #### g1

public double g1(double t)
The value of the linear combination of $$u$$ and $$\frac{\partial u}{\partial x}$$ at the boundary $$x = 0$$ at a given time $$t$$. $(1-c_1)u(t,0) - c_1\frac{\partial u}{\partial x}(t,0) = g_1(t)$
Parameters:
t - a time
Returns:
$$g_1(t)$$
• #### c2

public double c2()
Gets the coefficient c2 in the mixed boundary condition at the boundary x = a. $(1-c_2)u(t,a) + c_2\frac{\partial u}{\partial x}(t,a) = g_2(t)$ where $$0 \leq c_2 \leq 1$$. If $$c_2 = 0$$, this is the Dirichlet boundary condition. If $$c_2 = 1$$, this is the Neumann boundary condition.
Returns:
the coefficient c2
• #### g2

public double g2(double t)
The value of the linear combination of $$u$$ and $$\frac{\partial u}{\partial x}$$ at the boundary $$x = a$$ at the given time $$t$$. $(1-c_2)u(t,a) + c_2\frac{\partial u}{\partial x}(t,a) = g_2(t)$
Parameters:
t - a time
Returns:
$$g_2(t)$$
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8536790609359741, "perplexity": 1010.6289808001959}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-39/segments/1537267155413.17/warc/CC-MAIN-20180918130631-20180918150631-00291.warc.gz"}