@@ -8,9 +8,10 @@ using CairoMakie
88using Colors
99using FileIO
1010
11+
1112# 1)
1213model_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
1617uniform = (;
@@ -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