Skip to content

Commit 08de838

Browse files
committed
finish draft of study
1 parent 56aaaea commit 08de838

9 files changed

+223
-77
lines changed

examples/meshes/2.6/co-annulus_structured.geo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ Transfinite Curve(2200) = p * point_radial + 1 Using Bump bump;
5454
Transfinite Curve(2201) = p * point_radial + 1 Using Bump bump;
5555
Transfinite Surface(4000) Alternate;
5656
Transfinite Surface(4001) Alternate;
57-
Recombine Surface(4000);
58-
Recombine Surface(4001);
57+
// Recombine Surface(4000);
58+
// Recombine Surface(4001);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6090d60c99c8bda0d7526bbd41efc34ee1463c1461f11bcd20f6da030942a96b
3-
size 174904
2+
oid sha256:4b02434bb10f16a7096a4354634b58430d35a8cd52b5e10a1de41d4fb98021dd
3+
size 211442
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:8a9b8261fd4eca42e6518c95cf377bc51fd767149468491cffcbb1c84dd39b1e
3-
size 394093
2+
oid sha256:327f496223a4b6ae17491c838f82715b0a53e2b108757e963cfa9b4d6dc08404
3+
size 479918
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:3fed38897128ff657b4c53b2ecdec525fca0f81d5e23b30d23c5098cf61d66b7
3-
size 699331
2+
oid sha256:78e7a759aaea507101e1d778da2093cbc2a3740a0186b974473000b701fbb356
3+
size 860909
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:f3058572b1f7cf26edddd47f3562c032b0c8858e95fd260af0a29be44d6defd0
3-
size 1122400
2+
oid sha256:4f1864ca75cd38994821dbe365f715d106b9715f4024b398eda3c4a01c34ee1e
3+
size 1386500
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:f113503b70cd20d47bbe53f7814be820380e4e7eb02930049f1398b60f9b028f
3+
size 2029247
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:77d946e0073e6bd44ce14cb2b5e53967e5f3337c8ab42ad1711eb36f7a49dcc7
3+
size 4120951

examples/meshes/2.6/create-meshes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
for p in 2 3 4 5
3+
for p in 2 3 4 5 6
44
do
55
for name in co-annulus_unstructured co-annulus_structured
66
do

examples/study1/study1.jl

Lines changed: 206 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ using CairoMakie
88
using Colors
99
using FileIO
1010

11+
1112
# 1)
1213
model_square = CartesianDiscreteModel(
13-
(0, 1, 0, 1), haskey(ENV, "GITHUB_ACTIONS") ? (40, 40) : (20, 20)
14+
(0, 1, 0, 1), haskey(ENV, "GITHUB_ACTIONS") ? (40, 40) : (40, 40)
1415
)
1516
# BCs
1617
uniform = (;
@@ -24,72 +25,211 @@ wave = (;
2425
V_diri_tags=[1, 2, 3, 4, 5, 6, 7, 8]
2526
)
2627

28+
29+
paramlist = [
30+
# n, model, bcs
31+
(0.6, model_square, uniform)
32+
(1.0, model_square, uniform)
33+
(1.4, model_square, uniform)
34+
(0.6, model_square, wave)
35+
(1.0, model_square, wave)
36+
(1.4, model_square, wave)
37+
]
38+
function mkcase(n, model, bcs)
39+
(;n, model, bcs)
40+
end
41+
cases = [
42+
mkcase(n, model, bcs)
43+
for (n, model, bcs) in paramlist
44+
]
45+
46+
outs = []
47+
out = nothing
48+
for (i, case) in enumerate(cases)
49+
name = "square_$(i)_$(case.n)"
50+
out = GeMotion.simulate(
51+
name=name,
52+
Pr=100,
53+
Ra=1e4,
54+
n=case.n,
55+
model=case.model,
56+
jac_scaling = 1,
57+
nlsolver_opts=(;
58+
show_trace=true,
59+
method=:newton,
60+
linesearch=BackTracking(),
61+
ftol=1E-8,
62+
xtol=1E-50,
63+
iterations=50,
64+
);
65+
nlsolver_custom_init_guess=[],
66+
nlsolver_init_guess_type=:zero,
67+
case.bcs...
68+
)
69+
push!(outs, out)
70+
GeMotion.contourplot_unitsquare(;
71+
fun=out.psih,
72+
name=name*"/psi",
73+
contourargs=(;levels=[2.0^i for i in -1:1:3]|>x->vcat(-x,x)),
74+
surfaceargs=(;
75+
colormap=:coolwarm
76+
)
77+
) |> display
78+
GeMotion.contourplot_unitsquare(;
79+
fun=out.Th,
80+
name=name*"/T",
81+
contourargs=(;levels=0:0.1:1),
82+
surfaceargs=(;
83+
colormap=cmap_cold_to_hot_paraview()
84+
)
85+
) |> display
86+
GeMotion.contourplot_unitsquare(;
87+
fun=out.Sth,
88+
name=name*"/Sth",
89+
contourargs=(;levels=[4.0^i for i in -1:1:3]),
90+
surfaceargs=(;
91+
colormap=:Reds,
92+
# colorscale=x->min(x,100)
93+
)
94+
) |> display
95+
GeMotion.contourplot_unitsquare(;
96+
fun=out.Sfl,
97+
name=name*"/Sfl",
98+
contourargs=(;levels=[4.0^i for i in -2:1:3]),
99+
surfaceargs=(;
100+
colormap=:Blues,
101+
# colorrange=(0,100)
102+
)
103+
) |> display
104+
end
105+
106+
107+
108+
109+
110+
111+
112+
27113
# 2)
28-
# if haskey(ENV, "GITHUB_ACTIONS")
29-
# model_annulus = GmshDiscreteModel(
30-
# joinpath("../meshes/2.6/co-annulus_unstructured_4.msh")
31-
# )
32-
# # model_annulus = GmshDiscreteModel(
33-
# # joinpath("../meshes/2.6/co-annulus_structured_3.msh")
34-
# # )
35-
# else
36-
# # model_annulus = GmshDiscreteModel(
37-
# # joinpath("../meshes/2.6/co-annulus_unstructured_2.msh")
38-
# # )
39-
# model_annulus = GmshDiscreteModel(
40-
# joinpath("../meshes/2.6/co-annulus_structured_2.msh")
41-
# )
42-
# end
43-
44-
name = "con-annulus"
45-
46-
out1 = GeMotion.simulate(
47-
name=name,
48-
Pr=100,
49-
Ra=1e4,
50-
n=0.6,
51-
model=model_square,
52-
jac_scaling = 1,
53-
nlsolver_opts=(;
54-
show_trace=true,
55-
# method=:trust_region,
56-
# method=:anderson,
57-
# beta=0.01,
58-
# factor=0.1,
59-
# autoscale=false,
60-
method=:newton,
61-
# alphaguess=InitialStatic(alpha=1.0),
62-
linesearch=BackTracking(
63-
# order=3,
64-
# c_1=0.0,
65-
# ρ_hi=0.99,
66-
# ρ_lo=0.01,
67-
# iterations=2
68-
),
69-
# linesearch=HagerZhang(
70-
# display=1
71-
# ),
72-
# linesearch=Static(scaled=true),
73-
# linesearch=HagerZhang(),
74-
ftol=1E-8,
75-
xtol=1E-50,
76-
iterations=50,
77-
# extended_trace=true
78-
);
79-
nlsolver_custom_init_guess=[],
80-
# nlsolver_custom_init_guess=out1.result.free_values,
81-
# nlsolver_custom_init_guess=vcat(
82-
# zeros(size(out1.result[1].free_values)),
83-
# out1.result[2].free_values,
84-
# out1.result[3].free_values,
85-
# ),
86-
nlsolver_init_guess_type=:zero,
87-
# nlsolver_init_guess_type=:custom,
88-
wave...
114+
if haskey(ENV, "GITHUB_ACTIONS")
115+
model_annulus = GmshDiscreteModel(
116+
joinpath("../meshes/2.5/co-annulus_unstructured_2.msh")
117+
)
118+
# model_annulus = GmshDiscreteModel(
119+
# joinpath("../meshes/2.5/co-annulus_structured_3.msh")
120+
# )
121+
else
122+
# model_annulus = GmshDiscreteModel(
123+
# joinpath("../meshes/2.5/co-annulus_unstructured_3.msh")
124+
# )
125+
model_annulus = GmshDiscreteModel(
126+
joinpath("../meshes/2.5/co-annulus_structured_5.msh")
127+
)
128+
end
129+
uniform_annulus = (;
130+
T_diri_tags=["inner", "outer"],
131+
T_diri_expressions=[1.0, 0.0],
132+
V_diri_tags=["all"]
89133
)
90-
91-
out_post = GeMotion.plot_all_unitsquare(
92-
out1.psih, out1.Th, out1.uh, model_square, name, (T=[0.1 * i for i = 1:10], psi=[0.01,0.05,0.1,0.5,1.5,3.5,5.5,6]|>x->vcat(-x,x), Sth=[0.1,0.2,0.3,0.4,0.5,1.0,2,5], Sfl=vcat([0.1,1,10,50,100]))
134+
wave_annulus = (;
135+
T_diri_tags=["inner", "outer"],
136+
T_diri_expressions=[x->0.5*(sin(atan(x[2],x[1]))+1), 0.0],
137+
V_diri_tags=["all"]
93138
)
94-
1+1
95139

140+
paramlist = [
141+
# n, model, bcs, Sfl_lvls
142+
(0.6, model_annulus, uniform_annulus, [10.0^i for i=-2:1:2])
143+
(1.0, model_annulus, uniform_annulus, [4.0^i for i in -0:1:3])
144+
(1.4, model_annulus, uniform_annulus, [4.0^i for i in -0:1:3])
145+
(0.6, model_annulus, wave_annulus, [10.0^i for i=-2:1:2])
146+
(1.0, model_annulus, wave_annulus, [4.0^i for i in -2:1:3])
147+
(1.4, model_annulus, wave_annulus, [4.0^i for i in -2:1:3])
148+
]
149+
function mkcase(n, model, bcs, Sfl_lvls)
150+
(;n, model, bcs, Sfl_lvls)
151+
end
152+
cases = [
153+
mkcase(n, model, bcs, Sfl_lvls)
154+
for (n, model, bcs, Sfl_lvls) in paramlist
155+
]
156+
157+
outs = []
158+
for (i, case) in enumerate(cases)
159+
name = "annulus_$(i)_$(case.n)"
160+
161+
# initialize with a slightly increased n
162+
# this avoids "bad" solution for uniform n=1.0
163+
out = GeMotion.simulate(
164+
name=name,
165+
Pr=100,
166+
Ra=1e4,
167+
n=case.n+0.1,
168+
model=case.model,
169+
jac_scaling = 1,
170+
nlsolver_opts=(;
171+
show_trace=true,
172+
method=:newton,
173+
linesearch=BackTracking(),
174+
ftol=1E-8,
175+
xtol=1E-50,
176+
iterations=200,
177+
);
178+
nlsolver_custom_init_guess=[],
179+
nlsolver_init_guess_type=:zero,
180+
case.bcs...
181+
)
182+
183+
out = GeMotion.simulate(
184+
name=name,
185+
Pr=100,
186+
Ra=1e4,
187+
n=case.n,
188+
model=case.model,
189+
jac_scaling = 1,
190+
nlsolver_opts=(;
191+
show_trace=true,
192+
method=:newton,
193+
linesearch=BackTracking(),
194+
ftol=1E-8,
195+
xtol=1E-50,
196+
iterations=200,
197+
);
198+
nlsolver_custom_init_guess=out.result.free_values,
199+
nlsolver_init_guess_type=:custom,
200+
case.bcs...
201+
)
202+
push!(outs, out)
203+
# opts=(;ri=5/8,ro=13/8,eps=0.01,n_plot=100)
204+
opts=(;ri=2/3,ro=5/3,eps=0.01,n_plot=100)
205+
GeMotion.contourplot_coannulus(
206+
;opts...,
207+
fun=out.psih,
208+
name=name*"/psi",
209+
contourargs=(;levels=[2.0^i for i in -1:1:3]|>x->vcat(-x,x)),
210+
surfaceargs=(;colormap=:coolwarm)
211+
) |> display
212+
GeMotion.contourplot_coannulus(
213+
;opts...,
214+
fun=out.Th,
215+
name=name*"/T",
216+
contourargs=(;levels=0:0.1:1),
217+
surfaceargs=(;colormap=cmap_cold_to_hot_paraview())
218+
) |> display
219+
GeMotion.contourplot_coannulus(
220+
;opts...,
221+
fun=out.Sth,
222+
name=name*"/Sth",
223+
contourargs=(;levels=[4.0^i for i in -1:1:3]),
224+
surfaceargs=(;
225+
colormap=:Reds,
226+
)
227+
) |> display
228+
GeMotion.contourplot_coannulus(
229+
;opts...,
230+
fun=out.Sfl,
231+
name=name*"/Sfl",
232+
contourargs=(;levels=case.Sfl_lvls),
233+
surfaceargs=(;colormap=:Blues)
234+
) |> display
235+
end

0 commit comments

Comments
 (0)