Comments (8)
Hi @AsimUdel
There shouldn't be any changes you need to make to the AMR-Wind input file itself. The sampling output files should be viewable in any environment that can load netcdf files, and if you can view them through the amr-wind-frontend GUI, then it ought to be possible to plot them in a jupyter notebook.
One thing that you can try is using a notebook like this one to visualize the sampling00000.nc
:
https://github.com/lawrenceccheung/ALCC_Frontier_WindFarm/blob/main/precursor/MedWS_LowTI/postprocessing/HubHeight_Viz.ipynb
This one might be a little more lightweight notebook, and doesn't require loading the full amr-wind-frontend library in order for it to work.
Let me know if you have any questions about how to use it, or if you run into any issues loading it.
Lawrence
from amr-wind.
Hi @lawrenceccheung
Thank you so much, I have tried opening in Python using Jupyter notebook, I have come up with some error, Let me attach the file containing error, maybe I am doing something w
error_while_opening_netcdf_file.txt
rong. I would be grateful if you could guide me how to use https://github.com/lawrenceccheung/ALCC_Frontier_WindFarm/blob/main/precursor/MedWS_LowTI/postprocessing/HubHeight_Viz.ipynb this file.
from amr-wind.
Hi @AsimUdel,
In the part of your script where you calculate the horizontal velocity
>>> iplane=1
>>> Uh=np.sqrt(db['velocityx'][0][iplane,:,:]**2)
set iplane=0
. You only have one plane defined for xyplane
, so that's why this error message appears:
IndexError: index 1 is out of bounds for axis 0 with size 1
Note that you have both the xyplane
and yz
contained in sampling00000.nc
. By default, getPlaneXY()
will extract the first plane that it sees (xyplane
). To get the other plane, use the groupname
option:
db = ppsamplexr.getPlaneXR(amrdir+ncfile, iters, varnames, groupname='yz', verbose=0)
Lawrence
from amr-wind.
If you're using xarray
, you will often have to specify the group
variable when running xr.open_dataset
. Below I've attached a screenshot of some code where I ran 6 different spinup simulations (I was trying different roughness and surface flux heat values), and you can see how I open the netCDF data of each of those simulations and concatenate them. I end up with two Datasets in the end: one for the profile variables (pstats
) and one for the other variables.
from amr-wind.
@lawrenceccheung
I have tried as you suggested, I have attached screenshot of the Jupyter notebook and output of sampling00000.nc by GUI (AMR-Wind-Frontend), I don't know how to access the variable using Jupyter notebook
my planes input files are
yz_-2D ,yz_-4D, yz_0D, yz_2D, yz_4D, yz_6D, yz_8D
xy_hub xy_rotor_top xy_rotor_bottom
Kindly suggest me how to see the list of variables and shape so that I can plot them.
from amr-wind.
hi @AsimUdel, in your case use
Uh = np.sqrt(db['velocityx'][2][iplane,:,:]**2)
In that last cell.
The dictionary that is returned by ppsamplexr.getPlaneXR()
has the following structure:
db[varkey][iterkey][planenum, i, j]
where:
varkey
corresponds to the variable name (in your casevelocityx
)iterkey
corresponds to the time instance of the plane. In your case, you only extracted the slice correspondingiterkey
=2 because you specifiediters=[2]
above.planenum
is the offset plane number of the sample plane. In all cases you will haveplanenum=0
present, and if in the input file you provide. If you used theoffsets
specification in the input file, like in this example:
turbswA_.T0_swA.type = PlaneSampler
turbswA_.T0_swA.num_points = 601 45
turbswA_.T0_swA.origin = 730.0 2560.0 0.08400000000000318
turbswA_.T0_swA.axis1 = 3810.0 0.0 0.0
turbswA_.T0_swA.axis2 = 0.0 0.0 280.416
turbswA_.T0_swA.normal = -0.0 1.0 -0.0
turbswA_.T0_swA.offsets = 0.0 254.0 508.0
you can specify planenum
=1 or 2 as well.
i
andj
are the x and y indices of the plane that will be used to plot.
Hope this helps.
Lawrence
from amr-wind.
@lawrenceccheung
Thank you so much for comprehensive guide, right now I have plotted it.
from amr-wind.
If you're using
xarray
, you will often have to specify thegroup
variable when runningxr.open_dataset
. Below I've attached a screenshot of some code where I ran 6 different spinup simulations (I was trying different roughness and surface flux heat values), and you can see how I open the netCDF data of each of those simulations and concatenate them. I end up with two Datasets in the end: one for the profile variables (pstats
) and one for the other variables.
@rybchuk
Thank you so much, I will definitely look into that as (there must be many output files), I will try and get back to you soon.
from amr-wind.
Related Issues (20)
- Averaging (Post Processing AMR Wind) HOT 3
- Enable changing velocity in turbine simulations from precurors HOT 9
- Cannot find field: tke HOT 2
- Geostrophic Forcing flaws HOT 5
- FLLC Reintroduced bug HOT 1
- Feature request: ABL statistics on level >0 HOT 1
- Segfault of AMR-Wind + OpenFAST with oneapi HOT 2
- MMC forcing fails with GPU HOT 3
- Add time-vary & spatially varying body force for MMC simulations HOT 11
- GPU Unit test Failues: DiagnosticsTest.Max_Vel_MultiLevel and Max_MACvel_MultiLevel HOT 1
- Segmentation fault when running more than one turbine HOT 11
- Encountered NetCDF error; aborting HOT 6
- MAC velocity not getting filled correctly at the low boundary HOT 18
- Instability in some simulation HOT 10
- storing postprocessing files in another directory
- I encountered the following problems in the process of learning to use TurbineFASTLine. Is this due to the version of TurbineFastline HOT 5
- ow_w2a test is non deterministic on CPU HOT 2
- Poor performance of amr-wind HOT 14
- trouble in simulations results and some general queries HOT 3
- Excessive netCDF sampling warning HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amr-wind.