Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example eagle with mb input #7

Merged
merged 10 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ pip install -e emu_python

``` pip install git+https://github.nrel.gov/SEAS/SEAS.git@dv/emuwind ```

Note from PF:
Had trouble doing it this way on local machine so instead:
# (Activate conda environment first)
git clone git@github.nrel.gov:SEAS/SEAS.git
cd SEAS
git fetch --all
git checkout dv/emuwind
cd ..
pip install -e SEAS

# Other steps for era 5
Now need to add a file called APIKEY which contains the API Key you'll find in your data.planetos account
Expand Down
2 changes: 1 addition & 1 deletion emu_python/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def process_periodic_publication(self):
# self.set_wind_speed_direction()

#yaw_angles = [270 for t in range(self.num_turbines)]
yaw_angles = [270 for t in range(self.num_turbines)]
yaw_angles = [240 for t in range(self.num_turbines)]
# log these in kafka
#yaw_angles[1] = 260

Expand Down
4 changes: 1 addition & 3 deletions example_case_folders/example_sim_04/amr_input.inp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,12 @@ ABL.surface_temp_flux = 0.00
ABL.wall_shear_stress_type = "Moeng"

ABL.bndry_file = "/projects/ssc/amr_precursors/005_abl_neutral_lowTI_redo/bndry_files"
ABL.bndry_io_mode = 1
ABL.bndry_io_mode = 1 # Input mode
ABL.bndry_planes = ylo xlo # I'm (Paul) adding this but not sure if I have to
ABL.bndry_var_names = velocity temperature tke


# Output boundary files
ABL.bndry_file = "bndry_files"
ABL.bndry_io_mode = 0
ABL.bndry_planes = ylo xlo
ABL.bndry_output_start_time = 7200.0
ABL.bndry_var_names = velocity temperature tke
Expand Down
19 changes: 14 additions & 5 deletions example_case_folders/example_sim_04/batch_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=36
#SBATCH --account=ssc
#SBATCH --qos=high
# #SBATCH --qos=high

# A lot of modules and conda stuff
source /nopt/nrel/apps/anaconda/5.3/etc/profile.d/conda.sh
module use /nopt/nrel/apps/modules/centos74/modulefiles
# module use /nopt/nrel/apps/modules/centos74/modulefiles
module use /not/nrel/apps/modules/default/modulefiles
module purge
module load conda/5.3
module load intel-mpi/2018.0.3
# module load conda/5.3
module load conda
export PREFIX=~/.conda-envs/emupy
export PATH=$PREFIX/bin:$PATH
export FI_PROVIDER_PATH=$PREFIX/lib/libfabric/prov
export LD_LIBRARY_PATH=$PREFIX/lib/libfabric:$PREFIX/lib/release_mt:$LD_LIBRARY_PATH
source activate emupy
# module load intel-mpi/2018.0.3
module load helics/helics-3.1.0_openmpi
module load netcdf-c/4.7.3/gcc-mpi
conda activate emupy
# module load mkl
# module load mpt


# Set up the helics broker
helics_broker -t zmq -f 2 --loglevel="debug" &
Expand Down
2 changes: 0 additions & 2 deletions example_case_folders/example_sim_05/amr_input.inp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ ABL.bndry_var_names = velocity temperature tke


# Output boundary files
ABL.bndry_file = "bndry_files"
ABL.bndry_io_mode = 0
ABL.bndry_planes = ylo xlo
ABL.bndry_output_start_time = 7200.0
ABL.bndry_var_names = velocity temperature tke
Expand Down
172 changes: 172 additions & 0 deletions example_case_folders/example_sim_06/amr_input.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
time.stop_time = 10800.0 # Max (simulated) time to evolve
time.max_step = -1 # Max number of time steps

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# TIME STEP COMPUTATION #
#.......................................#
time.fixed_dt = 0.5 # Use this constant dt if > 0
time.cfl = 0.95 # CFL factor

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INPUT AND OUTPUT #
#.......................................#
time.plot_interval = 3600 # Steps between plot files
time.checkpoint_interval = 3600 # Steps between checkpoint files
io.restart_file = "/projects/ssc/amr_precursors/005_abl_neutral_lowTI_redo/chk14400"

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# PHYSICS #
#.......................................#
incflo.gravity = 0. 0. -9.81 # Gravitational force (3D)
incflo.density = 1.0 # Reference density

incflo.use_godunov = 1
incflo.godunov_type = weno_z
incflo.diffusion_type = 1
transport.viscosity = 1.0e-5
transport.laminar_prandtl = 0.7
transport.turbulent_prandtl = 0.3333
turbulence.model = OneEqKsgsM84

incflo.physics = ABL Actuator
ICNS.source_terms = BoussinesqBuoyancy CoriolisForcing ABLMeanBoussinesq ActuatorForcing
TKE.source_terms = KsgsM84Src
BoussinesqBuoyancy.reference_temperature = 300.0
CoriolisForcing.latitude = 41.3
ABLForcing.abl_forcing_height = 90
incflo.velocity = 6.928203230275509 4.0 0.0


# Atmospheric boundary layer
ABL.temperature_heights = 0.0 700.0 800.0 1280.0
ABL.temperature_values = 300.0 300.0 308.0 309.44
ABL.reference_temperature = 300.0
ABL.kappa = .40
ABL.surface_roughness_z0 = 1.0E-4
ABL.Uperiods = 25.0
ABL.Vperiods = 25.0
ABL.cutoff_height = 50.0
ABL.deltaU = 1.0
ABL.deltaV = 1.0
ABL.normal_direction = 2
ABL.perturb_ref_height = 50.0
ABL.perturb_temperature = false
ABL.perturb_velocity = true
ABL.stats_output_format = netcdf
ABL.stats_output_frequency = 1
ABL.surface_temp_flux = 0.00
ABL.wall_shear_stress_type = "Moeng"

ABL.bndry_file = "/projects/ssc/amr_precursors/005_abl_neutral_lowTI_redo/bndry_files"
ABL.bndry_io_mode = 1 #Input mode
ABL.bndry_planes = ylo xlo # I'm (Paul) adding this but not sure if I have to
ABL.bndry_var_names = velocity temperature tke


# Output boundary files
ABL.bndry_planes = ylo xlo
ABL.bndry_output_start_time = 7200.0
ABL.bndry_var_names = velocity temperature tke
ABL.bndry_output_format = native
ABL.stats_output_frequency = 1
ABL.stats_output_format = netcdf

# Whether to use helics
helics.activated = true

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# ADAPTIVE MESH REFINEMENT #
#.......................................#
amr.n_cell = 512 512 128 # Grid cells at coarsest AMRlevel
amr.max_level = 0 # Max AMR level in hierarchy

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# GEOMETRY #
#.......................................#
geometry.prob_lo = 0. 0. 0. # Lo corner coordinates
geometry.prob_hi = 5120. 5120. 1280. # Hi corner coordinates
geometry.is_periodic = 0 0 0
xlo.type = "mass_inflow"
xlo.density = 1.0
xlo.temperature = 0.0 # value required but ignored
xlo.tke = 0.0
xhi.type = "pressure_outflow"

ylo.type = "mass_inflow"
ylo.density = 1.0
ylo.temperature = 0.0
ylo.tke = 0.0
yhi.type = "pressure_outflow"

# Boundary conditions
zlo.type = "wall_model"
zlo.tke_type = "zero_gradient"

zhi.type = "slip_wall"
zhi.temperature_type = "fixed_gradient"
zhi.temperature = 0.003 # tracer is used to specify potential temperature gradient

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# VERBOSITY #
#.......................................#
incflo.verbose = 0 # incflo_level



#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SAMPLING #
#.......................................#
incflo.post_processing = samplingPlane samplingLine

samplingPlane.output_frequency = 600
samplingPlane.labels = z_plane
samplingPlane.fields = velocity temperature
samplingPlane.z_plane.type = PlaneSampler
samplingPlane.z_plane.axis1 = 5110 0.0 0.0
samplingPlane.z_plane.axis2 = 0.0 5110 0.0
samplingPlane.z_plane.origin = 5.0 5.0 0.0
samplingPlane.z_plane.num_points = 512 512
samplingPlane.z_plane.normal = 0.0 0.0 1.0
samplingPlane.z_plane.offsets = 5.0 85.0 155.0 255.0


samplingLine.output_frequency = 1
samplingLine.labels = z_line
samplingLine.fields = velocity temperature
samplingLine.z_line.type = LineSampler
samplingLine.z_line.num_points = 128
samplingLine.z_line.start = 5.0 5.0 5.0
samplingLine.z_line.end = 5.0 5.0 1275.0

#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# TURBINES #
#.......................................#

# 2.3 MW Turbine inputs

Actuator.labels = T00 T01
Actuator.type = JoukowskyDisk
Actuator.JoukowskyDisk.rotor_diameter = 116.0
Actuator.JoukowskyDisk.hub_height = 90.0
Actuator.JoukowskyDisk.output_frequency = 10
Actuator.JoukowskyDisk.diameters_to_sample = 2.5
Actuator.JoukowskyDisk.num_points_r = 40
Actuator.JoukowskyDisk.num_points_t = 5
Actuator.JoukowskyDisk.num_blades = 3
Actuator.JoukowskyDisk.use_tip_correction = true
Actuator.JoukowskyDisk.use_root_correction = true
Actuator.JoukowskyDisk.epsilon = 5.0
Actuator.JoukowskyDisk.vortex_core_size = 13.0

Actuator.JoukowskyDisk.wind_speed = 3.0 3.889649963239854 4.684006996752303 5.377830233987229 5.966542092267928 6.44625847394617 6.8138143922059236 7.066784852446481 7.203500851477444 7.22306038896904 7.320786359429763 7.535153078939617 7.864746237154081 8.30739130337076 8.860167873258558 9.519428936578247 10.280824938773394 10.589724312062877 11.13933247768231 12.08928744604103 13.12442240111568 14.237907914913496 15.422397632159566 16.670076738763772 17.972713521001396 19.321713675239476 20.708177009893884 22.122956165519163 23.556716965618207 25.0
Actuator.JoukowskyDisk.rpm = 5.500000000399841 5.7503730274604 6.924733009169061 7.950466035772244 8.820804709636782 9.530006866155707 10.073393458373337 10.447379427563192 10.649497356086282 10.678413746477254 10.82288967359941 11.139804720841314 11.627068002870239 12.28146474128283 13.098677474494233 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643 13.141137992834643
Actuator.JoukowskyDisk.thrust_coeff = 0.795419507524108 0.8163759621542088 0.8163759621542089 0.8163759621542088 0.8163759621542088 0.8163759621542093 0.8163759621542093 0.816375962154209 0.8163759621542089 0.816375962154209 0.8163759621542089 0.8163759621542088 0.8163759621542088 0.7816497292837605 0.6881024487256834 0.5960935792514858 0.5110705883010171 0.48169007343985104 0.3992418445397665 0.301726241148816 0.23137184415660814 0.17948146484830918 0.1408250546606467 0.11178366795199553 0.08975645587417404 0.07310080594700819 0.060299514659720915 0.0504505646442757 0.04286514300370846 0.03692885272686376


Actuator.JoukowskyDisk.yaw = 240.0

Actuator.T00.base_position = 2000.0 2000.0 0.0
Actuator.T01.base_position = 2500.0 2500.0 0.0
37 changes: 37 additions & 0 deletions example_case_folders/example_sim_06/batch_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
#SBATCH --job-name=emu
#SBATCH --time=1:00:00
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=36
#SBATCH --account=ssc
# #SBATCH --qos=high

# A lot of modules and conda stuff
source /nopt/nrel/apps/anaconda/5.3/etc/profile.d/conda.sh
# module use /nopt/nrel/apps/modules/centos74/modulefiles
module use /not/nrel/apps/modules/default/modulefiles
module purge
# module load conda/5.3
module load conda
export PREFIX=~/.conda-envs/emupy
export PATH=$PREFIX/bin:$PATH
export FI_PROVIDER_PATH=$PREFIX/lib/libfabric/prov
export LD_LIBRARY_PATH=$PREFIX/lib/libfabric:$PREFIX/lib/release_mt:$LD_LIBRARY_PATH
source activate emupy
# module load intel-mpi/2018.0.3
module load helics/helics-3.1.0_openmpi
module load netcdf-c/4.7.3/gcc-mpi
# module load mkl
# module load mpt


# Set up the helics broker
helics_broker -t zmq -f 2 --loglevel="debug" &

# Need to set this to your emu_python folder
# cd /home/pfleming/emu_python/emu_python
python3 emu_runscript.py emu_input_000.yaml >> logemu 2>&1 & # Start the controller center and pass in input file

# Now go back to scratch folder and launch the job
# cd /scratch/pfleming/c2c/example_sim_02
mpirun -n 72 /home/pfleming/amr-wind/build/amr_wind amr_input.inp >> logamr 2>&1
60 changes: 60 additions & 0 deletions example_case_folders/example_sim_06/emu_input_000.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Input YAML for emy_python

# Name
name: example_000

###
# Describe this emulator setup
description: Just a solar plant

dt: 0.5

emu_comms:

amr_wind:

wind_farm_0:
type: amr_wind_local #options are amr_wind or amr_wind_local
amr_wind_input_file: amr_input.inp

helics:

config:
name: emu_python # What is the purpose of this name
use_dash_frontend: False
KAFKA: False
KAFKA_topics: EMUV1py
helics:
# deltat: 1 # This will be assigned in software
subscription_topics: [status]
publication_topics: [control]
endpoints: []
helicsport: 23405
publication_interval: 1
endpoint_interval: 1
starttime: 0
stoptime: 36000
Agent: ControlCenter

py_sims:

solar_farm_0: # The name of py_sim object 1

py_sim_type: SimpleSolar
capacity: 50 # MW
efficiency: 0.5 #Fraction

initial_conditions:

power: 25 # MW
irradiance: 1000


controller:







23 changes: 23 additions & 0 deletions example_case_folders/example_sim_06/emu_runscript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from emu_python.emulator import Emulator
from emu_python.controller import Controller
# from emu_python.emu_comms import EmuComms
from emu_python.py_sims import PySims
from emu_python.utilities import load_yaml

import sys



input_dict = load_yaml(sys.argv[1])

#print(input_dict)

controller = Controller(input_dict)
py_sims = PySims(input_dict)


emulator = Emulator(controller, py_sims, input_dict)
emulator.run_helics_setup()
emulator.enter_execution(function_targets=[],
function_arguments=[[]])

2 changes: 2 additions & 0 deletions example_case_folders/example_sim_06/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is the second case meant to run on AMR-Wind, it is mostly copy of example_sim_04 except includes corrections to the turbine model from Michale Brazell

Loading