Sei sulla pagina 1di 9

Verifying that the basic Hopf−Cole transformation, w = 2 u -1 ux

where ut = uxx , satisfies the homogeneous Burgers’ equation


wt - wxx - wwx = 0 per Equation World’s description
In[2]:= CleanSlate@D;

HCleanSlateL Contexts purged: 8Global‘<

HCleanSlateL Approximate kernel memory recovered: 1 Kb

2
In[1]:= w@x_, t_D := €€€€€€€€€€€€€€€€€€€€ D@u@x, tD, xD;
u@x, tD

In[2]:= terms = Expand@8


D@w@x, tD, tD,
-D@w@x, tD, 8x, 2<D,
-w@x, tD D@w@x, tD, xD
<D;
MatrixForm@termsD
Out[3]//MatrixForm=
i @x,tD u @x,tD @x,tD y
H0,1L H1,0L H1,1L
j
j z
z
2u 2u
j z
- €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€ €
j
j u@x,tD2 u@x,tD
z
z
j
j H3,0L @x,tD z
z
j
j z
z
j - €€€€€€€€€€€€€€€€€€€€€€€€€ z
H1,0L @x,tD 3 H1,0L @x,tD uH2,0L @x,tD
j
j z
z
4 u 6 u 2 u
j z
€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€€€€€€€€
€
j
j z
z
3 2 u@x,tD
j z
u@x,tD u@x,tD
j 4 uH1,0L @x,tD3 4 uH1,0L @x,tD uH2,0L @x,tD
j z
z
j
j €€€€€€€€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ z
z
k u@x,tD3 u@x,tD2 {

In[4]:= transformedTerms = Expand@terms . 8


D@u@x, tD, 8x, 2<D ® D@u@x, tD, tD,
D@u@x, tD, 8x, 3<D ® D@u@x, tD, 8x, 1<, 8t, 1<D
<D;
MatrixForm@transformedTermsD
Out[5]//MatrixForm=
i - 2€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
@x,tD u @x,tD @x,tD y
H0,1L H1,0L H1,1L
j
j z
z
u 2u
j z
+ €€€€€€€€€€€€€€€€€€€€€€€ €
j
j u@x,tD2 u@x,tD
z
z
j H0,1L
j H1,1L @x,tD z
z
j
j z
z
j @x,tD z
H1,0L @x,tD H1,0L @x,tD 3

j
j z
z
6 u u 4 u 2 u
j z
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€€€€€€€€€€
€ - €€€€€€€€€€€€€€€€€€€€€€€
€
j
j z
z
2 3 u@x,tD
j z
u@x,tD u@x,tD
j 4 uH0,1L @x,tD uH1,0L @x,tD 4 uH1,0L @x,tD3
j z
z
j
j - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€ z
z
k u@x,tD 2
u@x,tD 3
{

In[6]:= residual = Total@transformedTermsD

Out[6]= 0

Verifying the Hopf−Cole transformation, w = -2 Νu-1 ux where


ut = Νuxx, satisfies the homogenous Burgers’ variant
wt - Νwxx + wwx = 0 with constant Ν
In[7]:= CleanSlate@D;

HCleanSlateL Contexts purged: 8Global‘<

HCleanSlateL Approximate kernel memory recovered: 0 Kb


2 Hopf−Cole.nb

-2 Ν
In[1]:= w@x_, t_D := €€€€€€€€€€€€€€€€€€€€ D@u@x, tD, xD;
u@x, tD

In[2]:= terms = Expand@8


D@w@x, tD, tD,
-Ν D@w@x, tD, 8x, 2<D,
w@x, tD D@w@x, tD, xD
<D;
MatrixForm@termsD
Out[3]//MatrixForm=
i 2€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
@x,tD u @x,tD @x,tD y
H0,1L H1,0L H1,1L
j z
Νu 2Νu
j
j
- €€€€€€€€€€€€€€€€€€€€€€€€€€
€ z
z
j
j u@x,tD2 u@x,tD
z
z
j
j 2 uH3,0L @x,tD z
z
j
j z
j €zz
2 uH1,0L @x,tD 3 2 uH1,0L @x,tD uH2,0L @x,tD
j z
Ν Ν Ν
j z
4 6 2
j z
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€
j
j z
z
3 2 u@x,tD
j z
u@x,tD u@x,tD
j
j z
z
j
j - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
4 Ν 2 u H1,0L @x,tD
3
4 Ν 2 uH1,0L @x,tD u H2,0L @x,tD z
z
k u@x,tD 3
u@x,tD 2
{

In[4]:= transformedTerms = ExpandBterms . :


1
D@u@x, tD, 8x, 2<D ® €€€ D@u@x, tD, tD,
Ν
1
D@u@x, tD, 8x, 3<D ® €€€ D@u@x, tD, 8x, 1<, 8t, 1<D
Ν
>F;
MatrixForm@transformedTermsD
Out[5]//MatrixForm=
i @x,tD u @x,tD @x,tD y
H0,1L H1,0L H1,1L
j z
2Νu 2Νu
j
j
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€€€€€€€€€€€€ z
z
j
j u@x,tD2 u@x,tD
z
z
j
j z
z
j
j z
z
j @x,tD @x,tD @x,tD @x,tD z
H0,1L H1,0L H1,0L 3 H1,1L
j z
Ν Ν 2 Ν
j z
6 u u 4 u 2 u
j z
- €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€
€
j
j z
z
2 3 u@x,tD
j z
u@x,tD u@x,tD
j
j z
z
j
j €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
4 Ν u H0,1L @x,tD uH1,0L @x,tD 4 Ν 2 uH1,0L @x,tD3
z
z
k u@x,tD 2
u@x,tD 3
{

In[6]:= residual = Total@transformedTermsD

Out[6]= 0

Verifying the complex exponential series solution u of the


equation ut = Νuxx on the periodic domain [0,L)
Because the equation is linear, we may verify each term independently.

In[7]:= CleanSlate@D;

HCleanSlateL Contexts purged: 8Global‘<

HCleanSlateL Approximate kernel memory recovered: 18 Kb

2
i2 n Πy z Ν tF ExpBä i 2 n Πy
u@x_, t_, n_D := u@nD ExpB- j j z xF;
` j
In[1]:= j €€€€€€€€€€€€ z
z j
j €€€€€€€€€€€€ z
z
k L { k L {
Hopf−Cole.nb 3

In[2]:= terms = Expand@8


D@u@x, t, nD, tD,
-Ν D@u@x, t, nD, 8x, 2<D
<D;
MatrixForm@termsD
Out[3]//MatrixForm=
i
j y
z
2 2

j z
2änΠx 4n Π tΝ

j z
€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€
€€€€€€€€€€
n2 Π2 Ν u@nD
j
`
j
4ã L L2
z
z
j
j
- €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ z
z
j
j z
z
L 2

j
j z
z
j
j z
z
j z
2 ä n Π x 4 n2 Π2 t Ν

j 4ã L
j z
z
€€€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€
€€€€€€€€€€
n2 Π2 Ν u@nD
`
L2

k {
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
L2

In[4]:= residual = Simplify@8


Total@termsD,
Hu@x, t, nD . x ® 0L - Hu@x, t, nD . x ® LL,
HD@u@x, t, nD, xD . x ® 0L - HD@u@x, t, nD, xD . x ® LL
<, n Î IntegersD

Out[4]= 80, 0, 0<

Verifying that complex exponential series solution u of ut = Νuxx


transformed by the Hopf−Cole variant w = -2 Νu-1 ux satisfies the
homogeneous Burgers’ equation wt - Νwxx + wwx = 0 on the
periodic domain [0,L) with constant Ν
In[5]:= CleanSlate@D;

HCleanSlateL Contexts purged: 8Global‘<

HCleanSlateL Approximate kernel memory recovered: 14 Kb

We verify for only a small number of terms because of the nonlinear nature of the equation.

2
i2 n Πz y i2 n Πz y
u@nD ExpB- j j
3 `
In[1]:= u@x_, t_D := â j
j €€€€€€€€€€€€ z
z Ν tF ExpBä j
j €€€€€€€€€€€€ z
z xF;
n=-3
k L { k L {
-2 Ν
In[2]:= w@x_, t_D := €€€€€€€€€€€€€€€€€€€€ D@u@x, tD, xD;
u@x, tD
4 Hopf−Cole.nb

In[3]:= terms = Expand@8


D@w@x, tD, tD,
-Ν D@w@x, tD, 8x, 2<D,
w@x, tD D@w@x, tD, xD
<D;
MatrixForm@termsD
Out[4]//MatrixForm=

A very large output was generated. Here is a sample of it:

i
j
2

j
12 ä Π x 72 Π t Ν

j
- €€€€€€€€€€€€€€€€€€ - €€€€€€€€€€€€€€€€€€€€€€
Π3 Ν2 u@-3D 480 ä †3‡ u@-3D u@-2D
j
` 2 ` `
j
432 ä ã L L2 †1‡ 128 †5‡
j
j
€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ + †1‡
€€€€€€€€€€€ + †31‡ + €€€€€€€€€€€€€€€€€€€€ + €€€€€€€€
j
j i y L H†1‡L L3 H†1‡L i
j
2 2
j z j
3

j 3 j L3 j
ä †1‡ †1‡ †1‡ †1‡
z
6 x
j z j
j †1‡ u@-3D+ã†1‡ †1‡+†3‡+†1‡+ã L @3D j
` `
j z
- €€€€€€€€€€€€€€€€
€€€€€€€€€€€€€€€€
€€€€
€ €€€
€€€ - €€€€€€€€
€€€€
€ € €€€€€€€€
€€€€
€ € -†1‡

j
j
j
j z
z j
j ã
j
L ã L u
j
j k { k
j
j
j
j
j
j
†1‡
j
k †1‡

Show Less Show More Show Full Output Set Size Limit...

In[5]:= residual = FullSimplify@8


Total@termsD,
Hw@x, tD . x ® 0L - Hw@x, tD . x ® LL,
HD@w@x, tD, xD . x ® 0L - HD@w@x, tD, xD . x ® LL
<, 8n Î Integers, t > 0, L > 0, Ν > 0<D;
MatrixForm@residualD
Out[6]//MatrixForm=
i0
j y
z
j
j z
z
j
j z
z
j
j
j
0 z
z
z
k0 {

The closed form of the solution:

In[7]:= FullSimplify@w@x, tDD

i i `
2 Π Hä L x+10 Π t ΝL
j
j4 ä Π Ν jj3 u@-3D + 2 ã
€€€€€€€€€€€€€€€€ `
€€€€€€€€€€€€€€€€
L2 u@-2D +
k k
Out[7]=

yz
y
4 Π Hä L x+8 Π t ΝL 8 Π Hä L x+4 Π t ΝL 10 Π Hä L x+2 Π t ΝL

u@-1D - ã u@1D - 2 ã u@2D - 3 㠀€€€€€€€ u@3Dz


zz “
12 ä Π x
€€€€€€€€€€€€€€ `
€€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ ` €€€€€€€€€€€€€€€€ `
€€€€€€€€€€€€€€€€ €€€€€ `
ã L2 L2 L2
{{
L

i ji`
2 Π Hä L x+10 Π t ΝL 4 Π Hä L x+8 Π t ΝL 6 Π Hä L x+6 Π t ΝL
j
jL ju@-3D + ã
€€€€€€€€€€€€€€€€ `
€€€€€€€€€€€€€€€€
L2 u@-2D + ã
€€€€€€€€€€€€€€€€
L2 u@-1D + ã
€€€€€€€€€€€€€€ `
u@0D +
€€€€€€€€€€€€€€ `
€€€€€€€€€€€€€€€€
L2
k k
yz y
8 Π Hä L x+4 Π t ΝL 10 Π Hä L x+2 Π t ΝL

u@1D + ã u@2D + 㠀€€€€€€€ u@3Dz zz


12 ä Π x
€€€€€€€€€€€€€€ `
€€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€ `
€€€€€€€€€€€€€€€€ €€€€€ `
ã L2 L2
{{
L

A particular Burgers’ equation solution for solver verification


In[8]:= CleanSlate@D;

HCleanSlateL Contexts purged: 8Global‘<

HCleanSlateL Approximate kernel memory recovered: 0 Kb


Hopf−Cole.nb 5

In[1]:= L = 2 Π;
Ν = 1;
tinitial = 0; tfinal = 1; tstep = Htfinal - tinitialL  10;
times = Range@tinitial, tfinal , tstep D;
Nsamples = 1024;
Ø


`
u@-nD n < 0








4 nŠ0


u@n_D := ∞ ≤
` 2 nŠ1





1 nŠ2






0 nŠ3
± 0 n>3
2
i2 n Πy z Ν tF ExpBä i 2 n Πy
u@nD ExpB- j j z xF;
3 `
In[7]:= u@x_, t_D := â j
j €€€€€€€€€€€€ z
z j
j €€€€€€€€€€€€ z
z
n=-3
k L { k L {
-2 Ν
In[8]:= w@x_, t_D = €€€€€€€€€€€€€€€€€€€€ D@u@x, tD, xD;
u@x, tD

In physical space, the closed form of the solution is:

In[9]:= FullSimplify@w@x, tDD

4 ä I-1 + ã2 ä x M I1 + ã3 t+ä x + ã2 ä x M
Out[9]= - €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
1 + 2 ã3 t+ä x + 4 ã4 t+2 ä x + 2 ã3 t+3 ä x + ã4 ä x

If, in addition, we require the input arguments to be purely real, the closed form of the solution is:

In[10]:= FullSimplify@ComplexExpand@w@x, tDDD

4 Iã3 t + 2 Cos@xDM Sin@xD


Out[10]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
2 ã4 t + 2 ã3 t Cos@xD + Cos@2 xD

In physical space, the initial condition is:

In[11]:= FullSimplify@w@x, 0DD

4 HSin@xD + Sin@2 xDL


Out[11]= €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€
2 + 2 Cos@xD + Cos@2 xD

We verify a zero residual for this solution:

In[12]:= terms = Expand@8


D@w@x, tD, tD,
-Ν D@w@x, tD, 8x, 2<D,
w@x, tD D@w@x, tD, xD
<D;
residual = FullSimplify@8
Total@termsD,
Hw@x, tD . x ® 0L - Hw@x, tD . x ® LL,
HD@w@x, tD, xD . x ® 0L - HD@w@x, tD, xD . x ® LL
<, 8n Î Integers<D;
MatrixForm@residualD
Out[14]//MatrixForm=
i
j 0 y
z
j
j z
z
j
j z
z
j
j
j
0 z
z
z
k0 {

In physical space the solution looks like:


6 Hopf−Cole.nb

In[15]:= Plot3D@w@x, tD, 8x, 0, L<, 8t, tinitial, tfinal <, 8


PlotRange ® 8Full, Full, Full<,
AxesLabel ® 8"x", "t", "w@x,tD"<,
Ticks ® 880, Π, 2 Π<, Automatic, Automatic<
<D

Out[15]=

We sample the solution to allow comparison with spectral methods:

In[16]:= sampleW@npoints_, times_D := TableB


2Πj
ChopBNBTableBwB €€€€€€€€€€€€€€€€€€€€€ , tF, 8j, 0, npoints - 1<FFF
npoints
, 8t, times<F;
physicalData = sampleW@Nsamples, timesD;
ListPlot3D@physicalData, 8
PlotRange ® 8Full, Full, Full<,
DataRange ® 880, L<, 80, tfinal <<,
AxesLabel ® 8"j", "t", "w@xj ,tD"<
<D

Out[18]=
Hopf−Cole.nb 7

Transform each timestep into spectral space , using the signal processing convention that we normalize the forward transform by
1/N:

In[19]:= spectralData = Chop@Map@Fourier@ð, FourierParameters ® 81, -1<D &, physicalDataDD;

In[20]:= waveNumberPairs@xs_D := Module@8


n2floor = Floor@Length@xsD  2D,
n2ceiling = Ceiling@Length@xsD  2D,
<,
H*Map from DFT coefficient array to one of 88wavenumber,coefficient<< *L
Sort@MapThread@List, 8
RotateLeft@Range@-n2floor, n2ceiling - 1D, n2floorD, xs
<DD
D;
spectralPairs = Map@waveNumberPairs, spectralDataD;
spectralAbsPairs = Map@waveNumberPairs, Abs@spectralDataDD;
spectralArgPairs = Map@waveNumberPairs, Arg@spectralDataDD;

Ÿ Spectrum detail for initial time:

In[24]:= ListLogPlotATooltip@spectralAbsPairs@@1DDD, 9
`
PlotRange ® 8Full, Full<, AxesLabel ® 9kn , Abs@wD=, Filling ® Axis
=E

Out[24]=
8 Hopf−Cole.nb

In[25]:= sortPairsByMagnitude@xs_D := Sort@xs, Abs@Last@ð1DD > Abs@Last@ð2DD &D;


Take@sortPairsByMagnitude@spectralPairs@@1DDD, 16D  TableForm
Out[26]//TableForm=
1 -1052.94 ä
-1 1052.94 ä
2 -875.924 ä
-2 875.924 ä
3 814.673 ä
-3 -814.673 ä
5 -222.369 ä
-5 222.369 ä
6 154.384 ä
-6 -154.384 ä
4 -115.767 ä
-4 115.767 ä
8 -52.1693 ä
-8 52.1693 ä
9 27.663 ä
-9 -27.663 ä

Ÿ Spectrum detail for final time:

In[27]:= ListLogPlotATooltip@spectralAbsPairs@@-1DDD, 9
`
PlotRange ® 8Full, Full<, AxesLabel ® 9kn , Abs@wD=, Filling ® Axis
=E

Out[27]=
Hopf−Cole.nb 9

In[28]:= sortPairsByMagnitude@xs_D := Sort@xs, Abs@Last@ð1DD > Abs@Last@ð2DD &D;


Take@sortPairsByMagnitude@spectralPairs@@-1DDD, 16D  TableForm
Out[29]//TableForm=
1 -388.425 ä
-1 388.425 ä
2 54.2387 ä
-2 -54.2387 ä
3 -8.44437 ä
-3 8.44437 ä
4 1.34427 ä
-4 -1.34427 ä
5 -0.214898 ä
-5 0.214898 ä
6 0.0343808 ä
-6 -0.0343808 ä
7 -0.00550127 ä
-7 0.00550127 ä
8 0.000880282 ä
-8 -0.000880282 ä

Ÿ Spectra details for all sampled times:

Obtain {n, t, value} triples for each sampled quantity :

In[30]:= spectralTriples = Flatten@MapThread@


Insert@ð2, ð1, Table@8j, 2<, 8j, Length@ð2D<DD &,
8times, spectralPairs<D, 1D;
spectralTriples = Select@spectralTriples, Abs@ð@@3DDD > 0 &D;
spectralAbsTriples = Map@8ð@@1DD, ð@@2DD, Abs@ð@@3DDD< &, spectralTriplesD;
spectralArgTriples = Map@8ð@@1DD, ð@@2DD, Arg@ð@@3DDD< &, spectralTriplesD;

In[34]:= ListPlot3DAspectralAbsTriples, 9
`
PlotRange ® Full, AxesLabel ® 9kn , t, Abs@wD=
=E

Out[34]=

Potrebbero piacerti anche