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
7f5ac72e
Commit
7f5ac72e
authored
5 years ago
by
Lars Hubatsch
Browse files
Options
Downloads
Patches
Plain Diff
New offset and stretch parameters for gamma0() and spacing().
parent
b73e39cb
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
+18
-13
18 additions, 13 deletions
ternary_frap.m
with
18 additions
and
13 deletions
ternary_frap.m
+
18
−
13
View file @
7f5ac72e
...
...
@@ -8,22 +8,26 @@ b = 0.025;
c
=
1
/
100
;
u0
=
0.05
;
e
=
0.4
;
e_g0
=
0.16
;
o_g0
=
0.2
;
%%
g0
=
gamma0
(
x
,
a
,
b
,
e_g0
,
o_g0
);
%% Make useful mesh (by inverting the tanh profile and using this as spacing)
x
=
linspace
(
-
a
-
1
,
-
a
+
1
,
3000
);
g
=
gamma0
(
x
,
a
,
1
*
b
,
e
);
g
=
gamma0
(
x
,
a
,
1
*
b
,
e
_g0
,
o_g0
);
g_unique
=
unique
(
g
);
x
=
linspace
(
g_unique
(
1
),
g_unique
(
end
-
1
),
300
);
g_inv
=
spacing
(
x
,
a
,
2
*
b
,
e
);
g_inv
=
spacing
(
x
,
a
,
2
*
b
,
e
_g0
,
o_g0
);
g_inv
=
g_inv
(
2
:
end
-
1
);
x
=
[
linspace
(
-
a
-
1
,
g_inv
(
2
),
30
),
g_inv
(
3
:
end
-
2
),
...
linspace
(
g_inv
(
end
-
1
),
-
a
+
1
,
30
),
linspace
(
-
a
+
1.1
,
300
,
300
)];
%% Solve pde
tic
t
=
linspace
(
0.001
,
4
,
50
0
);
t
=
linspace
(
0.001
,
0.5
,
25
0
);
fh_ic
=
@
(
x
)
flory_ic
(
x
,
a
,
u0
);
fh_bc
=
@
(
xl
,
ul
,
xr
,
ur
,
t
)
flory_bc
(
xl
,
ul
,
xr
,
ur
,
t
,
u0
);
fh_pde
=
@
(
x
,
t
,
u
,
dudx
)
flory_hugg_pde
(
x
,
t
,
u
,
dudx
,
a
,
b
,
e
,
c
,
u0
);
fh_pde
=
@
(
x
,
t
,
u
,
dudx
)
flory_hugg_pde
(
x
,
t
,
u
,
dudx
,
a
,
b
,
e
,
c
,
u0
,
...
e_g0
,
o_g0
);
sol
=
pdepe
(
2
,
fh_pde
,
fh_ic
,
fh_bc
,
x
,
t
);
toc
%% Plotting
...
...
@@ -34,7 +38,7 @@ for i = 1:length(t)
ax
.
FontSize
=
16
;
xlabel
(
'position'
);
ylabel
(
'volume fraction'
);
plot
(
x
,
phi_tot
(
x
,
a
,
b
,
e
,
u0
),
'LineWidth'
,
2
,
'LineStyle'
,
'--'
);
plot
(
x
,
sol
(
i
,
:),
'LineWidth'
,
2
);
pause
(
0.06
);
plot
(
x
,
sol
(
i
,
:),
'LineWidth'
,
2
);
pause
();
% % print([num2str(i),'.png'],'-dpng')
end
%% Figures
...
...
@@ -47,7 +51,7 @@ xlabel('position'); ylabel('volume fraction');
plot
(
x
,
sol
(
1
:
2
:
300
,
:),
'LineWidth'
,
2
,
'Color'
,
[
135
/
255
204
/
255
250
/
255
]);
plot
(
x
,
phi_tot
(
x
,
a
,
b
,
e
,
u0
),
'LineWidth'
,
4
,
'LineStyle'
,
'--'
,
'Color'
,
...
[
247
/
255
,
139
/
255
,
7
/
255
]);
print
([
pa
,
'ternary_time_course'
],
'-depsc'
);
%
print([pa, 'ternary_time_course'], '-depsc');
%% Plot and check derivatives of pt
figure
;
hold
on
;
x
=
linspace
(
40
,
60
,
100000
);
...
...
@@ -58,14 +62,15 @@ plot(x(1:end-1)+mean(diff(x))/2, ...
plot
(
x
,
gamma0
(
x
,
a
,
b
,
e
));
figure
;
plot
(
gamma0
(
x
,
a
,
b
,
e
),
spacing
(
gamma0
(
x
,
a
,
b
,
e
),
a
,
b
,
e
));
%% Function definitions for pde solver
function
[
c
,
f
,
s
]
=
flory_hugg_pde
(
x
,
t
,
u
,
dudx
,
a
,
b
,
e
,
c_p
,
u0
)
function
[
c
,
f
,
s
]
=
flory_hugg_pde
(
x
,
t
,
u
,
dudx
,
a
,
b
,
e
,
c_p
,
u0
,
...
e_g0
,
o_g0
)
% Solve with full ternary model. Analytical derivatives.
% pt ... phi_tot
% gra_a ... analytical gradient of phi_tot
pt
=
phi_tot
(
x
,
a
,
b
,
e
,
u0
);
gra_a
=
gradient_analytical
(
x
,
a
,
b
,
e
);
g0
=
gamma0
(
x
,
a
,
b
,
e
);
g0
=
gamma0
(
x
,
a
,
b
,
e
_g0
,
o_g0
);
c
=
c_p
;
f
=
g0
*
(
1
-
pt
)/
pt
*
(
pt
*
dudx
-
u
*
gra_a
);
s
=
0
;
...
...
@@ -91,12 +96,12 @@ function [pl,ql,pr,qr] = flory_bc(xl, ul, xr, ur, t, u0)
qr
=
0
;
end
function
g0
=
gamma0
(
x
,
a
,
b
,
e
)
g0
=
1
*
e
*
(
tanh
((
x
+
a
)/
b
)
+
1
)/
2
+
0.001
;
function
g0
=
gamma0
(
x
,
a
,
b
,
e
_g0
,
o_g0
)
g0
=
e_g0
*
(
tanh
((
x
+
a
)/
b
)
+
1
)/
2
+
o_g0
;
end
function
sp
=
spacing
(
x
,
a
,
b
,
e
)
sp
=
b
*
atanh
(
2
/(
1
*
e
)
*
(
x
-
0.001
)
-
1
)
-
a
;
function
sp
=
spacing
(
x
,
a
,
b
,
e
_g0
,
o_g0
)
sp
=
b
*
atanh
(
2
/(
e_g0
)
*
(
x
-
o_g0
)
-
1
)
-
a
;
end
function
p
=
phi_tot
(
x
,
a
,
b
,
e
,
u0
)
...
...
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