Skip to content

Commit 0c7d801

Browse files
Update Tutorial 3 with new parameters
1 parent 5980a5d commit 0c7d801

16 files changed

+367
-182
lines changed

amrwind_frontend.py

+32
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,38 @@ def setupfigax(self, clear=True, subplot=111):
763763
from farmfunctions import sampling_createAllProbes
764764
from farmfunctions import sweep_SetupRunParamSweep
765765

766+
def getMaxLevel(self):
767+
max_level = 0
768+
# Search refinement levels
769+
allrefinements = self.listboxpopupwindict['listboxtagging']
770+
alltags = allrefinements.getitemlist()
771+
772+
#print(alltags)
773+
for tag in alltags:
774+
pdict = allrefinements.dumpdict('AMR-Wind',
775+
subset=[tag],
776+
keyfunc=lambda n, d1, d2: d2.name)
777+
# Handle the Cartesian Box Refinements
778+
if pdict['tagging_type'][0]=='CartBoxRefinement':
779+
filename = pdict['tagging_static_refinement_def']
780+
# Load the boxes
781+
allboxes = self.readCartBoxFile(filename)
782+
if len(allboxes)>max_level: max_level = len(allboxes)
783+
784+
if pdict['tagging_type'][0]=='GeometryRefinement':
785+
if pdict['tagging_geom_type'][0]=='box':
786+
ilevel = pdict['tagging_level']
787+
if (ilevel is not None) and ilevel+1>max_level:
788+
max_level = ilevel+1
789+
return max_level
790+
791+
def autoMaxLevel(self):
792+
"""
793+
Automatically set the maximum refinement level
794+
"""
795+
max_level = self.getMaxLevel()
796+
self.inputvars['max_level'].setval(max_level)
797+
return
766798

767799
def estimateMeshSize(self, **kwargs):
768800
# Get the domain size

docs/tutorial3/Tutorial3_Case_0.inp

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# --- Simulation time control parameters ---
22
time.stop_time = 100.0 # Max (simulated) time to evolve [s]
33
time.max_step = -1
4-
time.fixed_dt = 0.25 # Fixed timestep size (in seconds). If negative, then time.cfl is used
4+
time.fixed_dt = 0.1 # Fixed timestep size (in seconds). If negative, then time.cfl is used
55
incflo.physics = FreeStream Actuator # List of physics models to include in simulation.
66
incflo.verbose = 0
77
io.check_file = chk
@@ -18,14 +18,14 @@ ConstValue.velocity.value = 10.0 0.0 0.0
1818
geometry.prob_lo = 0.0 0.0 0.0
1919
geometry.prob_hi = 960.0 960.0 960.0
2020
amr.n_cell = 96 96 96 # Number of cells in x, y, and z directions
21-
amr.max_level = 0
21+
amr.max_level = 2
2222
geometry.is_periodic = 0 1 0
2323
xlo.type = mass_inflow
2424
xlo.density = 1.0
2525
xlo.velocity = 10.0 0.0 0.0
2626
xhi.type = pressure_outflow
27-
zlo.type = no_slip_wall
28-
zhi.type = no_slip_wall
27+
zlo.type = slip_wall
28+
zhi.type = slip_wall
2929

3030
# --- ABL parameters ---
3131
ICNS.source_terms = ActuatorForcing
@@ -39,6 +39,7 @@ incflo.post_processing = sampling
3939
# --- Sampling parameters ---
4040
sampling.output_frequency = 100
4141
sampling.fields = velocity
42+
Actuator.UniformCtDisk.density = 1.0
4243

4344
#---- sample defs ----
4445
sampling.labels = T0_cl1 T1_cl1 T0_rp1 T1_rp1 T0_sw1 T1_sw1 Farm_hh
@@ -52,35 +53,35 @@ sampling.T1_cl1.start = 364.0 680.0 80.0
5253
sampling.T1_cl1.end = 480.0 680.0 80.0
5354
sampling.T0_rp1.type = PlaneSampler
5455
sampling.T0_rp1.num_points = 11 11
55-
sampling.T0_rp1.origin = 248.0 338.0 22.0
56-
sampling.T0_rp1.axis1 = 0.0 -116.0 0.0
56+
sampling.T0_rp1.origin = 248.0 222.0 22.0
57+
sampling.T0_rp1.axis1 = -0.0 116.0 -0.0
5758
sampling.T0_rp1.axis2 = 0.0 0.0 116.0
5859
sampling.T0_rp1.normal = 0.0 0.0 0.0
5960
sampling.T1_rp1.type = PlaneSampler
6061
sampling.T1_rp1.num_points = 11 11
61-
sampling.T1_rp1.origin = 248.0 738.0 22.0
62-
sampling.T1_rp1.axis1 = 0.0 -116.0 0.0
62+
sampling.T1_rp1.origin = 248.0 622.0 22.0
63+
sampling.T1_rp1.axis1 = -0.0 116.0 -0.0
6364
sampling.T1_rp1.axis2 = 0.0 0.0 116.0
6465
sampling.T1_rp1.normal = 0.0 0.0 0.0
6566
sampling.T0_sw1.type = PlaneSampler
6667
sampling.T0_sw1.num_points = 13 5
6768
sampling.T0_sw1.origin = 248.0 280.0 22.0
6869
sampling.T0_sw1.axis1 = 348.0 0.0 0.0
6970
sampling.T0_sw1.axis2 = 0.0 0.0 116.0
70-
sampling.T0_sw1.normal = 0.0 -1.0 0.0
71+
sampling.T0_sw1.normal = -0.0 1.0 -0.0
7172
sampling.T0_sw1.offsets = 0.0 116.0
7273
sampling.T1_sw1.type = PlaneSampler
7374
sampling.T1_sw1.num_points = 13 5
7475
sampling.T1_sw1.origin = 248.0 680.0 22.0
7576
sampling.T1_sw1.axis1 = 348.0 0.0 0.0
7677
sampling.T1_sw1.axis2 = 0.0 0.0 116.0
77-
sampling.T1_sw1.normal = 0.0 -1.0 0.0
78+
sampling.T1_sw1.normal = -0.0 1.0 -0.0
7879
sampling.T1_sw1.offsets = 0.0 116.0
7980
sampling.Farm_hh.type = PlaneSampler
80-
sampling.Farm_hh.num_points = 13 9
81-
sampling.Farm_hh.origin = 248.0 364.0 80.0
82-
sampling.Farm_hh.axis1 = 348.0 0.0 0.0
83-
sampling.Farm_hh.axis2 = 0.0 232.0 0.0
81+
sampling.Farm_hh.num_points = 81 81
82+
sampling.Farm_hh.origin = 80.0 80.0 80.0
83+
sampling.Farm_hh.axis1 = 800.0 0.0 0.0
84+
sampling.Farm_hh.axis2 = 0.0 800.0 0.0
8485
sampling.Farm_hh.normal = 0.0 0.0 0.0
8586

8687
#---- tagging defs ----
@@ -89,33 +90,33 @@ tagging.T0_level_0_zone.type = GeometryRefinement
8990
tagging.T0_level_0_zone.shapes = T0_level_0_zone
9091
tagging.T0_level_0_zone.level = 0
9192
tagging.T0_level_0_zone.T0_level_0_zone.type = box
92-
tagging.T0_level_0_zone.T0_level_0_zone.origin = 364.0 396.0 -7.0
93+
tagging.T0_level_0_zone.T0_level_0_zone.origin = 364.0 164.0 -7.0
9394
tagging.T0_level_0_zone.T0_level_0_zone.xaxis = 232.0 0.0 0.0
94-
tagging.T0_level_0_zone.T0_level_0_zone.yaxis = 0.0 -232.0 0.0
95+
tagging.T0_level_0_zone.T0_level_0_zone.yaxis = -0.0 232.0 -0.0
9596
tagging.T0_level_0_zone.T0_level_0_zone.zaxis = 0.0 0.0 203.0
9697
tagging.T1_level_0_zone.type = GeometryRefinement
9798
tagging.T1_level_0_zone.shapes = T1_level_0_zone
9899
tagging.T1_level_0_zone.level = 0
99100
tagging.T1_level_0_zone.T1_level_0_zone.type = box
100-
tagging.T1_level_0_zone.T1_level_0_zone.origin = 364.0 796.0 -7.0
101+
tagging.T1_level_0_zone.T1_level_0_zone.origin = 364.0 564.0 -7.0
101102
tagging.T1_level_0_zone.T1_level_0_zone.xaxis = 232.0 0.0 0.0
102-
tagging.T1_level_0_zone.T1_level_0_zone.yaxis = 0.0 -232.0 0.0
103+
tagging.T1_level_0_zone.T1_level_0_zone.yaxis = -0.0 232.0 -0.0
103104
tagging.T1_level_0_zone.T1_level_0_zone.zaxis = 0.0 0.0 203.0
104105
tagging.T0_level_1_zone.type = GeometryRefinement
105106
tagging.T0_level_1_zone.shapes = T0_level_1_zone
106107
tagging.T0_level_1_zone.level = 1
107108
tagging.T0_level_1_zone.T0_level_1_zone.type = box
108-
tagging.T0_level_1_zone.T0_level_1_zone.origin = 422.0 338.0 -7.0
109+
tagging.T0_level_1_zone.T0_level_1_zone.origin = 422.0 222.0 -7.0
109110
tagging.T0_level_1_zone.T0_level_1_zone.xaxis = 116.0 0.0 0.0
110-
tagging.T0_level_1_zone.T0_level_1_zone.yaxis = 0.0 -116.0 0.0
111+
tagging.T0_level_1_zone.T0_level_1_zone.yaxis = -0.0 116.0 -0.0
111112
tagging.T0_level_1_zone.T0_level_1_zone.zaxis = 0.0 0.0 203.0
112113
tagging.T1_level_1_zone.type = GeometryRefinement
113114
tagging.T1_level_1_zone.shapes = T1_level_1_zone
114115
tagging.T1_level_1_zone.level = 1
115116
tagging.T1_level_1_zone.T1_level_1_zone.type = box
116-
tagging.T1_level_1_zone.T1_level_1_zone.origin = 422.0 738.0 -7.0
117+
tagging.T1_level_1_zone.T1_level_1_zone.origin = 422.0 622.0 -7.0
117118
tagging.T1_level_1_zone.T1_level_1_zone.xaxis = 116.0 0.0 0.0
118-
tagging.T1_level_1_zone.T1_level_1_zone.yaxis = 0.0 -116.0 0.0
119+
tagging.T1_level_1_zone.T1_level_1_zone.yaxis = -0.0 116.0 -0.0
119120
tagging.T1_level_1_zone.T1_level_1_zone.zaxis = 0.0 0.0 203.0
120121

121122
#---- actuator defs ----

docs/tutorial3/Tutorial3_Case_1.inp

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# --- Simulation time control parameters ---
22
time.stop_time = 100.0 # Max (simulated) time to evolve [s]
33
time.max_step = -1
4-
time.fixed_dt = 0.25 # Fixed timestep size (in seconds). If negative, then time.cfl is used
4+
time.fixed_dt = 0.1 # Fixed timestep size (in seconds). If negative, then time.cfl is used
55
incflo.physics = FreeStream Actuator # List of physics models to include in simulation.
66
incflo.verbose = 0
77
io.check_file = chk
@@ -18,7 +18,7 @@ ConstValue.velocity.value = 7.07106781187 7.07106781187 0.0
1818
geometry.prob_lo = 0.0 0.0 0.0
1919
geometry.prob_hi = 960.0 960.0 960.0
2020
amr.n_cell = 96 96 96 # Number of cells in x, y, and z directions
21-
amr.max_level = 0
21+
amr.max_level = 2
2222
geometry.is_periodic = 0 0 0
2323
xlo.type = mass_inflow
2424
xlo.density = 1.0
@@ -30,8 +30,8 @@ ylo.density = 1.0
3030
ylo.velocity = 7.07106781187 7.07106781187 0.0
3131
yhi.type = pressure_outflow
3232
yhi.temperature_type = fixed_gradient
33-
zlo.type = no_slip_wall
34-
zhi.type = no_slip_wall
33+
zlo.type = slip_wall
34+
zhi.type = slip_wall
3535

3636
# --- ABL parameters ---
3737
ICNS.source_terms = ActuatorForcing
@@ -45,6 +45,7 @@ incflo.post_processing = sampling
4545
# --- Sampling parameters ---
4646
sampling.output_frequency = 100
4747
sampling.fields = velocity
48+
Actuator.UniformCtDisk.density = 1.0
4849

4950
#---- sample defs ----
5051
sampling.labels = T0_cl1 T1_cl1 T0_rp1 T1_rp1 T0_sw1 T1_sw1 Farm_hh
@@ -58,35 +59,35 @@ sampling.T1_cl1.start = 397.975613382 597.975613382 80.0
5859
sampling.T1_cl1.end = 480.0 680.0 80.0
5960
sampling.T0_rp1.type = PlaneSampler
6061
sampling.T0_rp1.num_points = 11 11
61-
sampling.T0_rp1.origin = 274.939033456 156.963420074 22.0
62-
sampling.T0_rp1.axis1 = 82.0243866176 -82.0243866176 0.0
62+
sampling.T0_rp1.origin = 356.963420074 74.9390334559 22.0
63+
sampling.T0_rp1.axis1 = -82.0243866176 82.0243866176 -0.0
6364
sampling.T0_rp1.axis2 = 0.0 0.0 116.0
6465
sampling.T0_rp1.normal = 0.0 0.0 0.0
6566
sampling.T1_rp1.type = PlaneSampler
6667
sampling.T1_rp1.num_points = 11 11
67-
sampling.T1_rp1.origin = 274.939033456 556.963420074 22.0
68-
sampling.T1_rp1.axis1 = 82.0243866176 -82.0243866176 0.0
68+
sampling.T1_rp1.origin = 356.963420074 474.939033456 22.0
69+
sampling.T1_rp1.axis1 = -82.0243866176 82.0243866176 -0.0
6970
sampling.T1_rp1.axis2 = 0.0 0.0 116.0
7071
sampling.T1_rp1.normal = 0.0 0.0 0.0
7172
sampling.T0_sw1.type = PlaneSampler
7273
sampling.T0_sw1.num_points = 13 5
7374
sampling.T0_sw1.origin = 315.951226765 115.951226765 22.0
7475
sampling.T0_sw1.axis1 = 246.073159853 246.073159853 0.0
7576
sampling.T0_sw1.axis2 = 0.0 0.0 116.0
76-
sampling.T0_sw1.normal = 0.707106781187 -0.707106781187 0.0
77+
sampling.T0_sw1.normal = -0.707106781187 0.707106781187 -0.0
7778
sampling.T0_sw1.offsets = 0.0 116.0
7879
sampling.T1_sw1.type = PlaneSampler
7980
sampling.T1_sw1.num_points = 13 5
8081
sampling.T1_sw1.origin = 315.951226765 515.951226765 22.0
8182
sampling.T1_sw1.axis1 = 246.073159853 246.073159853 0.0
8283
sampling.T1_sw1.axis2 = 0.0 0.0 116.0
83-
sampling.T1_sw1.normal = 0.707106781187 -0.707106781187 0.0
84+
sampling.T1_sw1.normal = -0.707106781187 0.707106781187 -0.0
8485
sampling.T1_sw1.offsets = 0.0 116.0
8586
sampling.Farm_hh.type = PlaneSampler
86-
sampling.Farm_hh.num_points = 13 9
87-
sampling.Farm_hh.origin = 248.0 364.0 80.0
88-
sampling.Farm_hh.axis1 = 348.0 0.0 0.0
89-
sampling.Farm_hh.axis2 = 0.0 232.0 0.0
87+
sampling.Farm_hh.num_points = 81 81
88+
sampling.Farm_hh.origin = 80.0 80.0 80.0
89+
sampling.Farm_hh.axis1 = 800.0 0.0 0.0
90+
sampling.Farm_hh.axis2 = 0.0 800.0 0.0
9091
sampling.Farm_hh.normal = 0.0 0.0 0.0
9192

9293
#---- tagging defs ----
@@ -95,33 +96,33 @@ tagging.T0_level_0_zone.type = GeometryRefinement
9596
tagging.T0_level_0_zone.shapes = T0_level_0_zone
9697
tagging.T0_level_0_zone.level = 0
9798
tagging.T0_level_0_zone.T0_level_0_zone.type = box
98-
tagging.T0_level_0_zone.T0_level_0_zone.origin = 315.951226765 280.0 -7.0
99+
tagging.T0_level_0_zone.T0_level_0_zone.origin = 480.0 115.951226765 -7.0
99100
tagging.T0_level_0_zone.T0_level_0_zone.xaxis = 164.048773235 164.048773235 0.0
100-
tagging.T0_level_0_zone.T0_level_0_zone.yaxis = 164.048773235 -164.048773235 0.0
101+
tagging.T0_level_0_zone.T0_level_0_zone.yaxis = -164.048773235 164.048773235 -0.0
101102
tagging.T0_level_0_zone.T0_level_0_zone.zaxis = 0.0 0.0 203.0
102103
tagging.T1_level_0_zone.type = GeometryRefinement
103104
tagging.T1_level_0_zone.shapes = T1_level_0_zone
104105
tagging.T1_level_0_zone.level = 0
105106
tagging.T1_level_0_zone.T1_level_0_zone.type = box
106-
tagging.T1_level_0_zone.T1_level_0_zone.origin = 315.951226765 680.0 -7.0
107+
tagging.T1_level_0_zone.T1_level_0_zone.origin = 480.0 515.951226765 -7.0
107108
tagging.T1_level_0_zone.T1_level_0_zone.xaxis = 164.048773235 164.048773235 0.0
108-
tagging.T1_level_0_zone.T1_level_0_zone.yaxis = 164.048773235 -164.048773235 0.0
109+
tagging.T1_level_0_zone.T1_level_0_zone.yaxis = -164.048773235 164.048773235 -0.0
109110
tagging.T1_level_0_zone.T1_level_0_zone.zaxis = 0.0 0.0 203.0
110111
tagging.T0_level_1_zone.type = GeometryRefinement
111112
tagging.T0_level_1_zone.shapes = T0_level_1_zone
112113
tagging.T0_level_1_zone.level = 1
113114
tagging.T0_level_1_zone.T0_level_1_zone.type = box
114-
tagging.T0_level_1_zone.T0_level_1_zone.origin = 397.975613382 280.0 -7.0
115+
tagging.T0_level_1_zone.T0_level_1_zone.origin = 480.0 197.975613382 -7.0
115116
tagging.T0_level_1_zone.T0_level_1_zone.xaxis = 82.0243866176 82.0243866176 0.0
116-
tagging.T0_level_1_zone.T0_level_1_zone.yaxis = 82.0243866176 -82.0243866176 0.0
117+
tagging.T0_level_1_zone.T0_level_1_zone.yaxis = -82.0243866176 82.0243866176 -0.0
117118
tagging.T0_level_1_zone.T0_level_1_zone.zaxis = 0.0 0.0 203.0
118119
tagging.T1_level_1_zone.type = GeometryRefinement
119120
tagging.T1_level_1_zone.shapes = T1_level_1_zone
120121
tagging.T1_level_1_zone.level = 1
121122
tagging.T1_level_1_zone.T1_level_1_zone.type = box
122-
tagging.T1_level_1_zone.T1_level_1_zone.origin = 397.975613382 680.0 -7.0
123+
tagging.T1_level_1_zone.T1_level_1_zone.origin = 480.0 597.975613382 -7.0
123124
tagging.T1_level_1_zone.T1_level_1_zone.xaxis = 82.0243866176 82.0243866176 0.0
124-
tagging.T1_level_1_zone.T1_level_1_zone.yaxis = 82.0243866176 -82.0243866176 0.0
125+
tagging.T1_level_1_zone.T1_level_1_zone.yaxis = -82.0243866176 82.0243866176 -0.0
125126
tagging.T1_level_1_zone.T1_level_1_zone.zaxis = 0.0 0.0 203.0
126127

127128
#---- actuator defs ----

0 commit comments

Comments
 (0)