1ccaff030SJeremy L Thompson# Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 2ccaff030SJeremy L Thompson# Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 3ccaff030SJeremy L Thompson# All Rights reserved. See files LICENSE and NOTICE for details. 4ccaff030SJeremy L Thompson# 5ccaff030SJeremy L Thompson# This file is part of CEED, a collection of benchmarks, miniapps, software 6ccaff030SJeremy L Thompson# libraries and APIs for efficient high-order finite element and spectral 7ccaff030SJeremy L Thompson# element discretizations for exascale applications. For more information and 8ccaff030SJeremy L Thompson# source code availability see http://github.com/ceed. 9ccaff030SJeremy L Thompson# 10ccaff030SJeremy L Thompson# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11ccaff030SJeremy L Thompson# a collaborative effort of two U.S. Department of Energy organizations (Office 12ccaff030SJeremy L Thompson# of Science and the National Nuclear Security Administration) responsible for 13ccaff030SJeremy L Thompson# the planning and preparation of a capable exascale ecosystem, including 14ccaff030SJeremy L Thompson# software, applications, hardware, advanced system engineering and early 15ccaff030SJeremy L Thompson# testbed platforms, in support of the nation's exascale computing imperative. 16ccaff030SJeremy L Thompson 17777ff853SJeremy L ThompsonCOMMON ?= ../../common.mk 18777ff853SJeremy L Thompson-include $(COMMON) 19777ff853SJeremy L Thompson 20ccaff030SJeremy L Thompson# Note: PETSC_ARCH can be undefined or empty for installations which do not use 21ccaff030SJeremy L Thompson# PETSC_ARCH - for example when using PETSc installed through Spack. 22ccaff030SJeremy L ThompsonPETSc.pc := $(PETSC_DIR)/$(PETSC_ARCH)/lib/pkgconfig/PETSc.pc 23ccaff030SJeremy L ThompsonCEED_DIR ?= ../.. 24ccaff030SJeremy L Thompsonceed.pc := $(CEED_DIR)/lib/pkgconfig/ceed.pc 25ccaff030SJeremy L Thompson 26ccaff030SJeremy L ThompsonCC = $(call pkgconf, --variable=ccompiler $(PETSc.pc) $(ceed.pc)) 27ccaff030SJeremy L ThompsonCFLAGS = -std=c99 \ 28ccaff030SJeremy L Thompson $(call pkgconf, --variable=cflags_extra $(PETSc.pc)) \ 29ccaff030SJeremy L Thompson $(call pkgconf, --cflags-only-other $(PETSc.pc)) \ 3028b8c626SJed Brown $(OPT) 3128b8c626SJed BrownCPPFLAGS = $(call pkgconf, --cflags-only-I $(PETSc.pc) $(ceed.pc)) \ 3228b8c626SJed Brown $(call pkgconf, --variable=cflags_dep $(PETSc.pc)) 33ccaff030SJeremy L ThompsonLDFLAGS = $(call pkgconf, --libs-only-L --libs-only-other $(PETSc.pc) $(ceed.pc)) 34ccaff030SJeremy L ThompsonLDFLAGS += $(patsubst -L%, $(call pkgconf, --variable=ldflag_rpath $(PETSc.pc))%, $(call pkgconf, --libs-only-L $(PETSc.pc) $(ceed.pc))) 35ccaff030SJeremy L ThompsonLDLIBS = $(call pkgconf, --libs-only-l $(PETSc.pc) $(ceed.pc)) -lm 36ccaff030SJeremy L Thompson 37ccaff030SJeremy L ThompsonOBJDIR := build 38ccaff030SJeremy L ThompsonSRCDIR := src 39ccaff030SJeremy L Thompson 40ccaff030SJeremy L Thompsonsrc.c := elasticity.c $(sort $(wildcard $(SRCDIR)/*.c)) 41ccaff030SJeremy L Thompsonsrc.o = $(src.c:%.c=$(OBJDIR)/%.o) 42ccaff030SJeremy L Thompson 43ccaff030SJeremy L Thompsonall: elasticity 44ccaff030SJeremy L Thompson 45ccaff030SJeremy L Thompsonelasticity: $(src.o) | $(PETSc.pc) $(ceed.pc) 4628b8c626SJed Brown $(call quiet,LINK.o) $(CEED_LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ 47ccaff030SJeremy L Thompson 48ccaff030SJeremy L Thompson.SECONDEXPANSION: # to expand $$(@D)/.DIR 49ccaff030SJeremy L Thompson%/.DIR : 50ccaff030SJeremy L Thompson @mkdir -p $(@D) 51ccaff030SJeremy L Thompson @touch $@ 52ccaff030SJeremy L Thompson 53777ff853SJeremy L Thompson# Quiet, color output 54777ff853SJeremy L Thompsonquiet ?= $($(1)) 55ccaff030SJeremy L Thompson 56ccaff030SJeremy L Thompson$(OBJDIR)/%.o : %.c | $$(@D)/.DIR 57ccaff030SJeremy L Thompson $(call quiet,CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(abspath $<) 58ccaff030SJeremy L Thompson 59ccaff030SJeremy L Thompson# Rules for building the examples 60ccaff030SJeremy L Thompson#%: %.c 61ccaff030SJeremy L Thompson 62ccaff030SJeremy L Thompsonprint: $(PETSc.pc) $(ceed.pc) 63ccaff030SJeremy L Thompson $(info CC : $(CC)) 64ccaff030SJeremy L Thompson $(info CFLAGS : $(CFLAGS)) 65ccaff030SJeremy L Thompson $(info CPPFLAGS: $(CPPFLAGS)) 66ccaff030SJeremy L Thompson $(info LDFLAGS : $(LDFLAGS)) 67ccaff030SJeremy L Thompson $(info LDLIBS : $(LDLIBS)) 68ccaff030SJeremy L Thompson @true 69ccaff030SJeremy L Thompson 70ccaff030SJeremy L Thompsonclean: 71788f67f3Sjeremylt $(RM) -r $(OBJDIR) elasticity *.vtu 72ccaff030SJeremy L Thompson 73ccaff030SJeremy L Thompson$(PETSc.pc): 74ccaff030SJeremy L Thompson $(if $(wildcard $@),,$(error \ 75ccaff030SJeremy L Thompson PETSc config not found at $@. Please set PETSC_DIR and PETSC_ARCH)) 76ccaff030SJeremy L Thompson 77ccaff030SJeremy L Thompson.PHONY: all print clean 78ccaff030SJeremy L Thompson 79ccaff030SJeremy L Thompsonpkgconf = $(shell pkg-config $1 | sed -e 's/^"//g' -e 's/"$$//g') 80ccaff030SJeremy L Thompson 818355605fSKaren (Ren) Stengel# E = 2 * mu + (1 + nu) 82*ffa5d67cSJeremy L Thompsontests-output/NH-strain.csv: args = -problem FSInitial-NH1 -E 2.8 -nu 0.4 83*ffa5d67cSJeremy L Thompsontests-output/MR-strain.csv: args = -problem FSInitial-MR1 -mu_1 1 -mu_2 0.0 -nu .4 84*ffa5d67cSJeremy L Thompsontests-output/MR-strain1.csv: args = -problem FSInitial-MR1 -mu_1 .5 -mu_2 0.5 -nu .4 858355605fSKaren (Ren) Stengel 86*ffa5d67cSJeremy L Thompsontests-output/%.csv: elasticity 878355605fSKaren (Ren) Stengel ./$< $(args) -degree 2 -dm_plex_box_faces 3,3,3 -num_steps 15 -bc_clamp 6 -bc_traction 5 -bc_traction_5 0,0,-1 -snes_converged_reason -snes_linesearch_atol 1e-30 -strain_energy_monitor $@ 888355605fSKaren (Ren) Stengel 89ccaff030SJeremy L Thompson-include $(src.o:%.o=%.d) 90