Skip to content

Commit 82b43da

Browse files
committed
added function(depth+subsidence)
1 parent 6261e99 commit 82b43da

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/constitutive_relations/eos/carbon_decomposition_rate_evaluator.cc

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
provided in the top-level COPYRIGHT file.
66
77
Authors: Ahmad Jan (jana@ornl.gov)
8+
Bo Gao (gaob@ornl.gov)
89
*/
910

1011
/*
@@ -18,7 +19,6 @@
1819
namespace Amanzi {
1920
namespace Relations {
2021

21-
2222
CarbonDecomposeRateEvaluator::CarbonDecomposeRateEvaluator(Teuchos::ParameterList& plist)
2323
: EvaluatorSecondaryMonotypeCV(plist)
2424
{
@@ -44,6 +44,9 @@ CarbonDecomposeRateEvaluator::CarbonDecomposeRateEvaluator(Teuchos::ParameterLis
4444
depth_key_ = Keys::readKey(plist, domain_, "depth", "depth");
4545
dependencies_.insert(KeyTag{ depth_key_, tag });
4646

47+
subsidence_key_ = Keys::readKey(plist, domain_surf_, "subsidence", "subsidence");
48+
dependencies_.insert(KeyTag{ subsidence_key_, tag });
49+
4750
q10_ = plist_.get<double>("Q10 [-]", 2.0);
4851

4952
is_func_temp_ = plist_.get<bool>("use temperature dependent coefficient", true);
@@ -75,6 +78,7 @@ CarbonDecomposeRateEvaluator::Evaluate_(const State& S, const std::vector<Compos
7578
const auto& depth_c = *S.Get<CompositeVector>(depth_key_, tag).ViewComponent("cell", false);
7679
const auto& sat_liq_c = *S.Get<CompositeVector>(sat_liq_key_, tag).ViewComponent("cell", false);
7780
const auto& sat_gas_c = *S.Get<CompositeVector>(sat_gas_key_, tag).ViewComponent("cell", false);
81+
const auto& subsidence_c = *S.Get<CompositeVector>(subsidence_key_, tag).ViewComponent("cell", false);
7882

7983
const auto& mesh = *S.GetMesh(domain_);
8084
const auto& mesh_surf = *S.GetMesh(domain_surf_);
@@ -86,7 +90,7 @@ CarbonDecomposeRateEvaluator::Evaluate_(const State& S, const std::vector<Compos
8690
if (temp_c[0][col_cells[c]] >= threshold_temp) {
8791
double dz = mesh.getCellVolume(col_cells[c]) / mesh_surf.getCellVolume(col);
8892
double f_temp = is_func_temp_ ? Func_Temp(temp_c[0][col_cells[c]], q10_) : 1.;
89-
double f_depth = is_func_depth_ ? Func_Depth(depth_c[0][col_cells[c]]) : 1.;
93+
double f_depth = is_func_depth_ ? Func_Depth(depth_c[0][col_cells[c]] + subsidence_c[0][col]) : 1.;
9094
double f_pres = is_func_pres_ ? Func_Pres(pres_c[0][col_cells[c]]) : 1.;
9195
double f_liq = is_func_liq_ ? Func_Satliq(sat_liq_c[0][col_cells[c]]) : 1.;
9296
double f_gas = is_func_gas_ ? Func_Satgas(sat_gas_c[0][col_cells[c]]) : 1.;
@@ -99,6 +103,26 @@ CarbonDecomposeRateEvaluator::Evaluate_(const State& S, const std::vector<Compos
99103
}
100104

101105

106+
void
107+
CarbonDecomposeRateEvaluator::EnsureCompatibility_ToDeps_(State& S)
108+
{
109+
const auto& fac = S.Require<CompositeVector, CompositeVectorSpace>(my_keys_.front().first,
110+
my_keys_.front().second);
111+
if (fac.Mesh() != Teuchos::null) {
112+
for (const auto& dep : dependencies_) {
113+
if (Keys::getDomain(dep.first) == Keys::getDomain(my_keys_.front().first)) {
114+
S.Require<CompositeVector, CompositeVectorSpace>(dep.first, dep.second).Update(fac);
115+
} else {
116+
CompositeVectorSpace dep_fac;
117+
dep_fac.SetMesh(S.GetMesh(Keys::getDomain(dep.first)))
118+
->AddComponent("cell", AmanziMesh::Entity_kind::CELL, 1);
119+
S.Require<CompositeVector, CompositeVectorSpace>(dep.first, dep.second).Update(dep_fac);
120+
}
121+
}
122+
}
123+
}
124+
125+
102126
double
103127
CarbonDecomposeRateEvaluator::Func_Temp(double temp, double q10) const
104128
{

src/constitutive_relations/eos/carbon_decomposition_rate_evaluator.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
provided in the top-level COPYRIGHT file.
66
77
Authors: Ahmad Jan (jana@ornl.gov)
8+
Bo Gao (gaob@ornl.gov)
89
*/
910

1011
/*
@@ -42,6 +43,8 @@ class CarbonDecomposeRateEvaluator : public EvaluatorSecondaryMonotypeCV {
4243
const Tag& wrt_tag,
4344
const std::vector<CompositeVector*>& result) override
4445
{}
46+
47+
virtual void EnsureCompatibility_ToDeps_(State& S) override;
4548

4649
double Func_Pres(double pres) const;
4750
double Func_Temp(double temp, double q10) const;
@@ -56,6 +59,7 @@ class CarbonDecomposeRateEvaluator : public EvaluatorSecondaryMonotypeCV {
5659
Key sat_gas_key_;
5760
Key por_key_;
5861
Key depth_key_;
62+
Key subsidence_key_;
5963
Key domain_;
6064
Key domain_surf_;
6165

0 commit comments

Comments
 (0)