Skip to content

Commit 5bfa1b1

Browse files
committed
prints values to file for plotting and aligns timestep with WW3
1 parent b2cdb81 commit 5bfa1b1

File tree

6 files changed

+61
-38
lines changed

6 files changed

+61
-38
lines changed

Exec/ABL/inputs_most

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
# ------------------ INPUTS TO MAIN PROGRAM -------------------
2-
max_step = 4000
2+
max_step = 3000
33

44
amrex.fpe_trap_invalid = 1
55

66
fabarray.mfiter_tile_size = 1024 1024 1024
77

88
# PROBLEM SIZE & GEOMETRY
9-
geometry.prob_extent = 1024 1024 1024
10-
amr.n_cell = 64 64 64
9+
geometry.prob_extent = 1025000 1025000 1024
10+
amr.n_cell = 41 41 4
1111

1212
geometry.is_periodic = 1 1 0
1313

1414
# MOST BOUNDARY (DEFAULT IS ADIABATIC FOR THETA)
1515
zlo.type = "Most"
16-
erf.most.z0 = 0.1
17-
erf.most.zref = 8.0
18-
16+
erf.most.z0 = 0.01
17+
erf.most.zref = 128.0
1918
zhi.type = "SlipWall"
2019

2120
# TIME STEP CONTROL
22-
erf.fixed_dt = 0.1 # fixed time step depending on grid resolution
21+
erf.fixed_dt = 6 # fixed time step depending on grid resolution
2322

2423
# DIAGNOSTICS & VERBOSITY
2524
erf.sum_interval = 1 # timesteps between computing mass
@@ -35,7 +34,7 @@ erf.check_int = 100 # number of timesteps between checkpoints
3534

3635
# PLOTFILES
3736
erf.plot_file_1 = plt # prefix of plotfile name
38-
erf.plot_int_1 = 10 # number of timesteps between plotfiles
37+
erf.plot_int_1 = 100 # number of timesteps between plotfiles
3938
erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta
4039

4140
# SOLVER CHOICE
@@ -60,6 +59,12 @@ prob.T_0 = 300.0
6059

6160
# Higher values of perturbations lead to instability
6261
# Instability seems to be coming from BC
63-
prob.U_0_Pert_Mag = 0.08
64-
prob.V_0_Pert_Mag = 0.08 #
62+
prob.U_0_Pert_Mag = 0.2
63+
prob.V_0_Pert_Mag = 0.2 #
6564
prob.W_0_Pert_Mag = 0.0
65+
66+
# MOST BOUNDARY (DEFAULT IS ADIABATIC FOR THETA)
67+
zlo.type = "Most"
68+
# erf.most.z0 = 0.1 Don't set z0
69+
#erf.most.zref = 128.0
70+
#erf.most.roughness_type = "modified_charnock"

Exec/ABL/inputs_most_test

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# ------------------ INPUTS TO MAIN PROGRAM -------------------
2-
max_step = 200
2+
max_step = 8
33

44
amrex.fpe_trap_invalid = 1
55

66
fabarray.mfiter_tile_size = 1024 1024 1024
77

88
# PROBLEM SIZE & GEOMETRY
9-
geometry.prob_extent = 256 256 256
10-
amr.n_cell = 16 16 16
9+
geometry.prob_extent = 41 41 1024
10+
amr.n_cell = 41 41 4
1111

1212
geometry.is_periodic = 1 1 0
1313

@@ -20,8 +20,8 @@ erf.most.average_policy = 0 # POLICY FOR AVERAGING
2020
#erf.most.use_normal_vector = true # USE NORMAL VECTOR W/ TERRAIN
2121
#erf.most.time_average = true # USE TIME AVERAGING
2222
#-----------------------------------------------------------------
23-
erf.most.z0 = 4.0 # SURFACE ROUGHNESS
24-
erf.most.zref = 8.0 # QUERY DISTANCE (HEIGHT OR NORM LENGTH)
23+
#erf.most.z0 = 4.0 # SURFACE ROUGHNESS
24+
erf.most.zref = 128.0 # QUERY DISTANCE (HEIGHT OR NORM LENGTH)
2525
#-----------------------------------------------------------------
2626
#erf.most.surf_temp = 301.0 # SPECIFIED SURFACE TEMP
2727
#erf.most.surf_temp_flux = 8.14165 # SPECIFIED SURFACE FLUX
@@ -33,7 +33,7 @@ erf.most.zref = 8.0 # QUERY DISTANCE (HEIGHT OR NORM LENGTH)
3333

3434

3535
# TIME STEP CONTROL
36-
erf.fixed_dt = 0.1 # fixed time step depending on grid resolution
36+
erf.fixed_dt = 1 # fixed time step depending on grid resolution
3737

3838
# DIAGNOSTICS & VERBOSITY
3939
erf.sum_interval = 1 # timesteps between computing mass

Exec/DevTests/ABL_with_WW3/inputs_mpmd

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
# ------------------ INPUTS TO MAIN PROGRAM -------------------
2-
max_step = 8
2+
max_step = 3000
33

44
amrex.fpe_trap_invalid = 0
55

66
fabarray.mfiter_tile_size = 1024 1024 1024
77

88
# PROBLEM SIZE & GEOMETRY
9-
geometry.prob_extent = 41 41 1024
9+
geometry.prob_extent = 1025000 1025000 1024
1010
amr.n_cell = 41 41 4
11+
#geometry.prob_extent = 191 91 1024
12+
#amr.n_cell = 191 91 4
13+
#geometry.prob_extent = 223 104 1024
14+
#amr.n_cell = 223 104 10
1115

1216
geometry.is_periodic = 1 1 0
1317

1418
zlo.type = "NoSlipWall"
1519
zhi.type = "SlipWall"
1620

1721
# TIME STEP CONTROL
18-
erf.fixed_dt = 1 # fixed time step depending on grid resolution
19-
erf.max_step=8
22+
erf.fixed_dt = 6 # fixed time step depending on grid resolution
2023
# DIAGNOSTICS & VERBOSITY
2124
erf.sum_interval = 1 # timesteps between computing mass
2225
erf.v = 1 # verbosity in ERF.cpp
@@ -31,7 +34,7 @@ erf.check_int = 100 # number of timesteps between checkpoints
3134

3235
# PLOTFILES
3336
erf.plot_file_1 = plt # prefix of plotfile name
34-
erf.plot_int_1 = 10 # number of timesteps between plotfiles
37+
erf.plot_int_1 = 50 # number of timesteps between plotfiles
3538
erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta
3639

3740
# SOLVER CHOICE
@@ -62,7 +65,7 @@ prob.T_0 = 300.0
6265

6366
# Higher values of perturbations lead to instability
6467
# Instability seems to be coming from BC
65-
prob.U_0_Pert_Mag = 0.08
66-
prob.V_0_Pert_Mag = 0.08 #
68+
prob.U_0_Pert_Mag = 0.2
69+
prob.V_0_Pert_Mag = 0.2 #
6770
prob.W_0_Pert_Mag = 0.0
6871

Source/BoundaryConditions/MOSTStress.H

+13-2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ struct adiabatic
9494
const amrex::Array4<amrex::Real>& /*eta_arr*/) const
9595
{
9696
u_star_arr(i,j,k) = mdata.kappa * umm_arr(i,j,k) / std::log(mdata.zref / z0_arr(i,j,k));
97+
amrex::AllPrintToFile("u_star_constant1.txt") << "(" << i << ", " << j << ", " << k << ") " << u_star_arr(i,j,k) << std::endl;
98+
amrex::AllPrintToFile("u_star_constant2.txt") << u_star_arr(i,j,k) << std::endl;
99+
//amrex::Print() << "constant case" << std::endl;
100+
97101
t_star_arr(i,j,k) = 0.0;
98102
olen_arr(i,j,k) = 1.0e16;
99103
}
@@ -146,7 +150,7 @@ struct adiabatic_charnock
146150
u_star_arr(i,j,k) = mdata.kappa * umm_arr(i,j,k) / std::log(mdata.zref / z0);
147151
++iter;
148152
} while ((std::abs(u_star_arr(i,j,k) - ustar) > tol) && iter <= max_iters);
149-
153+
amrex::Print() << "charnock case" << std::endl;
150154
t_star_arr(i,j,k) = 0.0;
151155
olen_arr(i,j,k) = 1.0e16;
152156
z0_arr(i,j,k) = z0;
@@ -202,7 +206,7 @@ struct adiabatic_mod_charnock
202206
u_star_arr(i,j,k) = mdata.kappa * umm_arr(i,j,k) / std::log(mdata.zref / z0);
203207
++iter;
204208
} while ((std::abs(u_star_arr(i,j,k) - ustar) > tol) && iter <= max_iters);
205-
209+
amrex::Print() << "modified charnock case" << std::endl;
206210
t_star_arr(i,j,k) = 0.0;
207211
olen_arr(i,j,k) = 1.0e16;
208212
z0_arr(i,j,k) = z0;
@@ -249,6 +253,7 @@ struct adiabatic_wave_coupled
249253
amrex::Real ustar = 0.0;
250254
amrex::Real z0 = 0.0;
251255
int ie, je;
256+
252257
ie = i < lbound(eta_arr).x ? lbound(eta_arr).x : i;
253258
je = j < lbound(eta_arr).y ? lbound(eta_arr).y : j;
254259
ie = ie > ubound(eta_arr).x ? ubound(eta_arr).x : ie;
@@ -262,9 +267,15 @@ struct adiabatic_wave_coupled
262267
++iter;
263268
} while ((std::abs(u_star_arr(i,j,k) - ustar) > tol) && iter <= max_iters);
264269

270+
//amrex::AllPrintToFile("u_star.txt") << "(i,j,k) = (" << i << ", " << j << ", " << k << ") U_STAR = " << u_star_arr(i,j,k) << std::endl;
271+
//amrex::Print() << "waves case" << std::endl;
265272
t_star_arr(i,j,k) = 0.0;
266273
olen_arr(i,j,k) = 1.0e16;
267274
z0_arr(i,j,k) = z0;
275+
276+
amrex::AllPrintToFile("u_star.txt") << u_star_arr(i,j,k) << std::endl;
277+
amrex::AllPrintToFile("hwave_test.txt") << Hwave_arr(i,j,k) << std::endl;
278+
amrex::AllPrintToFile("z0.txt") << z0_arr(i,j,k) << std::endl;
268279
}
269280

270281
private:

Source/ERF_read_waves.cpp

+9-13
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ ERF::read_waves (int lev)
2525
//amrex::Print() << " Just called ERF::read_waves to receive from WW3 " << bx << std::endl;
2626
amrex::Array4<Real> my_H_arr = Hwave_onegrid[lev]->array(mfi);
2727
amrex::Array4<Real> my_L_arr = Lwave_onegrid[lev]->array(mfi);
28+
/*
2829
amrex::Print() << "my Valid box: (orig) ("
2930
<< bx.smallEnd(0) << ", " << bx.smallEnd(1) << ") to ("
3031
<< bx.bigEnd(0) << ", " << bx.bigEnd(1) << ")" << std::endl;
32+
*/
3133
Real* my_H_ptr = my_H_arr.dataPtr();
3234
Real* my_L_ptr = my_L_arr.dataPtr();
3335

@@ -95,7 +97,7 @@ ERF::read_waves (int lev)
9597
int ny = bx.length(1);
9698
std::vector<amrex::Real> temp_bufferH(nx * ny, 1.0);
9799
std::vector<amrex::Real> temp_bufferL(nx * ny, 1.0);
98-
amrex::AllPrint() << " NX ,NY: " << nx << " " << ny << std::endl;
100+
//amrex::AllPrint() << " NX ,NY: " << nx << " " << ny << std::endl;
99101
//amrex::AllPrint() << "temp_bufferH size:" << temp_bufferH.size() << " from rank " << amrex::ParallelDescriptor::MyProc() << std::endl;
100102
//amrex::AllPrint() << " temp_buffer size: " << temp_buffer.size() << " my rank is " << amrex::MPMD::MyProc()<<std::endl;
101103

@@ -104,9 +106,9 @@ ERF::read_waves (int lev)
104106
const Array4<Real const>& arr_onegridH = Hwave_onegrid[lev]->const_array(mfi);
105107
int index = 0;
106108
const Box& bx = mfi.validbox();
107-
amrex::Print() << "my Valid box: ("
109+
/* amrex::Print() << "my Valid box: ("
108110
<< bx.smallEnd(0) << ", " << bx.smallEnd(1) << ") to ("
109-
<< bx.bigEnd(0) << ", " << bx.bigEnd(1) << ")" << std::endl;
111+
<< bx.bigEnd(0) << ", " << bx.bigEnd(1) << ")" << std::endl;*/
110112
for (int j = 0; j < ny; ++j) {
111113
for (int i = 0; i < nx; ++i) {
112114
amrex::AllPrintToFile("debug_index.txt")<< index << " i, j: "<< i << ", " << j << " j "<< arr_onegridH(i, j, 0)<<std::endl;
@@ -131,14 +133,14 @@ ERF::read_waves (int lev)
131133

132134
ParallelDescriptor::Barrier();
133135
amrex::ParallelDescriptor::Bcast(temp_bufferL.data(), temp_bufferL.size(), 0);
134-
136+
/*
135137
for (int i = 0; i < 25; ++i){
136138
amrex::Print() << i << " temp_buffer from rank " << amrex::ParallelDescriptor::MyProc() << " (after) " << temp_bufferH[i] << std::endl;
137139
}
138-
140+
*/
139141

140142
ParallelDescriptor::Barrier();
141-
amrex::Print() << " temp_bufferH.size: " << temp_bufferH.size() << std::endl;
143+
//amrex::Print() << " temp_bufferH.size: " << temp_bufferH.size() << std::endl;
142144

143145
for (MFIter mfi(*Hwave[lev]); mfi.isValid(); ++mfi) {
144146
const Box& bx = mfi.validbox();
@@ -148,16 +150,10 @@ for (MFIter mfi(*Hwave[lev]); mfi.isValid(); ++mfi) {
148150
const Box& domain_box = geom_at_level.Domain();
149151
int NX = domain_box.length(0);
150152
int NY = domain_box.length(1);
151-
amrex::AllPrint() << " BIG NX ,NY: " << nx << " " << ny <<" my rank is " << amrex::ParallelDescriptor::MyProc()<< std::endl;
153+
//amrex::AllPrint() << " BIG NX ,NY: " << nx << " " << ny <<" my rank is " << amrex::ParallelDescriptor::MyProc()<< std::endl;
152154

153155
int nx = bx.length(0);
154156
int ny = bx.length(1);
155-
amrex::AllPrint() << " small nx ,ny: " << nx << " " << ny <<" my rank is " << amrex::ParallelDescriptor::MyProc()<< std::endl;
156-
amrex::AllPrint() << " arr_hwave size: " << arr_hwave.size() << " my rank is " << amrex::ParallelDescriptor::MyProc()<< std::endl;
157-
amrex::AllPrint() << "my Valid box: ("
158-
<< bx.smallEnd(0) << ", " << bx.smallEnd(1) << ") to ("
159-
<< bx.bigEnd(0) << ", " << bx.bigEnd(1) << ")" << " my rank is " << amrex::ParallelDescriptor::MyProc() << std::endl;
160-
161157

162158
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) {
163159
// Calculate the global index for the temp_buffer

Source/TimeIntegration/ERF_TimeStep.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ ERF::timeStep (int lev, Real time, int /*iteration*/)
6363
<< " with dt = " << dt[lev] << std::endl;
6464
}
6565

66+
int M = 100;
67+
static int step_counter = 0;
68+
step_counter++;
69+
70+
if (step_counter == M){
6671
#ifdef ERF_USE_WW3_COUPLING
6772
amrex::Print() << " About to call send_to_ww3 from ERF_Timestep" << std::endl;
6873
send_to_ww3(lev);
@@ -72,6 +77,9 @@ ERF::timeStep (int lev, Real time, int /*iteration*/)
7277
//read_waves(lev);
7378
//send_to_ww3(lev);
7479
#endif
80+
step_counter = 0;
81+
}
82+
7583

7684
// Advance a single level for a single time step
7785
Advance(lev, time, dt[lev], istep[lev], nsubsteps[lev]);

0 commit comments

Comments
 (0)