Hi Brian,
To try to help you through this, I created two cases on a machine supported by CESM (yellowstone), one using the CESM-defined machine and one as a userdefined machine:
1) ./create_newcase -case ~/projects/cases/test.yellowstone -compset F -res f19_g16 -mach yellowstone
2) ./create_newcase -case ~/projects/cases/test.userdefined -compset F -res f19_g16 -mach userdefined
I then looked at settings in (1) to determine how to define variables in (2). Starting from the top directory of a clean checkout of CESM 1.2.1 (because I thought I saw that flag in some of your error messages), here are the steps I took to be able to build test.userdefined:
* Open http://www.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/x1745.html for reference
(i) Create the new case
$ cd $CESM1.2.1/scripts
$ ./create_newcase -case ~/projects/cases/test.userdefined -compset F -res f19_g16 -mach userdefined
(ii) Run cesm_setup
$ cd ~/projects/cases/test.userdefined
$ ./cesm_setup
ERROR: must set xml variable OS to generate Macros file
ERROR: must set xml variable MPILIB to build the model
ERROR: must set xml variable RUNDIR to build the model
ERROR: must set xml variable DIN_LOC_ROOT to build the model
ERROR: must set xml variable COMPILER to build the model
ERROR: must set xml variable EXEROOT to build the model
ERROR: must set xml variable MAX_TASKS_PER_NODE to build the model
(iii) Define all the variables listed in the error messages above
$ ./xmlchange OS=LINUX
$ ./xmlchange MPILIB=mpich2
$ ./xmlchange RUNDIR=/glade/scratch/mlevy/test.userdefined/run
$ ./xmlchange DIN_LOC_ROOT=/glade/p/cesmdata/cseg/inputdata
$ ./xmlchange COMPILER=intel
$ ./xmlchange EXEROOT=/glade/scratch/mlevy/test.userdefined/bld
$ ./xmlchange MAX_TASKS_PER_NODE=30
(iv) re-run cesm setup
$ ./cesm_setup
[ ... lots of output, success! ]
(v) edit env_mach_specific
Yellowstone uses modules, so much of this involved loading the correct version of compilers, netcdf, ESMF tools, etc. I think loading the netcdf and pnetcdf modules defined environment variables that I refer to in the Macros file. I also set some MP_ environment variables.
(vi) edit Macros
$ diff Macros.orig Macros
9,10d8
< SLIBS+=# USERDEFINED $(shell $(NETCDF_PATH)/bin/nc-config --flibs)
<
13,14d10
< CONFIG_ARGS:=
<
19,20d14
< ESMF_LIBDIR:=
<
31,33c25
< MPICC:= mpicc
<
< MPICXX:= mpicxx
---
> MPICC:= mpiicc
35c27
< MPIFC:= mpif90
---
> MPICXX:= mpiicpc
37c29
< MPI_LIB_NAME:=
---
> MPIFC:= mpiifort
39c31
< MPI_PATH:=
---
> NETCDF_PATH:=$(NETCDF)
41c33
< NETCDF_PATH:= USERDEFINED_MUST_EDIT_THIS
---
> PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs
43c35
< PNETCDF_PATH:=
---
> PNETCDF_PATH:=$(PNETCDF)
(vii) Build
$ ./test.userdefined.build
[lots of output]
CESM BUILDEXE SCRIPT HAS FINISHED SUCCESSFULLY
-------------------------------------------------------------------------