From df174947ce2cd521709a958689ce134ac662b3f7 Mon Sep 17 00:00:00 2001 From: Habeeb Idris Date: Wed, 2 Oct 2024 02:16:11 -0400 Subject: [PATCH] Got the optimization running and all tes passingts with minimal changes --- src/common/data_logging.hpp | 11 +++++++---- src/physics/CMakeLists.txt | 9 +++++---- src/physics/electromagnetics/CMakeLists.txt | 6 ++++++ src/physics/electromagnetics/electromag_integ.cpp | 6 +++--- src/physics/physics.hpp | 2 ++ src/physics/thermal/temp_integ.hpp | 2 +- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/common/data_logging.hpp b/src/common/data_logging.hpp index ea6144fe..c9afab9a 100644 --- a/src/common/data_logging.hpp +++ b/src/common/data_logging.hpp @@ -120,10 +120,13 @@ class ParaViewLogger double time, int rank) { - fields.at(fieldname)->SetFromTrueDofs(state); - pv.SetCycle(timestep); - pv.SetTime(time); - pv.Save(); + if (fields.count(fieldname) > 0) + { + fields.at(fieldname)->SetFromTrueDofs(state); + pv.SetCycle(timestep); + pv.SetTime(time); + pv.Save(); + } } void registerField(const std::string &name, mfem::ParGridFunction &field) diff --git a/src/physics/CMakeLists.txt b/src/physics/CMakeLists.txt index fcff6613..af681064 100644 --- a/src/physics/CMakeLists.txt +++ b/src/physics/CMakeLists.txt @@ -13,6 +13,7 @@ set(MISO_PHYSICS_HEADERS physics.hpp ) + target_sources(miso PRIVATE common_outputs.cpp @@ -27,10 +28,10 @@ target_sources(miso ${MISO_PHYSICS_HEADERS} ) -# get_target_property(MACH_PUBLIC_HEADERS mach PUBLIC_HEADER) -# set(MACH_PUBLIC_HEADERS ${MACH_PUBLIC_HEADERS} ${MACH_PHYSICS_HEADERS}) -# set_target_properties(mach PROPERTIES -# PUBLIC_HEADER "${MACH_PUBLIC_HEADERS}" +# get_target_property(MISO_PUBLIC_HEADERS miso PUBLIC_HEADER) +# set(MISO_PUBLIC_HEADERS ${MISO_PUBLIC_HEADERS} ${MISO_PHYSICS_HEADERS}) +# set_target_properties(miso PROPERTIES +# PUBLIC_HEADER "${MISO_PUBLIC_HEADERS}" # ) add_public_headers_to_target(miso "${MISO_PHYSICS_HEADERS}") diff --git a/src/physics/electromagnetics/CMakeLists.txt b/src/physics/electromagnetics/CMakeLists.txt index badc9479..7ec17e08 100644 --- a/src/physics/electromagnetics/CMakeLists.txt +++ b/src/physics/electromagnetics/CMakeLists.txt @@ -38,6 +38,12 @@ target_sources(miso ${MISO_PHYSICS_ELECTROMAGNETICS_HEADERS} ) +# get_target_property(MISO_PUBLIC_HEADERS miso PUBLIC_HEADER) +# set(MISO_PUBLIC_HEADERS ${MISO_PUBLIC_HEADERS} ${MISO_PHYSICS_ELECTROMAGNETICS_HEADERS}) +# set_target_properties(miso PROPERTIES +# PUBLIC_HEADER "${MISO_PUBLIC_HEADERS}" +# ) + add_public_headers_to_target(miso "${MISO_PHYSICS_ELECTROMAGNETICS_HEADERS}") target_include_directories(miso diff --git a/src/physics/electromagnetics/electromag_integ.cpp b/src/physics/electromagnetics/electromag_integ.cpp index e9988cac..c435debe 100644 --- a/src/physics/electromagnetics/electromag_integ.cpp +++ b/src/physics/electromagnetics/electromag_integ.cpp @@ -404,7 +404,7 @@ void NonlinearDiffusionIntegratorMeshRevSens::AssembleRHSElementVect( /// const double pointflux_norm = pointflux.Norml2(); pointflux_bar = 0.0; - if (fabs(pointflux_norm) > 1e-14) + if (fabs(pointflux_norm) > 1e-16) { add(pointflux_bar, pointflux_norm_bar / pointflux_norm, @@ -1651,14 +1651,14 @@ void DGInteriorFaceDiffusionIntegratorMeshRevSens::AssembleRHSElementVect( /// const double ip_flux2_norm = ip_flux2.Norml2(); ip_flux2_bar = 0.0; - if (fabs(ip_flux2_norm) > 1e-14) + if (fabs(ip_flux2_norm) > 1e-16) { ip_flux2_bar.Add(ip_flux2_norm_bar / ip_flux2_norm, ip_flux2); } /// const double ip_flux1_norm = ip_flux1.Norml2(); ip_flux1_bar = 0.0; - if (fabs(ip_flux1_norm) > 1e-14) + if (fabs(ip_flux1_norm) > 1e-16) { ip_flux1_bar.Add(ip_flux1_norm_bar / ip_flux1_norm, ip_flux1); } diff --git a/src/physics/physics.hpp b/src/physics/physics.hpp index 845ce32d..01a225b9 100644 --- a/src/physics/physics.hpp +++ b/src/physics/physics.hpp @@ -4,8 +4,10 @@ #include "electromagnetics/electromagnetics.hpp" #include "fluidflow/fluidflow.hpp" #include "thermal/thermal.hpp" +#include "joule/joule.hpp" #include "diag_mass_integ.hpp" #include "miso_input.hpp" #include "miso_integrator.hpp" +#include "solver.hpp" #endif \ No newline at end of file diff --git a/src/physics/thermal/temp_integ.hpp b/src/physics/thermal/temp_integ.hpp index c61b1d7f..1bf68e39 100644 --- a/src/physics/thermal/temp_integ.hpp +++ b/src/physics/thermal/temp_integ.hpp @@ -2,7 +2,7 @@ #define MISO_TEMP_INTEGRATOR #include "mfem.hpp" -//#include "solver.hpp" +#include "solver.hpp" namespace miso {