Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jigyasa Watwani
/
growth-pattern-control
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
48472926
authored
Dec 22, 2022
by
Jigyasa Watwani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
analytical solution rewriting
parent
10174caf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
euler_error/linear_growth_euler_errors.py
euler_error/linear_growth_euler_errors.py
View file @
48472926
...
...
@@ -7,13 +7,13 @@
import
numpy
as
np
import
dolfin
as
df
import
matplotlib.pyplot
as
plt
import
progressbar
#
import progressbar
from
scipy.optimize
import
curve_fit
df
.
set_log_level
(
df
.
LogLevel
.
ERROR
)
df
.
parameters
[
'form_compiler'
][
'optimize'
]
=
True
def
advection_diffusion
(
Nx
,
L
,
Nt
,
tmax
,
v
,
D
):
def
advection_diffusion
(
Nx
,
L
,
Nt
,
tmax
,
v
,
D
,
m
):
# mesh, function space, function, test function
mesh
=
df
.
IntervalMesh
(
Nx
,
0
,
L
)
function_space
=
df
.
FunctionSpace
(
mesh
,
'P'
,
1
)
...
...
@@ -37,7 +37,7 @@ def advection_diffusion(Nx, L, Nt, tmax, v, D):
+
df
.
inner
((
u
*
c0
)
.
dx
(
0
),
tc
)
+
D
*
df
.
inner
(
tc
.
dx
(
0
),
c
.
dx
(
0
)))
*
df
.
dx
(
mesh
)
for
i
in
progressbar
.
progressbar
(
range
(
1
,
len
(
times
)
)):
for
i
in
range
(
1
,
len
(
times
)):
v
.
t
=
times
[
i
]
u
.
assign
(
df
.
project
(
v
,
function_space
))
df
.
solve
(
form
==
0
,
c
)
...
...
@@ -49,15 +49,15 @@ def advection_diffusion(Nx, L, Nt, tmax, v, D):
return
[
c_array
,
x_array
]
Nx
,
L
,
tmax
,
D
,
b
,
m
=
100
,
1
,
1
,
0.1
,
0.01
,
2
Nx
,
L
,
tmax
,
D
,
b
,
m
=
100
,
0.
1
,
1
,
0.1
,
0.01
,
2
v
=
df
.
Expression
(
'b*x[0]/(L + b*t)'
,
b
=
b
,
L
=
L
,
t
=
0
,
degree
=
1
)
Nt_array
=
np
.
array
([
5
,
10
,
15
,
20
,
25
,
3
0
])
Nt_array
=
np
.
array
([
10
,
20
,
30
,
40
,
50
,
60
,
70
,
80
,
90
,
10
0
])
# , 400, 800, 1600, 3200, 6400, 12800])
dt_array
=
tmax
/
(
Nt_array
)
error_in_c
=
np
.
zeros
(
len
(
Nt_array
))
for
i
in
range
(
len
(
Nt_array
)):
c
,
x
=
advection_diffusion
(
Nx
,
L
,
Nt_array
[
i
],
tmax
,
v
,
D
)
c
,
x
=
advection_diffusion
(
Nx
,
L
,
Nt_array
[
i
],
tmax
,
v
,
D
,
m
)
times
=
np
.
linspace
(
0
,
tmax
,
Nt_array
[
i
]
+
1
)
c_exact
=
np
.
zeros
((
Nt_array
[
i
]
+
1
,
Nx
+
1
))
for
j
in
range
(
0
,
Nt_array
[
i
]
+
1
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment