diff --git a/CMakeLists.txt b/CMakeLists.txt index aacd55d6cb725a2e1d2185bc314c71735cf7e87d..0d4fd0e9cca7362dbf1c4c9e9cb0008c71d37d99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,29 +233,29 @@ file( GLOB LIB_HEADERS contrib/blossom5v2.05/*.h contrib/blossom5v2.05/*/*.h com add_library( fwi ${LIB_SOURCES} ${LIB_HEADERS}) target_link_libraries(fwi yaml-cpp) -add_executable( synthetics synthetics.cpp ${EXTRA_INCS}) +add_executable( synthetics synthetics.cpp ) target_link_libraries( synthetics fwi ${EXTRA_LIBS}) #add_executable( time_synthetics_wave time_synthetics_wave.cpp ${EXTRA_INCS}) #target_link_libraries( time_synthetics_wave fwi ${EXTRA_LIBS}) -add_executable( directional directional.cpp ${EXTRA_INCS}) +add_executable( directional directional.cpp ) target_link_libraries( directional fwi ${EXTRA_LIBS}) -add_executable( directional_field directional_field.cpp ${EXTRA_INCS}) +add_executable( directional_field directional_field.cpp ) target_link_libraries( directional_field fwi ${EXTRA_LIBS}) -add_executable( gradient gradient.cpp ${EXTRA_INCS}) +add_executable( gradient gradient.cpp ) target_link_libraries( gradient fwi ${EXTRA_LIBS}) #add_executable( convergence convergence.cpp ${EXTRA_INCS}) #target_link_libraries( convergence fwi ${EXTRA_LIBS}) #add_executable( preconditioner preconditioner.cpp ${EXTRA_INCS}) #target_link_libraries( preconditioner fwi ${EXTRA_LIBS}) -add_executable( ip_comparison ip_comparison.cpp ${EXTRA_INCS}) +add_executable( ip_comparison ip_comparison.cpp ) target_link_libraries( ip_comparison fwi ${EXTRA_LIBS}) #add_executable( ob_comparison ob_comparison.cpp ${EXTRA_INCS}) #target_link_libraries( ob_comparison fwi ${EXTRA_LIBS}) -add_executable( multiscale multiscale.cpp ${EXTRA_INCS}) +add_executable( multiscale multiscale.cpp ) target_link_libraries( multiscale fwi ${EXTRA_LIBS}) -add_executable( inversion inversion.cpp ${EXTRA_INCS}) +add_executable( inversion inversion.cpp ) target_link_libraries( inversion fwi ${EXTRA_LIBS}) -add_executable( error error.cpp ${EXTRA_INCS}) +add_executable( error error.cpp) target_link_libraries( error fwi ${EXTRA_LIBS}) diff --git a/common/configuration.h b/common/configuration.h index fb346bbbb019bee519b447c80d5c18677987d12d..fe5d0986a3ada8aa6b95c6927c1a5272380127e7 100644 --- a/common/configuration.h +++ b/common/configuration.h @@ -51,6 +51,12 @@ public: gmshFem.userDefinedParameter(remesh, "remesh"); _remesh = ((bool) remesh); }; + + ConfigurationInterface() : _name("dummy"), _parametrization(nullptr), _mc(1,0.) + { + _remesh = true; + }; + virtual ~ConfigurationInterface() {delete _parametrization;}; virtual void mesh() const; diff --git a/specific/configuration/flexible_acquisition.cpp b/specific/configuration/flexible_acquisition.cpp index c6adf1de3a33cdc02d55d9d9aca7f1935786c452..3850bb1d1eb83971fbfcc1febee4c7c5faeb2722 100644 --- a/specific/configuration/flexible_acquisition.cpp +++ b/specific/configuration/flexible_acquisition.cpp @@ -130,6 +130,7 @@ namespace flexible_acquisition // Once Dirichlet BCs are added //_named_domains() ... + _named_domains["top_bnd"] = Domain("top_bnd"); /* * Reference model function @@ -192,6 +193,9 @@ namespace flexible_acquisition gmodel::addPhysicalGroup(1, {lineLeftSuper, lineTop, lineRightSuper}, 12); gmodel::setPhysicalName(1, 12, "supersurface_bnd"); + gmodel::addPhysicalGroup(1, {lineTop}, 13); + gmodel::setPhysicalName(1, 13, "top_bnd"); + for (unsigned p = 0; p < p_er.size(); ++p) { gmodel::addPhysicalGroup(0, {p_er[p]}, 1000+p); gmodel::setPhysicalName(0, 1000+p, "emitter_receiver_"+std::to_string(p)); diff --git a/specific/wave/equation/simplewave.cpp b/specific/wave/equation/simplewave.cpp index b2fe3c972cdd03307245449e0c39aa6cfe79019c..da290b9ee6bd345169e41daf63cfe2a367d9e6c9 100644 --- a/specific/wave/equation/simplewave.cpp +++ b/specific/wave/equation/simplewave.cpp @@ -81,6 +81,12 @@ namespace simplewave else { msg::warning << "SimpleWave without specified top_bc defaults to Absorbing." << msg::endl; } + + _useSecondOrderABC = false; + int intArg; + gmshFem.userDefinedParameter(intArg, "useSecondOrderABC"); + _useSecondOrderABC = intArg != 0; + msg::warning << "Using Second Order ABC : " << _useSecondOrderABC << msg::endl; } bool Equation::modelIsObsolete() @@ -114,6 +120,8 @@ namespace simplewave void Equation::setLHS(const ModelStateEvaluator& ms) { auto top = _config->named_domains().find("top_bnd"); + + if (_topBC == "Dirichlet" || _topBC == "Neumann") { if (top == _config->named_domains().end()) @@ -138,10 +146,13 @@ namespace simplewave if(_realImpedance) { _formulation.integral(-1. * im * _pulsation * sqrt(real(m0)) * dof(_v), tf(_v), absorbingPartKnown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions + if (_useSecondOrderABC) _formulation.integral(1. * im / (2.0 * _pulsation * sqrt(real(m0))) * grad(dof(_v)), grad(tf(_v)), absorbingPartKnown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions + } else { _formulation.integral(-1. * im * _pulsation * sqrt(m0) * dof(_v), tf(_v), absorbingPartKnown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions + if (_useSecondOrderABC) _formulation.integral(1. * im / (2.0 * _pulsation * sqrt(m0)) * grad(dof(_v)), grad(tf(_v)), absorbingPartKnown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions } if(!_config->model_unknown(Support::BLK).isEmpty()) { @@ -152,10 +163,12 @@ namespace simplewave if(_realImpedance) { _formulation.integral(-1. * im * _pulsation * sqrt(real(m)) * dof(_v), tf(_v), absorbingPartUnknown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions + if (_useSecondOrderABC) _formulation.integral(1. * im / (2. * _pulsation * sqrt(real(m))) * grad(dof(_v)), grad(tf(_v)), absorbingPartUnknown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions } else { - _formulation.integral(-1. * im * _pulsation * sqrt(m) * dof(_v), tf(_v), absorbingPartUnknown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions + _formulation.integral(-1. * im * _pulsation * sqrt(m) * dof(_v), tf(_v), absorbingPartUnknown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions + if (_useSecondOrderABC) _formulation.integral(1. * im / (2. * _pulsation * sqrt(m)) * grad(dof(_v)), grad(tf(_v)), absorbingPartUnknown, integrationType(_integrationDegreeBnd)); //-1 from sign conventions } } } diff --git a/tests/test.cpp b/tests/test.cpp index 90c0a351a8915bd26f239058458196d16bbf037b..3a865294a01664b6f63317241c7bbd6c11c8c7f0 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -7,6 +7,10 @@ #include <gmshfem/Formulation.h> #include <gmshfem/GmshFem.h> #include "../common/wave/element.h" +#include "../common/data/element.h" +#include "../specific/data/element.h" + +#include "dummyAcquisition.h" #define INIT_GMSHFEM() \ namespace geo = gmsh::model::geo; \