-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into LandSeaTemplate
- Loading branch information
Showing
10 changed files
with
251 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# ------------------ INPUTS TO MAIN PROGRAM ------------------- | ||
max_step = 5 | ||
|
||
amrex.fpe_trap_invalid = 0 | ||
|
||
fabarray.mfiter_tile_size = 1024 1024 1024 | ||
|
||
# PROBLEM SIZE & GEOMETRY | ||
geometry.prob_extent = 191000 91000 1024 | ||
amr.n_cell = 191 91 4 | ||
|
||
geometry.is_periodic = 1 1 0 | ||
|
||
zlo.type = "NoSlipWall" | ||
zhi.type = "SlipWall" | ||
|
||
# TIME STEP CONTROL | ||
erf.fixed_dt = 10 # fixed time step depending on grid resolution | ||
erf.max_step=1 | ||
# DIAGNOSTICS & VERBOSITY | ||
erf.sum_interval = 1 # timesteps between computing mass | ||
erf.v = 1 # verbosity in ERF.cpp | ||
amr.v = 1 # verbosity in Amr.cpp | ||
|
||
# REFINEMENT / REGRIDDING | ||
amr.max_level = 0 # maximum level number allowed | ||
|
||
# CHECKPOINT FILES | ||
erf.check_file = chk # root name of checkpoint file | ||
erf.check_int = 100 # number of timesteps between checkpoints | ||
|
||
# PLOTFILES | ||
erf.plot_file_1 = plt # prefix of plotfile name | ||
erf.plot_int_1 = 10 # number of timesteps between plotfiles | ||
erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta | ||
|
||
# SOLVER CHOICE | ||
erf.alpha_T = 0.0 | ||
erf.alpha_C = 1.0 | ||
erf.use_gravity = false | ||
|
||
erf.molec_diff_type = "None" | ||
erf.les_type = "Smagorinsky" | ||
erf.Cs = 0.1 | ||
|
||
erf.init_type = "uniform" | ||
|
||
# MOST BOUNDARY (DEFAULT IS ADIABATIC FOR THETA) | ||
zlo.type = "Most" | ||
# erf.most.z0 = 0.1 Don't set z0 | ||
erf.most.zref = 128.0 # set 1/2 of the vertical dz: 1024 / 4 = 256 -> 256/2 = 128 | ||
erf.most.roughness_type_sea = wave_coupled | ||
|
||
# PROBLEM PARAMETERS | ||
prob.rho_0 = 1.0 | ||
prob.A_0 = 1.0 | ||
|
||
prob.U_0 = 10.0 | ||
prob.V_0 = 0.0 | ||
prob.W_0 = 0.0 | ||
prob.T_0 = 300.0 | ||
|
||
# Higher values of perturbations lead to instability | ||
# Instability seems to be coming from BC | ||
prob.U_0_Pert_Mag = 0.08 | ||
prob.V_0_Pert_Mag = 0.08 # | ||
prob.W_0_Pert_Mag = 0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#ifdef ERF_USE_WW3_COUPLING | ||
|
||
#include <ERF.H> | ||
#include <Utils.H> | ||
#include <mpi.h> | ||
#include <AMReX_MPMD.H> | ||
|
||
using namespace amrex; | ||
|
||
void | ||
ERF::read_waves (int lev) | ||
{ | ||
for ( MFIter mfi(*Hwave_onegrid[lev],false); mfi.isValid(); ++mfi) | ||
{ | ||
//auto my_H_ptr = Hwave[lev]->array(mfi); | ||
//auto my_L_ptr = Lwave[lev]->array(mfi); | ||
const auto & bx = mfi.validbox(); | ||
|
||
amrex::Print() << " HERE " << bx << std::endl; | ||
// How to declare my_H_ptr directly? | ||
amrex::Array4<Real> my_H_arr = Hwave_onegrid[lev]->array(mfi); | ||
amrex::Array4<Real> my_L_arr = Lwave_onegrid[lev]->array(mfi); | ||
|
||
Real* my_H_ptr = my_H_arr.dataPtr(); | ||
Real* my_L_ptr = my_L_arr.dataPtr(); | ||
|
||
int rank_offset = amrex::MPMD::MyProc() - amrex::ParallelDescriptor::MyProc(); | ||
int this_root, other_root; | ||
if (rank_offset == 0) { // First program | ||
this_root = 0; | ||
other_root = amrex::ParallelDescriptor::NProcs(); | ||
} else { | ||
this_root = rank_offset; | ||
other_root = 0; | ||
} | ||
|
||
|
||
int nx=2147483647; // sanity check | ||
int ny=2147483647; // sanity check | ||
|
||
//JUST RECV | ||
if (amrex::MPMD::MyProc() == this_root) { | ||
if (rank_offset == 0) // the first program | ||
{ | ||
MPI_Recv(&nx, 1, MPI_INT, other_root, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
MPI_Recv(&ny, 1, MPI_INT, other_root, 7, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
} | ||
else // the second program | ||
{ | ||
MPI_Recv(&nx, 1, MPI_INT, other_root, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
MPI_Recv(&ny, 1, MPI_INT, other_root, 6, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
} | ||
//This may not be necessary | ||
ParallelDescriptor::Bcast(&nx, 1); | ||
ParallelDescriptor::Bcast(&ny, 1); | ||
} | ||
if((nx)*(ny) > 0) { | ||
int nsealm = (nx)*ny; | ||
Print()<<nsealm<<std::endl; | ||
Print()<<" NX = " << nx<<std::endl; | ||
Print()<<" Ny = " << ny<<std::endl; | ||
Print()<<" BX NPTS = " << bx.numPts() <<std::endl; | ||
Print()<<" BX = " << bx <<std::endl; | ||
// Print()<<" FAB NPTS = " << Hwave_onegrid[0]->array(mfi).size() <<std::endl; | ||
Print()<<" FAB NPTS = " << (*Hwave_onegrid[0])[0].box().numPts()<<std::endl; | ||
Print()<<" FAB = " << (*Hwave_onegrid[0])[0].box() <<std::endl; | ||
// AMREX_ALWAYS_ASSERT_WITH_MESSAGE((nx)*ny <= bx.numPts() || bx.numPts() == 0, "total number of points being filled exceeds the size of the current box\n"); | ||
|
||
if (amrex::MPMD::MyProc() == this_root) { | ||
if (rank_offset == 0) // the first program | ||
{ | ||
MPI_Recv(my_H_ptr, nsealm, MPI_DOUBLE, other_root, 3, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
MPI_Recv(my_L_ptr, nsealm, MPI_DOUBLE, other_root, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
} | ||
else // the second program | ||
{ | ||
MPI_Recv(my_H_ptr, nsealm, MPI_DOUBLE, other_root, 2, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
MPI_Recv(my_L_ptr, nsealm, MPI_DOUBLE, other_root, 4, MPI_COMM_WORLD, MPI_STATUS_IGNORE); | ||
} | ||
} | ||
amrex::Print()<<"Just recieved "<<nsealm<<"as a double*"<<std::endl; | ||
|
||
if(bx.contains(IntVect(192,2,0))) { | ||
std::cout<<my_H_arr(192,92,0)<<std::endl; | ||
std::cout<<my_L_arr(192,92,0)<<std::endl; | ||
std::cout<<my_H_ptr[192-0+(92-0)*193]<<std::endl; | ||
std::cout<<my_L_ptr[192-0+(92-0)*193]<<std::endl; | ||
} | ||
amrex::AllPrintToFile("output_HS_cpp.txt")<<FArrayBox(my_H_arr)<<std::endl; | ||
amrex::AllPrintToFile("output_L_cpp.txt")<<FArrayBox(my_L_arr)<<std::endl; | ||
} else { | ||
finished_wave = true; | ||
} | ||
} | ||
//May need to be Redistribute | ||
// ParallelCopy(Hwave[lev],Hwave_onegrid[lev],0,0,1,0); | ||
Hwave[lev]->ParallelCopy(*Hwave_onegrid[lev]); | ||
Hwave[lev]->FillBoundary(geom[lev].periodicity()); | ||
Lwave[lev]->ParallelCopy(*Lwave_onegrid[lev]); | ||
Lwave[lev]->FillBoundary(geom[lev].periodicity()); | ||
amrex::Print() << "HWAVE BOX " << (*Hwave[lev])[0].box() << std::endl; | ||
|
||
print_state(*Hwave[lev],IntVect(103,-3,0),0,IntVect(3,3,0)); | ||
print_state(*Hwave[lev],IntVect(103,88,0),0,IntVect(3,3,0)); | ||
} | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters