diff --git a/docs/documentation/case.md b/docs/documentation/case.md index 037338cccf..5b3f54b202 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -522,6 +522,9 @@ To restart the simulation from $k$-th time step, see [Restarting Cases](running. | `probe_wrt` | Logical | Write the flow chosen probes data files for each time step | | `num_probes` | Integer | Number of probes | | `probe(i)%[x,y,z]` | Real | Coordinates of probe $i$ | +| `output_partial_domain` | Logical | Output part of the domain | +| `[x,y,z]_output%beg` | Real | Beginning of the output domain in the [x,y,z]-direction | +| `[x,y,z]_output%end` | Real | End of the output domain in the [x,y,z]-direction | The table lists formatted database output parameters. The parameters define variables that are outputted from simulation and file types and formats of data as well as options for post-processing. @@ -549,6 +552,11 @@ If `file_per_process` is true, then pre_process, simulation, and post_process mu - `probe_wrt` activates the output of state variables at coordinates specified by `probe(i)%[x;y,z]`. +- `output_partial_domain` activates the output of part of the domain specified by `[x,y,z]_output%beg` and `[x,y,z]_output%end`. +This is useful for large domains where only a portion of the domain is of interest. +It is not supported when `precision = 1` and `format = 1`. +It also cannot be enabled with `flux_wrt`, `heat_ratio_wrt`, `pres_inf_wrt`, `c_wrt`, `omega_wrt`, `ib`, `schlieren_wrt`, or `qm_wrt`. + ### 8. Acoustic Source {#acoustic-source} | Parameter | Type | Description | diff --git a/docs/examples.sh b/docs/examples.sh old mode 100644 new mode 100755 index 0608e33023..7a2e77df18 --- a/docs/examples.sh +++ b/docs/examples.sh @@ -1,6 +1,8 @@ #!/bin/bash -set -e +MAX_HEIGHT=400 + +set -e -x examples_md="$1/docs/documentation/examples.md" rm "$examples_md" || true @@ -11,11 +13,11 @@ for casedir in $(find "$1/examples/" -mindepth 1 -maxdepth 1 -type d); do casename="$(basename "$casedir")" if [ -f "$casedir/README.md" ]; then - sed -e "s/\.png/-$casename-example\.png/g" "$casedir/README.md" | sed 's/^#/##/g' >> "$examples_md" + sed -e "s/\.png/-$casename-example\.png/g" "$casedir/README.md" | sed 's/^#/##/g' | sed "s/MAX_HEIGHT/$MAX_HEIGHT/g" >> "$examples_md" echo '' >> "$examples_md" for png in $(find "$casedir" -maxdepth 1 -name '*.png'); do cp "$png" "$1/docs/documentation/$(basename "$png" | sed s/\.png//g)-$casename-example.png" done fi -done \ No newline at end of file +done diff --git a/examples/1D_inert_shocktube/README.md b/examples/1D_inert_shocktube/README.md index 07305487d5..0ad895304a 100644 --- a/examples/1D_inert_shocktube/README.md +++ b/examples/1D_inert_shocktube/README.md @@ -1,12 +1,12 @@ # 1D Multi-Component Inert Shock Tube -References: +Reference: > P. J. Martínez Ferrer, R. Buttay, G. Lehnasch, and A. Mura, “A detailed verification procedure for compressible reactive multicomponent Navier–Stokes solvers”, Comput. & Fluids, vol. 89, pp. 88–110, Jan. 2014. Accessed: Oct. 13, 2024. [Online]. Available: https://doi.org/10.1016/j.compfluid.2013.10.014 ## Initial Condition -![Initial Condition](initial.png) + ## Results -![Results](result.png) \ No newline at end of file + diff --git a/examples/1D_laxshocktube/README.md b/examples/1D_laxshocktube/README.md index 5e5f5a0e36..092aaedcf6 100644 --- a/examples/1D_laxshocktube/README.md +++ b/examples/1D_laxshocktube/README.md @@ -1,11 +1,12 @@ # Lax shock tube problem (1D) -Reference: P. D. Lax, Weak solutions of nonlinear hyperbolic equations and their numerical computation, Communications on pure and applied mathematics 7 (1) (1954) 159–193. +Reference: +> P. D. Lax, Weak solutions of nonlinear hyperbolic equations and their numerical computation, Communications on pure and applied mathematics 7 (1) (1954) 159–193. ## Initial Condition -![Initial Condition](initial.png) + ## Result -![Result](result.png) + diff --git a/examples/1D_reactive_shocktube/README.md b/examples/1D_reactive_shocktube/README.md index 9c2d64b3f4..fce3dadabc 100644 --- a/examples/1D_reactive_shocktube/README.md +++ b/examples/1D_reactive_shocktube/README.md @@ -7,8 +7,8 @@ References: ## Initial Condition -![Initial Condition](initial.png) + ## Results -![Results](result.png) \ No newline at end of file + diff --git a/examples/1D_shuosher_old/README.md b/examples/1D_shuosher_old/README.md index 498bc2be27..dcbfae459d 100644 --- a/examples/1D_shuosher_old/README.md +++ b/examples/1D_shuosher_old/README.md @@ -1,11 +1,12 @@ # Shu-Osher problem (1D) -Reference: C. W. Shu, S. Osher, Efficient implementation of essentially non-oscillatory shock-capturing schemes, Journal of Computational Physics 77 (2) (1988) 439–471. doi:10.1016/0021-9991(88)90177-5. +Reference: +> C. W. Shu, S. Osher, Efficient implementation of essentially non-oscillatory shock-capturing schemes, Journal of Computational Physics 77 (2) (1988) 439–471. doi:10.1016/0021-9991(88)90177-5. ## Initial Condition -![Initial Condition](initial.png) + ## Result -![Result](result.png) + diff --git a/examples/1D_titarevtorro/README.md b/examples/1D_titarevtorro/README.md index aaa2615525..42a346eae0 100644 --- a/examples/1D_titarevtorro/README.md +++ b/examples/1D_titarevtorro/README.md @@ -1,11 +1,12 @@ # Titarev-Toro problem (1D) -Reference: V. A. Titarev, E. F. Toro, Finite-volume WENO schemes for three-dimensional conservation laws, Journal of Computational Physics 201 (1) (2004) 238–260. +Reference: +> V. A. Titarev, E. F. Toro, Finite-volume WENO schemes for three-dimensional conservation laws, Journal of Computational Physics 201 (1) (2004) 238–260. ## Initial Condition -![Initial Condition](initial.png) + ## Result -![Result](result.png) + diff --git a/examples/2D_hardcodied_ic/README.md b/examples/2D_hardcodied_ic/README.md index d4161530f9..fc0fbf037d 100644 --- a/examples/2D_hardcodied_ic/README.md +++ b/examples/2D_hardcodied_ic/README.md @@ -1,9 +1,6 @@ # 2D Hardcodied IC Example -## Initial Condition +## Initial Condition and Result -![Initial Condition](initial.png) - -## Result - -![Result](result.png) \ No newline at end of file + + diff --git a/examples/2D_ibm_cfl_dt/README.md b/examples/2D_ibm_cfl_dt/README.md index 7fb6de1caa..cb8e5055f5 100644 --- a/examples/2D_ibm_cfl_dt/README.md +++ b/examples/2D_ibm_cfl_dt/README.md @@ -2,4 +2,4 @@ ## Result -![Result](result.png) + diff --git a/examples/2D_isentropicvortex/README.md b/examples/2D_isentropicvortex/README.md index 72032fbe1e..7c8ef4d9e2 100644 --- a/examples/2D_isentropicvortex/README.md +++ b/examples/2D_isentropicvortex/README.md @@ -1,11 +1,12 @@ # Isentropic vortex problem (2D) -Reference: Coralic, V., & Colonius, T. (2014). Finite-volume Weno scheme for viscous compressible multicomponent flows. Journal of Computational Physics, 274, 95–121. https://doi.org/10.1016/j.jcp.2014.06.003 +Reference: +> Coralic, V., & Colonius, T. (2014). Finite-volume Weno scheme for viscous compressible multicomponent flows. Journal of Computational Physics, 274, 95–121. https://doi.org/10.1016/j.jcp.2014.06.003 ## Density -![Density](alpha_rho1.png) + ## Density Norms -![Density Norms](density_norms.png) + diff --git a/examples/2D_lid_driven_cavity/README.md b/examples/2D_lid_driven_cavity/README.md index 737642936b..bbaf08f73d 100644 --- a/examples/2D_lid_driven_cavity/README.md +++ b/examples/2D_lid_driven_cavity/README.md @@ -1,16 +1,17 @@ # Lid-Driven Cavity Problem (2D) -Reference: Bezgin, D. A., & Buhendwa A. B., & Adams N. A. (2022). JAX-FLUIDS: A fully-differentiable high-order computational fluid dynamics solver for compressible two-phase flows. arXiv:2203.13760 +Reference: +> Bezgin, D. A., & Buhendwa A. B., & Adams N. A. (2022). JAX-FLUIDS: A fully-differentiable high-order computational fluid dynamics solver for compressible two-phase flows. arXiv:2203.13760 -Reference: Ghia, U., & Ghia, K. N., & Shin, C. T. (1982). High-re solutions for incompressible flow +> Ghia, U., & Ghia, K. N., & Shin, C. T. (1982). High-re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method. Journal of Computational Physics, 48, 387-411 Video: https://youtube.com/shorts/JEP28scZrBM?feature=share ## Final Condition -![Final Condition](final_condition.png) + ## Centerline Velocities -![Centerline Velocities](centerline_velocities.png) + diff --git a/examples/2D_rayleigh_taylor/README.md b/examples/2D_rayleigh_taylor/README.md index 1338f6a107..c0ff7e08e0 100644 --- a/examples/2D_rayleigh_taylor/README.md +++ b/examples/2D_rayleigh_taylor/README.md @@ -1,9 +1,5 @@ # Rayleigh-Taylor Instability (2D) -## Final Condition - -![Final Condition](final_condition.png) - -## Centerline Velocities - -![Linear Theory Comparison](linear_theory.jpg) +## Final Condition and Linear Theory + + diff --git a/examples/2D_rayleigh_taylor/final_condition.png b/examples/2D_rayleigh_taylor/final_condition.png index dec95ee6d3..9267f2f88c 100644 Binary files a/examples/2D_rayleigh_taylor/final_condition.png and b/examples/2D_rayleigh_taylor/final_condition.png differ diff --git a/examples/2D_rayleigh_taylor/linear_theory.jpg b/examples/2D_rayleigh_taylor/linear_theory.jpg deleted file mode 100644 index 84b9ba11c4..0000000000 Binary files a/examples/2D_rayleigh_taylor/linear_theory.jpg and /dev/null differ diff --git a/examples/2D_rayleigh_taylor/linear_theory.png b/examples/2D_rayleigh_taylor/linear_theory.png new file mode 100644 index 0000000000..1411fdf593 Binary files /dev/null and b/examples/2D_rayleigh_taylor/linear_theory.png differ diff --git a/examples/2D_riemann_test/README.md b/examples/2D_riemann_test/README.md index 4e644c9885..db2960046b 100644 --- a/examples/2D_riemann_test/README.md +++ b/examples/2D_riemann_test/README.md @@ -1,11 +1,9 @@ # 2D Riemann Test (2D) -Reference: Chamarthi, A., & Hoffmann, N., & Nishikawa, H., & Frankel S. (2023). Implicit gradients based conservative numerical scheme for compressible flows. arXiv:2110.05461 +Reference: +> Chamarthi, A., & Hoffmann, N., & Nishikawa, H., & Frankel S. (2023). Implicit gradients based conservative numerical scheme for compressible flows. arXiv:2110.05461 -## Density Initial Condition +## Density Initial and Final Conditions -![Density](alpha_rho1_initial.png) - -## Density Final Condition - -![Density Norms](alpha_rho1_final.png) + + diff --git a/examples/2D_shockdroplet/README.md b/examples/2D_shockdroplet/README.md index b2f2118b5d..a0883aa55b 100644 --- a/examples/2D_shockdroplet/README.md +++ b/examples/2D_shockdroplet/README.md @@ -1,11 +1,12 @@ # Shock Droplet (2D) -Reference: Panchal et. al., A Seven-Equation Diffused Interface Method for Resolved Multiphase Flows, JCP, 475 (2023) +Reference: +> Panchal et. al., A Seven-Equation Diffused Interface Method for Resolved Multiphase Flows, JCP, 475 (2023) ## Initial Condition -![Initial Condition](initial.png) + ## Result -![Result](result.png) \ No newline at end of file + diff --git a/examples/2D_triple_point/README.md b/examples/2D_triple_point/README.md new file mode 100644 index 0000000000..70da10d7f2 --- /dev/null +++ b/examples/2D_triple_point/README.md @@ -0,0 +1,9 @@ +# 2D Triple Point (2D) + +Reference: +> Trojak, W., & Dzanic, T. Positivity-preserving discoutinous spectral element method for compressible multi-species flows. arXiv:2308.02426 + +## Numerical Schlieren at Final Time + + + diff --git a/examples/2D_triple_point/case.py b/examples/2D_triple_point/case.py new file mode 100755 index 0000000000..59ac429b05 --- /dev/null +++ b/examples/2D_triple_point/case.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +import math +import json + +eps = 1e-8 +Nx = 699 +Ny = 299 + +print(json.dumps({ + # Logistics ================================================ + 'run_time_info' : 'F', + # ========================================================== + + # Computational Domain Parameters ========================== + 'x_domain%beg' : 0, + 'x_domain%end' : 7, + 'y_domain%beg' : 0, + 'y_domain%end' : 3, + 'm' : int(Nx), + 'n' : int(Ny), + 'p' : 0, + 'cfl_adap_dt' : 'T', + 'cfl_target' : 0.8, + 'n_start' : 0, + 't_stop' : 4.0, + 't_save' : 0.04, + # ========================================================== + + # Simulation Algorithm Parameters ========================== + 'num_patches' : 3, + 'model_eqns' : 2, + 'alt_soundspeed' : 'F', + 'num_fluids' : 2, + 'mpp_lim' : 'T', + 'mixture_err' : 'T', + 'time_stepper' : 3, + 'weno_order' : 7, + 'weno_eps' : 1.E-16, + 'weno_Re_flux' : 'F', + 'weno_avg' : 'F', + 'mapped_weno' : 'T', + 'null_weights' : 'F', + 'mp_weno' : 'F', + 'riemann_solver' : 2, + 'wave_speeds' : 1, + 'avg_state' : 2, + 'bc_x%beg' : -3,#11, + 'bc_x%end' : -3,#12 + 'bc_y%beg' : -3, + 'bc_y%end' : -3, + # ========================================================== + + # Formatted Database Files Structure Parameters ============ + 'format' : 1, + 'precision' : 2, + 'prim_vars_wrt' :'T', + 'schlieren_wrt' :'T', + 'fd_order' : 4, + 'schlieren_alpha(1)' : 0.5, + 'schlieren_alpha(2)' : 0.5, + 'parallel_io' :'T', + # ========================================================== + + # Patch 1: Left state ==================================== + 'patch_icpp(1)%geometry' : 3, + 'patch_icpp(1)%x_centroid' : 0.5, + 'patch_icpp(1)%y_centroid' : 3, + 'patch_icpp(1)%length_x' : 1, + 'patch_icpp(1)%length_y' : 6, + 'patch_icpp(1)%vel(1)' : 0., + 'patch_icpp(1)%vel(2)' : 0., + 'patch_icpp(1)%pres' : 1., + 'patch_icpp(1)%alpha_rho(1)' : (1 - eps)*1., + 'patch_icpp(1)%alpha_rho(2)' : eps, + 'patch_icpp(1)%alpha(1)' : 1 - eps, + 'patch_icpp(1)%alpha(2)' : eps, + # ========================================================== + + # Patch 2: Top right state ================================ + 'patch_icpp(2)%geometry' : 3, + 'patch_icpp(2)%alter_patch(1)' : 'T', + 'patch_icpp(2)%x_centroid' : 4, + 'patch_icpp(2)%y_centroid' : 2.25, + 'patch_icpp(2)%length_x' : 6, + 'patch_icpp(2)%length_y' : 1.5, + 'patch_icpp(2)%vel(1)' : 0., + 'patch_icpp(2)%vel(2)' : 0., + 'patch_icpp(2)%pres' : 0.1, + 'patch_icpp(2)%alpha_rho(1)' : (1-eps)*0.125, + 'patch_icpp(2)%alpha_rho(2)' : eps, + 'patch_icpp(2)%alpha(1)' : 1 - eps, + 'patch_icpp(2)%alpha(2)' : eps, + # ========================================================== + + # Patch 3: Bottom right state ============================= + 'patch_icpp(3)%geometry' : 3, + 'patch_icpp(3)%alter_patch(1)' : 'T', + 'patch_icpp(3)%x_centroid' : 4, + 'patch_icpp(3)%y_centroid' : 0.75, + 'patch_icpp(3)%length_x' : 6, + 'patch_icpp(3)%length_y' : 1.5, + 'patch_icpp(3)%vel(1)' : 0., + 'patch_icpp(3)%vel(2)' : 0., + 'patch_icpp(3)%pres' : 0.1, + 'patch_icpp(3)%alpha_rho(1)' : eps, + 'patch_icpp(3)%alpha_rho(2)' : (1 - eps)*1., + 'patch_icpp(3)%alpha(1)' : eps,# 0.95 + 'patch_icpp(3)%alpha(2)' : 1 - eps,#0.05, + # ========================================================== + + # Fluids Physical Parameters =============================== + 'fluid_pp(1)%gamma' : 1./(1.5 - 1.), + 'fluid_pp(1)%pi_inf' : 0, + 'fluid_pp(2)%gamma' : 1./(1.4 - 1.), + 'fluid_pp(2)%pi_inf' : 0., + # ========================================================== +})) diff --git a/examples/2D_triple_point/final.png b/examples/2D_triple_point/final.png new file mode 100644 index 0000000000..5766592cfb Binary files /dev/null and b/examples/2D_triple_point/final.png differ diff --git a/examples/3D_TaylorGreenVortex/README.md b/examples/3D_TaylorGreenVortex/README.md index 984e8a7d70..b2bc1ebe11 100644 --- a/examples/3D_TaylorGreenVortex/README.md +++ b/examples/3D_TaylorGreenVortex/README.md @@ -1,8 +1,10 @@ # Taylor-Green Vortex (3D) -Reference: Hillewaert, K. (2013). TestCase C3.5 - DNS of the transition of the Taylor-Green vortex, Re=1600 - Introduction and result summary. 2nd International Workshop on high-order methods for CFD. +Reference: +> Hillewaert, K. (2013). TestCase C3.5 - DNS of the transition of the Taylor-Green vortex, Re=1600 - Introduction and result summary. 2nd International Workshop on high-order methods for CFD. ## Final Condition This figure shows the isosurface with zero q-criterion. -![Density](result.png) + + diff --git a/examples/3D_ibm_bowshock/README.md b/examples/3D_ibm_bowshock/README.md index f701b53ed7..97bb2283d6 100644 --- a/examples/3D_ibm_bowshock/README.md +++ b/examples/3D_ibm_bowshock/README.md @@ -2,5 +2,5 @@ ## Final Condition -![Density](result.png) + diff --git a/examples/3D_rayleigh_taylor/README.md b/examples/3D_rayleigh_taylor/README.md index 068caa1435..7806f51810 100644 --- a/examples/3D_rayleigh_taylor/README.md +++ b/examples/3D_rayleigh_taylor/README.md @@ -1,9 +1,6 @@ # Rayleigh-Taylor Instability (3D) -## Final Condition +## Final Condition and Linear Theory -![Final Condition](final_condition.png) - -## Centerline Velocities - -![Linear Theory Comparison](linear_theory.png) + + diff --git a/examples/nD_perfect_reactor/README.md b/examples/nD_perfect_reactor/README.md index c15131ff4b..8e83f673c1 100644 --- a/examples/nD_perfect_reactor/README.md +++ b/examples/nD_perfect_reactor/README.md @@ -1,6 +1,7 @@ # Perfectly Stirred Reactor -Reference: G. B. Skinner and G. H. Ringrose, “Ignition Delays of a Hydrogen—Oxygen—Argon Mixture at Relatively Low Temperatures”, J. Chem. Phys., vol. 42, no. 6, pp. 2190–2192, Mar. 1965. Accessed: Oct. 13, 2024. [Online]. Available: https://doi.org/10.1063/1.1696266. +Reference: +> G. B. Skinner and G. H. Ringrose, “Ignition Delays of a Hydrogen—Oxygen—Argon Mixture at Relatively Low Temperatures”, J. Chem. Phys., vol. 42, no. 6, pp. 2190–2192, Mar. 1965. Accessed: Oct. 13, 2024. [Online]. Available: https://doi.org/10.1063/1.1696266. ```bash $ python3 analyze.py @@ -10,4 +11,4 @@ Induction Times ([OH] >= 1e-6): + (Che)MFC: 5.130e-05 s ``` -![Result](result.png) \ No newline at end of file + diff --git a/src/post_process/m_checker.fpp b/src/post_process/m_checker.fpp index 817e2ce004..2e587eea12 100644 --- a/src/post_process/m_checker.fpp +++ b/src/post_process/m_checker.fpp @@ -26,6 +26,7 @@ contains subroutine s_check_inputs call s_check_inputs_output_format + call s_check_inputs_partial_domain call s_check_inputs_partial_density call s_check_inputs_velocity call s_check_inputs_flux_limiter @@ -43,6 +44,21 @@ contains @:PROHIBIT(precision /= 1 .and. precision /= 2) end subroutine s_check_inputs_output_format + !> Checks constraints on partial domain parameters + subroutine s_check_inputs_partial_domain + @:PROHIBIT(output_partial_domain .and. format == 1) + @:PROHIBIT(output_partial_domain .and. precision == 1) + @:PROHIBIT(output_partial_domain .and. any([flux_wrt, heat_ratio_wrt, pres_inf_wrt, c_wrt, schlieren_wrt, qm_wrt, ib, any(omega_wrt)])) + + @:PROHIBIT(output_partial_domain .and. (f_is_default(x_output%beg) .or. f_is_default(x_output%end))) + @:PROHIBIT(output_partial_domain .and. n /= 0 .and. (f_is_default(y_output%beg) .or. f_is_default(y_output%end))) + @:PROHIBIT(output_partial_domain .and. p /= 0 .and. (f_is_default(z_output%beg) .or. f_is_default(z_output%end))) + + #:for X in ['x', 'y', 'z'] + @:PROHIBIT(${X}$_output%beg > ${X}$_output%end) + #:endfor + end subroutine s_check_inputs_partial_domain + !> Checks constraints on partial density parameters subroutine s_check_inputs_partial_density character(len=5) :: iStr diff --git a/src/post_process/m_data_output.fpp b/src/post_process/m_data_output.fpp index 812e39b8a7..0815e2a264 100644 --- a/src/post_process/m_data_output.fpp +++ b/src/post_process/m_data_output.fpp @@ -28,6 +28,7 @@ module m_data_output implicit none private; public :: s_initialize_data_output_module, & + s_define_output_region, & s_open_formatted_database_file, & s_open_intf_data_file, & s_open_energy_data_file, & @@ -368,6 +369,9 @@ contains ! Pressure if (pres_wrt .or. prim_vars_wrt) dbvars = dbvars + 1 + ! Elastic stresses + if (hypoelasticity) dbvars = dbvars + (num_dims*(num_dims + 1))/2 + ! Volume fraction(s) if ((model_eqns == 2) .or. (model_eqns == 3)) then @@ -433,6 +437,42 @@ contains end subroutine s_initialize_data_output_module ! -------------------------- + subroutine s_define_output_region + + integer :: i + integer :: lower_bound, upper_bound + + #:for X, M in [('x', 'm'), ('y', 'n'), ('z', 'p')] + + if (${M}$ == 0) return ! Early return for y or z if simulation is 1D or 2D + + lower_bound = -offset_${X}$%beg + upper_bound = ${M}$+offset_${X}$%end + + do i = lower_bound, upper_bound + if (${X}$_cc(i) > ${X}$_output%beg) then + ${X}$_output_idx%beg = i + offset_${X}$%beg + exit + end if + end do + + do i = upper_bound, lower_bound, -1 + if (${X}$_cc(i) < ${X}$_output%end) then + ${X}$_output_idx%end = i + offset_${X}$%beg + exit + end if + end do + + ! If no grid points are within the output region + if ((${X}$_cc(lower_bound) > ${X}$_output%end) .or. (${X}$_cc(upper_bound) < ${X}$_output%beg)) then + ${X}$_output_idx%beg = 0 + ${X}$_output_idx%end = 0 + end if + + #:endfor + + end subroutine s_define_output_region + subroutine s_open_formatted_database_file(t_step) ! -------------------- ! Description: This subroutine opens a new formatted database file, or ! replaces an old one, and readies it for the data storage @@ -523,7 +563,14 @@ contains ! file by describing in it the dimensionality of post-processed ! data as well as the total number of flow variable(s) that will ! eventually be stored in it - write (dbfile) m, n, p, dbvars + if (output_partial_domain) then + write (dbfile) x_output_idx%end - x_output_idx%beg, & + y_output_idx%end - y_output_idx%beg, & + z_output_idx%end - z_output_idx%beg, & + dbvars + else + write (dbfile) m, n, p, dbvars + end if ! Next, analogous steps to the ones above are carried out by the ! root process to create and setup the formatted database master @@ -542,7 +589,11 @@ contains '. Exiting ...') end if - write (dbroot) m_root, 0, 0, dbvars + if (output_partial_domain) then + write (dbroot) x_output_idx%end - x_output_idx%beg, 0, 0, dbvars + else + write (dbroot) m_root, 0, 0, dbvars + end if end if @@ -751,7 +802,13 @@ contains real(y_cb, sp), & real(z_cb, sp) else - write (dbfile) x_cb, y_cb, z_cb + if (output_partial_domain) then + write (dbfile) x_cb(x_output_idx%beg - 1:x_output_idx%end), & + y_cb(y_output_idx%beg - 1:y_output_idx%end), & + z_cb(z_output_idx%beg - 1:z_output_idx%end) + else + write (dbfile) x_cb, y_cb, z_cb + end if end if elseif (n > 0) then @@ -759,7 +816,12 @@ contains write (dbfile) real(x_cb, sp), & real(y_cb, sp) else - write (dbfile) x_cb, y_cb + if (output_partial_domain) then + write (dbfile) x_cb(x_output_idx%beg - 1:x_output_idx%end), & + y_cb(y_output_idx%beg - 1:y_output_idx%end) + else + write (dbfile) x_cb, y_cb + end if end if ! One-dimensional local grid data is written to the formatted @@ -768,9 +830,13 @@ contains else if (precision == 1) then - write (dbfile) real(x_cb, wp) + write (dbfile) real(x_cb, sp) else - write (dbfile) x_cb + if (output_partial_domain) then + write (dbfile) x_cb(x_output_idx%beg - 1:x_output_idx%end) + else + write (dbfile) x_cb + end if end if if (num_procs > 1) then @@ -783,7 +849,11 @@ contains if (precision == 1) then write (dbroot) real(x_root_cb, wp) else - write (dbroot) x_root_cb + if (output_partial_domain) then + write (dbroot) x_root_cb(x_output_idx%beg - 1:x_output_idx%end) + else + write (dbroot) x_root_cb + end if end if end if diff --git a/src/post_process/m_global_parameters.fpp b/src/post_process/m_global_parameters.fpp index 5f169d6437..df3a297851 100644 --- a/src/post_process/m_global_parameters.fpp +++ b/src/post_process/m_global_parameters.fpp @@ -198,6 +198,11 @@ module m_global_parameters integer :: precision !< Floating point precision of the database file(s) + logical :: output_partial_domain !< Specify portion of domain to output for post-processing + + type(bounds_info) :: x_output, y_output, z_output !< Portion of domain to output for post-processing + type(int_bounds_info) :: x_output_idx, y_output_idx, z_output_idx !< Indices of domain to output for post-processing + !> @name Size of the ghost zone layer in the x-, y- and z-coordinate directions. !! The definition of the ghost zone layers is only necessary when using the !! Silo database file format in multidimensions. These zones provide VisIt @@ -434,6 +439,15 @@ contains ! IBM num_ibs = dflt_int + ! Output partial domain + output_partial_domain = .false. + x_output%beg = dflt_real + x_output%end = dflt_real + y_output%beg = dflt_real + y_output%end = dflt_real + z_output%beg = dflt_real + z_output%end = dflt_real + end subroutine s_assign_default_values_to_user_inputs !> Computation of parameters, allocation procedures, and/or @@ -676,6 +690,15 @@ contains species_idx%end = 1 end if + if (output_partial_domain) then + x_output_idx%beg = 0 + x_output_idx%end = 0 + y_output_idx%beg = 0 + y_output_idx%end = 0 + z_output_idx%beg = 0 + z_output_idx%end = 0 + end if + momxb = mom_idx%beg momxe = mom_idx%end advxb = adv_idx%beg diff --git a/src/post_process/m_mpi_proxy.fpp b/src/post_process/m_mpi_proxy.fpp index 6ba1fa3b1c..4147ef794f 100644 --- a/src/post_process/m_mpi_proxy.fpp +++ b/src/post_process/m_mpi_proxy.fpp @@ -170,8 +170,7 @@ contains & 'prim_vars_wrt', 'c_wrt', 'qm_wrt','schlieren_wrt', 'bubbles_euler', 'qbmm', & & 'polytropic', 'polydisperse', 'file_per_process', 'relax', 'cf_wrt', & & 'adv_n', 'ib', 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', & - & 'surface_tension', 'hyperelasticity', 'kymograph', & - & 'bubbles_lagrange', 'rkck_adap_dt' ] + & 'surface_tension', 'hyperelasticity', 'bubbles_lagrange', 'rkck_adap_dt', 'output_partial_domain', 'kymograph'] call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr) #:endfor @@ -192,7 +191,9 @@ contains end do #:for VAR in [ 'pref', 'rhoref', 'R0ref', 'poly_sigma', 'Web', 'Ca', & - & 'Re_inv', 'sigma', 't_save', 't_stop' ] + & 'Re_inv', 'sigma', 't_save', 't_stop', & + & 'x_output%beg', 'x_output%end', 'y_output%beg', & + & 'y_output%end', 'z_output%beg', 'z_output%end' ] call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr) #:endfor call MPI_BCAST(schlieren_alpha(1), num_fluids_max, mpi_p, 0, MPI_COMM_WORLD, ierr) diff --git a/src/post_process/m_start_up.f90 b/src/post_process/m_start_up.f90 index 31e366535d..9473adcbac 100644 --- a/src/post_process/m_start_up.f90 +++ b/src/post_process/m_start_up.f90 @@ -70,6 +70,7 @@ subroutine s_read_input_file num_fluids, mpp_lim, & weno_order, bc_x, & bc_y, bc_z, fluid_pp, format, precision, & + output_partial_domain, x_output, y_output, z_output, & hypoelasticity, G, & chem_wrt_Y, chem_wrt_T, avg_state, & alpha_rho_wrt, rho_wrt, mom_wrt, vel_wrt, & @@ -198,6 +199,25 @@ subroutine s_save_data(t_step, varname, pres, c, H) integer :: i, j, k, l + integer :: x_beg, x_end, y_beg, y_end, z_beg, z_end + + if (output_partial_domain) then + call s_define_output_region + x_beg = -offset_x%beg + x_output_idx%beg + x_end = offset_x%end + x_output_idx%end + y_beg = -offset_y%beg + y_output_idx%beg + y_end = offset_y%end + y_output_idx%end + z_beg = -offset_z%beg + z_output_idx%beg + z_end = offset_z%end + z_output_idx%end + else + x_beg = -offset_x%beg + x_end = offset_x%end + m + y_beg = -offset_y%beg + y_end = offset_y%end + n + z_beg = -offset_z%beg + z_end = offset_z%end + p + end if + ! Opening a new formatted database file call s_open_formatted_database_file(t_step) @@ -247,11 +267,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if ((model_eqns == 2) .or. (model_eqns == 3) .or. (model_eqns == 4)) then do i = 1, num_fluids if (alpha_rho_wrt(i) .or. (cons_vars_wrt .or. prim_vars_wrt)) then - - q_sf = q_cons_vf(i)%sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_cons_vf(i)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) if (model_eqns /= 4) then write (varname, '(A,I0)') 'alpha_rho', i else @@ -270,11 +286,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if (rho_wrt & .or. & (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) then - - q_sf = rho_sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = rho_sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A)') 'rho' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -286,12 +298,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) ! Adding the momentum to the formatted database file ------------------- do i = 1, E_idx - mom_idx%beg if (mom_wrt(i) .or. cons_vars_wrt) then - - q_sf = q_cons_vf(i + cont_idx%end)%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_cons_vf(i + cont_idx%end)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I0)') 'mom', i call s_write_variable_to_formatted_database_file(varname, t_step) @@ -304,12 +311,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) ! Adding the velocity to the formatted database file ------------------- do i = 1, E_idx - mom_idx%beg if (vel_wrt(i) .or. prim_vars_wrt) then - - q_sf = q_prim_vf(i + cont_idx%end)%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_prim_vf(i + cont_idx%end)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I0)') 'vel', i call s_write_variable_to_formatted_database_file(varname, t_step) @@ -323,10 +325,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if (chemistry) then do i = 1, num_species if (chem_wrt_Y(i) .or. prim_vars_wrt) then - q_sf = q_prim_vf(chemxb + i - 1)%sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_prim_vf(chemxb + i - 1)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,A)') 'Y_', trim(species_names(i)) call s_write_variable_to_formatted_database_file(varname, t_step) @@ -336,10 +335,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) end do if (chem_wrt_T) then - q_sf = q_T_sf%sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_T_sf%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A)') 'T' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -363,11 +359,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) ! Adding the energy to the formatted database file --------------------- if (E_wrt .or. cons_vars_wrt) then - - q_sf = q_cons_vf(E_idx)%sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_cons_vf(E_idx)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A)') 'E' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -419,11 +411,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) ! Adding the pressure to the formatted database file ------------------- if (pres_wrt .or. prim_vars_wrt) then - - q_sf = q_prim_vf(E_idx)%sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_prim_vf(E_idx)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A)') 'pres' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -439,12 +427,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) do i = 1, num_fluids - 1 if (alpha_wrt(i) .or. (cons_vars_wrt .or. prim_vars_wrt)) then - - q_sf = q_cons_vf(i + E_idx)%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_cons_vf(i + E_idx)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I0)') 'alpha', i call s_write_variable_to_formatted_database_file(varname, t_step) @@ -456,12 +439,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if (alpha_wrt(num_fluids) & .or. & (cons_vars_wrt .or. prim_vars_wrt)) then - - q_sf = q_cons_vf(adv_idx%end)%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_cons_vf(adv_idx%end)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I0)') 'alpha', num_fluids call s_write_variable_to_formatted_database_file(varname, t_step) @@ -476,11 +454,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if (gamma_wrt & .or. & (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) then - - q_sf = gamma_sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = gamma_sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A)') 'gamma' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -506,11 +480,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if (pi_inf_wrt & .or. & (model_eqns == 1 .and. (cons_vars_wrt .or. prim_vars_wrt))) then - - q_sf = pi_inf_sf(-offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = pi_inf_sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A)') 'pi_inf' call s_write_variable_to_formatted_database_file(varname, t_step) @@ -638,11 +608,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) ! Adding the volume fraction(s) to the formatted database file --------- if (bubbles_euler) then do i = adv_idx%beg, adv_idx%end - q_sf = q_cons_vf(i)%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) - + q_sf = q_cons_vf(i)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I0)') 'alpha', i - E_idx call s_write_variable_to_formatted_database_file(varname, t_step) varname(:) = ' ' @@ -653,10 +619,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if (bubbles_euler) then !nR do i = 1, nb - q_sf = q_cons_vf(bub_idx%rs(i))%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) + q_sf = q_cons_vf(bub_idx%rs(i))%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I3.3)') 'nR', i call s_write_variable_to_formatted_database_file(varname, t_step) varname(:) = ' ' @@ -664,10 +627,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) !nRdot do i = 1, nb - q_sf = q_cons_vf(bub_idx%vs(i))%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) + q_sf = q_cons_vf(bub_idx%vs(i))%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I3.3)') 'nV', i call s_write_variable_to_formatted_database_file(varname, t_step) varname(:) = ' ' @@ -675,10 +635,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) if ((polytropic .neqv. .true.) .and. (.not. qbmm)) then !nP do i = 1, nb - q_sf = q_cons_vf(bub_idx%ps(i))%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) + q_sf = q_cons_vf(bub_idx%ps(i))%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I3.3)') 'nP', i call s_write_variable_to_formatted_database_file(varname, t_step) varname(:) = ' ' @@ -686,10 +643,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) !nM do i = 1, nb - q_sf = q_cons_vf(bub_idx%ms(i))%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) + q_sf = q_cons_vf(bub_idx%ms(i))%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A,I3.3)') 'nM', i call s_write_variable_to_formatted_database_file(varname, t_step) varname(:) = ' ' @@ -698,10 +652,7 @@ subroutine s_save_data(t_step, varname, pres, c, H) ! number density if (adv_n) then - q_sf = q_cons_vf(n_idx)%sf( & - -offset_x%beg:m + offset_x%end, & - -offset_y%beg:n + offset_y%end, & - -offset_z%beg:p + offset_z%end) + q_sf = q_cons_vf(n_idx)%sf(x_beg:x_end, y_beg:y_end, z_beg:z_end) write (varname, '(A)') 'n' call s_write_variable_to_formatted_database_file(varname, t_step) varname(:) = ' ' diff --git a/toolchain/mfc/run/case_dicts.py b/toolchain/mfc/run/case_dicts.py index b0c3164936..86c4fc5529 100644 --- a/toolchain/mfc/run/case_dicts.py +++ b/toolchain/mfc/run/case_dicts.py @@ -385,6 +385,7 @@ def analytic(self): 'n_start': ParamType.INT, 'surface_tension': ParamType.LOG, 'kymograph': ParamType.LOG, + 'output_partial_domain': ParamType.LOG, 'bubbles_lagrange': ParamType.LOG, }) @@ -394,6 +395,9 @@ def analytic(self): POST_PROCESS[f'bc_{cmp}%beg'] = ParamType.INT POST_PROCESS[f'bc_{cmp}%end'] = ParamType.INT + POST_PROCESS[f'{cmp}_output%beg'] = ParamType.REAL + POST_PROCESS[f'{cmp}_output%end'] = ParamType.REAL + for real_attr in ["mom_wrt", "vel_wrt", "flux_wrt", "omega_wrt"]: POST_PROCESS[f'{real_attr}({cmp_id})'] = ParamType.LOG diff --git a/toolchain/mfc/test/cases.py b/toolchain/mfc/test/cases.py index a9320119b5..21425fb41f 100644 --- a/toolchain/mfc/test/cases.py +++ b/toolchain/mfc/test/cases.py @@ -848,7 +848,7 @@ def foreach_example(): continue # List of currently broken examples -> currently attempting to fix! - brokenCases = ["2D_ibm_cfl_dt", "1D_sodHypo", "2D_viscous", "2D_laplace_pressure_jump", "2D_bubbly_steady_shock", "2D_advection", "2D_hardcodied_ic", "2D_ibm_multiphase", "2D_acoustic_broadband", "1D_inert_shocktube", "1D_reactive_shocktube", "2D_ibm_steady_shock", "3D_performance_test", "3D_ibm_stl_ellipsoid", "3D_sphbubcollapse", "2D_ibm_stl_wedge", "3D_ibm_stl_pyramid", "3D_ibm_bowshock", "3D_turb_mixing", "2D_mixing_artificial_Ma", "3D_lagrange_bubblescreen", "3D_hyper_bubingel", "3D_hyper_bubinwater", "1D_hyper_impact_strong", "1D_hyper_impact_weak", "1D_hypo_impact_strong", "1D_hypo_impact_weak" ] + brokenCases = ["2D_ibm_cfl_dt", "1D_sodHypo", "2D_viscous", "2D_laplace_pressure_jump", "2D_bubbly_steady_shock", "2D_advection", "2D_hardcodied_ic", "2D_ibm_multiphase", "2D_acoustic_broadband", "1D_inert_shocktube", "1D_reactive_shocktube", "2D_ibm_steady_shock", "3D_performance_test", "3D_ibm_stl_ellipsoid", "3D_sphbubcollapse", "2D_ibm_stl_wedge", "3D_ibm_stl_pyramid", "3D_ibm_bowshock", "3D_turb_mixing", "2D_mixing_artificial_Ma", "3D_lagrange_bubblescreen", "3D_hyper_bubingel", "3D_hyper_bubinwater", "2D_triple_point", "1D_hyper_impact_strong", "1D_hyper_impact_weak", "1D_hypo_impact_strong", "1D_hypo_impact_weak" ] if path in brokenCases: continue name = f"{path.split('_')[0]} -> Example -> {'_'.join(path.split('_')[1:])}"