NREL / SOWFA

Other
130 stars 113 forks source link

Core dumped - reconstruct #66

Open ColinB07 opened 4 years ago

ColinB07 commented 4 years ago

Hi ! I'm trying to use the windplantsolver. To do so, I'm referring to these instructions:

Generating the precursor data

Run your precursor for a long period of time so that turbulent structures can arise, and then let a quasi-equilibrium form. This is typically 20,000 seconds. You do not need to output anything during these simulations. An example of the controlDict is given in the attachment controlDict.1.
Update your controlDict to include the function “sampling/boundaryDataPre”. (for example: controlDict.2). You can also add other sampling functions for visualization, but this is optional. In the boundaryDataPre file, you can select which domain side to record. Since the inflow is typically from the west, the default option is to record the west domain patch.
Continue/restart your simulation from 20,000 seconds to 22,000 seconds using this new controlDict. This will generate you 2,000 seconds of precursor data. You should see a folder called boundaryDataPre in your postProcessing folder.

Preparing the precursor data

  1. In the postProcessing folder, you will see a folder called SourceHistory and a folder called boundaryDataPre.
  2. Copy the contents from “SOWFA\tools\boundaryDataConversion” to the postProcessing folder, and run the script makeBoundaryDataFiles.west.sh (note: you may have to change the first line of makeBoundaryDataFiles/data.py and of makeBoundaryDataFiles/points.py to fit your cluster). This will generate a folder called boundaryData containing the inflow data for the 2,000 seconds of simulation with correct formatting. This usually takes about 30 minutes on our cluster.
  3. Copy the contents from “SOWFA\tools\sourceDataConversion” to the postProcessing folder, and run the script sourceHistoryRead.py. This will create a file called sources in your postProcessing folder.
  4. Create a new folder in your main case directory (i.e., next to the folders constant and system) called drivingData. Copy the file sources and the folder boundaryData to drivingData.
  5. In your main case directory, gather the state information from the various processors at time = 20,000 using OpenFOAM. This will be your initial condition for the wind farm simulation. Use this command:

reconstructPar -time 20000 -fields '(k kappat nuSgs p_rgh qwall Rwall T U)'

Coupling to a wind farm simulation

  1. In your wind farm simulation folder, open the file runscript.preprocess. Then update the precursorDir to the directory of your precursor case. This folder should contain drivingData (containing the sources file and the boundaryData folder) and the folder 20000 (containing your initial conditions). Also, set startTime=20000, and make sure this matches with your controlDict.
  2. Setup the simulation settings in setUp. Run runscript.preprocess and then submit (qsub) a HPC job for runscript.solve.1.

Everything is fine, until step 8. The reconstructPar is not working. I get the error:

Reconstructing fields for mesh region0

Time = 20000

Reconstructing FV fields

    Reconstructing volScalarFields

        nuSgs
Segmentation fault (core dumped)

How could I fix it? Thank you for your time.

ShantanuPurohit commented 2 years ago

Hi Colin, Were you able to solve this issue? I'm facing the similar problem.

Cheers, Shantanu

Bartdoekemeijer commented 2 years ago

reconstructPar is an OpenFOAM function, not a SOWFA function. Have you run any of the OpenFOAM demo cases with your OpenFOAM installation to verify that reconstructpar works for other cases, and this is specifically an issue with the SOWFA simulation?

ShantanuPurohit commented 2 years ago

Hi Mr. Bart, Thank you for your response! In my case, reconstructPar is not working when I'm trying to generate the precursor data for "example.ABL.flatTerrain.neutral" (Step 8th of #26). I'm working on the MEXICO rotor, so I previously implemented the ALM using the pisoFoamTurbine.ALM solver. For this case, reconstructPar was working perfectly. Moreover, when I ran a tutorial of OpenFOAM, for that case too, it was working. I really can't pinpoint why it is not working for the precursor data. PS: I am running the simulations on my laptop (it's a high-end laptop), rather than on HPC.

Thanks, Shantanu

Bartdoekemeijer commented 2 years ago

Interesting. In a quick online search I have found comparable issues here and here. It may just be that your installation of reconstructPar does not work well with this precursor case. You can try either a different OpenFOAM version as suggested here or you may try a different precursor case, for example, this example precursor case. To save yourself some time, set the endTime to 1000 and try reconstructing the solution at that timestep after it completes. That should tell you if it's something consistent or whether it's just an issue with that particular example case.

ShantanuPurohit commented 2 years ago

Thanks for the advice, Bart! I tried the other precursor case you suggested. Again, the same error "Segmentation fault (core dumped)" appears after I try to reconstruct the solution. Just to point out, it successfully reconstructs the volScalarFields but throws the segmentation fault when it tries to reconstruct the volVectorFields. I'm currently using version 2.4. I think I'll try to install the earlier versions of OpenFOAM, such as 2.3, or whichever is compatible with SOWFA. Let's see how that goes. I'll keep you updated if it solves the problem.

Once again, thanks for the help!

ShantanuPurohit commented 2 years ago

Hi, I tried running "reconstructPar" with several versions of OpenFOAM (2.3.0, 2.4.x, OpenFOAM-6), but the problem still persists.

Bartdoekemeijer commented 2 years ago

Hi Shantanu,

Two things come to mind.

  1. Perhaps something is off in your precursor simulation. Have you investigated the flow fields? Have you seen anything strange in them?
  2. This may be a problem with your linux distro not playing nicely with OpenFOAM. We use Red Hat/CentOS at the NREL and TUDelft HPC facilities, and we have not experienced any issues with reconstructPar as far as I know. You can either try copying the precursor folder to a different system with a verified installation of OpenFOAM and try reconstructing the solution there, or you can try using a different OS on your laptop altogether.

Finally, since you're using a single machine, you could consider not parallelizing the SOWFA case. Just keep everything centralized. That means you should disable decomposePar and reconstructPar in your runscripts. It might slow you down a bit, but you'll definitely circumvent the issue that way.

nish-ant commented 2 years ago

Everything is fine, until step 8. The reconstructPar is not working. I get the error:

Reconstructing fields for mesh region0

Time = 20000

Reconstructing FV fields

    Reconstructing volScalarFields

        nuSgs
Segmentation fault (core dumped)

I was facing a similar issue. The reason for the segfault seems to be the compilation of OpenFOAM v2.4.0 using new versions of openMPI. So I reverted from openMPI v4.0.2 to v2.1.6 (for example; might work with some other versions as well) and reconstructPar executes without any error. For the installation of OpenFOAM on a cluster running on CentOS, you can follow the instructions given in the wiki and in Step 8, use an appropriate version of openMPI.