### Solver Configuration Example (TOML) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst An example TOML configuration for the solver settings, specifying the system type, spatial order, limiter, and Riemann solver. ```toml [solver] system = "rans-kwsst" order = 2 limiter = "mlp-u2" u2k = 5.0 riemann-solver = "ausmpw+" viscosity = "sutherland" ``` -------------------------------- ### Sutherland Viscosity Model Configuration Example (TOML) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Example TOML configuration for the Sutherland viscosity model, including reference viscosity, temperature, and constants. It also shows how to compute reference viscosity if not provided. ```toml [solver-viscosity-sutherland] muref = "mu" Tref = 300 CpTf = "1 / (gamma -1)*pf/rhof" Ts = 110.4 c1 = 1.458e-6 ``` -------------------------------- ### Time Integrator Configuration Example (TOML) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Example TOML configuration for time integration schemes, specifying the mode, controller, CFL number, and stepper method. ```toml [solver-time-integrator] mode = "steady" controller = "cfl" cfl = 1.0 stepper = "lu-sgs" max-iter = 1000 tolerance = 1e-6 ``` -------------------------------- ### Install pyBaram from Source Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/install.rst This command installs pyBaram directly from its source code using pip's editable install option. This is useful for development or when using the latest code from the repository. It is recommended to run this within a virtual environment. ```bash user@Computer ~/pyBaram$ pip install -e . ``` -------------------------------- ### pyBaram Command-Line Interface Help Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Displays the help message for the pyBaram console script, showing available sub-commands and options. This is the entry point for all pyBaram operations. ```bash user@Computer ~/pyBaram$ pybaram usage: pybaram [-h] [--verbose] {import,partition,run,restart,export} ... positional arguments: {import,partition,run,restart,export} sub-command help import import --help partition partition --help run run --help restart run --help export export --help optional arguments: -h, --help show this help message and exit --verbose, -v ``` -------------------------------- ### Writer Plugin Configuration Example Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configuration for the 'writer' plugin, responsible for saving simulation solution files. Key parameters include 'name' for the filename pattern (supporting iteration and time substitution) and 'iter-out' for specifying the output frequency for steady simulations. ```INI [soln-plugin-writer] name = out-{n} iter-out = 5000 ``` -------------------------------- ### Force Plugin Configuration Example Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configuration for the 'force' plugin, which calculates aerodynamic force and moment coefficients on a specified surface. It requires reference values for density, velocity, pressure, area, and length, and allows defining force and moment directions and centers. 'iter-out' is used for steady simulations and 'dt-out' for unsteady simulations. ```INI [soln-plugin-force-airfoil] iter-out = 50 rho = rhof vel = uf p = pf area = 1.0 length = 1.0 force-dir-name = ld force-dir-l = -sin(aoa/180*pi), cos(aoa/180*pi) force-dir-d = cos(aoa/180*pi), sin(aoa/180*pi) moment-center = 0.25, 0 moment-dir-name = z moment-dir-z = -1 ``` -------------------------------- ### Initial Conditions Configuration Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Defines the initial conditions for the simulation, including density, velocity components, and pressure. Allows for expressions using constants and mathematical functions. ```ini [soln-ics] rho = rhof u = uf*cos(aoa/180*pi) v = uf*sin(aoa/180*pi) p = pf ``` -------------------------------- ### Stats Plugin Configuration Example Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configuration for the 'stats' plugin, which logs simulation data. It includes the 'flushstep' parameter to control the frequency of writing to the log file. Default flushstep is 500. ```INI [soln-plugin-stats] flushstep = 300 ``` -------------------------------- ### Surface Plugin Configuration Example with Expressions Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configuration for the 'surface' plugin, which integrates variables along a specified surface. Users can define 'items' to integrate and provide custom expressions for these items, including using normal vector components (nx, ny, nz). 'iter-out' and 'dt-out' control output frequency for steady and unsteady simulations, respectively. ```INI [soln-plugin-surface-pout] iter-out = 500 items = p0, mdot p0 = p*(1+ (gamma-1)/2*(u**2 + v**2)/(gamma*p/rho))**(gamma/(gamma-1)) mdot = rho*(u*nx+v*ny) ``` -------------------------------- ### Install pyBaram Release Version Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/install.rst This command installs a specific release version of pyBaram using pip. It requires downloading the .whl file from the pyBaram releases page. The version number '0.X.Y' should be replaced with the actual release version. ```bash user@Computer ~/pyBaram$ pip install pybaram-0.X.Y-py3-none-any.whl ``` -------------------------------- ### Run PyBaram Simulation Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/examples.rst Executes a PyBaram simulation using a partitioned mesh file and a configuration file. This command initiates the core CFD solving process. It requires the partitioned .pbrm file and a .ini configuration file. ```bash user@Computer ~/pyBaram$ mpirun -n 4 pybaram run explosion_p4.pbrm explosion.ini ``` ```bash user@Computer ~/pyBaram$ pybaram run rae2822.pbrm rae2822.ini ``` ```bash user@Computer ~/pyBaram$ mpirun -n 16 pybaram run wing_mixed_ph.3_p16.pbrm oneram6.ini ``` ```bash user@Computer ~/pyBaram$ mpirun -n 16 pybaram run hb2_p16.pbrm hb2.ini ``` -------------------------------- ### Create and Activate Conda Environment Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/install.rst This snippet demonstrates how to create a new Conda environment named 'pybaram' and activate it for installing pyBaram and its dependencies. It assumes the user has Anaconda or Miniconda installed. ```bash user@Computer ~/pyBaram$ conda create -n pybaram user@Computer ~/pyBaram$ conda activate pybaram ``` -------------------------------- ### Convert Mesh to PyBaram Format Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/examples.rst Converts mesh files from CGNS format to PyBaram's native format (.pbrm). This is the first step in preparing mesh data for PyBaram simulations. It takes the input CGNS file and outputs a .pbrm file. ```bash user@Computer ~/pyBaram$ pybaram import explosion.cgns explosion.pbrm ``` ```bash user@Computer ~/pyBaram$ pybaram import rae2822.cgns rae2822.pbrm ``` ```bash user@Computer ~/pyBaram$ pybaram import wing_mixed_ph.3.cgns wing_mixed_ph.3.pbrm ``` ```bash user@Computer ~/pyBaram$ pybaram import hb2.cgns hb2.pbrm ``` -------------------------------- ### Steady Simulation Configuration Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configures a steady-state simulation with a specified CFL number, stepper, maximum iterations, tolerance, and residual variable. ```ini [solver-time-integrator] mode = steady cfl = 5.0 stepper = colored-lu-sgs max-iter = 10000 tolerance = 1e-12 res-var = rhou ``` -------------------------------- ### CFL Ramping Configuration Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Sets up a CFL ramping procedure where the CFL number increases linearly over iterations. Specifies the initial iteration for ramping and the final CFL number. ```ini [solver-cfl-ramp] iter0 = 500 max-iter = 2500 max-cfl = 10.0 ``` -------------------------------- ### Export PyBaram Simulation Results to VTK Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/examples.rst Exports simulation results from PyBaram's native format (.pbrs) to the VTK format (.vtu) for visualization. This step makes the simulation data compatible with visualization tools like Paraview. It takes the partitioned .pbrm file and the output .pbrs file, generating a .vtu file. ```bash user@Computer ~/pyBaram$ pybaram export explosion_p4.pbrm out-0.25.pbrs out.vtu ``` ```bash user@Computer ~/pyBaram$ pybaram export rae2822.pbrm out-10000.pbrs out.vtu ``` ```bash user@Computer ~/pyBaram$ pybaram export wing_mixed_ph.3_p16.pbrm out-20000.pbrs out.vtu ``` ```bash user@Computer ~/pyBaram$ pybaram export hb2_p16.pbrm out-5000.pbrs out.vtu ``` -------------------------------- ### Partition Mesh for Parallel Simulation Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/examples.rst Partitions a PyBaram mesh file into a specified number of smaller meshes for parallel processing. This is crucial for distributing the computational load across multiple cores or nodes. It takes the input .pbrm file and the number of partitions, outputting partitioned .pbrm files. ```bash user@Computer ~/pyBaram$ pybaram partition 4 explosion.pbrm explosion_p4.pbrm ``` ```bash user@Computer ~/pyBaram$ pybaram partition 16 wing_mixed_ph.3.pbrm wing_mixed_ph.3_p16.pbrm ``` ```bash user@Computer ~/pyBaram$ pybaram partition 16 hb2.pbrm hb2_p16.pbrm ``` -------------------------------- ### Initial Fluid Properties Calculation (Python) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Calculates initial fluid properties based on Reynolds number, Mach number, and other parameters. Dependencies include standard Python mathematical operations. ```python Re = 6.5e6 mach = 0.729 rhof = 1.0 uf = %(mach)s pf = 1/%(gamma)s mu = %(mach)s/%(Re)s nutf = 4*%(mu)s/%(rhof)s ``` -------------------------------- ### Unsteady Simulation Configuration Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configures a time-marching unsteady simulation using a CFL controller and a TVD-RK3 stepper. Sets the simulation time and initial CFL number. ```ini [solver-time-integrator] controller = cfl stepper = tvd-rk3 time = 0, 0.25 cfl = 0.9 ``` -------------------------------- ### INI Configuration: 3D Inviscid Spherical Explosion Source: https://context7.com/aadl_inha/pybaram/llms.txt Example INI configuration file for a 3D inviscid spherical explosion problem. It specifies backend settings, physical constants, solver parameters, initial conditions, boundary conditions, and output plugins. ```ini [backend-cpu] multi-thread = single [constants] gamma = 1.4 [solver] system = euler order = 2 limiter = mlp-u1 riemann-solver = roem [solver-time-integrator] controller = cfl stepper = tvd-rk3 time = 0, 0.25 cfl = 0.9 [soln-ics] r = sqrt(x*x + y*y + z*z) in = 0.5*(1 - tanh(1e8*(%(r)s-0.4))) out = (1.0 - %(in)s) rho = 1.0*%(in)s + 0.125*%(out)s u = 0 v = 0 w = 0 p = 1.0*%(in)s + 0.1*%(out)s [soln-bcs-outflow] type = sup-out [soln-bcs-sym] type = slip-wall [soln-plugin-writer] name = out-{t:.2f} dt-out = 0.05 [soln-plugin-stats] ``` -------------------------------- ### Import Mesh File (CGNS or Gmsh) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Converts mesh generator output files (CGNS or Gmsh) into the pyBaram mesh file format (.pbrm). This is the first step for preparing mesh data for simulation. ```bash user@Computer ~/pyBaram$ pybaram import mesh.cgns mesh.pbrm ``` -------------------------------- ### Partition Mesh File for MPI Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Partitions an existing pyBaram mesh file into multiple smaller files suitable for MPI parallel computation. The number of partitions is specified. ```bash user@Computer ~/pyBaram$ pybaram partition 2 mesh.pbrm mesh_p2.pbrm ``` -------------------------------- ### Export Solution Data (VTK or Tecplot) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Exports simulation solution data to external file formats, specifically VTK unstructured grid (.vtu) or Tecplot data file (.plt). Requires mesh and solution files as input. ```bash user@Computer ~/pyBaram$ pybaram export mesh.pbrm sol-100.pbrs out.vtu ``` -------------------------------- ### Run Flow Simulation (MPI Parallel) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Executes a flow simulation in parallel using MPI. The simulation is launched with 'mpirun', specifying the number of cores and using a pre-partitioned mesh file. ```bash user@Computer ~/pyBaram$ mpirun -np 2 pybaram run mesh_p2.pbrm conf.ini ``` -------------------------------- ### pyBaram Configuration: CPU Backend Settings Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configures the CPU backend for pyBaram, specifying the multi-threading layer used by Numba. Options include single-threaded, default Numba parallel, OpenMP, or Intel TBB. ```ini [backend-cpu] multi-thread = parallel ``` -------------------------------- ### INI Configuration: Steady-State Turbulent Flow (RANS) Source: https://context7.com/aadl_inha/pybaram/llms.txt Example INI configuration for a steady-state turbulent flow simulation using a RANS model. This configuration includes settings for turbulence, solver parameters, initial conditions, boundary conditions, and force calculation plugins. ```ini [backend-cpu] multi-thread = single [constants] gamma = 1.4 mu = 1.0e-5 Pr = 0.72 Prt = 0.9 [solver] system = rans-sa order = 2 limiter = mlp-u1 riemann-solver = roem [solver-time-integrator] stepper = lu-sgs max-iter = 10000 tolerance = 1e-10 res-var = rho cfl = 10.0 [solver-cfl-ramp] iter0 = 100 max-iter = 1000 max-cfl = 100.0 [soln-ics] rho = 1.225 u = 291.6 v = 0.0 w = 0.0 p = 101325.0 nuhat = 0.00018 [soln-bcs-wall] type = no-slip-wall [soln-bcs-farfield] type = sub-in-sup-out rho = 1.225 u = 291.6 v = 0.0 w = 0.0 p = 101325.0 [soln-plugin-writer] name = converged-{n:06d} iter-out = 1000 [soln-plugin-force-wall] rho = 1.225 vel = 291.6 area = 1.0 length = 1.0 force-dir-name = xy force-dir-x = 0.9998, 0.0175, 0.0 force-dir-y = -0.0175, 0.9998, 0.0 moment-center = 0.25, 0.0, 0.0 iter-out = 100 ``` -------------------------------- ### PyBaram Execution Flow Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/developer_guide.rst Details how pyBaram is executed and the initial steps involved in setting up a simulation. ```APIDOC ## PyBaram Execution Flow ### Description This section outlines the entry point for executing pyBaram and the initial module called for simulation setup. ### Method Command Line Execution ### Endpoint N/A ### Parameters None ### Request Example ```bash pybaram run ``` ### Response N/A The `pybaram` command is linked to `__main__.py`. In `run` or `restart` modes, it calls `process_common` in the `pybaram.api.simulation` module. This module initiates the integrator object and calls its `run` method to perform the simulation. ``` -------------------------------- ### Command-Line Interface (CLI) Source: https://context7.com/aadl_inha/pybaram/llms.txt Provides command-line tools for common pyBaram operations, including mesh import, partitioning, simulation runs, and restarts. ```APIDOC ## Command-Line Interface (CLI) ### Description pyBaram offers a command-line interface for executing various operations without writing Python scripts. ### Commands - **`pybaram import [--scale ]`**: Imports a mesh file. - **`pybaram partition `**: Partitions a mesh file. - **`pybaram run `**: Runs a fresh simulation. - **`pybaram restart `**: Restarts a simulation from a solution file. ### Usage Examples ```bash # Import mesh file pybaram import explosion.cgns explosion.pbrm --scale 1.0 # Partition mesh for parallel computation pybaram partition 4 explosion.pbrm explosion_part.pbrm # Run fresh simulation pybaram run explosion.pbrm explosion.ini # Restart from solution file pybaram restart explosion.pbrm out-0.15.pbrs explosion_restart.ini ``` ### Response #### Success Response (200) Command executes successfully, performing the requested operation. #### Response Example Output will vary based on the command and its success. For example, a successful import might show: `Mesh 'explosion.cgns' imported to 'explosion.pbrm' successfully.` ``` -------------------------------- ### Fresh Simulation Run API Source: https://context7.com/aadl_inha/pybaram/llms.txt Executes a new CFD simulation from scratch using provided mesh and configuration files. ```APIDOC ## Fresh Simulation Run API ### Description Executes a fresh CFD simulation from mesh and configuration files. The MPI communicator can be automatically initialized or provided explicitly. ### Method `run(mesh, cfg, be=None, comm=None)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **mesh** (object) - Required - A pyBaram mesh object (e.g., loaded by `NativeReader`). - **cfg** (object) - Required - A pyBaram INIFile object containing simulation settings. - **be** (object) - Optional - The computational backend to use (e.g., 'cpu'). If None, it's determined from `cfg`. - **comm** (object) - Optional - An MPI communicator object. If None, a default communicator is used. ### Request Example ```python from pybaram.api.simulation import run from pybaram.readers.native import NativeReader from pybaram.inifile import INIFile # Load mesh and configuration mesh = NativeReader('explosion.pbrm') cfg = INIFile('explosion.ini') # Run simulation (MPI communicator initialized automatically) run(mesh, cfg) # Run with custom backend and MPI communicator from pybaram.backends import get_backend from mpi4py import MPI comm = MPI.COMM_WORLD backend = get_backend('cpu', cfg) run(mesh, cfg, be=backend, comm=comm) ``` ### Response #### Success Response (200) Simulation completes successfully. Results are typically saved to files as defined in the configuration. #### Response Example N/A ``` -------------------------------- ### pyBaram Command-Line Interface Source: https://context7.com/aadl_inha/pybaram/llms.txt Command-line interface for running pyBaram operations, including mesh import, partitioning, simulation execution (fresh and restart). Uses a concise syntax for common tasks. ```bash # Import mesh file pybaram import explosion.cgns explosion.pbrm --scale 1.0 # Partition mesh for parallel computation pybaram partition 4 explosion.pbrm explosion_part.pbrm # Run fresh simulation pybaram run explosion.pbrm explosion.ini # Restart from solution file pybaram restart explosion.pbrm out-0.15.pbrs explosion_restart.ini ``` -------------------------------- ### Install Python Packages with Conda Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/install.rst This code installs essential Python packages required for pyBaram using Conda. It includes general scientific computing libraries like NumPy and Numba, data handling libraries like h5py, and parallel computing libraries like mpi4py. ```bash user@Computer ~/pyBaram$ conda install numpy numba h5py metis user@Computer ~/pyBaram$ conda install -c conda-forge mpi4py cgns ``` -------------------------------- ### Far-Field Boundary Condition Configuration Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Configures a far-field boundary condition. This is typically used for simulations where the boundaries are sufficiently far from the object of interest. ```ini [soln-bcs-far] type = far ``` -------------------------------- ### Run Flow Simulation (Serial) Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Executes a flow simulation using a specified mesh file (.pbrm) and a configuration file (.ini). This command runs the simulation in serial mode. ```bash user@Computer ~/pyBaram$ pybaram run mesh.pbrm conf.ini ``` -------------------------------- ### Restart Flow Simulation Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Restarts a flow simulation from a previous state using existing mesh and solution files. Optionally, a different configuration file can be provided to alter simulation methods. ```bash user@Computer ~/pyBaram$ pybaram restart mesh.pbrm sol-100.pbrs ``` -------------------------------- ### Solvers Module Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/developer_guide.rst Details the implementation of governing equations and spatial discretizations within the solvers module. ```APIDOC ## Solvers Module ### Description The `pybaram.solvers` module contains the implementation of the governing equations and their spatial discretizations. It organizes code into submodules for different governing equations, each containing objects like `system`, `elements`, `inters`, and `vertex`. ### Method Class Definitions and Method Implementations ### Endpoint N/A ### Parameters None ### Request Example ```python # Conceptual usage within the integrator # system = System(...) # system.construct_kernels() # system.rhside() ``` ### Response N/A #### Key Objects within Solvers: - **`system`**: Initializes `elements`, `inters`, and `vertex` objects, reads mesh and solution data, and generates kernels for computing the right-hand side. Overlaps non-blocking communications and computations for efficiency. - **`elements`**: Handles element-level computations. - **`inters`**: Manages interface-related computations. - **`vertex`**: Deals with vertex-specific data and computations. #### System Class Hierarchy Examples: - `pybaram.solvers.ranskwsst.system` - `pybaram.solvers.ranssa.system` - `pybaram.solvers.navierstokes.system` - `pybaram.solvers.euler.system` #### Base System Methods: - **`BaseSystem`**: Initiates objects and generates kernels. - **`BaseAdvecSystem.rhside`**: Handles right-hand side computation for advection problems (e.g., Euler systems). - **`BaseAdvecDiffSystem.rhside`**: Handles right-hand side computation for advection-diffusion problems (e.g., Navier-Stokes systems). - **`RANSSystem`**: Initiates objects and generates kernels for RANS simulations. ``` -------------------------------- ### Pybaram: Custom Backend Configuration in Python Source: https://context7.com/aadl_inha/pybaram/llms.txt Python code demonstrating how to configure and use a custom computational backend for Pybaram. It shows loading INI settings, specifying backend options like threading, and integrating the backend into the simulation run process. ```python from pybaram.backends import get_backend from pybaram.inifile import INIFile # Load configuration with backend settings cfg = INIFile() cfg.set('backend-cpu', 'multi-thread', 'single') # Single-threaded # cfg.set('backend-cpu', 'multi-thread', 'omp') # OpenMP threading via Numba # Get backend instance backend = get_backend('cpu', cfg) # Use in simulation from pybaram.api.simulation import run from pybaram.readers.native import NativeReader mesh = NativeReader('mesh.pbrm') run(mesh, cfg, be=backend) ``` -------------------------------- ### Run Fresh CFD Simulation (Python) Source: https://context7.com/aadl_inha/pybaram/llms.txt Executes a new CFD simulation from provided mesh and configuration files. It can automatically initialize MPI communicators or accept a custom backend and communicator. Inputs are mesh and configuration objects, with optional backend and MPI communicator. ```python from pybaram.api.simulation import run from pybaram.readers.native import NativeReader from pybaram.inifile import INIFile # Load mesh and configuration mesh = NativeReader('explosion.pbrm') cfg = INIFile('explosion.ini') # Run simulation (MPI communicator initialized automatically) run(mesh, cfg) # Run with custom backend and MPI communicator from pybaram.backends import get_backend from mpi4py import MPI comm = MPI.COMM_WORLD backend = get_backend('cpu', cfg) run(mesh, cfg, be=backend, comm=comm) ``` -------------------------------- ### Pybaram: Solution Writing Plugin Configuration Source: https://context7.com/aadl_inha/pybaram/llms.txt Configuration for the `soln-plugin-writer` in Pybaram INI files. This plugin enables automatic saving of simulation solution files at specified time intervals or iteration counts, supporting both steady and unsteady simulations. ```ini # Configuration for solution writer plugin # Add to INI file for unsteady simulation: [soln-plugin-writer] name = result-t{t:.3f} dt-out = 0.05 # Write every 0.05 time units # For steady simulation: [soln-plugin-writer] name = iter-{n:06d} iter-out = 500 # Write every 500 iterations ``` -------------------------------- ### Mesh Partitioning API Source: https://context7.com/aadl_inha/pybaram/llms.txt Partitions existing pyBaram mesh files into multiple subdomains for parallel computation using METIS. ```APIDOC ## Mesh Partitioning API ### Description Partitions a pyBaram mesh file into a specified number of subdomains for parallel execution using METIS. ### Method `partition_mesh(inmesh, outmesh, npart)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **inmesh** (string) - Required - Path to the input pyBaram mesh file ('.pbrm'). - **outmesh** (string) - Required - Path for the output partitioned pyBaram mesh file ('.pbrm'). - **npart** (int) - Required - Number of subdomains to partition the mesh into. ### Request Example ```python from pybaram.api.io import partition_mesh # Partition mesh into 4 subdomains for MPI parallel execution partition_mesh( inmesh='explosion.pbrm', outmesh='explosion_part.pbrm', npart=4 ) # Partition a larger mesh into 16 subdomains partition_mesh( inmesh='wing.pbrm', outmesh='wing_part.pbrm', npart=16 ) ``` ### Response #### Success Response (200) Operation completes without returning specific data, indicating successful mesh partitioning. #### Response Example N/A ``` -------------------------------- ### pyBaram Configuration: Essential Constants Source: https://gitlab.com/aadl_inha/pybaram/-/blob/master/doc/src/user_guide.rst Defines essential constants required for pyBaram simulations, such as the ratio of specific heats (gamma), dynamic viscosity (mu), Prandtl number (Pr), and turbulent Prandtl number (Prt). These are crucial for various physical models. ```ini [constants] gamma = 1.4 Pr = 0.72 Prt = 0.9 ``` -------------------------------- ### Manage Simulation Configuration (Python) Source: https://context7.com/aadl_inha/pybaram/llms.txt Provides an interface to load, read, set, and evaluate configuration parameters from INI files. Supports various data types and expression evaluation with substitutions. Outputs modified configuration objects or string representations. ```python from pybaram.inifile import INIFile # Load existing configuration cfg = INIFile('simulation.ini') # Read configuration values with type conversion gamma = cfg.getfloat('constants', 'gamma', default=1.4) max_iter = cfg.getint('solver-time-integrator', 'max-iter', default=10000) time_range = cfg.getlist('solver-time-integrator', 'time') # Returns list # Set configuration values cfg.set('solver-time-integrator', 'cfl', '0.9') cfg.set('constants', 'gamma', '1.4') # Evaluate expressions with substitutions expr = cfg.getexpr('soln-ics', 'rho', subs={'x': 0.5, 'y': 0.0}) # Convert configuration to string for storage config_str = cfg.tostr() # Load configuration from string cfg_new = INIFile() cfg_new.fromstr(config_str) ``` -------------------------------- ### Configuration File Management API Source: https://context7.com/aadl_inha/pybaram/llms.txt Provides an interface to load, read, modify, and save simulation configuration settings using the INI file format. ```APIDOC ## Configuration File Management API ### Description Manages simulation configuration settings through an INI file interface, allowing loading, reading, writing, and expression evaluation. ### Method `INIFile(filepath=None)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **filepath** (string) - Optional - Path to the INI file to load. If `None`, an empty configuration is created. ### Key Methods - **`getfloat(section, option, default=None)`**: Reads a float value. - **`getint(section, option, default=None)`**: Reads an integer value. - **`getlist(section, option)`**: Reads a list of values. - **`getexpr(section, option, subs={})`**: Reads and evaluates an expression with substitutions. - **`set(section, option, value)`**: Sets a configuration value. - **`tostr()`**: Converts the configuration to a string. - **`fromstr(config_string)`**: Loads configuration from a string. ### Request Example ```python from pybaram.inifile import INIFile # Load existing configuration cfg = INIFile('simulation.ini') # Read configuration values with type conversion gamma = cfg.getfloat('constants', 'gamma', default=1.4) max_iter = cfg.getint('solver-time-integrator', 'max-iter', default=10000) time_range = cfg.getlist('solver-time-integrator', 'time') # Returns list # Set configuration values cfg.set('solver-time-integrator', 'cfl', '0.9') cfg.set('constants', 'gamma', '1.4') # Evaluate expressions with substitutions expr = cfg.getexpr('soln-ics', 'rho', subs={'x': 0.5, 'y': 0.0}) # Convert configuration to string for storage config_str = cfg.tostr() # Load configuration from string cfg_new = INIFile() cfg_new.fromstr(config_str) ``` ### Response #### Success Response (200) Configuration data is read, modified, or written successfully. #### Response Example N/A ``` -------------------------------- ### Import Mesh Files (Python) Source: https://context7.com/aadl_inha/pybaram/llms.txt Converts external mesh files (CGNS, Gmsh) into pyBaram's native format. Takes input mesh file path, output mesh file path, and an optional scaling factor. Outputs a binary mesh file ready for pyBaram. ```python from pybaram.api.io import import_mesh # Import a CGNS mesh file with unit scaling import_mesh( inmesh='explosion.cgns', outmesh='explosion.pbrm', scale=1.0 ) # Import a Gmsh mesh file with scaling factor import_mesh( inmesh='wing.msh', outmesh='wing.pbrm', scale=0.001 # Convert from mm to m ) ``` -------------------------------- ### Pybaram: Force and Moment Calculation Plugin Source: https://context7.com/aadl_inha/pybaram/llms.txt Configuration settings for the `soln-plugin-force-wall` in Pybaram INI files. This plugin calculates aerodynamic forces and moments on specified boundary surfaces during a simulation, requiring reference conditions and direction vectors. ```ini [soln-plugin-force-wall] # Reference conditions rho = 1.225 # Reference density (kg/m^3) vel = 100.0 # Reference velocity (m/s) p = 0.0 # Ambient pressure (Pa) area = 1.0 # Reference area (m^2) length = 1.0 # Reference length (m) # Force directions (drag and lift) force-dir-name = xy force-dir-x = 1.0, 0.0, 0.0 # Drag direction force-dir-y = 0.0, 1.0, 0.0 # Lift direction # Moment calculation moment-center = 0.25, 0.0, 0.0 # Moment reference point moment-dir-name = z # Output frequency iter-out = 100 # For steady simulations # dt-out = 0.01 # For unsteady simulations ```