| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Rapid Optimization Library (ROL) Package |
| 4 |
// |
| 5 |
// Copyright 2014 NTESS and the ROL contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
/*! \file pde_thermal-fluids.hpp |
| 11 |
\brief Implements the local PDE interface for the Navier-Stokes control problem. |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef PDE_THERMALFLUIDS_EX07_HPP |
| 15 |
#define PDE_THERMALFLUIDS_EX07_HPP |
| 16 |
|
| 17 |
#include "../TOOLS/pde.hpp" |
| 18 |
#include "../TOOLS/fe.hpp" |
| 19 |
#include "../TOOLS/fieldhelper.hpp" |
| 20 |
|
| 21 |
#include "Intrepid_HGRAD_HEX_C1_FEM.hpp" |
| 22 |
#include "Intrepid_HGRAD_HEX_C2_FEM.hpp" |
| 23 |
#include "Intrepid_DefaultCubatureFactory.hpp" |
| 24 |
#include "Intrepid_FunctionSpaceTools.hpp" |
| 25 |
#include "Intrepid_CellTools.hpp" |
| 26 |
|
| 27 |
#include "ROL_Ptr.hpp" |
| 28 |
|
| 29 |
template <class Real> |
| 30 |
class PDE_ThermalFluids_ex07 : public PDE<Real> { |
| 31 |
private: |
| 32 |
// Finite element basis information |
| 33 |
ROL::Ptr<Intrepid::Basis<Real, Intrepid::FieldContainer<Real> > > basisPtrVel_; |
| 34 |
ROL::Ptr<Intrepid::Basis<Real, Intrepid::FieldContainer<Real> > > basisPtrPrs_; |
| 35 |
ROL::Ptr<Intrepid::Basis<Real, Intrepid::FieldContainer<Real> > > basisPtrThr_; |
| 36 |
std::vector<ROL::Ptr<Intrepid::Basis<Real, Intrepid::FieldContainer<Real> > > > basisPtrs_; |
| 37 |
// Cell cubature information |
| 38 |
ROL::Ptr<Intrepid::Cubature<Real> > cellCub_; |
| 39 |
ROL::Ptr<Intrepid::Cubature<Real> > bdryCub_; |
| 40 |
// Cell node information |
| 41 |
ROL::Ptr<Intrepid::FieldContainer<Real> > volCellNodes_; |
| 42 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > bdryCellNodes_; |
| 43 |
std::vector<std::vector<std::vector<int> > > bdryCellLocIds_; |
| 44 |
// Finite element definition |
| 45 |
ROL::Ptr<FE<Real> > feVel_; |
| 46 |
ROL::Ptr<FE<Real> > fePrs_; |
| 47 |
ROL::Ptr<FE<Real> > feThr_; |
| 48 |
std::vector<std::vector<ROL::Ptr<FE<Real> > > > feVelBdry_; |
| 49 |
std::vector<std::vector<ROL::Ptr<FE<Real> > > > fePrsBdry_; |
| 50 |
std::vector<std::vector<ROL::Ptr<FE<Real> > > > feThrBdry_; |
| 51 |
// Local degrees of freedom on boundary, for each side of the reference cell (first index). |
| 52 |
std::vector<std::vector<int> > fvidx_; |
| 53 |
std::vector<std::vector<int> > fpidx_; |
| 54 |
std::vector<std::vector<int> > fhidx_; |
| 55 |
// Coordinates of degrees freedom on boundary cells. |
| 56 |
// Indexing: [sideset number][local side id](cell number, value at dof) |
| 57 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > bdryCellVDofValues_; |
| 58 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > bdryCellTDofValues_; |
| 59 |
// Field pattern, offsets, etc. |
| 60 |
std::vector<std::vector<int> > fieldPattern_; // local Field/DOF pattern; set from DOF manager |
| 61 |
int numFields_; // number of fields (equations in the PDE) |
| 62 |
int numDofs_; // total number of degrees of freedom for all (local) fields |
| 63 |
std::vector<int> offset_; // for each field, a counting offset |
| 64 |
std::vector<int> numFieldDofs_; // for each field, number of degrees of freedom |
| 65 |
|
| 66 |
// Problem parameters. |
| 67 |
Real Re_, Pr_, Gr_, h_; |
| 68 |
const Real grav_; |
| 69 |
int Nbottom_, N0_, N1_, N2_, N3_; |
| 70 |
Real ReScale_, PrScale_, GrScale_, hScale_, TScale_; |
| 71 |
bool pinPressure_; |
| 72 |
|
| 73 |
ROL::Ptr<FieldHelper<Real> > fieldHelper_; |
| 74 |
|
| 75 |
Real velocityDirichletFunc(const std::vector<Real> & coords, int sideset, int locSideId, int dir) const { |
| 76 |
Real val(0); |
| 77 |
const Real one(1), two(2), three(3), four(4), x = coords[0]; |
| 78 |
if (sideset==5 && dir==1) { |
| 79 |
val = two*(one/three - x)*x; |
| 80 |
} |
| 81 |
if (sideset==6 && dir==1) { |
| 82 |
val = -four*(x-one/three)*(two/three-x); |
| 83 |
} |
| 84 |
if (sideset==7 && dir==1) { |
| 85 |
val = two*(x-two/three)*(one-x); |
| 86 |
} |
| 87 |
return val; |
| 88 |
} |
| 89 |
|
| 90 |
Real thermalDirichletFunc(const std::vector<Real> & coords, int sideset, int locSideId) const { |
| 91 |
const std::vector<Real> param = PDE<Real>::getParameter(); |
| 92 |
Real val(0); |
| 93 |
if (sideset==4) { |
| 94 |
val = static_cast<Real>(1); |
| 95 |
if (param.size()) { |
| 96 |
Real root2(std::sqrt(2.0)), pi(M_PI), ln2(std::log(2.0)); |
| 97 |
for (int i = 0; i < Nbottom_; ++i) { |
| 98 |
Real di(i+1); |
| 99 |
Real xcomp = param[2*i ]/ln2 * (root2 * std::sin(di * pi * coords[0]))/(di * pi); |
| 100 |
Real zcomp = param[2*i+1]/ln2 * (root2 * std::sin(di * pi * coords[2]))/(di * pi); |
| 101 |
val += TScale_*xcomp*zcomp; |
| 102 |
} |
| 103 |
} |
| 104 |
} |
| 105 |
else if (sideset==6) { |
| 106 |
val = static_cast<Real>(0); |
| 107 |
} |
| 108 |
return val; |
| 109 |
} |
| 110 |
|
| 111 |
void computeDirichlet(void) { |
| 112 |
// Compute Dirichlet values at DOFs. |
| 113 |
int d = basisPtrVel_->getBaseCellTopology().getDimension(); |
| 114 |
int fv = basisPtrVel_->getCardinality(); |
| 115 |
int ft = basisPtrThr_->getCardinality(); |
| 116 |
int numSidesets = bdryCellLocIds_.size(); |
| 117 |
bdryCellVDofValues_.resize(numSidesets); |
| 118 |
bdryCellTDofValues_.resize(numSidesets); |
| 119 |
for (int i=0; i<numSidesets; ++i) { |
| 120 |
int numLocSides = bdryCellLocIds_[i].size(); |
| 121 |
bdryCellVDofValues_[i].resize(numLocSides); |
| 122 |
bdryCellTDofValues_[i].resize(numLocSides); |
| 123 |
for (int j=0; j<numLocSides; ++j) { |
| 124 |
int c = bdryCellLocIds_[i][j].size(); |
| 125 |
bdryCellVDofValues_[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, d); |
| 126 |
bdryCellTDofValues_[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, ft); |
| 127 |
ROL::Ptr<Intrepid::FieldContainer<Real> > Vcoords, Tcoords; |
| 128 |
Vcoords = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, d); |
| 129 |
Tcoords = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, ft, d); |
| 130 |
if (c > 0) { |
| 131 |
feVel_->computeDofCoords(Vcoords, bdryCellNodes_[i][j]); |
| 132 |
feThr_->computeDofCoords(Tcoords, bdryCellNodes_[i][j]); |
| 133 |
} |
| 134 |
for (int k=0; k<c; ++k) { |
| 135 |
for (int l=0; l<fv; ++l) { |
| 136 |
std::vector<Real> dofpoint(d); |
| 137 |
//std::cout << "Sideset " << i << " LocalSide " << j << " Cell " << k << " Field " << l << " Coord "; |
| 138 |
for (int m=0; m<d; ++m) { |
| 139 |
dofpoint[m] = (*Vcoords)(k, l, m); |
| 140 |
//std::cout << dofpoint[m] << " "; |
| 141 |
} |
| 142 |
|
| 143 |
for (int m=0; m<d; ++m) { |
| 144 |
(*bdryCellVDofValues_[i][j])(k, l, m) = velocityDirichletFunc(dofpoint, i, j, m); |
| 145 |
//std::cout << " " << m << "-Value " << DirichletFunc(dofpoint, i, j, m); |
| 146 |
} |
| 147 |
//std::cout << std::endl; |
| 148 |
} |
| 149 |
for (int l=0; l<ft; ++l) { |
| 150 |
std::vector<Real> dofpoint(d); |
| 151 |
//std::cout << "Sideset " << i << " LocalSide " << j << " Cell " << k << " Field " << l << " Coord "; |
| 152 |
for (int m=0; m<d; ++m) { |
| 153 |
dofpoint[m] = (*Tcoords)(k, l, m); |
| 154 |
//std::cout << dofpoint[m] << " "; |
| 155 |
} |
| 156 |
|
| 157 |
(*bdryCellTDofValues_[i][j])(k, l) = thermalDirichletFunc(dofpoint, i, j); |
| 158 |
//std::cout << " Value " << DirichletFunc(dofpoint, i, j); |
| 159 |
//std::cout << std::endl; |
| 160 |
} |
| 161 |
} |
| 162 |
} |
| 163 |
} |
| 164 |
} |
| 165 |
|
| 166 |
Real ReynoldsNumber(void) const { |
| 167 |
const std::vector<Real> param = PDE<Real>::getParameter(); |
| 168 |
Real val = Re_; |
| 169 |
if (param.size()) { |
| 170 |
int offset = 2*(Nbottom_ + N0_ + N1_ + N2_ + N3_); |
| 171 |
Real one(1); |
| 172 |
val /= (one + ReScale_*param[offset]); |
| 173 |
} |
| 174 |
return val; |
| 175 |
} |
| 176 |
|
| 177 |
Real PrandtlNumber(void) const { |
| 178 |
const std::vector<Real> param = PDE<Real>::getParameter(); |
| 179 |
Real val = Pr_; |
| 180 |
if (param.size()) { |
| 181 |
int offset = 2*(Nbottom_ + N0_ + N1_ + N2_ + N3_); |
| 182 |
Real one(1); |
| 183 |
val *= (one + ReScale_*param[offset])/(one + PrScale_*param[offset+1]); |
| 184 |
} |
| 185 |
return val; |
| 186 |
} |
| 187 |
|
| 188 |
Real GrashofNumber(void) const { |
| 189 |
const std::vector<Real> param = PDE<Real>::getParameter(); |
| 190 |
Real val = Gr_; |
| 191 |
if (param.size()) { |
| 192 |
int offset = 2*(Nbottom_ + N0_ + N1_ + N2_ + N3_); |
| 193 |
Real one(1), muscale = one + ReScale_*param[offset]; |
| 194 |
val *= (one + GrScale_*param[offset+2])/(muscale*muscale); |
| 195 |
} |
| 196 |
return val; |
| 197 |
} |
| 198 |
|
| 199 |
Real ThicknessNumber(const std::vector<Real> &x, const int sideset) const { |
| 200 |
const std::vector<Real> param = PDE<Real>::getParameter(); |
| 201 |
Real val = h_, x1(0), x2(0); |
| 202 |
if ( param.size()) { |
| 203 |
const Real root2(std::sqrt(2.0)), pi(M_PI), ln2(std::log(2.0)); |
| 204 |
int offset = 0, N = 0; |
| 205 |
if ( sideset == 0 ) { |
| 206 |
offset = 2*Nbottom_; |
| 207 |
N = N0_; |
| 208 |
x1 = x[1]; |
| 209 |
x2 = x[2]; |
| 210 |
} |
| 211 |
else if ( sideset == 1 ) { |
| 212 |
offset = 2*(Nbottom_+N0_); |
| 213 |
N = N1_; |
| 214 |
x1 = x[0]; |
| 215 |
x2 = x[1]; |
| 216 |
} |
| 217 |
else if ( sideset == 2 ) { |
| 218 |
offset = 2*(Nbottom_+N0_+N1_); |
| 219 |
N = N2_; |
| 220 |
x1 = x[1]; |
| 221 |
x2 = x[2]; |
| 222 |
} |
| 223 |
else if ( sideset == 3 ) { |
| 224 |
offset = 2*(Nbottom_+N0_+N1_+N2_); |
| 225 |
N = N3_; |
| 226 |
x1 = x[0]; |
| 227 |
x2 = x[1]; |
| 228 |
} |
| 229 |
for (int i = 0; i < N; ++i) { |
| 230 |
Real di(i+1); |
| 231 |
Real xcomp = param[offset + 2*i ]/ln2 * (root2 * std::sin(di * pi * x1))/(di * pi); |
| 232 |
Real ycomp = param[offset + 2*i+1]/ln2 * (root2 * std::sin(di * pi * x2))/(di * pi); |
| 233 |
val += hScale_*xcomp*ycomp; |
| 234 |
} |
| 235 |
} |
| 236 |
return val; |
| 237 |
} |
| 238 |
|
| 239 |
Real viscosityFunc(const std::vector<Real> &x) const { |
| 240 |
Real ReynoldsNum = ReynoldsNumber(); |
| 241 |
return static_cast<Real>(1)/ReynoldsNum; |
| 242 |
} |
| 243 |
|
| 244 |
Real conductivityFunc(const std::vector<Real> &x) const { |
| 245 |
Real ReynoldsNum = ReynoldsNumber(); |
| 246 |
Real PrandtlNum = PrandtlNumber(); |
| 247 |
return static_cast<Real>(1)/(ReynoldsNum*PrandtlNum); |
| 248 |
} |
| 249 |
|
| 250 |
Real gravityFunc(const std::vector<Real> &x) const { |
| 251 |
Real ReynoldsNum = ReynoldsNumber(); |
| 252 |
Real GrashofNum = GrashofNumber(); |
| 253 |
return grav_*GrashofNum/(ReynoldsNum*ReynoldsNum); |
| 254 |
} |
| 255 |
|
| 256 |
Real thermalRobinFunc(const std::vector<Real> &x, const int sideset) const { |
| 257 |
return ThicknessNumber(x, sideset) * conductivityFunc(x); |
| 258 |
} |
| 259 |
|
| 260 |
void computeCoefficients(const ROL::Ptr<Intrepid::FieldContainer<Real> > &nu, |
| 261 |
const ROL::Ptr<Intrepid::FieldContainer<Real> > &grav, |
| 262 |
const ROL::Ptr<Intrepid::FieldContainer<Real> > &kappa) const { |
| 263 |
int c = feVel_->gradN()->dimension(0); |
| 264 |
int p = feVel_->gradN()->dimension(2); |
| 265 |
int d = feVel_->gradN()->dimension(3); |
| 266 |
std::vector<Real> pt(d); |
| 267 |
for (int i = 0; i < c; ++i) { |
| 268 |
for (int j = 0; j < p; ++j) { |
| 269 |
for ( int k = 0; k < d; ++k) { |
| 270 |
pt[k] = (*feVel_->cubPts())(i,j,k); |
| 271 |
} |
| 272 |
// Compute spatially dependent coefficients |
| 273 |
(*nu)(i,j) = viscosityFunc(pt); |
| 274 |
(*grav)(i,j) = gravityFunc(pt); |
| 275 |
(*kappa)(i,j) = conductivityFunc(pt); |
| 276 |
} |
| 277 |
} |
| 278 |
} |
| 279 |
|
| 280 |
void computeThermalRobin(ROL::Ptr<Intrepid::FieldContainer<Real> > &robin, |
| 281 |
const ROL::Ptr<Intrepid::FieldContainer<Real> > &u, |
| 282 |
const ROL::Ptr<Intrepid::FieldContainer<Real> > &z, |
| 283 |
const int sideset, |
| 284 |
const int locSideId, |
| 285 |
const int deriv = 0, |
| 286 |
const int component = 1) const { |
| 287 |
const int c = u->dimension(0); |
| 288 |
const int p = u->dimension(1); |
| 289 |
const int d = feThr_->gradN()->dimension(3); |
| 290 |
std::vector<Real> x(d); |
| 291 |
Real h(0); |
| 292 |
for (int i = 0; i < c; ++i) { |
| 293 |
for (int j = 0; j < p; ++j) { |
| 294 |
for (int k = 0; k < d; ++k) { |
| 295 |
x[k] = (*feThrBdry_[sideset][locSideId]->cubPts())(i,j,k); |
| 296 |
} |
| 297 |
h = thermalRobinFunc(x, sideset); |
| 298 |
if ( deriv == 0 ) { |
| 299 |
(*robin)(i,j) = h * ((*u)(i,j) - (*z)(i,j)); |
| 300 |
} |
| 301 |
else if ( deriv == 1 ) { |
| 302 |
(*robin)(i,j) = ((component==0) ? h : -h); |
| 303 |
} |
| 304 |
else { |
| 305 |
(*robin)(i,j) = static_cast<Real>(0); |
| 306 |
} |
| 307 |
} |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
ROL::Ptr<Intrepid::FieldContainer<Real> > getThermalBoundaryCoeff( |
| 312 |
const Intrepid::FieldContainer<Real> & cell_coeff, |
| 313 |
int sideSet, int cell) const { |
| 314 |
std::vector<int> bdryCellLocId = bdryCellLocIds_[sideSet][cell]; |
| 315 |
const int numCellsSide = bdryCellLocId.size(); |
| 316 |
const int f = basisPtrThr_->getCardinality(); |
| 317 |
|
| 318 |
ROL::Ptr<Intrepid::FieldContainer<Real > > bdry_coeff |
| 319 |
= ROL::makePtr<Intrepid::FieldContainer<Real >>(numCellsSide, f); |
| 320 |
for (int i = 0; i < numCellsSide; ++i) { |
| 321 |
for (int j = 0; j < f; ++j) { |
| 322 |
(*bdry_coeff)(i, j) = cell_coeff(bdryCellLocId[i], j); |
| 323 |
} |
| 324 |
} |
| 325 |
return bdry_coeff; |
| 326 |
} |
| 327 |
|
| 328 |
public: |
| 329 |
PDE_ThermalFluids_ex07(Teuchos::ParameterList &parlist) : grav_(-1) { |
| 330 |
// Finite element fields -- NOT DIMENSION INDEPENDENT! |
| 331 |
basisPtrVel_ = ROL::makePtr<Intrepid::Basis_HGRAD_HEX_C2_FEM<Real, Intrepid::FieldContainer<Real> >>(); |
| 332 |
basisPtrPrs_ = ROL::makePtr<Intrepid::Basis_HGRAD_HEX_C1_FEM<Real, Intrepid::FieldContainer<Real> >>(); |
| 333 |
basisPtrThr_ = ROL::makePtr<Intrepid::Basis_HGRAD_HEX_C2_FEM<Real, Intrepid::FieldContainer<Real> >>(); |
| 334 |
// Volume quadrature rules. |
| 335 |
shards::CellTopology cellType = basisPtrVel_->getBaseCellTopology(); // get the cell type from any basis |
| 336 |
Intrepid::DefaultCubatureFactory<Real> cubFactory; // create cubature factory |
| 337 |
int cubDegree = parlist.sublist("Problem").get("Cubature Degree", 4); // set cubature degree, e.g., 4 |
| 338 |
cellCub_ = cubFactory.create(cellType, cubDegree); // create default cubature |
| 339 |
// Boundary quadrature rules. |
| 340 |
int d = cellType.getDimension(); |
| 341 |
shards::CellTopology bdryCellType = cellType.getCellTopologyData(d-1, 0); |
| 342 |
int bdryCubDegree = parlist.sublist("Problem").get("Boundary Cubature Degree",4); // set cubature degree, e.g., 4 |
| 343 |
bdryCub_ = cubFactory.create(bdryCellType, bdryCubDegree); |
| 344 |
// Fill finite element basis container |
| 345 |
basisPtrs_.clear(); |
| 346 |
for (int i = 0; i < d; ++i) { |
| 347 |
basisPtrs_.push_back(basisPtrVel_); // Velocity |
| 348 |
} |
| 349 |
basisPtrs_.push_back(basisPtrPrs_); // Pressure |
| 350 |
basisPtrs_.push_back(basisPtrThr_); // Heat |
| 351 |
|
| 352 |
// Other problem parameters. |
| 353 |
Re_ = parlist.sublist("Problem").get("Reynolds Number", 200.0); |
| 354 |
Pr_ = parlist.sublist("Problem").get("Prandtl Number", 0.72); |
| 355 |
Gr_ = parlist.sublist("Problem").get("Grashof Number", 40000.0); |
| 356 |
h_ = parlist.sublist("Problem").get("Robin Coefficient", 1.0); |
| 357 |
// Stochastic Expansion Information. |
| 358 |
Nbottom_ = parlist.sublist("Problem").get("Bottom KL Truncation Order",5); |
| 359 |
N0_ = parlist.sublist("Problem").get("Side 0 KL Truncation Order",5); |
| 360 |
N1_ = parlist.sublist("Problem").get("Side 1 KL Truncation Order",5); |
| 361 |
N2_ = parlist.sublist("Problem").get("Side 2 KL Truncation Order",5); |
| 362 |
N3_ = parlist.sublist("Problem").get("Side 3 KL Truncation Order",5); |
| 363 |
// Stochastic scales |
| 364 |
ReScale_ = parlist.sublist("Problem").get("Reynolds Number Noise Scale",0.05); |
| 365 |
PrScale_ = parlist.sublist("Problem").get("Prandtl Number Noise Scale",0.05); |
| 366 |
GrScale_ = parlist.sublist("Problem").get("Grashof Number Noise Scale",0.05); |
| 367 |
hScale_ = parlist.sublist("Problem").get("Robin Noise Scale",0.2); |
| 368 |
TScale_ = parlist.sublist("Problem").get("Bottom Temperature Noise Scale",0.2); |
| 369 |
// Pin pressure |
| 370 |
pinPressure_ = parlist.sublist("Problem").get("Pin Pressure",false); |
| 371 |
|
| 372 |
numDofs_ = 0; |
| 373 |
numFields_ = basisPtrs_.size(); |
| 374 |
offset_.resize(numFields_); |
| 375 |
numFieldDofs_.resize(numFields_); |
| 376 |
for (int i=0; i<numFields_; ++i) { |
| 377 |
if (i==0) { |
| 378 |
offset_[i] = 0; |
| 379 |
} |
| 380 |
else { |
| 381 |
offset_[i] = offset_[i-1] + basisPtrs_[i-1]->getCardinality(); |
| 382 |
} |
| 383 |
numFieldDofs_[i] = basisPtrs_[i]->getCardinality(); |
| 384 |
numDofs_ += numFieldDofs_[i]; |
| 385 |
} |
| 386 |
} |
| 387 |
|
| 388 |
void residual(ROL::Ptr<Intrepid::FieldContainer<Real> > & res, |
| 389 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & u_coeff, |
| 390 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & z_coeff = ROL::nullPtr, |
| 391 |
const ROL::Ptr<const std::vector<Real> > & z_param = ROL::nullPtr) { |
| 392 |
// Retrieve dimensions. |
| 393 |
int c = u_coeff->dimension(0); |
| 394 |
int p = cellCub_->getNumPoints(); |
| 395 |
int fv = basisPtrVel_->getCardinality(); |
| 396 |
int fp = basisPtrPrs_->getCardinality(); |
| 397 |
int fh = basisPtrThr_->getCardinality(); |
| 398 |
int d = cellCub_->getDimension(); |
| 399 |
|
| 400 |
// Initialize residuals. |
| 401 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > R(d+2); |
| 402 |
for (int i = 0; i < d; ++i) { |
| 403 |
R[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv); |
| 404 |
} |
| 405 |
R[d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp); |
| 406 |
R[d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh); |
| 407 |
|
| 408 |
// Split u_coeff into components. |
| 409 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > U, Z; |
| 410 |
fieldHelper_->splitFieldCoeff(U, u_coeff); |
| 411 |
fieldHelper_->splitFieldCoeff(Z, z_coeff); |
| 412 |
|
| 413 |
// Evaluate problem coefficients at quadrature points. |
| 414 |
ROL::Ptr<Intrepid::FieldContainer<Real> > nu, grav, kappa; |
| 415 |
nu = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 416 |
grav = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 417 |
kappa = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 418 |
computeCoefficients(nu,grav,kappa); |
| 419 |
|
| 420 |
// Evaluate/interpolate finite element fields on cells. |
| 421 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > valVel_vec(d); |
| 422 |
for (int i = 0; i < d; ++i) { |
| 423 |
valVel_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 424 |
feVel_->evaluateValue(valVel_vec[i], U[i]); |
| 425 |
} |
| 426 |
ROL::Ptr<Intrepid::FieldContainer<Real> > valPres_eval, valHeat_eval; |
| 427 |
valPres_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 428 |
valHeat_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 429 |
fePrs_->evaluateValue(valPres_eval, U[d]); |
| 430 |
feThr_->evaluateValue(valHeat_eval, U[d+1]); |
| 431 |
// Evaluate/interpolate gradient of finite element fields on cells. |
| 432 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > gradVel_vec(d); |
| 433 |
for (int i = 0; i < d; ++i) { |
| 434 |
gradVel_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 435 |
feVel_->evaluateGradient(gradVel_vec[i], U[i]); |
| 436 |
} |
| 437 |
ROL::Ptr<Intrepid::FieldContainer<Real> > gradHeat_eval; |
| 438 |
gradHeat_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 439 |
feThr_->evaluateGradient(gradHeat_eval, U[d+1]); |
| 440 |
|
| 441 |
// Assemble the velocity vector and its divergence. |
| 442 |
ROL::Ptr<Intrepid::FieldContainer<Real> > valVel_eval, divVel_eval; |
| 443 |
valVel_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 444 |
divVel_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 445 |
for (int i = 0; i < c; ++i) { |
| 446 |
for (int j = 0; j < p; ++j) { |
| 447 |
(*divVel_eval)(i,j) = static_cast<Real>(0); |
| 448 |
for (int k = 0; k < d; ++k) { |
| 449 |
(*valVel_eval)(i,j,k) = (*valVel_vec[k])(i,j); |
| 450 |
(*divVel_eval)(i,j) += (*gradVel_vec[k])(i,j,k); |
| 451 |
} |
| 452 |
} |
| 453 |
} |
| 454 |
|
| 455 |
/**************************************************************************/ |
| 456 |
/*** NAVIER STOKES ********************************************************/ |
| 457 |
/**************************************************************************/ |
| 458 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > nuGradVel_vec(d), valVelDotgradVel_vec(d); |
| 459 |
for (int i = 0; i < d; ++i) { |
| 460 |
// Multiply velocity gradients with viscosity. |
| 461 |
nuGradVel_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 462 |
Intrepid::FunctionSpaceTools::tensorMultiplyDataData<Real>(*nuGradVel_vec[i], *nu, *gradVel_vec[i]); |
| 463 |
// Compute nonlinear terms in the Navier-Stokes equations. |
| 464 |
valVelDotgradVel_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 465 |
Intrepid::FunctionSpaceTools::dotMultiplyDataData<Real>(*valVelDotgradVel_vec[i], *valVel_eval, *gradVel_vec[i]); |
| 466 |
} |
| 467 |
// Negative pressure |
| 468 |
Intrepid::RealSpaceTools<Real>::scale(*valPres_eval,static_cast<Real>(-1)); |
| 469 |
// Compute gravitational force. |
| 470 |
ROL::Ptr<Intrepid::FieldContainer<Real> > gravForce; |
| 471 |
gravForce = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 472 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataData<Real>(*gravForce, *grav, *valHeat_eval); |
| 473 |
|
| 474 |
/**************************************************************************/ |
| 475 |
/*** THERMAL **************************************************************/ |
| 476 |
/**************************************************************************/ |
| 477 |
ROL::Ptr<Intrepid::FieldContainer<Real> > kappaGradHeat_eval, velDotGradHeat_eval; |
| 478 |
kappaGradHeat_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 479 |
velDotGradHeat_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 480 |
// Multiply temperature gradient with conductivity |
| 481 |
Intrepid::FunctionSpaceTools::tensorMultiplyDataData<Real>(*kappaGradHeat_eval, *kappa, *gradHeat_eval); |
| 482 |
// Dot multiply scaled velocity with temperature gradient |
| 483 |
Intrepid::FunctionSpaceTools::dotMultiplyDataData<Real>(*velDotGradHeat_eval, *valVel_eval, *gradHeat_eval); |
| 484 |
|
| 485 |
/**************************************************************************/ |
| 486 |
/*** EVALUATE WEAK FORM OF RESIDUAL ***************************************/ |
| 487 |
/**************************************************************************/ |
| 488 |
// Velocity equation. |
| 489 |
for (int i = 0; i < d; ++i) { |
| 490 |
Intrepid::FunctionSpaceTools::integrate<Real>((*R[i]), |
| 491 |
*nuGradVel_vec[i], // nu gradUX |
| 492 |
*(feVel_->gradNdetJ()), // gradPhi |
| 493 |
Intrepid::COMP_CPP, |
| 494 |
false); |
| 495 |
Intrepid::FunctionSpaceTools::integrate<Real>((*R[i]), |
| 496 |
*valVelDotgradVel_vec[i], // (U . gradUX) |
| 497 |
*(feVel_->NdetJ()), // Phi |
| 498 |
Intrepid::COMP_CPP, |
| 499 |
true); |
| 500 |
Intrepid::FunctionSpaceTools::integrate<Real>((*R[i]), |
| 501 |
*valPres_eval, // p |
| 502 |
*(feVel_->DNDdetJ(i)), // dPhi/dx |
| 503 |
Intrepid::COMP_CPP, |
| 504 |
true); |
| 505 |
} |
| 506 |
// Apply gravitational force. |
| 507 |
Intrepid::FunctionSpaceTools::integrate<Real>((*R[d-1]), |
| 508 |
*gravForce, // grav T |
| 509 |
*(feVel_->NdetJ()), // Phi |
| 510 |
Intrepid::COMP_CPP, |
| 511 |
true); |
| 512 |
// Pressure equation. |
| 513 |
Intrepid::FunctionSpaceTools::integrate<Real>((*R[d]), |
| 514 |
*divVel_eval, // divU |
| 515 |
*(fePrs_->NdetJ()), // Phi |
| 516 |
Intrepid::COMP_CPP, |
| 517 |
false); |
| 518 |
Intrepid::RealSpaceTools<Real>::scale((*R[d]),static_cast<Real>(-1)); |
| 519 |
// Heat equation. |
| 520 |
Intrepid::FunctionSpaceTools::integrate<Real>((*R[d+1]), |
| 521 |
*kappaGradHeat_eval, // kappa gradT |
| 522 |
*(feThr_->gradNdetJ()), // gradPhi |
| 523 |
Intrepid::COMP_CPP, |
| 524 |
false); |
| 525 |
Intrepid::FunctionSpaceTools::integrate<Real>((*R[d+1]), |
| 526 |
*velDotGradHeat_eval, // U . gradT |
| 527 |
*(feThr_->NdetJ()), // Phi |
| 528 |
Intrepid::COMP_CPP, |
| 529 |
true); |
| 530 |
|
| 531 |
/**************************************************************************/ |
| 532 |
/*** APPLY BOUNDARY CONDITIONS ********************************************/ |
| 533 |
/**************************************************************************/ |
| 534 |
// THERMAL BOUNDARIES |
| 535 |
// --> Control boundaries: i=0,1,2,3 |
| 536 |
// --> Substrate boundary: i=4 |
| 537 |
// --> Inflow boundary: i=6 |
| 538 |
// --> Outflow boundaries: i=5,7 |
| 539 |
// VELOCITY BOUNDARIES |
| 540 |
// --> No slip boundaries: i=0,1,2,3,4 |
| 541 |
// --> Inflow Boundary: i=6 |
| 542 |
// --> Outflow Boundaries: i=5,7 |
| 543 |
// PRESSURE BOUNDARIES |
| 544 |
// --> Pressure Pin: i=? |
| 545 |
int numSideSets = bdryCellLocIds_.size(); |
| 546 |
const int numCubPerSide = bdryCub_->getNumPoints(); |
| 547 |
if (numSideSets > 0) { |
| 548 |
// ROBIN CONDITIONS |
| 549 |
for (int i = 0; i < numSideSets; ++i) { |
| 550 |
// Control boundaries |
| 551 |
if (i==0 || i==1 || i==2 || i==3) { |
| 552 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 553 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 554 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 555 |
if (numCellsSide) { |
| 556 |
// Get U and Z coefficients on Robin boundary |
| 557 |
ROL::Ptr<Intrepid::FieldContainer<Real > > u_coeff_bdry, z_coeff_bdry; |
| 558 |
u_coeff_bdry = getThermalBoundaryCoeff(*(U[d+1]), i, j); |
| 559 |
z_coeff_bdry = getThermalBoundaryCoeff(*(Z[d+1]), i, j); |
| 560 |
// Evaluate U and Z on FE basis |
| 561 |
ROL::Ptr<Intrepid::FieldContainer<Real > > valU_eval_bdry, valZ_eval_bdry; |
| 562 |
valU_eval_bdry = ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 563 |
valZ_eval_bdry = ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 564 |
feThrBdry_[i][j]->evaluateValue(valU_eval_bdry, u_coeff_bdry); |
| 565 |
feThrBdry_[i][j]->evaluateValue(valZ_eval_bdry, z_coeff_bdry); |
| 566 |
// Compute Stefan-Boltzmann residual |
| 567 |
ROL::Ptr<Intrepid::FieldContainer<Real> > robinVal; |
| 568 |
robinVal = ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 569 |
computeThermalRobin(robinVal,valU_eval_bdry,valZ_eval_bdry,i,j,0); |
| 570 |
// Evaluate boundary integral |
| 571 |
ROL::Ptr<Intrepid::FieldContainer<Real> > robinRes; |
| 572 |
robinRes = ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, fh); |
| 573 |
Intrepid::FunctionSpaceTools::integrate<Real>(*robinRes, |
| 574 |
*robinVal, |
| 575 |
*(feThrBdry_[i][j]->NdetJ()), |
| 576 |
Intrepid::COMP_CPP, false); |
| 577 |
for (int k = 0; k < numCellsSide; ++k) { |
| 578 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 579 |
// Thermal boundary conditions. |
| 580 |
for (int l = 0; l < fh; ++l) { |
| 581 |
(*R[d+1])(cidx,l) += (*robinRes)(k,l); |
| 582 |
} |
| 583 |
} |
| 584 |
} |
| 585 |
} |
| 586 |
} |
| 587 |
} |
| 588 |
// DIRICHLET CONDITIONS |
| 589 |
computeDirichlet(); |
| 590 |
// Velocity Boundary Conditions |
| 591 |
for (int i = 0; i < numSideSets; ++i) { |
| 592 |
if (i==0 || i==1 || i==2 || i==3 || i==4 || i==5 || i==6 || i==7) { |
| 593 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 594 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 595 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 596 |
int numVBdryDofs = fvidx_[j].size(); |
| 597 |
for (int k = 0; k < numCellsSide; ++k) { |
| 598 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 599 |
for (int l = 0; l < numVBdryDofs; ++l) { |
| 600 |
for (int m = 0; m < d; ++m) { |
| 601 |
(*R[m])(cidx,fvidx_[j][l]) = (*U[m])(cidx,fvidx_[j][l]) - (*bdryCellVDofValues_[i][j])(k,fvidx_[j][l],m); |
| 602 |
} |
| 603 |
} |
| 604 |
} |
| 605 |
} |
| 606 |
} |
| 607 |
// Thermal Boundary Conditions |
| 608 |
if ( (i==4) || (i==6) ) { |
| 609 |
int numLocalSideIds = bdryCellLocIds_[i].size(); // Number of sides per cell |
| 610 |
for (int j = 0; j < numLocalSideIds; ++j) { // Loop over sides of cell: Quad = {0, 1, 2, 3} |
| 611 |
int numCellsSide = bdryCellLocIds_[i][j].size(); // Number of cells with side j |
| 612 |
int numHBdryDofs = fhidx_[j].size(); // Number of thermal boundary DOFs |
| 613 |
for (int k = 0; k < numCellsSide; ++k) { // Loop over cells with side j |
| 614 |
int cidx = bdryCellLocIds_[i][j][k]; // Cell index |
| 615 |
for (int l = 0; l < numHBdryDofs; ++l) { // Loop over all fields of cell k on side j |
| 616 |
(*R[d+1])(cidx,fhidx_[j][l]) = (*U[d+1])(cidx,fhidx_[j][l]) - (*bdryCellTDofValues_[i][j])(k,fhidx_[j][l]); |
| 617 |
} |
| 618 |
} |
| 619 |
} |
| 620 |
} |
| 621 |
// Pressure pinning |
| 622 |
if (i==8 && pinPressure_) { |
| 623 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 624 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 625 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 626 |
for (int k = 0; k < numCellsSide; ++k) { |
| 627 |
int l = 0, cidx = bdryCellLocIds_[i][j][k]; |
| 628 |
(*R[d])(cidx,fpidx_[j][l]) = (*U[d])(cidx,fpidx_[j][l]) - static_cast<Real>(0); |
| 629 |
} |
| 630 |
} |
| 631 |
} |
| 632 |
} |
| 633 |
} |
| 634 |
|
| 635 |
// Combine the residuals. |
| 636 |
fieldHelper_->combineFieldCoeff(res, R); |
| 637 |
} |
| 638 |
|
| 639 |
void Jacobian_1(ROL::Ptr<Intrepid::FieldContainer<Real> > & jac, |
| 640 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & u_coeff, |
| 641 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & z_coeff = ROL::nullPtr, |
| 642 |
const ROL::Ptr<const std::vector<Real> > & z_param = ROL::nullPtr) { |
| 643 |
// Retrieve dimensions. |
| 644 |
int c = u_coeff->dimension(0); |
| 645 |
int p = cellCub_->getNumPoints(); |
| 646 |
int fv = basisPtrVel_->getCardinality(); |
| 647 |
int fp = basisPtrPrs_->getCardinality(); |
| 648 |
int fh = basisPtrThr_->getCardinality(); |
| 649 |
int d = cellCub_->getDimension(); |
| 650 |
|
| 651 |
// Initialize jacobians. |
| 652 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > J(d+2); |
| 653 |
for (int i = 0; i < d+2; ++i) { |
| 654 |
J[i].resize(d+2); |
| 655 |
} |
| 656 |
for (int i = 0; i < d; ++i) { |
| 657 |
for (int j = 0; j < d; ++j) { |
| 658 |
J[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fv); |
| 659 |
} |
| 660 |
J[d][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fv); |
| 661 |
J[i][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fp); |
| 662 |
J[d+1][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fv); |
| 663 |
J[i][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fh); |
| 664 |
} |
| 665 |
J[d][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fp); |
| 666 |
J[d+1][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fp); |
| 667 |
J[d][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fh); |
| 668 |
J[d+1][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fh); |
| 669 |
|
| 670 |
// Split u_coeff into components. |
| 671 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > U, Z; |
| 672 |
fieldHelper_->splitFieldCoeff(U, u_coeff); |
| 673 |
fieldHelper_->splitFieldCoeff(Z, z_coeff); |
| 674 |
|
| 675 |
// Evaluate problem coefficients at quadrature points. |
| 676 |
ROL::Ptr<Intrepid::FieldContainer<Real> > nu, grav, kappa; |
| 677 |
nu = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 678 |
grav = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 679 |
kappa = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 680 |
computeCoefficients(nu,grav,kappa); |
| 681 |
|
| 682 |
// Evaluate/interpolate finite element fields on cells. |
| 683 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > valVel_vec(d); |
| 684 |
for (int i = 0; i < d; ++i) { |
| 685 |
valVel_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 686 |
feVel_->evaluateValue(valVel_vec[i], U[i]); |
| 687 |
} |
| 688 |
// Evaluate/interpolate gradient of finite element fields on cells. |
| 689 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > gradVel_vec(d); |
| 690 |
for (int i = 0; i < d; ++i) { |
| 691 |
gradVel_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 692 |
feVel_->evaluateGradient(gradVel_vec[i], U[i]); |
| 693 |
} |
| 694 |
ROL::Ptr<Intrepid::FieldContainer<Real> > gradHeat_eval; |
| 695 |
gradHeat_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 696 |
feThr_->evaluateGradient(gradHeat_eval, U[d+1]); |
| 697 |
|
| 698 |
// Assemble the velocity vector and its divergence. |
| 699 |
ROL::Ptr<Intrepid::FieldContainer<Real> > valVel_eval; |
| 700 |
valVel_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p, d); |
| 701 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > dVel_vec(d); |
| 702 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > gradHeat_vec(d); |
| 703 |
for (int k = 0; k < d; ++k) { |
| 704 |
dVel_vec[k].resize(d); |
| 705 |
for (int l = 0; l < d; ++l) { |
| 706 |
dVel_vec[k][l] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 707 |
for (int i = 0; i < c; ++i) { |
| 708 |
for (int j = 0; j < p; ++j) { |
| 709 |
(*dVel_vec[k][l])(i,j) = (*gradVel_vec[k])(i,j,l); |
| 710 |
} |
| 711 |
} |
| 712 |
} |
| 713 |
gradHeat_vec[k] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 714 |
for (int i = 0; i < c; ++i) { |
| 715 |
for (int j = 0; j < p; ++j) { |
| 716 |
(*valVel_eval)(i,j,k) = (*valVel_vec[k])(i,j); |
| 717 |
(*gradHeat_vec[k])(i,j) = (*gradHeat_eval)(i,j,k); |
| 718 |
} |
| 719 |
} |
| 720 |
} |
| 721 |
|
| 722 |
/**************************************************************************/ |
| 723 |
/*** NAVIER STOKES ********************************************************/ |
| 724 |
/**************************************************************************/ |
| 725 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > dVelPhi_vec(d); |
| 726 |
for (int i = 0; i < d; ++i) { |
| 727 |
// Compute nonlinear terms in the Navier-Stokes equations. |
| 728 |
dVelPhi_vec[i].resize(d); |
| 729 |
for (int j = 0; j < d; ++j) { |
| 730 |
dVelPhi_vec[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, p); |
| 731 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataField<Real>(*dVelPhi_vec[i][j], *dVel_vec[i][j], *(feVel_->N())); |
| 732 |
} |
| 733 |
} |
| 734 |
// Multiply velocity gradients with viscosity. |
| 735 |
ROL::Ptr<Intrepid::FieldContainer<Real> > nuGradPhi_eval; |
| 736 |
nuGradPhi_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, p, d); |
| 737 |
Intrepid::FunctionSpaceTools::tensorMultiplyDataField<Real>(*nuGradPhi_eval, *nu, *(feVel_->gradN())); |
| 738 |
// Compute nonlinear terms in the Navier-Stokes equations. |
| 739 |
ROL::Ptr<Intrepid::FieldContainer<Real> > valVelDotgradPhi_eval; |
| 740 |
valVelDotgradPhi_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, p); |
| 741 |
Intrepid::FunctionSpaceTools::dotMultiplyDataField<Real>(*valVelDotgradPhi_eval, *valVel_eval, *(feVel_->gradN())); |
| 742 |
// Negative pressure basis. |
| 743 |
Intrepid::FieldContainer<Real> negPrsPhi(*(fePrs_->N())); |
| 744 |
Intrepid::RealSpaceTools<Real>::scale(negPrsPhi,static_cast<Real>(-1)); |
| 745 |
// Compute gravity Jacobian |
| 746 |
ROL::Ptr<Intrepid::FieldContainer<Real> > gravPhi; |
| 747 |
gravPhi = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, p); |
| 748 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataField<Real>(*gravPhi, *grav, *(feThr_->N())); |
| 749 |
|
| 750 |
/**************************************************************************/ |
| 751 |
/*** THERMAL **************************************************************/ |
| 752 |
/**************************************************************************/ |
| 753 |
ROL::Ptr<Intrepid::FieldContainer<Real> > kappaGradPhi, VelPhi; |
| 754 |
kappaGradPhi = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, p, d); |
| 755 |
VelPhi = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, p); |
| 756 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > dHeatPhi(d); |
| 757 |
// Compute kappa times gradient of basis. |
| 758 |
Intrepid::FunctionSpaceTools::tensorMultiplyDataField<Real>(*kappaGradPhi, *kappa, *(feThr_->gradN())); |
| 759 |
// Compute scaled velocity. |
| 760 |
Intrepid::FunctionSpaceTools::dotMultiplyDataField<Real>(*VelPhi, *valVel_eval, *feThr_->gradN()); |
| 761 |
// Thermal-velocity Jacobians. |
| 762 |
for (int i = 0; i < d; ++i) { |
| 763 |
dHeatPhi[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, p); |
| 764 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataField<Real>(*dHeatPhi[i], *gradHeat_vec[i], *feThr_->N()); |
| 765 |
} |
| 766 |
|
| 767 |
/*** Evaluate weak form of the Jacobian. ***/ |
| 768 |
// X component of velocity equation. |
| 769 |
for (int i = 0; i < d; ++i) { |
| 770 |
// Velocity components |
| 771 |
for (int j = 0; j < d; ++j) { |
| 772 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[i][j]), |
| 773 |
*(feVel_->NdetJ()), // Phi |
| 774 |
*dVelPhi_vec[i][j], // (Phi . gradU) |
| 775 |
Intrepid::COMP_CPP, |
| 776 |
false); |
| 777 |
} |
| 778 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[i][i]), |
| 779 |
*nuGradPhi_eval, // nu gradPhi |
| 780 |
*(feVel_->gradNdetJ()), // gradPhi |
| 781 |
Intrepid::COMP_CPP, |
| 782 |
true); |
| 783 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[i][i]), |
| 784 |
*(feVel_->NdetJ()), // Phi |
| 785 |
*valVelDotgradPhi_eval, // (U . gradPhiX) |
| 786 |
Intrepid::COMP_CPP, |
| 787 |
true); |
| 788 |
// Pressure components |
| 789 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[i][d]), |
| 790 |
*(feVel_->DNDdetJ(i)), // dPhi/dx |
| 791 |
negPrsPhi, // -Phi |
| 792 |
Intrepid::COMP_CPP, |
| 793 |
false); |
| 794 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[d][i]), |
| 795 |
*(fePrs_->NdetJ()), // Phi |
| 796 |
*(feVel_->DND(i)), // dPhi/dx |
| 797 |
Intrepid::COMP_CPP, |
| 798 |
false); |
| 799 |
Intrepid::RealSpaceTools<Real>::scale((*J[d][i]),static_cast<Real>(-1)); |
| 800 |
// Thermal components |
| 801 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[d+1][i]), |
| 802 |
*dHeatPhi[i], // gradT Phi |
| 803 |
*(feVel_->NdetJ()), // Phi |
| 804 |
Intrepid::COMP_CPP, |
| 805 |
false); |
| 806 |
} |
| 807 |
// Gravitational component |
| 808 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[d-1][d+1]), |
| 809 |
*(feVel_->NdetJ()), // Phi |
| 810 |
*gravPhi, // grav Phi |
| 811 |
Intrepid::COMP_CPP, |
| 812 |
false); |
| 813 |
// Thermal components |
| 814 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[d+1][d+1]), |
| 815 |
*kappaGradPhi, // kappa gradPhi |
| 816 |
*(feThr_->gradNdetJ()), // gradPhi |
| 817 |
Intrepid::COMP_CPP, |
| 818 |
false); |
| 819 |
Intrepid::FunctionSpaceTools::integrate<Real>((*J[d+1][d+1]), |
| 820 |
*(feThr_->NdetJ()), // Phi |
| 821 |
*VelPhi, // U . gradPhi |
| 822 |
Intrepid::COMP_CPP, |
| 823 |
true); |
| 824 |
|
| 825 |
// APPLY BOUNDARY CONDITIONS |
| 826 |
// THERMAL BOUNDARIES |
| 827 |
// --> Control boundaries: i=0,1,2,3 |
| 828 |
// --> Substrate boundary: i=4 |
| 829 |
// --> Inflow boundary: i=6 |
| 830 |
// --> Outflow boundaries: i=5,7 |
| 831 |
// VELOCITY BOUNDARIES |
| 832 |
// --> No slip boundaries: i=0,1,2,3,4 |
| 833 |
// --> Inflow Boundary: i=6 |
| 834 |
// --> Outflow Boundaries: i=5,7 |
| 835 |
// PRESSURE BOUNDARIES |
| 836 |
// --> Pressure Pin: i=? |
| 837 |
int numSideSets = bdryCellLocIds_.size(); |
| 838 |
const int numCubPerSide = bdryCub_->getNumPoints(); |
| 839 |
if (numSideSets > 0) { |
| 840 |
// ROBIN CONDITIONS |
| 841 |
for (int i = 0; i < numSideSets; ++i) { |
| 842 |
// Control boundaries |
| 843 |
if (i==0 || i==1 || i==2 || i==3) { |
| 844 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 845 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 846 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 847 |
ROL::Ptr<Intrepid::FieldContainer<Real> > robinJac; |
| 848 |
if (numCellsSide) { |
| 849 |
// Get U and Z coefficients on Robin boundary |
| 850 |
ROL::Ptr<Intrepid::FieldContainer<Real > > u_coeff_bdry, z_coeff_bdry; |
| 851 |
u_coeff_bdry = getThermalBoundaryCoeff(*(U[d+1]), i, j); |
| 852 |
z_coeff_bdry = getThermalBoundaryCoeff(*(Z[d+1]), i, j); |
| 853 |
// Evaluate U and Z on FE basis |
| 854 |
ROL::Ptr<Intrepid::FieldContainer<Real > > valU_eval_bdry, valZ_eval_bdry; |
| 855 |
valU_eval_bdry = ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 856 |
valZ_eval_bdry = ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 857 |
feThrBdry_[i][j]->evaluateValue(valU_eval_bdry, u_coeff_bdry); |
| 858 |
feThrBdry_[i][j]->evaluateValue(valZ_eval_bdry, z_coeff_bdry); |
| 859 |
// Compute Stefan-Boltzmann residual |
| 860 |
ROL::Ptr< Intrepid::FieldContainer<Real> > robinVal1 |
| 861 |
= ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 862 |
Intrepid::FieldContainer<Real> robinVal(numCellsSide, fh, numCubPerSide); |
| 863 |
computeThermalRobin(robinVal1,valU_eval_bdry,valZ_eval_bdry,i,j,1,0); |
| 864 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataField<Real>(robinVal, |
| 865 |
*robinVal1, |
| 866 |
*(feThrBdry_[i][j]->N())); |
| 867 |
// Evaluate boundary integral |
| 868 |
robinJac = ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, fh, fh); |
| 869 |
Intrepid::FunctionSpaceTools::integrate<Real>(*robinJac, |
| 870 |
robinVal, |
| 871 |
*(feThrBdry_[i][j]->NdetJ()), |
| 872 |
Intrepid::COMP_CPP, false); |
| 873 |
for (int k = 0; k < numCellsSide; ++k) { |
| 874 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 875 |
for (int l = 0; l < fh; ++l) { |
| 876 |
for (int m = 0; m < fh; ++m) { |
| 877 |
(*J[d+1][d+1])(cidx,l,m) += (*robinJac)(k,l,m); |
| 878 |
} |
| 879 |
} |
| 880 |
} |
| 881 |
} |
| 882 |
} |
| 883 |
} |
| 884 |
} |
| 885 |
// DIRICHLET CONDITIONS |
| 886 |
for (int i = 0; i < numSideSets; ++i) { |
| 887 |
// Velocity Boundary Conditions |
| 888 |
if (i==0 || i==1 || i==2 || i==3 || i==4 || i==5 || i==6 || i==7) { |
| 889 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 890 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 891 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 892 |
int numVBdryDofs = fvidx_[j].size(); |
| 893 |
for (int k = 0; k < numCellsSide; ++k) { |
| 894 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 895 |
for (int l = 0; l < numVBdryDofs; ++l) { |
| 896 |
for (int m = 0; m < fv; ++m) { |
| 897 |
for (int n = 0; n < d; ++n) { |
| 898 |
for (int p = 0; p < d; ++p) { |
| 899 |
(*J[n][p])(cidx,fvidx_[j][l],m) = static_cast<Real>(0); |
| 900 |
} |
| 901 |
(*J[n][n])(cidx,fvidx_[j][l],fvidx_[j][l]) = static_cast<Real>(1); |
| 902 |
} |
| 903 |
} |
| 904 |
for (int m = 0; m < d; ++m) { |
| 905 |
for (int n = 0; n < fp; ++n) { |
| 906 |
(*J[m][d])(cidx,fvidx_[j][l],n) = static_cast<Real>(0); |
| 907 |
} |
| 908 |
for (int n = 0; n < fh; ++n) { |
| 909 |
(*J[m][d+1])(cidx,fvidx_[j][l],n) = static_cast<Real>(0); |
| 910 |
} |
| 911 |
} |
| 912 |
} |
| 913 |
} |
| 914 |
} |
| 915 |
} |
| 916 |
// Thermal boundary conditions |
| 917 |
if ( (i==4) || (i==6) ) { |
| 918 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 919 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 920 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 921 |
int numHBdryDofs = fhidx_[j].size(); |
| 922 |
for (int k = 0; k < numCellsSide; ++k) { |
| 923 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 924 |
for (int l = 0; l < numHBdryDofs; ++l) { |
| 925 |
for (int m = 0; m < fv; ++m) { |
| 926 |
for (int n = 0; n < d; ++n) { |
| 927 |
(*J[d+1][n])(cidx,fhidx_[j][l],m) = static_cast<Real>(0); |
| 928 |
} |
| 929 |
} |
| 930 |
for (int m = 0; m < fp; ++m) { |
| 931 |
(*J[d+1][d])(cidx,fhidx_[j][l],m) = static_cast<Real>(0); |
| 932 |
} |
| 933 |
for (int m = 0; m < fh; ++m) { |
| 934 |
(*J[d+1][d+1])(cidx,fhidx_[j][l],m) = static_cast<Real>(0); |
| 935 |
} |
| 936 |
(*J[d+1][d+1])(cidx,fhidx_[j][l],fhidx_[j][l]) = static_cast<Real>(1); |
| 937 |
} |
| 938 |
} |
| 939 |
} |
| 940 |
} |
| 941 |
// Pressure pinning |
| 942 |
if (i==8 && pinPressure_) { |
| 943 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 944 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 945 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 946 |
for (int k = 0; k < numCellsSide; ++k) { |
| 947 |
int l = 0, cidx = bdryCellLocIds_[i][j][k]; |
| 948 |
for (int m = 0; m < fv; ++m) { |
| 949 |
for (int n = 0; n < d; ++n) { |
| 950 |
(*J[d][n])(cidx,fpidx_[j][l],m) = static_cast<Real>(0); |
| 951 |
} |
| 952 |
} |
| 953 |
for (int m = 0; m < fp; ++m) { |
| 954 |
(*J[d][d])(cidx,fpidx_[j][l],m) = static_cast<Real>(0); |
| 955 |
} |
| 956 |
(*J[d][d])(cidx,fpidx_[j][l],fpidx_[j][l]) = static_cast<Real>(1); |
| 957 |
for (int m = 0; m < fh; ++m) { |
| 958 |
(*J[d][d+1])(cidx,fpidx_[j][l],m) = static_cast<Real>(0); |
| 959 |
} |
| 960 |
} |
| 961 |
} |
| 962 |
} |
| 963 |
} |
| 964 |
} |
| 965 |
|
| 966 |
// Combine the jacobians. |
| 967 |
fieldHelper_->combineFieldCoeff(jac, J); |
| 968 |
|
| 969 |
} |
| 970 |
|
| 971 |
|
| 972 |
void Jacobian_2(ROL::Ptr<Intrepid::FieldContainer<Real> > & jac, |
| 973 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & u_coeff, |
| 974 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & z_coeff = ROL::nullPtr, |
| 975 |
const ROL::Ptr<const std::vector<Real> > & z_param = ROL::nullPtr) { |
| 976 |
// Retrieve dimensions. |
| 977 |
int c = u_coeff->dimension(0); |
| 978 |
int fv = basisPtrVel_->getCardinality(); |
| 979 |
int fp = basisPtrPrs_->getCardinality(); |
| 980 |
int fh = basisPtrThr_->getCardinality(); |
| 981 |
int d = cellCub_->getDimension(); |
| 982 |
|
| 983 |
// Initialize jacobians. |
| 984 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > J(d+2); |
| 985 |
for (int i = 0; i < d+2; ++i) { |
| 986 |
J[i].resize(d+2); |
| 987 |
} |
| 988 |
for (int i = 0; i < d; ++i) { |
| 989 |
for (int j = 0; j < d; ++j) { |
| 990 |
J[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fv); |
| 991 |
} |
| 992 |
J[d][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fv); |
| 993 |
J[i][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fp); |
| 994 |
J[d+1][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fv); |
| 995 |
J[i][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fh); |
| 996 |
} |
| 997 |
J[d][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fp); |
| 998 |
J[d+1][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fp); |
| 999 |
J[d][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fh); |
| 1000 |
J[d+1][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fh); |
| 1001 |
|
| 1002 |
// Split u_coeff into components. |
| 1003 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > U, Z; |
| 1004 |
fieldHelper_->splitFieldCoeff(U, u_coeff); |
| 1005 |
fieldHelper_->splitFieldCoeff(Z, z_coeff); |
| 1006 |
|
| 1007 |
// APPLY BOUNDARY CONDITIONS |
| 1008 |
// THERMAL BOUNDARIES |
| 1009 |
// --> Control boundaries: i=0,1,2,3 |
| 1010 |
// --> Substrate boundary: i=4 |
| 1011 |
// --> Inflow boundary: i=6 |
| 1012 |
// --> Outflow boundaries: i=5,7 |
| 1013 |
// VELOCITY BOUNDARIES |
| 1014 |
// --> No slip boundaries: i=0,1,2,3,4 |
| 1015 |
// --> Inflow Boundary: i=6 |
| 1016 |
// --> Outflow Boundaries: i=5,7 |
| 1017 |
// PRESSURE BOUNDARIES |
| 1018 |
// --> Pressure Pin: i=? |
| 1019 |
int numSideSets = bdryCellLocIds_.size(); |
| 1020 |
const int numCubPerSide = bdryCub_->getNumPoints(); |
| 1021 |
if (numSideSets > 0) { |
| 1022 |
for (int i = 0; i < numSideSets; ++i) { |
| 1023 |
// Control boundaries |
| 1024 |
if (i==0 || i==1 || i==2 || i==3) { |
| 1025 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 1026 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 1027 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 1028 |
if (numCellsSide) { |
| 1029 |
// Get U and Z coefficients on Robin boundary |
| 1030 |
ROL::Ptr<Intrepid::FieldContainer<Real > > u_coeff_bdry |
| 1031 |
= getThermalBoundaryCoeff(*(U[d+1]), i, j); |
| 1032 |
ROL::Ptr<Intrepid::FieldContainer<Real > > z_coeff_bdry |
| 1033 |
= getThermalBoundaryCoeff(*(Z[d+1]), i, j); |
| 1034 |
// Evaluate U and Z on FE basis |
| 1035 |
ROL::Ptr<Intrepid::FieldContainer<Real > > valU_eval_bdry |
| 1036 |
= ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 1037 |
ROL::Ptr<Intrepid::FieldContainer<Real > > valZ_eval_bdry |
| 1038 |
= ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 1039 |
feThrBdry_[i][j]->evaluateValue(valU_eval_bdry, u_coeff_bdry); |
| 1040 |
feThrBdry_[i][j]->evaluateValue(valZ_eval_bdry, z_coeff_bdry); |
| 1041 |
// Compute Stefan-Boltzmann residual |
| 1042 |
ROL::Ptr< Intrepid::FieldContainer<Real> > robinVal1 |
| 1043 |
= ROL::makePtr<Intrepid::FieldContainer<Real>>(numCellsSide, numCubPerSide); |
| 1044 |
Intrepid::FieldContainer<Real> robinVal(numCellsSide, fh, numCubPerSide); |
| 1045 |
computeThermalRobin(robinVal1,valU_eval_bdry,valZ_eval_bdry,i,j,1,1); |
| 1046 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataField<Real>(robinVal, |
| 1047 |
*robinVal1, |
| 1048 |
*(feThrBdry_[i][j]->N())); |
| 1049 |
// Evaluate boundary integral |
| 1050 |
Intrepid::FieldContainer<Real> robinJac(numCellsSide, fh, fh); |
| 1051 |
Intrepid::FunctionSpaceTools::integrate<Real>(robinJac, |
| 1052 |
robinVal, |
| 1053 |
*(feThrBdry_[i][j]->NdetJ()), |
| 1054 |
Intrepid::COMP_CPP, false); |
| 1055 |
for (int k = 0; k < numCellsSide; ++k) { |
| 1056 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 1057 |
for (int l = 0; l < fh; ++l) { |
| 1058 |
for (int m = 0; m < fh; ++m) { |
| 1059 |
(*J[d+1][d+1])(cidx,l,m) += robinJac(k,l,m); |
| 1060 |
} |
| 1061 |
} |
| 1062 |
} |
| 1063 |
} |
| 1064 |
} |
| 1065 |
} |
| 1066 |
} |
| 1067 |
// DIRICHLET CONDITIONS |
| 1068 |
for (int i = 0; i < numSideSets; ++i) { |
| 1069 |
// Velocity Boundary Conditions |
| 1070 |
if (i==0 || i==1 || i==2 || i==3 || i==4 || i==5 || i==6 || i==7) { |
| 1071 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 1072 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 1073 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 1074 |
int numVBdryDofs = fvidx_[j].size(); |
| 1075 |
for (int k = 0; k < numCellsSide; ++k) { |
| 1076 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 1077 |
for (int l = 0; l < numVBdryDofs; ++l) { |
| 1078 |
for (int m = 0; m < fv; ++m) { |
| 1079 |
for (int n = 0; n < d; ++n) { |
| 1080 |
for (int p = 0; p < d; ++p) { |
| 1081 |
(*J[n][p])(cidx,fvidx_[j][l],m) = static_cast<Real>(0); |
| 1082 |
} |
| 1083 |
} |
| 1084 |
} |
| 1085 |
for (int m = 0; m < d; ++m) { |
| 1086 |
for (int n = 0; n < fp; ++n) { |
| 1087 |
(*J[m][d])(cidx,fvidx_[j][l],n) = static_cast<Real>(0); |
| 1088 |
} |
| 1089 |
for (int n = 0; n < fh; ++n) { |
| 1090 |
(*J[m][d+1])(cidx,fvidx_[j][l],n) = static_cast<Real>(0); |
| 1091 |
} |
| 1092 |
} |
| 1093 |
} |
| 1094 |
} |
| 1095 |
} |
| 1096 |
} |
| 1097 |
// Thermal boundary conditions |
| 1098 |
if ( (i==4) || (i==6) ) { |
| 1099 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 1100 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 1101 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 1102 |
int numHBdryDofs = fhidx_[j].size(); |
| 1103 |
for (int k = 0; k < numCellsSide; ++k) { |
| 1104 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 1105 |
for (int l = 0; l < numHBdryDofs; ++l) { |
| 1106 |
for (int m = 0; m < fv; ++m) { |
| 1107 |
for (int n = 0; n < d; ++n) { |
| 1108 |
(*J[d+1][n])(cidx,fhidx_[j][l],m) = static_cast<Real>(0); |
| 1109 |
} |
| 1110 |
} |
| 1111 |
for (int m = 0; m < fp; ++m) { |
| 1112 |
(*J[d+1][d])(cidx,fhidx_[j][l],m) = static_cast<Real>(0); |
| 1113 |
} |
| 1114 |
for (int m = 0; m < fh; ++m) { |
| 1115 |
(*J[d+1][d+1])(cidx,fhidx_[j][l],m) = static_cast<Real>(0); |
| 1116 |
} |
| 1117 |
} |
| 1118 |
} |
| 1119 |
} |
| 1120 |
} |
| 1121 |
// Pressure pinning |
| 1122 |
if (i==8 && pinPressure_) { |
| 1123 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 1124 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 1125 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 1126 |
for (int k = 0; k < numCellsSide; ++k) { |
| 1127 |
int l = 0, cidx = bdryCellLocIds_[i][j][k]; |
| 1128 |
for (int m = 0; m < fv; ++m) { |
| 1129 |
for (int n = 0; n < d; ++n) { |
| 1130 |
(*J[d][n])(cidx,fpidx_[j][l],m) = static_cast<Real>(0); |
| 1131 |
} |
| 1132 |
} |
| 1133 |
for (int m = 0; m < fp; ++m) { |
| 1134 |
(*J[d][d])(cidx,fpidx_[j][l],m) = static_cast<Real>(0); |
| 1135 |
} |
| 1136 |
for (int m = 0; m < fh; ++m) { |
| 1137 |
(*J[d][d+1])(cidx,fpidx_[j][l],m) = static_cast<Real>(0); |
| 1138 |
} |
| 1139 |
} |
| 1140 |
} |
| 1141 |
} |
| 1142 |
} |
| 1143 |
} |
| 1144 |
|
| 1145 |
// Combine the jacobians. |
| 1146 |
fieldHelper_->combineFieldCoeff(jac, J); |
| 1147 |
|
| 1148 |
} |
| 1149 |
|
| 1150 |
void Hessian_11(ROL::Ptr<Intrepid::FieldContainer<Real> > & hess, |
| 1151 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & l_coeff, |
| 1152 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & u_coeff, |
| 1153 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & z_coeff = ROL::nullPtr, |
| 1154 |
const ROL::Ptr<const std::vector<Real> > & z_param = ROL::nullPtr) { |
| 1155 |
// throw Exception::NotImplemented(""); |
| 1156 |
// Retrieve dimensions. |
| 1157 |
int c = u_coeff->dimension(0); |
| 1158 |
int p = cellCub_->getNumPoints(); |
| 1159 |
int fv = basisPtrVel_->getCardinality(); |
| 1160 |
int fp = basisPtrPrs_->getCardinality(); |
| 1161 |
int fh = basisPtrThr_->getCardinality(); |
| 1162 |
int d = cellCub_->getDimension(); |
| 1163 |
|
| 1164 |
// Initialize jacobians. |
| 1165 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > H(d+2); |
| 1166 |
for (int i = 0; i < d+2; ++i) { |
| 1167 |
H[i].resize(d+2); |
| 1168 |
} |
| 1169 |
for (int i = 0; i < d; ++i) { |
| 1170 |
for (int j = 0; j < d; ++j) { |
| 1171 |
H[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fv); |
| 1172 |
} |
| 1173 |
} |
| 1174 |
for (int i = 0; i < d; ++i) { |
| 1175 |
H[d][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fv); |
| 1176 |
H[i][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fp); |
| 1177 |
H[d+1][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fv); |
| 1178 |
H[i][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fh); |
| 1179 |
} |
| 1180 |
H[d][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fp); |
| 1181 |
H[d+1][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fp); |
| 1182 |
H[d][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fh); |
| 1183 |
H[d+1][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fh); |
| 1184 |
|
| 1185 |
// Split l_coeff into components. |
| 1186 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > L; |
| 1187 |
fieldHelper_->splitFieldCoeff(L, l_coeff); |
| 1188 |
|
| 1189 |
// APPLY DIRICHLET CONDITIONS |
| 1190 |
// THERMAL BOUNDARIES |
| 1191 |
// --> Control boundaries: i=0,1,2,3 |
| 1192 |
// --> Substrate boundary: i=4 |
| 1193 |
// --> Inflow boundary: i=6 |
| 1194 |
// --> Outflow boundaries: i=5,7 |
| 1195 |
// VELOCITY BOUNDARIES |
| 1196 |
// --> No slip boundaries: i=0,1,2,3,4 |
| 1197 |
// --> Inflow Boundary: i=6 |
| 1198 |
// --> Outflow Boundaries: i=5,7 |
| 1199 |
// PRESSURE BOUNDARIES |
| 1200 |
// --> Pressure Pin: i=? |
| 1201 |
int numSideSets = bdryCellLocIds_.size(); |
| 1202 |
if (numSideSets > 0) { |
| 1203 |
// DIRICHLET CONDITIONS |
| 1204 |
for (int i = 0; i < numSideSets; ++i) { |
| 1205 |
// Velocity boundary conditions |
| 1206 |
if (i==0 || i==1 || i==2 || i==3 || i==4 || i==5 || i==6 || i==7) { |
| 1207 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 1208 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 1209 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 1210 |
int numVBdryDofs = fvidx_[j].size(); |
| 1211 |
for (int k = 0; k < numCellsSide; ++k) { |
| 1212 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 1213 |
for (int l = 0; l < numVBdryDofs; ++l) { |
| 1214 |
for (int m = 0; m < d; ++m) { |
| 1215 |
(*L[m])(cidx,fvidx_[j][l]) = static_cast<Real>(0); |
| 1216 |
} |
| 1217 |
} |
| 1218 |
} |
| 1219 |
} |
| 1220 |
} |
| 1221 |
// Thermal boundaries |
| 1222 |
if ( (i==4) || (i==6) ) { |
| 1223 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 1224 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 1225 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 1226 |
int numHBdryDofs = fhidx_[j].size(); |
| 1227 |
for (int k = 0; k < numCellsSide; ++k) { |
| 1228 |
int cidx = bdryCellLocIds_[i][j][k]; |
| 1229 |
for (int l = 0; l < numHBdryDofs; ++l) { |
| 1230 |
(*L[d+1])(cidx,fhidx_[j][l]) = static_cast<Real>(0); |
| 1231 |
} |
| 1232 |
} |
| 1233 |
} |
| 1234 |
} |
| 1235 |
// Pressure pinning |
| 1236 |
if (i==8 && pinPressure_) { |
| 1237 |
int numLocalSideIds = bdryCellLocIds_[i].size(); |
| 1238 |
for (int j = 0; j < numLocalSideIds; ++j) { |
| 1239 |
int numCellsSide = bdryCellLocIds_[i][j].size(); |
| 1240 |
for (int k = 0; k < numCellsSide; ++k) { |
| 1241 |
int l = 0, cidx = bdryCellLocIds_[i][j][k]; |
| 1242 |
(*L[d])(cidx,fpidx_[j][l]) = static_cast<Real>(0); |
| 1243 |
} |
| 1244 |
} |
| 1245 |
} |
| 1246 |
} |
| 1247 |
} |
| 1248 |
|
| 1249 |
// Evaluate/interpolate finite element fields on cells. |
| 1250 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > valVel_vec(d); |
| 1251 |
for (int i = 0; i < d; ++i) { |
| 1252 |
valVel_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 1253 |
feVel_->evaluateValue(valVel_vec[i], L[i]); |
| 1254 |
} |
| 1255 |
ROL::Ptr<Intrepid::FieldContainer<Real> > valHeat_eval; |
| 1256 |
valHeat_eval = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, p); |
| 1257 |
feThr_->evaluateValue(valHeat_eval, L[d+1]); |
| 1258 |
|
| 1259 |
// Compute nonlinear terms in the Navier-Stokes equations. |
| 1260 |
std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > valVelPhi_vec(d); |
| 1261 |
for (int i = 0; i < d; ++i) { |
| 1262 |
valVelPhi_vec[i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, p); |
| 1263 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataField<Real>(*valVelPhi_vec[i], *valVel_vec[i], *(feVel_->N())); |
| 1264 |
} |
| 1265 |
|
| 1266 |
// Compute nonlinear terms in the thermal equation. |
| 1267 |
ROL::Ptr<Intrepid::FieldContainer<Real> > valHeatVelPhi; |
| 1268 |
valHeatVelPhi = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, p); |
| 1269 |
Intrepid::FunctionSpaceTools::scalarMultiplyDataField<Real>(*valHeatVelPhi, *valHeat_eval, *(feVel_->N())); |
| 1270 |
|
| 1271 |
/*** Evaluate weak form of the Hessian. ***/ |
| 1272 |
for (int i = 0; i < d; ++i) { |
| 1273 |
// velocity equation. |
| 1274 |
for (int j = 0; j < d; ++j) { |
| 1275 |
Intrepid::FunctionSpaceTools::integrate<Real>((*H[i][j]), |
| 1276 |
*valVelPhi_vec[j], // L Phi |
| 1277 |
*(feVel_->DNDdetJ(i)), // dPhi/dx |
| 1278 |
Intrepid::COMP_CPP, |
| 1279 |
false); |
| 1280 |
Intrepid::FunctionSpaceTools::integrate<Real>((*H[i][j]), |
| 1281 |
*(feVel_->DNDdetJ(j)), // dPhi/dx |
| 1282 |
*valVelPhi_vec[i], // L Phi |
| 1283 |
Intrepid::COMP_CPP, |
| 1284 |
true); |
| 1285 |
} |
| 1286 |
Intrepid::FunctionSpaceTools::integrate<Real>((*H[i][d+1]), |
| 1287 |
*valHeatVelPhi, // L Phi |
| 1288 |
*(feThr_->DNDdetJ(i)), // dPhi/dx |
| 1289 |
Intrepid::COMP_CPP, |
| 1290 |
false); |
| 1291 |
// Thermal equation. |
| 1292 |
Intrepid::FunctionSpaceTools::integrate<Real>((*H[d+1][i]), |
| 1293 |
*(feThr_->DNDdetJ(i)), // dPhi/dx |
| 1294 |
*valHeatVelPhi, // L Phi |
| 1295 |
Intrepid::COMP_CPP, |
| 1296 |
false); |
| 1297 |
} |
| 1298 |
|
| 1299 |
// Combine the Hessians. |
| 1300 |
fieldHelper_->combineFieldCoeff(hess, H); |
| 1301 |
|
| 1302 |
} |
| 1303 |
|
| 1304 |
void Hessian_12(ROL::Ptr<Intrepid::FieldContainer<Real> > & hess, |
| 1305 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & l_coeff, |
| 1306 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & u_coeff, |
| 1307 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & z_coeff = ROL::nullPtr, |
| 1308 |
const ROL::Ptr<const std::vector<Real> > & z_param = ROL::nullPtr) { |
| 1309 |
throw Exception::Zero(">>> (PDE_ThermalFluids::Hessian_12): Hessian is zero."); |
| 1310 |
} |
| 1311 |
|
| 1312 |
void Hessian_21(ROL::Ptr<Intrepid::FieldContainer<Real> > & hess, |
| 1313 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & l_coeff, |
| 1314 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & u_coeff, |
| 1315 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & z_coeff = ROL::nullPtr, |
| 1316 |
const ROL::Ptr<const std::vector<Real> > & z_param = ROL::nullPtr) { |
| 1317 |
throw Exception::Zero(">>> (PDE_ThermalFluids::Hessian_21): Hessian is zero."); |
| 1318 |
} |
| 1319 |
|
| 1320 |
void Hessian_22(ROL::Ptr<Intrepid::FieldContainer<Real> > & hess, |
| 1321 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & l_coeff, |
| 1322 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & u_coeff, |
| 1323 |
const ROL::Ptr<const Intrepid::FieldContainer<Real> > & z_coeff = ROL::nullPtr, |
| 1324 |
const ROL::Ptr<const std::vector<Real> > & z_param = ROL::nullPtr) { |
| 1325 |
throw Exception::Zero(">>> (PDE_ThermalFluids::Hessian_22): Hessian is zero."); |
| 1326 |
} |
| 1327 |
|
| 1328 |
void RieszMap_1(ROL::Ptr<Intrepid::FieldContainer<Real> > & riesz) { |
| 1329 |
// Retrieve dimensions. |
| 1330 |
int c = feVel_->N()->dimension(0); |
| 1331 |
int fv = basisPtrVel_->getCardinality(); |
| 1332 |
int fp = basisPtrPrs_->getCardinality(); |
| 1333 |
int fh = basisPtrThr_->getCardinality(); |
| 1334 |
int d = cellCub_->getDimension(); |
| 1335 |
|
| 1336 |
// Initialize jacobians. |
| 1337 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > J(d+2); |
| 1338 |
for (int i = 0; i < d+2; ++i) { |
| 1339 |
J[i].resize(d+2); |
| 1340 |
} |
| 1341 |
for (int i = 0; i < d; ++i) { |
| 1342 |
for (int j = 0; j < d; ++j) { |
| 1343 |
J[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fv); |
| 1344 |
} |
| 1345 |
J[d][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fv); |
| 1346 |
J[i][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fp); |
| 1347 |
J[d+1][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fv); |
| 1348 |
J[i][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fh); |
| 1349 |
} |
| 1350 |
J[d][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fp); |
| 1351 |
J[d+1][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fp); |
| 1352 |
J[d][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fh); |
| 1353 |
J[d+1][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fh); |
| 1354 |
|
| 1355 |
for (int i = 0; i < d; ++i) { |
| 1356 |
*(J[i][i]) = *(feVel_->stiffMat()); |
| 1357 |
Intrepid::RealSpaceTools<Real>::add(*(J[i][i]),*(feVel_->massMat())); |
| 1358 |
} |
| 1359 |
*(J[d][d]) = *(fePrs_->massMat()); |
| 1360 |
*(J[d+1][d+1]) = *(feThr_->stiffMat()); |
| 1361 |
Intrepid::RealSpaceTools<Real>::add(*(J[d+1][d+1]),*(feThr_->massMat())); |
| 1362 |
|
| 1363 |
// Combine the jacobians. |
| 1364 |
fieldHelper_->combineFieldCoeff(riesz, J); |
| 1365 |
} |
| 1366 |
|
| 1367 |
void RieszMap_2(ROL::Ptr<Intrepid::FieldContainer<Real> > & riesz) { |
| 1368 |
// Retrieve dimensions. |
| 1369 |
int c = feVel_->N()->dimension(0); |
| 1370 |
int fv = basisPtrVel_->getCardinality(); |
| 1371 |
int fp = basisPtrPrs_->getCardinality(); |
| 1372 |
int fh = basisPtrThr_->getCardinality(); |
| 1373 |
int d = cellCub_->getDimension(); |
| 1374 |
|
| 1375 |
// Initialize jacobians. |
| 1376 |
std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > J(d+2); |
| 1377 |
for (int i = 0; i < d+2; ++i) { |
| 1378 |
J[i].resize(d+2); |
| 1379 |
} |
| 1380 |
for (int i = 0; i < d; ++i) { |
| 1381 |
for (int j = 0; j < d; ++j) { |
| 1382 |
J[i][j] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fv); |
| 1383 |
} |
| 1384 |
J[d][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fv); |
| 1385 |
J[i][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fp); |
| 1386 |
J[d+1][i] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fv); |
| 1387 |
J[i][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fv, fh); |
| 1388 |
} |
| 1389 |
J[d][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fp); |
| 1390 |
J[d+1][d] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fp); |
| 1391 |
J[d][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fp, fh); |
| 1392 |
J[d+1][d+1] = ROL::makePtr<Intrepid::FieldContainer<Real>>(c, fh, fh); |
| 1393 |
|
| 1394 |
|
| 1395 |
for (int i = 0; i < d; ++i) { |
| 1396 |
*(J[i][i]) = *(feVel_->massMat()); |
| 1397 |
} |
| 1398 |
*(J[d][d]) = *(fePrs_->massMat()); |
| 1399 |
*(J[d+1][d+1]) = *(feThr_->massMat()); |
| 1400 |
|
| 1401 |
// Combine the jacobians. |
| 1402 |
fieldHelper_->combineFieldCoeff(riesz, J); |
| 1403 |
} |
| 1404 |
|
| 1405 |
std::vector<ROL::Ptr<Intrepid::Basis<Real, Intrepid::FieldContainer<Real> > > > getFields() { |
| 1406 |
return basisPtrs_; |
| 1407 |
} |
| 1408 |
|
| 1409 |
void setCellNodes(const ROL::Ptr<Intrepid::FieldContainer<Real> > &volCellNodes, |
| 1410 |
const std::vector<std::vector<ROL::Ptr<Intrepid::FieldContainer<Real> > > > &bdryCellNodes, |
| 1411 |
const std::vector<std::vector<std::vector<int> > > &bdryCellLocIds) { |
| 1412 |
volCellNodes_ = volCellNodes; |
| 1413 |
bdryCellNodes_ = bdryCellNodes; |
| 1414 |
bdryCellLocIds_ = bdryCellLocIds; |
| 1415 |
// Finite element definition. |
| 1416 |
feVel_ = ROL::makePtr<FE<Real>>(volCellNodes_,basisPtrVel_,cellCub_); |
| 1417 |
fePrs_ = ROL::makePtr<FE<Real>>(volCellNodes_,basisPtrPrs_,cellCub_); |
| 1418 |
feThr_ = ROL::makePtr<FE<Real>>(volCellNodes_,basisPtrThr_,cellCub_); |
| 1419 |
// Get boundary degrees of freedom. |
| 1420 |
fvidx_ = feVel_->getBoundaryDofs(); |
| 1421 |
fpidx_ = fePrs_->getBoundaryDofs(); |
| 1422 |
fhidx_ = feThr_->getBoundaryDofs(); |
| 1423 |
// Construct boundary FEs |
| 1424 |
const int numSideSets = bdryCellNodes.size(); |
| 1425 |
feVelBdry_.resize(numSideSets); |
| 1426 |
fePrsBdry_.resize(numSideSets); |
| 1427 |
feThrBdry_.resize(numSideSets); |
| 1428 |
for (int i = 0; i < numSideSets; ++i) { |
| 1429 |
int numLocSides = bdryCellNodes[i].size(); |
| 1430 |
feVelBdry_[i].resize(numLocSides); |
| 1431 |
fePrsBdry_[i].resize(numLocSides); |
| 1432 |
feThrBdry_[i].resize(numLocSides); |
| 1433 |
for (int j = 0; j < numLocSides; ++j) { |
| 1434 |
if (bdryCellNodes[i][j] != ROL::nullPtr) { |
| 1435 |
feVelBdry_[i][j] = ROL::makePtr<FE<Real>>(bdryCellNodes[i][j],basisPtrVel_,bdryCub_,j); |
| 1436 |
fePrsBdry_[i][j] = ROL::makePtr<FE<Real>>(bdryCellNodes[i][j],basisPtrPrs_,bdryCub_,j); |
| 1437 |
feThrBdry_[i][j] = ROL::makePtr<FE<Real>>(bdryCellNodes[i][j],basisPtrThr_,bdryCub_,j); |
| 1438 |
} |
| 1439 |
} |
| 1440 |
} |
| 1441 |
} |
| 1442 |
|
| 1443 |
void setFieldPattern(const std::vector<std::vector<int> > & fieldPattern) { |
| 1444 |
fieldPattern_ = fieldPattern; |
| 1445 |
fieldHelper_ = ROL::makePtr<FieldHelper<Real>>(numFields_, numDofs_, numFieldDofs_, fieldPattern_); |
| 1446 |
} |
| 1447 |
|
| 1448 |
const ROL::Ptr<FE<Real> > getVelocityFE(void) const { |
| 1449 |
return feVel_; |
| 1450 |
} |
| 1451 |
|
| 1452 |
const ROL::Ptr<FE<Real> > getPressureFE(void) const { |
| 1453 |
return fePrs_; |
| 1454 |
} |
| 1455 |
|
| 1456 |
const ROL::Ptr<FE<Real> > getThermalFE(void) const { |
| 1457 |
return feThr_; |
| 1458 |
} |
| 1459 |
|
| 1460 |
const std::vector<std::vector<ROL::Ptr<FE<Real> > > > getVelocityBdryFE(void) const { |
| 1461 |
return feVelBdry_; |
| 1462 |
} |
| 1463 |
|
| 1464 |
const std::vector<std::vector<ROL::Ptr<FE<Real> > > > getPressureBdryFE(void) const { |
| 1465 |
return fePrsBdry_; |
| 1466 |
} |
| 1467 |
|
| 1468 |
const std::vector<std::vector<ROL::Ptr<FE<Real> > > > getThermalBdryFE(void) const { |
| 1469 |
return feThrBdry_; |
| 1470 |
} |
| 1471 |
|
| 1472 |
const std::vector<std::vector<std::vector<int> > > getBdryCellLocIds(void) const { |
| 1473 |
return bdryCellLocIds_; |
| 1474 |
} |
| 1475 |
|
| 1476 |
const ROL::Ptr<FieldHelper<Real> > getFieldHelper(void) const { |
| 1477 |
return fieldHelper_; |
| 1478 |
} |
| 1479 |
|
| 1480 |
}; // PDE_ThermalFluids |
| 1481 |
|
| 1482 |
#endif |