Skip to content

Commit 8b96995

Browse files
committed
documentation and additional input checks
1 parent c0bb0a8 commit 8b96995

File tree

4 files changed

+203
-3
lines changed

4 files changed

+203
-3
lines changed

docs/documentation/case.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,10 @@ The parameters are used to specify options in algorithms that are used to integr
408408
Models and assumptions that are used to formulate and discritize the governing equations are described in [Bryngelson et al. (2019)](references.md).
409409
Details of the simulation algorithms and implementation of the WENO scheme can be found in [Coralic (2015)](references.md).
410410

411-
- `bc_[x,y,z]%[beg,end]` specifies the boundary conditions at the beginning and the end of domain boundaries in each coordinate direction by a negative integer from -1 through -12.
411+
- `bc_[x,y,z]%[beg,end]` specifies the boundary conditions at the beginning and the end of domain boundaries in each coordinate direction by a negative integer from -1 through -16.
412412
See table [Boundary Conditions](#boundary-conditions) for details.
413+
Boundary condition patches can be used with non-characteristic boundary conditions.
414+
Their use is detailed in [Boundary Condition Patches](#boundary-condition-patches).
413415

414416
- `bc_[x,y,z]%%vb[1,2,3]` specifies the velocity in the (x,1), (y,2), (z,3) direction applied to `bc_[x,y,z]%%beg` when using `bc_[x,y,z]%%beg = -16`.
415417
Tangential velocities require viscosity, `weno_avg = T`, and `bc_[x,y,z]%%beg = -16` to work properly. Normal velocities require `bc_[x,y,z]%%end = -15` or `\bc_[x,y,z]%%end = -16` to work properly.
@@ -479,6 +481,29 @@ This option requires `weno_Re_flux` to be true because cell boundary values are
479481

480482
- `hypoelasticity` activates elastic stress calculations for fluid-solid interactions. Requires `G` to be set in the fluid material's parameters.
481483

484+
#### Boundary Condition Patches
485+
486+
| Parameter | Type | Description |
487+
| ---: | :----: | :--- |
488+
| `num_bc_patches` | Integer | Number of boundary condition patches |
489+
| `dir`* | Integer | Direction of the boundary patch. [1]: x; [2]: y; [3]: z |
490+
| `loc`* | Integer | Location of the patch in the domain |
491+
| `type`* | Integer | The geometry of the patch. [1]: Line [2]: Circle [3]: Rectangle |
492+
| `x[y,z]_centroid`* | Real | Centroid of the boundary patch in the x[y,z]-direction |
493+
| `length_x[y,z]`* | Real | Length of the boundary patch in the x[y,z]-direction |
494+
| `radius`* | Real | Radius of the boundary patch |
495+
*: These parameters should be prepended with `patch_bc(j)%` where $j$ is the patch index.
496+
497+
Boundary condition patches can be used with the following boundary condition types:
498+
- `-2` reflective
499+
- `-3` ghost cell extrapolation
500+
- `-15` slip wall
501+
- `-16` no-slip wall
502+
- `-17` Dirichlet
503+
504+
Line segements along each domain edge are supported for 2D simulations.
505+
Squares and circles on each face are supported for 3D simulations.
506+
482507
#### Constant Time-Stepping
483508

484509
- `dt` specifies the constant time step size used in the simulation.

examples/2D_advection/asdf.py

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# state file generated using paraview version 5.11.0
2+
import paraview
3+
paraview.compatibility.major = 5
4+
paraview.compatibility.minor = 11
5+
6+
#### import the simple module from the paraview
7+
from paraview.simple import *
8+
import os, re
9+
#### disable automatic camera reset on 'Show'
10+
paraview.simple._DisableFirstRenderCameraReset()
11+
12+
# ----------------------------------------------------------------
13+
# setup views used in the visualization
14+
# ----------------------------------------------------------------
15+
16+
# get the material library
17+
materialLibrary1 = GetMaterialLibrary()
18+
19+
# Create a new 'Render View'
20+
renderView1 = CreateView('RenderView')
21+
renderView1.ViewSize = [2328, 1162]
22+
renderView1.InteractionMode = '2D'
23+
renderView1.AxesGrid = 'GridAxes3DActor'
24+
renderView1.CenterOfRotation = [0.5, 0.5, 0.0]
25+
renderView1.StereoType = 'Crystal Eyes'
26+
renderView1.CameraPosition = [0.5, 0.5, 2.7320508075688776]
27+
renderView1.CameraFocalPoint = [0.5, 0.5, 0.0]
28+
renderView1.CameraFocalDisk = 1.0
29+
renderView1.CameraParallelScale = 0.7071067811865476
30+
renderView1.BackEnd = 'OSPRay raycaster'
31+
renderView1.OSPRayMaterialLibrary = materialLibrary1
32+
33+
SetActiveView(None)
34+
35+
# ----------------------------------------------------------------
36+
# setup view layouts
37+
# ----------------------------------------------------------------
38+
39+
# create new layout object 'Layout #1'
40+
layout1 = CreateLayout(name='Layout #1')
41+
layout1.AssignView(0, renderView1)
42+
layout1.SetSize(2328, 1162)
43+
44+
# ----------------------------------------------------------------
45+
# restore active view
46+
SetActiveView(renderView1)
47+
# ----------------------------------------------------------------
48+
49+
# ----------------------------------------------------------------
50+
# setup the data processing pipelines
51+
# ----------------------------------------------------------------
52+
53+
# create a new 'VisItSiloReader'
54+
case_dir=os.getcwd()
55+
print(case_dir)
56+
# create a new 'VisItSiloReader'
57+
files = glob.glob(f"{case_dir}/silo_hdf5/root/*")
58+
print(files)
59+
sorted_files = sorted(files, key=lambda x: int(x.rsplit('_', 1)[-1][:-5]))
60+
print(sorted_files)
61+
collection_0silo = VisItSiloReader(registrationName='collection_0.silo*', FileName=sorted_files)
62+
collection_0silo.MeshStatus = ['rectilinear_grid']
63+
collection_0silo.CellArrayStatus = ['alpha1', 'alpha2', 'alpha_rho1', 'alpha_rho2', 'pres', 'vel1', 'vel2']
64+
65+
# ----------------------------------------------------------------
66+
# setup the visualization in view 'renderView1'
67+
# ----------------------------------------------------------------
68+
69+
# show data from collection_0silo
70+
collection_0siloDisplay = Show(collection_0silo, renderView1, 'UniformGridRepresentation')
71+
72+
# get 2D transfer function for 'vtkBlockColors'
73+
vtkBlockColorsTF2D = GetTransferFunction2D('vtkBlockColors')
74+
75+
# get color transfer function/color map for 'vtkBlockColors'
76+
vtkBlockColorsLUT = GetColorTransferFunction('vtkBlockColors')
77+
vtkBlockColorsLUT.InterpretValuesAsCategories = 1
78+
vtkBlockColorsLUT.AnnotationsInitialized = 1
79+
vtkBlockColorsLUT.TransferFunction2D = vtkBlockColorsTF2D
80+
vtkBlockColorsLUT.Annotations = ['0', '0', '1', '1', '2', '2', '3', '3', '4', '4', '5', '5', '6', '6', '7', '7', '8', '8', '9', '9', '10', '10', '11', '11']
81+
vtkBlockColorsLUT.ActiveAnnotatedValues = ['0', '1', '2', '3']
82+
vtkBlockColorsLUT.IndexedColors = [1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.63, 0.63, 1.0, 0.67, 0.5, 0.33, 1.0, 0.5, 0.75, 0.53, 0.35, 0.7, 1.0, 0.75, 0.5]
83+
84+
# get opacity transfer function/opacity map for 'vtkBlockColors'
85+
vtkBlockColorsPWF = GetOpacityTransferFunction('vtkBlockColors')
86+
87+
# trace defaults for the display properties.
88+
collection_0siloDisplay.Representation = 'Surface'
89+
collection_0siloDisplay.ColorArrayName = ['FIELD', 'vtkBlockColors']
90+
collection_0siloDisplay.LookupTable = vtkBlockColorsLUT
91+
collection_0siloDisplay.SelectTCoordArray = 'None'
92+
collection_0siloDisplay.SelectNormalArray = 'None'
93+
collection_0siloDisplay.SelectTangentArray = 'None'
94+
collection_0siloDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
95+
collection_0siloDisplay.SelectOrientationVectors = 'None'
96+
collection_0siloDisplay.ScaleFactor = 0.1
97+
collection_0siloDisplay.SelectScaleArray = 'None'
98+
collection_0siloDisplay.GlyphType = 'Arrow'
99+
collection_0siloDisplay.GlyphTableIndexArray = 'None'
100+
collection_0siloDisplay.GaussianRadius = 0.005
101+
collection_0siloDisplay.SetScaleArray = [None, '']
102+
collection_0siloDisplay.ScaleTransferFunction = 'PiecewiseFunction'
103+
collection_0siloDisplay.OpacityArray = [None, '']
104+
collection_0siloDisplay.OpacityTransferFunction = 'PiecewiseFunction'
105+
collection_0siloDisplay.DataAxesGrid = 'GridAxesRepresentation'
106+
collection_0siloDisplay.PolarAxes = 'PolarAxesRepresentation'
107+
collection_0siloDisplay.ScalarOpacityUnitDistance = 0.06564197879454707
108+
collection_0siloDisplay.ScalarOpacityFunction = vtkBlockColorsPWF
109+
collection_0siloDisplay.TransferFunction2D = vtkBlockColorsTF2D
110+
collection_0siloDisplay.OpacityArrayName = ['CELLS', 'alpha1']
111+
collection_0siloDisplay.ColorArray2Name = ['CELLS', 'alpha1']
112+
collection_0siloDisplay.SliceFunction = 'Plane'
113+
collection_0siloDisplay.SelectInputVectors = [None, '']
114+
collection_0siloDisplay.WriteLog = ''
115+
116+
# init the 'Plane' selected for 'SliceFunction'
117+
collection_0siloDisplay.SliceFunction.Origin = [0.5, 0.5, 0.0]
118+
119+
# setup the color legend parameters for each legend in this view
120+
121+
# get color legend/bar for vtkBlockColorsLUT in view renderView1
122+
vtkBlockColorsLUTColorBar = GetScalarBar(vtkBlockColorsLUT, renderView1)
123+
vtkBlockColorsLUTColorBar.Title = 'vtkBlockColors'
124+
vtkBlockColorsLUTColorBar.ComponentTitle = ''
125+
126+
# set color bar visibility
127+
vtkBlockColorsLUTColorBar.Visibility = 1
128+
129+
# show color legend
130+
collection_0siloDisplay.SetScalarBarVisibility(renderView1, True)
131+
132+
# ----------------------------------------------------------------
133+
# setup color maps and opacity mapes used in the visualization
134+
# note: the Get..() functions create a new object, if needed
135+
# ----------------------------------------------------------------
136+
137+
# ----------------------------------------------------------------
138+
# restore active source
139+
SetActiveSource(collection_0silo)
140+
# ----------------------------------------------------------------
141+
142+
# Ensure all time steps are considered
143+
timeKeeper = GetTimeKeeper()
144+
timeSteps = timeKeeper.TimestepValues
145+
146+
animationScene = GetAnimationScene()
147+
148+
directory_path = f"{case_dir}/render"
149+
os.makedirs(directory_path, exist_ok=True)
150+
151+
i = 0
152+
# Save all timesteps
153+
for t in timeSteps:
154+
animationScene.AnimationTime = t
155+
SaveScreenshot(f"{case_dir}/render/pic.{i:04d}.png", renderView1, ImageResolution=[2110,722])
156+
print(i)
157+
i = i + 1
158+

src/common/m_checker_common.fpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ contains
262262

263263
@: PROHIBIT(cyl_coord .and. p > 0 .and. (bc_z%end /= -1 .and. bc_z%end /= -2), &
264264
"bc_z%end must be -1 or -2 for 3D cylindrical coordinates")
265+
266+
#ifndef MFC_POST_PROCESS
267+
if (num_bc_patches > 0) then
268+
#:for DIR in [('x'), ('y'), ('z')]
269+
#:for LOC in [('beg'), ('end')]
270+
@:PROHIBIT(bc_${DIR}$%${LOC}$ == -1 .or. (bc_${DIR}$%${LOC}$ <= -4 .and. bc_${DIR}$%${LOC}$ >= -14), &
271+
"bc_${DIR}$%${LOC}$ is not compatible with num_bc_patches > 0")
272+
#:endfor
273+
#:endfor
274+
endif
275+
#endif
276+
265277
end subroutine s_check_inputs_bc
266278

267279
!> Checks constraints on the stiffened equation of state fluids parameters.

src/pre_process/m_checker.fpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ contains
207207
@:PROHIBIT(num_bc_patches > num_bc_patches_max, "num_bc_patches must be <= "//trim(iStr))
208208

209209
do i = 1, num_bc_patches
210+
call s_int_to_str(i, iStr)
210211

211212
! Line Segment BC
212213
if (patch_bc(i)%geometry == 1) then
@@ -218,6 +219,7 @@ contains
218219
"Line Segment Patch of Dir ${DIR}$ can't have a length in Dir ${DIR}$ or 3" )
219220
#:endfor
220221
end if
222+
221223
! Circle BC
222224
if (patch_bc(i)%geometry == 2) then
223225
@:PROHIBIT(f_is_default(patch_bc(i)%radius), "Circle Patch must have radius defined")
@@ -228,8 +230,8 @@ contains
228230
@:PROHIBIT(patch_bc(i)%dir == ${DIR}$ .and. .not. f_is_default(patch_bc(i)%centroid(${DIR}$)), &
229231
"Circle Patch of Dir ${DIR}$ can't have a centroid in Dir ${DIR}$")
230232
#:endfor
231-
232233
end if
234+
233235
! Rectangle BC
234236
if (patch_bc(i)%geometry == 3) then
235237
@:PROHIBIT( .not. f_is_default(patch_bc(i)%radius), "Rectangle Patch can't have radius defined")
@@ -240,9 +242,12 @@ contains
240242
@:PROHIBIT(patch_bc(i)%dir == ${DIR}$ .and. .not. f_is_default(patch_bc(i)%length(${DIR}$)), &
241243
"Rectangle Patch of Dir ${DIR}$ can't have a length in Dir ${DIR}$")
242244
#:endfor
243-
244245
end if
245246

247+
! Incompatible BC check
248+
@:PROHIBIT(((patch_bc(i)%type >= -14 .and. patch_bc(i)%type <= -4) .or. &
249+
(patch_bc(i)%type == -1) .or. patch_bc(i)%type < -16), &
250+
"Incompatible BC type for boundary condition patch"//trim(iStr))
246251
end do
247252

248253
end subroutine

0 commit comments

Comments
 (0)