Skip to content

Commit

Permalink
allow compilation from maindir
Browse files Browse the repository at this point in the history
  • Loading branch information
sstaehler committed Apr 17, 2018
1 parent 279473a commit 71f8010
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 23 deletions.
22 changes: 22 additions & 0 deletions Makefile.TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include make_axisem.macros

all: MESHER/xmesh SOLVER/axisem

MESHER/xmesh: MESHER/gitversion.h ./make_axisem.macros
@cd MESHER; $(MAKE) $(MFLAGS)

SOLVER/axisem: SOLVER/gitversion.h ./make_axisem.macros
@cd SOLVER; $(MAKE) $(MFLAGS)

clean:
cd MESHER; rm -f *.o *.M *.mod *.d *.il core *.html *.gcda *.gcno *.h; cd ..
cd SOLVER; rm -f *.o *.M *.mod *.d *.il core *.html *.gcda *.gcno *.h; cd ..
rm -f bin/axisem bin/xmesh

SOLVER/gitversion.h: .git/HEAD .git/index
echo "character(len=*), parameter :: gitversion = \"$(shell git rev-parse HEAD)\"" > $@

MESHER/gitversion.h: .git/HEAD .git/index
echo "character(len=*), parameter :: gitversion = \"$(shell git rev-parse HEAD)\"" > $@


2 changes: 2 additions & 0 deletions copytemplates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ cp MESHER/Makefile.TEMPLATE MESHER/Makefile
cp MESHER/inparam_mesh.TEMPLATE MESHER/inparam_mesh
cp SOLVER/inparam_basic.TEMPLATE SOLVER/inparam_basic
cp SOLVER/inparam_advanced.TEMPLATE SOLVER/inparam_advanced
cp SOLVER/inparam_basic.TEMPLATE inparam_basic
cp SOLVER/inparam_advanced.TEMPLATE inparam_advanced
cp SOLVER/STATIONS.TEMPLATE SOLVER/STATIONS
cp SOLVER/inparam_source.TEMPLATE SOLVER/inparam_source
cp SOLVER/inparam_hetero.TEMPLATE SOLVER/inparam_hetero
Expand Down
51 changes: 28 additions & 23 deletions submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
import argparse
import glob

int_models = ['prem_iso', 'prem_iso_solid', 'prem_iso_onecrust',
'prem_iso_light', 'prem_iso_solid_light',
'prem_ani', 'prem_ani_onecrust', 'prem_ani_light',
'ak135', 'ak135f', 'iasp91']


def create_inparam_mesh(mesh_file, mesh_period, nrad, ncl, ntheta=0,
max_depth=None, max_colat=None):
with open('inparam_mesh', 'w') as fid:
if mesh_file in \
['prem_iso', 'prem_iso_solid', 'prem_iso_onecrust',
'prem_iso_light', 'prem_iso_solid_light',
'prem_ani', 'prem_ani_onecrust', 'prem_ani_light',
'ak135', 'ak135f', 'iasp91']:
if mesh_file in int_models:

fid.write('BACKGROUND_MODEL %s\n' % mesh_file)
fid.write('EXT_MODEL none \n')
Expand Down Expand Up @@ -96,36 +97,48 @@ def define_arguments():
helptext = "Job directory name. \n"
parser.add_argument('job_name', help=helptext)

helptext = 'Mesh file \n'
helptext = 'Mesh file. Choose path to external mesh file or one\n' \
+ 'of the following AxiSEM internal models:\n' \
+ "'prem_iso', 'prem_iso_solid', 'prem_iso_onecrust',\n" \
+ "'prem_iso_light', 'prem_iso_solid_light',\n" \
+ "'prem_ani', 'prem_ani_onecrust', 'prem_ani_light',\n" \
+ "'ak135', 'ak135f', 'iasp91'\n"
parser.add_argument('mesh_file', help=helptext)

helptext = 'Mesh period \n'
parser.add_argument('mesh_period', type=float, help=helptext)

helptext = 'Number of radial slices \n'
helptext = 'Number of radial slices (default: 1)\n'
parser.add_argument('--nrad', type=int, help=helptext,
default=1)

helptext = 'Number of theta slices \n'
helptext = 'Number of theta slices (default: 2)\n' \
+ 'Set to 0 to use the maximum number possible for this\n' \
+ 'model and frequency'
parser.add_argument('--ntheta', type=int, help=helptext,
default=2)

helptext = 'Number of coarsening layers\n'
parser.add_argument('--ncl', type=int, help=helptext,
default=1)
helptext = 'Job type (local, CSCS Daint)\n'
parser.add_argument('-j', '--jobtype', type=str,
default='local',
help=helptext)

helptext = 'Maximum colatitude\n'
helptext = 'Maximum colatitude of mesh (default: 180 degree)\n'
parser.add_argument('--max_colat', type=float,
help=helptext)

helptext = 'Maximum depth in kilometer\n'
helptext = 'Maximum depth in kilometer (default: radius)\n'
parser.add_argument('--max_depth', type=float,
help=helptext)

helptext = 'Source depth in kilometer\n'
parser.add_argument('--src_depth', type=float, default=0.0,
help=helptext)

helptext = 'Number of coarsening layers (default: 1)\n'
parser.add_argument('--ncl', type=int, help=helptext,
default=1)

helptext = 'Wall time for the solver in hours\n'
parser.add_argument('-w', '--walltime', type=float, default=1.0,
help=helptext)
Expand All @@ -140,11 +153,6 @@ def define_arguments():
default='ACCOUNT',
help=helptext)

helptext = 'Job type (local, CSCS Daint)\n'
parser.add_argument('-j', '--jobtype', type=str,
default='local',
help=helptext)

return parser


Expand Down Expand Up @@ -176,11 +184,7 @@ def define_arguments():

os.chdir(meshdir)

if args.mesh_file in [
'prem_iso', 'prem_iso_solid', 'prem_iso_onecrust',
'prem_iso_light', 'prem_iso_solid_light',
'prem_ani', 'prem_ani_onecrust', 'prem_ani_light',
'ak135', 'ak135f', 'iasp91']:
if args.mesh_file in int_models:
print(' Using internal model %s' % args.mesh_file)
int_model = True
else:
Expand Down Expand Up @@ -368,6 +372,7 @@ def define_arguments():
repack_call

# Submit the jobs
# Only necessary, if the job is not run locally

if args.jobtype == 'Daint': # Daint (CSCS), Slurm-based
path_sbatch_FT = os.path.join(rundir, 'job_%s_FT.sh' % (jobname))
Expand Down

0 comments on commit 71f8010

Please sign in to comment.