-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/205_multivof: add sharpening_circle
- Loading branch information
Showing
10 changed files
with
202 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
velocity.pdf | ||
build | ||
add.conf | ||
b.dat | ||
*.pyc | ||
*.swp | ||
*.log | ||
*.status | ||
*.h5 | ||
*.xmf | ||
*.vts | ||
*.pvd | ||
stat.dat | ||
pid | ||
arg | ||
out | ||
job.id.last | ||
job.id | ||
base.conf | ||
mesh.conf | ||
np | ||
*.csv | ||
s*.vtk | ||
a.conf | ||
add.conf | ||
tl | ||
*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
m = 16 16 1 | ||
bs = 16 16 1 | ||
np = 1 | ||
tl = 1440 | ||
|
||
include $(shell ap.makesim) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
set -eu | ||
d=smooth | ||
echo > add.conf | ||
make cleanrun | ||
(cd vis && rm -vf *.png && ./vis_vf.py ../s_*.vtk) | ||
(cd vis && mkdir -p "$d" && mv -v a_*.png "$d") | ||
(vis/plot_volume_error.py --output vis/$d/volume_error.pdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
set -eu | ||
d=stepwise | ||
echo "include stepwise.conf" > add.conf | ||
make cleanrun | ||
(cd vis && rm -vf *.png && ./vis_vf.py ../s_*.vtk) | ||
(cd vis && mkdir -p "$d" && mv -v a_*.png "$d") | ||
(vis/plot_volume_error.py --output vis/$d/volume_error.pdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 2d | ||
set int dim 2 | ||
set int hypre_periodic_z 1 | ||
|
||
set double extent 4 | ||
|
||
# numerical | ||
set int sharpen 1 | ||
set double sharpen_cfl 0.1 | ||
set int enable_fluid 0 | ||
set string bc_path inline | ||
|
||
# time | ||
set double dtmax 1 | ||
set double tmax 10 | ||
set double dump_field_dt 1 | ||
set int dumpinit 1 | ||
set string dumplist vf | ||
set int verbose_stages 0 | ||
set int dumppolymarch 0 | ||
|
||
# volume fraction | ||
set string init_vf radial_trapezoid | ||
set vect radial_trapezoid_c 2 2 0 | ||
set double radial_trapezoid_rmin 0.5 | ||
set double radial_trapezoid_rmax 1.5 | ||
|
||
#include stepwise.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set double radial_trapezoid_rmin 1 | ||
set double radial_trapezoid_rmax 1.000001 |
38 changes: 38 additions & 0 deletions
38
examples/205_multivof/sharpening_circle/vis/plot_volume_error.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import numpy as np | ||
import argparse | ||
from argparse import Namespace | ||
import plottools | ||
import matplotlib.pyplot as plt | ||
import aphros | ||
import os | ||
|
||
myname = os.path.splitext(os.path.basename(__file__))[0] | ||
|
||
|
||
def load_stat(path): | ||
u = np.genfromtxt(path, names=True) | ||
res = Namespace(**{k: u[k] for k in u.dtype.names}) | ||
return res | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('dir', nargs='?', type=str, default='.') | ||
parser.add_argument('--output', type=str, default="volume_error.pdf") | ||
parser.add_argument('--ylim', nargs='*', type=float, default=[-1, 1]) | ||
parser.add_argument('--yscpow', nargs='*', type=int, default=-15) | ||
args = parser.parse_args() | ||
|
||
plottools.apply_params(plt) | ||
|
||
stat = load_stat(os.path.join(args.dir, "stat.dat")) | ||
|
||
fig, ax = plt.subplots(figsize=(1.9,1.5)) | ||
yscpow = args.yscpow | ||
if args.ylim: | ||
ax.set_ylim(*args.ylim) | ||
ax.set_xlabel('step') | ||
ax.set_ylabel(r'volume error $[10^{{{:}}}]$'.format(yscpow)) | ||
ax.plot(stat.step, stat.vol2_diff * 10 ** (-yscpow)) | ||
plottools.savefig(fig, args.output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/usr/bin/env pvbatch | ||
|
||
# state file generated using paraview version 5.9.0 | ||
|
||
from paraview.simple import * | ||
paraview.simple._DisableFirstRenderCameraReset() | ||
|
||
import argparse | ||
import os | ||
import re | ||
import paratools | ||
|
||
|
||
parser = argparse.ArgumentParser( | ||
description="Renders interface shapes from s_*.vtk files.") | ||
parser.add_argument('files', nargs='*', help="list of data files 's_*.vtk'") | ||
parser.add_argument('--force', | ||
action="store_true", | ||
help="overwrite existing files") | ||
args = parser.parse_args() | ||
|
||
renderView1 = CreateView('RenderView') | ||
renderView1.ViewSize = [1080, 1080] | ||
renderView1.OrientationAxesVisibility = 0 | ||
renderView1.UseLight = 0 | ||
renderView1.CameraPosition = [2, 2, 4] | ||
renderView1.CameraFocalPoint = [2, 2, 0] | ||
renderView1.CameraFocalDisk = 1.0 | ||
renderView1.CameraParallelProjection = 1 | ||
renderView1.CameraParallelScale = 1.5 | ||
renderView1.Background = [1] * 3 | ||
|
||
# https://github.com/OrdnanceSurvey/GeoDataViz-Toolkit/tree/master/Colours | ||
clhex_geo = [ | ||
"FF1F5B", "00CD6C", "009ADE", "AF58BA", "FFC61E", "F28522", "A0B1BA", | ||
"A6761D", "E9002D", "FFAA00", "00B000" | ||
] | ||
|
||
|
||
def rgb(h): | ||
return list(int(h[i:i + 2], 16) / 255. for i in (0, 2, 4)) | ||
|
||
|
||
steps = paratools.ReplaceFilename(args.files, '{}', keep_dir=False) | ||
source_s = LegacyVTKReader( | ||
FileNames=paratools.ReplaceFilename(args.files, 's_{}.vtk')) | ||
source_vf = XDMFReader( | ||
FileNames=paratools.ReplaceFilename(args.files, 'vf_{}.xmf')) | ||
source_vf.CellArrayStatus = ['vf'] | ||
sources_ft, timearrays = paratools.ApplyForceTime([source_s, source_vf]) | ||
source_s, source_vf = sources_ft | ||
|
||
vfDisplay = Show(source_vf, renderView1) | ||
vfLUT = GetColorTransferFunction('vf') | ||
vfLUT.AutomaticRescaleRangeMode = 'Never' | ||
vfLUT.RGBPoints = [0.0] + [1] * 3 + [1.0] + rgb(clhex_geo[2]) | ||
vfLUT.ColorSpace = 'RGB' | ||
vfLUT.NanColor = [1.0, 0.0, 0.0] | ||
vfLUT.Discretize = 0 | ||
vfLUT.ScalarRangeInitialized = 1.0 | ||
vfPWF = GetOpacityTransferFunction('vf') | ||
vfPWF.ScalarRangeInitialized = 1 | ||
vfDisplay.Representation = 'Surface' | ||
vfDisplay.ColorArrayName = ['CELLS', 'vf'] | ||
vfDisplay.LookupTable = vfLUT | ||
|
||
surfDisplay = Show(source_s, renderView1) | ||
surfDisplay.Representation = 'Wireframe' | ||
surfDisplay.AmbientColor = [0.0, 0.0, 0.0] | ||
surfDisplay.ColorArrayName = ['POINTS', ''] | ||
surfDisplay.DiffuseColor = [0.0, 0.0, 0.0] | ||
surfDisplay.LineWidth = 8 | ||
|
||
paratools.SetTimeStep(1, sources_ft, timearrays) | ||
|
||
paratools.SaveAnimation(steps, | ||
renderView1, | ||
sources_ft, | ||
timearrays, | ||
force=args.force) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters