Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pydrex.viscosity module #201

Merged
merged 16 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions examples/fluidity/advection2d/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GBM_MOBILITY := 10
GBS_THRESHOLD := 0.3
NUCLEATION_EFFICIENCY := 5

$(OUT_DIR)/fluidity.log-0: $(OUT_DIR)/$(SIM_NAME).flml \
all: $(OUT_DIR)/$(SIM_NAME).flml \
$(OUT_DIR)/$(SIM_NAME).msh $(OUT_DIR)/$(SIM_NAME).py $(OUT_DIR)/$(SIM_NAME).ini
@echo "********** Running fluidity with verbose logging enabled..."
./envcheck.sh -f
Expand Down Expand Up @@ -56,6 +56,6 @@ $(OUT_DIR)/$(SIM_NAME).msh:
./envcheck.sh -m
pydrex-mesh -k="rectangle" -a xy $(WIDTH),$(DEPTH) -r G:$(RESOLUTION) $@

.PHONY: clean
.PHONY: all clean
clean:
rm -rf $(OUT_DIR)
4 changes: 2 additions & 2 deletions examples/fluidity/corner2d/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GBM_MOBILITY := 10
GBS_THRESHOLD := 0.3
NUCLEATION_EFFICIENCY := 5

$(OUT_DIR)/fluidity.log-0: $(OUT_DIR)/$(SIM_NAME).flml \
all: $(OUT_DIR)/$(SIM_NAME).flml \
$(OUT_DIR)/$(SIM_NAME).msh $(OUT_DIR)/$(SIM_NAME).py $(OUT_DIR)/$(SIM_NAME).ini
@echo "********** Running fluidity with verbose logging enabled..."
./envcheck.sh -f
Expand Down Expand Up @@ -61,6 +61,6 @@ $(OUT_DIR)/$(SIM_NAME).msh:
pydrex-mesh -k="rectangle" -a xy $(WIDTH),$(DEPTH) \
-c $(HALF_WIDTH),-$(HALF_DEPTH) -r NW:$(RESOLUTION_HI),SE:$(RESOLUTION_LO) $@

.PHONY: clean
.PHONY: all clean
clean:
rm -rf $(OUT_DIR)
94 changes: 94 additions & 0 deletions examples/fluidity/ridge2d/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Make options to keep what's left of our sanity.
.SHELLFLAGS += -u
.ONESHELL:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
# Path options, SIM_NAME is the name of the .msh and .py files.
SIM_NAME := ridge2d
SRC_DIR := ridge2d
OUT_DIR := _out
# Number of processors to use for parallelisation.
NPROCS := 4
# Initial geometry options (in units of metres), passed to `pydrex-mesh`.
# Negative depth value makes z-values negative.
WIDTH := 1e6
DEPTH := -4e5
HALF_WIDTH := $(shell python3 -c 'print($(WIDTH)/2)')
HALF_DEPTH := $(shell python3 -c 'print($(DEPTH)/2)')
RESOLUTION_HI := 5e2
RESOLUTION_LO := 1e4
RESOLUTION_MED := 1e3
# Initial options for temperature field.
SURFACE_TEMP := 273
DIFF_TEMP := 1350
THERM_DIFFUSIVITY := 2.23e-6
THERM_FIT := "Standard"
MIN_AGE := 1
# Initial conditions, used to parametrise velocity fields and spawn particles.
# INIT_HORIZ can be a space-delimited array of values (for multiple particles).
# NOTE: PLATE_SPEED is in cm/yr here.
PLATE_SPEED := 2.0
# INIT_HORIZ := 3.13e4 9.74e4 2.02e5 3.97e5
# INIT_DEPTH := 2e5
# # Recrystallisation parameters.
# STRESS_EXPONENT := 1.5
# DEFORMATION_EXPONENT := 3.5
# GBM_MOBILITY := 10
# GBS_THRESHOLD := 0.3
# NUCLEATION_EFFICIENCY := 5

all: $(OUT_DIR)/$(SIM_NAME)_P$(NPROCS).flml
@echo "********** Running fluidity in parallel with verbose logging enabled..."
cd $(OUT_DIR) && mpiexec -np $(NPROCS) fluidity -v2 -l $<

$(OUT_DIR)/$(SIM_NAME)_P$(NPROCS).flml: $(OUT_DIR)/$(SIM_NAME).flml \
$(OUT_DIR)/$(SIM_NAME).msh $(OUT_DIR)/$(SIM_NAME).py $(OUT_DIR)/$(SIM_NAME).ini
@echo "********** Creating parallel flml file using flredecomp..."
./envcheck.sh -f
cd $(OUT_DIR) && mpiexec -np $(NPROCS) flredecomp -i 1 -o $(NPROCS) $(SIM_NAME) $(SIM_NAME)_P$(NPROCS)

$(OUT_DIR)/$(SIM_NAME).ini: $(OUT_DIR)/$(SIM_NAME).py
@echo "********** Setting up initial conditions and recryst. parameters..."
echo "[initial conditions]" > $@
echo "WIDTH = $(WIDTH)" >> $@
echo "DEPTH = $(DEPTH)" >> $@
echo "HALF_WIDTH = $(HALF_WIDTH)" >> $@
echo "HALF_DEPTH = $(HALF_DEPTH)" >> $@
echo "RESOLUTION_HI = $(RESOLUTION_HI)" >> $@
echo "RESOLUTION_LO = $(RESOLUTION_LO)" >> $@
echo "RESOLUTION_MED = $(RESOLUTION_MED)" >> $@
echo "SURFACE_TEMP = $(SURFACE_TEMP)" >> $@
echo "DIFF_TEMP = $(DIFF_TEMP)" >> $@
echo "THERM_DIFFUSIVITY = $(THERM_DIFFUSIVITY)" >> $@
echo "THERM_FIT = $(THERM_FIT)" >> $@
echo "MIN_AGE = $(MIN_AGE)" >> $@
echo "PLATE_SPEED = $(PLATE_SPEED)" >> $@

$(OUT_DIR)/$(SIM_NAME).msh: $(OUT_DIR)/$(SIM_NAME).geo
@echo "********** Building the mesh file..."
./envcheck.sh -m
gmsh -2 -o $@ $<

$(OUT_DIR)/$(SIM_NAME).py: $(SRC_DIR)/$(SIM_NAME).py
@echo "********** Copying python field setters..."
mkdir -p $(@D)
cp -f $< $@

$(OUT_DIR)/$(SIM_NAME).flml: $(SRC_DIR)/$(SIM_NAME).flml
@echo "********** Copying serial flml file..."
mkdir -p $(@D)
cp -f $< $@

$(OUT_DIR)/$(SIM_NAME).geo: $(SRC_DIR)/$(SIM_NAME).geo
@echo "********* Copying the .geo file..."
mkdir -p $(@D)
sed -i "s/width = .*;/width = $(WIDTH);/" $<
sed -i "s/depth = .*;/depth = $(DEPTH);/" $<
sed -i "s/res_hi = .*;/res_hi = $(RESOLUTION_HI);/" $<
sed -i "s/res_lo = .*;/res_lo = $(RESOLUTION_LO);/" $<
sed -i "s/res_med = .*;/res_med = $(RESOLUTION_MED);/" $<
cp -f $< $@

.PHONY: all clean
clean:
rm -rf $(OUT_DIR)
Binary file added examples/fluidity/ridge2d/ridge2d-mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading