### Install Example JSON Files Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Installs JSON files from the examples directory into the share/palace/test/data/examples location. It specifically excludes files in the 'postpro' subdirectory. ```cmake install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../examples/ DESTINATION share/palace/test/data/examples FILES_MATCHING PATTERN "*.json" PATTERN "*/postpro/*" EXCLUDE # Skip palace.json files ) ``` -------------------------------- ### Install Julia Package Environment Source: https://github.com/awslabs/palace/blob/main/docs/src/examples/antenna.md Install all necessary Julia packages for the plotting scripts by instantiating the project environment. Ensure you are in the 'examples' directory. ```bash julia --project -e 'using Pkg; Pkg.instantiate();' ``` -------------------------------- ### Download Example Files Source: https://github.com/awslabs/palace/blob/main/docs/src/quick.md Downloads the mesh and configuration files for the spheres example. Ensure the 'mesh' directory exists before running. ```bash mkdir -p mesh curl -o mesh/spheres.msh https://raw.githubusercontent.com/awslabs/palace/refs/heads/main/examples/spheres/mesh/spheres.msh curl -O https://raw.githubusercontent.com/awslabs/palace/refs/heads/main/examples/spheres/spheres.json ``` -------------------------------- ### Include Example File Source: https://github.com/awslabs/palace/blob/main/docs/src/examples/spheres.md This function is used to include and display the content of example files. It reads the specified file from the test examples directory. ```julia function include_example_file(example_path, filename) print(read(joinpath(@__DIR__, "..", "..", "..", "test", "examples", "ref", example_path, filename), String)) end ``` -------------------------------- ### Install Project Targets Source: https://github.com/awslabs/palace/blob/main/palace/CMakeLists.txt Installs the main target and library target to the runtime destination. ```cmake install( TARGETS ${TARGET_NAME} ${LIB_TARGET_NAME} RUNTIME DESTINATION bin ) ``` -------------------------------- ### Install Documenter with Julia Source: https://github.com/awslabs/palace/blob/main/README.md Installs the Documenter package for building local documentation. Ensure Julia is installed and accessible. ```sh julia --project=docs -e "using Pkg; Pkg.instantiate()" ``` -------------------------------- ### Install Palace with Spack Environment Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/spack.md Install Palace and its dependencies using the configured Spack environment. The first installation may take a long time as Spack builds everything from source. ```sh spack -e palace_spack install ``` -------------------------------- ### Install Unit Tests Executable Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Installs the 'unit-tests' executable to the 'bin' directory within the installation prefix. ```cmake install( TARGETS unit-tests RUNTIME DESTINATION bin ) ``` -------------------------------- ### Include Example File Source: https://github.com/awslabs/palace/blob/main/docs/src/examples/rings.md This command includes the content of a specified example file. It's typically used for demonstrating or testing specific parts of the code. ```julia include_example_file("rings", "terminal-M.csv") # hide ``` ```julia include_example_file("rings", "surface-F.csv") # hide ``` ```julia include_example_file("rings", "terminal-I.csv") # hide ``` -------------------------------- ### Install Helper Scripts Source: https://github.com/awslabs/palace/blob/main/palace/CMakeLists.txt Installs helper scripts to the bin directory with specific file permissions. ```cmake install( FILES ${CMAKE_SOURCE_DIR}/../scripts/palace ${CMAKE_SOURCE_DIR}/../scripts/validate-config DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) ``` -------------------------------- ### Install Test Data Files Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Installs the contents of the 'data' directory from the source tree to the 'share/palace/test/' directory within the installation prefix. ```cmake install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data DESTINATION share/palace/test/ ) ``` -------------------------------- ### Build Palace with Default Options Source: https://github.com/awslabs/palace/blob/main/docs/src/install.md After cloning, navigate to the directory and run these commands to build the executable with default settings. The binary will be installed in `build/bin/`. ```bash mkdir build && cd build cmake .. make -j ``` -------------------------------- ### Install Catch2 Libraries Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Installs the Catch2 library components (libraries, archives) to the appropriate subdirectories within the installation prefix, but only if external dependencies were built. ```cmake if(PALACE_BUILD_EXTERNAL_DEPS) install( TARGETS Catch2 LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) endif() ``` -------------------------------- ### Serve Local Documentation with Python Source: https://github.com/awslabs/palace/blob/main/README.md Starts a simple HTTP server in Python to visualize the rendered documentation. Navigate to localhost:8000 in your browser. ```sh cd docs/build && python -m http.server 8000 ``` -------------------------------- ### Instantiate Julia Environment Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Instantiates the Julia environment for the project. This is a one-time setup step. ```bash julia --project -e "using Pkg; Pkg.instantiate()" ``` -------------------------------- ### Install Script Directory Source: https://github.com/awslabs/palace/blob/main/palace/CMakeLists.txt Installs a directory of scripts to the bin destination with specified file permissions. ```cmake install( DIRECTORY ${CMAKE_SOURCE_DIR}/../scripts/schema DESTINATION bin FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) ``` -------------------------------- ### Example Spack Compiler Info Output Source: https://github.com/awslabs/palace/blob/main/docs/src/faq.md This is an example output from `spack compiler info`. Look for the 'fortran' field; if it shows 'None', a Fortran compiler is not detected. ```text [e] apple-clang@=17.0.0 build_system=bundle platform=darwin os=tahoe target=aarch64 prefix: /usr compilers: cc: /usr/bin/clang cxx: /usr/bin/clang++ fortran: None ``` -------------------------------- ### Download Palace Configuration File Source: https://github.com/awslabs/palace/blob/main/docs/src/quick.md Use curl to download the example spheres.json configuration file. ```bash curl -O https://raw.githubusercontent.com/awslabs/palace/refs/heads/main/examples/spheres/spheres.json ``` -------------------------------- ### Install Header Directory Source: https://github.com/awslabs/palace/blob/main/palace/CMakeLists.txt Installs a directory of header files to the include/palace destination with specified file permissions. ```cmake install( DIRECTORY ${CMAKE_SOURCE_DIR}/fem/qfunctions DESTINATION include/palace FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) ``` -------------------------------- ### Verify Spack Installation Source: https://github.com/awslabs/palace/blob/main/docs/src/quick.md Run this command to check if Spack is installed correctly. Ensure Spack is in your PATH. ```bash spack --version ``` ```json logrun(`spack --version`); # hide nothing # hide ``` -------------------------------- ### Download Mesh File Source: https://github.com/awslabs/palace/blob/main/docs/src/quick.md Create a mesh directory and download the example mesh file 'spheres.msh' using curl. This mesh is used for tutorial simulations. ```bash mkdir -p mesh curl -o mesh/spheres.msh https://raw.githubusercontent.com/awslabs/palace/refs/heads/main/examples/spheres/mesh/spheres.msh ``` -------------------------------- ### Install Latest Palace Version Source: https://github.com/awslabs/palace/blob/main/docs/src/faq.md Install the newest available version of Palace. Spack will automatically select the latest release if no specific version is requested. ```bash spack install palace ``` -------------------------------- ### Run Palace with MPI and VTune Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/notes.md Execute the Palace binary with multiple MPI processes and collect performance data using VTune. Ensure you are in the examples directory and adjust paths as necessary. ```bash cd /path/to/palace/examples/rings mpirun -n 10 -gtool "vtune -collect hpc-performance --app-working-dir=$(pwd) -result-dir $(pwd)/vtune-mpi:0-9" /path/to/palace/build/bin/palace-x86_64.bin rings.json ``` ```bash vtune-gui vtune-mpi.* ``` -------------------------------- ### Load Palace and Verify Usage Source: https://github.com/awslabs/palace/blob/main/docs/src/quick.md After installation, load Palace into your current shell environment and verify it by checking the help message. Remember to load Palace in each new shell session. ```bash spack load palace palace --help ``` ```json logrun(`palace --help`); # hide nothing # hide ``` -------------------------------- ### Build Palace with Make Threads Source: https://github.com/awslabs/palace/blob/main/docs/src/install.md Compile the project using `make` with a specified number of threads for faster builds. For example, use `-j 4` for 4 threads. ```bash make -j 4 ``` -------------------------------- ### Install Development Version of Palace Source: https://github.com/awslabs/palace/blob/main/docs/src/faq.md Install the most recent development version of Palace directly from the main branch. Use this for features not yet released, but be aware that development versions may be less stable. ```bash spack install palace@develop ``` -------------------------------- ### Install Specific Palace Version Source: https://github.com/awslabs/palace/blob/main/docs/src/faq.md Install a particular version of Palace by specifying the version number. This is useful when you need a known, stable release. ```bash spack install palace@0.14.0 ``` -------------------------------- ### Generate Container Recipe with Spack Source: https://github.com/awslabs/palace/blob/main/docs/src/install.md Creates a Spack environment file (`spack.yaml`) to define the desired Palace configuration for containerization. This example uses Singularity format. ```yaml spack: specs: - palace container: format: singularity images: os: "ubuntu:24.04" spack: develop ``` -------------------------------- ### Install Palace with Specific Variants using Spack Source: https://github.com/awslabs/palace/blob/main/docs/src/install.md Installs a specific version of Palace with desired variants and dependencies, such as MUMPS, SLEPc, and CUDA support. Adjust `cuda_arch` based on your GPU generation. ```bash spack install palace +mumps +slepc +cuda cuda_arch=90 ``` -------------------------------- ### Run Palace Simulation Source: https://github.com/awslabs/palace/blob/main/docs/src/run.md Execute a Palace simulation using the installed script. Specify the number of MPI processes and the configuration file. ```bash /bin/palace -np config.json ``` -------------------------------- ### Configure Transmon Simulation with AMR Source: https://github.com/awslabs/palace/blob/main/docs/src/examples/transmon.md Load and print configuration settings for a transmon simulation with Adaptive Mesh Refinement (AMR) enabled. This example shows how to access and display the MaxIts and Solver Order from the JSON configuration. ```julia import JSON #hide json_amr = JSON.parsefile( #hide joinpath(@__DIR__, "..", "..", "..", "examples", "transmon", "transmon_amr.json") #hide ) #hide println( #hide "config[\"Model\"][\"Refinement\"][\"MaxIts\"] = $(json_amr["Model"]["Refinement"]["MaxIts"])" #hide ) #hide println("config[\"Solver\"][\"Order\"] = $(json_amr["Solver"]["Order"]) ") #hide ``` -------------------------------- ### Activate and Load Palace Environment Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/spack.md Activate the Spack environment to make Palace available in your shell. Load the installed Palace package to use the 'palace' command. ```sh spack env activate palace_spack spack load palace ``` -------------------------------- ### Coverage Environment Variable Setup Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Sets up the SHOULD_SET_LLVM_PROFILE_FILE variable to conditionally enable LLVM profile file setting for coverage when using Clang, AppleClang, or IntelLLVM compilers. ```cmake set(SHOULD_SET_LLVM_PROFILE_FILE "$,$,$,$>>") ``` -------------------------------- ### Validate Configuration File Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/notes.md Use this script to validate a JSON configuration file against the provided Schema. This script is also available in the installation directory. ```bash ./scripts/validate_config config.json ``` -------------------------------- ### Configure Single Transmon Parameters Source: https://github.com/awslabs/palace/blob/main/docs/src/examples/transmon.md Example of calling the `single_transmon` function with specific geometric and processing parameters. Use this to define the physical layout and output options for the transmon qubit. ```julia single_transmon( w_shield=2μm, claw_gap=6μm, w_claw=34μm, l_claw=121μm, cap_width=24μm, cap_length=620μm, cap_gap=30μm, n_meander_turns=5, hanger_length=500μm, bend_radius=50μm, save_mesh::Bool=false, save_gds::Bool=false ) ``` -------------------------------- ### Fetch or Find Catch2 Testing Framework Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Includes the Catch2 testing framework, either by fetching it from GitHub if external dependencies are enabled, or by finding an installed version. If Catch2 is not found and external dependencies are disabled, a warning is issued and the configuration stops. ```cmake if(PALACE_BUILD_EXTERNAL_DEPS) Include(FetchContent) FetchContent_Declare(Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.8.1 ) FetchContent_MakeAvailable(Catch2) else() find_package(Catch2 3 QUIET) if(NOT Catch2_FOUND) message(WARNING "Catch2 not found, unit-tests target will not be available") return() endif() endif() ``` -------------------------------- ### Check lcov Version Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Before measuring test coverage, verify that `lcov` is installed and meets the recommended version (2.0 or newer) for optimal support. Older versions may still work but might report warnings. ```sh lcov --version ``` -------------------------------- ### Configure Frequency Domain Driven Solver Settings Source: https://context7.com/awslabs/palace/llms.txt Sets up parameters for frequency domain simulations, including frequency sweep methods (uniform, log, point, adaptive), sampling, and field saving options. Choose one or combine sweep options as needed. ```json { "Solver": { "Order": 2, "Device": "CPU", "Driven": { // Option 1: Simple uniform sweep "MinFreq": 2.0, // GHz "MaxFreq": 32.0, // GHz "FreqStep": 0.5, // GHz "SaveStep": 10, // Save field every N frequency steps // Option 2: Flexible multi-sample specification (can combine with MinFreq/MaxFreq) "Samples": [ { "Type": "Linear", "MinFreq": 2.0, "MaxFreq": 32.0, "FreqStep": 0.1, "SaveStep": 0 }, { "Type": "Log", "MinFreq": 1.0, "MaxFreq": 10.0, "NSample": 50 }, { "Type": "Point", "Freq": [5.0, 17.0, 28.5], // Explicit frequency points, GHz "SaveStep": 1 } ], "Save": [2.0, 17.0, 32.0], // Explicit frequencies to save fields "Restart": 1, // Resume from this frequency index (1-based) // Option 3: Adaptive fast frequency sweep (PROM) "AdaptiveTol": 1.0e-3, "AdaptiveMaxSamples": 20, "AdaptiveConvergenceMemory": 2, "AdaptiveGSOrthogonalization": "CGS2" } } } // Output: port-S.csv → S-parameters: magnitude (dB) and phase (deg) per frequency // Output: port-V.csv → Complex port voltages per frequency // Output: port-I.csv → Complex port currents per frequency ``` -------------------------------- ### Prepare and Run Palace Simulation Source: https://github.com/awslabs/palace/blob/main/docs/src/guide/problem.md This script prepares configuration files for multiple simulations by modifying excitation settings and then runs Palace for each configuration. It demonstrates a common workflow for parameter sweeps. ```python import json import os import subprocess config_path = "config.json" for i in range(4): # Prepare configuration file for simulation with open(config_path, "r") as f: config_json = json.loads(f.read()) for port in config_json["Boundaries"]["LumpedPort"]: port["Excitation"] = (1+i == port["Index"]) # Write new config file config_path_i = os.path.splitext(config_path)[0] + f"-{1+i}.json" with open(config_path_i, "w") as f: f.write(json.dumps(config_json)) # Run Palace simulation (alternatively, use Popen and wait) subprocess.run(["palace", "-np", 2, config_path_i]) ``` -------------------------------- ### Remove Old Version of Palace Source: https://github.com/awslabs/palace/blob/main/docs/src/faq.md Optionally remove an older version of Palace before installing a new one. If multiple versions are installed, Spack will prompt for specification. ```bash spack uninstall palace ``` -------------------------------- ### Get Spack Compiler Info Source: https://github.com/awslabs/palace/blob/main/docs/src/faq.md After listing compilers, use this command to get detailed information about a specific compiler toolchain, including whether a Fortran compiler is available. ```bash spack compiler info TOOLCHAIN_NAME ``` -------------------------------- ### Backend Configuration Source: https://github.com/awslabs/palace/blob/main/docs/src/config/solver.md Specifies the libCEED backend for simulation. A default backend is chosen if none is explicitly provided, based on the solver device. ```string "Backend" [""] : Specifies the [libCEED backend](https://libceed.org/en/latest/gettingstarted/#backends) to use for the simulation. If no backend is specified, a suitable default backend is selected based on the given `config["Solver"]["Device"]`. ``` -------------------------------- ### Build Status Messages Source: https://github.com/awslabs/palace/blob/main/palace/CMakeLists.txt Reports build configuration details such as build type, architecture, compiler flags, and installation prefix. ```cmake message(STATUS "CMake build type: ${CMAKE_BUILD_TYPE}") ``` ```cmake message(STATUS "Building for architecture: ${CMAKE_SYSTEM_PROCESSOR}") ``` ```cmake message(STATUS "Summary of extra compiler flags: ${CMAKE_CXX_FLAGS}") ``` ```cmake message(STATUS "Installation directory: ${CMAKE_INSTALL_PREFIX}/bin") ``` -------------------------------- ### List Spack Repositories Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/notes.md Verify that the local Spack repository has been added successfully by listing all configured repositories. ```bash spack repo list ``` -------------------------------- ### Run All Tests Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Executes all tests for the project using the default configuration. ```bash julia --project runtests.jl ``` -------------------------------- ### Update Reference Data Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Updates the reference data for test simulations. Use flags to target specific examples or perform a dry run. ```bash ./baseline ``` ```bash ./baseline -e spheres ``` ```bash ./baseline --dry-run ``` ```bash ./baseline -np 4 ``` -------------------------------- ### Run Benchmarks with Specific Options Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Executes benchmarks using the `palace-unit-tests` executable, specifying the number of samples. The `--backend` option can be used to select different assembly backends. ```bash bin/palace-unit-tests "[Benchmark]" --benchmark-samples 10 ``` -------------------------------- ### Run Palace with MPI Launcher Source: https://github.com/awslabs/palace/blob/main/docs/src/run.md Directly run the Palace binary in parallel using an MPI launcher. Specify options for the launcher and the architecture. ```bash [OPTIONS] /bin/palace-.bin config.json ``` -------------------------------- ### Set Output Name for Unit Tests Executable Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Sets the output name for the 'unit-tests' executable to 'palace-unit-tests'. This is useful for consistent naming when the executable is installed. ```cmake set_target_properties(unit-tests PROPERTIES OUTPUT_NAME palace-unit-tests) ``` -------------------------------- ### Build and Run Unit Tests Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/tutorial_add_new_unit_test.md Compile the test executable using `make palace-tests` after updating the CMakeLists.txt file. ```bash # Build tests in the build directory make palace-tests ``` -------------------------------- ### Run Palace with Singularity/Apptainer Source: https://github.com/awslabs/palace/blob/main/docs/src/run.md Execute a Palace simulation packaged as a Singularity/Apptainer image. Arguments are passed directly to the Palace simulation. ```bash singularity run palace.sif ``` -------------------------------- ### Configure Transient Solver Source: https://context7.com/awslabs/palace/llms.txt Sets up the time-domain solver for integrating Maxwell's equations. Configure excitation type, frequency, pulse width, simulation time, and time-stepping parameters. ```json { "Solver": { "Order": 3, "Device": "CPU", "Transient": { "Type": "GeneralizedAlpha", // "GeneralizedAlpha" [default] | "RungeKutta" | "ARKODE" | "CVODE" "Excitation": "ModulatedGaussian", // Excitation types: "Sinusoidal" | "Gaussian" | "DifferentiatedGaussian" // "ModulatedGaussian" | "Ramp" | "SmoothStep" "ExcitationFreq": 10.0, // GHz — center frequency (for harmonic excitations) "ExcitationWidth": 0.05, // ns — pulse width (for Gaussian-type excitations) "MaxTime": 1.0, // ns — simulation end time "TimeStep": 0.005, // ns — uniform time step size "SaveStep": 10, // Save field every N time steps // Adaptive time-stepping (only for "ARKODE" or "CVODE"): "Order": 3, "RelTol": 1e-4, "AbsTol": 1e-9 } } } // Output: port-V.csv → Port voltage time history // Output: port-I.csv → Port current time history // Output: surface-I.csv → Surface current excitation time history ``` -------------------------------- ### Configure Palace Build with CMake Source: https://github.com/awslabs/palace/blob/main/docs/src/install.md Configure a Palace build in a specified directory using CMake. Replace `` and `` with your actual paths. CMake options can be passed using the `-D=` format. ```bash mkdir && cd cmake [OPTIONS] ``` -------------------------------- ### Run Unit Test on GPU Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/tutorial_gpu_profiling.md Execute the 'Vector Sum - Complex' unit test on the GPU using the CUDA backend. This verifies the CUDA compilation and setup. ```sh bin/palace-unit-tests "Vector Sum - Complex" --device gpu --backend /gpu/cuda/magma ``` -------------------------------- ### Configure Magnetostatic Solver Source: https://context7.com/awslabs/palace/llms.txt Sets up the magnetostatic solver to compute inductance matrices. Requires 'SurfaceCurrent' boundaries. Configure mesh, materials, and linear solver parameters. ```json { "Problem": { "Type": "Magnetostatic", "Output": "postpro/magnetostatic" }, "Model": { "Mesh": "mesh/cavity2d.msh", "L0": 1.0 }, "Domains": { "Materials": [{ "Attributes": [1], "Permeability": 1.0 }] }, "Boundaries": { "PEC": { "Attributes": [3] }, "SurfaceCurrent": [ { "Index": 1, "Attributes": [2], "Direction": [1.0, 0.0, 0.0] } ] }, "Solver": { "Order": 2, "Device": "CPU", "Magnetostatic": { "Save": 1 }, "Linear": { "Type": "AMS", "KSPType": "CG", "Tol": 1.0e-8, "MaxIts": 100 } } } // Output: terminal-M.csv → Inductance matrix (H) // Output: terminal-Minv.csv → Inverse inductance matrix // Output: terminal-Mm.csv → Mutual inductance matrix ``` -------------------------------- ### Configure Boundary Postprocessing Settings Source: https://context7.com/awslabs/palace/llms.txt Defines postprocessing for boundary conditions, including surface flux integrals, dielectric loss, voltage/current line integrals, impedance, and far-field radiation patterns. Ensure correct 'Type' and 'Attributes' are specified for each postprocessing option. ```json { "Boundaries": { "Postprocessing": { "SurfaceFlux": [ { "Index": 1, "Attributes": [3], "Type": "Electric", // "Electric" | "Magnetic" | "Power" "TwoSided": false, "Center": [0.0, 0.0, 0.0] } ], "Dielectric": [ { "Index": 1, "Attributes": [12], "Type": "SA", // "Default" | "MA" (metal-air) | "MS" (metal-substrate) | "SA" (substrate-air) "Thickness": 2.0e-3, // Interface layer thickness in mesh length units "Permittivity": 10.0, "LossTan": 1.0 } ], "Impedance": [ { "Index": 1, "VoltageAttributes": [5], "CurrentAttributes": [6], "NSamples": 100 } ], "Voltage": [ { "Index": 1, "VoltagePath": [[0.0, 0.0, 0.0], [0.0, 0.0, 50.0]], "NSamples": 100 } ], "FarField": { "Attributes": [4], "NSample": 100, "ThetaPhis": [[0, 0], [35, 20], [90, 45]] // [theta°, phi°] pairs } } } } // Output: surface-F.csv → Surface flux integrals // Output: surface-Q.csv → Interface dielectric EPRs and quality factors ``` -------------------------------- ### Build Palace with CMake Build Tool Source: https://github.com/awslabs/palace/blob/main/docs/src/install.md Alternatively, use the `cmake --build` command to compile the project, specifying the number of threads with the `-j` flag. ```bash cmake --build . -- -j 4 ``` -------------------------------- ### Run Specific Test Categories with CTest Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Filters and runs tests based on regular expressions. Examples include running only MPI tests or tests containing 'postoperator' in their name. ```bash ctest -R mpi- # Run only MPI tests ctest -R postoperator # Run tests with postoperator in the name ``` -------------------------------- ### Build Palace with VTune Support Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/notes.md Build Palace with VTune support by setting the VTune environment variables and using the RelWithDebInfo build type. Ensure VTune's root directory is set during the CMake configuration. ```bash source /path/to/vtune-vars.sh # Replace with your VTune installation path mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo make -j $(nproc) ``` -------------------------------- ### Define libCEED JIT Source Directory Source: https://github.com/awslabs/palace/blob/main/test/unit/CMakeLists.txt Adds a compile definition to 'main.cpp' to specify the installation directory for libCEED JIT source files. This is used to locate JIT-compiled kernels at runtime. ```cmake set_property( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp APPEND PROPERTY COMPILE_DEFINITIONS "PALACE_LIBCEED_JIT_SOURCE_DIR=\"${CMAKE_INSTALL_PREFIX}/include/palace/\"" ) ``` -------------------------------- ### Configure Electrostatic Solver Source: https://context7.com/awslabs/palace/llms.txt Sets up the electrostatic solver to compute capacitance matrices. Requires 'Terminal' and 'Ground' boundaries. Configure mesh, materials, and linear solver parameters. ```json { "Problem": { "Type": "Electrostatic", "Output": "postpro" }, "Model": { "Mesh": "mesh/spheres.msh", "L0": 1.0e-2 }, "Domains": { "Materials": [{ "Attributes": [1], "Permittivity": 1.0 }] }, "Boundaries": { "Ground": { "Attributes": [2] }, "Terminal": [ { "Index": 1, "Attributes": [3] }, { "Index": 2, "Attributes": [4] } ] }, "Solver": { "Order": 3, "Device": "CPU", "Electrostatic": { "Save": 2 // Save fields for first N terminal activations [default 0] }, "Linear": { "Type": "BoomerAMG", "KSPType": "CG", "Tol": 1.0e-8, "MaxIts": 100 } } } // Output: terminal-C.csv → Maxwell capacitance matrix (F) // Output: terminal-Cinv.csv → Inverse capacitance matrix // Output: terminal-Cm.csv → Mutual capacitance matrix ``` -------------------------------- ### Run All Tests with CTest Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Executes all registered tests using CTest. This method automatically handles serial, MPI, and GPU tests, including proper environment setup and resource management. ```bash cd palace-build # If Palace was built with Spack: spack cd -b palace ctest ``` -------------------------------- ### Configure Electrostatic Boundary Conditions Source: https://context7.com/awslabs/palace/llms.txt Sets up ground (zero-potential) and terminal boundaries for electrostatic capacitance matrix extraction. Terminals are activated sequentially with unit voltage. ```json { "Boundaries": { "Ground": { "Attributes": [2] // Zero potential boundary (outer conductor, enclosure) }, "ZeroCharge": { "Attributes": [5] // Zero charge (PMC equivalent for electrostatics) }, "Terminal": [ { "Index": 1, "Attributes": [3] // Sphere A / conductor A }, { "Index": 2, "Attributes": [4] // Sphere B / conductor B } ] } } // Output: terminal-C.csv → Maxwell capacitance matrix (F) // Output: terminal-Cinv.csv → Inverse capacitance matrix // Output: terminal-Cm.csv → Mutual capacitance matrix ``` -------------------------------- ### Stratton-Chu Electric Field Integral Equation Source: https://github.com/awslabs/palace/blob/main/docs/src/reference.md The original Stratton-Chu transformation equation for the electric field, serving as the starting point for far-field approximations. Requires an analytic form for Green's function. ```math \mathbf{E}(\mathbf{r}_0) = \int_S \left[ i \omega \mu (\mathbf{n} \times \mathbf{H}) g(\mathbf{r}, \mathbf{r}_0) + (\mathbf{n} \times \mathbf{E}) \times \nabla g(\mathbf{r}, \mathbf{r}_0) + (\mathbf{n} \cdot \mathbf{E}) \nabla g(\mathbf{r}, \mathbf{r}_0) \right] dS ``` -------------------------------- ### Access Test Data Files Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Files required for tests should be stored in the `test/unit/data` folder. Access these files using the `PALACE_TEST_DATA_DIR` path variable to ensure accessibility across different build and installation scenarios. ```cpp auto path_to_banana = fs::path(PALACE_TEST_DATA_DIR) / "banana.txt" ``` -------------------------------- ### List Simulation Output Directory Source: https://github.com/awslabs/palace/blob/main/docs/src/quick.md Lists the contents of the 'postpro' directory after the simulation has completed. This helps in identifying generated output files. ```bash ls -R postpro ``` -------------------------------- ### MPI Profiling with VTune Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/notes.md Instructions for profiling MPI applications using VTune Profiler. This typically involves launching the application with mpiexec and VTune's collector. ```bash # For MPI profiling with multiple processes: # Follow Intel's official instructions for detailed usage information. ``` -------------------------------- ### Configure Periodic Boundary Conditions Source: https://context7.com/awslabs/palace/llms.txt Sets up periodic and Floquet periodic boundary conditions for structures with translational or rotational symmetry. 'Translation' is auto-detected if omitted. ```json { "Boundaries": { "Periodic": { "FloquetWaveVector": [0.0, 1.0e6, 0.0], // Phase delay rad/mesh-unit (optional) "BoundaryPairs": [ { "DonorAttributes": [5], "ReceiverAttributes": [6], "Translation": [0.0, 5000.0, 0.0] // Auto-detected if omitted } ] } } } ``` -------------------------------- ### Format Source Code Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/notes.md Run this script to automatically format C++ source code using clang-format and Markdown files using JuliaFormatter.jl. The script enforces include order as per the Google C++ Style Guide. ```bash ./scripts/format_source ``` -------------------------------- ### Visualization Workflow with ParaView and GLVis Source: https://context7.com/awslabs/palace/llms.txt Instructions for loading and visualizing Palace field output using ParaView for volume and surface data, and GLVis for cross-sections. ```bash # --- ParaView --- # Open volume field PVD file in ParaView: # File → Open → postpro/paraview/eigenmode/eigenmode.pvd # Click Apply → set Coloring to "E" or "B" for field magnitude # Filters → Common → Slice to create cross-sections # Open boundary surface PVD file (surface charges, currents, port modes): # File → Open → postpro/paraview/eigenmode_boundaries/eigenmode_boundaries.pvd # Time slider frames: each frame corresponds to one simulation step ``` -------------------------------- ### Display Transmon Design Parameters Source: https://github.com/awslabs/palace/blob/main/docs/src/examples/transmon.md Run this command to display the available design parameters for the single transmon module, including geometric dimensions and processing options. This helps in customizing the transmon qubit system. ```bash julia --project -E 'include("transmon.jl"); @doc SingleTransmon.single_transmon' ``` -------------------------------- ### Run Palace Simulation with MPI Source: https://context7.com/awslabs/palace/llms.txt Execute a Palace simulation using MPI parallelism. Specify the number of processes and the configuration file. ```bash palace -np config.json ``` ```bash palace --dry-run config.json ``` ```bash palace --version ``` ```bash palace --help ``` ```bash palace -np 4 config.json | tee simulation.log ``` ```bash mpirun -n 4 palace-x86_64.bin config.json # OMP_NUM_THREADS=8 for OpenMP ``` ```bash singularity run palace.sif -np 4 config.json ``` -------------------------------- ### Configure Top-Level Solver Settings Source: https://context7.com/awslabs/palace/llms.txt Sets global solver parameters such as finite element order, partial assembly, and device selection (CPU/GPU). These settings apply to all simulation types. ```json { "Solver": { "Order": 3, // FE polynomial order 1..N [default 1] "PartialAssemblyOrder": 1, // Enable partial assembly at this order [default 1 = fully enabled] "Device": "GPU", // "CPU" [default] | "GPU" | "Debug" "Backend": "" // libCEED backend; empty = auto-select based on Device } } ``` -------------------------------- ### Advanced Solver Options Source: https://github.com/awslabs/palace/blob/main/docs/src/config/solver.md Advanced configuration options for the solver, including quadrature order for the Jacobian and extra quadrature points. ```string "QuadratureOrderJacobian" [false] "ExtraQuadratureOrder" [0] ``` -------------------------------- ### Configure Wave Port Boundaries Source: https://context7.com/awslabs/palace/llms.txt Sets up wave port boundaries for driven and eigenmode simulations by solving a 2D eigenvalue problem. Ensure 'Attributes' are set to true domain boundaries. ```json { "Boundaries": { "WavePort": [ { "Index": 1, "Attributes": [4], "Excitation": true, // or integer excitation index for multi-excitation "Mode": 1, // Port mode index (1-based, ranked by wavenumber) "Offset": 0.0, // De-embedding offset in mesh length units "SolverType": "Default", "MaxIts": 30, "KSPTol": 1e-8, "EigenTol": 1e-6, "Verbose": 0, "VoltagePath": [[0.0, 0.0, 0.0], [0.0, 0.0, 100.0]], // V line integral path "NSamples": 100 }, { "Index": 2, "Attributes": [5], "Mode": 1, "Excitation": 2 // Second excitation index for multi-excitation sweeps } ] } } ``` -------------------------------- ### Build Container Image using Spack Source: https://github.com/awslabs/palace/blob/main/docs/src/install.md Commands to generate a Dockerfile or Singularity definition file from a Spack environment and then build the container image. Supports various OCI-compatible tools. ```bash # Docker/Podman spack containerize > Dockerfile podman build --format docker -t palace:latest . # or docker, or any other OCI-compatible tool # Singularity/Apptainer spack containerize > palace.def apptainer build palace.sif palace.def ``` -------------------------------- ### Run with Custom Palace Executable Source: https://github.com/awslabs/palace/blob/main/docs/src/developer/testing.md Runs tests using a custom path to the Palace executable. ```bash julia --project runtests.jl --palace-test "../../build/bin/palace" ```