diff --git a/cmake/SpecMiCPOptions.cmake b/cmake/SpecMiCPOptions.cmake index af37e46..12957bb 100644 --- a/cmake/SpecMiCPOptions.cmake +++ b/cmake/SpecMiCPOptions.cmake @@ -1,27 +1,31 @@ # For an explanation of the options see the INSTALL file option( SPECMICP_USE_OPENMP "Use OpenMP for parallelisation" ON ) option( SPECMICP_NO_DEBUG "Disable SpecMiCP assert" OFF ) option( SPECMICP_BUILD_STATIC "Build static libraries" OFF ) option( SPECMICP_BUILD_EXAMPLE "Build the examples" ON ) option( SPECMICP_BENCHMARK "Build benchmark" OFF ) option( SPECMICP_TEST "Enable testing" ON ) option( SPECMICP_BINARIES_USE_STATIC "Executables use static libraries" OFF ) # Linear algebra option( SPECMICP_USE_BLAS "Eigen uses BLAS/LAPACK" OFF ) # PGO sequence option( SPECMICP_PROFILE_GENERATE "Generate profile for PGO optimization" OFF ) option( SPECMICP_PROFILE_USE "Use profile for PGO optimization" OFF ) # LTO optimization option( SPECMICP_LD_GOLD "Use GNU gold linker" ON ) option( SPECMICP_LTO "Use link time optimization" OFF ) option( SPECMICP_FAT_LTO "Use link time optimization with fat objects" ON ) # the following is only a debug options for developpers # This options turns on the finite difference jacobian in specmicp system option( SPECMICP_DEBUG_EQUATION_FD_JACOBIAN "Use a finite difference jacobian" OFF ) +# ReactMiCP systems +option( REACTMICP_ENABLE_SYSTEM_SATURATED "Enable Saturated ReactMiCP system" ON ) +option( REACTMICP_ENABLE_SYSTEM_UNSATURATED "Enable Unsaturated ReactMiCP system" ON ) +option( REACTMICP_ENABLE_SYSTEM_CHLORIDE "Enable Chloride ReactMiCP system" ON ) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1985138..c32fa36 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,222 +1,252 @@ ###### Installation ####################### set(EXAMPLES_INSTALL_DIR ${SHARE_INSTALL_DIR}/examples) # SpecMiCP # ======== set (SPECMICP_EXAMPLES specmicp/adimensional/thermocarbo.cpp specmicp/adimensional/equilibrium_curve.cpp specmicp/adimensional/momas_thermo.cpp specmicp/adimensional/carbofe.cpp ) install(FILES ${SPECMICP_EXAMPLES} DESTINATION ${EXAMPLES_INSTALL_DIR}/specmicp ) # ReactMiCP # ========= set (REACTMICP_SATURATED_EXAMPLES reactmicp/equilibrium_curve.cpp reactmicp/saturated_react/react_leaching.cpp reactmicp/saturated_react/carbonation.cpp reactmicp/saturated_react/carbonation.yaml # the configuration file reactmicp/saturated_react/carbonationfe.cpp reactmicp/saturated_react/leaching_kinetic.cpp reactmicp/unsaturated/drying.cpp reactmicp/unsaturated/acc_carbo.cpp reactmicp/chloride/migration.cpp reactmicp/chloride/benchmark_rasouli.cpp ) install(FILES ${REACTMICP_SATURATED_EXAMPLES} DESTINATION ${EXAMPLES_INSTALL_DIR}/reactmicp/saturated ) file(COPY reactmicp/saturated_react/carbonation.yaml DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) ###### Build (optional) #################### if (NOT SPECMICP_BUILD_EXAMPLE) set(EXAMPLE_IS_OPTIONAL EXCLUDE_FROM_ALL) else() set(EXAMPLE_IS_OPTIONAL ) endif() # SpecMiCP # ======== # thermocarbo add_executable(ex_adim_thermocarbo ${EXAMPLE_IS_OPTIONAL} specmicp/adimensional/thermocarbo.cpp ) target_link_libraries(ex_adim_thermocarbo ${SPECMICP_LIBS}) # carbofe add_executable(ex_adim_carbofe ${EXAMPLE_IS_OPTIONAL} specmicp/adimensional/carbofe.cpp ) target_link_libraries(ex_adim_carbofe ${SPECMICP_LIBS}) # Momas thermodynamic example add_executable(ex_adim_momas ${EXAMPLE_IS_OPTIONAL} specmicp/adimensional/momas_thermo.cpp ) target_link_libraries(ex_adim_momas ${SPECMICP_LIBS}) # equilibrium curve add_executable(ex_adim_equilibriumcurve ${EXAMPLE_IS_OPTIONAL} specmicp/adimensional/equilibrium_curve.cpp ) target_link_libraries(ex_adim_equilibriumcurve ${SPECMICP_LIBS}) # ReactMiCP # ========= # EquilibriumCurve add_executable(ex_reactmicp_equilibriumcurve ${EXAMPLE_IS_OPTIONAL} reactmicp/equilibrium_curve.cpp ) target_link_libraries(ex_reactmicp_equilibriumcurve ${REACTMICP_LIBS}) +# a simple macro to find if the examples from a reactmicp systems +# must be included +# +# Check the option REACTMICP_ENABLE_SYSTEM_XXXX +macro(set_exclude_if_no_reactmicp_system exclude_var reactmicp_option) + if (NOT ${reactmicp_option} ) + set( ${exclude_var} EXCLUDE_FROM_ALL ) + else () + set( ${exclude_var} ${EXAMPLE_IS_OPTIONAL}) + endif () +endmacro(set_exclude_if_no_reactmicp_system) + + +# Saturated system +# ---------------- + +set_exclude_if_no_reactmicp_system( + DONT_COMPILE_SATURATED_EXAMPLE + REACTMICP_ENABLE_SYSTEM_SATURATED +) + # Leaching add_executable(ex_reactmicp_leaching - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_SATURATED_EXAMPLE} reactmicp/saturated_react/react_leaching.cpp ) target_link_libraries(ex_reactmicp_leaching ${REACTMICP_LIBS}) # Momas benchmark add_executable(ex_reactmicp_momas - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_SATURATED_EXAMPLE} reactmicp/saturated_react/momas_benchmark.cpp ) target_link_libraries(ex_reactmicp_momas ${REACTMICP_LIBS}) # Carbonation add_custom_target(ex_reactmicp_carbo_conf SOURCES reactmicp/saturated_react/carbonation.yaml) add_executable(ex_reactmicp_carbo - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_SATURATED_EXAMPLE} reactmicp/saturated_react/carbonation.cpp ) target_link_libraries(ex_reactmicp_carbo ${REACTMICP_LIBS}) add_executable(ex_reactmicp_carbo_static EXCLUDE_FROM_ALL reactmicp/saturated_react/carbonation.cpp ) target_link_libraries(ex_reactmicp_carbo_static ${REACTMICP_STATIC_LIBS}) # Carbonation with Fe add_executable(ex_reactmicp_carbofe - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_SATURATED_EXAMPLE} reactmicp/saturated_react/carbonationfe.cpp ) target_link_libraries(ex_reactmicp_carbofe ${REACTMICP_LIBS}) # Leaching with hydration add_executable(ex_reactmicp_leaching_kinetic - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_SATURATED_EXAMPLE} reactmicp/saturated_react/leaching_kinetic.cpp ) target_link_libraries(ex_reactmicp_leaching_kinetic ${REACTMICP_STATIC_LIBS}) # Unsaturated system # ================== +set_exclude_if_no_reactmicp_system( + DONT_COMPILE_UNSATURATED_EXAMPLE + REACTMICP_ENABLE_SYSTEM_UNSATURATED +) # drying # ------ add_executable(ex_reactmicp_drying - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_UNSATURATED_EXAMPLE} reactmicp/unsaturated/drying.cpp ) set(CEMDATA_PATH \"../data/cemdata.yaml\") set_source_files_properties(reactmicp/unsaturated/drying.cpp PROPERTIES COMPILE_DEFINITIONS "CEMDATA_PATH=${CEMDATA_PATH}" ) target_link_libraries(ex_reactmicp_drying ${REACTMICP_STATIC_LIBS}) # carbonation # ----------- if (HDF5_FOUND) add_executable(ex_reactmicp_acc_carbo - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_UNSATURATED_EXAMPLE} reactmicp/unsaturated/acc_carbo.cpp ) set(CEMDATA_PATH \"../data/cemdata.yaml\") set_source_files_properties(reactmicp/unsaturated/acc_carbo.cpp PROPERTIES COMPILE_DEFINITIONS "CEMDATA_PATH=${CEMDATA_PATH}" ) include_directories(${HDF5_INCLUDE_DIRS}) set_target_properties(ex_reactmicp_acc_carbo PROPERTIES COMPILE_DEFINITIONS HDF5_DEFINITIONS) target_link_libraries(ex_reactmicp_acc_carbo ${REACTMICP_STATIC_LIBS}) endif() # Chloride # ======== # migration # --------- +set_exclude_if_no_reactmicp_system( + DONT_COMPILE_CHLORIDE_EXAMPLE + REACTMICP_ENABLE_SYSTEM_CHLORIDE +) + add_executable(ex_reactmicp_migration - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_CHLORIDE_EXAMPLE} reactmicp/chloride/migration.cpp ) set(CEMDATA_PATH \"../data/cemdata.yaml\") set_source_files_properties(reactmicp/chloride/migration.cpp PROPERTIES COMPILE_DEFINITIONS "CEMDATA_PATH=${CEMDATA_PATH}" ) target_link_libraries(ex_reactmicp_migration ${REACTMICP_STATIC_LIBS}) add_executable(ex_reactmicp_benchmark_rasouli - ${EXAMPLE_IS_OPTIONAL} + ${DONT_COMPILE_CHLORIDE_EXAMPLE} reactmicp/chloride/benchmark_rasouli.cpp ) set(CEMDATA_PATH \"../data/cemdata.yaml\") set_source_files_properties(reactmicp/chloride/benchmark_rasouli.cpp PROPERTIES COMPILE_DEFINITIONS "CEMDATA_PATH=${CEMDATA_PATH}" ) target_link_libraries(ex_reactmicp_benchmark_rasouli ${REACTMICP_STATIC_LIBS}) diff --git a/examples/reactmicp/chloride/migration.cpp b/examples/reactmicp/chloride/migration.cpp index d683f7e..d680eb1 100644 --- a/examples/reactmicp/chloride/migration.cpp +++ b/examples/reactmicp/chloride/migration.cpp @@ -1,280 +1,296 @@ /* ============================================================================= Copyright (c) 2014-2017 F. Georget Princeton University Copyright (c) 2017 F. Georget EPFL All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ============================================================================= */ #include "reactmicp/systems/chloride/variables.hpp" #include "reactmicp/systems/chloride/variables_interface.hpp" #include "reactmicp/systems/chloride/transport_stagger.hpp" #include "reactmicp/systems/chloride/boundary_conditions.hpp" #include "specmicp_common/log.hpp" #include "specmicp_database/io/configuration.hpp" #include "specmicp/adimensional/adimensional_system_solver.hpp" #include "specmicp/problem_solver/smart_solver.hpp" #include "specmicp/problem_solver/reactant_box.hpp" #include "specmicp/adimensional/adimensional_system_solver_structs.hpp" #include "reactmicp/systems/chloride/transport_program_struct.hpp" #include "reactmicp/solver/staggers_base/stagger_structs.hpp" #include "dfpm/solver/parabolic_structs.hpp" #include "specmicp_common/log.hpp" #include #include - +#include using namespace specmicp; using namespace specmicp::reactmicp::systems::chloride; -mesh::Mesh1DPtr get_mesh(index_t nb_nodes) +mesh::Mesh1DPtr get_mesh(scalar_t thickness, scalar_t dx) { mesh::Uniform1DMeshGeometry amesh; - amesh.dx = 0.1; + amesh.dx = dx; amesh.section = (121.0)*3.14; - amesh.nb_nodes = nb_nodes; + amesh.nb_nodes = std::floor(thickness/dx)+1; return mesh::uniform_mesh1d(amesh); } specmicp::database::RawDatabasePtr get_database() { static database::RawDatabasePtr raw_data {nullptr}; if (raw_data == nullptr) { specmicp::database::Database thedatabase(CEMDATA_PATH); - thedatabase.keep_only_components({"H2O","H[+]", "Na[+]", "Cl[-]", "Ca[2+]", "SO4[2-]"}); + //thedatabase.keep_only_components({"H2O","H[+]", "Na[+]", "Cl[-]", "Ca[2+]", "SO4[2-]"}); + thedatabase.keep_only_components({"H2O","H[+]", "Na[+]", "Cl[-]", "Ca[2+]"}); thedatabase.swap_components({{"H[+]", "HO[-]"}}); thedatabase.remove_half_cell_reactions(); raw_data = thedatabase.get_database(); raw_data->freeze_db(); } return raw_data; } -specmicp::AdimensionalSystemSolution low_conc(database::RawDatabasePtr data, units::UnitsSet tunits) +specmicp::AdimensionalSystemSolution initial_conditions(database::RawDatabasePtr data, units::UnitsSet tunits) { ReactantBox box(data, tunits); box.set_solution(0.3, "L/L"); box.set_saturated_system(); box.set_inert_volume_fraction(0.7); box.add_aqueous_species("NaCl", 0.001, "mol/kg"); box.add_aqueous_species("NaOH", 0.3, "mol/kg"); - //box.add_aqueous_species("Ca(OH)2", 0.01, "mol/kg"); - box.add_aqueous_species("CaSO4", 0.01, "mol/kg"); + box.add_aqueous_species("Ca(OH)2", 0.02, "mol/kg"); + //box.add_aqueous_species("CaSO4", 0.01, "mol/kg"); SmartAdimSolver solver(data, box, false); if (! solver.solve()) { throw std::runtime_error("Cannot solve init cond"); } return solver.get_solution(); } -static specmicp::AdimensionalSystemSolution high_conc(database::RawDatabasePtr data, units::UnitsSet tunits) +static specmicp::AdimensionalSystemSolution boundary_conditions(database::RawDatabasePtr data, units::UnitsSet tunits) { ReactantBox box(data, tunits); box.set_solution(0.3, "L/L"); box.set_saturated_system(); box.set_inert_volume_fraction(0.7); - box.add_aqueous_species("NaOH", 0.1, "mol/kg"); + box.add_aqueous_species("NaOH", 0.3, "mol/kg"); box.add_aqueous_species("NaCl", 0.5, "mol/kg"); //box.add_aqueous_species("Ca(OH)2", 0.01, "mol/kg"); - box.add_aqueous_species("CaSO4", 0.01, "mol/kg"); + //box.add_aqueous_species("CaSO4", 0.01, "mol/kg"); SmartAdimSolver solver(data, box, false); if (! solver.solve()) { throw std::runtime_error("Cannot solve bound cond"); } return solver.get_solution(); } static void chemitry_step(ChlorideVariables* vars) { RawDatabasePtr data = vars->get_database(); for (int node=1; nodeget_mesh()->nb_nodes(); ++node) { AdimensionalSystemConstraints constraints; Vector total_conc = Vector::Zero(data->nb_component()); for (auto i: data->range_aqueous_component()) { total_conc(i) = vars->porosity(node)*vars->main_variables()(vars->dof_component(node, i)); } constraints.set_total_concentrations(total_conc); constraints.set_saturated_system(); constraints.set_inert_volume_fraction(0.7); AdimensionalSystemSolution sol = vars->adim_solution(node); Vector x = sol.main_variables; AdimensionalSystemSolver solver(data, constraints, vars->adim_solution(node)); solver.get_options().units_set = vars->get_units(); solver.get_options().system_options.cutoff_total_concentration = 1e-14; solver.get_options().solver_options.set_tolerance(1e-6,1e-14); micpsolver::MiCPPerformance perf = solver.solve(x, false); if (perf.return_code < micpsolver::MiCPSolverReturnCode::Success) { std::cout << "\n === \n" << total_conc << "\n === \n" << std::endl; throw std::runtime_error("Failed to solve chemistry step"); } auto adim_sol = solver.get_raw_solution(x); vars->set_adim_solution(node, adim_sol); } } int main() { std::cerr.flush(); specmicp::logger::ErrFile::stream() = &std::cout; specmicp::stdlog::ReportLevel() = specmicp::logger::Warning; - const index_t nb_nodes {31}; - mesh::Mesh1DPtr amesh = get_mesh(nb_nodes); auto tunits = units::SI_units; tunits.length = units::LengthUnit::centimeter; + mesh::Mesh1DPtr amesh = get_mesh(3.0, 0.1); + const index_t nb_nodes = amesh->nb_nodes(); + std::cout << "nb nodes : " << nb_nodes << std::endl; + auto data = get_database(); + index_t i_na = data->get_id_component("Na[+]"); index_t i_cl = data->get_id_component("Cl[-]"); - index_t i_ho = data->get_id_component("HO[-]"); index_t i_ca = data->get_id_component("Ca[2+]"); - index_t i_so = data->get_id_component("SO4[2-]"); + index_t i_h = data->get_id_component("H[+]"); + index_t i_ho = data->get_id_component("HO[-]"); ChlorideVariablesInterface interface(data, amesh, tunits); - std::vector sols = {low_conc(data, tunits), high_conc(data, tunits)}; + std::vector sols = { + initial_conditions(data, tunits), boundary_conditions(data, tunits)}; std::vector indices(nb_nodes, 0); indices[0] = 1; interface.set_adim_solutions(indices, sols); interface.set_diffusion_coefficient_component(i_na, 1.334e-5); interface.set_default_diffusion_coefficient_component(1.0e-5); interface.set_default_diffusion_coefficient_aqueous(1.0e-5); interface.set_diffusion_coefficient_component("Cl[-]", 2.032e-5); interface.set_diffusion_coefficient_aqueous("H[+]", 9.311e-5); interface.set_diffusion_coefficient_component("HO[-]", 5.273e-5); - interface.set_diffusion_coefficient_aqueous("HSO4[-]", 1.385e-5); - interface.set_diffusion_coefficient_component("SO4[2-]", 1.065e-5); + //interface.set_diffusion_coefficient_aqueous("HSO4[-]", 1.385e-5); + //interface.set_diffusion_coefficient_component("SO4[2-]", 1.065e-5); - interface.set_default_diffusion_resistance_factor(1.0e-3); + interface.set_default_diffusion_resistance_factor(5.0e-2); interface.set_potential(0, 0.0); - interface.set_potential(nb_nodes-1, 4.0); + interface.set_potential(nb_nodes-1, 1.0); auto variables = interface.get_variables(); std::shared_ptr bcs = BoundaryConditions::make(amesh, data); bcs->fix_concentrations_node(0); bcs->fix_potential_node(0); bcs->fix_concentrations_node(nb_nodes-1); bcs->fix_potential_node(nb_nodes-1); ChlorideTransportStagger stagger(variables, bcs); stagger.initialize(variables.get()); stagger.set_approximation_method(AdimSolutionPerturbationMethod::component); auto& opts = stagger.get_options(); opts.absolute_tolerance = 1e-12; opts.residuals_tolerance = 1e-6; opts.step_tolerance = 1e-14; opts.quasi_newton = 1; opts.maximum_step_length = 1e3; opts.maximum_iterations = 500; opts.alpha = 1; - index_t nb_iter = 1000; + index_t nb_iter = 10000; index_t dt = 50; - std::cout << "======\n" << variables->main_variables() << "\n=========\n" << std::endl; + std::vector currents(nb_iter); + + std::ofstream cur_file("migration_current.csv"); + cur_file << "Time(s)\tCurrent\n"; for (int i=0; i(retcode) << std::endl; auto res = stagger.get_residual(variables.get()); //std::cout << res << " - " << res/res_0 << std::endl; if (retcode < reactmicp::solver::StaggerReturnCode::NotConvergedYet) { throw std::runtime_error("Failed to solve iteration "+ std::to_string(i) +". Retcode : "+std::to_string(static_cast(retcode))); } + if (i%2==0) { + cur_file << (i+1)*dt << "\t" << variables->current()(0) << "\n"; + } } - std::cout << "-----\n" << variables->main_variables() << "\n-----\n" << std::endl; - - std::cout << variables->current() << std::endl; + cur_file.close(); //std::cout << " ======= \n" << current << std::endl; //std::cout << "[\n"; //for (index_t i=0; inb_nodes())) { - auto cl = variables->main_variables()(variables->dof_component(node, i_cl)); - auto na = variables->main_variables()(variables->dof_component(node, i_na)); - auto ho = variables->main_variables()(variables->dof_component(node, i_ho)); - auto ca = variables->main_variables()(variables->dof_component(node, i_ca)); - auto so = variables->main_variables()(variables->dof_component(node, i_so)); - - std::cout << amesh->get_position(node) << "\t" + AdimensionalSystemSolutionExtractor extr(variables->adim_solution(node), data, tunits); + auto rho_w = extr.density_water()*1000.; + auto cl = extr.molality_component(i_cl)*rho_w; + auto na = extr.molality_component(i_na)*rho_w; + auto ca = extr.molality_component(i_ca)*rho_w; + auto ph = extr.pH(); + + outfile << amesh->get_position(node) << "\t" << na << "\t" << cl << "\t" - << ho << "\t" << ca << "\t" - << so << "\t" + << ph << "\t" << variables->main_variables()(variables->dof_potential(node)) << "\t" - << na - cl - ho + 2*ca - 2*so<< "\n"; + << extr.charge_balance()*rho_w << "\t" + << "\n"; } + outfile.close(); + + } diff --git a/src/reactmicp/systems/CMakeLists.txt b/src/reactmicp/systems/CMakeLists.txt index 4e07b70..be21986 100644 --- a/src/reactmicp/systems/CMakeLists.txt +++ b/src/reactmicp/systems/CMakeLists.txt @@ -1,5 +1,13 @@ # The different systems +if ( REACTMICP_ENABLE_SYSTEM_SATURATED ) add_subdirectory( saturated_react ) -add_subdirectory( unsaturated ) -add_subdirectory( chloride ) +endif ( REACTMICP_ENABLE_SYSTEM_SATURATED ) + +if ( REACTMICP_ENABLE_SYSTEM_UNSATURATED ) + add_subdirectory( unsaturated ) +endif ( REACTMICP_ENABLE_SYSTEM_UNSATURATED ) + +if ( REACTMICP_ENABLE_SYSTEM_CHLORIDE ) + add_subdirectory( chloride ) +endif ( REACTMICP_ENABLE_SYSTEM_CHLORIDE ) diff --git a/tests/reactmicp/CMakeLists.txt b/tests/reactmicp/CMakeLists.txt index 8eb844d..295de95 100644 --- a/tests/reactmicp/CMakeLists.txt +++ b/tests/reactmicp/CMakeLists.txt @@ -1,91 +1,97 @@ # Reactmicp : Reactive transport solver # ------------------------------------- set(test_reactmicp_files solver/test_reactive_transport_solver.cpp solver/test_coupling.cpp ) add_catch_test(NAME reactmicp SOURCES ${test_reactmicp_files} LINK_LIBRARIES ${REACTMICP_STATIC_LIBS}) # Saturated diffusion using new reactive transport solver # ======================================================= set(test_reactmicp_saturated_files systems/saturated_react/test_reactmicp_saturated_react.cpp systems/saturated_react/speciation_system.cpp systems/saturated_react/variables.cpp systems/saturated_react/transport_program.cpp systems/saturated_react/equilibrium_stagger.cpp ) -add_catch_test( - NAME reactmicp_saturated_react - SOURCES ${test_reactmicp_saturated_files} - LINK_LIBRARIES ${REACTMICP_STATIC_LIBS} -) +if ( REACTMICP_ENABLE_SYSTEM_SATURATED ) + add_catch_test( + NAME reactmicp_saturated_react + SOURCES ${test_reactmicp_saturated_files} + LINK_LIBRARIES ${REACTMICP_STATIC_LIBS} + ) +endif( REACTMICP_ENABLE_SYSTEM_SATURATED ) # Unsaturated reactive transport system # ===================================== set(UNSATURATED_DIR systems/unsaturated) set(test_reactmicp_unsaturated_files ${UNSATURATED_DIR}/test_reactmicp_unsaturated.cpp ${UNSATURATED_DIR}/aqueous_equation.cpp ${UNSATURATED_DIR}/aqueous_pressure_equation.cpp ${UNSATURATED_DIR}/boundary_conditions.cpp ${UNSATURATED_DIR}/configuration.cpp ${UNSATURATED_DIR}/equilibrium_stagger.cpp ${UNSATURATED_DIR}/hdf5_unsaturated.cpp ${UNSATURATED_DIR}/pressure_equation.cpp ${UNSATURATED_DIR}/saturation_equation.cpp ${UNSATURATED_DIR}/saturation_pressure_equation.cpp ${UNSATURATED_DIR}/transport_stagger.cpp ${UNSATURATED_DIR}/variables.cpp ) set(TEST_CEMDATA_PATH \"../../data/cemdata.yaml\") set_source_files_properties( ${test_reactmicp_unsaturated_files} PROPERTIES COMPILE_DEFINITIONS "TEST_CEMDATA_PATH=${TEST_CEMDATA_PATH}" ) +if ( REACTMICP_ENABLE_SYSTEM_UNSATURATED ) add_catch_test( NAME reactmicp_unsaturated SOURCES ${test_reactmicp_unsaturated_files} LINK_LIBRARIES ${REACTMICP_STATIC_LIBS} ) +endif ( REACTMICP_ENABLE_SYSTEM_UNSATURATED ) # unsaturated binary # ------------------ add_subdirectory( binary/unsaturated ) # Chloride reactive transport system # =================================== set(CHLORIDE_DIR systems/chloride) set(test_reactmicp_chloride_files ${CHLORIDE_DIR}/test_reactmicp_chloride.cpp ${CHLORIDE_DIR}/variables.cpp ${CHLORIDE_DIR}/transport_program.cpp ${CHLORIDE_DIR}/transport_stagger.cpp ) set(TEST_CEMDATA_PATH \"../../data/cemdata.yaml\") set_source_files_properties( ${test_reactmicp_chloride_files} PROPERTIES COMPILE_DEFINITIONS "TEST_CEMDATA_PATH=${TEST_CEMDATA_PATH}" ) +if ( REACTMICP_ENABLE_SYSTEM_CHLORIDE ) add_catch_test( NAME reactmicp_chloride SOURCES ${test_reactmicp_chloride_files} LINK_LIBRARIES ${REACTMICP_STATIC_LIBS} ) +endif ( REACTMICP_ENABLE_SYSTEM_CHLORIDE )