diff --git a/.clang-tidy b/.clang-tidy index b872d9c1..b549d23b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -38,4 +38,4 @@ CheckOptions: WarningsAsErrors: '*' -HeaderFilterRegex: 'mach/src/' +HeaderFilterRegex: 'miso/src/' diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2cdfcc8b..dd11fc16 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,7 +8,7 @@ jobs: matrix: path: - 'src' - - 'mach' + - 'miso' steps: - uses: actions/checkout@v2 - name: Run clang-format style check for C/C++ programs. diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 03cf1fec..d92dd804 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Mach Tests +name: MISO Tests on: [push] @@ -282,15 +282,15 @@ jobs: message(FATAL_ERROR "Build failed") endif() - - name: Clone Mach + - name: Clone MISO uses: actions/checkout@v2 with: - path: mach + path: miso - - name: Create Mach Build Environment - run: cmake -E make_directory ${GITHUB_WORKSPACE}/mach/build + - name: Create MISO Build Environment + run: cmake -E make_directory ${GITHUB_WORKSPACE}/miso/build - - name: Configure Mach + - name: Configure MISO shell: cmake -P {0} run: | set(ENV{CC} ${{ matrix.config.cc }}) @@ -301,8 +301,8 @@ jobs: execute_process( COMMAND cmake - -S mach - -B mach/build + -S miso + -B miso/build -D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} -G Ninja -D CMAKE_MAKE_PROGRAM=ninja @@ -319,7 +319,7 @@ jobs: message(FATAL_ERROR "Bad exit status") endif() - - name: Build Mach + - name: Build MISO shell: cmake -P {0} run: | set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") @@ -338,7 +338,7 @@ jobs: # execute_process(COMMAND ccache -z) execute_process( - COMMAND cmake --build mach/build + COMMAND cmake --build miso/build RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE output @@ -351,7 +351,7 @@ jobs: message(FATAL_ERROR "Build failed") endif() - - name: Build Mach Tests + - name: Build MISO Tests shell: cmake -P {0} run: | set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") @@ -370,7 +370,7 @@ jobs: # execute_process(COMMAND ccache -z) execute_process( - COMMAND cmake --build mach/build --target build_tests + COMMAND cmake --build miso/build --target build_tests RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE output @@ -383,8 +383,8 @@ jobs: message(FATAL_ERROR "Build failed") endif() - - name: Test Mach - working-directory: mach/build + - name: Test MISO + working-directory: miso/build shell: bash run: ctest --output-on-failure diff --git a/.github/workflows/tidy.yml b/.github/workflows/tidy.yml index 53935a13..ce78d722 100644 --- a/.github/workflows/tidy.yml +++ b/.github/workflows/tidy.yml @@ -26,7 +26,7 @@ jobs: buildflags: "-fno-openmp", } steps: - - name: Clone Mach + - name: Clone MISO uses: actions/checkout@v2 with: fetch-depth: 2 @@ -276,13 +276,13 @@ jobs: message(FATAL_ERROR "Build failed") endif() - # - name: Clone Mach + # - name: Clone MISO # uses: actions/checkout@v2 # with: - # # path: mach + # # path: miso # fetch-depth: 2 - - name: Create Mach Build Environment + - name: Create MISO Build Environment run: cmake -E make_directory ${GITHUB_WORKSPACE}/build - name: Generate Compile Commands diff --git a/.gitignore b/.gitignore index 53824d31..a978cb6c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ # Object, binary, and library files *.o -/libmach.* +/libmiso.* *.bin *.so *.a @@ -42,11 +42,11 @@ build/* lib/* include/* -!build/mach_config.sh +!build/miso_config.sh # python wrapper related files -/mach/__pycache__ -/mach.egg-info +/miso/__pycache__ +/miso.egg-info # smb meshes in the sandbox sandbox/*.smb diff --git a/CMakeLists.txt b/CMakeLists.txt index b0997915..23245de5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.13...3.15) # set the project name, version, description, and languages -project(ODLMach VERSION 1.0 +project(ODLMISO VERSION 1.0 DESCRIPTION "Optimal Design Lab multi-physics solver" LANGUAGES CXX) @@ -102,18 +102,18 @@ if(NOT json_POPULATED) add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) endif() -# create build target library named mach, will be static library -add_library(mach STATIC "") +# create build target library named miso, will be static library +add_library(miso STATIC "") -target_sources(mach +target_sources(miso PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/mach.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/miso.hpp" ) -# Use CMakeLists.txt files in subdirectories to add sources to mach +# Use CMakeLists.txt files in subdirectories to add sources to miso add_subdirectory(src) -target_link_libraries(mach +target_link_libraries(miso PUBLIC "${ADEPT_LIBRARIES}" "${MFEM_LIBRARIES}" @@ -122,7 +122,7 @@ target_link_libraries(mach nlohmann_json::nlohmann_json ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${ADEPT_INCLUDE_DIRS}" "${MFEM_INCLUDE_DIRS}" @@ -130,23 +130,23 @@ target_include_directories(mach ) if (MFEM_USE_EGADS) - target_link_libraries(mach + target_link_libraries(miso PUBLIC "${EGADS_LIBRARIES}" ) - target_include_directories(mach + target_include_directories(miso PUBLIC "${EGADS_INCLUDE_DIRS}" ) endif (MFEM_USE_EGADS) -target_compile_features(mach +target_compile_features(miso PUBLIC cxx_std_17 ) -set_target_properties(mach +set_target_properties(miso PROPERTIES CXX_EXTENSIONS OFF POSITION_INDEPENDENT_CODE ON @@ -155,16 +155,16 @@ set_target_properties(mach # # INTERPROCEDURAL_OPTIMIZATION True ) -option(MACH_USE_CLANG_TIDY +option(MISO_USE_CLANG_TIDY "Use clang-tidy static analysis tool" NO) -if (MACH_USE_CLANG_TIDY) - set_target_properties(mach +if (MISO_USE_CLANG_TIDY) + set_target_properties(miso PROPERTIES CXX_CLANG_TIDY "clang-tidy;--format-style=file;--extra-arg=--std=c++11" # CXX_CLANG_TIDY "clang-tidy;--fix;--fix-errors;--format-style=file;--extra-arg=--std=c++11" ) -endif (MACH_USE_CLANG_TIDY) +endif (MISO_USE_CLANG_TIDY) set(DEBUG_OPTIONS "-g" @@ -177,7 +177,7 @@ set(RELEASE_OPTIONS "-O2" ) -target_compile_options(mach +target_compile_options(miso PRIVATE "$<$:${DEBUG_OPTIONS}>" "$<$:${RELEASE_OPTIONS}>" @@ -185,15 +185,15 @@ target_compile_options(mach # TODO: When EGADS support is in mainline PUMI move this to MFEM CMake if (MFEM_USE_EGADS) - target_compile_definitions(mach + target_compile_definitions(miso PUBLIC MFEM_USE_EGADS ) endif (MFEM_USE_EGADS) -install(TARGETS mach +install(TARGETS miso OPTIONAL - EXPORT machTargets + EXPORT misoTargets LIBRARY DESTINATION lib INCLUDES DESTINATION include ) @@ -204,17 +204,17 @@ install(DIRECTORY src FILES_MATCHING PATTERN "*.h*" ) -install(FILES mach.hpp +install(FILES miso.hpp OPTIONAL DESTINATION include ) -get_target_property(MACH_SOURCES mach SOURCES) -add_custom_target(mach-format +get_target_property(MISO_SOURCES miso SOURCES) +add_custom_target(miso-format COMMAND clang-format -style=file -i - ${MACH_SOURCES} + ${MISO_SOURCES} ) if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) @@ -247,7 +247,7 @@ add_subdirectory(sandbox EXCLUDE_FROM_ALL) add_subdirectory(doc) option(BUILD_PYTHON_WRAPPER - "Build a python wrapper for mach that allows constructing solvers and + "Build a python wrapper for miso that allows constructing solvers and running problems through a Python interface" NO) @@ -271,61 +271,61 @@ if (BUILD_PYTHON_WRAPPER) # FetchContent_MakeAvailable(pybind11_json) - pybind11_add_module(pyMach "") + pybind11_add_module(pyMISO "") - target_compile_features(pyMach + target_compile_features(pyMISO PUBLIC cxx_std_17 ) - if (MACH_USE_CLANG_TIDY) - set_target_properties(pyMach + if (MISO_USE_CLANG_TIDY) + set_target_properties(pyMISO PROPERTIES CXX_CLANG_TIDY "clang-tidy;--format-style=file;--extra-arg=--std=c++11" # CXX_CLANG_TIDY "clang-tidy;--fix;--fix-errors;--format-style=file;--extra-arg=--std=c++11" ) - endif (MACH_USE_CLANG_TIDY) + endif (MISO_USE_CLANG_TIDY) - add_subdirectory(mach) + add_subdirectory(miso) - get_target_property(PYMACH_SOURCES pyMach SOURCES) - add_custom_target(pymach-format + get_target_property(PYMISO_SOURCES pyMISO SOURCES) + add_custom_target(pymiso-format COMMAND clang-format -style=file -i - ${PYMACH_SOURCES} + ${PYMISO_SOURCES} ) if (BUILD_TESTING) - target_compile_definitions(pyMach + target_compile_definitions(pyMISO PRIVATE BUILD_TESTING ) - target_sources(pyMach + target_sources(pyMISO PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/test/regression/test_mach_inputs.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/test/regression/test_miso_inputs.hpp" ) - target_include_directories(pyMach + target_include_directories(pyMISO PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/test/regression/" ) endif (BUILD_TESTING) - target_link_libraries(pyMach + target_link_libraries(pyMISO PUBLIC - mach + miso # "${MFEM_LIBRARIES}" ) if (MFEM_USE_EGADS) - target_link_libraries(pyMach + target_link_libraries(pyMISO PUBLIC "${EGADS_LIBRARIES}" ) - target_include_directories(pyMach + target_include_directories(pyMISO PUBLIC "${EGADS_INCLUDE_DIRS}" ) @@ -337,17 +337,17 @@ if (BUILD_PYTHON_WRAPPER) OUTPUT_VARIABLE MPI4PY_INCLUDE_DIRS ) - target_include_directories(pyMach + target_include_directories(pyMISO PRIVATE "${MPI4PY_INCLUDE_DIRS}" ) - # target_compile_options(pyMach + # target_compile_options(pyMISO # PRIVATE # "$<$:${DEBUG_OPTIONS}>" # "$<$:${RELEASE_OPTIONS}>" # ) - # set_target_properties(pyMach + # set_target_properties(pyMISO # PROPERTIES # CXX_EXTENSIONS OFF # POSITION_INDEPENDENT_CODE ON @@ -356,12 +356,12 @@ if (BUILD_PYTHON_WRAPPER) # INTERPROCEDURAL_OPTIMIZATION OFF # ) - install(TARGETS pyMach - LIBRARY DESTINATION "${CMAKE_SOURCE_DIR}/mach" + install(TARGETS pyMISO + LIBRARY DESTINATION "${CMAKE_SOURCE_DIR}/miso" ) endif (BUILD_PYTHON_WRAPPER) add_custom_target(format - DEPENDS mach-format pymach-format + DEPENDS miso-format pymiso-format ) diff --git a/README.md b/README.md index d42bd157..61c560f6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -![master](https://github.com/OptimalDesignLab/mach/actions/workflows/build.yml/badge.svg?branch=master) ![dev](https://github.com/OptimalDesignLab/mach/actions/workflows/format.yml/badge.svg?branch=dev) -# ODL Mach # +![master](https://github.com/OptimalDesignLab/miso/actions/workflows/build.yml/badge.svg?branch=master) ![dev](https://github.com/OptimalDesignLab/miso/actions/workflows/format.yml/badge.svg?branch=dev) +# ODL MISO # -Mach is a C++ library for multi-physics finite-element simulations based on LLNL's [MFEM](https://github.com/mfem/mfem). +MISO is a C++ library for multi-physics finite-element simulations based on LLNL's [MFEM](https://github.com/mfem/mfem). ## Build Instructions ## @@ -27,7 +27,7 @@ To configure the library to build in `release` mode (with optimizations turned o ### Build: ### -Once configured, execute `make` from the build directory to build Mach. As usual, you can also use the `-j` argument to build in parallel. +Once configured, execute `make` from the build directory to build MISO. As usual, you can also use the `-j` argument to build in parallel. If using a build system other than GNU `make`, you can let CMake pick the computer's default build system with a command like `cmake --build . -j 4 --target install`. This tells CMake to `build` the project in the `.` (build) directory, in parallel using 4 processes, with the `install` target. @@ -41,13 +41,13 @@ TODO: make `make tests` an alias to `ctest --verbose` to always see verbose outp ### Installation: ### -To install Mach in a specific location, add `-DCMAKE_INSTALL_PREFIX="/path/to/mach/install"` to the configuration file. If not specified, the install directory will be the root directory, and the library will be installed to `lib/`, and the header files will be copied to `include/`. Use `make install` to install the library. +To install MISO in a specific location, add `-DCMAKE_INSTALL_PREFIX="/path/to/miso/install"` to the configuration file. If not specified, the install directory will be the root directory, and the library will be installed to `lib/`, and the header files will be copied to `include/`. Use `make install` to install the library. -TODO: Install pkg-config files so it is easier to use Mach in other CMake projects. +TODO: Install pkg-config files so it is easier to use MISO in other CMake projects. ### Documentation: ### -Use the build target `doc` to build the doxygen documentaion for Mach. +Use the build target `doc` to build the doxygen documentaion for MISO. TODO: make building the documentaion work diff --git a/cmake/config.hpp.in b/cmake/config.hpp.in index ab9bfe23..cba88ed1 100644 --- a/cmake/config.hpp.in +++ b/cmake/config.hpp.in @@ -1,5 +1,5 @@ -#ifndef MACH_CONFIG_HEADER -#define MACH_CONFIG_HEADER +#ifndef MISO_CONFIG_HEADER +#define MISO_CONFIG_HEADER /// Enable define guards for EGADS #cmakedefine MFEM_USE_EGADS diff --git a/doc/CodeDocumentation.conf.in b/doc/CodeDocumentation.conf.in index a12ea293..53c81f7b 100644 --- a/doc/CodeDocumentation.conf.in +++ b/doc/CodeDocumentation.conf.in @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "MACH" +PROJECT_NAME = "MISO" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = @MACH_SOURCE_DIR@ +STRIP_FROM_PATH = @MISO_SOURCE_DIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -758,10 +758,10 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = @MACH_SOURCE_DIR@/doc/CodeDocumentation.dox \ - @MACH_SOURCE_DIR@/sandbox \ - @MACH_SOURCE_DIR@/src \ - @MACH_SOURCE_DIR@/test +INPUT = @MISO_SOURCE_DIR@/doc/CodeDocumentation.dox \ + @MISO_SOURCE_DIR@/sandbox \ + @MISO_SOURCE_DIR@/src \ + @MISO_SOURCE_DIR@/test # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/doc/README b/doc/README index b37e458d..dc22ea90 100644 --- a/doc/README +++ b/doc/README @@ -8,7 +8,7 @@ This directory contains Doxygen configuration files for building HTML and LaTeX -documentation of the MACH sources. +documentation of the MISO sources. If not already available, Doxygen can be downloaded from diff --git a/doc/makefile b/doc/makefile index f7531f52..424ab12a 100644 --- a/doc/makefile +++ b/doc/makefile @@ -1,6 +1,6 @@ -# Make file to generate MACH documentation using Doxygen +# Make file to generate MISO documentation using Doxygen -MACH_DIR ?= .. +MISO_DIR ?= .. DOXYGEN_CONF = CodeDocumentation.conf # doxygen uses: graphviz, latex @@ -11,6 +11,6 @@ html: $(DOXYGEN_CONF) clean: rm -rf $(DOXYGEN_CONF) CodeDocumentation CodeDocumentation.html *~ -$(DOXYGEN_CONF): $(MACH_DIR)/doc/$(DOXYGEN_CONF).in - sed -e 's%@MACH_SOURCE_DIR@%$(MACH_DIR)%g' $(<) \ +$(DOXYGEN_CONF): $(MISO_DIR)/doc/$(DOXYGEN_CONF).in + sed -e 's%@MISO_SOURCE_DIR@%$(MISO_DIR)%g' $(<) \ > $(DOXYGEN_CONF) diff --git a/mach/CMakeLists.txt b/mach/CMakeLists.txt deleted file mode 100644 index 468627a1..00000000 --- a/mach/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(pyMach) \ No newline at end of file diff --git a/mach.hpp b/miso.hpp similarity index 80% rename from mach.hpp rename to miso.hpp index d4b761a4..1b585521 100644 --- a/mach.hpp +++ b/miso.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_HPP -#define MACH_HPP +#ifndef MISO_HPP +#define MISO_HPP #include "src/common/common.hpp" #include "src/physics/physics.hpp" diff --git a/miso/CMakeLists.txt b/miso/CMakeLists.txt new file mode 100644 index 00000000..399edd1c --- /dev/null +++ b/miso/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(pyMISO) \ No newline at end of file diff --git a/mach/__init__.py b/miso/__init__.py similarity index 80% rename from mach/__init__.py rename to miso/__init__.py index f253f157..71c0e676 100644 --- a/mach/__init__.py +++ b/miso/__init__.py @@ -2,7 +2,7 @@ from mpi4py import MPI -from .pyMach import MachSolver, Mesh, Vector +from .pyMISO import MISOSolver, Mesh, Vector try: import openmdao @@ -10,10 +10,10 @@ openmdao = None if MPI.COMM_WORLD.rank == 0: - print('Warning: OpenMDAO dependency is not installed. omMach wrapper will not be active.') + print('Warning: OpenMDAO dependency is not installed. omMISO wrapper will not be active.') if openmdao is not None: - from .omMach import omMachState, omMachFunctional + from .omMISO import omMISOState, omMISOFunctional from .omMeshMovement import omMeshMove try: diff --git a/mach/doc/Makefile b/miso/doc/Makefile similarity index 100% rename from mach/doc/Makefile rename to miso/doc/Makefile diff --git a/mach/doc/conf.py b/miso/doc/conf.py similarity index 99% rename from mach/doc/conf.py rename to miso/doc/conf.py index dc97dbd0..add7840d 100644 --- a/mach/doc/conf.py +++ b/miso/doc/conf.py @@ -17,7 +17,7 @@ # -- Project information ----------------------------------------------------- -project = 'Mach' +project = 'MISO' copyright = '2020, Optimal Design Lab' author = 'Optimal Design Lab' diff --git a/mach/doc/index.rst b/miso/doc/index.rst similarity index 70% rename from mach/doc/index.rst rename to miso/doc/index.rst index ed24b0cf..3a42d00e 100644 --- a/mach/doc/index.rst +++ b/miso/doc/index.rst @@ -1,10 +1,10 @@ -Welcome to Mach's documentation! +Welcome to MISO's documentation! ================================ -.. automodule:: mach.omMach +.. automodule:: miso.omMISO :members: -.. automodule:: mach.pyMach +.. automodule:: miso.pyMISO :members: .. toctree:: diff --git a/mach/doc/make.bat b/miso/doc/make.bat similarity index 100% rename from mach/doc/make.bat rename to miso/doc/make.bat diff --git a/mach/omEGADS.py b/miso/omEGADS.py similarity index 97% rename from mach/omEGADS.py rename to miso/omEGADS.py index 6774d1ff..f7022b6f 100644 --- a/mach/omEGADS.py +++ b/miso/omEGADS.py @@ -5,8 +5,8 @@ import openmdao.api as om import pyCAPS -from .pyMach import Mesh, Vector -from .pyMach import MeshMovement +from .pyMISO import Mesh, Vector +from .pyMISO import MeshMovement class omEGADS(om.ExplicitComponent): """ diff --git a/mach/omMach.py b/miso/omMISO.py similarity index 96% rename from mach/omMach.py rename to miso/omMISO.py index 00727863..4ecec25e 100644 --- a/mach/omMach.py +++ b/miso/omMISO.py @@ -3,13 +3,13 @@ import openmdao.api as om import numpy as np -from .pyMach import MachSolver, Vector +from .pyMISO import MISOSolver, Vector -class omMachState(om.ImplicitComponent): +class omMISOState(om.ImplicitComponent): """OpenMDAO component that converges the state variables""" def initialize(self): - self.options.declare("solver", types=MachSolver) + self.options.declare("solver", types=MISOSolver) self.options.declare("depends", types=list) self.options.declare("initial_condition", default=None) @@ -110,10 +110,10 @@ def solve_linear(self, d_outputs, d_residuals, mode): raise NotImplementedError -class omMachFunctional(om.ExplicitComponent): +class omMISOFunctional(om.ExplicitComponent): """OpenMDAO component that computes functionals given the state variables""" def initialize(self): - self.options.declare("solver", types=MachSolver) + self.options.declare("solver", types=MISOSolver) self.options.declare("func", types=str) self.options.declare("depends", types=list) self.options.declare("options", default=None, types=dict) diff --git a/mach/omMeshMovement.py b/miso/omMeshMovement.py similarity index 96% rename from mach/omMeshMovement.py rename to miso/omMeshMovement.py index af51f24b..a46aaad3 100644 --- a/mach/omMeshMovement.py +++ b/miso/omMeshMovement.py @@ -1,12 +1,12 @@ import numpy as np import openmdao.api as om -from .pyMach import Mesh, Vector, MachSolver -from .pyMach import MeshMovement +from .pyMISO import Mesh, Vector, MISOSolver +from .pyMISO import MeshMovement class omMeshMove(om.ImplicitComponent): def initialize(self): - self.options.declare('solver', types=MachSolver) + self.options.declare('solver', types=MISOSolver) # self.options['distributed'] = True def setup(self): diff --git a/mach/pyMach/CMakeLists.txt b/miso/pyMISO/CMakeLists.txt similarity index 68% rename from mach/pyMach/CMakeLists.txt rename to miso/pyMISO/CMakeLists.txt index 3de64c80..9a23cd72 100644 --- a/mach/pyMach/CMakeLists.txt +++ b/miso/pyMISO/CMakeLists.txt @@ -1,8 +1,8 @@ -target_sources(pyMach +target_sources(pyMISO PUBLIC - "pyMach.cpp" + "pyMISO.cpp" "field.cpp" - "machSolver.cpp" + "misoSolver.cpp" "vector.cpp" "mesh.cpp" "meshMotion.cpp" diff --git a/mach/pyMach/field.cpp b/miso/pyMISO/field.cpp similarity index 100% rename from mach/pyMach/field.cpp rename to miso/pyMISO/field.cpp diff --git a/mach/pyMach/mesh.cpp b/miso/pyMISO/mesh.cpp similarity index 99% rename from mach/pyMach/mesh.cpp rename to miso/pyMISO/mesh.cpp index 42d187bb..83d2ff3a 100644 --- a/mach/pyMach/mesh.cpp +++ b/miso/pyMISO/mesh.cpp @@ -244,7 +244,7 @@ void initMesh(py::module &m) return mesh; // #else - // throw MachException("mfem::ParMesh::init()\n" + // throw MISOException("mfem::ParMesh::init()\n" // "\tMFEM was not built with // PUMI!\n" // "\trecompile MFEM with diff --git a/mach/pyMach/meshMotion.cpp b/miso/pyMISO/meshMotion.cpp similarity index 99% rename from mach/pyMach/meshMotion.cpp rename to miso/pyMISO/meshMotion.cpp index 2974a09c..90706c68 100644 --- a/mach/pyMach/meshMotion.cpp +++ b/miso/pyMISO/meshMotion.cpp @@ -163,7 +163,7 @@ void initMeshMotion(py::module &m) #else { throw std::runtime_error( - "pyMach not built with EGADS support!\n" + "pyMISO not built with EGADS support!\n" "\t mapSurfaceMesh unavailable!\n"); }, #endif // MFEM_USE_EGADS diff --git a/mach/pyMach/machSolver.cpp b/miso/pyMISO/misoSolver.cpp similarity index 96% rename from mach/pyMach/machSolver.cpp rename to miso/pyMISO/misoSolver.cpp index e147c3bd..d99975e0 100644 --- a/mach/pyMach/machSolver.cpp +++ b/miso/pyMISO/misoSolver.cpp @@ -20,15 +20,15 @@ #include "mesh_movement.hpp" #ifdef BUILD_TESTING -#include "test_mach_inputs.hpp" +#include "test_miso_inputs.hpp" #endif -#include "mach_input.hpp" +#include "miso_input.hpp" namespace py = pybind11; using namespace mfem; -using namespace mach; +using namespace miso; namespace { @@ -71,9 +71,9 @@ SolverPtr initSolver(const std::string &type, return createSolver(json_options, nullptr, comm); } #ifdef BUILD_TESTING - else if (type == "TestMachInput") + else if (type == "TestMISOInput") { - return createSolver(json_options, nullptr, comm); + return createSolver(json_options, nullptr, comm); } #endif else @@ -118,9 +118,9 @@ double *npBufferToDoubleArray(const py::array_t &arr, return npBufferToDoubleArray(arr, shape, expected_dim); } -MachInputs pyDictToMachInputs(const py::dict &py_inputs) +MISOInputs pyDictToMISOInputs(const py::dict &py_inputs) { - MachInputs inputs(py_inputs.size()); + MISOInputs inputs(py_inputs.size()); for (const auto &input : py_inputs) { @@ -162,7 +162,7 @@ void initSolver(py::module &m) return; } - py::class_(m, "MachSolver") + py::class_(m, "MISOSolver") .def(py::init( [](const std::string &type, const std::string &opt_file_name, @@ -347,7 +347,7 @@ void initSolver(py::module &m) const py::dict &py_inputs, const py::array_t &state) { - self.solveForState(pyDictToMachInputs(py_inputs), + self.solveForState(pyDictToMISOInputs(py_inputs), npBufferToDoubleArray(state)); }, py::arg("inputs"), @@ -356,7 +356,7 @@ void initSolver(py::module &m) .def( "linearize", [](AbstractSolver &self, const py::dict &py_inputs) - { self.linearize(pyDictToMachInputs(py_inputs)); }, + { self.linearize(pyDictToMISOInputs(py_inputs)); }, py::arg("inputs")) .def( @@ -444,7 +444,7 @@ void initSolver(py::module &m) const py::dict &py_inputs, const py::array_t &residual) { - self.calcResidual(pyDictToMachInputs(py_inputs), + self.calcResidual(pyDictToMISOInputs(py_inputs), npBufferToDoubleArray(residual)); }, py::arg("inputs"), @@ -469,7 +469,7 @@ void initSolver(py::module &m) [](AbstractSolver &self, const std::string &fun, const py::dict &py_inputs) - { return self.calcOutput(fun, pyDictToMachInputs(py_inputs)); }, + { return self.calcOutput(fun, pyDictToMISOInputs(py_inputs)); }, "Evaluates and returns the output functional specifed by `fun`", py::arg("fun"), py::arg("inputs")) @@ -485,7 +485,7 @@ void initSolver(py::module &m) std::vector shape; auto *partial = npBufferToDoubleArray(partial_buffer, shape); - auto inputs = pyDictToMachInputs(py_inputs); + auto inputs = pyDictToMISOInputs(py_inputs); if (shape[0] == 1) { // *partial = self.calcOutputPartial(of, wrt, inputs); diff --git a/mach/pyMach/mpi4py_comm.hpp b/miso/pyMISO/mpi4py_comm.hpp similarity index 100% rename from mach/pyMach/mpi4py_comm.hpp rename to miso/pyMISO/mpi4py_comm.hpp diff --git a/mach/pyMach/pyMach.cpp b/miso/pyMISO/pyMISO.cpp similarity index 93% rename from mach/pyMach/pyMach.cpp rename to miso/pyMISO/pyMISO.cpp index 60ab2450..f4bf3cc3 100644 --- a/mach/pyMach/pyMach.cpp +++ b/miso/pyMISO/pyMISO.cpp @@ -8,7 +8,7 @@ void initSolver(py::module &); void initMesh(py::module &); void initMeshMotion(py::module &); -PYBIND11_MODULE(pyMach, m) +PYBIND11_MODULE(pyMISO, m) { initVector(m); initField(m); diff --git a/mach/pyMach/pybind11_json.hpp b/miso/pyMISO/pybind11_json.hpp similarity index 100% rename from mach/pyMach/pybind11_json.hpp rename to miso/pyMISO/pybind11_json.hpp diff --git a/mach/pyMach/vector.cpp b/miso/pyMISO/vector.cpp similarity index 100% rename from mach/pyMach/vector.cpp rename to miso/pyMISO/vector.cpp diff --git a/mach/test/data/testOMEGADS/quarter_annulus.csm b/miso/test/data/testOMEGADS/quarter_annulus.csm similarity index 100% rename from mach/test/data/testOMEGADS/quarter_annulus.csm rename to miso/test/data/testOMEGADS/quarter_annulus.csm diff --git a/mach/test/data/testOMEGADS/quarter_annulus.egads b/miso/test/data/testOMEGADS/quarter_annulus.egads similarity index 100% rename from mach/test/data/testOMEGADS/quarter_annulus.egads rename to miso/test/data/testOMEGADS/quarter_annulus.egads diff --git a/mach/test/data/testOMEGADS/quarter_annulus.egads.sup b/miso/test/data/testOMEGADS/quarter_annulus.egads.sup similarity index 100% rename from mach/test/data/testOMEGADS/quarter_annulus.egads.sup rename to miso/test/data/testOMEGADS/quarter_annulus.egads.sup diff --git a/mach/test/data/testOMEGADS/quarter_annulus.eto b/miso/test/data/testOMEGADS/quarter_annulus.eto similarity index 100% rename from mach/test/data/testOMEGADS/quarter_annulus.eto rename to miso/test/data/testOMEGADS/quarter_annulus.eto diff --git a/mach/test/data/testOMEGADS/quarter_annulus0.smb b/miso/test/data/testOMEGADS/quarter_annulus0.smb similarity index 100% rename from mach/test/data/testOMEGADS/quarter_annulus0.smb rename to miso/test/data/testOMEGADS/quarter_annulus0.smb diff --git a/mach/test/data/testOMMach/parallel_wires.egads b/miso/test/data/testOMMISO/parallel_wires.egads similarity index 100% rename from mach/test/data/testOMMach/parallel_wires.egads rename to miso/test/data/testOMMISO/parallel_wires.egads diff --git a/mach/test/data/testOMMach/parallel_wires.egads.sup b/miso/test/data/testOMMISO/parallel_wires.egads.sup similarity index 100% rename from mach/test/data/testOMMach/parallel_wires.egads.sup rename to miso/test/data/testOMMISO/parallel_wires.egads.sup diff --git a/mach/test/data/testOMMach/parallel_wires.egadslite b/miso/test/data/testOMMISO/parallel_wires.egadslite similarity index 100% rename from mach/test/data/testOMMach/parallel_wires.egadslite rename to miso/test/data/testOMMISO/parallel_wires.egadslite diff --git a/mach/test/data/testOMMach/parallel_wires.egadslite.sup b/miso/test/data/testOMMISO/parallel_wires.egadslite.sup similarity index 100% rename from mach/test/data/testOMMach/parallel_wires.egadslite.sup rename to miso/test/data/testOMMISO/parallel_wires.egadslite.sup diff --git a/mach/test/data/testOMMach/parallel_wires.eto b/miso/test/data/testOMMISO/parallel_wires.eto similarity index 100% rename from mach/test/data/testOMMach/parallel_wires.eto rename to miso/test/data/testOMMISO/parallel_wires.eto diff --git a/mach/test/data/testOMMach/parallel_wires0.smb b/miso/test/data/testOMMISO/parallel_wires0.smb similarity index 100% rename from mach/test/data/testOMMach/parallel_wires0.smb rename to miso/test/data/testOMMISO/parallel_wires0.smb diff --git a/mach/test/data/testOMMeshMovement/cyl.csm b/miso/test/data/testOMMeshMovement/cyl.csm similarity index 100% rename from mach/test/data/testOMMeshMovement/cyl.csm rename to miso/test/data/testOMMeshMovement/cyl.csm diff --git a/mach/test/data/testOMMeshMovement/cyl.egads b/miso/test/data/testOMMeshMovement/cyl.egads similarity index 100% rename from mach/test/data/testOMMeshMovement/cyl.egads rename to miso/test/data/testOMMeshMovement/cyl.egads diff --git a/mach/test/data/testOMMeshMovement/cyl.egads.sup b/miso/test/data/testOMMeshMovement/cyl.egads.sup similarity index 100% rename from mach/test/data/testOMMeshMovement/cyl.egads.sup rename to miso/test/data/testOMMeshMovement/cyl.egads.sup diff --git a/mach/test/data/testOMMeshMovement/cyl.eto b/miso/test/data/testOMMeshMovement/cyl.eto similarity index 100% rename from mach/test/data/testOMMeshMovement/cyl.eto rename to miso/test/data/testOMMeshMovement/cyl.eto diff --git a/mach/test/data/testOMMeshMovement/cyl0.smb b/miso/test/data/testOMMeshMovement/cyl0.smb similarity index 100% rename from mach/test/data/testOMMeshMovement/cyl0.smb rename to miso/test/data/testOMMeshMovement/cyl0.smb diff --git a/mach/test/testOMEGADS.py b/miso/test/testOMEGADS.py similarity index 96% rename from mach/test/testOMEGADS.py rename to miso/test/testOMEGADS.py index 070af228..76b1dc11 100644 --- a/mach/test/testOMEGADS.py +++ b/miso/test/testOMEGADS.py @@ -1,4 +1,4 @@ -from mach import omEGADS +from miso import omEGADS import openmdao.api as om diff --git a/mach/test/testOMMach.py b/miso/test/testOMMISO.py similarity index 90% rename from mach/test/testOMMach.py rename to miso/test/testOMMISO.py index d6bf8898..38d7e878 100644 --- a/mach/test/testOMMach.py +++ b/miso/test/testOMMISO.py @@ -3,7 +3,7 @@ import tempfile import os -from mach import omMachState, omMachFunctional, Mesh, Vector, MachSolver +from miso import omMISOState, omMISOFunctional, Mesh, Vector, MISOSolver import openmdao.api as om from openmdao.utils.assert_utils import assert_check_partials @@ -12,7 +12,7 @@ # }, # 'print-options': False, # 'flow-param': { -# 'mach': 1.0, +# 'miso': 1.0, # 'aoa': 0.0 # }, # 'space-dis': { @@ -99,10 +99,10 @@ # mesh = Mesh(num_rad, num_ang, 2.0, np.pi*0.5, degree) -# mach_nodes = Vector() -# mesh.getNodes(mach_nodes) -# print(mach_nodes) -# nodes = np.array(mach_nodes, copy=False) +# miso_nodes = Vector() +# mesh.getNodes(miso_nodes) +# print(miso_nodes) +# nodes = np.array(miso_nodes, copy=False) # apply_map(nodes) # mesh.Print(path) # mesh.PrintVTU("testpath") @@ -140,7 +140,7 @@ # q[2] = -rho*a*Ma*np.cos(theta) # q[3] = press/gami + 0.5*rho*a*a*Ma*Ma -# class TestMachGroup(unittest.TestCase): +# class TestMISOGroup(unittest.TestCase): # def test_group(self): # # for use_entvar in [False, True]: @@ -173,17 +173,17 @@ # mesh = buildQuarterAnnulusMesh(mesh_degree, nx, nx, filepath) -# # mach_nodes = Vector() -# # mesh.getNodes(mach_nodes) -# # mesh_nodes = np.array(mach_nodes, copy=False) +# # miso_nodes = Vector() +# # mesh.getNodes(miso_nodes) +# # mesh_nodes = np.array(miso_nodes, copy=False) -# solver = MachSolver('Euler', options, problem.comm) -# mach_nodes = solver.getMeshCoordinates() -# mesh_nodes = np.array(mach_nodes, copy=False) +# solver = MISOSolver('Euler', options, problem.comm) +# miso_nodes = solver.getMeshCoordinates() +# mesh_nodes = np.array(miso_nodes, copy=False) # ivc.add_output('vol_mesh_coords', mesh_nodes, mesh_nodes.shape) -# model.add_subsystem('machSolver', omMach(options_dict=options, +# model.add_subsystem('misoSolver', omMISO(options_dict=options, # solver_type='Euler', # initial_condition=qexact), # promotes_inputs=['vol_mesh_coords'], @@ -195,7 +195,7 @@ # print(drag[0]) # self.assertAlmostEqual(drag[0], target_drag[nx-1]) -# class TestMachFunctionals(unittest.TestCase): +# class TestMISOFunctionals(unittest.TestCase): # def test_functional(self): # def buildMesh(nx, ny, nz, path): # """Generate simple 3D box mesh @@ -265,7 +265,7 @@ # buildMesh(2, 2, 2, filepath) # options["mesh"]["file"] = filepath + ".mesh" - # solver = MachSolver("TestMachInput", options) + # solver = MISOSolver("TestMISOInput", options) # state = solver.getNewField() # solver.setFieldValue(state, 0.0); @@ -279,8 +279,8 @@ # model = problem.model # model.add_subsystem('functional', - # omMachFunctional(solver=solver, - # func="testMachInput", + # omMISOFunctional(solver=solver, + # func="testMISOInput", # depends=["test_val", "test_field", "state"]), # promotes_inputs=['*'], # promotes_outputs=['*']) @@ -293,20 +293,20 @@ # # problem['state'] = np_state # problem.run_model() - # fun = problem.get_val('testMachInput') + # fun = problem.get_val('testMISOInput') # print(fun[0]) # self.assertAlmostEqual(fun[0], 4.0) # problem['test_val'] = -2.0 # problem.run_model() - # fun = problem.get_val('testMachInput') + # fun = problem.get_val('testMISOInput') # print(fun[0]) # self.assertAlmostEqual(fun[0], 1.0) # solver.setFieldValue(test_field, 10.0); # problem['test_field'] = np_test_field # problem.run_model() - # fun = problem.get_val('testMachInput') + # fun = problem.get_val('testMISOInput') # print(fun[0]) # self.assertAlmostEqual(fun[0], 8.0) @@ -388,7 +388,7 @@ def test_energy_partials_coulomb(self): } prob = om.Problem() - emSolver = MachSolver("Magnetostatic", em_options, prob.comm) + emSolver = MISOSolver("Magnetostatic", em_options, prob.comm) state_size = emSolver.getFieldSize("state") state = np.zeros(state_size) inputs = { @@ -398,7 +398,7 @@ def test_energy_partials_coulomb(self): emSolver.solveForState(inputs, state) energy = prob.model.add_subsystem("energy", - omMachFunctional(solver=emSolver, + omMISOFunctional(solver=emSolver, func="energy", depends=["mesh_coords", "state"]), promotes_inputs=["mesh_coords", "state"], @@ -410,7 +410,7 @@ def test_energy_partials_coulomb(self): "axis": [0, 0, 1] } force = prob.model.add_subsystem("force", - omMachFunctional(solver=emSolver, + omMISOFunctional(solver=emSolver, func="force", depends=["mesh_coords", "state"], options=force_options), @@ -424,7 +424,7 @@ def test_energy_partials_coulomb(self): "about": [0.0, 0.0, 0.0] } torque = prob.model.add_subsystem("torque", - omMachFunctional(solver=emSolver, + omMISOFunctional(solver=emSolver, func="torque", depends=["mesh_coords", "state"], options=torque_options), @@ -444,8 +444,8 @@ def test_energy_partials_coulomb(self): def test_energy_partials_par_wires(self): em_options = { "mesh": { - "file": "data/testOMMach/parallel_wires.smb", - "model-file": "data/testOMMach/parallel_wires.egads", + "file": "data/testOMMISO/parallel_wires.smb", + "model-file": "data/testOMMISO/parallel_wires.egads", "refine": 0 }, "space-dis": { @@ -497,7 +497,7 @@ def test_energy_partials_par_wires(self): } prob = om.Problem() - emSolver = MachSolver("Magnetostatic", em_options, prob.comm) + emSolver = MISOSolver("Magnetostatic", em_options, prob.comm) state_size = emSolver.getFieldSize("state") state = np.zeros(state_size) inputs = { @@ -507,7 +507,7 @@ def test_energy_partials_par_wires(self): emSolver.solveForState(inputs, state) energy = prob.model.add_subsystem("energy", - omMachFunctional(solver=emSolver, + omMISOFunctional(solver=emSolver, func="energy", depends=["mesh_coords", "state"]), promotes_inputs=["mesh_coords", "state"], @@ -519,7 +519,7 @@ def test_energy_partials_par_wires(self): "axis": [0, 1, 0] } force = prob.model.add_subsystem("force", - omMachFunctional(solver=emSolver, + omMISOFunctional(solver=emSolver, func="force", depends=["mesh_coords", "state"], options=force_options), @@ -533,7 +533,7 @@ def test_energy_partials_par_wires(self): "about": [0.0, 0.0, 0.0] } torque = prob.model.add_subsystem("torque", - omMachFunctional(solver=emSolver, + omMISOFunctional(solver=emSolver, func="torque", depends=["mesh_coords", "state"], options=torque_options), @@ -553,8 +553,8 @@ class TestEMResiduals(unittest.TestCase): def test_res_partials(self): em_options = { "mesh": { - "file": "data/testOMMach/parallel_wires.smb", - "model-file": "data/testOMMach/parallel_wires.egads", + "file": "data/testOMMISO/parallel_wires.smb", + "model-file": "data/testOMMISO/parallel_wires.egads", "refine": 0 }, "space-dis": { @@ -606,10 +606,10 @@ def test_res_partials(self): } prob = om.Problem() - emSolver = MachSolver("Magnetostatic", em_options, prob.comm) + emSolver = MISOSolver("Magnetostatic", em_options, prob.comm) solver = prob.model.add_subsystem("em_solver", - omMachState(solver=emSolver, + omMISOState(solver=emSolver, # initial_condition=np.array([0.0, 0.0, 0.0]), depends=["current_density", "mesh_coords"]), promotes_inputs=["current_density", "mesh_coords"], diff --git a/mach/test/testOMMeshMovement.py b/miso/test/testOMMeshMovement.py similarity index 93% rename from mach/test/testOMMeshMovement.py rename to miso/test/testOMMeshMovement.py index a88029e2..f6afd64a 100644 --- a/mach/test/testOMMeshMovement.py +++ b/miso/test/testOMMeshMovement.py @@ -1,7 +1,7 @@ -from mach import omEGADS, omMeshMove, Mesh, Vector +from miso import omEGADS, omMeshMove, Mesh, Vector import openmdao.api as om -from mach import MachSolver +from miso import MISOSolver options = { 'mesh': { @@ -64,7 +64,7 @@ mesh_file='data/testOMMeshMovement/cyl.smb', tess_file='data/testOMMeshMovement/cyl.eto')) - meshMoveSolver = MachSolver("MeshMovement", options, problem.comm) + meshMoveSolver = MISOSolver("MeshMovement", options, problem.comm) model.add_subsystem('vol_mesh_move', omMeshMove(solver=meshMoveSolver)) model.connect('des_vars.length', 'surf_mesh_move.length') diff --git a/mach/test/testSolver.py b/miso/test/testSolver.py similarity index 95% rename from mach/test/testSolver.py rename to miso/test/testSolver.py index 02220ddd..88e2a0d2 100644 --- a/mach/test/testSolver.py +++ b/miso/test/testSolver.py @@ -3,7 +3,7 @@ import tempfile import os -from mach import MachSolver, Mesh, Vector +from miso import MISOSolver, Mesh, Vector class SolverRegressionTests(unittest.TestCase): # def test_steady_vortex(self): @@ -43,9 +43,9 @@ class SolverRegressionTests(unittest.TestCase): # mesh = Mesh(num_rad, num_ang, 2.0, np.pi*0.5, degree) - # mach_nodes = Vector() - # mesh.getNodes(mach_nodes) - # nodes = np.array(mach_nodes, copy=False) + # miso_nodes = Vector() + # mesh.getNodes(miso_nodes) + # nodes = np.array(miso_nodes, copy=False) # apply_map(nodes) # mesh.Print(path) @@ -87,7 +87,7 @@ class SolverRegressionTests(unittest.TestCase): # }, # "print-options": True, # "flow-param": { - # "mach": 1.0, + # "miso": 1.0, # "aoa": 0.0 # }, # "space-dis": { @@ -162,7 +162,7 @@ class SolverRegressionTests(unittest.TestCase): # else: # uexact = qexact - # solver = MachSolver("Euler", options, entvar=use_entvar) + # solver = MISOSolver("Euler", options, entvar=use_entvar) # state = solver.getNewField() @@ -185,7 +185,7 @@ class SolverRegressionTests(unittest.TestCase): # print(l2_errors) - def test_mach_inputs(self): + def test_miso_inputs(self): def buildMesh(nx, ny, nz, path): """Generate simple 3D box mesh @@ -254,8 +254,8 @@ def buildMesh(nx, ny, nz, path): buildMesh(2, 2, 2, filepath) options["mesh"]["file"] = filepath + ".mesh" - solver = MachSolver("TestMachInput", options) - solver.createOutput("testMachInput"); + solver = MISOSolver("TestMISOInput", options) + solver.createOutput("testMISOInput"); state = solver.getNewField() solver.setFieldValue(state, 0.0); @@ -269,16 +269,16 @@ def buildMesh(nx, ny, nz, path): "state": state } - fun = solver.calcOutput("testMachInput", inputs); + fun = solver.calcOutput("testMISOInput", inputs); self.assertAlmostEqual(fun, 2.0) inputs["test_val"] = 1.0; - fun = solver.calcOutput("testMachInput", inputs); + fun = solver.calcOutput("testMISOInput", inputs); self.assertAlmostEqual(fun, 1.0) inputs["test_val"] = 0.0; solver.setFieldValue(test_field, -1.0); - fun = solver.calcOutput("testMachInput", inputs); + fun = solver.calcOutput("testMISOInput", inputs); self.assertAlmostEqual(fun, -1.0) def test_ac_losses(self): @@ -380,7 +380,7 @@ def test_ac_losses(self): } } - solver = MachSolver("Magnetostatic", options) + solver = MISOSolver("Magnetostatic", options) solver.createOutput("ACLoss"); solver.createOutput("DCLoss"); diff --git a/sandbox/CMakeLists.txt b/sandbox/CMakeLists.txt index 60c46f77..2c15226f 100644 --- a/sandbox/CMakeLists.txt +++ b/sandbox/CMakeLists.txt @@ -6,10 +6,10 @@ function(create_sandbox source_list) foreach(X ${source_list}) add_executable("${X}.bin" "${X}.cpp") add_dependencies(sandbox "${X}.bin") - target_link_libraries("${X}.bin" PRIVATE mach) + target_link_libraries("${X}.bin" PRIVATE miso) target_include_directories("${X}.bin" PRIVATE "${CMAKE_SOURCE_DIR}") configure_file("${X}_options.json" "${X}_options.json" COPYONLY) - configure_file("mach_options.json" "mach_options.json" COPYONLY) + configure_file("miso_options.json" "miso_options.json" COPYONLY) endforeach() endfunction(create_sandbox) diff --git a/sandbox/advection2d.cpp b/sandbox/advection2d.cpp index e5aeaa23..c9362b39 100644 --- a/sandbox/advection2d.cpp +++ b/sandbox/advection2d.cpp @@ -4,12 +4,12 @@ #include "mfem.hpp" -#include "mach.hpp" +#include "miso.hpp" // #include "advection.hpp" using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; /// Defines the velocity field /// \param[in] x - coordinate of the point at which the velocity is needed @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) // Parse command-line options OptionsParser args(argc, argv); - const char *options_file = "../../sandbox/mach_options.json"; + const char *options_file = "../../sandbox/miso_options.json"; args.AddOption(&options_file, "-o", "--options", "Options file to use."); args.Parse(); @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) *out << "\n|| u_h - u ||_{L^2} = " << solver->calcL2Error(u0_function) << '\n' << endl; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/airfoil_chaotic.cpp b/sandbox/airfoil_chaotic.cpp index b71d9fcc..8e2761d0 100644 --- a/sandbox/airfoil_chaotic.cpp +++ b/sandbox/airfoil_chaotic.cpp @@ -5,11 +5,11 @@ #include "mfem.hpp" -#include "mach.hpp" +#include "miso.hpp" using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; void uinit(const Vector &x, Vector& u0); @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) mfem::out << "\nfinal residual norm = " << solver->calcResidualNorm() << endl; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/airfoil_chaotic_options.json b/sandbox/airfoil_chaotic_options.json index f6f022d0..14a51db7 100644 --- a/sandbox/airfoil_chaotic_options.json +++ b/sandbox/airfoil_chaotic_options.json @@ -3,7 +3,7 @@ "file": "naca0012-5deg.mesh" }, "flow-param": { - "mach": 0.2, + "miso": 0.2, "aoa": 20.0, "roll-axis": 0, "pitch-axis": 1, diff --git a/sandbox/airfoil_steady.cpp b/sandbox/airfoil_steady.cpp index b415b42a..15f2967d 100644 --- a/sandbox/airfoil_steady.cpp +++ b/sandbox/airfoil_steady.cpp @@ -13,7 +13,7 @@ constexpr bool entvar = false; using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; std::default_random_engine gen(std::random_device{}()); std::uniform_real_distribution normal_rand(-1.0,1.0); @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) mfem::out << "\nfinal residual norm = " << solver->calcResidualNorm() << endl; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/airfoil_steady_options.json b/sandbox/airfoil_steady_options.json index 7e8a2213..9de85e53 100644 --- a/sandbox/airfoil_steady_options.json +++ b/sandbox/airfoil_steady_options.json @@ -1,6 +1,6 @@ { "flow-param": { - "mach": 0.5, + "miso": 0.5, "aoa": 3.0, "roll-axis": 0, "pitch-axis": 1 diff --git a/sandbox/joule_box.cpp b/sandbox/joule_box.cpp index 38ff6b51..43c51022 100644 --- a/sandbox/joule_box.cpp +++ b/sandbox/joule_box.cpp @@ -2,11 +2,11 @@ #include #include "mfem.hpp" -#include "mach.hpp" +#include "miso.hpp" // using namespace std; // using namespace mfem; -// using namespace mach; +// using namespace miso; static double theta0; static double t_final; @@ -20,9 +20,9 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); - out = mach::getOutStream(rank); + out = miso::getOutStream(rank); #else - out = mach::getOutStream(0); + out = miso::getOutStream(0); #endif // Parse command-line options @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) try { // construct the solver - mach::JouleSolver solver(opt_file_name, move(mesh)); + miso::JouleSolver solver(opt_file_name, move(mesh)); solver.initDerived(); solver.setInitialCondition(initialTemperature); *out << "Solving..." << std::endl; @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) *out << "Solving done." << std::endl; solver.printSolution("joule_out"); } - catch (mach::MachException &exception) + catch (miso::MISOException &exception) { exception.print_message(); } diff --git a/sandbox/joule_wire.cpp b/sandbox/joule_wire.cpp index 04b24e28..5955c572 100644 --- a/sandbox/joule_wire.cpp +++ b/sandbox/joule_wire.cpp @@ -2,11 +2,11 @@ #include #include "mfem.hpp" -#include "mach.hpp" +#include "miso.hpp" // using namespace std; // using namespace mfem; -// using namespace mach; +// using namespace miso; static double theta0; static double t_final; @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) MPI_Init(&argc, &argv); int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank); - out = mach::getOutStream(rank); + out = miso::getOutStream(rank); // Parse command-line options mfem::OptionsParser args(argc, argv); @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) try { // construct the solver - mach::JouleSolver solver(opt_file_name); + miso::JouleSolver solver(opt_file_name); solver.initDerived(); solver.setInitialCondition(initialTemperature); *out << "Solving..." << std::endl; @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) *out << "Solving done." << std::endl; solver.printSolution("joule_out"); } - catch (mach::MachException &exception) + catch (miso::MISOException &exception) { exception.print_message(); } diff --git a/sandbox/magnetostatic_box.cpp b/sandbox/magnetostatic_box.cpp index fc7979c9..4ba946cb 100644 --- a/sandbox/magnetostatic_box.cpp +++ b/sandbox/magnetostatic_box.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; int main(int argc, char *argv[]) @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) // solver.printAdjoint("co-energy-adjoint"); solver->verifyMeshSensitivities(); } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/magnetostatic_motor.cpp b/sandbox/magnetostatic_motor.cpp index 7c9a5d1f..22ee9911 100644 --- a/sandbox/magnetostatic_motor.cpp +++ b/sandbox/magnetostatic_motor.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; int main(int argc, char *argv[]) @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) solver->solveForState(); std::cout << "finish steady solve\n"; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/magnetostatic_wire.cpp b/sandbox/magnetostatic_wire.cpp index 62d4876b..8b84ee68 100644 --- a/sandbox/magnetostatic_wire.cpp +++ b/sandbox/magnetostatic_wire.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; int main(int argc, char *argv[]) { @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) // solver->printSolution("wire_out"); // solver->verifyMeshSensitivities(); } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/mesh_move.cpp b/sandbox/mesh_move.cpp index 30a41f03..4ce55e46 100644 --- a/sandbox/mesh_move.cpp +++ b/sandbox/mesh_move.cpp @@ -1,14 +1,14 @@ #include "mfem.hpp" #include "thermal.hpp" #include "gmi_egads.h" -#include "mach_egads.hpp" +#include "miso_egads.hpp" #include #include using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; #ifdef MFEM_USE_PUMI int main(int argc, char *argv[]) @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) { } - catch (MachException &exception) + catch (MISOException &exception) { } diff --git a/sandbox/mesh_move_2.cpp b/sandbox/mesh_move_2.cpp index c36d1890..47db0bb4 100644 --- a/sandbox/mesh_move_2.cpp +++ b/sandbox/mesh_move_2.cpp @@ -1,7 +1,7 @@ #include "mfem.hpp" #include "thermal.hpp" #include "gmi_egads.h" -#include "mach_egads.hpp" +#include "miso_egads.hpp" #include "mesh_movement.hpp" #include @@ -9,7 +9,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; #ifdef MFEM_USE_PUMI int main(int argc, char *argv[]) @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) std::cout << "Solver Done" << std::endl; } - catch (MachException &exception) + catch (MISOException &exception) { } diff --git a/sandbox/mach_options.json b/sandbox/miso_options.json similarity index 100% rename from sandbox/mach_options.json rename to sandbox/miso_options.json diff --git a/sandbox/navier_stokes_mms.cpp b/sandbox/navier_stokes_mms.cpp index c420b1dd..71ac1d5c 100644 --- a/sandbox/navier_stokes_mms.cpp +++ b/sandbox/navier_stokes_mms.cpp @@ -7,7 +7,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; /// Generate smoothly perturbed mesh /// \param[in] degree - polynomial degree of the mapping @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) solver->printAdjoint("adjoint", degree+1); } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/patch_test b/sandbox/patch_test index cd2da832..c9cf203f 100644 --- a/sandbox/patch_test +++ b/sandbox/patch_test @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // function to match patch elements void checkNeighbour(const std::string &, int); @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) // Parse command-line options OptionsParser args(argc, argv); - const char *options_file = "mach_options.json"; + const char *options_file = "miso_options.json"; args.AddOption(&options_file, "-o", "--options", "Options file to use."); args.Parse(); diff --git a/sandbox/python/acloss.py b/sandbox/python/acloss.py index 0741346e..450b6e76 100644 --- a/sandbox/python/acloss.py +++ b/sandbox/python/acloss.py @@ -2,15 +2,15 @@ import matplotlib.pyplot as plt import numpy as np -from mach import MachSolver, Mesh, Vector +from miso import MISOSolver, Mesh, Vector options = { "silent": False, "print-options": False, "mesh": { - "file": "../../mach/test/data/testSolver/wire.smb", - "model-file": "../../mach/test/data/testSolver/wire.egads" + "file": "../../miso/test/data/testSolver/wire.smb", + "model-file": "../../miso/test/data/testSolver/wire.egads" }, "space-dis": { "basis-type": "nedelec", @@ -122,7 +122,7 @@ def calcFEMLoss(solver, state, current_density, fill_factor, n, r_s, freq): if __name__ == "__main__": - solver = MachSolver("Magnetostatic", options) + solver = MISOSolver("Magnetostatic", options) solver.createOutput("ACLoss"); solver.createOutput("DCLoss"); diff --git a/sandbox/python/joule_motor_egads_openmdao.py b/sandbox/python/joule_motor_egads_openmdao.py index 0bb9c0ac..9aac2d6d 100644 --- a/sandbox/python/joule_motor_egads_openmdao.py +++ b/sandbox/python/joule_motor_egads_openmdao.py @@ -1,7 +1,7 @@ -from mach import omEGADS, omMeshMove, omMachState, Mesh, Vector +from miso import omEGADS, omMeshMove, omMISOState, Mesh, Vector import openmdao.api as om -from mach import MachSolver +from miso import MISOSolver mesh_options = { 'mesh': { @@ -393,12 +393,12 @@ model.connect('des_vars.slot_radius', 'surf_mesh_move.slot_radius') model.connect('des_vars.stack_length', 'surf_mesh_move.stack_length') - meshMoveSolver = MachSolver("MeshMovement", mesh_options, problem.comm) + meshMoveSolver = MISOSolver("MeshMovement", mesh_options, problem.comm) model.add_subsystem('vol_mesh_move', omMeshMove(solver=meshMoveSolver)) model.connect('surf_mesh_move.surf_mesh_disp', 'vol_mesh_move.surf_mesh_disp') - emSolver = MachSolver("Magnetostatic", em_options, problem.comm) - model.add_subsystem('em_solver', omMachState(solver=emSolver, + emSolver = MISOSolver("Magnetostatic", em_options, problem.comm) + model.add_subsystem('em_solver', omMISOState(solver=emSolver, initial_condition=Vector([0.0, 0.0, 0.0]))) model.connect('vol_mesh_move.vol_mesh_coords', 'em_solver.mesh-coords') @@ -410,8 +410,8 @@ def thermal_init(x): else: return 283.15 - thermalSolver = MachSolver("Thermal", thermal_options, problem.comm) - model.add_subsystem('thermal_solver', omMachState(solver=thermalSolver, + thermalSolver = MISOSolver("Thermal", thermal_options, problem.comm) + model.add_subsystem('thermal_solver', omMISOState(solver=thermalSolver, initial_condition=thermal_init)) model.connect('vol_mesh_move.vol_mesh_coords', 'thermal_solver.mesh-coords') model.connect('em_solver.state', 'thermal_solver.mvp') diff --git a/sandbox/python/joule_wire_egads_openmdao.py b/sandbox/python/joule_wire_egads_openmdao.py index 95908612..4df3da70 100644 --- a/sandbox/python/joule_wire_egads_openmdao.py +++ b/sandbox/python/joule_wire_egads_openmdao.py @@ -1,7 +1,7 @@ -from mach import omEGADS, omMeshMove, omMachState, Mesh, Vector +from miso import omEGADS, omMeshMove, omMISOState, Mesh, Vector import openmdao.api as om -from mach import MachSolver +from miso import MISOSolver mesh_options = { 'mesh': { @@ -195,17 +195,17 @@ tess_file='wire.eto')) model.connect('des_vars.radius', 'surf_mesh_move.radius') - meshMoveSolver = MachSolver("MeshMovement", mesh_options, problem.comm) + meshMoveSolver = MISOSolver("MeshMovement", mesh_options, problem.comm) model.add_subsystem('vol_mesh_move', omMeshMove(solver=meshMoveSolver)) model.connect('surf_mesh_move.surf_mesh_disp', 'vol_mesh_move.surf_mesh_disp') - emSolver = MachSolver("Magnetostatic", em_options, problem.comm) - model.add_subsystem('em_solver', omMachState(solver=emSolver, + emSolver = MISOSolver("Magnetostatic", em_options, problem.comm) + model.add_subsystem('em_solver', omMISOState(solver=emSolver, initial_condition=Vector([0.0, 0.0, 0.0]))) model.connect('vol_mesh_move.vol_mesh_coords', 'em_solver.mesh-coords') - thermalSolver = MachSolver("Thermal", thermal_options, problem.comm) - model.add_subsystem('thermal_solver', omMachState(solver=thermalSolver, + thermalSolver = MISOSolver("Thermal", thermal_options, problem.comm) + model.add_subsystem('thermal_solver', omMISOState(solver=thermalSolver, initial_condition=300.0)) model.connect('vol_mesh_move.vol_mesh_coords', 'thermal_solver.mesh-coords') model.connect('em_solver.state', 'thermal_solver.mvp') diff --git a/sandbox/steady_vortex.cpp b/sandbox/steady_vortex.cpp index 0e8a9a5f..e81a4632 100644 --- a/sandbox/steady_vortex.cpp +++ b/sandbox/steady_vortex.cpp @@ -13,7 +13,7 @@ constexpr bool entvar = false; using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; std::default_random_engine gen(std::random_device{}()); std::uniform_real_distribution normal_rand(-1.0,1.0); @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) l2_error = (static_cast&>(*solver) .calcConservativeVarsL2Error(uexact, 0)); res_error = solver->calcResidualNorm(); - double drag = abs(solver->calcOutput("drag") - (-1 / mach::euler::gamma)); + double drag = abs(solver->calcOutput("drag") - (-1 / miso::euler::gamma)); double entropy = solver->calcOutput("entropy"); out->precision(15); @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) *out << "\nEntropy error = " << fabs(entropy - calcEntropyTotalExact()) << endl; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/steady_vortex_adjoint.cpp b/sandbox/steady_vortex_adjoint.cpp index 7a51f9cf..9d4d0dd5 100644 --- a/sandbox/steady_vortex_adjoint.cpp +++ b/sandbox/steady_vortex_adjoint.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; std::default_random_engine gen(std::random_device{}()); std::uniform_real_distribution normal_rand(-1.0,1.0); @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) solver->printSolution("final", map_degree+1); l2_error = solver->calcL2Error(uexact, 0); res_error = solver->calcResidualNorm(); - double drag = abs(solver->calcOutput("drag") - (-1 / mach::euler::gamma)); + double drag = abs(solver->calcOutput("drag") - (-1 / miso::euler::gamma)); if (0==myid) { @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) solver->printAdjoint("adjoint", map_degree+1); } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/steady_vortex_options.json b/sandbox/steady_vortex_options.json index 10f4a537..9187571e 100644 --- a/sandbox/steady_vortex_options.json +++ b/sandbox/steady_vortex_options.json @@ -1,6 +1,6 @@ { "flow-param": { - "mach": 1.0, + "miso": 1.0, "aoa": 0.0 }, "space-dis": { diff --git a/sandbox/surface_distance.cpp b/sandbox/surface_distance.cpp index fa8825dc..7eaf6a29 100644 --- a/sandbox/surface_distance.cpp +++ b/sandbox/surface_distance.cpp @@ -9,7 +9,7 @@ int main(int argc, char *argv[]) { using namespace std; using namespace mfem; - using namespace mach; + using namespace miso; // Initialize MPI MPI_Init(&argc, &argv); diff --git a/sandbox/thermal_square.cpp b/sandbox/thermal_square.cpp index 3874b264..05d03063 100644 --- a/sandbox/thermal_square.cpp +++ b/sandbox/thermal_square.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; static double temp_0; @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) std::cout << "\n|| rho_h - rho ||_{L^2} = " << solver->calcL2Error(ExactSolution) << '\n' << endl; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/unsteady_vortex.cpp b/sandbox/unsteady_vortex.cpp index 77270e44..72fe5686 100644 --- a/sandbox/unsteady_vortex.cpp +++ b/sandbox/unsteady_vortex.cpp @@ -10,7 +10,7 @@ constexpr bool entvar = true; using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; std::default_random_engine gen(std::random_device{}()); std::uniform_real_distribution normal_rand(-1.0,1.0); @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) << solver->calcL2Error(u0_function) << '\n' << endl; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/viscous_shock.cpp b/sandbox/viscous_shock.cpp index 1ddea0f3..4d31979d 100644 --- a/sandbox/viscous_shock.cpp +++ b/sandbox/viscous_shock.cpp @@ -7,7 +7,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; /// Generate smoothly perturbed mesh /// \param[in] degree - polynomial degree of the mapping @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) *out << "\nfinal residual norm = " << solver->calcResidualNorm() << endl; } - catch (MachException &exception) + catch (MISOException &exception) { exception.print_message(); } diff --git a/sandbox/viscous_shock_options.json b/sandbox/viscous_shock_options.json index c24ef7e4..dbca9cf9 100644 --- a/sandbox/viscous_shock_options.json +++ b/sandbox/viscous_shock_options.json @@ -1,6 +1,6 @@ { "flow-param": { - "mach": 2.5, + "miso": 2.5, "aoa": 0.0, "roll-axis": 0, "pitch-axis": 1, diff --git a/setup.py b/setup.py index 060d1f35..a1cf1ca6 100644 --- a/setup.py +++ b/setup.py @@ -3,28 +3,28 @@ __version__ = re.findall( r"""__version__ = ["']+([0-9\.]*)["']+""", - open('mach/__init__.py').read(), + open('miso/__init__.py').read(), )[0] -setup(name='mach', +setup(name='miso', version=__version__, - description="""Mach is a C++ library for multi-physics finite-element simulations developed by the Optimal Design Lab at Rensselaer Polytechnic Institute based on Lawrence Livermore National Lab\'s MFEM code.""", - long_description="""Mach is a C++ library for multi-physics finite-element simulations developed by the Optimal Design Lab at Rensselaer Polytechnic Institute based on Lawrence Livermore National Lab\'s MFEM code. - For fluids, it solves the compressible Euler and Navier-Stokes equations. Mach also solves magnetostatic and thermal equations for electromagnetic and thermal simulations. - Mach has implemented the discrete adjoint allowing for analytical derivative evaluation.""", + description="""MISO is a C++ library for multi-physics finite-element simulations developed by the Optimal Design Lab at Rensselaer Polytechnic Institute based on Lawrence Livermore National Lab\'s MFEM code.""", + long_description="""MISO is a C++ library for multi-physics finite-element simulations developed by the Optimal Design Lab at Rensselaer Polytechnic Institute based on Lawrence Livermore National Lab\'s MFEM code. + For fluids, it solves the compressible Euler and Navier-Stokes equations. MISO also solves magnetostatic and thermal equations for electromagnetic and thermal simulations. + MISO has implemented the discrete adjoint allowing for analytical derivative evaluation.""", long_description_content_type="text/markdown", keywords='adjoint optimization', author='', author_email='', - url='https://github.com/optimaldesignlab/mach', + url='https://github.com/optimaldesignlab/miso', license='', packages=[ - 'mach', + 'miso', ], package_data={ - 'mach': ['*.so'] + 'miso': ['*.so'] }, install_requires=[ 'mpi4py>=3.0.2', diff --git a/src/README.md b/src/README.md index 19598895..da282910 100644 --- a/src/README.md +++ b/src/README.md @@ -1,3 +1,3 @@ # Contents of the Source Directory -The source directory will contain all the *.hpp and *.cpp files needed to build the object files for the Mach library. \ No newline at end of file +The source directory will contain all the *.hpp and *.cpp files needed to build the object files for the MISO library. \ No newline at end of file diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 5fe56e90..948baf99 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(mach +target_sources(miso PRIVATE coefficient.cpp coefficient.hpp @@ -11,10 +11,10 @@ target_sources(mach functional_output.hpp inexact_newton.cpp inexact_newton.hpp - mach_linearform.cpp - mach_linearform.hpp - mach_output.hpp - mach_residual.hpp + miso_linearform.cpp + miso_linearform.hpp + miso_output.hpp + miso_residual.hpp material_library.hpp mfem_extensions.cpp mfem_extensions.hpp @@ -26,7 +26,7 @@ target_sources(mach surface_def.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/common/coefficient.cpp b/src/common/coefficient.cpp index 77081ac6..6281d350 100644 --- a/src/common/coefficient.cpp +++ b/src/common/coefficient.cpp @@ -4,7 +4,7 @@ using namespace mfem; -namespace mach +namespace miso { double ParameterContinuationCoefficient::lambda = 0.0; @@ -324,7 +324,7 @@ double team13ReluctivityCoefficient::Eval(ElementTransformation &trans, // { // if (!isfinite(nu)) // { - // throw MachException("nan!"); + // throw MISOException("nan!"); // } // } // catch(const std::exception& e) @@ -359,7 +359,7 @@ double team13ReluctivityCoefficient::EvalStateDeriv( // { // if (!isfinite(dnudb)) // { - // throw MachException("nan!"); + // throw MISOException("nan!"); // } // } // catch(const std::exception& e) @@ -560,4 +560,4 @@ double ElementFunctionCoefficient::Eval(ElementTransformation &trans, } } -} // namespace mach \ No newline at end of file +} // namespace miso \ No newline at end of file diff --git a/src/common/coefficient.hpp b/src/common/coefficient.hpp index 5d01c0fa..9804e4f4 100644 --- a/src/common/coefficient.hpp +++ b/src/common/coefficient.hpp @@ -1,15 +1,15 @@ -#ifndef MACH_COEFFICIENT -#define MACH_COEFFICIENT +#ifndef MISO_COEFFICIENT +#define MISO_COEFFICIENT #include #include "mfem.hpp" #include "tinysplinecxx.h" -#include "mach_types.hpp" +#include "miso_types.hpp" #include "utils.hpp" -namespace mach +namespace miso { /// TODO: remove this class, turn it into a grid function coefficient /// and then differentiate the grid function coefficient with respect @@ -632,6 +632,6 @@ class LameSecondParameter : public mfem::Coefficient } }; -} // namespace mach +} // namespace miso #endif diff --git a/src/common/common.hpp b/src/common/common.hpp index fef2e360..24b47249 100644 --- a/src/common/common.hpp +++ b/src/common/common.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_COMMON -#define MACH_COMMON +#ifndef MISO_COMMON +#define MISO_COMMON #include "default_options.hpp" #include "evolver.hpp" diff --git a/src/common/data/CMakeLists.txt b/src/common/data/CMakeLists.txt index aba2e0f1..a87a18e7 100644 --- a/src/common/data/CMakeLists.txt +++ b/src/common/data/CMakeLists.txt @@ -1,9 +1,9 @@ -target_sources(mach +target_sources(miso PRIVATE sbp_operators.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/common/data/sbp_operators.hpp b/src/common/data/sbp_operators.hpp index 4bd0147d..cfa7b11d 100644 --- a/src/common/data/sbp_operators.hpp +++ b/src/common/data/sbp_operators.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_SBP_OPERATORS -#define MACH_SBP_OPERATORS +#ifndef MISO_SBP_OPERATORS +#define MISO_SBP_OPERATORS namespace mfem { diff --git a/src/common/default_options.cpp b/src/common/default_options.cpp index 281601b6..0f32c401 100644 --- a/src/common/default_options.cpp +++ b/src/common/default_options.cpp @@ -1,6 +1,6 @@ #include "default_options.hpp" -namespace mach +namespace miso { /// This is placed in its own file because options are likely to grow large. /// Also, while it would have been nice to use a raw string here to define the @@ -10,7 +10,7 @@ const nlohmann::json default_options{ {"print-options", true}, // print out options when solver is constructed {"flow-param", // options related to flow simulations { - {"mach", 0.5}, // far-field mach number + {"miso", 0.5}, // far-field miso number {"aoa", 0.0}, // far-field angle of attack {"roll-axis", 0}, // axis aligned with nose to tail of aircraft {"pitch-axis", 1}, // axis in the "vertical" direction @@ -104,10 +104,10 @@ const nlohmann::json default_options{ {"mesh", { - {"file", "mach.mesh"}, // mesh file name - {"model-file", "mach.dmg"}, // model file name + {"file", "miso.mesh"}, // mesh file name + {"model-file", "miso.dmg"}, // model file name {"refine", 0} // recursive uniform refinement; 0 = no refinement }}, }; -} // namespace mach +} // namespace miso diff --git a/src/common/default_options.hpp b/src/common/default_options.hpp index e936401f..e85f02a9 100644 --- a/src/common/default_options.hpp +++ b/src/common/default_options.hpp @@ -1,15 +1,15 @@ -#ifndef MACH_DEFAULT_OPTIONS -#define MACH_DEFAULT_OPTIONS +#ifndef MISO_DEFAULT_OPTIONS +#define MISO_DEFAULT_OPTIONS #include "nlohmann/json.hpp" -namespace mach +namespace miso { -/// Defines the default options for mach +/// Defines the default options for miso /// Declared extern and defined in default_options.cpp so that executables can -/// `#include "mach.hpp"` and avoid a duplicate symbol linking error +/// `#include "miso.hpp"` and avoid a duplicate symbol linking error extern const nlohmann::json default_options; -} // namespace mach +} // namespace miso #endif diff --git a/src/common/evolver.cpp b/src/common/evolver.cpp index f1bbad6b..fb8fcdea 100644 --- a/src/common/evolver.cpp +++ b/src/common/evolver.cpp @@ -1,14 +1,14 @@ #include #include "utils.hpp" -#include "mach_load.hpp" +#include "miso_load.hpp" #include "evolver.hpp" using namespace mfem; -using namespace mach; +using namespace miso; -namespace mach +namespace miso { void ODESystemOperator::Mult(const mfem::Vector &k, mfem::Vector &r) const { @@ -16,7 +16,7 @@ void ODESystemOperator::Mult(const mfem::Vector &k, mfem::Vector &r) const // Use x_work to store x + dt*k add(1.0, *x, dt, k, x_work); auto inputs = - MachInputs({{"state", x_work.GetData()}, {"dxdt", k.GetData()}}); + MISOInputs({{"state", x_work.GetData()}, {"dxdt", k.GetData()}}); evaluate(*res, inputs, r); } @@ -24,12 +24,12 @@ Operator &ODESystemOperator::GetGradient(const mfem::Vector &k) const { // Use x_work to store x + dt*k add(1.0, *x, dt, k, x_work); - auto inputs = MachInputs( + auto inputs = MISOInputs( {{"dt", dt}, {"state", x_work.GetData()}, {"dxdt", k.GetData()}}); return getJacobian(*res, inputs, "dxdt"); } -class MachEvolver::SystemOperator : public mfem::Operator +class MISOEvolver::SystemOperator : public mfem::Operator { public: /// Nonlinear operator of the form that combines the mass, res, stiff, @@ -45,7 +45,7 @@ class MachEvolver::SystemOperator : public mfem::Operator ParNonlinearForm *_nonlinear_mass, ParBilinearForm *_mass, ParNonlinearForm *_res, - MachLoad *_load) + MISOLoad *_load) : Operator(((_nonlinear_mass != nullptr) ? _nonlinear_mass->FESpace()->GetTrueVSize() : (_mass != nullptr) ? _mass->FESpace()->GetTrueVSize() @@ -113,7 +113,7 @@ class MachEvolver::SystemOperator : public mfem::Operator // } if (load != nullptr) { - mach::addLoad(*load, r); + miso::addLoad(*load, r); r.SetSubVector(ess_tdof_list, 0.0); } if (mass != nullptr) @@ -198,7 +198,7 @@ class MachEvolver::SystemOperator : public mfem::Operator ParBilinearForm *mass; ParNonlinearForm *res; // BilinearFormType *stiff; - MachLoad *load; + MISOLoad *load; // mfem::HypreParVector *load_tv; // mutable HypreParMatrix *jac; mutable OperatorHandle jac; @@ -212,12 +212,12 @@ class MachEvolver::SystemOperator : public mfem::Operator Array ess_tdof_list; }; -MachEvolver::MachEvolver(Array &ess_bdr, +MISOEvolver::MISOEvolver(Array &ess_bdr, NonlinearFormType *_nonlinear_mass, BilinearFormType *_mass, NonlinearFormType *_res, BilinearFormType *_stiff, - MachLoad *_load, + MISOLoad *_load, NonlinearFormType *_ent, std::ostream &outstream, double start_time, @@ -243,7 +243,7 @@ MachEvolver::MachEvolver(Array &ess_bdr, { if ((_mass != nullptr) && (_nonlinear_mass != nullptr)) { - throw MachException( + throw MISOException( "Cannot use a linear and nonlinear mass operator " "simultaneously"); } @@ -271,7 +271,7 @@ MachEvolver::MachEvolver(Array &ess_bdr, } else { - throw MachException("Unsupported assembly level for mass matrix!"); + throw MISOException("Unsupported assembly level for mass matrix!"); } mass_solver = CGSolver(_mass->ParFESpace()->GetComm()); mass_solver.SetPreconditioner(*mass_prec); @@ -302,7 +302,7 @@ MachEvolver::MachEvolver(Array &ess_bdr, } else { - throw MachException( + throw MISOException( "Unsupported assembly level" "for stiffness matrix!"); } @@ -311,13 +311,13 @@ MachEvolver::MachEvolver(Array &ess_bdr, new SystemOperator(ess_bdr, _nonlinear_mass, _mass, _res, _load)); } -MachEvolver::~MachEvolver() = default; +MISOEvolver::~MISOEvolver() = default; -void MachEvolver::Mult(const mfem::Vector &x, mfem::Vector &y) const +void MISOEvolver::Mult(const mfem::Vector &x, mfem::Vector &y) const { if (nonlinear_mass != nullptr) { - throw MachException("Cannot use MachEvolver::Mult with nonlinear mass"); + throw MISOException("Cannot use MISOEvolver::Mult with nonlinear mass"); } if (res != nullptr) @@ -340,7 +340,7 @@ void MachEvolver::Mult(const mfem::Vector &x, mfem::Vector &y) const y *= -1.0; } -void MachEvolver::ImplicitSolve(const double dt, const Vector &x, Vector &k) +void MISOEvolver::ImplicitSolve(const double dt, const Vector &x, Vector &k) { setOperParameters(dt, &x); Vector zero; // empty vector is interpreted as zero r.h.s. by NewtonSolver @@ -357,7 +357,7 @@ void MachEvolver::ImplicitSolve(const double dt, const Vector &x, Vector &k) } } -void MachEvolver::ImplicitSolve(const double dt_stage, +void MISOEvolver::ImplicitSolve(const double dt_stage, const double dt, const Vector &x, Vector &k) @@ -372,49 +372,49 @@ void MachEvolver::ImplicitSolve(const double dt_stage, } } -void MachEvolver::SetLinearSolver(Solver *_linsolver) +void MISOEvolver::SetLinearSolver(Solver *_linsolver) { linsolver = _linsolver; } -void MachEvolver::SetNewtonSolver(NewtonSolver *_newton) +void MISOEvolver::SetNewtonSolver(NewtonSolver *_newton) { newton = _newton; newton->SetOperator(*combined_oper); } -mfem::Operator &MachEvolver::GetGradient(const mfem::Vector &x) const +mfem::Operator &MISOEvolver::GetGradient(const mfem::Vector &x) const { return combined_oper->GetGradient(x); } -double MachEvolver::Entropy(const mfem::Vector &x) +double MISOEvolver::Entropy(const mfem::Vector &x) { if (ent == nullptr) { - throw MachException("MachEvolver::Entropy(): ent member not defined!"); + throw MISOException("MISOEvolver::Entropy(): ent member not defined!"); } return ent->GetEnergy(x); } -double MachEvolver::EntropyChange(double dt, +double MISOEvolver::EntropyChange(double dt, const mfem::Vector &x, const mfem::Vector &k) { /// even though it is not used here, ent should be defined if (ent == nullptr) { - throw MachException("MachEvolver::EntropyChange(): ent not defined!"); + throw MISOException("MISOEvolver::EntropyChange(): ent not defined!"); } add(x, dt, k, x_work); return res->GetEnergy(x_work); } -void MachEvolver::setOperParameters(double dt, +void MISOEvolver::setOperParameters(double dt, const mfem::Vector *x, double dt_stage) { combined_oper->setParameters(dt, x, dt_stage); } -} // namespace mach +} // namespace miso diff --git a/src/common/evolver.hpp b/src/common/evolver.hpp index 80f09316..41bcfe28 100644 --- a/src/common/evolver.hpp +++ b/src/common/evolver.hpp @@ -1,17 +1,17 @@ -#ifndef MACH_LINEAR_EVOLVER -#define MACH_LINEAR_EVOLVER +#ifndef MISO_LINEAR_EVOLVER +#define MISO_LINEAR_EVOLVER #include "adept.h" #include "mfem.hpp" #include "inexact_newton.hpp" -#include "mach_load.hpp" /// should be able to remove this eventually -#include "mach_residual.hpp" -#include "mach_types.hpp" +#include "miso_load.hpp" /// should be able to remove this eventually +#include "miso_residual.hpp" +#include "miso_types.hpp" -namespace mach +namespace miso { -/// Wraps a MachResidual so that it can be used by MFEM's Newton solver, e.g. +/// Wraps a MISOResidual so that it can be used by MFEM's Newton solver, e.g. /// \note This is the operator provided to Newton's method for the nonlinear /// equations that arise from implicit time-marching schemes class ODESystemOperator final : public mfem::Operator @@ -21,7 +21,7 @@ class ODESystemOperator final : public mfem::Operator /// \param[in] residual - defines the dynamics of the ODE /// \note The `evaluate` method for `residual` must compute the space-time /// residual when provided the inputs for the "state" and "dxdt". - ODESystemOperator(MachResidual &residual) + ODESystemOperator(MISOResidual &residual) : Operator(getSize(residual)), res(&residual), dt(0.0), @@ -53,7 +53,7 @@ class ODESystemOperator final : public mfem::Operator private: /// Defines the ODE, both the mass matrix and dynamics - MachResidual *res; + MISOResidual *res; /// Current time step size double dt; /// Pointer to the solution at the previous time step @@ -104,7 +104,7 @@ class EntropyConstrainedOperator : public mfem::TimeDependentOperator /// Class that can handle implicit or explicit time marching of linear or /// nonlinear ODEs -class MachEvolver : public EntropyConstrainedOperator +class MISOEvolver : public EntropyConstrainedOperator { public: /// Serves as an base class for linear/nonlinear explicit/implicit time @@ -120,12 +120,12 @@ class MachEvolver : public EntropyConstrainedOperator /// \param[in] start_time - time to start integration from /// (important for time-variant sources) /// \param[in] type - solver type; explicit or implicit - MachEvolver(mfem::Array &ess_bdr, + MISOEvolver(mfem::Array &ess_bdr, NonlinearFormType *nonlinear_mass, BilinearFormType *mass, NonlinearFormType *res, BilinearFormType *stiff, - MachLoad *load, + MISOLoad *load, NonlinearFormType *ent, std::ostream &outstream, double start_time, @@ -185,12 +185,12 @@ class MachEvolver : public EntropyConstrainedOperator const mfem::Vector &k) override; /// explicitly prohibit copy/move construction - MachEvolver(const MachEvolver &) = delete; - MachEvolver &operator=(const MachEvolver &) = delete; - MachEvolver(MachEvolver &&) = delete; - MachEvolver &operator=(MachEvolver &&) = delete; + MISOEvolver(const MISOEvolver &) = delete; + MISOEvolver &operator=(const MISOEvolver &) = delete; + MISOEvolver(MISOEvolver &&) = delete; + MISOEvolver &operator=(MISOEvolver &&) = delete; - ~MachEvolver() override; + ~MISOEvolver() override; protected: /// pointer to nonlinear mass bilinear form (not owned) @@ -202,7 +202,7 @@ class MachEvolver : public EntropyConstrainedOperator /// pointer to stiffness bilinear form (not owned) mfem::OperatorHandle stiff; /// pointer to load vector (not owned) - MachLoad *load; + MISOLoad *load; /// pointer to a form for computing the entropy (not owned) NonlinearFormType *ent; /// outstream for printing @@ -226,7 +226,7 @@ class MachEvolver : public EntropyConstrainedOperator /// pointer-to-implementation idiom /// Hides implementation details of this operator, and because it's private, - /// it doesn't pollute the mach namespace + /// it doesn't pollute the miso namespace class SystemOperator; /// Operator that combines the linear/nonlinear spatial discretization with /// the load vector into one operator used for implicit solves @@ -241,6 +241,6 @@ class MachEvolver : public EntropyConstrainedOperator double dt_stage = -1.0); }; -} // namespace mach +} // namespace miso #endif diff --git a/src/common/functional_output.cpp b/src/common/functional_output.cpp index b2a9a984..0866ce87 100644 --- a/src/common/functional_output.cpp +++ b/src/common/functional_output.cpp @@ -2,15 +2,15 @@ #include "mfem.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" #include "functional_output.hpp" using namespace mfem; -namespace mach +namespace miso { -void setInputs(FunctionalOutput &output, const MachInputs &inputs) +void setInputs(FunctionalOutput &output, const MISOInputs &inputs) { for (const auto &in : inputs) { @@ -36,7 +36,7 @@ void setOptions(FunctionalOutput &output, const nlohmann::json &options) setOptions(output.integs, options); } -double calcOutput(FunctionalOutput &output, const MachInputs &inputs) +double calcOutput(FunctionalOutput &output, const MISOInputs &inputs) { setInputs(output, inputs); @@ -46,14 +46,14 @@ double calcOutput(FunctionalOutput &output, const MachInputs &inputs) double calcOutputPartial(FunctionalOutput &output, const std::string &wrt, - const MachInputs &inputs) + const MISOInputs &inputs) { return NAN; } void calcOutputPartial(FunctionalOutput &output, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, HypreParVector &partial) { setInputs(output, inputs); @@ -74,4 +74,4 @@ void calcOutputPartial(FunctionalOutput &output, } } -} // namespace mach +} // namespace miso diff --git a/src/common/functional_output.hpp b/src/common/functional_output.hpp index 19ab16eb..b7f87b32 100644 --- a/src/common/functional_output.hpp +++ b/src/common/functional_output.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_FUNCTIONAL_OUTPUT -#define MACH_FUNCTIONAL_OUTPUT +#ifndef MISO_FUNCTIONAL_OUTPUT +#define MISO_FUNCTIONAL_OUTPUT #include #include @@ -9,70 +9,70 @@ #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" -namespace mach +namespace miso { class FunctionalOutput final { public: - friend void setInputs(FunctionalOutput &output, const MachInputs &inputs); + friend void setInputs(FunctionalOutput &output, const MISOInputs &inputs); friend void setOptions(FunctionalOutput &output, const nlohmann::json &options); - friend double calcOutput(FunctionalOutput &output, const MachInputs &inputs); + friend double calcOutput(FunctionalOutput &output, const MISOInputs &inputs); friend double calcOutputPartial(FunctionalOutput &output, const std::string &wrt, - const MachInputs &inputs); + const MISOInputs &inputs); friend void calcOutputPartial(FunctionalOutput &output, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial); /// Adds domain integrator to the nonlinear form that backs this output, - /// and adds a reference to it to in integs as a MachIntegrator + /// and adds a reference to it to in integs as a MISOIntegrator /// \param[in] integrator - integrator to add to functional - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addOutputDomainIntegrator(T *integrator); /// Adds domain integrator restricted to certain elements specified by the /// attributes listed in @a bdr_attr_marker to the nonlinear form that backs - /// this output, and adds a reference to it to in integs as a MachIntegrator + /// this output, and adds a reference to it to in integs as a MISOIntegrator /// \param[in] integrator - integrator to add to functional /// \param[in] bdr_attr_marker - lists element attributes this integrator /// should be used on - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addOutputDomainIntegrator(T *integrator, std::vector bdr_attr_marker); /// Adds interface integrator to the nonlinear form that backs this output, - /// and adds a reference to it to in integs as a MachIntegrator + /// and adds a reference to it to in integs as a MISOIntegrator /// \param[in] integrator - integrator to add to functional - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addOutputInteriorFaceIntegrator(T *integrator); /// Adds boundary integrator to the nonlinear form that backs this output, - /// and adds a reference to it to in integs as a MachIntegrator + /// and adds a reference to it to in integs as a MISOIntegrator /// \param[in] integrator - integrator to add to functional - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addOutputBdrFaceIntegrator(T *integrator); /// Adds boundary integrator restricted to certain boundaries specified by /// the attributes listed in @a bdr_attr_marker to the nonlinear form that /// backs this output, and adds a reference to it to in integs as a - /// MachIntegrator + /// MISOIntegrator /// \param[in] integrator - integrator to add to functional /// \param[in] bdr_attr_marker - lists boundary attributes this integrator /// should be used on - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addOutputBdrFaceIntegrator(T *integrator, std::vector bdr_attr_marker); @@ -90,7 +90,7 @@ class FunctionalOutput final std::unordered_map *func_fields; /// Collection of integrators to be applied. - std::vector integs; + std::vector integs; /// Collection of element attribute markers for domain integrators std::list> domain_markers; @@ -111,7 +111,7 @@ void FunctionalOutput::addOutputDomainIntegrator(T *integrator) { integs.emplace_back(*integrator); output.AddDomainIntegrator(integrator); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, *func_fields, output_sens, output_scalar_sens); } @@ -124,7 +124,7 @@ void FunctionalOutput::addOutputDomainIntegrator( auto &marker = domain_markers.emplace_back(bdr_attr_marker.size()); marker.Assign(bdr_attr_marker.data()); output.AddDomainIntegrator(integrator, marker); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, *func_fields, output_sens, output_scalar_sens); } @@ -133,7 +133,7 @@ void FunctionalOutput::addOutputInteriorFaceIntegrator(T *integrator) { integs.emplace_back(*integrator); output.AddInteriorFaceIntegrator(integrator); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, *func_fields, output_sens, output_scalar_sens); } @@ -142,7 +142,7 @@ void FunctionalOutput::addOutputBdrFaceIntegrator(T *integrator) { integs.emplace_back(*integrator); output.AddBdrFaceIntegrator(integrator); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, *func_fields, output_sens, output_scalar_sens); } @@ -155,10 +155,10 @@ void FunctionalOutput::addOutputBdrFaceIntegrator( auto &marker = bdr_markers.emplace_back(bdr_attr_marker.size()); marker.Assign(bdr_attr_marker.data()); output.AddBdrFaceIntegrator(integrator, marker); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, *func_fields, output_sens, output_scalar_sens); } -} // namespace mach +} // namespace miso #endif diff --git a/src/common/inexact_newton.cpp b/src/common/inexact_newton.cpp index dfea2ff6..0e3bdfd8 100644 --- a/src/common/inexact_newton.cpp +++ b/src/common/inexact_newton.cpp @@ -4,7 +4,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; namespace mfem { diff --git a/src/common/material_library.hpp b/src/common/material_library.hpp index f23946c3..c5e7b331 100644 --- a/src/common/material_library.hpp +++ b/src/common/material_library.hpp @@ -1,11 +1,11 @@ -#ifndef MACH_MATERIAL_LIBRARY -#define MACH_MATERIAL_LIBRARY +#ifndef MISO_MATERIAL_LIBRARY +#define MISO_MATERIAL_LIBRARY #include "nlohmann/json.hpp" -namespace mach +namespace miso { -/// Defines the material library for for mach +/// Defines the material library for for miso /// /// This is placed in a hpp file instead of a json file so that it can be /// compiled in and doesn't require a path to it. This also allows comments. @@ -343,6 +343,6 @@ nlohmann::json material_library{ {"sigma", 58.14e6}, {"max-temp", 400}}}}; -} // namespace mach +} // namespace miso #endif diff --git a/src/common/mfem_extensions.cpp b/src/common/mfem_extensions.cpp index c1983b24..1f595ce3 100644 --- a/src/common/mfem_extensions.cpp +++ b/src/common/mfem_extensions.cpp @@ -8,9 +8,9 @@ using namespace mfem; using namespace std; -using namespace mach; +using namespace miso; -namespace mach +namespace miso { void PseudoTransientSolver::Init(TimeDependentOperator &_f) { @@ -70,4 +70,4 @@ void RRKImplicitMidpointSolver::Step(Vector &x, double &t, double &dt) t += gamma * dt; } -} // namespace mach +} // namespace miso diff --git a/src/common/mfem_extensions.hpp b/src/common/mfem_extensions.hpp index 0567e44f..59b3c152 100644 --- a/src/common/mfem_extensions.hpp +++ b/src/common/mfem_extensions.hpp @@ -3,7 +3,7 @@ #include "mfem.hpp" -namespace mach +namespace miso { /// Backward Euler pseudo-transient continuation solver class PseudoTransientSolver : public mfem::ODESolver @@ -35,6 +35,6 @@ class RRKImplicitMidpointSolver : public mfem::ODESolver std::ostream *out; }; -} // namespace mach +} // namespace miso #endif diff --git a/src/common/mach_linearform.cpp b/src/common/miso_linearform.cpp similarity index 76% rename from src/common/mach_linearform.cpp rename to src/common/miso_linearform.cpp index 27410e8f..6f430804 100644 --- a/src/common/mach_linearform.cpp +++ b/src/common/miso_linearform.cpp @@ -2,13 +2,13 @@ #include "mfem.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" -#include "mach_linearform.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" +#include "miso_linearform.hpp" -namespace mach +namespace miso { -void setInputs(MachLinearForm &load, const MachInputs &inputs) +void setInputs(MISOLinearForm &load, const MISOInputs &inputs) { for (const auto &in : inputs) { @@ -29,26 +29,26 @@ void setInputs(MachLinearForm &load, const MachInputs &inputs) setInputs(load.integs, inputs); } -void setOptions(MachLinearForm &load, const nlohmann::json &options) +void setOptions(MISOLinearForm &load, const nlohmann::json &options) { setOptions(load.integs, options); } -void addLoad(MachLinearForm &load, mfem::Vector &tv) +void addLoad(MISOLinearForm &load, mfem::Vector &tv) { load.lf.Assemble(); load.lf.ParallelAssemble(load.scratch); add(tv, load.scratch, tv); } -double vectorJacobianProduct(MachLinearForm &load, +double vectorJacobianProduct(MISOLinearForm &load, const mfem::HypreParVector &load_bar, const std::string &wrt) { if (load.scalar_sens.count(wrt) != 0) { throw std::logic_error( - "vectorJacobianProduct not implemented for MachLinearForm!\n"); + "vectorJacobianProduct not implemented for MISOLinearForm!\n"); // auto &adjoint = load.lf_fields->at("adjoint"); // adjoint = load_bar; // return load.scalar_sens.at(wrt).GetEnergy(); @@ -59,7 +59,7 @@ double vectorJacobianProduct(MachLinearForm &load, } } -void vectorJacobianProduct(MachLinearForm &load, +void vectorJacobianProduct(MISOLinearForm &load, const mfem::HypreParVector &load_bar, const std::string &wrt, mfem::HypreParVector &wrt_bar) @@ -74,4 +74,4 @@ void vectorJacobianProduct(MachLinearForm &load, } } -} // namespace mach +} // namespace miso diff --git a/src/common/mach_linearform.hpp b/src/common/miso_linearform.hpp similarity index 73% rename from src/common/mach_linearform.hpp rename to src/common/miso_linearform.hpp index 6f5b8155..d6c2b80c 100644 --- a/src/common/mach_linearform.hpp +++ b/src/common/miso_linearform.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_LINEAR_FORM -#define MACH_LINEAR_FORM +#ifndef MISO_LINEAR_FORM +#define MISO_LINEAR_FORM #include #include @@ -8,44 +8,44 @@ #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" -namespace mach +namespace miso { -class MachLinearForm final +class MISOLinearForm final { public: /// Assemble the linear form on the true dofs and add it to tv - friend void addLoad(MachLinearForm &load, mfem::Vector &tv); + friend void addLoad(MISOLinearForm &load, mfem::Vector &tv); /// Set inputs in all integrators used by the linear form - friend void setInputs(MachLinearForm &load, const MachInputs &inputs); + friend void setInputs(MISOLinearForm &load, const MISOInputs &inputs); /// Set options in all integrators used by the linear form - friend void setOptions(MachLinearForm &load, const nlohmann::json &options); + friend void setOptions(MISOLinearForm &load, const nlohmann::json &options); /// Assemble the linear form's sensitivity to a scalar and contract it with /// load_bar - friend double vectorJacobianProduct(MachLinearForm &load, + friend double vectorJacobianProduct(MISOLinearForm &load, const mfem::HypreParVector &load_bar, const std::string &wrt); - friend void vectorJacobianProduct(MachLinearForm &load, + friend void vectorJacobianProduct(MISOLinearForm &load, const mfem::HypreParVector &load_bar, const std::string &wrt, mfem::HypreParVector &wrt_bar); /// Adds domain integrator to linear form /// \param[in] integrator - linear form integrator for domain - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator template void addDomainIntegrator(T *integrator); /// Adds boundary integrator to linear form /// \param[in] integrator - linear form integrator for boundary - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator template void addBoundaryIntegrator(T *integrator); @@ -54,7 +54,7 @@ class MachLinearForm final /// attributes. /// \param[in] integrator - linear form integrator for boundary /// \param[in] bdr_attr_marker - boundary attributes for integrator - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator /// \note The array bdr_attr_marker is copied template @@ -62,7 +62,7 @@ class MachLinearForm final /// Adds boundary face integrator to linear form /// \param[in] integrator - face linear form integrator for boundary - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator template void addBdrFaceIntegrator(T *integrator); @@ -71,13 +71,13 @@ class MachLinearForm final /// boundary attributes. /// \param[in] integrator - face linear form integrator for boundary /// \param[in] bdr_attr_marker - boundary attributes for integrator - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator /// \note The array bdr_attr_marker is copied template void addBdrFaceIntegrator(T *integrator, mfem::Array &bdr_attr_marker); - MachLinearForm( + MISOLinearForm( mfem::ParFiniteElementSpace &pfes, std::unordered_map &fields) : lf(&pfes), scratch(&pfes), lf_fields(&fields) @@ -95,7 +95,7 @@ class MachLinearForm final mfem::HypreParVector scratch; /// Collection of integrators to be applied. - std::vector integs; + std::vector integs; /// Collection of boundary markers for boundary integrators std::vector> bdr_marker; @@ -111,49 +111,49 @@ class MachLinearForm final }; template -void MachLinearForm::addDomainIntegrator(T *integrator) +void MISOLinearForm::addDomainIntegrator(T *integrator) { integs.emplace_back(*integrator); lf.AddDomainIntegrator(integrator); - mach::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); + miso::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); } template -void MachLinearForm::addBoundaryIntegrator(T *integrator) +void MISOLinearForm::addBoundaryIntegrator(T *integrator) { integs.emplace_back(*integrator); lf.AddBoundaryIntegrator(integrator); - mach::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); + miso::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); } template -void MachLinearForm::addBoundaryIntegrator(T *integrator, +void MISOLinearForm::addBoundaryIntegrator(T *integrator, mfem::Array &bdr_attr_marker) { integs.emplace_back(*integrator); bdr_marker.emplace_back(bdr_attr_marker); lf.AddBoundaryIntegrator(integrator, bdr_marker.back()); - mach::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); + miso::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); } template -void MachLinearForm::addBdrFaceIntegrator(T *integrator) +void MISOLinearForm::addBdrFaceIntegrator(T *integrator) { integs.emplace_back(*integrator); lf.AddBdrFaceIntegrator(integrator); - mach::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); + miso::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); } template -void MachLinearForm::addBdrFaceIntegrator(T *integrator, +void MISOLinearForm::addBdrFaceIntegrator(T *integrator, mfem::Array &bdr_attr_marker) { integs.emplace_back(*integrator); bdr_marker.emplace_back(bdr_attr_marker); lf.AddBdrFaceIntegrator(integrator, bdr_marker.back()); - mach::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); + miso::addSensitivityIntegrator(*integrator, *lf_fields, sens, scalar_sens); } -} // namespace mach +} // namespace miso #endif diff --git a/src/common/mach_output.hpp b/src/common/miso_output.hpp similarity index 58% rename from src/common/mach_output.hpp rename to src/common/miso_output.hpp index 208fab20..4cc14c74 100644 --- a/src/common/mach_output.hpp +++ b/src/common/miso_output.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_OUTPUT -#define MACH_OUTPUT +#ifndef MISO_OUTPUT +#define MISO_OUTPUT #include #include @@ -10,37 +10,37 @@ #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" -namespace mach +namespace miso { -/// Creates common interface for outputs computable by mach -/// A MachOutput can wrap any type `T` that has the interface of an output. -class MachOutput final +/// Creates common interface for outputs computable by miso +/// A MISOOutput can wrap any type `T` that has the interface of an output. +class MISOOutput final { public: /// Used to set inputs in the underlying output type - friend void setInputs(MachOutput &output, const MachInputs &inputs); + friend void setInputs(MISOOutput &output, const MISOInputs &inputs); /// Used to set options for the underlying output type - friend void setOptions(MachOutput &output, const nlohmann::json &options); + friend void setOptions(MISOOutput &output, const nlohmann::json &options); /// Compute the scalar output based on the inputs - friend double calcOutput(MachOutput &output, const MachInputs &inputs); + friend double calcOutput(MISOOutput &output, const MISOInputs &inputs); /// Compute the output's sensitivity to a scalar - friend double calcOutputPartial(MachOutput &output, + friend double calcOutputPartial(MISOOutput &output, const std::string &wrt, - const MachInputs &inputs); + const MISOInputs &inputs); /// Compute the output's sensitivity to a field and store in @a partial - friend void calcOutputPartial(MachOutput &output, + friend void calcOutputPartial(MISOOutput &output, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial); template - MachOutput(T x) : self_(new model(std::move(x))) + MISOOutput(T x) : self_(new model(std::move(x))) { } private: @@ -48,13 +48,13 @@ class MachOutput final { public: virtual ~concept_t() = default; - virtual void setInputs_(const MachInputs &inputs) = 0; + virtual void setInputs_(const MISOInputs &inputs) = 0; virtual void setOptions_(const nlohmann::json &options) = 0; - virtual double calcOutput_(const MachInputs &inputs) = 0; + virtual double calcOutput_(const MISOInputs &inputs) = 0; virtual double calcOutputPartial_(const std::string &wrt, - const MachInputs &inputs) = 0; + const MISOInputs &inputs) = 0; virtual void calcOutputPartial_(const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial) = 0; }; @@ -63,7 +63,7 @@ class MachOutput final { public: model(T x) : data_(std::move(x)) { } - void setInputs_(const MachInputs &inputs) override + void setInputs_(const MISOInputs &inputs) override { setInputs(data_, inputs); } @@ -71,17 +71,17 @@ class MachOutput final { setOptions(data_, options); } - double calcOutput_(const MachInputs &inputs) override + double calcOutput_(const MISOInputs &inputs) override { return calcOutput(data_, inputs); } double calcOutputPartial_(const std::string &wrt, - const MachInputs &inputs) override + const MISOInputs &inputs) override { return calcOutputPartial(data_, wrt, inputs); } void calcOutputPartial_(const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial) override { calcOutputPartial(data_, wrt, inputs, partial); @@ -93,36 +93,36 @@ class MachOutput final std::unique_ptr self_; }; -inline void setInputs(MachOutput &output, const MachInputs &inputs) +inline void setInputs(MISOOutput &output, const MISOInputs &inputs) { output.self_->setInputs_(inputs); } -inline void setOptions(MachOutput &output, const nlohmann::json &options) +inline void setOptions(MISOOutput &output, const nlohmann::json &options) { output.self_->setOptions_(options); } -inline double calcOutput(MachOutput &output, const MachInputs &inputs) +inline double calcOutput(MISOOutput &output, const MISOInputs &inputs) { return output.self_->calcOutput_(inputs); } -inline double calcOutputPartial(MachOutput &output, +inline double calcOutputPartial(MISOOutput &output, const std::string &wrt, - const MachInputs &inputs) + const MISOInputs &inputs) { return output.self_->calcOutputPartial_(wrt, inputs); } -inline void calcOutputPartial(MachOutput &output, +inline void calcOutputPartial(MISOOutput &output, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial) { output.self_->calcOutputPartial_(wrt, inputs, partial); } -} // namespace mach +} // namespace miso #endif diff --git a/src/common/mach_residual.hpp b/src/common/miso_residual.hpp similarity index 70% rename from src/common/mach_residual.hpp rename to src/common/miso_residual.hpp index 6d8d5a00..5c04b156 100644 --- a/src/common/mach_residual.hpp +++ b/src/common/miso_residual.hpp @@ -1,17 +1,17 @@ -#ifndef MACH_RESIDUAL -#define MACH_RESIDUAL +#ifndef MISO_RESIDUAL +#define MISO_RESIDUAL #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" -namespace mach +namespace miso { -/// Defines a common interface for residual functions used by mach. -/// A MachResidual can wrap any type `T` that has the interface of a residual -/// function. For example, one instance of `T` is given by `MachNonlinearForm`, -/// so that every nonlinear form can be wrapped by a MachResidual. +/// Defines a common interface for residual functions used by miso. +/// A MISOResidual can wrap any type `T` that has the interface of a residual +/// function. For example, one instance of `T` is given by `MISONonlinearForm`, +/// so that every nonlinear form can be wrapped by a MISOResidual. /// \note We use this approach to achieve polymorphism without inheritance. /// This is important because we need to derive from `mfem` classes frequently, /// but at the same time we need to build on their classes' functionality. @@ -19,34 +19,34 @@ namespace mach /// we have pointers to base classes. /// \note This approach is based on the example in Sean Parent's talk: /// ``Inheritance is the base class of evil'' -class MachResidual final +class MISOResidual final { public: /// Gets the number of equations/unknowns of the underlying residual type /// \param[inout] residual - the residual whose size is being queried /// \returns the number of equations/unknowns /// \note Needed, e.g., by the ODESystemOperator constructor (see evolver.*) - friend int getSize(const MachResidual &residual); + friend int getSize(const MISOResidual &residual); /// Set inputs in the underlying residual type /// \param[inout] residual - the residual being assigned the input /// \param[in] inputs - the inputs that are being assigned - /// \note Ends up calling `setInputs` on either the `MachNonlinearForm` or + /// \note Ends up calling `setInputs` on either the `MISONonlinearForm` or /// a specialized version for each particular residual. - friend void setInputs(MachResidual &residual, const MachInputs &inputs); + friend void setInputs(MISOResidual &residual, const MISOInputs &inputs); /// Set options in the underlying residual type /// \param[inout] residual - the residual whose options are being set /// \param[in] options - the options that are being assigned - friend void setOptions(MachResidual &residual, + friend void setOptions(MISOResidual &residual, const nlohmann::json &options); /// Evaluate the residual function at given inputs and return as `res_vec` /// \param[inout] residual - the residual being evaluated /// \param[in] inputs - the independent variables at which to evaluate `res` /// \param[out] res_vec - the dependent variable, the output from `residual` - friend void evaluate(MachResidual &residual, - const MachInputs &inputs, + friend void evaluate(MISOResidual &residual, + const MISOInputs &inputs, mfem::Vector &res_vec); /// Compute the Jacobian of the given residual and return a reference to it @@ -55,16 +55,16 @@ class MachResidual final /// \param[in] wrt - the input we are differentiating with respect to /// \returns a reference to the residuals Jacobian with respect to `wrt` /// \note the underlying `Operator` is owned by `residual` - friend mfem::Operator &getJacobian(MachResidual &residual, - const MachInputs &inputs, + friend mfem::Operator &getJacobian(MISOResidual &residual, + const MISOInputs &inputs, std::string wrt); // TODO: we will eventual want to add functions for Jacobian products // The following constructors, assignment operators, and destructors allow - // the `MachResidual` to wrap the generic type `T`. + // the `MISOResidual` to wrap the generic type `T`. template - MachResidual(T x) : self_(new model(std::move(x))) + MISOResidual(T x) : self_(new model(std::move(x))) { } private: @@ -74,10 +74,10 @@ class MachResidual final public: virtual ~concept_t() = default; virtual int getSize_() const = 0; - virtual void setInputs_(const MachInputs &inputs) = 0; + virtual void setInputs_(const MISOInputs &inputs) = 0; virtual void setOptions_(const nlohmann::json &options) = 0; - virtual void eval_(const MachInputs &inputs, mfem::Vector &res_vec) = 0; - virtual mfem::Operator &getJac_(const MachInputs &inputs, + virtual void eval_(const MISOInputs &inputs, mfem::Vector &res_vec) = 0; + virtual mfem::Operator &getJac_(const MISOInputs &inputs, std::string wrt) = 0; }; @@ -89,7 +89,7 @@ class MachResidual final public: model(T x) : data_(std::move(x)) { } int getSize_() const override { return getSize(data_); } - void setInputs_(const MachInputs &inputs) override + void setInputs_(const MISOInputs &inputs) override { setInputs(data_, inputs); } @@ -97,11 +97,11 @@ class MachResidual final { setOptions(data_, options); } - void eval_(const MachInputs &inputs, mfem::Vector &res_vec) override + void eval_(const MISOInputs &inputs, mfem::Vector &res_vec) override { evaluate(data_, inputs, res_vec); } - mfem::Operator &getJac_(const MachInputs &inputs, + mfem::Operator &getJac_(const MISOInputs &inputs, std::string wrt) override { return getJacobian(data_, inputs, std::move(wrt)); @@ -114,27 +114,27 @@ class MachResidual final std::unique_ptr self_; }; -inline int getSize(const MachResidual &residual) +inline int getSize(const MISOResidual &residual) { return residual.self_->getSize_(); } -inline void setInputs(MachResidual &residual, const MachInputs &inputs) +inline void setInputs(MISOResidual &residual, const MISOInputs &inputs) { // passes `inputs` on to the `setInputs` function for the concrete // residual type residual.self_->setInputs_(inputs); } -inline void setOptions(MachResidual &residual, const nlohmann::json &options) +inline void setOptions(MISOResidual &residual, const nlohmann::json &options) { // passes `options` on to the `setOptions` function for the concrete // residual type residual.self_->setOptions_(options); } -inline void evaluate(MachResidual &residual, - const MachInputs &inputs, +inline void evaluate(MISOResidual &residual, + const MISOInputs &inputs, mfem::Vector &res_vec) { // passes `inputs` and `res_vec` on to the `evaluate` function for the @@ -142,8 +142,8 @@ inline void evaluate(MachResidual &residual, residual.self_->eval_(inputs, res_vec); } -inline mfem::Operator &getJacobian(MachResidual &residual, - const MachInputs &inputs, +inline mfem::Operator &getJacobian(MISOResidual &residual, + const MISOInputs &inputs, std::string wrt) { // passes `inputs` and `res_vec` on to the `getJacobian` function for the @@ -151,6 +151,6 @@ inline mfem::Operator &getJacobian(MachResidual &residual, return residual.self_->getJac_(inputs, std::move(wrt)); } -} // namespace mach +} // namespace miso -#endif // MACH_RESIDUAL +#endif // MISO_RESIDUAL diff --git a/src/common/orthopoly.cpp b/src/common/orthopoly.cpp index b2fb7e0c..3592db6c 100644 --- a/src/common/orthopoly.cpp +++ b/src/common/orthopoly.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace mfem; -namespace mach +namespace miso { void getLobattoQuadrature(const int num_nodes, Vector &x, Vector &w) { @@ -146,7 +146,7 @@ void getVandermondeForSeg(const Vector &x, const int degree, DenseMatrix &V) for (int r = 0; r <= degree; ++r) { V.GetColumnReference(ptr, poly); - mach::jacobiPoly(x, 0.0, 0.0, r, poly); + miso::jacobiPoly(x, 0.0, 0.0, r, poly); ptr += 1; } } @@ -167,10 +167,10 @@ void getVandermondeForTri(const Vector &x, for (int j = 0; j <= r; ++j) { V.GetColumnReference(ptr, poly); - mach::prorioPoly(x, y, r - j, j, poly); + miso::prorioPoly(x, y, r - j, j, poly); ptr += 1; } } } -} // namespace mach +} // namespace miso diff --git a/src/common/orthopoly.hpp b/src/common/orthopoly.hpp index 8da84c51..083684fc 100644 --- a/src/common/orthopoly.hpp +++ b/src/common/orthopoly.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_ORTHOPOLY -#define MACH_ORTHOPOLY +#ifndef MISO_ORTHOPOLY +#define MISO_ORTHOPOLY #include "mfem.hpp" -namespace mach +namespace miso { /// computes the LGL quadrature nodes and weights on the interval [-1,1] /// \param[in] num_nodes - the number of nodes (degree+1) @@ -64,6 +64,6 @@ void getVandermondeForTri(const mfem::Vector &x, int degree, mfem::DenseMatrix &V); -} // namespace mach +} // namespace miso #endif diff --git a/src/common/sbp_fe.cpp b/src/common/sbp_fe.cpp index f2ce7c1a..f40e1a61 100644 --- a/src/common/sbp_fe.cpp +++ b/src/common/sbp_fe.cpp @@ -333,7 +333,7 @@ int SBPFiniteElement::getIntegrationPointIndex(const IntegrationPoint &ip) const return i; } } - throw mach::MachException( + throw miso::MISOException( "SBPFiniteElement::getIntegrationPointIndex(ip)\n" "\tprovided ip is not a node of given element!"); } @@ -348,7 +348,7 @@ SBPSegmentElement::SBPSegmentElement(const int degree) Q[0].SetSize(num_nodes); Vector pts(num_nodes); Vector wts(num_nodes); - mach::getLobattoQuadrature(degree + 2, pts, wts); + miso::getLobattoQuadrature(degree + 2, pts, wts); // shift nodes to [0,1] and scale quadrature for (int i = 0; i < num_nodes; ++i) { @@ -418,7 +418,7 @@ SBPSegmentElement::SBPSegmentElement(const int degree) getNodeCoords(0, xi); xi *= 2.0; xi -= 1.0; - mach::getVandermondeForSeg(xi, order, V); + miso::getVandermondeForSeg(xi, order, V); // scale V to account for the different reference elements V *= sqrt(2.0); } @@ -452,7 +452,7 @@ void SBPSegmentElement::CalcShape(const IntegrationPoint &ip, shape = 0.0; for (int i = 0; i <= order; ++i) { - mach::jacobiPoly(xvec, 0.0, 0.0, i, poly); + miso::jacobiPoly(xvec, 0.0, 0.0, i, poly); poly *= 2.0; // scale to mfem reference element for (int k = 0; k < GetDof(); ++k) { @@ -831,7 +831,7 @@ SBPTriangleElement::SBPTriangleElement(const int degree, const int num_nodes) xi -= 1.0; eta *= 2.0; eta -= 1.0; - mach::getVandermondeForTri(xi, eta, order, V); + miso::getVandermondeForTri(xi, eta, order, V); // scale V to account for the different reference elements V *= 2.0; } @@ -869,7 +869,7 @@ void SBPTriangleElement::CalcShape(const IntegrationPoint &ip, { for (int j = 0; j <= r; ++j) { - mach::prorioPoly(xvec, yvec, r - j, j, poly); + miso::prorioPoly(xvec, yvec, r - j, j, poly); poly *= 2.0; // scale to mfem reference element for (int k = 0; k < GetDof(); ++k) { diff --git a/src/common/surface.hpp b/src/common/surface.hpp index 907ced84..1995e715 100644 --- a/src/common/surface.hpp +++ b/src/common/surface.hpp @@ -1,12 +1,12 @@ -#ifndef MACH_SURFACE -#define MACH_SURFACE +#ifndef MISO_SURFACE +#define MISO_SURFACE #include "mfem.hpp" #include "kdtree.hpp" #include "utils.hpp" -namespace mach +namespace miso { /// A geometry representation for distance calculations /// \tparam dim - number of spatial dimensions (only `dim=2` is tested) @@ -87,11 +87,11 @@ class Surface double solveConstrained() { - throw MachException("solveConstrained is not implemented yet!"); + throw MISOException("solveConstrained is not implemented yet!"); } }; -} // namespace mach +} // namespace miso #include "surface_def.hpp" diff --git a/src/common/surface_def.hpp b/src/common/surface_def.hpp index 23a1242b..0d327355 100644 --- a/src/common/surface_def.hpp +++ b/src/common/surface_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_SURFACE_DEF -#define MACH_SURFACE_DEF +#ifndef MISO_SURFACE_DEF +#define MISO_SURFACE_DEF #include "mfem.hpp" @@ -7,7 +7,7 @@ #include "utils.hpp" #include "surface.hpp" -namespace mach +namespace miso { template Surface::Surface(mfem::Mesh &ext_mesh) @@ -15,7 +15,7 @@ Surface::Surface(mfem::Mesh &ext_mesh) using namespace mfem; if (dim != 2) { - throw MachException("Surface class not tested for dim != 2."); + throw MISOException("Surface class not tested for dim != 2."); } // check that this is a valid surface mesh, in terms of dimensions MFEM_ASSERT(dim == ext_mesh.Dimension() + 1, "Invalid surface mesh."); @@ -31,7 +31,7 @@ Surface::Surface(mfem::Mesh &vol_mesh, mfem::Array &bdr_attr_marker) using namespace mfem; if (dim != 2) { - throw MachException("Surface class not tested for dim != 2."); + throw MISOException("Surface class not tested for dim != 2."); } // check that this is a valid volume mesh, in terms of dimensions MFEM_ASSERT(dim == vol_mesh.Dimension(), "Invalid volume mesh."); @@ -155,7 +155,7 @@ Surface::Surface(mfem::Mesh &vol_mesh, mfem::Array &bdr_attr_marker) } else { - throw MachException("Discontinuous nodes not yet supported"); + throw MISOException("Discontinuous nodes not yet supported"); } } // build out the kd-tree data structure @@ -168,7 +168,7 @@ void Surface::buildKDTree() using namespace mfem; if (mesh == nullptr) { - throw MachException("Cannot call buildKDTree with empty mesh."); + throw MISOException("Cannot call buildKDTree with empty mesh."); } mesh->EnsureNodes(); mesh->GetNodes()->FESpace()->BuildDofToArrays(); @@ -275,7 +275,7 @@ double Surface::solveDistance(mfem::ElementTransformation &trans, bool success = LinearSolve(Hess, step.GetData()); if (!success) { - throw MachException("LinearSolve failed in Surface::solveDistance!"); + throw MISOException("LinearSolve failed in Surface::solveDistance!"); } // check that this is a descent direction; if not, use scaled negative @@ -320,9 +320,9 @@ double Surface::solveDistance(mfem::ElementTransformation &trans, Jac.MultTranspose(res, gradient); } // If we get here, we exceeded the maximum number of Newton iterations - throw MachException("Newton solve failed in Surface::solveDistance!"); + throw MISOException("Newton solve failed in Surface::solveDistance!"); } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/CMakeLists.txt b/src/physics/CMakeLists.txt index 4c0f7544..05e35890 100644 --- a/src/physics/CMakeLists.txt +++ b/src/physics/CMakeLists.txt @@ -1,14 +1,14 @@ -target_sources(mach +target_sources(miso PRIVATE diag_mass_integ.cpp diag_mass_integ.hpp - mach_input.cpp - mach_input.hpp - mach_integrator.cpp - mach_integrator.hpp - mach_load.hpp - mach_nonlinearform.cpp - mach_nonlinearform.hpp + miso_input.cpp + miso_input.hpp + miso_integrator.cpp + miso_integrator.hpp + miso_load.hpp + miso_nonlinearform.cpp + miso_nonlinearform.hpp #mass_operator.cpp #mass_operator.hpp mfem_common_integ.cpp @@ -18,7 +18,7 @@ target_sources(mach solver.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/physics/diag_mass_integ.cpp b/src/physics/diag_mass_integ.cpp index a29dc541..f9ddefb0 100644 --- a/src/physics/diag_mass_integ.cpp +++ b/src/physics/diag_mass_integ.cpp @@ -3,7 +3,7 @@ using namespace mfem; using namespace std; -namespace mach +namespace miso { void DiagMassIntegrator::AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, @@ -36,4 +36,4 @@ void DiagMassIntegrator::AssembleElementMatrix(const FiniteElement &el, } } -} // namespace mach \ No newline at end of file +} // namespace miso \ No newline at end of file diff --git a/src/physics/diag_mass_integ.hpp b/src/physics/diag_mass_integ.hpp index 63eb1840..fa9b4664 100644 --- a/src/physics/diag_mass_integ.hpp +++ b/src/physics/diag_mass_integ.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_DIAG_MASS_INTEG -#define MACH_DIAG_MASS_INTEG +#ifndef MISO_DIAG_MASS_INTEG +#define MISO_DIAG_MASS_INTEG #include "mfem.hpp" -namespace mach +namespace miso { /// Integrator for diagonal mass matrices that arise in SBP discretizations class DiagMassIntegrator : public mfem::BilinearFormIntegrator @@ -31,6 +31,6 @@ class DiagMassIntegrator : public mfem::BilinearFormIntegrator bool space_vary_dt; }; -} // namespace mach +} // namespace miso #endif \ No newline at end of file diff --git a/src/physics/electromagnetics/CMakeLists.txt b/src/physics/electromagnetics/CMakeLists.txt index 2f5d3dee..4ae967a3 100644 --- a/src/physics/electromagnetics/CMakeLists.txt +++ b/src/physics/electromagnetics/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(mach +target_sources(miso PRIVATE current_load.cpp current_load.hpp @@ -12,7 +12,7 @@ target_sources(mach magnetostatic.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/physics/electromagnetics/current_load.cpp b/src/physics/electromagnetics/current_load.cpp index 301c22f4..9017edd7 100644 --- a/src/physics/electromagnetics/current_load.cpp +++ b/src/physics/electromagnetics/current_load.cpp @@ -3,16 +3,16 @@ #include "mfem.hpp" #include "coefficient.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" #include "mfem_common_integ.hpp" #include "current_load.hpp" using namespace mfem; -namespace mach +namespace miso { /// set inputs should include fields, so things can check if they're "dirty" -void setInputs(CurrentLoad &load, const MachInputs &inputs) +void setInputs(CurrentLoad &load, const MISOInputs &inputs) { setInputs(load.div_free_proj, inputs); @@ -223,4 +223,4 @@ void CurrentLoad::assembleLoad() scratch.ParallelAssemble(load); } -} // namespace mach +} // namespace miso diff --git a/src/physics/electromagnetics/current_load.hpp b/src/physics/electromagnetics/current_load.hpp index f2677087..9bf245e5 100644 --- a/src/physics/electromagnetics/current_load.hpp +++ b/src/physics/electromagnetics/current_load.hpp @@ -1,13 +1,13 @@ -#ifndef MACH_CURRENT_LOAD -#define MACH_CURRENT_LOAD +#ifndef MISO_CURRENT_LOAD +#define MISO_CURRENT_LOAD #include "mfem.hpp" #include "nlohmann/json.hpp" #include "div_free_projector.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" -namespace mach +namespace miso { class VectorFEMassIntegratorMeshSens; class VectorFEDomainLFIntegratorMeshSens; @@ -16,9 +16,9 @@ class CurrentLoad final { public: /// Used to set scalar inputs in the underlying load type - /// Ends up calling `setInputs` on either the `MachLinearForm` or + /// Ends up calling `setInputs` on either the `MISOLinearForm` or /// a specialized version for each particular load. - friend void setInputs(CurrentLoad &load, const MachInputs &inputs); + friend void setInputs(CurrentLoad &load, const MISOInputs &inputs); friend void setOptions(CurrentLoad &load, const nlohmann::json &options); @@ -70,6 +70,6 @@ class CurrentLoad final void assembleLoad(); }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/electromagnetics/electromag_integ.cpp b/src/physics/electromagnetics/electromag_integ.cpp index 08fda5ed..319aa79c 100644 --- a/src/physics/electromagnetics/electromag_integ.cpp +++ b/src/physics/electromagnetics/electromag_integ.cpp @@ -3,7 +3,7 @@ using namespace mfem; -namespace mach +namespace miso { double calcMagneticEnergy(ElementTransformation &trans, const IntegrationPoint &ip, @@ -266,7 +266,7 @@ void CurlCurlNLFIntegrator::AssembleElementGrad( // { // if (!isfinite(elmat(i,j))) // { - // throw MachException("nan!"); + // throw MISOException("nan!"); // } // } // catch(const std::exception& e) @@ -2584,7 +2584,7 @@ void ThermalSensIntegrator::AssembleRHSElementVect( } } -void setInputs(DCLossFunctionalIntegrator &integ, const MachInputs &inputs) +void setInputs(DCLossFunctionalIntegrator &integ, const MISOInputs &inputs) { auto it = inputs.find("current_density"); if (it != inputs.end()) @@ -2652,7 +2652,7 @@ double DCLossFunctionalIntegrator::GetElementEnergy( } void setInputs(HybridACLossFunctionalIntegrator &integ, - const MachInputs &inputs) + const MISOInputs &inputs) { auto it = inputs.find("diam"); if (it != inputs.end()) @@ -3391,4 +3391,4 @@ void ForceIntegratorMeshSens::AssembleRHSElementVect( } } -} // namespace mach +} // namespace miso diff --git a/src/physics/electromagnetics/electromag_integ.hpp b/src/physics/electromagnetics/electromag_integ.hpp index f8ef2f41..caf40450 100644 --- a/src/physics/electromagnetics/electromag_integ.hpp +++ b/src/physics/electromagnetics/electromag_integ.hpp @@ -1,15 +1,15 @@ -#ifndef MACH_ELECTROMAG_INTEG -#define MACH_ELECTROMAG_INTEG +#ifndef MISO_ELECTROMAG_INTEG +#define MISO_ELECTROMAG_INTEG #include #include "mfem.hpp" -#include "mach_types.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" +#include "miso_types.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" -namespace mach +namespace miso { class AbstractSolver; class StateCoefficient; @@ -563,7 +563,7 @@ space friend void setInput(MagneticCoenergyIntegrator &integ, const std::string &name, - const MachInput &input); + const MISOInput &input); private: /// the current state to use when evaluating \frac{\partial J}{\partial X} @@ -596,7 +596,7 @@ space inline void setInput(MagneticCoenergyIntegrator &integ, const std::string &name, - const MachInput &input) + const MISOInput &input) { // do nothing yet } @@ -823,7 +823,7 @@ class DCLossFunctionalIntegrator : public mfem::NonlinearFormIntegrator /// \brief allows changing the frequency and diameter of the strands for AC /// loss calculation friend void setInputs(DCLossFunctionalIntegrator &integ, - const MachInputs &inputs); + const MISOInputs &inputs); /// \brief - Compute DC copper losses in the domain /// \param[in] sigma - the electrical conductivity coefficient @@ -860,7 +860,7 @@ class HybridACLossFunctionalIntegrator : public mfem::NonlinearFormIntegrator /// \brief allows changing the frequency and diameter of the strands for AC /// loss calculation friend void setInputs(HybridACLossFunctionalIntegrator &integ, - const MachInputs &inputs); + const MISOInputs &inputs); /// \brief - Compute AC copper losses in the domain based on a hybrid /// analytical-FEM approach @@ -1003,6 +1003,6 @@ inline void addSensitivityIntegrator( new ForceIntegratorMeshSens(res_fields.at("state"), primal_integ)); } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/electromagnetics/electromag_outputs.hpp b/src/physics/electromagnetics/electromag_outputs.hpp index 8135b512..47d71dcd 100644 --- a/src/physics/electromagnetics/electromag_outputs.hpp +++ b/src/physics/electromagnetics/electromag_outputs.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_ELECTROMAG_OUTPUT -#define MACH_ELECTROMAG_OUTPUT +#ifndef MISO_ELECTROMAG_OUTPUT +#define MISO_ELECTROMAG_OUTPUT #include #include @@ -9,15 +9,15 @@ #include "electromag_integ.hpp" #include "functional_output.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" -namespace mach +namespace miso { class ForceFunctional final { public: friend inline void setInputs(ForceFunctional &output, - const MachInputs &inputs) + const MISOInputs &inputs) { setInputs(output.output, inputs); } @@ -26,21 +26,21 @@ class ForceFunctional final const nlohmann::json &options); friend inline double calcOutput(ForceFunctional &output, - const MachInputs &inputs) + const MISOInputs &inputs) { return calcOutput(output.output, inputs); } friend inline double calcOutputPartial(ForceFunctional &output, const std::string &wrt, - const MachInputs &inputs) + const MISOInputs &inputs) { return calcOutputPartial(output.output, wrt, inputs); } friend inline void calcOutputPartial(ForceFunctional &output, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial) { calcOutputPartial(output.output, wrt, inputs, partial); @@ -50,7 +50,7 @@ class ForceFunctional final mfem::ParFiniteElementSpace &fes, std::unordered_map &fields, const nlohmann::json &options, - mach::StateCoefficient &nu) + miso::StateCoefficient &nu) : output(fes, fields), fields(&fields) { setOptions(*this, options); @@ -69,7 +69,7 @@ class TorqueFunctional final { public: friend inline void setInputs(TorqueFunctional &output, - const MachInputs &inputs) + const MISOInputs &inputs) { setInputs(output.output, inputs); } @@ -78,21 +78,21 @@ class TorqueFunctional final const nlohmann::json &options); friend inline double calcOutput(TorqueFunctional &output, - const MachInputs &inputs) + const MISOInputs &inputs) { return calcOutput(output.output, inputs); } friend inline double calcOutputPartial(TorqueFunctional &output, const std::string &wrt, - const MachInputs &inputs) + const MISOInputs &inputs) { return calcOutputPartial(output.output, wrt, inputs); } friend inline void calcOutputPartial(TorqueFunctional &output, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial) { calcOutputPartial(output.output, wrt, inputs, partial); @@ -102,7 +102,7 @@ class TorqueFunctional final mfem::ParFiniteElementSpace &fes, std::unordered_map &fields, const nlohmann::json &options, - mach::StateCoefficient &nu) + miso::StateCoefficient &nu) : output(fes, fields), fields(&fields) { setOptions(*this, options); @@ -163,6 +163,6 @@ inline void setOptions(TorqueFunctional &output, const nlohmann::json &options) } } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/electromagnetics/electromagnetics.hpp b/src/physics/electromagnetics/electromagnetics.hpp index 0db755eb..9e6d4e78 100644 --- a/src/physics/electromagnetics/electromagnetics.hpp +++ b/src/physics/electromagnetics/electromagnetics.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_ELECTROMAGNETICS -#define MACH_ELECTROMAGNETICS +#ifndef MISO_ELECTROMAGNETICS +#define MISO_ELECTROMAGNETICS #include "electromag_integ.hpp" #include "magnetostatic.hpp" diff --git a/src/physics/electromagnetics/magnetic_load.cpp b/src/physics/electromagnetics/magnetic_load.cpp index a0460832..17a62fb8 100644 --- a/src/physics/electromagnetics/magnetic_load.cpp +++ b/src/physics/electromagnetics/magnetic_load.cpp @@ -1,14 +1,14 @@ #include "mfem.hpp" #include "coefficient.hpp" -#include "mach_input.hpp" -#include "mach_linearform.hpp" +#include "miso_input.hpp" +#include "miso_linearform.hpp" #include "mfem_common_integ.hpp" #include "magnetic_load.hpp" using namespace mfem; -namespace mach +namespace miso { MagneticLoad::MagneticLoad(ParFiniteElementSpace &pfes, VectorCoefficient &mag_coeff, @@ -21,14 +21,14 @@ MagneticLoad::MagneticLoad(ParFiniteElementSpace &pfes, std::make_tuple("mesh_coords"), std::forward_as_tuple(mesh_fes, mesh_gf.GetData())); - lf.addDomainIntegrator(new mach::VectorFEDomainLFCurlIntegrator(nuM, -1.0)); + lf.addDomainIntegrator(new miso::VectorFEDomainLFCurlIntegrator(nuM, -1.0)); /// only needed if magnets are on the boundary and not normal to boundary - // lf.addBdrFaceIntegrator(new mach::VectorFEBoundaryTangentLFIntegrator(nuM, + // lf.addBdrFaceIntegrator(new miso::VectorFEBoundaryTangentLFIntegrator(nuM, // -1.0)); } /// set inputs should include fields, so things can check it they're "dirty" -void setInputs(LegacyMagneticLoad &load, const MachInputs &inputs) +void setInputs(LegacyMagneticLoad &load, const MISOInputs &inputs) { auto it = inputs.find("mesh_coords"); if (it != inputs.end()) @@ -91,4 +91,4 @@ void LegacyMagneticLoad::assembleLoad() scratch.ParallelAssemble(load); } -} // namespace mach +} // namespace miso diff --git a/src/physics/electromagnetics/magnetic_load.hpp b/src/physics/electromagnetics/magnetic_load.hpp index 940a5c24..ed91643c 100644 --- a/src/physics/electromagnetics/magnetic_load.hpp +++ b/src/physics/electromagnetics/magnetic_load.hpp @@ -1,19 +1,19 @@ -#ifndef MACH_MAGNETIC_LOAD -#define MACH_MAGNETIC_LOAD +#ifndef MISO_MAGNETIC_LOAD +#define MISO_MAGNETIC_LOAD #include "mfem.hpp" #include "nlohmann/json.hpp" #include "coefficient.hpp" -#include "mach_input.hpp" -#include "mach_linearform.hpp" +#include "miso_input.hpp" +#include "miso_linearform.hpp" -namespace mach +namespace miso { class MagneticLoad final { public: - friend inline void setInputs(MagneticLoad &load, const MachInputs &inputs) + friend inline void setInputs(MagneticLoad &load, const MISOInputs &inputs) { setInputs(load.lf, inputs); } @@ -53,7 +53,7 @@ class MagneticLoad final private: std::unordered_map mag_load_fields; - MachLinearForm lf; + MISOLinearForm lf; mfem::ScalarVectorProductCoefficient nuM; }; @@ -61,9 +61,9 @@ class LegacyMagneticLoad final { public: /// Used to set scalar inputs in the underlying load type - /// Ends up calling `setInputs` on either the `MachLinearForm` or + /// Ends up calling `setInputs` on either the `MISOLinearForm` or /// a specialized version for each particular load. - friend void setInputs(LegacyMagneticLoad &load, const MachInputs &inputs); + friend void setInputs(LegacyMagneticLoad &load, const MISOInputs &inputs); friend inline void setOptions(LegacyMagneticLoad &load, const nlohmann::json &options) @@ -104,6 +104,6 @@ class LegacyMagneticLoad final void assembleLoad(); }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/electromagnetics/magnetostatic.cpp b/src/physics/electromagnetics/magnetostatic.cpp index 03536c22..c5469dde 100644 --- a/src/physics/electromagnetics/magnetostatic.cpp +++ b/src/physics/electromagnetics/magnetostatic.cpp @@ -35,34 +35,34 @@ std::unique_ptr constructReluctivityCoeff( if (!component["linear"].get()) { std::unique_ptr lin_coeff; - std::unique_ptr nonlin_coeff; + std::unique_ptr nonlin_coeff; auto mu_r = materials[material]["mu_r"].get(); lin_coeff.reset(new mfem::ConstantCoefficient(1.0 / (mu_r * mu_0))); // if (material == "team13") // { - // nonlin_coeff.reset(new mach::team13ReluctivityCoefficient()); + // nonlin_coeff.reset(new miso::team13ReluctivityCoefficient()); // } // else // { auto b = materials[material]["B"].get>(); auto h = materials[material]["H"].get>(); - nonlin_coeff.reset(new mach::ReluctivityCoefficient(b, h)); + nonlin_coeff.reset(new miso::ReluctivityCoefficient(b, h)); // } - temp_coeff.reset(new mach::ParameterContinuationCoefficient( + temp_coeff.reset(new miso::ParameterContinuationCoefficient( move(lin_coeff), move(nonlin_coeff))); // if (material == "team13") // { - // temp_coeff.reset(new mach::team13ReluctivityCoefficient()); + // temp_coeff.reset(new miso::team13ReluctivityCoefficient()); // } // else // { // auto b = materials[material]["B"].get>(); // auto h = materials[material]["H"].get>(); - // temp_coeff.reset(new mach::ReluctivityCoefficient(b, h)); + // temp_coeff.reset(new miso::ReluctivityCoefficient(b, h)); // } } else @@ -466,7 +466,7 @@ void team13_current(const xdouble *X, xdouble *J) } // anonymous namespace -namespace mach +namespace miso { MagnetostaticSolver::MagnetostaticSolver(const nlohmann::json &json_options, std::unique_ptr smesh, @@ -766,7 +766,7 @@ void MagnetostaticSolver::addOutput(const std::string &fun, { FunctionalOutput out(*fes, res_fields); out.addOutputDomainIntegrator(new MagneticEnergyIntegrator(*nu)); - // MachOutput mout(std::move(out)); + // MISOOutput mout(std::move(out)); outputs.emplace(fun, std::move(out)); } else if (fun == "ACLoss") @@ -803,7 +803,7 @@ void MagnetostaticSolver::addOutput(const std::string &fun, } else { - throw MachException("Output with name " + fun + + throw MISOException("Output with name " + fun + " not supported by " "MagnetostaticSolver!\n"); } @@ -818,12 +818,12 @@ void MagnetostaticSolver::constructForms() { MagnetostaticResidual mres( *fes, res_fields, *current_coeff, *mag_coeff, *nu); - new_res.reset(new MachResidual(std::move(mres))); + new_res.reset(new MISOResidual(std::move(mres))); // mass.reset(new BilinearFormType(fes.get())); res.reset(new NonlinearFormType(fes.get())); magnetostatic_load.reset( new MagnetostaticLoad(*fes, *current_coeff, *mag_coeff, *nu)); - load.reset(new MachLoad(*magnetostatic_load)); + load.reset(new MISOLoad(*magnetostatic_load)); // old_load.reset(new ParGridFunction(fes.get())); ent.reset(new ParNonlinearForm(fes.get())); } @@ -1127,7 +1127,7 @@ bool MagnetostaticSolver::iterationExit(int iter, } else { - throw MachException("MagnetostaticSolver requires steady time-dis!\n"); + throw MISOException("MagnetostaticSolver requires steady time-dis!\n"); } } @@ -1164,7 +1164,7 @@ double MagnetostaticSolver::calcStepSize(int iter, } else { - throw MachException("MagnetostaticSolver requires steady time-dis!\n"); + throw MISOException("MagnetostaticSolver requires steady time-dis!\n"); } } @@ -1196,7 +1196,7 @@ double MagnetostaticSolver::calcStepSize(int iter, // } // else // { -// throw MachException("Unsupported nonlinear solver type!\n" +// throw MISOException("Unsupported nonlinear solver type!\n" // "\tavilable options are: newton, inexactnewton\n"); // } @@ -2657,7 +2657,7 @@ double MagnetostaticSolver::mag_mu_r = 0.0; double MagnetostaticSolver::fill_factor = 0.0; double MagnetostaticSolver::current_density = 0.0; -void setInputs(MagnetostaticLoad &load, const MachInputs &inputs) +void setInputs(MagnetostaticLoad &load, const MISOInputs &inputs) { setInputs(load.current_load, inputs); setInputs(load.magnetic_load, inputs); @@ -2699,7 +2699,7 @@ int getSize(const MagnetostaticResidual &residual) return getSize(residual.nlf); } -void setInputs(MagnetostaticResidual &residual, const MachInputs &inputs) +void setInputs(MagnetostaticResidual &residual, const MISOInputs &inputs) { setInputs(residual.nlf, inputs); setInputs(*residual.load, inputs); @@ -2712,7 +2712,7 @@ void setOptions(MagnetostaticResidual &residual, const nlohmann::json &options) } void evaluate(MagnetostaticResidual &residual, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::Vector &res_vec) { evaluate(residual.nlf, inputs, res_vec); @@ -2721,10 +2721,10 @@ void evaluate(MagnetostaticResidual &residual, } mfem::Operator &getJacobian(MagnetostaticResidual &residual, - const MachInputs &inputs, + const MISOInputs &inputs, std::string wrt) { return getJacobian(residual.nlf, inputs, std::move(wrt)); } -} // namespace mach +} // namespace miso diff --git a/src/physics/electromagnetics/magnetostatic.hpp b/src/physics/electromagnetics/magnetostatic.hpp index 9476741d..bc41a23a 100644 --- a/src/physics/electromagnetics/magnetostatic.hpp +++ b/src/physics/electromagnetics/magnetostatic.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_MAGNETOSTATIC -#define MACH_MAGNETOSTATIC +#ifndef MISO_MAGNETOSTATIC +#define MISO_MAGNETOSTATIC #include #include @@ -10,17 +10,17 @@ #include "electromag_integ.hpp" #include "coefficient.hpp" #include "current_load.hpp" -#include "mach_load.hpp" -#include "mach_nonlinearform.hpp" +#include "miso_load.hpp" +#include "miso_nonlinearform.hpp" #include "magnetic_load.hpp" #include "solver.hpp" -namespace mach +namespace miso { class MagnetostaticLoad final { public: - friend void setInputs(MagnetostaticLoad &load, const MachInputs &inputs); + friend void setInputs(MagnetostaticLoad &load, const MISOInputs &inputs); friend void setOptions(MagnetostaticLoad &load, const nlohmann::json &options); @@ -55,17 +55,17 @@ class MagnetostaticResidual final friend int getSize(const MagnetostaticResidual &residual); friend void setInputs(MagnetostaticResidual &residual, - const MachInputs &inputs); + const MISOInputs &inputs); friend void setOptions(MagnetostaticResidual &residual, const nlohmann::json &options); friend void evaluate(MagnetostaticResidual &residual, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::Vector &res_vec); friend mfem::Operator &getJacobian(MagnetostaticResidual &residual, - const MachInputs &inputs, + const MISOInputs &inputs, std::string wrt); MagnetostaticResidual( @@ -81,7 +81,7 @@ class MagnetostaticResidual final } private: - MachNonlinearForm nlf; + MISONonlinearForm nlf; /// Need to store MagnetostaticLoad in pointer since underlying load types /// are not yet correctly moveable std::unique_ptr load; @@ -272,7 +272,7 @@ class MagnetostaticSolver : public AbstractSolver void constructSigma(); public: - /// TODO: throw MachException if constructCurrent not called first + /// TODO: throw MISOException if constructCurrent not called first /// introdue some current constructed flag? /// assemble vector associated with current source /// \note - constructCurrent must be called before calling this @@ -298,7 +298,7 @@ class MagnetostaticSolver : public AbstractSolver // double getFunctionalCurrentDensitySensitivity(const std::string &fun); private: - /// TODO: throw MachException if constructMagnetization or + /// TODO: throw MISOException if constructMagnetization or /// assembleCurrentSource not called first /// \brief assemble magnetization source terms into rhs vector and add them /// with the current source terms @@ -509,6 +509,6 @@ class MagnetostaticSolver : public AbstractSolver MPI_Comm comm); }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/CMakeLists.txt b/src/physics/fluidflow/CMakeLists.txt index 92c8d76f..ea49cc3a 100644 --- a/src/physics/fluidflow/CMakeLists.txt +++ b/src/physics/fluidflow/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(mach +target_sources(miso PRIVATE advection.cpp advection.hpp @@ -27,7 +27,7 @@ target_sources(mach viscous_integ.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/physics/fluidflow/advection.cpp b/src/physics/fluidflow/advection.cpp index d5716d70..b79fd909 100644 --- a/src/physics/fluidflow/advection.cpp +++ b/src/physics/fluidflow/advection.cpp @@ -6,7 +6,7 @@ using namespace mfem; using namespace std; -namespace mach +namespace miso { void AdvectionIntegrator::AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, @@ -119,7 +119,7 @@ AdvectionSolver::AdvectionSolver(const nlohmann::json &json_options, /// TODO: This should not be necessary? evolver.reset( // new LinearEvolver(*(mass_matrix), *(stiff_matrix), *(out))); - new MachEvolver(ess_bdr, + new MISOEvolver(ess_bdr, nullptr, mass.get(), nullptr, @@ -135,4 +135,4 @@ template class AdvectionSolver<1>; template class AdvectionSolver<2>; template class AdvectionSolver<3>; -} // namespace mach +} // namespace miso diff --git a/src/physics/fluidflow/advection.hpp b/src/physics/fluidflow/advection.hpp index 19c7f419..119bc1e2 100644 --- a/src/physics/fluidflow/advection.hpp +++ b/src/physics/fluidflow/advection.hpp @@ -1,11 +1,11 @@ -#ifndef MACH_ADVECTION -#define MACH_ADVECTION +#ifndef MISO_ADVECTION +#define MISO_ADVECTION #include "mfem.hpp" #include "solver.hpp" -namespace mach +namespace miso { /// Defines the velocity field used by the AdvectionSolver class /// \param[in] x - location at which to evaluate the velocity @@ -145,6 +145,6 @@ class AdvectionSolver : public AbstractSolver int getNumState() override { return 1; } }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/euler.cpp b/src/physics/fluidflow/euler.cpp index e890f8dd..ade1779a 100644 --- a/src/physics/fluidflow/euler.cpp +++ b/src/physics/fluidflow/euler.cpp @@ -12,7 +12,7 @@ using namespace mfem; using namespace std; -namespace mach +namespace miso { template EulerSolver::EulerSolver(const nlohmann::json &json_options, @@ -29,21 +29,21 @@ EulerSolver::EulerSolver(const nlohmann::json &json_options, *out << "The state variables are the conservative variables." << endl; } // define free-stream parameters; may or may not be used, depending on case - mach_fs = options["flow-param"]["mach"].template get(); + miso_fs = options["flow-param"]["miso"].template get(); aoa_fs = options["flow-param"]["aoa"].template get() * M_PI / 180; iroll = options["flow-param"]["roll-axis"].template get(); ipitch = options["flow-param"]["pitch-axis"].template get(); if (iroll == ipitch) { - throw MachException("iroll and ipitch must be distinct dimensions!"); + throw MISOException("iroll and ipitch must be distinct dimensions!"); } if ((iroll < 0) || (iroll > 2)) { - throw MachException("iroll axis must be between 0 and 2!"); + throw MISOException("iroll axis must be between 0 and 2!"); } if ((ipitch < 0) || (ipitch > 2)) { - throw MachException("ipitch axis must be between 0 and 2!"); + throw MISOException("ipitch axis must be between 0 and 2!"); } } @@ -108,7 +108,7 @@ void EulerSolver::addResBoundaryIntegrators(double alpha) { // isentropic vortex BC if (dim != 2) { - throw MachException( + throw MISOException( "EulerSolver::addBoundaryIntegrators(alpha)\n" "\tisentropic vortex BC must use 2D mesh!"); } @@ -249,7 +249,7 @@ void EulerSolver::addOutput(const std::string &fun, drag_dir(iroll) = cos(aoa_fs); drag_dir(ipitch) = sin(aoa_fs); } - drag_dir *= 1.0 / pow(mach_fs, 2.0); // to get non-dimensional Cd + drag_dir *= 1.0 / pow(miso_fs, 2.0); // to get non-dimensional Cd FunctionalOutput out(*fes, res_fields); out.addOutputBdrFaceIntegrator( @@ -273,7 +273,7 @@ void EulerSolver::addOutput(const std::string &fun, lift_dir(iroll) = -sin(aoa_fs); lift_dir(ipitch) = cos(aoa_fs); } - lift_dir *= 1.0 / pow(mach_fs, 2.0); // to get non-dimensional Cl + lift_dir *= 1.0 / pow(miso_fs, 2.0); // to get non-dimensional Cl FunctionalOutput out(*fes, res_fields); out.addOutputBdrFaceIntegrator( @@ -291,7 +291,7 @@ void EulerSolver::addOutput(const std::string &fun, } else { - throw MachException("Output with name " + fun + + throw MISOException("Output with name " + fun + " not supported by " "EulerSolver!\n"); } @@ -383,14 +383,14 @@ void EulerSolver::getFreeStreamState(mfem::Vector &q_ref) q_ref(0) = 1.0; if (dim == 1) { - q_ref(1) = q_ref(0) * mach_fs; // ignore angle of attack + q_ref(1) = q_ref(0) * miso_fs; // ignore angle of attack } else { - q_ref(iroll + 1) = q_ref(0) * mach_fs * cos(aoa_fs); - q_ref(ipitch + 1) = q_ref(0) * mach_fs * sin(aoa_fs); + q_ref(iroll + 1) = q_ref(0) * miso_fs * cos(aoa_fs); + q_ref(ipitch + 1) = q_ref(0) * miso_fs * sin(aoa_fs); } - q_ref(dim + 1) = 1 / (euler::gamma * euler::gami) + 0.5 * mach_fs * mach_fs; + q_ref(dim + 1) = 1 / (euler::gamma * euler::gami) + 0.5 * miso_fs * miso_fs; } template @@ -517,4 +517,4 @@ template class EulerSolver<2, false>; template class EulerSolver<3, true>; template class EulerSolver<3, false>; -} // namespace mach +} // namespace miso diff --git a/src/physics/fluidflow/euler.hpp b/src/physics/fluidflow/euler.hpp index c3e2286e..440fdc29 100644 --- a/src/physics/fluidflow/euler.hpp +++ b/src/physics/fluidflow/euler.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_EULER -#define MACH_EULER +#ifndef MISO_EULER +#define MISO_EULER //#include @@ -10,7 +10,7 @@ // using adept::adouble; -namespace mach +namespace miso { /// Solver for inviscid flow problems /// dim - number of spatial dimensions (1, 2, or 3) @@ -63,8 +63,8 @@ class EulerSolver : public AbstractSolver void setSolutionError(void (*u_exact)(const mfem::Vector &, mfem::Vector &)); protected: - /// free-stream Mach number - double mach_fs; + /// free-stream MISO number + double miso_fs; /// free-stream angle of attack double aoa_fs; /// index of dimension corresponding to nose to tail axis @@ -153,6 +153,6 @@ class EulerSolver : public AbstractSolver MPI_Comm comm); }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/euler_fluxes.hpp b/src/physics/fluidflow/euler_fluxes.hpp index da3b3c12..650b4e1d 100644 --- a/src/physics/fluidflow/euler_fluxes.hpp +++ b/src/physics/fluidflow/euler_fluxes.hpp @@ -1,7 +1,7 @@ /// Functions related to Euler equations -#ifndef MACH_EULER_FLUXES -#define MACH_EULER_FLUXES +#ifndef MISO_EULER_FLUXES +#define MISO_EULER_FLUXES #include // std::max @@ -11,7 +11,7 @@ using adept::adouble; -namespace mach +namespace miso { /// For constants related to the Euler equations namespace euler @@ -870,7 +870,7 @@ void calcFluxJacState(const mfem::Vector &x, stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcBoundaryFlux(dir_a.data(), + miso::calcBoundaryFlux(dir_a.data(), q_ref_a.data(), q_a.data(), work_vec_a.data(), @@ -1037,6 +1037,6 @@ void calcIsmailRoeFaceFluxWithDissUsingEntVars(const xdouble *dir, } } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/euler_integ.hpp b/src/physics/fluidflow/euler_integ.hpp index 19148b50..deafa1c1 100644 --- a/src/physics/fluidflow/euler_integ.hpp +++ b/src/physics/fluidflow/euler_integ.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_EULER_INTEG -#define MACH_EULER_INTEG +#ifndef MISO_EULER_INTEG +#define MISO_EULER_INTEG #include "adept.h" #include "mfem.hpp" @@ -7,7 +7,7 @@ #include "inviscid_integ.hpp" #include "euler_fluxes.hpp" -namespace mach +namespace miso { /// Integrator for the Euler flux over an element /// \tparam dim - number of spatial dimensions (1, 2, or 3) @@ -593,7 +593,7 @@ class EntropyIntegrator { } }; -} // namespace mach +} // namespace miso #include "euler_integ_def.hpp" diff --git a/src/physics/fluidflow/euler_integ_def.hpp b/src/physics/fluidflow/euler_integ_def.hpp index 07e68c76..20baf824 100644 --- a/src/physics/fluidflow/euler_integ_def.hpp +++ b/src/physics/fluidflow/euler_integ_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_EULER_INTEG_DEF -#define MACH_EULER_INTEG_DEF +#ifndef MISO_EULER_INTEG_DEF +#define MISO_EULER_INTEG_DEF #include "adept.h" #include "mfem.hpp" @@ -8,7 +8,7 @@ #include "euler_fluxes.hpp" #include "euler_integ.hpp" -namespace mach +namespace miso { using adept::adouble; @@ -27,7 +27,7 @@ void EulerIntegrator::calcFluxJacState(const mfem::Vector &dir, this->stack.new_recording(); // the depedent variable must be declared after the recording std::vector flux_a(q.Size()); - mach::calcEulerFlux(dir_a.data(), q_a.data(), flux_a.data()); + miso::calcEulerFlux(dir_a.data(), q_a.data(), flux_a.data()); // set the independent and dependent variable this->stack.independent(q_a.data(), q.Size()); this->stack.dependent(flux_a.data(), q.Size()); @@ -50,7 +50,7 @@ void EulerIntegrator::calcFluxJacDir(const mfem::Vector &dir, this->stack.new_recording(); // the depedent variable must be declared after the recording std::vector flux_a(q.Size()); - mach::calcEulerFlux(dir_a.data(), q_a.data(), flux_a.data()); + miso::calcEulerFlux(dir_a.data(), q_a.data(), flux_a.data()); this->stack.independent(dir_a.data(), dir.Size()); this->stack.dependent(flux_a.data(), q.Size()); // calculate the jacobian w.r.t state vaiables @@ -131,12 +131,12 @@ void IsmailRoeIntegrator::calcFluxJacStates( // run algorithm if (entvar) { - mach::calcIsmailRoeFluxUsingEntVars( + miso::calcIsmailRoeFluxUsingEntVars( di, qL_a.data(), qR_a.data(), flux_a.data()); } else { - mach::calcIsmailRoeFlux( + miso::calcIsmailRoeFlux( di, qL_a.data(), qR_a.data(), flux_a.data()); } // identify independent and dependent variables @@ -455,7 +455,7 @@ void IsentropicVortexBC::calcFluxJacState( this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcIsentropicVortexFlux( + miso::calcIsentropicVortexFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); this->stack.independent(q_a.data(), q.Size()); this->stack.dependent(flux_a.data(), q.Size()); @@ -481,7 +481,7 @@ void IsentropicVortexBC::calcFluxJacDir( this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcIsentropicVortexFlux( + miso::calcIsentropicVortexFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); this->stack.independent(dir_a.data(), dir.Size()); this->stack.dependent(flux_a.data(), q.Size()); @@ -535,7 +535,7 @@ void SlipWallBC::calcFluxJacState(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); this->stack.independent(q_a.data(), q.Size()); this->stack.dependent(flux_a.data(), q.Size()); @@ -560,7 +560,7 @@ void SlipWallBC::calcFluxJacDir(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); this->stack.independent(dir_a.data(), dir.Size()); this->stack.dependent(flux_a.data(), q.Size()); @@ -618,7 +618,7 @@ void FarFieldBC::calcFluxJacState(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcFarFieldFlux(dir_a.data(), + miso::calcFarFieldFlux(dir_a.data(), qfs_a.data(), q_a.data(), work_vec_a.data(), @@ -647,7 +647,7 @@ void FarFieldBC::calcFluxJacDir(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcFarFieldFlux(dir_a.data(), + miso::calcFarFieldFlux(dir_a.data(), qfs_a.data(), q_a.data(), work_vec_a.data(), @@ -745,12 +745,12 @@ void InterfaceIntegrator::calcFluxJacState(const mfem::Vector &dir, std::vector flux_a(qL.Size()); if (entvar) { - mach::calcIsmailRoeFaceFluxWithDissUsingEntVars( + miso::calcIsmailRoeFaceFluxWithDissUsingEntVars( dir_a.data(), diss_coeff_a, qL_a.data(), qR_a.data(), flux_a.data()); } else { - mach::calcIsmailRoeFaceFluxWithDiss( + miso::calcIsmailRoeFaceFluxWithDiss( dir_a.data(), diss_coeff_a, qL_a.data(), qR_a.data(), flux_a.data()); } // set the independent and dependent variables @@ -786,12 +786,12 @@ void InterfaceIntegrator::calcFluxJacDir( std::vector flux_a(qL.Size()); if (entvar) { - mach::calcIsmailRoeFaceFluxWithDissUsingEntVars( + miso::calcIsmailRoeFaceFluxWithDissUsingEntVars( dir_a.data(), diss_coeff_a, qL_a.data(), qR_a.data(), flux_a.data()); } else { - mach::calcIsmailRoeFaceFluxWithDiss( + miso::calcIsmailRoeFaceFluxWithDiss( dir_a.data(), diss_coeff_a, qL_a.data(), qR_a.data(), flux_a.data()); } // set the independent and dependent variables @@ -831,7 +831,7 @@ void PressureForce::calcFlux(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); adouble fun_a = dot(force_nrm_a.data(), flux_a.data() + 1); fun_a.set_gradient(1.0); @@ -846,6 +846,6 @@ double EntropyIntegrator::calcVolFun(const mfem::Vector &x, return entropy(u.GetData()); } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/euler_sens_integ.hpp b/src/physics/fluidflow/euler_sens_integ.hpp index 753f683b..d2fd778b 100644 --- a/src/physics/fluidflow/euler_sens_integ.hpp +++ b/src/physics/fluidflow/euler_sens_integ.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_EULER_SENS_INTEG -#define MACH_EULER_SENS_INTEG +#ifndef MISO_EULER_SENS_INTEG +#define MISO_EULER_SENS_INTEG #include "adept.h" #include "mfem.hpp" @@ -7,7 +7,7 @@ #include "mesh_sens_integ.hpp" #include "euler_fluxes.hpp" -namespace mach +namespace miso { /// Integrator for the mesh sensitivity of the Ismail-Roe domain integrator /// \tparam dim - number of spatial dimensions (1, 2, or 3) @@ -85,7 +85,7 @@ class SlipWallBCMeshSens adept::Stack &stack; }; -} // namespace mach +} // namespace miso #include "euler_sens_integ_def.hpp" diff --git a/src/physics/fluidflow/euler_sens_integ_def.hpp b/src/physics/fluidflow/euler_sens_integ_def.hpp index 1cb1319b..59cbd6df 100644 --- a/src/physics/fluidflow/euler_sens_integ_def.hpp +++ b/src/physics/fluidflow/euler_sens_integ_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_EULER_SENS_INTEG_DEF -#define MACH_EULER_SENS_INTEG_DEF +#ifndef MISO_EULER_SENS_INTEG_DEF +#define MISO_EULER_SENS_INTEG_DEF #include "adept.h" #include "mfem.hpp" @@ -8,7 +8,7 @@ #include "euler_fluxes.hpp" #include "euler_sens_integ.hpp" -namespace mach +namespace miso { using adept::adouble; @@ -49,13 +49,13 @@ void SlipWallBCMeshSens::calcFluxBar(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(u.Size()); - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), u_a.data(), flux_a.data()); adept::set_gradients(flux_a.data(), flux_bar.Size(), flux_bar.GetData()); this->stack.compute_adjoint(); adept::get_gradients(dir_a.data(), dir.Size(), dir_bar.GetData()); } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/fluidflow.hpp b/src/physics/fluidflow/fluidflow.hpp index 15f19762..9a1d36c6 100644 --- a/src/physics/fluidflow/fluidflow.hpp +++ b/src/physics/fluidflow/fluidflow.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_FLUIDFLOW -#define MACH_FLUIDFLOW +#ifndef MISO_FLUIDFLOW +#define MISO_FLUIDFLOW #include "advection.hpp" #include "euler_fluxes.hpp" diff --git a/src/physics/fluidflow/galer_diff.cpp b/src/physics/fluidflow/galer_diff.cpp index bb82a8b9..74c3b6ae 100644 --- a/src/physics/fluidflow/galer_diff.cpp +++ b/src/physics/fluidflow/galer_diff.cpp @@ -3,7 +3,7 @@ // #include "default_options.hpp" // #include "galer_diff.hpp" // using namespace std; -// using namespace mach; +// using namespace miso; // using namespace apf; // namespace mfem // { @@ -226,8 +226,8 @@ // { // case 1: nelmt = degree + 1; break; // case 2: nelmt = (degree+1) * (degree+2) / 2; break; -// case 3: throw MachException("Not implemeneted yet.\n"); break; -// default: throw MachException("dim must be 1, 2 or 3.\n"); +// case 3: throw MISOException("Not implemeneted yet.\n"); break; +// default: throw MISOException("dim must be 1, 2 or 3.\n"); // } // // loop over all the element: // // 1. build the patch for each element, diff --git a/src/physics/fluidflow/galer_diff.hpp b/src/physics/fluidflow/galer_diff.hpp index 66fe2812..e8025a73 100644 --- a/src/physics/fluidflow/galer_diff.hpp +++ b/src/physics/fluidflow/galer_diff.hpp @@ -2,7 +2,7 @@ // #define MFEM_GALER_DIFF // #include "mfem.hpp" // #include "solver.hpp" -// #include "mach_types.hpp" +// #include "miso_types.hpp" // #include "pumi.h" // namespace mfem @@ -16,7 +16,7 @@ // /// Class constructor. // /// \param[in] opt_file_name - file where options are stored // GalerkinDifference(const std::string &opt_file_name = -// std::string("mach_options.json")); +// std::string("miso_options.json")); // /// constructs the neighbour matrices for all mesh elements. // /// and second neighbours (shared vertices). @@ -84,5 +84,5 @@ // }; -// } // end of namespace mach +// } // end of namespace miso // #endif diff --git a/src/physics/fluidflow/inviscid_integ.hpp b/src/physics/fluidflow/inviscid_integ.hpp index a56b3bf2..1752ee32 100644 --- a/src/physics/fluidflow/inviscid_integ.hpp +++ b/src/physics/fluidflow/inviscid_integ.hpp @@ -1,10 +1,10 @@ -#ifndef MACH_INVISCID_INTEG -#define MACH_INVISCID_INTEG +#ifndef MISO_INVISCID_INTEG +#define MISO_INVISCID_INTEG #include "adept.h" #include "mfem.hpp" -namespace mach +namespace miso { /// Integrator for one-point inviscid flux functions /// \tparam Derived - a class Derived from this one (needed for CRTP) @@ -712,7 +712,7 @@ class NonlinearMassIntegrator : public mfem::NonlinearFormIntegrator } }; -} // namespace mach +} // namespace miso #include "inviscid_integ_def.hpp" diff --git a/src/physics/fluidflow/inviscid_integ_def.hpp b/src/physics/fluidflow/inviscid_integ_def.hpp index 3ddac9b1..a56c6dfe 100644 --- a/src/physics/fluidflow/inviscid_integ_def.hpp +++ b/src/physics/fluidflow/inviscid_integ_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_INVISCID_INTEG_DEF -#define MACH_INVISCID_INTEG_DEF +#ifndef MISO_INVISCID_INTEG_DEF +#define MISO_INVISCID_INTEG_DEF #include "mfem.hpp" @@ -7,7 +7,7 @@ #include "sbp_fe.hpp" #include "inviscid_integ.hpp" -namespace mach +namespace miso { template double InviscidIntegrator::GetElementEnergy( @@ -443,7 +443,7 @@ double InviscidBoundaryIntegrator::GetFaceEnergy( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "InviscidBoundaryIntegrator::GetFaceEnergy())\n" "\tcannot handle given dimension"); } @@ -499,7 +499,7 @@ void InviscidBoundaryIntegrator::AssembleFaceVector( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "InviscidBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -563,7 +563,7 @@ void InviscidBoundaryIntegrator::AssembleFaceGrad( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "InviscidBoundaryIntegrator::AssembleFaceGrad())\n" "\tcannot handle given dimension"); } @@ -631,7 +631,7 @@ double InviscidFaceIntegrator::GetFaceEnergy( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "InviscidBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -700,7 +700,7 @@ void InviscidFaceIntegrator::AssembleFaceVector( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "InviscidBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -772,7 +772,7 @@ void InviscidFaceIntegrator::AssembleFaceGrad( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "InviscidBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -896,6 +896,6 @@ void NonlinearMassIntegrator::AssembleElementGrad( elmat *= alpha; } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/mesh_sens_integ.hpp b/src/physics/fluidflow/mesh_sens_integ.hpp index e84e60c0..18339578 100644 --- a/src/physics/fluidflow/mesh_sens_integ.hpp +++ b/src/physics/fluidflow/mesh_sens_integ.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_MESH_SENS_INTEG -#define MACH_MESH_SENS_INTEG +#ifndef MISO_MESH_SENS_INTEG +#define MISO_MESH_SENS_INTEG #include "mfem.hpp" -namespace mach +namespace miso { /// Integrator for mesh sensitivity of dyadic domain integrators /// \tparam Derived - a class Derived from this one (needed for CRTP) @@ -147,7 +147,7 @@ class BoundaryMeshSensIntegrator : public mfem::LinearFormIntegrator } }; -} // namespace mach +} // namespace miso #include "mesh_sens_integ_def.hpp" diff --git a/src/physics/fluidflow/mesh_sens_integ_def.hpp b/src/physics/fluidflow/mesh_sens_integ_def.hpp index 38cb12fb..3574060e 100644 --- a/src/physics/fluidflow/mesh_sens_integ_def.hpp +++ b/src/physics/fluidflow/mesh_sens_integ_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_MESH_SENS_INTEG_DEF -#define MACH_MESH_SENS_INTEG_DEF +#ifndef MISO_MESH_SENS_INTEG_DEF +#define MISO_MESH_SENS_INTEG_DEF #include "mfem.hpp" @@ -7,7 +7,7 @@ #include "sbp_fe.hpp" #include "mesh_sens_integ.hpp" -namespace mach +namespace miso { template void DyadicMeshSensIntegrator::AssembleRHSElementVect( @@ -96,7 +96,7 @@ void BoundaryMeshSensIntegrator::AssembleRHSElementVect( mfem::ElementTransformation &trans, mfem::Vector &elvect) { - throw MachException( + throw MISOException( "BoundaryMeshSensIntegrator::AssembleRHSElementVect()\n" "\tUse AddBdrFaceIntegrator not AddBoundaryIntegrator"); @@ -150,7 +150,7 @@ void BoundaryMeshSensIntegrator::AssembleRHSElementVect( // break; // case 2: sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); // break; - // default: throw mach::MachException( + // default: throw miso::MISOException( // "BoundaryMeshSensIntegrator::AssembleFaceVector())\n" // "\tcannot handle given dimension"); // } @@ -251,7 +251,7 @@ void BoundaryMeshSensIntegrator::AssembleRHSElementVect( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "BoundaryMeshSensIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -298,6 +298,6 @@ void BoundaryMeshSensIntegrator::AssembleRHSElementVect( } } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/mms_integ.hpp b/src/physics/fluidflow/mms_integ.hpp index 8acd1686..6b04b70b 100644 --- a/src/physics/fluidflow/mms_integ.hpp +++ b/src/physics/fluidflow/mms_integ.hpp @@ -1,12 +1,12 @@ -#ifndef MACH_MMS_INTEG -#define MACH_MMS_INTEG +#ifndef MISO_MMS_INTEG +#define MISO_MMS_INTEG #include "mfem.hpp" #include "sbp_fe.hpp" #include "utils.hpp" -namespace mach +namespace miso { /// Integrator for method-of-manufactured solution (MMS) sources /// \tparam Derived - a class Derived from this one (needed for CRTP) @@ -80,7 +80,7 @@ class MMSIntegrator : public mfem::NonlinearFormIntegrator } }; -} // namespace mach +} // namespace miso #include "mms_integ_def.hpp" diff --git a/src/physics/fluidflow/mms_integ_def.hpp b/src/physics/fluidflow/mms_integ_def.hpp index f904e876..e2755a74 100644 --- a/src/physics/fluidflow/mms_integ_def.hpp +++ b/src/physics/fluidflow/mms_integ_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_MMS_INTEG_DEF -#define MACH_MMS_INTEG_DEF +#ifndef MISO_MMS_INTEG_DEF +#define MISO_MMS_INTEG_DEF #include "mfem.hpp" @@ -7,7 +7,7 @@ #include "utils.hpp" #include "mms_integ.hpp" -namespace mach +namespace miso { template void MMSIntegrator::AssembleElementVector( @@ -58,6 +58,6 @@ void MMSIntegrator::AssembleElementGrad( elmat = 0.0; } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/navier_stokes.cpp b/src/physics/fluidflow/navier_stokes.cpp index 601a07a0..660eff68 100644 --- a/src/physics/fluidflow/navier_stokes.cpp +++ b/src/physics/fluidflow/navier_stokes.cpp @@ -9,7 +9,7 @@ using namespace mfem; using namespace std; -namespace mach +namespace miso { template NavierStokesSolver::NavierStokesSolver( @@ -41,7 +41,7 @@ void NavierStokesSolver::addResVolumeIntegrators(double alpha) { if (dim != 2) { - throw MachException("Viscous MMS problem only available for 2D!"); + throw MISOException("Viscous MMS problem only available for 2D!"); } this->res->AddDomainIntegrator( new NavierStokesMMSIntegrator(re_fs, pr_fs)); @@ -198,7 +198,7 @@ void NavierStokesSolver::addOutput(const std::string &fun, drag_dir(this->iroll) = cos(this->aoa_fs); drag_dir(this->ipitch) = sin(this->aoa_fs); } - drag_dir *= 1.0 / pow(this->mach_fs, 2.0); // to get non-dimensional Cd + drag_dir *= 1.0 / pow(this->miso_fs, 2.0); // to get non-dimensional Cd FunctionalOutput out(*(this->fes), this->res_fields); out.addOutputBdrFaceIntegrator(new SurfaceForce(this->diff_stack, @@ -228,7 +228,7 @@ void NavierStokesSolver::addOutput(const std::string &fun, lift_dir(this->iroll) = -sin(this->aoa_fs); lift_dir(this->ipitch) = cos(this->aoa_fs); } - lift_dir *= 1.0 / pow(this->mach_fs, 2.0); // to get non-dimensional Cl + lift_dir *= 1.0 / pow(this->miso_fs, 2.0); // to get non-dimensional Cl FunctionalOutput out(*(this->fes), this->res_fields); out.addOutputBdrFaceIntegrator(new SurfaceForce(this->diff_stack, @@ -252,7 +252,7 @@ void NavierStokesSolver::addOutput(const std::string &fun, } else { - throw MachException("Output with name " + fun + + throw MISOException("Output with name " + fun + " not supported by " "NavierStokesSolver!\n"); } @@ -265,7 +265,7 @@ void NavierStokesSolver::getViscousInflowState(Vector &q_in) .template get>(); if (tmp.size() != dim + 2) { - throw MachException( + throw MISOException( "inflow-state option has wrong number of entries" " for problem dimension!"); } @@ -282,7 +282,7 @@ void NavierStokesSolver::getViscousOutflowState(Vector &q_out) .template get>(); if (tmp.size() != dim + 2) { - throw MachException( + throw MISOException( "outflow-state option has wrong number of entries" " for problem dimension!"); } @@ -364,4 +364,4 @@ void viscousMMSExact(const mfem::Vector &x, mfem::Vector &u) u(2) *= u(0); } -} // namespace mach +} // namespace miso diff --git a/src/physics/fluidflow/navier_stokes.hpp b/src/physics/fluidflow/navier_stokes.hpp index ad37a8fb..c62fbb41 100644 --- a/src/physics/fluidflow/navier_stokes.hpp +++ b/src/physics/fluidflow/navier_stokes.hpp @@ -1,11 +1,11 @@ -#ifndef MACH_NAVIER_STOKES -#define MACH_NAVIER_STOKES +#ifndef MISO_NAVIER_STOKES +#define MISO_NAVIER_STOKES #include "mfem.hpp" #include "euler.hpp" -namespace mach +namespace miso { /// Solver for Navier-Stokes flows /// dim - number of spatial dimensions (1, 2, or 3) @@ -63,7 +63,7 @@ class NavierStokesSolver : public EulerSolver /// interfaces." See also Fisher's thesis in the appendix, but note that the /// value of alpha listed there is incorrect!!! /// \param[in] Re - Reynolds number -/// \param[in] Ma - Mach number +/// \param[in] Ma - MISO number /// \param[in] v - velocity ration u/u_L /// \returns the right hand side of Equation (7.5) double shockEquation(double Re, double Ma, double v); @@ -78,6 +78,6 @@ void shockExact(const mfem::Vector &x, mfem::Vector &u); /// \param[out] u - conservative variables stored as a 4-vector void viscousMMSExact(const mfem::Vector &x, mfem::Vector &u); -} // namespace mach +} // namespace miso #endif \ No newline at end of file diff --git a/src/physics/fluidflow/navier_stokes_fluxes.hpp b/src/physics/fluidflow/navier_stokes_fluxes.hpp index 671368c6..2e254c8b 100644 --- a/src/physics/fluidflow/navier_stokes_fluxes.hpp +++ b/src/physics/fluidflow/navier_stokes_fluxes.hpp @@ -1,13 +1,13 @@ /// Functions related to Navier-Stokes equations -#ifndef MACH_NAVIER_STOKES_FLUXES -#define MACH_NAVIER_STOKES_FLUXES +#ifndef MISO_NAVIER_STOKES_FLUXES +#define MISO_NAVIER_STOKES_FLUXES #include // std::max #include "utils.hpp" #include "euler_fluxes.hpp" -namespace mach +namespace miso { /// For constants related to the Navier-Stokes equations namespace navierstokes @@ -569,6 +569,6 @@ void calcViscousMMS(double mu, double Pr, const xdouble *x, xdouble *src) (gamma - 1); } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/navier_stokes_integ.hpp b/src/physics/fluidflow/navier_stokes_integ.hpp index 4db31093..7e596b67 100644 --- a/src/physics/fluidflow/navier_stokes_integ.hpp +++ b/src/physics/fluidflow/navier_stokes_integ.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_NAVIER_STOKES_INTEG -#define MACH_NAVIER_STOKES_INTEG +#ifndef MISO_NAVIER_STOKES_INTEG +#define MISO_NAVIER_STOKES_INTEG #include "adept.h" #include "mfem.hpp" @@ -9,7 +9,7 @@ #include "euler_fluxes.hpp" #include "navier_stokes_fluxes.hpp" -namespace mach +namespace miso { /// Source-term integrator for a 2D Navier-Stokes MMS problem /// \note For details on the MMS problem, see the file viscous_mms.py @@ -1220,7 +1220,7 @@ class SurfaceForce : public mfem::NonlinearFormIntegrator #endif }; -} // namespace mach +} // namespace miso #include "navier_stokes_integ_def.hpp" diff --git a/src/physics/fluidflow/navier_stokes_integ_def.hpp b/src/physics/fluidflow/navier_stokes_integ_def.hpp index 29919056..b2da7d0c 100644 --- a/src/physics/fluidflow/navier_stokes_integ_def.hpp +++ b/src/physics/fluidflow/navier_stokes_integ_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_NAVIER_STOKES_INTEG_DEF -#define MACH_NAVIER_STOKES_INTEG_DEF +#ifndef MISO_NAVIER_STOKES_INTEG_DEF +#define MISO_NAVIER_STOKES_INTEG_DEF #include "adept.h" #include "mfem.hpp" @@ -10,7 +10,7 @@ #include "navier_stokes_fluxes.hpp" #include "navier_stokes_integ.hpp" -namespace mach +namespace miso { using adept::adouble; //============================================================================== @@ -38,7 +38,7 @@ void ESViscousIntegrator::applyScalingJacState(int d, adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; applyViscousScaling( @@ -73,7 +73,7 @@ void ESViscousIntegrator::applyScalingJacDw( adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; applyViscousScaling( @@ -182,23 +182,23 @@ void NoSlipAdiabaticWallBC::calcFluxJacState(const mfem::Vector &x, // create container for active double flux output std::vector flux_a(q.Size()); // Step 1: apply the EC slip wall flux - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); // Step 2: evaluate the adiabatic flux adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; - mach::calcAdiabaticWallFlux( + miso::calcAdiabaticWallFlux( dir_a.data(), mu_Re, Pr, q_a.data(), Dw_a.data(), work_vec_a.data()); for (int i = 0; i < flux_a.size(); ++i) { flux_a[i] -= work_vec_a[i]; // note the minus sign!!! } // Step 3: evaluate the no-slip penalty - mach::calcNoSlipPenaltyFlux(dir_a.data(), + miso::calcNoSlipPenaltyFlux(dir_a.data(), jac, mu_Re, Pr, @@ -242,23 +242,23 @@ void NoSlipAdiabaticWallBC::calcFluxJacDw( // create container for active double flux output std::vector flux_a(q.Size()); // Step 1: apply the EC slip wall flux - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); // Step 2: evaluate the adiabatic flux adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; - mach::calcAdiabaticWallFlux( + miso::calcAdiabaticWallFlux( dir_a.data(), mu_Re, Pr, q_a.data(), Dw_a.data(), work_vec_a.data()); for (int i = 0; i < flux_a.size(); ++i) { flux_a[i] -= work_vec_a[i]; // note the minus sign!!! } // Step 3: evaluate the no-slip penalty - mach::calcNoSlipPenaltyFlux(dir_a.data(), + miso::calcNoSlipPenaltyFlux(dir_a.data(), jac, mu_Re, Pr, @@ -406,7 +406,7 @@ void ViscousSlipWallBC::calcFluxJacState(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); #if 1 std::vector Dw_work(Dw_size); @@ -470,7 +470,7 @@ void ViscousSlipWallBC::calcFluxJacDw( // create container for active double flux output std::vector flux_a(q.Size()); // Step 1: apply the EC slip wall flux - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); // Step 2: evaluate the derivative flux std::vector Dw_work(Dw_size); @@ -478,7 +478,7 @@ void ViscousSlipWallBC::calcFluxJacDw( adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; std::vector work_a(q.Size()); @@ -572,7 +572,7 @@ void ViscousInflowBC::calcFluxJacState(const mfem::Vector &x, mfem::DenseMatrix &flux_jac) { // function defined in euler_fluxes.hpp - mach::calcFluxJacState( + miso::calcFluxJacState( x, dir, jac, q, Dw, q_in, work_vec, this->stack, flux_jac); #if 0 // create containers for active double objects for each input @@ -593,7 +593,7 @@ void ViscousInflowBC::calcFluxJacState(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcBoundaryFlux(dir_a.data(), q_in_a.data(), q_a.data(), + miso::calcBoundaryFlux(dir_a.data(), q_in_a.data(), q_a.data(), work_vec_a.data(), flux_a.data()); this->stack.independent(q_a.data(), q.Size()); this->stack.dependent(flux_a.data(), q.Size()); @@ -676,7 +676,7 @@ void ViscousOutflowBC::calcFluxJacState(const mfem::Vector &x, const mfem::DenseMatrix &Dw, mfem::DenseMatrix &flux_jac) { - mach::calcFluxJacState( + miso::calcFluxJacState( x, dir, jac, q, Dw, q_out, work_vec, this->stack, flux_jac); #if 0 int Dw_size = Dw.Height() * Dw.Width(); @@ -698,13 +698,13 @@ void ViscousOutflowBC::calcFluxJacState(const mfem::Vector &x, // create container for active double flux output std::vector flux_a(q.Size()); // Part 1: apply the inviscid inflow boundary condition - mach::calcBoundaryFlux(dir_a.data(), q_out_a.data(), q_a.data(), + miso::calcBoundaryFlux(dir_a.data(), q_out_a.data(), q_a.data(), work_vec_a.data(), flux_a.data()); // Part 2: evaluate the adiabatic flux adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; for (int d = 0; d < dim; ++d) @@ -768,7 +768,7 @@ void ViscousFarFieldBC::calcFluxJacState(const mfem::Vector &x, const mfem::DenseMatrix &Dw, mfem::DenseMatrix &flux_jac) { - mach::calcFluxJacState( + miso::calcFluxJacState( x, dir, jac, q, Dw, qfs, work_vec, this->stack, flux_jac); #if 0 // create containers for active double objects for each input @@ -784,7 +784,7 @@ void ViscousFarFieldBC::calcFluxJacState(const mfem::Vector &x, this->stack.new_recording(); // create container for active double flux output std::vector flux_a(q.Size()); - mach::calcBoundaryFlux(dir_a.data(), qfs_a.data(), q_a.data(), + miso::calcBoundaryFlux(dir_a.data(), qfs_a.data(), q_a.data(), work_vec_a.data(), flux_a.data()); this->stack.independent(q_a.data(), q.Size()); this->stack.dependent(flux_a.data(), q.Size()); @@ -1051,23 +1051,23 @@ void SurfaceForce::calcBndryFunJacState(const mfem::Vector &x, // create container for active double flux output std::vector flux_a(q.Size()); // Step 1: apply the EC slip wall flux - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); // Step 2: evaluate the adiabatic flux adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; - mach::calcAdiabaticWallFlux( + miso::calcAdiabaticWallFlux( dir_a.data(), mu_Re, Pr, q_a.data(), Dw_a.data(), work_vec_a.data()); for (int i = 0; i < flux_a.size(); ++i) { flux_a[i] -= work_vec_a[i]; // note the minus sign!!! } // Step 3: evaluate the no-slip penalty - mach::calcNoSlipPenaltyFlux(dir_a.data(), + miso::calcNoSlipPenaltyFlux(dir_a.data(), jac, mu_Re, Pr, @@ -1113,23 +1113,23 @@ void SurfaceForce::calcBndryFunJacDw(const mfem::Vector &x, // create container for active double flux output std::vector flux_a(q.Size()); // Step 1: apply the EC slip wall flux - mach::calcSlipWallFlux( + miso::calcSlipWallFlux( x_a.data(), dir_a.data(), q_a.data(), flux_a.data()); // Step 2: evaluate the adiabatic flux adouble mu_Re = mu; if (mu < 0.0) { - mu_Re = mach::calcSutherlandViscosity(q_a.data()); + mu_Re = miso::calcSutherlandViscosity(q_a.data()); } mu_Re /= Re; - mach::calcAdiabaticWallFlux( + miso::calcAdiabaticWallFlux( dir_a.data(), mu_Re, Pr, q_a.data(), Dw_a.data(), work_vec_a.data()); for (int i = 0; i < flux_a.size(); ++i) { flux_a[i] -= work_vec_a[i]; // note the minus sign!!! } // Step 3: evaluate the no-slip penalty - mach::calcNoSlipPenaltyFlux(dir_a.data(), + miso::calcNoSlipPenaltyFlux(dir_a.data(), jac, mu_Re, Pr, @@ -1187,7 +1187,7 @@ double SurfaceForce::GetFaceEnergy(const mfem::FiniteElement &el_bnd, sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "ViscousBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -1279,7 +1279,7 @@ void SurfaceForce::AssembleFaceVector( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "ViscousBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -1360,6 +1360,6 @@ void SurfaceForce::AssembleFaceVector( } // k/i loop } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/fluidflow/viscous_integ.hpp b/src/physics/fluidflow/viscous_integ.hpp index ce303227..4c77e2a5 100644 --- a/src/physics/fluidflow/viscous_integ.hpp +++ b/src/physics/fluidflow/viscous_integ.hpp @@ -1,10 +1,10 @@ -#ifndef MACH_VISCOUS_INTEG -#define MACH_VISCOUS_INTEG +#ifndef MISO_VISCOUS_INTEG +#define MISO_VISCOUS_INTEG #include "adept.h" #include "mfem.hpp" -namespace mach +namespace miso { /// Integrator for symmetric viscous terms /// \tparam Derived - a class Derived from this one (needed for CRTP) @@ -355,7 +355,7 @@ class ViscousBoundaryIntegrator : public mfem::NonlinearFormIntegrator #endif }; -} // namespace mach +} // namespace miso #include "viscous_integ_def.hpp" diff --git a/src/physics/fluidflow/viscous_integ_def.hpp b/src/physics/fluidflow/viscous_integ_def.hpp index 9e69b9c4..063a2ad9 100644 --- a/src/physics/fluidflow/viscous_integ_def.hpp +++ b/src/physics/fluidflow/viscous_integ_def.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_VISCOUS_INTEG_DEF -#define MACH_VISCOUS_INTEG_DEF +#ifndef MISO_VISCOUS_INTEG_DEF +#define MISO_VISCOUS_INTEG_DEF #include "mfem.hpp" @@ -7,7 +7,7 @@ #include "utils.hpp" #include "viscous_integ.hpp" -namespace mach +namespace miso { template void SymmetricViscousIntegrator::AssembleElementVector( @@ -250,7 +250,7 @@ double ViscousBoundaryIntegrator::GetFaceEnergy( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "ViscousBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -341,7 +341,7 @@ void ViscousBoundaryIntegrator::AssembleFaceVector( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "ViscousBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -465,7 +465,7 @@ void ViscousBoundaryIntegrator::AssembleFaceGrad( sbp_face = fec->FiniteElementForGeometry(Geometry::SEGMENT); break; default: - throw mach::MachException( + throw miso::MISOException( "ViscousBoundaryIntegrator::AssembleFaceVector())\n" "\tcannot handle given dimension"); } @@ -580,6 +580,6 @@ void ViscousBoundaryIntegrator::AssembleFaceGrad( } // k/i loop } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/joule/CMakeLists.txt b/src/physics/joule/CMakeLists.txt index 7ba84599..07d42224 100644 --- a/src/physics/joule/CMakeLists.txt +++ b/src/physics/joule/CMakeLists.txt @@ -1,10 +1,10 @@ -target_sources(mach +target_sources(miso PRIVATE joule.cpp joule.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/physics/joule/joule.cpp b/src/physics/joule/joule.cpp index 8d601b9f..63e36248 100644 --- a/src/physics/joule/joule.cpp +++ b/src/physics/joule/joule.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace mfem; -namespace mach +namespace miso { /// TODO: read options file and construct options files for EM and JouleSolver::JouleSolver(const std::string &opt_file_name, @@ -34,7 +34,7 @@ JouleSolver::JouleSolver(const std::string &opt_file_name, } else { - throw MachException( + throw MISOException( "JouleSolver::JouleSolver()\n" "\tMesh file has no extension!\n"); } @@ -55,7 +55,7 @@ JouleSolver::JouleSolver(const std::string &opt_file_name, } else { - throw MachException( + throw MISOException( "JouleSolver::JouleSolver()\n" "\tModel file has no extension!\n"); } @@ -145,4 +145,4 @@ void JouleSolver::solveForAdjoint(const std::string &fun) } } -} // namespace mach +} // namespace miso diff --git a/src/physics/joule/joule.hpp b/src/physics/joule/joule.hpp index 4af9cabf..5c59eebf 100644 --- a/src/physics/joule/joule.hpp +++ b/src/physics/joule/joule.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_JOULE -#define MACH_JOULE +#ifndef MISO_JOULE +#define MISO_JOULE #include "solver.hpp" -namespace mach +namespace miso { class MagnetostaticSolver; class ThermalSolver; @@ -63,6 +63,6 @@ class JouleSolver : public AbstractSolver MPI_Comm comm); }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/mach_input.cpp b/src/physics/mach_input.cpp deleted file mode 100644 index 88e686e6..00000000 --- a/src/physics/mach_input.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "utils.hpp" -#include "mach_input.hpp" - -namespace mach -{ -double *MachInput::getField() const -{ - if (active != Type::Field) - { - throw MachException("Input type is not a field!\n"); - } - else - { - return input.field; - } -} - -double MachInput::getValue() const -{ - if (active != Type::Value) - { - throw MachException("Input type is not a value!\n"); - } - else - { - return input.value; - } -} - -} // namespace mach diff --git a/src/physics/mach_integrator.cpp b/src/physics/mach_integrator.cpp deleted file mode 100644 index d9271c28..00000000 --- a/src/physics/mach_integrator.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include - -#include "mfem.hpp" -#include "nlohmann/json.hpp" - -#include "mach_input.hpp" -#include "mach_integrator.hpp" - -namespace mach -{ -void setInputs(std::vector &integrators, - const MachInputs &inputs) -{ - for (auto &integ : integrators) - { - setInputs(integ, inputs); - } -} - -void setInputs(MachIntegrator &integ, const MachInputs &inputs) -{ - integ.self_->setInputs_(inputs); -} - -void setOptions(std::vector &integrators, - const nlohmann::json &options) -{ - for (auto &integ : integrators) - { - setOptions(integ, options); - } -} - -void setOptions(MachIntegrator &integ, const nlohmann::json &options) -{ - integ.self_->setOptions_(options); -} - -} // namespace mach diff --git a/src/physics/meshmove/CMakeLists.txt b/src/physics/meshmove/CMakeLists.txt index e2a5ed25..d6007762 100644 --- a/src/physics/meshmove/CMakeLists.txt +++ b/src/physics/meshmove/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(mach +target_sources(miso PRIVATE mesh_move_integ.cpp mesh_move_integ.hpp @@ -6,7 +6,7 @@ target_sources(mach mesh_movement.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/physics/meshmove/mesh_move_integ.cpp b/src/physics/meshmove/mesh_move_integ.cpp index 54a1d5f1..925eb0ce 100644 --- a/src/physics/meshmove/mesh_move_integ.cpp +++ b/src/physics/meshmove/mesh_move_integ.cpp @@ -4,7 +4,7 @@ using namespace mfem; -namespace mach +namespace miso { void ElasticityPositionIntegrator::AssembleElementVector( const FiniteElement &el, @@ -29,4 +29,4 @@ void ElasticityPositionIntegrator::AssembleElementVector( elmat.Mult(disp, elvect); } -} // namespace mach +} // namespace miso diff --git a/src/physics/meshmove/mesh_move_integ.hpp b/src/physics/meshmove/mesh_move_integ.hpp index b3068ba8..38e88f33 100644 --- a/src/physics/meshmove/mesh_move_integ.hpp +++ b/src/physics/meshmove/mesh_move_integ.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_MESH_MOVE_INTEG -#define MACH_MESH_MOVE_INTEG +#ifndef MISO_MESH_MOVE_INTEG +#define MISO_MESH_MOVE_INTEG #include "mfem.hpp" -namespace mach +namespace miso { /** Integrator for the linear elasticity form: a(u,v) = (lambda div(u), div(v)) + (2 mu e(u), e(v)), @@ -29,6 +29,6 @@ class ElasticityPositionIntegrator : public mfem::ElasticityIntegrator mfem::Vector &elvect) override; }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/meshmove/mesh_movement.cpp b/src/physics/meshmove/mesh_movement.cpp index cd67c145..d95364e1 100644 --- a/src/physics/meshmove/mesh_movement.cpp +++ b/src/physics/meshmove/mesh_movement.cpp @@ -9,7 +9,7 @@ using namespace mfem; -namespace mach +namespace miso { LEAnalogySolver::LEAnalogySolver(const nlohmann::json &options, std::unique_ptr smesh, @@ -19,13 +19,13 @@ LEAnalogySolver::LEAnalogySolver(const nlohmann::json &options, if (options["space-dis"]["degree"] != mesh->GetNodes()->FESpace()->GetOrder(0)) { - throw MachException( + throw MISOException( "Linear Elasticity mesh movement solver must use same " "degree as mesh order!\n"); } if (options["space-dis"]["basis-type"] != "H1") { - throw MachException( + throw MISOException( "Linear Elasticity mesh movement solver must use H1 " "basis functions\n"); } @@ -68,7 +68,7 @@ double LEAnalogySolver::calcStepSize(int iter, } else { - throw MachException("LEAnalogySolver requires steady time-dis!\n"); + throw MISOException("LEAnalogySolver requires steady time-dis!\n"); } } @@ -81,7 +81,7 @@ void LEAnalogySolver::initialHook(const ParGridFunction &state) } else { - throw MachException("LEAnalogySolver requires steady time-dis!\n"); + throw MISOException("LEAnalogySolver requires steady time-dis!\n"); } } @@ -101,7 +101,7 @@ bool LEAnalogySolver::iterationExit(int iter, } else { - throw MachException("LEAnalogySolver requires steady time-dis!\n"); + throw MISOException("LEAnalogySolver requires steady time-dis!\n"); } } @@ -149,4 +149,4 @@ void LEAnalogySolver::setEssentialBoundaries() res->SetEssentialTrueDofs(ess_tdof_list); } -} // namespace mach +} // namespace miso diff --git a/src/physics/meshmove/mesh_movement.hpp b/src/physics/meshmove/mesh_movement.hpp index 05bae877..d0efef0b 100644 --- a/src/physics/meshmove/mesh_movement.hpp +++ b/src/physics/meshmove/mesh_movement.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_MESH_MOVEMENT -#define MACH_MESH_MOVEMENT +#ifndef MISO_MESH_MOVEMENT +#define MISO_MESH_MOVEMENT #include "mfem.hpp" @@ -10,7 +10,7 @@ namespace mfem class Coefficient; } // namespace mfem -namespace mach +namespace miso { class MeshMovementSolver : public AbstractSolver { @@ -93,6 +93,6 @@ class LEAnalogySolver : public MeshMovementSolver // static double MuFunc(const mfem::Vector &x, int ie); }; -} // namespace mach +} // namespace miso #endif \ No newline at end of file diff --git a/src/physics/mfem_common_integ.cpp b/src/physics/mfem_common_integ.cpp index 1c798aaf..3a2c137a 100644 --- a/src/physics/mfem_common_integ.cpp +++ b/src/physics/mfem_common_integ.cpp @@ -6,7 +6,7 @@ using namespace mfem; -namespace mach +namespace miso { void DiffusionIntegratorMeshSens::AssembleRHSElementVect( const mfem::FiniteElement &mesh_el, @@ -1498,4 +1498,4 @@ double MassResIntegrator::GetElementEnergy(const FiniteElement &elx, #endif -} // namespace mach +} // namespace miso diff --git a/src/physics/mfem_common_integ.hpp b/src/physics/mfem_common_integ.hpp index 8633e5ea..6417b094 100644 --- a/src/physics/mfem_common_integ.hpp +++ b/src/physics/mfem_common_integ.hpp @@ -1,13 +1,13 @@ -#ifndef MACH_MFEM_COMMON_INTEG -#define MACH_MFEM_COMMON_INTEG +#ifndef MISO_MFEM_COMMON_INTEG +#define MISO_MFEM_COMMON_INTEG #include "mfem.hpp" -#include "mach_integrator.hpp" +#include "miso_integrator.hpp" using namespace mfem; -namespace mach +namespace miso { class DiffusionIntegratorMeshSens final : public mfem::LinearFormIntegrator { @@ -280,7 +280,7 @@ class VectorFEDomainLFCurlIntegratorMeshSens final { public: VectorFEDomainLFCurlIntegratorMeshSens( - mach::VectorFEDomainLFCurlIntegrator &integ) + miso::VectorFEDomainLFCurlIntegrator &integ) : integ(integ), adjoint(nullptr) { } @@ -298,7 +298,7 @@ class VectorFEDomainLFCurlIntegratorMeshSens final private: /// reference to primal integrator - mach::VectorFEDomainLFCurlIntegrator &integ; + miso::VectorFEDomainLFCurlIntegrator &integ; /// the adjoint to use when evaluating d(psi^T f)/dX const mfem::GridFunction *adjoint; #ifndef MFEM_THREAD_SAFE @@ -360,7 +360,7 @@ class VectorFEBoundaryTangentLFIntegratorMeshSens final { public: VectorFEBoundaryTangentLFIntegratorMeshSens( - mach::VectorFEBoundaryTangentLFIntegrator &integ) + miso::VectorFEBoundaryTangentLFIntegrator &integ) : integ(integ), adjoint(nullptr) { } @@ -380,7 +380,7 @@ space private: /// reference to primal integrator - mach::VectorFEBoundaryTangentLFIntegrator &integ; + miso::VectorFEBoundaryTangentLFIntegrator &integ; /// the adjoint to use when evaluating d(psi^T f)/dX const mfem::GridFunction *adjoint; #ifndef MFEM_THREAD_SAFE @@ -600,6 +600,6 @@ class BoundaryNormalResIntegrator : public mfem::LinearFormIntegrator Vector &elvect) override; }; -} // namespace mach +} // namespace miso #endif \ No newline at end of file diff --git a/src/physics/miso_input.cpp b/src/physics/miso_input.cpp new file mode 100644 index 00000000..b1564bd0 --- /dev/null +++ b/src/physics/miso_input.cpp @@ -0,0 +1,30 @@ +#include "utils.hpp" +#include "miso_input.hpp" + +namespace miso +{ +double *MISOInput::getField() const +{ + if (active != Type::Field) + { + throw MISOException("Input type is not a field!\n"); + } + else + { + return input.field; + } +} + +double MISOInput::getValue() const +{ + if (active != Type::Value) + { + throw MISOException("Input type is not a value!\n"); + } + else + { + return input.value; + } +} + +} // namespace miso diff --git a/src/physics/mach_input.hpp b/src/physics/miso_input.hpp similarity index 78% rename from src/physics/mach_input.hpp rename to src/physics/miso_input.hpp index d4ddb37d..4980e7ae 100644 --- a/src/physics/mach_input.hpp +++ b/src/physics/miso_input.hpp @@ -1,23 +1,23 @@ -#ifndef MACH_INPUT -#define MACH_INPUT +#ifndef MISO_INPUT +#define MISO_INPUT #include #include -namespace mach +namespace miso { -/// Class that represents possible input variabels used when evaluating a mach +/// Class that represents possible input variabels used when evaluating a miso /// solver. Currently supported input types include either a field variable /// (array) or a scalar variable. The class is backed by a union that stores /// either the field or the scalar, and uses an enum to keep track of what type /// the union is holding. /// This class is meant to be similar in spirit to C++17's std::variant, but /// uses only C++11 features. -class MachInput +class MISOInput { public: - MachInput(double *field) : input(field), active(Type::Field) { } - MachInput(double value) : input(value), active(Type::Value) { } + MISOInput(double *field) : input(field), active(Type::Field) { } + MISOInput(double value) : input(value), active(Type::Value) { } /// access the input data double *getField() const; @@ -48,8 +48,8 @@ class MachInput }; /// Convenient shorthand for a map of inputs since each input must be named -using MachInputs = std::unordered_map; +using MISOInputs = std::unordered_map; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/miso_integrator.cpp b/src/physics/miso_integrator.cpp new file mode 100644 index 00000000..221ad753 --- /dev/null +++ b/src/physics/miso_integrator.cpp @@ -0,0 +1,39 @@ +#include + +#include "mfem.hpp" +#include "nlohmann/json.hpp" + +#include "miso_input.hpp" +#include "miso_integrator.hpp" + +namespace miso +{ +void setInputs(std::vector &integrators, + const MISOInputs &inputs) +{ + for (auto &integ : integrators) + { + setInputs(integ, inputs); + } +} + +void setInputs(MISOIntegrator &integ, const MISOInputs &inputs) +{ + integ.self_->setInputs_(inputs); +} + +void setOptions(std::vector &integrators, + const nlohmann::json &options) +{ + for (auto &integ : integrators) + { + setOptions(integ, options); + } +} + +void setOptions(MISOIntegrator &integ, const nlohmann::json &options) +{ + integ.self_->setOptions_(options); +} + +} // namespace miso diff --git a/src/physics/mach_integrator.hpp b/src/physics/miso_integrator.hpp similarity index 70% rename from src/physics/mach_integrator.hpp rename to src/physics/miso_integrator.hpp index 45c9fbf2..31cff8a8 100644 --- a/src/physics/mach_integrator.hpp +++ b/src/physics/miso_integrator.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_INTEGRATOR -#define MACH_INTEGRATOR +#ifndef MISO_INTEGRATOR +#define MISO_INTEGRATOR #include #include @@ -9,44 +9,44 @@ #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" -namespace mach +namespace miso { /// Default implementation of setInputs for a NonlinearFormIntegrator that does /// nothing but allows each child class of NonlinearFormIntegrator to be a -/// `MachIntegrator` +/// `MISOIntegrator` inline void setInputs(mfem::NonlinearFormIntegrator &integ, - const MachInputs &inputs) + const MISOInputs &inputs) { } /// Default implementation of setInputs for a LinearFormIntegrator that does /// nothing but allows each child class of LinearFormIntegrator to be a -/// `MachIntegrator` +/// `MISOIntegrator` inline void setInputs(mfem::LinearFormIntegrator &integ, - const MachInputs &inputs) + const MISOInputs &inputs) { } /// Default implementation of setOptions for a NonlinearFormIntegrator that does /// nothing but allows each child class of NonlinearFormIntegrator to be a -/// `MachIntegrator` +/// `MISOIntegrator` inline void setOptions(mfem::NonlinearFormIntegrator &integ, const nlohmann::json &options) { } /// Default implementation of setOptions for a LinearFormIntegrator that does /// nothing but allows each child class of LinearFormIntegrator to be a -/// `MachIntegrator` +/// `MISOIntegrator` inline void setOptions(mfem::LinearFormIntegrator &integ, const nlohmann::json &options) { } -/// Creates common interface for integrators used by mach -/// A MachIntegrator can wrap any type `T` that has a function -/// `setInput(T &, const std::string &, const MachInput &)` defined. +/// Creates common interface for integrators used by miso +/// A MISOIntegrator can wrap any type `T` that has a function +/// `setInput(T &, const std::string &, const MISOInput &)` defined. /// We have defined this function where `T` is a /// `mfem::NonlinearFormIntegrator` so that every nonlinear form integrator -/// can be wrapped with a MachIntegrator. This default implementation does +/// can be wrapped with a MISOIntegrator. This default implementation does /// nothing, but `setInput` can be specialized for specific integrators that /// depend on scalar or field inputs. For example, see `setInput` for /// `HybridACLossFunctionalIntegrator`. @@ -54,27 +54,27 @@ inline void setOptions(mfem::LinearFormIntegrator &integ, /// We use this class as a way to achieve polymorphism without having to modify /// `mfem::NonlinearFormIntegrator`. This approach is based on the example in /// Sean Parent's talk: ``Inheritance is the base class of evil'' -class MachIntegrator +class MISOIntegrator { public: - friend void setInputs(MachIntegrator &integ, const MachInputs &inputs); - friend void setOptions(MachIntegrator &integ, const nlohmann::json &options); + friend void setInputs(MISOIntegrator &integ, const MISOInputs &inputs); + friend void setOptions(MISOIntegrator &integ, const nlohmann::json &options); template - MachIntegrator(T &x) : self_(new model(x)) + MISOIntegrator(T &x) : self_(new model(x)) { } - MachIntegrator(const MachIntegrator &x) : self_(x.self_->copy_()) { } - MachIntegrator(MachIntegrator &&) noexcept = default; + MISOIntegrator(const MISOIntegrator &x) : self_(x.self_->copy_()) { } + MISOIntegrator(MISOIntegrator &&) noexcept = default; - MachIntegrator &operator=(const MachIntegrator &x) + MISOIntegrator &operator=(const MISOIntegrator &x) { - MachIntegrator tmp(x); + MISOIntegrator tmp(x); *this = std::move(tmp); return *this; } - MachIntegrator &operator=(MachIntegrator &&) noexcept = default; + MISOIntegrator &operator=(MISOIntegrator &&) noexcept = default; - ~MachIntegrator() = default; + ~MISOIntegrator() = default; private: class concept_t @@ -82,7 +82,7 @@ class MachIntegrator public: virtual ~concept_t() = default; virtual concept_t *copy_() const = 0; - virtual void setInputs_(const MachInputs &inputs) const = 0; + virtual void setInputs_(const MISOInputs &inputs) const = 0; virtual void setOptions_(const nlohmann::json &options) const = 0; }; @@ -92,7 +92,7 @@ class MachIntegrator public: model(T &x) : integ(x) { } concept_t *copy_() const override { return new model(*this); } - void setInputs_(const MachInputs &inputs) const override + void setInputs_(const MISOInputs &inputs) const override { setInputs(integ, inputs); } @@ -108,18 +108,18 @@ class MachIntegrator }; /// Used to set inputs in several integrators -void setInputs(std::vector &integrators, - const MachInputs &inputs); +void setInputs(std::vector &integrators, + const MISOInputs &inputs); /// Used to set inputs in the underlying integrator -void setInputs(MachIntegrator &integ, const MachInputs &inputs); +void setInputs(MISOIntegrator &integ, const MISOInputs &inputs); /// Used to set options in several integrators -void setOptions(std::vector &integrators, +void setOptions(std::vector &integrators, const nlohmann::json &options); /// Used to set options in the underlying integrator -void setOptions(MachIntegrator &integ, const nlohmann::json &options); +void setOptions(MISOIntegrator &integ, const nlohmann::json &options); /// Function meant to be specialized to allow sensitivity integrators /// to be associated with the forward version of the integrator @@ -136,6 +136,6 @@ inline void addSensitivityIntegrator( std::map &scalar_sens) { } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/mach_load.hpp b/src/physics/miso_load.hpp similarity index 73% rename from src/physics/mach_load.hpp rename to src/physics/miso_load.hpp index 9be13afd..1cc421a2 100644 --- a/src/physics/mach_load.hpp +++ b/src/physics/miso_load.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_LOAD -#define MACH_LOAD +#ifndef MISO_LOAD +#define MISO_LOAD #include #include @@ -10,47 +10,47 @@ #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" -namespace mach +namespace miso { -/// Creates common interface for load vectors used by mach -/// A MachLoad can wrap any type `T` that has the interface of a load vector. -/// We have defined this function where `T` is a `MachLinearForm` so that every -/// linear form can be wrapped with a MachLoad. +/// Creates common interface for load vectors used by miso +/// A MISOLoad can wrap any type `T` that has the interface of a load vector. +/// We have defined this function where `T` is a `MISOLinearForm` so that every +/// linear form can be wrapped with a MISOLoad. /// We use this class as a way to achieve polymorphism without needing to rely /// on inheritance This approach is based on the example in Sean Parent's talk: /// ``Inheritance is the base class of evil'' -class MachLoad final +class MISOLoad final { public: /// Used to set scalar inputs in the underlying load type - /// Ends up calling `setInputs` on either the `MachLinearForm` or + /// Ends up calling `setInputs` on either the `MISOLinearForm` or /// a specialized version for each particular load. - friend void setInputs(MachLoad &load, const MachInputs &inputs); + friend void setInputs(MISOLoad &load, const MISOInputs &inputs); /// Used to set options for the underlying load type - friend void setOptions(MachLoad &load, const nlohmann::json &options); + friend void setOptions(MISOLoad &load, const nlohmann::json &options); /// Assemble the load vector on the true dofs and add it to tv - friend void addLoad(MachLoad &load, mfem::Vector &tv); + friend void addLoad(MISOLoad &load, mfem::Vector &tv); /// Assemble the load vector's sensitivity to a scalar and contract it with /// res_bar - friend double vectorJacobianProduct(MachLoad &load, + friend double vectorJacobianProduct(MISOLoad &load, const mfem::HypreParVector &res_bar, std::string wrt); /// Assemble the load vector's sensitivity to a field and contract it with /// res_bar - friend void vectorJacobianProduct(MachLoad &load, + friend void vectorJacobianProduct(MISOLoad &load, const mfem::HypreParVector &res_bar, std::string wrt, mfem::HypreParVector &wrt_bar); template - MachLoad(T &x) : self_(new model(x)) + MISOLoad(T &x) : self_(new model(x)) { } private: @@ -58,7 +58,7 @@ class MachLoad final { public: virtual ~concept_t() = default; - virtual void setInputs_(const MachInputs &inputs) = 0; + virtual void setInputs_(const MISOInputs &inputs) = 0; virtual void setOptions_(const nlohmann::json &options) = 0; virtual void addLoad_(mfem::Vector &tv) = 0; virtual double vectorJacobianProduct_(const mfem::HypreParVector &res_bar, @@ -73,7 +73,7 @@ class MachLoad final { public: model(T &x) : data_(x) { } - void setInputs_(const MachInputs &inputs) override + void setInputs_(const MISOInputs &inputs) override { setInputs(data_, inputs); } @@ -100,29 +100,29 @@ class MachLoad final std::unique_ptr self_; }; -inline void setInputs(MachLoad &load, const MachInputs &inputs) +inline void setInputs(MISOLoad &load, const MISOInputs &inputs) { load.self_->setInputs_(inputs); } -inline void setOptions(MachLoad &load, const nlohmann::json &options) +inline void setOptions(MISOLoad &load, const nlohmann::json &options) { load.self_->setOptions_(options); } -inline void addLoad(MachLoad &load, mfem::Vector &tv) +inline void addLoad(MISOLoad &load, mfem::Vector &tv) { load.self_->addLoad_(tv); } -inline double vectorJacobianProduct(MachLoad &load, +inline double vectorJacobianProduct(MISOLoad &load, const mfem::HypreParVector &res_bar, std::string wrt) { return load.self_->vectorJacobianProduct_(res_bar, std::move(wrt)); } -inline void vectorJacobianProduct(MachLoad &load, +inline void vectorJacobianProduct(MISOLoad &load, const mfem::HypreParVector &res_bar, std::string wrt, mfem::HypreParVector &wrt_bar) @@ -130,6 +130,6 @@ inline void vectorJacobianProduct(MachLoad &load, load.self_->vectorJacobianProduct_(res_bar, std::move(wrt), wrt_bar); } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/mach_nonlinearform.cpp b/src/physics/miso_nonlinearform.cpp similarity index 68% rename from src/physics/mach_nonlinearform.cpp rename to src/physics/miso_nonlinearform.cpp index 477e4080..6ba0be2e 100644 --- a/src/physics/mach_nonlinearform.cpp +++ b/src/physics/miso_nonlinearform.cpp @@ -3,18 +3,18 @@ #include "mfem.hpp" #include "utils.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" -#include "mach_nonlinearform.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" +#include "miso_nonlinearform.hpp" -namespace mach +namespace miso { -int getSize(const MachNonlinearForm &form) +int getSize(const MISONonlinearForm &form) { return form.nf.FESpace()->GetTrueVSize(); } -void setInputs(MachNonlinearForm &form, const MachInputs &inputs) +void setInputs(MISONonlinearForm &form, const MISOInputs &inputs) { for (const auto &in : inputs) { @@ -35,13 +35,13 @@ void setInputs(MachNonlinearForm &form, const MachInputs &inputs) setInputs(form.integs, inputs); } -void setOptions(MachNonlinearForm &form, const nlohmann::json &options) +void setOptions(MISONonlinearForm &form, const nlohmann::json &options) { setOptions(form.integs, options); } -void evaluate(MachNonlinearForm &form, - const MachInputs &inputs, +void evaluate(MISONonlinearForm &form, + const MISOInputs &inputs, mfem::Vector &res_vec) { auto *pfes = form.nf.ParFESpace(); @@ -49,8 +49,8 @@ void evaluate(MachNonlinearForm &form, form.nf.Mult(state, res_vec); } -mfem::Operator &getJacobian(MachNonlinearForm &form, - const MachInputs &inputs, +mfem::Operator &getJacobian(MISONonlinearForm &form, + const MISOInputs &inputs, std::string wrt) { auto *pfes = form.nf.ParFESpace(); @@ -58,4 +58,4 @@ mfem::Operator &getJacobian(MachNonlinearForm &form, return form.nf.GetGradient(state); } -} // namespace mach \ No newline at end of file +} // namespace miso \ No newline at end of file diff --git a/src/physics/mach_nonlinearform.hpp b/src/physics/miso_nonlinearform.hpp similarity index 71% rename from src/physics/mach_nonlinearform.hpp rename to src/physics/miso_nonlinearform.hpp index 242b4019..ae9d4439 100644 --- a/src/physics/mach_nonlinearform.hpp +++ b/src/physics/miso_nonlinearform.hpp @@ -1,48 +1,48 @@ -#ifndef MACH_NONLINEAR_FORM -#define MACH_NONLINEAR_FORM +#ifndef MISO_NONLINEAR_FORM +#define MISO_NONLINEAR_FORM #include #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" -namespace mach +namespace miso { -class MachNonlinearForm final +class MISONonlinearForm final { public: /// Get the size of the nonlinear form (number of equations/unknowns) - friend int getSize(const MachNonlinearForm &form); + friend int getSize(const MISONonlinearForm &form); /// Set inputs in all integrators used by the nonlinear form - friend void setInputs(MachNonlinearForm &form, const MachInputs &inputs); + friend void setInputs(MISONonlinearForm &form, const MISOInputs &inputs); - friend void setOptions(MachNonlinearForm &form, + friend void setOptions(MISONonlinearForm &form, const nlohmann::json &options); /// Evaluate the nonlinear form using `inputs` and return result in `res_vec` - friend void evaluate(MachNonlinearForm &form, - const MachInputs &inputs, + friend void evaluate(MISONonlinearForm &form, + const MISOInputs &inputs, mfem::Vector &res_vec); /// Compute Jacobian of `form` with respect to `wrt` and return - friend mfem::Operator &getJacobian(MachNonlinearForm &form, - const MachInputs &inputs, + friend mfem::Operator &getJacobian(MISONonlinearForm &form, + const MISOInputs &inputs, std::string wrt); /// Adds the given domain integrator to the nonlinear form /// \param[in] integrator - nonlinear form integrator for domain - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator template void addDomainIntegrator(T *integrator); /// Adds the given boundary face integrator to the nonlinear form /// \param[in] integrator - face nonlinear form integrator for boundary - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator template void addBdrFaceIntegrator(T *integrator); @@ -51,7 +51,7 @@ class MachNonlinearForm final /// attributes. /// \param[in] integrator - face nonlinear form integrator for boundary /// \param[in] bdr_attr_marker - boundary attributes for integrator - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator /// \note The array bdr_attr_marker is copied template @@ -59,7 +59,7 @@ class MachNonlinearForm final /// Adds the given interior face integrator to the nonlinear form /// \param[in] integrator - face nonlinear form integrator for interfaces - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator /// \note Assumes ownership of integrator template void addInteriorFaceIntegrator(T *integrator); @@ -67,7 +67,7 @@ class MachNonlinearForm final /// Constructor for nonlinear form types /// \param[in] pfes - FEM space for the state (and possibly the adjoint) /// \param[in] fields - map of grid functions - MachNonlinearForm( + MISONonlinearForm( mfem::ParFiniteElementSpace &pfes, std::unordered_map &fields) : nf(&pfes), scratch(&pfes), nf_fields(&fields) @@ -85,7 +85,7 @@ class MachNonlinearForm final mfem::HypreParVector scratch; /// Collection of integrators to be applied. - std::vector integs; + std::vector integs; /// Collection of boundary markers for boundary integrators std::vector> bdr_markers; @@ -101,44 +101,44 @@ class MachNonlinearForm final }; template -void MachNonlinearForm::addDomainIntegrator(T *integrator) +void MISONonlinearForm::addDomainIntegrator(T *integrator) { integs.emplace_back(*integrator); nf.AddDomainIntegrator(integrator); - // mach::addSensitivityIntegrator(*integrator, *nf_fields, sens, + // miso::addSensitivityIntegrator(*integrator, *nf_fields, sens, // scalar_sens); } template -void MachNonlinearForm::addBdrFaceIntegrator(T *integrator) +void MISONonlinearForm::addBdrFaceIntegrator(T *integrator) { integs.emplace_back(*integrator); nf.AddBdrFaceIntegrator(integrator); - // mach::addSensitivityIntegrator(*integrator, *nf_fields, sens, + // miso::addSensitivityIntegrator(*integrator, *nf_fields, sens, // scalar_sens); } template -void MachNonlinearForm::addBdrFaceIntegrator(T *integrator, +void MISONonlinearForm::addBdrFaceIntegrator(T *integrator, std::vector bdr_attr_marker) { integs.emplace_back(*integrator); bdr_markers.emplace_back(bdr_attr_marker.size()); bdr_markers.back().Assign(bdr_attr_marker.data()); nf.AddBdrFaceIntegrator(integrator, bdr_markers.back()); - // mach::addSensitivityIntegrator(*integrator, *nf_fields, sens, + // miso::addSensitivityIntegrator(*integrator, *nf_fields, sens, // scalar_sens); } template -void MachNonlinearForm::addInteriorFaceIntegrator(T *integrator) +void MISONonlinearForm::addInteriorFaceIntegrator(T *integrator) { integs.emplace_back(*integrator); nf.AddInteriorFaceIntegrator(integrator); - // mach::addSensitivityIntegrator(*integrator, *nf_fields, sens, + // miso::addSensitivityIntegrator(*integrator, *nf_fields, sens, // scalar_sens); } -} // namespace mach +} // namespace miso -#endif // MACH_NONLINEAR_FORM \ No newline at end of file +#endif // MISO_NONLINEAR_FORM \ No newline at end of file diff --git a/src/physics/physics.hpp b/src/physics/physics.hpp index 760f6a92..01a225b9 100644 --- a/src/physics/physics.hpp +++ b/src/physics/physics.hpp @@ -1,13 +1,13 @@ -#ifndef MACH_PHYSICS -#define MACH_PHYSICS +#ifndef MISO_PHYSICS +#define MISO_PHYSICS #include "electromagnetics/electromagnetics.hpp" #include "fluidflow/fluidflow.hpp" #include "thermal/thermal.hpp" #include "joule/joule.hpp" #include "diag_mass_integ.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" #include "solver.hpp" #endif \ No newline at end of file diff --git a/src/physics/solver.cpp b/src/physics/solver.cpp index 9267da90..2200151a 100644 --- a/src/physics/solver.cpp +++ b/src/physics/solver.cpp @@ -33,9 +33,9 @@ #include "evolver.hpp" #include "diag_mass_integ.hpp" #include "material_library.hpp" -#include "mach_input.hpp" -#include "mach_integrator.hpp" -#include "mach_load.hpp" +#include "miso_input.hpp" +#include "miso_integrator.hpp" +#include "miso_load.hpp" #include "solver.hpp" #ifdef MFEM_USE_EGADS @@ -45,7 +45,7 @@ using namespace std; using namespace mfem; -namespace mach +namespace miso { adept::Stack AbstractSolver::diff_stack; @@ -141,7 +141,7 @@ void AbstractSolver::initBase(const nlohmann::json &file_options, } else { - throw MachException( + throw MISOException( "Unknown ODE solver type " + options["time-dis"]["ode-solver"].template get()); // TODO: parallel exit @@ -315,7 +315,7 @@ void AbstractSolver::constructMesh(unique_ptr smesh) } else { - throw MachException( + throw MISOException( "AbstractSolver::constructMesh(smesh)\n" "\tMesh file has no extension!\n"); } @@ -466,7 +466,7 @@ void AbstractSolver::constructPumiMesh() // Apply the attributes mesh->SetAttributes(); #else - throw MachException( + throw MISOException( "AbstractSolver::constructPumiMesh()\n" "\tMFEM was not built with PUMI!\n" "\trecompile MFEM with PUMI\n"); @@ -803,7 +803,7 @@ double AbstractSolver::calcResidualNorm() const } double AbstractSolver::calcResidualNorm(const ParGridFunction &state) const { - MachInputs inputs{{"state", state.GetTrueVector().GetData()}}; + MISOInputs inputs{{"state", state.GetTrueVector().GetData()}}; calcResidual(inputs, *scratch_tv); return std::sqrt(InnerProduct(comm, *scratch_tv, *scratch_tv)); @@ -879,17 +879,17 @@ void AbstractSolver::calcResidual(const ParGridFunction &state, delete r_true; } -void AbstractSolver::calcResidual(const MachInputs &inputs, +void AbstractSolver::calcResidual(const MISOInputs &inputs, double *res_buffer) const { auto residual = bufferToHypreParVector(res_buffer, *fes); calcResidual(inputs, residual); } -void AbstractSolver::calcResidual(const MachInputs &inputs, +void AbstractSolver::calcResidual(const MISOInputs &inputs, HypreParVector &residual) const { - // setInputs(*res, inputs); // once I've added MachNonlinearForm + // setInputs(*res, inputs); // once I've added MISONonlinearForm /// this approach would require communication twice, once to set the tdofs /// and then again inside of res->Mult @@ -907,17 +907,17 @@ void AbstractSolver::calcResidual(const MachInputs &inputs, if (load) { - mach::setInputs(*load, inputs); - mach::addLoad(*load, residual); + miso::setInputs(*load, inputs); + miso::addLoad(*load, residual); } } -void AbstractSolver::linearize(const MachInputs &inputs) +void AbstractSolver::linearize(const MISOInputs &inputs) { setInputs(res_integrators, inputs); if (load) { - mach::setInputs(*load, inputs); + miso::setInputs(*load, inputs); } /// something like this... @@ -942,7 +942,7 @@ double AbstractSolver::vectorJacobianProduct(const HypreParVector &res_bar, } if (load) { - wrt_bar += mach::vectorJacobianProduct(*load, res_bar, wrt); + wrt_bar += miso::vectorJacobianProduct(*load, res_bar, wrt); } return wrt_bar; } @@ -1058,7 +1058,7 @@ void AbstractSolver::printFields(const std::string &file_name, { if (fields.size() != names.size()) { - throw MachException( + throw MISOException( "Must supply a name for each grid function to print!"); } ParaViewDataCollection paraview_dc(file_name, mesh.get()); @@ -1128,7 +1128,7 @@ void AbstractSolver::solveForState(ParGridFunction &state) } } -void AbstractSolver::solveForState(const MachInputs &inputs, +void AbstractSolver::solveForState(const MISOInputs &inputs, double *state_buffer) { HypreParVector state(fes->GetComm(), @@ -1139,13 +1139,13 @@ void AbstractSolver::solveForState(const MachInputs &inputs, solveForState(inputs, state); } -void AbstractSolver::solveForState(const MachInputs &inputs, +void AbstractSolver::solveForState(const MISOInputs &inputs, mfem::HypreParVector &state) { - // mach::setInputs(*res, inputs); + // miso::setInputs(*res, inputs); if (load) { - mach::setInputs(*load, inputs); + miso::setInputs(*load, inputs); } auto &state_gf = res_fields.at("state"); @@ -1222,7 +1222,7 @@ void AbstractSolver::removeInternalBoundaries() } else { - throw MachException("Unrecognized entry for keep-bndrys!\n"); + throw MISOException("Unrecognized entry for keep-bndrys!\n"); } } else if (prob_opts.contains("keep-bndrys-adj-to")) @@ -1309,7 +1309,7 @@ void AbstractSolver::setUpExternalFields() } else { - throw MachException("Unrecognized basis type: " + basis + + throw MISOException("Unrecognized basis type: " + basis + "!\n" "Known types are:\n" "\tH1\n" @@ -1737,7 +1737,7 @@ unique_ptr AbstractSolver::constructLinearSolver( } else { - throw MachException( + throw MISOException( "Unsupported iterative solver type!\n" "\tavilable options are: hypregmres, gmres, hyprefgmres,\n" "\thyprepcg, pcg, minres"); @@ -1795,7 +1795,7 @@ unique_ptr AbstractSolver::constructPreconditioner( } else { - throw MachException( + throw MISOException( "Unsupported preconditioner type!\n" "\tavilable options are: HypreEuclid, HypreILU, HypreAMS," " HypreBoomerAMG.\n"); @@ -1832,7 +1832,7 @@ unique_ptr AbstractSolver::constructNonlinearSolver( } else { - throw MachException( + throw MISOException( "Unsupported nonlinear solver type!\n" "\tavilable options are: newton, inexactnewton\n"); } @@ -1850,7 +1850,7 @@ unique_ptr AbstractSolver::constructNonlinearSolver( void AbstractSolver::constructEvolver() { bool newton_abort = options["nonlin-solver"]["abort"].get(); - evolver.reset(new MachEvolver(ess_bdr, + evolver.reset(new MISOEvolver(ess_bdr, nonlinear_mass.get(), mass.get(), res.get(), @@ -1866,7 +1866,7 @@ void AbstractSolver::constructEvolver() void AbstractSolver::solveUnsteadyAdjoint(const std::string &fun) { - throw MachException( + throw MISOException( "AbstractSolver::solveUnsteadyAdjoint(fun)\n" "\tnot implemented yet!"); } @@ -1886,7 +1886,7 @@ void AbstractSolver::createOutput(const std::string &fun, } else { - throw MachException("Output with name " + fun + " already created!\n"); + throw MISOException("Output with name " + fun + " already created!\n"); } } @@ -1898,9 +1898,9 @@ void AbstractSolver::setOutputOptions(const std::string &fun, auto output = outputs.find(fun); if (output == outputs.end()) { - throw MachException("Did not find " + fun + " in output map?"); + throw MISOException("Did not find " + fun + " in output map?"); } - mach::setOptions(output->second, options); + miso::setOptions(output->second, options); } catch (const std::out_of_range &exception) { @@ -1914,22 +1914,22 @@ double AbstractSolver::calcOutput(const ParGridFunction &state, HypreParVector state_true(fes.get()); state.GetTrueDofs(state_true); - MachInputs inputs{{"state", state_true.GetData()}}; + MISOInputs inputs{{"state", state_true.GetData()}}; return calcOutput(fun, inputs); } double AbstractSolver::calcOutput(const std::string &fun, - const MachInputs &inputs) + const MISOInputs &inputs) { try { auto output = outputs.find(fun); if (output == outputs.end()) { - throw MachException("Did not find " + fun + " in output map?"); + throw MISOException("Did not find " + fun + " in output map?"); } - mach::setInputs(output->second, inputs); - return mach::calcOutput(output->second, inputs); + miso::setInputs(output->second, inputs); + return miso::calcOutput(output->second, inputs); } catch (const std::out_of_range &exception) { @@ -1940,7 +1940,7 @@ double AbstractSolver::calcOutput(const std::string &fun, void AbstractSolver::calcOutputPartial(const std::string &of, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, double &partial) { try @@ -1948,9 +1948,9 @@ void AbstractSolver::calcOutputPartial(const std::string &of, auto output = outputs.find(of); if (output == outputs.end()) { - throw MachException("Did not find " + of + " in output map?"); + throw MISOException("Did not find " + of + " in output map?"); } - double part = mach::calcOutputPartial(output->second, wrt, inputs); + double part = miso::calcOutputPartial(output->second, wrt, inputs); partial += part; } catch (const std::out_of_range &exception) @@ -1962,7 +1962,7 @@ void AbstractSolver::calcOutputPartial(const std::string &of, void AbstractSolver::calcOutputPartial(const std::string &of, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, double *partial_buffer) { /// get FESpace for field we're taking partial with respect to @@ -1976,7 +1976,7 @@ void AbstractSolver::calcOutputPartial(const std::string &of, void AbstractSolver::calcOutputPartial(const std::string &of, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, HypreParVector &partial) { try @@ -1984,9 +1984,9 @@ void AbstractSolver::calcOutputPartial(const std::string &of, auto output = outputs.find(of); if (output == outputs.end()) { - throw MachException("Did not find " + of + " in output map?"); + throw MISOException("Did not find " + of + " in output map?"); } - mach::calcOutputPartial(output->second, wrt, inputs, partial); + miso::calcOutputPartial(output->second, wrt, inputs, partial); } catch (const std::out_of_range &exception) { @@ -2126,4 +2126,4 @@ void AbstractSolver::checkJacobian(void (*pert_fun)(const mfem::Vector &, *out << "The Jacobian product error norm is " << sqrt(error) << endl; } -} // namespace mach +} // namespace miso diff --git a/src/physics/solver.hpp b/src/physics/solver.hpp index 7c01a6e4..91451f77 100644 --- a/src/physics/solver.hpp +++ b/src/physics/solver.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_SOLVER -#define MACH_SOLVER +#ifndef MISO_SOLVER +#define MISO_SOLVER #include #include @@ -10,11 +10,11 @@ #include "mfem.hpp" #include "nlohmann/json.hpp" -#include "mach_integrator.hpp" -#include "mach_input.hpp" -#include "mach_output.hpp" -#include "mach_residual.hpp" -#include "mach_types.hpp" +#include "miso_integrator.hpp" +#include "miso_input.hpp" +#include "miso_output.hpp" +#include "miso_residual.hpp" +#include "miso_types.hpp" #include "utils.hpp" #ifdef MFEM_USE_PUMI @@ -31,7 +31,7 @@ class Mesh2; #ifdef MFEM_USE_EGADS #include "gmi_egads.h" #endif // MFEM_USE_EGADS -namespace mach +namespace miso { struct pumiDeleter { @@ -42,13 +42,13 @@ struct pumiDeleter } }; -} // namespace mach +} // namespace miso #endif -namespace mach +namespace miso { -class MachEvolver; -class MachLoad; +class MISOEvolver; +class MISOLoad; /// Serves as a base class for specific PDE solvers class AbstractSolver @@ -370,19 +370,19 @@ class AbstractSolver inline virtual void solveForState(double *state) { - MachInputs inputs; + MISOInputs inputs; solveForState(inputs, state); } inline virtual void solveForState(mfem::HypreParVector &state) { - MachInputs inputs; + MISOInputs inputs; solveForState(inputs, state); } - virtual void solveForState(const MachInputs &inputs, double *state); + virtual void solveForState(const MISOInputs &inputs, double *state); - virtual void solveForState(const MachInputs &inputs, + virtual void solveForState(const MISOInputs &inputs, mfem::HypreParVector &state); /// Solve for the adjoint based on current mesh, solver, etc. @@ -442,7 +442,7 @@ class AbstractSolver /// \param[in] inputs - collection of field or scalar inputs to set before /// evaluating functional /// \return scalar value of estimated functional value - double calcOutput(const std::string &fun, const MachInputs &inputs); + double calcOutput(const std::string &fun, const MISOInputs &inputs); /// Evaluates and returns the partial derivative of output functional /// specifed by `of` with respect to the input specified by `wrt` @@ -453,7 +453,7 @@ class AbstractSolver /// \param[out] partial - the partial with respect to a scalar-valued input void calcOutputPartial(const std::string &of, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, double &partial); /// Evaluates and returns the partial derivative of output functional @@ -465,7 +465,7 @@ class AbstractSolver /// \param[out] partial - the partial with respect to a vector-valued input void calcOutputPartial(const std::string &of, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, double *partial); /// Evaluates and returns the partial derivative of output functional @@ -477,7 +477,7 @@ class AbstractSolver /// \param[out] partial - the partial with respect to a vector-valued input void calcOutputPartial(const std::string &of, const std::string &wrt, - const MachInputs &inputs, + const MISOInputs &inputs, mfem::HypreParVector &partial); /// Compute the residual norm based on the current solution in `u` @@ -518,17 +518,17 @@ class AbstractSolver /// \param[in] inputs - collection of field or scalar inputs to set before /// evaluating residual /// \param[out] residual - the residual - void calcResidual(const MachInputs &inputs, double *res_buffer) const; + void calcResidual(const MISOInputs &inputs, double *res_buffer) const; /// Compute the residual based on inputs and store the it in `residual` /// \param[in] inputs - collection of field or scalar inputs to set before /// evaluating residual /// \param[out] residual - the residual - void calcResidual(const MachInputs &inputs, + void calcResidual(const MISOInputs &inputs, mfem::HypreParVector &residual) const; /// Set inputs for residual integrators and assemble state jacobian - void linearize(const MachInputs &inputs); + void linearize(const MISOInputs &inputs); /// Compute vector jacobian product for derivative with respect to a scalar /// \param[in] residual_bar - multiplies jacobian on the left hand side @@ -707,11 +707,11 @@ class AbstractSolver /// the spatial residual (a semilinear form) std::unique_ptr res; /// the spatial residual /* only for demonstration */ - std::unique_ptr new_res; + std::unique_ptr new_res; /// the stiffness matrix bilinear form std::unique_ptr stiff; /// the load vector linear form - std::unique_ptr load; + std::unique_ptr load; /// entropy/energy that is needed for RRK methods std::unique_ptr ent; @@ -723,7 +723,7 @@ class AbstractSolver /// variables std::map ext_tvs; /// collection of integrators for the residual - std::vector res_integrators; + std::vector res_integrators; /// map of linear forms that will compute /// \psi^T \frac{\partial R}{\partial field} /// for each field the residual depends on @@ -741,7 +741,7 @@ class AbstractSolver /// time-marching method (might be NULL) std::unique_ptr ode_solver; /// the operator used for time-marching ODEs - std::unique_ptr evolver; + std::unique_ptr evolver; /// newton solver for the steady problem std::unique_ptr newton_solver; @@ -762,7 +762,7 @@ class AbstractSolver std::vector> bndry_marker; /// map of outputs - std::map outputs; + std::map outputs; //-------------------------------------------------------------------------- @@ -934,45 +934,45 @@ class AbstractSolver MPI_Comm comm = MPI_COMM_WORLD); /// Adds domain integrator to the nonlinear form for `fun`, and adds - /// reference to it to in fun_integrators as a MachIntegrator + /// reference to it to in fun_integrators as a MISOIntegrator /// \param[in] fun - specifies the desired functional /// \param[in] integrator - integrator to add to functional - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addResidualDomainIntegrator(T *integrator) { res->AddDomainIntegrator(integrator); res_integrators.emplace_back(*integrator); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, res_fields, res_sens, res_scalar_sens); } /// Adds interface integrator to the nonlinear form for `fun`, and adds - /// reference to it to in fun_integrators as a MachIntegrator + /// reference to it to in fun_integrators as a MISOIntegrator /// \param[in] fun - specifies the desired functional /// \param[in] integrator - integrator to add to functional - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addResidualInteriorFaceIntegrator(T *integrator) { res->AddInteriorFaceIntegrator(integrator); res_integrators.emplace_back(*integrator); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, res_fields, res_sens, res_scalar_sens); } /// Adds boundary integrator to the nonlinear form for `fun`, and adds - /// reference to it to in fun_integrators as a MachIntegrator + /// reference to it to in fun_integrators as a MISOIntegrator /// \param[in] fun - specifies the desired functional /// \param[in] integrator - integrator to add to functional - /// \tparam T - type of integrator, used for constructing MachIntegrator + /// \tparam T - type of integrator, used for constructing MISOIntegrator template void addResidualBdrFaceIntegrator(T *integrator, mfem::Array &bdr_marker) { res->AddBdrFaceIntegrator(integrator, bdr_marker); res_integrators.emplace_back(*integrator); - mach::addSensitivityIntegrator( + miso::addSensitivityIntegrator( *integrator, res_fields, res_sens, res_scalar_sens); } @@ -1020,6 +1020,6 @@ SolverPtr createSolver(const std::string &opt_file_name, return createSolver(json_options, move(smesh), comm); } -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/thermal/CMakeLists.txt b/src/physics/thermal/CMakeLists.txt index 43bb77cf..27ba2749 100644 --- a/src/physics/thermal/CMakeLists.txt +++ b/src/physics/thermal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(mach +target_sources(miso PRIVATE thermal.cpp thermal.hpp @@ -9,7 +9,7 @@ target_sources(mach thermal_verify.cpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/physics/thermal/temp_integ.cpp b/src/physics/thermal/temp_integ.cpp index 863b92ae..6e13834f 100644 --- a/src/physics/thermal/temp_integ.cpp +++ b/src/physics/thermal/temp_integ.cpp @@ -4,7 +4,7 @@ using namespace mfem; using namespace std; -namespace mach +namespace miso { double AggregateIntegratorNumerator::GetElementEnergy( const FiniteElement &el, @@ -481,4 +481,4 @@ void TempResIntegrator::AssembleElementVector(const mfem::FiniteElement &elx, } } -} // namespace mach +} // namespace miso diff --git a/src/physics/thermal/temp_integ.hpp b/src/physics/thermal/temp_integ.hpp index 8c9b9ee3..1bf68e39 100644 --- a/src/physics/thermal/temp_integ.hpp +++ b/src/physics/thermal/temp_integ.hpp @@ -1,10 +1,10 @@ -#ifndef MACH_TEMP_INTEGRATOR -#define MACH_TEMP_INTEGRATOR +#ifndef MISO_TEMP_INTEGRATOR +#define MISO_TEMP_INTEGRATOR #include "mfem.hpp" #include "solver.hpp" -namespace mach +namespace miso { class AggregateIntegratorNumerator : public mfem::NonlinearFormIntegrator { @@ -260,6 +260,6 @@ class TempResIntegrator : public mfem::NonlinearFormIntegrator #endif }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/thermal/therm_integ.cpp b/src/physics/thermal/therm_integ.cpp index 3bc9a03b..740e80ee 100644 --- a/src/physics/thermal/therm_integ.cpp +++ b/src/physics/thermal/therm_integ.cpp @@ -7,7 +7,7 @@ // using namespace mfem; -// namespace mach +// namespace miso // { // void InteriorBoundaryOutFluxInteg::AssembleFaceVector( @@ -255,6 +255,6 @@ // } // } -// } // namespace mach +// } // namespace miso // #endif diff --git a/src/physics/thermal/therm_integ.hpp b/src/physics/thermal/therm_integ.hpp index d473ac59..b6d16db5 100644 --- a/src/physics/thermal/therm_integ.hpp +++ b/src/physics/thermal/therm_integ.hpp @@ -1,5 +1,5 @@ -// #ifndef MACH_THERM_INTEG -// #define MACH_THERM_INTEG +// #ifndef MISO_THERM_INTEG +// #define MISO_THERM_INTEG // #ifdef MFEM_USE_PUMI // #include @@ -7,7 +7,7 @@ // #include "mfem.hpp" // #include "apfMDS.h" -// namespace mach +// namespace miso // { // class InteriorBoundaryOutFluxInteg : public mfem::BilinearFormIntegrator @@ -47,7 +47,7 @@ // mfem::DenseMatrix &elmat) override; // }; -// } // namespace mach +// } // namespace miso // #endif diff --git a/src/physics/thermal/thermal.cpp b/src/physics/thermal/thermal.cpp index 11b1310a..510a4d85 100644 --- a/src/physics/thermal/thermal.cpp +++ b/src/physics/thermal/thermal.cpp @@ -8,8 +8,8 @@ #include "thermal.hpp" #include "utils.hpp" -#include "mach_load.hpp" -#include "mach_linearform.hpp" +#include "miso_load.hpp" +#include "miso_linearform.hpp" using namespace std; using namespace mfem; @@ -35,7 +35,7 @@ void test_flux_func(const Vector &x, double time, Vector &y) } // anonymous namespace -namespace mach +namespace miso { ThermalSolver::ThermalSolver(const nlohmann::json &options, std::unique_ptr smesh, @@ -441,7 +441,7 @@ void ThermalSolver::constructConvection() } else { - throw MachException( + throw MISOException( "Using convection boundary condition without" "specifying heat transfer coefficient!\n"); } @@ -654,8 +654,8 @@ void ThermalSolver::constructForms() { mass.reset(new BilinearFormType(fes.get())); res.reset(new ParNonlinearForm(fes.get())); - therm_load.reset(new MachLinearForm(*fes, res_fields)); - load.reset(new MachLoad(*therm_load)); + therm_load.reset(new MISOLinearForm(*fes, res_fields)); + load.reset(new MISOLoad(*therm_load)); } void ThermalSolver::addMassIntegrators(double alpha) @@ -715,7 +715,7 @@ void ThermalSolver::addLoadBoundaryIntegrators(double alpha) { // auto *load_lf = dynamic_cast(load.get()); // if (!load_lf) - // throw MachException("Couldn't cast load to LinearFormType!\n"); + // throw MISOException("Couldn't cast load to LinearFormType!\n"); /// determine type of flux function auto &bcs = options["bcs"]; @@ -731,12 +731,12 @@ void ThermalSolver::addLoadBoundaryIntegrators(double alpha) } else { - throw MachException("Specified flux function not supported!\n"); + throw MISOException("Specified flux function not supported!\n"); } } else { - throw MachException( + throw MISOException( "Must specify outflux type if using outflux " "boundary conditions!"); } @@ -767,11 +767,11 @@ void ThermalSolver::constructEvolver() ThermalEvolver::ThermalEvolver(Array ess_bdr, BilinearFormType *mass, ParNonlinearForm *res, - MachLoad *load, + MISOLoad *load, std::ostream &outstream, double start_time, VectorCoefficient *_flux_coeff) - : MachEvolver(ess_bdr, + : MISOEvolver(ess_bdr, nullptr, mass, res, @@ -788,11 +788,11 @@ void ThermalEvolver::Mult(const mfem::Vector &x, mfem::Vector &y) const if (flux_coeff != nullptr) { flux_coeff->SetTime(t); - MachInputs inputs({{"time", t}}); + MISOInputs inputs({{"time", t}}); setInputs(*load, inputs); } - MachEvolver::Mult(x, y); + MISOEvolver::Mult(x, y); } void ThermalEvolver::ImplicitSolve(const double dt, const Vector &x, Vector &k) @@ -801,11 +801,11 @@ void ThermalEvolver::ImplicitSolve(const double dt, const Vector &x, Vector &k) if (flux_coeff != nullptr) { flux_coeff->SetTime(t); - MachInputs inputs({{"time", t}}); + MISOInputs inputs({{"time", t}}); setInputs(*load, inputs); } - MachEvolver::ImplicitSolve(dt, x, k); + MISOEvolver::ImplicitSolve(dt, x, k); } -} // namespace mach +} // namespace miso diff --git a/src/physics/thermal/thermal.hpp b/src/physics/thermal/thermal.hpp index ace79c4f..b72ae787 100644 --- a/src/physics/thermal/thermal.hpp +++ b/src/physics/thermal/thermal.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_THERMAL -#define MACH_THERMAL +#ifndef MISO_THERMAL +#define MISO_THERMAL #include "mfem.hpp" #include "adept.h" @@ -15,10 +15,10 @@ #include #include -namespace mach +namespace miso { -class MachLoad; -class MachLinearForm; +class MISOLoad; +class MISOLinearForm; class ThermalSolver : public AbstractSolver { @@ -73,7 +73,7 @@ class ThermalSolver : public AbstractSolver private: /// linear form object that allows setting inputs/assembling - std::unique_ptr therm_load; + std::unique_ptr therm_load; /// Magnetic vector potential A grid function (not owned) GridFunType *a_field; @@ -195,13 +195,13 @@ class ThermalSolver : public AbstractSolver MPI_Comm comm); }; -class ThermalEvolver : public MachEvolver +class ThermalEvolver : public MISOEvolver { public: ThermalEvolver(mfem::Array ess_bdr, BilinearFormType *mass, mfem::ParNonlinearForm *res, - MachLoad *load, + MISOLoad *load, std::ostream &outstream, double start_time, mfem::VectorCoefficient *flux_coeff); @@ -216,6 +216,6 @@ class ThermalEvolver : public MachEvolver mfem::VectorCoefficient *flux_coeff; }; -} // namespace mach +} // namespace miso #endif diff --git a/src/physics/thermal/thermal_verify.cpp b/src/physics/thermal/thermal_verify.cpp index b12e9936..aedb1ee0 100644 --- a/src/physics/thermal/thermal_verify.cpp +++ b/src/physics/thermal/thermal_verify.cpp @@ -6,7 +6,7 @@ // using namespace std; // using namespace mfem; -// namespace mach +// namespace miso // { // static std::default_random_engine gen(std::random_device{}()); diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index ba9c0f3f..a17c3a58 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1,17 +1,17 @@ -target_sources(mach +target_sources(miso PRIVATE div_free_projector.cpp div_free_projector.hpp irrotational_projector.cpp irrotational_projector.hpp kdtree.hpp - mach_types.hpp + miso_types.hpp utilities.hpp utils.cpp utils.hpp ) -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/utils/EGADS/CMakeLists.txt b/src/utils/EGADS/CMakeLists.txt index 5c17830b..7b136920 100644 --- a/src/utils/EGADS/CMakeLists.txt +++ b/src/utils/EGADS/CMakeLists.txt @@ -2,31 +2,31 @@ if (MFEM_USE_EGADS) option(EGADS_LITE "Enable EGADSlite" OFF) # this file brings EGADS_LITE from CMake to C++ -# configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mach_egads_config.hpp.in" -# "${CMAKE_CURRENT_BINARY_DIR}/mach_egads_config.hpp") +# configure_file("${CMAKE_CURRENT_SOURCE_DIR}/miso_egads_config.hpp.in" +# "${CMAKE_CURRENT_BINARY_DIR}/miso_egads_config.hpp") -target_sources(mach +target_sources(miso PRIVATE - mach_egads.cpp - mach_egads.hpp + miso_egads.cpp + miso_egads.hpp ) -#add_library(mach_egads ${SOURCES}) +#add_library(miso_egads ${SOURCES}) -target_link_libraries(mach PUBLIC ${EGADS_LIBRARIES}) +target_link_libraries(miso PUBLIC ${EGADS_LIBRARIES}) # Include directories -target_include_directories(mach +target_include_directories(miso PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${EGADS_INCLUDE_DIR})" ) # make sure the compiler can find the config header -#target_include_directories(mach PRIVATE +#target_include_directories(miso PRIVATE # $) -# mach_export_library(mach_egads) +# miso_export_library(miso_egads) endif (MFEM_USE_EGADS) \ No newline at end of file diff --git a/src/utils/EGADS/mach_egads.cpp b/src/utils/EGADS/mach_egads.cpp index f17ca420..4cfaf573 100644 --- a/src/utils/EGADS/mach_egads.cpp +++ b/src/utils/EGADS/mach_egads.cpp @@ -7,11 +7,11 @@ #include "egads.h" #endif -#include "mach_egads.hpp" +#include "miso_egads.hpp" using namespace mfem; -namespace mach +namespace miso { void mapSurfaceMesh(const std::string &old_model_file, const std::string &new_model_file, @@ -135,7 +135,7 @@ void mapSurfaceMesh(const std::string &old_model_file, } #else throw std::runtime_error( - "Mach not built with EGADS support!\n" + "MISO not built with EGADS support!\n" "\tmapSurfaceMesh unavailable!\n"); #endif } @@ -214,7 +214,7 @@ void mapSurfaceMesh(const std::string &old_model_file, // int error2 = EG_getGlobal(newtess, global, &ptype, &pindex, // s_coords); if (error2 != 0) // { -// //throw MachException("getNewBoundaryNodes()\n Failed to +// //throw MISOException("getNewBoundaryNodes()\n Failed to // retrieve new coordinates at node "<< global <<"!"); // } // disp(0) = s_coords[0] - xold.x(); @@ -225,7 +225,7 @@ void mapSurfaceMesh(const std::string &old_model_file, // } // else // { -// //throw MachException("getNewBoundaryNodes()\n Remap of boundary nodes +// //throw MISOException("getNewBoundaryNodes()\n Remap of boundary nodes // has failed!"); // } @@ -276,4 +276,4 @@ void mapSurfaceMesh(const std::string &old_model_file, // } // #endif -} // namespace mach +} // namespace miso diff --git a/src/utils/EGADS/mach_egads.hpp b/src/utils/EGADS/mach_egads.hpp index 20aa7f88..436cbb02 100644 --- a/src/utils/EGADS/mach_egads.hpp +++ b/src/utils/EGADS/mach_egads.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_EGADS -#define MACH_EGADS +#ifndef MISO_EGADS +#define MISO_EGADS #include @@ -8,12 +8,12 @@ namespace mfem class HypreParVector; } // namespace mfem -namespace mach +namespace miso { void mapSurfaceMesh(const std::string &old_model_file, const std::string &new_model_file, const std::string &tess_file, mfem::HypreParVector &displacement); -} // namespace mach +} // namespace miso #endif diff --git a/src/utils/div_free_projector.cpp b/src/utils/div_free_projector.cpp index 7cbf9efc..4fbc6981 100644 --- a/src/utils/div_free_projector.cpp +++ b/src/utils/div_free_projector.cpp @@ -2,9 +2,9 @@ using namespace mfem; -namespace mach +namespace miso { -void setInputs(DivergenceFreeProjector &op, const MachInputs &inputs) +void setInputs(DivergenceFreeProjector &op, const MISOInputs &inputs) { auto it = inputs.find("mesh_coords"); if (it != inputs.end()) @@ -43,4 +43,4 @@ void DivergenceFreeProjector::vectorJacobianProduct( } } -} // namespace mach +} // namespace miso diff --git a/src/utils/div_free_projector.hpp b/src/utils/div_free_projector.hpp index 509a12eb..7e88ec02 100644 --- a/src/utils/div_free_projector.hpp +++ b/src/utils/div_free_projector.hpp @@ -1,11 +1,11 @@ -#ifndef MACH_DIV_FREE_PROJECTOR -#define MACH_DIV_FREE_PROJECTOR +#ifndef MISO_DIV_FREE_PROJECTOR +#define MISO_DIV_FREE_PROJECTOR #include "mfem.hpp" #include "irrotational_projector.hpp" -namespace mach +namespace miso { /// This class computes the divergence free portion of a vector field. /// This vector field must be discretized using Nedelec basis @@ -14,7 +14,7 @@ class DivergenceFreeProjector : public IrrotationalProjector { public: /// Used to set inputs in the operator - friend void setInputs(DivergenceFreeProjector &op, const MachInputs &inputs); + friend void setInputs(DivergenceFreeProjector &op, const MISOInputs &inputs); // Given a GridFunction 'x' of Nedelec DoFs for an arbitrary vector field, // compute the Nedelec DoFs of the divergence free portion, 'y', of @@ -42,6 +42,6 @@ class DivergenceFreeProjector : public IrrotationalProjector mutable mfem::ParGridFunction psi_irrot; }; -} // namespace mach +} // namespace miso #endif diff --git a/src/utils/irrotational_projector.cpp b/src/utils/irrotational_projector.cpp index 0e70d3be..2fe1fc12 100644 --- a/src/utils/irrotational_projector.cpp +++ b/src/utils/irrotational_projector.cpp @@ -5,7 +5,7 @@ using namespace mfem; -namespace mach +namespace miso { IrrotationalProjector::IrrotationalProjector(ParFiniteElementSpace &h1_fes, ParFiniteElementSpace &nd_fes, @@ -45,7 +45,7 @@ IrrotationalProjector::IrrotationalProjector(ParFiniteElementSpace &h1_fes, mesh_sens.AddDomainIntegrator(div_mesh_sens); } -void setInputs(IrrotationalProjector &op, const MachInputs &inputs) +void setInputs(IrrotationalProjector &op, const MISOInputs &inputs) { auto it = inputs.find("mesh_coords"); if (it != inputs.end()) @@ -214,4 +214,4 @@ void IrrotationalProjector::update() const grad.Finalize(); } -} // namespace mach +} // namespace miso diff --git a/src/utils/irrotational_projector.hpp b/src/utils/irrotational_projector.hpp index 55517319..9b8af05b 100644 --- a/src/utils/irrotational_projector.hpp +++ b/src/utils/irrotational_projector.hpp @@ -1,11 +1,11 @@ -#ifndef MACH_IRROTATIONAL_PROJECTOR -#define MACH_IRROTATIONAL_PROJECTOR +#ifndef MISO_IRROTATIONAL_PROJECTOR +#define MISO_IRROTATIONAL_PROJECTOR #include "mfem.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" -namespace mach +namespace miso { /// Forward declarations of mesh sens integrators class DiffusionIntegratorMeshSens; @@ -52,12 +52,12 @@ class IrrotationalProjector : public mfem::Operator { public: /// Used to set inputs in the operator - friend void setInputs(IrrotationalProjector &op, const MachInputs &inputs); + friend void setInputs(IrrotationalProjector &op, const MISOInputs &inputs); // Given a GridFunction 'x' of Nedelec DoFs for an arbitrary vector field, // compute the Nedelec DoFs of the irrotational portion, 'y', of // this vector field. The resulting GridFunction will satisfy Curl y = 0 - // to machine precision. + // to misoine precision. void Mult(const mfem::Vector &x, mfem::Vector &y) const override; /// \brief Reverse-mode differentiation of IrrotationalProjector::Mult @@ -103,6 +103,6 @@ class IrrotationalProjector : public mfem::Operator mfem::Array ess_bdr, ess_bdr_tdofs; }; -} // namespace mach +} // namespace miso #endif diff --git a/src/utils/kdtree.hpp b/src/utils/kdtree.hpp index 16ca8333..fd9a45c8 100644 --- a/src/utils/kdtree.hpp +++ b/src/utils/kdtree.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_KDTREE -#define MACH_KDTREE +#ifndef MISO_KDTREE +#define MISO_KDTREE #include #include @@ -10,7 +10,7 @@ #include "mfem.hpp" -namespace mach +namespace miso { /// Class for representing a point /// \tparam coord_type - a numeric type @@ -299,6 +299,6 @@ int main() { } #endif -} // namespace mach +} // namespace miso #endif \ No newline at end of file diff --git a/src/utils/mach_types.hpp b/src/utils/miso_types.hpp similarity index 91% rename from src/utils/mach_types.hpp rename to src/utils/miso_types.hpp index 98fcbc28..84539af3 100644 --- a/src/utils/mach_types.hpp +++ b/src/utils/miso_types.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_TYPES -#define MACH_TYPES +#ifndef MISO_TYPES +#define MISO_TYPES #include "mfem.hpp" -namespace mach +namespace miso { // Aliases for various mfem types. // Originally used to distinguish between serial and parallel types @@ -26,6 +26,6 @@ using EMPrecType = mfem::HypreAMS; using EMPrecType2 = mfem::HypreBoomerAMG; using SolverType = CGType; -} // namespace mach +} // namespace miso #endif diff --git a/src/utils/utilities.hpp b/src/utils/utilities.hpp index 481e0633..bf6fbfe4 100644 --- a/src/utils/utilities.hpp +++ b/src/utils/utilities.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_UTILITIES -#define MACH_UTILITIES +#ifndef MISO_UTILITIES +#define MISO_UTILITIES #include "json.hpp" #include "kdtree.hpp" -#include "mach_types.hpp" +#include "miso_types.hpp" #include "utils.hpp" #endif \ No newline at end of file diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index fe746615..a3f323eb 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -5,7 +5,7 @@ using namespace mfem; using namespace std; -namespace mach +namespace miso { /// performs the Hadamard (elementwise) product: `v(i) = v1(i)*v2(i)` void multiplyElementwise(const Vector &v1, const Vector &v2, Vector &v) @@ -331,7 +331,7 @@ double secant(const std::function &func, } if (iter > maxiter) { - throw MachException("secant: maximum number of iterations exceeded"); + throw MISOException("secant: maximum number of iterations exceeded"); } return x; } @@ -415,7 +415,7 @@ void buildInterpolation(int dim, } else { - throw MachException( + throw MISOException( "Other dimension interpolation has not been implemented yet.\n"); } @@ -467,7 +467,7 @@ void buildInterpolation(int dim, } else { - throw MachException( + throw MISOException( "Other dimension interpolation has not been implemented " "yet.\n"); } @@ -522,7 +522,7 @@ void buildLSInterpolation(int dim, } else { - throw MachException("buildLSInterpolation: dim must be 3 or less.\n"); + throw MISOException("buildLSInterpolation: dim must be 3 or less.\n"); } // Construct the generalized Vandermonde matrix @@ -717,10 +717,10 @@ void transferSolution(MeshType &old_mesh, const GridFunType &in, GridFunType &out) { - throw MachException( + throw MISOException( "transferSolution requires GSLIB!" "\trecompile MFEM with GSLIB!"); } #endif -} // namespace mach +} // namespace miso diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index 64b5a416..92408f8a 100644 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_UTILS -#define MACH_UTILS +#ifndef MISO_UTILS +#define MISO_UTILS #include #include @@ -8,9 +8,9 @@ #include "mfem.hpp" -#include "mach_types.hpp" +#include "miso_types.hpp" -namespace mach +namespace miso { /// Perform quadratic interpolation based on (x0,y0,dydx0) and (x1,y1) /// \param[in] x0 - location of first dependent data point @@ -21,12 +21,12 @@ namespace mach double quadInterp(double x0, double y0, double dydx0, double x1, double y1); /// Handles (high-level) exceptions in both serial and parallel -class MachException : public std::exception +class MISOException : public std::exception { public: /// Class constructor. /// \param[in] err_msg - the error message to be printed - MachException(std::string err_msg) : error_msg(std::move(std::move(err_msg))) + MISOException(std::string err_msg) : error_msg(std::move(std::move(err_msg))) { } /// Overwrites inherieted member that returns a c-string. @@ -134,7 +134,7 @@ mfem::HypreParVector bufferToHypreParVector( // // Given a GridFunction 'x' of Nedelec DoFs for an arbitrary vector field, // // compute the Nedelec DoFs of the irrotational portion, 'y', of // // this vector field. The resulting GridFunction will satisfy Curl y = 0 -// // to machine precision. +// // to misoine precision. // void Mult(const mfem::Vector &x, mfem::Vector &y) const override; // /// \brief Reverse-mode differentiation of IrrotationalProjector::Mult @@ -264,6 +264,6 @@ void transferSolution(MeshType &old_mesh, const GridFunType &in, GridFunType &out); -} // namespace mach +} // namespace miso #endif diff --git a/test/regression/CMakeLists.txt b/test/regression/CMakeLists.txt index 7703ba7e..92d13cc6 100644 --- a/test/regression/CMakeLists.txt +++ b/test/regression/CMakeLists.txt @@ -2,14 +2,14 @@ function(create_tests source_list data_files) foreach(X ${source_list}) add_executable("${X}.bin" "${X}.cpp" regression_test_main.cpp ${data_files}) add_dependencies(build_tests "${X}.bin") - target_link_libraries("${X}.bin" PRIVATE mach Catch) + target_link_libraries("${X}.bin" PRIVATE miso Catch) target_include_directories("${X}.bin" PRIVATE "${CMAKE_SOURCE_DIR}") add_test(NAME "${X}" COMMAND "${X}.bin") # configure_file("${X}_options.json" "${X}_options.json" COPYONLY) endforeach() endfunction(create_tests) -# for all targets created in this file, include the main dir (containing mach.hpp) +# for all targets created in this file, include the main dir (containing miso.hpp) #include_directories(BEFORE ${PROJECT_SOURCE_DIR}) # group together all regression tests @@ -18,7 +18,7 @@ set(REGRESSION_TEST_SRCS test_navier_stokes_mms test_thermal_cube test_steady_thermal_cube - test_mach_inputs + test_miso_inputs test_magnetostatic_box test_meshmovement_box test_meshmovement_annulus diff --git a/test/regression/egads/CMakeLists.txt b/test/regression/egads/CMakeLists.txt index e9e45907..1eff3904 100644 --- a/test/regression/egads/CMakeLists.txt +++ b/test/regression/egads/CMakeLists.txt @@ -3,14 +3,14 @@ function(create_egads_tests source_list data_files) add_executable("${X}.bin" "${X}.cpp" "../regression_test_main.cpp" ${data_files}) add_dependencies("${X}.bin" copy-egads-data-files) add_dependencies(build_tests "${X}.bin") - target_link_libraries("${X}.bin" PRIVATE mach "${EGADS_LIBRARIES}" Catch) + target_link_libraries("${X}.bin" PRIVATE miso "${EGADS_LIBRARIES}" Catch) target_include_directories("${X}.bin" PRIVATE "${CMAKE_SOURCE_DIR}" "${EGADS_INCLUDE_DIRS}") add_test(NAME "${X}" COMMAND "${X}.bin") # configure_file("${X}_options.json" "${X}_options.json" COPYONLY) endforeach() endfunction(create_egads_tests) -# for all targets created in this file, include the main dir (containing mach.hpp) +# for all targets created in this file, include the main dir (containing miso.hpp) #include_directories(BEFORE ${PROJECT_SOURCE_DIR}) # group together all regression tests diff --git a/test/regression/egads/coupled_motor.cpp b/test/regression/egads/coupled_motor.cpp index 8113a395..c26a9ffb 100644 --- a/test/regression/egads/coupled_motor.cpp +++ b/test/regression/egads/coupled_motor.cpp @@ -9,7 +9,7 @@ #include "thermal.hpp" using namespace mfem; -using namespace mach; +using namespace miso; auto em_options = R"( { @@ -345,7 +345,7 @@ TEST_CASE("Coupled Motor Solve", // }); // therm_solver->setResidualInput("mvp", *em_state); - MachInputs inputs; + MISOInputs inputs; em_solver->solveForState(inputs, *em_state); // therm_solver->solveForState(*therm_state); diff --git a/test/regression/egads/test_acloss_functional.cpp b/test/regression/egads/test_acloss_functional.cpp index 53fda2b0..e7c9a035 100644 --- a/test/regression/egads/test_acloss_functional.cpp +++ b/test/regression/egads/test_acloss_functional.cpp @@ -18,7 +18,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; namespace { @@ -100,7 +100,7 @@ TEST_CASE("HybridACLossFunctionalIntegrator::GetEnergy", int n = 3; functional.AddDomainIntegrator( - new mach::HybridACLossFunctionalIntegrator(sigma, frequency, d, fill_factor)); + new miso::HybridACLossFunctionalIntegrator(sigma, frequency, d, fill_factor)); const auto b_mag = 1.0; const auto loss = n * M_PI * l * std::pow(d, 4) * sigma_val diff --git a/test/regression/egads/test_coulomb1984_force.cpp b/test/regression/egads/test_coulomb1984_force.cpp index 143c0c82..e0d8f9a7 100644 --- a/test/regression/egads/test_coulomb1984_force.cpp +++ b/test/regression/egads/test_coulomb1984_force.cpp @@ -10,7 +10,7 @@ #include "thermal.hpp" using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto em_options = R"( @@ -76,7 +76,7 @@ TEST_CASE("Force Regression Test Coulomb 1984 Paper") *em_state = 0.0; // initialize zero field auto current_density = 3e6; - MachInputs inputs { + MISOInputs inputs { {"current_density", current_density}, {"state", em_state->GetData()} }; diff --git a/test/regression/egads/test_joule_wire_egads.cpp b/test/regression/egads/test_joule_wire_egads.cpp index 0c30b5f0..2aa5465e 100644 --- a/test/regression/egads/test_joule_wire_egads.cpp +++ b/test/regression/egads/test_joule_wire_egads.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto em_options = R"( diff --git a/test/regression/egads/test_meshmovement_egads_cyl.cpp b/test/regression/egads/test_meshmovement_egads_cyl.cpp index 068a621b..00ab834c 100644 --- a/test/regression/egads/test_meshmovement_egads_cyl.cpp +++ b/test/regression/egads/test_meshmovement_egads_cyl.cpp @@ -6,11 +6,11 @@ #include "mfem.hpp" #include "mesh_movement.hpp" -#include "mach_egads.hpp" +#include "miso_egads.hpp" using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( diff --git a/test/regression/egads/test_team13.cpp b/test/regression/egads/test_team13.cpp index fb17de96..0daded87 100644 --- a/test/regression/egads/test_team13.cpp +++ b/test/regression/egads/test_team13.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto em_options = R"( diff --git a/test/regression/egads/test_thermal_ring.cpp b/test/regression/egads/test_thermal_ring.cpp index d124704c..5e8d89eb 100644 --- a/test/regression/egads/test_thermal_ring.cpp +++ b/test/regression/egads/test_thermal_ring.cpp @@ -9,7 +9,7 @@ #include "thermal.hpp" using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto current_options = R"( diff --git a/test/regression/egads/test_torque_loop.cpp b/test/regression/egads/test_torque_loop.cpp index ce68fecc..bd60bcd0 100644 --- a/test/regression/egads/test_torque_loop.cpp +++ b/test/regression/egads/test_torque_loop.cpp @@ -10,7 +10,7 @@ #include "thermal.hpp" using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto em_options = R"( @@ -91,7 +91,7 @@ TEST_CASE("Torque Loop Regression Test") // The volume is lower because of bad mesh resolution constexpr auto current_density = M_1_PI * 1e7 * 1.5884635222882089; - MachInputs inputs { + MISOInputs inputs { {"current_density", current_density}, {"fill-factor", 1.0}, {"state", em_state->GetData()} diff --git a/test/regression/test_joule_box.cpp b/test/regression/test_joule_box.cpp index 6dc49765..c30bf123 100644 --- a/test/regression/test_joule_box.cpp +++ b/test/regression/test_joule_box.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto em_options = R"( @@ -205,7 +205,7 @@ TEST_CASE("Joule Box Solver Regression Test", move(em_mesh)); auto em_state = em_solver->getNewField(); em_solver->setFieldValue(*em_state, aexact); - MachInputs em_inputs; + MISOInputs em_inputs; em_solver->solveForState(em_inputs, *em_state); auto therm_solver = createSolver(therm_options, @@ -214,7 +214,7 @@ TEST_CASE("Joule Box Solver Regression Test", // therm_solver->setResidualInput("mvp", *em_state); therm_solver->setFieldValue(*therm_state, initialTemp); - MachInputs therm_inputs = { + MISOInputs therm_inputs = { {"mvp", em_state->GetData()} }; therm_solver->solveForState(therm_inputs, *therm_state); diff --git a/test/regression/test_magnetostatic_box.cpp b/test/regression/test_magnetostatic_box.cpp index f8279330..8df4f6ef 100644 --- a/test/regression/test_magnetostatic_box.cpp +++ b/test/regression/test_magnetostatic_box.cpp @@ -9,7 +9,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( @@ -130,7 +130,7 @@ TEST_CASE("Magnetostatic Box Solver Regression Test", auto state = solver->getNewField(); solver->setFieldValue(*state, aexact); - MachInputs inputs { + MISOInputs inputs { {"state", state->GetData()} }; solver->solveForState(inputs, *state); diff --git a/test/regression/test_meshmovement_annulus.cpp b/test/regression/test_meshmovement_annulus.cpp index 7e3fdffd..21fdd4d4 100644 --- a/test/regression/test_meshmovement_annulus.cpp +++ b/test/regression/test_meshmovement_annulus.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( diff --git a/test/regression/test_meshmovement_box.cpp b/test/regression/test_meshmovement_box.cpp index c01ba03d..c80c62df 100644 --- a/test/regression/test_meshmovement_box.cpp +++ b/test/regression/test_meshmovement_box.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( @@ -91,7 +91,7 @@ TEST_CASE("Mesh Movement Box Regression Test", auto solver = createSolver(options, move(smesh)); auto coord_field = solver->getNewField(); solver->setFieldValue(*coord_field, boxDisplacement); - MachInputs inputs; + MISOInputs inputs; solver->solveForState(inputs, *coord_field); // solver->printField("sol", *coord_field, "coords", 0); diff --git a/test/regression/test_mach_inputs.cpp b/test/regression/test_miso_inputs.cpp similarity index 83% rename from test/regression/test_mach_inputs.cpp rename to test/regression/test_miso_inputs.cpp index 3533a851..9357d023 100644 --- a/test/regression/test_mach_inputs.cpp +++ b/test/regression/test_miso_inputs.cpp @@ -5,7 +5,7 @@ #include "mfem.hpp" #include "solver.hpp" -#include "test_mach_inputs.hpp" +#include "test_miso_inputs.hpp" auto options = R"( { @@ -51,7 +51,7 @@ auto options = R"( } })"_json; -using namespace mach; +using namespace miso; using namespace mfem; /// Generate mesh @@ -60,12 +60,12 @@ using namespace mfem; std::unique_ptr buildMesh(int nxy, int nz); -TEST_CASE("MachInputs Scalar Input Test", - "[MachInputs]") +TEST_CASE("MISOInputs Scalar Input Test", + "[MISOInputs]") { // construct the solver, set the initial condition, and solve std::unique_ptr mesh = buildMesh(4, 4); - auto solver = createSolver(options, + auto solver = createSolver(options, move(mesh)); auto state = solver->getNewField(); solver->setFieldValue(*state, 0.0); @@ -73,29 +73,29 @@ TEST_CASE("MachInputs Scalar Input Test", auto test_field = solver->getNewField(); solver->setFieldValue(*test_field, 0.0); - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"test_val", 2.0}, {"test_field", test_field->GetData()}, {"state", state->GetData()} }); - solver->createOutput("testMachInput"); - auto fun = solver->calcOutput("testMachInput", inputs); + solver->createOutput("testMISOInput"); + auto fun = solver->calcOutput("testMISOInput", inputs); std::cout << "fun: " << fun << "\n"; REQUIRE(fun == Approx(2.0).margin(1e-10)); inputs.at("test_val") = 1.0; - fun = solver->calcOutput("testMachInput", inputs); + fun = solver->calcOutput("testMISOInput", inputs); std::cout << "fun: " << fun << "\n"; REQUIRE(fun == Approx(1.0).margin(1e-10)); } -TEST_CASE("MachInputs Field Input Test", - "[MachInputs]") +TEST_CASE("MISOInputs Field Input Test", + "[MISOInputs]") { // construct the solver, set the initial condition, and solve std::unique_ptr mesh = buildMesh(4, 4); - auto solver = createSolver(options, + auto solver = createSolver(options, move(mesh)); auto state = solver->getNewField(); solver->setFieldValue(*state, 0.0); @@ -103,19 +103,19 @@ TEST_CASE("MachInputs Field Input Test", auto test_field = solver->getNewField(); solver->setFieldValue(*test_field, 0.0); - auto inputs = MachInputs{ + auto inputs = MISOInputs{ {"test_val", 0.0}, {"test_field", test_field->GetData()}, {"state", state->GetData()} }; - solver->createOutput("testMachInput"); - auto fun = solver->calcOutput("testMachInput", inputs); + solver->createOutput("testMISOInput"); + auto fun = solver->calcOutput("testMISOInput", inputs); std::cout << "fun: " << fun << "\n"; REQUIRE(fun == Approx(0.0).margin(1e-10)); solver->setFieldValue(*test_field, -1.0); - fun = solver->calcOutput("testMachInput", inputs); + fun = solver->calcOutput("testMISOInput", inputs); std::cout << "fun: " << fun << "\n"; REQUIRE(fun == Approx(-1.0).margin(1e-10)); } diff --git a/test/regression/test_mach_inputs.hpp b/test/regression/test_miso_inputs.hpp similarity index 72% rename from test/regression/test_mach_inputs.hpp rename to test/regression/test_miso_inputs.hpp index 6101c49d..9752be5b 100644 --- a/test/regression/test_mach_inputs.hpp +++ b/test/regression/test_miso_inputs.hpp @@ -1,5 +1,5 @@ -#ifndef MACH_TEST_MACH_INPUTS -#define MACH_TEST_MACH_INPUTS +#ifndef MISO_TEST_MISO_INPUTS +#define MISO_TEST_MISO_INPUTS #include "mfem.hpp" #include "nlohmann/json.hpp" @@ -8,13 +8,13 @@ #include "solver.hpp" #include "utils.hpp" -namespace mach +namespace miso { -class TestMachInputIntegrator : public mfem::NonlinearFormIntegrator +class TestMISOInputIntegrator : public mfem::NonlinearFormIntegrator { public: - TestMachInputIntegrator(const mfem::GridFunction &field) + TestMISOInputIntegrator(const mfem::GridFunction &field) : test_val(0.0), test_field(field) { } @@ -45,16 +45,16 @@ class TestMachInputIntegrator : public mfem::NonlinearFormIntegrator return fun; } - friend void setInputs(TestMachInputIntegrator &integ, - const MachInputs &inputs); + friend void setInputs(TestMISOInputIntegrator &integ, + const MISOInputs &inputs); private: double test_val; const mfem::GridFunction &test_field; }; -void setInputs(TestMachInputIntegrator &integ, - const MachInputs &inputs) +void setInputs(TestMISOInputIntegrator &integ, + const MISOInputs &inputs) { auto it = inputs.find("test_val"); if (it != inputs.end()) @@ -65,15 +65,15 @@ void setInputs(TestMachInputIntegrator &integ, } else { - throw MachException("Bad input type for test_val!"); + throw MISOException("Bad input type for test_val!"); } } } -class TestMachInputSolver : public AbstractSolver +class TestMISOInputSolver : public AbstractSolver { public: - TestMachInputSolver(const nlohmann::json &json_options, + TestMISOInputSolver(const nlohmann::json &json_options, std::unique_ptr smesh, MPI_Comm comm) : AbstractSolver(json_options, move(smesh), comm) @@ -83,12 +83,12 @@ class TestMachInputSolver : public AbstractSolver void addOutput(const std::string &fun, const nlohmann::json &options) override { - if (fun == "testMachInput") + if (fun == "testMISOInput") { FunctionalOutput out(*fes, res_fields); out.addOutputDomainIntegrator( - new TestMachInputIntegrator(res_fields.at("test_field"))); + new TestMISOInputIntegrator(res_fields.at("test_field"))); outputs.emplace(fun, std::move(out)); } } @@ -96,6 +96,6 @@ class TestMachInputSolver : public AbstractSolver int getNumState() override { return 1; } }; -} // namespace mach +} // namespace miso #endif diff --git a/test/regression/test_navier_stokes_mms.cpp b/test/regression/test_navier_stokes_mms.cpp index 9bc49773..63def66d 100644 --- a/test/regression/test_navier_stokes_mms.cpp +++ b/test/regression/test_navier_stokes_mms.cpp @@ -10,7 +10,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( diff --git a/test/regression/test_steady_thermal_cube.cpp b/test/regression/test_steady_thermal_cube.cpp index 90c49549..b4481aab 100644 --- a/test/regression/test_steady_thermal_cube.cpp +++ b/test/regression/test_steady_thermal_cube.cpp @@ -7,7 +7,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( @@ -109,7 +109,7 @@ TEST_CASE("Thermal Cube Solver Steady Regression Test", solver->setFieldValue(*state, u0); - MachInputs inputs; + MISOInputs inputs; solver->solveForState(inputs, *state); double l2_error = solver->calcL2Error(*state, u0); std::cout << "l2_error: " << l2_error << "\n"; diff --git a/test/regression/test_steady_vortex.cpp b/test/regression/test_steady_vortex.cpp index 97bc9279..7b3ba37e 100644 --- a/test/regression/test_steady_vortex.cpp +++ b/test/regression/test_steady_vortex.cpp @@ -10,14 +10,14 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( { "print-options": false, "flow-param": { - "mach": 1.0, + "miso": 1.0, "aoa": 0.0 }, "space-dis": { @@ -139,7 +139,7 @@ TEMPLATE_TEST_CASE_SIG("Steady Vortex Solver Regression Test", "boundaries": [0, 0, 0, 1] })"_json; solver->createOutput("drag", drag_opts); - double drag_error = fabs(solver->calcOutput("drag") - (-1 /mach::euler::gamma)); + double drag_error = fabs(solver->calcOutput("drag") - (-1 /miso::euler::gamma)); REQUIRE(drag_error == Approx(target_drag_error[nx-1]).margin(1e-10)); } } diff --git a/test/regression/test_thermal_cube.cpp b/test/regression/test_thermal_cube.cpp index b1ff3c99..8031017b 100644 --- a/test/regression/test_thermal_cube.cpp +++ b/test/regression/test_thermal_cube.cpp @@ -7,7 +7,7 @@ using namespace std; using namespace mfem; -using namespace mach; +using namespace miso; // Provide the options explicitly for regression tests auto options = R"( diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 08e9a454..318cfdc4 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -2,7 +2,7 @@ function(create_tests source_list data_files) foreach(X ${source_list}) add_executable("${X}.bin" "${X}.cpp" unit_test_main.cpp ${data_files}) add_dependencies(build_tests "${X}.bin") - target_link_libraries("${X}.bin" PRIVATE mach Catch) + target_link_libraries("${X}.bin" PRIVATE miso Catch) target_include_directories("${X}.bin" PRIVATE "${CMAKE_SOURCE_DIR}") add_test(NAME "${X}" COMMAND "${X}.bin") endforeach() @@ -12,13 +12,13 @@ function(create_mpi_tests source_list data_files) foreach(X ${source_list}) add_executable("${X}.bin" "${X}.cpp" unit_test_mpi_main.cpp ${data_files}) add_dependencies(build_tests "${X}.bin") - target_link_libraries("${X}.bin" PRIVATE mach Catch) + target_link_libraries("${X}.bin" PRIVATE miso Catch) target_include_directories("${X}.bin" PRIVATE "${CMAKE_SOURCE_DIR}") add_test(NAME "${X}" COMMAND "${X}.bin") endforeach() endfunction(create_mpi_tests) -# for all targets created in this file, include the main dir (containing mach.hpp) +# for all targets created in this file, include the main dir (containing miso.hpp) #include_directories(BEFORE ${PROJECT_SOURCE_DIR}) # group together all fluids related tests @@ -47,7 +47,7 @@ set(EM_TEST_SRCS # group fluid MPI tests set(FLUID_MPI_TEST_SRCS test_mfem_common_integ - test_mach_residual + test_miso_residual ) # group EM MPI tests @@ -58,7 +58,7 @@ set(EM_MPI_TEST_SRCS test_magnetostatic_solver test_steinmetz_integ test_coefficient - test_mach_load + test_miso_load test_current_load test_magnetic_load test_magnetostatic_load diff --git a/test/unit/electromag_test_data.hpp b/test/unit/electromag_test_data.hpp index 38165bae..ccb8df99 100644 --- a/test/unit/electromag_test_data.hpp +++ b/test/unit/electromag_test_data.hpp @@ -77,7 +77,7 @@ void vectorFunc2RevDiff(const mfem::Vector &x, const mfem::Vector &v_bar, mfem:: } /// Simple linear coefficient for testing CurlCurlNLFIntegrator -class LinearCoefficient : public mach::StateCoefficient +class LinearCoefficient : public miso::StateCoefficient { public: LinearCoefficient(double val = 1.0) : value(val) {} @@ -101,7 +101,7 @@ class LinearCoefficient : public mach::StateCoefficient }; /// Simple nonlinear coefficient for testing CurlCurlNLFIntegrator -class NonLinearCoefficient : public mach::StateCoefficient +class NonLinearCoefficient : public miso::StateCoefficient { public: NonLinearCoefficient() {}; diff --git a/test/unit/euler_test_data.cpp b/test/unit/euler_test_data.cpp index bbc59f23..9da1c0dc 100644 --- a/test/unit/euler_test_data.cpp +++ b/test/unit/euler_test_data.cpp @@ -87,7 +87,7 @@ void randBaselineVectorPert(const Vector &x, Vector &u) if (entvar) { Vector q(u); - mach::calcEntropyVars(q.GetData(), u.GetData()); + miso::calcEntropyVars(q.GetData(), u.GetData()); } } // explicit instantiation of the templated function above diff --git a/test/unit/laplace.hpp b/test/unit/laplace.hpp index f92554e5..9d46b09b 100644 --- a/test/unit/laplace.hpp +++ b/test/unit/laplace.hpp @@ -1,9 +1,9 @@ -#ifndef MACH_LAPLACE -#define MACH_LAPLACE +#ifndef MISO_LAPLACE +#define MISO_LAPLACE #include "viscous_integ.hpp" -namespace mach +namespace miso { /// Volume integrator for scalar, second-order operator @@ -169,6 +169,6 @@ public : int deg; }; -} // namespace mach +} // namespace miso #endif \ No newline at end of file diff --git a/test/unit/test_coefficient.cpp b/test/unit/test_coefficient.cpp index e48c2d6b..f7c0af6e 100644 --- a/test/unit/test_coefficient.cpp +++ b/test/unit/test_coefficient.cpp @@ -121,7 +121,7 @@ TEST_CASE("MeshDependentVectorCoefficient::EvalRevDiff", { using namespace mfem; // using namespace electromag_data; - using namespace mach; + using namespace miso; constexpr double eps_fd = 1e-5; constexpr int dim = 3; @@ -214,7 +214,7 @@ TEST_CASE("FunctionCoefficient::EvalRevDiff", { using namespace mfem; // using namespace electromag_data; - using namespace mach; + using namespace miso; constexpr double eps_fd = 1e-5; constexpr int dim = 3; @@ -294,7 +294,7 @@ TEST_CASE("SteinmetzCoefficient::EvalRevDiff", { using namespace mfem; // using namespace electromag_data; - using namespace mach; + using namespace miso; constexpr double eps_fd = 1e-5; constexpr int dim = 3; @@ -317,7 +317,7 @@ TEST_CASE("SteinmetzCoefficient::EvalRevDiff", VectorFunctionCoefficient pert(dim, electromag_data::randVectorState); A.ProjectCoefficient(pert); - mach::SteinmetzCoefficient coeff(1, 2, 4, 0.5, 0.6, A); + miso::SteinmetzCoefficient coeff(1, 2, 4, 0.5, 0.6, A); for (int j = 0; j < fes.GetNE(); j++) { @@ -376,7 +376,7 @@ TEST_CASE("SteinmetzVectorDiffCoefficient::Eval", "[SteinmetzVectorDiffCoefficient]") { using namespace mfem; - using namespace mach; + using namespace miso; constexpr double eps_fd = 1e-5; constexpr int dim = 3; @@ -396,8 +396,8 @@ TEST_CASE("SteinmetzVectorDiffCoefficient::Eval", VectorFunctionCoefficient pert(dim, electromag_data::randVectorState); A.ProjectCoefficient(pert); - mach::SteinmetzCoefficient coeff(1, 2, 4, 0.5, 0.6, A); - mach::SteinmetzVectorDiffCoefficient d_coeff(1, 2, 4, 0.5, 0.6, A); + miso::SteinmetzCoefficient coeff(1, 2, 4, 0.5, 0.6, A); + miso::SteinmetzVectorDiffCoefficient d_coeff(1, 2, 4, 0.5, 0.6, A); for (int j = 0; j < fes.GetNE(); j++) { @@ -461,7 +461,7 @@ TEST_CASE("ReluctivityCoefficient::EvalStateDeriv", "[ReluctivityCoefficient]") { using namespace mfem; - using namespace mach; + using namespace miso; constexpr double eps_fd = 1e-5; constexpr int dim = 3; @@ -491,7 +491,7 @@ TEST_CASE("ReluctivityCoefficient::EvalStateDeriv", auto h = material_library["hiperco50"]["H"].get>(); // auto b = material_library["team13"]["B"].get>(); // auto h = material_library["team13"]["H"].get>(); - mach::ReluctivityCoefficient coeff(b, h); + miso::ReluctivityCoefficient coeff(b, h); for (int j = 0; j < fes.GetNE(); j++) { diff --git a/test/unit/test_current_load.cpp b/test/unit/test_current_load.cpp index 51cd6598..ab702982 100644 --- a/test/unit/test_current_load.cpp +++ b/test/unit/test_current_load.cpp @@ -7,7 +7,7 @@ #include "utils.hpp" #include "coefficient.hpp" -#include "mach_load.hpp" +#include "miso_load.hpp" #include "current_load.hpp" void simpleCurrent(const mfem::Vector &x, @@ -42,7 +42,7 @@ void box2CurrentSourceRevDiff(const mfem::Vector &x, static std::default_random_engine gen; static std::uniform_real_distribution uniform_rand(-1.0,1.0); -using namespace mach; +using namespace miso; using namespace mfem; // using adept::adouble; // static adept::Stack diff_stack; @@ -86,9 +86,9 @@ TEST_CASE("CurrentLoad setInputs") CurrentLoad load(fes, current_coeff); - MachLoad ml(load); + MISOLoad ml(load); - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"current_density", 1.0} }); @@ -150,10 +150,10 @@ TEST_CASE("CurrentLoad vectorJacobianProduct wrt current_density") CurrentLoad load(fes, current_coeff); - MachLoad ml(load); + MISOLoad ml(load); auto current_density = 1e6; - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"current_density", current_density} }); setInputs(ml, inputs); @@ -209,14 +209,14 @@ TEST_CASE("CurrentLoad vectorJacobianProduct wrt mesh_coords") simpleCurrentRevDiff); CurrentLoad load(fes, current_coeff); - MachLoad ml(load); + MISOLoad ml(load); // extract mesh nodes and get their finite-element space auto &x_nodes = *dynamic_cast(mesh->GetNodes()); auto &mesh_fes = *x_nodes.ParFESpace(); auto current_density = 1e6; - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"current_density", current_density}, {"mesh_coords", x_nodes.GetData()} }); diff --git a/test/unit/test_div_free_projector.cpp b/test/unit/test_div_free_projector.cpp index 25a312d5..e4252675 100644 --- a/test/unit/test_div_free_projector.cpp +++ b/test/unit/test_div_free_projector.cpp @@ -4,7 +4,7 @@ #include "mfem.hpp" #include "electromag_test_data.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" #include "div_free_projector.hpp" TEST_CASE("DivergenceFreeProjector::vectorJacobianProduct wrt in") @@ -40,7 +40,7 @@ TEST_CASE("DivergenceFreeProjector::vectorJacobianProduct wrt in") auto ir_order = h1_fes.GetElementTransformation(0)->OrderW() + 2 * fes.GetFE(0)->GetOrder(); - mach::DivergenceFreeProjector op(h1_fes, fes, ir_order); + miso::DivergenceFreeProjector op(h1_fes, fes, ir_order); // initialize the vector that the Jacobian multiplies ParGridFunction p(&fes); @@ -98,7 +98,7 @@ TEST_CASE("DivergenceFreeProjector::vectorJacobianProduct wrt mesh_coords") // extract mesh nodes and get their finite-element space auto &x_nodes = dynamic_cast(*mesh.GetNodes()); - auto inputs = mach::MachInputs({ + auto inputs = miso::MISOInputs({ {"mesh_coords", x_nodes.GetData()} }); auto &mesh_fes = *x_nodes.ParFESpace(); @@ -110,7 +110,7 @@ TEST_CASE("DivergenceFreeProjector::vectorJacobianProduct wrt mesh_coords") auto ir_order = h1_fes.GetElementTransformation(0)->OrderW() + 2 * fes.GetFE(0)->GetOrder(); - mach::DivergenceFreeProjector op(h1_fes, fes, ir_order); + miso::DivergenceFreeProjector op(h1_fes, fes, ir_order); // initialize the vector that the Jacobian multiplies ParGridFunction p(&fes); diff --git a/test/unit/test_electromag_integ.cpp b/test/unit/test_electromag_integ.cpp index 78e9c3da..186a4fd9 100644 --- a/test/unit/test_electromag_integ.cpp +++ b/test/unit/test_electromag_integ.cpp @@ -35,7 +35,7 @@ TEST_CASE("CurlCurlNLFIntegrator::AssembleElementGrad - linear", LinearCoefficient nu(1.0); res.AddDomainIntegrator( - new mach::CurlCurlNLFIntegrator(nu)); + new miso::CurlCurlNLFIntegrator(nu)); // initialize state; here we randomly perturb a constant state ParGridFunction A(&fes); @@ -100,10 +100,10 @@ TEST_CASE("CurlCurlNLFIntegrator::AssembleElementGrad", NonlinearForm res(fes.get()); - std::unique_ptr nu( + std::unique_ptr nu( new LinearCoefficient()); - res.AddDomainIntegrator(new mach::CurlCurlNLFIntegrator(*nu)); + res.AddDomainIntegrator(new miso::CurlCurlNLFIntegrator(*nu)); // GridFunction A(fes.get()); // VectorFunctionCoefficient a0(3, [](const Vector &x, Vector &a) @@ -183,11 +183,11 @@ TEST_CASE("CurlCurlNLFIntegrator::AssembleElementGrad - Nonlinear", VectorFunctionCoefficient pert(3, randBaselineVectorPert); a.ProjectCoefficient(pert); - std::unique_ptr nu( + std::unique_ptr nu( new NonLinearCoefficient()); NonlinearForm res(fes.get()); - res.AddDomainIntegrator(new mach::CurlCurlNLFIntegrator(*nu)); + res.AddDomainIntegrator(new miso::CurlCurlNLFIntegrator(*nu)); // initialize the vector that the Jacobian multiplies GridFunction v(fes.get()); @@ -253,7 +253,7 @@ TEST_CASE("CurlCurlNLFIntegratorMeshSens::AssembleRHSElementVect") // we use res for finite-difference approximation NonlinearForm res(&fes); - auto *integ = new mach::CurlCurlNLFIntegrator(nu); + auto *integ = new miso::CurlCurlNLFIntegrator(nu); res.AddDomainIntegrator(integ); // initialize the vector that we use to perturb the mesh nodes @@ -263,7 +263,7 @@ TEST_CASE("CurlCurlNLFIntegratorMeshSens::AssembleRHSElementVect") // evaluate d(psi^T R)/dx and contract with v LinearForm dfdx(&mesh_fes); dfdx.AddDomainIntegrator( - new mach::CurlCurlNLFIntegratorMeshSens(state, adjoint, *integ)); + new miso::CurlCurlNLFIntegratorMeshSens(state, adjoint, *integ)); dfdx.Assemble(); double dfdx_v = dfdx * v; @@ -321,7 +321,7 @@ TEST_CASE("VectorFECurldJdXIntegerator::AssembleRHSElementVect", mesh.get(), rt_fec.get())); /// We use a linear coefficient since the magnets are linear - std::unique_ptr nu( + std::unique_ptr nu( new LinearCoefficient()); // initialize magnetization source and adjoint; here we randomly perturb a constant state @@ -330,7 +330,7 @@ TEST_CASE("VectorFECurldJdXIntegerator::AssembleRHSElementVect", VectorFunctionCoefficient mag(3, vectorFunc, vectorFuncRevDiff); // /// Costruct coefficient - // mach::VectorMeshDependentCoefficient mag(dim); + // miso::VectorMeshDependentCoefficient mag(dim); // std::unique_ptr coeff1( // new VectorFunctionCoefficient(dim, vectorFunc, vectorFuncRevDiff)); // std::unique_ptr coeff2( @@ -353,7 +353,7 @@ TEST_CASE("VectorFECurldJdXIntegerator::AssembleRHSElementVect", // build the nonlinear form for d(psi^T R)/dx LinearForm dfdx(mesh_fes); dfdx.AddDomainIntegrator( - new mach::VectorFECurldJdXIntegerator(nu.get(), &M, &adjoint, &mag)); + new miso::VectorFECurldJdXIntegerator(nu.get(), &M, &adjoint, &mag)); dfdx.Assemble(); // initialize the vector that we use to perturb the mesh nodes @@ -432,7 +432,7 @@ TEST_CASE("VectorFEMassdJdXIntegerator::AssembleRHSElementVect", VectorFunctionCoefficient current(3, vectorFunc, vectorFuncRevDiff); /// Costruct coefficient - // mach::VectorMeshDependentCoefficient current(dim); + // miso::VectorMeshDependentCoefficient current(dim); // std::unique_ptr coeff1( // new VectorFunctionCoefficient(dim, vectorFunc, vectorFuncRevDiff)); // std::unique_ptr coeff2( @@ -455,7 +455,7 @@ TEST_CASE("VectorFEMassdJdXIntegerator::AssembleRHSElementVect", // build the nonlinear form for d(psi^T R)/dx LinearForm dfdx(mesh_fes); dfdx.AddDomainIntegrator( - new mach::VectorFEMassdJdXIntegerator(&J, &adjoint, ¤t)); + new miso::VectorFEMassdJdXIntegerator(&J, &adjoint, ¤t)); dfdx.Assemble(); // initialize the vector that we use to perturb the mesh nodes @@ -536,7 +536,7 @@ TEST_CASE("VectorFEWeakDivergencedJdXIntegrator::AssembleRHSElementVect", VectorFunctionCoefficient current(3, vectorFunc, vectorFuncRevDiff); /// Costruct coefficient - // mach::VectorMeshDependentCoefficient current(dim); + // miso::VectorMeshDependentCoefficient current(dim); // std::unique_ptr coeff1( // new VectorFunctionCoefficient(dim, vectorFunc, vectorFuncRevDiff)); // std::unique_ptr coeff2( @@ -559,7 +559,7 @@ TEST_CASE("VectorFEWeakDivergencedJdXIntegrator::AssembleRHSElementVect", // build the nonlinear form for d(psi^T R)/dx LinearForm dfdx(mesh_fes); dfdx.AddDomainIntegrator( - new mach::VectorFEWeakDivergencedJdXIntegrator(&c, &adjoint, ¤t)); + new miso::VectorFEWeakDivergencedJdXIntegrator(&c, &adjoint, ¤t)); dfdx.Assemble(); // initialize the vector that we use to perturb the mesh nodes @@ -634,7 +634,7 @@ TEST_CASE("VectorFEDomainLFMeshSensInteg::AssembleRHSElementVect" VectorFunctionCoefficient pert(3, randVectorState); /// Costruct coefficient - mach::VectorMeshDependentCoefficient current(dim); + miso::VectorMeshDependentCoefficient current(dim); std::unique_ptr coeff1( new VectorFunctionCoefficient(dim, vectorFunc, vectorFuncRevDiff)); std::unique_ptr coeff2( @@ -655,7 +655,7 @@ TEST_CASE("VectorFEDomainLFMeshSensInteg::AssembleRHSElementVect" // build the nonlinear form for d(psi^T R)/dx LinearForm dfdx(mesh_fes); dfdx.AddDomainIntegrator( - new mach::VectorFEDomainLFMeshSensInteg(&adjoint, current)); + new miso::VectorFEDomainLFMeshSensInteg(&adjoint, current)); dfdx.Assemble(); // initialize the vector that we use to perturb the mesh nodes @@ -730,7 +730,7 @@ TEST_CASE("VectorFEDomainLFMeshSensInteg::AssembleRHSElementVect" // // build the linear form for d(psi^T R)/dx // LinearForm dfdx(mesh_fes); // dfdx.AddDomainIntegrator( -// new mach::GridFuncMeshSensIntegrator(&adjoint, ¤t)); +// new miso::GridFuncMeshSensIntegrator(&adjoint, ¤t)); // dfdx.Assemble(); // GridFunction dFdX_gf(mesh_fes); @@ -809,12 +809,12 @@ TEST_CASE("MagneticEnergyIntegrator::GetEnergy") }); A.ProjectCoefficient(pert); - std::unique_ptr nu( + std::unique_ptr nu( new NonLinearCoefficient()); NonlinearForm functional(fes.get()); functional.AddDomainIntegrator( - new mach::MagneticEnergyIntegrator(*nu)); + new miso::MagneticEnergyIntegrator(*nu)); const double fun = functional.GetEnergy(A); const double b_mag = 2.0; @@ -857,7 +857,7 @@ TEST_CASE("MagneticEnergyIntegrator::AssembleElementVector") NonlinearForm functional(&fes); functional.AddDomainIntegrator( - new mach::MagneticEnergyIntegrator(nu)); + new miso::MagneticEnergyIntegrator(nu)); // initialize the vector that dJdu multiplies GridFunction p(&fes); @@ -918,7 +918,7 @@ TEST_CASE("MagneticEnergyIntegratorMeshSens::AssembleRHSElementVect") GridFunction A(&fes); A.ProjectCoefficient(pert); - auto *integ = new mach::MagneticEnergyIntegrator(nu); + auto *integ = new miso::MagneticEnergyIntegrator(nu); NonlinearForm functional(&fes); functional.AddDomainIntegrator(integ); @@ -929,7 +929,7 @@ TEST_CASE("MagneticEnergyIntegratorMeshSens::AssembleRHSElementVect") // evaluate dJdx and compute its product with p LinearForm dJdx(&mesh_fes); dJdx.AddDomainIntegrator( - new mach::MagneticEnergyIntegratorMeshSens(A, *integ)); + new miso::MagneticEnergyIntegratorMeshSens(A, *integ)); dJdx.Assemble(); double dJdx_dot_p = dJdx * p; @@ -985,12 +985,12 @@ TEST_CASE("MagneticCoenergyIntegrator::AssembleElementVector", VectorFunctionCoefficient pert(3, randVectorState); q.ProjectCoefficient(pert); - std::unique_ptr nu( + std::unique_ptr nu( // new LinearCoefficient()); new NonLinearCoefficient()); functional.AddDomainIntegrator( - new mach::MagneticCoenergyIntegrator(q, nu.get())); + new miso::MagneticCoenergyIntegrator(q, nu.get())); // initialize the vector that dJdu multiplies GridFunction v(fes.get()); @@ -1055,21 +1055,21 @@ TEST_CASE("MagneticCoenergyIntegrator::AssembleElementRHSVect", VectorFunctionCoefficient v_rand(dim, randVectorState); v.ProjectCoefficient(v_rand); - std::unique_ptr nu( + std::unique_ptr nu( new NonLinearCoefficient()); // evaluate dJdx and compute its product with v // GridFunction dJdx(*x_nodes); LinearForm dJdx(mesh_fes); dJdx.AddDomainIntegrator( - new mach::MagneticCoenergyIntegrator(q, nu.get())); + new miso::MagneticCoenergyIntegrator(q, nu.get())); dJdx.Assemble(); double dJdx_dot_v = dJdx * v; // now compute the finite-difference approximation... NonlinearForm functional(fes.get()); functional.AddDomainIntegrator( - new mach::MagneticCoenergyIntegrator(q, nu.get())); + new miso::MagneticCoenergyIntegrator(q, nu.get())); double delta = 1e-5; GridFunction x_pert(*x_nodes); @@ -1129,7 +1129,7 @@ TEST_CASE("BNormIntegrator::GetElementEnergy", NonlinearForm functional(fes.get()); functional.AddDomainIntegrator( - new mach::BNormIntegrator()); + new miso::BNormIntegrator()); const double fun = functional.GetEnergy(A); @@ -1176,7 +1176,7 @@ TEST_CASE("BNormIntegrator::AssembleElementVector", q.ProjectCoefficient(pert); functional.AddDomainIntegrator( - new mach::BNormIntegrator()); + new miso::BNormIntegrator()); // initialize the vector that dJdu multiplies GridFunction v(fes.get()); @@ -1246,14 +1246,14 @@ TEST_CASE("BNormdJdX::AssembleRHSElementVect", // GridFunction dJdx(*x_nodes); LinearForm dJdx(mesh_fes); dJdx.AddDomainIntegrator( - new mach::BNormdJdx(A)); + new miso::BNormdJdx(A)); dJdx.Assemble(); double dJdx_dot_v = dJdx * v; // now compute the finite-difference approximation... NonlinearForm functional(fes.get()); functional.AddDomainIntegrator( - new mach::BNormIntegrator()); + new miso::BNormIntegrator()); double delta = 1e-5; GridFunction x_pert(*x_nodes); @@ -1309,11 +1309,11 @@ TEST_CASE("nuBNormIntegrator::AssembleElementVector", VectorFunctionCoefficient pert(3, randVectorState); q.ProjectCoefficient(pert); - std::unique_ptr nu( + std::unique_ptr nu( new NonLinearCoefficient()); functional.AddDomainIntegrator( - new mach::nuBNormIntegrator(nu.get())); + new miso::nuBNormIntegrator(nu.get())); // initialize the vector that dJdu multiplies GridFunction v(fes.get()); @@ -1379,21 +1379,21 @@ TEST_CASE("nuBNormdJdX::AssembleRHSElementVect", VectorFunctionCoefficient v_rand(dim, randVectorState); v.ProjectCoefficient(v_rand); - std::unique_ptr nu( + std::unique_ptr nu( new NonLinearCoefficient()); // evaluate dJdx and compute its product with v // GridFunction dJdx(*x_nodes); LinearForm dJdx(mesh_fes); dJdx.AddDomainIntegrator( - new mach::nuBNormdJdx(q, nu.get())); + new miso::nuBNormdJdx(q, nu.get())); dJdx.Assemble(); double dJdx_dot_v = dJdx * v; // now compute the finite-difference approximation... NonlinearForm functional(fes.get()); functional.AddDomainIntegrator( - new mach::nuBNormIntegrator(nu.get())); + new miso::nuBNormIntegrator(nu.get())); double delta = 1e-5; GridFunction x_pert(*x_nodes); @@ -1455,21 +1455,21 @@ TEST_CASE("nuFuncIntegrator::AssembleRHSElementVect", VectorFunctionCoefficient v_rand(dim, randVectorState); v.ProjectCoefficient(v_rand); - std::unique_ptr nu( + std::unique_ptr nu( new NonLinearCoefficient()); // evaluate dJdx and compute its product with v // GridFunction dJdx(*x_nodes); LinearForm dJdx(mesh_fes); dJdx.AddDomainIntegrator( - new mach::nuFuncIntegrator(&q, nu.get())); + new miso::nuFuncIntegrator(&q, nu.get())); dJdx.Assemble(); double dJdx_dot_v = dJdx * v; // now compute the finite-difference approximation... NonlinearForm functional(fes.get()); functional.AddDomainIntegrator( - new mach::nuFuncIntegrator(nu.get())); + new miso::nuFuncIntegrator(nu.get())); double delta = 1e-5; GridFunction x_pert(*x_nodes); @@ -1531,7 +1531,7 @@ TEST_CASE("DCLossFunctionalIntegrator::GetEnergy", auto current_density = 1.0; // current density magnitude functional.AddDomainIntegrator( - new mach::DCLossFunctionalIntegrator(sigma, current, current_density)); + new miso::DCLossFunctionalIntegrator(sigma, current, current_density)); const auto R_dc = 1.0 / (sigma_val); // length / (sigma * area) const auto loss = std::pow(current_density, 2) * R_dc; @@ -1545,7 +1545,7 @@ TEST_CASE("DCLossFunctionalIntegrator::GetEnergy", } } -namespace mach +namespace miso { /// Compute the finite-difference approximation of the derivative of the /// magnetic energy with respect to B @@ -1608,8 +1608,8 @@ TEST_CASE("calcMagneticEnergy") mesh->EnsureNodes(); const double lin_nu_val = 0.42; - std::unique_ptr lin_nu(new LinearCoefficient(lin_nu_val)); - std::unique_ptr nu(new NonLinearCoefficient()); + std::unique_ptr lin_nu(new LinearCoefficient(lin_nu_val)); + std::unique_ptr nu(new NonLinearCoefficient()); /// construct elements int p = 1; @@ -1635,10 +1635,10 @@ TEST_CASE("calcMagneticEnergy") const IntegrationPoint &ip = ir->IntPoint(i); trans.SetIntPoint(&ip); - double lin_en = mach::calcMagneticEnergy(trans, ip, *lin_nu, B_mag); + double lin_en = miso::calcMagneticEnergy(trans, ip, *lin_nu, B_mag); REQUIRE(lin_en == Approx(0.5*pow(B_mag, 2)*lin_nu_val).epsilon(1e-8)); - double en = mach::calcMagneticEnergy(trans, ip, *nu, B_mag); + double en = miso::calcMagneticEnergy(trans, ip, *nu, B_mag); REQUIRE(en == Approx(nonlin_energy(B_mag)).epsilon(1e-8)); // std::cout << "lin_en: " << lin_en << " en: " << en << "\n"; } @@ -1661,8 +1661,8 @@ TEST_CASE("calcMagneticEnergyDot") 1.0, 1.0, 1.0, true))); mesh->EnsureNodes(); - // std::unique_ptr nu(new LinearCoefficient(0.75)); - std::unique_ptr nu(new NonLinearCoefficient()); + // std::unique_ptr nu(new LinearCoefficient(0.75)); + std::unique_ptr nu(new NonLinearCoefficient()); /// construct elements int p = 1; @@ -1686,8 +1686,8 @@ TEST_CASE("calcMagneticEnergyDot") const IntegrationPoint &ip = ir->IntPoint(i); trans.SetIntPoint(&ip); - double dWdB = mach::calcMagneticEnergyDot(trans, ip, *nu, B_mag); - double dWdB_fd = mach::calcMagneticEnergyFD(trans, ip, *nu, B_mag); + double dWdB = miso::calcMagneticEnergyDot(trans, ip, *nu, B_mag); + double dWdB_fd = miso::calcMagneticEnergyFD(trans, ip, *nu, B_mag); REQUIRE(dWdB == Approx(dWdB_fd).epsilon(1e-10)); } } @@ -1709,8 +1709,8 @@ TEST_CASE("calcMagneticEnergyDoubleDot") 1.0, 1.0, 1.0, true))); mesh->EnsureNodes(); - // std::unique_ptr nu(new LinearCoefficient(0.75)); - std::unique_ptr nu(new NonLinearCoefficient()); + // std::unique_ptr nu(new LinearCoefficient(0.75)); + std::unique_ptr nu(new NonLinearCoefficient()); /// construct elements int p = 1; @@ -1734,8 +1734,8 @@ TEST_CASE("calcMagneticEnergyDoubleDot") const IntegrationPoint &ip = ir->IntPoint(i); trans.SetIntPoint(&ip); - double d2WdB2 = mach::calcMagneticEnergyDoubleDot(trans, ip, *nu, B_mag); - double d2WdB2_fd = mach::calcMagneticEnergyDoubleFD(trans, ip, *nu, B_mag); + double d2WdB2 = miso::calcMagneticEnergyDoubleDot(trans, ip, *nu, B_mag); + double d2WdB2_fd = miso::calcMagneticEnergyDoubleFD(trans, ip, *nu, B_mag); REQUIRE(d2WdB2 == Approx(d2WdB2_fd).epsilon(1e-10)); } } @@ -1781,13 +1781,13 @@ TEST_CASE("ForceIntegrator::GetElementEnergy") NonlinearForm functional(&fes); functional.AddDomainIntegrator( - new mach::ForceIntegrator(nu, v)); + new miso::ForceIntegrator(nu, v)); auto force = functional.GetEnergy(A); NonlinearForm energy(&fes); energy.AddDomainIntegrator( - new mach::MagneticEnergyIntegrator(nu)); + new miso::MagneticEnergyIntegrator(nu)); add(x_nodes, -delta, v, x_nodes); auto dWds = -energy.GetEnergy(A); @@ -1841,7 +1841,7 @@ TEST_CASE("ForceIntegrator::AssembleElementVector") NonlinearForm functional(&fes); functional.AddDomainIntegrator( - new mach::ForceIntegrator(nu, v)); + new miso::ForceIntegrator(nu, v)); // initialize the vector that dJdu multiplies GridFunction p(&fes); @@ -1902,7 +1902,7 @@ TEST_CASE("ForceIntegratorMeshSens::AssembleRHSElementVect") GridFunction A(&fes); A.ProjectCoefficient(pert); - auto *integ = new mach::ForceIntegrator(nu, v); + auto *integ = new miso::ForceIntegrator(nu, v); NonlinearForm functional(&fes); functional.AddDomainIntegrator(integ); @@ -1913,7 +1913,7 @@ TEST_CASE("ForceIntegratorMeshSens::AssembleRHSElementVect") // evaluate dJdx and compute its product with p LinearForm dJdx(&mesh_fes); dJdx.AddDomainIntegrator( - new mach::ForceIntegratorMeshSens(A, *integ)); + new miso::ForceIntegratorMeshSens(A, *integ)); dJdx.Assemble(); double dJdx_dot_p = dJdx * p; @@ -1967,14 +1967,14 @@ TEST_CASE("ForceIntegratorMeshSens::AssembleRHSElementVect") // VectorFunctionCoefficient pert(3, randBaselineVectorPert); // a.ProjectCoefficient(pert); -// std::unique_ptr nu( +// std::unique_ptr nu( // new NonLinearCoefficient()); // std::unique_ptr mag( // new mfem::VectorFunctionCoefficient(3, mag_func)); // NonlinearForm res(fes.get()); -// res.AddDomainIntegrator(new mach::MagnetizationIntegrator(nu.get(), +// res.AddDomainIntegrator(new miso::MagnetizationIntegrator(nu.get(), // mag.get())); // // initialize the vector that the Jacobian multiplies diff --git a/test/unit/test_euler_assemble.cpp b/test/unit/test_euler_assemble.cpp index 285818eb..39c3d65b 100644 --- a/test/unit/test_euler_assemble.cpp +++ b/test/unit/test_euler_assemble.cpp @@ -30,7 +30,7 @@ TEST_CASE("EulerIntegrator::AssembleElementGrad", "[EulerIntegrator]") &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); - res.AddDomainIntegrator(new mach::EulerIntegrator<2>(diff_stack)); + res.AddDomainIntegrator(new miso::EulerIntegrator<2>(diff_stack)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -70,7 +70,7 @@ TEST_CASE("EulerIntegrator::AssembleElementGrad", "[EulerIntegrator]") &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); - res.AddDomainIntegrator(new mach::EulerIntegrator<2>(diff_stack)); + res.AddDomainIntegrator(new miso::EulerIntegrator<2>(diff_stack)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -128,7 +128,7 @@ TEST_CASE("SlipWallBC::AssembleFaceGrad", "[SlipWallBC]") &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); - res.AddBdrFaceIntegrator(new mach::SlipWallBC(diff_stack, + res.AddBdrFaceIntegrator(new miso::SlipWallBC(diff_stack, fec.get())); // initialize state; here we randomly perturb a constant state @@ -169,7 +169,7 @@ TEST_CASE("SlipWallBC::AssembleFaceGrad", "[SlipWallBC]") &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); - res.AddBdrFaceIntegrator(new mach::SlipWallBC(diff_stack, + res.AddBdrFaceIntegrator(new miso::SlipWallBC(diff_stack, fec.get())); // initialize state; here we randomly perturb a constant state @@ -234,7 +234,7 @@ TEST_CASE("PressureForce::AssembleVector", "[PressureForce]") NonlinearForm drag(fes.get()); drag.AddBdrFaceIntegrator( - new mach::PressureForce(diff_stack, fec.get(), drag_dir)); + new miso::PressureForce(diff_stack, fec.get(), drag_dir)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -270,7 +270,7 @@ TEST_CASE("PressureForce::AssembleVector", "[PressureForce]") NonlinearForm drag(fes.get()); drag.AddBdrFaceIntegrator( - new mach::PressureForce(diff_stack, fec.get(), drag_dir)); + new miso::PressureForce(diff_stack, fec.get(), drag_dir)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -326,7 +326,7 @@ TEMPLATE_TEST_CASE_SIG("DyadicFluxIntegrator::AssembleElementGrad", NonlinearForm res(fes.get()); res.AddDomainIntegrator( - new mach::IsmailRoeIntegrator<2,entvar>(diff_stack)); + new miso::IsmailRoeIntegrator<2,entvar>(diff_stack)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -366,7 +366,7 @@ TEMPLATE_TEST_CASE_SIG("DyadicFluxIntegrator::AssembleElementGrad", &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); - res.AddDomainIntegrator(new mach::IsmailRoeIntegrator<2, entvar>(diff_stack)); + res.AddDomainIntegrator(new miso::IsmailRoeIntegrator<2, entvar>(diff_stack)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -428,7 +428,7 @@ TEMPLATE_TEST_CASE_SIG("DyadicFluxIntegrator::AssembleElementGrad", // &mesh, fec.get(), num_state, Ordering::byVDIM)); // NonlinearForm res(fes.get()); -// res.AddInteriorFaceIntegrator(new mach::InterfaceIntegrator( +// res.AddInteriorFaceIntegrator(new miso::InterfaceIntegrator( // diff_stack, diss_coeff, fec.get())); // // initialize state; here we randomly perturb a constant state @@ -490,7 +490,7 @@ TEMPLATE_TEST_CASE_SIG("EntStableLPSIntegrator::AssembleElementGrad using entvar NonlinearForm res(fes.get()); res.AddDomainIntegrator( - new mach::EntStableLPSIntegrator<2, entvar>(diff_stack)); + new miso::EntStableLPSIntegrator<2, entvar>(diff_stack)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -530,7 +530,7 @@ TEMPLATE_TEST_CASE_SIG("EntStableLPSIntegrator::AssembleElementGrad using entvar &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); - res.AddDomainIntegrator(new mach::EntStableLPSIntegrator<2, entvar>(diff_stack)); + res.AddDomainIntegrator(new miso::EntStableLPSIntegrator<2, entvar>(diff_stack)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -600,7 +600,7 @@ TEMPLATE_TEST_CASE_SIG("MassIntegrator::AssembleElementGrad", NonlinearForm res(fes.get()); res.AddDomainIntegrator( - new mach::MassIntegrator<2, entvar>(diff_stack)); + new miso::MassIntegrator<2, entvar>(diff_stack)); // evaluate the Jacobian and compute its product with v Operator &Jac = res.GetGradient(u); @@ -641,7 +641,7 @@ TEMPLATE_TEST_CASE_SIG("MassIntegrator::AssembleElementGrad", NonlinearForm res(fes.get()); res.AddDomainIntegrator( - new mach::MassIntegrator<2, entvar>(diff_stack)); + new miso::MassIntegrator<2, entvar>(diff_stack)); // evaluate the Jacobian and compute its product with v Operator &Jac = res.GetGradient(u); @@ -695,7 +695,7 @@ TEMPLATE_TEST_CASE_SIG("InviscidFaceIntegrator::AssembleFaceGrad", NonlinearForm res(fes.get()); res.AddInteriorFaceIntegrator( - new mach::InterfaceIntegrator(diff_stack, diss_coeff, + new miso::InterfaceIntegrator(diff_stack, diss_coeff, fec.get())); // initialize state; here we randomly perturb a constant state diff --git a/test/unit/test_euler_fluxes.cpp b/test/unit/test_euler_fluxes.cpp index 54072c1e..c7493ac7 100644 --- a/test/unit/test_euler_fluxes.cpp +++ b/test/unit/test_euler_fluxes.cpp @@ -6,8 +6,8 @@ TEST_CASE( "Log-average is correct", "[log-avg]") { using namespace euler_data; - REQUIRE( mach::logavg(rho, rho) == Approx(rho) ); - REQUIRE( mach::logavg(rho, 2.0*rho) == Approx(1.422001977589051) ); + REQUIRE( miso::logavg(rho, rho) == Approx(rho) ); + REQUIRE( miso::logavg(rho, 2.0*rho) == Approx(1.422001977589051) ); } TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", @@ -33,27 +33,27 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", SECTION("Pressure function is correct") { - REQUIRE(mach::pressure(q.GetData()) == + REQUIRE(miso::pressure(q.GetData()) == Approx(press_check[dim - 1])); } SECTION("Entropy function is correct") { - REQUIRE(mach::entropy(q.GetData()) == + REQUIRE(miso::entropy(q.GetData()) == Approx(entropy_check[dim - 1])); } SECTION("Entropy function is correct when using entropy variables") { mfem::Vector w(dim + 2); - mach::calcEntropyVars(q.GetData(), w.GetData()); - REQUIRE(mach::entropy(w.GetData()) == + miso::calcEntropyVars(q.GetData(), w.GetData()); + REQUIRE(miso::entropy(w.GetData()) == Approx(entropy_check[dim - 1])); } SECTION( "Spectral radius of flux Jacobian is correct" ) { - REQUIRE(mach::calcSpectralRadius(nrm.GetData(), q.GetData()) == Approx(spect_check[dim - 1])); + REQUIRE(miso::calcSpectralRadius(nrm.GetData(), q.GetData()) == Approx(spect_check[dim - 1])); } SECTION( "Euler flux is correct" ) @@ -62,7 +62,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // following constructor is to find the appropriate offset int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector flux_vec(flux_check + offset, dim + 2); - mach::calcEulerFlux(nrm.GetData(), q.GetData(), flux.GetData()); + miso::calcEulerFlux(nrm.GetData(), q.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) { REQUIRE( flux(i) == Approx(flux_vec(i)) ); @@ -73,7 +73,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", { int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector flux_vec(flux_check + offset, dim + 2); - mach::calcRoeFaceFlux(nrm.GetData(), q.GetData(), + miso::calcRoeFaceFlux(nrm.GetData(), q.GetData(), q.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) { @@ -100,7 +100,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", { DYNAMIC_SECTION( "Ismail-Roe flux is correct in direction " << di ) { - mach::calcIsmailRoeFlux(di, q.GetData(), qR.GetData(), + miso::calcIsmailRoeFlux(di, q.GetData(), qR.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) { @@ -110,9 +110,9 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", DYNAMIC_SECTION( "Ismail-Roe flux (based on entropy vars) is correct in direction " << di ) { mfem::Vector wL(dim + 2), wR(dim + 2); - mach::calcEntropyVars(q.GetData(), wL.GetData()); - mach::calcEntropyVars(qR.GetData(), wR.GetData()); - mach::calcIsmailRoeFluxUsingEntVars(di, wL.GetData(), + miso::calcEntropyVars(q.GetData(), wL.GetData()); + miso::calcEntropyVars(qR.GetData(), wR.GetData()); + miso::calcIsmailRoeFluxUsingEntVars(di, wL.GetData(), wR.GetData(), flux.GetData()); for (int i = 0; i < dim + 2; ++i) @@ -125,7 +125,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", SECTION( "Ismail-Roe face flux is correct in given direction" ) { // get flux from function - mach::calcIsmailRoeFaceFlux(nrm.GetData(), q.GetData(), + miso::calcIsmailRoeFaceFlux(nrm.GetData(), q.GetData(), qR.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) { @@ -143,20 +143,20 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", { // get flux from function double diss_coeff = 1.0; - mach::calcIsmailRoeFaceFluxWithDiss( + miso::calcIsmailRoeFaceFluxWithDiss( nrm.GetData(), diss_coeff, q.GetData(), qR.GetData(), flux.GetData()); // evaluate the dissipation externally (since we cannot use fluxIR_check // data here directly) mfem::Vector wL(dim+2), wR(dim+2); - mach::calcEntropyVars(q.GetData(), wL.GetData()); - mach::calcEntropyVars(qR.GetData(), wR.GetData()); + miso::calcEntropyVars(q.GetData(), wL.GetData()); + miso::calcEntropyVars(qR.GetData(), wR.GetData()); mfem::Vector q_avg(dim+2); add(0.5, q, 0.5, qR, q_avg); mfem::Vector dqdw(dim+2); wL -= wR; - mach::calcdQdWProduct(q_avg.GetData(), wL.GetData(), + miso::calcdQdWProduct(q_avg.GetData(), wL.GetData(), dqdw.GetData()); - double spect = mach::calcSpectralRadius(nrm.GetData(), + double spect = miso::calcSpectralRadius(nrm.GetData(), q_avg.GetData()); for (int i = 0; i < dim+2; ++i) @@ -175,9 +175,9 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", { // get flux from function mfem::Vector wL(dim+2), wR(dim+2); - mach::calcEntropyVars(q.GetData(), wL.GetData()); - mach::calcEntropyVars(qR.GetData(), wR.GetData()); - mach::calcIsmailRoeFaceFluxUsingEntVars( + miso::calcEntropyVars(q.GetData(), wL.GetData()); + miso::calcEntropyVars(qR.GetData(), wR.GetData()); + miso::calcIsmailRoeFaceFluxUsingEntVars( nrm.GetData(), wL.GetData(), wR.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) { @@ -195,10 +195,10 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", { // get flux from function mfem::Vector wL(dim+2), wR(dim+2); - mach::calcEntropyVars(q.GetData(), wL.GetData()); - mach::calcEntropyVars(qR.GetData(), wR.GetData()); + miso::calcEntropyVars(q.GetData(), wL.GetData()); + miso::calcEntropyVars(qR.GetData(), wR.GetData()); double diss_coeff = 1.0; - mach::calcIsmailRoeFaceFluxWithDissUsingEntVars( + miso::calcIsmailRoeFaceFluxWithDissUsingEntVars( nrm.GetData(), diss_coeff, wL.GetData(), wR.GetData(), flux.GetData()); // evaluate the dissipation externally (since we cannot use fluxIR_check @@ -207,9 +207,9 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", add(0.5, q, 0.5, qR, q_avg); mfem::Vector dqdw(dim+2); wL -= wR; - mach::calcdQdWProduct(q_avg.GetData(), wL.GetData(), + miso::calcdQdWProduct(q_avg.GetData(), wL.GetData(), dqdw.GetData()); - double spect = mach::calcSpectralRadius(nrm.GetData(), + double spect = miso::calcSpectralRadius(nrm.GetData(), q_avg.GetData()); for (int i = 0; i < dim+2; ++i) @@ -230,7 +230,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // the following constructor is to find the appropriate offset int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector entvar_vec(entvar_check + offset, dim + 2); - mach::calcEntropyVars(q.GetData(), qR.GetData()); + miso::calcEntropyVars(q.GetData(), qR.GetData()); for (int i = 0; i < dim+2; ++i) { REQUIRE( qR(i) == Approx(entvar_vec(i)) ); @@ -243,7 +243,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // the following constructor is to find the appropriate offset int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector w(entvar_check + offset, dim + 2); - mach::calcConservativeVars(w.GetData(), qR.GetData()); + miso::calcConservativeVars(w.GetData(), qR.GetData()); for (int i = 0; i < dim+2; ++i) { REQUIRE( qR(i) == Approx(q(i)) ); @@ -256,7 +256,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // in the following constructor is to find the appropriate offset int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector dqdw_prod(dqdw_prod_check + offset, dim+2); - mach::calcdQdWProduct(q.GetData(), qR.GetData(), + miso::calcdQdWProduct(q.GetData(), qR.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) { @@ -272,7 +272,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // appropriate offset int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector flux_vec(flux_check + offset, dim + 2); - mach::calcBoundaryFlux(nrm.GetData(), q.GetData(), + miso::calcBoundaryFlux(nrm.GetData(), q.GetData(), q.GetData(), work.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) @@ -289,7 +289,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // appropriate offset int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector flux_vec(flux_check + offset, dim + 2); - mach::calcFarFieldFlux(nrm.GetData(), q.GetData(), + miso::calcFarFieldFlux(nrm.GetData(), q.GetData(), q.GetData(), work.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) @@ -307,8 +307,8 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", int offset = div((dim+1)*(dim+2),2).quot - 3; mfem::Vector flux_vec(flux_check + offset, dim + 2); mfem::Vector w(dim+2); - mach::calcEntropyVars(q.GetData(), w.GetData()); - mach::calcFarFieldFlux(nrm.GetData(), q.GetData(), + miso::calcEntropyVars(q.GetData(), w.GetData()); + miso::calcFarFieldFlux(nrm.GetData(), q.GetData(), w.GetData(), work.GetData(), flux.GetData()); for (int i = 0; i < dim+2; ++i) @@ -321,7 +321,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", { // In this test case, the wall normal is set proportional to the momentum, // so the momentum should come back as zero - mach::projectStateOntoWall(q.GetData()+1, q.GetData(), + miso::projectStateOntoWall(q.GetData()+1, q.GetData(), flux.GetData()); REQUIRE( flux(0) == Approx(q(0)) ); for (int i = 0; i < dim; ++i) @@ -337,12 +337,12 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // proportional to the momentum, so the flux will be zero, except for the // term flux[1:dim] = pressure*dir[0:dim-1] mfem::Vector x(dim); - mach::calcSlipWallFlux(x.GetData(), q.GetData()+1, + miso::calcSlipWallFlux(x.GetData(), q.GetData()+1, q.GetData(), flux.GetData()); - //mach::projectStateOntoWall(q.GetData()+1, q.GetData(), + //miso::projectStateOntoWall(q.GetData()+1, q.GetData(), // work.GetData()); - //double press = mach::pressure(work.GetData()); - double press = mach::pressure(q.GetData()); + //double press = miso::pressure(work.GetData()); + double press = miso::pressure(q.GetData()); REQUIRE( flux(0) == Approx(0.0).margin(abs_tol) ); for (int i = 0; i < dim; ++i) { @@ -358,10 +358,10 @@ TEMPLATE_TEST_CASE_SIG("Euler flux functions, etc, produce correct values", // term flux[1:dim] = pressure*dir[0:dim-1] mfem::Vector x(dim); mfem::Vector w(dim + 2); - mach::calcEntropyVars(q.GetData(), w.GetData()); - mach::calcSlipWallFlux(x.GetData(), q.GetData() + 1, + miso::calcEntropyVars(q.GetData(), w.GetData()); + miso::calcSlipWallFlux(x.GetData(), q.GetData() + 1, w.GetData(), flux.GetData()); - double press = mach::pressure(q.GetData()); + double press = miso::pressure(q.GetData()); REQUIRE( flux(0) == Approx(0.0).margin(abs_tol) ); for (int i = 0; i < dim; ++i) { @@ -391,7 +391,7 @@ TEST_CASE( "calcBoundaryFlux is correct", "[bndry-flux]") qbnd(di+1) = rhou2[di]; nrm(di) = dir[di]; } - mach::calcBoundaryFlux(nrm.GetData(), qbnd.GetData(), q.GetData(), + miso::calcBoundaryFlux(nrm.GetData(), qbnd.GetData(), q.GetData(), work.GetData(), flux.GetData()); for (int i = 0; i < 4; ++i) { @@ -415,10 +415,10 @@ TEST_CASE( "calcIsentropicVortexFlux is correct", "[vortex-flux]") { nrm(di) = dir[di]; } - mach::calcIsentropicVortexState(x.GetData(), q.GetData()); - mach::calcIsentropicVortexFlux(x.GetData(), nrm.GetData(), + miso::calcIsentropicVortexState(x.GetData(), q.GetData()); + miso::calcIsentropicVortexFlux(x.GetData(), nrm.GetData(), q.GetData(), flux.GetData()); - mach::calcEulerFlux(nrm.GetData(), q.GetData(), flux2.GetData()); + miso::calcEulerFlux(nrm.GetData(), q.GetData(), flux2.GetData()); for (int i = 0; i < 4; ++i) { REQUIRE( flux(i) == Approx(flux2(i)) ); diff --git a/test/unit/test_euler_integ.cpp b/test/unit/test_euler_integ.cpp index 4ec7929e..ba2fcd1f 100644 --- a/test/unit/test_euler_integ.cpp +++ b/test/unit/test_euler_integ.cpp @@ -22,7 +22,7 @@ TEMPLATE_TEST_CASE_SIG("Euler flux jacobian", "[euler_flux_jac]", nrm(di) = dir[di]; } adept::Stack stack; - mach::EulerIntegrator eulerinteg(stack); + miso::EulerIntegrator eulerinteg(stack); SECTION(" Euler flux jacobian w.r.t state is correct.") { @@ -128,7 +128,7 @@ TEMPLATE_TEST_CASE_SIG("Ismail-Roe Jacobian", "[Ismail]", mfem::Vector qL_plus(qL), qL_minus(qL); mfem::Vector qR_plus(qR), qR_minus(qR); adept::Stack diff_stack; - mach::IsmailRoeIntegrator ismailinteg(diff_stack); + miso::IsmailRoeIntegrator ismailinteg(diff_stack); // +ve perturbation qL_plus.Add(delta, v); qR_plus.Add(delta, v); @@ -202,8 +202,8 @@ TEMPLATE_TEST_CASE_SIG("Ismail-Roe based on ent-vars Jacobian", "[Ismail-ent]", qL(di + 1) = rhou[di]; qR(di + 1) = rhou2[di]; } - mach::calcEntropyVars(qL.GetData(), wL.GetData()); - mach::calcEntropyVars(qR.GetData(), wR.GetData()); + miso::calcEntropyVars(qL.GetData(), wL.GetData()); + miso::calcEntropyVars(qR.GetData(), wR.GetData()); // create perturbation vector for (int di = 0; di < dim + 2; ++di) { @@ -213,7 +213,7 @@ TEMPLATE_TEST_CASE_SIG("Ismail-Roe based on ent-vars Jacobian", "[Ismail-ent]", mfem::Vector wL_plus(wL), wL_minus(wL); mfem::Vector wR_plus(wR), wR_minus(wR); adept::Stack diff_stack; - mach::IsmailRoeIntegrator ismailinteg(diff_stack); + miso::IsmailRoeIntegrator ismailinteg(diff_stack); // +ve perturbation wL_plus.Add(delta, v); wR_plus.Add(delta, v); @@ -299,7 +299,7 @@ TEMPLATE_TEST_CASE_SIG("Ismail-Roe face-flux Jacobian", "[Ismail-face]", double diss_coeff = 1.0; std::unique_ptr fec( new mfem::SBPCollection(1, dim)); - mach::InterfaceIntegrator ismailfaceinteg(diff_stack, diss_coeff, + miso::InterfaceIntegrator ismailfaceinteg(diff_stack, diss_coeff, fec.get()); // +ve perturbation qL_plus.Add(delta, v); @@ -374,8 +374,8 @@ TEMPLATE_TEST_CASE_SIG("Ismail-Roe face-flux Jacobian based on entropy variables qL(di + 1) = rhou[di]; qR(di + 1) = rhou2[di]; } - mach::calcEntropyVars(qL.GetData(), wL.GetData()); - mach::calcEntropyVars(qR.GetData(), wR.GetData()); + miso::calcEntropyVars(qL.GetData(), wL.GetData()); + miso::calcEntropyVars(qR.GetData(), wR.GetData()); // create perturbation vector for (int di = 0; di < dim + 2; ++di) { @@ -388,7 +388,7 @@ TEMPLATE_TEST_CASE_SIG("Ismail-Roe face-flux Jacobian based on entropy variables double diss_coeff = 1.0; std::unique_ptr fec( new mfem::SBPCollection(1, dim)); - mach::InterfaceIntegrator ismailfaceinteg(diff_stack, diss_coeff, + miso::InterfaceIntegrator ismailfaceinteg(diff_stack, diss_coeff, fec.get()); // +ve perturbation wL_plus.Add(delta, v); @@ -454,7 +454,7 @@ TEMPLATE_TEST_CASE_SIG("ApplyLPSScaling", "[LPSScaling]", // Create the adjJ matrix, the AD stack, and the integrator mfem::DenseMatrix adjJ(adjJ_data, dim, dim); adept::Stack diff_stack; - mach::EntStableLPSIntegrator lpsinteg(diff_stack); + miso::EntStableLPSIntegrator lpsinteg(diff_stack); SECTION("Apply scaling jacobian w.r.t AdjJ is correct") { @@ -578,11 +578,11 @@ TEMPLATE_TEST_CASE_SIG("Mass integrator calcMatVec Jacobians", q(di + 1) = rhou[di]; } mfem::Vector w(dim+2); - mach::calcEntropyVars(q.GetData(), w.GetData()); + miso::calcEntropyVars(q.GetData(), w.GetData()); // Create the AD stack and the integrator adept::Stack diff_stack; - mach::MassIntegrator mass_integ(diff_stack); + miso::MassIntegrator mass_integ(diff_stack); SECTION("convertVarsJacState Jacobian w.r.t state is correct") { @@ -638,7 +638,7 @@ TEMPLATE_TEST_CASE_SIG("Isentropic vortex BC flux", "[IsentropricVortexBC]", } if (entvar) { - mach::calcEntropyVars(q.GetData(), w.GetData()); + miso::calcEntropyVars(q.GetData(), w.GetData()); } else { @@ -654,7 +654,7 @@ TEMPLATE_TEST_CASE_SIG("Isentropic vortex BC flux", "[IsentropricVortexBC]", SECTION("Jacobian of Isentropic Vortex BC flux w.r.t state is correct") { fec.reset(new mfem::SBPCollection(1, dim)); - mach::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); + miso::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim + 2); for (int i = 0; i < dim + 2; i++) @@ -694,7 +694,7 @@ TEMPLATE_TEST_CASE_SIG("Isentropic vortex BC flux", "[IsentropricVortexBC]", SECTION("Jacobian of Isentropic Vortex BC flux w.r.t state is correct (DSBP)") { fec.reset(new mfem::DSBPCollection(1, dim)); - mach::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); + miso::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim + 2); for (int i = 0; i < dim + 2; i++) @@ -734,7 +734,7 @@ TEMPLATE_TEST_CASE_SIG("Isentropic vortex BC flux", "[IsentropricVortexBC]", SECTION("Jacobian of Isentropic Vortex BC flux w.r.t dir is correct") { fec.reset(new mfem::SBPCollection(1, dim)); - mach::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); + miso::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim); for (int i = 0; i < dim; i++) @@ -774,7 +774,7 @@ TEMPLATE_TEST_CASE_SIG("Isentropic vortex BC flux", "[IsentropricVortexBC]", SECTION("Jacobian of Isentropic Vortex BC flux w.r.t dir is correct (DSBP)") { fec.reset(new mfem::DSBPCollection(1, dim)); - mach::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); + miso::IsentropicVortexBC isentropic_vortex(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim); for (int i = 0; i < dim; i++) @@ -834,7 +834,7 @@ TEMPLATE_TEST_CASE_SIG("Slip Wall Flux Jacobians", "[Slip Wall]", } if (entvar) { - mach::calcEntropyVars(q.GetData(), w.GetData()); + miso::calcEntropyVars(q.GetData(), w.GetData()); } else { @@ -852,7 +852,7 @@ TEMPLATE_TEST_CASE_SIG("Slip Wall Flux Jacobians", "[Slip Wall]", { // Define the SBP elements and finite-element space fec.reset(new mfem::SBPCollection(1, dim)); - mach::SlipWallBC slip_wall(diff_stack, fec.get()); + miso::SlipWallBC slip_wall(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim + 2); for (int i = 0; i < dim + 2; i++) @@ -893,7 +893,7 @@ TEMPLATE_TEST_CASE_SIG("Slip Wall Flux Jacobians", "[Slip Wall]", { // Define the SBP elements and finite-element space fec.reset(new mfem::DSBPCollection(1, dim)); - mach::SlipWallBC slip_wall(diff_stack, fec.get()); + miso::SlipWallBC slip_wall(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim + 2); for (int i = 0; i < dim + 2; i++) @@ -934,7 +934,7 @@ TEMPLATE_TEST_CASE_SIG("Slip Wall Flux Jacobians", "[Slip Wall]", { // Define the SBP elements and finite-element space fec.reset(new mfem::SBPCollection(1, dim)); - mach::SlipWallBC slip_wall(diff_stack, fec.get()); + miso::SlipWallBC slip_wall(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim); for (int i = 0; i < dim; i++) @@ -975,7 +975,7 @@ TEMPLATE_TEST_CASE_SIG("Slip Wall Flux Jacobians", "[Slip Wall]", { // Define the SBP elements and finite-element space fec.reset(new mfem::DSBPCollection(1, dim)); - mach::SlipWallBC slip_wall(diff_stack, fec.get()); + miso::SlipWallBC slip_wall(diff_stack, fec.get()); // create the perturbation vector mfem::Vector v(dim); for (int i = 0; i < dim; i++) @@ -1056,7 +1056,7 @@ TEMPLATE_TEST_CASE_SIG("Pressure force gradient", "[Pressure Force]", { // Define the SBP elements and finite-element space fec.reset(new mfem::SBPCollection(1, dim)); - mach::PressureForce force(diff_stack, fec.get(), drag_dir); + miso::PressureForce force(diff_stack, fec.get(), drag_dir); // create the perturbation vector mfem::Vector v(dim + 2); for (int i = 0; i < dim + 2; i++) @@ -1086,12 +1086,12 @@ TEMPLATE_TEST_CASE_SIG("Pressure force gradient", "[Pressure Force]", } mfem::Vector w(dim + 2); - mach::calcEntropyVars(q.GetData(), w.GetData()); + miso::calcEntropyVars(q.GetData(), w.GetData()); SECTION("Gradient of pressure stress w.r.t w is correct") { // Define the SBP elements and finite-element space fec.reset(new mfem::SBPCollection(1, dim)); - mach::PressureForce force(diff_stack, fec.get(), drag_dir); + miso::PressureForce force(diff_stack, fec.get(), drag_dir); // create the perturbation vector mfem::Vector v(dim + 2); for (int i = 0; i < dim + 2; i++) @@ -1148,7 +1148,7 @@ TEMPLATE_TEST_CASE_SIG("Entropy variables Jacobian", "[lps integrator]", // perturbed vectors mfem::Vector q_plus(q), q_minus(q); adept::Stack diff_stack; - mach::EntStableLPSIntegrator lpsinteg(diff_stack); + miso::EntStableLPSIntegrator lpsinteg(diff_stack); // +ve perturbation q_plus.Add(delta, v); // -ve perturbation diff --git a/test/unit/test_euler_sens_integ.cpp b/test/unit/test_euler_sens_integ.cpp index b4e42a38..ee66f0ec 100644 --- a/test/unit/test_euler_sens_integ.cpp +++ b/test/unit/test_euler_sens_integ.cpp @@ -37,7 +37,7 @@ TEMPLATE_TEST_CASE_SIG("IsmailRoeMeshSensIntegrator::AssembleElementVector", // we use res for finite-difference approximation NonlinearForm res(fes.get()); res.AddDomainIntegrator( - new mach::IsmailRoeIntegrator<2,entvar>(diff_stack)); + new miso::IsmailRoeIntegrator<2,entvar>(diff_stack)); // initialize state and adjoint; here we randomly perturb a constant state GridFunction state(fes.get()), adjoint(fes.get()); @@ -52,7 +52,7 @@ TEMPLATE_TEST_CASE_SIG("IsmailRoeMeshSensIntegrator::AssembleElementVector", // build the linear form for d(psi^T R)/dx LinearForm dfdx(mesh_fes); dfdx.AddDomainIntegrator( - new mach::IsmailRoeMeshSensIntegrator<2,entvar>( + new miso::IsmailRoeMeshSensIntegrator<2,entvar>( state, adjoint, num_state)); dfdx.Assemble(); @@ -113,7 +113,7 @@ TEMPLATE_TEST_CASE_SIG("SlipWallBCMeshSens::AssembleRHSElementVect", // we use res for finite-difference approximation NonlinearForm res(fes.get()); res.AddBdrFaceIntegrator( - new mach::SlipWallBC<2, entvar>(diff_stack, fec.get())); + new miso::SlipWallBC<2, entvar>(diff_stack, fec.get())); // initialize state and adjoint; here we randomly perturb a constant state GridFunction state(fes.get()), adjoint(fes.get()); @@ -128,7 +128,7 @@ TEMPLATE_TEST_CASE_SIG("SlipWallBCMeshSens::AssembleRHSElementVect", // build the linear form for d(psi^T R)/dx LinearForm dfdx(mesh_fes); dfdx.AddBdrFaceIntegrator( - new mach::SlipWallBCMeshSens<2, entvar>( + new miso::SlipWallBCMeshSens<2, entvar>( diff_stack, state, adjoint, num_state)); dfdx.Assemble(); diff --git a/test/unit/test_evolver.cpp b/test/unit/test_evolver.cpp index 1e22c323..03d338c8 100644 --- a/test/unit/test_evolver.cpp +++ b/test/unit/test_evolver.cpp @@ -9,7 +9,7 @@ TEST_CASE("Testing RRKImplicitMidpointSolver", "[rrk]") { const bool verbose = false; // set to true for some output - std::ostream *out = verbose ? mach::getOutStream(0) : mach::getOutStream(1); + std::ostream *out = verbose ? miso::getOutStream(0) : miso::getOutStream(1); using namespace mfem; // For solving dense matrix systems @@ -32,7 +32,7 @@ TEST_CASE("Testing RRKImplicitMidpointSolver", "[rrk]") }; // Operator for exponential-entropy ODE, Eq. (3.1) in Ranocha et al. 2020 - class ExponentialODE : public mach::EntropyConstrainedOperator + class ExponentialODE : public miso::EntropyConstrainedOperator { public: ExponentialODE() : EntropyConstrainedOperator( @@ -105,7 +105,7 @@ TEST_CASE("Testing RRKImplicitMidpointSolver", "[rrk]") }; std::unique_ptr ode(new ExponentialODE()); - std::unique_ptr solver(new mach::RRKImplicitMidpointSolver(out)); + std::unique_ptr solver(new miso::RRKImplicitMidpointSolver(out)); solver->Init(*ode); double t_final = 5.0; diff --git a/test/unit/test_irrotational_projector.cpp b/test/unit/test_irrotational_projector.cpp index 78cdca22..76d7a7bc 100644 --- a/test/unit/test_irrotational_projector.cpp +++ b/test/unit/test_irrotational_projector.cpp @@ -3,7 +3,7 @@ #include "catch.hpp" #include "mfem.hpp" -#include "mach_input.hpp" +#include "miso_input.hpp" #include "irrotational_projector.hpp" #include "electromag_test_data.hpp" @@ -40,7 +40,7 @@ TEST_CASE("IrrotationalProjector::vectorJacobianProduct wrt in") auto ir_order = h1_fes.GetElementTransformation(0)->OrderW() + 2 * fes.GetFE(0)->GetOrder(); - mach::IrrotationalProjector op(h1_fes, fes, ir_order); + miso::IrrotationalProjector op(h1_fes, fes, ir_order); // initialize the vector that the Jacobian multiplies ParGridFunction p(&fes); @@ -98,7 +98,7 @@ TEST_CASE("IrrotationalProjector::vectorJacobianProduct wrt mesh_coords") // extract mesh nodes and get their finite-element space auto &x_nodes = dynamic_cast(*mesh.GetNodes()); - auto inputs = mach::MachInputs({ + auto inputs = miso::MISOInputs({ {"mesh_coords", x_nodes.GetData()} }); auto &mesh_fes = *x_nodes.ParFESpace(); @@ -110,7 +110,7 @@ TEST_CASE("IrrotationalProjector::vectorJacobianProduct wrt mesh_coords") auto ir_order = h1_fes.GetElementTransformation(0)->OrderW() + 2 * fes.GetFE(0)->GetOrder(); - mach::IrrotationalProjector op(h1_fes, fes, ir_order); + miso::IrrotationalProjector op(h1_fes, fes, ir_order); // initialize the vector that the Jacobian multiplies ParGridFunction p(&fes); diff --git a/test/unit/test_magnetic_load.cpp b/test/unit/test_magnetic_load.cpp index b52f4cc0..5071f5a7 100644 --- a/test/unit/test_magnetic_load.cpp +++ b/test/unit/test_magnetic_load.cpp @@ -6,10 +6,10 @@ #include "mfem.hpp" #include "utils.hpp" -#include "mach_load.hpp" +#include "miso_load.hpp" #include "magnetic_load.hpp" -using namespace mach; +using namespace miso; using namespace mfem; void northMagnetizationSource(const Vector &x, @@ -59,11 +59,11 @@ TEST_CASE("LegacyMagneticLoad Value Test") ConstantCoefficient nu(1.0);///(M_PI*4e-7)); LegacyMagneticLoad load(fes, mag_coeff, nu); - MachLoad ml(load); + MISOLoad ml(load); HypreParVector tv(&fes); - MachInputs inputs; + MISOInputs inputs; setInputs(ml, inputs); tv = 0.0; addLoad(ml, tv); @@ -115,11 +115,11 @@ TEST_CASE("MagneticLoad Value Test") ConstantCoefficient nu(1.0);///(M_PI*4e-7)); MagneticLoad loadLF(fes, mag_coeff, nu); - MachLoad mlLF(loadLF); + MISOLoad mlLF(loadLF); HypreParVector tv(&fes); - MachInputs inputs; + MISOInputs inputs; setInputs(mlLF, inputs); tv = 0.0; @@ -162,13 +162,13 @@ TEST_CASE("MagneticLoad vectorJacobianProduct wrt mesh_coords") ConstantCoefficient nu(1.0); MagneticLoad load(fes, mag_coeff, nu); - MachLoad ml(load); + MISOLoad ml(load); // extract mesh nodes and get their finite-element space auto &x_nodes = *dynamic_cast(mesh.GetNodes()); auto &mesh_fes = *x_nodes.ParFESpace(); - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"mesh_coords", x_nodes.GetData()} }); setInputs(ml, inputs); diff --git a/test/unit/test_magnetostatic_load.cpp b/test/unit/test_magnetostatic_load.cpp index 08e21839..be52b85d 100644 --- a/test/unit/test_magnetostatic_load.cpp +++ b/test/unit/test_magnetostatic_load.cpp @@ -6,10 +6,10 @@ #include "mfem.hpp" #include "utils.hpp" -#include "mach_load.hpp" +#include "miso_load.hpp" #include "magnetostatic.hpp" -using namespace mach; +using namespace miso; using namespace mfem; void simpleCurrent(const mfem::Vector &x, @@ -70,11 +70,11 @@ TEST_CASE("MagnetostaticLoad Value Test") ConstantCoefficient nu(1.0); MagnetostaticLoad load(fes, current_coeff, mag_coeff, nu); - MachLoad ml(load); + MISOLoad ml(load); HypreParVector tv(&fes); - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"current_density", 1.0} }); @@ -135,10 +135,10 @@ TEST_CASE("CurrentLoad vectorJacobianProduct wrt current_density") ConstantCoefficient nu(1.0); MagnetostaticLoad load(fes, current_coeff, mag_coeff, nu); - MachLoad ml(load); + MISOLoad ml(load); auto current_density = 1e6; - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"current_density", current_density} }); setInputs(ml, inputs); @@ -202,13 +202,13 @@ TEST_CASE("MagnetostaticLoad vectorJacobianProduct wrt mesh_coords") ConstantCoefficient nu(1.0); MagnetostaticLoad load(fes, current_coeff, mag_coeff, nu); - MachLoad ml(load); + MISOLoad ml(load); // extract mesh nodes and get their finite-element space auto &x_nodes = *dynamic_cast(mesh.GetNodes()); auto &mesh_fes = *x_nodes.ParFESpace(); - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"mesh_coords", x_nodes.GetData()} }); setInputs(ml, inputs); diff --git a/test/unit/test_magnetostatic_solver.cpp b/test/unit/test_magnetostatic_solver.cpp index 59f66179..63c93de9 100644 --- a/test/unit/test_magnetostatic_solver.cpp +++ b/test/unit/test_magnetostatic_solver.cpp @@ -15,7 +15,7 @@ // namespace // { -// using namespace mach; +// using namespace miso; // void getDivFreeCurrentMeshSens(mfem::ParFiniteElementSpace *mesh_fes, // mfem::ParFiniteElementSpace *h1_fes, @@ -151,7 +151,7 @@ // { // using namespace mfem; // using namespace electromag_data; -// using namespace mach; +// using namespace miso; // const int dim = 3; // const double delta = 1e-5; @@ -295,7 +295,7 @@ // { // using namespace mfem; // using namespace electromag_data; -// using namespace mach; +// using namespace miso; // const int dim = 3; // const double delta = 1e-5; @@ -313,7 +313,7 @@ // nlohmann::json options = getBoxOptions(p); // // generate initial tet mesh -// mach::MagnetostaticSolver solver(options, move(init_mesh)); +// miso::MagnetostaticSolver solver(options, move(init_mesh)); // solver.initDerived(); // auto *mesh = solver.getMesh(); @@ -350,7 +350,7 @@ // // back step // { // auto back_mesh = getMesh(mesh_el,2); -// mach::MagnetostaticSolver back_solver(options, move(back_mesh)); +// miso::MagnetostaticSolver back_solver(options, move(back_mesh)); // auto *b_mesh = back_solver.getMesh(); // auto *back_pert(static_cast(b_mesh->GetNodes())); // back_pert->Add(-delta, v); @@ -365,7 +365,7 @@ // { // auto forward_mesh = getMesh(mesh_el,2); -// mach::MagnetostaticSolver forward_solver(options, move(forward_mesh)); +// miso::MagnetostaticSolver forward_solver(options, move(forward_mesh)); // auto *f_mesh = forward_solver.getMesh(); // auto *forward_pert(static_cast(f_mesh->GetNodes())); @@ -389,7 +389,7 @@ // { // using namespace mfem; // using namespace electromag_data; -// using namespace mach; +// using namespace miso; // const int dim = 3; // const double delta = 1e-5; @@ -407,7 +407,7 @@ // nlohmann::json options = getBoxOptions(p); // // generate initial tet mesh -// mach::MagnetostaticSolver solver(options, move(init_mesh)); +// miso::MagnetostaticSolver solver(options, move(init_mesh)); // solver.initDerived(); // solver.solveForState(); @@ -422,7 +422,7 @@ // J -= delta; // back_options["problem-opts"]["current_density"] = J; -// mach::MagnetostaticSolver back_solver(back_options, move(mesh)); +// miso::MagnetostaticSolver back_solver(back_options, move(mesh)); // back_solver.initDerived(); // back_solver.solveForState(); // dRdJ_cd = back_solver.getResidual(); @@ -435,7 +435,7 @@ // J += 2*delta; // forward_options["problem-opts"]["current_density"] = J; -// mach::MagnetostaticSolver forward_solver(forward_options, move(forward_mesh)); +// miso::MagnetostaticSolver forward_solver(forward_options, move(forward_mesh)); // forward_solver.initDerived(); // forward_solver.solveForState(); // *dRdJ_cd += *(forward_solver.getResidual()); @@ -454,7 +454,7 @@ // { // using namespace mfem; // using namespace electromag_data; -// using namespace mach; +// using namespace miso; // const int dim = 3; // const double delta = 1e-5; @@ -472,7 +472,7 @@ // nlohmann::json options = getBoxOptions(p); // // generate initial tet mesh -// mach::MagnetostaticSolver solver(options, move(init_mesh)); +// miso::MagnetostaticSolver solver(options, move(init_mesh)); // solver.initDerived(); // solver.solveForState(); @@ -488,7 +488,7 @@ // J -= delta; // back_options["problem-opts"]["current_density"] = J; -// mach::MagnetostaticSolver back_solver(back_options, move(mesh)); +// miso::MagnetostaticSolver back_solver(back_options, move(mesh)); // back_solver.initDerived(); // back_solver.solveForState(); // dWdJ_cd -= back_solver.calcOutput("co-energy"); @@ -502,7 +502,7 @@ // J += delta; // forward_options["problem-opts"]["current_density"] = J; -// mach::MagnetostaticSolver forward_solver(forward_options, move(forward_mesh)); +// miso::MagnetostaticSolver forward_solver(forward_options, move(forward_mesh)); // forward_solver.initDerived(); // forward_solver.solveForState(); // dWdJ_cd += forward_solver.calcOutput("co-energy"); @@ -521,7 +521,7 @@ // { // using namespace mfem; // using namespace electromag_data; -// using namespace mach; +// using namespace miso; // const int dim = 3; // const double delta = 1e-5; @@ -561,7 +561,7 @@ // v.ProjectCoefficient(v_rand); // /// Costruct coefficient -// mach::VectorMeshDependentCoefficient current(dim); +// miso::VectorMeshDependentCoefficient current(dim); // std::unique_ptr coeff1( // new VectorFunctionCoefficient(dim, func, funcRevDiff)); // std::unique_ptr coeff2( @@ -715,7 +715,7 @@ // { // using namespace mfem; // using namespace electromag_data; -// using namespace mach; +// using namespace miso; // const int dim = 3; // const double delta = 1e-5; @@ -851,7 +851,7 @@ // nlohmann::json options = getBoxOptions(p); -// mach::MagnetostaticSolver solver(options, move(init_mesh)); +// miso::MagnetostaticSolver solver(options, move(init_mesh)); // solver.initDerived(); // solver.solveForState(); // solver.printSolution("state", 0); @@ -879,10 +879,10 @@ // { // auto back_mesh = getMesh(mesh_el,2); -// mach::GridFunType back_pert(*static_cast(back_mesh->GetNodes())); +// miso::GridFunType back_pert(*static_cast(back_mesh->GetNodes())); // back_pert.Add(-delta, v); // back_mesh->SetNodes(back_pert); -// mach::MagnetostaticSolver back_solver(options, move(back_mesh)); +// miso::MagnetostaticSolver back_solver(options, move(back_mesh)); // back_solver.initDerived(); // back_solver.solveForState(); // dJdX_v_cd -= back_solver.calcOutput("co-energy"); @@ -895,7 +895,7 @@ // GridFunction forward_pert(*forward_mesh->GetNodes()); // forward_pert.Add(delta, v); // forward_mesh->SetNodes(forward_pert); -// mach::MagnetostaticSolver forward_solver(options, move(forward_mesh)); +// miso::MagnetostaticSolver forward_solver(options, move(forward_mesh)); // forward_solver.initDerived(); // forward_solver.solveForState(); // double forward_energy = forward_solver.calcOutput("co-energy"); @@ -912,7 +912,7 @@ // GridFunction forward_pert(*forward_mesh->GetNodes()); // forward_pert.Add(fd_delta, v); // forward_mesh->SetNodes(forward_pert); -// mach::MagnetostaticSolver forward_solver(options, move(forward_mesh)); +// miso::MagnetostaticSolver forward_solver(options, move(forward_mesh)); // forward_solver.initDerived(); // forward_solver.solveForState(); // dJdX_v_fd += forward_solver.calcOutput("co-energy"); @@ -934,7 +934,7 @@ // { // using namespace mfem; // using namespace electromag_data; -// using namespace mach; +// using namespace miso; // const int dim = 3; // const double delta = 1e-5; @@ -947,7 +947,7 @@ // { // nlohmann::json options = getWireOptions(p); // // generate initial tet mesh -// mach::MagnetostaticSolver solver(options, nullptr); +// miso::MagnetostaticSolver solver(options, nullptr); // solver.initDerived(); // auto *mesh = solver.getMesh(); @@ -989,7 +989,7 @@ // double dJdX_v_cd = 0.0; // // back step -// mach::MagnetostaticSolver back_solver(options, nullptr); +// miso::MagnetostaticSolver back_solver(options, nullptr); // auto *b_mesh = back_solver.getMesh(); // auto *back_pert(static_cast(b_mesh->GetNodes())); // back_pert->Add(-delta, v); @@ -1002,7 +1002,7 @@ // // forward step -// mach::MagnetostaticSolver forward_solver(options, nullptr); +// miso::MagnetostaticSolver forward_solver(options, nullptr); // auto *f_mesh = forward_solver.getMesh(); // auto *forward_pert(static_cast(f_mesh->GetNodes())); // forward_pert->Add(delta, v); diff --git a/test/unit/test_mfem_common_integ.cpp b/test/unit/test_mfem_common_integ.cpp index 9da95561..11e7272d 100644 --- a/test/unit/test_mfem_common_integ.cpp +++ b/test/unit/test_mfem_common_integ.cpp @@ -65,7 +65,7 @@ TEST_CASE("DiffusionIntegratorMeshSens::AssembleRHSElementVect") // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::DiffusionIntegratorMeshSens; + auto integ = new miso::DiffusionIntegratorMeshSens; integ->setState(state); integ->setAdjoint(adjoint); dfdx.AddDomainIntegrator(integ); @@ -148,7 +148,7 @@ TEST_CASE("VectorFEWeakDivergenceIntegratorMeshSens::AssembleRHSElementVect") // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::VectorFEWeakDivergenceIntegratorMeshSens; + auto integ = new miso::VectorFEWeakDivergenceIntegratorMeshSens; integ->setState(state); integ->setAdjoint(adjoint); dfdx.AddDomainIntegrator(integ); @@ -230,7 +230,7 @@ TEST_CASE("VectorFECurlIntegratorMeshSens::AssembleRHSElementVect - (u, curl v)" // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::VectorFECurlIntegratorMeshSens; + auto integ = new miso::VectorFECurlIntegratorMeshSens; integ->setState(state); integ->setAdjoint(adjoint); dfdx.AddDomainIntegrator(integ); @@ -311,7 +311,7 @@ TEST_CASE("VectorFECurlIntegratorMeshSens::AssembleRHSElementVect - (curl u, v)" // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::VectorFECurlIntegratorMeshSens; + auto integ = new miso::VectorFECurlIntegratorMeshSens; integ->setState(state); integ->setAdjoint(adjoint); dfdx.AddDomainIntegrator(integ); @@ -390,7 +390,7 @@ TEST_CASE("VectorFEMassIntegratorMeshSens::AssembleRHSElementVect") // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::VectorFEMassIntegratorMeshSens; + auto integ = new miso::VectorFEMassIntegratorMeshSens; integ->setState(state); integ->setAdjoint(adjoint); dfdx.AddDomainIntegrator(integ); @@ -470,7 +470,7 @@ TEST_CASE("VectorFEDomainLFIntegratorMeshSens::AssembleRHSElementVect") // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::VectorFEDomainLFIntegratorMeshSens(vec_coeff); + auto integ = new miso::VectorFEDomainLFIntegratorMeshSens(vec_coeff); integ->setAdjoint(adjoint); dfdx.AddDomainIntegrator(integ); @@ -534,7 +534,7 @@ TEST_CASE("VectorFEDomainLFCurlIntegratorMeshSens::AssembleRHSElementVect") VectorConstantCoefficient vec_coeff(vec); // we use b for finite-difference approximation ParLinearForm b(&fes); - auto *primal = new mach::VectorFEDomainLFCurlIntegrator(vec_coeff); + auto *primal = new miso::VectorFEDomainLFCurlIntegrator(vec_coeff); b.AddDomainIntegrator(primal); // initialize state and adjoint; here we randomly perturb a constant state @@ -544,7 +544,7 @@ TEST_CASE("VectorFEDomainLFCurlIntegratorMeshSens::AssembleRHSElementVect") // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::VectorFEDomainLFCurlIntegratorMeshSens(*primal); + auto integ = new miso::VectorFEDomainLFCurlIntegratorMeshSens(*primal); integ->setAdjoint(adjoint); dfdx.AddDomainIntegrator(integ); @@ -610,7 +610,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") VectorConstantCoefficient vec_coeff(vec); // we use b for finite-difference approximation ParLinearForm b(&fes); - auto *primal = new mach::VectorFEBoundaryTangentLFIntegrator(vec_coeff); + auto *primal = new miso::VectorFEBoundaryTangentLFIntegrator(vec_coeff); b.AddBoundaryIntegrator(primal); // initialize state and adjoint; here we randomly perturb a constant state @@ -620,7 +620,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // build the nonlinear form for d(psi^T R)/dx ParLinearForm dfdx(&mesh_fes); - auto integ = new mach::VectorFEBoundaryTangentLFIntegratorMeshSens(*primal); + auto integ = new miso::VectorFEBoundaryTangentLFIntegratorMeshSens(*primal); integ->setAdjoint(adjoint); dfdx.AddBdrFaceIntegrator(integ); @@ -690,7 +690,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // ConstantCoefficient Q(1.0); // // FunctionCoefficient Q(func, funcRevDiff); -// mach::SteinmetzCoefficient Q(1, 2, 4, 0.5, 0.6, A); +// miso::SteinmetzCoefficient Q(1, 2, 4, 0.5, 0.6, A); // // initialize state; here we randomly perturb a constant state // GridFunction q(fes.get()); @@ -706,14 +706,14 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // GridFunction dJdx(*x_nodes); // LinearForm dJdx(mesh_fes); // dJdx.AddDomainIntegrator( -// new mach::TestLFMeshSensIntegrator(Q)); +// new miso::TestLFMeshSensIntegrator(Q)); // dJdx.Assemble(); // double dJdx_dot_v = dJdx * v; // // now compute the finite-difference approximation... // NonlinearForm functional(fes.get()); // functional.AddDomainIntegrator( -// new mach::TestLFIntegrator(Q)); +// new miso::TestLFIntegrator(Q)); // double delta = 1e-5; // GridFunction x_pert(*x_nodes); @@ -765,8 +765,8 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // we use res for finite-difference approximation // std::unique_ptr q1(new ConstantCoefficient(1)); // std::unique_ptr q2(new ConstantCoefficient(2)); -// std::unique_ptr Q; -// Q.reset(new mach::MeshDependentCoefficient()); +// std::unique_ptr Q; +// Q.reset(new miso::MeshDependentCoefficient()); // Q->addCoefficient(1, move(q1)); // Q->addCoefficient(2, move(q2)); // LinearForm res(fes.get()); @@ -786,7 +786,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // build the nonlinear form for d(psi^T R)/dx // NonlinearForm dfdx_form(mesh_fes); // dfdx_form.AddDomainIntegrator( -// new mach::DomainResIntegrator(*Q, &adjoint)); +// new miso::DomainResIntegrator(*Q, &adjoint)); // // initialize the vector that we use to perturb the mesh nodes // GridFunction v(mesh_fes); @@ -860,7 +860,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // build the nonlinear form for d(psi^T R)/dx // NonlinearForm dfdx_form(mesh_fes); // dfdx_form.AddDomainIntegrator( -// new mach::MassResIntegrator(*Q, +// new miso::MassResIntegrator(*Q, // &state, &adjoint)); // // initialize the vector that we use to perturb the mesh nodes @@ -924,8 +924,8 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // we use res for finite-difference approximation // std::unique_ptr q1(new ConstantCoefficient(1)); // std::unique_ptr q2(new ConstantCoefficient(2)); -// std::unique_ptr Q; -// Q.reset(new mach::MeshDependentCoefficient()); +// std::unique_ptr Q; +// Q.reset(new miso::MeshDependentCoefficient()); // Q->addCoefficient(1, move(q1)); // Q->addCoefficient(2, move(q2)); // BilinearForm res(fes.get()); @@ -945,7 +945,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // build the nonlinear form for d(psi^T R)/dx // NonlinearForm dfdx_form(mesh_fes); // dfdx_form.AddDomainIntegrator( -// new mach::DiffusionResIntegrator(*Q, +// new miso::DiffusionResIntegrator(*Q, // &state, &adjoint)); // // initialize the vector that we use to perturb the mesh nodes @@ -1024,7 +1024,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // build the nonlinear form for d(psi^T R)/dx // LinearForm dfdx(mesh_fes); // dfdx.AddDomainIntegrator( -// new mach::DiffusionResIntegrator(*Q, +// new miso::DiffusionResIntegrator(*Q, // &state, &adjoint)); // // initialize the vector that we use to perturb the mesh nodes @@ -1106,7 +1106,7 @@ TEST_CASE("VectorFEBoundaryTangentLFIntegratorMeshSens::AssembleRHSElementVect") // // build the nonlinear form for d(psi^T R)/dx // LinearForm dfdx_form(mesh_fes); // dfdx_form.AddBdrFaceIntegrator( -// new mach::BoundaryNormalResIntegrator(*Q, +// new miso::BoundaryNormalResIntegrator(*Q, // &state, &adjoint), attr); // // initialize the vector that we use to perturb the mesh nodes diff --git a/test/unit/test_mach_load.cpp b/test/unit/test_miso_load.cpp similarity index 82% rename from test/unit/test_mach_load.cpp rename to test/unit/test_miso_load.cpp index 53b408ff..a6ecace3 100644 --- a/test/unit/test_mach_load.cpp +++ b/test/unit/test_miso_load.cpp @@ -5,16 +5,16 @@ #include "mfem.hpp" #include "utils.hpp" -#include "mach_load.hpp" -#include "mach_linearform.hpp" +#include "miso_load.hpp" +#include "miso_linearform.hpp" // namespace // { -class TestMachLoadIntegrator : public mfem::LinearFormIntegrator +class TestMISOLoadIntegrator : public mfem::LinearFormIntegrator { public: - TestMachLoadIntegrator() + TestMISOLoadIntegrator() : test_val(0.0) { } @@ -43,15 +43,15 @@ class TestMachLoadIntegrator : public mfem::LinearFormIntegrator } } - friend void setInputs(TestMachLoadIntegrator &integ, - const mach::MachInputs &inputs); + friend void setInputs(TestMISOLoadIntegrator &integ, + const miso::MISOInputs &inputs); private: double test_val; }; -void setInputs(TestMachLoadIntegrator &integ, - const mach::MachInputs &inputs) +void setInputs(TestMISOLoadIntegrator &integ, + const miso::MISOInputs &inputs) { auto it = inputs.find("test_val"); if (it != inputs.end()) @@ -62,14 +62,14 @@ void setInputs(TestMachLoadIntegrator &integ, } else { - throw mach::MachException("Bad input type for test_val!"); + throw miso::MISOException("Bad input type for test_val!"); } } } // } // anonymous namespace -using namespace mach; +using namespace miso; using namespace mfem; /// Generate mesh @@ -78,8 +78,8 @@ using namespace mfem; std::unique_ptr buildMesh(int nxy, int nz); -TEST_CASE("MachInputs Scalar Input Test", - "[MachInputs]") +TEST_CASE("MISOInputs Scalar Input Test", + "[MISOInputs]") { std::unique_ptr smesh = buildMesh(4, 4); @@ -91,12 +91,12 @@ TEST_CASE("MachInputs Scalar Input Test", ParFiniteElementSpace fes(mesh.get(), &fec); std::unordered_map fields; - MachLinearForm lf(fes, fields); - lf.addDomainIntegrator(new TestMachLoadIntegrator); + MISOLinearForm lf(fes, fields); + lf.addDomainIntegrator(new TestMISOLoadIntegrator); - MachLoad ml(lf); + MISOLoad ml(lf); - auto inputs = MachInputs({ + auto inputs = MISOInputs({ {"test_val", 5.0} }); diff --git a/test/unit/test_mach_residual.cpp b/test/unit/test_miso_residual.cpp similarity index 84% rename from test/unit/test_mach_residual.cpp rename to test/unit/test_miso_residual.cpp index a5604b7a..6fd785ea 100644 --- a/test/unit/test_mach_residual.cpp +++ b/test/unit/test_miso_residual.cpp @@ -5,8 +5,8 @@ #include "mfem.hpp" #include "utils.hpp" -#include "mach_residual.hpp" -#include "mach_nonlinearform.hpp" +#include "miso_residual.hpp" +#include "miso_nonlinearform.hpp" class TestIntegrator : public mfem::NonlinearFormIntegrator { @@ -49,14 +49,14 @@ class TestIntegrator : public mfem::NonlinearFormIntegrator } // used to set the time variable for the form - friend void setInputs(TestIntegrator &integ, const mach::MachInputs &inputs); + friend void setInputs(TestIntegrator &integ, const miso::MISOInputs &inputs); private: double time; mfem::Vector shape; }; -void setInputs(TestIntegrator &integ, const mach::MachInputs &inputs) +void setInputs(TestIntegrator &integ, const miso::MISOInputs &inputs) { auto it = inputs.find("time"); if (it != inputs.end()) @@ -65,11 +65,11 @@ void setInputs(TestIntegrator &integ, const mach::MachInputs &inputs) } } -using namespace mach; +using namespace miso; using namespace mfem; -TEST_CASE("MachResidual Scalar Input Test", - "[MachResidual]") +TEST_CASE("MISOResidual Scalar Input Test", + "[MISOResidual]") { // set up the mesh and finite-element space auto numx = 4; @@ -82,11 +82,11 @@ TEST_CASE("MachResidual Scalar Input Test", auto fec = H1_FECollection(p, mesh->Dimension()); ParFiniteElementSpace fes(mesh.get(), &fec); - // create a MachNonlinearForm and wrap it into a MachResidual + // create a MISONonlinearForm and wrap it into a MISOResidual std::unordered_map fields; - MachNonlinearForm nf(fes, fields); + MISONonlinearForm nf(fes, fields); nf.addDomainIntegrator(new TestIntegrator); - MachResidual res(std::move(nf)); + MISOResidual res(std::move(nf)); // These steps create a grid function for x+y FunctionCoefficient coeff( @@ -94,8 +94,8 @@ TEST_CASE("MachResidual Scalar Input Test", auto state = ParGridFunction(&fes); state.ProjectCoefficient(coeff); - // set the time using a MachInput to pi, and set state - auto inputs = MachInputs({ + // set the time using a MISOInput to pi, and set state + auto inputs = MISOInputs({ {"time", M_PI}, {"state", state.GetData()} }); setInputs(res, inputs); @@ -107,7 +107,7 @@ TEST_CASE("MachResidual Scalar Input Test", REQUIRE(integral == Approx(-7.0/6.0).margin(1e-10)); // now change the time to 1.5*pi and evaluate again - inputs.at("time") = MachInput(1.5*M_PI); + inputs.at("time") = MISOInput(1.5*M_PI); setInputs(res, inputs); evaluate(res, inputs, res_vec); integral = res_vec.Sum(); // <-- will not work on multiple processors diff --git a/test/unit/test_navier_stokes_assemble.cpp b/test/unit/test_navier_stokes_assemble.cpp index f7c6d02e..9ba79efc 100644 --- a/test/unit/test_navier_stokes_assemble.cpp +++ b/test/unit/test_navier_stokes_assemble.cpp @@ -34,7 +34,7 @@ TEST_CASE("ESViscousIntegrator::AssembleElementGrad", "[ESViscousIntegrator]") &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); res.AddDomainIntegrator( - new mach::ESViscousIntegrator<2>(diff_stack, Re_num, Pr_num, vis)); + new miso::ESViscousIntegrator<2>(diff_stack, Re_num, Pr_num, vis)); // initialize state; here we randomly perturb a constant state GridFunction q(fes.get()); @@ -104,7 +104,7 @@ TEST_CASE("NoSlipAdiabaticWallBC::AssembleFaceGrad", "[NoSlipBC]") NonlinearForm res(fes.get()); res.AddBdrFaceIntegrator( - new mach::NoSlipAdiabaticWallBC(diff_stack, fec.get(), Re_num, + new miso::NoSlipAdiabaticWallBC(diff_stack, fec.get(), Re_num, Pr_num, q_ref, vis)); // initialize state; here we randomly perturb a constant state @@ -167,7 +167,7 @@ TEST_CASE("ViscousSlipWallBC::AssembleFaceGrad", "[VisSlipWallBC]") NonlinearForm res(fes.get()); res.AddBdrFaceIntegrator( - new mach::ViscousSlipWallBC(diff_stack, fec.get(), Re_num, + new miso::ViscousSlipWallBC(diff_stack, fec.get(), Re_num, Pr_num, vis)); // initialize state; here we randomly perturb a constant state @@ -238,7 +238,7 @@ TEST_CASE("ViscousInflowWallBC::AssembleFaceGrad", "[VisInflowBC]") NonlinearForm res(fes.get()); res.AddBdrFaceIntegrator( - new mach::ViscousInflowBC(diff_stack, fec.get(), Re_num, + new miso::ViscousInflowBC(diff_stack, fec.get(), Re_num, Pr_num, q_in, vis)); // initialize state; here we randomly perturb a constant state @@ -309,7 +309,7 @@ TEST_CASE("ViscousOutflowBC::AssembleFaceGrad", "[VisOutflowBC]") NonlinearForm res(fes.get()); res.AddBdrFaceIntegrator( - new mach::ViscousOutflowBC(diff_stack, fec.get(), Re_num, + new miso::ViscousOutflowBC(diff_stack, fec.get(), Re_num, Pr_num, q_out, vis)); // initialize state; here we randomly perturb a constant state @@ -380,7 +380,7 @@ TEST_CASE("ViscousFarFieldBC::AssembleFaceGrad", "[VisFarFieldBC]") NonlinearForm res(fes.get()); res.AddBdrFaceIntegrator( - new mach::NoSlipAdiabaticWallBC(diff_stack, fec.get(), Re_num, + new miso::NoSlipAdiabaticWallBC(diff_stack, fec.get(), Re_num, Pr_num, q_far, vis)); // initialize state; here we randomly perturb a constant state @@ -455,7 +455,7 @@ TEST_CASE("SurfaceForce::AssembleVector", "[Surface Force]") NonlinearForm drag(fes.get()); drag.AddBdrFaceIntegrator( - new mach::SurfaceForce(diff_stack, fec.get(), dim + 2, Re, Pr, + new miso::SurfaceForce(diff_stack, fec.get(), dim + 2, Re, Pr, q_ref, drag_dir)); // initialize state; here we randomly perturb a constant state @@ -492,7 +492,7 @@ TEST_CASE("SurfaceForce::AssembleVector", "[Surface Force]") NonlinearForm drag(fes.get()); drag.AddBdrFaceIntegrator( - new mach::SurfaceForce(diff_stack, fec.get(), dim + 2, Re, Pr, + new miso::SurfaceForce(diff_stack, fec.get(), dim + 2, Re, Pr, q_ref, drag_dir)); // initialize state; here we randomly perturb a constant state diff --git a/test/unit/test_navier_stokes_fluxes.cpp b/test/unit/test_navier_stokes_fluxes.cpp index 98f3e7ca..2f24c8ba 100644 --- a/test/unit/test_navier_stokes_fluxes.cpp +++ b/test/unit/test_navier_stokes_fluxes.cpp @@ -45,7 +45,7 @@ TEMPLATE_TEST_CASE_SIG("navierstokes flux functions, etc, produce correct values q(di + 1) = rhou[di]; } // viscosity coefficient - double mu = mach::calcSutherlandViscosity(q) / Re; + double mu = miso::calcSutherlandViscosity(q) / Re; // spatial derivatives of entropy variables // for (int j = 0; j < dim; ++j) // { @@ -62,7 +62,7 @@ TEMPLATE_TEST_CASE_SIG("navierstokes flux functions, etc, produce correct values for (int j = 0; j < dim; ++j) { del_w.GetColumn(j, del_wxj); - mach::calcdQdWProduct(q.GetData(), del_wxj.GetData(), + miso::calcdQdWProduct(q.GetData(), del_wxj.GetData(), del_qxj.GetData()); del_vxj(dim + 1, j) = (gami * del_qxj(dim + 1)) / q(0); del_vxj(0, j) = del_qxj(0); @@ -74,7 +74,7 @@ TEMPLATE_TEST_CASE_SIG("navierstokes flux functions, etc, produce correct values del_vxj(dim + 1, j) += gami * (q(i) * q(i) * del_qxj(0)) / (2 * q(0) * q(0) * q(0)); } - del_vxj(dim + 1, j) -= mach::pressure(q) * del_qxj(0) / (q(0) * q(0)); + del_vxj(dim + 1, j) -= miso::pressure(q) * del_qxj(0) / (q(0) * q(0)); del_vxj(dim + 1, j) *= mu * gamma / (Pr * gami); } @@ -119,7 +119,7 @@ TEMPLATE_TEST_CASE_SIG("navierstokes flux functions, etc, produce correct values cdel_wxj(di) = 0; } del_w.GetColumn(j, del_wxj); - mach::applyCijMatrix(i, j, mu, Pr, q.GetData(), del_wxj.GetData(), cdel_wxj.GetData()); + miso::applyCijMatrix(i, j, mu, Pr, q.GetData(), del_wxj.GetData(), cdel_wxj.GetData()); for (int k = 0; k < dim + 2; ++k) { cdwij(k) += cdel_wxj(k); @@ -149,13 +149,13 @@ TEMPLATE_TEST_CASE_SIG("navierstokes flux functions, etc, produce correct values SECTION("applyViscousScaling is correct") { - double mu_Re = mach::calcSutherlandViscosity(q.GetData()); + double mu_Re = miso::calcSutherlandViscosity(q.GetData()); mu_Re /= Re; // get flux using c_{hat} matrices for (int i = 0; i < dim; ++i) { // no need to initialize `cdwij` here, it's done in the function itself - mach::applyViscousScaling(i, mu_Re, Pr, q.GetData(), del_w.GetData(), cdwij.GetData()); + miso::applyViscousScaling(i, mu_Re, Pr, q.GetData(), del_w.GetData(), cdwij.GetData()); for (int s = 0; s < dim + 2; ++s) { fcdwij(s, i) = cdwij(s); diff --git a/test/unit/test_navier_stokes_integ.cpp b/test/unit/test_navier_stokes_integ.cpp index 14c0d3e2..007323e4 100644 --- a/test/unit/test_navier_stokes_integ.cpp +++ b/test/unit/test_navier_stokes_integ.cpp @@ -30,7 +30,7 @@ TEMPLATE_TEST_CASE_SIG("ESViscousIntegrator::applyScalingJacState", "[ESViscousI mfem::DenseMatrix delw(delw_data, dim + 2, dim); // Create the AD stack, and the integrator adept::Stack diff_stack; - mach::ESViscousIntegrator esviscousinteg(diff_stack, Re_num, Pr_num, mu); + miso::ESViscousIntegrator esviscousinteg(diff_stack, Re_num, Pr_num, mu); // calculate the jacobian w.r.t q for (int di = 0; di < dim; ++di) { @@ -90,7 +90,7 @@ TEMPLATE_TEST_CASE_SIG("ESViscousIntegrator::applyScalingJacDw", "[ESViscousInte mfem::DenseMatrix delw(delw_data, dim + 2, dim); // Create the AD stack, and the integrator adept::Stack diff_stack; - mach::ESViscousIntegrator esviscousinteg(diff_stack, Re_num, Pr_num, mu); + miso::ESViscousIntegrator esviscousinteg(diff_stack, Re_num, Pr_num, mu); // calculate the jacobian w.r.t q for (int di = 0; di < dim; ++di) { @@ -171,7 +171,7 @@ TEMPLATE_TEST_CASE_SIG("Noslip Jacobian", "[NoSlipAdiabaticWallBC]", adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::NoSlipAdiabaticWallBC noslipadiabatic(diff_stack, fec.get(), + miso::NoSlipAdiabaticWallBC noslipadiabatic(diff_stack, fec.get(), Re_num, Pr_num, q_ref, mu); SECTION("jacobian of no slip adiabatic wall w.r.t state is correct") @@ -275,7 +275,7 @@ TEMPLATE_TEST_CASE_SIG("Noslip Jacobian w.r.t Dw", "[NoSlipAdiabaticWallBC]", // Create the AD stack, and the integrator adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::NoSlipAdiabaticWallBC noslipadiabatic(diff_stack, fec.get(), + miso::NoSlipAdiabaticWallBC noslipadiabatic(diff_stack, fec.get(), Re_num, Pr_num, q_ref, mu); SECTION("jacobian of no slip adiabatic wall w.r.t Dw is correct") @@ -353,7 +353,7 @@ TEMPLATE_TEST_CASE_SIG("Slip wall Jacobian states", "[ViscousSlipWallBC]", // Create the AD stack, and the integrator adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::ViscousSlipWallBC viscousslipwall(diff_stack, fec.get(), Re_num, + miso::ViscousSlipWallBC viscousslipwall(diff_stack, fec.get(), Re_num, Pr_num, mu); SECTION("jacobian of Viscous Slip Wall BC w.r.t state is correct") @@ -420,7 +420,7 @@ TEMPLATE_TEST_CASE_SIG("Viscous inflow Jacobian", "[ViscousInflowBC]", // Create the AD stack, and the integrator adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::ViscousInflowBC viscousinflow(diff_stack, fec.get(), Re_num, + miso::ViscousInflowBC viscousinflow(diff_stack, fec.get(), Re_num, Pr_num, q_in, mu); SECTION("jacobian of viscous inflow bc w.r.t state is correct") @@ -486,7 +486,7 @@ TEMPLATE_TEST_CASE_SIG("Viscous outflow Jacobian", "[ViscousOutflowBC]", // Create the AD stack, and the integrator adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::ViscousOutflowBC viscousoutflow(diff_stack, fec.get(), Re_num, + miso::ViscousOutflowBC viscousoutflow(diff_stack, fec.get(), Re_num, Pr_num, q_out, mu); SECTION("jacobian of viscous outflow bc w.r.t state is correct") @@ -552,7 +552,7 @@ TEMPLATE_TEST_CASE_SIG("Viscous farfield Jacobian", "[ViscousFarFieldBC]", // Create the AD stack, and the integrator adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::ViscousFarFieldBC viscousfarfield(diff_stack, fec.get(), Re_num, + miso::ViscousFarFieldBC viscousfarfield(diff_stack, fec.get(), Re_num, Pr_num, qfs, mu); SECTION("jacobian of viscous farfield bc w.r.t state is correct") @@ -622,7 +622,7 @@ TEMPLATE_TEST_CASE_SIG("Viscous Exact BC Jacobian", "[VisExactBC]", // Create the AD stack, and the integrator adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::ViscousExactBC viscousexact(diff_stack, fec.get(), Re_num, + miso::ViscousExactBC viscousexact(diff_stack, fec.get(), Re_num, Pr_num, exact, mu); SECTION("jacobian of viscous farfield bc w.r.t state is correct") @@ -705,7 +705,7 @@ TEMPLATE_TEST_CASE_SIG("Surface force gradients", "[Surface Force]", std::unique_ptr fec; adept::Stack diff_stack; fec.reset(new mfem::SBPCollection(1, dim)); - mach::SurfaceForce force(diff_stack, fec.get(), dim + 2, Re, Pr, + miso::SurfaceForce force(diff_stack, fec.get(), dim + 2, Re, Pr, q_ref, drag_dir); SECTION("Gradient of surface force w.r.t q is correct") diff --git a/test/unit/test_reconstruction.cpp b/test/unit/test_reconstruction.cpp index 345f38ff..d032352a 100644 --- a/test/unit/test_reconstruction.cpp +++ b/test/unit/test_reconstruction.cpp @@ -76,7 +76,7 @@ TEST_CASE("Reconstruction operator passed the test... ", } } - mach::buildInterpolation(dim, order, x_cent, x_quad, interp); + miso::buildInterpolation(dim, order, x_cent, x_quad, interp); //std::cout << "Check the accuracy:\n"; mfem::Vector x_coord(num_cent), x_coord_interp(num_quad); @@ -189,7 +189,7 @@ TEMPLATE_TEST_CASE_SIG("Least-squares reconstruction operator is accurate.", { for (int degree = 1; degree <= 4; ++degree) { - mach::buildLSInterpolation(dim, degree, x_cent, x_quad, interp); + miso::buildLSInterpolation(dim, degree, x_cent, x_quad, interp); // check that interp exactly interpolates all total degree polynomials for (int p = 0; p <= degree; ++p) { @@ -210,7 +210,7 @@ TEMPLATE_TEST_CASE_SIG("Least-squares reconstruction operator is accurate.", { for (int degree = 1; degree <= 2; ++degree) { - mach::buildLSInterpolation(dim, degree, x_cent, x_quad, interp); + miso::buildLSInterpolation(dim, degree, x_cent, x_quad, interp); // check that interp exactly interpolates all total degree polynomials for (int p = 0; p <= degree; ++p) { @@ -235,7 +235,7 @@ TEMPLATE_TEST_CASE_SIG("Least-squares reconstruction operator is accurate.", { for (int degree = 1; degree <= 1; ++degree) { - mach::buildLSInterpolation(dim, degree, x_cent, x_quad, interp); + miso::buildLSInterpolation(dim, degree, x_cent, x_quad, interp); // check that interp exactly interpolates all total degree polynomials for (int p = 0; p <= degree; ++p) { diff --git a/test/unit/test_steinmetz_integ.cpp b/test/unit/test_steinmetz_integ.cpp index 81627b75..f9f8a8c8 100644 --- a/test/unit/test_steinmetz_integ.cpp +++ b/test/unit/test_steinmetz_integ.cpp @@ -32,7 +32,7 @@ TEST_CASE("DomainResIntegrator::AssembleElementVector", { using namespace mfem; using namespace euler_data; - using namespace mach; + using namespace miso; const int dim = 3; // templating is hard here because mesh constructors double delta = 1e-5; @@ -61,8 +61,8 @@ TEST_CASE("DomainResIntegrator::AssembleElementVector", // std::unique_ptr q2(new FunctionCoefficient(func, funcRevDiff)); std::unique_ptr q2(new SteinmetzCoefficient( 1, 2, 4, 0.5, 0.6, A)); - // std::unique_ptr Q; - // Q.reset(new mach::MeshDependentCoefficient()); + // std::unique_ptr Q; + // Q.reset(new miso::MeshDependentCoefficient()); // Q->addCoefficient(1, move(q1)); // Q->addCoefficient(2, move(q2)); LinearForm res(&fes); @@ -81,7 +81,7 @@ TEST_CASE("DomainResIntegrator::AssembleElementVector", // build the nonlinear form for d(psi^T R)/dx NonlinearForm dfdx_form(mesh_fes); dfdx_form.AddDomainIntegrator( - new mach::DomainResIntegrator(*q2, &adjoint)); + new miso::DomainResIntegrator(*q2, &adjoint)); // initialize the vector that we use to perturb the mesh nodes GridFunction v(mesh_fes); @@ -119,7 +119,7 @@ TEST_CASE("ThermalSensIntegrator::AssembleElementVector", { using namespace mfem; using namespace euler_data; - using namespace mach; + using namespace miso; const int dim = 3; // templating is hard here because mesh constructors double delta = 1e-5; @@ -152,8 +152,8 @@ TEST_CASE("ThermalSensIntegrator::AssembleElementVector", std::unique_ptr q1(new ConstantCoefficient(1)); std::unique_ptr q2(new SteinmetzCoefficient( 1, 2, 4, 0.5, 0.6, A)); - std::unique_ptr Q; - // Q.reset(new mach::MeshDependentCoefficient()); + std::unique_ptr Q; + // Q.reset(new miso::MeshDependentCoefficient()); // Q->addCoefficient(1, move(q1)); // Q->addCoefficient(2, move(q2)); std::unique_ptr QV( @@ -172,7 +172,7 @@ TEST_CASE("ThermalSensIntegrator::AssembleElementVector", // build the nonlinear form for d(psi^T R)/dx LinearForm dfdx_form(fesa.get()); dfdx_form.AddDomainIntegrator( - new mach::ThermalSensIntegrator(*QV, &adjoint)); + new miso::ThermalSensIntegrator(*QV, &adjoint)); // initialize the vector that we use to perturb the vector potential GridFunction v(fesa.get()); diff --git a/test/unit/test_surface.cpp b/test/unit/test_surface.cpp index 08734275..e9f409af 100644 --- a/test/unit/test_surface.cpp +++ b/test/unit/test_surface.cpp @@ -61,7 +61,7 @@ TEST_CASE( "calc/solveDistance applied to linear segment", "[surface]") SnapNodes(*mesh); // Construct the surface object - mach::Surface<2> surf(*mesh); + miso::Surface<2> surf(*mesh); // Get the relevant element transformation ElementTransformation *trans = mesh->GetElementTransformation(0); @@ -128,7 +128,7 @@ TEST_CASE( "calc/solveDistance applied to quadratic segment", "[surface]") //sol_ofs.close(); // Construct the surface object - mach::Surface<2> surf(*mesh); + miso::Surface<2> surf(*mesh); // Get the relevant element transformation ElementTransformation *trans = mesh->GetElementTransformation(0); @@ -211,7 +211,7 @@ TEST_CASE( "calc/solveDistance applied to cubic segment", "[surface]") //sol_ofs.close(); // Construct the surface object - mach::Surface<2> surf(*mesh); + miso::Surface<2> surf(*mesh); // Get the relevant element transformation ElementTransformation *trans = mesh->GetElementTransformation(0); @@ -290,7 +290,7 @@ TEST_CASE( "calcDistance applied to linear mesh", "[surface]") //sol_ofs.close(); // Construct the surface object - mach::Surface<2> surf(*mesh); + miso::Surface<2> surf(*mesh); // Test 1: Closest point on a vertex Vector x(2); @@ -360,7 +360,7 @@ TEST_CASE( "calcDistance applied to quadratic mesh", "[surface]") //sol_ofs.close(); // Construct the surface object - mach::Surface<2> surf(*mesh); + miso::Surface<2> surf(*mesh); // Test 1: closest point inside an element Vector x(2); @@ -430,7 +430,7 @@ TEST_CASE( "calcDistance applied to cubic mesh", "[surface]") //sol_ofs.close(); // Construct the surface object - mach::Surface<2> surf(*mesh); + miso::Surface<2> surf(*mesh); // Test 1: closest point inside an element Vector x(2); diff --git a/test/unit/test_thermal_integ.cpp b/test/unit/test_thermal_integ.cpp index be2903e3..1c8a6439 100644 --- a/test/unit/test_thermal_integ.cpp +++ b/test/unit/test_thermal_integ.cpp @@ -170,7 +170,7 @@ // TEST_CASE("InteriorBoundaryOutFluxInteg::AssembleFaceMatrix") // { // using namespace mfem; -// using namespace mach; +// using namespace miso; // constexpr int dim = 3; // constexpr int num_edge = 2; @@ -237,7 +237,7 @@ TEST_CASE("AggregateIntegratorNumerator/Denominator::GetEnergy") { using namespace mfem; - using namespace mach; + using namespace miso; constexpr int dim = 3; int num_edge = 2; @@ -311,7 +311,7 @@ TEST_CASE("AggregateIntegrator::AssembleVector", "[AggregateIntegrator]") std::unique_ptr fes(new FiniteElementSpace( mesh.get(), fec.get())); - std::unique_ptr func; + std::unique_ptr func; const double scale = 0.01; @@ -330,8 +330,8 @@ TEST_CASE("AggregateIntegrator::AssembleVector", "[AggregateIntegrator]") double rhoa = 5.0; NonlinearForm agg(fes.get()); agg.AddDomainIntegrator( - new mach::AggregateIntegrator(fes.get(), rhoa, m, &q)); - func.reset(new mach::AggregateIntegrator(fes.get(), rhoa, m)); + new miso::AggregateIntegrator(fes.get(), rhoa, m, &q)); + func.reset(new miso::AggregateIntegrator(fes.get(), rhoa, m)); // initialize the vector that dJdu multiplies GridFunction v(fes.get()); @@ -380,7 +380,7 @@ TEST_CASE("TempIntegrator::AssembleVector", "[TempIntegrator]") std::unique_ptr fes(new FiniteElementSpace( mesh.get(), fec.get())); - std::unique_ptr func; + std::unique_ptr func; const double scale = 0.01; @@ -393,8 +393,8 @@ TEST_CASE("TempIntegrator::AssembleVector", "[TempIntegrator]") NonlinearForm tempint(fes.get()); tempint.AddDomainIntegrator( - new mach::TempIntegrator(fes.get(), &q)); - func.reset(new mach::TempIntegrator(fes.get())); + new miso::TempIntegrator(fes.get(), &q)); + func.reset(new miso::TempIntegrator(fes.get())); // initialize the vector that dJdu multiplies GridFunction v(fes.get()); @@ -445,7 +445,7 @@ TEST_CASE("AggregateResIntegrator::AssembleVector", "[AggregateResIntegrator]") std::unique_ptr fes(new FiniteElementSpace( mesh.get(), fec.get())); - std::unique_ptr func; + std::unique_ptr func; const double scale = 0.01; @@ -476,8 +476,8 @@ TEST_CASE("AggregateResIntegrator::AssembleVector", "[AggregateResIntegrator]") GridFunction dJdx(*x_nodes); NonlinearForm agg(mesh_fes); agg.AddDomainIntegrator( - new mach::AggregateResIntegrator(fes.get(), rhoa, m, &q)); - func.reset(new mach::AggregateResIntegrator(fes.get(), rhoa, m)); + new miso::AggregateResIntegrator(fes.get(), rhoa, m, &q)); + func.reset(new miso::AggregateResIntegrator(fes.get(), rhoa, m)); agg.Mult(*x_nodes, dJdx); double dJdx_dot_v = dJdx * v; @@ -522,7 +522,7 @@ TEST_CASE("TempResIntegrator::AssembleVector", "[TempResIntegrator]") std::unique_ptr fes(new FiniteElementSpace( mesh.get(), fec.get())); - std::unique_ptr func; + std::unique_ptr func; const double scale = 0.01; @@ -546,8 +546,8 @@ TEST_CASE("TempResIntegrator::AssembleVector", "[TempResIntegrator]") GridFunction dJdx(*x_nodes); NonlinearForm tempint(mesh_fes); tempint.AddDomainIntegrator( - new mach::TempResIntegrator(fes.get(), &q)); - func.reset(new mach::TempResIntegrator(fes.get())); + new miso::TempResIntegrator(fes.get(), &q)); + func.reset(new miso::TempResIntegrator(fes.get())); tempint.Mult(*x_nodes, dJdx); double dJdx_dot_v = dJdx * v; diff --git a/test/unit/test_utils.cpp b/test/unit/test_utils.cpp index 2b1fbe2a..820d6c36 100644 --- a/test/unit/test_utils.cpp +++ b/test/unit/test_utils.cpp @@ -14,7 +14,7 @@ TEST_CASE("Testing secant method", "[secant]") { return exp(x) - 1; }; - double x = mach::secant(expfun, 0.5, M_PI, ftol, xtol, maxiter); + double x = miso::secant(expfun, 0.5, M_PI, ftol, xtol, maxiter); std::cout << "Solution 1 = " << x << std::endl; REQUIRE( x == Approx(0.0).margin(xtol) ); @@ -23,7 +23,7 @@ TEST_CASE("Testing secant method", "[secant]") { return sin(exp(x)); }; - x = mach::secant(logfun, 0, M_PI, ftol, xtol, maxiter); + x = miso::secant(logfun, 0, M_PI, ftol, xtol, maxiter); std::cout << "Solution 2 = " << x << std::endl; REQUIRE( x == Approx(log(M_PI)).margin(xtol) ); diff --git a/test/unit/test_viscous_integ.cpp b/test/unit/test_viscous_integ.cpp index 81eee224..a87dfb08 100644 --- a/test/unit/test_viscous_integ.cpp +++ b/test/unit/test_viscous_integ.cpp @@ -31,10 +31,10 @@ TEMPLATE_TEST_CASE_SIG("ViscousIntegrator::AssembleElementVector", &mesh, fec.get(), num_state, Ordering::byVDIM)); NonlinearForm res(fes.get()); - res.AddDomainIntegrator(new mach::LaplaceIntegrator<2>(diff_stack)); - res.AddDomainIntegrator(new mach::SourceIntegrator(p)); + res.AddDomainIntegrator(new miso::LaplaceIntegrator<2>(diff_stack)); + res.AddDomainIntegrator(new miso::SourceIntegrator(p)); res.AddBdrFaceIntegrator( - new mach::LaplaceNaturalBC<2>(diff_stack, fec.get())); + new miso::LaplaceNaturalBC<2>(diff_stack, fec.get())); GridFunction u(fes.get()), r(fes.get()); VectorFunctionCoefficient u0(1, uexact

); u.ProjectCoefficient(u0);