Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frap Theory
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hubatsch
Frap Theory
Commits
42bf60f2
Commit
42bf60f2
authored
5 years ago
by
Lars Hubatsch
Browse files
Options
Downloads
Patches
Plain Diff
Analytical derivates work, parameter regime doesn't look completely off.
parent
6bea983a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ternary_frap.m
+31
-15
31 additions, 15 deletions
ternary_frap.m
with
31 additions
and
15 deletions
ternary_frap.m
+
31
−
15
View file @
42bf60f2
...
...
@@ -4,8 +4,8 @@
% conditions are introduced. Integration of model via pdepe.
%% Solve pde
x
=
linspace
(
0
,
4
0
,
5
00
);
t
=
linspace
(
0
,
500
0
,
50
);
x
=
linspace
(
0
,
50
0
,
60
00
);
t
=
linspace
(
0
,
500
,
50
);
% opt = odeset('RelTol',1e-14, 'AbsTol', 1e-16,'MaxStep',1e-2);
% sol = pdepe(0,@flory_pde, @flory_ic, @flory_bc,x,t, opt);
sol
=
pdepe
(
0
,
@
flory_hugg_pde
,
@
flory_ic
,
@
flory_bc
,
x
,
t
);
...
...
@@ -13,28 +13,36 @@ sol = pdepe(0,@flory_hugg_pde, @flory_ic, @flory_bc,x,t);
%% Plotting
figure
(
1
);
hold
on
;
for
i
=
1
:
50
cla
;
plot
(
x
,
pt
(
x
));
plot
(
x
,
sol
(
i
,
:));
pause
(
0.0
1
);
cla
;
plot
(
x
,
pt
(
x
));
plot
(
x
,
sol
(
i
,
:));
pause
(
0.0
4
);
end
%% Plot and check derivatives of pt
figure
;
hold
on
;
x
=
linspace
(
140
,
170
,
500
);
plot
(
x
,
pt
(
x
));
plot
(
x
,
gra_pt
(
x
,
0.001
));
plot
(
x
,
lap_pt
(
x
,
0.001
));
plot
(
x
,
gralap_pt
(
x
,
0.001
));
plot
(
x
,
laplap_pt
(
x
,
0.001
));
plot
(
x
,
gra_a
(
x
,
-
155
,
0.5
));
plot
(
x
,
lap_a
(
x
,
-
155
,
0.5
));
% pt(0)
% gra_pt(0, 0.00001)
% lap_pt(0, 0.00001)
% lap_a(0, -155, 0.5)
% gralap_pt(0, 0.00001)
% laplap_pt(0, 0.00001)
%% Function definitions for pde solver
function
[
c
,
f
,
s
]
=
flory_hugg_pde
(
x
,
t
,
u
,
dudx
)
% Solve with full ternary model.
X
=
2
.2
;
K
=
1
;
X
=
3
.2
;
K
=
1
.5
;
c
=
1
/(
pt
(
x
)
+
1
);
f
=
dudx
;
s
=
u
*
(
lap_pt
(
x
,
0.001
)
-
2
*
X
*
(
lap_pt
(
x
,
0.001
)
-
...
gra_pt
(
x
,
0.001
)
^
2
-
pt
(
x
)
*
lap_pt
(
x
,
0.001
))
+
...
K
*
(
-
laplap_pt
(
x
,
0.001
)
+
...
gra_pt
(
x
,
0.001
)
*
gralap_pt
(
x
,
0.001
)
+
...
pt
(
x
)
*
laplap_pt
(
x
,
0.001
)))/(
pt
(
x
)
+
1
)
+
...
dudx
*
(
-
2
*
X
*
(
gra_pt
(
x
,
0.001
)
-
pt
(
x
)
*
gra_pt
(
x
,
0.001
))
-
...
K
*
gralap_pt
(
x
,
0.001
)
+
K
*
pt
(
x
)
*
gralap_pt
(
x
,
0.001
))/
...
s
=
u
*
(
lap_pt
(
x
,
0.00
0
1
)
-
2
*
X
*
(
lap_pt
(
x
,
0.
0
001
)
-
...
gra_pt
(
x
,
0.00
0
1
)
^
2
-
pt
(
x
)
*
lap_pt
(
x
,
0.
0
001
))
+
...
K
*
(
-
laplap_pt
(
x
,
0.00
0
1
)
+
...
gra_pt
(
x
,
0.00
0
1
)
*
gralap_pt
(
x
,
0.
0
001
)
+
...
pt
(
x
)
*
laplap_pt
(
x
,
0.00
0
1
)))/(
pt
(
x
)
+
1
)
+
...
dudx
*
(
-
2
*
X
*
(
gra_pt
(
x
,
0.00
0
1
)
-
pt
(
x
)
*
gra_pt
(
x
,
0.
0
001
))
-
...
K
*
gralap_pt
(
x
,
0.00
0
1
)
+
K
*
pt
(
x
)
*
gralap_pt
(
x
,
0.
0
001
))/
...
(
pt
(
x
)
+
1
);
end
...
...
@@ -42,7 +50,7 @@ function u0 = flory_ic(x)
if
x
<
5
u0
=
0.0
;
else
u0
=
0.
1
;
u0
=
0.
5
;
end
% u0 = pt(x)*0.5;
end
...
...
@@ -64,7 +72,7 @@ s = -u*lap_pt(x)/pt(x);
end
function
p
=
pt
(
x
)
p
=
(
tanh
(
-
(
x
-
5
)
*
2
)
+
1
)/
2
+
0.
1
;
p
=
(
tanh
(
-
(
x
-
15
5
)
*
2
)
+
1
)/
2
+
0.
3
;
end
function
gpt
=
gra_pt
(
x
,
delta
)
...
...
@@ -84,4 +92,12 @@ end
function
llpt
=
laplap_pt
(
x
,
delta
)
llpt
=
(
gralap_pt
(
x
+
delta
,
delta
)
-
...
gralap_pt
(
x
-
delta
,
delta
))/(
2
*
delta
);
end
function
grad
=
gra_a
(
x
,
a
,
b
)
grad
=
-
(
1
-
tanh
(
-
(
x
+
a
)/
b
)
.^
2
)
*
1
/
b
*
0.5
;
end
function
lap
=
lap_a
(
x
,
a
,
b
)
lap
=
-
2
*
tanh
(
-
(
x
+
a
)/
b
)
.*
(
1
-
tanh
(
-
(
x
+
a
)/
b
)
.^
2
)
*
1
/
b
^
2
*
0.5
;
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment