User Tools

Site Tools


hydrocode_makefile

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

hydrocode_makefile [2014/06/02 22:10] (current)
bartl created
Line 1: Line 1:
 +Since VH-1 does the setup of the problem in the main code, I wanted to have a way to have several different problems set up at the same time inside one source folder. My solution is as follows, let me know if you have a better way to do this.  --- //Alex B.//
  
 +  - set up a problem name in the beginning of the makefile and create the corresponding ''​vhone_<​problemname>​.f90''​
 +  - run ''​make link''​ to create a symlink of this file to vhone.f90 before compiling.
 +  - compile as usual with ''​make''​. This will create the file vh1-starter-<​problemname>​ in the main directory.
 +  - type ''​make run''​ to let it cd into the appropriate directory and run the newly compiled file, thus eliminating the need to cd between the two directories all the time.
 +
 +Here is the modified makefile I use for the starter version, it can easily be adapted to the serial version, although one might find that files other than vhone.f90 differ from problem to problem:
 +<file bash makefile>​
 +#name of the problem
 +PROBLEM = insertnameofproblemhere
 +
 +# Specify search path for subroutines that perform 1D ppmlr hydrodynamics
 +VPATH = ../​PPMLR ​
 +#
 +# System-dependent parameters ​
 +#
 +# F90           ​FORTRAN 90 Compiler
 +# LDR           ​Program to load the objects into an executable, typically the same as F90
 +# LDFLAGS ​      Flags to pass to the compiler during linking
 +# LIBS          A list of libraries to link with the executable, normally only netCDF
 +#
 +#  the following is set for gfortran compiler ​ http://​gcc.gnu.org/​wiki/​GFortran
 +#
 +F90 = gfortran ​
 +FFLAGS = -c 
 +LDR= gfortran ​             ​
 +LDRFLAGS= ​             ​
 +LIBS=  ​
 +#
 +#
 +# List of objects to build multidimensional VH-1 hydro code:
 +
 +VHOBJS = vh1mods.o vhone.o \
 +         ​ppmlr.o forces.o flatten.o evolve.o remap.o \
 +         ​states.o boundary.o volume.o riemann.o parabola.o
 +         
 +
 +# Lines from here on down should not need to be changed. ​ They are the
 +# actual rules which make uses to build the executable
 +#
 +.SUFFIXES: .f90 .o
 +
 +.f90.o:
 + $(F90) $(FFLAGS) $< 
 +
 +vhzero:​ $(VHOBJS)
 +
 + $(LDR) $(LDRFLAGS) -o vh1-starter $(VHOBJS) $(LIBS); mv vh1-starter ../​../​vh1-starter-$(PROBLEM)
 +#
 +#
 +clean:
 + rm -f *.o *.l
 +
 +clobber:​ clean
 + rm -f ../​../​vh1-starter-$(PROBLEM)
 + rm -f *.mod
 +
 +link:
 + ln -sf vhone_$(PROBLEM).f90 vhone.f90
 +
 +run:
 + cd ../../; ./​vh1-starter-$(PROBLEM)
 +
 +# Dependencies for the object files
 +vhone.o: ​   vhone.f90 ​   global.mod sweeps.mod sweepsize.mod ​
 +
 +evolve.o: ​  ​evolve.f90 ​  ​global.mod sweeps.mod sweepsize.mod
 +flatten.o: ​ flatten.f90 ​ global.mod sweeps.mod sweepsize.mod
 +forces.o: ​  ​forces.f90 ​  ​global.mod sweeps.mod sweepsize.mod
 +ppmlr.o: ​   ppmlr.f90 ​   global.mod sweeps.mod sweepsize.mod
 +remap.o: ​   remap.f90 ​   global.mod sweeps.mod sweepsize.mod
 +states.o: ​  ​states.f90 ​  ​global.mod sweeps.mod sweepsize.mod
 +boundary.o: boundary.f90 global.mod sweeps.mod sweepsize.mod
 +volume.o: ​  ​volume.f90 ​  ​global.mod sweeps.mod sweepsize.mod
 +parabola.o: parabola.f90 sweepsize.mod
 +riemann.o: ​ riemann.f90 ​ sweepsize.mod
 +</​file>​
hydrocode_makefile.txt ยท Last modified: 2014/06/02 22:10 by bartl