diff --git a/.patches/exercise-biomineralization/exercise-biomineralization.patch b/.patches/exercise-biomineralization/exercise-biomineralization.patch index b0f01d4f18932988bd7b6b75bf8ffad3125347c5..8f9e5efcaea48944d284c2830761cfe4111bf8f3 100644 --- a/.patches/exercise-biomineralization/exercise-biomineralization.patch +++ b/.patches/exercise-biomineralization/exercise-biomineralization.patch @@ -1,6 +1,6 @@ diff -ruN exercises/exercise-biomineralization/biominproblem.hh exercises/solution/exercise-biomineralization/biominproblem.hh ---- exercises/exercise-biomineralization/biominproblem.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/biominproblem.hh 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/biominproblem.hh 2024-07-17 10:12:47.948499425 +0200 ++++ exercises/solution/exercise-biomineralization/biominproblem.hh 2024-07-17 10:24:57.671229916 +0200 @@ -31,10 +31,12 @@ // TODO: dumux-course-task @@ -22,13 +22,14 @@ diff -ruN exercises/exercise-biomineralization/biominproblem.hh exercises/soluti static constexpr int numComponents = FluidSystem::numComponents; static constexpr int pressureIdx = Indices::pressureIdx; -@@ -182,11 +185,12 @@ +@@ -182,12 +185,12 @@ NumEqVector values(0.0); - Scalar waterFlux = injVolumeflux_; // divide by area if area not 1! [m/s] -+ Scalar gasFlux = injCO2_; // divide by area if area not 1! [m/s] + Scalar waterFlux = injVolumeflux_; // divide by area if area not 1! [m^3/m^2s] +-// Scalar gasFlux = injCO2_; // divide by area if area not 1! [kg/m^2s] ++ Scalar gasFlux = injCO2_; // divide by area if area not 1! [kg/m^2s] - // Set values for Ca + urea injection above aquitard. + // Set values for Ca + urea injection above aquitard until injBioTime is reached. // Use negative values for injection. if(globalPos[0] < eps_ - && globalPos[1] > 11.0 - eps_ @@ -36,29 +37,29 @@ diff -ruN exercises/exercise-biomineralization/biominproblem.hh exercises/soluti && globalPos[1] < 12.0 + eps_ && time_ < injBioTime_) { -@@ -196,9 +200,15 @@ +@@ -197,6 +200,13 @@ } // TODO: dumux-course-task // Set CO2 injection below aquitard after the injBioTime -+ else if(globalPos[0] < eps_ ++ if(globalPos[0] < eps_ + && globalPos[1] > 2.0 + eps_ + && globalPos[1] < 3.0 + eps_ + && time_ > injBioTime_ ) + { + values[conti0EqIdx + CO2Idx] = - gasFlux / FluidSystem::molarMass(CO2Idx); + } - else - { -- // Scalar gasFlux = injCO2_; // divide by area if area not 1! [m/s] - values = 0.0; //mol/m²/s - } -@@ -265,11 +275,13 @@ + return values; + } +@@ -259,14 +269,15 @@ + + // TODO: dumux-course-task // set Chemistry - // set VolumeVariables - // call reactionSource() in chemistry +-// Chemistry chemistry; + Chemistry chemistry; + // set VolumeVariables + const auto& volVars = elemVolVars[scv]; + // call reactionSource() in chemistry + chemistry.reactionSource(source, volVars); return source; @@ -69,8 +70,8 @@ diff -ruN exercises/exercise-biomineralization/biominproblem.hh exercises/soluti { return Kxx_; diff -ruN exercises/exercise-biomineralization/biominspatialparams.hh exercises/solution/exercise-biomineralization/biominspatialparams.hh ---- exercises/exercise-biomineralization/biominspatialparams.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/biominspatialparams.hh 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/biominspatialparams.hh 2023-03-31 11:06:46.213029086 +0200 ++++ exercises/solution/exercise-biomineralization/biominspatialparams.hh 2023-03-31 11:06:46.257030162 +0200 @@ -30,7 +30,7 @@ #include <dumux/material/fluidmatrixinteractions/porosityprecipitation.hh> // TODO: dumux-course-task @@ -90,31 +91,44 @@ diff -ruN exercises/exercise-biomineralization/biominspatialparams.hh exercises/ Scalar initialPorosity_; diff -ruN exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh ---- exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh 2024-07-08 09:06:59.613159864 +0200 -@@ -93,6 +93,7 @@ +--- exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh 2024-07-17 10:12:47.940499262 +0200 ++++ exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh 2024-07-17 10:24:22.278207845 +0200 +@@ -85,24 +85,26 @@ + // define and compute some parameters for convenience: + const Scalar xwCa = volVars.moleFraction(liquidPhaseIdx,CaIdx); + const Scalar densityBiofilm = volVars.solidComponentDensity(BiofilmPhaseIdx); ++ + using std::max; + const Scalar volFracBiofilm = max(volVars.solidVolumeFraction(BiofilmPhaseIdx),0.0); ++ // TODO: dumux-course-task // implement mass of biofilm +- const Scalar massBiofilm = 0.0; + const Scalar massBiofilm = densityBiofilm * volFracBiofilm; - ++ const Scalar molalityUrea = moleFracToMolality(volVars.moleFraction(liquidPhaseIdx,UreaIdx), xwCa, -@@ -100,20 +101,21 @@ + volVars.moleFraction(liquidPhaseIdx,CO2Idx)); // [mol_urea/kg_H2O] // TODO: dumux-course-task - // compute rate of ureolysis by implementing Z_urease,biofilm and r_urea +- // compute rate of ureolysis by implementing Zub and rurea +- const Scalar Zub = 0.0; - const Scalar rurea = 0.0; ++ // compute rate of ureolysis by implementing Z_urease,biofilm and r_urea + const Scalar Zub = kub_ * massBiofilm; // [kg urease/m³] + const Scalar rurea = kUrease_ * Zub * molalityUrea / (kUrea_ + molalityUrea); // [mol/m³s] +- // TODO: dumux-course-task // compute/set dissolution and precipitation rate of calcite - const Scalar rprec = 0.0; + const Scalar rprec = rurea; // set source terms // TODO: dumux-course-task - // update terms according to stochiometry +@@ -110,11 +112,11 @@ + // Hint: Ammonium occurs in the reaction equation, but is not accounted for in this simplified setup. + // Additionally, the consumption of water by the reaction may be neglected, as water is present in excess. q[H2OIdx] += 0.0; - q[CO2Idx] += 0.0; - q[CaIdx] += 0.0; @@ -129,8 +143,8 @@ diff -ruN exercises/exercise-biomineralization/chemistry/simplebiominreactions.h private: diff -ruN exercises/exercise-biomineralization/CMakeLists.txt exercises/solution/exercise-biomineralization/CMakeLists.txt ---- exercises/exercise-biomineralization/CMakeLists.txt 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/CMakeLists.txt 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/CMakeLists.txt 2023-03-31 11:06:46.213029086 +0200 ++++ exercises/solution/exercise-biomineralization/CMakeLists.txt 2023-03-31 11:06:46.257030162 +0200 @@ -1,7 +1,7 @@ # executables for exercisebiomin -dumux_add_test(NAME exercise_biomin @@ -142,8 +156,8 @@ diff -ruN exercises/exercise-biomineralization/CMakeLists.txt exercises/solution # add a symlink for each input file add_input_file_links() diff -ruN exercises/exercise-biomineralization/components/biofilm.hh exercises/solution/exercise-biomineralization/components/biofilm.hh ---- exercises/exercise-biomineralization/components/biofilm.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/components/biofilm.hh 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/components/biofilm.hh 2023-03-31 11:06:46.213029086 +0200 ++++ exercises/solution/exercise-biomineralization/components/biofilm.hh 2023-03-31 11:06:46.257030162 +0200 @@ -24,9 +24,10 @@ #ifndef DUMUX_BIOFILM_HH #define DUMUX_BIOFILM_HH @@ -157,8 +171,8 @@ diff -ruN exercises/exercise-biomineralization/components/biofilm.hh exercises/s namespace Dumux::Components { diff -ruN exercises/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh exercises/solution/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh ---- exercises/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh 2024-01-03 15:09:59.457498898 +0100 ++++ exercises/solution/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh 2024-07-17 10:12:47.944499344 +0200 @@ -53,10 +53,11 @@ using std::pow; // TODO: dumux-course-task @@ -168,13 +182,13 @@ diff -ruN exercises/exercise-biomineralization/fluidmatrixinteractions/permeabil // TODO: dumux-course-task // return the updated permeability according to K=K_0*(poro/refPoro)^exponent - return refPerm; -+ return refPerm * pow((poro)/(refPoro), exponent); ++ return refPerm * pow(poro/refPoro, exponent); } }; diff -ruN exercises/exercise-biomineralization/fluidsystems/biomin.hh exercises/solution/exercise-biomineralization/fluidsystems/biomin.hh ---- exercises/exercise-biomineralization/fluidsystems/biomin.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/fluidsystems/biomin.hh 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/fluidsystems/biomin.hh 2024-01-03 15:09:59.461499000 +0100 ++++ exercises/solution/exercise-biomineralization/fluidsystems/biomin.hh 2024-01-03 15:09:59.465499101 +0100 @@ -231,7 +231,7 @@ static void init() { @@ -185,21 +199,21 @@ diff -ruN exercises/exercise-biomineralization/fluidsystems/biomin.hh exercises/ } diff -ruN exercises/exercise-biomineralization/params.input exercises/solution/exercise-biomineralization/params.input ---- exercises/exercise-biomineralization/params.input 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/params.input 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/params.input 2024-07-17 10:12:47.924498936 +0200 ++++ exercises/solution/exercise-biomineralization/params.input 2024-07-17 10:25:30.064171179 +0200 @@ -16,10 +16,10 @@ InitBiofilm = 0.05 # [-] initial volumefraction biofilm [Injection] --InjVolumeflux = 1e-5 # [m³/s] = [ml/min] /[s/min] /[ml/m³] +-InjVolumeflux = 1e-5 # [m³/s] -InjBioTime = 10 # [days] -+InjVolumeflux = 1e-4 # [m³/s] = [ml/min] /[s/min] /[ml/m³] ++InjVolumeflux = 1e-4 # [m³/s] +InjBioTime = 12 # [days] InjCO2 = 1e-2 # [kg/s] gasFlux -InjCO2Time = 4 # [days] duration of CO2 injection until the end of the simulation +InjCO2Time = 4 # [days] ConcCa = 40 # [kg/m³] injected calcium concentration (max: 50) - ConcUrea = 60 # [kg/m³] injected urea concentration (max: 80) + ConcUrea = 60 # [kg/m³] injected urea concentration, should be 1.5 times ConcCa (max: 80) @@ -35,7 +35,6 @@ Aquitard.Swr = 0.0 @@ -218,8 +232,8 @@ diff -ruN exercises/exercise-biomineralization/params.input exercises/solution/e +[PowerLaw] +Exponent = 5.0 diff -ruN exercises/exercise-biomineralization/properties.hh exercises/solution/exercise-biomineralization/properties.hh ---- exercises/exercise-biomineralization/properties.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/properties.hh 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/properties.hh 2023-03-31 11:06:46.213029086 +0200 ++++ exercises/solution/exercise-biomineralization/properties.hh 2023-03-31 11:06:46.261030260 +0200 @@ -30,17 +30,20 @@ #include <dumux/discretization/cctpfa.hh> #include <dumux/porousmediumflow/2pncmin/model.hh> @@ -253,9 +267,9 @@ diff -ruN exercises/exercise-biomineralization/properties.hh exercises/solution/ public: using type = FluidSystems::BioMin<Scalar, CO2Impl, H2OType>; diff -ruN exercises/exercise-biomineralization/README.md exercises/solution/exercise-biomineralization/README.md ---- exercises/exercise-biomineralization/README.md 2024-07-16 16:55:16.514073847 +0200 +--- exercises/exercise-biomineralization/README.md 2024-07-17 10:12:47.944499344 +0200 +++ exercises/solution/exercise-biomineralization/README.md 1970-01-01 01:00:00.000000000 +0100 -@@ -1,255 +0,0 @@ +@@ -1,257 +0,0 @@ -# Exercise Biomineralization (DuMuX Course) - -The aim of this exercise is to get a first glimpse at the _DuMu<sup>x</sup>_ way of implementing mineralization and reaction processes. In the scope of this exercise, the setting of boundary conditions is revisited and a new reaction term is implemented. @@ -344,14 +358,14 @@ diff -ruN exercises/exercise-biomineralization/README.md exercises/solution/exer - -Calcium ion + Urea + 2 Water → (2 Ammonium ions) + Calcite - --Note that for the sake of having a simplified chemistry for this dumux-course example, the component Ammonium is not considered as part of the reaction. Thus, you cannot set its source term, even though it is produced in the real reaction. --Similarly, we only account for "Total Carbon", which is the sum of all carbon species +-Note that for the sake of having a simplified chemistry for this dumux-course example, the component ammonium is not considered as part of the reaction. Thus, you cannot set its source term, even though it is produced in the real reaction. +-Similarly, we only account for "total carbon", which is the sum of all carbon species -($`\mathrm{CO_{2}}`$, $`\mathrm{H_{2}CO_{3}}`$, $`\mathrm{HCO_{3}^{-}}`$, and $`\mathrm{CO_{3}^{2-}}`$). --Further, we assume that the overall reaction has reached an equilibrium state, i.e. every mole of urea hydrolyzed will lead to a mole of Calcite precipitating, and thus the precipitation rate simplifies to $`\displaystyle r_{prec} = r_{urea}`$. --In reality, the initial geochemistry might be far away from conditions at which Calcite precipitates, e.g. due to low pH values at which the "Total Carbon" is mainly present as bicarbonate, $`\mathrm{HCO_{3}^{-}}`$, not taking part in the Calcite precipitation reaction. +-Further, we assume that the overall reaction has reached an equilibrium state, i.e. every mole of urea hydrolyzed will lead to a mole of calcite precipitating, and thus the precipitation rate simplifies to $`\displaystyle r_{prec} = r_{urea}`$. +-In reality, the initial geochemistry might be far away from conditions at which calcite precipitates, e.g. due to low pH values at which the "total carbon" is mainly present as bicarbonate, $`\mathrm{HCO_{3}^{-}}`$, not taking part in the calcite precipitation reaction. -To reach the overall reaction's equilibrium state, the pH value needs to be increased first by ureolysis. --However, to calculate the detailed precipitation rate of Calcite, we would first need to determine how much of the aggregate species "Total Carbon" is present in the form of each of its sub species, $`\mathrm{CO_{2}}`$, $`\mathrm{H_{2}CO_{3}}`$, $`\mathrm{HCO_{3}^{-}}`$, and $`\mathrm{CO_{3}^{2-}}`$. --Further, we would need to account for all involved complex aqueous geochemistry to be able to determine the activities of both Calcium and Carbonate ions, which also impact the precipitation rate. +-However, to calculate the detailed precipitation rate of calcite, we would first need to determine how much of the aggregate species "total carbon" is present in the form of each of its sub species, $`\mathrm{CO_{2}}`$, $`\mathrm{H_{2}CO_{3}}`$, $`\mathrm{HCO_{3}^{-}}`$, and $`\mathrm{CO_{3}^{2-}}`$. +-Further, we would need to account for all involved complex aqueous geochemistry to be able to determine the activities of both calcium and carbonate ions, which also impact the precipitation rate. -We feel that this very specific chemistry goes beyond what is necessary for this dumux-course exercise and simplify the chemistry also with the motivation to save on the run time, which accounting for the detailed, complex geochemistry would increase significantly. -The assumption of the overall reaction being at an equilibrium is used in many models for biomineralization. - @@ -435,8 +449,10 @@ diff -ruN exercises/exercise-biomineralization/README.md exercises/solution/exer - const Scalar exponent = getParam<Scalar>("PowerLaw.Exponent", 5.0); -``` - +-Then modify the return value, so that the reference permeability is actually updated +- -```c++ -- const Scalar factor = pow(poro/refPoro, exponent); +- return = refPerm pow(poro/refPoro, exponent); -``` - -As a special feature, we would like the exponent $`\displaystyle \eta=5`$ to be a run-time parameter read from the input file, as this allows easy modification of the parameter and potentially fit it. @@ -512,8 +528,8 @@ diff -ruN exercises/exercise-biomineralization/README.md exercises/solution/exer -output.CellData.append((S_gas_0-S_gas_1),'diffS_gas'); -``` diff -ruN exercises/exercise-biomineralization/solidsystems/biominsolidphase.hh exercises/solution/exercise-biomineralization/solidsystems/biominsolidphase.hh ---- exercises/exercise-biomineralization/solidsystems/biominsolidphase.hh 2024-07-08 09:06:59.581159992 +0200 -+++ exercises/solution/exercise-biomineralization/solidsystems/biominsolidphase.hh 2024-07-08 09:06:59.613159864 +0200 +--- exercises/exercise-biomineralization/solidsystems/biominsolidphase.hh 2023-03-31 11:06:46.213029086 +0200 ++++ exercises/solution/exercise-biomineralization/solidsystems/biominsolidphase.hh 2023-03-31 11:06:46.261030260 +0200 @@ -27,12 +27,12 @@ #include <string> #include <dune/common/exceptions.hh> diff --git a/exercises/exercise-biomineralization/README.md b/exercises/exercise-biomineralization/README.md index 48c698f819b63d6890e156b2cfd1c3f50291f3a5..b3ac137ffb88793881e22d76c10d7409f9fe69c0 100644 --- a/exercises/exercise-biomineralization/README.md +++ b/exercises/exercise-biomineralization/README.md @@ -86,14 +86,14 @@ Calcium ion + Total Carbon → Calcite Calcium ion + Urea + 2 Water → (2 Ammonium ions) + Calcite -Note that for the sake of having a simplified chemistry for this dumux-course example, the component Ammonium is not considered as part of the reaction. Thus, you cannot set its source term, even though it is produced in the real reaction. -Similarly, we only account for "Total Carbon", which is the sum of all carbon species +Note that for the sake of having a simplified chemistry for this dumux-course example, the component ammonium is not considered as part of the reaction. Thus, you cannot set its source term, even though it is produced in the real reaction. +Similarly, we only account for "total carbon", which is the sum of all carbon species ($`\mathrm{CO_{2}}`$, $`\mathrm{H_{2}CO_{3}}`$, $`\mathrm{HCO_{3}^{-}}`$, and $`\mathrm{CO_{3}^{2-}}`$). -Further, we assume that the overall reaction has reached an equilibrium state, i.e. every mole of urea hydrolyzed will lead to a mole of Calcite precipitating, and thus the precipitation rate simplifies to $`\displaystyle r_{prec} = r_{urea}`$. -In reality, the initial geochemistry might be far away from conditions at which Calcite precipitates, e.g. due to low pH values at which the "Total Carbon" is mainly present as bicarbonate, $`\mathrm{HCO_{3}^{-}}`$, not taking part in the Calcite precipitation reaction. +Further, we assume that the overall reaction has reached an equilibrium state, i.e. every mole of urea hydrolyzed will lead to a mole of calcite precipitating, and thus the precipitation rate simplifies to $`\displaystyle r_{prec} = r_{urea}`$. +In reality, the initial geochemistry might be far away from conditions at which calcite precipitates, e.g. due to low pH values at which the "total carbon" is mainly present as bicarbonate, $`\mathrm{HCO_{3}^{-}}`$, not taking part in the calcite precipitation reaction. To reach the overall reaction's equilibrium state, the pH value needs to be increased first by ureolysis. -However, to calculate the detailed precipitation rate of Calcite, we would first need to determine how much of the aggregate species "Total Carbon" is present in the form of each of its sub species, $`\mathrm{CO_{2}}`$, $`\mathrm{H_{2}CO_{3}}`$, $`\mathrm{HCO_{3}^{-}}`$, and $`\mathrm{CO_{3}^{2-}}`$. -Further, we would need to account for all involved complex aqueous geochemistry to be able to determine the activities of both Calcium and Carbonate ions, which also impact the precipitation rate. +However, to calculate the detailed precipitation rate of calcite, we would first need to determine how much of the aggregate species "total carbon" is present in the form of each of its sub species, $`\mathrm{CO_{2}}`$, $`\mathrm{H_{2}CO_{3}}`$, $`\mathrm{HCO_{3}^{-}}`$, and $`\mathrm{CO_{3}^{2-}}`$. +Further, we would need to account for all involved complex aqueous geochemistry to be able to determine the activities of both calcium and carbonate ions, which also impact the precipitation rate. We feel that this very specific chemistry goes beyond what is necessary for this dumux-course exercise and simplify the chemistry also with the motivation to save on the run time, which accounting for the detailed, complex geochemistry would increase significantly. The assumption of the overall reaction being at an equilibrium is used in many models for biomineralization. @@ -177,8 +177,10 @@ $`\displaystyle K = K_0 \left(\frac{\phi}{\phi_0}\right)^\eta`$ const Scalar exponent = getParam<Scalar>("PowerLaw.Exponent", 5.0); ``` +Then modify the return value, so that the reference permeability is actually updated + ```c++ - const Scalar factor = pow(poro/refPoro, exponent); + return = refPerm pow(poro/refPoro, exponent); ``` As a special feature, we would like the exponent $`\displaystyle \eta=5`$ to be a run-time parameter read from the input file, as this allows easy modification of the parameter and potentially fit it. diff --git a/exercises/exercise-biomineralization/biominproblem.hh b/exercises/exercise-biomineralization/biominproblem.hh index 1f315088cffc6c94c75c07379f2d440e541f96c5..305f1a982a7008c1f2f936fde3a133490ccf7e7d 100644 --- a/exercises/exercise-biomineralization/biominproblem.hh +++ b/exercises/exercise-biomineralization/biominproblem.hh @@ -181,9 +181,10 @@ public: { NumEqVector values(0.0); - Scalar waterFlux = injVolumeflux_; // divide by area if area not 1! [m/s] + Scalar waterFlux = injVolumeflux_; // divide by area if area not 1! [m^3/m^2s] +// Scalar gasFlux = injCO2_; // divide by area if area not 1! [kg/m^2s] - // Set values for Ca + urea injection above aquitard. + // Set values for Ca + urea injection above aquitard until injBioTime is reached. // Use negative values for injection. if(globalPos[0] < eps_ && globalPos[1] > 11.0 - eps_ @@ -196,11 +197,6 @@ public: } // TODO: dumux-course-task // Set CO2 injection below aquitard after the injBioTime - else - { - // Scalar gasFlux = injCO2_; // divide by area if area not 1! [m/s] - values = 0.0; //mol/m²/s - } return values; } @@ -263,6 +259,7 @@ public: // TODO: dumux-course-task // set Chemistry +// Chemistry chemistry; // set VolumeVariables // call reactionSource() in chemistry diff --git a/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh b/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh index c71af7228654e52fdfe72cd8c3853f41962d999e..d85f7f87dc2432278add17f480a12ef9699af129 100644 --- a/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh +++ b/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh @@ -85,29 +85,30 @@ public: // define and compute some parameters for convenience: const Scalar xwCa = volVars.moleFraction(liquidPhaseIdx,CaIdx); const Scalar densityBiofilm = volVars.solidComponentDensity(BiofilmPhaseIdx); - - Scalar volFracBiofilm = volVars.solidVolumeFraction(BiofilmPhaseIdx); - - if (volFracBiofilm < 0) - volFracBiofilm = 0; + using std::max; + const Scalar volFracBiofilm = max(volVars.solidVolumeFraction(BiofilmPhaseIdx),0.0); // TODO: dumux-course-task // implement mass of biofilm - + const Scalar massBiofilm = 0.0; const Scalar molalityUrea = moleFracToMolality(volVars.moleFraction(liquidPhaseIdx,UreaIdx), xwCa, volVars.moleFraction(liquidPhaseIdx,CO2Idx)); // [mol_urea/kg_H2O] // TODO: dumux-course-task - // compute rate of ureolysis by implementing Z_urease,biofilm and r_urea + // compute rate of ureolysis by implementing Zub and rurea + const Scalar Zub = 0.0; const Scalar rurea = 0.0; + // TODO: dumux-course-task // compute/set dissolution and precipitation rate of calcite const Scalar rprec = 0.0; // set source terms // TODO: dumux-course-task - // update terms according to stochiometry + // set the source terms using the reaction rates defined above and signs based on the stoichiometry of the reactions. + // Hint: Ammonium occurs in the reaction equation, but is not accounted for in this simplified setup. + // Additionally, the consumption of water by the reaction may be neglected, as water is present in excess. q[H2OIdx] += 0.0; q[CO2Idx] += 0.0; q[CaIdx] += 0.0; diff --git a/exercises/exercise-biomineralization/params.input b/exercises/exercise-biomineralization/params.input index 6a5c51349d0faa2d2de39a83792b82279b996bb2..edc94eedea0ba4e5cb69ce6447e21f6d4ada592c 100644 --- a/exercises/exercise-biomineralization/params.input +++ b/exercises/exercise-biomineralization/params.input @@ -16,12 +16,12 @@ InitPressure = 1e5 # [Pa] initial pressure InitBiofilm = 0.05 # [-] initial volumefraction biofilm [Injection] -InjVolumeflux = 1e-5 # [m³/s] = [ml/min] /[s/min] /[ml/m³] +InjVolumeflux = 1e-5 # [m³/s] InjBioTime = 10 # [days] InjCO2 = 1e-2 # [kg/s] gasFlux InjCO2Time = 4 # [days] duration of CO2 injection until the end of the simulation ConcCa = 40 # [kg/m³] injected calcium concentration (max: 50) -ConcUrea = 60 # [kg/m³] injected urea concentration (max: 80) +ConcUrea = 60 # [kg/m³] injected urea concentration, should be 1.5 times ConcCa (max: 80) [SpatialParams] InitialPorosity = 0.35 # [-] diff --git a/exercises/solution/exercise-biomineralization/biominproblem.hh b/exercises/solution/exercise-biomineralization/biominproblem.hh index 1bad9aeed66da725935084c5abcdaca4fff36c43..e9c386429aa126b8b0ea0a66ae1b8258eb215024 100644 --- a/exercises/solution/exercise-biomineralization/biominproblem.hh +++ b/exercises/solution/exercise-biomineralization/biominproblem.hh @@ -184,10 +184,10 @@ public: { NumEqVector values(0.0); - Scalar waterFlux = injVolumeflux_; // divide by area if area not 1! [m/s] - Scalar gasFlux = injCO2_; // divide by area if area not 1! [m/s] + Scalar waterFlux = injVolumeflux_; // divide by area if area not 1! [m^3/m^2s] + Scalar gasFlux = injCO2_; // divide by area if area not 1! [kg/m^2s] - // Set values for Ca + urea injection above aquitard. + // Set values for Ca + urea injection above aquitard until injBioTime is reached. // Use negative values for injection. if(globalPos[0] < eps_ && globalPos[1] > 11.0 + eps_ @@ -200,17 +200,13 @@ public: } // TODO: dumux-course-task // Set CO2 injection below aquitard after the injBioTime - else if(globalPos[0] < eps_ + if(globalPos[0] < eps_ && globalPos[1] > 2.0 + eps_ && globalPos[1] < 3.0 + eps_ && time_ > injBioTime_ ) { values[conti0EqIdx + CO2Idx] = - gasFlux / FluidSystem::molarMass(CO2Idx); } - else - { - values = 0.0; //mol/m²/s - } return values; } @@ -273,10 +269,10 @@ public: // TODO: dumux-course-task // set Chemistry - // set VolumeVariables - // call reactionSource() in chemistry Chemistry chemistry; + // set VolumeVariables const auto& volVars = elemVolVars[scv]; + // call reactionSource() in chemistry chemistry.reactionSource(source, volVars); return source; diff --git a/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh b/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh index 71219a077e24707ee55fc7664e21b29a87406f73..b1e8354aae306b51741eaaded349a8bfcd179cae 100644 --- a/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh +++ b/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh @@ -86,10 +86,9 @@ public: const Scalar xwCa = volVars.moleFraction(liquidPhaseIdx,CaIdx); const Scalar densityBiofilm = volVars.solidComponentDensity(BiofilmPhaseIdx); - Scalar volFracBiofilm = volVars.solidVolumeFraction(BiofilmPhaseIdx); + using std::max; + const Scalar volFracBiofilm = max(volVars.solidVolumeFraction(BiofilmPhaseIdx),0.0); - if (volFracBiofilm < 0) - volFracBiofilm = 0; // TODO: dumux-course-task // implement mass of biofilm @@ -109,7 +108,9 @@ public: // set source terms // TODO: dumux-course-task - // update terms according to stochiometry + // set the source terms using the reaction rates defined above and signs based on the stoichiometry of the reactions. + // Hint: Ammonium occurs in the reaction equation, but is not accounted for in this simplified setup. + // Additionally, the consumption of water by the reaction may be neglected, as water is present in excess. q[H2OIdx] += 0.0; q[CO2Idx] += rurea - rprec ; q[CaIdx] += - rprec; diff --git a/exercises/solution/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh b/exercises/solution/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh index 3155225504604aafca729f35aa11627ce4c288ae..8cd24c3755132be2f9b8558a80ca6d83ef6b31fb 100644 --- a/exercises/solution/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh +++ b/exercises/solution/exercise-biomineralization/fluidmatrixinteractions/permeabilitypowerlaw.hh @@ -57,7 +57,7 @@ public: // TODO: dumux-course-task // return the updated permeability according to K=K_0*(poro/refPoro)^exponent - return refPerm * pow((poro)/(refPoro), exponent); + return refPerm * pow(poro/refPoro, exponent); } }; diff --git a/exercises/solution/exercise-biomineralization/params.input b/exercises/solution/exercise-biomineralization/params.input index 2bc70bdb028da1ba09d9051e1028cb85b67ef8ca..fe4294869d4061cf0e4ee78d36563e5cc5040f05 100644 --- a/exercises/solution/exercise-biomineralization/params.input +++ b/exercises/solution/exercise-biomineralization/params.input @@ -16,12 +16,12 @@ InitPressure = 1e5 # [Pa] initial pressure InitBiofilm = 0.05 # [-] initial volumefraction biofilm [Injection] -InjVolumeflux = 1e-4 # [m³/s] = [ml/min] /[s/min] /[ml/m³] +InjVolumeflux = 1e-4 # [m³/s] InjBioTime = 12 # [days] InjCO2 = 1e-2 # [kg/s] gasFlux InjCO2Time = 4 # [days] ConcCa = 40 # [kg/m³] injected calcium concentration (max: 50) -ConcUrea = 60 # [kg/m³] injected urea concentration (max: 80) +ConcUrea = 60 # [kg/m³] injected urea concentration, should be 1.5 times ConcCa (max: 80) [SpatialParams] InitialPorosity = 0.35 # [-] diff --git a/slides/biomin.md b/slides/biomin.md index df06232b5e364cee57535a0e99784815d7e47581..7198193ed600aa877f26e916582f076238713ff3 100644 --- a/slides/biomin.md +++ b/slides/biomin.md @@ -13,25 +13,6 @@ Microbes change the chemistry in a way that promotes the precipitation of calcit <img src="img/biomin_intro-microbes.png"/></br> <small>Credit: James Connolly, Montana State University.</small> -## What is ICP? - -:::::: {.columns} -::: {.column width=75%} -<video controls> -<source src="img/biomin_MIP-timelapse.ogg"/> -</video> -</br> -<small>Credit: James Connolly, Montana State University.</small> -::: -::: {.column width=25%} -* Biofilm (green) is alive -* Flow is induced, biofilm moves -* Reactions occur - * Calcite precipitates (white) - * Biofilm dies slowly -::: -:::::: - ## Results of ICP Segmented CT image of a glass-bead column mineralized by ICP @@ -272,38 +253,6 @@ $$ ## Specific Implementations -* Implement reactive sources and sinks, calling a seperate chemistry file - -```cpp -#include "chemistry/simplebiominreactions.hh" // chemical reactions -… -using Chemistry = typename Dumux::SimpleBiominReactions<NumEqVector, - VolumeVariables>; -… -``` - -## Specific Implementations - -* Implement reactive sources and sinks, calling a seperate chemistry file - -```cpp -NumEqVector source(const Element& element, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars, - const SubControlVolume& scv) const -{ - NumEqVector source(0.0); - Chemistry chemistry; - - const auto& volVars = elemVolVars[scv]; - chemistry.reactionSource(source, volVars); - - return source; -} -``` - -## Specific Implementations - * Update porosity in dumux/material/fluidmatrixinteractions/porosityprecipitation.hh ```cpp diff --git a/slides/img/biomin_MIP-timelapse.ogg b/slides/img/biomin_MIP-timelapse.ogg deleted file mode 100644 index 66298b22cdbb913d2241ca1510aba0bc2c8ce47c..0000000000000000000000000000000000000000 Binary files a/slides/img/biomin_MIP-timelapse.ogg and /dev/null differ