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

Add example simulations (closes #39) #84

Merged
merged 78 commits into from
Sep 23, 2020
Merged

Conversation

bss116
Copy link
Contributor

@bss116 bss116 commented May 15, 2020

This pull request adds example simulations with various configurations of the code. The different setups are documented in docs/udales-example-simulations.md, but feel free to expand on the documentation! They should all run out of the box (e.g. ./u-dales/tools/utils/local_execute.sh u-dales/examples/101).

bss116 and others added 30 commits January 16, 2020 15:03
This remove the requirement for all codeowners to review every PR (as described in #52.). From now users should manually select the reviewers from the list when opening a new PR,
Fixes issues with the CI workers for macOS and Linux and updates to latest images.
This pull request is a cleanup, restructuring and documentation of the input namelists.
* Parameters are documented in docs/udales-namoptions-overview.md.
* Parameters are re-categorised, where possible, along the original DALES namelists.
* New sections are introduced: output, trees, chemistry, scalars.
* Unused parameters are removed.
* All parameter default vales and functionality are checked, except for the sections trees, chemistry, scalars and inlet.
… 201. Still need to 1) add 501, 502, 2) edit runtimes and domain sizes, 3) test all simulations.
@dmey
Copy link
Contributor

dmey commented Sep 19, 2020

I changed da_concatenate.sh, now there should not be any messages if there is nothing to merge. Let me know if that works for you and/or if there is anything else about the example simulations.

@bss116 👍. For clarity, I would probably move the last paragraph in https://github.com/uDALES/u-dales/blob/bss/example-simulations/docs/udales-example-simulations.md up at the top of 502 (e.g. under a prerequisites subheading) given that this is needed before running 502. Also, if you can add the download and preparation step in a code snippet under that paragraph and before https://github.com/uDALES/u-dales/blob/bss/example-simulations/docs/udales-example-simulations.md#buildings-from-lidar-image it would make it easier to understand.
E.g.

wget -O examples_driver_501.zip "https://www.dropbox.com/sh/spld3hqipqe17j1/AAA0cuzW3qc9ftY6dvHcSSL8a?dl=1"
cd ...

@bss116
Copy link
Contributor Author

bss116 commented Sep 19, 2020

@dmey any more feedback or is this ready to squash merge?

@dmey
Copy link
Contributor

dmey commented Sep 19, 2020

@bss116 could you please check that the docs are correct for 502. Following the docs I get the following error:

Reading Driver u-velocity: udriver_000.501         
record length        68640
At line 581 of file /tmp/proj-udales/u-dales/src/moddriver.f90 (unit = 11, file = 'udriver_000.501')
Fortran runtime error: Non-existing record number

Error termination. Backtrace:
At line 581 of file /tmp/proj-udales/u-dales/src/moddriver.f90 (unit = 11, file = 'udriver_000.501')
Fortran runtime error: Non-existing record number

Error termination. Backtrace:
#0  0x7f3077b232ed in ???
#1  0x7f3077b23ed5 in ???
#2  0x7f3077b2469d in ???
#3  0x7f3077c9e45f in ???
#0  0x7fd64a3802ed in ???
#1  0x7fd64a380ed5 in ???
#2  0x7fd64a38169d in ???
#3  0x7fd64a4fb45f in ???
#4  0x55a64315277b in __moddriver_MOD_readdriverfile
   at /tmp/proj-udales/u-dales/src/moddriver.f90:581
#4  0x560248f3b77b in __moddriver_MOD_readdriverfile
   at /tmp/proj-udales/u-dales/src/moddriver.f90:581
#5  0x55a6431faaaf in __modstartup_MOD_readinitfiles
   at /tmp/proj-udales/u-dales/src/modstartup.f90:1081
#6  0x55a643206893 in __modstartup_MOD_startup
   at /tmp/proj-udales/u-dales/src/modstartup.f90:466
#7  0x55a64329263d in dalesurban
   at /tmp/proj-udales/u-dales/src/program.f90:53
#8  0x55a64311ee08 in main
   at /tmp/proj-udales/u-dales/src/program.f90:23
#5  0x560248fe3aaf in __modstartup_MOD_readinitfiles
   at /tmp/proj-udales/u-dales/src/modstartup.f90:1081
#6  0x560248fef893 in __modstartup_MOD_startup
   at /tmp/proj-udales/u-dales/src/modstartup.f90:466
#7  0x56024907b63d in dalesurban
   at /tmp/proj-udales/u-dales/src/program.f90:53
#8  0x560248f07e08 in main
   at /tmp/proj-udales/u-dales/src/program.f90:23
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------
--------------------------------------------------------------------------
mpiexec detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:

 Process name: [[27683,1],1]
 Exit code:    2
--------------------------------------------------------------------------

I got this by running the following commands.

# From top-level project directory.
export DA_EXPDIR=$(pwd)/experiments #  The top-level directory of the simulation setups.
export DA_WORKDIR=$(pwd)/outputs # Output top-level directory
export DA_EXPDIR_SRC=$(pwd)/u-dales/examples
export DA_WORKDIR_SRC=$(pwd)/u-dales/outputs
./u-dales/tools/utils/da_prep.sh 502 502

export DA_UTILSDIR=$(pwd)/u-dales/tools/utils # Directory of utils scripts
export DA_BUILD=$(pwd)/u-dales/build/release/u-dales # Build file
export NCPU=2 # Number of CPUs to use for a simulation
export DA_WORKDIR=$(pwd)/outputs # Output top-level directory

pushd experiments/502/
wget -O examples_driver_501.zip "https://www.dropbox.com/sh/spld3hqipqe17j1/AAA0cuzW3qc9ftY6dvHcSSL8a?dl=1"
unzip examples_driver_501.zip
popd

./u-dales/tools/utils/local_execute.sh experiments/502

@bss116
Copy link
Contributor Author

bss116 commented Sep 19, 2020

hmm that's not good. I can run it without problems. I have a vague memory that @tomgrylls ran into problems with the way the driver files are read/saved on one of his operating systems. What are you running on?

Edit: There are changes to how the file is read in #81, that's everything I could find about it.

@dmey
Copy link
Contributor

dmey commented Sep 19, 2020

Originally I assumed that you produced driver inputs in netCDF -- mhh, well if these are just binaries specific to the system then I don't think there's much of a point having them in the examples. But how did you manage to run them though? I though @tomgrylls created them on the HPC in RHEL and I though you use a mac!? I tried on Ubuntu 18.04.

@bss116
Copy link
Contributor Author

bss116 commented Sep 19, 2020

No they are not supposed to be system specific, and as far as I remember I got them to run both on Mac and HPC at the end. Not sure where we generated the data, it's been too long. Now I ran on my Mac, yes. Well, alright. Shall we write a note that these files may not work for all systems and merge? Otherwise he have to wait when/if @tomgrylls has time to look into it, I cannot help with this.

@dmey
Copy link
Contributor

dmey commented Sep 19, 2020

No they are not supposed to be system specific, and as far as I remember I got them to run both on Mac and HPC at the end. Not sure where we generated the data, it's been too long. Now I ran on my Mac, yes. Well, alright. Shall we write a note that these files may not work for all systems and merge? Otherwise he have to wait when/if @tomgrylls has time to look into it, I cannot help with this.

@bss116 sorry but this does not make sense to me given that you are not even running these on Linux so if they were system specific they would fail on yours more likely than on mine... I think that either we are following different instructions or are using different driver files/udales binaries. Have you tried starting afresh? If this is not urgent, I would wait for this to be tested and check with @tomgrylls before merging it in otherwise don't worry and we can always amend the docs later 😃.

@dmey
Copy link
Contributor

dmey commented Sep 20, 2020

@bss116 Good news 😃 -- I was able to run the cases 😌. It looks like there is no problem with the driver files (@tomgrylls 😃). The problem seem to be with the da_prep.sh which does not copy all the files needed by 502 and I guess you ran the case directly from u-dales folder which does not require the use of da_prep.sh. This would explain why it ran on yours and not on mine. So I would suggest either amending the da_prep.sh script so that the correct files are copied (better) or change the documentation to advise not to use da_prep.sh.

@bss116
Copy link
Contributor Author

bss116 commented Sep 20, 2020

@dmey That's good! Which files were not copied by da_prep.sh? This should be easy to fix. No I actually copied your code snippet, only put the driver files there manually since I don't have wget... 🤔

@dmey
Copy link
Contributor

dmey commented Sep 20, 2020

@bss116 I have not investigate this further but I guess the image and driver files -- are you OK to check this locally at your end? Otherwise this may end up in quite a lot of a back and forth... I would suggest deleting your 502 folder and try as per instructions to make sure you don't have left over files. I have amended the script below to reflect what I have done as I understand from the current docs but it would also be good to go over the current instructions independently to check that it all makes sense. In the snipped below I have also added curl as that should be what's avail on mac (BTW if you want wget on mac and Homebrew you can get it with brew install wget). Let me know if you want me to amend it instead -- the reason I had not modified da_prep.sh was simply because you may know of other files which are common in u-dales that needs to be added.

# From top-level project directory.

# Download required files
pushd u-dales/examples/502 # This is as you have it in the current docs -- 
# an alternative is to download them in experiments/502 but this would need to be created first...
curl -o examples_driver_501.zip -L https://www.dropbox.com/sh/spld3hqipqe17j1/AAA0cuzW3qc9ftY6dvHcSSL8a?dl=1
unzip examples_driver_501.zip
popd

export DA_EXPDIR=$(pwd)/experiments #  The top-level directory of the simulation setups.
export DA_WORKDIR=$(pwd)/outputs # Output top-level directory
export DA_EXPDIR_SRC=$(pwd)/u-dales/examples
export DA_WORKDIR_SRC=$(pwd)/u-dales/outputs
./u-dales/tools/utils/da_prep.sh 502 502

export DA_UTILSDIR=$(pwd)/u-dales/tools/utils # Directory of utils scripts
export DA_BUILD=$(pwd)/u-dales/build/release/u-dales # Build file
export NCPU=2 # Number of CPUs to use for a simulation
export DA_WORKDIR=$(pwd)/outputs # Output top-level directory

./u-dales/tools/utils/local_execute.sh experiments/502

@bss116
Copy link
Contributor Author

bss116 commented Sep 21, 2020

Okay I have now expanded da_prep.sh to also copy any available driver files across. Now it should work to both run the driver examples from the example directory and also by making a copy of the simulation, whether the driver files were downloaded in the example directory or experiment directory. I have also changed the docs a bit to make clearer which steps have to be executed to run example simulations. Your example above should now work, just note that you need to change

export DA_WORKDIR_SRC=$(pwd)/u-dales/examples

I have updated this in the getting started guide.

Also the simpler

export DA_UTILSDIR=$(pwd)/u-dales/tools/utils # Directory of utils scripts
export DA_BUILD=$(pwd)/u-dales/build/release/u-dales # Build file
export NCPU=2 # Number of CPUs to use for a simulation
export DA_WORKDIR=$(pwd)/outputs # Output top-level directory

# From top-level project directory.

# Download required files
pushd u-dales/examples/502 # This is as you have it in the current docs -- 
# an alternative is to download them in experiments/502 but this would need to be created first...
curl -o examples_driver_501.zip -L https://www.dropbox.com/sh/spld3hqipqe17j1/AAA0cuzW3qc9ftY6dvHcSSL8a?dl=1
unzip examples_driver_501.zip
popd

./u-dales/tools/utils/local_execute.sh u-dales/examples/502

as described in the example simulation docs should work.

PS: the driver simulations are still a bit fiddly, I just had to start them twice to get them to run (but this is not an issue for the documentation of the example cases)

@dmey
Copy link
Contributor

dmey commented Sep 21, 2020

@bss116 this is good but I think that it also adds a lot of duplication with the other docs (i.e. twice as much docs/code to maintain). Can you please have a look at #87 and approve if OK -- In that I tried to keep consistency with the set up described in the getting started guide so there is no need to vary any of the environmental variables already defined which may confuse readers when going through the examples/documentation for the first time.

@dmey dmey self-requested a review September 23, 2020 05:32
Copy link
Contributor

@dmey dmey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two minor comments -- rest looks good! 👍

docs/udales-example-simulations.md Outdated Show resolved Hide resolved
docs/udales-example-simulations.md Outdated Show resolved Hide resolved
bss116 and others added 3 commits September 23, 2020 13:02
Co-authored-by: dmey <dmey@users.noreply.github.com>
Co-authored-by: dmey <dmey@users.noreply.github.com>
@bss116 bss116 merged commit 0acc049 into master Sep 23, 2020
@bss116 bss116 deleted the bss/example-simulations branch September 23, 2020 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants