Skip to content

Commit

Permalink
progress on #34 in QCAD/ATO/PHAL
Browse files Browse the repository at this point in the history
this will only compile with
trilinos/Trilinos@7846c2e
  • Loading branch information
ibaned committed Feb 20, 2017
1 parent 0b1407a commit 5647db4
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 69 deletions.
6 changes: 3 additions & 3 deletions src/ATO/evaluators/ATO_AddForce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ class AddScalar : public PHX::EvaluatorWithBaseImpl<Traits>,
typedef typename EvalT::MeshScalarT MeshScalarT;

// Input:
PHX::MDField<ScalarT,Cell,QuadPoint> add_scalar;
PHX::MDField<MeshScalarT,Cell,Node,QuadPoint> w_bf;
PHX::MDField<const ScalarT,Cell,QuadPoint> add_scalar;
PHX::MDField<const MeshScalarT,Cell,Node,QuadPoint> w_bf;
PHX::MDField<const ScalarT,Cell,Node> inResidual;

// Output:
PHX::MDField<ScalarT,Cell,Node> inResidual;
PHX::MDField<ScalarT,Cell,Node> outResidual;

std::size_t numNodes;
Expand Down
4 changes: 2 additions & 2 deletions src/QCAD/evaluators/QCAD_Permittivity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ namespace QCAD {
std::size_t numQPs;
std::size_t numDims;
PHX::MDField<ScalarT,Cell,QuadPoint> permittivity;
PHX::MDField<ScalarT,Cell,QuadPoint> Temp;
PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<const ScalarT,Cell,QuadPoint> Temp;
PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> coordVec;

//! Define boolean variables to categorize
std::string typ; // permittivity type
Expand Down
8 changes: 2 additions & 6 deletions src/QCAD/evaluators/QCAD_Permittivity_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,13 @@ Permittivity(Teuchos::ParameterList& p,

// Add coordinate dependence to permittivity evaluator
if(position_dependent) {
PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim>
tmp(p.get<std::string>("Coordinate Vector Name"), dl->qp_vector);
coordVec = tmp;
coordVec = decltype(coordVec)(p.get<std::string>("Coordinate Vector Name"), dl->qp_vector);
this->addDependentField(coordVec);
}

// Add temperature dependence to permittivity evaluator
if(temp_dependent) {
PHX::MDField<ScalarT,Cell,QuadPoint>
tmp(p.get<std::string>("Temperature Variable Name"), dl->qp_scalar);
Temp = tmp;
Temp = decltype(Temp)(p.get<std::string>("Temperature Variable Name"), dl->qp_scalar);
this->addDependentField(Temp);
}

Expand Down
14 changes: 7 additions & 7 deletions src/QCAD/evaluators/QCAD_PoissonSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ namespace QCAD {
std::size_t numQPs;
std::size_t numDims;
std::size_t numNodes;
PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<MeshScalarT,Cell,Vertex,Dim> coordVecAtVertices;
PHX::MDField<MeshScalarT,Cell,QuadPoint> weights;
PHX::MDField<ScalarT,Cell,QuadPoint> potential; // scaled potential (no unit)
PHX::MDField<ScalarT,Dim> temperatureField; // lattice temperature [K]
PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<const MeshScalarT,Cell,Vertex,Dim> coordVecAtVertices;
PHX::MDField<const MeshScalarT,Cell,QuadPoint> weights;
PHX::MDField<const ScalarT,Cell,QuadPoint> potential; // scaled potential (no unit)
PHX::MDField<const ScalarT,Dim> temperatureField; // lattice temperature [K]

//! output
PHX::MDField<ScalarT,Cell,QuadPoint> poissonSource; // scaled RHS (unitless)
Expand Down Expand Up @@ -240,8 +240,8 @@ namespace QCAD {
bool bRealEigenvectors;
int nEigenvectors;
double fixedQuantumOcc;
std::vector< PHX::MDField<ScalarT,Cell,QuadPoint> > eigenvector_Re;
std::vector< PHX::MDField<ScalarT,Cell,QuadPoint> > eigenvector_Im;
std::vector< PHX::MDField<const ScalarT,Cell,QuadPoint> > eigenvector_Re;
std::vector< PHX::MDField<const ScalarT,Cell,QuadPoint> > eigenvector_Im;

//! Material database
Teuchos::RCP<QCAD::MaterialDatabase> materialDB;
Expand Down
4 changes: 2 additions & 2 deletions src/QCAD/evaluators/QCAD_PoissonSourceInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class PoissonSourceInterfaceBase :

// Input:
//! Coordinate vector at vertices
PHX::MDField<MeshScalarT,Cell,Vertex,Dim> coordVec;
PHX::MDField<ScalarT,Cell,Node> dof;
PHX::MDField<const MeshScalarT,Cell,Vertex,Dim> coordVec;
PHX::MDField<const ScalarT,Cell,Node> dof;

Teuchos::RCP<shards::CellTopology> cellType;
Teuchos::ArrayRCP<Teuchos::RCP<shards::CellTopology> > sideType;
Expand Down
6 changes: 1 addition & 5 deletions src/QCAD/evaluators/QCAD_PoissonSourceInterface_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ PoissonSourceInterfaceBase(const Teuchos::ParameterList& p) :
std::endl << "Error: PoissonSource Interface boundary conditions "
<< "are only supported when the DOF is not a vector" << std::endl);

//PHX::MDField<ScalarT,Cell,Node> tmp(p.get<std::string>("DOF Name"),
//p.get<Teuchos::RCP<PHX::DataLayout> >("DOF Data Layout"));
//dof = tmp;

dof = PHX::MDField<ScalarT,Cell,Node>(p.get<std::string>("DOF Name"),
dof = decltype(dof)(p.get<std::string>("DOF Name"),
p.get<Teuchos::RCP<PHX::DataLayout> >("DOF Data Layout"));
this->addDependentField(dof);
this->addDependentField(coordVec);
Expand Down
12 changes: 6 additions & 6 deletions src/QCAD/evaluators/QCAD_PoissonSourceNeumann.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ class PoissonSourceNeumannBase :

// Input:
//! Coordinate vector at vertices
PHX::MDField<MeshScalarT,Cell,Vertex,Dim> coordVec;
PHX::MDField<ScalarT,Cell,Node> dof;
PHX::MDField<ScalarT,Cell,Node,VecDim> dofVec;
PHX::MDField<ScalarT,Cell,Node> beta_field;
PHX::MDField<ScalarT,Cell,Node> thickness_field;
PHX::MDField<ScalarT,Cell,Node> elevation_field;
PHX::MDField<const MeshScalarT,Cell,Vertex,Dim> coordVec;
PHX::MDField<const ScalarT,Cell,Node> dof;
PHX::MDField<const ScalarT,Cell,Node,VecDim> dofVec;
PHX::MDField<const ScalarT,Cell,Node> beta_field;
PHX::MDField<const ScalarT,Cell,Node> thickness_field;
PHX::MDField<const ScalarT,Cell,Node> elevation_field;
Teuchos::RCP<shards::CellTopology> cellType;
Teuchos::ArrayRCP<Teuchos::RCP<shards::CellTopology> > sideType;
Teuchos::RCP<Intrepid2::Cubature<PHX::Device> > cubatureCell;
Expand Down
3 changes: 1 addition & 2 deletions src/QCAD/evaluators/QCAD_PoissonSourceNeumann_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ PoissonSourceNeumannBase(const Teuchos::ParameterList& p) :
std::endl << "Error: PoissonSource Neumann boundary conditions "
<< "only supported when the DOF is not a vector" << std::endl);

PHX::MDField<ScalarT,Cell,Node> tmp(p.get<std::string>("DOF Name"),
dof = decltype(dof)(p.get<std::string>("DOF Name"),
p.get<Teuchos::RCP<PHX::DataLayout> >("DOF Data Layout"));
dof = tmp;
this->addDependentField(dof);
this->addDependentField(coordVec);

Expand Down
8 changes: 4 additions & 4 deletions src/QCAD/evaluators/QCAD_PoissonSource_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ PoissonSource(Teuchos::ParameterList& p,
eigenvector_Re.resize(nEigenvectors);
for (int k = 0; k < nEigenvectors; ++k) {
sprintf(buf, "%s_Re%d", evecFieldRoot.c_str(), k);
PHX::MDField<ScalarT,Cell,QuadPoint> fr(buf,dl->qp_scalar);
PHX::MDField<const ScalarT,Cell,QuadPoint> fr(buf,dl->qp_scalar);
eigenvector_Re[k] = fr; this->addDependentField(eigenvector_Re[k]);
}

if(!bRealEigenvectors) {
eigenvector_Im.resize(nEigenvectors);
for (int k = 0; k < nEigenvectors; ++k) {
sprintf(buf, "%s_Im%d", evecFieldRoot.c_str(), k);
PHX::MDField<ScalarT,Cell,QuadPoint> fi(buf,dl->qp_scalar);
eigenvector_Im[k] = fi; this->addDependentField(eigenvector_Im[k]);
sprintf(buf, "%s_Im%d", evecFieldRoot.c_str(), k);
PHX::MDField<const ScalarT,Cell,QuadPoint> fi(buf,dl->qp_scalar);
eigenvector_Im[k] = fi; this->addDependentField(eigenvector_Im[k]);
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/QCAD/evaluators/QCAD_ResponseSaddleValue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace QCAD
typename EvalT::ScalarT& fieldVal, typename EvalT::ScalarT& retFieldVal,
std::vector<typename EvalT::ScalarT>& fieldGrad) const;
void getCellArea(const std::size_t cell, typename EvalT::ScalarT& cellArea) const;
void getAvgCellCoordinates(PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coordVec,
void getAvgCellCoordinates(PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> coordVec,
const std::size_t cell, double* dblAvgCoords, double& dblMaxZ) const;

std::size_t numQPs;
Expand All @@ -58,12 +58,12 @@ namespace QCAD

Teuchos::RCP<QCAD::SaddleValueResponseFunction> svResponseFn;

PHX::MDField<ScalarT> field;
PHX::MDField<ScalarT> fieldGradient;
PHX::MDField<ScalarT> retField;
PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<MeshScalarT,Cell,Node,Dim> coordVec_vertices; //not currently needed
PHX::MDField<MeshScalarT,Cell,QuadPoint> weights;
PHX::MDField<const ScalarT> field;
PHX::MDField<const ScalarT> fieldGradient;
PHX::MDField<const ScalarT> retField;
PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<const MeshScalarT,Cell,Node,Dim> coordVec_vertices; //not currently needed
PHX::MDField<const MeshScalarT,Cell,QuadPoint> weights;

std::string fieldName;
std::string fieldGradientName;
Expand Down
11 changes: 5 additions & 6 deletions src/QCAD/evaluators/QCAD_ResponseSaddleValue_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ ResponseSaddleValue(Teuchos::ParameterList& p,
bReturnSameField = true;

//! setup operation field and its gradient, and the return field (if it's different)
PHX::MDField<ScalarT> f(fieldName, dl->qp_scalar); field = f;
PHX::MDField<ScalarT> fg(fieldGradientName, dl->qp_vector); fieldGradient = fg;

if(!bReturnSameField) {
PHX::MDField<ScalarT> fr(retFieldName, dl->qp_scalar); retField = fr; }
field = decltype(field)(fieldName, dl->qp_scalar);
fieldGradient = decltype(fieldGradient)(fieldGradientName, dl->qp_vector);

if(!bReturnSameField)
retField = decltype(retField)(retFieldName, dl->qp_scalar);

//! add dependent fields
this->addDependentField(field);
Expand Down Expand Up @@ -467,7 +466,7 @@ getCellArea(const std::size_t cell, typename EvalT::ScalarT& cellArea) const
// **********************************************************************
template<typename EvalT, typename Traits>
void QCAD::ResponseSaddleValue<EvalT, Traits>::
getAvgCellCoordinates(PHX::MDField<typename EvalT::MeshScalarT,Cell,QuadPoint,Dim> coordVec,
getAvgCellCoordinates(PHX::MDField<const typename EvalT::MeshScalarT,Cell,QuadPoint,Dim> coordVec,
const std::size_t cell, double* dblAvgCoords, double& dblMaxZ) const
{
std::vector<MeshScalarT> avgCoord(numDims, 0.0); //just a double?
Expand Down
10 changes: 5 additions & 5 deletions src/QCAD/evaluators/QCAD_SchrodingerPotential.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ namespace QCAD {
getValidSchrodingerPotentialParameters() const;

ScalarT parabolicPotentialValue( const int numDim,
const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp );
ScalarT finiteWallPotential( const int numDim,
const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp );
ScalarT stringFormulaPotential( const int numDim,
const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp );

//! input
std::size_t numQPs;
std::size_t numDims;
PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<ScalarT,Cell,QuadPoint> psi; //wavefunction
PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<const ScalarT,Cell,QuadPoint> psi; //wavefunction

//! output
PHX::MDField<ScalarT,Cell,QuadPoint> V; //potential
Expand Down
6 changes: 3 additions & 3 deletions src/QCAD/evaluators/QCAD_SchrodingerPotential_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ QCAD::SchrodingerPotential<EvalT,Traits>::getValidSchrodingerPotentialParameters
template<typename EvalT,typename Traits>
typename QCAD::SchrodingerPotential<EvalT,Traits>::ScalarT
QCAD::SchrodingerPotential<EvalT,Traits>::parabolicPotentialValue(
const int numDim, const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int numDim, const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp )
{
ScalarT val;
Expand Down Expand Up @@ -232,7 +232,7 @@ QCAD::SchrodingerPotential<EvalT,Traits>::parabolicPotentialValue(
template<typename EvalT,typename Traits>
typename QCAD::SchrodingerPotential<EvalT,Traits>::ScalarT
QCAD::SchrodingerPotential<EvalT,Traits>::finiteWallPotential(
const int numDim, const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int numDim, const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp )
{
ScalarT val;
Expand Down Expand Up @@ -294,7 +294,7 @@ QCAD::SchrodingerPotential<EvalT,Traits>::finiteWallPotential(
template<typename EvalT,typename Traits>
typename QCAD::SchrodingerPotential<EvalT,Traits>::ScalarT
QCAD::SchrodingerPotential<EvalT,Traits>::stringFormulaPotential(
const int numDim, const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int numDim, const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp )
{
ScalarT val;
Expand Down
16 changes: 8 additions & 8 deletions src/QCAD/evaluators/QCAD_SchrodingerResid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SchrodingerResid : public PHX::EvaluatorWithBaseImpl<Traits>,
typedef typename EvalT::MeshScalarT MeshScalarT;

//! Helper function to compute inverse effective mass
double getInvEffMassFiniteWall( const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
double getInvEffMassFiniteWall( const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp );
double getInvEffMass1DMosCap(const MeshScalarT coord0);

Expand All @@ -47,13 +47,13 @@ class SchrodingerResid : public PHX::EvaluatorWithBaseImpl<Traits>,
std::size_t numQPs;
std::size_t numDims;

PHX::MDField<MeshScalarT,Cell,Node,QuadPoint> wBF;
PHX::MDField<ScalarT,Cell,QuadPoint> psi;
PHX::MDField<ScalarT,Cell,QuadPoint> psiDot;
PHX::MDField<MeshScalarT,Cell,Node,QuadPoint,Dim> wGradBF;
PHX::MDField<ScalarT,Cell,QuadPoint,Dim> psiGrad;
PHX::MDField<ScalarT,Cell,QuadPoint> V;
PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coordVec;
PHX::MDField<const MeshScalarT,Cell,Node,QuadPoint> wBF;
PHX::MDField<const ScalarT,Cell,QuadPoint> psi;
PHX::MDField<const ScalarT,Cell,QuadPoint> psiDot;
PHX::MDField<const MeshScalarT,Cell,Node,QuadPoint,Dim> wGradBF;
PHX::MDField<const ScalarT,Cell,QuadPoint,Dim> psiGrad;
PHX::MDField<const ScalarT,Cell,QuadPoint> V;
PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> coordVec;

bool enableTransient;
bool havePotential;
Expand Down
2 changes: 1 addition & 1 deletion src/QCAD/evaluators/QCAD_SchrodingerResid_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ evaluateFields(typename Traits::EvalData workset)
// **********************************************************************
template<typename EvalT, typename Traits> double
QCAD::SchrodingerResid<EvalT, Traits>::getInvEffMassFiniteWall(
const PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> & coord,
const PHX::MDField<const MeshScalarT,Cell,QuadPoint,Dim> & coord,
const int cell, const int qp )
{
double effMass;
Expand Down
4 changes: 2 additions & 2 deletions src/evaluators/PHAL_JouleHeating.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class JouleHeating :
std::size_t numDims;

// Inputs
PHX::MDField<ScalarT,Cell,QuadPoint,Dim> potentialGrad;
PHX::MDField<ScalarT,Cell,QuadPoint,Dim> potentialFlux;
PHX::MDField<const ScalarT,Cell,QuadPoint,Dim> potentialGrad;
PHX::MDField<const ScalarT,Cell,QuadPoint,Dim> potentialFlux;

// Outputs
PHX::MDField<ScalarT,Cell,QuadPoint> jouleHeating;
Expand Down

0 comments on commit 5647db4

Please sign in to comment.