本文整理汇总了C++中albany::BCUtils::haveBCSpecified方法的典型用法代码示例。如果您正苦于以下问题:C++ BCUtils::haveBCSpecified方法的具体用法?C++ BCUtils::haveBCSpecified怎么用?C++ BCUtils::haveBCSpecified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类albany::BCUtils
的用法示例。
在下文中一共展示了BCUtils::haveBCSpecified方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: neumannNames
void FELIX::Hydrology::constructNeumannEvaluators (const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
// Check to make sure that Neumann BCs are given in the input file
if (!nbcUtils.haveBCSpecified(this->params))
{
return;
}
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
std::vector<std::string> neumannNames(neq + 1);
Teuchos::Array<Teuchos::Array<int> > offsets;
offsets.resize(1);
neumannNames[0] = "Hydraulic Potential";
neumannNames[1] = "all";
offsets[0].resize(1);
offsets[0][0] = 0;
// Construct BC evaluators for all possible names of conditions
std::vector<std::string> condNames(1);
condNames[0] = "neumann";
nfm.resize(1); // FELIX problem only has one element block
nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs, neumannNames, dof_names, false, 0,
condNames, offsets, dl,
this->params, this->paramLib);
}
示例2:
//Neumann BCs
void
Albany::PNPProblem::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
// Check to make sure that Neumann BCs are given in the input file
if(!nbcUtils.haveBCSpecified(this->params)) {
return;
}
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
//
// Currently we aren't exactly doing this right. I think to do this
// correctly we need different neumann evaluators for each DOF (velocity,
// pressure, temperature, flux) since velocity is a vector and the
// others are scalars. The dof_names stuff is only used
// for robin conditions, so at this point, as long as we don't enable
// robin conditions, this should work.
std::vector<std::string> nbcNames;
Teuchos::RCP< Teuchos::Array<std::string> > dof_names =
Teuchos::rcp(new Teuchos::Array<std::string>);
// TODO: arbitraty numSpecies
Teuchos::Array<Teuchos::Array<int> > offsets;
int idx = 0;
nbcNames.push_back("C1");
offsets.push_back(Teuchos::Array<int>(1,idx++));
if (numSpecies>=2) {
nbcNames.push_back("C2");
offsets.push_back(Teuchos::Array<int>(1,idx++));
}
if (numSpecies==3) {
nbcNames.push_back("C3");
offsets.push_back(Teuchos::Array<int>(1,idx++));
}
nbcNames.push_back("Phi");
offsets.push_back(Teuchos::Array<int>(1,idx++));
dof_names->push_back("Concentration");
dof_names->push_back("Potential");
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dudx, dudy, dudz), or dudn, not both
std::vector<std::string> condNames; //dudx, dudy, dudz, dudn, basal
nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs, nbcNames,
Teuchos::arcp(dof_names),
true, 0, condNames, offsets, dl,
this->params, this->paramLib);
}
示例3: if
// Neumann BCs
void
Albany::HeatProblem::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> bcUtils;
// Check to make sure that Neumann BCs are given in the input file
if(!bcUtils.haveBCSpecified(this->params))
return;
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
std::vector<std::string> bcNames(neq);
Teuchos::ArrayRCP<std::string> dof_names(neq);
Teuchos::Array<Teuchos::Array<int> > offsets;
offsets.resize(neq);
bcNames[0] = "T";
dof_names[0] = "Temperature";
offsets[0].resize(1);
offsets[0][0] = 0;
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dudx, dudy, dudz), or dudn, not both
std::vector<std::string> condNames(5);
//dudx, dudy, dudz, dudn, scaled jump (internal surface), or robin (like DBC plus scaled jump)
// Note that sidesets are only supported for two and 3D currently
if(numDim == 2)
condNames[0] = "(dudx, dudy)";
else if(numDim == 3)
condNames[0] = "(dudx, dudy, dudz)";
else
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
condNames[1] = "dudn";
condNames[2] = "scaled jump";
condNames[3] = "robin";
condNames[4] = "radiate";
nfm.resize(1); // Heat problem only has one physics set
nfm[0] = bcUtils.constructBCEvaluators(meshSpecs, bcNames, dof_names, false, 0,
condNames, offsets, dl, this->params, this->paramLib, materialDB);
}
示例4: if
// Neumann BCs
void
Albany::PoissonsEquationProblem::constructNeumannEvaluators(
const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> neuUtils;
// Check to make sure that Neumann BCs are given in the input file
if(!neuUtils.haveBCSpecified(this->params))
return;
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
std::vector<std::string> neumannNames(neq);
Teuchos::Array<Teuchos::Array<int> > offsets;
offsets.resize(neq);
neumannNames[0] = "P";
offsets[0].resize(1);
offsets[0][0] = 0;
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dudx, dudy, dudz), or dudn, not both
std::vector<std::string> condNames(2); //dudx, dudy, dudz, dudn, P
Teuchos::ArrayRCP<std::string> dof_names(1);
dof_names[0] = "Phi";
// Note that sidesets are only supported for two and 3D currently
if(numDim == 2)
condNames[0] = "(dudx, dudy)";
else if(numDim == 3)
condNames[0] = "(dudx, dudy, dudz)";
else
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
condNames[1] = "dudn";
nfm.resize(1);
nfm[0] = neuUtils.constructBCEvaluators(meshSpecs, neumannNames, dof_names, true, 0,
condNames, offsets, dl,
this->params, this->paramLib);
}
示例5: condNames
//Neumann BCs
void
Tsunami::Boussinesq::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
// Check to make sure that Neumann BCs are given in the input file
if(!nbcUtils.haveBCSpecified(this->params)) {
return;
}
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
//
// Currently we aren't exactly doing this right. I think to do this
// correctly we need different neumann evaluators for each DOF (velocity,
// pressure, temperature, flux) since velocity is a vector and the
// others are scalars. The dof_names stuff is only used
// for robin conditions, so at this point, as long as we don't enable
// robin conditions, this should work.
std::vector<std::string> nbcNames;
Teuchos::RCP< Teuchos::Array<std::string> > dof_names =
Teuchos::rcp(new Teuchos::Array<std::string>);
Teuchos::Array<Teuchos::Array<int> > offsets;
int idx = 0;
nbcNames.push_back("eta");
offsets.push_back(Teuchos::Array<int>(1,idx++));
nbcNames.push_back("ualpha");
offsets.push_back(Teuchos::Array<int>(1,idx++));
if (numDim > 1) {
nbcNames.push_back("valpha");
offsets.push_back(Teuchos::Array<int>(1,idx++));
}
nbcNames.push_back("E1");
offsets.push_back(Teuchos::Array<int>(1,idx++));
if (numDim > 1) {
nbcNames.push_back("E2");
offsets.push_back(Teuchos::Array<int>(1,idx++));
}
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dudx, dudy, dudz), or dudn, not both
std::vector<std::string> condNames(3); //dudx, dudy, dudz, dudn, basal
// Note that sidesets are only supported for two and 3D currently
//
//IKT, FIXME: the following needs to be changed for Tsunami problem!
if(numDim == 2)
condNames[0] = "(dudx, dudy)";
else
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
condNames[1] = "dudn";
condNames[2] = "basal";
nfm.resize(1);
nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs, nbcNames,
Teuchos::arcp(dof_names),
true, 0, condNames, offsets, dl,
this->params, this->paramLib);
}
示例6: if
// Neumann BCs
void
QCAD::PoissonProblem::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
using std::string;
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> bcUtils;
// Check to make sure that Neumann BCs are given in the input file
if(!bcUtils.haveBCSpecified(this->params))
return;
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
std::vector<string> bcNames(neq);
Teuchos::ArrayRCP<string> dof_names(neq);
Teuchos::Array<Teuchos::Array<int> > offsets;
offsets.resize(neq);
bcNames[0] = "Phi";
dof_names[0] = "Potential";
offsets[0].resize(1);
offsets[0][0] = 0;
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dudx, dudy, dudz), or dudn, not both
std::vector<string> condNames(4);
//dudx, dudy, dudz, dudn, scaled jump (internal surface), or robin (like DBC plus scaled jump)
// Note that sidesets are only supported for two and 3D currently
if(numDim == 2)
condNames[0] = "(dudx, dudy)";
else if(numDim == 3)
condNames[0] = "(dudx, dudy, dudz)";
else
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
condNames[1] = "dudn";
condNames[2] = "scaled jump";
condNames[3] = "robin";
nfm.resize(1); // Poisson problem only has one physics set
//nfm[0] = bcUtils.constructBCEvaluators(meshSpecs, bcNames, dof_names, false, 0,
// condNames, offsets, dl, this->params, this->paramLib, materialDB);
bool isVectorField = false;
int offsetToFirstDOF = 0;
// From here down, this code was copied from constructBCEvaluators call commented out
// above and modified to create QCAD::PoissonNeumann evaluators.
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::ParameterList;
using PHX::DataLayout;
using PHX::MDALayout;
using std::vector;
using PHAL::NeumannFactoryTraits;
using PHAL::AlbanyTraits;
// Drop into the "Neumann BCs" sublist
Teuchos::ParameterList BCparams = this->params->sublist(Albany::NeumannTraits::bcParamsPl);
BCparams.validateParameters(*(Albany::NeumannTraits::getValidBCParameters(meshSpecs->ssNames, bcNames, condNames)),0);
std::map<string, RCP<ParameterList> > evaluators_to_build;
vector<string> bcs;
// Check for all possible standard BCs (every dof on every sideset) to see which is set
for (std::size_t i=0; i<meshSpecs->ssNames.size(); i++) {
for (std::size_t j=0; j<bcNames.size(); j++) {
for (std::size_t k=0; k<condNames.size(); k++) {
// construct input.xml string like:
// "NBC on SS sidelist_12 for DOF T set dudn"
// or
// "NBC on SS sidelist_12 for DOF T set (dudx, dudy)"
// or
// "NBC on SS surface_1 for DOF all set P"
std::string ss = Albany::NeumannTraits::constructBCName(meshSpecs->ssNames[i], bcNames[j], condNames[k]);
// Have a match of the line in input.xml
if (BCparams.isParameter(ss)) {
// std::cout << "Constructing NBC: " << ss << std::endl;
TEUCHOS_TEST_FOR_EXCEPTION(BCparams.isType<string>(ss), std::logic_error,
"NBC array information in XML file must be of type Array(double)\n");
// These are read in the Albany::Neumann constructor (PHAL_Neumann_Def.hpp)
//.........这里部分代码省略.........
示例7: if
//------------------------------------------------------------------------------
// Traction BCs
void
Albany::MechanicsProblem::
constructNeumannEvaluators(
const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> neuUtils;
// Check to make sure that Neumann BCs are given in the input file
if (!neuUtils.haveBCSpecified(this->params))
return;
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset,
// so ordering is important
std::vector<std::string> neumannNames(neq + 1);
Teuchos::Array<Teuchos::Array<int>> offsets;
offsets.resize(neq + 1);
neumannNames[0] = "sig_x";
offsets[0].resize(1);
offsets[0][0] = 0;
// The Neumann BC code uses offsets[neq].size() as num dim, so use num_dims_
// here rather than neq.
offsets[neq].resize(num_dims_);
offsets[neq][0] = 0;
if (num_dims_ > 1) {
neumannNames[1] = "sig_y";
offsets[1].resize(1);
offsets[1][0] = 1;
offsets[neq][1] = 1;
}
if (num_dims_ > 2) {
neumannNames[2] = "sig_z";
offsets[2].resize(1);
offsets[2][0] = 2;
offsets[neq][2] = 2;
}
neumannNames[neq] = "all";
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dudx, dudy, dudz),
// or dudn, not both
std::vector<std::string> condNames(3); //dudx, dudy, dudz, dudn, P
Teuchos::ArrayRCP<std::string> dof_names(1);
dof_names[0] = "Displacement";
// Note that sidesets are only supported for two and 3D currently
if (num_dims_ == 2)
condNames[0] = "(t_x, t_y)";
else if (num_dims_ == 3)
condNames[0] = "(t_x, t_y, t_z)";
else
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
'\n' << "Error: Sidesets only supported in 2 and 3D." << '\n');
condNames[1] = "dudn";
condNames[2] = "P";
nfm.resize(1); // Elasticity problem only has one element block
nfm[0] = neuUtils.constructBCEvaluators(
meshSpecs,
neumannNames,
dof_names,
true,
0,
condNames,
offsets,
dl_,
this->params,
this->paramLib);
}
示例8: if
// Neumann BCs
void
Aeras::HydrostaticProblem::
constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
// Check to make sure that Neumann BCs are given in the input file
if(!nbcUtils.haveBCSpecified(this->params)) {
return;
}
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
std::vector<std::string> neumannNames(1 + 1);
Teuchos::Array<Teuchos::Array<int> > offsets;
offsets.resize(1 + 1);
neumannNames[0] = "rho";
offsets[0].resize(1);
offsets[0][0] = 0;
offsets[1].resize(1);
offsets[1][0] = 0;
neumannNames[1] = "all";
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dUdx, dUdy, dUdz)
std::vector<std::string> condNames(1); //(dUdx, dUdy, dUdz)
Teuchos::ArrayRCP<std::string> dof_names(1);
dof_names[0] = "rho";
// Note that sidesets are only supported for two and 3D currently
if(numDim == 1)
condNames[0] = "(dFluxdx)";
else if(numDim == 2)
condNames[0] = "(dFluxdx, dFluxdy)";
else if(numDim == 3)
condNames[0] = "(dFluxdx, dFluxdy, dFluxdz)";
else
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
// condNames[1] = "dFluxdn";
// condNames[2] = "basal";
// condNames[3] = "P";
// condNames[4] = "lateral";
nfm.resize(1); // Aeras X scalar advection problem only has one
// element block
nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs,
neumannNames,
dof_names,
true,
0,
condNames,
offsets,
dl,
this->params,
this->paramLib);
}
示例9: if
// Neumann BCs
void
FELIX::StokesFOThickness::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
{
// Note: we only enter this function if sidesets are defined in the mesh file
// i.e. meshSpecs.ssNames.size() > 0
Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
// Check to make sure that Neumann BCs are given in the input file
if(!nbcUtils.haveBCSpecified(this->params)) {
return;
}
// Construct BC evaluators for all side sets and names
// Note that the string index sets up the equation offset, so ordering is important
std::vector<std::string> neumannNames(neq + 1);
Teuchos::Array<Teuchos::Array<int> > offsets;
offsets.resize(neq + 1);
neumannNames[0] = "U0";
offsets[0].resize(1);
offsets[0][0] = 0;
offsets[neq].resize(neq-1);
offsets[neq][0] = 0;
if (neq-1>1){
neumannNames[1] = "U1";
offsets[1].resize(1);
offsets[1][0] = 1;
offsets[neq][1] = 1;
}
if (neq-1>2){
neumannNames[2] = "U2";
offsets[2].resize(1);
offsets[2][0] = 2;
offsets[neq][2] = 2;
}
neumannNames[neq-1] = "H";
offsets[neq-1].resize(1);
offsets[neq-1][0] = neq-1;
neumannNames[neq] = "all";
// Construct BC evaluators for all possible names of conditions
// Should only specify flux vector components (dCdx, dCdy, dCdz), or dCdn, not both
std::vector<std::string> condNames(6); //(dCdx, dCdy, dCdz), dCdn, basal, P, lateral, basal_scalar_field
Teuchos::ArrayRCP<std::string> dof_names(2);
dof_names[0] = "Velocity";
dof_names[1] = "Thickness";
// Note that sidesets are only supported for two and 3D currently
if(numDim == 2)
condNames[0] = "(dFluxdx, dFluxdy)";
else if(numDim == 3)
condNames[0] = "(dFluxdx, dFluxdy, dFluxdz)";
else
TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
condNames[1] = "dFluxdn";
condNames[2] = "basal";
condNames[3] = "P";
condNames[4] = "lateral";
condNames[5] = "basal_scalar_field";
nfm.resize(1); // FELIX problem only has one element block
nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs, neumannNames, dof_names, true, 0,
condNames, offsets, dl,
this->params, this->paramLib);
}