Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplified RBKC case #18

Open
wants to merge 1 commit into
base: RBKC_simplified
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions include/boundaryvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include <deal.II/numerics/vector_tools.h>
#include <fstream>
#include <iostream>
#include <math.h>

#include "externalfunc.h"
#include "globalvariables.h"

using namespace dealii;
Expand All @@ -14,18 +16,19 @@ namespace EquationData {
template <int dim>
class PressureDirichletBoundaryValues : public Function<dim> {
private:
const double period_; // value
double period_; // value
int boundary_id_{-1};
int bd_i_;

public:
PressureDirichletBoundaryValues()
: Function<dim>(), period_(0.2), bd_i_(0) {} // 之前的没有
: Function<dim>(), period_(0), bd_i_(0) {} // 之前的没有
virtual double value(const Point<dim>& p,
const unsigned int component = 0) const; // boundary
virtual void get_bd_i(int bd_i) { bd_i_ = bd_i; }
// virtual void vector_value(const Point<dim>& p, //放在这里没啥用
// Vector<double>& value) const;
virtual void get_period(double period) { period_ = period; }
virtual void set_boundary_id(int bnd_id) { boundary_id_ = bnd_id; }
};

Expand All @@ -42,23 +45,24 @@ double PressureDirichletBoundaryValues<dim>::value(
// g_P_bnd_id + g_num_P_bnd_id) {
// return g_Pb_top + g_P_grad * (0. - p[2]);
// }
return g_Pb_top + g_P_grad * (0. - p[2]);
//return (ocean_datum + g_P_boundary_head.at(bd_i_) - p[2]) > 0 ? g_P_grad*p[2] : 0;
return 0;
}

template <int dim>
class PressureNeumanBoundaryValues : public Function<dim> {
private:
const double period_; // value
double period_; // value
int boundary_id_{-1};
int bd_i_;

public:
PressureNeumanBoundaryValues()
: Function<dim>(), period_(0.2), bd_i_(0) {} // 之前的没有
: Function<dim>(), period_(0), bd_i_(0) {} // 之前的没有
virtual void get_bd_i(int bd_i) { bd_i_ = bd_i; };
virtual double value(const Point<dim>& p,
const unsigned int component = 0) const; // boundary

virtual void get_period(double period) { period_ = period; }
// virtual void vector_value(const Point<dim>& p, //放在这里没啥用
// Vector<double>& value) const;
virtual void set_boundary_id(int bnd_id) { boundary_id_ = bnd_id; }
Expand All @@ -78,14 +82,15 @@ double PressureNeumanBoundaryValues<dim>::value(
template <int dim>
class TemperatureDirichletBoundaryValues : public Function<dim> {
private:
const double period_; // value
double period_; // value
int boundary_id_{-1};
int bd_i_;

public:
TemperatureDirichletBoundaryValues()
: Function<dim>(), period_(0.2), bd_i_(0) {} // 之前的没有
: Function<dim>(), period_(0), bd_i_(0) {} // 之前的没有
virtual void get_bd_i(int bd_i) { bd_i_ = bd_i; };
virtual void get_period(double period) { period_ = period; }
virtual double value(const Point<dim>& p,
const unsigned int component = 0) const; // boundary
// virtual void vector_value(const Point<dim>& p, //放在这里没啥用
Expand All @@ -104,13 +109,9 @@ double TemperatureDirichletBoundaryValues<dim>::value(
const double time = this->get_time();

if (bd_i_ == 0) {
return g_Tb_well;
} else if (bd_i_ == 1 || bd_i_ == 2) {
return g_Tb_top + g_T_grad * (0. - p[2]);
} else {
return g_Tb_seabed_top + g_T_seabed_grad * (0. - p[2]);
return g_T_basement;
}
}
} // namespace EquationData

// template <int dim>
// void TemperatureDirichletBoundaryValues<dim>::vector_value(
Expand All @@ -122,14 +123,15 @@ double TemperatureDirichletBoundaryValues<dim>::value(
template <int dim>
class TemperatureNeumanBoundaryValues : public Function<dim> {
private:
const double period; // value
double period_; // value
int boundary_id_{-1};
int bd_i_;

public:
TemperatureNeumanBoundaryValues()
: Function<dim>(), period(0.2), bd_i_(0) {} // 之前的没有
virtual void get_bd_i(int bd_i) { bd_i_ = bd_i; };
: Function<dim>(), period_(0), bd_i_(0) {} // 之前的没有
virtual void get_bd_i(int bd_i) { bd_i_ = bd_i; }
virtual void get_period(double period) { period_ = period; }
virtual double value(const Point<dim>& p,
const unsigned int component = 0) const; // boundary
// virtual void vector_value(const Point<dim>& p, //放在这里没啥用
Expand All @@ -146,7 +148,7 @@ double TemperatureNeumanBoundaryValues<dim>::value(
// Assert(dim == 3, ExcNotImplemented());

const double time = this->get_time();
return g_QT_top;
return g_QT_bottom;
}

// template <int dim>
Expand Down
Loading