Skip to content
Merged
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
26 changes: 16 additions & 10 deletions components/ww3/cime_config/buildlib_cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,20 @@ def buildlib(bldroot, installpath, case):
# Define WW3 repository directories
repodir = "{}/components/ww3/src".format(srcroot)
modeldir = "{}/WW3/model".format(repodir)

# TODO: these work dirs will have to be changed to live in the binary/build area.
# Achieving this will probably require a significant refactor of the ww3 infrastructure.
# Doing this stuff in-source not only clutters the repo, but also introduces potential race
# conditions if we were to try to build multiple ww3 cases simultaneously.
bindir = "{}/bin".format(modeldir)
exedir = "{}/exe".format(modeldir)
tmpdir = "{}/tmp".format(modeldir)
builddir = "{}/wav".format(exeroot)

# work dirs are placed in the binary/build area.
bindir_source = "{}/bin".format(modeldir)
bindir = "{}/bin".format(builddir)
shutil.copytree(bindir_source, bindir)
auxdir_source = "{}/aux".format(modeldir)
auxdir = "{}/aux".format(builddir)
shutil.copytree(auxdir_source, auxdir)
ftndir_source = "{}/ftn".format(modeldir)
ftndir = "{}/ftn".format(builddir)
shutil.copytree(ftndir_source, ftndir)

tmpdir = "{}/tmp".format(builddir)

# Run w3_setup to create wwatch3.env file
env_file = os.path.join(bindir, "wwatch3.env")
Expand All @@ -77,15 +83,15 @@ def buildlib(bldroot, installpath, case):
y
""".format(sf90, scc, tmpdir))

run_bld_cmd_ensure_logging("./w3_setup {} -s E3SM < w3_setup.inp".format(modeldir), logger, from_dir=bindir)
run_bld_cmd_ensure_logging("./w3_setup {} -s E3SM < w3_setup.inp".format(builddir), logger, from_dir=bindir)
os.remove(inp_file)

# Generate pre-processed WW3 source code
ww3_exe = ['ww3_shel','ww3_grid']
for exe in ww3_exe:
run_bld_cmd_ensure_logging("./w3_source {}".format(exe), logger, from_dir=bindir)
for exe in ww3_exe:
tarfile = "{}/work/{}.tar.gz".format(modeldir,exe)
tarfile = "{}/work/{}.tar.gz".format(builddir,exe)
shutil.move(tarfile, tmpdir)
run_bld_cmd_ensure_logging("tar -xzvf {}.tar.gz".format(exe), logger, from_dir=tmpdir)
run_bld_cmd_ensure_logging("rm ww3_shel.F90", logger, from_dir=tmpdir)
Expand Down