From 6e191b0dc7dd1552bedf821ac63d4990a0001d60 Mon Sep 17 00:00:00 2001 From: Mahesh Natarajan Date: Tue, 22 Oct 2024 12:36:48 -0700 Subject: [PATCH 1/3] Changing actuator disk model names --- Source/DataStructs/ERF_DataStruct.H | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/DataStructs/ERF_DataStruct.H b/Source/DataStructs/ERF_DataStruct.H index b3e2992ae..c8f639a4a 100644 --- a/Source/DataStructs/ERF_DataStruct.H +++ b/Source/DataStructs/ERF_DataStruct.H @@ -42,7 +42,7 @@ AMREX_ENUM(MoistureType, ); AMREX_ENUM(WindFarmType, - Fitch, EWP, SimpleActuatorDisk, GeneralActuatorDisk, None + Fitch, EWP, SimpleAD, GeneralAD, None ); AMREX_ENUM(WindFarmLocType, @@ -393,14 +393,14 @@ struct SolverChoice { // // Wind farm checks // - if (windfarm_type==WindFarmType::SimpleActuatorDisk and sampling_distance_by_D < 0.0) { + if (windfarm_type==WindFarmType::SimpleAD and sampling_distance_by_D < 0.0) { amrex::Abort("To use simplified actuator disks, you need to provide a variable" " erf.sampling_distance_by_D in the inputs which specifies the upstream" " distance as a factor of the turbine diameter at which the incoming free stream" " velocity will be computed at."); } - if ( (windfarm_type==WindFarmType::SimpleActuatorDisk || - windfarm_type==WindFarmType::GeneralActuatorDisk ) && turb_disk_angle < 0.0) { + if ( (windfarm_type==WindFarmType::SimpleAD || + windfarm_type==WindFarmType::GeneralAD ) && turb_disk_angle < 0.0) { amrex::Abort("To use simplified actuator disks, you need to provide a variable" " erf.turb_disk_angle_from_x in the inputs which is the angle of the face of the" " turbine disk from the x-axis. A turbine facing an oncoming flow in the x-direction" From 706852362527ed53a78820463f25eda593cd7043 Mon Sep 17 00:00:00 2001 From: Mahesh Natarajan Date: Sun, 27 Oct 2024 19:56:48 -0700 Subject: [PATCH 2/3] Some changes to actuator disk model --- .../ERF_InitWindFarm.cpp | 20 ++++++++++--------- .../ERF_AdvanceGeneralAD.cpp | 14 +++++++------ .../ERF_AdvanceSimpleAD.cpp | 18 ++++++----------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/Source/WindFarmParametrization/ERF_InitWindFarm.cpp b/Source/WindFarmParametrization/ERF_InitWindFarm.cpp index 99a6f2f20..6f48a711b 100644 --- a/Source/WindFarmParametrization/ERF_InitWindFarm.cpp +++ b/Source/WindFarmParametrization/ERF_InitWindFarm.cpp @@ -125,14 +125,6 @@ WindFarm::init_windfarm_lat_lon (const std::string windfarm_loc_table, xloc[it] = xloc[it] - xloc_min + windfarm_x_shift; yloc[it] = yloc[it] - yloc_min + windfarm_y_shift; } - - FILE* file_xy_loc; - file_xy_loc = fopen("file_xy_loc_KingPlains.txt","w"); - - for(int it = 0;it 1){ + printf("Actuator disks with indices %d and %d are overlapping\n", + turb_indices_overlap[0],turb_indices_overlap[1]); + amrex::Error("Actuator disks are overlapping. Visualize actuator_disks.vtk " + " and check the windturbine locations input file. Exiting.."); + } } - } }); } diff --git a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp index 42f9d4be3..873c6f12c 100644 --- a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp +++ b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp @@ -239,7 +239,7 @@ compute_source_terms_Fn_Ft (const Real rad, AMREX_ALWAYS_ASSERT(std::fabs(std::exp(-fhub))<=1.0); AMREX_ALWAYS_ASSERT(std::fabs(std::exp(-ftip))<=1.0); - F = 1.0;//2.0/PI*(std::acos(std::exp(-ftip)) + std::acos(std::exp(-fhub)) ); + F = 2.0/PI*(std::acos(std::exp(-ftip)) + std::acos(std::exp(-fhub)) ); at_new = 1.0/ ( 4.0*F*std::sin(psi)*std::cos(psi)/(s*Ct+1e-10) - 1.0 ); an_new = 1.0/ ( 1.0 + 4.0*F*std::pow(std::sin(psi),2)/(s*Cn + 1e-10) ); @@ -468,17 +468,19 @@ GeneralAD::source_terms_cellcentered (const Geometry& geom, d_blade_pitch_ptr, n_spec_extra); - Real Fn = Fn_and_Ft[0]; - Real Ft = Fn_and_Ft[1]; + Real Fn = 3.0*Fn_and_Ft[0]; + Real Ft = 3.0*Fn_and_Ft[1]; // Compute the source terms - pass in radial distance, free stream velocity Real Fx = Fn*std::cos(phi) + Ft*std::sin(zeta)*std::sin(phi); Real Fy = Fn*std::sin(phi) - Ft*std::sin(zeta)*std::cos(phi); Real Fz = -Ft*std::cos(zeta); - source_x = -Fx*inv_dens_vol; - source_y = -Fy*inv_dens_vol; - source_z = -Fz*inv_dens_vol; + //Real dn = ( + + source_x = -Fx/(2.0*PI*rad*dx[0])*1.0/std::pow(2.0*PI,0.5); + source_y = -Fy/(2.0*PI*rad*dx[0])*1.0/std::pow(2.0*PI,0.5); + source_z = -Fz/(2.0*PI*rad*dx[0])*1.0/std::pow(2.0*PI,0.5); //printf("Val source_x, is %0.15g, %0.15g, %0.15g %0.15g %0.15g %0.15g\n", rad, Fn, Ft, source_x, source_y, source_z); diff --git a/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp b/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp index 38a10d65e..7709f6355 100644 --- a/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp +++ b/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp @@ -114,7 +114,7 @@ void SimpleAD::compute_freestream_velocity(const MultiFab& cons_in, amrex::ParallelContext::CommunicatorAll()); get_turb_loc(xloc, yloc); - if (ParallelDescriptor::IOProcessor()){ + /*if (ParallelDescriptor::IOProcessor()){ for(int it=0; it(SMark_array(ii,jj,kk,1)); + + if(it != -1) { Real avg_vel = d_freestream_velocity_ptr[it]/(d_disk_cell_count_ptr[it] + 1e-10); Real phi = d_freestream_phi_ptr[it]/(d_disk_cell_count_ptr[it] + 1e-10); @@ -210,8 +211,6 @@ SimpleAD::source_terms_cellcentered (const Geometry& geom, a = 0.5 - 0.5*std::pow(1.0-C_T,0.5); } Real Uinfty_dot_nhat = avg_vel*(std::cos(phi)*nx + std::sin(phi)*ny); - if(SMark_array(ii,jj,kk,1) == static_cast(it)) { - check_int++; if(C_T <= 1) { source_x = -2.0*std::pow(Uinfty_dot_nhat, 2.0)*a*(1.0-a)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::cos(phi); source_y = -2.0*std::pow(Uinfty_dot_nhat, 2.0)*a*(1.0-a)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::sin(phi); @@ -220,12 +219,7 @@ SimpleAD::source_terms_cellcentered (const Geometry& geom, source_x = -0.5*C_T*std::pow(Uinfty_dot_nhat, 2.0)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::cos(phi); source_y = -0.5*C_T*std::pow(Uinfty_dot_nhat, 2.0)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::sin(phi); } - } - } - if(check_int > 1){ - amrex::Error("Actuator disks are overlapping. Visualize actuator_disks.vtk " - "and check the windturbine locations input file. Exiting.."); - } + } simpleAD_array(i,j,k,0) = source_x; simpleAD_array(i,j,k,1) = source_y; From c4d4c2ec549c63ec90cb0ac017ed06668ae11fe1 Mon Sep 17 00:00:00 2001 From: Mahesh Natarajan Date: Sun, 27 Oct 2024 20:06:59 -0700 Subject: [PATCH 3/3] Revmoing unused variable --- .../GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp index 873c6f12c..aaa64ceb2 100644 --- a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp +++ b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp @@ -417,7 +417,6 @@ GeneralAD::source_terms_cellcentered (const Geometry& geom, Real y = ProbLoArr[1] + (jj+0.5)*dx[1]; Real z = ProbLoArr[2] + (kk+0.5)*dx[2]; // ?? Density needed here - Real inv_dens_vol = 1.0/(1.0*dx[0]*dx[1]*dx[2]); int check_int = 0;