Exawind / amr-wind

AMReX-based structured wind solver
https://exawind.github.io/amr-wind
Other
112 stars 83 forks source link

Read profile from file for RANS #1300

Open hgopalan opened 1 month ago

hgopalan commented 1 month ago

Is this feature request related to a problem?

For RANS simulations, we often do not need precursor simulations and can use one-dimensional profile at inflow to drive the simulations. There is support for power law profile option using UDFs but I would like to read my profile from a file and apply the inflow BC to velocity, temperature, viscosity and turbulent kinetic energy. Extending the UDF path to read from file will help but I have been struggling with the best way to set it up.

Describe the preferred solution

A custom scalar model with support for reading a profile from file.

Additional context

RANS simulations for wind siting is often performed using a 1-D profile at inflow.

marchdf commented 3 weeks ago

@hgopalan looks like you did that for the other PR? Can you close this now?

hgopalan commented 3 weeks ago

No this is different from that. I want an option in the UDF to read the wind speed, temperature and turbulent kinetic energy from file for the RANS model. This will make it unnecessary to run precursor RANS simulations and we can directly do inflow-outflow.

marchdf commented 3 weeks ago

ohhhh you want a BC UDF that uses data from a file. That makes sense. And pretty trivial. Can you post an example file you would want to read?

Though why not just recast that file into a netcdf file and use the ABL boundary plane functionality?

hgopalan commented 3 weeks ago

The file will be

z u v w Temperature TKE 0 4 2 0 300 0.7 .... ..

I want to keep the input to a simple text file as it may come from different sources and do not want to touch netcdf.

moprak-nrel commented 3 weeks ago

Do these inputs come from a python code? As an easy stopgap to avoid running a precursor I can help with writing function to output a netcdf file.

hgopalan commented 3 weeks ago

There are several possible sources: (1) python code (2) WRF/ERF (3) Measurements. The idea is to use the use linear interpolation algorithm to vertically interpolate the data from the source into the vertical z locations in AMR-Wind. We are going to assume horizontally homogenous profile for now.

rybchuk commented 3 weeks ago

Harish pointed me this way. Me and Tony have been running AMR-Wind simulations where we use ML-generated data for our ABL.bndry_file inflow BCs. As part of this process, we had to reformat the ML-generated data into a netCDF file format that is compatible with AMR-Wind. I put together a notebook where I (1) figure out the formatting of an AMR-Wind-generated BC file, (2) arrange my ML-generated data to match the expected format, and (3) sanity check that data.

format_for_amrwind.ipynb.zip