mirror of https://github.com/lammps/lammps.git
replace tabs and remove trailing whitespace in lib folder with updated script
This commit is contained in:
parent
30821b37e5
commit
92b5b159e5
|
@ -3,7 +3,7 @@ LAMMPS, if particular packages are included in the LAMMPS build.
|
||||||
|
|
||||||
Most of these directories contain code for the library; some contain
|
Most of these directories contain code for the library; some contain
|
||||||
a Makefile.lammps file that points to where the library is installed
|
a Makefile.lammps file that points to where the library is installed
|
||||||
elsewhere on your system.
|
elsewhere on your system.
|
||||||
|
|
||||||
In either case, the library itself must be installed and/or built
|
In either case, the library itself must be installed and/or built
|
||||||
first, so that the appropriate library files exist for LAMMPS to link
|
first, so that the appropriate library files exist for LAMMPS to link
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,16 +20,16 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ATC_Coupling
|
* @class ATC_Coupling
|
||||||
* @brief Base class for atom-continuum coupling
|
* @brief Base class for atom-continuum coupling
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ATC_Coupling : public ATC_Method {
|
class ATC_Coupling : public ATC_Method {
|
||||||
|
|
||||||
public: /** methods */
|
public: /** methods */
|
||||||
|
|
||||||
friend class ExtrinsicModel; // friend is not inherited
|
friend class ExtrinsicModel; // friend is not inherited
|
||||||
friend class ExtrinsicModelTwoTemperature;
|
friend class ExtrinsicModelTwoTemperature;
|
||||||
friend class ExtrinsicModelDriftDiffusion;
|
friend class ExtrinsicModelDriftDiffusion;
|
||||||
friend class ExtrinsicModelDriftDiffusionConvection;
|
friend class ExtrinsicModelDriftDiffusionConvection;
|
||||||
friend class ExtrinsicModelElectrostatic;
|
friend class ExtrinsicModelElectrostatic;
|
||||||
friend class ExtrinsicModelElectrostaticMomentum;
|
friend class ExtrinsicModelElectrostaticMomentum;
|
||||||
|
@ -72,13 +72,13 @@ namespace ATC {
|
||||||
virtual void pre_init_integrate();
|
virtual void pre_init_integrate();
|
||||||
|
|
||||||
/** Predictor phase, Verlet first step for velocity and position */
|
/** Predictor phase, Verlet first step for velocity and position */
|
||||||
virtual void init_integrate();
|
virtual void init_integrate();
|
||||||
|
|
||||||
/** Predictor phase, executed after Verlet */
|
/** Predictor phase, executed after Verlet */
|
||||||
virtual void post_init_integrate();
|
virtual void post_init_integrate();
|
||||||
|
|
||||||
/** Corrector phase, executed after Verlet*/
|
/** Corrector phase, executed after Verlet*/
|
||||||
|
|
||||||
virtual void post_final_integrate();
|
virtual void post_final_integrate();
|
||||||
|
|
||||||
/** pre/post atomic force calculation in minimize */
|
/** pre/post atomic force calculation in minimize */
|
||||||
|
@ -95,9 +95,9 @@ namespace ATC {
|
||||||
const std::set<std::string> & boundary_face_names() {return boundaryFaceNames_;};
|
const std::set<std::string> & boundary_face_names() {return boundaryFaceNames_;};
|
||||||
/** access to boundary integration method */
|
/** access to boundary integration method */
|
||||||
int boundary_integration_type() {return bndyIntType_;};
|
int boundary_integration_type() {return bndyIntType_;};
|
||||||
void set_boundary_integration_type(int boundaryIntegrationType)
|
void set_boundary_integration_type(int boundaryIntegrationType)
|
||||||
{bndyIntType_ = boundaryIntegrationType;};
|
{bndyIntType_ = boundaryIntegrationType;};
|
||||||
void set_boundary_face_set(const std::set< std::pair<int,int> > * boundaryFaceSet)
|
void set_boundary_face_set(const std::set< std::pair<int,int> > * boundaryFaceSet)
|
||||||
{bndyFaceSet_ = boundaryFaceSet;};
|
{bndyFaceSet_ = boundaryFaceSet;};
|
||||||
BoundaryIntegrationType parse_boundary_integration
|
BoundaryIntegrationType parse_boundary_integration
|
||||||
(int narg, char **arg, const std::set< std::pair<int,int> > * boundaryFaceSet);
|
(int narg, char **arg, const std::set< std::pair<int,int> > * boundaryFaceSet);
|
||||||
|
@ -107,10 +107,10 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
/** access to all boundary fluxes */
|
/** access to all boundary fluxes */
|
||||||
FIELDS &boundary_fluxes() {return boundaryFlux_;};
|
FIELDS &boundary_fluxes() {return boundaryFlux_;};
|
||||||
/** wrapper for FE_Engine's compute_boundary_flux functions */
|
/** wrapper for FE_Engine's compute_boundary_flux functions */
|
||||||
void compute_boundary_flux(const Array2D<bool> & rhs_mask,
|
void compute_boundary_flux(const Array2D<bool> & rhs_mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
FIELDS &rhs,
|
FIELDS &rhs,
|
||||||
const Array< std::set <int> > atomMaterialGroups,
|
const Array< std::set <int> > atomMaterialGroups,
|
||||||
const VectorDependencyManager<SPAR_MAT * > * shpFcnDerivs,
|
const VectorDependencyManager<SPAR_MAT * > * shpFcnDerivs,
|
||||||
|
@ -128,12 +128,12 @@ namespace ATC {
|
||||||
|
|
||||||
DENS_MAN &field_rhs(FieldName thisField) { return rhs_[thisField]; };
|
DENS_MAN &field_rhs(FieldName thisField) { return rhs_[thisField]; };
|
||||||
/** allow FE_Engine to construct ATC structures after mesh is constructed */
|
/** allow FE_Engine to construct ATC structures after mesh is constructed */
|
||||||
virtual void initialize_mesh_data(void);
|
virtual void initialize_mesh_data(void);
|
||||||
|
|
||||||
// public for FieldIntegrator
|
// public for FieldIntegrator
|
||||||
bool source_atomic_quadrature(FieldName /* field */)
|
bool source_atomic_quadrature(FieldName /* field */)
|
||||||
{ return (sourceIntegration_ == FULL_DOMAIN_ATOMIC_QUADRATURE_SOURCE); }
|
{ return (sourceIntegration_ == FULL_DOMAIN_ATOMIC_QUADRATURE_SOURCE); }
|
||||||
ATC::IntegrationDomainType source_integration()
|
ATC::IntegrationDomainType source_integration()
|
||||||
{ return sourceIntegration_; }
|
{ return sourceIntegration_; }
|
||||||
|
|
||||||
/** wrapper for FE_Engine's compute_sources */
|
/** wrapper for FE_Engine's compute_sources */
|
||||||
|
@ -143,25 +143,25 @@ namespace ATC {
|
||||||
FIELD_MATS & atomicSources);
|
FIELD_MATS & atomicSources);
|
||||||
/** computes tangent matrix using atomic quadrature near FE region */
|
/** computes tangent matrix using atomic quadrature near FE region */
|
||||||
void masked_atom_domain_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
|
void masked_atom_domain_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
|
||||||
const RHS_MASK & rhsMask,
|
const RHS_MASK & rhsMask,
|
||||||
const FIELDS & fields,
|
const FIELDS & fields,
|
||||||
SPAR_MAT & stiffness,
|
SPAR_MAT & stiffness,
|
||||||
const PhysicsModel * physicsModel);
|
const PhysicsModel * physicsModel);
|
||||||
/** wrapper for FE_Engine's compute_rhs_vector functions */
|
/** wrapper for FE_Engine's compute_rhs_vector functions */
|
||||||
void compute_rhs_vector(const RHS_MASK & rhs_mask,
|
void compute_rhs_vector(const RHS_MASK & rhs_mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
FIELDS &rhs,
|
FIELDS &rhs,
|
||||||
const IntegrationDomainType domain, // = FULL_DOMAIN
|
const IntegrationDomainType domain, // = FULL_DOMAIN
|
||||||
const PhysicsModel * physicsModel=nullptr);
|
const PhysicsModel * physicsModel=nullptr);
|
||||||
/** wrapper for FE_Engine's compute_tangent_matrix */
|
/** wrapper for FE_Engine's compute_tangent_matrix */
|
||||||
void compute_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
|
void compute_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
|
||||||
const RHS_MASK & rhsMask,
|
const RHS_MASK & rhsMask,
|
||||||
const FIELDS & fields,
|
const FIELDS & fields,
|
||||||
SPAR_MAT & stiffness,
|
SPAR_MAT & stiffness,
|
||||||
const IntegrationDomainType integrationType,
|
const IntegrationDomainType integrationType,
|
||||||
const PhysicsModel * physicsModel=nullptr);
|
const PhysicsModel * physicsModel=nullptr);
|
||||||
void tangent_matrix(const std::pair<FieldName,FieldName> row_col,
|
void tangent_matrix(const std::pair<FieldName,FieldName> row_col,
|
||||||
const RHS_MASK & rhsMask,
|
const RHS_MASK & rhsMask,
|
||||||
const PhysicsModel * physicsModel,
|
const PhysicsModel * physicsModel,
|
||||||
SPAR_MAT & stiffness);
|
SPAR_MAT & stiffness);
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ namespace ATC {
|
||||||
|
|
||||||
// public for ImplicitSolveOperator
|
// public for ImplicitSolveOperator
|
||||||
/** return pointer to PrescribedDataManager */
|
/** return pointer to PrescribedDataManager */
|
||||||
PrescribedDataManager * prescribed_data_manager()
|
PrescribedDataManager * prescribed_data_manager()
|
||||||
{ return prescribedDataMgr_; }
|
{ return prescribedDataMgr_; }
|
||||||
// public for Kinetostat
|
// public for Kinetostat
|
||||||
// TODO rename to "mass_matrix"
|
// TODO rename to "mass_matrix"
|
||||||
|
@ -228,7 +228,7 @@ namespace ATC {
|
||||||
void set_mass_mat_time_filter(FieldName thisField,TimeFilterManager::FilterIntegrationType filterIntegrationType);
|
void set_mass_mat_time_filter(FieldName thisField,TimeFilterManager::FilterIntegrationType filterIntegrationType);
|
||||||
|
|
||||||
/** return reference to ExtrinsicModelManager */
|
/** return reference to ExtrinsicModelManager */
|
||||||
ExtrinsicModelManager & extrinsic_model_manager()
|
ExtrinsicModelManager & extrinsic_model_manager()
|
||||||
{ return extrinsicModelManager_; }
|
{ return extrinsicModelManager_; }
|
||||||
/** access to time integrator */
|
/** access to time integrator */
|
||||||
const TimeIntegrator * time_integrator(const FieldName & field) const {
|
const TimeIntegrator * time_integrator(const FieldName & field) const {
|
||||||
|
@ -242,7 +242,7 @@ namespace ATC {
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** allow FE_Engine to construct data manager after mesh is constructed */
|
/** allow FE_Engine to construct data manager after mesh is constructed */
|
||||||
void construct_prescribed_data_manager (void);
|
void construct_prescribed_data_manager (void);
|
||||||
/** method to create physics model */
|
/** method to create physics model */
|
||||||
void create_physics_model(const PhysicsType & physicsType,
|
void create_physics_model(const PhysicsType & physicsType,
|
||||||
std::string matFileName);
|
std::string matFileName);
|
||||||
|
@ -289,7 +289,7 @@ namespace ATC {
|
||||||
void set_sources();
|
void set_sources();
|
||||||
/** assemble various contributions to the heat flux in the atomic region */
|
/** assemble various contributions to the heat flux in the atomic region */
|
||||||
void compute_atomic_sources(const Array2D<bool> & rhs_mask,
|
void compute_atomic_sources(const Array2D<bool> & rhs_mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
FIELDS &atomicSources);
|
FIELDS &atomicSources);
|
||||||
|
|
||||||
DENS_MAT &get_source(FieldName thisField){return sources_[thisField].set_quantity();};
|
DENS_MAT &get_source(FieldName thisField){return sources_[thisField].set_quantity();};
|
||||||
|
@ -313,25 +313,25 @@ namespace ATC {
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** access for field mask */
|
/** access for field mask */
|
||||||
Array2D<bool> &field_mask() {return fieldMask_;};
|
Array2D<bool> &field_mask() {return fieldMask_;};
|
||||||
/** create field mask */
|
/** create field mask */
|
||||||
void reset_flux_mask();
|
void reset_flux_mask();
|
||||||
/** field mask for intrinsic integration */
|
/** field mask for intrinsic integration */
|
||||||
Array2D<bool> intrinsicMask_;
|
Array2D<bool> intrinsicMask_;
|
||||||
/** wrapper for FE_Engine's compute_flux functions */
|
/** wrapper for FE_Engine's compute_flux functions */
|
||||||
void compute_flux(const Array2D<bool> & rhs_mask,
|
void compute_flux(const Array2D<bool> & rhs_mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
GRAD_FIELD_MATS &flux,
|
GRAD_FIELD_MATS &flux,
|
||||||
const PhysicsModel * physicsModel=nullptr,
|
const PhysicsModel * physicsModel=nullptr,
|
||||||
const bool normalize = false);
|
const bool normalize = false);
|
||||||
/** evaluate rhs on the atomic domain which is near the FE region */
|
/** evaluate rhs on the atomic domain which is near the FE region */
|
||||||
void masked_atom_domain_rhs_integral(const Array2D<bool> & rhs_mask,
|
void masked_atom_domain_rhs_integral(const Array2D<bool> & rhs_mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
FIELDS &rhs,
|
FIELDS &rhs,
|
||||||
const PhysicsModel * physicsModel);
|
const PhysicsModel * physicsModel);
|
||||||
/** evaluate rhs on a specified domain defined by mask and physics model */
|
/** evaluate rhs on a specified domain defined by mask and physics model */
|
||||||
void evaluate_rhs_integral(const Array2D<bool> & rhs_mask,
|
void evaluate_rhs_integral(const Array2D<bool> & rhs_mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
FIELDS &rhs,
|
FIELDS &rhs,
|
||||||
const IntegrationDomainType domain,
|
const IntegrationDomainType domain,
|
||||||
const PhysicsModel * physicsModel=nullptr);
|
const PhysicsModel * physicsModel=nullptr);
|
||||||
|
@ -422,8 +422,8 @@ namespace ATC {
|
||||||
/*@{*/
|
/*@{*/
|
||||||
Array<int> elementToMaterialMap_; // ATOMIC_TAG * elementToMaterialMap_;
|
Array<int> elementToMaterialMap_; // ATOMIC_TAG * elementToMaterialMap_;
|
||||||
/** atomic ATC material tag */
|
/** atomic ATC material tag */
|
||||||
|
|
||||||
|
|
||||||
Array< std::set <int> > atomMaterialGroups_; // ATOMIC_TAG*atomMaterialGroups_;
|
Array< std::set <int> > atomMaterialGroups_; // ATOMIC_TAG*atomMaterialGroups_;
|
||||||
Array< std::set <int> > atomMaterialGroupsMask_; // ATOMIC_TAG*atomMaterialGroupsMask_;
|
Array< std::set <int> > atomMaterialGroupsMask_; // ATOMIC_TAG*atomMaterialGroupsMask_;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
@ -432,7 +432,7 @@ namespace ATC {
|
||||||
/** computational geometry */
|
/** computational geometry */
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/*@{*/
|
/*@{*/
|
||||||
bool atomQuadForInternal_;
|
bool atomQuadForInternal_;
|
||||||
MatrixDependencyManager<DenseMatrix, bool> * elementMask_;
|
MatrixDependencyManager<DenseMatrix, bool> * elementMask_;
|
||||||
MatrixDependencyManager<DenseMatrix, bool> * elementMaskMass_;
|
MatrixDependencyManager<DenseMatrix, bool> * elementMaskMass_;
|
||||||
MatrixDependencyManager<DenseMatrix, bool> * elementMaskMassMd_;
|
MatrixDependencyManager<DenseMatrix, bool> * elementMaskMassMd_;
|
||||||
|
@ -465,7 +465,7 @@ namespace ATC {
|
||||||
DIAG_MAN * atomicWeightsMask_;
|
DIAG_MAN * atomicWeightsMask_;
|
||||||
SPAR_MAN * shpFcnMask_;
|
SPAR_MAN * shpFcnMask_;
|
||||||
VectorDependencyManager<SPAR_MAT * > * shpFcnDerivsMask_;
|
VectorDependencyManager<SPAR_MAT * > * shpFcnDerivsMask_;
|
||||||
Array<bool> atomMask_;
|
Array<bool> atomMask_;
|
||||||
SPAR_MAN atomToOverlapMat_;
|
SPAR_MAN atomToOverlapMat_;
|
||||||
DIAG_MAN nodalMaskMat_;
|
DIAG_MAN nodalMaskMat_;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
@ -475,7 +475,7 @@ namespace ATC {
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** mask for computation of fluxes */
|
/** mask for computation of fluxes */
|
||||||
Array2D<bool> fieldMask_;
|
Array2D<bool> fieldMask_;
|
||||||
DIAG_MAT fluxMask_;
|
DIAG_MAT fluxMask_;
|
||||||
DIAG_MAT fluxMaskComplement_;
|
DIAG_MAT fluxMaskComplement_;
|
||||||
/** sources */
|
/** sources */
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace ATC {
|
||||||
// Class ATC_CouplingEnergy
|
// Class ATC_CouplingEnergy
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -33,18 +33,18 @@ namespace ATC {
|
||||||
nodalAtomicKineticTemperature_(nullptr),
|
nodalAtomicKineticTemperature_(nullptr),
|
||||||
nodalAtomicConfigurationalTemperature_(nullptr)
|
nodalAtomicConfigurationalTemperature_(nullptr)
|
||||||
{
|
{
|
||||||
// Allocate PhysicsModel
|
// Allocate PhysicsModel
|
||||||
create_physics_model(THERMAL, matParamFile);
|
create_physics_model(THERMAL, matParamFile);
|
||||||
|
|
||||||
// create extrinsic physics model
|
// create extrinsic physics model
|
||||||
if (extrinsicModel != NO_MODEL) {
|
if (extrinsicModel != NO_MODEL) {
|
||||||
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
set_time();
|
set_time();
|
||||||
bndyIntType_ = FE_INTERPOLATION;
|
bndyIntType_ = FE_INTERPOLATION;
|
||||||
|
|
||||||
// set up field data based on physicsModel
|
// set up field data based on physicsModel
|
||||||
physicsModel_->num_fields(fieldSizes_,fieldMask_);
|
physicsModel_->num_fields(fieldSizes_,fieldMask_);
|
||||||
|
|
||||||
|
@ -182,16 +182,16 @@ namespace ATC {
|
||||||
// register the per-atom quantity for the temperature definition
|
// register the per-atom quantity for the temperature definition
|
||||||
interscaleManager_.add_per_atom_quantity(atomEnergyForTemperature,
|
interscaleManager_.add_per_atom_quantity(atomEnergyForTemperature,
|
||||||
"AtomicEnergyForTemperature");
|
"AtomicEnergyForTemperature");
|
||||||
|
|
||||||
// nodal restriction of the atomic energy quantity for the temperature definition
|
// nodal restriction of the atomic energy quantity for the temperature definition
|
||||||
AtfShapeFunctionRestriction * nodalAtomicEnergy = new AtfShapeFunctionRestriction(this,
|
AtfShapeFunctionRestriction * nodalAtomicEnergy = new AtfShapeFunctionRestriction(this,
|
||||||
atomEnergyForTemperature,
|
atomEnergyForTemperature,
|
||||||
shpFcn_);
|
shpFcn_);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicEnergy,
|
interscaleManager_.add_dense_matrix(nodalAtomicEnergy,
|
||||||
"NodalAtomicEnergy");
|
"NodalAtomicEnergy");
|
||||||
|
|
||||||
// nodal atomic temperature field
|
// nodal atomic temperature field
|
||||||
|
|
||||||
AtfShapeFunctionMdProjection * nodalAtomicTemperature = new AtfShapeFunctionMdProjection(this,
|
AtfShapeFunctionMdProjection * nodalAtomicTemperature = new AtfShapeFunctionMdProjection(this,
|
||||||
nodalAtomicEnergy,
|
nodalAtomicEnergy,
|
||||||
TEMPERATURE);
|
TEMPERATURE);
|
||||||
|
@ -210,18 +210,18 @@ namespace ATC {
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
void ATC_CouplingEnergy::init_filter()
|
void ATC_CouplingEnergy::init_filter()
|
||||||
{
|
{
|
||||||
|
|
||||||
TimeIntegrator::TimeIntegrationType timeIntegrationType = timeIntegrators_[TEMPERATURE]->time_integration_type();
|
TimeIntegrator::TimeIntegrationType timeIntegrationType = timeIntegrators_[TEMPERATURE]->time_integration_type();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (timeFilterManager_.end_equilibrate()) {
|
if (timeFilterManager_.end_equilibrate()) {
|
||||||
if (timeIntegrationType==TimeIntegrator::GEAR) {
|
if (timeIntegrationType==TimeIntegrator::GEAR) {
|
||||||
if (equilibriumStart_) {
|
if (equilibriumStart_) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (atomicRegulator_->regulator_target()==AtomicRegulator::DYNAMICS) { // based on FE equation
|
if (atomicRegulator_->regulator_target()==AtomicRegulator::DYNAMICS) { // based on FE equation
|
||||||
DENS_MAT vdotflamMat(-2.*(nodalAtomicFields_[TEMPERATURE].quantity())); // note 2 is for 1/2 vdotflam addition
|
DENS_MAT vdotflamMat(-2.*(nodalAtomicFields_[TEMPERATURE].quantity())); // note 2 is for 1/2 vdotflam addition
|
||||||
atomicRegulator_->reset_lambda_contribution(vdotflamMat);
|
atomicRegulator_->reset_lambda_contribution(vdotflamMat);
|
||||||
|
@ -249,7 +249,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
bool foundMatch = false;
|
bool foundMatch = false;
|
||||||
int argIndx = 0;
|
int argIndx = 0;
|
||||||
|
|
||||||
// check to see if input is a transfer class command
|
// check to see if input is a transfer class command
|
||||||
// check derived class before base class
|
// check derived class before base class
|
||||||
|
|
||||||
|
@ -311,19 +311,19 @@ namespace ATC {
|
||||||
// output[2] = average temperature
|
// output[2] = average temperature
|
||||||
|
|
||||||
double mvv2e = lammpsInterface_->mvv2e(); // convert to lammps energy units
|
double mvv2e = lammpsInterface_->mvv2e(); // convert to lammps energy units
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
Array<FieldName> mask(1);
|
Array<FieldName> mask(1);
|
||||||
FIELD_MATS energy;
|
FIELD_MATS energy;
|
||||||
mask(0) = TEMPERATURE;
|
mask(0) = TEMPERATURE;
|
||||||
|
|
||||||
feEngine_->compute_energy(mask,
|
feEngine_->compute_energy(mask,
|
||||||
fields_,
|
fields_,
|
||||||
physicsModel_,
|
physicsModel_,
|
||||||
elementToMaterialMap_,
|
elementToMaterialMap_,
|
||||||
energy,
|
energy,
|
||||||
&(elementMask_->quantity()));
|
&(elementMask_->quantity()));
|
||||||
|
|
||||||
double phononEnergy = mvv2e * energy[TEMPERATURE].col_sum();
|
double phononEnergy = mvv2e * energy[TEMPERATURE].col_sum();
|
||||||
return phononEnergy;
|
return phononEnergy;
|
||||||
}
|
}
|
||||||
|
@ -353,9 +353,9 @@ namespace ATC {
|
||||||
_keTemp_ = nodalAtomicKineticTemperature_->quantity();
|
_keTemp_ = nodalAtomicKineticTemperature_->quantity();
|
||||||
if (nodalAtomicConfigurationalTemperature_)
|
if (nodalAtomicConfigurationalTemperature_)
|
||||||
_peTemp_ = nodalAtomicConfigurationalTemperature_->quantity();
|
_peTemp_ = nodalAtomicConfigurationalTemperature_->quantity();
|
||||||
|
|
||||||
OUTPUT_LIST outputData;
|
OUTPUT_LIST outputData;
|
||||||
|
|
||||||
// base class output
|
// base class output
|
||||||
ATC_Method::output();
|
ATC_Method::output();
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
atomicRegulator_->output(outputData);
|
atomicRegulator_->output(outputData);
|
||||||
extrinsicModelManager_.output(outputData);
|
extrinsicModelManager_.output(outputData);
|
||||||
|
|
||||||
DENS_MAT & temperature(nodalAtomicFields_[TEMPERATURE].set_quantity());
|
DENS_MAT & temperature(nodalAtomicFields_[TEMPERATURE].set_quantity());
|
||||||
DENS_MAT & dotTemperature(dot_fields_[TEMPERATURE].set_quantity());
|
DENS_MAT & dotTemperature(dot_fields_[TEMPERATURE].set_quantity());
|
||||||
DENS_MAT & ddotTemperature(ddot_fields_[TEMPERATURE].set_quantity());
|
DENS_MAT & ddotTemperature(ddot_fields_[TEMPERATURE].set_quantity());
|
||||||
|
@ -384,18 +384,18 @@ namespace ATC {
|
||||||
feEngine_->add_global("temperature_std_dev", T_stddev);
|
feEngine_->add_global("temperature_std_dev", T_stddev);
|
||||||
double Ta_mean = (nodalAtomicFields_[TEMPERATURE].quantity()).col_sum(0)/nNodes_;
|
double Ta_mean = (nodalAtomicFields_[TEMPERATURE].quantity()).col_sum(0)/nNodes_;
|
||||||
feEngine_->add_global("atomic_temperature_mean", Ta_mean);
|
feEngine_->add_global("atomic_temperature_mean", Ta_mean);
|
||||||
double Ta_stddev = (nodalAtomicFields_[TEMPERATURE].quantity()).col_stdev(0);
|
double Ta_stddev = (nodalAtomicFields_[TEMPERATURE].quantity()).col_stdev(0);
|
||||||
feEngine_->add_global("atomic_temperature_std_dev", Ta_stddev);
|
feEngine_->add_global("atomic_temperature_std_dev", Ta_stddev);
|
||||||
|
|
||||||
// different temperature measures, if appropriate
|
// different temperature measures, if appropriate
|
||||||
if (nodalAtomicKineticTemperature_)
|
if (nodalAtomicKineticTemperature_)
|
||||||
outputData["kinetic_temperature"] = & _keTemp_;
|
outputData["kinetic_temperature"] = & _keTemp_;
|
||||||
|
|
||||||
if (nodalAtomicConfigurationalTemperature_) {
|
if (nodalAtomicConfigurationalTemperature_) {
|
||||||
_peTemp_ *= 2; // account for full temperature
|
_peTemp_ *= 2; // account for full temperature
|
||||||
outputData["configurational_temperature"] = & _peTemp_;
|
outputData["configurational_temperature"] = & _peTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mesh data
|
// mesh data
|
||||||
outputData["NodalAtomicTemperature"] = &temperature;
|
outputData["NodalAtomicTemperature"] = &temperature;
|
||||||
outputData["dot_temperature"] = &dotTemperature;
|
outputData["dot_temperature"] = &dotTemperature;
|
||||||
|
|
|
@ -25,9 +25,9 @@ namespace ATC {
|
||||||
class ATC_CouplingEnergy : public ATC_Coupling {
|
class ATC_CouplingEnergy : public ATC_Coupling {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ATC_CouplingEnergy(std::string groupName,
|
ATC_CouplingEnergy(std::string groupName,
|
||||||
double ** & perAtomArray,
|
double ** & perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
std::string matParamFile,
|
std::string matParamFile,
|
||||||
|
@ -64,7 +64,7 @@ namespace ATC {
|
||||||
/** physics specific filter initialization */
|
/** physics specific filter initialization */
|
||||||
void init_filter();
|
void init_filter();
|
||||||
|
|
||||||
|
|
||||||
double compute_lambda_power(int gid);
|
double compute_lambda_power(int gid);
|
||||||
|
|
||||||
/** kinetic temperature for post-processing */
|
/** kinetic temperature for post-processing */
|
||||||
|
@ -77,6 +77,6 @@ namespace ATC {
|
||||||
DENS_MAT _keTemp_, _peTemp_;
|
DENS_MAT _keTemp_, _peTemp_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,11 +31,11 @@ namespace ATC {
|
||||||
// Class ATC_CouplingMass
|
// Class ATC_CouplingMass
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ATC_CouplingMass::ATC_CouplingMass(string groupName,
|
ATC_CouplingMass::ATC_CouplingMass(string groupName,
|
||||||
double **& perAtomArray,
|
double **& perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
string matParamFile,
|
string matParamFile,
|
||||||
|
@ -43,19 +43,19 @@ namespace ATC {
|
||||||
: ATC_Coupling(groupName,perAtomArray,thisFix),
|
: ATC_Coupling(groupName,perAtomArray,thisFix),
|
||||||
resetNlocal_(false)
|
resetNlocal_(false)
|
||||||
{
|
{
|
||||||
// Allocate PhysicsModel
|
// Allocate PhysicsModel
|
||||||
create_physics_model(SPECIES, matParamFile);
|
create_physics_model(SPECIES, matParamFile);
|
||||||
|
|
||||||
// create extrinsic physics model
|
// create extrinsic physics model
|
||||||
if (extrinsicModel != NO_MODEL) {
|
if (extrinsicModel != NO_MODEL) {
|
||||||
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
set_time();
|
set_time();
|
||||||
bndyIntType_ = NO_QUADRATURE;
|
bndyIntType_ = NO_QUADRATURE;
|
||||||
|
|
||||||
|
|
||||||
// set up field data based on physicsModel
|
// set up field data based on physicsModel
|
||||||
physicsModel_->num_fields(fieldSizes_,fieldMask_);
|
physicsModel_->num_fields(fieldSizes_,fieldMask_);
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify
|
// modify
|
||||||
// parses inputs and modifies state
|
// parses inputs and modifies state
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool ATC_CouplingMass::modify(int narg, char **arg)
|
bool ATC_CouplingMass::modify(int narg, char **arg)
|
||||||
{
|
{
|
||||||
bool match = false;
|
bool match = false;
|
||||||
// check to see if it is a transfer class command
|
// check to see if it is a transfer class command
|
||||||
|
|
||||||
// check derived class before base class
|
// check derived class before base class
|
||||||
int argIndex = 0;
|
int argIndex = 0;
|
||||||
// pass-through to concentration regulator
|
// pass-through to concentration regulator
|
||||||
|
@ -117,7 +117,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ATC_CouplingMass::initialize()
|
void ATC_CouplingMass::initialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
fieldSizes_[SPECIES_CONCENTRATION] = ntracked();
|
fieldSizes_[SPECIES_CONCENTRATION] = ntracked();
|
||||||
|
|
||||||
// Base class initalizations
|
// Base class initalizations
|
||||||
|
@ -135,9 +135,9 @@ namespace ATC {
|
||||||
FieldManager fmgr(this);
|
FieldManager fmgr(this);
|
||||||
atomicFields_[MASS_DENSITY] = fmgr.nodal_atomic_field(MASS_DENSITY, field_to_intrinsic_name(MASS_DENSITY));
|
atomicFields_[MASS_DENSITY] = fmgr.nodal_atomic_field(MASS_DENSITY, field_to_intrinsic_name(MASS_DENSITY));
|
||||||
|
|
||||||
if (has_tracked_species()) {
|
if (has_tracked_species()) {
|
||||||
atomicFields_[SPECIES_CONCENTRATION] = fmgr.nodal_atomic_field(SPECIES_CONCENTRATION, field_to_intrinsic_name(SPECIES_CONCENTRATION));
|
atomicFields_[SPECIES_CONCENTRATION] = fmgr.nodal_atomic_field(SPECIES_CONCENTRATION, field_to_intrinsic_name(SPECIES_CONCENTRATION));
|
||||||
|
|
||||||
//if (atomicRegulator_->needs_temperature()) {
|
//if (atomicRegulator_->needs_temperature()) {
|
||||||
|
|
||||||
atomicFields_[TEMPERATURE] = fmgr.nodal_atomic_field(KINETIC_TEMPERATURE, field_to_intrinsic_name(TEMPERATURE));
|
atomicFields_[TEMPERATURE] = fmgr.nodal_atomic_field(KINETIC_TEMPERATURE, field_to_intrinsic_name(TEMPERATURE));
|
||||||
|
@ -146,7 +146,7 @@ namespace ATC {
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
throw ATC_Error("ATC_CouplingMass: no tracked species");
|
throw ATC_Error("ATC_CouplingMass: no tracked species");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,14 +161,14 @@ namespace ATC {
|
||||||
const string moleculeName = molecule->first;
|
const string moleculeName = molecule->first;
|
||||||
SmallMoleculeSet * smallMoleculeSet = interscaleManager_.small_molecule_set(moleculeName);
|
SmallMoleculeSet * smallMoleculeSet = interscaleManager_.small_molecule_set(moleculeName);
|
||||||
SPAR_MAN * shpFcnMol = interscaleManager_.sparse_matrix("ShapeFunction"+moleculeName);
|
SPAR_MAN * shpFcnMol = interscaleManager_.sparse_matrix("ShapeFunction"+moleculeName);
|
||||||
AtomToSmallMoleculeTransfer<double> * moleculeMass =
|
AtomToSmallMoleculeTransfer<double> * moleculeMass =
|
||||||
new AtomToSmallMoleculeTransfer<double>(this,mass,smallMoleculeSet);
|
new AtomToSmallMoleculeTransfer<double>(this,mass,smallMoleculeSet);
|
||||||
interscaleManager_.add_dense_matrix(moleculeMass,"MoleculeMass"+moleculeName);
|
interscaleManager_.add_dense_matrix(moleculeMass,"MoleculeMass"+moleculeName);
|
||||||
MotfShapeFunctionRestriction * nodalAtomicMoleculeMass =
|
MotfShapeFunctionRestriction * nodalAtomicMoleculeMass =
|
||||||
new MotfShapeFunctionRestriction(moleculeMass,shpFcnMol);
|
new MotfShapeFunctionRestriction(moleculeMass,shpFcnMol);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicMoleculeMass,"NodalMoleculeMass"+moleculeName);
|
interscaleManager_.add_dense_matrix(nodalAtomicMoleculeMass,"NodalMoleculeMass"+moleculeName);
|
||||||
|
|
||||||
|
|
||||||
AtfShapeFunctionMdProjection * nodalAtomicMoleculeMassDensity =
|
AtfShapeFunctionMdProjection * nodalAtomicMoleculeMassDensity =
|
||||||
new AtfShapeFunctionMdProjection(this,nodalAtomicMoleculeMass,MASS_DENSITY);
|
new AtfShapeFunctionMdProjection(this,nodalAtomicMoleculeMass,MASS_DENSITY);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicMoleculeMassDensity,"NodalMoleculeMassDensity"+moleculeName);
|
interscaleManager_.add_dense_matrix(nodalAtomicMoleculeMassDensity,"NodalMoleculeMassDensity"+moleculeName);
|
||||||
|
@ -180,7 +180,7 @@ namespace ATC {
|
||||||
|
|
||||||
void ATC_CouplingMass::init_filter()
|
void ATC_CouplingMass::init_filter()
|
||||||
{
|
{
|
||||||
|
|
||||||
ATC_Coupling::init_filter();
|
ATC_Coupling::init_filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,11 +192,11 @@ namespace ATC {
|
||||||
void ATC_CouplingMass::pre_exchange()
|
void ATC_CouplingMass::pre_exchange()
|
||||||
{
|
{
|
||||||
ATC_Coupling::pre_exchange();
|
ATC_Coupling::pre_exchange();
|
||||||
|
|
||||||
//if (atomicRegulator_->needs_temperature()) {
|
//if (atomicRegulator_->needs_temperature()) {
|
||||||
field(TEMPERATURE) = atomicFields_[TEMPERATURE]->quantity();
|
field(TEMPERATURE) = atomicFields_[TEMPERATURE]->quantity();
|
||||||
///}
|
///}
|
||||||
atomicRegulator_->pre_exchange();
|
atomicRegulator_->pre_exchange();
|
||||||
if (resetNlocal_) {
|
if (resetNlocal_) {
|
||||||
this->reset_nlocal();
|
this->reset_nlocal();
|
||||||
resetNlocal_ = false;
|
resetNlocal_ = false;
|
||||||
|
@ -208,7 +208,7 @@ namespace ATC {
|
||||||
// does post-processing steps and outputs data
|
// does post-processing steps and outputs data
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ATC_CouplingMass::output()
|
void ATC_CouplingMass::output()
|
||||||
{
|
{
|
||||||
if (output_now()) {
|
if (output_now()) {
|
||||||
feEngine_->departition_mesh();
|
feEngine_->departition_mesh();
|
||||||
OUTPUT_LIST outputData;
|
OUTPUT_LIST outputData;
|
||||||
|
@ -226,10 +226,10 @@ namespace ATC {
|
||||||
(_tiIt_->second)->output(outputData);
|
(_tiIt_->second)->output(outputData);
|
||||||
}
|
}
|
||||||
extrinsicModelManager_.output(outputData);
|
extrinsicModelManager_.output(outputData);
|
||||||
atomicRegulator_->output(outputData);
|
atomicRegulator_->output(outputData);
|
||||||
|
|
||||||
FIELD_POINTERS::iterator itr;
|
FIELD_POINTERS::iterator itr;
|
||||||
for (itr=atomicFields_.begin(); itr!=atomicFields_.end();itr++) {
|
for (itr=atomicFields_.begin(); itr!=atomicFields_.end();itr++) {
|
||||||
FieldName name = itr->first;
|
FieldName name = itr->first;
|
||||||
const DENS_MAT & data = (itr->second)->quantity();
|
const DENS_MAT & data = (itr->second)->quantity();
|
||||||
outputData[field_to_intrinsic_name(name)] = & data;
|
outputData[field_to_intrinsic_name(name)] = & data;
|
||||||
|
|
|
@ -32,20 +32,20 @@ namespace ATC {
|
||||||
class ATC_CouplingMass : public ATC_Coupling {
|
class ATC_CouplingMass : public ATC_Coupling {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ATC_CouplingMass(std::string groupName,
|
ATC_CouplingMass(std::string groupName,
|
||||||
double **& perAtomArray,
|
double **& perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
std::string matParamFile,
|
std::string matParamFile,
|
||||||
ExtrinsicModelType extrinsic = NO_MODEL);
|
ExtrinsicModelType extrinsic = NO_MODEL);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~ATC_CouplingMass();
|
virtual ~ATC_CouplingMass();
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
virtual bool modify(int narg, char **arg);
|
virtual bool modify(int narg, char **arg);
|
||||||
|
|
||||||
/** pre time integration */
|
/** pre time integration */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ namespace ATC {
|
||||||
|
|
||||||
bool resetNlocal_;
|
bool resetNlocal_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// i.e. we only need the correct shape function matrix for restriction
|
// i.e. we only need the correct shape function matrix for restriction
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,11 @@ namespace ATC {
|
||||||
// Class ATC_CouplingMomentum
|
// Class ATC_CouplingMomentum
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ATC_CouplingMomentum::ATC_CouplingMomentum(string groupName,
|
ATC_CouplingMomentum::ATC_CouplingMomentum(string groupName,
|
||||||
double **& perAtomArray,
|
double **& perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
string matParamFile,
|
string matParamFile,
|
||||||
|
@ -35,14 +35,14 @@ namespace ATC {
|
||||||
: ATC_Coupling(groupName,perAtomArray,thisFix),
|
: ATC_Coupling(groupName,perAtomArray,thisFix),
|
||||||
refPE_(0)
|
refPE_(0)
|
||||||
{
|
{
|
||||||
// Allocate PhysicsModel
|
// Allocate PhysicsModel
|
||||||
create_physics_model(intrinsicModel, matParamFile);
|
create_physics_model(intrinsicModel, matParamFile);
|
||||||
|
|
||||||
// create extrinsic physics model
|
// create extrinsic physics model
|
||||||
if (extrinsicModel != NO_MODEL) {
|
if (extrinsicModel != NO_MODEL) {
|
||||||
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up field data based on physicsModel
|
// set up field data based on physicsModel
|
||||||
physicsModel_->num_fields(fieldSizes_,fieldMask_);
|
physicsModel_->num_fields(fieldSizes_,fieldMask_);
|
||||||
|
|
||||||
|
@ -166,14 +166,14 @@ namespace ATC {
|
||||||
atomicMassWeightedDisplacement = new AtomicMassWeightedDisplacement(this);
|
atomicMassWeightedDisplacement = new AtomicMassWeightedDisplacement(this);
|
||||||
interscaleManager_.add_per_atom_quantity(atomicMassWeightedDisplacement,
|
interscaleManager_.add_per_atom_quantity(atomicMassWeightedDisplacement,
|
||||||
"AtomicMassWeightedDisplacement");
|
"AtomicMassWeightedDisplacement");
|
||||||
|
|
||||||
// nodal (RHS) mass-weighted displacement
|
// nodal (RHS) mass-weighted displacement
|
||||||
AtfShapeFunctionRestriction * nodalAtomicMassWeightedDisplacement = new AtfShapeFunctionRestriction(this,
|
AtfShapeFunctionRestriction * nodalAtomicMassWeightedDisplacement = new AtfShapeFunctionRestriction(this,
|
||||||
atomicMassWeightedDisplacement,
|
atomicMassWeightedDisplacement,
|
||||||
shpFcn_);
|
shpFcn_);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicMassWeightedDisplacement,
|
interscaleManager_.add_dense_matrix(nodalAtomicMassWeightedDisplacement,
|
||||||
"NodalAtomicMassWeightedDisplacement");
|
"NodalAtomicMassWeightedDisplacement");
|
||||||
|
|
||||||
// nodal displacement derived only from atoms
|
// nodal displacement derived only from atoms
|
||||||
AtfShapeFunctionMdProjection * nodalAtomicDisplacement = new AtfShapeFunctionMdProjection(this,
|
AtfShapeFunctionMdProjection * nodalAtomicDisplacement = new AtfShapeFunctionMdProjection(this,
|
||||||
nodalAtomicMassWeightedDisplacement,
|
nodalAtomicMassWeightedDisplacement,
|
||||||
|
@ -194,7 +194,7 @@ namespace ATC {
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
void ATC_CouplingMomentum::init_filter()
|
void ATC_CouplingMomentum::init_filter()
|
||||||
{
|
{
|
||||||
|
|
||||||
ATC_Coupling::init_filter();
|
ATC_Coupling::init_filter();
|
||||||
|
|
||||||
if (timeFilterManager_.end_equilibrate() && equilibriumStart_) // set up correct initial lambda forces to enforce initial accerlation
|
if (timeFilterManager_.end_equilibrate() && equilibriumStart_) // set up correct initial lambda forces to enforce initial accerlation
|
||||||
|
@ -288,35 +288,35 @@ namespace ATC {
|
||||||
ATC_Method::min_post_force();
|
ATC_Method::min_post_force();
|
||||||
|
|
||||||
// Set sources
|
// Set sources
|
||||||
|
|
||||||
prescribedDataMgr_->set_sources(time(),sources_);
|
prescribedDataMgr_->set_sources(time(),sources_);
|
||||||
extrinsicModelManager_.set_sources(fields_,extrinsicSources_);
|
extrinsicModelManager_.set_sources(fields_,extrinsicSources_);
|
||||||
extrinsicModelManager_.pre_final_integrate();
|
extrinsicModelManager_.pre_final_integrate();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (outputNow_) {
|
if (outputNow_) {
|
||||||
update_time(1.0);
|
update_time(1.0);
|
||||||
update_step();
|
update_step();
|
||||||
output();
|
output();
|
||||||
outputNow_ = false;
|
outputNow_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
localStep_ += 1;
|
localStep_ += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// output
|
// output
|
||||||
// does post-processing steps and outputs data
|
// does post-processing steps and outputs data
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ATC_CouplingMomentum::output()
|
void ATC_CouplingMomentum::output()
|
||||||
{
|
{
|
||||||
if (output_now()) {
|
if (output_now()) {
|
||||||
feEngine_->departition_mesh();
|
feEngine_->departition_mesh();
|
||||||
OUTPUT_LIST outputData;
|
OUTPUT_LIST outputData;
|
||||||
|
|
||||||
// base class output
|
// base class output
|
||||||
ATC_Method::output();
|
ATC_Method::output();
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
atomicRegulator_->output(outputData);
|
atomicRegulator_->output(outputData);
|
||||||
extrinsicModelManager_.output(outputData);
|
extrinsicModelManager_.output(outputData);
|
||||||
|
|
||||||
DENS_MAT & velocity(nodalAtomicFields_[VELOCITY].set_quantity());
|
DENS_MAT & velocity(nodalAtomicFields_[VELOCITY].set_quantity());
|
||||||
DENS_MAT & rhs(rhs_[VELOCITY].set_quantity());
|
DENS_MAT & rhs(rhs_[VELOCITY].set_quantity());
|
||||||
if (lammpsInterface_->rank_zero()) {
|
if (lammpsInterface_->rank_zero()) {
|
||||||
|
@ -341,7 +341,7 @@ namespace ATC {
|
||||||
if (trackDisplacement_) {
|
if (trackDisplacement_) {
|
||||||
outputData["NodalAtomicDisplacement"] = & nodalAtomicFields_[DISPLACEMENT].set_quantity();
|
outputData["NodalAtomicDisplacement"] = & nodalAtomicFields_[DISPLACEMENT].set_quantity();
|
||||||
}
|
}
|
||||||
|
|
||||||
feEngine_->write_data(output_index(), fields_, & outputData);
|
feEngine_->write_data(output_index(), fields_, & outputData);
|
||||||
}
|
}
|
||||||
// force optional variables to reset to keep in sync
|
// force optional variables to reset to keep in sync
|
||||||
|
@ -376,7 +376,7 @@ namespace ATC {
|
||||||
kineticEnergy += v.dot(M*v);
|
kineticEnergy += v.dot(M*v);
|
||||||
}
|
}
|
||||||
if (domain == FE_DOMAIN) {
|
if (domain == FE_DOMAIN) {
|
||||||
|
|
||||||
Array<FieldName> massMask(1);
|
Array<FieldName> massMask(1);
|
||||||
massMask(0) = VELOCITY;
|
massMask(0) = VELOCITY;
|
||||||
feEngine_->compute_lumped_mass_matrix(massMask,fields_,physicsModel_,atomMaterialGroups_,
|
feEngine_->compute_lumped_mass_matrix(massMask,fields_,physicsModel_,atomMaterialGroups_,
|
||||||
|
@ -388,20 +388,20 @@ namespace ATC {
|
||||||
kineticEnergy -= v.dot(Ma*v);
|
kineticEnergy -= v.dot(Ma*v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double mvv2e = lammpsInterface_->mvv2e();
|
double mvv2e = lammpsInterface_->mvv2e();
|
||||||
kineticEnergy *= 0.5*mvv2e; // convert to LAMMPS units
|
kineticEnergy *= 0.5*mvv2e; // convert to LAMMPS units
|
||||||
|
|
||||||
return kineticEnergy;
|
return kineticEnergy;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// potential/strain energy
|
// potential/strain energy
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
double ATC_CouplingMomentum::potential_energy(const IntegrationDomainType domain) const
|
double ATC_CouplingMomentum::potential_energy(const IntegrationDomainType domain) const
|
||||||
{
|
{
|
||||||
Array<FieldName> mask(1);
|
Array<FieldName> mask(1);
|
||||||
mask(0) = VELOCITY;
|
mask(0) = VELOCITY;
|
||||||
FIELD_MATS energy;
|
FIELD_MATS energy;
|
||||||
feEngine_->compute_energy(mask,
|
feEngine_->compute_energy(mask,
|
||||||
fields_,
|
fields_,
|
||||||
physicsModel_,
|
physicsModel_,
|
||||||
elementToMaterialMap_,
|
elementToMaterialMap_,
|
||||||
|
@ -424,7 +424,7 @@ namespace ATC {
|
||||||
// output[3] = total coarse scale energy
|
// output[3] = total coarse scale energy
|
||||||
// output[4] = fe-only coarse scale kinetic energy
|
// output[4] = fe-only coarse scale kinetic energy
|
||||||
// output[5] = fe-only coarse scale potential energy
|
// output[5] = fe-only coarse scale potential energy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
|
|
|
@ -26,21 +26,21 @@ namespace ATC {
|
||||||
class ATC_CouplingMomentum : public ATC_Coupling {
|
class ATC_CouplingMomentum : public ATC_Coupling {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ATC_CouplingMomentum(std::string groupName,
|
ATC_CouplingMomentum(std::string groupName,
|
||||||
double **& perAtomArray,
|
double **& perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
std::string matParamFile,
|
std::string matParamFile,
|
||||||
PhysicsType intrinsicModel,
|
PhysicsType intrinsicModel,
|
||||||
ExtrinsicModelType extrinsicModel = NO_MODEL);
|
ExtrinsicModelType extrinsicModel = NO_MODEL);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~ATC_CouplingMomentum();
|
virtual ~ATC_CouplingMomentum();
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
virtual bool modify(int narg, char **arg);
|
virtual bool modify(int narg, char **arg);
|
||||||
|
|
||||||
/** pre time integration */
|
/** pre time integration */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace ATC {
|
||||||
// Class ATC_CouplingMomentumEnergy
|
// Class ATC_CouplingMomentumEnergy
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -36,12 +36,12 @@ namespace ATC {
|
||||||
nodalAtomicConfigurationalTemperature_(nullptr),
|
nodalAtomicConfigurationalTemperature_(nullptr),
|
||||||
refPE_(0)
|
refPE_(0)
|
||||||
{
|
{
|
||||||
// Allocate PhysicsModel
|
// Allocate PhysicsModel
|
||||||
create_physics_model(THERMO_ELASTIC, matParamFile);
|
create_physics_model(THERMO_ELASTIC, matParamFile);
|
||||||
|
|
||||||
// create extrinsic physics model
|
// create extrinsic physics model
|
||||||
if (extrinsicModel != NO_MODEL) {
|
if (extrinsicModel != NO_MODEL) {
|
||||||
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up field data based on physicsModel
|
// set up field data based on physicsModel
|
||||||
|
@ -129,14 +129,14 @@ namespace ATC {
|
||||||
AtomicMomentum * atomicMomentum = new AtomicMomentum(this);
|
AtomicMomentum * atomicMomentum = new AtomicMomentum(this);
|
||||||
interscaleManager_.add_per_atom_quantity(atomicMomentum,
|
interscaleManager_.add_per_atom_quantity(atomicMomentum,
|
||||||
"AtomicMomentum");
|
"AtomicMomentum");
|
||||||
|
|
||||||
// nodal momentum for RHS
|
// nodal momentum for RHS
|
||||||
AtfShapeFunctionRestriction * nodalAtomicMomentum = new AtfShapeFunctionRestriction(this,
|
AtfShapeFunctionRestriction * nodalAtomicMomentum = new AtfShapeFunctionRestriction(this,
|
||||||
atomicMomentum,
|
atomicMomentum,
|
||||||
shpFcn_);
|
shpFcn_);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicMomentum,
|
interscaleManager_.add_dense_matrix(nodalAtomicMomentum,
|
||||||
"NodalAtomicMomentum");
|
"NodalAtomicMomentum");
|
||||||
|
|
||||||
// nodal forces
|
// nodal forces
|
||||||
FundamentalAtomQuantity * atomicForce = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE);
|
FundamentalAtomQuantity * atomicForce = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE);
|
||||||
AtfShapeFunctionRestriction * nodalAtomicForce = new AtfShapeFunctionRestriction(this,
|
AtfShapeFunctionRestriction * nodalAtomicForce = new AtfShapeFunctionRestriction(this,
|
||||||
|
@ -144,14 +144,14 @@ namespace ATC {
|
||||||
shpFcn_);
|
shpFcn_);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicForce,
|
interscaleManager_.add_dense_matrix(nodalAtomicForce,
|
||||||
"NodalAtomicForce");
|
"NodalAtomicForce");
|
||||||
|
|
||||||
// nodal velocity derived only from atoms
|
// nodal velocity derived only from atoms
|
||||||
AtfShapeFunctionMdProjection * nodalAtomicVelocity = new AtfShapeFunctionMdProjection(this,
|
AtfShapeFunctionMdProjection * nodalAtomicVelocity = new AtfShapeFunctionMdProjection(this,
|
||||||
nodalAtomicMomentum,
|
nodalAtomicMomentum,
|
||||||
VELOCITY);
|
VELOCITY);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicVelocity,
|
interscaleManager_.add_dense_matrix(nodalAtomicVelocity,
|
||||||
"NodalAtomicVelocity");
|
"NodalAtomicVelocity");
|
||||||
|
|
||||||
if (trackDisplacement_) {
|
if (trackDisplacement_) {
|
||||||
// mass-weighted (center-of-mass) displacement of each atom
|
// mass-weighted (center-of-mass) displacement of each atom
|
||||||
AtomicMassWeightedDisplacement * atomicMassWeightedDisplacement;
|
AtomicMassWeightedDisplacement * atomicMassWeightedDisplacement;
|
||||||
|
@ -166,14 +166,14 @@ namespace ATC {
|
||||||
atomicMassWeightedDisplacement = new AtomicMassWeightedDisplacement(this);
|
atomicMassWeightedDisplacement = new AtomicMassWeightedDisplacement(this);
|
||||||
interscaleManager_.add_per_atom_quantity(atomicMassWeightedDisplacement,
|
interscaleManager_.add_per_atom_quantity(atomicMassWeightedDisplacement,
|
||||||
"AtomicMassWeightedDisplacement");
|
"AtomicMassWeightedDisplacement");
|
||||||
|
|
||||||
// nodal (RHS) mass-weighted displacement
|
// nodal (RHS) mass-weighted displacement
|
||||||
AtfShapeFunctionRestriction * nodalAtomicMassWeightedDisplacement = new AtfShapeFunctionRestriction(this,
|
AtfShapeFunctionRestriction * nodalAtomicMassWeightedDisplacement = new AtfShapeFunctionRestriction(this,
|
||||||
atomicMassWeightedDisplacement,
|
atomicMassWeightedDisplacement,
|
||||||
shpFcn_);
|
shpFcn_);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicMassWeightedDisplacement,
|
interscaleManager_.add_dense_matrix(nodalAtomicMassWeightedDisplacement,
|
||||||
"NodalAtomicMassWeightedDisplacement");
|
"NodalAtomicMassWeightedDisplacement");
|
||||||
|
|
||||||
// nodal displacement derived only from atoms
|
// nodal displacement derived only from atoms
|
||||||
AtfShapeFunctionMdProjection * nodalAtomicDisplacement = new AtfShapeFunctionMdProjection(this,
|
AtfShapeFunctionMdProjection * nodalAtomicDisplacement = new AtfShapeFunctionMdProjection(this,
|
||||||
nodalAtomicMassWeightedDisplacement,
|
nodalAtomicMassWeightedDisplacement,
|
||||||
|
@ -183,7 +183,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// always need fluctuating velocity and kinetic energy
|
// always need fluctuating velocity and kinetic energy
|
||||||
|
|
||||||
FtaShapeFunctionProlongation * atomicMeanVelocity = new FtaShapeFunctionProlongation(this,&fields_[VELOCITY],shpFcn_);
|
FtaShapeFunctionProlongation * atomicMeanVelocity = new FtaShapeFunctionProlongation(this,&fields_[VELOCITY],shpFcn_);
|
||||||
interscaleManager_.add_per_atom_quantity(atomicMeanVelocity,
|
interscaleManager_.add_per_atom_quantity(atomicMeanVelocity,
|
||||||
field_to_prolongation_name(VELOCITY));
|
field_to_prolongation_name(VELOCITY));
|
||||||
|
@ -267,16 +267,16 @@ namespace ATC {
|
||||||
// register the per-atom quantity for the temperature definition
|
// register the per-atom quantity for the temperature definition
|
||||||
interscaleManager_.add_per_atom_quantity(atomEnergyForTemperature,
|
interscaleManager_.add_per_atom_quantity(atomEnergyForTemperature,
|
||||||
"AtomicEnergyForTemperature");
|
"AtomicEnergyForTemperature");
|
||||||
|
|
||||||
// nodal restriction of the atomic energy quantity for the temperature definition
|
// nodal restriction of the atomic energy quantity for the temperature definition
|
||||||
AtfShapeFunctionRestriction * nodalAtomicEnergy = new AtfShapeFunctionRestriction(this,
|
AtfShapeFunctionRestriction * nodalAtomicEnergy = new AtfShapeFunctionRestriction(this,
|
||||||
atomEnergyForTemperature,
|
atomEnergyForTemperature,
|
||||||
shpFcn_);
|
shpFcn_);
|
||||||
interscaleManager_.add_dense_matrix(nodalAtomicEnergy,
|
interscaleManager_.add_dense_matrix(nodalAtomicEnergy,
|
||||||
"NodalAtomicEnergy");
|
"NodalAtomicEnergy");
|
||||||
|
|
||||||
// nodal atomic temperature field
|
// nodal atomic temperature field
|
||||||
|
|
||||||
AtfShapeFunctionMdProjection * nodalAtomicTemperature = new AtfShapeFunctionMdProjection(this,
|
AtfShapeFunctionMdProjection * nodalAtomicTemperature = new AtfShapeFunctionMdProjection(this,
|
||||||
nodalAtomicEnergy,
|
nodalAtomicEnergy,
|
||||||
TEMPERATURE);
|
TEMPERATURE);
|
||||||
|
@ -299,17 +299,17 @@ namespace ATC {
|
||||||
throw ATC_Error("ATC_CouplingMomentumEnergy::initialize - method only valid with fractional step time integration");
|
throw ATC_Error("ATC_CouplingMomentumEnergy::initialize - method only valid with fractional step time integration");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ATC_Coupling::init_filter();
|
ATC_Coupling::init_filter();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (timeFilterManager_.end_equilibrate() && equilibriumStart_) {
|
if (timeFilterManager_.end_equilibrate() && equilibriumStart_) {
|
||||||
if (atomicRegulator_->coupling_mode(VELOCITY)==AtomicRegulator::FLUX || atomicRegulator_->coupling_mode(VELOCITY)==AtomicRegulator::GHOST_FLUX)
|
if (atomicRegulator_->coupling_mode(VELOCITY)==AtomicRegulator::FLUX || atomicRegulator_->coupling_mode(VELOCITY)==AtomicRegulator::GHOST_FLUX)
|
||||||
// nothing needed in other cases since kinetostat force is balanced by boundary flux in FE equations
|
// nothing needed in other cases since kinetostat force is balanced by boundary flux in FE equations
|
||||||
atomicRegulator_->reset_lambda_contribution(nodalAtomicFieldsRoc_[VELOCITY].quantity(),VELOCITY);
|
atomicRegulator_->reset_lambda_contribution(nodalAtomicFieldsRoc_[VELOCITY].quantity(),VELOCITY);
|
||||||
|
|
||||||
DENS_MAT powerMat(-1.*(nodalAtomicFields_[TEMPERATURE].quantity()));
|
DENS_MAT powerMat(-1.*(nodalAtomicFields_[TEMPERATURE].quantity()));
|
||||||
atomicRegulator_->reset_lambda_contribution(powerMat,TEMPERATURE);
|
atomicRegulator_->reset_lambda_contribution(powerMat,TEMPERATURE);
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ namespace ATC {
|
||||||
Array<FieldName> mask(1);
|
Array<FieldName> mask(1);
|
||||||
mask(0) = VELOCITY;
|
mask(0) = VELOCITY;
|
||||||
FIELD_MATS energy;
|
FIELD_MATS energy;
|
||||||
feEngine_->compute_energy(mask,
|
feEngine_->compute_energy(mask,
|
||||||
fields_,
|
fields_,
|
||||||
physicsModel_,
|
physicsModel_,
|
||||||
elementToMaterialMap_,
|
elementToMaterialMap_,
|
||||||
|
@ -371,7 +371,7 @@ namespace ATC {
|
||||||
potentialEnergy *= mvv2e; // convert to LAMMPS units
|
potentialEnergy *= mvv2e; // convert to LAMMPS units
|
||||||
return potentialEnergy-refPE_;
|
return potentialEnergy-refPE_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// compute_vector
|
// compute_vector
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -399,14 +399,14 @@ namespace ATC {
|
||||||
Array<FieldName> mask(1);
|
Array<FieldName> mask(1);
|
||||||
FIELD_MATS energy;
|
FIELD_MATS energy;
|
||||||
mask(0) = TEMPERATURE;
|
mask(0) = TEMPERATURE;
|
||||||
|
|
||||||
feEngine_->compute_energy(mask,
|
feEngine_->compute_energy(mask,
|
||||||
fields_,
|
fields_,
|
||||||
physicsModel_,
|
physicsModel_,
|
||||||
elementToMaterialMap_,
|
elementToMaterialMap_,
|
||||||
energy,
|
energy,
|
||||||
&(elementMask_->quantity()));
|
&(elementMask_->quantity()));
|
||||||
|
|
||||||
double phononEnergy = mvv2e * energy[TEMPERATURE].col_sum();
|
double phononEnergy = mvv2e * energy[TEMPERATURE].col_sum();
|
||||||
return phononEnergy;
|
return phononEnergy;
|
||||||
}
|
}
|
||||||
|
@ -435,9 +435,9 @@ namespace ATC {
|
||||||
_keTemp_ = nodalAtomicKineticTemperature_->quantity();
|
_keTemp_ = nodalAtomicKineticTemperature_->quantity();
|
||||||
if (nodalAtomicConfigurationalTemperature_)
|
if (nodalAtomicConfigurationalTemperature_)
|
||||||
_peTemp_ = nodalAtomicConfigurationalTemperature_->quantity();
|
_peTemp_ = nodalAtomicConfigurationalTemperature_->quantity();
|
||||||
|
|
||||||
OUTPUT_LIST outputData;
|
OUTPUT_LIST outputData;
|
||||||
|
|
||||||
// base class output
|
// base class output
|
||||||
ATC_Method::output();
|
ATC_Method::output();
|
||||||
|
|
||||||
|
@ -447,13 +447,13 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// auxiliary data
|
// auxiliary data
|
||||||
|
|
||||||
for (_tiIt_ = timeIntegrators_.begin(); _tiIt_ != timeIntegrators_.end(); ++_tiIt_) {
|
for (_tiIt_ = timeIntegrators_.begin(); _tiIt_ != timeIntegrators_.end(); ++_tiIt_) {
|
||||||
(_tiIt_->second)->output(outputData);
|
(_tiIt_->second)->output(outputData);
|
||||||
}
|
}
|
||||||
atomicRegulator_->output(outputData);
|
atomicRegulator_->output(outputData);
|
||||||
extrinsicModelManager_.output(outputData);
|
extrinsicModelManager_.output(outputData);
|
||||||
|
|
||||||
DENS_MAT & velocity(nodalAtomicFields_[VELOCITY].set_quantity());
|
DENS_MAT & velocity(nodalAtomicFields_[VELOCITY].set_quantity());
|
||||||
DENS_MAT & rhs(rhs_[VELOCITY].set_quantity());
|
DENS_MAT & rhs(rhs_[VELOCITY].set_quantity());
|
||||||
DENS_MAT & temperature(nodalAtomicFields_[TEMPERATURE].set_quantity());
|
DENS_MAT & temperature(nodalAtomicFields_[TEMPERATURE].set_quantity());
|
||||||
|
@ -469,18 +469,18 @@ namespace ATC {
|
||||||
feEngine_->add_global("temperature_std_dev", T_stddev);
|
feEngine_->add_global("temperature_std_dev", T_stddev);
|
||||||
double Ta_mean = (nodalAtomicFields_[TEMPERATURE].quantity()).col_sum(0)/nNodes_;
|
double Ta_mean = (nodalAtomicFields_[TEMPERATURE].quantity()).col_sum(0)/nNodes_;
|
||||||
feEngine_->add_global("atomic_temperature_mean", Ta_mean);
|
feEngine_->add_global("atomic_temperature_mean", Ta_mean);
|
||||||
double Ta_stddev = (nodalAtomicFields_[TEMPERATURE].quantity()).col_stdev(0);
|
double Ta_stddev = (nodalAtomicFields_[TEMPERATURE].quantity()).col_stdev(0);
|
||||||
feEngine_->add_global("atomic_temperature_std_dev", Ta_stddev);
|
feEngine_->add_global("atomic_temperature_std_dev", Ta_stddev);
|
||||||
|
|
||||||
// different temperature measures, if appropriate
|
// different temperature measures, if appropriate
|
||||||
if (nodalAtomicKineticTemperature_)
|
if (nodalAtomicKineticTemperature_)
|
||||||
outputData["kinetic_temperature"] = & _keTemp_;
|
outputData["kinetic_temperature"] = & _keTemp_;
|
||||||
|
|
||||||
if (nodalAtomicConfigurationalTemperature_) {
|
if (nodalAtomicConfigurationalTemperature_) {
|
||||||
_peTemp_ *= 2; // account for full temperature
|
_peTemp_ *= 2; // account for full temperature
|
||||||
outputData["configurational_temperature"] = & _peTemp_;
|
outputData["configurational_temperature"] = & _peTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mesh data
|
// mesh data
|
||||||
outputData["NodalAtomicVelocity"] = &velocity;
|
outputData["NodalAtomicVelocity"] = &velocity;
|
||||||
outputData["FE_Force"] = &rhs;
|
outputData["FE_Force"] = &rhs;
|
||||||
|
@ -491,10 +491,10 @@ namespace ATC {
|
||||||
outputData["ddot_temperature"] = &ddotTemperature;
|
outputData["ddot_temperature"] = &ddotTemperature;
|
||||||
outputData["NodalAtomicPower"] = &rocTemperature;
|
outputData["NodalAtomicPower"] = &rocTemperature;
|
||||||
outputData["fePower"] = &fePower;
|
outputData["fePower"] = &fePower;
|
||||||
|
|
||||||
feEngine_->write_data(output_index(), fields_, & outputData);
|
feEngine_->write_data(output_index(), fields_, & outputData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hence propagation is performed on proc 0 but not others.
|
// hence propagation is performed on proc 0 but not others.
|
||||||
// The real fix is to have const data in the output list
|
// The real fix is to have const data in the output list
|
||||||
// force optional variables to reset to keep in sync
|
// force optional variables to reset to keep in sync
|
||||||
|
|
|
@ -25,9 +25,9 @@ namespace ATC {
|
||||||
class ATC_CouplingMomentumEnergy : public ATC_Coupling {
|
class ATC_CouplingMomentumEnergy : public ATC_Coupling {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ATC_CouplingMomentumEnergy(std::string groupName,
|
ATC_CouplingMomentumEnergy(std::string groupName,
|
||||||
double ** & perAtomArray,
|
double ** & perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
std::string matParamFile,
|
std::string matParamFile,
|
||||||
|
@ -78,6 +78,6 @@ namespace ATC {
|
||||||
// data
|
// data
|
||||||
double refPE_;
|
double refPE_;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -66,12 +66,12 @@ namespace ATC {
|
||||||
|
|
||||||
/** Predictor phase, executed before Verlet */
|
/** Predictor phase, executed before Verlet */
|
||||||
virtual void pre_init_integrate() {
|
virtual void pre_init_integrate() {
|
||||||
feEngine_->partition_mesh();
|
feEngine_->partition_mesh();
|
||||||
update_step();
|
update_step();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Predictor phase, Verlet first step for velocity and position */
|
/** Predictor phase, Verlet first step for velocity and position */
|
||||||
virtual void init_integrate();
|
virtual void init_integrate();
|
||||||
|
|
||||||
/** Predictor phase, executed after Verlet */
|
/** Predictor phase, executed after Verlet */
|
||||||
virtual void post_init_integrate();
|
virtual void post_init_integrate();
|
||||||
|
@ -127,7 +127,7 @@ namespace ATC {
|
||||||
/** access to interscale manager */
|
/** access to interscale manager */
|
||||||
InterscaleManager & interscale_manager() {return interscaleManager_;};
|
InterscaleManager & interscale_manager() {return interscaleManager_;};
|
||||||
/** access to lammps interface */
|
/** access to lammps interface */
|
||||||
|
|
||||||
LammpsInterface const * lammps_interface() const {return lammpsInterface_;};
|
LammpsInterface const * lammps_interface() const {return lammpsInterface_;};
|
||||||
/** access to time filter */
|
/** access to time filter */
|
||||||
TimeFilterManager * time_filter_manager() {return &timeFilterManager_;};
|
TimeFilterManager * time_filter_manager() {return &timeFilterManager_;};
|
||||||
|
@ -142,7 +142,7 @@ namespace ATC {
|
||||||
/** compute vector for output */
|
/** compute vector for output */
|
||||||
virtual double compute_vector(int /* n */) {return 0.;}
|
virtual double compute_vector(int /* n */) {return 0.;}
|
||||||
/** compute vector for output */
|
/** compute vector for output */
|
||||||
virtual double compute_array(int /* irow */, int /* icol */) {return 0.;};
|
virtual double compute_array(int /* irow */, int /* icol */) {return 0.;};
|
||||||
int scalar_flag() const {return scalarFlag_;}
|
int scalar_flag() const {return scalarFlag_;}
|
||||||
int vector_flag() const {return vectorFlag_;}
|
int vector_flag() const {return vectorFlag_;}
|
||||||
int size_vector() const {return sizeVector_;}
|
int size_vector() const {return sizeVector_;}
|
||||||
|
@ -164,16 +164,16 @@ namespace ATC {
|
||||||
|
|
||||||
/** time/step functions */
|
/** time/step functions */
|
||||||
bool sample_now(void) const
|
bool sample_now(void) const
|
||||||
{
|
{
|
||||||
int s = step();
|
int s = step();
|
||||||
bool now = ( (sampleFrequency_ > 0) && (s % sampleFrequency_ == 0));
|
bool now = ( (sampleFrequency_ > 0) && (s % sampleFrequency_ == 0));
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
bool output_now(void) const
|
bool output_now(void) const
|
||||||
{
|
{
|
||||||
int s = step();
|
int s = step();
|
||||||
|
|
||||||
bool now = ( (outputFrequency_ > 0) && (s == 1 || s % outputFrequency_ == 0) );
|
bool now = ( (outputFrequency_ > 0) && (s == 1 || s % outputFrequency_ == 0) );
|
||||||
now = now || outputNow_;
|
now = now || outputNow_;
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ namespace ATC {
|
||||||
const std::map<std::string,std::pair<MolSize,int> > & molecule_ids() const {return moleculeIds_;};
|
const std::map<std::string,std::pair<MolSize,int> > & molecule_ids() const {return moleculeIds_;};
|
||||||
/** access to internal element set */
|
/** access to internal element set */
|
||||||
const std::string & internal_element_set() {return internalElementSet_;};
|
const std::string & internal_element_set() {return internalElementSet_;};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
/** \name mass matrix operations */
|
/** \name mass matrix operations */
|
||||||
|
@ -339,7 +339,7 @@ namespace ATC {
|
||||||
// inverted using GMRES
|
// inverted using GMRES
|
||||||
void apply_inverse_mass_matrix(MATRIX & data, FieldName thisField)
|
void apply_inverse_mass_matrix(MATRIX & data, FieldName thisField)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (useConsistentMassMatrix_(thisField)) {
|
if (useConsistentMassMatrix_(thisField)) {
|
||||||
//data = consistentMassInverse_*data;
|
//data = consistentMassInverse_*data;
|
||||||
data = (consistentMassMatsInv_[thisField].quantity())*data;
|
data = (consistentMassMatsInv_[thisField].quantity())*data;
|
||||||
|
@ -351,7 +351,7 @@ namespace ATC {
|
||||||
void apply_inverse_mass_matrix(const MATRIX & data_in, MATRIX & data_out,
|
void apply_inverse_mass_matrix(const MATRIX & data_in, MATRIX & data_out,
|
||||||
FieldName thisField)
|
FieldName thisField)
|
||||||
{
|
{
|
||||||
if (useConsistentMassMatrix_(thisField)) {
|
if (useConsistentMassMatrix_(thisField)) {
|
||||||
//data_out = consistentMassInverse_*data_in;
|
//data_out = consistentMassInverse_*data_in;
|
||||||
data_out = (consistentMassMatsInv_[thisField].quantity())*data_in;
|
data_out = (consistentMassMatsInv_[thisField].quantity())*data_in;
|
||||||
return;
|
return;
|
||||||
|
@ -365,7 +365,7 @@ namespace ATC {
|
||||||
|
|
||||||
DIAG_MAN &mass_mat(FieldName thisField)
|
DIAG_MAN &mass_mat(FieldName thisField)
|
||||||
{ return massMats_[thisField];};
|
{ return massMats_[thisField];};
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/** \name mass matrices */
|
/** \name mass matrices */
|
||||||
|
@ -383,13 +383,13 @@ namespace ATC {
|
||||||
void register_mass_matrix_dependency(DependencyManager * dependent,
|
void register_mass_matrix_dependency(DependencyManager * dependent,
|
||||||
FieldName thisField)
|
FieldName thisField)
|
||||||
{
|
{
|
||||||
if (useConsistentMassMatrix_(thisField)) {
|
if (useConsistentMassMatrix_(thisField)) {
|
||||||
consistentMassMatsInv_[thisField].register_dependence(dependent);
|
consistentMassMatsInv_[thisField].register_dependence(dependent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
massMatsInv_[thisField].register_dependence(dependent);
|
massMatsInv_[thisField].register_dependence(dependent);
|
||||||
};
|
};
|
||||||
|
|
||||||
void apply_inverse_md_mass_matrix(MATRIX & data, FieldName thisField)
|
void apply_inverse_md_mass_matrix(MATRIX & data, FieldName thisField)
|
||||||
{ data = (massMatsMdInv_[thisField].quantity())*data; };
|
{ data = (massMatsMdInv_[thisField].quantity())*data; };
|
||||||
void register_md_mass_matrix_dependency(DependencyManager * dependent,
|
void register_md_mass_matrix_dependency(DependencyManager * dependent,
|
||||||
|
@ -416,11 +416,11 @@ namespace ATC {
|
||||||
return man->second;
|
return man->second;
|
||||||
};
|
};
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
/** \name Interscale operators */
|
/** \name Interscale operators */
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
bool use_md_mass_normalization() const { return mdMassNormalization_;}
|
bool use_md_mass_normalization() const { return mdMassNormalization_;}
|
||||||
bool kernel_based() { return kernelBased_; }
|
bool kernel_based() { return kernelBased_; }
|
||||||
bool kernel_on_the_fly() const { return kernelOnTheFly_;}
|
bool kernel_on_the_fly() const { return kernelOnTheFly_;}
|
||||||
bool has_kernel_function() { return kernelFunction_ != nullptr; }
|
bool has_kernel_function() { return kernelFunction_ != nullptr; }
|
||||||
|
@ -439,20 +439,20 @@ namespace ATC {
|
||||||
|
|
||||||
double ke_scale() { return keScale_; }
|
double ke_scale() { return keScale_; }
|
||||||
double pe_scale() { return peScale_; }
|
double pe_scale() { return peScale_; }
|
||||||
|
|
||||||
/** from a atom group, find the nodes that have non-zero shape function contributions */
|
/** from a atom group, find the nodes that have non-zero shape function contributions */
|
||||||
|
|
||||||
bool nodal_influence(const int groupbit, std::set<int>& nset, std::set<int>& aset, double tol =1.e-8);
|
bool nodal_influence(const int groupbit, std::set<int>& nset, std::set<int>& aset, double tol =1.e-8);
|
||||||
int nodal_influence(const int groupbit, std::set<int>& nset, std::set<int>& aset,
|
int nodal_influence(const int groupbit, std::set<int>& nset, std::set<int>& aset,
|
||||||
bool ghost,
|
bool ghost,
|
||||||
double tol =1.e-8);
|
double tol =1.e-8);
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Restrict based on atomic volume integration for volumetric quantities : given w_\alpha, w_I = \sum_\alpha N_{I\alpha} w_\alpha */
|
/** Restrict based on atomic volume integration for volumetric quantities : given w_\alpha, w_I = \sum_\alpha N_{I\alpha} w_\alpha */
|
||||||
void restrict_volumetric_quantity(const MATRIX &atomData,
|
void restrict_volumetric_quantity(const MATRIX &atomData,
|
||||||
MATRIX &nodeData);
|
MATRIX &nodeData);
|
||||||
void restrict_volumetric_quantity(const MATRIX &atomData,
|
void restrict_volumetric_quantity(const MATRIX &atomData,
|
||||||
MATRIX &nodeData,
|
MATRIX &nodeData,
|
||||||
const SPAR_MAT & shpFcn);
|
const SPAR_MAT & shpFcn);
|
||||||
|
@ -474,7 +474,7 @@ namespace ATC {
|
||||||
protected: /** methods */
|
protected: /** methods */
|
||||||
/** time functions */
|
/** time functions */
|
||||||
void set_time(double t=0) {simTime_=t;};
|
void set_time(double t=0) {simTime_=t;};
|
||||||
void update_time(double alpha = 1.0)
|
void update_time(double alpha = 1.0)
|
||||||
{
|
{
|
||||||
double dt = lammpsInterface_->dt();
|
double dt = lammpsInterface_->dt();
|
||||||
simTime_ += alpha*dt;
|
simTime_ += alpha*dt;
|
||||||
|
@ -506,7 +506,7 @@ namespace ATC {
|
||||||
|
|
||||||
virtual void read_restart_data(std::string fileName_, RESTART_LIST & data);
|
virtual void read_restart_data(std::string fileName_, RESTART_LIST & data);
|
||||||
virtual void write_restart_data(std::string fileName_, RESTART_LIST & data);
|
virtual void write_restart_data(std::string fileName_, RESTART_LIST & data);
|
||||||
void pack_fields(RESTART_LIST & data);
|
void pack_fields(RESTART_LIST & data);
|
||||||
|
|
||||||
/** mass matrices */
|
/** mass matrices */
|
||||||
DIAG_MAT massMatInv_;
|
DIAG_MAT massMatInv_;
|
||||||
|
@ -564,11 +564,11 @@ namespace ATC {
|
||||||
|
|
||||||
void reset_fields();
|
void reset_fields();
|
||||||
|
|
||||||
private: /** methods */
|
private: /** methods */
|
||||||
ATC_Method(); // do not define
|
ATC_Method(); // do not define
|
||||||
|
|
||||||
protected: /** data */
|
protected: /** data */
|
||||||
|
|
||||||
/* parsed input requires changes */
|
/* parsed input requires changes */
|
||||||
bool needReset_;
|
bool needReset_;
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ namespace ATC {
|
||||||
PerAtomQuantity<double> * atomProcGhostCoarseGrainingPositions_;
|
PerAtomQuantity<double> * atomProcGhostCoarseGrainingPositions_;
|
||||||
PerAtomQuantity<double> * atomReferencePositions_;
|
PerAtomQuantity<double> * atomReferencePositions_;
|
||||||
|
|
||||||
|
|
||||||
/** number of unique FE nodes */
|
/** number of unique FE nodes */
|
||||||
int nNodes_;
|
int nNodes_;
|
||||||
|
|
||||||
|
@ -631,17 +631,17 @@ namespace ATC {
|
||||||
bool trackDisplacement_;
|
bool trackDisplacement_;
|
||||||
|
|
||||||
/** map from reference positions to element id, pointer is to internal only */
|
/** map from reference positions to element id, pointer is to internal only */
|
||||||
|
|
||||||
bool needsAtomToElementMap_;
|
bool needsAtomToElementMap_;
|
||||||
PerAtomQuantity<int> * atomElement_;
|
PerAtomQuantity<int> * atomElement_;
|
||||||
PerAtomQuantity<int> * atomGhostElement_;
|
PerAtomQuantity<int> * atomGhostElement_;
|
||||||
|
|
||||||
/* use element sets to define internal and/or ghost regions */
|
/* use element sets to define internal and/or ghost regions */
|
||||||
std::string internalElementSet_;
|
std::string internalElementSet_;
|
||||||
|
|
||||||
/** atomic ATC material tag */
|
/** atomic ATC material tag */
|
||||||
|
|
||||||
|
|
||||||
double Xprd_,Yprd_,Zprd_; // lengths of periodic box in reference frame
|
double Xprd_,Yprd_,Zprd_; // lengths of periodic box in reference frame
|
||||||
double XY_,YZ_,XZ_;
|
double XY_,YZ_,XZ_;
|
||||||
double boxXlo_,boxXhi_; // lo/hi bounds of periodic box in reference frame
|
double boxXlo_,boxXhi_; // lo/hi bounds of periodic box in reference frame
|
||||||
|
@ -671,22 +671,22 @@ namespace ATC {
|
||||||
/** base name for output files */
|
/** base name for output files */
|
||||||
std::string outputPrefix_;
|
std::string outputPrefix_;
|
||||||
|
|
||||||
/** output flag */
|
/** output flag */
|
||||||
|
|
||||||
bool outputNow_;
|
bool outputNow_;
|
||||||
/** output time or step (for lammps compatibility) */
|
/** output time or step (for lammps compatibility) */
|
||||||
bool outputTime_;
|
bool outputTime_;
|
||||||
|
|
||||||
/** output frequency */
|
/** output frequency */
|
||||||
int outputFrequency_;
|
int outputFrequency_;
|
||||||
|
|
||||||
/** sample frequency */
|
/** sample frequency */
|
||||||
int sampleFrequency_;
|
int sampleFrequency_;
|
||||||
|
|
||||||
/** sample counter */
|
/** sample counter */
|
||||||
int sampleCounter_;
|
int sampleCounter_;
|
||||||
|
|
||||||
TAG_FIELDS filteredData_;
|
TAG_FIELDS filteredData_;
|
||||||
|
|
||||||
double peScale_,keScale_;
|
double peScale_,keScale_;
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ namespace ATC {
|
||||||
int sizeVector_; // N = size of global vector
|
int sizeVector_; // N = size of global vector
|
||||||
int scalarVectorFreq_; // frequency compute s/v data is available at
|
int scalarVectorFreq_; // frequency compute s/v data is available at
|
||||||
int sizePerAtomCols_; // N = size of per atom vector to dump
|
int sizePerAtomCols_; // N = size of per atom vector to dump
|
||||||
|
|
||||||
double **perAtomOutput_; // per atom data
|
double **perAtomOutput_; // per atom data
|
||||||
double **&perAtomArray_; // per atom data
|
double **&perAtomArray_; // per atom data
|
||||||
int extScalar_; // 0/1 if scalar is intensive/extensive
|
int extScalar_; // 0/1 if scalar is intensive/extensive
|
||||||
|
@ -724,15 +724,15 @@ namespace ATC {
|
||||||
/** \name time integration and filtering fields */
|
/** \name time integration and filtering fields */
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
FIELDS dot_fields_;
|
FIELDS dot_fields_;
|
||||||
FIELDS ddot_fields_;
|
FIELDS ddot_fields_;
|
||||||
FIELDS dddot_fields_;
|
FIELDS dddot_fields_;
|
||||||
|
|
||||||
/** Restricted Fields */
|
/** Restricted Fields */
|
||||||
|
|
||||||
FIELDS nodalAtomicFields_; // replaces fieldNdFiltered_
|
FIELDS nodalAtomicFields_; // replaces fieldNdFiltered_
|
||||||
FIELDS nodalAtomicFieldsRoc_;
|
FIELDS nodalAtomicFieldsRoc_;
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
@ -740,9 +740,9 @@ namespace ATC {
|
||||||
/** \name quadrature weights */
|
/** \name quadrature weights */
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
DIAG_MAT NodeVolumes_;
|
DIAG_MAT NodeVolumes_;
|
||||||
DIAG_MAN invNodeVolumes_;
|
DIAG_MAN invNodeVolumes_;
|
||||||
/** atomic quadrature integration weights (V_\alpha) */
|
/** atomic quadrature integration weights (V_\alpha) */
|
||||||
ProtectedAtomDiagonalMatrix<double> * atomVolume_;
|
ProtectedAtomDiagonalMatrix<double> * atomVolume_;
|
||||||
std::string atomicWeightsFile_;
|
std::string atomicWeightsFile_;
|
||||||
|
@ -770,7 +770,7 @@ namespace ATC {
|
||||||
bool needProcGhost_;
|
bool needProcGhost_;
|
||||||
std::string groupTag_;
|
std::string groupTag_;
|
||||||
std::string groupTagGhost_;
|
std::string groupTagGhost_;
|
||||||
|
|
||||||
/** number of atoms of correct type,
|
/** number of atoms of correct type,
|
||||||
ghosts are atoms outside our domain of interest
|
ghosts are atoms outside our domain of interest
|
||||||
boundary are atoms contributing to boundary flux terms */
|
boundary are atoms contributing to boundary flux terms */
|
||||||
|
@ -824,7 +824,7 @@ namespace ATC {
|
||||||
SPAR_MAN kernelAccumulantMol_; // KKM add
|
SPAR_MAN kernelAccumulantMol_; // KKM add
|
||||||
SPAR_MAN kernelAccumulantMolGrad_; // KKM add
|
SPAR_MAN kernelAccumulantMolGrad_; // KKM add
|
||||||
DIAG_MAN* accumulantWeights_;
|
DIAG_MAN* accumulantWeights_;
|
||||||
DIAG_MAN* accumulantInverseVolumes_;
|
DIAG_MAN* accumulantInverseVolumes_;
|
||||||
int accumulantBandwidth_;
|
int accumulantBandwidth_;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
@ -845,7 +845,7 @@ namespace ATC {
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
/** \name reference data */
|
/** \name reference data */
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
bool hasRefPE_;
|
bool hasRefPE_;
|
||||||
bool setRefPE_;
|
bool setRefPE_;
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace ATC {
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
string matParamFile)
|
string matParamFile)
|
||||||
: ATC_Method(groupName,perAtomArray,thisFix),
|
: ATC_Method(groupName,perAtomArray,thisFix),
|
||||||
xPointer_(nullptr),
|
xPointer_(nullptr),
|
||||||
outputStepZero_(true),
|
outputStepZero_(true),
|
||||||
neighborReset_(false),
|
neighborReset_(false),
|
||||||
pairMap_(nullptr),
|
pairMap_(nullptr),
|
||||||
|
@ -95,7 +95,7 @@ namespace ATC {
|
||||||
lmp->lattice(cb.cell_vectors, cb.basis_vectors);
|
lmp->lattice(cb.cell_vectors, cb.basis_vectors);
|
||||||
cb.inv_atom_volume = 1.0 / lmp->volume_per_atom();
|
cb.inv_atom_volume = 1.0 / lmp->volume_per_atom();
|
||||||
cb.e2mvv = 1.0 / lmp->mvv2e();
|
cb.e2mvv = 1.0 / lmp->mvv2e();
|
||||||
cb.atom_mass = lmp->atom_mass(1);
|
cb.atom_mass = lmp->atom_mass(1);
|
||||||
cb.boltzmann = lmp->boltz();
|
cb.boltzmann = lmp->boltz();
|
||||||
cb.hbar = lmp->hbar();
|
cb.hbar = lmp->hbar();
|
||||||
cauchyBornStress_ = new StressCauchyBorn(fileId, cb);
|
cauchyBornStress_ = new StressCauchyBorn(fileId, cb);
|
||||||
|
@ -103,7 +103,7 @@ namespace ATC {
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
set_time();
|
set_time();
|
||||||
|
|
||||||
outputFlags_.reset(NUM_TOTAL_FIELDS);
|
outputFlags_.reset(NUM_TOTAL_FIELDS);
|
||||||
outputFlags_ = false;
|
outputFlags_ = false;
|
||||||
fieldFlags_.reset(NUM_TOTAL_FIELDS);
|
fieldFlags_.reset(NUM_TOTAL_FIELDS);
|
||||||
|
@ -117,20 +117,20 @@ namespace ATC {
|
||||||
for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = nullptr; }
|
for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = nullptr; }
|
||||||
|
|
||||||
// Hardy requires ref positions for processor ghosts for bond list
|
// Hardy requires ref positions for processor ghosts for bond list
|
||||||
|
|
||||||
//needXrefProcessorGhosts_ = true;
|
//needXrefProcessorGhosts_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
ATC_Transfer::~ATC_Transfer()
|
ATC_Transfer::~ATC_Transfer()
|
||||||
{
|
{
|
||||||
interscaleManager_.clear();
|
interscaleManager_.clear();
|
||||||
if (cauchyBornStress_) delete cauchyBornStress_;
|
if (cauchyBornStress_) delete cauchyBornStress_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// called before the beginning of a "run"
|
// called before the beginning of a "run"
|
||||||
void ATC_Transfer::initialize()
|
void ATC_Transfer::initialize()
|
||||||
{
|
{
|
||||||
if (kernelOnTheFly_ && !readRefPE_ && !setRefPEvalue_) {
|
if (kernelOnTheFly_ && !readRefPE_ && !setRefPEvalue_) {
|
||||||
if (setRefPE_) {
|
if (setRefPE_) {
|
||||||
|
@ -143,7 +143,7 @@ namespace ATC {
|
||||||
|
|
||||||
ATC_Method::initialize();
|
ATC_Method::initialize();
|
||||||
|
|
||||||
if (!initialized_) {
|
if (!initialized_) {
|
||||||
if (cauchyBornStress_) cauchyBornStress_->initialize();
|
if (cauchyBornStress_) cauchyBornStress_->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,16 +164,16 @@ namespace ATC {
|
||||||
ghostManager_.initialize();
|
ghostManager_.initialize();
|
||||||
|
|
||||||
// initialize bond matrix B_Iab
|
// initialize bond matrix B_Iab
|
||||||
if ((! bondOnTheFly_)
|
if ((! bondOnTheFly_)
|
||||||
&& ( ( fieldFlags_(STRESS)
|
&& ( ( fieldFlags_(STRESS)
|
||||||
|| fieldFlags_(ESHELBY_STRESS)
|
|| fieldFlags_(ESHELBY_STRESS)
|
||||||
|| fieldFlags_(HEAT_FLUX) ) ) ) {
|
|| fieldFlags_(HEAT_FLUX) ) ) ) {
|
||||||
try {
|
try {
|
||||||
compute_bond_matrix();
|
compute_bond_matrix();
|
||||||
}
|
}
|
||||||
catch(bad_alloc&) {
|
catch(bad_alloc&) {
|
||||||
ATC::LammpsInterface::instance()->print_msg("stress/heat_flux will be computed on-the-fly");
|
ATC::LammpsInterface::instance()->print_msg("stress/heat_flux will be computed on-the-fly");
|
||||||
|
|
||||||
bondOnTheFly_ = true;
|
bondOnTheFly_ = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ namespace ATC {
|
||||||
// set sample frequency to output if sample has not be specified
|
// set sample frequency to output if sample has not be specified
|
||||||
if (sampleFrequency_ == 0) sampleFrequency_ = outputFrequency_;
|
if (sampleFrequency_ == 0) sampleFrequency_ = outputFrequency_;
|
||||||
|
|
||||||
// output for step 0
|
// output for step 0
|
||||||
if (!initialized_) {
|
if (!initialized_) {
|
||||||
if (outputFrequency_ > 0) {
|
if (outputFrequency_ > 0) {
|
||||||
// initialize filtered data
|
// initialize filtered data
|
||||||
|
@ -224,9 +224,9 @@ namespace ATC {
|
||||||
|
|
||||||
lammpsInterface_->computes_addstep(lammpsInterface_->ntimestep()+sampleFrequency_);
|
lammpsInterface_->computes_addstep(lammpsInterface_->ntimestep()+sampleFrequency_);
|
||||||
|
|
||||||
|
|
||||||
//remap_ghost_ref_positions();
|
//remap_ghost_ref_positions();
|
||||||
update_peratom_output();
|
update_peratom_output();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -242,7 +242,7 @@ namespace ATC {
|
||||||
void ATC_Transfer::construct_time_integration_data()
|
void ATC_Transfer::construct_time_integration_data()
|
||||||
{
|
{
|
||||||
if (!initialized_) {
|
if (!initialized_) {
|
||||||
|
|
||||||
// size arrays for requested/required fields
|
// size arrays for requested/required fields
|
||||||
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
|
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
|
||||||
if (fieldFlags_(index)) {
|
if (fieldFlags_(index)) {
|
||||||
|
@ -298,13 +298,13 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
// interpolant
|
// interpolant
|
||||||
if (!(kernelOnTheFly_)) {
|
if (!(kernelOnTheFly_)) {
|
||||||
// finite element shape functions for interpolants
|
// finite element shape functions for interpolants
|
||||||
PerAtomShapeFunction * atomShapeFunctions = new PerAtomShapeFunction(this);
|
PerAtomShapeFunction * atomShapeFunctions = new PerAtomShapeFunction(this);
|
||||||
interscaleManager_.add_per_atom_sparse_matrix(atomShapeFunctions,"Interpolant");
|
interscaleManager_.add_per_atom_sparse_matrix(atomShapeFunctions,"Interpolant");
|
||||||
shpFcn_ = atomShapeFunctions;
|
shpFcn_ = atomShapeFunctions;
|
||||||
}
|
}
|
||||||
// accummulant and weights
|
// accummulant and weights
|
||||||
|
|
||||||
this->create_atom_volume();
|
this->create_atom_volume();
|
||||||
// accumulants
|
// accumulants
|
||||||
if (kernelFunction_) {
|
if (kernelFunction_) {
|
||||||
|
@ -312,7 +312,7 @@ namespace ATC {
|
||||||
if (kernelOnTheFly_) {
|
if (kernelOnTheFly_) {
|
||||||
ConstantQuantity<double> * atomCount = new ConstantQuantity<double>(this,1.);
|
ConstantQuantity<double> * atomCount = new ConstantQuantity<double>(this,1.);
|
||||||
interscaleManager_.add_per_atom_quantity(atomCount,"AtomCount");
|
interscaleManager_.add_per_atom_quantity(atomCount,"AtomCount");
|
||||||
OnTheFlyKernelAccumulation * myWeights
|
OnTheFlyKernelAccumulation * myWeights
|
||||||
= new OnTheFlyKernelAccumulation(this,
|
= new OnTheFlyKernelAccumulation(this,
|
||||||
atomCount, kernelFunction_, atomCoarseGrainingPositions_);
|
atomCount, kernelFunction_, atomCoarseGrainingPositions_);
|
||||||
interscaleManager_.add_dense_matrix(myWeights,
|
interscaleManager_.add_dense_matrix(myWeights,
|
||||||
|
@ -337,7 +337,7 @@ namespace ATC {
|
||||||
if (kernelOnTheFly_) {
|
if (kernelOnTheFly_) {
|
||||||
ConstantQuantity<double> * atomCount = new ConstantQuantity<double>(this,1.);
|
ConstantQuantity<double> * atomCount = new ConstantQuantity<double>(this,1.);
|
||||||
interscaleManager_.add_per_atom_quantity(atomCount,"AtomCount");
|
interscaleManager_.add_per_atom_quantity(atomCount,"AtomCount");
|
||||||
OnTheFlyMeshAccumulation * myWeights
|
OnTheFlyMeshAccumulation * myWeights
|
||||||
= new OnTheFlyMeshAccumulation(this,
|
= new OnTheFlyMeshAccumulation(this,
|
||||||
atomCount, atomCoarseGrainingPositions_);
|
atomCount, atomCoarseGrainingPositions_);
|
||||||
interscaleManager_.add_dense_matrix(myWeights,
|
interscaleManager_.add_dense_matrix(myWeights,
|
||||||
|
@ -363,13 +363,13 @@ namespace ATC {
|
||||||
// molecule centroid, molecule charge, dipole moment and quadrupole moment calculations KKM add
|
// molecule centroid, molecule charge, dipole moment and quadrupole moment calculations KKM add
|
||||||
if (!moleculeIds_.empty()) {
|
if (!moleculeIds_.empty()) {
|
||||||
map<string,pair<MolSize,int> >::const_iterator molecule;
|
map<string,pair<MolSize,int> >::const_iterator molecule;
|
||||||
InterscaleManager & interscaleManager = this->interscale_manager(); // KKM add, may be we do not need this as interscaleManager_ already exists.
|
InterscaleManager & interscaleManager = this->interscale_manager(); // KKM add, may be we do not need this as interscaleManager_ already exists.
|
||||||
PerAtomQuantity<double> * atomProcGhostCoarseGrainingPositions_ = interscaleManager.per_atom_quantity("AtomicProcGhostCoarseGrainingPositions");
|
PerAtomQuantity<double> * atomProcGhostCoarseGrainingPositions_ = interscaleManager.per_atom_quantity("AtomicProcGhostCoarseGrainingPositions");
|
||||||
FundamentalAtomQuantity * mass = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS,PROC_GHOST);
|
FundamentalAtomQuantity * mass = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS,PROC_GHOST);
|
||||||
molecule = moleculeIds_.begin();
|
molecule = moleculeIds_.begin();
|
||||||
int groupbit = (molecule->second).second;
|
int groupbit = (molecule->second).second;
|
||||||
smallMoleculeSet_ = new SmallMoleculeSet(this,groupbit);
|
smallMoleculeSet_ = new SmallMoleculeSet(this,groupbit);
|
||||||
smallMoleculeSet_->initialize(); // KKM add, why should we?
|
smallMoleculeSet_->initialize(); // KKM add, why should we?
|
||||||
interscaleManager_.add_small_molecule_set(smallMoleculeSet_,"MoleculeSet");
|
interscaleManager_.add_small_molecule_set(smallMoleculeSet_,"MoleculeSet");
|
||||||
moleculeCentroid_ = new SmallMoleculeCentroid(this,mass,smallMoleculeSet_,atomProcGhostCoarseGrainingPositions_);
|
moleculeCentroid_ = new SmallMoleculeCentroid(this,mass,smallMoleculeSet_,atomProcGhostCoarseGrainingPositions_);
|
||||||
interscaleManager_.add_dense_matrix(moleculeCentroid_,"MoleculeCentroid");
|
interscaleManager_.add_dense_matrix(moleculeCentroid_,"MoleculeCentroid");
|
||||||
|
@ -393,7 +393,7 @@ namespace ATC {
|
||||||
|
|
||||||
// set pointer to positions
|
// set pointer to positions
|
||||||
// REFACTOR use method's handling of xref/xpointer
|
// REFACTOR use method's handling of xref/xpointer
|
||||||
set_xPointer();
|
set_xPointer();
|
||||||
|
|
||||||
ATC_Method::construct_transfers();
|
ATC_Method::construct_transfers();
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// for hardy-based fluxes
|
// for hardy-based fluxes
|
||||||
|
|
||||||
bool needsBondMatrix = (! bondOnTheFly_ ) &&
|
bool needsBondMatrix = (! bondOnTheFly_ ) &&
|
||||||
(fieldFlags_(STRESS)
|
(fieldFlags_(STRESS)
|
||||||
|| fieldFlags_(ESHELBY_STRESS)
|
|| fieldFlags_(ESHELBY_STRESS)
|
||||||
|
@ -434,7 +434,7 @@ namespace ATC {
|
||||||
|
|
||||||
const FE_Mesh * fe_mesh = feEngine_->fe_mesh();
|
const FE_Mesh * fe_mesh = feEngine_->fe_mesh();
|
||||||
if (!kernelBased_) {
|
if (!kernelBased_) {
|
||||||
bondMatrix_ = new BondMatrixPartitionOfUnity(lammpsInterface_,*pairMap_,xPointer_,fe_mesh,accumulantInverseVolumes_);
|
bondMatrix_ = new BondMatrixPartitionOfUnity(lammpsInterface_,*pairMap_,xPointer_,fe_mesh,accumulantInverseVolumes_);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bondMatrix_ = new BondMatrixKernel(lammpsInterface_,*pairMap_,xPointer_,fe_mesh,kernelFunction_);
|
bondMatrix_ = new BondMatrixKernel(lammpsInterface_,*pairMap_,xPointer_,fe_mesh,kernelFunction_);
|
||||||
|
@ -470,7 +470,7 @@ namespace ATC {
|
||||||
|
|
||||||
FieldManager fmgr(this);
|
FieldManager fmgr(this);
|
||||||
|
|
||||||
// for(int index=0; index < NUM_TOTAL_FIELDS; ++index)
|
// for(int index=0; index < NUM_TOTAL_FIELDS; ++index)
|
||||||
for(int i=0; i < numFields_; ++i) {
|
for(int i=0; i < numFields_; ++i) {
|
||||||
FieldName index = indices_[i];
|
FieldName index = indices_[i];
|
||||||
if (fieldFlags_(index)) {
|
if (fieldFlags_(index)) {
|
||||||
|
@ -492,9 +492,9 @@ namespace ATC {
|
||||||
interscaleManager_.add_per_atom_quantity(c,tag);
|
interscaleManager_.add_per_atom_quantity(c,tag);
|
||||||
int projection = iter->second;
|
int projection = iter->second;
|
||||||
DIAG_MAN * w = nullptr;
|
DIAG_MAN * w = nullptr;
|
||||||
if (projection == VOLUME_NORMALIZATION )
|
if (projection == VOLUME_NORMALIZATION )
|
||||||
{ w = accumulantInverseVolumes_; }
|
{ w = accumulantInverseVolumes_; }
|
||||||
else if (projection == NUMBER_NORMALIZATION )
|
else if (projection == NUMBER_NORMALIZATION )
|
||||||
{ w = accumulantWeights_; }
|
{ w = accumulantWeights_; }
|
||||||
if (kernelFunction_ && kernelOnTheFly_) {
|
if (kernelFunction_ && kernelOnTheFly_) {
|
||||||
OnTheFlyKernelAccumulationNormalized * C = new OnTheFlyKernelAccumulationNormalized(this, c, kernelFunction_, atomCoarseGrainingPositions_, w);
|
OnTheFlyKernelAccumulationNormalized * C = new OnTheFlyKernelAccumulationNormalized(this, c, kernelFunction_, atomCoarseGrainingPositions_, w);
|
||||||
|
@ -507,7 +507,7 @@ namespace ATC {
|
||||||
outputFieldsTagged_[tag] = C;
|
outputFieldsTagged_[tag] = C;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -519,18 +519,18 @@ namespace ATC {
|
||||||
if ((!initialized_) || timeFilterManager_.need_reset()) {
|
if ((!initialized_) || timeFilterManager_.need_reset()) {
|
||||||
timeFilters_.reset(NUM_TOTAL_FIELDS+nComputes_);
|
timeFilters_.reset(NUM_TOTAL_FIELDS+nComputes_);
|
||||||
sampleCounter_ = 0;
|
sampleCounter_ = 0;
|
||||||
|
|
||||||
// for filtered fields
|
// for filtered fields
|
||||||
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
|
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
|
||||||
if (fieldFlags_(index)) {
|
if (fieldFlags_(index)) {
|
||||||
string name = field_to_string((FieldName) index);
|
string name = field_to_string((FieldName) index);
|
||||||
filteredData_[name] = 0.0;
|
filteredData_[name] = 0.0;
|
||||||
timeFilters_(index) = timeFilterManager_.construct();
|
timeFilters_(index) = timeFilterManager_.construct();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for filtered projected computes
|
// for filtered projected computes
|
||||||
|
|
||||||
// lists/accessing of fields ( & computes)
|
// lists/accessing of fields ( & computes)
|
||||||
map <string,int>::const_iterator iter;
|
map <string,int>::const_iterator iter;
|
||||||
int index = NUM_TOTAL_FIELDS;
|
int index = NUM_TOTAL_FIELDS;
|
||||||
|
@ -546,7 +546,7 @@ namespace ATC {
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// called after the end of a "run"
|
// called after the end of a "run"
|
||||||
void ATC_Transfer::finish()
|
void ATC_Transfer::finish()
|
||||||
{
|
{
|
||||||
// base class
|
// base class
|
||||||
ATC_Method::finish();
|
ATC_Method::finish();
|
||||||
|
@ -560,7 +560,7 @@ namespace ATC {
|
||||||
|
|
||||||
int argIdx = 0;
|
int argIdx = 0;
|
||||||
// check to see if it is a transfer class command
|
// check to see if it is a transfer class command
|
||||||
/*! \page man_hardy_fields fix_modify AtC fields
|
/*! \page man_hardy_fields fix_modify AtC fields
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC fields <all | none> \n
|
fix_modify AtC fields <all | none> \n
|
||||||
fix_modify AtC fields <add | delete> <list_of_fields> \n
|
fix_modify AtC fields <add | delete> <list_of_fields> \n
|
||||||
|
@ -575,13 +575,13 @@ namespace ATC {
|
||||||
temperature : temperature derived from the relative atomic kinetic energy (as done by ) \n
|
temperature : temperature derived from the relative atomic kinetic energy (as done by ) \n
|
||||||
kinetic_temperature : temperature derived from the full kinetic energy \n
|
kinetic_temperature : temperature derived from the full kinetic energy \n
|
||||||
number_density : simple kernel estimation of number of atoms per unit volume \n
|
number_density : simple kernel estimation of number of atoms per unit volume \n
|
||||||
stress :
|
stress :
|
||||||
Cauchy stress tensor for eulerian analysis (atom_element_map), or
|
Cauchy stress tensor for eulerian analysis (atom_element_map), or
|
||||||
1st Piola-Kirchhoff stress tensor for lagrangian analysis \n
|
1st Piola-Kirchhoff stress tensor for lagrangian analysis \n
|
||||||
transformed_stress :
|
transformed_stress :
|
||||||
1st Piola-Kirchhoff stress tensor for eulerian analysis (atom_element_map), or
|
1st Piola-Kirchhoff stress tensor for eulerian analysis (atom_element_map), or
|
||||||
Cauchy stress tensor for lagrangian analysis \n
|
Cauchy stress tensor for lagrangian analysis \n
|
||||||
heat_flux : spatial heat flux vector for eulerian,
|
heat_flux : spatial heat flux vector for eulerian,
|
||||||
or referential heat flux vector for lagrangian \n
|
or referential heat flux vector for lagrangian \n
|
||||||
potential_energy : potential energy per unit volume \n
|
potential_energy : potential energy per unit volume \n
|
||||||
kinetic_energy : kinetic energy per unit volume \n
|
kinetic_energy : kinetic energy per unit volume \n
|
||||||
|
@ -590,23 +590,23 @@ namespace ATC {
|
||||||
energy : total energy (potential + kinetic) per unit volume \n
|
energy : total energy (potential + kinetic) per unit volume \n
|
||||||
number_density : number of atoms per unit volume \n
|
number_density : number of atoms per unit volume \n
|
||||||
eshelby_stress: configurational stress (energy-momentum) tensor defined by Eshelby
|
eshelby_stress: configurational stress (energy-momentum) tensor defined by Eshelby
|
||||||
[References: Philos. Trans. Royal Soc. London A, Math. Phys. Sci., Vol. 244,
|
[References: Philos. Trans. Royal Soc. London A, Math. Phys. Sci., Vol. 244,
|
||||||
No. 877 (1951) pp. 87-112; J. Elasticity, Vol. 5, Nos. 3-4 (1975) pp. 321-335] \n
|
No. 877 (1951) pp. 87-112; J. Elasticity, Vol. 5, Nos. 3-4 (1975) pp. 321-335] \n
|
||||||
vacancy_concentration: volume fraction of vacancy content \n
|
vacancy_concentration: volume fraction of vacancy content \n
|
||||||
type_concentration: volume fraction of a specific atom type \n
|
type_concentration: volume fraction of a specific atom type \n
|
||||||
\section examples
|
\section examples
|
||||||
<TT> fix_modify AtC fields add velocity temperature </TT>
|
<TT> fix_modify AtC fields add velocity temperature </TT>
|
||||||
\section description
|
\section description
|
||||||
Allows modification of the fields calculated and output by the
|
Allows modification of the fields calculated and output by the
|
||||||
transfer class. The commands are cumulative, e.g.\n
|
transfer class. The commands are cumulative, e.g.\n
|
||||||
<TT> fix_modify AtC fields none </TT> \n
|
<TT> fix_modify AtC fields none </TT> \n
|
||||||
followed by \n
|
followed by \n
|
||||||
<TT> fix_modify AtC fields add velocity temperature </TT> \n
|
<TT> fix_modify AtC fields add velocity temperature </TT> \n
|
||||||
will only output the velocity and temperature fields.
|
will only output the velocity and temperature fields.
|
||||||
\section restrictions
|
\section restrictions
|
||||||
Must be used with the hardy/field type of AtC fix, see \ref man_fix_atc.
|
Must be used with the hardy/field type of AtC fix, see \ref man_fix_atc.
|
||||||
Currently, the stress and heat flux formulas are only correct for
|
Currently, the stress and heat flux formulas are only correct for
|
||||||
central force potentials, e.g. Lennard-Jones and EAM
|
central force potentials, e.g. Lennard-Jones and EAM
|
||||||
but not Stillinger-Weber.
|
but not Stillinger-Weber.
|
||||||
\section related
|
\section related
|
||||||
See \ref man_hardy_gradients , \ref man_hardy_rates and \ref man_hardy_computes
|
See \ref man_hardy_gradients , \ref man_hardy_rates and \ref man_hardy_computes
|
||||||
|
@ -615,30 +615,30 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
if (strcmp(arg[argIdx],"fields")==0) {
|
if (strcmp(arg[argIdx],"fields")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
if (strcmp(arg[argIdx],"all")==0) {
|
if (strcmp(arg[argIdx],"all")==0) {
|
||||||
outputFlags_ = true;
|
outputFlags_ = true;
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"none")==0) {
|
else if (strcmp(arg[argIdx],"none")==0) {
|
||||||
outputFlags_ = false;
|
outputFlags_ = false;
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"add")==0) {
|
else if (strcmp(arg[argIdx],"add")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
for (int i = argIdx; i < narg; ++i) {
|
for (int i = argIdx; i < narg; ++i) {
|
||||||
FieldName field_name = string_to_field(arg[i]);
|
FieldName field_name = string_to_field(arg[i]);
|
||||||
outputFlags_(field_name) = true;
|
outputFlags_(field_name) = true;
|
||||||
}
|
}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"delete")==0) {
|
else if (strcmp(arg[argIdx],"delete")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
for (int i = argIdx; i < narg; ++i) {
|
for (int i = argIdx; i < narg; ++i) {
|
||||||
FieldName field_name = string_to_field(arg[i]);
|
FieldName field_name = string_to_field(arg[i]);
|
||||||
outputFlags_(field_name) = false;
|
outputFlags_(field_name) = false;
|
||||||
}
|
}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
check_field_dependencies();
|
check_field_dependencies();
|
||||||
if (fieldFlags_(DISPLACEMENT)) { trackDisplacement_ = true; }
|
if (fieldFlags_(DISPLACEMENT)) { trackDisplacement_ = true; }
|
||||||
}
|
}
|
||||||
|
@ -649,17 +649,17 @@ namespace ATC {
|
||||||
- add | delete (keyword) = add or delete the calculation of gradients for the listed output fields \n
|
- add | delete (keyword) = add or delete the calculation of gradients for the listed output fields \n
|
||||||
- fields (keyword) = \n
|
- fields (keyword) = \n
|
||||||
gradients can be calculated for all fields listed in \ref man_hardy_fields
|
gradients can be calculated for all fields listed in \ref man_hardy_fields
|
||||||
|
|
||||||
\section examples
|
\section examples
|
||||||
<TT> fix_modify AtC gradients add temperature velocity stress </TT> \n
|
<TT> fix_modify AtC gradients add temperature velocity stress </TT> \n
|
||||||
<TT> fix_modify AtC gradients delete velocity </TT> \n
|
<TT> fix_modify AtC gradients delete velocity </TT> \n
|
||||||
\section description
|
\section description
|
||||||
Requests calculation and output of gradients of the fields from the
|
Requests calculation and output of gradients of the fields from the
|
||||||
transfer class. These gradients will be with regard to spatial or material
|
transfer class. These gradients will be with regard to spatial or material
|
||||||
coordinate for eulerian or lagrangian analysis, respectively, as specified by
|
coordinate for eulerian or lagrangian analysis, respectively, as specified by
|
||||||
atom_element_map (see \ref man_atom_element_map )
|
atom_element_map (see \ref man_atom_element_map )
|
||||||
\section restrictions
|
\section restrictions
|
||||||
Must be used with the hardy/field type of AtC fix
|
Must be used with the hardy/field type of AtC fix
|
||||||
( see \ref man_fix_atc )
|
( see \ref man_fix_atc )
|
||||||
\section related
|
\section related
|
||||||
\section default
|
\section default
|
||||||
|
@ -667,33 +667,33 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
else if (strcmp(arg[argIdx],"gradients")==0) {
|
else if (strcmp(arg[argIdx],"gradients")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
if (strcmp(arg[argIdx],"add")==0) {
|
if (strcmp(arg[argIdx],"add")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
FieldName field_name;
|
FieldName field_name;
|
||||||
for (int i = argIdx; i < narg; ++i) {
|
for (int i = argIdx; i < narg; ++i) {
|
||||||
field_name = string_to_field(arg[i]);
|
field_name = string_to_field(arg[i]);
|
||||||
gradFlags_(field_name) = true;
|
gradFlags_(field_name) = true;
|
||||||
}
|
}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"delete")==0) {
|
else if (strcmp(arg[argIdx],"delete")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
FieldName field_name;
|
FieldName field_name;
|
||||||
for (int i = argIdx; i < narg; ++i) {
|
for (int i = argIdx; i < narg; ++i) {
|
||||||
field_name = string_to_field(arg[i]);
|
field_name = string_to_field(arg[i]);
|
||||||
gradFlags_(field_name) = false;
|
gradFlags_(field_name) = false;
|
||||||
}
|
}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \page man_hardy_rates fix_modify AtC rates
|
/*! \page man_hardy_rates fix_modify AtC rates
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC rates <add | delete> <list_of_fields> \n
|
fix_modify AtC rates <add | delete> <list_of_fields> \n
|
||||||
- add | delete (keyword) = add or delete the calculation of rates (time derivatives) for the listed output fields \n
|
- add | delete (keyword) = add or delete the calculation of rates (time derivatives) for the listed output fields \n
|
||||||
- fields (keyword) = \n
|
- fields (keyword) = \n
|
||||||
rates can be calculated for all fields listed in \ref man_hardy_fields
|
rates can be calculated for all fields listed in \ref man_hardy_fields
|
||||||
|
|
||||||
\section examples
|
\section examples
|
||||||
<TT> fix_modify AtC rates add temperature velocity stress </TT> \n
|
<TT> fix_modify AtC rates add temperature velocity stress </TT> \n
|
||||||
<TT> fix_modify AtC rates delete stress </TT> \n
|
<TT> fix_modify AtC rates delete stress </TT> \n
|
||||||
|
@ -703,7 +703,7 @@ namespace ATC {
|
||||||
are the partial time derivatives of the nodal fields, not the full (material) time
|
are the partial time derivatives of the nodal fields, not the full (material) time
|
||||||
derivatives. \n
|
derivatives. \n
|
||||||
\section restrictions
|
\section restrictions
|
||||||
Must be used with the hardy/field type of AtC fix
|
Must be used with the hardy/field type of AtC fix
|
||||||
( see \ref man_fix_atc )
|
( see \ref man_fix_atc )
|
||||||
\section related
|
\section related
|
||||||
\section default
|
\section default
|
||||||
|
@ -711,16 +711,16 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
else if (strcmp(arg[argIdx],"rates")==0) {
|
else if (strcmp(arg[argIdx],"rates")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
if (strcmp(arg[argIdx],"add")==0) {
|
if (strcmp(arg[argIdx],"add")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
FieldName field_name;
|
FieldName field_name;
|
||||||
for (int i = argIdx; i < narg; ++i) {
|
for (int i = argIdx; i < narg; ++i) {
|
||||||
field_name = string_to_field(arg[i]);
|
field_name = string_to_field(arg[i]);
|
||||||
rateFlags_(field_name) = true;
|
rateFlags_(field_name) = true;
|
||||||
}
|
}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"delete")==0) {
|
else if (strcmp(arg[argIdx],"delete")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
FieldName field_name;
|
FieldName field_name;
|
||||||
for (int i = argIdx; i < narg; ++i) {
|
for (int i = argIdx; i < narg; ++i) {
|
||||||
|
@ -728,7 +728,7 @@ namespace ATC {
|
||||||
rateFlags_(field_name) = false;
|
rateFlags_(field_name) = false;
|
||||||
}
|
}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ namespace ATC {
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC pair_interactions <on|off> \n
|
fix_modify AtC pair_interactions <on|off> \n
|
||||||
fix_modify AtC bond_interactions <on|off> \n
|
fix_modify AtC bond_interactions <on|off> \n
|
||||||
|
|
||||||
\section examples
|
\section examples
|
||||||
<TT> fix_modify AtC bond_interactions on </TT> \n
|
<TT> fix_modify AtC bond_interactions on </TT> \n
|
||||||
\section description
|
\section description
|
||||||
|
@ -748,27 +748,27 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
if (strcmp(arg[argIdx],"pair_interactions")==0) { // default true
|
if (strcmp(arg[argIdx],"pair_interactions")==0) { // default true
|
||||||
argIdx++;
|
argIdx++;
|
||||||
if (strcmp(arg[argIdx],"on")==0) { hasPairs_ = true; }
|
if (strcmp(arg[argIdx],"on")==0) { hasPairs_ = true; }
|
||||||
else { hasPairs_ = false;}
|
else { hasPairs_ = false;}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
if (strcmp(arg[argIdx],"bond_interactions")==0) { // default false
|
if (strcmp(arg[argIdx],"bond_interactions")==0) { // default false
|
||||||
argIdx++;
|
argIdx++;
|
||||||
if (strcmp(arg[argIdx],"on")==0) { hasBonds_ = true; }
|
if (strcmp(arg[argIdx],"on")==0) { hasBonds_ = true; }
|
||||||
else { hasBonds_ = false;}
|
else { hasBonds_ = false;}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \page man_hardy_computes fix_modify AtC computes
|
/*! \page man_hardy_computes fix_modify AtC computes
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC computes <add | delete> [per-atom compute id] <volume | number> \n
|
fix_modify AtC computes <add | delete> [per-atom compute id] <volume | number> \n
|
||||||
- add | delete (keyword) = add or delete the calculation of an equivalent continuum field
|
- add | delete (keyword) = add or delete the calculation of an equivalent continuum field
|
||||||
for the specified per-atom compute as volume or number density quantity \n
|
for the specified per-atom compute as volume or number density quantity \n
|
||||||
- per-atom compute id = name/id for per-atom compute,
|
- per-atom compute id = name/id for per-atom compute,
|
||||||
fields can be calculated for all per-atom computes available from LAMMPS \n
|
fields can be calculated for all per-atom computes available from LAMMPS \n
|
||||||
- volume | number (keyword) = field created is a per-unit-volume quantity
|
- volume | number (keyword) = field created is a per-unit-volume quantity
|
||||||
or a per-atom quantity as weighted by kernel functions \n
|
or a per-atom quantity as weighted by kernel functions \n
|
||||||
|
|
||||||
\section examples
|
\section examples
|
||||||
<TT> compute virial all stress/atom </TT> \n
|
<TT> compute virial all stress/atom </TT> \n
|
||||||
<TT> fix_modify AtC computes add virial volume </TT> \n
|
<TT> fix_modify AtC computes add virial volume </TT> \n
|
||||||
|
@ -782,24 +782,24 @@ namespace ATC {
|
||||||
Must be used with the hardy/field type of AtC fix ( see \ref man_fix_atc ) \n
|
Must be used with the hardy/field type of AtC fix ( see \ref man_fix_atc ) \n
|
||||||
Per-atom compute must be specified before corresponding continuum field can be requested \n
|
Per-atom compute must be specified before corresponding continuum field can be requested \n
|
||||||
\section related
|
\section related
|
||||||
See manual page for compute
|
See manual page for compute
|
||||||
\section default
|
\section default
|
||||||
No defaults exist for this command
|
No defaults exist for this command
|
||||||
*/
|
*/
|
||||||
else if (strcmp(arg[argIdx],"computes")==0) {
|
else if (strcmp(arg[argIdx],"computes")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
if (strcmp(arg[argIdx],"add")==0) {
|
if (strcmp(arg[argIdx],"add")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
string tag(arg[argIdx++]);
|
string tag(arg[argIdx++]);
|
||||||
int normalization = NO_NORMALIZATION;
|
int normalization = NO_NORMALIZATION;
|
||||||
if (narg > argIdx) {
|
if (narg > argIdx) {
|
||||||
if (strcmp(arg[argIdx],"volume")==0) {
|
if (strcmp(arg[argIdx],"volume")==0) {
|
||||||
normalization = VOLUME_NORMALIZATION;
|
normalization = VOLUME_NORMALIZATION;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"number")==0) {
|
else if (strcmp(arg[argIdx],"number")==0) {
|
||||||
normalization = NUMBER_NORMALIZATION;
|
normalization = NUMBER_NORMALIZATION;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"mass")==0) {
|
else if (strcmp(arg[argIdx],"mass")==0) {
|
||||||
normalization = MASS_NORMALIZATION;
|
normalization = MASS_NORMALIZATION;
|
||||||
throw ATC_Error("mass normalized not implemented");
|
throw ATC_Error("mass normalized not implemented");
|
||||||
}
|
}
|
||||||
|
@ -807,8 +807,8 @@ namespace ATC {
|
||||||
computes_[tag] = normalization;
|
computes_[tag] = normalization;
|
||||||
nComputes_++;
|
nComputes_++;
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(arg[argIdx],"delete")==0) {
|
else if (strcmp(arg[argIdx],"delete")==0) {
|
||||||
argIdx++;
|
argIdx++;
|
||||||
string tag(arg[argIdx]);
|
string tag(arg[argIdx]);
|
||||||
if (computes_.find(tag) != computes_.end()) {
|
if (computes_.find(tag) != computes_.end()) {
|
||||||
|
@ -816,10 +816,10 @@ namespace ATC {
|
||||||
nComputes_--;
|
nComputes_--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ATC_Error(tag+" compute is not in list");
|
throw ATC_Error(tag+" compute is not in list");
|
||||||
}
|
}
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -833,7 +833,7 @@ namespace ATC {
|
||||||
Specifies a frequency at which fields are computed for the case
|
Specifies a frequency at which fields are computed for the case
|
||||||
where time filters are being applied.
|
where time filters are being applied.
|
||||||
\section restrictions
|
\section restrictions
|
||||||
Must be used with the hardy/field AtC fix ( see \ref man_fix_atc )
|
Must be used with the hardy/field AtC fix ( see \ref man_fix_atc )
|
||||||
and is only relevant when time filters are being used.
|
and is only relevant when time filters are being used.
|
||||||
\section related
|
\section related
|
||||||
\section default
|
\section default
|
||||||
|
@ -869,11 +869,11 @@ namespace ATC {
|
||||||
// REFACTOR move this to post_neighbor
|
// REFACTOR move this to post_neighbor
|
||||||
void ATC_Transfer::pre_final_integrate()
|
void ATC_Transfer::pre_final_integrate()
|
||||||
{
|
{
|
||||||
// update time
|
// update time
|
||||||
update_time(); // time uses step if dt = 0
|
update_time(); // time uses step if dt = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( neighborReset_ && sample_now() ) {
|
if ( neighborReset_ && sample_now() ) {
|
||||||
if (! kernelOnTheFly_ ) {
|
if (! kernelOnTheFly_ ) {
|
||||||
if (!moleculeIds_.empty()) compute_kernel_matrix_molecule(); //KKM add
|
if (!moleculeIds_.empty()) compute_kernel_matrix_molecule(); //KKM add
|
||||||
|
@ -889,7 +889,7 @@ namespace ATC {
|
||||||
// compute spatially smoothed quantities
|
// compute spatially smoothed quantities
|
||||||
double dt = lammpsInterface_->dt();
|
double dt = lammpsInterface_->dt();
|
||||||
if ( sample_now() ) {
|
if ( sample_now() ) {
|
||||||
|
|
||||||
bool needsBond = (! bondOnTheFly_ ) &&
|
bool needsBond = (! bondOnTheFly_ ) &&
|
||||||
(fieldFlags_(STRESS)
|
(fieldFlags_(STRESS)
|
||||||
|| fieldFlags_(ESHELBY_STRESS)
|
|| fieldFlags_(ESHELBY_STRESS)
|
||||||
|
@ -898,7 +898,7 @@ namespace ATC {
|
||||||
if ( needsBond ) {
|
if ( needsBond ) {
|
||||||
if (pairMap_->need_reset()) {
|
if (pairMap_->need_reset()) {
|
||||||
// ATC::LammpsInterface::instance()->print_msg("Recomputing bond matrix due to atomReset_ value");
|
// ATC::LammpsInterface::instance()->print_msg("Recomputing bond matrix due to atomReset_ value");
|
||||||
compute_bond_matrix();
|
compute_bond_matrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
time_filter_pre (dt);
|
time_filter_pre (dt);
|
||||||
|
@ -923,8 +923,8 @@ namespace ATC {
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
void ATC_Transfer::compute_fields(void)
|
void ATC_Transfer::compute_fields(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
// keep per-atom computes fresh. JAZ and REJ not sure why;
|
// keep per-atom computes fresh. JAZ and REJ not sure why;
|
||||||
// need to confer with JAT. (JAZ, 4/5/12)
|
// need to confer with JAT. (JAZ, 4/5/12)
|
||||||
interscaleManager_.lammps_force_reset();
|
interscaleManager_.lammps_force_reset();
|
||||||
|
|
||||||
|
@ -937,16 +937,16 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldFlags_(STRESS))
|
if (fieldFlags_(STRESS))
|
||||||
compute_stress(hardyData_["stress"].set_quantity());
|
compute_stress(hardyData_["stress"].set_quantity());
|
||||||
if (fieldFlags_(HEAT_FLUX))
|
if (fieldFlags_(HEAT_FLUX))
|
||||||
compute_heatflux(hardyData_["heat_flux"].set_quantity());
|
compute_heatflux(hardyData_["heat_flux"].set_quantity());
|
||||||
// molecule data
|
// molecule data
|
||||||
if (fieldFlags_(DIPOLE_MOMENT))
|
if (fieldFlags_(DIPOLE_MOMENT))
|
||||||
compute_dipole_moment(hardyData_["dipole_moment"].set_quantity());
|
compute_dipole_moment(hardyData_["dipole_moment"].set_quantity());
|
||||||
if (fieldFlags_(QUADRUPOLE_MOMENT))
|
if (fieldFlags_(QUADRUPOLE_MOMENT))
|
||||||
compute_quadrupole_moment(hardyData_["quadrupole_moment"].set_quantity());
|
compute_quadrupole_moment(hardyData_["quadrupole_moment"].set_quantity());
|
||||||
if (fieldFlags_(DISLOCATION_DENSITY))
|
if (fieldFlags_(DISLOCATION_DENSITY))
|
||||||
compute_dislocation_density(hardyData_["dislocation_density"].set_quantity());
|
compute_dislocation_density(hardyData_["dislocation_density"].set_quantity());
|
||||||
|
|
||||||
// (2) derived quantities
|
// (2) derived quantities
|
||||||
|
@ -963,7 +963,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// compute: eshelby stress
|
// compute: eshelby stress
|
||||||
if (fieldFlags_(ESHELBY_STRESS)) {
|
if (fieldFlags_(ESHELBY_STRESS)) {
|
||||||
{
|
{
|
||||||
compute_eshelby_stress(hardyData_["eshelby_stress"].set_quantity(),
|
compute_eshelby_stress(hardyData_["eshelby_stress"].set_quantity(),
|
||||||
|
@ -985,18 +985,18 @@ namespace ATC {
|
||||||
E,hardyData_["stress"].quantity(),
|
E,hardyData_["stress"].quantity(),
|
||||||
hardyData_["displacement_gradient"].quantity());
|
hardyData_["displacement_gradient"].quantity());
|
||||||
}
|
}
|
||||||
// compute: cauchy born stress
|
// compute: cauchy born stress
|
||||||
if (fieldFlags_(CAUCHY_BORN_STRESS)) {
|
if (fieldFlags_(CAUCHY_BORN_STRESS)) {
|
||||||
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
|
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
|
||||||
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
|
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
|
||||||
cauchy_born_stress(hardyData_["displacement_gradient"].quantity(),
|
cauchy_born_stress(hardyData_["displacement_gradient"].quantity(),
|
||||||
hardyData_["cauchy_born_stress"].set_quantity(), temp);
|
hardyData_["cauchy_born_stress"].set_quantity(), temp);
|
||||||
}
|
}
|
||||||
// compute: cauchy born energy
|
// compute: cauchy born energy
|
||||||
if (fieldFlags_(CAUCHY_BORN_ENERGY)) {
|
if (fieldFlags_(CAUCHY_BORN_ENERGY)) {
|
||||||
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
|
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
|
||||||
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
|
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
|
||||||
cauchy_born_energy(hardyData_["displacement_gradient"].quantity(),
|
cauchy_born_energy(hardyData_["displacement_gradient"].quantity(),
|
||||||
hardyData_["cauchy_born_energy"].set_quantity(), temp);
|
hardyData_["cauchy_born_energy"].set_quantity(), temp);
|
||||||
}
|
}
|
||||||
// 1st PK transformed to cauchy (lag) or cauchy transformed to 1st PK (eul)
|
// 1st PK transformed to cauchy (lag) or cauchy transformed to 1st PK (eul)
|
||||||
|
@ -1014,13 +1014,13 @@ namespace ATC {
|
||||||
compute_electric_potential(
|
compute_electric_potential(
|
||||||
hardyData_[field_to_string(ELECTRIC_POTENTIAL)].set_quantity());
|
hardyData_[field_to_string(ELECTRIC_POTENTIAL)].set_quantity());
|
||||||
}
|
}
|
||||||
// compute: rotation and/or stretch from deformation gradient
|
// compute: rotation and/or stretch from deformation gradient
|
||||||
if (fieldFlags_(ROTATION) || fieldFlags_(STRETCH)) {
|
if (fieldFlags_(ROTATION) || fieldFlags_(STRETCH)) {
|
||||||
compute_polar_decomposition(hardyData_["rotation"].set_quantity(),
|
compute_polar_decomposition(hardyData_["rotation"].set_quantity(),
|
||||||
hardyData_["stretch"].set_quantity(),
|
hardyData_["stretch"].set_quantity(),
|
||||||
hardyData_["displacement_gradient"].quantity());
|
hardyData_["displacement_gradient"].quantity());
|
||||||
}
|
}
|
||||||
// compute: rotation and/or stretch from deformation gradient
|
// compute: rotation and/or stretch from deformation gradient
|
||||||
if (fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)) {
|
if (fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)) {
|
||||||
compute_elastic_deformation_gradient2(hardyData_["elastic_deformation_gradient"].set_quantity(),
|
compute_elastic_deformation_gradient2(hardyData_["elastic_deformation_gradient"].set_quantity(),
|
||||||
hardyData_["stress"].quantity(),
|
hardyData_["stress"].quantity(),
|
||||||
|
@ -1082,9 +1082,9 @@ namespace ATC {
|
||||||
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
||||||
FT = F.transpose();
|
FT = F.transpose();
|
||||||
FTINV = inv(FT);
|
FTINV = inv(FT);
|
||||||
|
|
||||||
// volumes are already reference volumes.
|
// volumes are already reference volumes.
|
||||||
PK1 = CAUCHY*FTINV;
|
PK1 = CAUCHY*FTINV;
|
||||||
matrix_to_vector(k,PK1,myData);
|
matrix_to_vector(k,PK1,myData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1094,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}// end of compute_fields routine
|
}// end of compute_fields routine
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
@ -1156,7 +1156,7 @@ namespace ATC {
|
||||||
filteredData_[grad_field] = hardyData_[grad_field];
|
filteredData_[grad_field] = hardyData_[grad_field];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lists/accessing of fields ( & computes)
|
// lists/accessing of fields ( & computes)
|
||||||
map <string,int>::const_iterator iter;
|
map <string,int>::const_iterator iter;
|
||||||
int index = NUM_TOTAL_FIELDS;
|
int index = NUM_TOTAL_FIELDS;
|
||||||
|
@ -1177,7 +1177,7 @@ namespace ATC {
|
||||||
void ATC_Transfer::output()
|
void ATC_Transfer::output()
|
||||||
{
|
{
|
||||||
feEngine_->departition_mesh();
|
feEngine_->departition_mesh();
|
||||||
|
|
||||||
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
|
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
|
||||||
if (outputFlags_(index)) {
|
if (outputFlags_(index)) {
|
||||||
FieldName fName = (FieldName) index;
|
FieldName fName = (FieldName) index;
|
||||||
|
@ -1185,7 +1185,7 @@ namespace ATC {
|
||||||
fields_[fName] = filteredData_[name];
|
fields_[fName] = filteredData_[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ATC_Method::output();
|
ATC_Method::output();
|
||||||
if (lammpsInterface_->comm_rank() == 0) {
|
if (lammpsInterface_->comm_rank() == 0) {
|
||||||
// data
|
// data
|
||||||
|
@ -1209,7 +1209,7 @@ namespace ATC {
|
||||||
output_data[grad_name] = & ( filteredData_[grad_name].set_quantity());
|
output_data[grad_name] = & ( filteredData_[grad_name].set_quantity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lists/accessing of fields ( & computes)
|
// lists/accessing of fields ( & computes)
|
||||||
map <string,int>::const_iterator iter;
|
map <string,int>::const_iterator iter;
|
||||||
for (iter = computes_.begin(); iter != computes_.end(); iter++) {
|
for (iter = computes_.begin(); iter != computes_.end(); iter++) {
|
||||||
|
@ -1226,7 +1226,7 @@ namespace ATC {
|
||||||
output_data["NodalInverseVolumes"] = &nodalInverseVolumes;
|
output_data["NodalInverseVolumes"] = &nodalInverseVolumes;
|
||||||
|
|
||||||
// output
|
// output
|
||||||
feEngine_->write_data(output_index(), & output_data);
|
feEngine_->write_data(output_index(), & output_data);
|
||||||
}
|
}
|
||||||
feEngine_->partition_mesh();
|
feEngine_->partition_mesh();
|
||||||
}
|
}
|
||||||
|
@ -1235,7 +1235,7 @@ namespace ATC {
|
||||||
|
|
||||||
/////// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
/////// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// computes nodeData = N*atomData
|
// computes nodeData = N*atomData
|
||||||
void ATC_Transfer::project(const DENS_MAT & atomData,
|
void ATC_Transfer::project(const DENS_MAT & atomData,
|
||||||
DENS_MAT & nodeData)
|
DENS_MAT & nodeData)
|
||||||
{
|
{
|
||||||
|
@ -1290,8 +1290,8 @@ namespace ATC {
|
||||||
void ATC_Transfer::project_count_normalized(const DENS_MAT & atomData,
|
void ATC_Transfer::project_count_normalized(const DENS_MAT & atomData,
|
||||||
DENS_MAT & nodeData)
|
DENS_MAT & nodeData)
|
||||||
{
|
{
|
||||||
DENS_MAT tmp;
|
DENS_MAT tmp;
|
||||||
project(atomData,tmp);
|
project(atomData,tmp);
|
||||||
nodeData = (accumulantWeights_->quantity())*tmp;
|
nodeData = (accumulantWeights_->quantity())*tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1301,7 +1301,7 @@ namespace ATC {
|
||||||
DENS_MAT & nodeData)
|
DENS_MAT & nodeData)
|
||||||
{
|
{
|
||||||
DENS_MAT tmp;
|
DENS_MAT tmp;
|
||||||
project(atomData,tmp);
|
project(atomData,tmp);
|
||||||
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
|
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1310,8 +1310,8 @@ namespace ATC {
|
||||||
void ATC_Transfer::project_volume_normalized_molecule(const DENS_MAT & molData,
|
void ATC_Transfer::project_volume_normalized_molecule(const DENS_MAT & molData,
|
||||||
DENS_MAT & nodeData)
|
DENS_MAT & nodeData)
|
||||||
{
|
{
|
||||||
DENS_MAT tmp;
|
DENS_MAT tmp;
|
||||||
project_molecule(molData,tmp);
|
project_molecule(molData,tmp);
|
||||||
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
|
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1320,8 +1320,8 @@ namespace ATC {
|
||||||
void ATC_Transfer::project_volume_normalized_molecule_gradient(const DENS_MAT & molData,
|
void ATC_Transfer::project_volume_normalized_molecule_gradient(const DENS_MAT & molData,
|
||||||
DENS_MAT & nodeData)
|
DENS_MAT & nodeData)
|
||||||
{
|
{
|
||||||
DENS_MAT tmp;
|
DENS_MAT tmp;
|
||||||
project_molecule_gradient(molData,tmp);
|
project_molecule_gradient(molData,tmp);
|
||||||
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
|
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1354,14 +1354,14 @@ namespace ATC {
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// computes "virial" part of heat flux
|
// computes "virial" part of heat flux
|
||||||
// This is correct ONLY for pair potentials.
|
// This is correct ONLY for pair potentials.
|
||||||
void ATC_Transfer::compute_heat_matrix()
|
void ATC_Transfer::compute_heat_matrix()
|
||||||
{
|
{
|
||||||
atomicHeatMatrix_ = pairHeatFlux_->quantity();
|
atomicHeatMatrix_ = pairHeatFlux_->quantity();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// set xPointer_ to xref or xatom depending on Lagrangian/Eulerian analysis
|
// set xPointer_ to xref or xatom depending on Lagrangian/Eulerian analysis
|
||||||
void ATC_Transfer::set_xPointer()
|
void ATC_Transfer::set_xPointer()
|
||||||
{
|
{
|
||||||
xPointer_ = xref_;
|
xPointer_ = xref_;
|
||||||
|
@ -1386,7 +1386,7 @@ namespace ATC {
|
||||||
fieldFlags_(DISPLACEMENT) = true;
|
fieldFlags_(DISPLACEMENT) = true;
|
||||||
}
|
}
|
||||||
if (fieldFlags_(CAUCHY_BORN_STRESS)
|
if (fieldFlags_(CAUCHY_BORN_STRESS)
|
||||||
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|
||||||
|| fieldFlags_(CAUCHY_BORN_ESHELBY_STRESS)
|
|| fieldFlags_(CAUCHY_BORN_ESHELBY_STRESS)
|
||||||
|| fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)) {
|
|| fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)) {
|
||||||
if (! (cauchyBornStress_) ) {
|
if (! (cauchyBornStress_) ) {
|
||||||
|
@ -1419,7 +1419,7 @@ namespace ATC {
|
||||||
fieldFlags_(KINETIC_ENERGY) = true;
|
fieldFlags_(KINETIC_ENERGY) = true;
|
||||||
}
|
}
|
||||||
if (fieldFlags_(TEMPERATURE) || fieldFlags_(HEAT_FLUX) ||
|
if (fieldFlags_(TEMPERATURE) || fieldFlags_(HEAT_FLUX) ||
|
||||||
fieldFlags_(KINETIC_ENERGY) || fieldFlags_(THERMAL_ENERGY) ||
|
fieldFlags_(KINETIC_ENERGY) || fieldFlags_(THERMAL_ENERGY) ||
|
||||||
fieldFlags_(ENERGY) || fieldFlags_(INTERNAL_ENERGY) ||
|
fieldFlags_(ENERGY) || fieldFlags_(INTERNAL_ENERGY) ||
|
||||||
fieldFlags_(KINETIC_ENERGY) || (fieldFlags_(STRESS) &&
|
fieldFlags_(KINETIC_ENERGY) || (fieldFlags_(STRESS) &&
|
||||||
atomToElementMapType_ == EULERIAN) ) {
|
atomToElementMapType_ == EULERIAN) ) {
|
||||||
|
@ -1438,15 +1438,15 @@ namespace ATC {
|
||||||
fieldFlags_(NUMBER_DENSITY) = true;
|
fieldFlags_(NUMBER_DENSITY) = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldFlags_(ROTATION) ||
|
if (fieldFlags_(ROTATION) ||
|
||||||
fieldFlags_(STRETCH)) {
|
fieldFlags_(STRETCH)) {
|
||||||
fieldFlags_(DISPLACEMENT) = true;
|
fieldFlags_(DISPLACEMENT) = true;
|
||||||
}
|
}
|
||||||
if (fieldFlags_(ESHELBY_STRESS)
|
if (fieldFlags_(ESHELBY_STRESS)
|
||||||
|| fieldFlags_(CAUCHY_BORN_STRESS)
|
|| fieldFlags_(CAUCHY_BORN_STRESS)
|
||||||
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|
||||||
|| fieldFlags_(CAUCHY_BORN_ESHELBY_STRESS)
|
|| fieldFlags_(CAUCHY_BORN_ESHELBY_STRESS)
|
||||||
|| fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)
|
|| fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)
|
||||||
|| fieldFlags_(VACANCY_CONCENTRATION)
|
|| fieldFlags_(VACANCY_CONCENTRATION)
|
||||||
|| fieldFlags_(ROTATION)
|
|| fieldFlags_(ROTATION)
|
||||||
|| fieldFlags_(STRETCH) ) {
|
|| fieldFlags_(STRETCH) ) {
|
||||||
|
@ -1459,8 +1459,8 @@ namespace ATC {
|
||||||
throw ATC_Error("Calculation of stress field not possible with selected pair type.");
|
throw ATC_Error("Calculation of stress field not possible with selected pair type.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============== THIN WRAPPERS ====================================
|
//============== THIN WRAPPERS ====================================
|
||||||
// OBSOLETE
|
// OBSOLETE
|
||||||
|
@ -1492,7 +1492,7 @@ namespace ATC {
|
||||||
|
|
||||||
// calculate kinetic energy tensor part of stress for Eulerian analysis
|
// calculate kinetic energy tensor part of stress for Eulerian analysis
|
||||||
if (atomToElementMapType_ == EULERIAN && nLocal_>0) {
|
if (atomToElementMapType_ == EULERIAN && nLocal_>0) {
|
||||||
compute_kinetic_stress(stress);
|
compute_kinetic_stress(stress);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// zero stress table for Lagrangian analysis or if nLocal_ = 0
|
// zero stress table for Lagrangian analysis or if nLocal_ = 0
|
||||||
|
@ -1511,7 +1511,7 @@ namespace ATC {
|
||||||
compute_force_matrix();
|
compute_force_matrix();
|
||||||
// calculate force part of stress tensor
|
// calculate force part of stress tensor
|
||||||
local_potential_hardy_stress = atomicBondMatrix_*atomicForceMatrix_;
|
local_potential_hardy_stress = atomicBondMatrix_*atomicForceMatrix_;
|
||||||
local_potential_hardy_stress *= 0.5;
|
local_potential_hardy_stress *= 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// global summation of potential part of stress tensor
|
// global summation of potential part of stress tensor
|
||||||
|
@ -1570,7 +1570,7 @@ namespace ATC {
|
||||||
compute_kinetic_heatflux(flux);
|
compute_kinetic_heatflux(flux);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
flux.zero(); // zero stress table for Lagrangian analysis
|
flux.zero(); // zero stress table for Lagrangian analysis
|
||||||
}
|
}
|
||||||
// add potential part of heat flux vector
|
// add potential part of heat flux vector
|
||||||
int nrows = flux.nRows();
|
int nrows = flux.nRows();
|
||||||
|
@ -1628,11 +1628,11 @@ namespace ATC {
|
||||||
// - e^0_I v_I + \sigma^T_I v_I
|
// - e^0_I v_I + \sigma^T_I v_I
|
||||||
for (int i = 0; i < nNodes_; i++) {
|
for (int i = 0; i < nNodes_; i++) {
|
||||||
double e_i = energy(i,0);
|
double e_i = energy(i,0);
|
||||||
flux(i,0) += (e_i + stress(i,0))*velocity(i,0)
|
flux(i,0) += (e_i + stress(i,0))*velocity(i,0)
|
||||||
+ stress(i,3)*velocity(i,1)+ stress(i,4)*velocity(i,2);
|
+ stress(i,3)*velocity(i,1)+ stress(i,4)*velocity(i,2);
|
||||||
flux(i,1) += (e_i + stress(i,1))*velocity(i,1)
|
flux(i,1) += (e_i + stress(i,1))*velocity(i,1)
|
||||||
+ stress(i,3)*velocity(i,0)+ stress(i,5)*velocity(i,2);
|
+ stress(i,3)*velocity(i,0)+ stress(i,5)*velocity(i,2);
|
||||||
flux(i,2) += (e_i + stress(i,2))*velocity(i,2)
|
flux(i,2) += (e_i + stress(i,2))*velocity(i,2)
|
||||||
+ stress(i,4)*velocity(i,0)+ stress(i,5)*velocity(i,1);
|
+ stress(i,4)*velocity(i,0)+ stress(i,5)*velocity(i,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1643,7 +1643,7 @@ namespace ATC {
|
||||||
const DENS_MAT & rho = (restrictedCharge_->quantity());
|
const DENS_MAT & rho = (restrictedCharge_->quantity());
|
||||||
SPAR_MAT K;
|
SPAR_MAT K;
|
||||||
feEngine_->stiffness_matrix(K);
|
feEngine_->stiffness_matrix(K);
|
||||||
double permittivity = lammpsInterface_->dielectric();
|
double permittivity = lammpsInterface_->dielectric();
|
||||||
permittivity *= LammpsInterface::instance()->epsilon0();
|
permittivity *= LammpsInterface::instance()->epsilon0();
|
||||||
K *= permittivity;
|
K *= permittivity;
|
||||||
BC_SET bcs;
|
BC_SET bcs;
|
||||||
|
@ -1670,7 +1670,7 @@ namespace ATC {
|
||||||
|
|
||||||
for (int i = 0; i < nLocal_; i++) {
|
for (int i = 0; i < nLocal_; i++) {
|
||||||
int atomIdx = internalToAtom_(i);
|
int atomIdx = internalToAtom_(i);
|
||||||
if (type[atomIdx] != 13) {
|
if (type[atomIdx] != 13) {
|
||||||
atomCnt(i,0) = myAtomicWeights(i,i);
|
atomCnt(i,0) = myAtomicWeights(i,i);
|
||||||
atomic_weight_sum += myAtomicWeights(i,i);
|
atomic_weight_sum += myAtomicWeights(i,i);
|
||||||
number_atoms++;
|
number_atoms++;
|
||||||
|
@ -1725,7 +1725,7 @@ namespace ATC {
|
||||||
#ifndef H_BASED
|
#ifndef H_BASED
|
||||||
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
||||||
#endif
|
#endif
|
||||||
FT = F.transpose();
|
FT = F.transpose();
|
||||||
}
|
}
|
||||||
else if (atomToElementMapType_ == EULERIAN) {
|
else if (atomToElementMapType_ == EULERIAN) {
|
||||||
vector_to_symm_matrix(i,S,P);
|
vector_to_symm_matrix(i,S,P);
|
||||||
|
@ -1741,9 +1741,9 @@ namespace ATC {
|
||||||
// Q stores (1-H)
|
// Q stores (1-H)
|
||||||
Q -= FT.transpose();
|
Q -= FT.transpose();
|
||||||
DENS_MAT F(3,3);
|
DENS_MAT F(3,3);
|
||||||
F = inv(Q);
|
F = inv(Q);
|
||||||
FT = F.transpose();
|
FT = F.transpose();
|
||||||
ESH = FT*ESH;
|
ESH = FT*ESH;
|
||||||
}
|
}
|
||||||
// copy to global
|
// copy to global
|
||||||
matrix_to_vector(i,ESH,M);
|
matrix_to_vector(i,ESH,M);
|
||||||
|
@ -1761,7 +1761,7 @@ namespace ATC {
|
||||||
DENS_MAT_VEC &h = hField[DISPLACEMENT];
|
DENS_MAT_VEC &h = hField[DISPLACEMENT];
|
||||||
h.assign(nsd_, DENS_MAT(nNodes_,nsd_));
|
h.assign(nsd_, DENS_MAT(nNodes_,nsd_));
|
||||||
tField.assign(nsd_, DENS_MAT(nNodes_,nsd_));
|
tField.assign(nsd_, DENS_MAT(nNodes_,nsd_));
|
||||||
// each row is the CB stress at a node stored in voigt form
|
// each row is the CB stress at a node stored in voigt form
|
||||||
T.reset(nNodes_,FieldSizes[CAUCHY_BORN_STRESS]);
|
T.reset(nNodes_,FieldSizes[CAUCHY_BORN_STRESS]);
|
||||||
const double nktv2p = lammpsInterface_->nktv2p();
|
const double nktv2p = lammpsInterface_->nktv2p();
|
||||||
const double fact = -lammpsInterface_->mvv2e()*nktv2p;
|
const double fact = -lammpsInterface_->mvv2e()*nktv2p;
|
||||||
|
@ -1779,7 +1779,7 @@ namespace ATC {
|
||||||
DENS_MAT S(nNodes_,6);
|
DENS_MAT S(nNodes_,6);
|
||||||
symm_dens_mat_vec_to_vector(tField,S);
|
symm_dens_mat_vec_to_vector(tField,S);
|
||||||
S *= fact;
|
S *= fact;
|
||||||
|
|
||||||
// tField/S holds the 2nd P-K stress tensor. Transform to
|
// tField/S holds the 2nd P-K stress tensor. Transform to
|
||||||
// Cauchy for EULERIAN analysis, transform to 1st P-K
|
// Cauchy for EULERIAN analysis, transform to 1st P-K
|
||||||
// for LAGRANGIAN analysis.
|
// for LAGRANGIAN analysis.
|
||||||
|
@ -1799,7 +1799,7 @@ namespace ATC {
|
||||||
FT = transpose(F);
|
FT = transpose(F);
|
||||||
double J = det(F);
|
double J = det(F);
|
||||||
STRESS = F*PK2*FT;
|
STRESS = F*PK2*FT;
|
||||||
STRESS *= 1/J;
|
STRESS *= 1/J;
|
||||||
symm_matrix_to_vector(i,STRESS,T);
|
symm_matrix_to_vector(i,STRESS,T);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -1810,7 +1810,7 @@ namespace ATC {
|
||||||
STRESS = F*PK2;
|
STRESS = F*PK2;
|
||||||
matrix_to_vector(i,STRESS,T);
|
matrix_to_vector(i,STRESS,T);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1861,7 +1861,7 @@ namespace ATC {
|
||||||
void ATC_Transfer::cauchy_born_entropic_energy(const DENS_MAT &H, DENS_MAT &E, const DENS_MAT &T)
|
void ATC_Transfer::cauchy_born_entropic_energy(const DENS_MAT &H, DENS_MAT &E, const DENS_MAT &T)
|
||||||
{
|
{
|
||||||
FIELD_MATS uField; // uField should contain temperature.
|
FIELD_MATS uField; // uField should contain temperature.
|
||||||
uField[TEMPERATURE] = T;
|
uField[TEMPERATURE] = T;
|
||||||
GRAD_FIELD_MATS hField;
|
GRAD_FIELD_MATS hField;
|
||||||
DENS_MAT_VEC &h = hField[DISPLACEMENT];
|
DENS_MAT_VEC &h = hField[DISPLACEMENT];
|
||||||
h.assign(nsd_, DENS_MAT(nNodes_,nsd_));
|
h.assign(nsd_, DENS_MAT(nNodes_,nsd_));
|
||||||
|
@ -1916,13 +1916,13 @@ namespace ATC {
|
||||||
vector_to_matrix(i,H,F);
|
vector_to_matrix(i,H,F);
|
||||||
|
|
||||||
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
||||||
FT = F.transpose();
|
FT = F.transpose();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
double J = det(FT);
|
double J = det(FT);
|
||||||
FT *= 1/J;
|
FT *= 1/J;
|
||||||
if (atomToElementMapType_ == EULERIAN) {
|
if (atomToElementMapType_ == EULERIAN) {
|
||||||
FT = inv(FT);
|
FT = inv(FT);
|
||||||
}
|
}
|
||||||
S = P*FT;
|
S = P*FT;
|
||||||
matrix_to_vector(i,S,stress);
|
matrix_to_vector(i,S,stress);
|
||||||
|
@ -1933,10 +1933,10 @@ namespace ATC {
|
||||||
DENS_MAT & stretch, const DENS_MAT & H)
|
DENS_MAT & stretch, const DENS_MAT & H)
|
||||||
{
|
{
|
||||||
DENS_MAT F(3,3),R(3,3),U(3,3);
|
DENS_MAT F(3,3),R(3,3),U(3,3);
|
||||||
for (int i = 0; i < nNodes_; i++) {
|
for (int i = 0; i < nNodes_; i++) {
|
||||||
vector_to_matrix(i,H,F);
|
vector_to_matrix(i,H,F);
|
||||||
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
||||||
if (atomToElementMapType_ == EULERIAN) {
|
if (atomToElementMapType_ == EULERIAN) {
|
||||||
polar_decomposition(F,R,U,false); } // F = V R
|
polar_decomposition(F,R,U,false); } // F = V R
|
||||||
else {
|
else {
|
||||||
polar_decomposition(F,R,U); } // F = R U
|
polar_decomposition(F,R,U); } // F = R U
|
||||||
|
@ -1953,12 +1953,12 @@ namespace ATC {
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
void ATC_Transfer::compute_elastic_deformation_gradient(DENS_MAT & Fe,
|
void ATC_Transfer::compute_elastic_deformation_gradient(DENS_MAT & Fe,
|
||||||
const DENS_MAT & P, const DENS_MAT & H)
|
const DENS_MAT & P, const DENS_MAT & H)
|
||||||
|
|
||||||
{
|
{
|
||||||
// calculate Fe for every node
|
// calculate Fe for every node
|
||||||
const double nktv2p = lammpsInterface_->nktv2p();
|
const double nktv2p = lammpsInterface_->nktv2p();
|
||||||
const double fact = 1.0/ ( lammpsInterface_->mvv2e()*nktv2p );
|
const double fact = 1.0/ ( lammpsInterface_->mvv2e()*nktv2p );
|
||||||
for (int i = 0; i < nNodes_; i++) {
|
for (int i = 0; i < nNodes_; i++) {
|
||||||
DENS_VEC Pv = global_vector_to_vector(i,P);
|
DENS_VEC Pv = global_vector_to_vector(i,P);
|
||||||
Pv *= fact;
|
Pv *= fact;
|
||||||
CBElasticTangentOperator tangent(cauchyBornStress_, Pv);
|
CBElasticTangentOperator tangent(cauchyBornStress_, Pv);
|
||||||
|
@ -1977,11 +1977,11 @@ namespace ATC {
|
||||||
const double nktv2p = lammpsInterface_->nktv2p();
|
const double nktv2p = lammpsInterface_->nktv2p();
|
||||||
const double fact = 1.0/ ( lammpsInterface_->mvv2e()*nktv2p );
|
const double fact = 1.0/ ( lammpsInterface_->mvv2e()*nktv2p );
|
||||||
DENS_MAT F(3,3),R(3,3),U(3,3),PP(3,3),S(3,3);
|
DENS_MAT F(3,3),R(3,3),U(3,3),PP(3,3),S(3,3);
|
||||||
for (int i = 0; i < nNodes_; i++) {
|
for (int i = 0; i < nNodes_; i++) {
|
||||||
// get F = RU
|
// get F = RU
|
||||||
vector_to_matrix(i,H,F);
|
vector_to_matrix(i,H,F);
|
||||||
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
|
||||||
if (atomToElementMapType_ == EULERIAN) {
|
if (atomToElementMapType_ == EULERIAN) {
|
||||||
polar_decomposition(F,R,U,false); } // F = V R
|
polar_decomposition(F,R,U,false); } // F = V R
|
||||||
else {
|
else {
|
||||||
polar_decomposition(F,R,U); } // F = R U
|
polar_decomposition(F,R,U); } // F = R U
|
||||||
|
@ -1989,7 +1989,7 @@ namespace ATC {
|
||||||
vector_to_matrix(i,P,PP);
|
vector_to_matrix(i,P,PP);
|
||||||
//S = PP*transpose(F);
|
//S = PP*transpose(F);
|
||||||
S = inv(F)*PP;
|
S = inv(F)*PP;
|
||||||
|
|
||||||
S += S.transpose(); S *= 0.5; // symmetrize
|
S += S.transpose(); S *= 0.5; // symmetrize
|
||||||
DENS_VEC Sv = to_voigt(S);
|
DENS_VEC Sv = to_voigt(S);
|
||||||
Sv *= fact;
|
Sv *= fact;
|
||||||
|
|
|
@ -22,9 +22,9 @@ class TimeFilter;
|
||||||
class ATC_Transfer : public ATC_Method {
|
class ATC_Transfer : public ATC_Method {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ATC_Transfer(std::string groupName,
|
ATC_Transfer(std::string groupName,
|
||||||
double **& perAtomArray,
|
double **& perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
std::string matParamFile = "none");
|
std::string matParamFile = "none");
|
||||||
|
@ -52,7 +52,7 @@ class ATC_Transfer : public ATC_Method {
|
||||||
virtual void pre_neighbor() {ATC_Method::pre_neighbor(); neighborReset_ = true;};
|
virtual void pre_neighbor() {ATC_Method::pre_neighbor(); neighborReset_ = true;};
|
||||||
|
|
||||||
/** output function */
|
/** output function */
|
||||||
virtual void output();
|
virtual void output();
|
||||||
|
|
||||||
/** external access to hardy data and other information*/
|
/** external access to hardy data and other information*/
|
||||||
const DENS_MAT * hardy_data(std::string field) { return &hardyData_[field].quantity(); }
|
const DENS_MAT * hardy_data(std::string field) { return &hardyData_[field].quantity(); }
|
||||||
|
@ -63,25 +63,25 @@ class ATC_Transfer : public ATC_Method {
|
||||||
double ** xPointer_;
|
double ** xPointer_;
|
||||||
|
|
||||||
/** data */
|
/** data */
|
||||||
TAG_FIELDS hardyData_;
|
TAG_FIELDS hardyData_;
|
||||||
SmallMoleculeSet * smallMoleculeSet_; // KKM add
|
SmallMoleculeSet * smallMoleculeSet_; // KKM add
|
||||||
SmallMoleculeCentroid * moleculeCentroid_; // KKM add
|
SmallMoleculeCentroid * moleculeCentroid_; // KKM add
|
||||||
SmallMoleculeDipoleMoment * dipoleMoment_; // KKM add
|
SmallMoleculeDipoleMoment * dipoleMoment_; // KKM add
|
||||||
SmallMoleculeQuadrupoleMoment * quadrupoleMoment_; // KKM add
|
SmallMoleculeQuadrupoleMoment * quadrupoleMoment_; // KKM add
|
||||||
/** container for dependency managed data */
|
/** container for dependency managed data */
|
||||||
std::vector < DENS_MAN * > outputFields_;
|
std::vector < DENS_MAN * > outputFields_;
|
||||||
|
|
||||||
std::map < std::string, DENS_MAN * > outputFieldsTagged_;
|
std::map < std::string, DENS_MAN * > outputFieldsTagged_;
|
||||||
|
|
||||||
DENS_MAN * restrictedCharge_; // WIP/TEMP
|
DENS_MAN * restrictedCharge_; // WIP/TEMP
|
||||||
|
|
||||||
/** work space */
|
/** work space */
|
||||||
DENS_MAT atomicScalar_;
|
DENS_MAT atomicScalar_;
|
||||||
DENS_MAT atomicVector_;
|
DENS_MAT atomicVector_;
|
||||||
DENS_MAT atomicTensor_;
|
DENS_MAT atomicTensor_;
|
||||||
|
|
||||||
/** calculation flags */
|
/** calculation flags */
|
||||||
Array<bool> fieldFlags_;
|
Array<bool> fieldFlags_;
|
||||||
Array<bool> outputFlags_;
|
Array<bool> outputFlags_;
|
||||||
Array<bool> gradFlags_;
|
Array<bool> gradFlags_;
|
||||||
Array<bool> rateFlags_;
|
Array<bool> rateFlags_;
|
||||||
|
@ -117,7 +117,7 @@ class ATC_Transfer : public ATC_Method {
|
||||||
void compute_heatflux(DENS_MAT & flux);
|
void compute_heatflux(DENS_MAT & flux);
|
||||||
/** derived quantities: compute nodal to nodal quantities */
|
/** derived quantities: compute nodal to nodal quantities */
|
||||||
void compute_eshelby_stress(DENS_MAT & eshebly_stress,
|
void compute_eshelby_stress(DENS_MAT & eshebly_stress,
|
||||||
const DENS_MAT & energy, const DENS_MAT & stress,
|
const DENS_MAT & energy, const DENS_MAT & stress,
|
||||||
const DENS_MAT & displacement_gradient);
|
const DENS_MAT & displacement_gradient);
|
||||||
void cauchy_born_stress(const DENS_MAT &dudx, DENS_MAT &T, const DENS_MAT *temp=0);
|
void cauchy_born_stress(const DENS_MAT &dudx, DENS_MAT &T, const DENS_MAT *temp=0);
|
||||||
void cauchy_born_energy(const DENS_MAT &dudx, DENS_MAT &T, const DENS_MAT *temp=0);
|
void cauchy_born_energy(const DENS_MAT &dudx, DENS_MAT &T, const DENS_MAT *temp=0);
|
||||||
|
@ -151,15 +151,15 @@ class ATC_Transfer : public ATC_Method {
|
||||||
virtual void compute_dislocation_density(DENS_MAT & dislocation_density) = 0;
|
virtual void compute_dislocation_density(DENS_MAT & dislocation_density) = 0;
|
||||||
|
|
||||||
/** compute smooth fields */
|
/** compute smooth fields */
|
||||||
void compute_fields(void);
|
void compute_fields(void);
|
||||||
void time_filter_pre (double dt);
|
void time_filter_pre (double dt);
|
||||||
void time_filter_post(double dt);
|
void time_filter_post(double dt);
|
||||||
|
|
||||||
/** mapping of atomic pairs to pair index value */
|
/** mapping of atomic pairs to pair index value */
|
||||||
class PairMap * pairMap_;
|
class PairMap * pairMap_;
|
||||||
class BondMatrix * bondMatrix_;
|
class BondMatrix * bondMatrix_;
|
||||||
class PairVirial * pairVirial_;
|
class PairVirial * pairVirial_;
|
||||||
class PairPotentialHeatFlux * pairHeatFlux_;
|
class PairPotentialHeatFlux * pairHeatFlux_;
|
||||||
|
|
||||||
/** routine to calculate matrix of force & position dyads */
|
/** routine to calculate matrix of force & position dyads */
|
||||||
void compute_force_matrix();
|
void compute_force_matrix();
|
||||||
|
@ -176,7 +176,7 @@ class ATC_Transfer : public ATC_Method {
|
||||||
DENS_MAT & nodeData) = 0;
|
DENS_MAT & nodeData) = 0;
|
||||||
|
|
||||||
/** routine to calculate matrix of bond functions */
|
/** routine to calculate matrix of bond functions */
|
||||||
virtual void compute_bond_matrix();
|
virtual void compute_bond_matrix();
|
||||||
|
|
||||||
/** routine to set xPointer to xref or xatom */
|
/** routine to set xPointer to xref or xatom */
|
||||||
void set_xPointer();
|
void set_xPointer();
|
||||||
|
@ -200,21 +200,21 @@ class ATC_Transfer : public ATC_Method {
|
||||||
void project_count_normalized(const DENS_MAT & atomData,
|
void project_count_normalized(const DENS_MAT & atomData,
|
||||||
DENS_MAT & nodeData);
|
DENS_MAT & nodeData);
|
||||||
|
|
||||||
/** hardy_project (volume density): given w_\alpha,
|
/** hardy_project (volume density): given w_\alpha,
|
||||||
w_I = 1/\Omega_I \sum_\alpha N_{I\alpha} w_\alpha
|
w_I = 1/\Omega_I \sum_\alpha N_{I\alpha} w_\alpha
|
||||||
where \Omega_I = \int_{support region of node I} N_{I} dV */
|
where \Omega_I = \int_{support region of node I} N_{I} dV */
|
||||||
// REFACTOR AtfNodeWeightedShapeFunctionRestriction
|
// REFACTOR AtfNodeWeightedShapeFunctionRestriction
|
||||||
void project_volume_normalized(const DENS_MAT & atomData,
|
void project_volume_normalized(const DENS_MAT & atomData,
|
||||||
DENS_MAT & nodeData);
|
DENS_MAT & nodeData);
|
||||||
void project_volume_normalized_molecule(const DENS_MAT & molData,
|
void project_volume_normalized_molecule(const DENS_MAT & molData,
|
||||||
DENS_MAT & nodeData); // KKM add
|
DENS_MAT & nodeData); // KKM add
|
||||||
void project_volume_normalized_molecule_gradient(const DENS_MAT & molData,
|
void project_volume_normalized_molecule_gradient(const DENS_MAT & molData,
|
||||||
DENS_MAT & nodeData); // KKM add
|
DENS_MAT & nodeData); // KKM add
|
||||||
|
|
||||||
|
|
||||||
/** gradient_compute: given w_I,
|
/** gradient_compute: given w_I,
|
||||||
w_J = \sum_I N_I'{xJ} \dyad w_I
|
w_J = \sum_I N_I'{xJ} \dyad w_I
|
||||||
where N_I'{xJ} is the gradient of the normalized
|
where N_I'{xJ} is the gradient of the normalized
|
||||||
shape function of node I evaluated at node J */
|
shape function of node I evaluated at node J */
|
||||||
// REFACTOR MatToGradBySparse
|
// REFACTOR MatToGradBySparse
|
||||||
void gradient_compute(const DENS_MAT & inNodeData,
|
void gradient_compute(const DENS_MAT & inNodeData,
|
||||||
|
@ -226,7 +226,7 @@ class ATC_Transfer : public ATC_Method {
|
||||||
/** workset data */
|
/** workset data */
|
||||||
VectorDependencyManager<SPAR_MAT * > * gradientMatrix_;
|
VectorDependencyManager<SPAR_MAT * > * gradientMatrix_;
|
||||||
|
|
||||||
|
|
||||||
SPAR_MAT atomicBondMatrix_;
|
SPAR_MAT atomicBondMatrix_;
|
||||||
DENS_MAT atomicForceMatrix_;
|
DENS_MAT atomicForceMatrix_;
|
||||||
DENS_MAT atomicHeatMatrix_;
|
DENS_MAT atomicHeatMatrix_;
|
||||||
|
@ -247,7 +247,7 @@ class ATC_Transfer : public ATC_Method {
|
||||||
Array<TimeFilter *> timeFilters_;
|
Array<TimeFilter *> timeFilters_;
|
||||||
|
|
||||||
/** check consistency of fieldFlags_ */
|
/** check consistency of fieldFlags_ */
|
||||||
void check_field_dependencies();
|
void check_field_dependencies();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// ATC headers
|
// ATC headers
|
||||||
#include "ATC_TransferKernel.h"
|
#include "ATC_TransferKernel.h"
|
||||||
#include "ATC_Error.h"
|
#include "ATC_Error.h"
|
||||||
#include "FE_Engine.h"
|
#include "FE_Engine.h"
|
||||||
|
@ -44,10 +44,10 @@ using ATC_Utility::to_string;
|
||||||
{
|
{
|
||||||
bool match = false;
|
bool match = false;
|
||||||
|
|
||||||
/*! \page man_hardy_kernel fix_modify AtC kernel
|
/*! \page man_hardy_kernel fix_modify AtC kernel
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC kernel <type> <parameters>
|
fix_modify AtC kernel <type> <parameters>
|
||||||
- type (keyword) = step, cell, cubic_bar, cubic_cylinder, cubic_sphere,
|
- type (keyword) = step, cell, cubic_bar, cubic_cylinder, cubic_sphere,
|
||||||
quartic_bar, quartic_cylinder, quartic_sphere \n
|
quartic_bar, quartic_cylinder, quartic_sphere \n
|
||||||
- parameters :\n
|
- parameters :\n
|
||||||
step = radius (double) \n
|
step = radius (double) \n
|
||||||
|
@ -62,7 +62,7 @@ using ATC_Utility::to_string;
|
||||||
<TT> fix_modify AtC kernel cell 1.0 1.0 1.0 </TT> \n
|
<TT> fix_modify AtC kernel cell 1.0 1.0 1.0 </TT> \n
|
||||||
<TT> fix_modify AtC kernel quartic_sphere 10.0 </TT>
|
<TT> fix_modify AtC kernel quartic_sphere 10.0 </TT>
|
||||||
\section description
|
\section description
|
||||||
|
|
||||||
\section restrictions
|
\section restrictions
|
||||||
Must be used with the hardy AtC fix \n
|
Must be used with the hardy AtC fix \n
|
||||||
For bar kernel types, half-width oriented along x-direction \n
|
For bar kernel types, half-width oriented along x-direction \n
|
||||||
|
@ -92,28 +92,28 @@ using ATC_Utility::to_string;
|
||||||
SPAR_MAT & dN(kernelAccumulantMolGrad_.set_quantity());
|
SPAR_MAT & dN(kernelAccumulantMolGrad_.set_quantity());
|
||||||
dN.reset(nLocalMol,nNodes_);
|
dN.reset(nLocalMol,nNodes_);
|
||||||
DENS_VEC derivKer(nsd_);
|
DENS_VEC derivKer(nsd_);
|
||||||
DENS_VEC xI(nsd_),xm(nsd_),xmI(nsd_);
|
DENS_VEC xI(nsd_),xm(nsd_),xmI(nsd_);
|
||||||
const DENS_MAT & centroidMolMatrix(moleculeCentroid_->quantity());
|
const DENS_MAT & centroidMolMatrix(moleculeCentroid_->quantity());
|
||||||
ATC::LammpsInterface::instance()->stream_msg_once("computing kernel matrix molecule ",true,false);
|
ATC::LammpsInterface::instance()->stream_msg_once("computing kernel matrix molecule ",true,false);
|
||||||
int heartbeatFreq = (nNodes_ <= 10 ? 1 : (int) nNodes_ / 10);
|
int heartbeatFreq = (nNodes_ <= 10 ? 1 : (int) nNodes_ / 10);
|
||||||
for (int i = 0; i < nNodes_; i++) {
|
for (int i = 0; i < nNodes_; i++) {
|
||||||
if (i % heartbeatFreq == 0 ) {
|
if (i % heartbeatFreq == 0 ) {
|
||||||
ATC::LammpsInterface::instance()->stream_msg_once(".",false,false);
|
ATC::LammpsInterface::instance()->stream_msg_once(".",false,false);
|
||||||
}
|
}
|
||||||
xI = (feEngine_->fe_mesh())->nodal_coordinates(i);
|
xI = (feEngine_->fe_mesh())->nodal_coordinates(i);
|
||||||
for (int j = 0; j < nLocalMol; j++) {
|
for (int j = 0; j < nLocalMol; j++) {
|
||||||
for (int k = 0; k < nsd_; k++) {
|
for (int k = 0; k < nsd_; k++) {
|
||||||
xm(k) = centroidMolMatrix(j,k);
|
xm(k) = centroidMolMatrix(j,k);
|
||||||
}
|
}
|
||||||
xmI = xm - xI;
|
xmI = xm - xI;
|
||||||
lammpsInterface_->periodicity_correction(xmI.ptr());
|
lammpsInterface_->periodicity_correction(xmI.ptr());
|
||||||
double val = kernelFunction_->value(xmI);
|
double val = kernelFunction_->value(xmI);
|
||||||
if (val > 0) N.add(j,i,val);
|
if (val > 0) N.add(j,i,val);
|
||||||
kernelFunction_->derivative(xmI,derivKer);
|
kernelFunction_->derivative(xmI,derivKer);
|
||||||
double val_grad = derivKer(2);
|
double val_grad = derivKer(2);
|
||||||
if (val_grad!= 0) dN.add(j,i,val_grad);
|
if (val_grad!= 0) dN.add(j,i,val_grad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// reset kernelShpFunctions with the weights of molecules on processors
|
// reset kernelShpFunctions with the weights of molecules on processors
|
||||||
DENS_VEC fractions(N.nRows());
|
DENS_VEC fractions(N.nRows());
|
||||||
DENS_VEC fractions_deriv(dN.nRows());
|
DENS_VEC fractions_deriv(dN.nRows());
|
||||||
|
@ -126,10 +126,10 @@ using ATC_Utility::to_string;
|
||||||
dN.compress();
|
dN.compress();
|
||||||
if (lammpsInterface_->rank_zero()) {
|
if (lammpsInterface_->rank_zero()) {
|
||||||
ATC::LammpsInterface::instance()->stream_msg_once("done",false,true);
|
ATC::LammpsInterface::instance()->stream_msg_once("done",false,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
void ATC_TransferKernel::compute_projection(const DENS_MAT & atomData,
|
void ATC_TransferKernel::compute_projection(const DENS_MAT & atomData,
|
||||||
DENS_MAT & nodeData)
|
DENS_MAT & nodeData)
|
||||||
|
@ -183,7 +183,7 @@ using ATC_Utility::to_string;
|
||||||
int **firstneigh = lammpsInterface_->neighbor_list_firstneigh();
|
int **firstneigh = lammpsInterface_->neighbor_list_firstneigh();
|
||||||
double ** xatom = lammpsInterface_->xatom();
|
double ** xatom = lammpsInterface_->xatom();
|
||||||
double lam1,lam2;
|
double lam1,lam2;
|
||||||
double bond_value;
|
double bond_value;
|
||||||
// process differently for mesh vs translation-invariant kernels
|
// process differently for mesh vs translation-invariant kernels
|
||||||
ATC::LammpsInterface::instance()->stream_msg_once("computing potential stress: ",true,false);
|
ATC::LammpsInterface::instance()->stream_msg_once("computing potential stress: ",true,false);
|
||||||
int heartbeatFreq = (nNodes_ <= 10 ? 1 : (int) nNodes_ / 10);
|
int heartbeatFreq = (nNodes_ <= 10 ? 1 : (int) nNodes_ / 10);
|
||||||
|
@ -202,7 +202,7 @@ using ATC_Utility::to_string;
|
||||||
int inode = i;
|
int inode = i;
|
||||||
for (int j = 0; j < nLocal_; j++) {
|
for (int j = 0; j < nLocal_; j++) {
|
||||||
// second (neighbor) atom location
|
// second (neighbor) atom location
|
||||||
int lammps_j = internalToAtom_(j);
|
int lammps_j = internalToAtom_(j);
|
||||||
xa.copy(xPointer_[lammps_j],3);
|
xa.copy(xPointer_[lammps_j],3);
|
||||||
// difference vector
|
// difference vector
|
||||||
xaI = xa - xI;
|
xaI = xa - xI;
|
||||||
|
@ -217,8 +217,8 @@ using ATC_Utility::to_string;
|
||||||
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
|
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
|
||||||
// compute virial
|
// compute virial
|
||||||
if (lam1 < lam2) {
|
if (lam1 < lam2) {
|
||||||
bond_value
|
bond_value
|
||||||
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
|
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
|
||||||
double delx = xatom[lammps_j][0] - xatom[lammps_k][0];
|
double delx = xatom[lammps_j][0] - xatom[lammps_k][0];
|
||||||
double dely = xatom[lammps_j][1] - xatom[lammps_k][1];
|
double dely = xatom[lammps_j][1] - xatom[lammps_k][1];
|
||||||
double delz = xatom[lammps_j][2] - xatom[lammps_k][2];
|
double delz = xatom[lammps_j][2] - xatom[lammps_k][2];
|
||||||
|
@ -227,9 +227,9 @@ using ATC_Utility::to_string;
|
||||||
lammpsInterface_->pair_force(lammps_j,lammps_k,rsq,fforce);
|
lammpsInterface_->pair_force(lammps_j,lammps_k,rsq,fforce);
|
||||||
fforce *= 0.5; // dbl count
|
fforce *= 0.5; // dbl count
|
||||||
if (atomToElementMapType_ == LAGRANGIAN) {
|
if (atomToElementMapType_ == LAGRANGIAN) {
|
||||||
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
||||||
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
||||||
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
||||||
stress(inode,0) +=-delx*fforce*delX*bond_value;
|
stress(inode,0) +=-delx*fforce*delX*bond_value;
|
||||||
stress(inode,1) +=-delx*fforce*delY*bond_value;
|
stress(inode,1) +=-delx*fforce*delY*bond_value;
|
||||||
stress(inode,2) +=-delx*fforce*delZ*bond_value;
|
stress(inode,2) +=-delx*fforce*delZ*bond_value;
|
||||||
|
@ -266,9 +266,9 @@ using ATC_Utility::to_string;
|
||||||
int **firstneigh = lammpsInterface_->neighbor_list_firstneigh();
|
int **firstneigh = lammpsInterface_->neighbor_list_firstneigh();
|
||||||
double ** xatom = lammpsInterface_->xatom();
|
double ** xatom = lammpsInterface_->xatom();
|
||||||
double ** vatom = lammpsInterface_->vatom();
|
double ** vatom = lammpsInterface_->vatom();
|
||||||
|
|
||||||
double lam1,lam2;
|
double lam1,lam2;
|
||||||
double bond_value;
|
double bond_value;
|
||||||
// process differently for mesh vs translation-invariant kernels
|
// process differently for mesh vs translation-invariant kernels
|
||||||
// "normal" kernel functions
|
// "normal" kernel functions
|
||||||
DENS_VEC xa(nsd_),xI(nsd_),xaI(nsd_),xb(nsd_),xbI(nsd_),xba(nsd_);
|
DENS_VEC xa(nsd_),xI(nsd_),xaI(nsd_),xb(nsd_),xbI(nsd_),xba(nsd_);
|
||||||
|
@ -281,7 +281,7 @@ using ATC_Utility::to_string;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < nLocal_; j++) {
|
for (int j = 0; j < nLocal_; j++) {
|
||||||
int lammps_j = internalToAtom_(j);
|
int lammps_j = internalToAtom_(j);
|
||||||
xa.copy(xPointer_[lammps_j],3);
|
xa.copy(xPointer_[lammps_j],3);
|
||||||
// difference vector
|
// difference vector
|
||||||
xaI = xa - xI;
|
xaI = xa - xI;
|
||||||
|
@ -296,8 +296,8 @@ using ATC_Utility::to_string;
|
||||||
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
|
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
|
||||||
// compute virial
|
// compute virial
|
||||||
if (lam1 < lam2) {
|
if (lam1 < lam2) {
|
||||||
bond_value
|
bond_value
|
||||||
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
|
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
|
||||||
double delx = xatom[lammps_j][0] - xatom[lammps_k][0];
|
double delx = xatom[lammps_j][0] - xatom[lammps_k][0];
|
||||||
double dely = xatom[lammps_j][1] - xatom[lammps_k][1];
|
double dely = xatom[lammps_j][1] - xatom[lammps_k][1];
|
||||||
double delz = xatom[lammps_j][2] - xatom[lammps_k][2];
|
double delz = xatom[lammps_j][2] - xatom[lammps_k][2];
|
||||||
|
@ -308,9 +308,9 @@ using ATC_Utility::to_string;
|
||||||
double * v = vatom[lammps_j];
|
double * v = vatom[lammps_j];
|
||||||
fforce *= (delx*v[0] + dely*v[1] + delz*v[2]);
|
fforce *= (delx*v[0] + dely*v[1] + delz*v[2]);
|
||||||
if (atomToElementMapType_ == LAGRANGIAN) {
|
if (atomToElementMapType_ == LAGRANGIAN) {
|
||||||
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
||||||
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
||||||
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
||||||
flux(inode,0) +=fforce*delX*bond_value;
|
flux(inode,0) +=fforce*delX*bond_value;
|
||||||
flux(inode,1) +=fforce*delY*bond_value;
|
flux(inode,1) +=fforce*delY*bond_value;
|
||||||
flux(inode,2) +=fforce*delZ*bond_value;
|
flux(inode,2) +=fforce*delZ*bond_value;
|
||||||
|
@ -327,7 +327,7 @@ using ATC_Utility::to_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// calculation of the dislocation density tensor
|
// calculation of the dislocation density tensor
|
||||||
void ATC_TransferKernel::compute_dislocation_density(DENS_MAT & A)
|
void ATC_TransferKernel::compute_dislocation_density(DENS_MAT & A)
|
||||||
{
|
{
|
||||||
A.reset(nNodes_,9);
|
A.reset(nNodes_,9);
|
||||||
|
@ -348,7 +348,7 @@ using ATC_Utility::to_string;
|
||||||
lammpsInterface_->int_allsum(&localNumberLines,&totalNumberLines,1);
|
lammpsInterface_->int_allsum(&localNumberLines,&totalNumberLines,1);
|
||||||
if (totalNumberLines == 0) {
|
if (totalNumberLines == 0) {
|
||||||
ATC::LammpsInterface::instance()->print_msg_once("no dislocation lines found");
|
ATC::LammpsInterface::instance()->print_msg_once("no dislocation lines found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for output
|
// for output
|
||||||
|
@ -366,7 +366,7 @@ using ATC_Utility::to_string;
|
||||||
|
|
||||||
|
|
||||||
DENS_MAT local_A(nNodes_,9);
|
DENS_MAT local_A(nNodes_,9);
|
||||||
local_A.zero();
|
local_A.zero();
|
||||||
DENS_VEC xa(nsd_),xI(nsd_),xaI(nsd_),xb(nsd_),xbI(nsd_),xba(nsd_);
|
DENS_VEC xa(nsd_),xI(nsd_),xaI(nsd_),xb(nsd_),xbI(nsd_),xba(nsd_);
|
||||||
double kernel_inv_vol = kernelFunction_->inv_vol();
|
double kernel_inv_vol = kernelFunction_->inv_vol();
|
||||||
int iPt = 0, iSeg= 0;
|
int iPt = 0, iSeg= 0;
|
||||||
|
@ -393,7 +393,7 @@ using ATC_Utility::to_string;
|
||||||
xa(k) = x1[k];
|
xa(k) = x1[k];
|
||||||
xb(k) = x2[k];
|
xb(k) = x2[k];
|
||||||
xba(k) = delta[k];
|
xba(k) = delta[k];
|
||||||
}
|
}
|
||||||
for (int I = 0; I < nNodes_; I++) {
|
for (int I = 0; I < nNodes_; I++) {
|
||||||
xI = (feEngine_->fe_mesh())->nodal_coordinates(I);
|
xI = (feEngine_->fe_mesh())->nodal_coordinates(I);
|
||||||
if (!kernelFunction_->node_contributes(xI)) {
|
if (!kernelFunction_->node_contributes(xI)) {
|
||||||
|
@ -405,7 +405,7 @@ using ATC_Utility::to_string;
|
||||||
double lam1=0,lam2=0;
|
double lam1=0,lam2=0;
|
||||||
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
|
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
|
||||||
if (lam1 < lam2) {
|
if (lam1 < lam2) {
|
||||||
double bond_value
|
double bond_value
|
||||||
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
|
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
|
||||||
local_A(I,0) += xba(0)*burgers[0]*bond_value;
|
local_A(I,0) += xba(0)*burgers[0]*bond_value;
|
||||||
local_A(I,1) += xba(0)*burgers[1]*bond_value;
|
local_A(I,1) += xba(0)*burgers[1]*bond_value;
|
||||||
|
@ -449,7 +449,7 @@ using ATC_Utility::to_string;
|
||||||
lammpsInterface_->int_allsum(&nSeg,&totalNumberSegments,1);
|
lammpsInterface_->int_allsum(&nSeg,&totalNumberSegments,1);
|
||||||
|
|
||||||
// output
|
// output
|
||||||
double volume = lammpsInterface_->domain_volume();
|
double volume = lammpsInterface_->domain_volume();
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << "total dislocation line length = " << totalDislocationDensity;
|
ss << "total dislocation line length = " << totalDislocationDensity;
|
||||||
ss << " lines = " << totalNumberLines << " segments = " << totalNumberSegments;
|
ss << " lines = " << totalNumberLines << " segments = " << totalNumberSegments;
|
||||||
|
@ -474,10 +474,10 @@ using ATC_Utility::to_string;
|
||||||
segOutput.write_geometry(&segCoor,&segConn);
|
segOutput.write_geometry(&segCoor,&segConn);
|
||||||
OUTPUT_LIST segOut;
|
OUTPUT_LIST segOut;
|
||||||
segOut["burgers_vector"] = &segBurg;
|
segOut["burgers_vector"] = &segBurg;
|
||||||
segOutput.write_data(0,&segOut);
|
segOutput.write_data(0,&segOut);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
throw ATC_Error("unimplemented function compute_dislocation_density (DXA support not included");
|
throw ATC_Error("unimplemented function compute_dislocation_density (DXA support not included");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ class KernelFunction;
|
||||||
class ATC_TransferKernel : public ATC_Transfer {
|
class ATC_TransferKernel : public ATC_Transfer {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ATC_TransferKernel(std::string groupName,
|
ATC_TransferKernel(std::string groupName,
|
||||||
double **& perAtomArray,
|
double **& perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
std::string matParamFile = "none");
|
std::string matParamFile = "none");
|
||||||
|
@ -27,7 +27,7 @@ class ATC_TransferKernel : public ATC_Transfer {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** routine to calculate matrix of kernel functions */
|
/** routine to calculate matrix of kernel functions */
|
||||||
|
|
||||||
virtual void compute_kernel_matrix_molecule();
|
virtual void compute_kernel_matrix_molecule();
|
||||||
|
|
||||||
/** calculate projection on the fly*/
|
/** calculate projection on the fly*/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// ATC headers
|
// ATC headers
|
||||||
#include "ATC_TransferPartitionOfUnity.h"
|
#include "ATC_TransferPartitionOfUnity.h"
|
||||||
#include "ATC_Error.h"
|
#include "ATC_Error.h"
|
||||||
#include "FE_Engine.h"
|
#include "FE_Engine.h"
|
||||||
|
@ -27,7 +27,7 @@ static double line_xg[line_ngauss], line_wg[line_ngauss];
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
ATC_TransferPartitionOfUnity::ATC_TransferPartitionOfUnity(
|
ATC_TransferPartitionOfUnity::ATC_TransferPartitionOfUnity(
|
||||||
string groupName,
|
string groupName,
|
||||||
double ** & perAtomArray,
|
double ** & perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
string matParamFile)
|
string matParamFile)
|
||||||
|
@ -67,7 +67,7 @@ namespace ATC {
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// kinetic energy portion of stress
|
// kinetic energy portion of stress
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KineticTensor
|
* @class KineticTensor
|
||||||
* @brief Class for computing the quantity - m v' (x) v'
|
* @brief Class for computing the quantity - m v' (x) v'
|
||||||
|
@ -83,7 +83,7 @@ namespace ATC {
|
||||||
double mvv2e = lammpsInterface_->mvv2e(); // [MV^2]-->[Energy]
|
double mvv2e = lammpsInterface_->mvv2e(); // [MV^2]-->[Energy]
|
||||||
|
|
||||||
DENS_MAT & v = variationVelocity_;
|
DENS_MAT & v = variationVelocity_;
|
||||||
|
|
||||||
atomicTensor_.reset(nLocal_,6);
|
atomicTensor_.reset(nLocal_,6);
|
||||||
for (int i = 0; i < nLocal_; i++) {
|
for (int i = 0; i < nLocal_; i++) {
|
||||||
int atomIdx = internalToAtom_(i);
|
int atomIdx = internalToAtom_(i);
|
||||||
|
@ -132,7 +132,7 @@ namespace ATC {
|
||||||
ATC::LammpsInterface::instance()->stream_msg_once(".",false,false);
|
ATC::LammpsInterface::instance()->stream_msg_once(".",false,false);
|
||||||
}
|
}
|
||||||
// first atom location
|
// first atom location
|
||||||
int lammps_j = internalToAtom_(j);
|
int lammps_j = internalToAtom_(j);
|
||||||
xa.copy(xPointer_[lammps_j],3);
|
xa.copy(xPointer_[lammps_j],3);
|
||||||
for (int k = 0; k < numneigh[lammps_j]; ++k) {
|
for (int k = 0; k < numneigh[lammps_j]; ++k) {
|
||||||
int lammps_k = firstneigh[lammps_j][k];
|
int lammps_k = firstneigh[lammps_j][k];
|
||||||
|
@ -147,9 +147,9 @@ namespace ATC {
|
||||||
lammpsInterface_->pair_force(lammps_j,lammps_k,rsq,fforce);
|
lammpsInterface_->pair_force(lammps_j,lammps_k,rsq,fforce);
|
||||||
fforce *= 0.5; // 1/2 sum_ab = sum_(ab)
|
fforce *= 0.5; // 1/2 sum_ab = sum_(ab)
|
||||||
if (atomToElementMapType_ == LAGRANGIAN) {
|
if (atomToElementMapType_ == LAGRANGIAN) {
|
||||||
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
||||||
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
||||||
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
||||||
virial[0] =-delx*fforce*delX;
|
virial[0] =-delx*fforce*delX;
|
||||||
virial[1] =-delx*fforce*delY;
|
virial[1] =-delx*fforce*delY;
|
||||||
virial[2] =-delx*fforce*delZ;
|
virial[2] =-delx*fforce*delZ;
|
||||||
|
@ -172,7 +172,7 @@ namespace ATC {
|
||||||
for (int i = 0; i < line_ngauss; i++) {
|
for (int i = 0; i < line_ngauss; i++) {
|
||||||
double lambda = line_xg[i];
|
double lambda = line_xg[i];
|
||||||
xlambda = lambda*xab + xb;
|
xlambda = lambda*xab + xb;
|
||||||
|
|
||||||
lammpsInterface_->periodicity_correction(xlambda.ptr());
|
lammpsInterface_->periodicity_correction(xlambda.ptr());
|
||||||
feEngine_->shape_functions(xlambda,shp,node_list);
|
feEngine_->shape_functions(xlambda,shp,node_list);
|
||||||
// accumulate to nodes whose support overlaps the integration point
|
// accumulate to nodes whose support overlaps the integration point
|
||||||
|
@ -242,7 +242,7 @@ namespace ATC {
|
||||||
DENS_VEC xa(nsd_),xb(nsd_),xab(nsd_),xlambda(nsd_);
|
DENS_VEC xa(nsd_),xb(nsd_),xab(nsd_),xlambda(nsd_);
|
||||||
for (int j = 0; j < nLocal_; j++) {
|
for (int j = 0; j < nLocal_; j++) {
|
||||||
// first atom location
|
// first atom location
|
||||||
int lammps_j = internalToAtom_(j);
|
int lammps_j = internalToAtom_(j);
|
||||||
xa.copy(xPointer_[lammps_j],3);
|
xa.copy(xPointer_[lammps_j],3);
|
||||||
for (int k = 0; k < numneigh[lammps_j]; ++k) {
|
for (int k = 0; k < numneigh[lammps_j]; ++k) {
|
||||||
int lammps_k = firstneigh[lammps_j][k];
|
int lammps_k = firstneigh[lammps_j][k];
|
||||||
|
@ -260,9 +260,9 @@ namespace ATC {
|
||||||
delz*variationVelocity_(j,2));
|
delz*variationVelocity_(j,2));
|
||||||
double flux_vec[3];
|
double flux_vec[3];
|
||||||
if (atomToElementMapType_ == LAGRANGIAN) {
|
if (atomToElementMapType_ == LAGRANGIAN) {
|
||||||
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
|
||||||
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
|
||||||
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
|
||||||
flux_vec[0] =fforce*delX;
|
flux_vec[0] =fforce*delX;
|
||||||
flux_vec[1] =fforce*delY;
|
flux_vec[1] =fforce*delY;
|
||||||
flux_vec[2] =fforce*delZ;
|
flux_vec[2] =fforce*delZ;
|
||||||
|
@ -276,7 +276,7 @@ namespace ATC {
|
||||||
for (int i = 0; i < line_ngauss; i++) {
|
for (int i = 0; i < line_ngauss; i++) {
|
||||||
double lambda = line_xg[i];
|
double lambda = line_xg[i];
|
||||||
xlambda = lambda*xab + xb;
|
xlambda = lambda*xab + xb;
|
||||||
|
|
||||||
lammpsInterface_->periodicity_correction(xlambda.ptr());
|
lammpsInterface_->periodicity_correction(xlambda.ptr());
|
||||||
feEngine_->shape_functions(xlambda,shp,node_list);
|
feEngine_->shape_functions(xlambda,shp,node_list);
|
||||||
// accumulate to nodes whose support overlaps the integration point
|
// accumulate to nodes whose support overlaps the integration point
|
||||||
|
@ -316,7 +316,7 @@ namespace ATC {
|
||||||
field_to_prolongation_name(VELOCITY));
|
field_to_prolongation_name(VELOCITY));
|
||||||
}
|
}
|
||||||
// use of prolong assumes atom system contained within mesh
|
// use of prolong assumes atom system contained within mesh
|
||||||
vbar_ = vbar->quantity();
|
vbar_ = vbar->quantity();
|
||||||
// compute and store variation velocities of atoms
|
// compute and store variation velocities of atoms
|
||||||
for (int i = 0; i < nLocal_; i++) {
|
for (int i = 0; i < nLocal_; i++) {
|
||||||
int atomIdx = internalToAtom_(i);
|
int atomIdx = internalToAtom_(i);
|
||||||
|
@ -328,10 +328,10 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// calculation of the dislocation density tensor
|
// calculation of the dislocation density tensor
|
||||||
void ATC_TransferPartitionOfUnity::compute_dislocation_density(DENS_MAT & A)
|
void ATC_TransferPartitionOfUnity::compute_dislocation_density(DENS_MAT & A)
|
||||||
{
|
{
|
||||||
|
|
||||||
A.reset(nNodes_,9);
|
A.reset(nNodes_,9);
|
||||||
#ifdef HAS_DXA
|
#ifdef HAS_DXA
|
||||||
double cnaCutoff = lammpsInterface_->near_neighbor_cutoff();
|
double cnaCutoff = lammpsInterface_->near_neighbor_cutoff();
|
||||||
|
@ -368,7 +368,7 @@ namespace ATC {
|
||||||
|
|
||||||
|
|
||||||
DENS_MAT local_A(nNodes_,9);
|
DENS_MAT local_A(nNodes_,9);
|
||||||
local_A.zero();
|
local_A.zero();
|
||||||
Array<bool> latticePeriodicity(3);
|
Array<bool> latticePeriodicity(3);
|
||||||
latticePeriodicity(0) = (bool) periodicity[0];
|
latticePeriodicity(0) = (bool) periodicity[0];
|
||||||
latticePeriodicity(1) = (bool) periodicity[1];
|
latticePeriodicity(1) = (bool) periodicity[1];
|
||||||
|
@ -406,7 +406,7 @@ namespace ATC {
|
||||||
for (int i = 0; i < line_ngauss; i++) {
|
for (int i = 0; i < line_ngauss; i++) {
|
||||||
double lambda = line_xg[i];
|
double lambda = line_xg[i];
|
||||||
xlambda = lambda*xba + xa;
|
xlambda = lambda*xba + xa;
|
||||||
|
|
||||||
lammpsInterface_->periodicity_correction(xlambda.ptr());
|
lammpsInterface_->periodicity_correction(xlambda.ptr());
|
||||||
feEngine_->shape_functions(xlambda,shp,node_list);
|
feEngine_->shape_functions(xlambda,shp,node_list);
|
||||||
// accumulate to nodes whose support overlaps the integration point
|
// accumulate to nodes whose support overlaps the integration point
|
||||||
|
@ -472,7 +472,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
ATC::LammpsInterface::instance()->print_msg_once(ss.str());
|
ATC::LammpsInterface::instance()->print_msg_once(ss.str());
|
||||||
ss.str("");
|
ss.str("");
|
||||||
DENS_VEC A_avg(9);
|
DENS_VEC A_avg(9);
|
||||||
for (int i = 0; i < nNodes_; i++) {
|
for (int i = 0; i < nNodes_; i++) {
|
||||||
for (int j = 0; j < 9; j++) {
|
for (int j = 0; j < 9; j++) {
|
||||||
A_avg(j) += A(i,j);
|
A_avg(j) += A(i,j);
|
||||||
|
@ -480,9 +480,9 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
A_avg /= nNodes_;
|
A_avg /= nNodes_;
|
||||||
ss << "average nodal dislocation density tensor = \n";
|
ss << "average nodal dislocation density tensor = \n";
|
||||||
ss << A_avg(0) << " " << A_avg(1) << " " << A_avg(2) << "\n";
|
ss << A_avg(0) << " " << A_avg(1) << " " << A_avg(2) << "\n";
|
||||||
ss << A_avg(3) << " " << A_avg(4) << " " << A_avg(5) << "\n";
|
ss << A_avg(3) << " " << A_avg(4) << " " << A_avg(5) << "\n";
|
||||||
ss << A_avg(6) << " " << A_avg(7) << " " << A_avg(8) << "\n";
|
ss << A_avg(6) << " " << A_avg(7) << " " << A_avg(8) << "\n";
|
||||||
ATC::LammpsInterface::instance()->print_msg_once(ss.str());
|
ATC::LammpsInterface::instance()->print_msg_once(ss.str());
|
||||||
|
|
||||||
if (nSeg > 0) {
|
if (nSeg > 0) {
|
||||||
|
@ -495,7 +495,7 @@ namespace ATC {
|
||||||
segOutput.write_geometry(&segCoor,&segConn);
|
segOutput.write_geometry(&segCoor,&segConn);
|
||||||
OUTPUT_LIST segOut;
|
OUTPUT_LIST segOut;
|
||||||
segOut["burgers_vector"] = &segBurg;
|
segOut["burgers_vector"] = &segBurg;
|
||||||
segOutput.write_data(0,&segOut);
|
segOutput.write_data(0,&segOut);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
throw ATC_Error("TransferParititionOfUnity::compute_dislocaton_density - unimplemented function");
|
throw ATC_Error("TransferParititionOfUnity::compute_dislocaton_density - unimplemented function");
|
||||||
|
|
|
@ -9,9 +9,9 @@ namespace ATC {
|
||||||
class ATC_TransferPartitionOfUnity : public ATC_Transfer {
|
class ATC_TransferPartitionOfUnity : public ATC_Transfer {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ATC_TransferPartitionOfUnity(std::string groupName,
|
ATC_TransferPartitionOfUnity(std::string groupName,
|
||||||
double **& perAtomArray,
|
double **& perAtomArray,
|
||||||
LAMMPS_NS::Fix * thisFix,
|
LAMMPS_NS::Fix * thisFix,
|
||||||
std::string matParamFile = "none");
|
std::string matParamFile = "none");
|
||||||
|
@ -49,7 +49,7 @@ class ATC_TransferPartitionOfUnity : public ATC_Transfer {
|
||||||
virtual void compute_dislocation_density(DENS_MAT & dislocation_density);
|
virtual void compute_dislocation_density(DENS_MAT & dislocation_density);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DENS_MAT variationVelocity_;
|
DENS_MAT variationVelocity_;
|
||||||
DENS_MAT vbar_;
|
DENS_MAT vbar_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ATC
|
||||||
static const double kBeV_ = 8.617343e-5;// [eV/K]
|
static const double kBeV_ = 8.617343e-5;// [eV/K]
|
||||||
|
|
||||||
/** unsigned ints, when needed */
|
/** unsigned ints, when needed */
|
||||||
typedef int INDEX;
|
typedef int INDEX;
|
||||||
|
|
||||||
/** elementset integral */
|
/** elementset integral */
|
||||||
enum ElementsetOperationType {
|
enum ElementsetOperationType {
|
||||||
|
@ -53,13 +53,13 @@ namespace ATC
|
||||||
FULL_DOMAIN=0,
|
FULL_DOMAIN=0,
|
||||||
ATOM_DOMAIN,
|
ATOM_DOMAIN,
|
||||||
FE_DOMAIN,
|
FE_DOMAIN,
|
||||||
FULL_DOMAIN_ATOMIC_QUADRATURE_SOURCE,
|
FULL_DOMAIN_ATOMIC_QUADRATURE_SOURCE,
|
||||||
FULL_DOMAIN_FREE_ONLY
|
FULL_DOMAIN_FREE_ONLY
|
||||||
};
|
};
|
||||||
/** domain decomposition */
|
/** domain decomposition */
|
||||||
enum DomainDecompositionType {
|
enum DomainDecompositionType {
|
||||||
REPLICATED_MEMORY=0,
|
REPLICATED_MEMORY=0,
|
||||||
DISTRIBUTED_MEMORY
|
DISTRIBUTED_MEMORY
|
||||||
};
|
};
|
||||||
/** atomic weight specification */
|
/** atomic weight specification */
|
||||||
enum AtomicWeightType {
|
enum AtomicWeightType {
|
||||||
|
@ -100,7 +100,7 @@ namespace ATC
|
||||||
NUM_ATOM_TYPES
|
NUM_ATOM_TYPES
|
||||||
};
|
};
|
||||||
/** field types */
|
/** field types */
|
||||||
enum FieldName {
|
enum FieldName {
|
||||||
TIME=-2,
|
TIME=-2,
|
||||||
POSITION=-1,
|
POSITION=-1,
|
||||||
TEMPERATURE=0, // Intrinsic Fields
|
TEMPERATURE=0, // Intrinsic Fields
|
||||||
|
@ -114,9 +114,9 @@ namespace ATC
|
||||||
ELECTRON_TEMPERATURE,
|
ELECTRON_TEMPERATURE,
|
||||||
ELECTRIC_POTENTIAL,
|
ELECTRIC_POTENTIAL,
|
||||||
ELECTRON_WAVEFUNCTION,
|
ELECTRON_WAVEFUNCTION,
|
||||||
ELECTRON_WAVEFUNCTIONS,
|
ELECTRON_WAVEFUNCTIONS,
|
||||||
ELECTRON_WAVEFUNCTION_ENERGIES,
|
ELECTRON_WAVEFUNCTION_ENERGIES,
|
||||||
FERMI_ENERGY,
|
FERMI_ENERGY,
|
||||||
MOMENTUM,
|
MOMENTUM,
|
||||||
PROJECTED_VELOCITY,
|
PROJECTED_VELOCITY,
|
||||||
KINETIC_TEMPERATURE,
|
KINETIC_TEMPERATURE,
|
||||||
|
@ -144,9 +144,9 @@ namespace ATC
|
||||||
QUADRUPOLE_MOMENT,
|
QUADRUPOLE_MOMENT,
|
||||||
CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT,
|
CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT,
|
||||||
DISLOCATION_DENSITY,
|
DISLOCATION_DENSITY,
|
||||||
NUM_TOTAL_FIELDS
|
NUM_TOTAL_FIELDS
|
||||||
};
|
};
|
||||||
const int NUM_FIELDS = ELECTRON_WAVEFUNCTION+1;
|
const int NUM_FIELDS = ELECTRON_WAVEFUNCTION+1;
|
||||||
|
|
||||||
#define NDIM 3
|
#define NDIM 3
|
||||||
static const int FieldSizes[NUM_TOTAL_FIELDS] = {
|
static const int FieldSizes[NUM_TOTAL_FIELDS] = {
|
||||||
|
@ -193,7 +193,7 @@ namespace ATC
|
||||||
NDIM*NDIM // DISLOCATION_DENSITY
|
NDIM*NDIM // DISLOCATION_DENSITY
|
||||||
};
|
};
|
||||||
|
|
||||||
enum NodalAtomicFieldNormalization {
|
enum NodalAtomicFieldNormalization {
|
||||||
NO_NORMALIZATION=0,
|
NO_NORMALIZATION=0,
|
||||||
VOLUME_NORMALIZATION, NUMBER_NORMALIZATION, MASS_NORMALIZATION,
|
VOLUME_NORMALIZATION, NUMBER_NORMALIZATION, MASS_NORMALIZATION,
|
||||||
MASS_MATRIX
|
MASS_MATRIX
|
||||||
|
@ -209,7 +209,7 @@ namespace ATC
|
||||||
enum FeIntQuadrature {NODAL, GAUSS1, GAUSS2, GAUSS3, FACE};
|
enum FeIntQuadrature {NODAL, GAUSS1, GAUSS2, GAUSS3, FACE};
|
||||||
|
|
||||||
/** field name enum to string */
|
/** field name enum to string */
|
||||||
inline FeIntQuadrature string_to_FIQ(const std::string &str)
|
inline FeIntQuadrature string_to_FIQ(const std::string &str)
|
||||||
{
|
{
|
||||||
if (str == "nodal")
|
if (str == "nodal")
|
||||||
return NODAL;
|
return NODAL;
|
||||||
|
@ -226,7 +226,7 @@ namespace ATC
|
||||||
}
|
}
|
||||||
|
|
||||||
/** field name enum to string */
|
/** field name enum to string */
|
||||||
inline std::string field_to_string(const FieldName index)
|
inline std::string field_to_string(const FieldName index)
|
||||||
{
|
{
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case TEMPERATURE:
|
case TEMPERATURE:
|
||||||
|
@ -313,7 +313,7 @@ namespace ATC
|
||||||
}
|
}
|
||||||
|
|
||||||
/** string to field enum */
|
/** string to field enum */
|
||||||
inline FieldName string_to_field(const std::string & name)
|
inline FieldName string_to_field(const std::string & name)
|
||||||
{
|
{
|
||||||
if (name=="temperature")
|
if (name=="temperature")
|
||||||
return TEMPERATURE;
|
return TEMPERATURE;
|
||||||
|
@ -397,7 +397,7 @@ namespace ATC
|
||||||
throw ATC_Error(name + " is not a valid field");
|
throw ATC_Error(name + " is not a valid field");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_intrinsic(const FieldName & field_enum)
|
inline bool is_intrinsic(const FieldName & field_enum)
|
||||||
{
|
{
|
||||||
if (field_enum==TEMPERATURE
|
if (field_enum==TEMPERATURE
|
||||||
|| field_enum==DISPLACEMENT
|
|| field_enum==DISPLACEMENT
|
||||||
|
@ -412,7 +412,7 @@ namespace ATC
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string field_to_intrinsic_name(const FieldName index)
|
inline std::string field_to_intrinsic_name(const FieldName index)
|
||||||
{
|
{
|
||||||
if (is_intrinsic(index)) {
|
if (is_intrinsic(index)) {
|
||||||
return "NodalAtomic"+ATC_Utility::to_cap(field_to_string(index));
|
return "NodalAtomic"+ATC_Utility::to_cap(field_to_string(index));
|
||||||
|
@ -421,7 +421,7 @@ namespace ATC
|
||||||
throw ATC_Error("field "+field_to_string(index)+" is not an intrinsic field");
|
throw ATC_Error("field "+field_to_string(index)+" is not an intrinsic field");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline std::string field_to_restriction_name(const FieldName index)
|
inline std::string field_to_restriction_name(const FieldName index)
|
||||||
{
|
{
|
||||||
if (is_intrinsic(index)) {
|
if (is_intrinsic(index)) {
|
||||||
return "Restricted"+ATC_Utility::to_cap(field_to_string(index));
|
return "Restricted"+ATC_Utility::to_cap(field_to_string(index));
|
||||||
|
@ -430,7 +430,7 @@ namespace ATC
|
||||||
throw ATC_Error("field "+field_to_string(index)+" is not an intrinsic field");
|
throw ATC_Error("field "+field_to_string(index)+" is not an intrinsic field");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline std::string field_to_prolongation_name(const FieldName index)
|
inline std::string field_to_prolongation_name(const FieldName index)
|
||||||
{
|
{
|
||||||
return "Prolonged"+ATC_Utility::to_cap(field_to_string(index));
|
return "Prolonged"+ATC_Utility::to_cap(field_to_string(index));
|
||||||
}
|
}
|
||||||
|
@ -473,9 +473,9 @@ namespace ATC
|
||||||
THERMO_ELASTIC,
|
THERMO_ELASTIC,
|
||||||
SPECIES // aka Mass
|
SPECIES // aka Mass
|
||||||
};
|
};
|
||||||
|
|
||||||
/** rhs types */
|
/** rhs types */
|
||||||
enum FluxType
|
enum FluxType
|
||||||
{
|
{
|
||||||
FLUX = 0, // has a source weighted by gradient of shape function
|
FLUX = 0, // has a source weighted by gradient of shape function
|
||||||
SOURCE, // has a source term weighted by the shape function
|
SOURCE, // has a source term weighted by the shape function
|
||||||
|
@ -487,12 +487,12 @@ namespace ATC
|
||||||
};
|
};
|
||||||
|
|
||||||
/** stiffness/ derivative of rhs types */
|
/** stiffness/ derivative of rhs types */
|
||||||
enum StiffnessType
|
enum StiffnessType
|
||||||
{
|
{
|
||||||
BB_STIFFNESS = 0,
|
BB_STIFFNESS = 0,
|
||||||
NN_STIFFNESS,
|
NN_STIFFNESS,
|
||||||
BN_STIFFNESS,
|
BN_STIFFNESS,
|
||||||
NB_STIFFNESS,
|
NB_STIFFNESS,
|
||||||
NUM_STIFFNESS
|
NUM_STIFFNESS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -519,8 +519,8 @@ namespace ATC
|
||||||
typedef std::set<int> ESET; // elementset
|
typedef std::set<int> ESET; // elementset
|
||||||
|
|
||||||
/** typedefs for N and B integrand functions */
|
/** typedefs for N and B integrand functions */
|
||||||
typedef std::set<FieldName> ARG_NAMES;
|
typedef std::set<FieldName> ARG_NAMES;
|
||||||
typedef std::map<FieldName, ATC_matrix::DenseMatrix<double> > ARGS;
|
typedef std::map<FieldName, ATC_matrix::DenseMatrix<double> > ARGS;
|
||||||
typedef ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> FIELD;
|
typedef ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> FIELD;
|
||||||
typedef std::vector<ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > GRAD_FIELD;
|
typedef std::vector<ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > GRAD_FIELD;
|
||||||
typedef std::map<FieldName, ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > FIELDS;
|
typedef std::map<FieldName, ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > FIELDS;
|
||||||
|
@ -555,7 +555,7 @@ namespace ATC
|
||||||
typedef std::map<FieldName, std::set<PAIR> > OPEN_SURFACE;
|
typedef std::map<FieldName, std::set<PAIR> > OPEN_SURFACE;
|
||||||
typedef std::map<FieldName, Array2D<XT_Function *> > VOLUME_SOURCE;
|
typedef std::map<FieldName, Array2D<XT_Function *> > VOLUME_SOURCE;
|
||||||
typedef std::map<std::string, ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > ATOMIC_DATA;
|
typedef std::map<std::string, ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > ATOMIC_DATA;
|
||||||
|
|
||||||
/** typedefs for FE_Mesh */
|
/** typedefs for FE_Mesh */
|
||||||
typedef std::map<std::string, std::set<int > > NODE_SET_MAP;
|
typedef std::map<std::string, std::set<int > > NODE_SET_MAP;
|
||||||
typedef std::map<std::string, std::set<int > > ELEMENT_SET_MAP;
|
typedef std::map<std::string, std::set<int > > ELEMENT_SET_MAP;
|
||||||
|
@ -603,14 +603,14 @@ namespace ATC
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string print_mask(const Array2D<bool> & rhsMask)
|
inline std::string print_mask(const Array2D<bool> & rhsMask)
|
||||||
{
|
{
|
||||||
std::string msg;
|
std::string msg;
|
||||||
for (int i = 0; i < NUM_FIELDS; i++) {
|
for (int i = 0; i < NUM_FIELDS; i++) {
|
||||||
FieldName field = (FieldName) i;
|
FieldName field = (FieldName) i;
|
||||||
std::string name = field_to_string(field);
|
std::string name = field_to_string(field);
|
||||||
if (rhsMask(field,FLUX)
|
if (rhsMask(field,FLUX)
|
||||||
|| rhsMask(field,SOURCE)
|
|| rhsMask(field,SOURCE)
|
||||||
|| rhsMask(field,PRESCRIBED_SOURCE)
|
|| rhsMask(field,PRESCRIBED_SOURCE)
|
||||||
|| rhsMask(field,ROBIN_SOURCE)
|
|| rhsMask(field,ROBIN_SOURCE)
|
||||||
|| rhsMask(field,OPEN_SOURCE)
|
|| rhsMask(field,OPEN_SOURCE)
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
namespace ATC_matrix {
|
namespace ATC_matrix {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Array
|
* @class Array
|
||||||
* @brief Base class for creating, sizing and operating on 1-D arrays of data
|
* @brief Base class for creating, sizing and operating on 1-D arrays of data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
Array(const Array<T>& A);
|
Array(const Array<T>& A);
|
||||||
virtual ~Array();
|
virtual ~Array();
|
||||||
|
|
||||||
// Resize and reinitialize the array
|
// Resize and reinitialize the array
|
||||||
virtual void reset(int len);
|
virtual void reset(int len);
|
||||||
//* resizes the matrix, copy what fits default to OFF
|
//* resizes the matrix, copy what fits default to OFF
|
||||||
virtual void resize(int len, bool copy=false);
|
virtual void resize(int len, bool copy=false);
|
||||||
|
@ -38,17 +38,17 @@ public:
|
||||||
int size() const;
|
int size() const;
|
||||||
// Do I have this element?
|
// Do I have this element?
|
||||||
bool has_member(T val) const;
|
bool has_member(T val) const;
|
||||||
// range
|
// range
|
||||||
bool check_range(T min, T max) const;
|
bool check_range(T min, T max) const;
|
||||||
void range(T & min, T & max) const;
|
void range(T & min, T & max) const;
|
||||||
// search an ordered array
|
// search an ordered array
|
||||||
int index(T& val) const;
|
int index(T& val) const;
|
||||||
// Return pointer to internal data
|
// Return pointer to internal data
|
||||||
const T* data() const;
|
const T* data() const;
|
||||||
T* ptr() const;
|
T* ptr() const;
|
||||||
// print
|
// print
|
||||||
void print(std::string name = "") const;
|
void print(std::string name = "") const;
|
||||||
// Dump templated type to disk; operation not safe for all types
|
// Dump templated type to disk; operation not safe for all types
|
||||||
void write_restart(FILE *f) const;
|
void write_restart(FILE *f) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
virtual ~AliasArray();
|
virtual ~AliasArray();
|
||||||
virtual AliasArray<T>& operator= (const Array<T> &other);
|
virtual AliasArray<T>& operator= (const Array<T> &other);
|
||||||
virtual AliasArray<T>& operator= (const T &value);
|
virtual AliasArray<T>& operator= (const T &value);
|
||||||
|
|
||||||
const T& operator() (int i) const;
|
const T& operator() (int i) const;
|
||||||
int size() const;
|
int size() const;
|
||||||
T* ptr() const;
|
T* ptr() const;
|
||||||
|
@ -135,8 +135,8 @@ void Array<T>::resize(int len, bool copy) {
|
||||||
delete[] data_;
|
delete[] data_;
|
||||||
data_ = new T[len_];
|
data_ = new T[len_];
|
||||||
for (int i = 0 ; i < len_; i++) {
|
for (int i = 0 ; i < len_; i++) {
|
||||||
if (i < temp.size())
|
if (i < temp.size())
|
||||||
data_[i] = temp.data_[i];
|
data_[i] = temp.data_[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -269,7 +269,7 @@ AliasArray<T>::AliasArray(const AliasArray<T> & other) {
|
||||||
|
|
||||||
// for a mem continguous slice
|
// for a mem continguous slice
|
||||||
template<typename T>
|
template<typename T>
|
||||||
AliasArray<T>::AliasArray(int len, T * ptr) {
|
AliasArray<T>::AliasArray(int len, T * ptr) {
|
||||||
len_ = len;
|
len_ = len;
|
||||||
data_ = ptr;
|
data_ = ptr;
|
||||||
}
|
}
|
||||||
|
@ -281,8 +281,8 @@ AliasArray<T>::AliasArray(const Array<T>& A) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
AliasArray<T>::~AliasArray(void) {
|
AliasArray<T>::~AliasArray(void) {
|
||||||
len_ = 0;
|
len_ = 0;
|
||||||
data_ = nullptr; // trick base class into not deleting parent data
|
data_ = nullptr; // trick base class into not deleting parent data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,20 +20,20 @@ namespace ATC_matrix {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Array2D {
|
class Array2D {
|
||||||
public:
|
public:
|
||||||
Array2D();
|
Array2D();
|
||||||
Array2D(int nrows, int ncols);
|
Array2D(int nrows, int ncols);
|
||||||
Array2D(const Array2D<T>& A); // copy constructor
|
Array2D(const Array2D<T>& A); // copy constructor
|
||||||
~Array2D();
|
~Array2D();
|
||||||
|
|
||||||
// Resize and reinitalize matrix
|
// Resize and reinitalize matrix
|
||||||
void reset(int nrows, int ncols);
|
void reset(int nrows, int ncols);
|
||||||
// Access method to get the (i,j) element:
|
// Access method to get the (i,j) element:
|
||||||
T& operator() (int i, int j);
|
T& operator() (int i, int j);
|
||||||
// Access method to get the i-th col
|
// Access method to get the i-th col
|
||||||
AliasArray<T> column(int i) const;
|
AliasArray<T> column(int i) const;
|
||||||
// Access method to get the (i,j) element:
|
// Access method to get the (i,j) element:
|
||||||
const T& operator() (int i, int j) const;
|
const T& operator() (int i, int j) const;
|
||||||
// Copy operator
|
// Copy operator
|
||||||
Array2D<T>& operator= (const Array2D<T>& other);
|
Array2D<T>& operator= (const Array2D<T>& other);
|
||||||
// assignment operator
|
// assignment operator
|
||||||
|
@ -48,10 +48,10 @@ public:
|
||||||
// Dump templated type to disk; operation not safe for all types
|
// Dump templated type to disk; operation not safe for all types
|
||||||
void write_restart(FILE *f) const;
|
void write_restart(FILE *f) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int nrows_, ncols_;
|
int nrows_, ncols_;
|
||||||
T *data_;
|
T *data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Array2D<T>::Array2D() {
|
Array2D<T>::Array2D() {
|
||||||
|
@ -172,7 +172,7 @@ template<typename T>
|
||||||
Array2D<T>::~Array2D() {
|
Array2D<T>::~Array2D() {
|
||||||
if (data_ != nullptr)
|
if (data_ != nullptr)
|
||||||
delete[] data_;
|
delete[] data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void Array2D<T>::print(std::string name) const {
|
void Array2D<T>::print(std::string name) const {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// ATC headers
|
// ATC headers
|
||||||
#include "AtomToMoleculeTransfer.h"
|
#include "AtomToMoleculeTransfer.h"
|
||||||
#include "ATC_Method.h"
|
#include "ATC_Method.h"
|
||||||
|
|
||||||
|
@ -19,15 +19,15 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
atomPositions_->register_dependence(this);
|
atomPositions_->register_dependence(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
SmallMoleculeCentroid::~SmallMoleculeCentroid()
|
SmallMoleculeCentroid::~SmallMoleculeCentroid()
|
||||||
{
|
{
|
||||||
atomPositions_->remove_dependence(this);
|
atomPositions_->remove_dependence(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Quantity
|
// Quantity
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -42,7 +42,7 @@ namespace ATC {
|
||||||
for (int i = 0; i < nLocalMol; i++) {
|
for (int i = 0; i < nLocalMol; i++) {
|
||||||
const set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
|
const set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
|
||||||
set<int>::const_iterator atomsLocalMolID;
|
set<int>::const_iterator atomsLocalMolID;
|
||||||
double totalSourceMol = 0.0; // for total source
|
double totalSourceMol = 0.0; // for total source
|
||||||
for (atomsLocalMolID = atomsLocalMolArray.begin(); atomsLocalMolID != atomsLocalMolArray.end(); atomsLocalMolID++) {
|
for (atomsLocalMolID = atomsLocalMolArray.begin(); atomsLocalMolID != atomsLocalMolArray.end(); atomsLocalMolID++) {
|
||||||
totalSourceMol += sourceMatrix(*atomsLocalMolID,0);
|
totalSourceMol += sourceMatrix(*atomsLocalMolID,0);
|
||||||
} // compute total source
|
} // compute total source
|
||||||
|
@ -62,11 +62,11 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Class SmallMoleculeDipoleMoment
|
// Class SmallMoleculeDipoleMoment
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -100,8 +100,8 @@ namespace ATC {
|
||||||
quantity_.reset(nLocalMol,nsd);
|
quantity_.reset(nLocalMol,nsd);
|
||||||
double dx[3];
|
double dx[3];
|
||||||
|
|
||||||
//call the SmallMoleculeCentroid here to find Centroid ....
|
//call the SmallMoleculeCentroid here to find Centroid ....
|
||||||
const DENS_MAT & centroidMolMatrix(centroid_->quantity());
|
const DENS_MAT & centroidMolMatrix(centroid_->quantity());
|
||||||
for (int i = 0; i < nLocalMol; i++) {
|
for (int i = 0; i < nLocalMol; i++) {
|
||||||
const set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
|
const set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
|
||||||
set<int>::const_iterator atomsLocalMolID;;
|
set<int>::const_iterator atomsLocalMolID;;
|
||||||
|
@ -111,15 +111,15 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
lammps->minimum_image(dx[0], dx[1], dx[2]);
|
lammps->minimum_image(dx[0], dx[1], dx[2]);
|
||||||
for(int j = 0; j < nsd; j++) {
|
for(int j = 0; j < nsd; j++) {
|
||||||
quantity_(i,j) += sourceMatrix(*atomsLocalMolID,0) * dx[j];
|
quantity_(i,j) += sourceMatrix(*atomsLocalMolID,0) * dx[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Class SmallMoleculeQuadrupoleMoment
|
// Class SmallMoleculeQuadrupoleMoment
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -202,9 +202,9 @@ namespace ATC {
|
||||||
// reallocate memory only if sizing has changed
|
// reallocate memory only if sizing has changed
|
||||||
const SPAR_MAT & shapeFunctionMatrix(shapeFunction_->quantity());
|
const SPAR_MAT & shapeFunctionMatrix(shapeFunction_->quantity());
|
||||||
quantity_.resize(shapeFunctionMatrix.nCols(),sourceMatrix.nCols());
|
quantity_.resize(shapeFunctionMatrix.nCols(),sourceMatrix.nCols());
|
||||||
|
|
||||||
local_restriction(sourceMatrix,shapeFunctionMatrix);
|
local_restriction(sourceMatrix,shapeFunctionMatrix);
|
||||||
|
|
||||||
// communicate for total restriction
|
// communicate for total restriction
|
||||||
int count = quantity_.nRows()*quantity_.nCols();
|
int count = quantity_.nRows()*quantity_.nCols();
|
||||||
lammpsInterface_->allsum(_workspace_.ptr(),quantity_.ptr(),count);
|
lammpsInterface_->allsum(_workspace_.ptr(),quantity_.ptr(),count);
|
||||||
|
@ -222,4 +222,4 @@ namespace ATC {
|
||||||
_workspace_.reset(quantity_.nRows(),quantity_.nCols());
|
_workspace_.reset(quantity_.nRows(),quantity_.nCols());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// A class for defining transfer operations molecular centers of mass (centroid), dipole moments, quadrupole moments
|
// A class for defining transfer operations molecular centers of mass (centroid), dipole moments, quadrupole moments
|
||||||
|
|
||||||
#ifndef ATOM_TO_MOLECULE_TRANSFER_H
|
#ifndef ATOM_TO_MOLECULE_TRANSFER_H
|
||||||
#define ATOM_TO_MOLECULE_TRANSFER_H
|
#define ATOM_TO_MOLECULE_TRANSFER_H
|
||||||
|
@ -15,18 +15,18 @@ namespace ATC {
|
||||||
// forward declarations
|
// forward declarations
|
||||||
class ATC_Method;
|
class ATC_Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class PerMoleculeQuantity
|
* @class PerMoleculeQuantity
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class PerMoleculeQuantity : public DenseMatrixTransfer<T> {
|
class PerMoleculeQuantity : public DenseMatrixTransfer<T> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PerMoleculeQuantity(ATC_Method * atc):DenseMatrixTransfer<T>(), atc_(atc) {};
|
PerMoleculeQuantity(ATC_Method * atc):DenseMatrixTransfer<T>(), atc_(atc) {};
|
||||||
|
|
||||||
virtual ~PerMoleculeQuantity() {};
|
virtual ~PerMoleculeQuantity() {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -34,8 +34,8 @@ namespace ATC {
|
||||||
/** utility object for atc information */
|
/** utility object for atc information */
|
||||||
ATC_Method * atc_;
|
ATC_Method * atc_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//do not define
|
//do not define
|
||||||
PerMoleculeQuantity();
|
PerMoleculeQuantity();
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class AtomToSmallMoleculeTransfer : public PerMoleculeQuantity<T> {
|
class AtomToSmallMoleculeTransfer : public PerMoleculeQuantity<T> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//constructor
|
//constructor
|
||||||
|
@ -61,20 +61,20 @@ namespace ATC {
|
||||||
source_->register_dependence(this);
|
source_->register_dependence(this);
|
||||||
smallMoleculeSet_->register_dependence(this);
|
smallMoleculeSet_->register_dependence(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
//destructor
|
//destructor
|
||||||
virtual ~AtomToSmallMoleculeTransfer()
|
virtual ~AtomToSmallMoleculeTransfer()
|
||||||
{
|
{
|
||||||
source_->remove_dependence(this);
|
source_->remove_dependence(this);
|
||||||
smallMoleculeSet_->remove_dependence(this);
|
smallMoleculeSet_->remove_dependence(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
// apply transfer operator
|
// apply transfer operator
|
||||||
void reset_quantity() const
|
void reset_quantity() const
|
||||||
{
|
{
|
||||||
const DenseMatrix<T> & sourceMatrix(source_->quantity());
|
const DenseMatrix<T> & sourceMatrix(source_->quantity());
|
||||||
int nLocalMol = smallMoleculeSet_->local_molecule_count();
|
int nLocalMol = smallMoleculeSet_->local_molecule_count();
|
||||||
(this->quantity_).reset(nLocalMol,sourceMatrix.nCols());
|
(this->quantity_).reset(nLocalMol,sourceMatrix.nCols());
|
||||||
for (int i = 0; i < nLocalMol ; i++) {
|
for (int i = 0; i < nLocalMol ; i++) {
|
||||||
const std::set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
|
const std::set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
|
||||||
std::set<int>::const_iterator atomsLocalMolID;
|
std::set<int>::const_iterator atomsLocalMolID;
|
||||||
|
@ -86,29 +86,29 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// pointer to source atomic quantity data
|
// pointer to source atomic quantity data
|
||||||
PerAtomQuantity<T> * source_;
|
PerAtomQuantity<T> * source_;
|
||||||
// pointer to molecule data
|
// pointer to molecule data
|
||||||
SmallMoleculeSet * smallMoleculeSet_;
|
SmallMoleculeSet * smallMoleculeSet_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// do not define
|
// do not define
|
||||||
AtomToSmallMoleculeTransfer();
|
AtomToSmallMoleculeTransfer();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class SmallMoleculeCentroid
|
* @class SmallMoleculeCentroid
|
||||||
* @brief Class for defining objects to transfer molecular centroid (center of mass)
|
* @brief Class for defining objects to transfer molecular centroid (center of mass)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class SmallMoleculeCentroid : public AtomToSmallMoleculeTransfer<double> {
|
class SmallMoleculeCentroid : public AtomToSmallMoleculeTransfer<double> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//constructor
|
//constructor
|
||||||
SmallMoleculeCentroid(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions);
|
SmallMoleculeCentroid(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions);
|
||||||
|
@ -116,15 +116,15 @@ namespace ATC {
|
||||||
//destructor
|
//destructor
|
||||||
virtual ~SmallMoleculeCentroid();
|
virtual ~SmallMoleculeCentroid();
|
||||||
|
|
||||||
// apply transfer operator
|
// apply transfer operator
|
||||||
virtual void reset_quantity() const;
|
virtual void reset_quantity() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// pointer to source atomic quantity date : positions of atoms in a molecule
|
// pointer to source atomic quantity date : positions of atoms in a molecule
|
||||||
PerAtomQuantity<double> * atomPositions_;
|
PerAtomQuantity<double> * atomPositions_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//do not define
|
//do not define
|
||||||
SmallMoleculeCentroid();
|
SmallMoleculeCentroid();
|
||||||
|
@ -133,28 +133,28 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class SmallMoleculeDipoleMoment
|
* @class SmallMoleculeDipoleMoment
|
||||||
* @brief Class for defining objects to transfer molecular dipole moments
|
* @brief Class for defining objects to transfer molecular dipole moments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SmallMoleculeDipoleMoment : public SmallMoleculeCentroid {
|
class SmallMoleculeDipoleMoment : public SmallMoleculeCentroid {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//constructor
|
//constructor
|
||||||
SmallMoleculeDipoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);
|
SmallMoleculeDipoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);
|
||||||
|
|
||||||
//destructor
|
//destructor
|
||||||
virtual ~SmallMoleculeDipoleMoment();
|
virtual ~SmallMoleculeDipoleMoment();
|
||||||
|
|
||||||
// apply transfer operator
|
// apply transfer operator
|
||||||
virtual void reset_quantity() const;
|
virtual void reset_quantity() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//pointer to the centroid data
|
//pointer to the centroid data
|
||||||
SmallMoleculeCentroid * centroid_;
|
SmallMoleculeCentroid * centroid_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//do not define
|
//do not define
|
||||||
SmallMoleculeDipoleMoment();
|
SmallMoleculeDipoleMoment();
|
||||||
|
@ -162,14 +162,14 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class AtomToFeTransfer
|
* @class AtomToFeTransfer
|
||||||
* @brief Class for defining objects to transfer molecular quadrupole moments
|
* @brief Class for defining objects to transfer molecular quadrupole moments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class SmallMoleculeQuadrupoleMoment : public SmallMoleculeCentroid {
|
class SmallMoleculeQuadrupoleMoment : public SmallMoleculeCentroid {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//constructor
|
//constructor
|
||||||
SmallMoleculeQuadrupoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);
|
SmallMoleculeQuadrupoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);
|
||||||
|
@ -179,10 +179,10 @@ namespace ATC {
|
||||||
|
|
||||||
//apply transfer operator
|
//apply transfer operator
|
||||||
virtual void reset_quantity() const;
|
virtual void reset_quantity() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//pointer to the centroid data
|
//pointer to the centroid data
|
||||||
SmallMoleculeCentroid * centroid_;
|
SmallMoleculeCentroid * centroid_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -190,7 +190,7 @@ namespace ATC {
|
||||||
//do not define
|
//do not define
|
||||||
SmallMoleculeQuadrupoleMoment();
|
SmallMoleculeQuadrupoleMoment();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class MotfShapeFunctionRestriction
|
* @class MotfShapeFunctionRestriction
|
||||||
|
@ -201,11 +201,11 @@ namespace ATC {
|
||||||
class MotfShapeFunctionRestriction : public MatToMatTransfer<double> {
|
class MotfShapeFunctionRestriction : public MatToMatTransfer<double> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
MotfShapeFunctionRestriction(PerMoleculeQuantity<double> * source,
|
MotfShapeFunctionRestriction(PerMoleculeQuantity<double> * source,
|
||||||
SPAR_MAN * shapeFunction);
|
SPAR_MAN * shapeFunction);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~MotfShapeFunctionRestriction();
|
virtual ~MotfShapeFunctionRestriction();
|
||||||
|
|
||||||
|
@ -218,8 +218,8 @@ namespace ATC {
|
||||||
SPAR_MAN * shapeFunction_;
|
SPAR_MAN * shapeFunction_;
|
||||||
|
|
||||||
/** persistent workspace */
|
/** persistent workspace */
|
||||||
|
|
||||||
|
|
||||||
mutable DENS_MAT _workspace_;
|
mutable DENS_MAT _workspace_;
|
||||||
|
|
||||||
/** applies restriction operation on this processor */
|
/** applies restriction operation on this processor */
|
||||||
|
@ -236,4 +236,4 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ using std::pair;
|
||||||
|
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
|
|
||||||
// only one regulator method at time, i.e. fixed & flux, thermo & elastic
|
// only one regulator method at time, i.e. fixed & flux, thermo & elastic
|
||||||
// regulator manages lambda variables, creates new ones when requested with dimensions and zero ics (map of tag to lambda)
|
// regulator manages lambda variables, creates new ones when requested with dimensions and zero ics (map of tag to lambda)
|
||||||
// regulator keeps track of which lambda are being used, unused lambdas deleted (map of tag to bool), all tags set to unused on start of initialization
|
// regulator keeps track of which lambda are being used, unused lambdas deleted (map of tag to bool), all tags set to unused on start of initialization
|
||||||
|
@ -168,7 +168,7 @@ namespace ATC {
|
||||||
fix_modify AtC control <physics_type> <solution_parameter> <value>\n
|
fix_modify AtC control <physics_type> <solution_parameter> <value>\n
|
||||||
- physics_type (string) = thermal | momentum\n
|
- physics_type (string) = thermal | momentum\n
|
||||||
- solution_parameter (string) = max_iterations | tolerance\n
|
- solution_parameter (string) = max_iterations | tolerance\n
|
||||||
|
|
||||||
fix_modify AtC transfer <physics_type> control max_iterations <max_iterations>\n
|
fix_modify AtC transfer <physics_type> control max_iterations <max_iterations>\n
|
||||||
- max_iterations (int) = maximum number of iterations that will be used by iterative matrix solvers\n
|
- max_iterations (int) = maximum number of iterations that will be used by iterative matrix solvers\n
|
||||||
|
|
||||||
|
@ -209,14 +209,14 @@ namespace ATC {
|
||||||
foundMatch = true;
|
foundMatch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \page man_localized_lambda fix_modify AtC control localized_lambda
|
/*! \page man_localized_lambda fix_modify AtC control localized_lambda
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC control localized_lambda <on|off>
|
fix_modify AtC control localized_lambda <on|off>
|
||||||
\section examples
|
\section examples
|
||||||
<TT> fix_modify atc control localized_lambda on </TT> \n
|
<TT> fix_modify atc control localized_lambda on </TT> \n
|
||||||
\section description
|
\section description
|
||||||
Turns on localization algorithms for control algorithms to restrict the influence of FE coupling or boundary conditions to a region near the boundary of the MD region. Control algorithms will not affect atoms in elements not possessing faces on the boundary of the region. Flux-based control is localized via row-sum lumping while quantity control is done by solving a truncated matrix equation.
|
Turns on localization algorithms for control algorithms to restrict the influence of FE coupling or boundary conditions to a region near the boundary of the MD region. Control algorithms will not affect atoms in elements not possessing faces on the boundary of the region. Flux-based control is localized via row-sum lumping while quantity control is done by solving a truncated matrix equation.
|
||||||
\section restrictions
|
\section restrictions
|
||||||
\section related
|
\section related
|
||||||
\section default
|
\section default
|
||||||
Default is off.
|
Default is off.
|
||||||
|
@ -233,16 +233,16 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \page man_lumped_lambda_solve fix_modify AtC control lumped_lambda_solve
|
/*! \page man_lumped_lambda_solve fix_modify AtC control lumped_lambda_solve
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC control lumped_lambda_solve <on|off>
|
fix_modify AtC control lumped_lambda_solve <on|off>
|
||||||
\section examples
|
\section examples
|
||||||
<TT> fix_modify atc control lumped_lambda_solve on </TT> \n
|
<TT> fix_modify atc control lumped_lambda_solve on </TT> \n
|
||||||
\section description
|
\section description
|
||||||
Command to use or not use lumped matrix for lambda solve
|
Command to use or not use lumped matrix for lambda solve
|
||||||
\section restrictions
|
\section restrictions
|
||||||
\section related
|
\section related
|
||||||
\section default
|
\section default
|
||||||
*/
|
*/
|
||||||
|
@ -260,12 +260,12 @@ namespace ATC {
|
||||||
|
|
||||||
/*! \page man_mask_direction fix_modify AtC control mask_direction
|
/*! \page man_mask_direction fix_modify AtC control mask_direction
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC control mask_direction <direction> <on|off>
|
fix_modify AtC control mask_direction <direction> <on|off>
|
||||||
\section examples
|
\section examples
|
||||||
<TT> fix_modify atc control mask_direction 0 on </TT> \n
|
<TT> fix_modify atc control mask_direction 0 on </TT> \n
|
||||||
\section description
|
\section description
|
||||||
Command to mask out certain dimensions from the atomic regulator
|
Command to mask out certain dimensions from the atomic regulator
|
||||||
\section restrictions
|
\section restrictions
|
||||||
\section related
|
\section related
|
||||||
\section default
|
\section default
|
||||||
*/
|
*/
|
||||||
|
@ -404,7 +404,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_pre_predictor:
|
// apply_pre_predictor:
|
||||||
// applies the controller in the pre-predictor
|
// applies the controller in the pre-predictor
|
||||||
// phase of the time integrator
|
// phase of the time integrator
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void AtomicRegulator::apply_pre_predictor(double dt, int timeStep)
|
void AtomicRegulator::apply_pre_predictor(double dt, int timeStep)
|
||||||
{
|
{
|
||||||
|
@ -415,7 +415,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_mid_predictor:
|
// apply_mid_predictor:
|
||||||
// applies the controller in the mid-predictor
|
// applies the controller in the mid-predictor
|
||||||
// phase of the time integrator
|
// phase of the time integrator
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void AtomicRegulator::apply_mid_predictor(double dt, int timeStep)
|
void AtomicRegulator::apply_mid_predictor(double dt, int timeStep)
|
||||||
{
|
{
|
||||||
|
@ -426,14 +426,14 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_post_predictor:
|
// apply_post_predictor:
|
||||||
// applies the controller in the post-predictor
|
// applies the controller in the post-predictor
|
||||||
// phase of the time integrator
|
// phase of the time integrator
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void AtomicRegulator::apply_post_predictor(double dt, int timeStep)
|
void AtomicRegulator::apply_post_predictor(double dt, int timeStep)
|
||||||
{
|
{
|
||||||
if (timeStep % howOften_==0) // apply full integration scheme, including filter
|
if (timeStep % howOften_==0) // apply full integration scheme, including filter
|
||||||
regulatorMethod_->apply_post_predictor(dt);
|
regulatorMethod_->apply_post_predictor(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_pre_corrector:
|
// apply_pre_corrector:
|
||||||
// applies the controller in the pre-corrector phase
|
// applies the controller in the pre-corrector phase
|
||||||
|
@ -441,7 +441,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void AtomicRegulator::apply_pre_corrector(double dt, int timeStep)
|
void AtomicRegulator::apply_pre_corrector(double dt, int timeStep)
|
||||||
{
|
{
|
||||||
if (timeStep % howOften_==0) // apply full integration scheme, including filter
|
if (timeStep % howOften_==0) // apply full integration scheme, including filter
|
||||||
regulatorMethod_->apply_pre_corrector(dt);
|
regulatorMethod_->apply_pre_corrector(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// add_to_rhs:
|
// add_to_rhs:
|
||||||
// adds any controller contributions to the FE rhs
|
// adds any controller contributions to the FE rhs
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void AtomicRegulator::add_to_rhs(FIELDS & rhs)
|
void AtomicRegulator::add_to_rhs(FIELDS & rhs)
|
||||||
{
|
{
|
||||||
|
@ -509,7 +509,7 @@ namespace ATC {
|
||||||
// Class RegulatorMethod
|
// Class RegulatorMethod
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -545,7 +545,7 @@ namespace ATC {
|
||||||
// Class RegulatorShapeFunction
|
// Class RegulatorShapeFunction
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -604,7 +604,7 @@ namespace ATC {
|
||||||
interscaleManager.add_dense_matrix_int(overlapToNodeMap_,
|
interscaleManager.add_dense_matrix_int(overlapToNodeMap_,
|
||||||
regulatorPrefix_+"OverlapToNodeMap");
|
regulatorPrefix_+"OverlapToNodeMap");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -690,7 +690,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void RegulatorShapeFunction::compute_sparsity(void)
|
void RegulatorShapeFunction::compute_sparsity(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
// first get local pattern from N N^T
|
// first get local pattern from N N^T
|
||||||
int nNodeOverlap = nodeToOverlapMap_->size();
|
int nNodeOverlap = nodeToOverlapMap_->size();
|
||||||
DENS_MAT tmpLocal(nNodeOverlap,nNodeOverlap);
|
DENS_MAT tmpLocal(nNodeOverlap,nNodeOverlap);
|
||||||
|
@ -699,7 +699,7 @@ namespace ATC {
|
||||||
if (myShapeFunctionMatrix.nRows() > 0) {
|
if (myShapeFunctionMatrix.nRows() > 0) {
|
||||||
tmpLocal = myShapeFunctionMatrix.transMat(myShapeFunctionMatrix);
|
tmpLocal = myShapeFunctionMatrix.transMat(myShapeFunctionMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
// second accumulate total pattern across processors
|
// second accumulate total pattern across processors
|
||||||
LammpsInterface::instance()->allsum(tmpLocal.ptr(), tmp.ptr(), tmp.size());
|
LammpsInterface::instance()->allsum(tmpLocal.ptr(), tmp.ptr(), tmp.size());
|
||||||
// third extract non-zero entries & construct sparse template
|
// third extract non-zero entries & construct sparse template
|
||||||
|
@ -724,13 +724,13 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
|
|
||||||
// assemble N^T W N with appropriate weighting matrix
|
// assemble N^T W N with appropriate weighting matrix
|
||||||
|
|
||||||
DIAG_MAT weights;
|
DIAG_MAT weights;
|
||||||
if (shapeFunctionMatrix_->nRows() > 0) {
|
if (shapeFunctionMatrix_->nRows() > 0) {
|
||||||
weights.reset(weights_->quantity());
|
weights.reset(weights_->quantity());
|
||||||
}
|
}
|
||||||
matrixSolver_->assemble_matrix(weights);
|
matrixSolver_->assemble_matrix(weights);
|
||||||
|
|
||||||
// solve on overlap nodes
|
// solve on overlap nodes
|
||||||
int nNodeOverlap = nodeToOverlapMap_->size();
|
int nNodeOverlap = nodeToOverlapMap_->size();
|
||||||
DENS_MAT rhsOverlap(nNodeOverlap,rhs.nCols());
|
DENS_MAT rhsOverlap(nNodeOverlap,rhs.nCols());
|
||||||
|
@ -747,7 +747,7 @@ namespace ATC {
|
||||||
tempLambda = 0.;
|
tempLambda = 0.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// map solution back to all nodes
|
// map solution back to all nodes
|
||||||
map_overlap_to_unique(lambdaOverlap,lambda);
|
map_overlap_to_unique(lambdaOverlap,lambda);
|
||||||
}
|
}
|
||||||
|
@ -761,8 +761,8 @@ namespace ATC {
|
||||||
RegulatorMethod::reset_nlocal();
|
RegulatorMethod::reset_nlocal();
|
||||||
nLocal_ = atomicRegulator_->nlocal();
|
nLocal_ = atomicRegulator_->nlocal();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//compute_sparsity();
|
//compute_sparsity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +903,7 @@ namespace ATC {
|
||||||
void LambdaMatrixSolver::assemble_matrix(DIAG_MAT & weights)
|
void LambdaMatrixSolver::assemble_matrix(DIAG_MAT & weights)
|
||||||
{
|
{
|
||||||
// form matrix : sum_a N_Ia * W_a * N_Ja
|
// form matrix : sum_a N_Ia * W_a * N_Ja
|
||||||
|
|
||||||
SPAR_MAT lambdaMatrixLocal(matrixTemplate_.quantity());
|
SPAR_MAT lambdaMatrixLocal(matrixTemplate_.quantity());
|
||||||
if (weights.nRows()>0)
|
if (weights.nRows()>0)
|
||||||
lambdaMatrixLocal.weighted_least_squares(shapeFunctionMatrix_->quantity(),weights);
|
lambdaMatrixLocal.weighted_least_squares(shapeFunctionMatrix_->quantity(),weights);
|
||||||
|
@ -941,13 +941,13 @@ namespace ATC {
|
||||||
void LambdaMatrixSolverLumped::assemble_matrix(DIAG_MAT & weights)
|
void LambdaMatrixSolverLumped::assemble_matrix(DIAG_MAT & weights)
|
||||||
{
|
{
|
||||||
LambdaMatrixSolver::assemble_matrix(weights);
|
LambdaMatrixSolver::assemble_matrix(weights);
|
||||||
|
|
||||||
lumpedMatrix_ = lambdaMatrix_.row_sum_lump();
|
lumpedMatrix_ = lambdaMatrix_.row_sum_lump();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LambdaMatrixSolverLumped::execute(VECTOR & rhs, VECTOR & lambda)
|
void LambdaMatrixSolverLumped::execute(VECTOR & rhs, VECTOR & lambda)
|
||||||
{
|
{
|
||||||
|
|
||||||
// solve lumped equation
|
// solve lumped equation
|
||||||
const set<int> & applicationNodes(applicationNodes_->quantity());
|
const set<int> & applicationNodes(applicationNodes_->quantity());
|
||||||
const INT_ARRAY & nodeToOverlapMap(nodeToOverlapMap_->quantity());
|
const INT_ARRAY & nodeToOverlapMap(nodeToOverlapMap_->quantity());
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class AtomicRegulator {
|
class AtomicRegulator {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** linear solver types */
|
/** linear solver types */
|
||||||
|
@ -68,14 +68,14 @@ namespace ATC {
|
||||||
GHOST_FLUX,
|
GHOST_FLUX,
|
||||||
FIXED
|
FIXED
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
AtomicRegulator(ATC_Coupling * atc,
|
AtomicRegulator(ATC_Coupling * atc,
|
||||||
const std::string & regulatorPrefix = "");
|
const std::string & regulatorPrefix = "");
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~AtomicRegulator();
|
virtual ~AtomicRegulator();
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
virtual bool modify(int narg, char **arg);
|
virtual bool modify(int narg, char **arg);
|
||||||
|
|
||||||
|
@ -87,11 +87,11 @@ namespace ATC {
|
||||||
|
|
||||||
/** initialization of method data */
|
/** initialization of method data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
/** add output information */
|
/** add output information */
|
||||||
virtual void output(OUTPUT_LIST & outputData) const;
|
virtual void output(OUTPUT_LIST & outputData) const;
|
||||||
virtual double compute_vector(int /* n */) const {return 0;}
|
virtual double compute_vector(int /* n */) const {return 0;}
|
||||||
|
|
||||||
/** final work at the end of a run */
|
/** final work at the end of a run */
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ namespace ATC {
|
||||||
/** set up atom to material identification */
|
/** set up atom to material identification */
|
||||||
virtual void reset_atom_materials(const Array<int> & elementToMaterialMap,
|
virtual void reset_atom_materials(const Array<int> & elementToMaterialMap,
|
||||||
const MatrixDependencyManager<DenseMatrix, int> * atomElement);
|
const MatrixDependencyManager<DenseMatrix, int> * atomElement);
|
||||||
|
|
||||||
// application steps
|
// application steps
|
||||||
/** apply the regulator in the pre-predictor phase */
|
/** apply the regulator in the pre-predictor phase */
|
||||||
virtual void apply_pre_predictor(double dt, int timeStep);
|
virtual void apply_pre_predictor(double dt, int timeStep);
|
||||||
|
@ -136,7 +136,7 @@ namespace ATC {
|
||||||
virtual void compute_boundary_flux(FIELDS & fields);
|
virtual void compute_boundary_flux(FIELDS & fields);
|
||||||
/** add contributions (if any) to the finite element right-hand side */
|
/** add contributions (if any) to the finite element right-hand side */
|
||||||
virtual void add_to_rhs(FIELDS & rhs);
|
virtual void add_to_rhs(FIELDS & rhs);
|
||||||
|
|
||||||
// data access, intended for method objects
|
// data access, intended for method objects
|
||||||
/** returns a pointer to the DENS_MAN associated with the tag, creates a new data member if necessary */
|
/** returns a pointer to the DENS_MAN associated with the tag, creates a new data member if necessary */
|
||||||
DENS_MAN * regulator_data(const std::string tag, int nCols);
|
DENS_MAN * regulator_data(const std::string tag, int nCols);
|
||||||
|
@ -158,7 +158,7 @@ namespace ATC {
|
||||||
/** access for number of spatial dimensions */
|
/** access for number of spatial dimensions */
|
||||||
int nsd() {return nsd_;};
|
int nsd() {return nsd_;};
|
||||||
/** access for number of local atoms */
|
/** access for number of local atoms */
|
||||||
int nlocal() {return nLocal_;};
|
int nlocal() {return nLocal_;};
|
||||||
/** access for boundary integration methods */
|
/** access for boundary integration methods */
|
||||||
BoundaryIntegrationType boundary_integration_type()
|
BoundaryIntegrationType boundary_integration_type()
|
||||||
{return boundaryIntegrationType_;};
|
{return boundaryIntegrationType_;};
|
||||||
|
@ -176,7 +176,7 @@ namespace ATC {
|
||||||
/** check to see if this direction is being used */
|
/** check to see if this direction is being used */
|
||||||
bool apply_in_direction(int i) const {return applyInDirection_[i];};
|
bool apply_in_direction(int i) const {return applyInDirection_[i];};
|
||||||
|
|
||||||
|
|
||||||
/** checks if there are any fixed nodes in the MD region */
|
/** checks if there are any fixed nodes in the MD region */
|
||||||
bool md_fixed_nodes(FieldName fieldName = NUM_TOTAL_FIELDS) const;
|
bool md_fixed_nodes(FieldName fieldName = NUM_TOTAL_FIELDS) const;
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** returns prefix tag for regulator */
|
/** returns prefix tag for regulator */
|
||||||
const std::string & regulator_prefix() const {return regulatorPrefix_;};
|
const std::string & regulator_prefix() const {return regulatorPrefix_;};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
@ -200,11 +200,11 @@ namespace ATC {
|
||||||
|
|
||||||
/** sets all data to be used */
|
/** sets all data to be used */
|
||||||
void set_all_data_to_used();
|
void set_all_data_to_used();
|
||||||
|
|
||||||
// data
|
// data
|
||||||
/** point to atc_transfer object */
|
/** point to atc_transfer object */
|
||||||
ATC_Coupling * atc_;
|
ATC_Coupling * atc_;
|
||||||
|
|
||||||
/** how often in number of time steps regulator is applied */
|
/** how often in number of time steps regulator is applied */
|
||||||
int howOften_;
|
int howOften_;
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ namespace ATC {
|
||||||
RegulatorTargetType regulatorTarget_;
|
RegulatorTargetType regulatorTarget_;
|
||||||
/** regulator fe coupling type flag */
|
/** regulator fe coupling type flag */
|
||||||
RegulatorCouplingType couplingMode_;
|
RegulatorCouplingType couplingMode_;
|
||||||
|
|
||||||
/** number of nodes */
|
/** number of nodes */
|
||||||
int nNodes_;
|
int nNodes_;
|
||||||
/** number of spatial dimensions */
|
/** number of spatial dimensions */
|
||||||
|
@ -241,7 +241,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** restrict application in certain directions */
|
/** restrict application in certain directions */
|
||||||
std::vector<bool> applyInDirection_;
|
std::vector<bool> applyInDirection_;
|
||||||
|
|
||||||
// method pointers
|
// method pointers
|
||||||
/** time filtering object */
|
/** time filtering object */
|
||||||
TimeFilter * timeFilter_;
|
TimeFilter * timeFilter_;
|
||||||
|
@ -256,30 +256,30 @@ namespace ATC {
|
||||||
const std::string regulatorPrefix_;
|
const std::string regulatorPrefix_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
AtomicRegulator();
|
AtomicRegulator();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class RegulatorMethod
|
* @class RegulatorMethod
|
||||||
* @brief Base class for implementation of control algorithms
|
* @brief Base class for implementation of control algorithms
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Class RegulatorMethod
|
// Class RegulatorMethod
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class RegulatorMethod {
|
class RegulatorMethod {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RegulatorMethod(AtomicRegulator * atomicRegulator,
|
RegulatorMethod(AtomicRegulator * atomicRegulator,
|
||||||
const std::string & regulatorPrefix = "");
|
const std::string & regulatorPrefix = "");
|
||||||
|
|
||||||
virtual ~RegulatorMethod(){};
|
virtual ~RegulatorMethod(){};
|
||||||
|
|
||||||
/** instantiate all needed data */
|
/** instantiate all needed data */
|
||||||
|
@ -294,7 +294,7 @@ namespace ATC {
|
||||||
/** set up atom to material identification */
|
/** set up atom to material identification */
|
||||||
virtual void reset_atom_materials(const Array<int> & /* elementToMaterialMap */,
|
virtual void reset_atom_materials(const Array<int> & /* elementToMaterialMap */,
|
||||||
const MatrixDependencyManager<DenseMatrix, int> * /* atomElement */){};
|
const MatrixDependencyManager<DenseMatrix, int> * /* atomElement */){};
|
||||||
|
|
||||||
/** applies regulator to atoms in the pre-predictor phase */
|
/** applies regulator to atoms in the pre-predictor phase */
|
||||||
virtual void apply_pre_predictor(double /* dt */){};
|
virtual void apply_pre_predictor(double /* dt */){};
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** pack fields for restart */
|
/** pack fields for restart */
|
||||||
virtual void pack_fields(RESTART_LIST & /* data */){};
|
virtual void pack_fields(RESTART_LIST & /* data */){};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//data
|
//data
|
||||||
|
@ -372,7 +372,7 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
RegulatorMethod();
|
RegulatorMethod();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -389,14 +389,14 @@ namespace ATC {
|
||||||
// of N^T w N lambda = rhs
|
// of N^T w N lambda = rhs
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class RegulatorShapeFunction : public RegulatorMethod {
|
class RegulatorShapeFunction : public RegulatorMethod {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RegulatorShapeFunction(AtomicRegulator * atomicRegulator,
|
RegulatorShapeFunction(AtomicRegulator * atomicRegulator,
|
||||||
const std::string & regulatorPrefix = "");
|
const std::string & regulatorPrefix = "");
|
||||||
|
|
||||||
virtual ~RegulatorShapeFunction();
|
virtual ~RegulatorShapeFunction();
|
||||||
|
|
||||||
/** instantiate all needed data */
|
/** instantiate all needed data */
|
||||||
|
@ -524,18 +524,18 @@ namespace ATC {
|
||||||
// Class LambdaMatrixSolver
|
// Class LambdaMatrixSolver
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class LambdaMatrixSolver {
|
class LambdaMatrixSolver {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LambdaMatrixSolver(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance);
|
LambdaMatrixSolver(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance);
|
||||||
|
|
||||||
virtual ~LambdaMatrixSolver(){};
|
virtual ~LambdaMatrixSolver(){};
|
||||||
|
|
||||||
/** assemble the matrix */
|
/** assemble the matrix */
|
||||||
virtual void assemble_matrix(DIAG_MAT & weights);
|
virtual void assemble_matrix(DIAG_MAT & weights);
|
||||||
|
|
||||||
/** execute the solver */
|
/** execute the solver */
|
||||||
virtual void execute(VECTOR & rhs, VECTOR & lambda)=0;
|
virtual void execute(VECTOR & rhs, VECTOR & lambda)=0;
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** matrix used to solve for lambda */
|
/** matrix used to solve for lambda */
|
||||||
SPAR_MAT lambdaMatrix_;
|
SPAR_MAT lambdaMatrix_;
|
||||||
|
|
||||||
/** maximum number of iterations */
|
/** maximum number of iterations */
|
||||||
int maxIterations_;
|
int maxIterations_;
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
LambdaMatrixSolver();
|
LambdaMatrixSolver();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -568,21 +568,21 @@ namespace ATC {
|
||||||
// Class LambdaMatrixSolverLumped
|
// Class LambdaMatrixSolverLumped
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class LambdaMatrixSolverLumped : public LambdaMatrixSolver {
|
class LambdaMatrixSolverLumped : public LambdaMatrixSolver {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LambdaMatrixSolverLumped(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance, const SetDependencyManager<int> * applicationNodes, const NodeToSubset * nodeToOverlapMap);
|
LambdaMatrixSolverLumped(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance, const SetDependencyManager<int> * applicationNodes, const NodeToSubset * nodeToOverlapMap);
|
||||||
|
|
||||||
virtual ~LambdaMatrixSolverLumped(){};
|
virtual ~LambdaMatrixSolverLumped(){};
|
||||||
|
|
||||||
/** assemble the matrix */
|
/** assemble the matrix */
|
||||||
virtual void assemble_matrix(DIAG_MAT & weights);
|
virtual void assemble_matrix(DIAG_MAT & weights);
|
||||||
|
|
||||||
/** execute the solver */
|
/** execute the solver */
|
||||||
virtual void execute(VECTOR & rhs, VECTOR & lambda);
|
virtual void execute(VECTOR & rhs, VECTOR & lambda);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** lumped version of the matrix governing lambda */
|
/** lumped version of the matrix governing lambda */
|
||||||
|
@ -598,7 +598,7 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
LambdaMatrixSolverLumped();
|
LambdaMatrixSolverLumped();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -606,18 +606,18 @@ namespace ATC {
|
||||||
// Class LambdaMatrixSolverCg
|
// Class LambdaMatrixSolverCg
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class LambdaMatrixSolverCg : public LambdaMatrixSolver {
|
class LambdaMatrixSolverCg : public LambdaMatrixSolver {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LambdaMatrixSolverCg(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance);
|
LambdaMatrixSolverCg(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance);
|
||||||
|
|
||||||
virtual ~LambdaMatrixSolverCg(){};
|
virtual ~LambdaMatrixSolverCg(){};
|
||||||
|
|
||||||
/** execute the solver */
|
/** execute the solver */
|
||||||
virtual void execute(VECTOR & rhs, VECTOR & lambda);
|
virtual void execute(VECTOR & rhs, VECTOR & lambda);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
LambdaMatrixSolverCg();
|
LambdaMatrixSolverCg();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,14 +16,14 @@ using std::vector;
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
BodyForceViscous::BodyForceViscous(
|
BodyForceViscous::BodyForceViscous(
|
||||||
fstream &fileId, std::map<std::string,double> & parameters)
|
fstream &fileId, std::map<std::string,double> & parameters)
|
||||||
: BodyForce(), gamma_(0)
|
: BodyForce(), gamma_(0)
|
||||||
{
|
{
|
||||||
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
||||||
std::vector<std::string> line;
|
std::vector<std::string> line;
|
||||||
while(fileId.good()) {
|
while(fileId.good()) {
|
||||||
command_line(fileId, line);
|
command_line(fileId, line);
|
||||||
if (line.size() == 0) continue;
|
if (line.size() == 0) continue;
|
||||||
if (line[0] == "end") return;
|
if (line[0] == "end") return;
|
||||||
double value = str2dbl(line[1]);
|
double value = str2dbl(line[1]);
|
||||||
if (line[0] == "gamma") {
|
if (line[0] == "gamma") {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class BodyForce
|
* @class BodyForce
|
||||||
* @brief Base class for models of body forces in the momentum eqn
|
* @brief Base class for models of body forces in the momentum eqn
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace ATC {
|
||||||
BodyForceViscous(std::fstream &matfile,std::map<std::string,double> & parameters);
|
BodyForceViscous(std::fstream &matfile,std::map<std::string,double> & parameters);
|
||||||
virtual ~BodyForceViscous() {};
|
virtual ~BodyForceViscous() {};
|
||||||
virtual bool body_force(const FIELD_MATS &fields,
|
virtual bool body_force(const FIELD_MATS &fields,
|
||||||
DENS_MAT &flux) const
|
DENS_MAT &flux) const
|
||||||
{
|
{
|
||||||
FIELD_MATS::const_iterator v_field = fields.find(VELOCITY);
|
FIELD_MATS::const_iterator v_field = fields.find(VELOCITY);
|
||||||
const DENS_MAT & v = v_field->second;
|
const DENS_MAT & v = v_field->second;
|
||||||
|
@ -49,20 +49,20 @@ namespace ATC {
|
||||||
class BodyForceElectricField : public BodyForce
|
class BodyForceElectricField : public BodyForce
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BodyForceElectricField(std::fstream & /* matfile */,std::map<std::string,double> & /* parameters */)
|
BodyForceElectricField(std::fstream & /* matfile */,std::map<std::string,double> & /* parameters */)
|
||||||
{ throw ATC_Error("unimplemented due to issues with accessing electric field"); }
|
{ throw ATC_Error("unimplemented due to issues with accessing electric field"); }
|
||||||
virtual ~BodyForceElectricField() {};
|
virtual ~BodyForceElectricField() {};
|
||||||
virtual bool body_force(const FIELD_MATS &fields,
|
virtual bool body_force(const FIELD_MATS &fields,
|
||||||
DENS_MAT &flux) const
|
DENS_MAT &flux) const
|
||||||
{
|
{
|
||||||
FIELD_MATS::const_iterator v_field = fields.find(VELOCITY);
|
FIELD_MATS::const_iterator v_field = fields.find(VELOCITY);
|
||||||
const DENS_MAT & v = v_field->second;
|
const DENS_MAT & v = v_field->second;
|
||||||
int nNodes = v.nRows();
|
int nNodes = v.nRows();
|
||||||
flux.reset(nNodes,1);
|
flux.reset(nNodes,1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace ATC {
|
||||||
std::vector<DENS_VEC>::iterator R(ref_coords_.begin()), Rp;
|
std::vector<DENS_VEC>::iterator R(ref_coords_.begin()), Rp;
|
||||||
const double TOL = 1.0e-6 * R->dot(*R);
|
const double TOL = 1.0e-6 * R->dot(*R);
|
||||||
|
|
||||||
for (; R!=ref_coords_.end(); R++, r++) {
|
for (; R!=ref_coords_.end(); R++, r++) {
|
||||||
for (Rp=R+1; Rp!=ref_coords_.end(); Rp++) {
|
for (Rp=R+1; Rp!=ref_coords_.end(); Rp++) {
|
||||||
if (sum_difference_squared(*Rp, *R) < TOL) {
|
if (sum_difference_squared(*Rp, *R) < TOL) {
|
||||||
ref_coords_.erase(R--);
|
ref_coords_.erase(R--);
|
||||||
|
@ -59,13 +59,13 @@ namespace ATC {
|
||||||
fid << ((i+1)%3==0 ? "\n" : " ");
|
fid << ((i+1)%3==0 ? "\n" : " ");
|
||||||
}
|
}
|
||||||
fid << "\nCELLS "<<npts<<" "<<2*npts<<"\n";
|
fid << "\nCELLS "<<npts<<" "<<2*npts<<"\n";
|
||||||
for (int i=0; i<npts; i++) fid << "1" << " " << i << "\n";
|
for (int i=0; i<npts; i++) fid << "1" << " " << i << "\n";
|
||||||
|
|
||||||
fid << "CELL_TYPES " << npts << "\n";
|
fid << "CELL_TYPES " << npts << "\n";
|
||||||
for (int i=0; i<npts; i++) fid << "1" << "\n";
|
for (int i=0; i<npts; i++) fid << "1" << "\n";
|
||||||
}
|
}
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// constructor
|
// constructor
|
||||||
// @param N 3x3 DenseMatrix with each column as a base vector
|
// @param N 3x3 DenseMatrix with each column as a base vector
|
||||||
// @param B 3xn DenseMatrix with each column being a basis vector
|
// @param B 3xn DenseMatrix with each column being a basis vector
|
||||||
// @param R vector of 3D bond Vectors to representative atom in ref config
|
// @param R vector of 3D bond Vectors to representative atom in ref config
|
||||||
|
@ -79,7 +79,7 @@ namespace ATC {
|
||||||
for (int a=-1; a<2; a++)
|
for (int a=-1; a<2; a++)
|
||||||
for (int b=-1; b<2; b++)
|
for (int b=-1; b<2; b++)
|
||||||
for (int c=-1; c<2; c++)
|
for (int c=-1; c<2; c++)
|
||||||
if ( a!=0 || b!=0 || c!=0) queue0_.push(hash(a,b,c));
|
if ( a!=0 || b!=0 || c!=0) queue0_.push(hash(a,b,c));
|
||||||
}
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// writes out default lattice parameters
|
// writes out default lattice parameters
|
||||||
|
@ -111,7 +111,7 @@ namespace ATC {
|
||||||
_FindAtomsInCutoff(v);
|
_FindAtomsInCutoff(v);
|
||||||
}
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Computes forces on central atom, with atom I displaced by u.
|
// Computes forces on central atom, with atom I displaced by u.
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
DENS_VEC AtomCluster::perturbed_force(const CbPotential *p, int I, DENS_VEC *u) const
|
DENS_VEC AtomCluster::perturbed_force(const CbPotential *p, int I, DENS_VEC *u) const
|
||||||
{
|
{
|
||||||
|
@ -167,19 +167,19 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Computes \f$r^2 = \Vert a n_1 + b n_2 +c n_3 + b_d \Vert^2 \f$
|
// Computes \f$r^2 = \Vert a n_1 + b n_2 +c n_3 + b_d \Vert^2 \f$
|
||||||
// and adds atom (a,b,c,d) if \f$r^2 < r_{cutoff}^2 \f$
|
// and adds atom (a,b,c,d) if \f$r^2 < r_{cutoff}^2 \f$
|
||||||
// @param a cell x-index
|
// @param a cell x-index
|
||||||
// @param b cell y-index
|
// @param b cell y-index
|
||||||
// @param c cell z-index
|
// @param c cell z-index
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
bool CBLattice::_CheckUnitCell(char a, char b, char c, AtomCluster &v)
|
bool CBLattice::_CheckUnitCell(char a, char b, char c, AtomCluster &v)
|
||||||
{
|
{
|
||||||
const int nsd = n_.nRows(); // number of spatial dimensions
|
const int nsd = n_.nRows(); // number of spatial dimensions
|
||||||
const double A=double(a), B=double(b), C=double(c);
|
const double A=double(a), B=double(b), C=double(c);
|
||||||
bool found=false;
|
bool found=false;
|
||||||
DENS_VEC r0(nsd,false), R0(nsd,false), Rd(nsd,false); // don't initialize
|
DENS_VEC r0(nsd,false), R0(nsd,false), Rd(nsd,false); // don't initialize
|
||||||
|
|
||||||
for (int i=0; i<nsd; i++) { // precompute locations of cell
|
for (int i=0; i<nsd; i++) { // precompute locations of cell
|
||||||
R0(i) = A*N_(0,i) + B*N_(1,i) + C*N_(2,i); // reference
|
R0(i) = A*N_(0,i) + B*N_(1,i) + C*N_(2,i); // reference
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace ATC
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class AtomCluster
|
* @class AtomCluster
|
||||||
* @brief Base class for a container for a cluster of atoms around an atom at the origin
|
* @brief Base class for a container for a cluster of atoms around an atom at the origin
|
||||||
* (which is not included in the lists).
|
* (which is not included in the lists).
|
||||||
* Provides routines for outputting the atoms in the cluster to a vtk file,
|
* Provides routines for outputting the atoms in the cluster to a vtk file,
|
||||||
* and checking for any overlapping atoms (which should not happen).
|
* and checking for any overlapping atoms (which should not happen).
|
||||||
|
@ -23,7 +23,7 @@ namespace ATC
|
||||||
class AtomCluster
|
class AtomCluster
|
||||||
{
|
{
|
||||||
friend class CBLattice;
|
friend class CBLattice;
|
||||||
friend DENS_MAT_VEC compute_dynamical_derivative(StressArgs &args);
|
friend DENS_MAT_VEC compute_dynamical_derivative(StressArgs &args);
|
||||||
friend int test_FCB(const StressArgs &args);
|
friend int test_FCB(const StressArgs &args);
|
||||||
public:
|
public:
|
||||||
//* Returns the number of atoms in the cluster.
|
//* Returns the number of atoms in the cluster.
|
||||||
|
@ -46,25 +46,25 @@ namespace ATC
|
||||||
double bond_length(INDEX i) const { return cur_bond_len_[i]; }
|
double bond_length(INDEX i) const { return cur_bond_len_[i]; }
|
||||||
//* Returns a reference to the deformation gradient tensor.
|
//* Returns a reference to the deformation gradient tensor.
|
||||||
const DENS_MAT& deformation_gradient() const { return F_; }
|
const DENS_MAT& deformation_gradient() const { return F_; }
|
||||||
|
|
||||||
//* Computes forces on central atom, with atom I displaced by u.
|
//* Computes forces on central atom, with atom I displaced by u.
|
||||||
DENS_VEC perturbed_force(const CbPotential *p, int I, DENS_VEC *u) const;
|
DENS_VEC perturbed_force(const CbPotential *p, int I, DENS_VEC *u) const;
|
||||||
//* Computes the force constant matrix between atoms I and 0.
|
//* Computes the force constant matrix between atoms I and 0.
|
||||||
DENS_MAT force_constants(INDEX I, const CbPotential *p) const;
|
DENS_MAT force_constants(INDEX I, const CbPotential *p) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<double> cur_bond_len_; //*> Bond lengths (current)
|
std::vector<double> cur_bond_len_; //*> Bond lengths (current)
|
||||||
std::vector<DENS_VEC> ref_coords_; //*> Atom coordinates (ref)
|
std::vector<DENS_VEC> ref_coords_; //*> Atom coordinates (ref)
|
||||||
DENS_MAT F_; //*> Deformation gradient
|
DENS_MAT F_; //*> Deformation gradient
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CBLattice
|
* @class CBLattice
|
||||||
* @brief Base class that generates a virtual atom clusters given a lattice and
|
* @brief Base class that generates a virtual atom clusters given a lattice and
|
||||||
* a deformation gradient.
|
* a deformation gradient.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CBLattice
|
class CBLattice
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -76,7 +76,7 @@ namespace ATC
|
||||||
public:
|
public:
|
||||||
//* Operator that outputs the lattice and basis to a stream.
|
//* Operator that outputs the lattice and basis to a stream.
|
||||||
friend std::ostream& operator<<(std::ostream& o, const CBLattice& lattice);
|
friend std::ostream& operator<<(std::ostream& o, const CBLattice& lattice);
|
||||||
CBLattice(const MATRIX &N, const MATRIX &B);
|
CBLattice(const MATRIX &N, const MATRIX &B);
|
||||||
//* generates the virtual atom cluster
|
//* generates the virtual atom cluster
|
||||||
void atom_cluster(const MATRIX &F, double cutoff, AtomCluster &v);
|
void atom_cluster(const MATRIX &F, double cutoff, AtomCluster &v);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace ATC
|
||||||
};
|
};
|
||||||
// hash functions: a, b, c must in range [-128, 127]
|
// hash functions: a, b, c must in range [-128, 127]
|
||||||
inline int hash(int a,int b,int c) {return(a+128)|((b+128)<<8)|((c+128)<<16);}
|
inline int hash(int a,int b,int c) {return(a+128)|((b+128)<<8)|((c+128)<<16);}
|
||||||
inline void unhash(int r, int &a, int &b, int &c)
|
inline void unhash(int r, int &a, int &b, int &c)
|
||||||
{
|
{
|
||||||
a = (r&0xFF) - 128;
|
a = (r&0xFF) - 128;
|
||||||
b = ((r>>8)&0xFF) - 128;
|
b = ((r>>8)&0xFF) - 128;
|
||||||
|
|
26
lib/atc/CG.h
26
lib/atc/CG.h
|
@ -4,28 +4,28 @@
|
||||||
// CG solves the symmetric positive definite linear
|
// CG solves the symmetric positive definite linear
|
||||||
// system Ax=b using the Conjugate Gradient method.
|
// system Ax=b using the Conjugate Gradient method.
|
||||||
//
|
//
|
||||||
// CG follows the algorithm described on p. 15 in the
|
// CG follows the algorithm described on p. 15 in the
|
||||||
// SIAM Templates book.
|
// SIAM Templates book.
|
||||||
//
|
//
|
||||||
// The return value indicates convergence within max_iter (input)
|
// The return value indicates convergence within max_iter (input)
|
||||||
// iterations (0), or no convergence within max_iter iterations (1).
|
// iterations (0), or no convergence within max_iter iterations (1).
|
||||||
//
|
//
|
||||||
// Upon successful return, output arguments have the following values:
|
// Upon successful return, output arguments have the following values:
|
||||||
//
|
//
|
||||||
// x -- approximate solution to Ax = b
|
// x -- approximate solution to Ax = b
|
||||||
// max_iter -- the number of iterations performed before the
|
// max_iter -- the number of iterations performed before the
|
||||||
// tolerance was reached
|
// tolerance was reached
|
||||||
// tol -- the residual after the final iteration
|
// tol -- the residual after the final iteration
|
||||||
//
|
//
|
||||||
//*****************************************************************
|
//*****************************************************************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CG
|
* @class CG
|
||||||
* @brief Base class for solving the linear system Ax=b using the Conjugate Gradient method
|
* @brief Base class for solving the linear system Ax=b using the Conjugate Gradient method
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template < class Matrix, class Vector, class DataVector, class Preconditioner, class Real >
|
template < class Matrix, class Vector, class DataVector, class Preconditioner, class Real >
|
||||||
int
|
int
|
||||||
CG(const Matrix &A, Vector &x, const DataVector &b, const Preconditioner &M, int &max_iter, Real &tol) {
|
CG(const Matrix &A, Vector &x, const DataVector &b, const Preconditioner &M, int &max_iter, Real &tol) {
|
||||||
Real resid;
|
Real resid;
|
||||||
DenseVector<Real> p, z, q;
|
DenseVector<Real> p, z, q;
|
||||||
|
@ -44,9 +44,9 @@ CG(const Matrix &A, Vector &x, const DataVector &b, const Preconditioner &M, int
|
||||||
// Implicit assumption that only diagonal matrices are being used for preconditioning
|
// Implicit assumption that only diagonal matrices are being used for preconditioning
|
||||||
Preconditioner Minv = M.inv();
|
Preconditioner Minv = M.inv();
|
||||||
|
|
||||||
if (normb == 0.0)
|
if (normb == 0.0)
|
||||||
normb = 1;
|
normb = 1;
|
||||||
|
|
||||||
if ((resid = r.norm() / normb) <= tol) {
|
if ((resid = r.norm() / normb) <= tol) {
|
||||||
tol = resid;
|
tol = resid;
|
||||||
max_iter = 0;
|
max_iter = 0;
|
||||||
|
@ -56,7 +56,7 @@ CG(const Matrix &A, Vector &x, const DataVector &b, const Preconditioner &M, int
|
||||||
for (int i = 0; i < max_iter; i++) {
|
for (int i = 0; i < max_iter; i++) {
|
||||||
z = Minv*r;
|
z = Minv*r;
|
||||||
rho = r.dot(z);
|
rho = r.dot(z);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
p = z;
|
p = z;
|
||||||
else {
|
else {
|
||||||
|
@ -64,18 +64,18 @@ CG(const Matrix &A, Vector &x, const DataVector &b, const Preconditioner &M, int
|
||||||
tmp = p*beta;
|
tmp = p*beta;
|
||||||
p = z + tmp;
|
p = z + tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
q = A*p;
|
q = A*p;
|
||||||
alpha = rho / p.dot(q);
|
alpha = rho / p.dot(q);
|
||||||
|
|
||||||
x += p*alpha;
|
x += p*alpha;
|
||||||
r -= q*alpha;
|
r -= q*alpha;
|
||||||
|
|
||||||
if ((resid = r.norm() / normb) <= tol)
|
if ((resid = r.norm() / normb) <= tol)
|
||||||
{
|
{
|
||||||
tol = resid;
|
tol = resid;
|
||||||
max_iter = i+1;
|
max_iter = i+1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rho_1 = rho;
|
rho_1 = rho;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ATC {
|
||||||
DENS_MAT L0;
|
DENS_MAT L0;
|
||||||
DENS_MAT_VEC M0;
|
DENS_MAT_VEC M0;
|
||||||
|
|
||||||
// If temperature is nonzero then allocate space for
|
// If temperature is nonzero then allocate space for
|
||||||
// dynamical matrix and its derivative with respect to F.
|
// dynamical matrix and its derivative with respect to F.
|
||||||
if (finite_temp) {
|
if (finite_temp) {
|
||||||
D.reset(3,3);
|
D.reset(3,3);
|
||||||
|
@ -42,11 +42,11 @@ namespace ATC {
|
||||||
l0.reset(3);
|
l0.reset(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (F) *F = 0.0;
|
if (F) *F = 0.0;
|
||||||
|
|
||||||
// if using EAM potential, calculate embedding function and derivatives
|
// if using EAM potential, calculate embedding function and derivatives
|
||||||
if (args.potential->terms.embedding) {
|
if (args.potential->terms.embedding) {
|
||||||
|
|
||||||
for (INDEX a=0; a<args.vac.size(); a++) {
|
for (INDEX a=0; a<args.vac.size(); a++) {
|
||||||
PairParam pair(args.vac.R(a), args.vac.bond_length(a));
|
PairParam pair(args.vac.R(a), args.vac.bond_length(a));
|
||||||
e_density += args.potential->rho(pair.d);
|
e_density += args.potential->rho(pair.d);
|
||||||
|
@ -58,7 +58,7 @@ namespace ATC {
|
||||||
DENS_MAT rR = tensor_product(pair.r, pair.R);
|
DENS_MAT rR = tensor_product(pair.r, pair.R);
|
||||||
L0.add_scaled(rR, pair.di*pair.rho_r);
|
L0.add_scaled(rR, pair.di*pair.rho_r);
|
||||||
DENS_MAT rr = tensor_product(pair.r, pair.r);
|
DENS_MAT rr = tensor_product(pair.r, pair.r);
|
||||||
rr *= pair.di*pair.di*(pair.rho_rr - pair.di*pair.rho_r);
|
rr *= pair.di*pair.di*(pair.rho_rr - pair.di*pair.rho_r);
|
||||||
diagonal(rr) += pair.di*pair.rho_r;
|
diagonal(rr) += pair.di*pair.rho_r;
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int k = 0; k < 3; k++) {
|
for (int k = 0; k < 3; k++) {
|
||||||
|
@ -96,7 +96,7 @@ namespace ATC {
|
||||||
// Loop on all cluster atoms (origin atom not included).
|
// Loop on all cluster atoms (origin atom not included).
|
||||||
for (INDEX a=0; a<args.vac.size(); a++) {
|
for (INDEX a=0; a<args.vac.size(); a++) {
|
||||||
PairParam pair(args.vac.R(a), args.vac.bond_length(a));
|
PairParam pair(args.vac.R(a), args.vac.bond_length(a));
|
||||||
if (args.potential->terms.pairwise) {
|
if (args.potential->terms.pairwise) {
|
||||||
if (F) *F += 0.5*args.potential->phi(pair.d);
|
if (F) *F += 0.5*args.potential->phi(pair.d);
|
||||||
pair.phi_r = args.potential->phi_r(pair.d);
|
pair.phi_r = args.potential->phi_r(pair.d);
|
||||||
pairwise_stress(pair, s);
|
pairwise_stress(pair, s);
|
||||||
|
@ -104,7 +104,7 @@ namespace ATC {
|
||||||
if (args.potential->terms.embedding) {
|
if (args.potential->terms.embedding) {
|
||||||
pair.F_p = embed_p;
|
pair.F_p = embed_p;
|
||||||
pair.rho_r = args.potential->rho_r(pair.d);
|
pair.rho_r = args.potential->rho_r(pair.d);
|
||||||
embedding_stress(pair, s);
|
embedding_stress(pair, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finite_temp) { // Compute finite T terms.
|
if (finite_temp) { // Compute finite T terms.
|
||||||
|
@ -177,7 +177,7 @@ namespace ATC {
|
||||||
|
|
||||||
for (INDEX a=0; a<args.vac.size(); a++) {
|
for (INDEX a=0; a<args.vac.size(); a++) {
|
||||||
PairParam pair(args.vac.R(a), args.vac.bond_length(a));
|
PairParam pair(args.vac.R(a), args.vac.bond_length(a));
|
||||||
if (args.potential->terms.pairwise) {
|
if (args.potential->terms.pairwise) {
|
||||||
F += 0.5*args.potential->phi(pair.d);
|
F += 0.5*args.potential->phi(pair.d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,11 +185,11 @@ namespace ATC {
|
||||||
pair.r = args.vac.r(a);
|
pair.r = args.vac.r(a);
|
||||||
if (args.potential->terms.pairwise) {
|
if (args.potential->terms.pairwise) {
|
||||||
pair.phi_r = args.potential->phi_r(pair.d);
|
pair.phi_r = args.potential->phi_r(pair.d);
|
||||||
pair.phi_rr = args.potential->phi_rr(pair.d);
|
pair.phi_rr = args.potential->phi_rr(pair.d);
|
||||||
pair.phi_rrr = args.potential->phi_rrr(pair.d);
|
pair.phi_rrr = args.potential->phi_rrr(pair.d);
|
||||||
pairwise_thermal(pair, D);
|
pairwise_thermal(pair, D);
|
||||||
}
|
}
|
||||||
if (args.potential->terms.embedding) {
|
if (args.potential->terms.embedding) {
|
||||||
pair.rho_r = args.potential->rho_r(pair.d);
|
pair.rho_r = args.potential->rho_r(pair.d);
|
||||||
pair.rho_rr = args.potential->rho_rr(pair.d);
|
pair.rho_rr = args.potential->rho_rr(pair.d);
|
||||||
pair.rho_rrr = args.potential->rho_rrr(pair.d);
|
pair.rho_rrr = args.potential->rho_rrr(pair.d);
|
||||||
|
@ -200,7 +200,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if has three-body terms ... TODO compute three-body terms
|
// if has three-body terms ... TODO compute three-body terms
|
||||||
}
|
}
|
||||||
// Finish finite temperature Cauchy-Born.
|
// Finish finite temperature Cauchy-Born.
|
||||||
const double kB = args.boltzmann_constant;
|
const double kB = args.boltzmann_constant;
|
||||||
const double hbar = args.planck_constant;
|
const double hbar = args.planck_constant;
|
||||||
|
@ -209,7 +209,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
//if (finite_temp) F += 0.5*args.boltzmann_constant*T*log(det(D));
|
//if (finite_temp) F += 0.5*args.boltzmann_constant*T*log(det(D));
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Computes the entropic energy TS (minus c_v T)
|
// Computes the entropic energy TS (minus c_v T)
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -268,7 +268,7 @@ namespace ATC {
|
||||||
const double hbar = args.planck_constant;;
|
const double hbar = args.planck_constant;;
|
||||||
double F = kB*T*log(pow(hbar/(kB*T),3.0)*sqrt(det(D)));
|
double F = kB*T*log(pow(hbar/(kB*T),3.0)*sqrt(det(D)));
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Computes the stress contribution given the pairwise parameters.
|
// Computes the stress contribution given the pairwise parameters.
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -295,26 +295,26 @@ namespace ATC {
|
||||||
void pairwise_thermal(const PairParam &p, DENS_MAT &D, DENS_MAT_VEC *dDdF)
|
void pairwise_thermal(const PairParam &p, DENS_MAT &D, DENS_MAT_VEC *dDdF)
|
||||||
{
|
{
|
||||||
const double di2 = p.di*p.di;
|
const double di2 = p.di*p.di;
|
||||||
const double g = p.di*p.phi_r;
|
const double g = p.di*p.phi_r;
|
||||||
const double g_d = p.di*p.phi_rr - p.di*g; // units (energy / length^3)
|
const double g_d = p.di*p.phi_rr - p.di*g; // units (energy / length^3)
|
||||||
const double f = di2 * (p.phi_rr - g); // units (energy / length^4)
|
const double f = di2 * (p.phi_rr - g); // units (energy / length^4)
|
||||||
const double f_d = di2*(p.phi_rrr-g_d) - 2.0*p.di*f;
|
const double f_d = di2*(p.phi_rrr-g_d) - 2.0*p.di*f;
|
||||||
|
|
||||||
// compute needed tensor products of r and R
|
// compute needed tensor products of r and R
|
||||||
const DENS_MAT rr = tensor_product(p.r, p.r);
|
const DENS_MAT rr = tensor_product(p.r, p.r);
|
||||||
|
|
||||||
// compute the dynamical matrix
|
// compute the dynamical matrix
|
||||||
D.add_scaled(rr, f);
|
D.add_scaled(rr, f);
|
||||||
diagonal(D) += g;
|
diagonal(D) += g;
|
||||||
|
|
||||||
if (!dDdF) return; // skip derivative
|
if (!dDdF) return; // skip derivative
|
||||||
const double gp_r = g_d*p.di;
|
const double gp_r = g_d*p.di;
|
||||||
const double fp_r = f_d*p.di;
|
const double fp_r = f_d*p.di;
|
||||||
const double fr[] = {f*p.r(0), f*p.r(1), f*p.r(2)};
|
const double fr[] = {f*p.r(0), f*p.r(1), f*p.r(2)};
|
||||||
const DENS_MAT rR = tensor_product(p.r, p.R);
|
const DENS_MAT rR = tensor_product(p.r, p.R);
|
||||||
|
|
||||||
DENS_MAT_VEC &dD = *dDdF;
|
DENS_MAT_VEC &dD = *dDdF;
|
||||||
|
|
||||||
// compute first term in A.13
|
// compute first term in A.13
|
||||||
dD[0].add_scaled(rR, fp_r*rr(0,0) + gp_r);
|
dD[0].add_scaled(rR, fp_r*rr(0,0) + gp_r);
|
||||||
dD[1].add_scaled(rR, fp_r*rr(1,1) + gp_r);
|
dD[1].add_scaled(rR, fp_r*rr(1,1) + gp_r);
|
||||||
|
@ -349,13 +349,13 @@ namespace ATC {
|
||||||
const double z = di*(2*p.F_p*p.rho_r);
|
const double z = di*(2*p.F_p*p.rho_r);
|
||||||
const double y = di2*(x-z);
|
const double y = di2*(x-z);
|
||||||
|
|
||||||
// compute needed tensor products of r and R
|
// compute needed tensor products of r and R
|
||||||
const DENS_MAT rr = tensor_product(p.r, p.r);
|
const DENS_MAT rr = tensor_product(p.r, p.r);
|
||||||
|
|
||||||
// compute the dynamical matrix
|
// compute the dynamical matrix
|
||||||
D.add_scaled(rr, y);
|
D.add_scaled(rr, y);
|
||||||
diagonal(D) += z;
|
diagonal(D) += z;
|
||||||
|
|
||||||
if (!dDdF) return; // skip derivative
|
if (!dDdF) return; // skip derivative
|
||||||
DENS_MAT_VEC &dD = *dDdF;
|
DENS_MAT_VEC &dD = *dDdF;
|
||||||
const DENS_MAT rR = tensor_product(p.r, p.R);
|
const DENS_MAT rR = tensor_product(p.r, p.R);
|
||||||
|
@ -382,10 +382,10 @@ namespace ATC {
|
||||||
dD[3].add_scaled(L0, b*rr(1,2));
|
dD[3].add_scaled(L0, b*rr(1,2));
|
||||||
dD[4].add_scaled(L0, b*rr(0,2));
|
dD[4].add_scaled(L0, b*rr(0,2));
|
||||||
dD[5].add_scaled(L0, b*rr(0,1));
|
dD[5].add_scaled(L0, b*rr(0,1));
|
||||||
|
|
||||||
//add remaining term
|
//add remaining term
|
||||||
const double aw = a + w;
|
const double aw = a + w;
|
||||||
const double awr[] = {aw*p.r(0), aw*p.r(1), aw*p.r(2)};
|
const double awr[] = {aw*p.r(0), aw*p.r(1), aw*p.r(2)};
|
||||||
for (INDEX L=0; L<p.R.size(); L++) {
|
for (INDEX L=0; L<p.R.size(); L++) {
|
||||||
dD[0](0,L) += 2*awr[0]*p.R[L];
|
dD[0](0,L) += 2*awr[0]*p.R[L];
|
||||||
dD[1](1,L) += 2*awr[1]*p.R[L];
|
dD[1](1,L) += 2*awr[1]*p.R[L];
|
||||||
|
@ -420,8 +420,8 @@ namespace ATC {
|
||||||
|
|
||||||
const double detD = det(D);
|
const double detD = det(D);
|
||||||
const double factor = 0.5*kb*T/detD;
|
const double factor = 0.5*kb*T/detD;
|
||||||
// converts from PK1 to PK2
|
// converts from PK1 to PK2
|
||||||
dd = inv(F)*dd;
|
dd = inv(F)*dd;
|
||||||
for (INDEX i=0; i<3; i++)
|
for (INDEX i=0; i<3; i++)
|
||||||
for (INDEX j=i; j<3; j++)
|
for (INDEX j=i; j<3; j++)
|
||||||
s(i,j) += factor * dd(i,j);
|
s(i,j) += factor * dd(i,j);
|
||||||
|
@ -430,13 +430,13 @@ namespace ATC {
|
||||||
if (F_w) *F_w += 0.5*kb*T*log(detD);
|
if (F_w) *F_w += 0.5*kb*T*log(detD);
|
||||||
}
|
}
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// Returns the stretch tensor and its derivative with respect to C (R C-G).
|
// Returns the stretch tensor and its derivative with respect to C (R C-G).
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void stretch_tensor_derivative(const DENS_VEC &C, DENS_VEC &U, DENS_MAT &dU)
|
void stretch_tensor_derivative(const DENS_VEC &C, DENS_VEC &U, DENS_MAT &dU)
|
||||||
{
|
{
|
||||||
// Compute the invariants of C
|
// Compute the invariants of C
|
||||||
const DENS_VEC C2(voigt3::dsymm(C,C));
|
const DENS_VEC C2(voigt3::dsymm(C,C));
|
||||||
const double Ic = voigt3::tr(C);
|
const double Ic = voigt3::tr(C);
|
||||||
const double IIc = 0.5*(Ic*Ic - voigt3::tr(C2));
|
const double IIc = 0.5*(Ic*Ic - voigt3::tr(C2));
|
||||||
const double IIIc = voigt3::det(C);
|
const double IIIc = voigt3::det(C);
|
||||||
const DENS_VEC I = voigt3::eye(3);
|
const DENS_VEC I = voigt3::eye(3);
|
||||||
|
@ -460,16 +460,16 @@ namespace ATC {
|
||||||
dU = tensor_product(dIc*dlambda, dIc); // may not be correct
|
dU = tensor_product(dIc*dlambda, dIc); // may not be correct
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the largest eigenvalue of C
|
// Find the largest eigenvalue of C
|
||||||
const double L = Ic*(Ic*Ic - 4.5*IIc) + 13.5*IIIc;
|
const double L = Ic*(Ic*Ic - 4.5*IIc) + 13.5*IIIc;
|
||||||
DENS_VEC dL( (3.0*Ic*Ic-4.5*IIc)*dIc );
|
DENS_VEC dL( (3.0*Ic*Ic-4.5*IIc)*dIc );
|
||||||
dL.add_scaled(dIIc, -4.5*Ic);
|
dL.add_scaled(dIIc, -4.5*Ic);
|
||||||
dL.add_scaled(dIIIc, 13.5);
|
dL.add_scaled(dIIIc, 13.5);
|
||||||
const double kpow = pow(k,-1.5);
|
const double kpow = pow(k,-1.5);
|
||||||
const double dkpow = -1.5*kpow/k;
|
const double dkpow = -1.5*kpow/k;
|
||||||
const double phi = acos(L*kpow); // phi - good
|
const double phi = acos(L*kpow); // phi - good
|
||||||
|
|
||||||
// temporary factors for dphi
|
// temporary factors for dphi
|
||||||
const double d1 = -1.0/sqrt(1.0-L*L*kpow*kpow);
|
const double d1 = -1.0/sqrt(1.0-L*L*kpow*kpow);
|
||||||
const double d2 = d1*kpow;
|
const double d2 = d1*kpow;
|
||||||
|
@ -479,13 +479,13 @@ namespace ATC {
|
||||||
const double sqrt_k=sqrt(k), cos_p3i=cos((1.0/3.0)*phi);
|
const double sqrt_k=sqrt(k), cos_p3i=cos((1.0/3.0)*phi);
|
||||||
const double lam2 = (1.0/3.0)*(Ic + 2.0*sqrt_k*cos_p3i);
|
const double lam2 = (1.0/3.0)*(Ic + 2.0*sqrt_k*cos_p3i);
|
||||||
|
|
||||||
DENS_VEC dlam2 = (1.0/3.0)*dIc;
|
DENS_VEC dlam2 = (1.0/3.0)*dIc;
|
||||||
dlam2.add_scaled(dk, (1.0/3.0)*cos_p3i/sqrt_k);
|
dlam2.add_scaled(dk, (1.0/3.0)*cos_p3i/sqrt_k);
|
||||||
dlam2.add_scaled(dphi, (-2.0/9.0)*sqrt_k*sin((1.0/3.0)*phi));
|
dlam2.add_scaled(dphi, (-2.0/9.0)*sqrt_k*sin((1.0/3.0)*phi));
|
||||||
const double lambda = sqrt(lam2);
|
const double lambda = sqrt(lam2);
|
||||||
const DENS_VEC dlambda = (0.5/lambda)*dlam2;
|
const DENS_VEC dlambda = (0.5/lambda)*dlam2;
|
||||||
|
|
||||||
// Compute the invariants of U
|
// Compute the invariants of U
|
||||||
const double IIIu = sqrt(IIIc);
|
const double IIIu = sqrt(IIIc);
|
||||||
const DENS_VEC dIIIu (0.5/IIIu*dIIIc);
|
const DENS_VEC dIIIu (0.5/IIIu*dIIIc);
|
||||||
|
|
||||||
|
@ -504,20 +504,20 @@ namespace ATC {
|
||||||
dfct.add_scaled(dIIu, Iu);
|
dfct.add_scaled(dIIu, Iu);
|
||||||
dfct -= dIIIu;
|
dfct -= dIIIu;
|
||||||
dfct *= -fct*fct;
|
dfct *= -fct*fct;
|
||||||
|
|
||||||
U = voigt3::eye(3, Iu*IIIu);
|
U = voigt3::eye(3, Iu*IIIu);
|
||||||
U.add_scaled(C, Iu*Iu-IIu);
|
U.add_scaled(C, Iu*Iu-IIu);
|
||||||
U -= C2;
|
U -= C2;
|
||||||
|
|
||||||
DENS_MAT da = tensor_product(I, dIu); da *= IIIu;
|
DENS_MAT da = tensor_product(I, dIu); da *= IIIu;
|
||||||
da.add_scaled(tensor_product(I, dIIIu), Iu);
|
da.add_scaled(tensor_product(I, dIIIu), Iu);
|
||||||
da += tensor_product(C, 2.0*Iu*dIu-dIIu);
|
da += tensor_product(C, 2.0*Iu*dIu-dIIu);
|
||||||
da.add_scaled(eye<double>(6,6),Iu*Iu-IIu);
|
da.add_scaled(eye<double>(6,6),Iu*Iu-IIu);
|
||||||
da -= voigt3::derivative_of_square(C);
|
da -= voigt3::derivative_of_square(C);
|
||||||
|
|
||||||
dU = tensor_product(U, dfct);
|
dU = tensor_product(U, dfct);
|
||||||
dU.add_scaled(da, fct);
|
dU.add_scaled(da, fct);
|
||||||
U *= fct;
|
U *= fct;
|
||||||
}
|
}
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// Computes the dynamical matrix (TESTING FUNCTION)
|
// Computes the dynamical matrix (TESTING FUNCTION)
|
||||||
|
@ -526,11 +526,11 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
DENS_MAT D(3,3);
|
DENS_MAT D(3,3);
|
||||||
for (INDEX a=0; a<args.vac.size(); a++) {
|
for (INDEX a=0; a<args.vac.size(); a++) {
|
||||||
PairParam pair(args.vac.R(a), args.vac.r(a).norm());
|
PairParam pair(args.vac.R(a), args.vac.r(a).norm());
|
||||||
pair.phi_r = args.potential->phi_r(pair.d);
|
pair.phi_r = args.potential->phi_r(pair.d);
|
||||||
pair.r = args.vac.r(a);
|
pair.r = args.vac.r(a);
|
||||||
pair.phi_rr = args.potential->phi_rr(pair.d);
|
pair.phi_rr = args.potential->phi_rr(pair.d);
|
||||||
pair.phi_rrr = args.potential->phi_rrr(pair.d);
|
pair.phi_rrr = args.potential->phi_rrr(pair.d);
|
||||||
pairwise_thermal(pair, D);
|
pairwise_thermal(pair, D);
|
||||||
}
|
}
|
||||||
return D;
|
return D;
|
||||||
|
@ -558,7 +558,7 @@ namespace ATC {
|
||||||
args.vac.F_(i,j) = Fij - EPS;
|
args.vac.F_(i,j) = Fij - EPS;
|
||||||
DENS_MAT Db = compute_dynamical_matrix(args);
|
DENS_MAT Db = compute_dynamical_matrix(args);
|
||||||
args.vac.F_(i,j) = Fij;
|
args.vac.F_(i,j) = Fij;
|
||||||
|
|
||||||
dDdF[0](i,j) = (Da(0,0)-Db(0,0))*(0.5/EPS);
|
dDdF[0](i,j) = (Da(0,0)-Db(0,0))*(0.5/EPS);
|
||||||
dDdF[1](i,j) = (Da(1,1)-Db(1,1))*(0.5/EPS);
|
dDdF[1](i,j) = (Da(1,1)-Db(1,1))*(0.5/EPS);
|
||||||
dDdF[2](i,j) = (Da(2,2)-Db(2,2))*(0.5/EPS);
|
dDdF[2](i,j) = (Da(2,2)-Db(2,2))*(0.5/EPS);
|
||||||
|
|
|
@ -13,9 +13,9 @@ namespace ATC {
|
||||||
class AtomCluster;
|
class AtomCluster;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class StressAtIP
|
* @class StressAtIP
|
||||||
* @brief Class for passing the vector of stresses at quadrature points
|
* @brief Class for passing the vector of stresses at quadrature points
|
||||||
* Done by storing the quadrature point and providing indexing
|
* Done by storing the quadrature point and providing indexing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class StressAtIP {
|
class StressAtIP {
|
||||||
|
@ -30,7 +30,7 @@ namespace ATC {
|
||||||
void set_quadrature_point(INDEX qp) { q = qp; }
|
void set_quadrature_point(INDEX qp) { q = qp; }
|
||||||
//* Operator that outputs the stress
|
//* Operator that outputs the stress
|
||||||
friend std::ostream& operator<<(std::ostream& o, const StressAtIP& s)
|
friend std::ostream& operator<<(std::ostream& o, const StressAtIP& s)
|
||||||
{ o << "stress\n";
|
{ o << "stress\n";
|
||||||
o << s(0,0) << " " << s(0,1) << " " << s(0,2) << "\n";
|
o << s(0,0) << " " << s(0,1) << " " << s(0,2) << "\n";
|
||||||
o << s(1,0) << " " << s(1,1) << " " << s(1,2) << "\n";
|
o << s(1,0) << " " << s(1,1) << " " << s(1,2) << "\n";
|
||||||
o << s(2,0) << " " << s(2,1) << " " << s(2,2) << "\n";
|
o << s(2,0) << " " << s(2,1) << " " << s(2,2) << "\n";
|
||||||
|
@ -56,7 +56,7 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class PairParam
|
* @class PairParam
|
||||||
* @brief Class for storing parameters used in pairwise stress computations
|
* @brief Class for storing parameters used in pairwise stress computations
|
||||||
*/
|
*/
|
||||||
struct PairParam {
|
struct PairParam {
|
||||||
|
@ -82,7 +82,7 @@ namespace ATC {
|
||||||
void cb_stress(const StressArgs &args, StressAtIP &s, double *F=0);
|
void cb_stress(const StressArgs &args, StressAtIP &s, double *F=0);
|
||||||
//* Computes the elastic energy (free or potential if T=0).
|
//* Computes the elastic energy (free or potential if T=0).
|
||||||
double cb_energy(const StressArgs &args);
|
double cb_energy(const StressArgs &args);
|
||||||
//* Computes the entropic energy
|
//* Computes the entropic energy
|
||||||
double cb_entropic_energy(const StressArgs &args);
|
double cb_entropic_energy(const StressArgs &args);
|
||||||
//* Auxiliary functions for cb_stress
|
//* Auxiliary functions for cb_stress
|
||||||
//@{
|
//@{
|
||||||
|
@ -96,8 +96,8 @@ namespace ATC {
|
||||||
void embedding_thermal(const PairParam &p, DENS_MAT &D, DENS_MAT &L0, DENS_MAT_VEC *dDdF=0);
|
void embedding_thermal(const PairParam &p, DENS_MAT &D, DENS_MAT &L0, DENS_MAT_VEC *dDdF=0);
|
||||||
//* Last stage of the pairwise finite-T Cauchy-Born stress computation.
|
//* Last stage of the pairwise finite-T Cauchy-Born stress computation.
|
||||||
void thermal_end(const DENS_MAT_VEC &DF, const DENS_MAT &D, const DENS_MAT &F,
|
void thermal_end(const DENS_MAT_VEC &DF, const DENS_MAT &D, const DENS_MAT &F,
|
||||||
const double &T, const double &kb, StressAtIP &s, double *F_w=0);
|
const double &T, const double &kb, StressAtIP &s, double *F_w=0);
|
||||||
//* Returns the stretch tensor and its derivative with respect to C (R C-G).
|
//* Returns the stretch tensor and its derivative with respect to C (R C-G).
|
||||||
void stretch_tensor_derivative(const DENS_VEC &C, DENS_VEC &U, DENS_MAT &dU);
|
void stretch_tensor_derivative(const DENS_VEC &C, DENS_VEC &U, DENS_MAT &dU);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
@ -11,75 +11,75 @@ namespace ATC
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CbEam
|
* @class CbEam
|
||||||
* @brief Class for computing Cauchy-Born quantities for an Embeded-Atom Method material
|
* @brief Class for computing Cauchy-Born quantities for an Embeded-Atom Method material
|
||||||
* (A factor of one-half is already included to split the
|
* (A factor of one-half is already included to split the
|
||||||
* bond energy between atoms)
|
* bond energy between atoms)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CbEam : public CbPotential
|
class CbEam : public CbPotential
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CbEam(void) : CbPotential(Interactions(PAIRWISE,EAM)) {
|
CbEam(void) : CbPotential(Interactions(PAIRWISE,EAM)) {
|
||||||
// get pointer to lammps' pair_eam object
|
// get pointer to lammps' pair_eam object
|
||||||
lammps_eam = ATC::LammpsInterface::instance()->pair_eam();
|
lammps_eam = ATC::LammpsInterface::instance()->pair_eam();
|
||||||
nrho = &lammps_eam->nrho;
|
nrho = &lammps_eam->nrho;
|
||||||
nr = &lammps_eam->nr;
|
nr = &lammps_eam->nr;
|
||||||
nfrho = &lammps_eam->nfrho;
|
nfrho = &lammps_eam->nfrho;
|
||||||
nrhor = &lammps_eam->nrhor;
|
nrhor = &lammps_eam->nrhor;
|
||||||
nz2r = &lammps_eam->nz2r;
|
nz2r = &lammps_eam->nz2r;
|
||||||
type2frho = lammps_eam->type2frho;
|
type2frho = lammps_eam->type2frho;
|
||||||
type2rhor = lammps_eam->type2rhor;
|
type2rhor = lammps_eam->type2rhor;
|
||||||
type2z2r = lammps_eam->type2z2r;
|
type2z2r = lammps_eam->type2z2r;
|
||||||
dr = &lammps_eam->dr;
|
dr = &lammps_eam->dr;
|
||||||
rdr = &lammps_eam->rdr;
|
rdr = &lammps_eam->rdr;
|
||||||
drho = &lammps_eam->drho;
|
drho = &lammps_eam->drho;
|
||||||
rdrho = &lammps_eam->rdrho;
|
rdrho = &lammps_eam->rdrho;
|
||||||
rhor_spline = &lammps_eam->rhor_spline;
|
rhor_spline = &lammps_eam->rhor_spline;
|
||||||
frho_spline = &lammps_eam->frho_spline;
|
frho_spline = &lammps_eam->frho_spline;
|
||||||
z2r_spline = &lammps_eam->z2r_spline;
|
z2r_spline = &lammps_eam->z2r_spline;
|
||||||
cutmax = &lammps_eam->cutmax;
|
cutmax = &lammps_eam->cutmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the cutoff readius of the EAM potential functions rho and z2r.
|
//! Returns the cutoff readius of the EAM potential functions rho and z2r.
|
||||||
double cutoff_radius() const { return *cutmax; }
|
double cutoff_radius() const { return *cutmax; }
|
||||||
//! Returns the EAM pair energy
|
//! Returns the EAM pair energy
|
||||||
double phi(const double &r) const
|
double phi(const double &r) const
|
||||||
{
|
{
|
||||||
double p = r*(*rdr) + 1.0;
|
double p = r*(*rdr) + 1.0;
|
||||||
int m = static_cast<int> (p);
|
int m = static_cast<int> (p);
|
||||||
m = MIN(m,(*nr)-1);
|
m = MIN(m,(*nr)-1);
|
||||||
p -= m;
|
p -= m;
|
||||||
p = MIN(p,1.0);
|
p = MIN(p,1.0);
|
||||||
// for now, assume itype = jtype = 1
|
// for now, assume itype = jtype = 1
|
||||||
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
||||||
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||||
return z2/r;
|
return z2/r;
|
||||||
}
|
}
|
||||||
//! Returns the first derivative of the pair energy.
|
//! Returns the first derivative of the pair energy.
|
||||||
double phi_r(const double &r) const
|
double phi_r(const double &r) const
|
||||||
{
|
{
|
||||||
double p = r*(*rdr) + 1.0;
|
double p = r*(*rdr) + 1.0;
|
||||||
int m = static_cast<int> (p);
|
int m = static_cast<int> (p);
|
||||||
m = MIN(m,(*nr)-1);
|
m = MIN(m,(*nr)-1);
|
||||||
p -= m;
|
p -= m;
|
||||||
p = MIN(p,1.0);
|
p = MIN(p,1.0);
|
||||||
// for now, assume itype = jtype = 1
|
// for now, assume itype = jtype = 1
|
||||||
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
||||||
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||||
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
|
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
|
||||||
return (1.0/r)*(z2p-z2/r);
|
return (1.0/r)*(z2p-z2/r);
|
||||||
}
|
}
|
||||||
//! Returns the second derivative of the pair energy.
|
//! Returns the second derivative of the pair energy.
|
||||||
double phi_rr(const double &r) const
|
double phi_rr(const double &r) const
|
||||||
{
|
{
|
||||||
double p = r*(*rdr) + 1.0;
|
double p = r*(*rdr) + 1.0;
|
||||||
int m = static_cast<int> (p);
|
int m = static_cast<int> (p);
|
||||||
m = MIN(m,(*nr)-1);
|
m = MIN(m,(*nr)-1);
|
||||||
p -= m;
|
p -= m;
|
||||||
p = MIN(p,1.0);
|
p = MIN(p,1.0);
|
||||||
// for now, assume itype = jtype = 1
|
// for now, assume itype = jtype = 1
|
||||||
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
||||||
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||||
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
|
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
|
||||||
|
@ -94,7 +94,7 @@ namespace ATC
|
||||||
m = MIN(m,(*nr)-1);
|
m = MIN(m,(*nr)-1);
|
||||||
p -= m;
|
p -= m;
|
||||||
p = MIN(p,1.0);
|
p = MIN(p,1.0);
|
||||||
// for now, assume itype = jtype = 1
|
// for now, assume itype = jtype = 1
|
||||||
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
double *coeff = (*z2r_spline)[type2z2r[1][1]][m];
|
||||||
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
double z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
|
||||||
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
|
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
|
||||||
|
@ -102,7 +102,7 @@ namespace ATC
|
||||||
double z2ppp = (*rdr)*(*rdr)*2.0*coeff[0];
|
double z2ppp = (*rdr)*(*rdr)*2.0*coeff[0];
|
||||||
return (1.0/r)*(z2ppp-3.0*z2pp/r+6.0*z2p/(r*r)-6.0*z2/(r*r*r));
|
return (1.0/r)*(z2ppp-3.0*z2pp/r+6.0*z2p/(r*r)-6.0*z2/(r*r*r));
|
||||||
}
|
}
|
||||||
//! Returns the EAM atomic charge density.
|
//! Returns the EAM atomic charge density.
|
||||||
double rho(const double &r) const
|
double rho(const double &r) const
|
||||||
{
|
{
|
||||||
double p = r*(*rdr) + 1.0;
|
double p = r*(*rdr) + 1.0;
|
||||||
|
@ -150,7 +150,7 @@ namespace ATC
|
||||||
double *coeff = (*rhor_spline)[type2rhor[1][1]][m];
|
double *coeff = (*rhor_spline)[type2rhor[1][1]][m];
|
||||||
return ((*rdr)*(*rdr)*2.0*coeff[0]);
|
return ((*rdr)*(*rdr)*2.0*coeff[0]);
|
||||||
}
|
}
|
||||||
//! Returns the EAM embedding energy.
|
//! Returns the EAM embedding energy.
|
||||||
double F(const double &p) const
|
double F(const double &p) const
|
||||||
{
|
{
|
||||||
double q = p*(*rdrho) + 1.0;
|
double q = p*(*rdrho) + 1.0;
|
||||||
|
@ -202,7 +202,7 @@ namespace ATC
|
||||||
int *type2frho,**type2rhor,**type2z2r;
|
int *type2frho,**type2rhor,**type2z2r;
|
||||||
double *cutmax;
|
double *cutmax;
|
||||||
double *dr,*rdr,*drho,*rdrho;
|
double *dr,*rdr,*drho,*rdrho;
|
||||||
double ****rhor_spline,****frho_spline,****z2r_spline;
|
double ****rhor_spline,****frho_spline,****z2r_spline;
|
||||||
LAMMPS_NS::PairEAM* lammps_eam;
|
LAMMPS_NS::PairEAM* lammps_eam;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,24 +24,24 @@ namespace ATC
|
||||||
B (4.0*eps*pow(sig, 6)),
|
B (4.0*eps*pow(sig, 6)),
|
||||||
rcut(cutoff_radius)
|
rcut(cutoff_radius)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
//! Returns the cutoff readius of the LJ potential.
|
//! Returns the cutoff readius of the LJ potential.
|
||||||
double cutoff_radius() const { return rcut; }
|
double cutoff_radius() const { return rcut; }
|
||||||
//! Returns the LJ energy between two interacting atoms (6,12).
|
//! Returns the LJ energy between two interacting atoms (6,12).
|
||||||
double phi(const double &r) const
|
double phi(const double &r) const
|
||||||
{
|
{
|
||||||
const double r6i = 1.0/((r*r*r)*(r*r*r));
|
const double r6i = 1.0/((r*r*r)*(r*r*r));
|
||||||
return r6i*(A*r6i - B);
|
return r6i*(A*r6i - B);
|
||||||
}
|
}
|
||||||
//! Returns the first derivative of the LJ energy (7,13).
|
//! Returns the first derivative of the LJ energy (7,13).
|
||||||
double phi_r(const double &r) const
|
double phi_r(const double &r) const
|
||||||
{
|
{
|
||||||
const double ri = 1.0/r;
|
const double ri = 1.0/r;
|
||||||
const double r6i = (ri*ri*ri)*(ri*ri*ri);
|
const double r6i = (ri*ri*ri)*(ri*ri*ri);
|
||||||
return r6i*ri*(6.0*B - 12.0*A*r6i);
|
return r6i*ri*(6.0*B - 12.0*A*r6i);
|
||||||
}
|
}
|
||||||
//! Returns the second derivative of the LJ energy (8,14).
|
//! Returns the second derivative of the LJ energy (8,14).
|
||||||
double phi_rr(const double &r) const
|
double phi_rr(const double &r) const
|
||||||
{
|
{
|
||||||
const double r2i = 1.0/(r*r);
|
const double r2i = 1.0/(r*r);
|
||||||
const double r6i = r2i*r2i*r2i;
|
const double r6i = r2i*r2i*r2i;
|
||||||
|
|
|
@ -23,20 +23,20 @@ namespace ATC
|
||||||
A (4.0*eps*pow(sig, 12)),
|
A (4.0*eps*pow(sig, 12)),
|
||||||
B (4.0*eps*pow(sig, 6)),
|
B (4.0*eps*pow(sig, 6)),
|
||||||
rcut(cutoff_radius)
|
rcut(cutoff_radius)
|
||||||
{
|
{
|
||||||
ricut = 1.0/rcut;
|
ricut = 1.0/rcut;
|
||||||
r6icut = (ricut*ricut*ricut)*(ricut*ricut*ricut);
|
r6icut = (ricut*ricut*ricut)*(ricut*ricut*ricut);
|
||||||
phicut = r6icut*(A*r6icut - B);
|
phicut = r6icut*(A*r6icut - B);
|
||||||
dphicut = r6icut*ricut*(6.0*B - 12.0*A*r6icut);
|
dphicut = r6icut*ricut*(6.0*B - 12.0*A*r6icut);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns the cutoff readius of the LJ potential.
|
//! Returns the cutoff readius of the LJ potential.
|
||||||
double cutoff_radius() const { return rcut; }
|
double cutoff_radius() const { return rcut; }
|
||||||
//! Returns the LJ energy between two interacting atoms (6,12).
|
//! Returns the LJ energy between two interacting atoms (6,12).
|
||||||
double phi(const double &r) const
|
double phi(const double &r) const
|
||||||
{
|
{
|
||||||
const double r6i = 1.0/((r*r*r)*(r*r*r));
|
const double r6i = 1.0/((r*r*r)*(r*r*r));
|
||||||
if (r < rcut) {
|
if (r < rcut) {
|
||||||
return (r6i*(A*r6i - B) - phicut - (r-rcut)*dphicut);
|
return (r6i*(A*r6i - B) - phicut - (r-rcut)*dphicut);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -44,11 +44,11 @@ namespace ATC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! Returns the first derivative of the LJ energy (7,13).
|
//! Returns the first derivative of the LJ energy (7,13).
|
||||||
double phi_r(const double &r) const
|
double phi_r(const double &r) const
|
||||||
{
|
{
|
||||||
const double ri = 1.0/r;
|
const double ri = 1.0/r;
|
||||||
const double r6i = (ri*ri*ri)*(ri*ri*ri);
|
const double r6i = (ri*ri*ri)*(ri*ri*ri);
|
||||||
if (r < rcut) {
|
if (r < rcut) {
|
||||||
return (r6i*ri*(6.0*B - 12.0*A*r6i) - dphicut);
|
return (r6i*ri*(6.0*B - 12.0*A*r6i) - dphicut);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -56,7 +56,7 @@ namespace ATC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! Returns the second derivative of the LJ energy (8,14).
|
//! Returns the second derivative of the LJ energy (8,14).
|
||||||
double phi_rr(const double &r) const
|
double phi_rr(const double &r) const
|
||||||
{
|
{
|
||||||
const double r2i = 1.0/(r*r);
|
const double r2i = 1.0/(r*r);
|
||||||
const double r6i = r2i*r2i*r2i;
|
const double r6i = r2i*r2i*r2i;
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ATC
|
||||||
return (phi_r(r+dr)-phi_r(r)) / dr;
|
return (phi_r(r+dr)-phi_r(r)) / dr;
|
||||||
}
|
}
|
||||||
// Approximates the third derivative of phi
|
// Approximates the third derivative of phi
|
||||||
double CbPotential::phi_rrr(const double &r) const
|
double CbPotential::phi_rrr(const double &r) const
|
||||||
{
|
{
|
||||||
const double dr = r*EPS;
|
const double dr = r*EPS;
|
||||||
return (phi_rr(r+dr)-phi_rr(r)) / dr;
|
return (phi_rr(r+dr)-phi_rr(r)) / dr;
|
||||||
|
@ -34,8 +34,8 @@ namespace ATC
|
||||||
const double dr = r*EPS;
|
const double dr = r*EPS;
|
||||||
return (rho_r(r+dr)-rho_r(r)) / dr;
|
return (rho_r(r+dr)-rho_r(r)) / dr;
|
||||||
}
|
}
|
||||||
// Approximates the third derivative of rho
|
// Approximates the third derivative of rho
|
||||||
double CbPotential::rho_rrr(const double &r) const
|
double CbPotential::rho_rrr(const double &r) const
|
||||||
{
|
{
|
||||||
const double dr = r*EPS;
|
const double dr = r*EPS;
|
||||||
return (rho_rr(r+dr)-rho_rr(r)) / dr;
|
return (rho_rr(r+dr)-rho_rr(r)) / dr;
|
||||||
|
@ -44,7 +44,7 @@ namespace ATC
|
||||||
double CbPotential::F_p(const double &p) const
|
double CbPotential::F_p(const double &p) const
|
||||||
{
|
{
|
||||||
const double dp = p*EPS;
|
const double dp = p*EPS;
|
||||||
return (F(p+dp)-F(p)) / dp;
|
return (F(p+dp)-F(p)) / dp;
|
||||||
}
|
}
|
||||||
// Approximates the second derivative of the embedding function
|
// Approximates the second derivative of the embedding function
|
||||||
double CbPotential::F_pp(const double &p) const
|
double CbPotential::F_pp(const double &p) const
|
||||||
|
@ -79,7 +79,7 @@ namespace ATC
|
||||||
Interactions::Interactions(int a, int b, int c)
|
Interactions::Interactions(int a, int b, int c)
|
||||||
{
|
{
|
||||||
// bitwise OR combines the terms that are listed
|
// bitwise OR combines the terms that are listed
|
||||||
const int abc = a|b|c;
|
const int abc = a|b|c;
|
||||||
pairwise = (abc&PAIRWISE)>0;
|
pairwise = (abc&PAIRWISE)>0;
|
||||||
embedding = (abc&EAM)>0;
|
embedding = (abc&EAM)>0;
|
||||||
three_body = (abc&THREE_BDY)>0;
|
three_body = (abc&THREE_BDY)>0;
|
||||||
|
|
|
@ -29,10 +29,10 @@ namespace ATC
|
||||||
protected:
|
protected:
|
||||||
//! CbPotential base constructor:
|
//! CbPotential base constructor:
|
||||||
//! Initializes which terms are included in energy computation.
|
//! Initializes which terms are included in energy computation.
|
||||||
//@param potential_terms Switches for atomic interaction terms.
|
//@param potential_terms Switches for atomic interaction terms.
|
||||||
CbPotential(Interactions interaction_terms) : terms(interaction_terms) {}
|
CbPotential(Interactions interaction_terms) : terms(interaction_terms) {}
|
||||||
public:
|
public:
|
||||||
virtual ~CbPotential() {}
|
virtual ~CbPotential() {}
|
||||||
const Interactions terms; //!< switches for types of potential terms.
|
const Interactions terms; //!< switches for types of potential terms.
|
||||||
|
|
||||||
//! Returns the minimum distance that all interactions get neglected.
|
//! Returns the minimum distance that all interactions get neglected.
|
||||||
|
|
|
@ -20,7 +20,7 @@ using std::vector;
|
||||||
using std::set;
|
using std::set;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify:
|
// modify:
|
||||||
// parses and adjusts charge regulator state based on
|
// parses and adjusts charge regulator state based on
|
||||||
|
@ -97,7 +97,7 @@ namespace ATC {
|
||||||
regulators_[tag] = new ChargeRegulatorMethodEffectiveCharge(this,p);
|
regulators_[tag] = new ChargeRegulatorMethodEffectiveCharge(this,p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw ATC_Error("ChargeRegulator::construct_method unknown charge regulator type");
|
throw ATC_Error("ChargeRegulator::construct_method unknown charge regulator type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,12 +110,12 @@ namespace ATC {
|
||||||
void ChargeRegulator::initialize()
|
void ChargeRegulator::initialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
map<string, ChargeRegulatorMethod *>::iterator itr;
|
map<string, ChargeRegulatorMethod *>::iterator itr;
|
||||||
for (itr = regulators_.begin();
|
for (itr = regulators_.begin();
|
||||||
itr != regulators_.end(); itr++) { itr->second->initialize(); }
|
itr != regulators_.end(); itr++) { itr->second->initialize(); }
|
||||||
|
|
||||||
atc_->set_boundary_integration_type(boundaryIntegrationType_);
|
atc_->set_boundary_integration_type(boundaryIntegrationType_);
|
||||||
AtomicRegulator::reset_nlocal();
|
AtomicRegulator::reset_nlocal();
|
||||||
AtomicRegulator::delete_unused_data();
|
AtomicRegulator::delete_unused_data();
|
||||||
needReset_ = false;
|
needReset_ = false;
|
||||||
|
@ -152,23 +152,23 @@ namespace ATC {
|
||||||
//========================================================
|
//========================================================
|
||||||
// Class ChargeRegulatorMethod
|
// Class ChargeRegulatorMethod
|
||||||
//========================================================
|
//========================================================
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and ChargeRegulator
|
// Grab references to ATC and ChargeRegulator
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ChargeRegulatorMethod::ChargeRegulatorMethod
|
ChargeRegulatorMethod::ChargeRegulatorMethod
|
||||||
(ChargeRegulator *chargeRegulator,
|
(ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & p)
|
ChargeRegulator::ChargeRegulatorParameters & p)
|
||||||
: RegulatorShapeFunction(chargeRegulator),
|
: RegulatorShapeFunction(chargeRegulator),
|
||||||
chargeRegulator_(chargeRegulator),
|
chargeRegulator_(chargeRegulator),
|
||||||
lammpsInterface_(LammpsInterface::instance()),
|
lammpsInterface_(LammpsInterface::instance()),
|
||||||
rC_(0), rCsq_(0),
|
rC_(0), rCsq_(0),
|
||||||
targetValue_(nullptr),
|
targetValue_(nullptr),
|
||||||
targetPhi_(p.value),
|
targetPhi_(p.value),
|
||||||
surface_(p.faceset),
|
surface_(p.faceset),
|
||||||
atomGroupBit_(p.groupBit),
|
atomGroupBit_(p.groupBit),
|
||||||
boundary_(false),
|
boundary_(false),
|
||||||
depth_(p.depth),
|
depth_(p.depth),
|
||||||
surfaceType_(p.surfaceType),
|
surfaceType_(p.surfaceType),
|
||||||
permittivity_(p.permittivity),
|
permittivity_(p.permittivity),
|
||||||
|
@ -185,7 +185,7 @@ namespace ATC {
|
||||||
point_.reset(nsd_);
|
point_.reset(nsd_);
|
||||||
for (int i=0; i < nsd_; i++) { point_(i) = faceCoords(i,0); }
|
for (int i=0; i < nsd_; i++) { point_(i) = faceCoords(i,0); }
|
||||||
#ifdef ATC_VERBOSE
|
#ifdef ATC_VERBOSE
|
||||||
stringstream ss; ss << "point: (" << point_(0) << "," << point_(1) << "," << point_(2) << ") normal: (" << normal_(0) << "," << normal_(1) << "," << normal_(2) << ") depth: " << depth_;
|
stringstream ss; ss << "point: (" << point_(0) << "," << point_(1) << "," << point_(2) << ") normal: (" << normal_(0) << "," << normal_(1) << "," << normal_(2) << ") depth: " << depth_;
|
||||||
lammpsInterface_->print_msg_once(ss.str());
|
lammpsInterface_->print_msg_once(ss.str());
|
||||||
#endif
|
#endif
|
||||||
sum_.reset(nsd_);
|
sum_.reset(nsd_);
|
||||||
|
@ -193,7 +193,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Initialize
|
// Initialize
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ namespace ATC {
|
||||||
// note derived method set initialized to true
|
// note derived method set initialized to true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ChargeRegulatorMethod::nlocal() { return atc_->nlocal(); }
|
int ChargeRegulatorMethod::nlocal() { return atc_->nlocal(); }
|
||||||
|
|
||||||
void ChargeRegulatorMethod::set_greens_functions(void)
|
void ChargeRegulatorMethod::set_greens_functions(void)
|
||||||
|
@ -260,14 +260,14 @@ namespace ATC {
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ChargeRegulatorMethodFeedback::ChargeRegulatorMethodFeedback
|
ChargeRegulatorMethodFeedback::ChargeRegulatorMethodFeedback
|
||||||
(ChargeRegulator *chargeRegulator,
|
(ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & p)
|
ChargeRegulator::ChargeRegulatorParameters & p)
|
||||||
: ChargeRegulatorMethod (chargeRegulator, p),
|
: ChargeRegulatorMethod (chargeRegulator, p),
|
||||||
controlNodes_(nodes_),
|
controlNodes_(nodes_),
|
||||||
influenceGroupBit_(p.groupBit)
|
influenceGroupBit_(p.groupBit)
|
||||||
{
|
{
|
||||||
nControlNodes_ = controlNodes_.size();
|
nControlNodes_ = controlNodes_.size();
|
||||||
sum_.resize(1);
|
sum_.resize(1);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Initialize
|
// Initialize
|
||||||
|
@ -275,10 +275,10 @@ namespace ATC {
|
||||||
void ChargeRegulatorMethodFeedback::initialize(void)
|
void ChargeRegulatorMethodFeedback::initialize(void)
|
||||||
{
|
{
|
||||||
ChargeRegulatorMethod::initialize();
|
ChargeRegulatorMethod::initialize();
|
||||||
if (surfaceType_ != ChargeRegulator::CONDUCTOR)
|
if (surfaceType_ != ChargeRegulator::CONDUCTOR)
|
||||||
throw ATC_Error("currently charge feedback can only mimic a conductor");
|
throw ATC_Error("currently charge feedback can only mimic a conductor");
|
||||||
set_influence();
|
set_influence();
|
||||||
set_influence_matrix();
|
set_influence_matrix();
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -299,13 +299,13 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// find measurement atoms and nodes
|
// find measurement atoms and nodes
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodFeedback::set_influence(void)
|
void ChargeRegulatorMethodFeedback::set_influence(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
// get nodes that overlap influence atoms & compact list of influence atoms
|
// get nodes that overlap influence atoms & compact list of influence atoms
|
||||||
boundary_ =
|
boundary_ =
|
||||||
atc_->nodal_influence(influenceGroupBit_,influenceNodes_,influenceAtoms_);
|
atc_->nodal_influence(influenceGroupBit_,influenceNodes_,influenceAtoms_);
|
||||||
nInfluenceAtoms_ = influenceAtoms_.size(); // local
|
nInfluenceAtoms_ = influenceAtoms_.size(); // local
|
||||||
nInfluenceNodes_ = influenceNodes_.size(); // global
|
nInfluenceNodes_ = influenceNodes_.size(); // global
|
||||||
|
@ -313,13 +313,13 @@ namespace ATC {
|
||||||
lammpsInterface_->print_msg(ss.str());
|
lammpsInterface_->print_msg(ss.str());
|
||||||
if (nInfluenceNodes_ == 0) throw ATC_Error("no influence nodes");
|
if (nInfluenceNodes_ == 0) throw ATC_Error("no influence nodes");
|
||||||
|
|
||||||
const Array<int> & map = (boundary_) ? atc_->ghost_to_atom_map() : atc_->internal_to_atom_map();
|
const Array<int> & map = (boundary_) ? atc_->ghost_to_atom_map() : atc_->internal_to_atom_map();
|
||||||
for (set<int>::const_iterator itr = influenceAtoms_.begin(); itr != influenceAtoms_.end(); itr++) {
|
for (set<int>::const_iterator itr = influenceAtoms_.begin(); itr != influenceAtoms_.end(); itr++) {
|
||||||
influenceAtomsIds_.insert(map(*itr));
|
influenceAtomsIds_.insert(map(*itr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// constuct a Green's submatrix
|
// constuct a Green's submatrix
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodFeedback::set_influence_matrix(void)
|
void ChargeRegulatorMethodFeedback::set_influence_matrix(void)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +329,7 @@ namespace ATC {
|
||||||
//
|
//
|
||||||
if (nInfluenceNodes_ < nControlNodes_) throw ATC_Error(" least square not implemented ");
|
if (nInfluenceNodes_ < nControlNodes_) throw ATC_Error(" least square not implemented ");
|
||||||
if (nInfluenceNodes_ > nControlNodes_) throw ATC_Error(" solve not possible ");
|
if (nInfluenceNodes_ > nControlNodes_) throw ATC_Error(" solve not possible ");
|
||||||
DENS_MAT G(nInfluenceNodes_,nControlNodes_);
|
DENS_MAT G(nInfluenceNodes_,nControlNodes_);
|
||||||
DENS_VEC G_I;
|
DENS_VEC G_I;
|
||||||
set<int>::const_iterator itr,itr2,itr3;
|
set<int>::const_iterator itr,itr2,itr3;
|
||||||
const Array<int> & nmap = atc_->fe_engine()->fe_mesh()->global_to_unique_map();
|
const Array<int> & nmap = atc_->fe_engine()->fe_mesh()->global_to_unique_map();
|
||||||
|
@ -339,7 +339,7 @@ namespace ATC {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (itr2 = controlNodes_.begin(); itr2 != controlNodes_.end(); itr2++) {
|
for (itr2 = controlNodes_.begin(); itr2 != controlNodes_.end(); itr2++) {
|
||||||
int jnode = nmap(*itr2);
|
int jnode = nmap(*itr2);
|
||||||
G(i,j++) = G_I(jnode);
|
G(i,j++) = G_I(jnode);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -371,33 +371,33 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
// swap contributions across processors
|
// swap contributions across processors
|
||||||
DENS_MAT localNNT = NNT;
|
DENS_MAT localNNT = NNT;
|
||||||
int count = NNT.nRows()*NNT.nCols();
|
int count = NNT.nRows()*NNT.nCols();
|
||||||
lammpsInterface_->allsum(localNNT.ptr(),NNT.ptr(),count);
|
lammpsInterface_->allsum(localNNT.ptr(),NNT.ptr(),count);
|
||||||
invNNT_ = inv(NNT);
|
invNNT_ = inv(NNT);
|
||||||
|
|
||||||
// total influence matrix
|
// total influence matrix
|
||||||
if (nInfluenceAtoms_ > 0) { NTinvNNTinvG_ = NT_*invNNT_*invG_; }
|
if (nInfluenceAtoms_ > 0) { NTinvNNTinvG_ = NT_*invNNT_*invG_; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// change potential/charge pre-force calculation
|
// change potential/charge pre-force calculation
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodFeedback::apply_pre_force(double /* dt */)
|
void ChargeRegulatorMethodFeedback::apply_pre_force(double /* dt */)
|
||||||
{
|
{
|
||||||
|
|
||||||
sum_ = 0;
|
sum_ = 0;
|
||||||
if (nInfluenceAtoms_ == 0) return; // nothing to do
|
if (nInfluenceAtoms_ == 0) return; // nothing to do
|
||||||
apply_feedback_charges();
|
apply_feedback_charges();
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply feedback charges to atoms
|
// apply feedback charges to atoms
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodFeedback::apply_feedback_charges()
|
void ChargeRegulatorMethodFeedback::apply_feedback_charges()
|
||||||
{
|
{
|
||||||
double * q = lammpsInterface_->atom_charge();
|
double * q = lammpsInterface_->atom_charge();
|
||||||
// calculate error in potential on the control nodes
|
// calculate error in potential on the control nodes
|
||||||
|
|
||||||
const DENS_MAT & phiField = (atc_->field(ELECTRIC_POTENTIAL)).quantity();
|
const DENS_MAT & phiField = (atc_->field(ELECTRIC_POTENTIAL)).quantity();
|
||||||
DENS_MAT dphi(nControlNodes_,1);
|
DENS_MAT dphi(nControlNodes_,1);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -410,10 +410,10 @@ namespace ATC {
|
||||||
DENS_MAT dq = NTinvNNTinvG_*dphi;
|
DENS_MAT dq = NTinvNNTinvG_*dphi;
|
||||||
i = 0;
|
i = 0;
|
||||||
for (itr = influenceAtomsIds_.begin(); itr != influenceAtomsIds_.end(); itr++) {
|
for (itr = influenceAtomsIds_.begin(); itr != influenceAtomsIds_.end(); itr++) {
|
||||||
sum_(0) += dq(i,0);
|
sum_(0) += dq(i,0);
|
||||||
q[*itr] += dq(i++,0);
|
q[*itr] += dq(i++,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
(interscaleManager_->fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE))->force_reset();
|
(interscaleManager_->fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE))->force_reset();
|
||||||
(interscaleManager_->fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE, GHOST))->force_reset();
|
(interscaleManager_->fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE, GHOST))->force_reset();
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ namespace ATC {
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ChargeRegulatorMethodImageCharge::ChargeRegulatorMethodImageCharge
|
ChargeRegulatorMethodImageCharge::ChargeRegulatorMethodImageCharge
|
||||||
(ChargeRegulator *chargeRegulator,
|
(ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & p)
|
ChargeRegulator::ChargeRegulatorParameters & p)
|
||||||
: ChargeRegulatorMethod (chargeRegulator, p),
|
: ChargeRegulatorMethod (chargeRegulator, p),
|
||||||
imageNodes_(nodes_)
|
imageNodes_(nodes_)
|
||||||
|
@ -459,12 +459,12 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
sum_ = 0;
|
sum_ = 0;
|
||||||
apply_local_forces();
|
apply_local_forces();
|
||||||
|
|
||||||
//correct_forces();
|
//correct_forces();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply local coulomb forces
|
// apply local coulomb forces
|
||||||
// -- due to image charges
|
// -- due to image charges
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodImageCharge::apply_local_forces()
|
void ChargeRegulatorMethodImageCharge::apply_local_forces()
|
||||||
|
@ -477,8 +477,8 @@ namespace ATC {
|
||||||
|
|
||||||
const int *mask = lammpsInterface_->atom_mask();
|
const int *mask = lammpsInterface_->atom_mask();
|
||||||
///..............................................
|
///..............................................
|
||||||
double ** x = lammpsInterface_->xatom();
|
double ** x = lammpsInterface_->xatom();
|
||||||
double ** f = lammpsInterface_->fatom();
|
double ** f = lammpsInterface_->fatom();
|
||||||
double * q = lammpsInterface_->atom_charge();
|
double * q = lammpsInterface_->atom_charge();
|
||||||
|
|
||||||
// loop over neighbor list
|
// loop over neighbor list
|
||||||
|
@ -487,13 +487,13 @@ namespace ATC {
|
||||||
double qi = q[i];
|
double qi = q[i];
|
||||||
if ((mask[i] & atomGroupBit_) && qi != 0.) {
|
if ((mask[i] & atomGroupBit_) && qi != 0.) {
|
||||||
double* fi = f[i];
|
double* fi = f[i];
|
||||||
DENS_VEC xi(x[i],nsd_);
|
DENS_VEC xi(x[i],nsd_);
|
||||||
// distance to surface
|
// distance to surface
|
||||||
double dn = reflect(xi);
|
double dn = reflect(xi);
|
||||||
// all ions near the interface/wall
|
// all ions near the interface/wall
|
||||||
// (a) self image
|
// (a) self image
|
||||||
if (dn < rC_) { // close enough to wall to have explicit image charges
|
if (dn < rC_) { // close enough to wall to have explicit image charges
|
||||||
double factor_coul = 1;
|
double factor_coul = 1;
|
||||||
double dx = 2.*dn; // distance to image charge
|
double dx = 2.*dn; // distance to image charge
|
||||||
double fn = factor_coul*qi*qi*permittivityRatio_/dx;
|
double fn = factor_coul*qi*qi*permittivityRatio_/dx;
|
||||||
fi[0] += fn*normal_[0];
|
fi[0] += fn*normal_[0];
|
||||||
|
@ -513,8 +513,8 @@ namespace ATC {
|
||||||
dn = reflect(xj);
|
dn = reflect(xj);
|
||||||
DENS_VEC dx = xi-xj;
|
DENS_VEC dx = xi-xj;
|
||||||
double r2 = dx.norm_sq();
|
double r2 = dx.norm_sq();
|
||||||
// neighbor image j' inside cutoff from i
|
// neighbor image j' inside cutoff from i
|
||||||
if (r2 < rCsq_) {
|
if (r2 < rCsq_) {
|
||||||
double fm = factor_coul*qi*qj*permittivityRatio_/r2;
|
double fm = factor_coul*qi*qj*permittivityRatio_/r2;
|
||||||
fi[0] += fm*dx(0);
|
fi[0] += fm*dx(0);
|
||||||
fi[1] += fm*dx(1);
|
fi[1] += fm*dx(1);
|
||||||
|
@ -532,7 +532,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// correct charge densities
|
// correct charge densities
|
||||||
// - to reflect image charges
|
// - to reflect image charges
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodImageCharge::correct_charge_densities()
|
void ChargeRegulatorMethodImageCharge::correct_charge_densities()
|
||||||
{
|
{
|
||||||
|
@ -554,19 +554,19 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
ChargeRegulatorMethodEffectiveCharge::ChargeRegulatorMethodEffectiveCharge(
|
ChargeRegulatorMethodEffectiveCharge::ChargeRegulatorMethodEffectiveCharge(
|
||||||
ChargeRegulator *chargeRegulator,
|
ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & p)
|
ChargeRegulator::ChargeRegulatorParameters & p)
|
||||||
: ChargeRegulatorMethod (chargeRegulator, p),
|
: ChargeRegulatorMethod (chargeRegulator, p),
|
||||||
chargeDensity_(p.value),
|
chargeDensity_(p.value),
|
||||||
useSlab_(false)
|
useSlab_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// add_charged_surface
|
// add_charged_surface
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodEffectiveCharge::initialize( )
|
void ChargeRegulatorMethodEffectiveCharge::initialize( )
|
||||||
{
|
{
|
||||||
ChargeRegulatorMethod::initialize();
|
ChargeRegulatorMethod::initialize();
|
||||||
boundary_ = atc_->is_ghost_group(atomGroupBit_);
|
boundary_ = atc_->is_ghost_group(atomGroupBit_);
|
||||||
|
@ -644,7 +644,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// add effective forces post LAMMPS force call
|
// add effective forces post LAMMPS force call
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ChargeRegulatorMethodEffectiveCharge::apply_post_force(double /* dt */)
|
void ChargeRegulatorMethodEffectiveCharge::apply_post_force(double /* dt */)
|
||||||
{
|
{
|
||||||
apply_local_forces();
|
apply_local_forces();
|
||||||
}
|
}
|
||||||
|
@ -664,7 +664,7 @@ namespace ATC {
|
||||||
const DENS_MAT & xa((interscaleManager_->per_atom_quantity("AtomicCoarseGrainingPositions"))->quantity());
|
const DENS_MAT & xa((interscaleManager_->per_atom_quantity("AtomicCoarseGrainingPositions"))->quantity());
|
||||||
|
|
||||||
// WORKSPACE - most are static
|
// WORKSPACE - most are static
|
||||||
SparseVector<double> dv(nNodes_);
|
SparseVector<double> dv(nNodes_);
|
||||||
vector<SparseVector<double> > derivativeVectors;
|
vector<SparseVector<double> > derivativeVectors;
|
||||||
derivativeVectors.reserve(nsd_);
|
derivativeVectors.reserve(nsd_);
|
||||||
const SPAR_MAT_VEC & shapeFunctionDerivatives((interscaleManager_->vector_sparse_matrix("InterpolateGradient"))->quantity());
|
const SPAR_MAT_VEC & shapeFunctionDerivatives((interscaleManager_->vector_sparse_matrix("InterpolateGradient"))->quantity());
|
||||||
|
@ -674,7 +674,7 @@ namespace ATC {
|
||||||
|
|
||||||
NODE_TO_XF_MAP::const_iterator inode;
|
NODE_TO_XF_MAP::const_iterator inode;
|
||||||
for (inode = nodeXFMap_.begin(); inode != nodeXFMap_.end(); inode++) {
|
for (inode = nodeXFMap_.begin(); inode != nodeXFMap_.end(); inode++) {
|
||||||
|
|
||||||
int node = inode->first;
|
int node = inode->first;
|
||||||
DENS_VEC xI = (inode->second).first;
|
DENS_VEC xI = (inode->second).first;
|
||||||
double qI = (inode->second).second;
|
double qI = (inode->second).second;
|
||||||
|
@ -682,46 +682,46 @@ namespace ATC {
|
||||||
for (int i = 0; i < nlocal(); i++) {
|
for (int i = 0; i < nlocal(); i++) {
|
||||||
int atom = (atc_->internal_to_atom_map())(i);
|
int atom = (atc_->internal_to_atom_map())(i);
|
||||||
double qa = q[atom];
|
double qa = q[atom];
|
||||||
if (qa != 0) {
|
if (qa != 0) {
|
||||||
double dxSq = 0.;
|
double dxSq = 0.;
|
||||||
for (int j = 0; j < nsd_; j++) {
|
for (int j = 0; j < nsd_; j++) {
|
||||||
dx[j] = xa(i,j) - xI(j);
|
dx[j] = xa(i,j) - xI(j);
|
||||||
dxSq += dx[j]*dx[j];
|
dxSq += dx[j]*dx[j];
|
||||||
}
|
}
|
||||||
if (dxSq < rCsq_) {
|
if (dxSq < rCsq_) {
|
||||||
// first apply pairwise coulombic interaction
|
// first apply pairwise coulombic interaction
|
||||||
if (!useSlab_) {
|
if (!useSlab_) {
|
||||||
double coulForce = qqrd2e_*qI*qa/(dxSq*sqrtf(dxSq));
|
double coulForce = qqrd2e_*qI*qa/(dxSq*sqrtf(dxSq));
|
||||||
for (int j = 0; j < nsd_; j++) {
|
for (int j = 0; j < nsd_; j++) {
|
||||||
_atomElectricalForce_(i,j) += dx[j]*coulForce; }
|
_atomElectricalForce_(i,j) += dx[j]*coulForce; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// second correct for FE potential induced by BCs
|
// second correct for FE potential induced by BCs
|
||||||
// determine shape function derivatives at atomic location
|
// determine shape function derivatives at atomic location
|
||||||
// and construct sparse vectors to store derivative data
|
// and construct sparse vectors to store derivative data
|
||||||
|
|
||||||
|
|
||||||
for (int j = 0; j < nsd_; j++) {
|
for (int j = 0; j < nsd_; j++) {
|
||||||
shapeFunctionDerivatives[j]->row(i,nodeValues,nodeIndices);
|
shapeFunctionDerivatives[j]->row(i,nodeValues,nodeIndices);
|
||||||
derivativeVectors.push_back(dv);
|
derivativeVectors.push_back(dv);
|
||||||
for (int k = 0; k < nodeIndices.size(); k++) {
|
for (int k = 0; k < nodeIndices.size(); k++) {
|
||||||
derivativeVectors[j](nodeIndices(k)) = nodeValues(k); }
|
derivativeVectors[j](nodeIndices(k)) = nodeValues(k); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute greens function from charge quadrature
|
// compute greens function from charge quadrature
|
||||||
|
|
||||||
SparseVector<double> shortFePotential(nNodes_);
|
SparseVector<double> shortFePotential(nNodes_);
|
||||||
shortFePotential.add_scaled(greensFunctions_[node],penalty*phiI);
|
shortFePotential.add_scaled(greensFunctions_[node],penalty*phiI);
|
||||||
|
|
||||||
// compute electric field induced by charge
|
// compute electric field induced by charge
|
||||||
DENS_VEC efield(nsd_);
|
DENS_VEC efield(nsd_);
|
||||||
for (int j = 0; j < nsd_; j++) {
|
for (int j = 0; j < nsd_; j++) {
|
||||||
efield(j) = -.1*dot(derivativeVectors[j],shortFePotential); }
|
efield(j) = -.1*dot(derivativeVectors[j],shortFePotential); }
|
||||||
|
|
||||||
// apply correction in atomic forces
|
// apply correction in atomic forces
|
||||||
double c = qV2e_*qa;
|
double c = qV2e_*qa;
|
||||||
for (int j = 0; j < nsd_; j++) {
|
for (int j = 0; j < nsd_; j++) {
|
||||||
if ((!useSlab_) || (j==nsd_)) {
|
if ((!useSlab_) || (j==nsd_)) {
|
||||||
_atomElectricalForce_(i,j) -= c*efield(j);
|
_atomElectricalForce_(i,j) -= c*efield(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // end namespace
|
}; // end namespace
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ATC {
|
||||||
|
|
||||||
class ChargeRegulatorMethod;
|
class ChargeRegulatorMethod;
|
||||||
class ChargeRegulator : public AtomicRegulator {
|
class ChargeRegulator : public AtomicRegulator {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** charge regulator types */
|
/** charge regulator types */
|
||||||
|
@ -43,21 +43,21 @@ namespace ATC {
|
||||||
permittivity(0),
|
permittivity(0),
|
||||||
surfaceType(INSULATOR) { };
|
surfaceType(INSULATOR) { };
|
||||||
ChargeRegulatorType method;
|
ChargeRegulatorType method;
|
||||||
double value;
|
double value;
|
||||||
int groupBit;
|
int groupBit;
|
||||||
std::string groupTag;
|
std::string groupTag;
|
||||||
double depth;
|
double depth;
|
||||||
double permittivity;
|
double permittivity;
|
||||||
ChargedSurfaceType surfaceType;
|
ChargedSurfaceType surfaceType;
|
||||||
FSET faceset;
|
FSET faceset;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** constructor */
|
/** constructor */
|
||||||
ChargeRegulator(ATC_Coupling *atc);
|
ChargeRegulator(ATC_Coupling *atc);
|
||||||
|
|
||||||
/** destructor */
|
/** destructor */
|
||||||
~ChargeRegulator();
|
~ChargeRegulator();
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
virtual bool modify(int narg, char **arg);
|
virtual bool modify(int narg, char **arg);
|
||||||
virtual void construct_methods();
|
virtual void construct_methods();
|
||||||
|
@ -67,8 +67,8 @@ namespace ATC {
|
||||||
virtual void output(OUTPUT_LIST & outputData) const;
|
virtual void output(OUTPUT_LIST & outputData) const;
|
||||||
virtual double compute_vector(int /* n */) const {return 0;} // TODO
|
virtual double compute_vector(int /* n */) const {return 0;} // TODO
|
||||||
|
|
||||||
void assign_poisson_solver(PoissonSolver * solver) { poissonSolver_ = solver;}
|
void assign_poisson_solver(PoissonSolver * solver) { poissonSolver_ = solver;}
|
||||||
PoissonSolver * poisson_solver(void) { return poissonSolver_;}
|
PoissonSolver * poisson_solver(void) { return poissonSolver_;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -86,19 +86,19 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ChargeRegulatorMethod
|
* @class ChargeRegulatorMethod
|
||||||
* @brief Base class for implementation of ChargeRegulator algorithms
|
* @brief Base class for implementation of ChargeRegulator algorithms
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ChargeRegulatorMethod : public RegulatorShapeFunction {
|
class ChargeRegulatorMethod : public RegulatorShapeFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChargeRegulatorMethod(ChargeRegulator *chargeRegulator,
|
ChargeRegulatorMethod(ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
||||||
~ChargeRegulatorMethod(){};
|
~ChargeRegulatorMethod(){};
|
||||||
virtual void initialize(void);
|
virtual void initialize(void);
|
||||||
void set_greens_functions();
|
void set_greens_functions();
|
||||||
virtual void apply_pre_force(double /* dt */){};
|
virtual void apply_pre_force(double /* dt */){};
|
||||||
virtual void apply_post_force(double /* dt */){};
|
virtual void apply_post_force(double /* dt */){};
|
||||||
virtual void set_weights() {};
|
virtual void set_weights() {};
|
||||||
const DENS_VEC & total_influence() const { return sum_;}
|
const DENS_VEC & total_influence() const { return sum_;}
|
||||||
virtual void output(OUTPUT_LIST & outputData);
|
virtual void output(OUTPUT_LIST & outputData);
|
||||||
|
@ -120,13 +120,13 @@ namespace ATC {
|
||||||
/** conversion constants */
|
/** conversion constants */
|
||||||
double qV2e_, qqrd2e_;
|
double qV2e_, qqrd2e_;
|
||||||
/** member data */
|
/** member data */
|
||||||
XT_Function * targetValue_;
|
XT_Function * targetValue_;
|
||||||
double targetPhi_;
|
double targetPhi_;
|
||||||
// controlling
|
// controlling
|
||||||
FSET surface_;
|
FSET surface_;
|
||||||
NSET nodes_;
|
NSET nodes_;
|
||||||
int atomGroupBit_;
|
int atomGroupBit_;
|
||||||
bool boundary_; // atoms on boundary
|
bool boundary_; // atoms on boundary
|
||||||
DENS_VEC point_;
|
DENS_VEC point_;
|
||||||
DENS_VEC normal_;
|
DENS_VEC normal_;
|
||||||
double depth_;
|
double depth_;
|
||||||
|
@ -147,13 +147,13 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ChargeRegulatorMethodFeedback : public ChargeRegulatorMethod {
|
class ChargeRegulatorMethodFeedback : public ChargeRegulatorMethod {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** constructor */
|
/** constructor */
|
||||||
ChargeRegulatorMethodFeedback(ChargeRegulator *chargeRegulator,
|
ChargeRegulatorMethodFeedback(ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
||||||
|
|
||||||
/** destructor */
|
/** destructor */
|
||||||
~ChargeRegulatorMethodFeedback(){};
|
~ChargeRegulatorMethodFeedback(){};
|
||||||
|
|
||||||
|
@ -161,30 +161,30 @@ namespace ATC {
|
||||||
virtual void construct_transfers();
|
virtual void construct_transfers();
|
||||||
|
|
||||||
/** initialize */
|
/** initialize */
|
||||||
virtual void initialize(void);
|
virtual void initialize(void);
|
||||||
|
|
||||||
/** set influence nodes and atoms */
|
/** set influence nodes and atoms */
|
||||||
void set_influence();
|
void set_influence();
|
||||||
|
|
||||||
void set_influence_matrix(void);
|
void set_influence_matrix(void);
|
||||||
|
|
||||||
/** post first verlet step */
|
/** post first verlet step */
|
||||||
virtual void apply_pre_force(double dt);
|
virtual void apply_pre_force(double dt);
|
||||||
|
|
||||||
void apply_feedback_charges();
|
void apply_feedback_charges();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
int nControlNodes_;
|
int nControlNodes_;
|
||||||
NSET & controlNodes_;
|
NSET & controlNodes_;
|
||||||
// measurement/controlled
|
// measurement/controlled
|
||||||
int influenceGroupBit_;
|
int influenceGroupBit_;
|
||||||
int nInfluenceAtoms_;
|
int nInfluenceAtoms_;
|
||||||
NSET influenceAtoms_, influenceAtomsIds_;
|
NSET influenceAtoms_, influenceAtomsIds_;
|
||||||
int nInfluenceNodes_;
|
int nInfluenceNodes_;
|
||||||
NSET influenceNodes_;
|
NSET influenceNodes_;
|
||||||
|
|
||||||
|
|
||||||
DENS_MAT invG_;
|
DENS_MAT invG_;
|
||||||
DENS_MAT invNNT_;
|
DENS_MAT invNNT_;
|
||||||
DENS_MAT NT_;
|
DENS_MAT NT_;
|
||||||
|
@ -200,26 +200,26 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ChargeRegulatorMethodImageCharge : public ChargeRegulatorMethod {
|
class ChargeRegulatorMethodImageCharge : public ChargeRegulatorMethod {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** constructor */
|
/** constructor */
|
||||||
ChargeRegulatorMethodImageCharge(ChargeRegulator *chargeRegulator,
|
ChargeRegulatorMethodImageCharge(ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
||||||
|
|
||||||
/** destructor */
|
/** destructor */
|
||||||
~ChargeRegulatorMethodImageCharge(){};
|
~ChargeRegulatorMethodImageCharge(){};
|
||||||
|
|
||||||
/** initialize */
|
/** initialize */
|
||||||
virtual void initialize(void);
|
virtual void initialize(void);
|
||||||
|
|
||||||
/** post first verlet step */
|
/** post first verlet step */
|
||||||
virtual void apply_post_force(double dt);
|
virtual void apply_post_force(double dt);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double reflect(DENS_VEC & x) const {
|
double reflect(DENS_VEC & x) const {
|
||||||
double dn = (x-point_).dot(normal_);
|
double dn = (x-point_).dot(normal_);
|
||||||
x -= 2*dn*normal_;
|
x -= 2*dn*normal_;
|
||||||
return dn;
|
return dn;
|
||||||
}
|
}
|
||||||
// internal functions
|
// internal functions
|
||||||
|
@ -229,8 +229,8 @@ namespace ATC {
|
||||||
|
|
||||||
double layerDepth_;
|
double layerDepth_;
|
||||||
double permittivityRatio_;
|
double permittivityRatio_;
|
||||||
NSET & imageNodes_;
|
NSET & imageNodes_;
|
||||||
DENS_MAT imageTransferOp_;
|
DENS_MAT imageTransferOp_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChargeRegulatorMethodImageCharge(); // DO NOT define this
|
ChargeRegulatorMethodImageCharge(); // DO NOT define this
|
||||||
|
@ -244,21 +244,21 @@ namespace ATC {
|
||||||
class ChargeRegulatorMethodEffectiveCharge : public ChargeRegulatorMethod {
|
class ChargeRegulatorMethodEffectiveCharge : public ChargeRegulatorMethod {
|
||||||
|
|
||||||
typedef std::map<int,std::pair<DENS_VEC,double> > NODE_TO_XF_MAP;
|
typedef std::map<int,std::pair<DENS_VEC,double> > NODE_TO_XF_MAP;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** constructor */
|
/** constructor */
|
||||||
ChargeRegulatorMethodEffectiveCharge(ChargeRegulator *chargeRegulator,
|
ChargeRegulatorMethodEffectiveCharge(ChargeRegulator *chargeRegulator,
|
||||||
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
ChargeRegulator::ChargeRegulatorParameters & parameters);
|
||||||
|
|
||||||
/** destructor */
|
/** destructor */
|
||||||
~ChargeRegulatorMethodEffectiveCharge(){};
|
~ChargeRegulatorMethodEffectiveCharge(){};
|
||||||
|
|
||||||
/** initialize */
|
/** initialize */
|
||||||
virtual void initialize(void);
|
virtual void initialize(void);
|
||||||
|
|
||||||
/** post first verlet step */
|
/** post first verlet step */
|
||||||
virtual void apply_post_force(double dt);
|
virtual void apply_post_force(double dt);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// internal functions
|
// internal functions
|
||||||
|
@ -268,7 +268,7 @@ namespace ATC {
|
||||||
double chargeDensity_;
|
double chargeDensity_;
|
||||||
std::map<int,double> nodalChargePotential_;
|
std::map<int,double> nodalChargePotential_;
|
||||||
|
|
||||||
NODE_TO_XF_MAP nodeXFMap_;
|
NODE_TO_XF_MAP nodeXFMap_;
|
||||||
|
|
||||||
bool useSlab_;
|
bool useSlab_;
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ namespace ATC {
|
||||||
private:
|
private:
|
||||||
ChargeRegulatorMethodEffectiveCharge(); // DO NOT define this
|
ChargeRegulatorMethodEffectiveCharge(); // DO NOT define this
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
namespace ATC_matrix {
|
namespace ATC_matrix {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class CloneVector
|
* @class CloneVector
|
||||||
* @brief Class for creating objects that wrap matrix data for manipulation through vector operations
|
* @brief Class for creating objects that wrap matrix data for manipulation through vector operations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _resize(INDEX nRows, INDEX nCols, bool copy, bool zero);
|
void _resize(INDEX nRows, INDEX nCols, bool copy, bool zero);
|
||||||
|
|
||||||
Vector<T> * const _baseV; // ptr to a base vector
|
Vector<T> * const _baseV; // ptr to a base vector
|
||||||
Matrix<T> * const _baseM; // ptr to a base matrix
|
Matrix<T> * const _baseM; // ptr to a base matrix
|
||||||
int _clone_type; // what to clone (see enum CLONE_TYPE)
|
int _clone_type; // what to clone (see enum CLONE_TYPE)
|
||||||
|
@ -52,7 +52,7 @@ private:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
CloneVector<T>::CloneVector(const Vector<T> &c)
|
CloneVector<T>::CloneVector(const Vector<T> &c)
|
||||||
: Vector<T>(), _baseV(const_cast<Vector<T>*>(&c)), _baseM(nullptr)
|
: Vector<T>(), _baseV(const_cast<Vector<T>*>(&c)), _baseM(nullptr)
|
||||||
{}
|
{}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Construct from a matrix, the const_cast isn't pretty
|
// Construct from a matrix, the const_cast isn't pretty
|
||||||
|
@ -64,7 +64,7 @@ CloneVector<T>::CloneVector(const Vector<T> &c)
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
|
CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
|
||||||
: Vector<T>(), _baseV(nullptr), _baseM(const_cast<Matrix<T>*>(&c))
|
: Vector<T>(), _baseV(nullptr), _baseM(const_cast<Matrix<T>*>(&c))
|
||||||
, _clone_type(dim), _idx(idx)
|
, _clone_type(dim), _idx(idx)
|
||||||
{}
|
{}
|
||||||
|
@ -72,7 +72,7 @@ CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
|
||||||
// Construct from a DiagonalMatrix
|
// Construct from a DiagonalMatrix
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
CloneVector<T>::CloneVector(const DiagonalMatrix<T> &c, INDEX /* idx */)
|
CloneVector<T>::CloneVector(const DiagonalMatrix<T> &c, INDEX /* idx */)
|
||||||
: Vector<T>(), _baseV(nullptr), _baseM(const_cast<DiagonalMatrix<T>*>(&c))
|
: Vector<T>(), _baseV(nullptr), _baseM(const_cast<DiagonalMatrix<T>*>(&c))
|
||||||
, _clone_type(CLONE_DIAG), _idx(0)
|
, _clone_type(CLONE_DIAG), _idx(0)
|
||||||
{}
|
{}
|
||||||
|
@ -80,7 +80,7 @@ CloneVector<T>::CloneVector(const DiagonalMatrix<T> &c, INDEX /* idx */)
|
||||||
// value (const) indexing operator
|
// value (const) indexing operator
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T CloneVector<T>::operator()(INDEX i, INDEX /* j */) const
|
T CloneVector<T>::operator()(INDEX i, INDEX /* j */) const
|
||||||
{
|
{
|
||||||
return (*this)[i];
|
return (*this)[i];
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ INDEX CloneVector<T>::nRows() const
|
||||||
template<typename T>
|
template<typename T>
|
||||||
CloneVector<T>& CloneVector<T>::operator=(const T &v)
|
CloneVector<T>& CloneVector<T>::operator=(const T &v)
|
||||||
{
|
{
|
||||||
this->set_all_elements_to(v);
|
this->set_all_elements_to(v);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -144,7 +144,7 @@ template<typename T>
|
||||||
CloneVector<T>& CloneVector<T>::operator=(const CloneVector<T> &C)
|
CloneVector<T>& CloneVector<T>::operator=(const CloneVector<T> &C)
|
||||||
{
|
{
|
||||||
GCK(*this, C, this->size()!=C.size(), "Error in CloneVector:operator=");
|
GCK(*this, C, this->size()!=C.size(), "Error in CloneVector:operator=");
|
||||||
int sz = this->size();
|
int sz = this->size();
|
||||||
for (INDEX i = 0; i < sz; i++) (*this)[i] = C[i];
|
for (INDEX i = 0; i < sz; i++) (*this)[i] = C[i];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ template<typename T>
|
||||||
CloneVector<T>& CloneVector<T>::operator=(const Matrix<T> &C)
|
CloneVector<T>& CloneVector<T>::operator=(const Matrix<T> &C)
|
||||||
{
|
{
|
||||||
GCK(*this, C, this->size()!=C.size(), "Error in CloneVector:operator=");
|
GCK(*this, C, this->size()!=C.size(), "Error in CloneVector:operator=");
|
||||||
int sz = this->size();
|
int sz = this->size();
|
||||||
for (INDEX i = 0; i < sz; i++) (*this)[i] = C[i];
|
for (INDEX i = 0; i < sz; i++) (*this)[i] = C[i];
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ bool CloneVector<T>::memory_contiguous() const
|
||||||
// drill down through clone of clones
|
// drill down through clone of clones
|
||||||
if (_baseV) return _baseV->memory_contiguous();
|
if (_baseV) return _baseV->memory_contiguous();
|
||||||
// could be okay if DiagonalMatrix, but can't guarantee this
|
// could be okay if DiagonalMatrix, but can't guarantee this
|
||||||
if (_clone_type == CLONE_DIAG) return false;
|
if (_clone_type == CLONE_DIAG) return false;
|
||||||
#ifdef ROW_STORAGE
|
#ifdef ROW_STORAGE
|
||||||
return _clone_type == CLONE_ROW;
|
return _clone_type == CLONE_ROW;
|
||||||
#else
|
#else
|
||||||
|
@ -199,7 +199,7 @@ T* CloneVector<T>::ptr() const
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void CloneVector<T>::_resize(INDEX nRows, INDEX nCols, bool copy, bool zero)
|
void CloneVector<T>::_resize(INDEX nRows, INDEX nCols, bool copy, bool zero)
|
||||||
{
|
{
|
||||||
if (_baseV)
|
if (_baseV)
|
||||||
{
|
{
|
||||||
if (copy) _baseV->resize(nRows, nCols, copy);
|
if (copy) _baseV->resize(nRows, nCols, copy);
|
||||||
else _baseV->reset (nRows, nCols, zero);
|
else _baseV->reset (nRows, nCols, zero);
|
||||||
|
@ -232,7 +232,7 @@ void CloneVector<T>::resize(INDEX nRows, INDEX nCols, bool copy)
|
||||||
_resize(nRows, nCols, copy, false);
|
_resize(nRows, nCols, copy, false);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// resizes the matrix and optionally zeros it out
|
// resizes the matrix and optionally zeros it out
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void CloneVector<T>::reset(INDEX nRows, INDEX nCols, bool zero)
|
void CloneVector<T>::reset(INDEX nRows, INDEX nCols, bool zero)
|
||||||
|
|
|
@ -41,7 +41,7 @@ const double kMinScale_ = 10000.;
|
||||||
}
|
}
|
||||||
if (parameters_.size()) parameters_.clear();
|
if (parameters_.size()) parameters_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify:
|
// modify:
|
||||||
// parses and adjusts charge regulator state based on
|
// parses and adjusts charge regulator state based on
|
||||||
|
@ -66,7 +66,7 @@ const double kMinScale_ = 10000.;
|
||||||
// consruct new ones
|
// consruct new ones
|
||||||
map<string, ConcentrationRegulatorParameters>::iterator itr;
|
map<string, ConcentrationRegulatorParameters>::iterator itr;
|
||||||
for (itr = parameters_.begin();
|
for (itr = parameters_.begin();
|
||||||
itr != parameters_.end(); itr++) {
|
itr != parameters_.end(); itr++) {
|
||||||
string tag = itr->first;
|
string tag = itr->first;
|
||||||
if (regulators_.find(tag) != regulators_.end()) delete regulators_[tag];
|
if (regulators_.find(tag) != regulators_.end()) delete regulators_[tag];
|
||||||
ConcentrationRegulatorParameters & p = itr->second;
|
ConcentrationRegulatorParameters & p = itr->second;
|
||||||
|
@ -82,7 +82,7 @@ const double kMinScale_ = 10000.;
|
||||||
regulators_[tag] = new ConcentrationRegulatorMethodTransition(this,p);
|
regulators_[tag] = new ConcentrationRegulatorMethodTransition(this,p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw ATC_Error("ConcentrationRegulator::initialize unknown concentration regulator type");
|
throw ATC_Error("ConcentrationRegulator::initialize unknown concentration regulator type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,12 +93,12 @@ const double kMinScale_ = 10000.;
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ConcentrationRegulator::initialize()
|
void ConcentrationRegulator::initialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
map<string, ConcentrationRegulatorMethod *>::iterator itr;
|
map<string, ConcentrationRegulatorMethod *>::iterator itr;
|
||||||
for (itr = regulators_.begin();
|
for (itr = regulators_.begin();
|
||||||
itr != regulators_.end(); itr++) { itr->second->initialize(); }
|
itr != regulators_.end(); itr++) { itr->second->initialize(); }
|
||||||
|
|
||||||
atc_->set_boundary_integration_type(boundaryIntegrationType_);
|
atc_->set_boundary_integration_type(boundaryIntegrationType_);
|
||||||
AtomicRegulator::reset_nlocal();
|
AtomicRegulator::reset_nlocal();
|
||||||
AtomicRegulator::delete_unused_data();
|
AtomicRegulator::delete_unused_data();
|
||||||
needReset_ = false;
|
needReset_ = false;
|
||||||
|
@ -157,7 +157,7 @@ const double kMinScale_ = 10000.;
|
||||||
|
|
||||||
map<string, ConcentrationRegulatorMethod *>::const_iterator itr;
|
map<string, ConcentrationRegulatorMethod *>::const_iterator itr;
|
||||||
for (itr = regulators_.begin();
|
for (itr = regulators_.begin();
|
||||||
itr != regulators_.end(); itr++) {
|
itr != regulators_.end(); itr++) {
|
||||||
if (c++ == n) { return itr->second->compute_vector(m); }
|
if (c++ == n) { return itr->second->compute_vector(m); }
|
||||||
}
|
}
|
||||||
return 0.;
|
return 0.;
|
||||||
|
@ -168,34 +168,34 @@ const double kMinScale_ = 10000.;
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
int ConcentrationRegulator::size_vector(int /* i */) const
|
int ConcentrationRegulator::size_vector(int /* i */) const
|
||||||
{
|
{
|
||||||
int n = (regulators_.size())*5;
|
int n = (regulators_.size())*5;
|
||||||
if (n==0) n = 20;
|
if (n==0) n = 20;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================
|
//========================================================
|
||||||
// Class ConcentrationRegulatorMethodTransition
|
// Class ConcentrationRegulatorMethodTransition
|
||||||
//========================================================
|
//========================================================
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and ConcentrationRegulator
|
// Grab references to ATC and ConcentrationRegulator
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ConcentrationRegulatorMethodTransition::ConcentrationRegulatorMethodTransition
|
ConcentrationRegulatorMethodTransition::ConcentrationRegulatorMethodTransition
|
||||||
(ConcentrationRegulator *concReg,
|
(ConcentrationRegulator *concReg,
|
||||||
ConcentrationRegulator::ConcentrationRegulatorParameters & p)
|
ConcentrationRegulator::ConcentrationRegulatorParameters & p)
|
||||||
: ConcentrationRegulatorMethod(concReg),
|
: ConcentrationRegulatorMethod(concReg),
|
||||||
concentrationRegulator_(concReg),
|
concentrationRegulator_(concReg),
|
||||||
interscaleManager_(nullptr),
|
interscaleManager_(nullptr),
|
||||||
lammpsInterface_(LammpsInterface::instance()),
|
lammpsInterface_(LammpsInterface::instance()),
|
||||||
list_(nullptr),
|
list_(nullptr),
|
||||||
targetConcentration_(p.value),
|
targetConcentration_(p.value),
|
||||||
targetCount_(0),
|
targetCount_(0),
|
||||||
elemset_(p.elemset),
|
elemset_(p.elemset),
|
||||||
p_(nullptr),
|
p_(nullptr),
|
||||||
randomNumberGenerator_(nullptr),
|
randomNumberGenerator_(nullptr),
|
||||||
q0_(0),
|
q0_(0),
|
||||||
controlType_(p.type),
|
controlType_(p.type),
|
||||||
controlIndex_(0),
|
controlIndex_(0),
|
||||||
transitionType_(p.transitionType),
|
transitionType_(p.transitionType),
|
||||||
transitionInterval_(p.transitionInterval),
|
transitionInterval_(p.transitionInterval),
|
||||||
|
@ -241,7 +241,7 @@ const double kMinScale_ = 10000.;
|
||||||
|
|
||||||
PerAtomQuantity<int> * a2el = atc_->atom_to_element_map();
|
PerAtomQuantity<int> * a2el = atc_->atom_to_element_map();
|
||||||
list_ = new AtomInElementSet(atc_,a2el,elemset_,controlType_);
|
list_ = new AtomInElementSet(atc_,a2el,elemset_,controlType_);
|
||||||
|
|
||||||
nNodes_ = atc_->num_nodes();
|
nNodes_ = atc_->num_nodes();
|
||||||
DENS_MAT conc(nNodes_,1); conc = targetConcentration_;
|
DENS_MAT conc(nNodes_,1); conc = targetConcentration_;
|
||||||
DENS_VEC integral = atc_->fe_engine()->integrate(conc,elemset_);
|
DENS_VEC integral = atc_->fe_engine()->integrate(conc,elemset_);
|
||||||
|
@ -250,7 +250,7 @@ const double kMinScale_ = 10000.;
|
||||||
volumes_.resize(elemset_.size());
|
volumes_.resize(elemset_.size());
|
||||||
ESET::const_iterator itr;
|
ESET::const_iterator itr;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
DENS_MAT c(nNodes_,1); c = 1;
|
DENS_MAT c(nNodes_,1); c = 1;
|
||||||
V_ = 0.;
|
V_ = 0.;
|
||||||
for (itr = elemset_.begin(); itr != elemset_.end(); itr++, i++) {
|
for (itr = elemset_.begin(); itr != elemset_.end(); itr++, i++) {
|
||||||
ESET e; e.insert(*itr);
|
ESET e; e.insert(*itr);
|
||||||
|
@ -261,14 +261,14 @@ const double kMinScale_ = 10000.;
|
||||||
volumes_ *= 1./V_;
|
volumes_ *= 1./V_;
|
||||||
for (int i = 1; i < volumes_.size(); i++) {
|
for (int i = 1; i < volumes_.size(); i++) {
|
||||||
volumes_(i) += volumes_(i-1);
|
volumes_(i) += volumes_(i-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// record original energetic properties
|
// record original energetic properties
|
||||||
int ntypes = lammpsInterface_->ntypes();
|
int ntypes = lammpsInterface_->ntypes();
|
||||||
epsilon0_.reset(ntypes);
|
epsilon0_.reset(ntypes);
|
||||||
p_ = lammpsInterface_->potential();
|
p_ = lammpsInterface_->potential();
|
||||||
lammpsInterface_->epsilons(controlType_,p_,epsilon0_.ptr());
|
lammpsInterface_->epsilons(controlType_,p_,epsilon0_.ptr());
|
||||||
|
|
||||||
#ifdef ATC_VERBOSE
|
#ifdef ATC_VERBOSE
|
||||||
string msg = "type "+to_string(controlType_)+" target count " + to_string(targetCount_);
|
string msg = "type "+to_string(controlType_)+" target count " + to_string(targetCount_);
|
||||||
msg += " volume " + to_string(V_);
|
msg += " volume " + to_string(V_);
|
||||||
|
@ -280,11 +280,11 @@ const double kMinScale_ = 10000.;
|
||||||
}
|
}
|
||||||
double ConcentrationRegulatorMethodTransition::uniform() const {
|
double ConcentrationRegulatorMethodTransition::uniform() const {
|
||||||
_rngUniformCounter_++;
|
_rngUniformCounter_++;
|
||||||
return lammpsInterface_->random_uniform(randomNumberGenerator_);
|
return lammpsInterface_->random_uniform(randomNumberGenerator_);
|
||||||
}
|
}
|
||||||
double ConcentrationRegulatorMethodTransition::normal() const {
|
double ConcentrationRegulatorMethodTransition::normal() const {
|
||||||
_rngNormalCounter_++;
|
_rngNormalCounter_++;
|
||||||
return lammpsInterface_->random_normal(randomNumberGenerator_);
|
return lammpsInterface_->random_normal(randomNumberGenerator_);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// pre exchange
|
// pre exchange
|
||||||
|
@ -294,7 +294,7 @@ const double kMinScale_ = 10000.;
|
||||||
// return if should not be called on this timestep
|
// return if should not be called on this timestep
|
||||||
if ( ! lammpsInterface_->now(frequency_)) return;
|
if ( ! lammpsInterface_->now(frequency_)) return;
|
||||||
nexchanges_ = excess();
|
nexchanges_ = excess();
|
||||||
int n = abs(nexchanges_);
|
int n = abs(nexchanges_);
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (nexchanges_ > 0) { success = delete_atoms(n); }
|
if (nexchanges_ > 0) { success = delete_atoms(n); }
|
||||||
else if (nexchanges_ < 0) { success = insert_atoms(n); }
|
else if (nexchanges_ < 0) { success = insert_atoms(n); }
|
||||||
|
@ -308,7 +308,7 @@ const double kMinScale_ = 10000.;
|
||||||
}
|
}
|
||||||
transitionCounter_=0;
|
transitionCounter_=0;
|
||||||
transition();
|
transition();
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// pre force
|
// pre force
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -319,28 +319,28 @@ const double kMinScale_ = 10000.;
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// accept
|
// accept
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool ConcentrationRegulatorMethodTransition::accept(double energy, double /* T */) const
|
bool ConcentrationRegulatorMethodTransition::accept(double energy, double /* T */) const
|
||||||
{
|
{
|
||||||
#ifdef ATC_VERBOSE2
|
#ifdef ATC_VERBOSE2
|
||||||
if (energy < maxEnergy_) lammpsInterface_->print_msg(" energy "+to_string(energy)+" "+to_string(rngCounter_));
|
if (energy < maxEnergy_) lammpsInterface_->print_msg(" energy "+to_string(energy)+" "+to_string(rngCounter_));
|
||||||
#endif
|
#endif
|
||||||
return (energy < maxEnergy_);
|
return (energy < maxEnergy_);
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// energy
|
// energy
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
double ConcentrationRegulatorMethodTransition::energy(int id) const
|
double ConcentrationRegulatorMethodTransition::energy(int id) const
|
||||||
{
|
{
|
||||||
double e = lammpsInterface_->shortrange_energy(id,maxEnergy_);
|
double e = lammpsInterface_->shortrange_energy(id,maxEnergy_);
|
||||||
#ifdef ATC_VERBOSE
|
#ifdef ATC_VERBOSE
|
||||||
{
|
{
|
||||||
int * tag = lammpsInterface_->atom_tag();
|
int * tag = lammpsInterface_->atom_tag();
|
||||||
lammpsInterface_->print_msg(to_string(controlType_)+" deletion energy "+to_string(e)+" id "+to_string(tag[id])+" "+to_string(_rngUniformCounter_)+":"+to_string(_rngNormalCounter_));
|
lammpsInterface_->print_msg(to_string(controlType_)+" deletion energy "+to_string(e)+" id "+to_string(tag[id])+" "+to_string(_rngUniformCounter_)+":"+to_string(_rngNormalCounter_));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
double ConcentrationRegulatorMethodTransition::energy(double * x) const
|
double ConcentrationRegulatorMethodTransition::energy(double * x) const
|
||||||
{
|
{
|
||||||
double e = lammpsInterface_->shortrange_energy(x,controlType_,maxEnergy_);
|
double e = lammpsInterface_->shortrange_energy(x,controlType_,maxEnergy_);
|
||||||
#ifdef ATC_VERBOSE
|
#ifdef ATC_VERBOSE
|
||||||
|
@ -375,8 +375,8 @@ const double kMinScale_ = 10000.;
|
||||||
bool ConcentrationRegulatorMethodTransition::delete_atoms(int n)
|
bool ConcentrationRegulatorMethodTransition::delete_atoms(int n)
|
||||||
{
|
{
|
||||||
ID_PAIR idPair;
|
ID_PAIR idPair;
|
||||||
|
|
||||||
deletionIds_.clear();
|
deletionIds_.clear();
|
||||||
int deletions = 0;
|
int deletions = 0;
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
while(deletions < n && attempts < maxAttempts_){
|
while(deletions < n && attempts < maxAttempts_){
|
||||||
|
@ -406,7 +406,7 @@ const double kMinScale_ = 10000.;
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
double ConcentrationRegulatorMethodTransition::deletion_id(ID_PAIR & id) const
|
double ConcentrationRegulatorMethodTransition::deletion_id(ID_PAIR & id) const
|
||||||
{
|
{
|
||||||
if (atc_->parallel_consistency()) return deletion_id_consistent(id);
|
if (atc_->parallel_consistency()) return deletion_id_consistent(id);
|
||||||
else return deletion_id_free(id);
|
else return deletion_id_free(id);
|
||||||
}
|
}
|
||||||
double ConcentrationRegulatorMethodTransition::deletion_id_consistent(ID_PAIR & id) const
|
double ConcentrationRegulatorMethodTransition::deletion_id_consistent(ID_PAIR & id) const
|
||||||
|
@ -422,12 +422,12 @@ const double kMinScale_ = 10000.;
|
||||||
double min = ntotal;
|
double min = ntotal;
|
||||||
int * tag = lammpsInterface_->atom_tag();
|
int * tag = lammpsInterface_->atom_tag();
|
||||||
for (itr = list.begin(); itr != list.end(); itr++) {
|
for (itr = list.begin(); itr != list.end(); itr++) {
|
||||||
int atag = tag[itr->second];
|
int atag = tag[itr->second];
|
||||||
double d = fabs(atag-r);
|
double d = fabs(atag-r);
|
||||||
if (d < min) {
|
if (d < min) {
|
||||||
min = d;
|
min = d;
|
||||||
idx = i;
|
idx = i;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
int imin = kMinScale_*min;
|
int imin = kMinScale_*min;
|
||||||
|
@ -455,7 +455,7 @@ const double kMinScale_ = 10000.;
|
||||||
r *= ntotal;
|
r *= ntotal;
|
||||||
if ( (r >= nrank-n) && (r < nrank)) { // pick processor
|
if ( (r >= nrank-n) && (r < nrank)) { // pick processor
|
||||||
|
|
||||||
r = uniform();
|
r = uniform();
|
||||||
int idx = rnd(r*(n-1));
|
int idx = rnd(r*(n-1));
|
||||||
id = list_->item(idx);
|
id = list_->item(idx);
|
||||||
// avoid repeats
|
// avoid repeats
|
||||||
|
@ -463,7 +463,7 @@ const double kMinScale_ = 10000.;
|
||||||
l.erase(l.begin()+idx);
|
l.erase(l.begin()+idx);
|
||||||
return energy(id.second);
|
return energy(id.second);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return maxEnergy_;
|
return maxEnergy_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ const double kMinScale_ = 10000.;
|
||||||
{
|
{
|
||||||
|
|
||||||
insertionIds_.clear();
|
insertionIds_.clear();
|
||||||
DENS_VEC x(3); x = 0;
|
DENS_VEC x(3); x = 0;
|
||||||
DENS_VEC v(3); v = 0;
|
DENS_VEC v(3); v = 0;
|
||||||
const DENS_MAN & T = atc_->field(TEMPERATURE);
|
const DENS_MAN & T = atc_->field(TEMPERATURE);
|
||||||
int additions = 0;
|
int additions = 0;
|
||||||
|
@ -482,7 +482,7 @@ const double kMinScale_ = 10000.;
|
||||||
while(additions < n && attempts < maxAttempts_){
|
while(additions < n && attempts < maxAttempts_){
|
||||||
if(accept(insertion_location(x))) {
|
if(accept(insertion_location(x))) {
|
||||||
DENS_VEC Tv = atc_->fe_engine()->interpolate_field(x,T);
|
DENS_VEC Tv = atc_->fe_engine()->interpolate_field(x,T);
|
||||||
Tv(0) = 300.;
|
Tv(0) = 300.;
|
||||||
pick_velocity(v,Tv(0)); // 3 normal
|
pick_velocity(v,Tv(0)); // 3 normal
|
||||||
int nlocal = lammpsInterface_->insert_atom(transitionType_,controlMask_,x.ptr(),v.ptr()); // no charge
|
int nlocal = lammpsInterface_->insert_atom(transitionType_,controlMask_,x.ptr(),v.ptr()); // no charge
|
||||||
insertionIds_.push_back(pair<int,int>(-1,nlocal)); // atc id unknown
|
insertionIds_.push_back(pair<int,int>(-1,nlocal)); // atc id unknown
|
||||||
|
@ -540,7 +540,7 @@ Tv(0) = 300.;
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
double ConcentrationRegulatorMethodTransition::insertion_location(DENS_VEC & x) const
|
double ConcentrationRegulatorMethodTransition::insertion_location(DENS_VEC & x) const
|
||||||
{
|
{
|
||||||
// pick random element
|
// pick random element
|
||||||
int elem = pick_element(); // 1 uniform
|
int elem = pick_element(); // 1 uniform
|
||||||
// pick random local coordinate
|
// pick random local coordinate
|
||||||
DENS_VEC xi(3);
|
DENS_VEC xi(3);
|
||||||
|
@ -552,8 +552,8 @@ Tv(0) = 300.;
|
||||||
#endif
|
#endif
|
||||||
return energy(x.ptr());
|
return energy(x.ptr());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return maxEnergy_;
|
return maxEnergy_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -573,7 +573,7 @@ Tv(0) = 300.;
|
||||||
// pick coordinates
|
// pick coordinates
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ConcentrationRegulatorMethodTransition::pick_coordinates(const int elem,
|
void ConcentrationRegulatorMethodTransition::pick_coordinates(const int elem,
|
||||||
DENS_VEC & xi,
|
DENS_VEC & xi,
|
||||||
DENS_VEC & x) const
|
DENS_VEC & x) const
|
||||||
{
|
{
|
||||||
xi.reset(3);
|
xi.reset(3);
|
||||||
|
@ -600,9 +600,9 @@ Tv(0) = 300.;
|
||||||
void ConcentrationRegulatorMethodTransition::transition()
|
void ConcentrationRegulatorMethodTransition::transition()
|
||||||
{
|
{
|
||||||
transitionCounter_++;
|
transitionCounter_++;
|
||||||
//if (insertionIds_.size() == 0) return; //
|
//if (insertionIds_.size() == 0) return; //
|
||||||
if (transitionCounter_> transitionInterval_) {
|
if (transitionCounter_> transitionInterval_) {
|
||||||
nInTransition_ = 0;
|
nInTransition_ = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (transitionCounter_==transitionInterval_) {
|
else if (transitionCounter_==transitionInterval_) {
|
||||||
|
@ -611,10 +611,10 @@ Tv(0) = 300.;
|
||||||
else {
|
else {
|
||||||
transitionFactor_ = insertion_factor(transitionCounter_);
|
transitionFactor_ = insertion_factor(transitionCounter_);
|
||||||
if (nInTransition_ < 0) transitionFactor_ = 1-transitionFactor_;
|
if (nInTransition_ < 0) transitionFactor_ = 1-transitionFactor_;
|
||||||
double q = 0;
|
double q = 0;
|
||||||
lammpsInterface_->set_charge(transitionType_,q);
|
lammpsInterface_->set_charge(transitionType_,q);
|
||||||
DENS_VEC eps = epsilon0_;
|
DENS_VEC eps = epsilon0_;
|
||||||
|
|
||||||
lammpsInterface_->set_epsilons(transitionType_,p_,eps.ptr());
|
lammpsInterface_->set_epsilons(transitionType_,p_,eps.ptr());
|
||||||
lammpsInterface_->pair_reinit(); // epsilon
|
lammpsInterface_->pair_reinit(); // epsilon
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,7 @@ Tv(0) = 300.;
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
double ConcentrationRegulatorMethodTransition::compute_vector(int n) const
|
double ConcentrationRegulatorMethodTransition::compute_vector(int n) const
|
||||||
{
|
{
|
||||||
if (n==0) return count() - targetCount_;
|
if (n==0) return count() - targetCount_;
|
||||||
else if (n==1) return count()/V_;
|
else if (n==1) return count()/V_;
|
||||||
else if (n==2) return (1.-transitionFactor_)*nInTransition_;
|
else if (n==2) return (1.-transitionFactor_)*nInTransition_;
|
||||||
else if (n==3) return _rngUniformCounter_;
|
else if (n==3) return _rngUniformCounter_;
|
||||||
|
|
|
@ -16,13 +16,13 @@ namespace ATC {
|
||||||
|
|
||||||
class ConcentrationRegulatorMethod;
|
class ConcentrationRegulatorMethod;
|
||||||
class ConcentrationRegulator : public AtomicRegulator {
|
class ConcentrationRegulator : public AtomicRegulator {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ConcentrationRegulatorType {NONE=0,TRANSITION};
|
enum ConcentrationRegulatorType {NONE=0,TRANSITION};
|
||||||
/** parser data */
|
/** parser data */
|
||||||
struct ConcentrationRegulatorParameters {
|
struct ConcentrationRegulatorParameters {
|
||||||
ConcentrationRegulatorParameters():
|
ConcentrationRegulatorParameters():
|
||||||
method(NONE),
|
method(NONE),
|
||||||
type(0),
|
type(0),
|
||||||
groupbit(0),
|
groupbit(0),
|
||||||
transitionType(0),
|
transitionType(0),
|
||||||
|
@ -36,14 +36,14 @@ namespace ATC {
|
||||||
int type;
|
int type;
|
||||||
int groupbit;
|
int groupbit;
|
||||||
int transitionType;
|
int transitionType;
|
||||||
double value;
|
double value;
|
||||||
int frequency;
|
int frequency;
|
||||||
int transitionInterval;
|
int transitionInterval;
|
||||||
double maxEnergy;
|
double maxEnergy;
|
||||||
int maxExchanges;
|
int maxExchanges;
|
||||||
int maxAttempts;
|
int maxAttempts;
|
||||||
std::string transitionTag;
|
std::string transitionTag;
|
||||||
ESET elemset;
|
ESET elemset;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** constructor */
|
/** constructor */
|
||||||
|
@ -96,22 +96,22 @@ namespace ATC {
|
||||||
private:
|
private:
|
||||||
ConcentrationRegulator(); // DO NOT define this
|
ConcentrationRegulator(); // DO NOT define this
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ConcentrationRegulatorMethod
|
* @class ConcentrationRegulatorMethod
|
||||||
* @brief Base class for ConcentrationRegulator algorithms
|
* @brief Base class for ConcentrationRegulator algorithms
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ConcentrationRegulatorMethod : public RegulatorShapeFunction {
|
class ConcentrationRegulatorMethod : public RegulatorShapeFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConcentrationRegulatorMethod(ConcentrationRegulator *c)
|
ConcentrationRegulatorMethod(ConcentrationRegulator *c)
|
||||||
: RegulatorShapeFunction(c) {};
|
: RegulatorShapeFunction(c) {};
|
||||||
~ConcentrationRegulatorMethod() {};
|
~ConcentrationRegulatorMethod() {};
|
||||||
void initialize(void) {};
|
void initialize(void) {};
|
||||||
virtual void pre_force() {};
|
virtual void pre_force() {};
|
||||||
virtual void pre_exchange() {};
|
virtual void pre_exchange() {};
|
||||||
virtual void finish() {};
|
virtual void finish() {};
|
||||||
virtual void set_weights() {};
|
virtual void set_weights() {};
|
||||||
virtual double compute_vector(int /* n */) const { return 0;}
|
virtual double compute_vector(int /* n */) const { return 0;}
|
||||||
virtual void output(OUTPUT_LIST & /* outputData */){};
|
virtual void output(OUTPUT_LIST & /* outputData */){};
|
||||||
|
@ -124,7 +124,7 @@ namespace ATC {
|
||||||
* @brief GCMC + thermodynamic integration
|
* @brief GCMC + thermodynamic integration
|
||||||
*/
|
*/
|
||||||
class ConcentrationRegulatorMethodTransition : public ConcentrationRegulatorMethod {
|
class ConcentrationRegulatorMethodTransition : public ConcentrationRegulatorMethod {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** constructor */
|
/** constructor */
|
||||||
ConcentrationRegulatorMethodTransition(
|
ConcentrationRegulatorMethodTransition(
|
||||||
|
@ -135,11 +135,11 @@ namespace ATC {
|
||||||
if (randomNumberGenerator_) delete randomNumberGenerator_;
|
if (randomNumberGenerator_) delete randomNumberGenerator_;
|
||||||
}
|
}
|
||||||
/** initialize */
|
/** initialize */
|
||||||
void initialize(void);
|
void initialize(void);
|
||||||
/** prior to force evaluation */
|
/** prior to force evaluation */
|
||||||
virtual void pre_force();
|
virtual void pre_force();
|
||||||
/** prior to exchanges */
|
/** prior to exchanges */
|
||||||
virtual void pre_exchange();
|
virtual void pre_exchange();
|
||||||
/** "thermo" output */
|
/** "thermo" output */
|
||||||
virtual double compute_vector(int n) const;
|
virtual double compute_vector(int n) const;
|
||||||
protected:
|
protected:
|
||||||
|
@ -155,13 +155,13 @@ namespace ATC {
|
||||||
double deletion_id_free(ID_PAIR & id) const ;
|
double deletion_id_free(ID_PAIR & id) const ;
|
||||||
double insertion_factor(int c) const // a ramp
|
double insertion_factor(int c) const // a ramp
|
||||||
{
|
{
|
||||||
if (c < transitionInterval_) return ((double) c)/transitionInterval_;
|
if (c < transitionInterval_) return ((double) c)/transitionInterval_;
|
||||||
else return 1.0;
|
else return 1.0;
|
||||||
}
|
}
|
||||||
void transition();
|
void transition();
|
||||||
bool accept(double energy, double T = 0) const;
|
bool accept(double energy, double T = 0) const;
|
||||||
bool delete_atoms(int n);
|
bool delete_atoms(int n);
|
||||||
bool insert_atoms(int n);
|
bool insert_atoms(int n);
|
||||||
int pick_element() const;
|
int pick_element() const;
|
||||||
void pick_coordinates(const int elem, DENS_VEC & xi, DENS_VEC& x ) const;
|
void pick_coordinates(const int elem, DENS_VEC & xi, DENS_VEC& x ) const;
|
||||||
void pick_velocity(DENS_VEC & v, const double T ) const;
|
void pick_velocity(DENS_VEC & v, const double T ) const;
|
||||||
|
@ -179,9 +179,9 @@ namespace ATC {
|
||||||
|
|
||||||
/** member data */
|
/** member data */
|
||||||
class AtomInElementSet * list_;
|
class AtomInElementSet * list_;
|
||||||
double targetConcentration_;
|
double targetConcentration_;
|
||||||
double targetCount_;
|
double targetCount_;
|
||||||
ESET elemset_;
|
ESET elemset_;
|
||||||
POTENTIAL p_;
|
POTENTIAL p_;
|
||||||
RNG_POINTER randomNumberGenerator_;
|
RNG_POINTER randomNumberGenerator_;
|
||||||
DENS_VEC volumes_;
|
DENS_VEC volumes_;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
namespace ATC_matrix {
|
namespace ATC_matrix {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DenseMatrix
|
* @class DenseMatrix
|
||||||
* @brief Class for storing data in a "dense" matrix form
|
* @brief Class for storing data in a "dense" matrix form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -36,7 +36,7 @@ public:
|
||||||
DenseMatrix<T> mult_by_element(const DenseMatrix<T>& B) const;
|
DenseMatrix<T> mult_by_element(const DenseMatrix<T>& B) const;
|
||||||
/** returns by element multiply A_ij = this_ij / B_ij */
|
/** returns by element multiply A_ij = this_ij / B_ij */
|
||||||
DenseMatrix<T> div_by_element(const DenseMatrix<T>& B) const;
|
DenseMatrix<T> div_by_element(const DenseMatrix<T>& B) const;
|
||||||
|
|
||||||
/** overloaded virtual functions */
|
/** overloaded virtual functions */
|
||||||
//T& operator()(INDEX i, INDEX j) { MICK(i,j) return DATA(i,j); }
|
//T& operator()(INDEX i, INDEX j) { MICK(i,j) return DATA(i,j); }
|
||||||
T& operator()(INDEX i, INDEX j) { MICK(i,j) return DATA(i,j); }
|
T& operator()(INDEX i, INDEX j) { MICK(i,j) return DATA(i,j); }
|
||||||
|
@ -50,7 +50,7 @@ public:
|
||||||
void from_file(std::string & name);
|
void from_file(std::string & name);
|
||||||
void set_all_elements_to(const T &v);
|
void set_all_elements_to(const T &v);
|
||||||
DiagonalMatrix<T> diag() const;
|
DiagonalMatrix<T> diag() const;
|
||||||
|
|
||||||
DenseMatrix<T>& operator=(const T &v);
|
DenseMatrix<T>& operator=(const T &v);
|
||||||
DenseMatrix<T>& operator=(const Matrix<T> &c);
|
DenseMatrix<T>& operator=(const Matrix<T> &c);
|
||||||
DenseMatrix<T>& operator=(const DenseMatrix<T> &c);
|
DenseMatrix<T>& operator=(const DenseMatrix<T> &c);
|
||||||
|
@ -120,8 +120,8 @@ void DenseMatrix<T>::resize(INDEX rows, INDEX cols, bool copy)
|
||||||
_delete();
|
_delete();
|
||||||
_create(rows, cols);
|
_create(rows, cols);
|
||||||
int szi = this->nRows();
|
int szi = this->nRows();
|
||||||
int szj = this->nCols();
|
int szj = this->nCols();
|
||||||
for (INDEX i = 0; i < szi; i++)
|
for (INDEX i = 0; i < szi; i++)
|
||||||
for (INDEX j = 0; j < szj; j++)
|
for (INDEX j = 0; j < szj; j++)
|
||||||
(*this)(i,j) = temp.in_range(i,j) ? temp(i,j) : T(0);
|
(*this)(i,j) = temp.in_range(i,j) ? temp(i,j) : T(0);
|
||||||
}
|
}
|
||||||
|
@ -153,22 +153,22 @@ DenseMatrix<T> DenseMatrix<T>::mult_by_element(const DenseMatrix<T>& B) const
|
||||||
DenseMatrix C;
|
DenseMatrix C;
|
||||||
C.reset(_nRows,_nCols);
|
C.reset(_nRows,_nCols);
|
||||||
if (B.nCols() == _nCols) {
|
if (B.nCols() == _nCols) {
|
||||||
int szi = this->nRows();
|
int szi = this->nRows();
|
||||||
int szj = this->nCols();
|
int szj = this->nCols();
|
||||||
for (INDEX i = 0; i < szi; i++)
|
for (INDEX i = 0; i < szi; i++)
|
||||||
for (INDEX j = 0; j < szj; j++)
|
for (INDEX j = 0; j < szj; j++)
|
||||||
C(i,j) = (*this)(i,j)*B(i,j);
|
C(i,j) = (*this)(i,j)*B(i,j);
|
||||||
}
|
}
|
||||||
else if (B.nCols() == 1) {
|
else if (B.nCols() == 1) {
|
||||||
std::cout << "MULTIPLYING\n";
|
std::cout << "MULTIPLYING\n";
|
||||||
int szi = this->nRows();
|
int szi = this->nRows();
|
||||||
int szj = this->nCols();
|
int szj = this->nCols();
|
||||||
for (INDEX i = 0; i < szi; i++)
|
for (INDEX i = 0; i < szi; i++)
|
||||||
for (INDEX j = 0; j < szj; j++)
|
for (INDEX j = 0; j < szj; j++)
|
||||||
C(i,j) = (*this)(i,j)*B(i,0);
|
C(i,j) = (*this)(i,j)*B(i,0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SSCK(B, *this, "DenseMatrix::mult_by_element");
|
SSCK(B, *this, "DenseMatrix::mult_by_element");
|
||||||
}
|
}
|
||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
@ -182,21 +182,21 @@ DenseMatrix<T> DenseMatrix<T>::div_by_element(const DenseMatrix<T>& B) const
|
||||||
C.reset(_nRows,_nCols);
|
C.reset(_nRows,_nCols);
|
||||||
|
|
||||||
if (B.nCols() == _nCols) {
|
if (B.nCols() == _nCols) {
|
||||||
int szi = this->nRows();
|
int szi = this->nRows();
|
||||||
int szj = this->nCols();
|
int szj = this->nCols();
|
||||||
for (INDEX i = 0; i < szi; i++)
|
for (INDEX i = 0; i < szi; i++)
|
||||||
for (INDEX j = 0; j < szj; j++)
|
for (INDEX j = 0; j < szj; j++)
|
||||||
C(i,j) = (*this)(i,j)/B(i,j);
|
C(i,j) = (*this)(i,j)/B(i,j);
|
||||||
}
|
}
|
||||||
else if (B.nCols() == 1) {
|
else if (B.nCols() == 1) {
|
||||||
int szi = this->nRows();
|
int szi = this->nRows();
|
||||||
int szj = this->nCols();
|
int szj = this->nCols();
|
||||||
for (INDEX i = 0; i < szi; i++)
|
for (INDEX i = 0; i < szi; i++)
|
||||||
for (INDEX j = 0; j < szj; j++)
|
for (INDEX j = 0; j < szj; j++)
|
||||||
C(i,j) = (*this)(i,j)/B(i,0);
|
C(i,j) = (*this)(i,j)/B(i,0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SSCK(B, *this, "DenseMatrix::div_by_element");
|
SSCK(B, *this, "DenseMatrix::div_by_element");
|
||||||
}
|
}
|
||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void DenseMatrix<T>::write_restart(FILE *f) const
|
||||||
// reads matrix from text file (matrix needs to be sized)
|
// reads matrix from text file (matrix needs to be sized)
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DenseMatrix<T>::from_file(std::string & name)
|
void DenseMatrix<T>::from_file(std::string & name)
|
||||||
{
|
{
|
||||||
GCHK(_nRows == 0,"from_file needs nRows > 0");
|
GCHK(_nRows == 0,"from_file needs nRows > 0");
|
||||||
GCHK(_nCols == 0,"from_file needs nCols > 0");
|
GCHK(_nCols == 0,"from_file needs nCols > 0");
|
||||||
|
@ -223,10 +223,10 @@ void DenseMatrix<T>::from_file(std::string & name)
|
||||||
char line[lineSize];
|
char line[lineSize];
|
||||||
if (! in.good()) gerror(name+" is not available");
|
if (! in.good()) gerror(name+" is not available");
|
||||||
in.getline(line,lineSize); // header
|
in.getline(line,lineSize); // header
|
||||||
int szi = this->nRows();
|
int szi = this->nRows();
|
||||||
int szj = this->nCols();
|
int szj = this->nCols();
|
||||||
for (INDEX i = 0; i < szi; i++)
|
for (INDEX i = 0; i < szi; i++)
|
||||||
for (INDEX j = 0; j < szj; j++)
|
for (INDEX j = 0; j < szj; j++)
|
||||||
in >> (*this)(i,j);
|
in >> (*this)(i,j);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -239,15 +239,15 @@ inline void DenseMatrix<T>::set_all_elements_to(const T &v)
|
||||||
for (INDEX i = 0; i < sz; i++) _data[i] = v;
|
for (INDEX i = 0; i < sz; i++) _data[i] = v;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Return a diagonal matrix containing the diagonal entries of this matrix
|
// Return a diagonal matrix containing the diagonal entries of this matrix
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DiagonalMatrix<T> DenseMatrix<T>::diag() const
|
DiagonalMatrix<T> DenseMatrix<T>::diag() const
|
||||||
{
|
{
|
||||||
DiagonalMatrix<T> D(nRows(), true); // initialized to zero
|
DiagonalMatrix<T> D(nRows(), true); // initialized to zero
|
||||||
INDEX i;
|
INDEX i;
|
||||||
for (i=0; i<nRows(); i++)
|
for (i=0; i<nRows(); i++)
|
||||||
{
|
{
|
||||||
D(i,i) = DATA(i,i);
|
D(i,i) = DATA(i,i);
|
||||||
}
|
}
|
||||||
return D;
|
return D;
|
||||||
|
@ -259,7 +259,7 @@ template <typename T>
|
||||||
void DenseMatrix<T>::_delete()
|
void DenseMatrix<T>::_delete()
|
||||||
{
|
{
|
||||||
_nRows = _nCols = 0;
|
_nRows = _nCols = 0;
|
||||||
if (_data){
|
if (_data){
|
||||||
delete [] _data;
|
delete [] _data;
|
||||||
_data = nullptr;
|
_data = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ template <typename T>
|
||||||
void DenseMatrix<T>::_create(INDEX rows, INDEX cols, bool zero)
|
void DenseMatrix<T>::_create(INDEX rows, INDEX cols, bool zero)
|
||||||
{
|
{
|
||||||
|
|
||||||
_nRows=rows;
|
_nRows=rows;
|
||||||
_nCols=cols;
|
_nCols=cols;
|
||||||
_data = (this->size() ? new T [_nCols*_nRows] : nullptr);
|
_data = (this->size() ? new T [_nCols*_nRows] : nullptr);
|
||||||
if (zero) this->zero();
|
if (zero) this->zero();
|
||||||
|
@ -280,14 +280,14 @@ void DenseMatrix<T>::_create(INDEX rows, INDEX cols, bool zero)
|
||||||
// creates a deep memory copy from a general matrix
|
// creates a deep memory copy from a general matrix
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DenseMatrix<T>::_copy(const Matrix<T> &c)
|
void DenseMatrix<T>::_copy(const Matrix<T> &c)
|
||||||
{
|
{
|
||||||
if (!_data || this->size()!=c.size())
|
if (!_data || this->size()!=c.size())
|
||||||
{
|
{
|
||||||
_delete();
|
_delete();
|
||||||
_create(c.nRows(), c.nCols());
|
_create(c.nRows(), c.nCols());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_nRows = c.nRows();
|
_nRows = c.nRows();
|
||||||
_nCols = c.nCols();
|
_nCols = c.nCols();
|
||||||
|
@ -295,7 +295,7 @@ void DenseMatrix<T>::_copy(const Matrix<T> &c)
|
||||||
memcpy(_data, c.ptr(), c.size()*sizeof(T));
|
memcpy(_data, c.ptr(), c.size()*sizeof(T));
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// sets all elements to a constant
|
// sets all elements to a constant
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
DenseMatrix<T>& DenseMatrix<T>::operator=(const T &v)
|
DenseMatrix<T>& DenseMatrix<T>::operator=(const T &v)
|
||||||
|
@ -355,9 +355,9 @@ void DenseMatrix<T>::_set_equal(const Matrix<T> &r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//* Returns the transpose of the cofactor matrix of A.
|
//* Returns the transpose of the cofactor matrix of A.
|
||||||
//* see http://en.wikipedia.org/wiki/Adjugate_matrix
|
//* see http://en.wikipedia.org/wiki/Adjugate_matrix
|
||||||
//* symmetric flag only affects cases N>3
|
//* symmetric flag only affects cases N>3
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DenseMatrix<T> adjugate(const Matrix<T> &A, bool symmetric)
|
DenseMatrix<T> adjugate(const Matrix<T> &A, bool symmetric)
|
||||||
{
|
{
|
||||||
if (!A.is_square()) gerror("adjugate can only be computed for square matrices.");
|
if (!A.is_square()) gerror("adjugate can only be computed for square matrices.");
|
||||||
|
@ -365,7 +365,7 @@ DenseMatrix<T> adjugate(const Matrix<T> &A, bool symmetric)
|
||||||
switch (A.nRows()) {
|
switch (A.nRows()) {
|
||||||
case 1:
|
case 1:
|
||||||
gerror("adjugate must be computed for matrixes of size greater than 1");
|
gerror("adjugate must be computed for matrixes of size greater than 1");
|
||||||
case 2:
|
case 2:
|
||||||
C(0,0) = A(1,1); C(0,1) =-A(0,1);
|
C(0,0) = A(1,1); C(0,1) =-A(0,1);
|
||||||
C(1,0) =-A(1,0); C(1,1) = A(0,0);
|
C(1,0) =-A(1,0); C(1,1) = A(0,0);
|
||||||
break;
|
break;
|
||||||
|
@ -377,18 +377,18 @@ DenseMatrix<T> adjugate(const Matrix<T> &A, bool symmetric)
|
||||||
C(1,1) = A(0,0)*A(2,2)-A(0,2)*A(2,0);
|
C(1,1) = A(0,0)*A(2,2)-A(0,2)*A(2,0);
|
||||||
C(2,1) =-A(0,0)*A(2,1)+A(0,1)*A(2,0); // i+j is odd
|
C(2,1) =-A(0,0)*A(2,1)+A(0,1)*A(2,0); // i+j is odd
|
||||||
C(0,2) = A(0,1)*A(1,2)-A(0,2)*A(1,1);
|
C(0,2) = A(0,1)*A(1,2)-A(0,2)*A(1,1);
|
||||||
C(1,2) =-A(0,0)*A(1,2)+A(0,2)*A(1,0); // i+j is odd
|
C(1,2) =-A(0,0)*A(1,2)+A(0,2)*A(1,0); // i+j is odd
|
||||||
C(2,2) = A(0,0)*A(1,1)-A(0,1)*A(1,0);
|
C(2,2) = A(0,0)*A(1,1)-A(0,1)*A(1,0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// this feature is neither tested nor optimal - use at your own risk!!!
|
// this feature is neither tested nor optimal - use at your own risk!!!
|
||||||
DenseMatrix<T> m(A.nRows()-1, A.nRows()-1);
|
DenseMatrix<T> m(A.nRows()-1, A.nRows()-1);
|
||||||
double sign[] = {1.0, -1.0};
|
double sign[] = {1.0, -1.0};
|
||||||
for (INDEX j=0; j<A.nCols(); j++) {
|
for (INDEX j=0; j<A.nCols(); j++) {
|
||||||
for (INDEX i=0; i<A.nRows(); i++) {
|
for (INDEX i=0; i<A.nRows(); i++) {
|
||||||
for (INDEX mj=0; mj<m.nCols(); mj++) {
|
for (INDEX mj=0; mj<m.nCols(); mj++) {
|
||||||
for (INDEX mi=0; mi<m.nRows(); mi++) {
|
for (INDEX mi=0; mi<m.nRows(); mi++) {
|
||||||
m(mi, mj) = A(mi+(mi>=i), mj+(mj>=j)); // skip row i and col j
|
m(mi, mj) = A(mi+(mi>=i), mj+(mj>=j)); // skip row i and col j
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ template<typename T>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DenseVector
|
* @class DenseVector
|
||||||
* @brief Class for storing data in a "dense" vector form
|
* @brief Class for storing data in a "dense" vector form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DenseVector : public Vector<T>
|
class DenseVector : public Vector<T>
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
DenseVector(const Vector<T> &c) : Vector<T>(), _data(nullptr) { _copy(c); }
|
DenseVector(const Vector<T> &c) : Vector<T>(), _data(nullptr) { _copy(c); }
|
||||||
DenseVector(const T * ptr, INDEX nrows) : Vector<T>(), _data(nullptr) { copy(ptr,nrows); }
|
DenseVector(const T * ptr, INDEX nrows) : Vector<T>(), _data(nullptr) { copy(ptr,nrows); }
|
||||||
virtual ~DenseVector() { _delete(); }
|
virtual ~DenseVector() { _delete(); }
|
||||||
|
|
||||||
//* resizes the Vector, ignores nCols, optionally copys what fits
|
//* resizes the Vector, ignores nCols, optionally copys what fits
|
||||||
void resize(INDEX rows, INDEX cols=1, bool copy=false);
|
void resize(INDEX rows, INDEX cols=1, bool copy=false);
|
||||||
//* resizes the Vector, ignores nCols, optionally zeros it out
|
//* resizes the Vector, ignores nCols, optionally zeros it out
|
||||||
|
@ -35,7 +35,7 @@ public:
|
||||||
T& operator()(INDEX i, INDEX /* j */) { VICK(i) return _data[i]; }
|
T& operator()(INDEX i, INDEX /* j */) { VICK(i) return _data[i]; }
|
||||||
T operator()(INDEX i) const { VICK(i) return _data[i]; }
|
T operator()(INDEX i) const { VICK(i) return _data[i]; }
|
||||||
T& operator()(INDEX i) { VICK(i) return _data[i]; }
|
T& operator()(INDEX i) { VICK(i) return _data[i]; }
|
||||||
void set_all_elements_to(const T &v) {
|
void set_all_elements_to(const T &v) {
|
||||||
int sz = this->size();
|
int sz = this->size();
|
||||||
for (INDEX i = 0; i < sz; i++) _data[i] = v;
|
for (INDEX i = 0; i < sz; i++) _data[i] = v;
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,8 @@ inline void DenseVector<T>::_create(INDEX n, bool zero)
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//* creates a deep memory copy from a general matrix
|
//* creates a deep memory copy from a general matrix
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void DenseVector<T>::_copy(const Vector<T> &c)
|
inline void DenseVector<T>::_copy(const Vector<T> &c)
|
||||||
{
|
{
|
||||||
if (!_data || _size!=c.size())
|
if (!_data || _size!=c.size())
|
||||||
{
|
{
|
||||||
_delete();
|
_delete();
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DependencyManager
|
* @class DependencyManager
|
||||||
* @brief Base class for defining objects that manage the dependencies of various objects
|
* @brief Base class for defining objects that manage the dependencies of various objects
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -30,13 +30,13 @@ namespace ATC {
|
||||||
|
|
||||||
// used as a friend so it can perform a depth-first search to have safe deletions of managed dependencies
|
// used as a friend so it can perform a depth-first search to have safe deletions of managed dependencies
|
||||||
friend class InterscaleManager;
|
friend class InterscaleManager;
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
DependencyManager() : needReset_(true), isFixed_(false), memoryType_(TEMPORARY), dfsFound_(false) {};
|
DependencyManager() : needReset_(true), isFixed_(false), memoryType_(TEMPORARY), dfsFound_(false) {};
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~DependencyManager() {};
|
virtual ~DependencyManager() {};
|
||||||
|
|
||||||
/** registration by other PerAtomQuantity objects */
|
/** registration by other PerAtomQuantity objects */
|
||||||
void register_dependence(DependencyManager * dependentQuantity)
|
void register_dependence(DependencyManager * dependentQuantity)
|
||||||
{dependentQuantities_.insert(dependentQuantity);};
|
{dependentQuantities_.insert(dependentQuantity);};
|
||||||
|
@ -47,7 +47,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** check if a reset is required */
|
/** check if a reset is required */
|
||||||
bool need_reset() const {return needReset_ && !isFixed_;};
|
bool need_reset() const {return needReset_ && !isFixed_;};
|
||||||
|
|
||||||
/** propagate need to reset to to dependencies */
|
/** propagate need to reset to to dependencies */
|
||||||
void propagate_reset()
|
void propagate_reset()
|
||||||
{
|
{
|
||||||
|
@ -91,10 +91,10 @@ namespace ATC {
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** list of dependent atomic quantities */
|
/** list of dependent atomic quantities */
|
||||||
std::set<DependencyManager * > dependentQuantities_;
|
std::set<DependencyManager * > dependentQuantities_;
|
||||||
|
|
||||||
/** flag for needing a recent */
|
/** flag for needing a recent */
|
||||||
// mutable is applied because there can be internal updates because we update when needed rather than when pushed
|
// mutable is applied because there can be internal updates because we update when needed rather than when pushed
|
||||||
mutable bool needReset_;
|
mutable bool needReset_;
|
||||||
|
@ -107,9 +107,9 @@ namespace ATC {
|
||||||
|
|
||||||
/** flag for if the node has been found in depth-first search */
|
/** flag for if the node has been found in depth-first search */
|
||||||
bool dfsFound_;
|
bool dfsFound_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class MatrixDependencyManager
|
* @class MatrixDependencyManager
|
||||||
* @brief Class for defining objects that manage the dependencies of matrices
|
* @brief Class for defining objects that manage the dependencies of matrices
|
||||||
|
@ -127,7 +127,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** returns a non-const version for manipulations and changes, resets dependent quantities */
|
/** returns a non-const version for manipulations and changes, resets dependent quantities */
|
||||||
virtual T<U> & set_quantity() {propagate_reset(); return get_quantity();};
|
virtual T<U> & set_quantity() {propagate_reset(); return get_quantity();};
|
||||||
|
|
||||||
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
|
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
|
||||||
virtual const T<U> & quantity() const {return get_quantity();};
|
virtual const T<U> & quantity() const {return get_quantity();};
|
||||||
|
|
||||||
|
@ -210,12 +210,12 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MatrixDependencyManager(MPI_Comm comm) :
|
MatrixDependencyManager(MPI_Comm comm) :
|
||||||
MatrixDependencyManager<SparseMatrix, T>(), quantity_(comm) {};
|
MatrixDependencyManager<SparseMatrix, T>(), quantity_(comm) {};
|
||||||
|
|
||||||
MatrixDependencyManager(MPI_Comm comm, int nRows, int nCols) :
|
MatrixDependencyManager(MPI_Comm comm, int nRows, int nCols) :
|
||||||
MatrixDependencyManager<SparseMatrix, T>(), quantity_(comm, nRows, nCols) {};
|
MatrixDependencyManager<SparseMatrix, T>(), quantity_(comm, nRows, nCols) {};
|
||||||
|
|
||||||
virtual ~MatrixDependencyManager() {};
|
virtual ~MatrixDependencyManager() {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -238,12 +238,12 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MatrixDependencyManager(MPI_Comm comm) :
|
MatrixDependencyManager(MPI_Comm comm) :
|
||||||
MatrixDependencyManager<DiagonalMatrix, T>(), quantity_(comm) {};
|
MatrixDependencyManager<DiagonalMatrix, T>(), quantity_(comm) {};
|
||||||
|
|
||||||
MatrixDependencyManager(MPI_Comm comm, int nRows, int nCols) :
|
MatrixDependencyManager(MPI_Comm comm, int nRows, int nCols) :
|
||||||
MatrixDependencyManager<DiagonalMatrix, T>(), quantity_(comm, nRows, nCols) {};
|
MatrixDependencyManager<DiagonalMatrix, T>(), quantity_(comm, nRows, nCols) {};
|
||||||
|
|
||||||
virtual ~MatrixDependencyManager() {};
|
virtual ~MatrixDependencyManager() {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -267,13 +267,13 @@ namespace ATC {
|
||||||
// constructor
|
// constructor
|
||||||
SetDependencyManager() :
|
SetDependencyManager() :
|
||||||
DependencyManager(), quantity_() {};
|
DependencyManager(), quantity_() {};
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~SetDependencyManager() {};
|
virtual ~SetDependencyManager() {};
|
||||||
|
|
||||||
/** returns a non-const version for manipulations and changes, resets dependent quantities */
|
/** returns a non-const version for manipulations and changes, resets dependent quantities */
|
||||||
virtual std::set<T> & set_quantity() {propagate_reset(); return quantity_;};
|
virtual std::set<T> & set_quantity() {propagate_reset(); return quantity_;};
|
||||||
|
|
||||||
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
|
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
|
||||||
virtual const std::set<T> & quantity() const {return quantity_;};
|
virtual const std::set<T> & quantity() const {return quantity_;};
|
||||||
|
|
||||||
|
@ -300,13 +300,13 @@ namespace ATC {
|
||||||
// constructor
|
// constructor
|
||||||
VectorDependencyManager() :
|
VectorDependencyManager() :
|
||||||
DependencyManager(), quantity_() {};
|
DependencyManager(), quantity_() {};
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~VectorDependencyManager() {};
|
virtual ~VectorDependencyManager() {};
|
||||||
|
|
||||||
/** returns a non-const version for manipulations and changes, resets dependent quantities */
|
/** returns a non-const version for manipulations and changes, resets dependent quantities */
|
||||||
virtual std::vector<T> & set_quantity() {propagate_reset(); return quantity_;};
|
virtual std::vector<T> & set_quantity() {propagate_reset(); return quantity_;};
|
||||||
|
|
||||||
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
|
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
|
||||||
virtual const std::vector<T> & quantity() const {return quantity_;};
|
virtual const std::vector<T> & quantity() const {return quantity_;};
|
||||||
|
|
||||||
|
|
|
@ -7,19 +7,19 @@ namespace ATC_matrix {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class DiagonalMatrix
|
* @class DiagonalMatrix
|
||||||
* @brief Class for storing data as a diagonal matrix
|
* @brief Class for storing data as a diagonal matrix
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class DiagonalMatrix : public Matrix<T>
|
class DiagonalMatrix : public Matrix<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit DiagonalMatrix(INDEX nRows=0, bool zero=0);
|
explicit DiagonalMatrix(INDEX nRows=0, bool zero=0);
|
||||||
DiagonalMatrix(const DiagonalMatrix<T>& c);
|
DiagonalMatrix(const DiagonalMatrix<T>& c);
|
||||||
DiagonalMatrix(const Vector<T>& v);
|
DiagonalMatrix(const Vector<T>& v);
|
||||||
virtual ~DiagonalMatrix();
|
virtual ~DiagonalMatrix();
|
||||||
|
|
||||||
//* resizes the matrix, ignores nCols, optionally zeros
|
//* resizes the matrix, ignores nCols, optionally zeros
|
||||||
void reset(INDEX rows, INDEX cols=0, bool zero=true);
|
void reset(INDEX rows, INDEX cols=0, bool zero=true);
|
||||||
//* resizes the matrix, ignores nCols, optionally copies what fits
|
//* resizes the matrix, ignores nCols, optionally copies what fits
|
||||||
void resize(INDEX rows, INDEX cols=0, bool copy=false);
|
void resize(INDEX rows, INDEX cols=0, bool copy=false);
|
||||||
|
@ -62,7 +62,7 @@ class DiagonalMatrix : public Matrix<T>
|
||||||
|
|
||||||
INDEX size() const { return _data->size(); }
|
INDEX size() const { return _data->size(); }
|
||||||
//* computes the inverse of this matrix
|
//* computes the inverse of this matrix
|
||||||
DiagonalMatrix<T>& inv_this();
|
DiagonalMatrix<T>& inv_this();
|
||||||
//* returns a copy of the inverse of this matrix
|
//* returns a copy of the inverse of this matrix
|
||||||
DiagonalMatrix<T> inv() const;
|
DiagonalMatrix<T> inv() const;
|
||||||
|
|
||||||
|
@ -82,19 +82,19 @@ protected:
|
||||||
DiagonalMatrix& operator=(const Vector<T> & /* c */) {}
|
DiagonalMatrix& operator=(const Vector<T> & /* c */) {}
|
||||||
DiagonalMatrix& operator=(const Matrix<T> & /* c */) {}
|
DiagonalMatrix& operator=(const Matrix<T> & /* c */) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _delete();
|
void _delete();
|
||||||
Vector<T> *_data;
|
Vector<T> *_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// DiagonalMatrix-DiagonalMatrix multiplication
|
// DiagonalMatrix-DiagonalMatrix multiplication
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DiagonalMatrix<T> operator*(const DiagonalMatrix<T>& A, const DiagonalMatrix<T>& B)
|
DiagonalMatrix<T> operator*(const DiagonalMatrix<T>& A, const DiagonalMatrix<T>& B)
|
||||||
{
|
{
|
||||||
SSCK(A, B, "DiagonalMatrix-DiagonalMatrix multiplication");
|
SSCK(A, B, "DiagonalMatrix-DiagonalMatrix multiplication");
|
||||||
DiagonalMatrix<T> R(A);
|
DiagonalMatrix<T> R(A);
|
||||||
for (INDEX i=0; i<R.nRows(); i++) R[i] *= B[i];
|
for (INDEX i=0; i<R.nRows(); i++) R[i] *= B[i];
|
||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ DenseVector<T> operator*(const Vector<T> &b, const DiagonalMatrix<T>& A)
|
||||||
// DiagonalMatrix-SparseMatrix multiplication
|
// DiagonalMatrix-SparseMatrix multiplication
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
SparseMatrix<T> operator*(const DiagonalMatrix<T> &A, const SparseMatrix<T>& B)
|
SparseMatrix<T> operator*(const DiagonalMatrix<T> &A, const SparseMatrix<T>& B)
|
||||||
{
|
{
|
||||||
GCK(A, B, A.nCols()!=B.nRows() ,"DiagonalMatrix-SparseMatrix multiplication");
|
GCK(A, B, A.nCols()!=B.nRows() ,"DiagonalMatrix-SparseMatrix multiplication");
|
||||||
SparseMatrix<T> R(B);
|
SparseMatrix<T> R(B);
|
||||||
|
@ -171,7 +171,7 @@ DiagonalMatrix<T> operator*(DiagonalMatrix<T> &A, const T s)
|
||||||
// Commute with DiagonalMatrix * double
|
// Commute with DiagonalMatrix * double
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DiagonalMatrix<T> operator*(const T s, const DiagonalMatrix<T>& A)
|
DiagonalMatrix<T> operator*(const T s, const DiagonalMatrix<T>& A)
|
||||||
{
|
{
|
||||||
DiagonalMatrix<T> R(A);
|
DiagonalMatrix<T> R(A);
|
||||||
R *= s;
|
R *= s;
|
||||||
|
@ -231,10 +231,10 @@ DiagonalMatrix<T>::DiagonalMatrix(const Vector<T>& v)
|
||||||
// destructor
|
// destructor
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DiagonalMatrix<T>::~DiagonalMatrix()
|
DiagonalMatrix<T>::~DiagonalMatrix()
|
||||||
{
|
{
|
||||||
_delete();
|
_delete();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// deletes the data stored by this matrix
|
// deletes the data stored by this matrix
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -244,7 +244,7 @@ void DiagonalMatrix<T>::_delete()
|
||||||
if (_data) delete _data;
|
if (_data) delete _data;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// resizes the matrix, ignores nCols, optionally zeros
|
// resizes the matrix, ignores nCols, optionally zeros
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DiagonalMatrix<T>::reset(INDEX rows, INDEX /* cols */, bool zero)
|
void DiagonalMatrix<T>::reset(INDEX rows, INDEX /* cols */, bool zero)
|
||||||
|
@ -258,13 +258,13 @@ void DiagonalMatrix<T>::reset(INDEX rows, INDEX /* cols */, bool zero)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DiagonalMatrix<T>::resize(INDEX rows, INDEX /* cols */, bool copy)
|
void DiagonalMatrix<T>::resize(INDEX rows, INDEX /* cols */, bool copy)
|
||||||
{
|
{
|
||||||
_data->resize(rows, copy);
|
_data->resize(rows, copy);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// changes the diagonal of the matrix to a vector v (makes a copy)
|
// changes the diagonal of the matrix to a vector v (makes a copy)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DiagonalMatrix<T>::reset(const Vector<T>& v)
|
void DiagonalMatrix<T>::reset(const Vector<T>& v)
|
||||||
{
|
{
|
||||||
if (&v == _data) return; // check for self-reset
|
if (&v == _data) return; // check for self-reset
|
||||||
_delete();
|
_delete();
|
||||||
|
@ -274,7 +274,7 @@ void DiagonalMatrix<T>::reset(const Vector<T>& v)
|
||||||
// copys from another DiagonalMatrix
|
// copys from another DiagonalMatrix
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DiagonalMatrix<T>::reset(const DiagonalMatrix<T>& c)
|
void DiagonalMatrix<T>::reset(const DiagonalMatrix<T>& c)
|
||||||
{
|
{
|
||||||
reset(*(c._data));
|
reset(*(c._data));
|
||||||
}
|
}
|
||||||
|
@ -337,41 +337,41 @@ T& DiagonalMatrix<T>::operator()(INDEX i, INDEX /* j */)
|
||||||
// value indexing operator - returns 0 if i!=j
|
// value indexing operator - returns 0 if i!=j
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T DiagonalMatrix<T>::operator()(INDEX i, INDEX j) const
|
T DiagonalMatrix<T>::operator()(INDEX i, INDEX j) const
|
||||||
{
|
{
|
||||||
return (i==j) ? (*_data)(i) : (T)0;
|
return (i==j) ? (*_data)(i) : (T)0;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// flat reference indexing operator
|
// flat reference indexing operator
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& DiagonalMatrix<T>::operator[](INDEX i)
|
T& DiagonalMatrix<T>::operator[](INDEX i)
|
||||||
{
|
{
|
||||||
return (*_data)(i);
|
return (*_data)(i);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// flat value indexing operator
|
// flat value indexing operator
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T DiagonalMatrix<T>::operator[](INDEX i) const
|
T DiagonalMatrix<T>::operator[](INDEX i) const
|
||||||
{
|
{
|
||||||
return (*_data)(i);
|
return (*_data)(i);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// returns the number of rows
|
// returns the number of rows
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INDEX DiagonalMatrix<T>::nRows() const
|
INDEX DiagonalMatrix<T>::nRows() const
|
||||||
{
|
{
|
||||||
return _data->size();
|
return _data->size();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// returns the number of columns (same as nCols())
|
// returns the number of columns (same as nCols())
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
INDEX DiagonalMatrix<T>::nCols() const
|
INDEX DiagonalMatrix<T>::nCols() const
|
||||||
{
|
{
|
||||||
return _data->size();
|
return _data->size();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// returns a pointer to the diagonal values, dangerous!
|
// returns a pointer to the diagonal values, dangerous!
|
||||||
|
@ -379,13 +379,13 @@ INDEX DiagonalMatrix<T>::nCols() const
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* DiagonalMatrix<T>::ptr() const
|
T* DiagonalMatrix<T>::ptr() const
|
||||||
{
|
{
|
||||||
return _data->ptr();
|
return _data->ptr();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// writes the diagonal to a binary data restart file
|
// writes the diagonal to a binary data restart file
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DiagonalMatrix<T>::write_restart(FILE *f) const
|
void DiagonalMatrix<T>::write_restart(FILE *f) const
|
||||||
{
|
{
|
||||||
_data->write_restart(f);
|
_data->write_restart(f);
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ void DiagonalMatrix<T>::write_restart(FILE *f) const
|
||||||
// sets the diagonal to a constant
|
// sets the diagonal to a constant
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const T v)
|
DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const T v)
|
||||||
{
|
{
|
||||||
this->set_all_elements_to(v);
|
this->set_all_elements_to(v);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -402,7 +402,7 @@ DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const T v)
|
||||||
// assignment operator with another diagonal matrix
|
// assignment operator with another diagonal matrix
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const DiagonalMatrix<T>& C)
|
DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const DiagonalMatrix<T>& C)
|
||||||
{
|
{
|
||||||
reset(C);
|
reset(C);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -411,7 +411,7 @@ DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const DiagonalMatrix<T>& C)
|
||||||
// writes a matlab command to duplicate this sparse matrix
|
// writes a matlab command to duplicate this sparse matrix
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void DiagonalMatrix<T>::matlab(std::ostream &o, const std::string &s) const
|
void DiagonalMatrix<T>::matlab(std::ostream &o, const std::string &s) const
|
||||||
{
|
{
|
||||||
_data->matlab(o, s);
|
_data->matlab(o, s);
|
||||||
o << s <<"=diag("<<s<<",0);\n";
|
o << s <<"=diag("<<s<<",0);\n";
|
||||||
|
@ -422,16 +422,16 @@ void DiagonalMatrix<T>::matlab(std::ostream &o, const std::string &s)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
DiagonalMatrix<T>& DiagonalMatrix<T>::inv_this()
|
DiagonalMatrix<T>& DiagonalMatrix<T>::inv_this()
|
||||||
{
|
{
|
||||||
for(INDEX i=0; i<nRows(); i++)
|
for(INDEX i=0; i<nRows(); i++)
|
||||||
{
|
{
|
||||||
if ((*this)[i]!=T(0)) (*this)[i] = 1.0/(*this)[i];
|
if ((*this)[i]!=T(0)) (*this)[i] = 1.0/(*this)[i];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"DiagonalMatrix::inv(): ("<<i<<","<<i<<")=0\n";
|
std::cout<<"DiagonalMatrix::inv(): ("<<i<<","<<i<<")=0\n";
|
||||||
ERROR_FOR_BACKTRACE
|
ERROR_FOR_BACKTRACE
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Error check info
|
// Error check info
|
||||||
const double min_max = _data->minabs() / _data->maxabs();
|
const double min_max = _data->minabs() / _data->maxabs();
|
||||||
if (min_max > 1e-14) return *this;
|
if (min_max > 1e-14) return *this;
|
||||||
|
@ -447,10 +447,10 @@ DiagonalMatrix<T> DiagonalMatrix<T>::inv() const
|
||||||
{
|
{
|
||||||
DiagonalMatrix<T> invA(*this); // Make copy of A to invert
|
DiagonalMatrix<T> invA(*this); // Make copy of A to invert
|
||||||
|
|
||||||
for(INDEX i=0; i<invA.nRows(); i++)
|
for(INDEX i=0; i<invA.nRows(); i++)
|
||||||
{
|
{
|
||||||
if ((*this)[i]!=T(0)) invA[i]=1.0/(*this)[i];
|
if ((*this)[i]!=T(0)) invA[i]=1.0/(*this)[i];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"DiagonalMatrix::inv(): ("<<i<<","<<i<<")=0\n";
|
std::cout<<"DiagonalMatrix::inv(): ("<<i<<","<<i<<")=0\n";
|
||||||
ERROR_FOR_BACKTRACE
|
ERROR_FOR_BACKTRACE
|
||||||
|
@ -494,7 +494,7 @@ void DiagonalMatrix<T>::_set_equal(const Matrix<T> &r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// casts a generic matrix pointer into a DiagonalMatrix pointer - null if fail
|
// casts a generic matrix pointer into a DiagonalMatrix pointer - null if fail
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const DiagonalMatrix<T> *diag_cast(const Matrix<T> *m)
|
const DiagonalMatrix<T> *diag_cast(const Matrix<T> *m)
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
MomentumTimeIntegrator::MomentumTimeIntegrator(ATC_Coupling * atc,
|
MomentumTimeIntegrator::MomentumTimeIntegrator(ATC_Coupling * atc,
|
||||||
TimeIntegrationType timeIntegrationType) :
|
TimeIntegrationType timeIntegrationType) :
|
||||||
TimeIntegrator(atc, timeIntegrationType)
|
TimeIntegrator(atc, timeIntegrationType)
|
||||||
|
@ -36,7 +36,7 @@ namespace ATC {
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC time_integration <descriptor> \n
|
fix_modify AtC time_integration <descriptor> \n
|
||||||
- descriptor (string) = time integration type \n
|
- descriptor (string) = time integration type \n
|
||||||
|
|
||||||
various time integration methods for the finite elements\n
|
various time integration methods for the finite elements\n
|
||||||
\section description
|
\section description
|
||||||
verlet - atomic velocity update with 2nd order Verlet, nodal temperature update with 2nd order Verlet, kinetostats based on controlling force \n
|
verlet - atomic velocity update with 2nd order Verlet, nodal temperature update with 2nd order Verlet, kinetostats based on controlling force \n
|
||||||
|
@ -49,7 +49,7 @@ namespace ATC {
|
||||||
\section related
|
\section related
|
||||||
see \ref man_fix_atc
|
see \ref man_fix_atc
|
||||||
\section default
|
\section default
|
||||||
none
|
none
|
||||||
*/
|
*/
|
||||||
if (strcmp(arg[argIndex],"verlet")==0) {
|
if (strcmp(arg[argIndex],"verlet")==0) {
|
||||||
timeIntegrationType_ = VERLET;
|
timeIntegrationType_ = VERLET;
|
||||||
|
@ -78,7 +78,7 @@ namespace ATC {
|
||||||
if (atc_->reset_methods()) {
|
if (atc_->reset_methods()) {
|
||||||
if (timeIntegrationMethod_)
|
if (timeIntegrationMethod_)
|
||||||
delete timeIntegrationMethod_;
|
delete timeIntegrationMethod_;
|
||||||
|
|
||||||
if (timeFilterManager_->need_reset()) {
|
if (timeFilterManager_->need_reset()) {
|
||||||
switch (timeIntegrationType_) {
|
switch (timeIntegrationType_) {
|
||||||
case VERLET:
|
case VERLET:
|
||||||
|
@ -122,7 +122,7 @@ namespace ATC {
|
||||||
default:
|
default:
|
||||||
throw ATC_Error("Unknown time integration type in MomentumTimeIntegrator::Initialize()");
|
throw ATC_Error("Unknown time integration type in MomentumTimeIntegrator::Initialize()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab data from ATC
|
// Grab data from ATC
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
MomentumIntegrationMethod::MomentumIntegrationMethod(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
MomentumIntegrationMethod::MomentumIntegrationMethod(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
||||||
TimeIntegrationMethod(momentumTimeIntegrator),
|
TimeIntegrationMethod(momentumTimeIntegrator),
|
||||||
timeFilter_(timeIntegrator_->time_filter()),
|
timeFilter_(timeIntegrator_->time_filter()),
|
||||||
|
@ -178,7 +178,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ElasticTimeIntegratorVerlet::ElasticTimeIntegratorVerlet(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
ElasticTimeIntegratorVerlet::ElasticTimeIntegratorVerlet(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
||||||
MomentumIntegrationMethod(momentumTimeIntegrator),
|
MomentumIntegrationMethod(momentumTimeIntegrator),
|
||||||
displacement_(atc_->field(DISPLACEMENT)),
|
displacement_(atc_->field(DISPLACEMENT)),
|
||||||
|
@ -217,7 +217,7 @@ namespace ATC {
|
||||||
if (timeFilterManager->need_reset()) {
|
if (timeFilterManager->need_reset()) {
|
||||||
timeFilter_->initialize(nodalAtomicForce_->quantity());
|
timeFilter_->initialize(nodalAtomicForce_->quantity());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(timeFilterManager->end_equilibrate())) {
|
if (!(timeFilterManager->end_equilibrate())) {
|
||||||
nodalAtomicForceFiltered_.reset(atc_->num_nodes(),atc_->nsd());
|
nodalAtomicForceFiltered_.reset(atc_->num_nodes(),atc_->nsd());
|
||||||
}
|
}
|
||||||
|
@ -238,14 +238,14 @@ namespace ATC {
|
||||||
explicit_1(velocity_.set_quantity(),acceleration_.quantity(),.5*dt);
|
explicit_1(velocity_.set_quantity(),acceleration_.quantity(),.5*dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// post_initial_integrate1
|
// post_initial_integrate1
|
||||||
// time integration after Verlet step 1
|
// time integration after Verlet step 1
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ElasticTimeIntegratorVerlet::post_initial_integrate1(double dt)
|
void ElasticTimeIntegratorVerlet::post_initial_integrate1(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
// for improved accuracy, but this would be inconsistent with
|
// for improved accuracy, but this would be inconsistent with
|
||||||
// the atomic integration scheme
|
// the atomic integration scheme
|
||||||
explicit_1(displacement_.set_quantity(),velocity_.quantity(),dt);
|
explicit_1(displacement_.set_quantity(),velocity_.quantity(),dt);
|
||||||
|
@ -253,7 +253,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// pre_final_integrate1
|
// pre_final_integrate1
|
||||||
// first time integration computations
|
// first time integration computations
|
||||||
// before Verlet step 2
|
// before Verlet step 2
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ElasticTimeIntegratorVerlet::pre_final_integrate1(double dt)
|
void ElasticTimeIntegratorVerlet::pre_final_integrate1(double dt)
|
||||||
|
@ -325,7 +325,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ElasticTimeIntegratorVerletFiltered::ElasticTimeIntegratorVerletFiltered(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
ElasticTimeIntegratorVerletFiltered::ElasticTimeIntegratorVerletFiltered(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
||||||
ElasticTimeIntegratorVerlet(momentumTimeIntegrator),
|
ElasticTimeIntegratorVerlet(momentumTimeIntegrator),
|
||||||
nodalAtomicAcceleration_(atc_->nodal_atomic_field_roc(VELOCITY))
|
nodalAtomicAcceleration_(atc_->nodal_atomic_field_roc(VELOCITY))
|
||||||
|
@ -349,7 +349,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ElasticTimeIntegratorVerletFiltered::post_initial_integrate1(double dt)
|
void ElasticTimeIntegratorVerletFiltered::post_initial_integrate1(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
// for improved accuracy, but this would be inconsistent with
|
// for improved accuracy, but this would be inconsistent with
|
||||||
// the atomic integration scheme
|
// the atomic integration scheme
|
||||||
explicit_1(displacement_.set_quantity(),velocity_.quantity(),dt);
|
explicit_1(displacement_.set_quantity(),velocity_.quantity(),dt);
|
||||||
|
@ -367,7 +367,7 @@ namespace ATC {
|
||||||
acceleration_.set_quantity(),
|
acceleration_.set_quantity(),
|
||||||
VELOCITY);
|
VELOCITY);
|
||||||
explicit_1(velocity_.set_quantity(),acceleration_.quantity(),.5*dt);
|
explicit_1(velocity_.set_quantity(),acceleration_.quantity(),.5*dt);
|
||||||
|
|
||||||
atc_->apply_inverse_md_mass_matrix(nodalAtomicForceFiltered_.quantity(),
|
atc_->apply_inverse_md_mass_matrix(nodalAtomicForceFiltered_.quantity(),
|
||||||
nodalAtomicAcceleration_.set_quantity(),
|
nodalAtomicAcceleration_.set_quantity(),
|
||||||
VELOCITY);
|
VELOCITY);
|
||||||
|
@ -404,7 +404,7 @@ namespace ATC {
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
ElasticTimeIntegratorFractionalStep::ElasticTimeIntegratorFractionalStep(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
ElasticTimeIntegratorFractionalStep::ElasticTimeIntegratorFractionalStep(MomentumTimeIntegrator * momentumTimeIntegrator) :
|
||||||
MomentumIntegrationMethod(momentumTimeIntegrator),
|
MomentumIntegrationMethod(momentumTimeIntegrator),
|
||||||
displacement_(atc_->field(DISPLACEMENT)),
|
displacement_(atc_->field(DISPLACEMENT)),
|
||||||
|
@ -413,7 +413,7 @@ namespace ATC {
|
||||||
nodalAtomicMomentum_(nullptr),
|
nodalAtomicMomentum_(nullptr),
|
||||||
nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()),
|
nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()),
|
||||||
nodalAtomicDisplacement_(nullptr),
|
nodalAtomicDisplacement_(nullptr),
|
||||||
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),
|
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),
|
||||||
nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd())
|
nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd())
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -450,7 +450,7 @@ namespace ATC {
|
||||||
// the form of this integrator implies no time filters that require history data can be used
|
// the form of this integrator implies no time filters that require history data can be used
|
||||||
timeFilter_->initialize();
|
timeFilter_->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets up time filter for post-processing the filtered power
|
// sets up time filter for post-processing the filtered power
|
||||||
// this time integrator should use an explicit-implicit filter
|
// this time integrator should use an explicit-implicit filter
|
||||||
// to mirror the 2nd order Verlet integration scheme
|
// to mirror the 2nd order Verlet integration scheme
|
||||||
|
@ -513,7 +513,7 @@ namespace ATC {
|
||||||
atomicVelocityDelta,
|
atomicVelocityDelta,
|
||||||
VELOCITY);
|
VELOCITY);
|
||||||
velocity_ += atomicVelocityDelta;
|
velocity_ += atomicVelocityDelta;
|
||||||
|
|
||||||
// approximation to force for output
|
// approximation to force for output
|
||||||
nodalAtomicForce_ /= 0.5*dt;
|
nodalAtomicForce_ /= 0.5*dt;
|
||||||
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
|
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
|
||||||
|
@ -549,16 +549,16 @@ namespace ATC {
|
||||||
// atomic contributions to change in momentum
|
// atomic contributions to change in momentum
|
||||||
// compute change in restricted atomic momentum
|
// compute change in restricted atomic momentum
|
||||||
nodalAtomicForce_ += nodalAtomicMomentum_->quantity();
|
nodalAtomicForce_ += nodalAtomicMomentum_->quantity();
|
||||||
|
|
||||||
// update FE temperature with change in temperature from MD
|
// update FE temperature with change in temperature from MD
|
||||||
compute_velocity_delta(nodalAtomicForce_,dt);
|
compute_velocity_delta(nodalAtomicForce_,dt);
|
||||||
velocity_ += atomicVelocityDelta_.quantity();
|
velocity_ += atomicVelocityDelta_.quantity();
|
||||||
|
|
||||||
// approximation to power for output
|
// approximation to power for output
|
||||||
nodalAtomicForce_ /= 0.5*dt;
|
nodalAtomicForce_ /= 0.5*dt;
|
||||||
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
|
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
|
||||||
nodalAtomicForce_,dt);
|
nodalAtomicForce_,dt);
|
||||||
|
|
||||||
// change to velocity from FE dynamics
|
// change to velocity from FE dynamics
|
||||||
atc_->apply_inverse_mass_matrix(velocityRhs_.quantity(),
|
atc_->apply_inverse_mass_matrix(velocityRhs_.quantity(),
|
||||||
acceleration_.set_quantity(),
|
acceleration_.set_quantity(),
|
||||||
|
@ -681,7 +681,7 @@ namespace ATC {
|
||||||
if (!timeFilterManager->end_equilibrate()) {
|
if (!timeFilterManager->end_equilibrate()) {
|
||||||
// implies an initial condition of the instantaneous atomic energy
|
// implies an initial condition of the instantaneous atomic energy
|
||||||
// for the corresponding filtered variable, consistent with the temperature
|
// for the corresponding filtered variable, consistent with the temperature
|
||||||
nodalAtomicMomentumFiltered_ = nodalAtomicMomentum_->quantity();
|
nodalAtomicMomentumFiltered_ = nodalAtomicMomentum_->quantity();
|
||||||
nodalAtomicForceFiltered_.reset(atc_->num_nodes(),atc_->nsd());
|
nodalAtomicForceFiltered_.reset(atc_->num_nodes(),atc_->nsd());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ namespace ATC {
|
||||||
apply_gear_predictor(dt);
|
apply_gear_predictor(dt);
|
||||||
|
|
||||||
// update filtered nodal atomic force
|
// update filtered nodal atomic force
|
||||||
|
|
||||||
// that way kinetostat and integrator can be consistent
|
// that way kinetostat and integrator can be consistent
|
||||||
timeFilter_->apply_pre_step1(nodalAtomicForceFiltered_.set_quantity(),
|
timeFilter_->apply_pre_step1(nodalAtomicForceFiltered_.set_quantity(),
|
||||||
nodalAtomicForce_,dt);
|
nodalAtomicForce_,dt);
|
||||||
|
@ -724,15 +724,15 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void FluidsTimeIntegratorGear::pre_final_integrate1(double dt)
|
void FluidsTimeIntegratorGear::pre_final_integrate1(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
// before the new rhs is computed but after atomic velocity is updated.
|
// before the new rhs is computed but after atomic velocity is updated.
|
||||||
// compute change in restricted atomic momentum
|
// compute change in restricted atomic momentum
|
||||||
nodalAtomicForce_ += nodalAtomicMomentum_->quantity();
|
nodalAtomicForce_ += nodalAtomicMomentum_->quantity();
|
||||||
|
|
||||||
// update FE velocity with change in velocity from MD
|
// update FE velocity with change in velocity from MD
|
||||||
compute_velocity_delta(nodalAtomicForce_,dt);
|
compute_velocity_delta(nodalAtomicForce_,dt);
|
||||||
velocity_ += atomicVelocityDelta_.quantity();
|
velocity_ += atomicVelocityDelta_.quantity();
|
||||||
|
|
||||||
// approximation to force for output
|
// approximation to force for output
|
||||||
nodalAtomicForce_ /= dt;
|
nodalAtomicForce_ /= dt;
|
||||||
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
|
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
|
||||||
|
|
|
@ -16,19 +16,19 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MomentumTimeIntegrator : public TimeIntegrator {
|
class MomentumTimeIntegrator : public TimeIntegrator {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
MomentumTimeIntegrator(ATC_Coupling * atc,
|
MomentumTimeIntegrator(ATC_Coupling * atc,
|
||||||
TimeIntegrationType timeIntegrationType);
|
TimeIntegrationType timeIntegrationType);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~MomentumTimeIntegrator(){};
|
virtual ~MomentumTimeIntegrator(){};
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
virtual bool modify(int narg, char **arg);
|
virtual bool modify(int narg, char **arg);
|
||||||
|
|
||||||
/** create objects to implement requested numerical method */
|
/** create objects to implement requested numerical method */
|
||||||
virtual void construct_methods();
|
virtual void construct_methods();
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ namespace ATC {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** filtered atomic force */
|
/** filtered atomic force */
|
||||||
|
|
||||||
DENS_MAN nodalAtomicForceFiltered_;
|
DENS_MAN nodalAtomicForceFiltered_;
|
||||||
|
|
||||||
/** filtered atomic momentum due initial conditions and MD updates */
|
/** filtered atomic momentum due initial conditions and MD updates */
|
||||||
|
@ -58,7 +58,7 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
MomentumTimeIntegrator();
|
MomentumTimeIntegrator();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,12 +67,12 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MomentumIntegrationMethod : public TimeIntegrationMethod {
|
class MomentumIntegrationMethod : public TimeIntegrationMethod {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
MomentumIntegrationMethod(MomentumTimeIntegrator * momentumTimeIntegrator);
|
MomentumIntegrationMethod(MomentumTimeIntegrator * momentumTimeIntegrator);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~MomentumIntegrationMethod(){};
|
virtual ~MomentumIntegrationMethod(){};
|
||||||
|
|
||||||
|
@ -81,17 +81,17 @@ namespace ATC {
|
||||||
|
|
||||||
/** checks to see if first RHS computation is needed */
|
/** checks to see if first RHS computation is needed */
|
||||||
virtual bool has_final_predictor() {return true;};
|
virtual bool has_final_predictor() {return true;};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** time filtering object */
|
/** time filtering object */
|
||||||
TimeFilter * timeFilter_;
|
TimeFilter * timeFilter_;
|
||||||
|
|
||||||
/** finite element velocity field */
|
/** finite element velocity field */
|
||||||
DENS_MAN & velocity_;
|
DENS_MAN & velocity_;
|
||||||
/** finite element acceleration field */
|
/** finite element acceleration field */
|
||||||
DENS_MAN & acceleration_;
|
DENS_MAN & acceleration_;
|
||||||
|
|
||||||
/** atomic nodal velocity field */
|
/** atomic nodal velocity field */
|
||||||
DENS_MAN & nodalAtomicVelocityOut_;
|
DENS_MAN & nodalAtomicVelocityOut_;
|
||||||
/** right-hand side of velocity equation */
|
/** right-hand side of velocity equation */
|
||||||
|
@ -106,7 +106,7 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
MomentumIntegrationMethod();
|
MomentumIntegrationMethod();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,21 +115,21 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElasticTimeIntegratorVerlet : public MomentumIntegrationMethod {
|
class ElasticTimeIntegratorVerlet : public MomentumIntegrationMethod {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ElasticTimeIntegratorVerlet(MomentumTimeIntegrator * momentumTimeIntegrator);
|
ElasticTimeIntegratorVerlet(MomentumTimeIntegrator * momentumTimeIntegrator);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~ElasticTimeIntegratorVerlet(){};
|
virtual ~ElasticTimeIntegratorVerlet(){};
|
||||||
|
|
||||||
/** create and get necessary transfer operators */
|
/** create and get necessary transfer operators */
|
||||||
virtual void construct_transfers();
|
virtual void construct_transfers();
|
||||||
|
|
||||||
/** pre time integration initialization of data */
|
/** pre time integration initialization of data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
// time step methods, corresponding to ATC_Transfer
|
// time step methods, corresponding to ATC_Transfer
|
||||||
/** first part of pre_initial_integrate */
|
/** first part of pre_initial_integrate */
|
||||||
virtual void pre_initial_integrate1(double dt);
|
virtual void pre_initial_integrate1(double dt);
|
||||||
|
@ -143,52 +143,52 @@ namespace ATC {
|
||||||
virtual void add_to_rhs();
|
virtual void add_to_rhs();
|
||||||
/** post processing step before output */
|
/** post processing step before output */
|
||||||
virtual void post_process();
|
virtual void post_process();
|
||||||
|
|
||||||
/** add output data */
|
/** add output data */
|
||||||
virtual void output(OUTPUT_LIST & outputData);
|
virtual void output(OUTPUT_LIST & outputData);
|
||||||
|
|
||||||
/** operations at end of a run */
|
/** operations at end of a run */
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** finite element displacement field */
|
/** finite element displacement field */
|
||||||
DENS_MAN & displacement_;
|
DENS_MAN & displacement_;
|
||||||
|
|
||||||
/** atomic nodal displacement field */
|
/** atomic nodal displacement field */
|
||||||
DENS_MAN & nodalAtomicDisplacementOut_;
|
DENS_MAN & nodalAtomicDisplacementOut_;
|
||||||
|
|
||||||
/** filtered atomic force */
|
/** filtered atomic force */
|
||||||
DENS_MAN & nodalAtomicForceFiltered_;
|
DENS_MAN & nodalAtomicForceFiltered_;
|
||||||
|
|
||||||
/** transfer for computing atomic displacement */
|
/** transfer for computing atomic displacement */
|
||||||
DENS_MAN * nodalAtomicDisplacement_;
|
DENS_MAN * nodalAtomicDisplacement_;
|
||||||
|
|
||||||
/** transfer for computing nodal atomic force */
|
/** transfer for computing nodal atomic force */
|
||||||
DENS_MAN * nodalAtomicForce_;
|
DENS_MAN * nodalAtomicForce_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
ElasticTimeIntegratorVerlet();
|
ElasticTimeIntegratorVerlet();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElasticTimeIntegratorVerlet
|
* @class ElasticTimeIntegratorVerlet
|
||||||
* @brief Verlet integration for FE elastic quantities with time filtering
|
* @brief Verlet integration for FE elastic quantities with time filtering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElasticTimeIntegratorVerletFiltered : public ElasticTimeIntegratorVerlet {
|
class ElasticTimeIntegratorVerletFiltered : public ElasticTimeIntegratorVerlet {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ElasticTimeIntegratorVerletFiltered(MomentumTimeIntegrator * momentumTimeIntegrator);
|
ElasticTimeIntegratorVerletFiltered(MomentumTimeIntegrator * momentumTimeIntegrator);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~ElasticTimeIntegratorVerletFiltered(){};
|
virtual ~ElasticTimeIntegratorVerletFiltered(){};
|
||||||
|
|
||||||
// time step methods, corresponding to ATC_Transfer
|
// time step methods, corresponding to ATC_Transfer
|
||||||
/** first part of pre_initial_integrate */
|
/** first part of pre_initial_integrate */
|
||||||
virtual void pre_initial_integrate1(double dt);
|
virtual void pre_initial_integrate1(double dt);
|
||||||
|
@ -203,7 +203,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** add output data */
|
/** add output data */
|
||||||
virtual void output(OUTPUT_LIST & outputData);
|
virtual void output(OUTPUT_LIST & outputData);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** atomic nodal acceleration field */
|
/** atomic nodal acceleration field */
|
||||||
|
@ -213,16 +213,16 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
ElasticTimeIntegratorVerletFiltered();
|
ElasticTimeIntegratorVerletFiltered();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElasticTimeIntegratorFractionalStep
|
* @class ElasticTimeIntegratorFractionalStep
|
||||||
* @brief Class for using 2nd order Verlet integration to update FE contributions to momentum field
|
* @brief Class for using 2nd order Verlet integration to update FE contributions to momentum field
|
||||||
* (Uses same update for the atomic contributions to the finite
|
* (Uses same update for the atomic contributions to the finite
|
||||||
* elements as are used by the LAMMPS integration scheme
|
* elements as are used by the LAMMPS integration scheme
|
||||||
* for the atomic velocities and positions, i.e. Verlet.)
|
* for the atomic velocities and positions, i.e. Verlet.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElasticTimeIntegratorFractionalStep : public MomentumIntegrationMethod {
|
class ElasticTimeIntegratorFractionalStep : public MomentumIntegrationMethod {
|
||||||
|
|
||||||
|
@ -230,16 +230,16 @@ namespace ATC {
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ElasticTimeIntegratorFractionalStep(MomentumTimeIntegrator * momentumTimeIntegrator);
|
ElasticTimeIntegratorFractionalStep(MomentumTimeIntegrator * momentumTimeIntegrator);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~ElasticTimeIntegratorFractionalStep() {};
|
virtual ~ElasticTimeIntegratorFractionalStep() {};
|
||||||
|
|
||||||
/** create and get necessary transfer operators */
|
/** create and get necessary transfer operators */
|
||||||
virtual void construct_transfers();
|
virtual void construct_transfers();
|
||||||
|
|
||||||
/** pre time integration initialization of data */
|
/** pre time integration initialization of data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
// time step methods, corresponding to ATC_Transfer
|
// time step methods, corresponding to ATC_Transfer
|
||||||
/** first part of pre_initial_integrate */
|
/** first part of pre_initial_integrate */
|
||||||
virtual void pre_initial_integrate1(double dt);
|
virtual void pre_initial_integrate1(double dt);
|
||||||
|
@ -272,13 +272,13 @@ namespace ATC {
|
||||||
// data
|
// data
|
||||||
/** finite element displacement field */
|
/** finite element displacement field */
|
||||||
DENS_MAN & displacement_;
|
DENS_MAN & displacement_;
|
||||||
|
|
||||||
/** atomic nodal displacement field */
|
/** atomic nodal displacement field */
|
||||||
DENS_MAN & nodalAtomicDisplacementOut_;
|
DENS_MAN & nodalAtomicDisplacementOut_;
|
||||||
|
|
||||||
/** equivalent nodal force due to atomic momentum change */
|
/** equivalent nodal force due to atomic momentum change */
|
||||||
DENS_MAT nodalAtomicForce_;
|
DENS_MAT nodalAtomicForce_;
|
||||||
|
|
||||||
/** filtered atomic force */
|
/** filtered atomic force */
|
||||||
DENS_MAN & nodalAtomicForceFiltered_;
|
DENS_MAN & nodalAtomicForceFiltered_;
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** filtered atomic momentum */
|
/** filtered atomic momentum */
|
||||||
DENS_MAN & nodalAtomicMomentumFiltered_;
|
DENS_MAN & nodalAtomicMomentumFiltered_;
|
||||||
|
|
||||||
/** transfer for computing atomic displacement */
|
/** transfer for computing atomic displacement */
|
||||||
DENS_MAN * nodalAtomicDisplacement_;
|
DENS_MAN * nodalAtomicDisplacement_;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ namespace ATC {
|
||||||
* @class FluidsTimeIntegratorGear
|
* @class FluidsTimeIntegratorGear
|
||||||
* @brief Class for using 3rd order Gear integration to update FE contributions to momentum field
|
* @brief Class for using 3rd order Gear integration to update FE contributions to momentum field
|
||||||
* and fractional step method for atomic contributions
|
* and fractional step method for atomic contributions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FluidsTimeIntegratorGear : public MomentumIntegrationMethod {
|
class FluidsTimeIntegratorGear : public MomentumIntegrationMethod {
|
||||||
|
|
||||||
|
@ -320,16 +320,16 @@ namespace ATC {
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
FluidsTimeIntegratorGear(MomentumTimeIntegrator * MomentumTimeIntegrator);
|
FluidsTimeIntegratorGear(MomentumTimeIntegrator * MomentumTimeIntegrator);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~FluidsTimeIntegratorGear() {};
|
virtual ~FluidsTimeIntegratorGear() {};
|
||||||
|
|
||||||
/** create and get necessary transfer operators */
|
/** create and get necessary transfer operators */
|
||||||
virtual void construct_transfers();
|
virtual void construct_transfers();
|
||||||
|
|
||||||
/** pre time integration initialization of data */
|
/** pre time integration initialization of data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
// time step methods, corresponding to ATC_Transfer
|
// time step methods, corresponding to ATC_Transfer
|
||||||
/** first part of pre_initial_integrate */
|
/** first part of pre_initial_integrate */
|
||||||
virtual void pre_initial_integrate1(double dt);
|
virtual void pre_initial_integrate1(double dt);
|
||||||
|
@ -371,7 +371,7 @@ namespace ATC {
|
||||||
// data
|
// data
|
||||||
/** equivalent nodal force due to atomic momentum change */
|
/** equivalent nodal force due to atomic momentum change */
|
||||||
DENS_MAT nodalAtomicForce_;
|
DENS_MAT nodalAtomicForce_;
|
||||||
|
|
||||||
/** filtered atomic force */
|
/** filtered atomic force */
|
||||||
DENS_MAN & nodalAtomicForceFiltered_;
|
DENS_MAN & nodalAtomicForceFiltered_;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ using std::vector;
|
||||||
|
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
|
ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
|
||||||
fstream &fileId, map<string,double> & /* parameters */)
|
fstream &fileId, map<string,double> & /* parameters */)
|
||||||
: ElectronChargeDensity(), n_()
|
: ElectronChargeDensity(), n_()
|
||||||
{
|
{
|
||||||
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
||||||
|
@ -23,7 +23,7 @@ ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
|
||||||
double coef = 1.;
|
double coef = 1.;
|
||||||
while(fileId.good()) {
|
while(fileId.good()) {
|
||||||
command_line(fileId, line);
|
command_line(fileId, line);
|
||||||
if (line.size() == 0) continue;
|
if (line.size() == 0) continue;
|
||||||
if (line[0] == "end") return;
|
if (line[0] == "end") return;
|
||||||
else if (line[0] == "scale") coef = str2dbl(line[1]);
|
else if (line[0] == "scale") coef = str2dbl(line[1]);
|
||||||
else if (line[0] == "number_of_points") {
|
else if (line[0] == "number_of_points") {
|
||||||
|
@ -34,14 +34,14 @@ ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronChargeDensityLinear::ElectronChargeDensityLinear(
|
ElectronChargeDensityLinear::ElectronChargeDensityLinear(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronChargeDensity()
|
: ElectronChargeDensity()
|
||||||
{
|
{
|
||||||
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
||||||
vector<string> line;
|
vector<string> line;
|
||||||
while(fileId.good()) {
|
while(fileId.good()) {
|
||||||
command_line(fileId, line);
|
command_line(fileId, line);
|
||||||
if (line.size() == 0) continue;
|
if (line.size() == 0) continue;
|
||||||
if (line[0] == "end") return;
|
if (line[0] == "end") return;
|
||||||
double value = str2dbl(line[1]);
|
double value = str2dbl(line[1]);
|
||||||
if (line[0] == "coefficient") {
|
if (line[0] == "coefficient") {
|
||||||
|
@ -52,7 +52,7 @@ ElectronChargeDensityLinear::ElectronChargeDensityLinear(
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronChargeDensityExponential::ElectronChargeDensityExponential(
|
ElectronChargeDensityExponential::ElectronChargeDensityExponential(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronChargeDensity(),
|
: ElectronChargeDensity(),
|
||||||
intrinsicConcentration_(0),
|
intrinsicConcentration_(0),
|
||||||
intrinsicEnergy_(0),
|
intrinsicEnergy_(0),
|
||||||
|
@ -62,7 +62,7 @@ ElectronChargeDensityExponential::ElectronChargeDensityExponential(
|
||||||
vector<string> line;
|
vector<string> line;
|
||||||
while(fileId.good()) {
|
while(fileId.good()) {
|
||||||
command_line(fileId, line);
|
command_line(fileId, line);
|
||||||
if (line.size() == 0) continue;
|
if (line.size() == 0) continue;
|
||||||
if (line[0] == "end") return;
|
if (line[0] == "end") return;
|
||||||
double value = str2dbl(line[1]);
|
double value = str2dbl(line[1]);
|
||||||
if (line[0] == "intrinsic_concentration") {
|
if (line[0] == "intrinsic_concentration") {
|
||||||
|
@ -84,7 +84,7 @@ ElectronChargeDensityExponential::ElectronChargeDensityExponential(
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
|
ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronChargeDensity(),
|
: ElectronChargeDensity(),
|
||||||
Ef_(0),
|
Ef_(0),
|
||||||
referenceTemperature_(0),
|
referenceTemperature_(0),
|
||||||
|
@ -96,7 +96,7 @@ ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
|
||||||
vector<string> line;
|
vector<string> line;
|
||||||
while(fileId.good()) {
|
while(fileId.good()) {
|
||||||
command_line(fileId, line);
|
command_line(fileId, line);
|
||||||
if (line.size() == 0) continue;
|
if (line.size() == 0) continue;
|
||||||
if (line[0] == "end") return;
|
if (line[0] == "end") return;
|
||||||
double value = str2dbl(line[1]);
|
double value = str2dbl(line[1]);
|
||||||
if (line[0] == "fermi_energy") {
|
if (line[0] == "fermi_energy") {
|
||||||
|
@ -120,7 +120,7 @@ ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
|
||||||
else if (line[0] == "donor_concentration") {
|
else if (line[0] == "donor_concentration") {
|
||||||
donorIonization_ = true;
|
donorIonization_ = true;
|
||||||
Nd_ = value;
|
Nd_ = value;
|
||||||
parameters["donor_concentration"] = Nd_;
|
parameters["donor_concentration"] = Nd_;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ATC_Error( "unrecognized material function "+line[0]);
|
throw ATC_Error( "unrecognized material function "+line[0]);
|
||||||
|
|
|
@ -12,8 +12,8 @@ const double tol = 1.e-8;
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronChargeDensity
|
* @class ElectronChargeDensity
|
||||||
* @brief Base class for models of extrinsic electric charges
|
* @brief Base class for models of extrinsic electric charges
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronChargeDensity
|
class ElectronChargeDensity
|
||||||
|
@ -24,10 +24,10 @@ namespace ATC {
|
||||||
virtual bool electron_charge_density(const FIELD_MATS & /* fields */,
|
virtual bool electron_charge_density(const FIELD_MATS & /* fields */,
|
||||||
DENS_MAT & /* flux */) const { return false; };
|
DENS_MAT & /* flux */) const { return false; };
|
||||||
|
|
||||||
|
|
||||||
virtual void D_electron_charge_density(const FieldName /* fieldName */,
|
virtual void D_electron_charge_density(const FieldName /* fieldName */,
|
||||||
const FIELD_MATS & /* fields */,
|
const FIELD_MATS & /* fields */,
|
||||||
DENS_MAT & /* flux */) const
|
DENS_MAT & /* flux */) const
|
||||||
{ throw ATC_Error("Charge density D_electron_charge_density unimplemented function");}
|
{ throw ATC_Error("Charge density D_electron_charge_density unimplemented function");}
|
||||||
|
|
||||||
virtual void band_edge_potential(const FIELD_MATS & /* fields */,
|
virtual void band_edge_potential(const FIELD_MATS & /* fields */,
|
||||||
|
@ -51,13 +51,13 @@ namespace ATC {
|
||||||
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
||||||
const DENS_MAT & phi = phi_field->second;
|
const DENS_MAT & phi = phi_field->second;
|
||||||
int nNodes = phi.nRows();
|
int nNodes = phi.nRows();
|
||||||
flux.reset(nNodes,1,false);
|
flux.reset(nNodes,1,false);
|
||||||
for (int i = 0; i < nNodes; i++) { // a mapping of a vector
|
for (int i = 0; i < nNodes; i++) { // a mapping of a vector
|
||||||
flux(i,0) = n_.f(phi(i,0));
|
flux(i,0) = n_.f(phi(i,0));
|
||||||
}
|
}
|
||||||
flux *= -1.;
|
flux *= -1.;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
virtual void D_electron_charge_density(const FieldName /* field */,
|
virtual void D_electron_charge_density(const FieldName /* field */,
|
||||||
const FIELD_MATS &fields,
|
const FIELD_MATS &fields,
|
||||||
DENS_MAT &coef) const
|
DENS_MAT &coef) const
|
||||||
|
@ -65,10 +65,10 @@ namespace ATC {
|
||||||
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
||||||
const DENS_MAT & phi = phi_field->second;
|
const DENS_MAT & phi = phi_field->second;
|
||||||
int nNodes = phi.nRows();
|
int nNodes = phi.nRows();
|
||||||
coef.reset(nNodes,1,false);
|
coef.reset(nNodes,1,false);
|
||||||
for (int i = 0; i < nNodes; i++) {
|
for (int i = 0; i < nNodes; i++) {
|
||||||
coef(i,0) = n_.dfdt(phi(i,0));
|
coef(i,0) = n_.dfdt(phi(i,0));
|
||||||
coef(i,0) = n_.dfdt(phi(i,0));
|
coef(i,0) = n_.dfdt(phi(i,0));
|
||||||
}
|
}
|
||||||
coef *= -1.;
|
coef *= -1.;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ namespace ATC {
|
||||||
flux = phi_field->second;
|
flux = phi_field->second;
|
||||||
flux *= -C_;
|
flux *= -C_;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
virtual void D_electron_charge_density(const FieldName /* field */,
|
virtual void D_electron_charge_density(const FieldName /* field */,
|
||||||
const FIELD_MATS &fields,
|
const FIELD_MATS &fields,
|
||||||
DENS_MAT &coef) const
|
DENS_MAT &coef) const
|
||||||
|
@ -111,7 +111,7 @@ namespace ATC {
|
||||||
/**
|
/**
|
||||||
* @class ElectronChargeDensityExponential
|
* @class ElectronChargeDensityExponential
|
||||||
* @brief Class for models of electron charge density dependent on difference between electric potential and the Fermi level n = n_i exp ( (phi-E_i) / kB T)
|
* @brief Class for models of electron charge density dependent on difference between electric potential and the Fermi level n = n_i exp ( (phi-E_i) / kB T)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronChargeDensityExponential : public ElectronChargeDensity
|
class ElectronChargeDensityExponential : public ElectronChargeDensity
|
||||||
{
|
{
|
||||||
|
@ -121,13 +121,13 @@ namespace ATC {
|
||||||
|
|
||||||
double n(const double phi, double T) const
|
double n(const double phi, double T) const
|
||||||
{
|
{
|
||||||
return -intrinsicConcentration_*exp((phi-intrinsicEnergy_)/(kBeV_*T));
|
return -intrinsicConcentration_*exp((phi-intrinsicEnergy_)/(kBeV_*T));
|
||||||
}
|
}
|
||||||
double dndphi(const double phi, double T) const
|
double dndphi(const double phi, double T) const
|
||||||
{
|
{
|
||||||
return n(phi,T)/(kBeV_*T);
|
return n(phi,T)/(kBeV_*T);
|
||||||
}
|
}
|
||||||
virtual bool electron_charge_density(const FIELD_MATS &fields,
|
virtual bool electron_charge_density(const FIELD_MATS &fields,
|
||||||
DENS_MAT &density) const
|
DENS_MAT &density) const
|
||||||
{
|
{
|
||||||
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
||||||
|
@ -139,17 +139,17 @@ namespace ATC {
|
||||||
density.resize(nNodes,1);
|
density.resize(nNodes,1);
|
||||||
if (hasTref) {
|
if (hasTref) {
|
||||||
T = referenceTemperature_;
|
T = referenceTemperature_;
|
||||||
for (int i = 0; i < nNodes; i++) {
|
for (int i = 0; i < nNodes; i++) {
|
||||||
density(i,0) = n(phi(i,0),T); }
|
density(i,0) = n(phi(i,0),T); }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const DENS_MAT & temp = T_field->second;
|
const DENS_MAT & temp = T_field->second;
|
||||||
for (int i = 0; i < nNodes; i++) {
|
for (int i = 0; i < nNodes; i++) {
|
||||||
density(i,0) = n(phi(i,0),temp(i,0)); }
|
density(i,0) = n(phi(i,0),temp(i,0)); }
|
||||||
}
|
}
|
||||||
density *= -1.;
|
density *= -1.;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
virtual void D_electron_charge_density(const FieldName /* field */,
|
virtual void D_electron_charge_density(const FieldName /* field */,
|
||||||
const FIELD_MATS &fields,
|
const FIELD_MATS &fields,
|
||||||
DENS_MAT &coef) const
|
DENS_MAT &coef) const
|
||||||
|
@ -163,16 +163,16 @@ namespace ATC {
|
||||||
coef.resize(nNodes,1);
|
coef.resize(nNodes,1);
|
||||||
if (hasTref) {
|
if (hasTref) {
|
||||||
T = referenceTemperature_;
|
T = referenceTemperature_;
|
||||||
for (int i = 0; i < nNodes; i++) {
|
for (int i = 0; i < nNodes; i++) {
|
||||||
coef(i,0) = dndphi(phi(i,0),T); }
|
coef(i,0) = dndphi(phi(i,0),T); }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const DENS_MAT & temp = T_field->second;
|
const DENS_MAT & temp = T_field->second;
|
||||||
for (int i = 0; i < nNodes; i++) {
|
for (int i = 0; i < nNodes; i++) {
|
||||||
coef(i,0) = dndphi(phi(i,0),temp(i,0)); }
|
coef(i,0) = dndphi(phi(i,0),temp(i,0)); }
|
||||||
}
|
}
|
||||||
coef *= -1.;
|
coef *= -1.;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double intrinsicConcentration_,intrinsicEnergy_;
|
double intrinsicConcentration_,intrinsicEnergy_;
|
||||||
double referenceTemperature_;
|
double referenceTemperature_;
|
||||||
|
@ -181,8 +181,8 @@ namespace ATC {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @class ElectronChargeDensityFermiDirac
|
* @class ElectronChargeDensityFermiDirac
|
||||||
* @brief Class for models of electron charge density based on Fermi-Dirac statistics
|
* @brief Class for models of electron charge density based on Fermi-Dirac statistics
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronChargeDensityFermiDirac : public ElectronChargeDensity
|
class ElectronChargeDensityFermiDirac : public ElectronChargeDensity
|
||||||
{
|
{
|
||||||
|
@ -195,7 +195,7 @@ namespace ATC {
|
||||||
if (T > 0) f = 1.0 / ( exp((E-Ef_)/kBeV_/T)+1.0 );
|
if (T > 0) f = 1.0 / ( exp((E-Ef_)/kBeV_/T)+1.0 );
|
||||||
else if (E > Ef_) f = 0;
|
else if (E > Ef_) f = 0;
|
||||||
return f;
|
return f;
|
||||||
};
|
};
|
||||||
virtual bool electron_charge_density(const FIELD_MATS &fields,
|
virtual bool electron_charge_density(const FIELD_MATS &fields,
|
||||||
DENS_MAT &density) const
|
DENS_MAT &density) const
|
||||||
{
|
{
|
||||||
|
@ -215,34 +215,34 @@ namespace ATC {
|
||||||
const DENS_MAT & phi = phi_field->second;
|
const DENS_MAT & phi = phi_field->second;
|
||||||
|
|
||||||
int nNodes = psi.nRows();
|
int nNodes = psi.nRows();
|
||||||
density.reset(nNodes,1);
|
density.reset(nNodes,1);
|
||||||
double T = referenceTemperature_;
|
double T = referenceTemperature_;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < nNodes; i++) {
|
for (int i = 0; i < nNodes; i++) {
|
||||||
if (!hasReferenceTemperature_) { T = Ts(i,0); }
|
if (!hasReferenceTemperature_) { T = Ts(i,0); }
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (j = 0; j < psis.nCols(); j++) {
|
for (j = 0; j < psis.nCols(); j++) {
|
||||||
double E = Es(j,0); // Eigenvalue
|
double E = Es(j,0); // Eigenvalue
|
||||||
double f = fermi_dirac(E,T);
|
double f = fermi_dirac(E,T);
|
||||||
if (f < tol) break;
|
if (f < tol) break;
|
||||||
else count++;
|
else count++;
|
||||||
density(i,0) -= psis(i,j)*psis(i,j)*f; // < 0
|
density(i,0) -= psis(i,j)*psis(i,j)*f; // < 0
|
||||||
}
|
}
|
||||||
if (donorIonization_) {
|
if (donorIonization_) {
|
||||||
double E = -1.0* phi(i,0);// units [eV] E = - |e| phi
|
double E = -1.0* phi(i,0);// units [eV] E = - |e| phi
|
||||||
if ( E + Eb_ > Ef_+Ed_) density(i,0) += Nd_; // > 0
|
if ( E + Eb_ > Ef_+Ed_) density(i,0) += Nd_; // > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
virtual void D_electron_charge_density(const FieldName /* fieldName */,
|
virtual void D_electron_charge_density(const FieldName /* fieldName */,
|
||||||
const FIELD_MATS &fields,
|
const FIELD_MATS &fields,
|
||||||
DENS_MAT &coef) const
|
DENS_MAT &coef) const
|
||||||
{
|
{
|
||||||
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
|
||||||
const DENS_MAT & phi = phi_field->second;
|
const DENS_MAT & phi = phi_field->second;
|
||||||
int nNodes = phi.nRows();
|
int nNodes = phi.nRows();
|
||||||
coef.reset(nNodes,1,false);
|
coef.reset(nNodes,1,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void band_edge_potential(const FIELD_MATS &fields,
|
virtual void band_edge_potential(const FIELD_MATS &fields,
|
||||||
|
@ -251,7 +251,7 @@ namespace ATC {
|
||||||
FIELD_MATS::const_iterator p_field = fields.find(ELECTRIC_POTENTIAL);
|
FIELD_MATS::const_iterator p_field = fields.find(ELECTRIC_POTENTIAL);
|
||||||
const DENS_MAT & phi = p_field->second;
|
const DENS_MAT & phi = p_field->second;
|
||||||
int nNodes = phi.nRows();
|
int nNodes = phi.nRows();
|
||||||
density.reset(nNodes,1,false);
|
density.reset(nNodes,1,false);
|
||||||
density = Eb_;
|
density = Eb_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -264,6 +264,6 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ATC {
|
||||||
|
|
||||||
ElectronDragPowerLinear::ElectronDragPowerLinear(fstream &fileId,
|
ElectronDragPowerLinear::ElectronDragPowerLinear(fstream &fileId,
|
||||||
map<string,double> & parameters,
|
map<string,double> & parameters,
|
||||||
Material * material)
|
Material * material)
|
||||||
: ElectronDragPower(),
|
: ElectronDragPower(),
|
||||||
electronDragInvTau_(0),
|
electronDragInvTau_(0),
|
||||||
material_(material)
|
material_(material)
|
||||||
|
@ -42,7 +42,7 @@ ElectronDragPowerLinear::ElectronDragPowerLinear(fstream &fileId,
|
||||||
const GRAD_FIELD_MATS & /* gradFields */,
|
const GRAD_FIELD_MATS & /* gradFields */,
|
||||||
DENS_MAT & flux)
|
DENS_MAT & flux)
|
||||||
{
|
{
|
||||||
|
|
||||||
FIELD_MATS::const_iterator evField = fields.find(ELECTRON_VELOCITY);
|
FIELD_MATS::const_iterator evField = fields.find(ELECTRON_VELOCITY);
|
||||||
const DENS_MAT & v = evField->second;
|
const DENS_MAT & v = evField->second;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ ElectronDragPowerLinear::ElectronDragPowerLinear(fstream &fileId,
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectronDragPowerLinear::electron_drag_velocity_coefficient(const FIELD_MATS &fields,
|
void ElectronDragPowerLinear::electron_drag_velocity_coefficient(const FIELD_MATS &fields,
|
||||||
DENS_MAT & dragCoef)
|
DENS_MAT & dragCoef)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronDragPower
|
* @class ElectronDragPower
|
||||||
* @brief Base class for defining the lattice drag power from electrons
|
* @brief Base class for defining the lattice drag power from electrons
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronDragPowerLinear
|
* @class ElectronDragPowerLinear
|
||||||
* @brief Class for electron drag that linearly depends on the difference between the electron and lattice velocities
|
* @brief Class for electron drag that linearly depends on the difference between the electron and lattice velocities
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronDragPowerLinear : public ElectronDragPower
|
class ElectronDragPowerLinear : public ElectronDragPower
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -66,6 +66,6 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ ElectronFlux::ElectronFlux() :
|
||||||
|
|
||||||
|
|
||||||
ElectronFluxLinear::ElectronFluxLinear(
|
ElectronFluxLinear::ElectronFluxLinear(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronFlux(),
|
: ElectronFlux(),
|
||||||
electronMobility_(0),
|
electronMobility_(0),
|
||||||
electronDiffusivity_(0)
|
electronDiffusivity_(0)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ ElectronFluxLinear::ElectronFluxLinear(
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronFluxThermopower::ElectronFluxThermopower(
|
ElectronFluxThermopower::ElectronFluxThermopower(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronFlux(),
|
: ElectronFlux(),
|
||||||
electronMobility_(0),
|
electronMobility_(0),
|
||||||
seebeckCoef_(0)
|
seebeckCoef_(0)
|
||||||
|
@ -61,7 +61,7 @@ ElectronFluxThermopower::ElectronFluxThermopower(
|
||||||
vector<string> line;
|
vector<string> line;
|
||||||
while(fileId.good()) {
|
while(fileId.good()) {
|
||||||
command_line(fileId, line);
|
command_line(fileId, line);
|
||||||
if (line.size() == 0) continue;
|
if (line.size() == 0) continue;
|
||||||
if (line[0] == "end") return;
|
if (line[0] == "end") return;
|
||||||
double value = str2dbl(line[1]);
|
double value = str2dbl(line[1]);
|
||||||
if (line[0] == "mobility") {
|
if (line[0] == "mobility") {
|
||||||
|
@ -79,7 +79,7 @@ ElectronFluxThermopower::ElectronFluxThermopower(
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronFluxConvection::ElectronFluxConvection(
|
ElectronFluxConvection::ElectronFluxConvection(
|
||||||
fstream &fileId, map<string,double> & /* parameters */)
|
fstream &fileId, map<string,double> & /* parameters */)
|
||||||
: ElectronFlux()
|
: ElectronFlux()
|
||||||
{
|
{
|
||||||
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
|
||||||
|
|
|
@ -20,12 +20,12 @@ namespace ATC {
|
||||||
/** computes flux */
|
/** computes flux */
|
||||||
virtual void electron_flux(const FIELD_MATS &fields,
|
virtual void electron_flux(const FIELD_MATS &fields,
|
||||||
const GRAD_FIELD_MATS & /* gradFields */,
|
const GRAD_FIELD_MATS & /* gradFields */,
|
||||||
DENS_MAT_VEC &flux)
|
DENS_MAT_VEC &flux)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
|
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
|
||||||
const DENS_MAT & etMat = etField->second;
|
const DENS_MAT & etMat = etField->second;
|
||||||
zeroWorkspace_.reset(etMat.nRows(),etMat.nCols());
|
zeroWorkspace_.reset(etMat.nRows(),etMat.nCols());
|
||||||
|
@ -75,12 +75,12 @@ namespace ATC {
|
||||||
DENS_MAT zeroWorkspace_;
|
DENS_MAT zeroWorkspace_;
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronFluxLinear
|
* @class ElectronFluxLinear
|
||||||
* @brief Class for drift-diffusion electron flux with linear dependency on the electron density gradient
|
* @brief Class for drift-diffusion electron flux with linear dependency on the electron density gradient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronFluxLinear : public ElectronFlux
|
class ElectronFluxLinear : public ElectronFlux
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -98,7 +98,7 @@ namespace ATC {
|
||||||
const DENS_MAT & n = edField->second;
|
const DENS_MAT & n = edField->second;
|
||||||
const DENS_MAT_VEC & dn = dEdField->second;
|
const DENS_MAT_VEC & dn = dEdField->second;
|
||||||
const DENS_MAT_VEC & dphi = dPhiField->second;
|
const DENS_MAT_VEC & dphi = dPhiField->second;
|
||||||
|
|
||||||
//n.print("DENSITY");
|
//n.print("DENSITY");
|
||||||
//for (int i = 0; i < 3; i++) {
|
//for (int i = 0; i < 3; i++) {
|
||||||
// dn[i].print("GRAD N");
|
// dn[i].print("GRAD N");
|
||||||
|
@ -131,17 +131,17 @@ namespace ATC {
|
||||||
flux[2] += -electronDiffusivity_* dn[2];
|
flux[2] += -electronDiffusivity_* dn[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double electronMobility_, electronDiffusivity_;
|
double electronMobility_, electronDiffusivity_;
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronFluxThermopower
|
* @class ElectronFluxThermopower
|
||||||
* @brief Class for defining the electron flux (i.e., current) to include the elctron velocity or have a electron temperature-dependent mobility
|
* @brief Class for defining the electron flux (i.e., current) to include the elctron velocity or have a electron temperature-dependent mobility
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronFluxThermopower : public ElectronFlux
|
class ElectronFluxThermopower : public ElectronFlux
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -165,13 +165,13 @@ namespace ATC {
|
||||||
GRAD_FIELD_MATS::const_iterator dPhiField = gradFields.find(ELECTRIC_POTENTIAL);
|
GRAD_FIELD_MATS::const_iterator dPhiField = gradFields.find(ELECTRIC_POTENTIAL);
|
||||||
GRAD_FIELD_MATS::const_iterator dEtField = gradFields.find(ELECTRON_TEMPERATURE);
|
GRAD_FIELD_MATS::const_iterator dEtField = gradFields.find(ELECTRON_TEMPERATURE);
|
||||||
|
|
||||||
// J_n = - \mu n grad \phi - \mu kB/e T_e grad n
|
// J_n = - \mu n grad \phi - \mu kB/e T_e grad n
|
||||||
// - \mu S n grad T_e - \mu kB/e n grad T_e
|
// - \mu S n grad T_e - \mu kB/e n grad T_e
|
||||||
const DENS_MAT & n = edField->second;
|
const DENS_MAT & n = edField->second;
|
||||||
const DENS_MAT_VEC & dn = dEdField->second;
|
const DENS_MAT_VEC & dn = dEdField->second;
|
||||||
const DENS_MAT_VEC & dphi = dPhiField->second;
|
const DENS_MAT_VEC & dphi = dPhiField->second;
|
||||||
const DENS_MAT_VEC & dT = dEtField->second;
|
const DENS_MAT_VEC & dT = dEtField->second;
|
||||||
|
|
||||||
flux[0] = -electronMobility_*dphi[0];
|
flux[0] = -electronMobility_*dphi[0];
|
||||||
flux[1] = -electronMobility_*dphi[1];
|
flux[1] = -electronMobility_*dphi[1];
|
||||||
flux[2] = -electronMobility_*dphi[2];
|
flux[2] = -electronMobility_*dphi[2];
|
||||||
|
@ -179,7 +179,7 @@ namespace ATC {
|
||||||
flux[0] += coef* dT[0];
|
flux[0] += coef* dT[0];
|
||||||
flux[1] += coef* dT[1];
|
flux[1] += coef* dT[1];
|
||||||
flux[2] += coef* dT[2];
|
flux[2] += coef* dT[2];
|
||||||
flux[0] *= n; // scale by n
|
flux[0] *= n; // scale by n
|
||||||
flux[1] *= n;
|
flux[1] *= n;
|
||||||
flux[2] *= n;
|
flux[2] *= n;
|
||||||
|
|
||||||
|
@ -188,23 +188,23 @@ namespace ATC {
|
||||||
//tmp[0] *= Te;
|
//tmp[0] *= Te;
|
||||||
//tmp[1] *= Te;
|
//tmp[1] *= Te;
|
||||||
//tmp[2] *= Te;
|
//tmp[2] *= Te;
|
||||||
coef = -electronMobility_*kBeV_;
|
coef = -electronMobility_*kBeV_;
|
||||||
//flux[0] += tmp[0];
|
//flux[0] += tmp[0];
|
||||||
flux[0] += dn[0].mult_by_element(Te);
|
flux[0] += dn[0].mult_by_element(Te);
|
||||||
flux[1] += dn[1].mult_by_element(Te);
|
flux[1] += dn[1].mult_by_element(Te);
|
||||||
flux[2] += dn[2].mult_by_element(Te);
|
flux[2] += dn[2].mult_by_element(Te);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double electronMobility_, seebeckCoef_;
|
double electronMobility_, seebeckCoef_;
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronFluxConvection
|
* @class ElectronFluxConvection
|
||||||
* @brief Class for electron flux based on the standard convection term
|
* @brief Class for electron flux based on the standard convection term
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronFluxConvection : public ElectronFlux
|
class ElectronFluxConvection : public ElectronFlux
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -220,6 +220,6 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ using std::vector;
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
ElectronHeatCapacityConstant::ElectronHeatCapacityConstant(
|
ElectronHeatCapacityConstant::ElectronHeatCapacityConstant(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronHeatCapacity(),
|
: ElectronHeatCapacity(),
|
||||||
electronHeatCapacity_(0)
|
electronHeatCapacity_(0)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ ElectronHeatCapacityConstant::ElectronHeatCapacityConstant(
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronHeatCapacityLinear::ElectronHeatCapacityLinear(
|
ElectronHeatCapacityLinear::ElectronHeatCapacityLinear(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronHeatCapacity(),
|
: ElectronHeatCapacity(),
|
||||||
electronHeatCapacity_(0)
|
electronHeatCapacity_(0)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ ElectronHeatCapacityLinear::ElectronHeatCapacityLinear(
|
||||||
|
|
||||||
ElectronHeatCapacityConstantAddDensity::ElectronHeatCapacityConstantAddDensity(fstream &fileId,
|
ElectronHeatCapacityConstantAddDensity::ElectronHeatCapacityConstantAddDensity(fstream &fileId,
|
||||||
map<string,double> & parameters,
|
map<string,double> & parameters,
|
||||||
Material * material)
|
Material * material)
|
||||||
: ElectronHeatCapacityConstant(fileId, parameters),
|
: ElectronHeatCapacityConstant(fileId, parameters),
|
||||||
material_(material)
|
material_(material)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ ElectronHeatCapacityConstantAddDensity::ElectronHeatCapacityConstantAddDensity(f
|
||||||
|
|
||||||
ElectronHeatCapacityLinearAddDensity::ElectronHeatCapacityLinearAddDensity(fstream &fileId,
|
ElectronHeatCapacityLinearAddDensity::ElectronHeatCapacityLinearAddDensity(fstream &fileId,
|
||||||
map<string,double> & parameters,
|
map<string,double> & parameters,
|
||||||
Material * material)
|
Material * material)
|
||||||
: ElectronHeatCapacityLinear(fileId, parameters),
|
: ElectronHeatCapacityLinear(fileId, parameters),
|
||||||
material_(material)
|
material_(material)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,19 +27,19 @@ namespace ATC {
|
||||||
DENS_MAT_VEC & Dcapacity)=0;
|
DENS_MAT_VEC & Dcapacity)=0;
|
||||||
/** computes thermal energy */
|
/** computes thermal energy */
|
||||||
virtual void electron_thermal_energy(const FIELD_MATS &fields,
|
virtual void electron_thermal_energy(const FIELD_MATS &fields,
|
||||||
DENS_MAT &energy)=0;
|
DENS_MAT &energy)=0;
|
||||||
};
|
};
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronHeatCapacityConstant
|
* @class ElectronHeatCapacityConstant
|
||||||
* @brief Class for a constant electron heat capacity
|
* @brief Class for a constant electron heat capacity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronHeatCapacityConstant : public ElectronHeatCapacity
|
class ElectronHeatCapacityConstant : public ElectronHeatCapacity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElectronHeatCapacityConstant(std::fstream &matfile,
|
ElectronHeatCapacityConstant(std::fstream &matfile,
|
||||||
std::map<std::string,double> & parameters);
|
std::map<std::string,double> & parameters);
|
||||||
virtual ~ElectronHeatCapacityConstant() {};
|
virtual ~ElectronHeatCapacityConstant() {};
|
||||||
virtual void electron_heat_capacity(const FIELD_MATS &fields,
|
virtual void electron_heat_capacity(const FIELD_MATS &fields,
|
||||||
|
@ -59,25 +59,25 @@ namespace ATC {
|
||||||
Dcapacity[0] = zeroWorkspace_;
|
Dcapacity[0] = zeroWorkspace_;
|
||||||
Dcapacity[1] = zeroWorkspace_;
|
Dcapacity[1] = zeroWorkspace_;
|
||||||
Dcapacity[2] = zeroWorkspace_;
|
Dcapacity[2] = zeroWorkspace_;
|
||||||
}
|
}
|
||||||
virtual void electron_thermal_energy(const FIELD_MATS &fields,
|
virtual void electron_thermal_energy(const FIELD_MATS &fields,
|
||||||
DENS_MAT &energy)
|
DENS_MAT &energy)
|
||||||
{
|
{
|
||||||
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
|
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
|
||||||
const DENS_MAT & T = etField->second;
|
const DENS_MAT & T = etField->second;
|
||||||
energy = electronHeatCapacity_ * T;
|
energy = electronHeatCapacity_ * T;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double electronHeatCapacity_;
|
double electronHeatCapacity_;
|
||||||
DENS_MAT zeroWorkspace_;
|
DENS_MAT zeroWorkspace_;
|
||||||
};
|
};
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronHeatCapacityLinear
|
* @class ElectronHeatCapacityLinear
|
||||||
* @brief Class for an electron capacity that is directly proportional to the electron temperature
|
* @brief Class for an electron capacity that is directly proportional to the electron temperature
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronHeatCapacityLinear : public ElectronHeatCapacity
|
class ElectronHeatCapacityLinear : public ElectronHeatCapacity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -108,21 +108,21 @@ namespace ATC {
|
||||||
const DENS_MAT & T = etField->second;
|
const DENS_MAT & T = etField->second;
|
||||||
energy = electronHeatCapacity_ * T;
|
energy = electronHeatCapacity_ * T;
|
||||||
energy *= T;
|
energy *= T;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double electronHeatCapacity_;
|
double electronHeatCapacity_;
|
||||||
};
|
};
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronHeatCapacityConstantAddDensity
|
* @class ElectronHeatCapacityConstantAddDensity
|
||||||
* @brief Class for a constant electron specific heat capacity (i.e, does not include the electron density)
|
* @brief Class for a constant electron specific heat capacity (i.e, does not include the electron density)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronHeatCapacityConstantAddDensity : public ElectronHeatCapacityConstant
|
class ElectronHeatCapacityConstantAddDensity : public ElectronHeatCapacityConstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElectronHeatCapacityConstantAddDensity(std::fstream &matfile,
|
ElectronHeatCapacityConstantAddDensity(std::fstream &matfile,
|
||||||
std::map<std::string,double> & parameters,
|
std::map<std::string,double> & parameters,
|
||||||
Material * material);
|
Material * material);
|
||||||
virtual ~ElectronHeatCapacityConstantAddDensity() {};
|
virtual ~ElectronHeatCapacityConstantAddDensity() {};
|
||||||
|
@ -165,12 +165,12 @@ namespace ATC {
|
||||||
DENS_MAT capacityMat_; // avoid resizing if possible
|
DENS_MAT capacityMat_; // avoid resizing if possible
|
||||||
};
|
};
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronHeatCapacityLinearAddDensity
|
* @class ElectronHeatCapacityLinearAddDensity
|
||||||
* @brief Class for a electron specific heat capacity that is proportional to the temperature (i.e., does not include density)
|
* @brief Class for a electron specific heat capacity that is proportional to the temperature (i.e., does not include density)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronHeatCapacityLinearAddDensity : public ElectronHeatCapacityLinear
|
class ElectronHeatCapacityLinearAddDensity : public ElectronHeatCapacityLinear
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -199,7 +199,7 @@ namespace ATC {
|
||||||
|
|
||||||
GRAD_FIELD_MATS::const_iterator dEdField = gradFields.find(ELECTRON_DENSITY);
|
GRAD_FIELD_MATS::const_iterator dEdField = gradFields.find(ELECTRON_DENSITY);
|
||||||
const DENS_MAT_VEC & Ddensity = dEdField->second;
|
const DENS_MAT_VEC & Ddensity = dEdField->second;
|
||||||
ElectronHeatCapacityLinear::electron_heat_capacity(fields,capacityWorkspace_);
|
ElectronHeatCapacityLinear::electron_heat_capacity(fields,capacityWorkspace_);
|
||||||
Dcapacity[0] += Ddensity[0].mult_by_element(capacityWorkspace_);
|
Dcapacity[0] += Ddensity[0].mult_by_element(capacityWorkspace_);
|
||||||
Dcapacity[1] += Ddensity[1].mult_by_element(capacityWorkspace_);
|
Dcapacity[1] += Ddensity[1].mult_by_element(capacityWorkspace_);
|
||||||
Dcapacity[2] += Ddensity[2].mult_by_element(capacityWorkspace_);
|
Dcapacity[2] += Ddensity[2].mult_by_element(capacityWorkspace_);
|
||||||
|
@ -208,7 +208,7 @@ namespace ATC {
|
||||||
DENS_MAT &energy)
|
DENS_MAT &energy)
|
||||||
{
|
{
|
||||||
ElectronHeatCapacityLinear::electron_thermal_energy(fields,energy);
|
ElectronHeatCapacityLinear::electron_thermal_energy(fields,energy);
|
||||||
|
|
||||||
FIELD_MATS::const_iterator edField = fields.find(ELECTRON_DENSITY);
|
FIELD_MATS::const_iterator edField = fields.find(ELECTRON_DENSITY);
|
||||||
const DENS_MAT & density = edField->second;
|
const DENS_MAT & density = edField->second;
|
||||||
|
|
||||||
|
@ -220,6 +220,6 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ ElectronHeatFlux::ElectronHeatFlux(ElectronHeatCapacity * electronHeatCapacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronHeatFluxLinear::ElectronHeatFluxLinear(fstream &fileId, map<string,double> & parameters,
|
ElectronHeatFluxLinear::ElectronHeatFluxLinear(fstream &fileId, map<string,double> & parameters,
|
||||||
ElectronHeatCapacity * electronHeatCapacity)
|
ElectronHeatCapacity * electronHeatCapacity)
|
||||||
: ElectronHeatFlux(electronHeatCapacity),
|
: ElectronHeatFlux(electronHeatCapacity),
|
||||||
conductivity_(0)
|
conductivity_(0)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ ElectronHeatFluxLinear::ElectronHeatFluxLinear(fstream &fileId, map<string,doubl
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronHeatFluxPowerLaw::ElectronHeatFluxPowerLaw(fstream &fileId, map<string,double> & parameters,
|
ElectronHeatFluxPowerLaw::ElectronHeatFluxPowerLaw(fstream &fileId, map<string,double> & parameters,
|
||||||
ElectronHeatCapacity * electronHeatCapacity)
|
ElectronHeatCapacity * electronHeatCapacity)
|
||||||
: ElectronHeatFlux(electronHeatCapacity),
|
: ElectronHeatFlux(electronHeatCapacity),
|
||||||
conductivity_(0)
|
conductivity_(0)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ ElectronHeatFluxPowerLaw::ElectronHeatFluxPowerLaw(fstream &fileId, map<string,d
|
||||||
ElectronHeatFluxThermopower::ElectronHeatFluxThermopower(
|
ElectronHeatFluxThermopower::ElectronHeatFluxThermopower(
|
||||||
fstream &fileId, map<string,double> & parameters,
|
fstream &fileId, map<string,double> & parameters,
|
||||||
/*const*/ ElectronFlux * electronFlux,
|
/*const*/ ElectronFlux * electronFlux,
|
||||||
ElectronHeatCapacity * electronHeatCapacity)
|
ElectronHeatCapacity * electronHeatCapacity)
|
||||||
: ElectronHeatFlux(electronHeatCapacity),
|
: ElectronHeatFlux(electronHeatCapacity),
|
||||||
conductivity_(0),
|
conductivity_(0),
|
||||||
seebeckCoef_(0),
|
seebeckCoef_(0),
|
||||||
|
@ -86,7 +86,7 @@ ElectronHeatFluxThermopower::ElectronHeatFluxThermopower(
|
||||||
else {
|
else {
|
||||||
throw ATC_Error( "unrecognized material function "+line[0]);
|
throw ATC_Error( "unrecognized material function "+line[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
seebeckCoef_ = parameters["seebeck_coefficient"];
|
seebeckCoef_ = parameters["seebeck_coefficient"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace ATC {
|
||||||
const GRAD_FIELD_MATS & /* gradFields */,
|
const GRAD_FIELD_MATS & /* gradFields */,
|
||||||
DENS_MAT_VEC &flux)
|
DENS_MAT_VEC &flux)
|
||||||
{
|
{
|
||||||
|
|
||||||
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
|
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
|
||||||
const DENS_MAT & Te = etField->second;
|
const DENS_MAT & Te = etField->second;
|
||||||
zeroWorkspace_.reset(Te.nRows(),Te.nCols());
|
zeroWorkspace_.reset(Te.nRows(),Te.nCols());
|
||||||
|
@ -47,7 +47,7 @@ namespace ATC {
|
||||||
flux[0] = vx;
|
flux[0] = vx;
|
||||||
flux[1] = vy;
|
flux[1] = vy;
|
||||||
flux[2] = vz;
|
flux[2] = vz;
|
||||||
// scale by thermal energy
|
// scale by thermal energy
|
||||||
flux[0] *= cpTeWorkspace_;
|
flux[0] *= cpTeWorkspace_;
|
||||||
flux[1] *= cpTeWorkspace_;
|
flux[1] *= cpTeWorkspace_;
|
||||||
flux[2] *= cpTeWorkspace_;
|
flux[2] *= cpTeWorkspace_;
|
||||||
|
@ -58,12 +58,12 @@ namespace ATC {
|
||||||
DENS_MAT cpTeWorkspace_; // hopefully avoid resizing
|
DENS_MAT cpTeWorkspace_; // hopefully avoid resizing
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronHeatFluxLinear
|
* @class ElectronHeatFluxLinear
|
||||||
* @brief Class for an electron heat flux proportional to the temperature gradient with constant conductivity
|
* @brief Class for an electron heat flux proportional to the temperature gradient with constant conductivity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronHeatFluxLinear : public ElectronHeatFlux
|
class ElectronHeatFluxLinear : public ElectronHeatFlux
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -80,17 +80,17 @@ namespace ATC {
|
||||||
flux[0] = -conductivity_ * dT[0];
|
flux[0] = -conductivity_ * dT[0];
|
||||||
flux[1] = -conductivity_ * dT[1];
|
flux[1] = -conductivity_ * dT[1];
|
||||||
flux[2] = -conductivity_ * dT[2];
|
flux[2] = -conductivity_ * dT[2];
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double conductivity_;
|
double conductivity_;
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronHeatFluxPowerLaw
|
* @class ElectronHeatFluxPowerLaw
|
||||||
* @brief Class for an electron heat flux proportional to the temperature gradient but with a conductivity proportional to the ratio of the electron and phonon temperatures
|
* @brief Class for an electron heat flux proportional to the temperature gradient but with a conductivity proportional to the ratio of the electron and phonon temperatures
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronHeatFluxPowerLaw : public ElectronHeatFlux
|
class ElectronHeatFluxPowerLaw : public ElectronHeatFlux
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -116,23 +116,23 @@ namespace ATC {
|
||||||
flux[0] *= electronConductivity_;
|
flux[0] *= electronConductivity_;
|
||||||
flux[1] *= electronConductivity_;
|
flux[1] *= electronConductivity_;
|
||||||
flux[2] *= electronConductivity_;
|
flux[2] *= electronConductivity_;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double conductivity_;
|
double conductivity_;
|
||||||
DENS_MAT electronConductivity_; // hopefully avoid resizing
|
DENS_MAT electronConductivity_; // hopefully avoid resizing
|
||||||
};
|
};
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronHeatFluxThermopower
|
* @class ElectronHeatFluxThermopower
|
||||||
* @brief Class for an electron heat flux proportional to the temperature gradient but with a condu
|
* @brief Class for an electron heat flux proportional to the temperature gradient but with a condu
|
||||||
ctivity proportional to the ratio of the electron and phonon temperatures with the thermopower from the electric current included
|
ctivity proportional to the ratio of the electron and phonon temperatures with the thermopower from the electric current included
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronHeatFluxThermopower : public ElectronHeatFlux
|
class ElectronHeatFluxThermopower : public ElectronHeatFlux
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElectronHeatFluxThermopower(std::fstream &matfile,
|
ElectronHeatFluxThermopower(std::fstream &matfile,
|
||||||
std::map<std::string,double> & parameters,
|
std::map<std::string,double> & parameters,
|
||||||
/*const*/ ElectronFlux * electronFlux = nullptr,
|
/*const*/ ElectronFlux * electronFlux = nullptr,
|
||||||
/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
|
/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
|
||||||
|
@ -147,7 +147,7 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t
|
||||||
const DENS_MAT_VEC & dT = dEtField->second;
|
const DENS_MAT_VEC & dT = dEtField->second;
|
||||||
const DENS_MAT & T = tField->second;
|
const DENS_MAT & T = tField->second;
|
||||||
const DENS_MAT & Te = etField->second;
|
const DENS_MAT & Te = etField->second;
|
||||||
|
|
||||||
// flux = -ke * ( Te / T ) dT + pi J_e;
|
// flux = -ke * ( Te / T ) dT + pi J_e;
|
||||||
flux[0] = dT[0];
|
flux[0] = dT[0];
|
||||||
flux[1] = dT[1];
|
flux[1] = dT[1];
|
||||||
|
@ -163,16 +163,16 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t
|
||||||
tmp_[2] *= Te;
|
tmp_[2] *= Te;
|
||||||
flux[0] += seebeckCoef_*tmp_[0];
|
flux[0] += seebeckCoef_*tmp_[0];
|
||||||
flux[1] += seebeckCoef_*tmp_[1];
|
flux[1] += seebeckCoef_*tmp_[1];
|
||||||
flux[2] += seebeckCoef_*tmp_[2];
|
flux[2] += seebeckCoef_*tmp_[2];
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double conductivity_,seebeckCoef_;
|
double conductivity_,seebeckCoef_;
|
||||||
ElectronFlux * electronFlux_;
|
ElectronFlux * electronFlux_;
|
||||||
DENS_MAT elecCondWorkspace_; // hopefully avoid resizing
|
DENS_MAT elecCondWorkspace_; // hopefully avoid resizing
|
||||||
DENS_MAT_VEC tmp_;
|
DENS_MAT_VEC tmp_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ using std::vector;
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
ElectronPhononExchangeLinear::ElectronPhononExchangeLinear(
|
ElectronPhononExchangeLinear::ElectronPhononExchangeLinear(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronPhononExchange(),
|
: ElectronPhononExchange(),
|
||||||
exchangeCoef_(0)
|
exchangeCoef_(0)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ ElectronPhononExchangeLinear::ElectronPhononExchangeLinear(
|
||||||
}
|
}
|
||||||
|
|
||||||
ElectronPhononExchangePowerLaw::ElectronPhononExchangePowerLaw(
|
ElectronPhononExchangePowerLaw::ElectronPhononExchangePowerLaw(
|
||||||
fstream &fileId, map<string,double> & parameters)
|
fstream &fileId, map<string,double> & parameters)
|
||||||
: ElectronPhononExchange(),
|
: ElectronPhononExchange(),
|
||||||
exchangeCoef_(0),
|
exchangeCoef_(0),
|
||||||
exponent_(1)
|
exponent_(1)
|
||||||
|
@ -65,7 +65,7 @@ ElectronPhononExchangePowerLaw::ElectronPhononExchangePowerLaw(
|
||||||
|
|
||||||
ElectronPhononExchangeHertel::ElectronPhononExchangeHertel(fstream &fileId,
|
ElectronPhononExchangeHertel::ElectronPhononExchangeHertel(fstream &fileId,
|
||||||
map<string,double> & parameters,
|
map<string,double> & parameters,
|
||||||
Material * material)
|
Material * material)
|
||||||
: ElectronPhononExchange(),
|
: ElectronPhononExchange(),
|
||||||
exchangeCoef_(0),
|
exchangeCoef_(0),
|
||||||
debeyeTemperature_(1),
|
debeyeTemperature_(1),
|
||||||
|
@ -93,7 +93,7 @@ ElectronPhononExchangeHertel::ElectronPhononExchangeHertel(fstream &fileId,
|
||||||
// coupling coefficient, eqn. 15 of Hertel 2002
|
// coupling coefficient, eqn. 15 of Hertel 2002
|
||||||
double kb = LammpsInterface::instance()->kBoltzmann();
|
double kb = LammpsInterface::instance()->kBoltzmann();
|
||||||
double hbar = LammpsInterface::instance()->hbar();
|
double hbar = LammpsInterface::instance()->hbar();
|
||||||
double PI = 3.141592653589793238;
|
double PI = 3.141592653589793238;
|
||||||
exchangeCoef_ = 144.*1.0369*kb/(PI*hbar);
|
exchangeCoef_ = 144.*1.0369*kb/(PI*hbar);
|
||||||
exchangeCoef_ *= massEnhancement_/pow(debeyeTemperature_,2);
|
exchangeCoef_ *= massEnhancement_/pow(debeyeTemperature_,2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "ATC_TypeDefs.h"
|
#include "ATC_TypeDefs.h"
|
||||||
|
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
class Material;
|
class Material;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,16 +54,16 @@ namespace ATC {
|
||||||
double exchangeCoef_;
|
double exchangeCoef_;
|
||||||
};
|
};
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronPhononExchangePowerLaw
|
* @class ElectronPhononExchangePowerLaw
|
||||||
* @brief Class for electron-phonon exchange proportional to the temperature difference raised to a constant power
|
* @brief Class for electron-phonon exchange proportional to the temperature difference raised to a constant power
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronPhononExchangePowerLaw : public ElectronPhononExchange
|
class ElectronPhononExchangePowerLaw : public ElectronPhononExchange
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElectronPhononExchangePowerLaw(std::fstream &matfile,
|
ElectronPhononExchangePowerLaw(std::fstream &matfile,
|
||||||
std::map<std::string,double> & parameters);
|
std::map<std::string,double> & parameters);
|
||||||
virtual ~ElectronPhononExchangePowerLaw() {};
|
virtual ~ElectronPhononExchangePowerLaw() {};
|
||||||
virtual bool electron_phonon_exchange(const FIELD_MATS &fields,
|
virtual bool electron_phonon_exchange(const FIELD_MATS &fields,
|
||||||
|
@ -78,22 +78,22 @@ namespace ATC {
|
||||||
flux = (Te - T).pow(exponent_);
|
flux = (Te - T).pow(exponent_);
|
||||||
flux *= exchangeCoef_;
|
flux *= exchangeCoef_;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
double exchangeCoef_;
|
double exchangeCoef_;
|
||||||
int exponent_;
|
int exponent_;
|
||||||
};
|
};
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ElectronPhononExchangeHertel
|
* @class ElectronPhononExchangeHertel
|
||||||
* @brief Class for electron-phonon exchange based on the formulation of Hertel for Cu
|
* @brief Class for electron-phonon exchange based on the formulation of Hertel for Cu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ElectronPhononExchangeHertel : public ElectronPhononExchange
|
class ElectronPhononExchangeHertel : public ElectronPhononExchange
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElectronPhononExchangeHertel(std::fstream &matfile,
|
ElectronPhononExchangeHertel(std::fstream &matfile,
|
||||||
std::map<std::string,double> & parameters,
|
std::map<std::string,double> & parameters,
|
||||||
Material * material);
|
Material * material);
|
||||||
virtual ~ElectronPhononExchangeHertel() {};
|
virtual ~ElectronPhononExchangeHertel() {};
|
||||||
|
@ -104,13 +104,13 @@ namespace ATC {
|
||||||
double debeyeTemperature_;
|
double debeyeTemperature_;
|
||||||
double massEnhancement_;
|
double massEnhancement_;
|
||||||
Material * material_;
|
Material * material_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ElectronPhononExchangeHertel() {};
|
ElectronPhononExchangeHertel() {};
|
||||||
DENS_MAT capacityWorkspace_;
|
DENS_MAT capacityWorkspace_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -48,16 +48,16 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool ExtrinsicModelManager::modify(int narg, char **arg)
|
bool ExtrinsicModelManager::modify(int narg, char **arg)
|
||||||
{
|
{
|
||||||
bool foundMatch = false;
|
bool foundMatch = false;
|
||||||
|
|
||||||
// loop over models with command
|
// loop over models with command
|
||||||
vector<ExtrinsicModel *>::iterator imodel;
|
vector<ExtrinsicModel *>::iterator imodel;
|
||||||
for(imodel=extrinsicModels_.begin();
|
for(imodel=extrinsicModels_.begin();
|
||||||
imodel!=extrinsicModels_.end(); imodel++) {
|
imodel!=extrinsicModels_.end(); imodel++) {
|
||||||
foundMatch = (*imodel)->modify(narg,arg);
|
foundMatch = (*imodel)->modify(narg,arg);
|
||||||
if (foundMatch) break;
|
if (foundMatch) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return foundMatch;
|
return foundMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,10 +81,10 @@ namespace ATC {
|
||||||
myModel = new ExtrinsicModelTwoTemperature
|
myModel = new ExtrinsicModelTwoTemperature
|
||||||
(this,modelType,matFileName);
|
(this,modelType,matFileName);
|
||||||
}
|
}
|
||||||
else if (modelType==DRIFT_DIFFUSION
|
else if (modelType==DRIFT_DIFFUSION
|
||||||
|| modelType==DRIFT_DIFFUSION_EQUILIBRIUM
|
|| modelType==DRIFT_DIFFUSION_EQUILIBRIUM
|
||||||
|| modelType==DRIFT_DIFFUSION_SCHRODINGER
|
|| modelType==DRIFT_DIFFUSION_SCHRODINGER
|
||||||
|| modelType==DRIFT_DIFFUSION_SCHRODINGER_SLICE)
|
|| modelType==DRIFT_DIFFUSION_SCHRODINGER_SLICE)
|
||||||
{
|
{
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << "creating drift_diffusion extrinsic model";
|
ss << "creating drift_diffusion extrinsic model";
|
||||||
|
@ -92,7 +92,7 @@ namespace ATC {
|
||||||
myModel = new ExtrinsicModelDriftDiffusion
|
myModel = new ExtrinsicModelDriftDiffusion
|
||||||
(this,modelType,matFileName);
|
(this,modelType,matFileName);
|
||||||
}
|
}
|
||||||
else if (modelType==CONVECTIVE_DRIFT_DIFFUSION
|
else if (modelType==CONVECTIVE_DRIFT_DIFFUSION
|
||||||
|| modelType==CONVECTIVE_DRIFT_DIFFUSION_EQUILIBRIUM
|
|| modelType==CONVECTIVE_DRIFT_DIFFUSION_EQUILIBRIUM
|
||||||
|| modelType==CONVECTIVE_DRIFT_DIFFUSION_SCHRODINGER) {
|
|| modelType==CONVECTIVE_DRIFT_DIFFUSION_SCHRODINGER) {
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
|
@ -129,7 +129,7 @@ namespace ATC {
|
||||||
void ExtrinsicModelManager::construct_transfers()
|
void ExtrinsicModelManager::construct_transfers()
|
||||||
{
|
{
|
||||||
vector<ExtrinsicModel *>::iterator imodel;
|
vector<ExtrinsicModel *>::iterator imodel;
|
||||||
for(imodel=extrinsicModels_.begin();
|
for(imodel=extrinsicModels_.begin();
|
||||||
imodel!=extrinsicModels_.end(); imodel++) {
|
imodel!=extrinsicModels_.end(); imodel++) {
|
||||||
// initialize models
|
// initialize models
|
||||||
(*imodel)->construct_transfers();
|
(*imodel)->construct_transfers();
|
||||||
|
@ -142,7 +142,7 @@ namespace ATC {
|
||||||
void ExtrinsicModelManager::initialize()
|
void ExtrinsicModelManager::initialize()
|
||||||
{
|
{
|
||||||
vector<ExtrinsicModel *>::iterator imodel;
|
vector<ExtrinsicModel *>::iterator imodel;
|
||||||
for(imodel=extrinsicModels_.begin();
|
for(imodel=extrinsicModels_.begin();
|
||||||
imodel!=extrinsicModels_.end(); imodel++) {
|
imodel!=extrinsicModels_.end(); imodel++) {
|
||||||
// initialize models
|
// initialize models
|
||||||
(*imodel)->initialize();
|
(*imodel)->initialize();
|
||||||
|
@ -168,13 +168,13 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
int extrinsicSize = 0;
|
int extrinsicSize = 0;
|
||||||
vector<ExtrinsicModel *>::iterator imodel;
|
vector<ExtrinsicModel *>::iterator imodel;
|
||||||
for(imodel=extrinsicModels_.begin();
|
for(imodel=extrinsicModels_.begin();
|
||||||
imodel!=extrinsicModels_.end(); imodel++) {
|
imodel!=extrinsicModels_.end(); imodel++) {
|
||||||
// query all models for LAMMPS display
|
// query all models for LAMMPS display
|
||||||
int currentSize = intrinsicSize + extrinsicSize;
|
int currentSize = intrinsicSize + extrinsicSize;
|
||||||
extrinsicSize += (*imodel)->size_vector(currentSize);
|
extrinsicSize += (*imodel)->size_vector(currentSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return extrinsicSize;
|
return extrinsicSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
double value = 0.;
|
double value = 0.;
|
||||||
vector<ExtrinsicModel *>::iterator imodel;
|
vector<ExtrinsicModel *>::iterator imodel;
|
||||||
for(imodel=extrinsicModels_.begin();
|
for(imodel=extrinsicModels_.begin();
|
||||||
imodel!=extrinsicModels_.end(); imodel++) {
|
imodel!=extrinsicModels_.end(); imodel++) {
|
||||||
value += (*imodel)->compute_scalar(); // sum
|
value += (*imodel)->compute_scalar(); // sum
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
double value = 0.;
|
double value = 0.;
|
||||||
vector<ExtrinsicModel *>::iterator imodel;
|
vector<ExtrinsicModel *>::iterator imodel;
|
||||||
for(imodel=extrinsicModels_.begin();
|
for(imodel=extrinsicModels_.begin();
|
||||||
imodel!=extrinsicModels_.end(); imodel++) {
|
imodel!=extrinsicModels_.end(); imodel++) {
|
||||||
// query all models for LAMMPS display
|
// query all models for LAMMPS display
|
||||||
if ((*imodel)->compute_vector(n,value))
|
if ((*imodel)->compute_vector(n,value))
|
||||||
|
@ -348,7 +348,7 @@ namespace ATC {
|
||||||
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
|
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
|
||||||
rhsMaskIntrinsic_ = false;
|
rhsMaskIntrinsic_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -371,7 +371,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ExtrinsicModel::num_fields(map<FieldName,int> & fieldSizes)
|
void ExtrinsicModel::num_fields(map<FieldName,int> & fieldSizes)
|
||||||
{
|
{
|
||||||
physicsModel_->num_fields(fieldSizes,atc_->fieldMask_);
|
physicsModel_->num_fields(fieldSizes,atc_->fieldMask_);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ExtrinsicModelManager {
|
class ExtrinsicModelManager {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -98,7 +98,7 @@ namespace ATC {
|
||||||
|
|
||||||
|
|
||||||
/** model name enum to string */
|
/** model name enum to string */
|
||||||
static bool model_to_string(const ExtrinsicModelType index, std::string & name)
|
static bool model_to_string(const ExtrinsicModelType index, std::string & name)
|
||||||
{
|
{
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case NO_MODEL:
|
case NO_MODEL:
|
||||||
|
@ -141,11 +141,11 @@ namespace ATC {
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** string to model enum */
|
/** string to model enum */
|
||||||
static bool string_to_model(const std::string & name, ExtrinsicModelType & index)
|
static bool string_to_model(const std::string & name, ExtrinsicModelType & index)
|
||||||
{
|
{
|
||||||
if (name=="no_model")
|
if (name=="no_model")
|
||||||
index = NO_MODEL;
|
index = NO_MODEL;
|
||||||
|
@ -174,7 +174,7 @@ namespace ATC {
|
||||||
|
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ExtrinsicModel {
|
class ExtrinsicModel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -295,8 +295,8 @@ namespace ATC {
|
||||||
/** rhs mask for coupling with MD */
|
/** rhs mask for coupling with MD */
|
||||||
Array2D<bool> rhsMaskIntrinsic_;
|
Array2D<bool> rhsMaskIntrinsic_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GRAD_FIELD_MATS fluxes_;
|
GRAD_FIELD_MATS fluxes_;
|
||||||
|
|
||||||
/** number of nodes */
|
/** number of nodes */
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace ATC {
|
||||||
string matFileName) :
|
string matFileName) :
|
||||||
ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName),
|
ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName),
|
||||||
continuityIntegrator_(nullptr),
|
continuityIntegrator_(nullptr),
|
||||||
|
|
||||||
poissonSolverType_(DIRECT), // ITERATIVE | DIRECT
|
poissonSolverType_(DIRECT), // ITERATIVE | DIRECT
|
||||||
poissonSolver_(nullptr),
|
poissonSolver_(nullptr),
|
||||||
baseSize_(0),
|
baseSize_(0),
|
||||||
|
@ -49,34 +49,34 @@ namespace ATC {
|
||||||
schrodingerSolver_(nullptr),
|
schrodingerSolver_(nullptr),
|
||||||
schrodingerPoissonMgr_(),
|
schrodingerPoissonMgr_(),
|
||||||
schrodingerPoissonSolver_(nullptr),
|
schrodingerPoissonSolver_(nullptr),
|
||||||
maxConsistencyIter_(0), maxConstraintIter_(1),
|
maxConsistencyIter_(0), maxConstraintIter_(1),
|
||||||
safe_dEf_(0.1), Ef_shift_(0.0),
|
safe_dEf_(0.1), Ef_shift_(0.0),
|
||||||
oneD_(false), oneDcoor_(0), oneDconserve_(0)
|
oneD_(false), oneDcoor_(0), oneDconserve_(0)
|
||||||
{
|
{
|
||||||
// delete base class's version of the physics model
|
// delete base class's version of the physics model
|
||||||
if (physicsModel_) delete physicsModel_;
|
if (physicsModel_) delete physicsModel_;
|
||||||
if (modelType == DRIFT_DIFFUSION_EQUILIBRIUM) {
|
if (modelType == DRIFT_DIFFUSION_EQUILIBRIUM) {
|
||||||
physicsModel_ = new PhysicsModelDriftDiffusionEquilibrium(matFileName);
|
physicsModel_ = new PhysicsModelDriftDiffusionEquilibrium(matFileName);
|
||||||
electronDensityEqn_ = ELECTRON_EQUILIBRIUM;
|
electronDensityEqn_ = ELECTRON_EQUILIBRIUM;
|
||||||
}
|
}
|
||||||
else if (modelType == DRIFT_DIFFUSION_SCHRODINGER) {
|
else if (modelType == DRIFT_DIFFUSION_SCHRODINGER) {
|
||||||
physicsModel_ = new PhysicsModelDriftDiffusionSchrodinger(matFileName);
|
physicsModel_ = new PhysicsModelDriftDiffusionSchrodinger(matFileName);
|
||||||
electronDensityEqn_ = ELECTRON_SCHRODINGER;
|
electronDensityEqn_ = ELECTRON_SCHRODINGER;
|
||||||
maxConsistencyIter_ = 1;
|
maxConsistencyIter_ = 1;
|
||||||
}
|
}
|
||||||
else if (modelType == DRIFT_DIFFUSION_SCHRODINGER_SLICE) {
|
else if (modelType == DRIFT_DIFFUSION_SCHRODINGER_SLICE) {
|
||||||
physicsModel_ = new PhysicsModelDriftDiffusionSchrodingerSlice(matFileName);
|
physicsModel_ = new PhysicsModelDriftDiffusionSchrodingerSlice(matFileName);
|
||||||
electronDensityEqn_ = ELECTRON_SCHRODINGER;
|
electronDensityEqn_ = ELECTRON_SCHRODINGER;
|
||||||
maxConsistencyIter_ = 1;
|
maxConsistencyIter_ = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
physicsModel_ = new PhysicsModelDriftDiffusion(matFileName);
|
physicsModel_ = new PhysicsModelDriftDiffusion(matFileName);
|
||||||
}
|
}
|
||||||
atc_->useConsistentMassMatrix_(ELECTRON_DENSITY) = true;
|
atc_->useConsistentMassMatrix_(ELECTRON_DENSITY) = true;
|
||||||
rhsMaskIntrinsic_(ELECTRON_TEMPERATURE,SOURCE) = true;
|
rhsMaskIntrinsic_(ELECTRON_TEMPERATURE,SOURCE) = true;
|
||||||
//atc_->fieldMask_(ELECTRON_TEMPERATURE,EXTRINSIC_SOURCE) = true;
|
//atc_->fieldMask_(ELECTRON_TEMPERATURE,EXTRINSIC_SOURCE) = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -89,7 +89,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify
|
// modify
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool ExtrinsicModelDriftDiffusion::modify(int narg, char **arg)
|
bool ExtrinsicModelDriftDiffusion::modify(int narg, char **arg)
|
||||||
{
|
{
|
||||||
|
@ -110,9 +110,9 @@ namespace ATC {
|
||||||
nNodes_ = atc_->num_nodes();
|
nNodes_ = atc_->num_nodes();
|
||||||
rhs_[ELECTRON_DENSITY].reset(nNodes_,1);
|
rhs_[ELECTRON_DENSITY].reset(nNodes_,1);
|
||||||
rhs_[ELECTRIC_POTENTIAL].reset(nNodes_,1);
|
rhs_[ELECTRIC_POTENTIAL].reset(nNodes_,1);
|
||||||
|
|
||||||
// set up electron continuity integrator
|
// set up electron continuity integrator
|
||||||
Array2D <bool> rhsMask(NUM_TOTAL_FIELDS,NUM_FLUX);
|
Array2D <bool> rhsMask(NUM_TOTAL_FIELDS,NUM_FLUX);
|
||||||
rhsMask = false;
|
rhsMask = false;
|
||||||
for (int i = 0; i < NUM_FLUX; i++) {
|
for (int i = 0; i < NUM_FLUX; i++) {
|
||||||
rhsMask(ELECTRON_DENSITY,i) = atc_->fieldMask_(ELECTRON_DENSITY,i);
|
rhsMask(ELECTRON_DENSITY,i) = atc_->fieldMask_(ELECTRON_DENSITY,i);
|
||||||
|
@ -121,7 +121,7 @@ namespace ATC {
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
|
|
||||||
if (continuityIntegrator_) delete continuityIntegrator_;
|
if (continuityIntegrator_) delete continuityIntegrator_;
|
||||||
if (electronTimeIntegration_ == TimeIntegrator::IMPLICIT) {
|
if (electronTimeIntegration_ == TimeIntegrator::IMPLICIT) {
|
||||||
continuityIntegrator_ = new FieldImplicitEulerIntegrator(ELECTRON_DENSITY,
|
continuityIntegrator_ = new FieldImplicitEulerIntegrator(ELECTRON_DENSITY,
|
||||||
physicsModel_, atc_->feEngine_, atc_, rhsMask);
|
physicsModel_, atc_->feEngine_, atc_, rhsMask);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ namespace ATC {
|
||||||
rhsMask(ELECTRIC_POTENTIAL,i) = atc_->fieldMask_(ELECTRIC_POTENTIAL,i);
|
rhsMask(ELECTRIC_POTENTIAL,i) = atc_->fieldMask_(ELECTRIC_POTENTIAL,i);
|
||||||
}
|
}
|
||||||
int type = ATC::LinearSolver::ITERATIVE_SOLVE_SYMMETRIC;
|
int type = ATC::LinearSolver::ITERATIVE_SOLVE_SYMMETRIC;
|
||||||
if (poissonSolverType_ == DIRECT) {
|
if (poissonSolverType_ == DIRECT) {
|
||||||
type = ATC::LinearSolver::DIRECT_SOLVE;
|
type = ATC::LinearSolver::DIRECT_SOLVE;
|
||||||
}
|
}
|
||||||
if (poissonSolver_) delete poissonSolver_;
|
if (poissonSolver_) delete poissonSolver_;
|
||||||
|
@ -154,12 +154,12 @@ namespace ATC {
|
||||||
// set up schrodinger solver
|
// set up schrodinger solver
|
||||||
if ( electronDensityEqn_ == ELECTRON_SCHRODINGER ) {
|
if ( electronDensityEqn_ == ELECTRON_SCHRODINGER ) {
|
||||||
if ( schrodingerSolver_ ) delete schrodingerSolver_;
|
if ( schrodingerSolver_ ) delete schrodingerSolver_;
|
||||||
if ( oneD_ ) {
|
if ( oneD_ ) {
|
||||||
EfHistory_.reset(oneDslices_.size(),2);
|
EfHistory_.reset(oneDslices_.size(),2);
|
||||||
schrodingerSolver_ = new SliceSchrodingerSolver(ELECTRON_DENSITY,
|
schrodingerSolver_ = new SliceSchrodingerSolver(ELECTRON_DENSITY,
|
||||||
physicsModel_, atc_->feEngine_, atc_->prescribedDataMgr_, atc_,
|
physicsModel_, atc_->feEngine_, atc_->prescribedDataMgr_, atc_,
|
||||||
oneDslices_,oneDdxs_);
|
oneDslices_,oneDdxs_);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
schrodingerSolver_ = new SchrodingerSolver(ELECTRON_DENSITY,
|
schrodingerSolver_ = new SchrodingerSolver(ELECTRON_DENSITY,
|
||||||
physicsModel_, atc_->feEngine_, atc_->prescribedDataMgr_, atc_);
|
physicsModel_, atc_->feEngine_, atc_->prescribedDataMgr_, atc_);
|
||||||
|
@ -192,7 +192,7 @@ namespace ATC {
|
||||||
double dt = atc_->lammpsInterface_->dt();
|
double dt = atc_->lammpsInterface_->dt();
|
||||||
double time = atc_->time();
|
double time = atc_->time();
|
||||||
int step = atc_->step();
|
int step = atc_->step();
|
||||||
if (step % fluxUpdateFreq_ != 0) return;
|
if (step % fluxUpdateFreq_ != 0) return;
|
||||||
|
|
||||||
// set Dirchlet data
|
// set Dirchlet data
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
|
@ -201,25 +201,25 @@ namespace ATC {
|
||||||
atc_->set_sources();
|
atc_->set_sources();
|
||||||
|
|
||||||
// subcyle integration of fast electron variable/s
|
// subcyle integration of fast electron variable/s
|
||||||
|
|
||||||
double idt = dt/nsubcycle_;
|
double idt = dt/nsubcycle_;
|
||||||
for (int i = 0; i < nsubcycle_ ; ++i) {
|
for (int i = 0; i < nsubcycle_ ; ++i) {
|
||||||
if (electronDensityEqn_ == ELECTRON_CONTINUITY) {
|
if (electronDensityEqn_ == ELECTRON_CONTINUITY) {
|
||||||
// update continuity eqn
|
// update continuity eqn
|
||||||
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
|
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
|
||||||
continuityIntegrator_->update(idt,time,atc_->fields_,rhs_);
|
continuityIntegrator_->update(idt,time,atc_->fields_,rhs_);
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
// solve poisson eqn for electric potential
|
// solve poisson eqn for electric potential
|
||||||
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) )
|
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) )
|
||||||
poissonSolver_->solve(atc_->fields(),rhs_);
|
poissonSolver_->solve(atc_->fields(),rhs_);
|
||||||
}
|
}
|
||||||
else if (electronDensityEqn_ == ELECTRON_SCHRODINGER) {
|
else if (electronDensityEqn_ == ELECTRON_SCHRODINGER) {
|
||||||
if ( (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
|
if ( (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
|
||||||
|| (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) ) )
|
|| (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) ) )
|
||||||
schrodingerPoissonSolver_->solve(rhs_,fluxes_);
|
schrodingerPoissonSolver_->solve(rhs_,fluxes_);
|
||||||
}
|
}
|
||||||
// update electron temperature
|
// update electron temperature
|
||||||
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_TEMPERATURE)
|
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_TEMPERATURE)
|
||||||
&& temperatureIntegrator_ ) {
|
&& temperatureIntegrator_ ) {
|
||||||
#ifdef ATC_VERBOSE
|
#ifdef ATC_VERBOSE
|
||||||
ATC::LammpsInterface::instance()->stream_msg_once("start temperature integration...",true,false);
|
ATC::LammpsInterface::instance()->stream_msg_once("start temperature integration...",true,false);
|
||||||
|
@ -229,10 +229,10 @@ namespace ATC {
|
||||||
ATC::LammpsInterface::instance()->stream_msg_once(" done",false,true);
|
ATC::LammpsInterface::instance()->stream_msg_once(" done",false,true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// set coupling source terms
|
// set coupling source terms
|
||||||
|
@ -249,7 +249,7 @@ namespace ATC {
|
||||||
// output
|
// output
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void ExtrinsicModelDriftDiffusion::output(OUTPUT_LIST & outputData)
|
void ExtrinsicModelDriftDiffusion::output(OUTPUT_LIST & outputData)
|
||||||
{
|
{
|
||||||
#ifdef ATC_VERBOSE
|
#ifdef ATC_VERBOSE
|
||||||
// ATC::LammpsInterface::instance()->print_msg_once("start output",true,false);
|
// ATC::LammpsInterface::instance()->print_msg_once("start output",true,false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -355,13 +355,13 @@ namespace ATC {
|
||||||
baseSize_(0)
|
baseSize_(0)
|
||||||
{
|
{
|
||||||
// delete base class's version of the physics model
|
// delete base class's version of the physics model
|
||||||
if (physicsModel_) delete physicsModel_;
|
if (physicsModel_) delete physicsModel_;
|
||||||
if (modelType == CONVECTIVE_DRIFT_DIFFUSION_SCHRODINGER) {
|
if (modelType == CONVECTIVE_DRIFT_DIFFUSION_SCHRODINGER) {
|
||||||
physicsModel_ = new PhysicsModelDriftDiffusionConvectionSchrodinger(matFileName);
|
physicsModel_ = new PhysicsModelDriftDiffusionConvectionSchrodinger(matFileName);
|
||||||
electronDensityEqn_ = ELECTRON_SCHRODINGER;
|
electronDensityEqn_ = ELECTRON_SCHRODINGER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
physicsModel_ = new PhysicsModelDriftDiffusionConvection(matFileName);
|
physicsModel_ = new PhysicsModelDriftDiffusionConvection(matFileName);
|
||||||
}
|
}
|
||||||
atc_->useConsistentMassMatrix_(ELECTRON_VELOCITY) = false;
|
atc_->useConsistentMassMatrix_(ELECTRON_VELOCITY) = false;
|
||||||
atc_->useConsistentMassMatrix_(ELECTRON_TEMPERATURE) = false;
|
atc_->useConsistentMassMatrix_(ELECTRON_TEMPERATURE) = false;
|
||||||
|
@ -388,7 +388,7 @@ namespace ATC {
|
||||||
nsd_ = atc_->nsd();
|
nsd_ = atc_->nsd();
|
||||||
rhs_[ELECTRON_VELOCITY].reset(nNodes_,nsd_);
|
rhs_[ELECTRON_VELOCITY].reset(nNodes_,nsd_);
|
||||||
|
|
||||||
|
|
||||||
atc_->set_fixed_nodes(); // needed to correctly set BC data
|
atc_->set_fixed_nodes(); // needed to correctly set BC data
|
||||||
// initialize Poisson solver
|
// initialize Poisson solver
|
||||||
if (cddmPoissonSolver_) delete cddmPoissonSolver_;
|
if (cddmPoissonSolver_) delete cddmPoissonSolver_;
|
||||||
|
@ -397,9 +397,9 @@ namespace ATC {
|
||||||
rhsMask(ELECTRIC_POTENTIAL,FLUX) = true;
|
rhsMask(ELECTRIC_POTENTIAL,FLUX) = true;
|
||||||
pair<FieldName,FieldName> row_col(ELECTRIC_POTENTIAL,ELECTRIC_POTENTIAL);
|
pair<FieldName,FieldName> row_col(ELECTRIC_POTENTIAL,ELECTRIC_POTENTIAL);
|
||||||
SPAR_MAT stiffness;
|
SPAR_MAT stiffness;
|
||||||
(atc_->feEngine_)->compute_tangent_matrix(rhsMask,row_col, atc_->fields(), physicsModel_,
|
(atc_->feEngine_)->compute_tangent_matrix(rhsMask,row_col, atc_->fields(), physicsModel_,
|
||||||
atc_->element_to_material_map(), stiffness);
|
atc_->element_to_material_map(), stiffness);
|
||||||
|
|
||||||
const BC_SET & bcs = (atc_->prescribedDataMgr_->bcs(ELECTRIC_POTENTIAL))[0];
|
const BC_SET & bcs = (atc_->prescribedDataMgr_->bcs(ELECTRIC_POTENTIAL))[0];
|
||||||
|
|
||||||
cddmPoissonSolver_ = new LinearSolver(stiffness, bcs, poissonSolverType_,
|
cddmPoissonSolver_ = new LinearSolver(stiffness, bcs, poissonSolverType_,
|
||||||
|
@ -427,7 +427,7 @@ namespace ATC {
|
||||||
double dt = atc_->lammpsInterface_->dt();
|
double dt = atc_->lammpsInterface_->dt();
|
||||||
double time = atc_->time();
|
double time = atc_->time();
|
||||||
int step = atc_->step();
|
int step = atc_->step();
|
||||||
if (step % fluxUpdateFreq_ != 0) return;
|
if (step % fluxUpdateFreq_ != 0) return;
|
||||||
|
|
||||||
// set Dirchlet data
|
// set Dirchlet data
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
|
@ -436,16 +436,16 @@ namespace ATC {
|
||||||
atc_->set_sources();
|
atc_->set_sources();
|
||||||
|
|
||||||
// subcyle integration of fast electron variable/s
|
// subcyle integration of fast electron variable/s
|
||||||
|
|
||||||
double idt = dt/nsubcycle_;
|
double idt = dt/nsubcycle_;
|
||||||
for (int i = 0; i < nsubcycle_ ; ++i) {
|
for (int i = 0; i < nsubcycle_ ; ++i) {
|
||||||
// update electron temperature mass matrix
|
// update electron temperature mass matrix
|
||||||
atc_->compute_mass_matrix(ELECTRON_VELOCITY,physicsModel_);
|
atc_->compute_mass_matrix(ELECTRON_VELOCITY,physicsModel_);
|
||||||
// update electron velocity
|
// update electron velocity
|
||||||
if (!(atc_->prescribedDataMgr_)->all_fixed(ELECTRON_VELOCITY)) {
|
if (!(atc_->prescribedDataMgr_)->all_fixed(ELECTRON_VELOCITY)) {
|
||||||
//const BCS & bcs
|
//const BCS & bcs
|
||||||
// = atc_->prescribedDataMgr_->bcs(ELECTRON_VELOCITY);
|
// = atc_->prescribedDataMgr_->bcs(ELECTRON_VELOCITY);
|
||||||
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
|
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
|
||||||
rhsMask = false;
|
rhsMask = false;
|
||||||
rhsMask(ELECTRON_VELOCITY,SOURCE) = atc_->fieldMask_(ELECTRON_VELOCITY,SOURCE);
|
rhsMask(ELECTRON_VELOCITY,SOURCE) = atc_->fieldMask_(ELECTRON_VELOCITY,SOURCE);
|
||||||
rhsMask(ELECTRON_VELOCITY,FLUX) = atc_->fieldMask_(ELECTRON_VELOCITY,FLUX);
|
rhsMask(ELECTRON_VELOCITY,FLUX) = atc_->fieldMask_(ELECTRON_VELOCITY,FLUX);
|
||||||
|
@ -455,7 +455,7 @@ namespace ATC {
|
||||||
atc_->compute_rhs_vector(rhsMask, atc_->fields_, rhs, atc_->source_integration(), physicsModel_);
|
atc_->compute_rhs_vector(rhsMask, atc_->fields_, rhs, atc_->source_integration(), physicsModel_);
|
||||||
const DENS_MAT & velocityRhs = rhs[ELECTRON_VELOCITY].quantity();
|
const DENS_MAT & velocityRhs = rhs[ELECTRON_VELOCITY].quantity();
|
||||||
|
|
||||||
// add a solver for electron momentum
|
// add a solver for electron momentum
|
||||||
DENS_MAT & velocity = (atc_->field(ELECTRON_VELOCITY)).set_quantity();
|
DENS_MAT & velocity = (atc_->field(ELECTRON_VELOCITY)).set_quantity();
|
||||||
for (int j = 0; j < nsd_; ++j) {
|
for (int j = 0; j < nsd_; ++j) {
|
||||||
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_VELOCITY,j) ) {
|
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_VELOCITY,j) ) {
|
||||||
|
@ -477,12 +477,12 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//atc_->set_fixed_nodes();
|
//atc_->set_fixed_nodes();
|
||||||
|
|
||||||
if (electronDensityEqn_ == ELECTRON_CONTINUITY) {
|
if (electronDensityEqn_ == ELECTRON_CONTINUITY) {
|
||||||
// update continuity eqn
|
// update continuity eqn
|
||||||
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
|
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
|
||||||
rhsMask = false;
|
rhsMask = false;
|
||||||
rhsMask(ELECTRON_DENSITY,FLUX) = atc_->fieldMask_(ELECTRON_DENSITY,FLUX);
|
rhsMask(ELECTRON_DENSITY,FLUX) = atc_->fieldMask_(ELECTRON_DENSITY,FLUX);
|
||||||
rhsMask(ELECTRON_DENSITY,SOURCE) = atc_->fieldMask_(ELECTRON_DENSITY,SOURCE);
|
rhsMask(ELECTRON_DENSITY,SOURCE) = atc_->fieldMask_(ELECTRON_DENSITY,SOURCE);
|
||||||
|
@ -490,11 +490,11 @@ namespace ATC {
|
||||||
FIELDS rhs;
|
FIELDS rhs;
|
||||||
rhs[ELECTRON_DENSITY].reset(nNodes_,1);
|
rhs[ELECTRON_DENSITY].reset(nNodes_,1);
|
||||||
atc_->compute_rhs_vector(rhsMask, atc_->fields_, rhs, atc_->source_integration(), physicsModel_);
|
atc_->compute_rhs_vector(rhsMask, atc_->fields_, rhs, atc_->source_integration(), physicsModel_);
|
||||||
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
|
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
|
||||||
continuityIntegrator_->update(idt,time,atc_->fields_,rhs);
|
continuityIntegrator_->update(idt,time,atc_->fields_,rhs);
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
// solve poisson eqn for electric potential
|
// solve poisson eqn for electric potential
|
||||||
|
|
||||||
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) ) {
|
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) ) {
|
||||||
//poissonSolver_->solve(atc_->fields_,rhs_);
|
//poissonSolver_->solve(atc_->fields_,rhs_);
|
||||||
rhsMask = false;
|
rhsMask = false;
|
||||||
|
@ -507,12 +507,12 @@ namespace ATC {
|
||||||
const CLON_VEC r =column(rhs[ELECTRIC_POTENTIAL].quantity(),0);
|
const CLON_VEC r =column(rhs[ELECTRIC_POTENTIAL].quantity(),0);
|
||||||
cddmPoissonSolver_->solve(x,r);
|
cddmPoissonSolver_->solve(x,r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (electronDensityEqn_ == ELECTRON_SCHRODINGER) {
|
else if (electronDensityEqn_ == ELECTRON_SCHRODINGER) {
|
||||||
schrodingerPoissonSolver_->solve(rhs_,fluxes_);
|
schrodingerPoissonSolver_->solve(rhs_,fluxes_);
|
||||||
}
|
}
|
||||||
|
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
// update electron temperature mass matrix
|
// update electron temperature mass matrix
|
||||||
atc_->compute_mass_matrix(ELECTRON_TEMPERATURE,physicsModel_);
|
atc_->compute_mass_matrix(ELECTRON_TEMPERATURE,physicsModel_);
|
||||||
// update electron temperature
|
// update electron temperature
|
||||||
|
@ -521,11 +521,11 @@ namespace ATC {
|
||||||
temperatureIntegrator_->update(idt,time,atc_->fields_,rhs_);
|
temperatureIntegrator_->update(idt,time,atc_->fields_,rhs_);
|
||||||
//}
|
//}
|
||||||
//else { // lumped mass matrix
|
//else { // lumped mass matrix
|
||||||
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -536,8 +536,8 @@ namespace ATC {
|
||||||
void ExtrinsicModelDriftDiffusionConvection::output(OUTPUT_LIST & outputData)
|
void ExtrinsicModelDriftDiffusionConvection::output(OUTPUT_LIST & outputData)
|
||||||
{
|
{
|
||||||
ExtrinsicModelDriftDiffusion::output(outputData);
|
ExtrinsicModelDriftDiffusion::output(outputData);
|
||||||
|
|
||||||
|
|
||||||
//FIELD jouleHeating(atc_->num_nodes(),1);
|
//FIELD jouleHeating(atc_->num_nodes(),1);
|
||||||
//set_kinetic_energy_source(atc_->fields(),jouleHeating);
|
//set_kinetic_energy_source(atc_->fields(),jouleHeating);
|
||||||
outputData["joule_heating"] = & (atc_->extrinsic_source(TEMPERATURE)).set_quantity();
|
outputData["joule_heating"] = & (atc_->extrinsic_source(TEMPERATURE)).set_quantity();
|
||||||
|
@ -587,7 +587,7 @@ namespace ATC {
|
||||||
DENS_MAT & velocity((atc_->field(ELECTRON_VELOCITY)).set_quantity());
|
DENS_MAT & velocity((atc_->field(ELECTRON_VELOCITY)).set_quantity());
|
||||||
SPAR_MAT & velocityMassMat = (atc_->consistentMassMats_[ELECTRON_VELOCITY]).set_quantity();
|
SPAR_MAT & velocityMassMat = (atc_->consistentMassMats_[ELECTRON_VELOCITY]).set_quantity();
|
||||||
kineticEnergy.reset(nNodes_,1);
|
kineticEnergy.reset(nNodes_,1);
|
||||||
|
|
||||||
for (int j = 0; j < nsd_; j++) {
|
for (int j = 0; j < nsd_; j++) {
|
||||||
CLON_VEC myVelocity(velocity,CLONE_COL,j);
|
CLON_VEC myVelocity(velocity,CLONE_COL,j);
|
||||||
DENS_MAT velocityMat(nNodes_,1);
|
DENS_MAT velocityMat(nNodes_,1);
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ExtrinsicModelDriftDiffusion : public ExtrinsicModelTwoTemperature {
|
class ExtrinsicModelDriftDiffusion : public ExtrinsicModelTwoTemperature {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -63,7 +63,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** get LAMMPS display variables */
|
/** get LAMMPS display variables */
|
||||||
virtual bool compute_vector(int n, double & value);
|
virtual bool compute_vector(int n, double & value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Poisson solve */
|
/** Poisson solve */
|
||||||
void poisson_solve();
|
void poisson_solve();
|
||||||
|
@ -91,7 +91,7 @@ namespace ATC {
|
||||||
enum electronDensityEqnType { ELECTRON_CONTINUITY,
|
enum electronDensityEqnType { ELECTRON_CONTINUITY,
|
||||||
ELECTRON_EQUILIBRIUM,
|
ELECTRON_EQUILIBRIUM,
|
||||||
ELECTRON_SCHRODINGER};
|
ELECTRON_SCHRODINGER};
|
||||||
|
|
||||||
/** frequency for updating the electron state */
|
/** frequency for updating the electron state */
|
||||||
int fluxUpdateFreq_;
|
int fluxUpdateFreq_;
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ExtrinsicModelDriftDiffusionConvection : public ExtrinsicModelDriftDiffusion {
|
class ExtrinsicModelDriftDiffusionConvection : public ExtrinsicModelDriftDiffusion {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -167,7 +167,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** get LAMMPS display variables */
|
/** get LAMMPS display variables */
|
||||||
virtual bool compute_vector(int n, double & value);
|
virtual bool compute_vector(int n, double & value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** compute the total kinetic energy of the electrons */
|
/** compute the total kinetic energy of the electrons */
|
||||||
|
@ -176,7 +176,7 @@ namespace ATC {
|
||||||
/** Linear solver for velocity */
|
/** Linear solver for velocity */
|
||||||
std::vector<LinearSolver * > velocitySolvers_;
|
std::vector<LinearSolver * > velocitySolvers_;
|
||||||
|
|
||||||
|
|
||||||
/** Linear solver for solving the poisson equations */
|
/** Linear solver for solving the poisson equations */
|
||||||
LinearSolver * cddmPoissonSolver_;
|
LinearSolver * cddmPoissonSolver_;
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,11 @@ namespace ATC {
|
||||||
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
|
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
|
||||||
rhsMaskIntrinsic_ = false;
|
rhsMaskIntrinsic_ = false;
|
||||||
if (atc_->track_charge()) {
|
if (atc_->track_charge()) {
|
||||||
|
|
||||||
if (! chargeRegulator_) chargeRegulator_ = new ChargeRegulator(atc_);
|
if (! chargeRegulator_) chargeRegulator_ = new ChargeRegulator(atc_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -68,7 +68,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify
|
// modify
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool ExtrinsicModelElectrostatic::modify(int narg, char **arg)
|
bool ExtrinsicModelElectrostatic::modify(int narg, char **arg)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ namespace ATC {
|
||||||
if (strcmp(arg[argIndx],"max_solves")==0) {
|
if (strcmp(arg[argIndx],"max_solves")==0) {
|
||||||
argIndx++;
|
argIndx++;
|
||||||
maxSolves_ = atoi(arg[argIndx]) ; }
|
maxSolves_ = atoi(arg[argIndx]) ; }
|
||||||
|
|
||||||
else if (strcmp(arg[argIndx],"tolerance")==0) {
|
else if (strcmp(arg[argIndx],"tolerance")==0) {
|
||||||
argIndx++;
|
argIndx++;
|
||||||
poissonSolverTol_ = atof(arg[argIndx]);
|
poissonSolverTol_ = atof(arg[argIndx]);
|
||||||
|
@ -97,7 +97,7 @@ namespace ATC {
|
||||||
poissonSolverType_ = DIRECT; }
|
poissonSolverType_ = DIRECT; }
|
||||||
match = true;
|
match = true;
|
||||||
} // end "poisson_solver"
|
} // end "poisson_solver"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** creates fixed charge on faceset
|
/** creates fixed charge on faceset
|
||||||
|
@ -177,9 +177,9 @@ namespace ATC {
|
||||||
"InterpolantGradient");
|
"InterpolantGradient");
|
||||||
}
|
}
|
||||||
|
|
||||||
FundamentalAtomQuantity * atomicCharge =
|
FundamentalAtomQuantity * atomicCharge =
|
||||||
interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE);
|
interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE);
|
||||||
AtfShapeFunctionRestriction * nodalAtomicCharge =
|
AtfShapeFunctionRestriction * nodalAtomicCharge =
|
||||||
new AtfShapeFunctionRestriction(atc_,atomicCharge,atc_->accumulant());
|
new AtfShapeFunctionRestriction(atc_,atomicCharge,atc_->accumulant());
|
||||||
interscaleManager.add_dense_matrix(nodalAtomicCharge,"NodalAtomicCharge");
|
interscaleManager.add_dense_matrix(nodalAtomicCharge,"NodalAtomicCharge");
|
||||||
AtfShapeFunctionMdProjection * nodalAtomicChargeDensity =
|
AtfShapeFunctionMdProjection * nodalAtomicChargeDensity =
|
||||||
|
@ -198,10 +198,10 @@ namespace ATC {
|
||||||
const string moleculeName = molecule->first;
|
const string moleculeName = molecule->first;
|
||||||
SmallMoleculeSet * smallMoleculeSet = interscaleManager.small_molecule_set(moleculeName);
|
SmallMoleculeSet * smallMoleculeSet = interscaleManager.small_molecule_set(moleculeName);
|
||||||
// calculate nodal charge from the molecules
|
// calculate nodal charge from the molecules
|
||||||
AtomToSmallMoleculeTransfer<double> * moleculeCharge =
|
AtomToSmallMoleculeTransfer<double> * moleculeCharge =
|
||||||
new AtomToSmallMoleculeTransfer<double>(atc_,charge,smallMoleculeSet);
|
new AtomToSmallMoleculeTransfer<double>(atc_,charge,smallMoleculeSet);
|
||||||
interscaleManager.add_dense_matrix(moleculeCharge,"MoleculeCharge"+moleculeName);
|
interscaleManager.add_dense_matrix(moleculeCharge,"MoleculeCharge"+moleculeName);
|
||||||
MotfShapeFunctionRestriction * nodalAtomicMoleculeCharge =
|
MotfShapeFunctionRestriction * nodalAtomicMoleculeCharge =
|
||||||
new MotfShapeFunctionRestriction(moleculeCharge,
|
new MotfShapeFunctionRestriction(moleculeCharge,
|
||||||
interscaleManager.sparse_matrix("ShapeFunction"+moleculeName));
|
interscaleManager.sparse_matrix("ShapeFunction"+moleculeName));
|
||||||
interscaleManager.add_dense_matrix(nodalAtomicMoleculeCharge,"NodalMoleculeCharge"+moleculeName);
|
interscaleManager.add_dense_matrix(nodalAtomicMoleculeCharge,"NodalMoleculeCharge"+moleculeName);
|
||||||
|
@ -212,10 +212,10 @@ namespace ATC {
|
||||||
// dipole moment density
|
// dipole moment density
|
||||||
// calculate the dipole moment of the molecules
|
// calculate the dipole moment of the molecules
|
||||||
SmallMoleculeCentroid * moleculeCentroid = static_cast<SmallMoleculeCentroid*>(interscaleManager.dense_matrix("MoleculeCentroid"+moleculeName));
|
SmallMoleculeCentroid * moleculeCentroid = static_cast<SmallMoleculeCentroid*>(interscaleManager.dense_matrix("MoleculeCentroid"+moleculeName));
|
||||||
SmallMoleculeDipoleMoment * dipoleMoment =
|
SmallMoleculeDipoleMoment * dipoleMoment =
|
||||||
new SmallMoleculeDipoleMoment(atc_,charge,smallMoleculeSet,atomProcGhostCoarseGrainingPositions,moleculeCentroid);
|
new SmallMoleculeDipoleMoment(atc_,charge,smallMoleculeSet,atomProcGhostCoarseGrainingPositions,moleculeCentroid);
|
||||||
interscaleManager.add_dense_matrix(dipoleMoment,"DipoleMoment"+moleculeName);
|
interscaleManager.add_dense_matrix(dipoleMoment,"DipoleMoment"+moleculeName);
|
||||||
MotfShapeFunctionRestriction * nodalAtomicMoleculeDipole =
|
MotfShapeFunctionRestriction * nodalAtomicMoleculeDipole =
|
||||||
new MotfShapeFunctionRestriction(dipoleMoment,
|
new MotfShapeFunctionRestriction(dipoleMoment,
|
||||||
interscaleManager.sparse_matrix("ShapeFunction"+moleculeName));
|
interscaleManager.sparse_matrix("ShapeFunction"+moleculeName));
|
||||||
interscaleManager.add_dense_matrix(nodalAtomicMoleculeDipole,"NodalMoleculeDipole"+moleculeName);
|
interscaleManager.add_dense_matrix(nodalAtomicMoleculeDipole,"NodalMoleculeDipole"+moleculeName);
|
||||||
|
@ -224,7 +224,7 @@ namespace ATC {
|
||||||
interscaleManager.add_dense_matrix(nodalAtomicMoleculeDipoleDensity,"NodalMoleculeDipoleDensity"+moleculeName);
|
interscaleManager.add_dense_matrix(nodalAtomicMoleculeDipoleDensity,"NodalMoleculeDipoleDensity"+moleculeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -255,7 +255,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
rhsMask_(ELECTRIC_POTENTIAL,FLUX) = false;// for poisson solve & rhs compute
|
rhsMask_(ELECTRIC_POTENTIAL,FLUX) = false;// for poisson solve & rhs compute
|
||||||
// need to create the bcs for the solver to configure properly
|
// need to create the bcs for the solver to configure properly
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
if (poissonSolver_) delete poissonSolver_;
|
if (poissonSolver_) delete poissonSolver_;
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,14 +278,14 @@ namespace ATC {
|
||||||
// set up Green's function per node
|
// set up Green's function per node
|
||||||
for (int i = 0; i < nNodes; i++) {
|
for (int i = 0; i < nNodes; i++) {
|
||||||
set<int> localNodes;
|
set<int> localNodes;
|
||||||
|
|
||||||
for (int j = 0; j < nNodes; j++)
|
for (int j = 0; j < nNodes; j++)
|
||||||
localNodes.insert(j);
|
localNodes.insert(j);
|
||||||
|
|
||||||
// call Poisson solver to get Green's function for node i
|
// call Poisson solver to get Green's function for node i
|
||||||
DENS_VEC globalGreensFunction;
|
DENS_VEC globalGreensFunction;
|
||||||
poissonSolver_->greens_function(i,globalGreensFunction);
|
poissonSolver_->greens_function(i,globalGreensFunction);
|
||||||
|
|
||||||
// store green's functions as sparse vectors only on local nodes
|
// store green's functions as sparse vectors only on local nodes
|
||||||
set<int>::const_iterator thisNode;
|
set<int>::const_iterator thisNode;
|
||||||
SparseVector<double> sparseGreensFunction(nNodes);
|
SparseVector<double> sparseGreensFunction(nNodes);
|
||||||
|
@ -311,7 +311,7 @@ namespace ATC {
|
||||||
nodalAtomicGhostCharge_ = interscaleManager.dense_matrix("NodalAtomicGhostCharge");
|
nodalAtomicGhostCharge_ = interscaleManager.dense_matrix("NodalAtomicGhostCharge");
|
||||||
if (! nodalAtomicGhostCharge_) {
|
if (! nodalAtomicGhostCharge_) {
|
||||||
FundamentalAtomQuantity * ghostCharge = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE, GHOST);
|
FundamentalAtomQuantity * ghostCharge = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE, GHOST);
|
||||||
|
|
||||||
PerAtomSparseMatrix<double> * ghostShapeFunctions = interscaleManager.per_atom_sparse_matrix("InterpolantGhost");
|
PerAtomSparseMatrix<double> * ghostShapeFunctions = interscaleManager.per_atom_sparse_matrix("InterpolantGhost");
|
||||||
if (!ghostShapeFunctions) {
|
if (!ghostShapeFunctions) {
|
||||||
ghostShapeFunctions = new PerAtomShapeFunction(atc_,
|
ghostShapeFunctions = new PerAtomShapeFunction(atc_,
|
||||||
|
@ -353,10 +353,10 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
|
|
||||||
if (chargeRegulator_) chargeRegulator_->apply_post_force(atc_->dt());
|
if (chargeRegulator_) chargeRegulator_->apply_post_force(atc_->dt());
|
||||||
// add in correction accounting for lumped mass matrix in charge density
|
// add in correction accounting for lumped mass matrix in charge density
|
||||||
// in atomistic part of domain & account for physics model fluxes,resets rhs
|
// in atomistic part of domain & account for physics model fluxes,resets rhs
|
||||||
|
|
||||||
|
|
||||||
// set Dirchlet data
|
// set Dirchlet data
|
||||||
atc_->set_fixed_nodes();
|
atc_->set_fixed_nodes();
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ namespace ATC {
|
||||||
|
|
||||||
// compute Poisson equation RHS sources
|
// compute Poisson equation RHS sources
|
||||||
atc_->compute_rhs_vector(rhsMask_, atc_->fields_, rhs_, atc_->source_integration(), physicsModel_);
|
atc_->compute_rhs_vector(rhsMask_, atc_->fields_, rhs_, atc_->source_integration(), physicsModel_);
|
||||||
|
|
||||||
// add atomic charges to rhs
|
// add atomic charges to rhs
|
||||||
DENS_MAT & rhs = rhs_[ELECTRIC_POTENTIAL].set_quantity();
|
DENS_MAT & rhs = rhs_[ELECTRIC_POTENTIAL].set_quantity();
|
||||||
if (atc_->track_charge()) {
|
if (atc_->track_charge()) {
|
||||||
|
@ -376,9 +376,9 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// solve poisson eqn for electric potential
|
// solve poisson eqn for electric potential
|
||||||
// electron charge density added to Poisson RHS in solver
|
// electron charge density added to Poisson RHS in solver
|
||||||
|
@ -391,7 +391,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// do this for intrinsic charges or effective electron charges at atoms
|
// do this for intrinsic charges or effective electron charges at atoms
|
||||||
if (atc_->track_charge()
|
if (atc_->track_charge()
|
||||||
|| ( LammpsInterface::instance()->atom_charge() && atc_->source_atomic_quadrature(ELECTRIC_POTENTIAL) ) ) {
|
|| ( LammpsInterface::instance()->atom_charge() && atc_->source_atomic_quadrature(ELECTRIC_POTENTIAL) ) ) {
|
||||||
_atomElectricalForce_.resize(atc_->nlocal(),atc_->nsd());
|
_atomElectricalForce_.resize(atc_->nlocal(),atc_->nsd());
|
||||||
add_electrostatic_forces(potential);
|
add_electrostatic_forces(potential);
|
||||||
|
@ -400,8 +400,8 @@ namespace ATC {
|
||||||
apply_charged_surfaces(potential);
|
apply_charged_surfaces(potential);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InterscaleManager & interscaleManager_ = atc_->interscale_manager();
|
InterscaleManager & interscaleManager_ = atc_->interscale_manager();
|
||||||
atomForces_ = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE);
|
atomForces_ = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE);
|
||||||
(*atomForces_) += _atomElectricalForce_; // f_E in ours, f in lammps ultimately
|
(*atomForces_) += _atomElectricalForce_; // f_E in ours, f in lammps ultimately
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ namespace ATC {
|
||||||
else {
|
else {
|
||||||
localF[0] = 0.;localF[1] = 0.; localF[2] = 0.;
|
localF[0] = 0.;localF[1] = 0.; localF[2] = 0.;
|
||||||
}
|
}
|
||||||
LammpsInterface::instance()->allsum(localF,totalElectricalForce_,3);
|
LammpsInterface::instance()->allsum(localF,totalElectricalForce_,3);
|
||||||
if (LammpsInterface::instance()->rank_zero()) {
|
if (LammpsInterface::instance()->rank_zero()) {
|
||||||
atc_->feEngine_->add_global("electrostatic_force_x", totalElectricalForce_[0]);
|
atc_->feEngine_->add_global("electrostatic_force_x", totalElectricalForce_[0]);
|
||||||
atc_->feEngine_->add_global("electrostatic_force_y", totalElectricalForce_[1]);
|
atc_->feEngine_->add_global("electrostatic_force_y", totalElectricalForce_[1]);
|
||||||
|
@ -435,9 +435,9 @@ namespace ATC {
|
||||||
InterscaleManager & interscaleManager(atc_->interscale_manager());
|
InterscaleManager & interscaleManager(atc_->interscale_manager());
|
||||||
const DENS_MAN * atomicChargeDensity(interscaleManager.dense_matrix("NodalAtomicChargeDensity"));
|
const DENS_MAN * atomicChargeDensity(interscaleManager.dense_matrix("NodalAtomicChargeDensity"));
|
||||||
atc_->nodal_atomic_field(CHARGE_DENSITY) = atomicChargeDensity->quantity();
|
atc_->nodal_atomic_field(CHARGE_DENSITY) = atomicChargeDensity->quantity();
|
||||||
|
|
||||||
fields[CHARGE_DENSITY] = atomicChargeDensity->quantity();
|
fields[CHARGE_DENSITY] = atomicChargeDensity->quantity();
|
||||||
|
|
||||||
DENS_MAT & chargeDensity(fields[CHARGE_DENSITY].set_quantity());
|
DENS_MAT & chargeDensity(fields[CHARGE_DENSITY].set_quantity());
|
||||||
DENS_MAT & nodalAtomicChargeDensity((atc_->nodal_atomic_field(CHARGE_DENSITY)).set_quantity());
|
DENS_MAT & nodalAtomicChargeDensity((atc_->nodal_atomic_field(CHARGE_DENSITY)).set_quantity());
|
||||||
if ((atc_->lammps_interface())->rank_zero()) {
|
if ((atc_->lammps_interface())->rank_zero()) {
|
||||||
|
@ -446,7 +446,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (fields.find(ELECTRON_DENSITY)==fields.end()) {
|
if (fields.find(ELECTRON_DENSITY)==fields.end()) {
|
||||||
fields[ELECTRON_DENSITY].reset(fields[CHARGE_DENSITY].nRows(),1);
|
fields[ELECTRON_DENSITY].reset(fields[CHARGE_DENSITY].nRows(),1);
|
||||||
DENS_MAT & electronDensity(fields[ELECTRON_DENSITY].set_quantity());
|
DENS_MAT & electronDensity(fields[ELECTRON_DENSITY].set_quantity());
|
||||||
|
@ -454,7 +454,7 @@ namespace ATC {
|
||||||
outputData["electron_density"] = &electronDensity;
|
outputData["electron_density"] = &electronDensity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const map<string,pair<MolSize,int> > & moleculeIds(atc_->molecule_ids());
|
const map<string,pair<MolSize,int> > & moleculeIds(atc_->molecule_ids());
|
||||||
map<string,pair<MolSize,int> >::const_iterator molecule;
|
map<string,pair<MolSize,int> >::const_iterator molecule;
|
||||||
for (molecule = moleculeIds.begin(); molecule != moleculeIds.end(); molecule++) {
|
for (molecule = moleculeIds.begin(); molecule != moleculeIds.end(); molecule++) {
|
||||||
|
@ -488,7 +488,7 @@ namespace ATC {
|
||||||
//((atc_->interscale_manager()).fundamental_atom_quantity(LammpsInterface::ATOM_POSITION))->force_reset();
|
//((atc_->interscale_manager()).fundamental_atom_quantity(LammpsInterface::ATOM_POSITION))->force_reset();
|
||||||
const DENS_MAT & atomPosition = ((atc_->interscale_manager()).fundamental_atom_quantity(LammpsInterface::ATOM_POSITION))->quantity();
|
const DENS_MAT & atomPosition = ((atc_->interscale_manager()).fundamental_atom_quantity(LammpsInterface::ATOM_POSITION))->quantity();
|
||||||
double local_fdotx = 0, fdotx;
|
double local_fdotx = 0, fdotx;
|
||||||
|
|
||||||
for (int i = 0; i < _atomElectricalForce_.nRows() ; i++) {
|
for (int i = 0; i < _atomElectricalForce_.nRows() ; i++) {
|
||||||
for (int j = 0; j < _atomElectricalForce_.nCols() ; j++) {
|
for (int j = 0; j < _atomElectricalForce_.nCols() ; j++) {
|
||||||
local_fdotx -= _atomElectricalForce_(i,j)*atomPosition(i,j);
|
local_fdotx -= _atomElectricalForce_(i,j)*atomPosition(i,j);
|
||||||
|
@ -505,7 +505,7 @@ namespace ATC {
|
||||||
bool ExtrinsicModelElectrostatic::compute_vector(int n, double & value)
|
bool ExtrinsicModelElectrostatic::compute_vector(int n, double & value)
|
||||||
{
|
{
|
||||||
if (n == baseSize_) {
|
if (n == baseSize_) {
|
||||||
|
|
||||||
double nSum = ((atc_->field(ELECTRON_DENSITY)).quantity()).col_sum();
|
double nSum = ((atc_->field(ELECTRON_DENSITY)).quantity()).col_sum();
|
||||||
value = nSum;
|
value = nSum;
|
||||||
return true;
|
return true;
|
||||||
|
@ -532,7 +532,7 @@ namespace ATC {
|
||||||
void ExtrinsicModelElectrostatic::add_electrostatic_forces
|
void ExtrinsicModelElectrostatic::add_electrostatic_forces
|
||||||
(MATRIX & potential)
|
(MATRIX & potential)
|
||||||
{
|
{
|
||||||
|
|
||||||
//double qE2f = LammpsInterface::instance()->qe2f();
|
//double qE2f = LammpsInterface::instance()->qe2f();
|
||||||
double qV2e = LammpsInterface::instance()->qv2e(); // charge volts to our energy units
|
double qV2e = LammpsInterface::instance()->qv2e(); // charge volts to our energy units
|
||||||
//double ** f = LammpsInterface::instance()->fatom();
|
//double ** f = LammpsInterface::instance()->fatom();
|
||||||
|
@ -548,7 +548,7 @@ namespace ATC {
|
||||||
Ei = -1.*(*(shapeFucntionDerivatives[i])*potential);
|
Ei = -1.*(*(shapeFucntionDerivatives[i])*potential);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int dimOffset = 0;
|
int dimOffset = 0;
|
||||||
if (useSlab_) dimOffset = nsd - 1;
|
if (useSlab_) dimOffset = nsd - 1;
|
||||||
for (int i = 0; i < nLocal; i++) {
|
for (int i = 0; i < nLocal; i++) {
|
||||||
|
@ -559,7 +559,7 @@ namespace ATC {
|
||||||
for (int j = dimOffset; j < nsd; j ++)
|
for (int j = dimOffset; j < nsd; j ++)
|
||||||
_atomElectricalForce_(i,j) = c*E(i,j);
|
_atomElectricalForce_(i,j) = c*E(i,j);
|
||||||
}
|
}
|
||||||
|
|
||||||
// correct field for short range interactions
|
// correct field for short range interactions
|
||||||
if (includeShortRange_)
|
if (includeShortRange_)
|
||||||
correct_electrostatic_forces();
|
correct_electrostatic_forces();
|
||||||
|
@ -577,7 +577,7 @@ namespace ATC {
|
||||||
double * q = LammpsInterface::instance()->atom_charge();
|
double * q = LammpsInterface::instance()->atom_charge();
|
||||||
vector<SparseVector<double> > atomicFePotential;
|
vector<SparseVector<double> > atomicFePotential;
|
||||||
int nLocal = atc_->nlocal();
|
int nLocal = atc_->nlocal();
|
||||||
|
|
||||||
int nGhostLammps = LammpsInterface::instance()->nghost();
|
int nGhostLammps = LammpsInterface::instance()->nghost();
|
||||||
int nLocalLammps = LammpsInterface::instance()->nlocal();
|
int nLocalLammps = LammpsInterface::instance()->nlocal();
|
||||||
int nLocalTotal = nLocalLammps + nGhostLammps; // total number of atoms on this processor
|
int nLocalTotal = nLocalLammps + nGhostLammps; // total number of atoms on this processor
|
||||||
|
@ -593,18 +593,18 @@ namespace ATC {
|
||||||
DenseVector<INDEX> nodeIndices;
|
DenseVector<INDEX> nodeIndices;
|
||||||
DENS_VEC nodeValues;
|
DENS_VEC nodeValues;
|
||||||
myShpFcn.row(i,nodeValues,nodeIndices);
|
myShpFcn.row(i,nodeValues,nodeIndices);
|
||||||
|
|
||||||
int atomIdx = atc_->internalToAtom_(i);
|
int atomIdx = atc_->internalToAtom_(i);
|
||||||
//double c = qE2f*q[atomIdx];
|
//double c = qE2f*q[atomIdx];
|
||||||
//double c = qV2e*q[atomIdx];
|
//double c = qV2e*q[atomIdx];
|
||||||
//nodeValues *= c;
|
//nodeValues *= c;
|
||||||
nodeValues *= q[atomIdx];
|
nodeValues *= q[atomIdx];
|
||||||
|
|
||||||
for (int j = 0; j < nodeIndices.size(); j++)
|
for (int j = 0; j < nodeIndices.size(); j++)
|
||||||
atomicFePotential[atomIdx].add_scaled(greensFunctions_[nodeIndices(j)],nodeValues(j));
|
atomicFePotential[atomIdx].add_scaled(greensFunctions_[nodeIndices(j)],nodeValues(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute local potential contribtutions for lammps ghost atoms
|
// compute local potential contribtutions for lammps ghost atoms
|
||||||
// which are known to ATC,
|
// which are known to ATC,
|
||||||
// this will grab both processor and periodic neighbors,
|
// this will grab both processor and periodic neighbors,
|
||||||
// so we need to add in neighbor contributions using lammps indices
|
// so we need to add in neighbor contributions using lammps indices
|
||||||
|
@ -621,7 +621,7 @@ namespace ATC {
|
||||||
Array<int> nodeIndices(nodesPerElement);
|
Array<int> nodeIndices(nodesPerElement);
|
||||||
DENS_VEC nodeValues(nodesPerElement);
|
DENS_VEC nodeValues(nodesPerElement);
|
||||||
(atc_->feEngine_)->shape_functions(coords,nodeValues,nodeIndices);
|
(atc_->feEngine_)->shape_functions(coords,nodeValues,nodeIndices);
|
||||||
|
|
||||||
//double c = qV2e*q[i];
|
//double c = qV2e*q[i];
|
||||||
//nodeValues *= c;
|
//nodeValues *= c;
|
||||||
nodeValues *= q[i];
|
nodeValues *= q[i];
|
||||||
|
@ -633,7 +633,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get sparse vectors of derivatives at each atom
|
// Get sparse vectors of derivatives at each atom
|
||||||
|
|
||||||
// to compute this only when the shape functions change
|
// to compute this only when the shape functions change
|
||||||
vector<vector<SparseVector<double> > > atomicDerivatives;
|
vector<vector<SparseVector<double> > > atomicDerivatives;
|
||||||
atomicDerivatives.reserve(nLocal);
|
atomicDerivatives.reserve(nLocal);
|
||||||
|
@ -657,9 +657,9 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop over all atoms and correct their efield based on all their
|
// loop over all atoms and correct their efield based on all their
|
||||||
// neighbor's local efield response
|
// neighbor's local efield response
|
||||||
|
|
||||||
// need to use specific coulombic cutoff from different pairs
|
// need to use specific coulombic cutoff from different pairs
|
||||||
// see pair_coul_cut for an example of the data structures
|
// see pair_coul_cut for an example of the data structures
|
||||||
// unfortunately don't know how to get at this data in general
|
// unfortunately don't know how to get at this data in general
|
||||||
|
@ -670,12 +670,12 @@ namespace ATC {
|
||||||
|
|
||||||
double cutoffRadius = LammpsInterface::instance()->pair_cutoff();
|
double cutoffRadius = LammpsInterface::instance()->pair_cutoff();
|
||||||
double cutoffSq = cutoffRadius*cutoffRadius;
|
double cutoffSq = cutoffRadius*cutoffRadius;
|
||||||
|
|
||||||
int inum = LammpsInterface::instance()->neighbor_list_inum();
|
int inum = LammpsInterface::instance()->neighbor_list_inum();
|
||||||
int * ilist = LammpsInterface::instance()->neighbor_list_ilist();
|
int * ilist = LammpsInterface::instance()->neighbor_list_ilist();
|
||||||
int * numneigh = LammpsInterface::instance()->neighbor_list_numneigh();
|
int * numneigh = LammpsInterface::instance()->neighbor_list_numneigh();
|
||||||
int ** firstneigh = LammpsInterface::instance()->neighbor_list_firstneigh();
|
int ** firstneigh = LammpsInterface::instance()->neighbor_list_firstneigh();
|
||||||
|
|
||||||
// loop over neighbors of my atoms
|
// loop over neighbors of my atoms
|
||||||
for (int ii = 0; ii < inum; ii++) {
|
for (int ii = 0; ii < inum; ii++) {
|
||||||
int i = ilist[ii];
|
int i = ilist[ii];
|
||||||
|
@ -683,10 +683,10 @@ namespace ATC {
|
||||||
double xtmp = xatom[i][0];
|
double xtmp = xatom[i][0];
|
||||||
double ytmp = xatom[i][1];
|
double ytmp = xatom[i][1];
|
||||||
double ztmp = xatom[i][2];
|
double ztmp = xatom[i][2];
|
||||||
|
|
||||||
int * jlist = firstneigh[i];
|
int * jlist = firstneigh[i];
|
||||||
int jnum = numneigh[i];
|
int jnum = numneigh[i];
|
||||||
|
|
||||||
for (int jj = 0; jj < jnum; jj++) {
|
for (int jj = 0; jj < jnum; jj++) {
|
||||||
int j = jlist[jj];
|
int j = jlist[jj];
|
||||||
if (mask[j] & atc_->groupbit_) {
|
if (mask[j] & atc_->groupbit_) {
|
||||||
|
@ -696,7 +696,7 @@ namespace ATC {
|
||||||
double delx = xtmp - xatom[j][0];
|
double delx = xtmp - xatom[j][0];
|
||||||
double dely = ytmp - xatom[j][1];
|
double dely = ytmp - xatom[j][1];
|
||||||
double delz = ztmp - xatom[j][2];
|
double delz = ztmp - xatom[j][2];
|
||||||
double rsq = delx*delx + dely*dely + delz*delz;
|
double rsq = delx*delx + dely*dely + delz*delz;
|
||||||
if (rsq < cutoffSq) {
|
if (rsq < cutoffSq) {
|
||||||
DENS_VEC efield(nsd);
|
DENS_VEC efield(nsd);
|
||||||
efield = 0.;
|
efield = 0.;
|
||||||
|
@ -732,7 +732,7 @@ namespace ATC {
|
||||||
// get faceset information
|
// get faceset information
|
||||||
int nNodes = atc_->num_nodes();
|
int nNodes = atc_->num_nodes();
|
||||||
const FE_Mesh * feMesh = (atc_->feEngine_)->fe_mesh();
|
const FE_Mesh * feMesh = (atc_->feEngine_)->fe_mesh();
|
||||||
const set< pair <int,int> > * faceset
|
const set< pair <int,int> > * faceset
|
||||||
= & ( feMesh->faceset(facesetName));
|
= & ( feMesh->faceset(facesetName));
|
||||||
|
|
||||||
// set face sources to all point at one function for use in integration
|
// set face sources to all point at one function for use in integration
|
||||||
|
@ -765,7 +765,7 @@ namespace ATC {
|
||||||
nodalFaceWeights[ELECTRIC_POTENTIAL].reset(nNodes,1);
|
nodalFaceWeights[ELECTRIC_POTENTIAL].reset(nNodes,1);
|
||||||
Array<bool> fieldMask(NUM_FIELDS);
|
Array<bool> fieldMask(NUM_FIELDS);
|
||||||
fieldMask(ELECTRIC_POTENTIAL) = true;
|
fieldMask(ELECTRIC_POTENTIAL) = true;
|
||||||
|
|
||||||
(atc_->feEngine_)->add_fluxes(fieldMask,0.,faceSources,nodalFaceWeights);
|
(atc_->feEngine_)->add_fluxes(fieldMask,0.,faceSources,nodalFaceWeights);
|
||||||
// set up data structure holding charged faceset information
|
// set up data structure holding charged faceset information
|
||||||
FIELDS sources;
|
FIELDS sources;
|
||||||
|
@ -774,7 +774,7 @@ namespace ATC {
|
||||||
for (myNodeData = myFaceset.begin(); myNodeData != myFaceset.end(); myNodeData++) {
|
for (myNodeData = myFaceset.begin(); myNodeData != myFaceset.end(); myNodeData++) {
|
||||||
// evaluate voltage at each node I
|
// evaluate voltage at each node I
|
||||||
// set up X_T function for integration: k*chargeDensity/||x_I - x_s||
|
// set up X_T function for integration: k*chargeDensity/||x_I - x_s||
|
||||||
|
|
||||||
// integral is approximated in two parts:
|
// integral is approximated in two parts:
|
||||||
// 1) near part with all faces within r < rcrit evaluated as 2 * pi * rcrit * k sigma A/A0, A is area of this region and A0 = pi * rcrit^2, so 2 k sigma A / rcrit
|
// 1) near part with all faces within r < rcrit evaluated as 2 * pi * rcrit * k sigma A/A0, A is area of this region and A0 = pi * rcrit^2, so 2 k sigma A / rcrit
|
||||||
// 2) far part evaluated using Gaussian quadrature on faceset
|
// 2) far part evaluated using Gaussian quadrature on faceset
|
||||||
|
@ -790,7 +790,7 @@ namespace ATC {
|
||||||
string radialPower = "radial_power";
|
string radialPower = "radial_power";
|
||||||
f = XT_Function_Mgr::instance()->function(radialPower,8,xtArgs);
|
f = XT_Function_Mgr::instance()->function(radialPower,8,xtArgs);
|
||||||
|
|
||||||
|
|
||||||
for (iset = faceset->begin(); iset != faceset->end(); iset++) {
|
for (iset = faceset->begin(); iset != faceset->end(); iset++) {
|
||||||
pair<int,int> face = *iset;
|
pair<int,int> face = *iset;
|
||||||
// allocate
|
// allocate
|
||||||
|
@ -850,7 +850,7 @@ namespace ATC {
|
||||||
string facesetName = isurface->first;
|
string facesetName = isurface->first;
|
||||||
map<int,pair<DENS_VEC,double> >::const_iterator inode;
|
map<int,pair<DENS_VEC,double> >::const_iterator inode;
|
||||||
for (inode = (isurface->second).begin(); inode != (isurface->second).end(); inode++) {
|
for (inode = (isurface->second).begin(); inode != (isurface->second).end(); inode++) {
|
||||||
|
|
||||||
int nodeId = inode->first;
|
int nodeId = inode->first;
|
||||||
DENS_VEC nodalCoords = (inode->second).first;
|
DENS_VEC nodalCoords = (inode->second).first;
|
||||||
double nodalCharge = (inode->second).second;
|
double nodalCharge = (inode->second).second;
|
||||||
|
@ -858,26 +858,26 @@ namespace ATC {
|
||||||
PerAtomQuantity<double> * atomicCoords = (atc_->interscale_manager()).per_atom_quantity("AtomicCoarseGrainingPositions");
|
PerAtomQuantity<double> * atomicCoords = (atc_->interscale_manager()).per_atom_quantity("AtomicCoarseGrainingPositions");
|
||||||
const DENS_MAT & myAtomicCoords(atomicCoords->quantity());
|
const DENS_MAT & myAtomicCoords(atomicCoords->quantity());
|
||||||
for (int i = 0; i < nLocal; i++) {
|
for (int i = 0; i < nLocal; i++) {
|
||||||
if (abs(qatom(i,0)) > 0) {
|
if (abs(qatom(i,0)) > 0) {
|
||||||
double distanceSq = 0.;
|
double distanceSq = 0.;
|
||||||
double deltaX[3];
|
double deltaX[3];
|
||||||
for (int j = 0; j < nsd; j++) {
|
for (int j = 0; j < nsd; j++) {
|
||||||
deltaX[j] = myAtomicCoords(i,j) - nodalCoords(j);
|
deltaX[j] = myAtomicCoords(i,j) - nodalCoords(j);
|
||||||
distanceSq += deltaX[j]*deltaX[j];
|
distanceSq += deltaX[j]*deltaX[j];
|
||||||
}
|
}
|
||||||
if (distanceSq < cutoffSq) {
|
if (distanceSq < cutoffSq) {
|
||||||
// first apply pairwise coulombic interaction
|
// first apply pairwise coulombic interaction
|
||||||
if (!useSlab_) {
|
if (!useSlab_) {
|
||||||
double coulForce = qqrd2e*nodalCharge*qatom(i,0)/(distanceSq*sqrtf(distanceSq));
|
double coulForce = qqrd2e*nodalCharge*qatom(i,0)/(distanceSq*sqrtf(distanceSq));
|
||||||
for (int j = 0; j < nsd; j++)
|
for (int j = 0; j < nsd; j++)
|
||||||
//fatom[atomIdx][j] += deltaX[j]*coulForce;
|
//fatom[atomIdx][j] += deltaX[j]*coulForce;
|
||||||
_atomElectricalForce_(i,j) += deltaX[j]*coulForce;
|
_atomElectricalForce_(i,j) += deltaX[j]*coulForce;
|
||||||
}
|
}
|
||||||
|
|
||||||
// second correct for FE potential induced by BCs
|
// second correct for FE potential induced by BCs
|
||||||
// determine shape function derivatives at atomic location
|
// determine shape function derivatives at atomic location
|
||||||
// and construct sparse vectors to store derivative data
|
// and construct sparse vectors to store derivative data
|
||||||
|
|
||||||
vector<SparseVector<double> > derivativeVectors;
|
vector<SparseVector<double> > derivativeVectors;
|
||||||
derivativeVectors.reserve(nsd);
|
derivativeVectors.reserve(nsd);
|
||||||
const SPAR_MAT_VEC & shapeFunctionDerivatives((interscaleManager.vector_sparse_matrix("InterpolantGradient"))->quantity());
|
const SPAR_MAT_VEC & shapeFunctionDerivatives((interscaleManager.vector_sparse_matrix("InterpolantGradient"))->quantity());
|
||||||
|
@ -889,23 +889,23 @@ namespace ATC {
|
||||||
for (int k = 0; k < nodeIndices.size(); k++)
|
for (int k = 0; k < nodeIndices.size(); k++)
|
||||||
derivativeVectors[j](nodeIndices(k)) = nodeValues(k);
|
derivativeVectors[j](nodeIndices(k)) = nodeValues(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute greens function from charge quadrature
|
// compute greens function from charge quadrature
|
||||||
|
|
||||||
SparseVector<double> shortFePotential(nNodes);
|
SparseVector<double> shortFePotential(nNodes);
|
||||||
shortFePotential.add_scaled(greensFunctions_[nodeId],penalty*nodalPotential);
|
shortFePotential.add_scaled(greensFunctions_[nodeId],penalty*nodalPotential);
|
||||||
|
|
||||||
// compute electric field induced by charge
|
// compute electric field induced by charge
|
||||||
DENS_VEC efield(nsd);
|
DENS_VEC efield(nsd);
|
||||||
efield = 0.;
|
efield = 0.;
|
||||||
for (int j = 0; j < nsd; j++)
|
for (int j = 0; j < nsd; j++)
|
||||||
efield(j) = -.1*dot(derivativeVectors[j],shortFePotential);
|
efield(j) = -.1*dot(derivativeVectors[j],shortFePotential);
|
||||||
|
|
||||||
// apply correction in atomic forces
|
// apply correction in atomic forces
|
||||||
//double c = qE2f*qatom[atomIdx];
|
//double c = qE2f*qatom[atomIdx];
|
||||||
double c = qV2e*qatom(i,0);
|
double c = qV2e*qatom(i,0);
|
||||||
for (int j = 0; j < nsd; j++)
|
for (int j = 0; j < nsd; j++)
|
||||||
if ((!useSlab_) || (j==nsd)) {
|
if ((!useSlab_) || (j==nsd)) {
|
||||||
//fatom[atomIdx][j] -= c*efield(j);
|
//fatom[atomIdx][j] -= c*efield(j);
|
||||||
_atomElectricalForce_(i,j) -= c*efield(j);
|
_atomElectricalForce_(i,j) -= c*efield(j);
|
||||||
}
|
}
|
||||||
|
@ -932,7 +932,7 @@ namespace ATC {
|
||||||
string matFileName) :
|
string matFileName) :
|
||||||
ExtrinsicModelElectrostatic(modelManager,modelType,matFileName)
|
ExtrinsicModelElectrostatic(modelManager,modelType,matFileName)
|
||||||
{
|
{
|
||||||
if (physicsModel_) delete physicsModel_;
|
if (physicsModel_) delete physicsModel_;
|
||||||
if (modelType == ELECTROSTATIC) {
|
if (modelType == ELECTROSTATIC) {
|
||||||
physicsModel_ = new PhysicsModelElectrostatic(matFileName);
|
physicsModel_ = new PhysicsModelElectrostatic(matFileName);
|
||||||
}
|
}
|
||||||
|
@ -943,7 +943,7 @@ namespace ATC {
|
||||||
rhsMaskIntrinsic_(VELOCITY,SOURCE) = true;
|
rhsMaskIntrinsic_(VELOCITY,SOURCE) = true;
|
||||||
atc_->fieldMask_(VELOCITY,EXTRINSIC_SOURCE) = true;
|
atc_->fieldMask_(VELOCITY,EXTRINSIC_SOURCE) = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -953,7 +953,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify
|
// modify
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool ExtrinsicModelElectrostaticMomentum::modify(int narg, char **arg)
|
bool ExtrinsicModelElectrostaticMomentum::modify(int narg, char **arg)
|
||||||
{
|
{
|
||||||
|
@ -983,7 +983,7 @@ namespace ATC {
|
||||||
void ExtrinsicModelElectrostaticMomentum::set_sources(FIELDS & fields, FIELDS & sources)
|
void ExtrinsicModelElectrostaticMomentum::set_sources(FIELDS & fields, FIELDS & sources)
|
||||||
{
|
{
|
||||||
// compute charge density
|
// compute charge density
|
||||||
if (modelType_ == ELECTROSTATIC_EQUILIBRIUM) {
|
if (modelType_ == ELECTROSTATIC_EQUILIBRIUM) {
|
||||||
DENS_MAN & n = atc_->field(ELECTRON_DENSITY);
|
DENS_MAN & n = atc_->field(ELECTRON_DENSITY);
|
||||||
atc_->nodal_projection(ELECTRON_DENSITY,physicsModel_,n);
|
atc_->nodal_projection(ELECTRON_DENSITY,physicsModel_,n);
|
||||||
}
|
}
|
||||||
|
@ -997,7 +997,7 @@ namespace ATC {
|
||||||
|
|
||||||
// compute source term with appropriate masking and physics model
|
// compute source term with appropriate masking and physics model
|
||||||
atc_->evaluate_rhs_integral(rhsMaskIntrinsic_, fields, sources,
|
atc_->evaluate_rhs_integral(rhsMaskIntrinsic_, fields, sources,
|
||||||
atc_->source_integration(), physicsModel_);
|
atc_->source_integration(), physicsModel_);
|
||||||
//(sources[VELOCITY].quantity()).print("V SRC");
|
//(sources[VELOCITY].quantity()).print("V SRC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace ATC {
|
||||||
/**
|
/**
|
||||||
* @class ExtrinsicModelElectrostatic
|
* @class ExtrinsicModelElectrostatic
|
||||||
* @brief add self-consistent electrostatic forces
|
* @brief add self-consistent electrostatic forces
|
||||||
* owned field: ELECTRIC_POTENTIAL
|
* owned field: ELECTRIC_POTENTIAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -35,7 +35,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ExtrinsicModelElectrostatic : public ExtrinsicModel {
|
class ExtrinsicModelElectrostatic : public ExtrinsicModel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -71,9 +71,9 @@ namespace ATC {
|
||||||
virtual double compute_scalar(void);
|
virtual double compute_scalar(void);
|
||||||
virtual bool compute_vector(int n, double & value);
|
virtual bool compute_vector(int n, double & value);
|
||||||
|
|
||||||
PoissonSolver * poisson_solver(void) const { return poissonSolver_;}
|
PoissonSolver * poisson_solver(void) const { return poissonSolver_;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** poisson solver type */
|
/** poisson solver type */
|
||||||
SolverType poissonSolverType_;
|
SolverType poissonSolverType_;
|
||||||
|
@ -91,7 +91,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** rhs mask for Poisson solver */
|
/** rhs mask for Poisson solver */
|
||||||
Array2D<bool> rhsMask_;
|
Array2D<bool> rhsMask_;
|
||||||
|
|
||||||
/** estimate intrinsic charge density */
|
/** estimate intrinsic charge density */
|
||||||
void add_electrostatic_forces(MATRIX & nodalPotential);
|
void add_electrostatic_forces(MATRIX & nodalPotential);
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ namespace ATC {
|
||||||
const double chargeDensity);
|
const double chargeDensity);
|
||||||
#endif
|
#endif
|
||||||
/** charge regulator */
|
/** charge regulator */
|
||||||
ChargeRegulator * chargeRegulator_;
|
ChargeRegulator * chargeRegulator_;
|
||||||
|
|
||||||
/** local electric potential Green's function for each node */
|
/** local electric potential Green's function for each node */
|
||||||
std::vector<SparseVector<double> > greensFunctions_;
|
std::vector<SparseVector<double> > greensFunctions_;
|
||||||
|
@ -123,11 +123,11 @@ namespace ATC {
|
||||||
/** data structure storing potential induced only by charges under the nodal shape function support */
|
/** data structure storing potential induced only by charges under the nodal shape function support */
|
||||||
std::map<std::string,std::map<int,double> > nodalChargePotential_;
|
std::map<std::string,std::map<int,double> > nodalChargePotential_;
|
||||||
|
|
||||||
|
|
||||||
/** allows electric force only applied only in z direction to complement LAMMPS slab command */
|
/** allows electric force only applied only in z direction to complement LAMMPS slab command */
|
||||||
bool useSlab_;
|
bool useSlab_;
|
||||||
|
|
||||||
|
|
||||||
/** enables method when short range interactions are off */
|
/** enables method when short range interactions are off */
|
||||||
bool includeShortRange_;
|
bool includeShortRange_;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ExtrinsicModelElectrostaticMomentum : public ExtrinsicModelElectrostatic {
|
class ExtrinsicModelElectrostaticMomentum : public ExtrinsicModelElectrostatic {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -180,7 +180,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** Add model-specific output data */
|
/** Add model-specific output data */
|
||||||
virtual void output(OUTPUT_LIST & outputData);
|
virtual void output(OUTPUT_LIST & outputData);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ATC {
|
||||||
electronTimeIntegration_(TimeIntegrator::IMPLICIT),
|
electronTimeIntegration_(TimeIntegrator::IMPLICIT),
|
||||||
temperatureIntegrator_(nullptr),
|
temperatureIntegrator_(nullptr),
|
||||||
nsubcycle_(1),
|
nsubcycle_(1),
|
||||||
exchangeFlag_(true),
|
exchangeFlag_(true),
|
||||||
baseSize_(0)
|
baseSize_(0)
|
||||||
{
|
{
|
||||||
physicsModel_ = new PhysicsModelTwoTemperature(matFileName);
|
physicsModel_ = new PhysicsModelTwoTemperature(matFileName);
|
||||||
|
@ -39,7 +39,7 @@ namespace ATC {
|
||||||
rhsMaskIntrinsic_(TEMPERATURE,SOURCE) = true;
|
rhsMaskIntrinsic_(TEMPERATURE,SOURCE) = true;
|
||||||
atc_->fieldMask_(TEMPERATURE,EXTRINSIC_SOURCE) = true;
|
atc_->fieldMask_(TEMPERATURE,EXTRINSIC_SOURCE) = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -49,7 +49,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify
|
// modify
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool ExtrinsicModelTwoTemperature::modify(int narg, char **arg)
|
bool ExtrinsicModelTwoTemperature::modify(int narg, char **arg)
|
||||||
{
|
{
|
||||||
|
@ -174,12 +174,12 @@ namespace ATC {
|
||||||
else if (electronTimeIntegration_ == TimeIntegrator::IMPLICIT) {
|
else if (electronTimeIntegration_ == TimeIntegrator::IMPLICIT) {
|
||||||
double alpha = 1; // backwards Euler
|
double alpha = 1; // backwards Euler
|
||||||
temperatureIntegrator_ = new FieldImplicitEulerIntegrator(
|
temperatureIntegrator_ = new FieldImplicitEulerIntegrator(
|
||||||
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
|
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
|
||||||
rhsMask, alpha);
|
rhsMask, alpha);
|
||||||
}
|
}
|
||||||
else if (electronTimeIntegration_ == TimeIntegrator::EXPLICIT) {
|
else if (electronTimeIntegration_ == TimeIntegrator::EXPLICIT) {
|
||||||
temperatureIntegrator_ = new FieldExplicitEulerIntegrator(
|
temperatureIntegrator_ = new FieldExplicitEulerIntegrator(
|
||||||
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
|
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
|
||||||
rhsMask);
|
rhsMask);
|
||||||
}
|
}
|
||||||
double dt = atc_->lammpsInterface_->dt();
|
double dt = atc_->lammpsInterface_->dt();
|
||||||
|
@ -267,18 +267,18 @@ namespace ATC {
|
||||||
// output[1] = total electron energy
|
// output[1] = total electron energy
|
||||||
// output[2] = average electron temperature
|
// output[2] = average electron temperature
|
||||||
|
|
||||||
if (n == baseSize_) {
|
if (n == baseSize_) {
|
||||||
Array<FieldName> mask(1);
|
Array<FieldName> mask(1);
|
||||||
FIELD_MATS energy;
|
FIELD_MATS energy;
|
||||||
mask(0) = ELECTRON_TEMPERATURE;
|
mask(0) = ELECTRON_TEMPERATURE;
|
||||||
|
|
||||||
(atc_->feEngine_)->compute_energy(mask,
|
(atc_->feEngine_)->compute_energy(mask,
|
||||||
atc_->fields(),
|
atc_->fields(),
|
||||||
physicsModel_,
|
physicsModel_,
|
||||||
atc_->elementToMaterialMap_,
|
atc_->elementToMaterialMap_,
|
||||||
energy);
|
energy);
|
||||||
// convert to lammps energy units
|
// convert to lammps energy units
|
||||||
double mvv2e = (atc_->lammps_interface())->mvv2e();
|
double mvv2e = (atc_->lammps_interface())->mvv2e();
|
||||||
double electronEnergy = mvv2e * energy[ELECTRON_TEMPERATURE].col_sum();
|
double electronEnergy = mvv2e * energy[ELECTRON_TEMPERATURE].col_sum();
|
||||||
value = electronEnergy;
|
value = electronEnergy;
|
||||||
return true;
|
return true;
|
||||||
|
@ -288,7 +288,7 @@ namespace ATC {
|
||||||
value = electronTemperature;
|
value = electronTemperature;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ExtrinsicModelTwoTemperature : public ExtrinsicModel {
|
class ExtrinsicModelTwoTemperature : public ExtrinsicModel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -50,7 +50,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** Add model-specific output data */
|
/** Add model-specific output data */
|
||||||
virtual void output(OUTPUT_LIST & outputData);
|
virtual void output(OUTPUT_LIST & outputData);
|
||||||
|
|
||||||
/** set up LAMMPS display variables */
|
/** set up LAMMPS display variables */
|
||||||
virtual int size_vector(int externalSize);
|
virtual int size_vector(int externalSize);
|
||||||
|
|
||||||
|
|
|
@ -45,22 +45,22 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FE_Element::num_ips() const
|
int FE_Element::num_ips() const
|
||||||
{
|
{
|
||||||
return feInterpolate_->num_ips();
|
return feInterpolate_->num_ips();
|
||||||
}
|
}
|
||||||
|
|
||||||
int FE_Element::num_face_ips() const
|
int FE_Element::num_face_ips() const
|
||||||
{
|
{
|
||||||
return feInterpolate_->num_face_ips();
|
return feInterpolate_->num_face_ips();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_Element::face_coordinates(const DENS_MAT &eltCoords,
|
void FE_Element::face_coordinates(const DENS_MAT &eltCoords,
|
||||||
const int faceID,
|
const int faceID,
|
||||||
DENS_MAT & faceCoords) const
|
DENS_MAT & faceCoords) const
|
||||||
{
|
{
|
||||||
faceCoords.reset(nSD_, numFaceNodes_);
|
faceCoords.reset(nSD_, numFaceNodes_);
|
||||||
|
|
||||||
for (int inode=0; inode < numFaceNodes_; inode++)
|
for (int inode=0; inode < numFaceNodes_; inode++)
|
||||||
{
|
{
|
||||||
int id = localFaceConn_(faceID,inode);
|
int id = localFaceConn_(faceID,inode);
|
||||||
for (int isd=0; isd<nSD_; isd++) {
|
for (int isd=0; isd<nSD_; isd++) {
|
||||||
|
@ -94,7 +94,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
centroid(i) = eltCoords.row_mean(i);
|
centroid(i) = eltCoords.row_mean(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// generic conversion from global to local coordinates using
|
// generic conversion from global to local coordinates using
|
||||||
// Newton's method to solve the nonliear equation that arises
|
// Newton's method to solve the nonliear equation that arises
|
||||||
|
@ -110,8 +110,8 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
if (fabs(xiGuess(0)) > 1.0) xiGuess(0) = 0.;
|
if (fabs(xiGuess(0)) > 1.0) xiGuess(0) = 0.;
|
||||||
if (fabs(xiGuess(1)) > 1.0) xiGuess(1) = 0.;
|
if (fabs(xiGuess(1)) > 1.0) xiGuess(1) = 0.;
|
||||||
if (fabs(xiGuess(2)) > 1.0) xiGuess(2) = 0.;
|
if (fabs(xiGuess(2)) > 1.0) xiGuess(2) = 0.;
|
||||||
|
|
||||||
// iteratively solve the equation by calculating the global
|
// iteratively solve the equation by calculating the global
|
||||||
// position of the guess and bringing the difference between it
|
// position of the guess and bringing the difference between it
|
||||||
// and the actual global position of x to zero
|
// and the actual global position of x to zero
|
||||||
//
|
//
|
||||||
|
@ -127,12 +127,12 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
while (count < localCoordinatesMaxIterations_) {
|
while (count < localCoordinatesMaxIterations_) {
|
||||||
feInterpolate_->compute_N_dNdr(xiGuess,N,dNdr);
|
feInterpolate_->compute_N_dNdr(xiGuess,N,dNdr);
|
||||||
xGuess = N*eltCoordsT;
|
xGuess = N*eltCoordsT;
|
||||||
xDiff = xGuess-x;
|
xDiff = xGuess-x;
|
||||||
// determine if the guess is close enough.
|
// determine if the guess is close enough.
|
||||||
// if it is, take it and run
|
// if it is, take it and run
|
||||||
// if not, use Newton's method to update the guess
|
// if not, use Newton's method to update the guess
|
||||||
if (!dbl_geq(abs(xDiff(0)),tolerance_) &&
|
if (!dbl_geq(abs(xDiff(0)),tolerance_) &&
|
||||||
!dbl_geq(abs(xDiff(1)),tolerance_) &&
|
!dbl_geq(abs(xDiff(1)),tolerance_) &&
|
||||||
!dbl_geq(abs(xDiff(2)),tolerance_)) {
|
!dbl_geq(abs(xDiff(2)),tolerance_)) {
|
||||||
converged = true;
|
converged = true;
|
||||||
xi = xiGuess;
|
xi = xiGuess;
|
||||||
|
@ -160,11 +160,11 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
xi(i) = 2.0*(x(i)-min)/(max-min) - 1.0;
|
xi(i) = 2.0*(x(i)-min)/(max-min) - 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (projectionGuess_ == CENTROID_LINEARIZED) {
|
else if (projectionGuess_ == CENTROID_LINEARIZED) {
|
||||||
DENS_VEC xi0(nSD_); xi0 = 0;
|
DENS_VEC xi0(nSD_); xi0 = 0;
|
||||||
DENS_VEC x0(nSD_), dx(nSD_);
|
DENS_VEC x0(nSD_), dx(nSD_);
|
||||||
centroid(eltCoords,x0);
|
centroid(eltCoords,x0);
|
||||||
dx = x - x0;
|
dx = x - x0;
|
||||||
vector<DENS_VEC> ts; ts.reserve(nSD_);
|
vector<DENS_VEC> ts; ts.reserve(nSD_);
|
||||||
tangents(eltCoords,xi0,ts);
|
tangents(eltCoords,xi0,ts);
|
||||||
DENS_VEC & t1 = ts[0];
|
DENS_VEC & t1 = ts[0];
|
||||||
|
@ -178,7 +178,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
xi(1) = J2/J;
|
xi(1) = J2/J;
|
||||||
xi(2) = J3/J;
|
xi(2) = J3/J;
|
||||||
}
|
}
|
||||||
else if (projectionGuess_ == TWOD_ANALYTIC) {
|
else if (projectionGuess_ == TWOD_ANALYTIC) {
|
||||||
// assume x-y planar and HEX8
|
// assume x-y planar and HEX8
|
||||||
double x0 = x(0), y0 = x(1);
|
double x0 = x(0), y0 = x(1);
|
||||||
double X[4] = {eltCoords(0,0),eltCoords(0,1),eltCoords(0,2),eltCoords(0,3)};
|
double X[4] = {eltCoords(0,0),eltCoords(0,1),eltCoords(0,2),eltCoords(0,3)};
|
||||||
|
@ -194,13 +194,13 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
xi1[0] = (4*x0 - X[0] + xi2[0]*X[0] - X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0] - X[0] - xi2[0]*X[0])/(-X[0] + xi2[0]*X[0] + X[0] - xi2[0]*X[0] + X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0]);
|
xi1[0] = (4*x0 - X[0] + xi2[0]*X[0] - X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0] - X[0] - xi2[0]*X[0])/(-X[0] + xi2[0]*X[0] + X[0] - xi2[0]*X[0] + X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0]);
|
||||||
xi1[1] = (4*x0 - X[0] + xi2[0]*X[0] - X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0] - X[0] - xi2[0]*X[0])/(-X[0] + xi2[0]*X[0] + X[0] - xi2[0]*X[0] + X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0]);
|
xi1[1] = (4*x0 - X[0] + xi2[0]*X[0] - X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0] - X[0] - xi2[0]*X[0])/(-X[0] + xi2[0]*X[0] + X[0] - xi2[0]*X[0] + X[0] + xi2[0]*X[0] - X[0] - xi2[0]*X[0]);
|
||||||
// choose which one gives back x
|
// choose which one gives back x
|
||||||
xi(0) = xi1[0];
|
xi(0) = xi1[0];
|
||||||
xi(1) = xi2[0];
|
xi(1) = xi2[0];
|
||||||
xi(2) = 0;
|
xi(2) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FE_Element::range_check(const DENS_MAT &eltCoords,
|
bool FE_Element::range_check(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x) const
|
const DENS_VEC &x) const
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// Note: Only works for convex elements with planar faces with
|
// Note: Only works for convex elements with planar faces with
|
||||||
// outward normals
|
// outward normals
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
bool FE_Element::contains_point(const DENS_MAT &eltCoords,
|
bool FE_Element::contains_point(const DENS_MAT &eltCoords,
|
||||||
|
@ -229,7 +229,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
bool inside = true;
|
bool inside = true;
|
||||||
for (int faceID=0; faceID<numFaces_; ++faceID) {
|
for (int faceID=0; faceID<numFaces_; ++faceID) {
|
||||||
face_coordinates(eltCoords, faceID, faceCoords);
|
face_coordinates(eltCoords, faceID, faceCoords);
|
||||||
feInterpolate_->face_normal(faceCoords,
|
feInterpolate_->face_normal(faceCoords,
|
||||||
0,
|
0,
|
||||||
normal);
|
normal);
|
||||||
faceToPoint = x - column(faceCoords, 0);
|
faceToPoint = x - column(faceCoords, 0);
|
||||||
|
@ -258,8 +258,8 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
if (dbl_geq(eltCoords(dim,it),min)) {
|
if (dbl_geq(eltCoords(dim,it),min)) {
|
||||||
++it;
|
++it;
|
||||||
} else {
|
} else {
|
||||||
// set min to this node's coord in the specified dim, if it's
|
// set min to this node's coord in the specified dim, if it's
|
||||||
// smaller than the value previously stored
|
// smaller than the value previously stored
|
||||||
min = eltCoords(dim,it);
|
min = eltCoords(dim,it);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -277,7 +277,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// shape_function calls should stay generic at all costs
|
// shape_function calls should stay generic at all costs
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
@ -306,7 +306,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
local_coordinates(eltCoords, x, xi);
|
local_coordinates(eltCoords, x, xi);
|
||||||
|
|
||||||
feInterpolate_->shape_function(eltCoords, xi, N, dNdx);
|
feInterpolate_->shape_function(eltCoords, xi, N, dNdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_Element::shape_function_derivatives(const DENS_MAT eltCoords,
|
void FE_Element::shape_function_derivatives(const DENS_MAT eltCoords,
|
||||||
const VECTOR &x,
|
const VECTOR &x,
|
||||||
|
@ -316,7 +316,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
local_coordinates(eltCoords, x, xi);
|
local_coordinates(eltCoords, x, xi);
|
||||||
|
|
||||||
feInterpolate_->shape_function_derivatives(eltCoords, xi, dNdx);
|
feInterpolate_->shape_function_derivatives(eltCoords, xi, dNdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FE_Element::shape_function(const DENS_MAT eltCoords,
|
void FE_Element::shape_function(const DENS_MAT eltCoords,
|
||||||
|
@ -334,8 +334,8 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
DIAG_MAT &weights)
|
DIAG_MAT &weights)
|
||||||
{
|
{
|
||||||
DENS_MAT faceCoords;
|
DENS_MAT faceCoords;
|
||||||
face_coordinates(eltCoords, faceID, faceCoords);
|
face_coordinates(eltCoords, faceID, faceCoords);
|
||||||
|
|
||||||
feInterpolate_->face_shape_function(eltCoords, faceCoords, faceID,
|
feInterpolate_->face_shape_function(eltCoords, faceCoords, faceID,
|
||||||
N, n, weights);
|
N, n, weights);
|
||||||
}
|
}
|
||||||
|
@ -348,8 +348,8 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
DIAG_MAT &weights)
|
DIAG_MAT &weights)
|
||||||
{
|
{
|
||||||
DENS_MAT faceCoords;
|
DENS_MAT faceCoords;
|
||||||
face_coordinates(eltCoords, faceID, faceCoords);
|
face_coordinates(eltCoords, faceID, faceCoords);
|
||||||
|
|
||||||
feInterpolate_->face_shape_function(eltCoords, faceCoords, faceID,
|
feInterpolate_->face_shape_function(eltCoords, faceCoords, faceID,
|
||||||
N, dN, Nn, weights);
|
N, dN, Nn, weights);
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
double FE_Element::face_normal(const DENS_MAT &eltCoords,
|
double FE_Element::face_normal(const DENS_MAT &eltCoords,
|
||||||
const int faceID,
|
const int faceID,
|
||||||
int ip,
|
int ip,
|
||||||
DENS_VEC &normal)
|
DENS_VEC &normal)
|
||||||
{
|
{
|
||||||
DENS_MAT faceCoords;
|
DENS_MAT faceCoords;
|
||||||
face_coordinates(eltCoords, faceID, faceCoords);
|
face_coordinates(eltCoords, faceID, faceCoords);
|
||||||
|
@ -373,12 +373,12 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
{
|
{
|
||||||
feInterpolate_->tangents(eltCoords,localCoords,tangents,normalize);
|
feInterpolate_->tangents(eltCoords,localCoords,tangents,normalize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// =============================================================
|
// =============================================================
|
||||||
// class FE_ElementHex
|
// class FE_ElementHex
|
||||||
// =============================================================
|
// =============================================================
|
||||||
FE_ElementHex::FE_ElementHex(int numNodes,
|
FE_ElementHex::FE_ElementHex(int numNodes,
|
||||||
int numFaceNodes,
|
int numFaceNodes,
|
||||||
int numNodes1d)
|
int numNodes1d)
|
||||||
: FE_Element(3, // number of spatial dimensions
|
: FE_Element(3, // number of spatial dimensions
|
||||||
|
@ -396,126 +396,126 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
// /
|
// /
|
||||||
// /
|
// /
|
||||||
// z
|
// z
|
||||||
|
|
||||||
// Basic properties of element:
|
// Basic properties of element:
|
||||||
vol_ = 8.0;
|
vol_ = 8.0;
|
||||||
faceArea_ = 4.0;
|
faceArea_ = 4.0;
|
||||||
|
|
||||||
// Order-specific information:
|
// Order-specific information:
|
||||||
if (numNodes != 8 &&
|
if (numNodes != 8 &&
|
||||||
numNodes != 20 &&
|
numNodes != 20 &&
|
||||||
numNodes != 27) {
|
numNodes != 27) {
|
||||||
throw ATC_Error("Unrecognized interpolation order specified "
|
throw ATC_Error("Unrecognized interpolation order specified "
|
||||||
"for element class: \n"
|
"for element class: \n"
|
||||||
" element only knows how to construct lin "
|
" element only knows how to construct lin "
|
||||||
"and quad elements.");
|
"and quad elements.");
|
||||||
}
|
}
|
||||||
|
|
||||||
localCoords_.resize(nSD_,numNodes_);
|
localCoords_.resize(nSD_,numNodes_);
|
||||||
localFaceConn_ = Array2D<int>(numFaces_,numFaceNodes_);
|
localFaceConn_ = Array2D<int>(numFaces_,numFaceNodes_);
|
||||||
|
|
||||||
// Matrix of local nodal coordinates
|
// Matrix of local nodal coordinates
|
||||||
localCoords_(0,0) = -1; localCoords_(0,4) = -1;
|
localCoords_(0,0) = -1; localCoords_(0,4) = -1;
|
||||||
localCoords_(1,0) = -1; localCoords_(1,4) = -1;
|
localCoords_(1,0) = -1; localCoords_(1,4) = -1;
|
||||||
localCoords_(2,0) = -1; localCoords_(2,4) = 1;
|
localCoords_(2,0) = -1; localCoords_(2,4) = 1;
|
||||||
//
|
//
|
||||||
localCoords_(0,1) = 1; localCoords_(0,5) = 1;
|
localCoords_(0,1) = 1; localCoords_(0,5) = 1;
|
||||||
localCoords_(1,1) = -1; localCoords_(1,5) = -1;
|
localCoords_(1,1) = -1; localCoords_(1,5) = -1;
|
||||||
localCoords_(2,1) = -1; localCoords_(2,5) = 1;
|
localCoords_(2,1) = -1; localCoords_(2,5) = 1;
|
||||||
//
|
//
|
||||||
localCoords_(0,2) = 1; localCoords_(0,6) = 1;
|
localCoords_(0,2) = 1; localCoords_(0,6) = 1;
|
||||||
localCoords_(1,2) = 1; localCoords_(1,6) = 1;
|
localCoords_(1,2) = 1; localCoords_(1,6) = 1;
|
||||||
localCoords_(2,2) = -1; localCoords_(2,6) = 1;
|
localCoords_(2,2) = -1; localCoords_(2,6) = 1;
|
||||||
//
|
//
|
||||||
localCoords_(0,3) = -1; localCoords_(0,7) = -1;
|
localCoords_(0,3) = -1; localCoords_(0,7) = -1;
|
||||||
localCoords_(1,3) = 1; localCoords_(1,7) = 1;
|
localCoords_(1,3) = 1; localCoords_(1,7) = 1;
|
||||||
localCoords_(2,3) = -1; localCoords_(2,7) = 1;
|
localCoords_(2,3) = -1; localCoords_(2,7) = 1;
|
||||||
if (numNodes >= 20) {
|
if (numNodes >= 20) {
|
||||||
// only for quads
|
// only for quads
|
||||||
localCoords_(0,8) = 0; localCoords_(0,14) = 1;
|
localCoords_(0,8) = 0; localCoords_(0,14) = 1;
|
||||||
localCoords_(1,8) = -1; localCoords_(1,14) = 1;
|
localCoords_(1,8) = -1; localCoords_(1,14) = 1;
|
||||||
localCoords_(2,8) = -1; localCoords_(2,14) = 0;
|
localCoords_(2,8) = -1; localCoords_(2,14) = 0;
|
||||||
//
|
//
|
||||||
localCoords_(0,9) = 1; localCoords_(0,15) = -1;
|
localCoords_(0,9) = 1; localCoords_(0,15) = -1;
|
||||||
localCoords_(1,9) = 0; localCoords_(1,15) = 1;
|
localCoords_(1,9) = 0; localCoords_(1,15) = 1;
|
||||||
localCoords_(2,9) = -1; localCoords_(2,15) = 0;
|
localCoords_(2,9) = -1; localCoords_(2,15) = 0;
|
||||||
//
|
//
|
||||||
localCoords_(0,10) = 0; localCoords_(0,16) = 0;
|
localCoords_(0,10) = 0; localCoords_(0,16) = 0;
|
||||||
localCoords_(1,10) = 1; localCoords_(1,16) = -1;
|
localCoords_(1,10) = 1; localCoords_(1,16) = -1;
|
||||||
localCoords_(2,10) = -1; localCoords_(2,16) = 1;
|
localCoords_(2,10) = -1; localCoords_(2,16) = 1;
|
||||||
//
|
//
|
||||||
localCoords_(0,11) = -1; localCoords_(0,17) = 1;
|
localCoords_(0,11) = -1; localCoords_(0,17) = 1;
|
||||||
localCoords_(1,11) = 0; localCoords_(1,17) = 0;
|
localCoords_(1,11) = 0; localCoords_(1,17) = 0;
|
||||||
localCoords_(2,11) = -1; localCoords_(2,17) = 1;
|
localCoords_(2,11) = -1; localCoords_(2,17) = 1;
|
||||||
//
|
//
|
||||||
localCoords_(0,12) = -1; localCoords_(0,18) = 0;
|
localCoords_(0,12) = -1; localCoords_(0,18) = 0;
|
||||||
localCoords_(1,12) = -1; localCoords_(1,18) = 1;
|
localCoords_(1,12) = -1; localCoords_(1,18) = 1;
|
||||||
localCoords_(2,12) = 0; localCoords_(2,18) = 1;
|
localCoords_(2,12) = 0; localCoords_(2,18) = 1;
|
||||||
//
|
//
|
||||||
localCoords_(0,13) = 1; localCoords_(0,19) = -1;
|
localCoords_(0,13) = 1; localCoords_(0,19) = -1;
|
||||||
localCoords_(1,13) = -1; localCoords_(1,19) = 0;
|
localCoords_(1,13) = -1; localCoords_(1,19) = 0;
|
||||||
localCoords_(2,13) = 0; localCoords_(2,19) = 1;
|
localCoords_(2,13) = 0; localCoords_(2,19) = 1;
|
||||||
if (numNodes >= 27) {
|
if (numNodes >= 27) {
|
||||||
// only for quads
|
// only for quads
|
||||||
localCoords_(0,20) = 0; localCoords_(0,24) = 1;
|
localCoords_(0,20) = 0; localCoords_(0,24) = 1;
|
||||||
localCoords_(1,20) = 0; localCoords_(1,24) = 0;
|
localCoords_(1,20) = 0; localCoords_(1,24) = 0;
|
||||||
localCoords_(2,20) = 0; localCoords_(2,24) = 0;
|
localCoords_(2,20) = 0; localCoords_(2,24) = 0;
|
||||||
//
|
//
|
||||||
localCoords_(0,21) = 0; localCoords_(0,25) = 0;
|
localCoords_(0,21) = 0; localCoords_(0,25) = 0;
|
||||||
localCoords_(1,21) = 0; localCoords_(1,25) = -1;
|
localCoords_(1,21) = 0; localCoords_(1,25) = -1;
|
||||||
localCoords_(2,21) = -1; localCoords_(2,25) = 0;
|
localCoords_(2,21) = -1; localCoords_(2,25) = 0;
|
||||||
//
|
//
|
||||||
localCoords_(0,22) = 0; localCoords_(0,26) = 0;
|
localCoords_(0,22) = 0; localCoords_(0,26) = 0;
|
||||||
localCoords_(1,22) = 0; localCoords_(1,26) = 1;
|
localCoords_(1,22) = 0; localCoords_(1,26) = 1;
|
||||||
localCoords_(2,22) = 1; localCoords_(2,26) = 0;
|
localCoords_(2,22) = 1; localCoords_(2,26) = 0;
|
||||||
//
|
//
|
||||||
localCoords_(0,23) = -1;
|
localCoords_(0,23) = -1;
|
||||||
localCoords_(1,23) = 0;
|
localCoords_(1,23) = 0;
|
||||||
localCoords_(2,23) = 0;
|
localCoords_(2,23) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matrix of local face connectivity
|
// Matrix of local face connectivity
|
||||||
// -x // +x
|
// -x // +x
|
||||||
localFaceConn_(0,0) = 0; localFaceConn_(1,0) = 1;
|
localFaceConn_(0,0) = 0; localFaceConn_(1,0) = 1;
|
||||||
localFaceConn_(0,1) = 4; localFaceConn_(1,1) = 2;
|
localFaceConn_(0,1) = 4; localFaceConn_(1,1) = 2;
|
||||||
localFaceConn_(0,2) = 7; localFaceConn_(1,2) = 6;
|
localFaceConn_(0,2) = 7; localFaceConn_(1,2) = 6;
|
||||||
localFaceConn_(0,3) = 3; localFaceConn_(1,3) = 5;
|
localFaceConn_(0,3) = 3; localFaceConn_(1,3) = 5;
|
||||||
if (numNodes >= 20) {
|
if (numNodes >= 20) {
|
||||||
localFaceConn_(0,4) = 12; localFaceConn_(1,4) = 9;
|
localFaceConn_(0,4) = 12; localFaceConn_(1,4) = 9;
|
||||||
localFaceConn_(0,5) = 19; localFaceConn_(1,5) = 14;
|
localFaceConn_(0,5) = 19; localFaceConn_(1,5) = 14;
|
||||||
localFaceConn_(0,6) = 15; localFaceConn_(1,6) = 17;
|
localFaceConn_(0,6) = 15; localFaceConn_(1,6) = 17;
|
||||||
localFaceConn_(0,7) = 11; localFaceConn_(1,7) = 13;
|
localFaceConn_(0,7) = 11; localFaceConn_(1,7) = 13;
|
||||||
if (numNodes >= 27) {
|
if (numNodes >= 27) {
|
||||||
localFaceConn_(0,8) = 23; localFaceConn_(1,8) = 24;
|
localFaceConn_(0,8) = 23; localFaceConn_(1,8) = 24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -y // +y
|
// -y // +y
|
||||||
localFaceConn_(2,0) = 0; localFaceConn_(3,0) = 3;
|
localFaceConn_(2,0) = 0; localFaceConn_(3,0) = 3;
|
||||||
localFaceConn_(2,1) = 1; localFaceConn_(3,1) = 7;
|
localFaceConn_(2,1) = 1; localFaceConn_(3,1) = 7;
|
||||||
localFaceConn_(2,2) = 5; localFaceConn_(3,2) = 6;
|
localFaceConn_(2,2) = 5; localFaceConn_(3,2) = 6;
|
||||||
localFaceConn_(2,3) = 4; localFaceConn_(3,3) = 2;
|
localFaceConn_(2,3) = 4; localFaceConn_(3,3) = 2;
|
||||||
if (numNodes >= 20) {
|
if (numNodes >= 20) {
|
||||||
localFaceConn_(2,4) = 8; localFaceConn_(3,4) = 15;
|
localFaceConn_(2,4) = 8; localFaceConn_(3,4) = 15;
|
||||||
localFaceConn_(2,5) = 13; localFaceConn_(3,5) = 18;
|
localFaceConn_(2,5) = 13; localFaceConn_(3,5) = 18;
|
||||||
localFaceConn_(2,6) = 16; localFaceConn_(3,6) = 14;
|
localFaceConn_(2,6) = 16; localFaceConn_(3,6) = 14;
|
||||||
localFaceConn_(2,7) = 12; localFaceConn_(3,7) = 10;
|
localFaceConn_(2,7) = 12; localFaceConn_(3,7) = 10;
|
||||||
if (numNodes >= 27) {
|
if (numNodes >= 27) {
|
||||||
localFaceConn_(2,8) = 25; localFaceConn_(3,8) = 26;
|
localFaceConn_(2,8) = 25; localFaceConn_(3,8) = 26;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -z // +z
|
// -z // +z
|
||||||
localFaceConn_(4,0) = 0; localFaceConn_(5,0) = 4;
|
localFaceConn_(4,0) = 0; localFaceConn_(5,0) = 4;
|
||||||
localFaceConn_(4,1) = 3; localFaceConn_(5,1) = 5;
|
localFaceConn_(4,1) = 3; localFaceConn_(5,1) = 5;
|
||||||
localFaceConn_(4,2) = 2; localFaceConn_(5,2) = 6;
|
localFaceConn_(4,2) = 2; localFaceConn_(5,2) = 6;
|
||||||
localFaceConn_(4,3) = 1; localFaceConn_(5,3) = 7;
|
localFaceConn_(4,3) = 1; localFaceConn_(5,3) = 7;
|
||||||
if (numNodes >= 20) {
|
if (numNodes >= 20) {
|
||||||
localFaceConn_(4,4) = 8; localFaceConn_(5,4) = 16;
|
localFaceConn_(4,4) = 8; localFaceConn_(5,4) = 16;
|
||||||
localFaceConn_(4,5) = 11; localFaceConn_(5,5) = 17;
|
localFaceConn_(4,5) = 11; localFaceConn_(5,5) = 17;
|
||||||
localFaceConn_(4,6) = 10; localFaceConn_(5,6) = 18;
|
localFaceConn_(4,6) = 10; localFaceConn_(5,6) = 18;
|
||||||
localFaceConn_(4,7) = 9; localFaceConn_(5,7) = 19;
|
localFaceConn_(4,7) = 9; localFaceConn_(5,7) = 19;
|
||||||
if (numNodes >= 27) {
|
if (numNodes >= 27) {
|
||||||
localFaceConn_(4,8) = 21; localFaceConn_(5,8) = 22;
|
localFaceConn_(4,8) = 21; localFaceConn_(5,8) = 22;
|
||||||
}
|
}
|
||||||
|
@ -530,7 +530,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine alignment and skewness to see which guess we should use
|
// determine alignment and skewness to see which guess we should use
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FE_ElementHex::~FE_ElementHex()
|
FE_ElementHex::~FE_ElementHex()
|
||||||
|
@ -538,18 +538,18 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
// Handled by base class
|
// Handled by base class
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_ElementHex::set_quadrature(FeIntQuadrature type)
|
void FE_ElementHex::set_quadrature(FeIntQuadrature type)
|
||||||
{
|
{
|
||||||
feInterpolate_->set_quadrature(HEXA,type);
|
feInterpolate_->set_quadrature(HEXA,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FE_ElementHex::contains_point(const DENS_MAT &eltCoords,
|
bool FE_ElementHex::contains_point(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x) const
|
const DENS_VEC &x) const
|
||||||
{
|
{
|
||||||
if (! range_check(eltCoords,x) ) return false;
|
if (! range_check(eltCoords,x) ) return false;
|
||||||
|
|
||||||
DENS_VEC xi;
|
DENS_VEC xi;
|
||||||
bool converged = local_coordinates(eltCoords,x,xi);
|
bool converged = local_coordinates(eltCoords,x,xi);
|
||||||
if (!converged) return false;
|
if (!converged) return false;
|
||||||
for (int i=0; i<nSD_; ++i) {
|
for (int i=0; i<nSD_; ++i) {
|
||||||
if (!dbl_geq(1.0,abs(xi(i)))) return false;
|
if (!dbl_geq(1.0,abs(xi(i)))) return false;
|
||||||
|
@ -592,7 +592,7 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// =============================================================
|
// =============================================================
|
||||||
// class FE_ElementTet
|
// class FE_ElementTet
|
||||||
|
@ -614,12 +614,12 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
// 3 .7
|
// 3 .7
|
||||||
// |\```--- .
|
// |\```--- .
|
||||||
// | \ ```--2 .
|
// | \ ```--2 .
|
||||||
// | \ .|
|
// | \ .|
|
||||||
// | \ . |
|
// | \ . |
|
||||||
// | . \ |
|
// | . \ |
|
||||||
// | . \ |
|
// | . \ |
|
||||||
// |.___________\| -------> r
|
// |.___________\| -------> r
|
||||||
// 0 1
|
// 0 1
|
||||||
//
|
//
|
||||||
// (This is as dictated by the EXODUSII standard.)
|
// (This is as dictated by the EXODUSII standard.)
|
||||||
//
|
//
|
||||||
|
@ -631,18 +631,18 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
// Basic properties of element:
|
// Basic properties of element:
|
||||||
vol_ = 1.0/6.0; // local volume
|
vol_ = 1.0/6.0; // local volume
|
||||||
faceArea_ = 1.0/2.0;
|
faceArea_ = 1.0/2.0;
|
||||||
|
|
||||||
// Order-specific information:
|
// Order-specific information:
|
||||||
if (numNodes != 4 && numNodes != 10) {
|
if (numNodes != 4 && numNodes != 10) {
|
||||||
throw ATC_Error("Unrecognized interpolation order specified "
|
throw ATC_Error("Unrecognized interpolation order specified "
|
||||||
"for element class: \n"
|
"for element class: \n"
|
||||||
" element only knows how to construct lin "
|
" element only knows how to construct lin "
|
||||||
"and quad elements.");
|
"and quad elements.");
|
||||||
}
|
}
|
||||||
|
|
||||||
localCoords_.resize(nSD_+1, numNodes_);
|
localCoords_.resize(nSD_+1, numNodes_);
|
||||||
localFaceConn_ = Array2D<int>(numFaces_,numFaceNodes_);
|
localFaceConn_ = Array2D<int>(numFaces_,numFaceNodes_);
|
||||||
|
|
||||||
// Matrix of local nodal coordinates
|
// Matrix of local nodal coordinates
|
||||||
//
|
//
|
||||||
// Remember, there's actually another coordinate too (u), coming
|
// Remember, there's actually another coordinate too (u), coming
|
||||||
|
@ -653,45 +653,45 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
//
|
//
|
||||||
// The first three axes correspond to x, y, and z (essentially),
|
// The first three axes correspond to x, y, and z (essentially),
|
||||||
// for the canonical element.
|
// for the canonical element.
|
||||||
|
|
||||||
// Everyone gets these nodes...
|
// Everyone gets these nodes...
|
||||||
localCoords_(0,0) = 0; localCoords_(0,2) = 0;
|
localCoords_(0,0) = 0; localCoords_(0,2) = 0;
|
||||||
localCoords_(1,0) = 0; localCoords_(1,2) = 1;
|
localCoords_(1,0) = 0; localCoords_(1,2) = 1;
|
||||||
localCoords_(2,0) = 0; localCoords_(2,2) = 0;
|
localCoords_(2,0) = 0; localCoords_(2,2) = 0;
|
||||||
localCoords_(3,0) = 1; localCoords_(3,2) = 0;
|
localCoords_(3,0) = 1; localCoords_(3,2) = 0;
|
||||||
//
|
//
|
||||||
localCoords_(0,1) = 1; localCoords_(0,3) = 0;
|
localCoords_(0,1) = 1; localCoords_(0,3) = 0;
|
||||||
localCoords_(1,1) = 0; localCoords_(1,3) = 0;
|
localCoords_(1,1) = 0; localCoords_(1,3) = 0;
|
||||||
localCoords_(2,1) = 0; localCoords_(2,3) = 1;
|
localCoords_(2,1) = 0; localCoords_(2,3) = 1;
|
||||||
localCoords_(3,1) = 0; localCoords_(3,3) = 0;
|
localCoords_(3,1) = 0; localCoords_(3,3) = 0;
|
||||||
if (numNodes >= 10) {
|
if (numNodes >= 10) {
|
||||||
// ...quads get even more!
|
// ...quads get even more!
|
||||||
localCoords_(0,4) = 0.5; localCoords_(0,5) = 0.5;
|
localCoords_(0,4) = 0.5; localCoords_(0,5) = 0.5;
|
||||||
localCoords_(1,4) = 0.0; localCoords_(1,5) = 0.5;
|
localCoords_(1,4) = 0.0; localCoords_(1,5) = 0.5;
|
||||||
localCoords_(2,4) = 0.0; localCoords_(2,5) = 0.0;
|
localCoords_(2,4) = 0.0; localCoords_(2,5) = 0.0;
|
||||||
localCoords_(3,4) = 0.5; localCoords_(3,5) = 0.0;
|
localCoords_(3,4) = 0.5; localCoords_(3,5) = 0.0;
|
||||||
//
|
//
|
||||||
localCoords_(0,6) = 0.0; localCoords_(0,7) = 0.0;
|
localCoords_(0,6) = 0.0; localCoords_(0,7) = 0.0;
|
||||||
localCoords_(1,6) = 0.5; localCoords_(1,7) = 0.0;
|
localCoords_(1,6) = 0.5; localCoords_(1,7) = 0.0;
|
||||||
localCoords_(2,6) = 0.0; localCoords_(2,7) = 0.5;
|
localCoords_(2,6) = 0.0; localCoords_(2,7) = 0.5;
|
||||||
localCoords_(3,6) = 0.5; localCoords_(3,7) = 0.5;
|
localCoords_(3,6) = 0.5; localCoords_(3,7) = 0.5;
|
||||||
//
|
//
|
||||||
localCoords_(0,8) = 0.5; localCoords_(0,9) = 0.0;
|
localCoords_(0,8) = 0.5; localCoords_(0,9) = 0.0;
|
||||||
localCoords_(1,8) = 0.0; localCoords_(1,9) = 0.5;
|
localCoords_(1,8) = 0.0; localCoords_(1,9) = 0.5;
|
||||||
localCoords_(2,8) = 0.5; localCoords_(2,9) = 0.5;
|
localCoords_(2,8) = 0.5; localCoords_(2,9) = 0.5;
|
||||||
localCoords_(3,8) = 0.0; localCoords_(3,9) = 0.0;
|
localCoords_(3,8) = 0.0; localCoords_(3,9) = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matrix of local face connectivity:
|
// Matrix of local face connectivity:
|
||||||
// ...opposite point 0, ...opposite point 2,
|
// ...opposite point 0, ...opposite point 2,
|
||||||
localFaceConn_(0,0) = 1; localFaceConn_(2,0) = 0;
|
localFaceConn_(0,0) = 1; localFaceConn_(2,0) = 0;
|
||||||
localFaceConn_(0,1) = 2; localFaceConn_(2,1) = 1;
|
localFaceConn_(0,1) = 2; localFaceConn_(2,1) = 1;
|
||||||
localFaceConn_(0,2) = 3; localFaceConn_(2,2) = 3;
|
localFaceConn_(0,2) = 3; localFaceConn_(2,2) = 3;
|
||||||
|
|
||||||
// ...opposite point 1, ...opposite point 3.
|
// ...opposite point 1, ...opposite point 3.
|
||||||
localFaceConn_(1,0) = 2; localFaceConn_(3,0) = 0;
|
localFaceConn_(1,0) = 2; localFaceConn_(3,0) = 0;
|
||||||
localFaceConn_(1,1) = 0; localFaceConn_(3,1) = 2;
|
localFaceConn_(1,1) = 0; localFaceConn_(3,1) = 2;
|
||||||
localFaceConn_(1,2) = 3; localFaceConn_(3,2) = 1;
|
localFaceConn_(1,2) = 3; localFaceConn_(3,2) = 1;
|
||||||
|
|
||||||
feInterpolate_ = new FE_InterpolateSimpLin(this);
|
feInterpolate_ = new FE_InterpolateSimpLin(this);
|
||||||
}
|
}
|
||||||
|
@ -701,8 +701,8 @@ static const double localCoordinatesTolerance = 1.e-09;
|
||||||
// Handled by base class
|
// Handled by base class
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_ElementTet::set_quadrature(FeIntQuadrature type)
|
void FE_ElementTet::set_quadrature(FeIntQuadrature type)
|
||||||
{
|
{
|
||||||
feInterpolate_->set_quadrature(TETRA,type);
|
feInterpolate_->set_quadrature(TETRA,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
enum ProjectionGuessType {
|
enum ProjectionGuessType {
|
||||||
COORDINATE_ALIGNED=0,
|
COORDINATE_ALIGNED=0,
|
||||||
CENTROID_LINEARIZED,
|
CENTROID_LINEARIZED,
|
||||||
TWOD_ANALYTIC};
|
TWOD_ANALYTIC};
|
||||||
|
|
||||||
|
@ -23,23 +23,23 @@ namespace ATC {
|
||||||
* @class FE_Element
|
* @class FE_Element
|
||||||
* @brief Base class for a finite element holding info for canonical element
|
* @brief Base class for a finite element holding info for canonical element
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FE_Element {
|
class FE_Element {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// CONSTRUCTOR AND DESTRUCTOR
|
// CONSTRUCTOR AND DESTRUCTOR
|
||||||
|
|
||||||
FE_Element(const int nSD,
|
FE_Element(const int nSD,
|
||||||
int numFaces,
|
int numFaces,
|
||||||
int numNodes,
|
int numNodes,
|
||||||
int numFaceNodes,
|
int numFaceNodes,
|
||||||
int numNodes1d);
|
int numNodes1d);
|
||||||
|
|
||||||
virtual ~FE_Element();
|
virtual ~FE_Element();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// GETTERS
|
// GETTERS
|
||||||
|
@ -49,23 +49,23 @@ namespace ATC {
|
||||||
|
|
||||||
/** get number of element nodes */
|
/** get number of element nodes */
|
||||||
int num_elt_nodes() { return numNodes_; }
|
int num_elt_nodes() { return numNodes_; }
|
||||||
|
|
||||||
/** get number of element nodes */
|
/** get number of element nodes */
|
||||||
int num_elt_nodes_1d() { return numNodes1d_; }
|
int num_elt_nodes_1d() { return numNodes1d_; }
|
||||||
|
|
||||||
/** get number of faces */
|
/** get number of faces */
|
||||||
int num_faces() { return numFaces_; }
|
int num_faces() { return numFaces_; }
|
||||||
|
|
||||||
/** get number of face nodes */
|
/** get number of face nodes */
|
||||||
int num_face_nodes() { return numFaceNodes_; }
|
int num_face_nodes() { return numFaceNodes_; }
|
||||||
|
|
||||||
// Getters for FE_Interpoate to have access to coordinates and connectivity
|
// Getters for FE_Interpoate to have access to coordinates and connectivity
|
||||||
/** get canonical coordinates */
|
/** get canonical coordinates */
|
||||||
const DENS_MAT &local_coords() const { return localCoords_; }
|
const DENS_MAT &local_coords() const { return localCoords_; }
|
||||||
|
|
||||||
/** get canonical coordinates in 1d */
|
/** get canonical coordinates in 1d */
|
||||||
DENS_VEC local_coords_1d() const;
|
DENS_VEC local_coords_1d() const;
|
||||||
|
|
||||||
/** get canonical connectivity of nodes and faces */
|
/** get canonical connectivity of nodes and faces */
|
||||||
const Array2D<int> &local_face_conn() const { return localFaceConn_; }
|
const Array2D<int> &local_face_conn() const { return localFaceConn_; }
|
||||||
|
|
||||||
|
@ -78,29 +78,29 @@ namespace ATC {
|
||||||
// the following two are pass-throughs to the interpolate class, and
|
// the following two are pass-throughs to the interpolate class, and
|
||||||
// can thus only be declared in the class body (or else the
|
// can thus only be declared in the class body (or else the
|
||||||
// interpolate class is "incomplete" and cannot be referenced)
|
// interpolate class is "incomplete" and cannot be referenced)
|
||||||
|
|
||||||
/** get number of integration points */
|
/** get number of integration points */
|
||||||
int num_ips() const;
|
int num_ips() const;
|
||||||
|
|
||||||
/** get number of integration points */
|
/** get number of integration points */
|
||||||
int num_face_ips() const;
|
int num_face_ips() const;
|
||||||
|
|
||||||
/** order of interpolation */
|
/** order of interpolation */
|
||||||
int order() const {return numNodes1d_;}
|
int order() const {return numNodes1d_;}
|
||||||
|
|
||||||
/** compute the quadrature for a given element type */
|
/** compute the quadrature for a given element type */
|
||||||
virtual void set_quadrature(FeIntQuadrature type) = 0;
|
virtual void set_quadrature(FeIntQuadrature type) = 0;
|
||||||
|
|
||||||
/** return the set of 1d nodes that correspond to this node in 3d space */
|
/** return the set of 1d nodes that correspond to this node in 3d space */
|
||||||
void mapping(const int inode, std::vector<int> &mapping) const;
|
void mapping(const int inode, std::vector<int> &mapping) const;
|
||||||
|
|
||||||
/** extract face coordinates from element coordinates */
|
/** extract face coordinates from element coordinates */
|
||||||
void face_coordinates(const DENS_MAT &eltCoords,
|
void face_coordinates(const DENS_MAT &eltCoords,
|
||||||
const int faceID,
|
const int faceID,
|
||||||
DENS_MAT &faceCoords) const;
|
DENS_MAT &faceCoords) const;
|
||||||
|
|
||||||
/** set initial guess type for point in element search */
|
/** set initial guess type for point in element search */
|
||||||
void set_projection_guess(ProjectionGuessType type)
|
void set_projection_guess(ProjectionGuessType type)
|
||||||
{ projectionGuess_ = type;}
|
{ projectionGuess_ = type;}
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
@ -122,7 +122,7 @@ namespace ATC {
|
||||||
/** check if element bounding box contains the given point */
|
/** check if element bounding box contains the given point */
|
||||||
bool range_check(const DENS_MAT &eltCoords, const DENS_VEC & x) const;
|
bool range_check(const DENS_MAT &eltCoords, const DENS_VEC & x) const;
|
||||||
|
|
||||||
/** get the min and max coordinate of any point in an element in a
|
/** get the min and max coordinate of any point in an element in a
|
||||||
* dimension */
|
* dimension */
|
||||||
void bounds_in_dim(const DENS_MAT &eltCoords, const int dim,
|
void bounds_in_dim(const DENS_MAT &eltCoords, const int dim,
|
||||||
double &min, double &max) const;
|
double &min, double &max) const;
|
||||||
|
@ -133,7 +133,7 @@ namespace ATC {
|
||||||
virtual void shape_function(const VECTOR & xi,
|
virtual void shape_function(const VECTOR & xi,
|
||||||
DENS_VEC &N) const;
|
DENS_VEC &N) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute shape functions at all ip's:
|
* compute shape functions at all ip's:
|
||||||
* indexed: N(ip,node)
|
* indexed: N(ip,node)
|
||||||
* dN[nsd](ip,node)
|
* dN[nsd](ip,node)
|
||||||
|
@ -141,11 +141,11 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
virtual void shape_function(const DENS_MAT eltCoords,
|
virtual void shape_function(const DENS_MAT eltCoords,
|
||||||
DENS_MAT &N,
|
DENS_MAT &N,
|
||||||
std::vector<DENS_MAT> &dN,
|
std::vector<DENS_MAT> &dN,
|
||||||
DIAG_MAT &weights);
|
DIAG_MAT &weights);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute shape functions and derivatives at a single point,
|
* compute shape functions and derivatives at a single point,
|
||||||
* given the point and the element that contains it
|
* given the point and the element that contains it
|
||||||
* indexed: N(node)
|
* indexed: N(node)
|
||||||
*/
|
*/
|
||||||
|
@ -153,8 +153,8 @@ namespace ATC {
|
||||||
const VECTOR &x,
|
const VECTOR &x,
|
||||||
DENS_VEC &N);
|
DENS_VEC &N);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute shape functions and derivatives at a single point,
|
* compute shape functions and derivatives at a single point,
|
||||||
* given the point and the element that contains it
|
* given the point and the element that contains it
|
||||||
* indexed: N(node)
|
* indexed: N(node)
|
||||||
* dNdx(ip,nSD)
|
* dNdx(ip,nSD)
|
||||||
|
@ -164,17 +164,17 @@ namespace ATC {
|
||||||
DENS_VEC &N,
|
DENS_VEC &N,
|
||||||
DENS_MAT &dNdx);
|
DENS_MAT &dNdx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute shape functions and derivatives at a single point,
|
* compute shape functions and derivatives at a single point,
|
||||||
* given the point and the element that contains it
|
* given the point and the element that contains it
|
||||||
* indexed:
|
* indexed:
|
||||||
* dNdx(ip,nSD)
|
* dNdx(ip,nSD)
|
||||||
*/
|
*/
|
||||||
virtual void shape_function_derivatives(const DENS_MAT eltCoords,
|
virtual void shape_function_derivatives(const DENS_MAT eltCoords,
|
||||||
const VECTOR &x,
|
const VECTOR &x,
|
||||||
DENS_MAT &dNdx);
|
DENS_MAT &dNdx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute shape functions at all face ip's:
|
* compute shape functions at all face ip's:
|
||||||
* indexed: N(ip,node)
|
* indexed: N(ip,node)
|
||||||
* n[nsd](ip,node)
|
* n[nsd](ip,node)
|
||||||
|
@ -186,7 +186,7 @@ namespace ATC {
|
||||||
DENS_MAT &n,
|
DENS_MAT &n,
|
||||||
DIAG_MAT &weights);
|
DIAG_MAT &weights);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute shape functions at all face ip's:
|
* compute shape functions at all face ip's:
|
||||||
* indexed: N(ip,node)
|
* indexed: N(ip,node)
|
||||||
* dN[nsd](ip,node)
|
* dN[nsd](ip,node)
|
||||||
|
@ -200,32 +200,32 @@ namespace ATC {
|
||||||
std::vector<DENS_MAT> &Nn,
|
std::vector<DENS_MAT> &Nn,
|
||||||
DIAG_MAT &weights);
|
DIAG_MAT &weights);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute normal vector from the specified face
|
* compute normal vector from the specified face
|
||||||
* indexed: normal(nSD)
|
* indexed: normal(nSD)
|
||||||
*/
|
*/
|
||||||
virtual double face_normal(const DENS_MAT &eltCoords,
|
virtual double face_normal(const DENS_MAT &eltCoords,
|
||||||
const int faceID,
|
const int faceID,
|
||||||
int ip,
|
int ip,
|
||||||
DENS_VEC &normal);
|
DENS_VEC &normal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compute tangents to local coordinates
|
* compute tangents to local coordinates
|
||||||
* indexed:
|
* indexed:
|
||||||
*/
|
*/
|
||||||
virtual void tangents(const DENS_MAT &eltCoords,
|
virtual void tangents(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x,
|
const DENS_VEC &x,
|
||||||
std::vector<DENS_VEC> & tangents,
|
std::vector<DENS_VEC> & tangents,
|
||||||
const bool normalize=false) const;
|
const bool normalize=false) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// HELPERS
|
// HELPERS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate the appropriate interpolation class
|
* generate the appropriate interpolation class
|
||||||
*/
|
*/
|
||||||
FE_Interpolate *interpolate_factory(std::string interpolateType);
|
FE_Interpolate *interpolate_factory(std::string interpolateType);
|
||||||
|
|
||||||
|
@ -233,11 +233,11 @@ namespace ATC {
|
||||||
virtual void initial_local_coordinates(const DENS_MAT &eltCoords,
|
virtual void initial_local_coordinates(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x,
|
const DENS_VEC &x,
|
||||||
DENS_VEC &xiInitial) const;
|
DENS_VEC &xiInitial) const;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// PROTECTED MEMBERS
|
// PROTECTED MEMBERS
|
||||||
|
|
||||||
// Currently used interpolation class
|
// Currently used interpolation class
|
||||||
FE_Interpolate *feInterpolate_;
|
FE_Interpolate *feInterpolate_;
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ namespace ATC {
|
||||||
// Number of face nodes
|
// Number of face nodes
|
||||||
int numFaceNodes_;
|
int numFaceNodes_;
|
||||||
// Number of nodes in one dimension
|
// Number of nodes in one dimension
|
||||||
int numNodes1d_;
|
int numNodes1d_;
|
||||||
|
|
||||||
|
|
||||||
// local coords of nodes: localCoords_(isd, ip)
|
// local coords of nodes: localCoords_(isd, ip)
|
||||||
|
@ -269,7 +269,7 @@ namespace ATC {
|
||||||
/** tolerance used in solving Newton's method for local coordinates */
|
/** tolerance used in solving Newton's method for local coordinates */
|
||||||
double tolerance_;
|
double tolerance_;
|
||||||
ProjectionGuessType projectionGuess_;
|
ProjectionGuessType projectionGuess_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ namespace ATC {
|
||||||
|
|
||||||
~FE_ElementHex();
|
~FE_ElementHex();
|
||||||
|
|
||||||
void set_quadrature(FeIntQuadrature type);
|
void set_quadrature(FeIntQuadrature type);
|
||||||
|
|
||||||
bool contains_point(const DENS_MAT &eltCoords,
|
bool contains_point(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x) const;
|
const DENS_VEC &x) const;
|
||||||
|
@ -312,7 +312,7 @@ namespace ATC {
|
||||||
void write_restart(FILE *);
|
void write_restart(FILE *);
|
||||||
|
|
||||||
~FE_ElementRect();
|
~FE_ElementRect();
|
||||||
|
|
||||||
bool local_coordinates(const DENS_MAT &eltCoords,
|
bool local_coordinates(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x,
|
const DENS_VEC &x,
|
||||||
DENS_VEC &xi) const;
|
DENS_VEC &xi) const;
|
||||||
|
@ -320,7 +320,7 @@ namespace ATC {
|
||||||
protected:
|
protected:
|
||||||
virtual bool contains_point(const DENS_MAT &eltCoords,
|
virtual bool contains_point(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x) const;
|
const DENS_VEC &x) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,10 +338,10 @@ namespace ATC {
|
||||||
|
|
||||||
// Dump state info to disk for later restart (unimplemented)
|
// Dump state info to disk for later restart (unimplemented)
|
||||||
void write_restart(FILE *);
|
void write_restart(FILE *);
|
||||||
|
|
||||||
~FE_ElementTet();
|
~FE_ElementTet();
|
||||||
|
|
||||||
void set_quadrature(FeIntQuadrature type);
|
void set_quadrature(FeIntQuadrature type);
|
||||||
|
|
||||||
bool local_coordinates(const DENS_MAT &eltCoords,
|
bool local_coordinates(const DENS_MAT &eltCoords,
|
||||||
const DENS_VEC &x,
|
const DENS_VEC &x,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,36 +16,36 @@
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
|
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
class ATC_Method;
|
class ATC_Method;
|
||||||
class FE_Element;
|
class FE_Element;
|
||||||
class XT_Function;
|
class XT_Function;
|
||||||
class KernelFunction;
|
class KernelFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class FE_Engine
|
* @class FE_Engine
|
||||||
* @brief Base class for computing and assembling mass matrix
|
* @brief Base class for computing and assembling mass matrix
|
||||||
* and rhs vectors
|
* and rhs vectors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FE_Engine{
|
class FE_Engine{
|
||||||
public:
|
public:
|
||||||
/** constructor/s */
|
/** constructor/s */
|
||||||
FE_Engine(MPI_Comm comm);
|
FE_Engine(MPI_Comm comm);
|
||||||
|
|
||||||
/** destructor */
|
/** destructor */
|
||||||
~FE_Engine();
|
~FE_Engine();
|
||||||
|
|
||||||
/** initialize */
|
/** initialize */
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
MPI_Comm communicator() {return communicator_;}
|
MPI_Comm communicator() {return communicator_;}
|
||||||
void partition_mesh();
|
void partition_mesh();
|
||||||
void departition_mesh();
|
void departition_mesh();
|
||||||
bool is_partitioned() const { return feMesh_->is_partitioned(); }
|
bool is_partitioned() const { return feMesh_->is_partitioned(); }
|
||||||
int map_elem_to_myElem(int elemID) const
|
int map_elem_to_myElem(int elemID) const
|
||||||
{ return feMesh_->map_elem_to_myElem(elemID); }
|
{ return feMesh_->map_elem_to_myElem(elemID); }
|
||||||
int map_myElem_to_elem(int myElemID) const
|
int map_myElem_to_elem(int myElemID) const
|
||||||
{ return feMesh_->map_myElem_to_elem(myElemID); }
|
{ return feMesh_->map_myElem_to_elem(myElemID); }
|
||||||
|
|
||||||
// note: it is misleading to declare the following const
|
// note: it is misleading to declare the following const
|
||||||
|
@ -60,7 +60,7 @@ namespace ATC {
|
||||||
// are more pertinent to other classes (FE_Interpolate,
|
// are more pertinent to other classes (FE_Interpolate,
|
||||||
// for the most part) that it uses temporarily for space/
|
// for the most part) that it uses temporarily for space/
|
||||||
// time speedups while doing it's computations.
|
// time speedups while doing it's computations.
|
||||||
//
|
//
|
||||||
// I approve of this usage of mutable, but the const/
|
// I approve of this usage of mutable, but the const/
|
||||||
// non-const member function declaring in this class is
|
// non-const member function declaring in this class is
|
||||||
// really all wrong to begin with.
|
// really all wrong to begin with.
|
||||||
|
@ -71,7 +71,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
bool modify(int narg, char **arg);
|
bool modify(int narg, char **arg);
|
||||||
|
|
||||||
/** finish up */
|
/** finish up */
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
|
@ -84,11 +84,11 @@ namespace ATC {
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** these assume the caller is handling the parallel collection */
|
/** these assume the caller is handling the parallel collection */
|
||||||
void initialize_output(int rank, std::string outputPrefix, std::set<int> otypes);
|
void initialize_output(int rank, std::string outputPrefix, std::set<int> otypes);
|
||||||
|
|
||||||
/** write geometry */
|
/** write geometry */
|
||||||
void write_geometry(void);
|
void write_geometry(void);
|
||||||
|
|
||||||
/** write data: data is arrayed over _unique_ nodes
|
/** write data: data is arrayed over _unique_ nodes
|
||||||
and then mapped by the engine */
|
and then mapped by the engine */
|
||||||
void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=nullptr);
|
void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=nullptr);
|
||||||
void write_data(double time, OUTPUT_LIST *data);
|
void write_data(double time, OUTPUT_LIST *data);
|
||||||
|
@ -102,7 +102,7 @@ namespace ATC {
|
||||||
void delete_elements(const std::set<int> &elementList);
|
void delete_elements(const std::set<int> &elementList);
|
||||||
void cut_mesh(const std::set<PAIR> &cutFaces, const std::set<int> &edgeNodes);
|
void cut_mesh(const std::set<PAIR> &cutFaces, const std::set<int> &edgeNodes);
|
||||||
|
|
||||||
void add_global(const std::string name, const double value)
|
void add_global(const std::string name, const double value)
|
||||||
{ outputManager_.add_global(name,value); }
|
{ outputManager_.add_global(name,value); }
|
||||||
|
|
||||||
void add_field_names(const std::string field, const std::vector<std::string> & names)
|
void add_field_names(const std::string field, const std::vector<std::string> & names)
|
||||||
|
@ -175,18 +175,18 @@ namespace ATC {
|
||||||
|
|
||||||
/** compute a dimensionless mass matrix */
|
/** compute a dimensionless mass matrix */
|
||||||
void compute_mass_matrix(SPAR_MAT &mass_matrix) const;
|
void compute_mass_matrix(SPAR_MAT &mass_matrix) const;
|
||||||
|
|
||||||
/** computes a dimensionless mass matrix for the given-quadrature */
|
/** computes a dimensionless mass matrix for the given-quadrature */
|
||||||
void compute_mass_matrix(const DIAG_MAT &weights,
|
void compute_mass_matrix(const DIAG_MAT &weights,
|
||||||
const SPAR_MAT &N,
|
const SPAR_MAT &N,
|
||||||
SPAR_MAT &mass_matrix) const;
|
SPAR_MAT &mass_matrix) const;
|
||||||
|
|
||||||
/** compute a single dimensionless mass matrix */
|
/** compute a single dimensionless mass matrix */
|
||||||
void compute_lumped_mass_matrix(DIAG_MAT &lumped_mass_matrix) const;
|
void compute_lumped_mass_matrix(DIAG_MAT &lumped_mass_matrix) const;
|
||||||
|
|
||||||
/** compute lumped mass matrix = diag (\int \rho N_I dV) */
|
/** compute lumped mass matrix = diag (\int \rho N_I dV) */
|
||||||
void compute_lumped_mass_matrix(
|
void compute_lumped_mass_matrix(
|
||||||
const Array<FieldName> &mask,
|
const Array<FieldName> &mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
const PhysicsModel *physicsModel,
|
const PhysicsModel *physicsModel,
|
||||||
const Array<int> &elementMaterials,
|
const Array<int> &elementMaterials,
|
||||||
|
@ -195,7 +195,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** compute dimensional lumped mass matrix using given quadrature */
|
/** compute dimensional lumped mass matrix using given quadrature */
|
||||||
void compute_lumped_mass_matrix(
|
void compute_lumped_mass_matrix(
|
||||||
const Array<FieldName> &mask,
|
const Array<FieldName> &mask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
const PhysicsModel *physicsModel,
|
const PhysicsModel *physicsModel,
|
||||||
const Array<std::set<int> > &pointMaterialGroups,
|
const Array<std::set<int> > &pointMaterialGroups,
|
||||||
|
@ -211,7 +211,7 @@ namespace ATC {
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
const PhysicsModel *physicsModel,
|
const PhysicsModel *physicsModel,
|
||||||
const Array<int> &elementMaterials,
|
const Array<int> &elementMaterials,
|
||||||
FIELD_MATS &energy,
|
FIELD_MATS &energy,
|
||||||
const DenseMatrix<bool> *elementMask=nullptr,
|
const DenseMatrix<bool> *elementMask=nullptr,
|
||||||
const IntegrationDomainType domain=FULL_DOMAIN) const;
|
const IntegrationDomainType domain=FULL_DOMAIN) const;
|
||||||
|
|
||||||
|
@ -250,15 +250,15 @@ namespace ATC {
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
const PhysicsModel *physicsModel,
|
const PhysicsModel *physicsModel,
|
||||||
const Array<int> &elementMaterials,
|
const Array<int> &elementMaterials,
|
||||||
GRAD_FIELD_MATS &flux,
|
GRAD_FIELD_MATS &flux,
|
||||||
const DenseMatrix<bool> *elementMask=nullptr) const;
|
const DenseMatrix<bool> *elementMask=nullptr) const;
|
||||||
|
|
||||||
/** compute the flux on the MD/FE boundary */
|
/** compute the flux on the MD/FE boundary */
|
||||||
void compute_boundary_flux(const RHS_MASK &rhsMask,
|
void compute_boundary_flux(const RHS_MASK &rhsMask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
const PhysicsModel *physicsModel,
|
const PhysicsModel *physicsModel,
|
||||||
const Array<int> &elementMaterials,
|
const Array<int> &elementMaterials,
|
||||||
const std::set<PAIR> &faceSet,
|
const std::set<PAIR> &faceSet,
|
||||||
FIELDS &rhs) const;
|
FIELDS &rhs) const;
|
||||||
|
|
||||||
/** compute the flux on using an L2 interpolation of the flux */
|
/** compute the flux on using an L2 interpolation of the flux */
|
||||||
|
@ -276,21 +276,21 @@ namespace ATC {
|
||||||
const std::set<int> *nodeSet=nullptr) const;
|
const std::set<int> *nodeSet=nullptr) const;
|
||||||
|
|
||||||
/** compute prescribed flux given an array of functions of x & t */
|
/** compute prescribed flux given an array of functions of x & t */
|
||||||
void add_fluxes(const Array<bool> &fieldMask,
|
void add_fluxes(const Array<bool> &fieldMask,
|
||||||
const double time,
|
const double time,
|
||||||
const SURFACE_SOURCE &sourceFunctions,
|
const SURFACE_SOURCE &sourceFunctions,
|
||||||
FIELDS &nodalSources) const;
|
FIELDS &nodalSources) const;
|
||||||
void compute_fluxes(const Array<bool> &fieldMask,
|
void compute_fluxes(const Array<bool> &fieldMask,
|
||||||
const double time,
|
const double time,
|
||||||
const SURFACE_SOURCE &sourceFunctions,
|
const SURFACE_SOURCE &sourceFunctions,
|
||||||
FIELDS &nodalSources) const
|
FIELDS &nodalSources) const
|
||||||
{
|
{
|
||||||
SURFACE_SOURCE::const_iterator src_iter;
|
SURFACE_SOURCE::const_iterator src_iter;
|
||||||
for (src_iter=sourceFunctions.begin(); src_iter!=sourceFunctions.end(); src_iter++) {
|
for (src_iter=sourceFunctions.begin(); src_iter!=sourceFunctions.end(); src_iter++) {
|
||||||
_fieldName_ = src_iter->first;
|
_fieldName_ = src_iter->first;
|
||||||
if (!fieldMask((int)_fieldName_)) continue;
|
if (!fieldMask((int)_fieldName_)) continue;
|
||||||
if (nodalSources[_fieldName_].nRows()==0) {
|
if (nodalSources[_fieldName_].nRows()==0) {
|
||||||
nodalSources[_fieldName_].reset(nNodesUnique_,1);
|
nodalSources[_fieldName_].reset(nNodesUnique_,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_fluxes(fieldMask, time, sourceFunctions, nodalSources);
|
add_fluxes(fieldMask, time, sourceFunctions, nodalSources);
|
||||||
|
@ -310,7 +310,7 @@ namespace ATC {
|
||||||
SPAR_MAT &tangent) const;
|
SPAR_MAT &tangent) const;
|
||||||
|
|
||||||
/** compute open flux given a face set */
|
/** compute open flux given a face set */
|
||||||
|
|
||||||
void add_open_fluxes(const Array2D<bool> &rhsMask,
|
void add_open_fluxes(const Array2D<bool> &rhsMask,
|
||||||
const FIELDS &fields,
|
const FIELDS &fields,
|
||||||
const OPEN_SURFACE &openFaces,
|
const OPEN_SURFACE &openFaces,
|
||||||
|
@ -324,13 +324,13 @@ namespace ATC {
|
||||||
const FieldName velocity = ELECTRON_VELOCITY) const;
|
const FieldName velocity = ELECTRON_VELOCITY) const;
|
||||||
|
|
||||||
/** compute nodal vector of volume based sources */
|
/** compute nodal vector of volume based sources */
|
||||||
void add_sources(const Array<bool> &fieldMask,
|
void add_sources(const Array<bool> &fieldMask,
|
||||||
const double time,
|
const double time,
|
||||||
const VOLUME_SOURCE &sourceFunctions,
|
const VOLUME_SOURCE &sourceFunctions,
|
||||||
FIELDS &nodalSources) const;
|
FIELDS &nodalSources) const;
|
||||||
void add_sources(const Array<bool> &fieldMask,
|
void add_sources(const Array<bool> &fieldMask,
|
||||||
const double time,
|
const double time,
|
||||||
const FIELDS &sources,
|
const FIELDS &sources,
|
||||||
FIELDS &nodalSources) const;
|
FIELDS &nodalSources) const;
|
||||||
|
|
||||||
/** compute surface flux of a nodal field */
|
/** compute surface flux of a nodal field */
|
||||||
|
@ -356,37 +356,37 @@ namespace ATC {
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
/** evaluate shape function at a list of points in R^3 */
|
/** evaluate shape function at a list of points in R^3 */
|
||||||
void evaluate_shape_functions(const MATRIX &coords,
|
void evaluate_shape_functions(const MATRIX &coords,
|
||||||
SPAR_MAT &N) const;
|
SPAR_MAT &N) const;
|
||||||
|
|
||||||
/** evaluate shape function & derivatives at a list of points in R^3 */
|
/** evaluate shape function & derivatives at a list of points in R^3 */
|
||||||
void evaluate_shape_functions(const MATRIX &coords,
|
void evaluate_shape_functions(const MATRIX &coords,
|
||||||
SPAR_MAT &N,
|
SPAR_MAT &N,
|
||||||
SPAR_MAT_VEC &dN) const;
|
SPAR_MAT_VEC &dN) const;
|
||||||
|
|
||||||
/** evaluate shape function at a list of points in R^3 */
|
/** evaluate shape function at a list of points in R^3 */
|
||||||
void evaluate_shape_functions(const MATRIX &coords,
|
void evaluate_shape_functions(const MATRIX &coords,
|
||||||
const INT_ARRAY &pointToEltMap,
|
const INT_ARRAY &pointToEltMap,
|
||||||
SPAR_MAT &N) const;
|
SPAR_MAT &N) const;
|
||||||
|
|
||||||
/** evaluate shape function & derivatives at a list of points in R^3 */
|
/** evaluate shape function & derivatives at a list of points in R^3 */
|
||||||
void evaluate_shape_functions(const MATRIX &coords,
|
void evaluate_shape_functions(const MATRIX &coords,
|
||||||
const INT_ARRAY &pointToEltMap,
|
const INT_ARRAY &pointToEltMap,
|
||||||
SPAR_MAT &N,
|
SPAR_MAT &N,
|
||||||
SPAR_MAT_VEC &dN) const;
|
SPAR_MAT_VEC &dN) const;
|
||||||
|
|
||||||
/** evaluate shape derivatives at a list of points in R^3 */
|
/** evaluate shape derivatives at a list of points in R^3 */
|
||||||
void evaluate_shape_function_derivatives(const MATRIX &coords,
|
void evaluate_shape_function_derivatives(const MATRIX &coords,
|
||||||
const INT_ARRAY &pointToEltMap,
|
const INT_ARRAY &pointToEltMap,
|
||||||
SPAR_MAT_VEC &dN) const;
|
SPAR_MAT_VEC &dN) const;
|
||||||
|
|
||||||
void shape_functions(const VECTOR &x,
|
void shape_functions(const VECTOR &x,
|
||||||
DENS_VEC &shp,
|
DENS_VEC &shp,
|
||||||
Array<int> &node_list) const
|
Array<int> &node_list) const
|
||||||
{ feMesh_->shape_functions(x,shp,node_list); }
|
{ feMesh_->shape_functions(x,shp,node_list); }
|
||||||
|
|
||||||
void shape_functions(const VECTOR & x,
|
void shape_functions(const VECTOR & x,
|
||||||
DENS_VEC& shp,
|
DENS_VEC& shp,
|
||||||
DENS_MAT& dshp,
|
DENS_MAT& dshp,
|
||||||
Array<int> &node_list) const
|
Array<int> &node_list) const
|
||||||
{ feMesh_->shape_functions(x,shp,dshp,node_list); }
|
{ feMesh_->shape_functions(x,shp,dshp,node_list); }
|
||||||
|
@ -405,7 +405,7 @@ namespace ATC {
|
||||||
|
|
||||||
void shape_functions(const VECTOR &x,
|
void shape_functions(const VECTOR &x,
|
||||||
const int eltId,
|
const int eltId,
|
||||||
DENS_VEC &shp,
|
DENS_VEC &shp,
|
||||||
DENS_MAT &dshp,
|
DENS_MAT &dshp,
|
||||||
Array<int> &node_list) const
|
Array<int> &node_list) const
|
||||||
{ feMesh_->shape_functions(x,eltId,shp,dshp,node_list); }
|
{ feMesh_->shape_functions(x,eltId,shp,dshp,node_list); }
|
||||||
|
@ -425,21 +425,21 @@ namespace ATC {
|
||||||
/** \name nodeset */
|
/** \name nodeset */
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
/** pass through */
|
/** pass through */
|
||||||
void create_nodeset(const std::string &name, const std::set<int> &nodeset)
|
void create_nodeset(const std::string &name, const std::set<int> &nodeset)
|
||||||
{ feMesh_->create_nodeset(name,nodeset); }
|
{ feMesh_->create_nodeset(name,nodeset); }
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
/** \name accessors */
|
/** \name accessors */
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** even though these are pass-throughs there is a necessary
|
/** even though these are pass-throughs there is a necessary
|
||||||
* translation */
|
* translation */
|
||||||
/** return number of unique nodes */
|
/** return number of unique nodes */
|
||||||
int num_nodes() const { return feMesh_->num_nodes_unique(); }
|
int num_nodes() const { return feMesh_->num_nodes_unique(); }
|
||||||
|
|
||||||
/** return number of total nodes */
|
/** return number of total nodes */
|
||||||
int nNodesTotal() const { return feMesh_->num_nodes(); }
|
int nNodesTotal() const { return feMesh_->num_nodes(); }
|
||||||
|
|
||||||
/** return number of elements */
|
/** return number of elements */
|
||||||
int num_elements() const { return feMesh_->num_elements(); }
|
int num_elements() const { return feMesh_->num_elements(); }
|
||||||
int my_num_elements() const { return feMesh_->my_num_elements(); }
|
int my_num_elements() const { return feMesh_->my_num_elements(); }
|
||||||
|
@ -448,53 +448,53 @@ namespace ATC {
|
||||||
int num_nodes_per_element() const { return feMesh_->num_nodes_per_element(); }
|
int num_nodes_per_element() const { return feMesh_->num_nodes_per_element(); }
|
||||||
|
|
||||||
/** return element connectivity */
|
/** return element connectivity */
|
||||||
void element_connectivity(const int eltID,
|
void element_connectivity(const int eltID,
|
||||||
Array<int> & nodes) const
|
Array<int> & nodes) const
|
||||||
{ feMesh_->element_connectivity_unique(eltID, nodes); }
|
{ feMesh_->element_connectivity_unique(eltID, nodes); }
|
||||||
|
|
||||||
/** return face connectivity */
|
/** return face connectivity */
|
||||||
void face_connectivity(const PAIR &faceID,
|
void face_connectivity(const PAIR &faceID,
|
||||||
Array<int> &nodes) const
|
Array<int> &nodes) const
|
||||||
{ feMesh_->face_connectivity_unique(faceID, nodes); }
|
{ feMesh_->face_connectivity_unique(faceID, nodes); }
|
||||||
|
|
||||||
/** in lieu of pass-throughs const accessors ... */
|
/** in lieu of pass-throughs const accessors ... */
|
||||||
/** return const ptr to mesh */
|
/** return const ptr to mesh */
|
||||||
const FE_Mesh* fe_mesh() const { return feMesh_; }
|
const FE_Mesh* fe_mesh() const { return feMesh_; }
|
||||||
|
|
||||||
/** return number of spatial dimensions */
|
/** return number of spatial dimensions */
|
||||||
int nsd() const { return feMesh_->num_spatial_dimensions(); }
|
int nsd() const { return feMesh_->num_spatial_dimensions(); }
|
||||||
|
|
||||||
/** return if the FE mesh has been created */
|
/** return if the FE mesh has been created */
|
||||||
int has_mesh() const { return feMesh_!=nullptr; }
|
int has_mesh() const { return feMesh_!=nullptr; }
|
||||||
|
|
||||||
/** get nodal coordinates for a given element */
|
/** get nodal coordinates for a given element */
|
||||||
void element_coordinates(const int eltIdx, DENS_MAT &coords)
|
void element_coordinates(const int eltIdx, DENS_MAT &coords)
|
||||||
{ feMesh_->element_coordinates(eltIdx,coords); }
|
{ feMesh_->element_coordinates(eltIdx,coords); }
|
||||||
|
|
||||||
/** get nodal coordinates for a given element */
|
/** get nodal coordinates for a given element */
|
||||||
void element_field(const int eltIdx, const DENS_MAT field,
|
void element_field(const int eltIdx, const DENS_MAT field,
|
||||||
DENS_MAT &local_field)
|
DENS_MAT &local_field)
|
||||||
{ feMesh_->element_field(eltIdx, field, local_field); }
|
{ feMesh_->element_field(eltIdx, field, local_field); }
|
||||||
|
|
||||||
/** access list of elements to be deleted */
|
/** access list of elements to be deleted */
|
||||||
const std::set<int> &null_elements(void) const
|
const std::set<int> &null_elements(void) const
|
||||||
{ return nullElements_; }
|
{ return nullElements_; }
|
||||||
|
|
||||||
/** access to the amended nodal coordinate values */
|
/** access to the amended nodal coordinate values */
|
||||||
const DENS_MAT &nodal_coordinates(void) const
|
const DENS_MAT &nodal_coordinates(void) const
|
||||||
{ return (*feMesh_->coordinates()); }
|
{ return (*feMesh_->coordinates()); }
|
||||||
|
|
||||||
/** map global node numbering to unique node numbering for
|
/** map global node numbering to unique node numbering for
|
||||||
* amended mesh */
|
* amended mesh */
|
||||||
int map_global_to_unique(const int global_id) const
|
int map_global_to_unique(const int global_id) const
|
||||||
{ return (*feMesh_->node_map())(global_id); }
|
{ return (*feMesh_->node_map())(global_id); }
|
||||||
|
|
||||||
int number_of_global_nodes(void) const { return nNodes_; }
|
int number_of_global_nodes(void) const { return nNodes_; }
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
/** set kernel */
|
/** set kernel */
|
||||||
|
|
||||||
void set_kernel(KernelFunction* ptr);
|
void set_kernel(KernelFunction* ptr);
|
||||||
KernelFunction *kernel(int /* i */) { return kernelFunction_; }
|
KernelFunction *kernel(int /* i */) { return kernelFunction_; }
|
||||||
KernelFunction *kernel() { return kernelFunction_; }
|
KernelFunction *kernel() { return kernelFunction_; }
|
||||||
|
@ -512,8 +512,8 @@ namespace ATC {
|
||||||
|
|
||||||
/** auxiliary kernel function */
|
/** auxiliary kernel function */
|
||||||
KernelFunction *kernelFunction_;
|
KernelFunction *kernelFunction_;
|
||||||
|
|
||||||
/** initialized flag */
|
/** initialized flag */
|
||||||
bool initialized_;
|
bool initialized_;
|
||||||
|
|
||||||
void parse_partitions(int & argIdx, int narg, char ** arg,
|
void parse_partitions(int & argIdx, int narg, char ** arg,
|
||||||
|
@ -521,13 +521,13 @@ namespace ATC {
|
||||||
void print_partitions(double xmin, double xmax, Array<double> &dx) const;
|
void print_partitions(double xmin, double xmax, Array<double> &dx) const;
|
||||||
|
|
||||||
/** create a uniform, structured mesh */
|
/** create a uniform, structured mesh */
|
||||||
void create_mesh(Array<double> &dx,
|
void create_mesh(Array<double> &dx,
|
||||||
Array<double> &dy,
|
Array<double> &dy,
|
||||||
Array<double> &dz,
|
Array<double> &dz,
|
||||||
const char *regionName,
|
const char *regionName,
|
||||||
Array<bool> periodic);
|
Array<bool> periodic);
|
||||||
|
|
||||||
void create_mesh(int nx, int ny, int nz,
|
void create_mesh(int nx, int ny, int nz,
|
||||||
const char *regionName,
|
const char *regionName,
|
||||||
Array<bool> periodic);
|
Array<bool> periodic);
|
||||||
|
|
||||||
|
@ -537,11 +537,11 @@ namespace ATC {
|
||||||
|
|
||||||
/** data that can be used for a subset of original mesh */
|
/** data that can be used for a subset of original mesh */
|
||||||
std::set<int> nullElements_;
|
std::set<int> nullElements_;
|
||||||
|
|
||||||
/** faces upon which nodes are duplicated */
|
/** faces upon which nodes are duplicated */
|
||||||
std::set<PAIR> cutFaces_;
|
std::set<PAIR> cutFaces_;
|
||||||
std::set<int> cutEdge_;
|
std::set<int> cutEdge_;
|
||||||
|
|
||||||
/** workspace */
|
/** workspace */
|
||||||
int nNodesPerElement_;
|
int nNodesPerElement_;
|
||||||
int nSD_;
|
int nSD_;
|
||||||
|
@ -551,9 +551,9 @@ namespace ATC {
|
||||||
mutable int nIPsPerElement_;
|
mutable int nIPsPerElement_;
|
||||||
mutable int nIPsPerFace_;
|
mutable int nIPsPerFace_;
|
||||||
mutable FeIntQuadrature quadrature_;
|
mutable FeIntQuadrature quadrature_;
|
||||||
mutable FIELDS::const_iterator _fieldItr_;
|
mutable FIELDS::const_iterator _fieldItr_;
|
||||||
mutable FieldName _fieldName_;
|
mutable FieldName _fieldName_;
|
||||||
|
|
||||||
/** sized arrays */
|
/** sized arrays */
|
||||||
mutable DIAG_MAT _weights_;
|
mutable DIAG_MAT _weights_;
|
||||||
mutable DENS_MAT _N_, _Nw_;
|
mutable DENS_MAT _N_, _Nw_;
|
||||||
|
@ -565,14 +565,14 @@ namespace ATC {
|
||||||
/** unsized arrays */
|
/** unsized arrays */
|
||||||
mutable DENS_MAT _Nmat_;
|
mutable DENS_MAT _Nmat_;
|
||||||
mutable FIELD_MATS _fieldsAtIPs_;
|
mutable FIELD_MATS _fieldsAtIPs_;
|
||||||
mutable GRAD_FIELD_MATS _gradFieldsAtIPs_;
|
mutable GRAD_FIELD_MATS _gradFieldsAtIPs_;
|
||||||
mutable DENS_MAT _Nfluxes_;
|
mutable DENS_MAT _Nfluxes_;
|
||||||
mutable AliasArray<int> _conn_;
|
mutable AliasArray<int> _conn_;
|
||||||
mutable DENS_MAT_VEC _Bfluxes_;
|
mutable DENS_MAT_VEC _Bfluxes_;
|
||||||
|
|
||||||
/** output object */
|
/** output object */
|
||||||
OutputManager outputManager_;
|
OutputManager outputManager_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // end namespace ATC
|
}; // end namespace ATC
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_Interpolate::set_quadrature(FeEltGeometry geo,
|
void FE_Interpolate::set_quadrature(FeEltGeometry geo,
|
||||||
FeIntQuadrature quad)
|
FeIntQuadrature quad)
|
||||||
{
|
{
|
||||||
if (feQuadList_.count(quad) == 0) {
|
if (feQuadList_.count(quad) == 0) {
|
||||||
feQuad_ = new FE_Quadrature(geo,quad);
|
feQuad_ = new FE_Quadrature(geo,quad);
|
||||||
|
@ -47,7 +47,7 @@ namespace ATC {
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
int numFaces = feElement_->num_faces();
|
int numFaces = feElement_->num_faces();
|
||||||
int numFaceNodes = feElement_->num_face_nodes();
|
int numFaceNodes = feElement_->num_face_nodes();
|
||||||
|
|
||||||
int numIPs = feQuad_->numIPs;
|
int numIPs = feQuad_->numIPs;
|
||||||
DENS_MAT &ipCoords = feQuad_->ipCoords;
|
DENS_MAT &ipCoords = feQuad_->ipCoords;
|
||||||
int numFaceIPs = feQuad_->numFaceIPs;
|
int numFaceIPs = feQuad_->numFaceIPs;
|
||||||
|
@ -79,7 +79,7 @@ namespace ATC {
|
||||||
compute_N_dNdr(thisIP,thisN,thisdNdr);
|
compute_N_dNdr(thisIP,thisN,thisdNdr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute 2D face shape function derivatives
|
// Compute 2D face shape function derivatives
|
||||||
dNdrFace2D_.assign(numFaceIPs,DENS_MAT(nSD_-1,numFaceNodes));
|
dNdrFace2D_.assign(numFaceIPs,DENS_MAT(nSD_-1,numFaceNodes));
|
||||||
for (int ip = 0; ip < numFaceIPs; ip++) {
|
for (int ip = 0; ip < numFaceIPs; ip++) {
|
||||||
|
@ -111,14 +111,14 @@ namespace ATC {
|
||||||
N.resize(numEltNodes);
|
N.resize(numEltNodes);
|
||||||
DENS_MAT dNdr(nSD_,numEltNodes,false);
|
DENS_MAT dNdr(nSD_,numEltNodes,false);
|
||||||
compute_N_dNdr(xi,N,dNdr);
|
compute_N_dNdr(xi,N,dNdr);
|
||||||
|
|
||||||
DENS_MAT eltCoordsT = transpose(eltCoords);
|
DENS_MAT eltCoordsT = transpose(eltCoords);
|
||||||
DENS_MAT dxdr, drdx;
|
DENS_MAT dxdr, drdx;
|
||||||
|
|
||||||
dxdr = dNdr*eltCoordsT;
|
dxdr = dNdr*eltCoordsT;
|
||||||
drdx = inv(dxdr);
|
drdx = inv(dxdr);
|
||||||
dNdx = drdx*dNdr;
|
dNdx = drdx*dNdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_Interpolate::shape_function_derivatives(const DENS_MAT &eltCoords,
|
void FE_Interpolate::shape_function_derivatives(const DENS_MAT &eltCoords,
|
||||||
const VECTOR &xi,
|
const VECTOR &xi,
|
||||||
|
@ -126,16 +126,16 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
DENS_MAT dNdr(nSD_,numEltNodes,false);
|
DENS_MAT dNdr(nSD_,numEltNodes,false);
|
||||||
|
|
||||||
DENS_VEC N(numEltNodes);
|
DENS_VEC N(numEltNodes);
|
||||||
compute_N_dNdr(xi,N,dNdr);
|
compute_N_dNdr(xi,N,dNdr);
|
||||||
DENS_MAT eltCoordsT = transpose(eltCoords);
|
DENS_MAT eltCoordsT = transpose(eltCoords);
|
||||||
DENS_MAT dxdr, drdx;
|
DENS_MAT dxdr, drdx;
|
||||||
dxdr = dNdr*eltCoordsT; // tangents or Jacobian matrix
|
dxdr = dNdr*eltCoordsT; // tangents or Jacobian matrix
|
||||||
|
|
||||||
drdx = inv(dxdr);
|
drdx = inv(dxdr);
|
||||||
dNdx = drdx*dNdr; // dN/dx = dN/dxi (dx/dxi)^-1
|
dNdx = drdx*dNdr; // dN/dx = dN/dxi (dx/dxi)^-1
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_Interpolate::tangents(const DENS_MAT &eltCoords,
|
void FE_Interpolate::tangents(const DENS_MAT &eltCoords,
|
||||||
const VECTOR &xi,
|
const VECTOR &xi,
|
||||||
|
@ -143,15 +143,15 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
DENS_MAT dNdr(nSD_,numEltNodes,false);
|
DENS_MAT dNdr(nSD_,numEltNodes,false);
|
||||||
|
|
||||||
DENS_VEC N(numEltNodes);
|
DENS_VEC N(numEltNodes);
|
||||||
compute_N_dNdr(xi,N,dNdr);
|
compute_N_dNdr(xi,N,dNdr);
|
||||||
//dNdr.print("dNdr");
|
//dNdr.print("dNdr");
|
||||||
DENS_MAT eltCoordsT = transpose(eltCoords);
|
DENS_MAT eltCoordsT = transpose(eltCoords);
|
||||||
//eltCoordsT.print("elt coords");
|
//eltCoordsT.print("elt coords");
|
||||||
dxdr = dNdr*eltCoordsT;
|
dxdr = dNdr*eltCoordsT;
|
||||||
//dxdr.print("dxdr");
|
//dxdr.print("dxdr");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_Interpolate::tangents(const DENS_MAT &eltCoords,
|
void FE_Interpolate::tangents(const DENS_MAT &eltCoords,
|
||||||
const VECTOR &xi,
|
const VECTOR &xi,
|
||||||
|
@ -162,7 +162,7 @@ namespace ATC {
|
||||||
tangents(eltCoords,xi,dxdr);
|
tangents(eltCoords,xi,dxdr);
|
||||||
//dxdr.print("dxdr-post");
|
//dxdr.print("dxdr-post");
|
||||||
dxdxi.resize(nSD_);
|
dxdxi.resize(nSD_);
|
||||||
//for (int i = 0; i < nSD_; ++i) dxdxi[i] = CLON_VEC(dxdr,CLONE_COL,i);
|
//for (int i = 0; i < nSD_; ++i) dxdxi[i] = CLON_VEC(dxdr,CLONE_COL,i);
|
||||||
for (int i = 0; i < nSD_; ++i) {
|
for (int i = 0; i < nSD_; ++i) {
|
||||||
dxdxi[i].resize(nSD_);
|
dxdxi[i].resize(nSD_);
|
||||||
for (int j = 0; j < nSD_; ++j) {
|
for (int j = 0; j < nSD_; ++j) {
|
||||||
|
@ -192,7 +192,7 @@ namespace ATC {
|
||||||
DIAG_MAT &weights)
|
DIAG_MAT &weights)
|
||||||
{
|
{
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
|
|
||||||
// Transpose eltCoords
|
// Transpose eltCoords
|
||||||
DENS_MAT eltCoordsT(transpose(eltCoords));
|
DENS_MAT eltCoordsT(transpose(eltCoords));
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ namespace ATC {
|
||||||
|
|
||||||
// Set sizes of matrices and vectors
|
// Set sizes of matrices and vectors
|
||||||
if ((int)dN.size() != nSD_) dN.resize(nSD_);
|
if ((int)dN.size() != nSD_) dN.resize(nSD_);
|
||||||
for (int isd = 0; isd < nSD_; isd++)
|
for (int isd = 0; isd < nSD_; isd++)
|
||||||
dN[isd].resize(feQuad_->numIPs,numEltNodes);
|
dN[isd].resize(feQuad_->numIPs,numEltNodes);
|
||||||
weights.resize(feQuad_->numIPs,feQuad_->numIPs);
|
weights.resize(feQuad_->numIPs,feQuad_->numIPs);
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ namespace ATC {
|
||||||
// Compute dNdx and fill dN matrix
|
// Compute dNdx and fill dN matrix
|
||||||
dNdx = drdx * dNdr_[ip];
|
dNdx = drdx * dNdr_[ip];
|
||||||
for (int isd = 0; isd < nSD_; isd++)
|
for (int isd = 0; isd < nSD_; isd++)
|
||||||
for (int inode = 0; inode < numEltNodes; inode++)
|
for (int inode = 0; inode < numEltNodes; inode++)
|
||||||
dN[isd](ip,inode) = dNdx(isd,inode);
|
dN[isd](ip,inode) = dNdx(isd,inode);
|
||||||
|
|
||||||
// Compute jacobian determinant of dxdr at this ip
|
// Compute jacobian determinant of dxdr at this ip
|
||||||
|
@ -227,9 +227,9 @@ namespace ATC {
|
||||||
+ dxdr(0,2) * (dxdr(1,0)*dxdr(2,1) - dxdr(1,1)*dxdr(2,0));
|
+ dxdr(0,2) * (dxdr(1,0)*dxdr(2,1) - dxdr(1,1)*dxdr(2,0));
|
||||||
|
|
||||||
// Compute ip weight
|
// Compute ip weight
|
||||||
weights(ip,ip) = feQuad_->ipWeights(ip)*J;
|
weights(ip,ip) = feQuad_->ipWeights(ip)*J;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
@ -268,9 +268,9 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute ip weight
|
// Compute ip weight
|
||||||
weights(ip,ip) = feQuad_->ipFaceWeights(ip)*J;
|
weights(ip,ip) = feQuad_->ipFaceWeights(ip)*J;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_Interpolate::face_shape_function(const DENS_MAT &eltCoords,
|
void FE_Interpolate::face_shape_function(const DENS_MAT &eltCoords,
|
||||||
|
@ -323,9 +323,9 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute ip weight
|
// Compute ip weight
|
||||||
weights(ip,ip) = feQuad_->ipFaceWeights(ip)*J;
|
weights(ip,ip) = feQuad_->ipFaceWeights(ip)*J;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
@ -333,7 +333,7 @@ namespace ATC {
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
double FE_Interpolate::face_normal(const DENS_MAT &faceCoords,
|
double FE_Interpolate::face_normal(const DENS_MAT &faceCoords,
|
||||||
int ip,
|
int ip,
|
||||||
DENS_VEC &normal)
|
DENS_VEC &normal)
|
||||||
{
|
{
|
||||||
// Compute dx/dr for deformed element
|
// Compute dx/dr for deformed element
|
||||||
DENS_MAT faceCoordsT = transpose(faceCoords);
|
DENS_MAT faceCoordsT = transpose(faceCoords);
|
||||||
|
@ -345,8 +345,8 @@ namespace ATC {
|
||||||
normal(2) = dxdr(0,0)*dxdr(1,1) - dxdr(0,1)*dxdr(1,0);
|
normal(2) = dxdr(0,0)*dxdr(1,1) - dxdr(0,1)*dxdr(1,0);
|
||||||
|
|
||||||
// Jacobian (3D)
|
// Jacobian (3D)
|
||||||
double J = sqrt(normal(0)*normal(0) +
|
double J = sqrt(normal(0)*normal(0) +
|
||||||
normal(1)*normal(1) +
|
normal(1)*normal(1) +
|
||||||
normal(2)*normal(2));
|
normal(2)*normal(2));
|
||||||
double invJ = 1.0/J;
|
double invJ = 1.0/J;
|
||||||
normal(0) *= invJ;
|
normal(0) *= invJ;
|
||||||
|
@ -354,24 +354,24 @@ namespace ATC {
|
||||||
normal(2) *= invJ;
|
normal(2) *= invJ;
|
||||||
return J;
|
return J;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FE_Interpolate::num_ips() const
|
int FE_Interpolate::num_ips() const
|
||||||
{
|
{
|
||||||
return feQuad_->numIPs;
|
return feQuad_->numIPs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FE_Interpolate::num_face_ips() const
|
int FE_Interpolate::num_face_ips() const
|
||||||
{
|
{
|
||||||
return feQuad_->numFaceIPs;
|
return feQuad_->numFaceIPs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
* Class FE_InterpolateCartLagrange
|
* Class FE_InterpolateCartLagrange
|
||||||
*
|
*
|
||||||
* For computing Lagrange shape functions using Cartesian
|
* For computing Lagrange shape functions using Cartesian
|
||||||
* coordinate systems (all quads/hexes fall under this
|
* coordinate systems (all quads/hexes fall under this
|
||||||
* category, and any elements derived by degenerating
|
* category, and any elements derived by degenerating
|
||||||
* them). Not to be used for serendipity elements, which
|
* them). Not to be used for serendipity elements, which
|
||||||
* should be implemented for SPEED.
|
* should be implemented for SPEED.
|
||||||
*
|
*
|
||||||
|
@ -395,7 +395,7 @@ namespace ATC {
|
||||||
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
|
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
int numEltNodes1d = feElement_->num_elt_nodes_1d();
|
int numEltNodes1d = feElement_->num_elt_nodes_1d();
|
||||||
|
|
||||||
DENS_MAT lagrangeTerms(nSD_,numEltNodes1d);
|
DENS_MAT lagrangeTerms(nSD_,numEltNodes1d);
|
||||||
DENS_MAT lagrangeDenom(nSD_,numEltNodes1d);
|
DENS_MAT lagrangeDenom(nSD_,numEltNodes1d);
|
||||||
lagrangeTerms = 1.0;
|
lagrangeTerms = 1.0;
|
||||||
|
@ -404,7 +404,7 @@ namespace ATC {
|
||||||
for (int inode = 0; inode < numEltNodes1d; ++inode) {
|
for (int inode = 0; inode < numEltNodes1d; ++inode) {
|
||||||
for (int icont = 0; icont < numEltNodes1d; ++icont) {
|
for (int icont = 0; icont < numEltNodes1d; ++icont) {
|
||||||
if (inode != icont) {
|
if (inode != icont) {
|
||||||
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
|
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
|
||||||
localCoords1d(icont));
|
localCoords1d(icont));
|
||||||
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
|
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ namespace ATC {
|
||||||
// *** see comments for compute_N_dNdr ***
|
// *** see comments for compute_N_dNdr ***
|
||||||
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
|
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
|
||||||
int numEltNodes1d = feElement_->num_elt_nodes_1d();
|
int numEltNodes1d = feElement_->num_elt_nodes_1d();
|
||||||
|
|
||||||
DENS_MAT lagrangeTerms(nD,numEltNodes1d);
|
DENS_MAT lagrangeTerms(nD,numEltNodes1d);
|
||||||
DENS_MAT lagrangeDenom(nD,numEltNodes1d);
|
DENS_MAT lagrangeDenom(nD,numEltNodes1d);
|
||||||
DENS_MAT lagrangeDeriv(nD,numEltNodes1d);
|
DENS_MAT lagrangeDeriv(nD,numEltNodes1d);
|
||||||
|
@ -453,7 +453,7 @@ namespace ATC {
|
||||||
for (int icont = 0; icont < numEltNodes1d; ++icont) {
|
for (int icont = 0; icont < numEltNodes1d; ++icont) {
|
||||||
if (inode != icont) {
|
if (inode != icont) {
|
||||||
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
|
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
|
||||||
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
|
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
|
||||||
localCoords1d(icont));
|
localCoords1d(icont));
|
||||||
for (int dcont=0; dcont<numEltNodes1d; ++dcont) {
|
for (int dcont=0; dcont<numEltNodes1d; ++dcont) {
|
||||||
if (inode == dcont) {
|
if (inode == dcont) {
|
||||||
|
@ -477,7 +477,7 @@ namespace ATC {
|
||||||
lagrangeDeriv(iSD,inode) /= lagrangeDenom(iSD,inode);
|
lagrangeDeriv(iSD,inode) /= lagrangeDenom(iSD,inode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dNdr = 1.0;
|
dNdr = 1.0;
|
||||||
vector<int> mapping(nD);
|
vector<int> mapping(nD);
|
||||||
for (int inode=0; inode<numNodes; ++inode) {
|
for (int inode=0; inode<numNodes; ++inode) {
|
||||||
|
@ -502,7 +502,7 @@ namespace ATC {
|
||||||
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
|
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
int numEltNodes1d = feElement_->num_elt_nodes_1d();
|
int numEltNodes1d = feElement_->num_elt_nodes_1d();
|
||||||
|
|
||||||
// lagrangeTerms stores the numerator for the various Lagrange polynomials
|
// lagrangeTerms stores the numerator for the various Lagrange polynomials
|
||||||
// in one dimension, that will be used to produce the three dimensional
|
// in one dimension, that will be used to produce the three dimensional
|
||||||
// shape functions
|
// shape functions
|
||||||
|
@ -526,13 +526,13 @@ namespace ATC {
|
||||||
for (int inode = 0; inode < numEltNodes1d; ++inode) {
|
for (int inode = 0; inode < numEltNodes1d; ++inode) {
|
||||||
for (int icont = 0; icont < numEltNodes1d; ++icont) {
|
for (int icont = 0; icont < numEltNodes1d; ++icont) {
|
||||||
if (inode != icont) {
|
if (inode != icont) {
|
||||||
// each dimension and each 1d node per dimension has a
|
// each dimension and each 1d node per dimension has a
|
||||||
// contribution from all nodes besides the current node
|
// contribution from all nodes besides the current node
|
||||||
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
|
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
|
||||||
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
|
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
|
||||||
localCoords1d(icont));
|
localCoords1d(icont));
|
||||||
// complciated; each sum produced by the product rule has one
|
// complciated; each sum produced by the product rule has one
|
||||||
// "derivative", and the rest are just identical to the terms
|
// "derivative", and the rest are just identical to the terms
|
||||||
// above
|
// above
|
||||||
for (int dcont=0; dcont<numEltNodes1d; ++dcont) {
|
for (int dcont=0; dcont<numEltNodes1d; ++dcont) {
|
||||||
if (inode == dcont) {
|
if (inode == dcont) {
|
||||||
|
@ -561,7 +561,7 @@ namespace ATC {
|
||||||
lagrangeDeriv(iSD,inode) /= lagrangeDenom(iSD,inode);
|
lagrangeDeriv(iSD,inode) /= lagrangeDenom(iSD,inode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
N = 1.0;
|
N = 1.0;
|
||||||
dNdr = 1.0;
|
dNdr = 1.0;
|
||||||
// mapping returns the 1d nodes in each dimension that should be multiplied
|
// mapping returns the 1d nodes in each dimension that should be multiplied
|
||||||
|
@ -589,7 +589,7 @@ namespace ATC {
|
||||||
*
|
*
|
||||||
* For computing linear shape functions using Cartesian
|
* For computing linear shape functions using Cartesian
|
||||||
* coordinate systems (all quads/hexes fall under this
|
* coordinate systems (all quads/hexes fall under this
|
||||||
* category, and any elements derived by degenerating
|
* category, and any elements derived by degenerating
|
||||||
* them).
|
* them).
|
||||||
*
|
*
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
|
@ -604,7 +604,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
// Handled by base class
|
// Handled by base class
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_InterpolateCartLin::compute_N(const VECTOR &point,
|
void FE_InterpolateCartLin::compute_N(const VECTOR &point,
|
||||||
VECTOR &N)
|
VECTOR &N)
|
||||||
{
|
{
|
||||||
|
@ -612,7 +612,7 @@ namespace ATC {
|
||||||
const DENS_MAT &localCoords = feElement_->local_coords();
|
const DENS_MAT &localCoords = feElement_->local_coords();
|
||||||
double invVol = 1.0/(feElement_->vol());
|
double invVol = 1.0/(feElement_->vol());
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
|
|
||||||
for (int inode = 0; inode < numEltNodes; ++inode) {
|
for (int inode = 0; inode < numEltNodes; ++inode) {
|
||||||
N(inode) = invVol;
|
N(inode) = invVol;
|
||||||
for (int isd = 0; isd < nSD_; ++isd) {
|
for (int isd = 0; isd < nSD_; ++isd) {
|
||||||
|
@ -633,7 +633,7 @@ namespace ATC {
|
||||||
// *** see comments for compute_N_dNdr ***
|
// *** see comments for compute_N_dNdr ***
|
||||||
const DENS_MAT &localCoords = feElement_->local_coords();
|
const DENS_MAT &localCoords = feElement_->local_coords();
|
||||||
double invVol = 1.0/vol;
|
double invVol = 1.0/vol;
|
||||||
|
|
||||||
for (int inode = 0; inode < numNodes; ++inode) {
|
for (int inode = 0; inode < numNodes; ++inode) {
|
||||||
for (int idr = 0; idr < nD; ++idr) {
|
for (int idr = 0; idr < nD; ++idr) {
|
||||||
dNdr(idr,inode) = invVol;
|
dNdr(idr,inode) = invVol;
|
||||||
|
@ -641,7 +641,7 @@ namespace ATC {
|
||||||
for (int id = 0; id < nD; ++id) {
|
for (int id = 0; id < nD; ++id) {
|
||||||
for (int idr = 0; idr < nD; ++idr) {
|
for (int idr = 0; idr < nD; ++idr) {
|
||||||
if (id == idr) dNdr(idr,inode) *= localCoords(id,inode);
|
if (id == idr) dNdr(idr,inode) *= localCoords(id,inode);
|
||||||
else dNdr(idr,inode) *= 1.0 +
|
else dNdr(idr,inode) *= 1.0 +
|
||||||
point(id)*localCoords(id,inode);
|
point(id)*localCoords(id,inode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -656,7 +656,7 @@ namespace ATC {
|
||||||
const DENS_MAT &localCoords = feElement_->local_coords();
|
const DENS_MAT &localCoords = feElement_->local_coords();
|
||||||
double invVol = 1.0/(feElement_->vol());
|
double invVol = 1.0/(feElement_->vol());
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
|
|
||||||
// Fill in for each node
|
// Fill in for each node
|
||||||
for (int inode = 0; inode < numEltNodes; ++inode) {
|
for (int inode = 0; inode < numEltNodes; ++inode) {
|
||||||
// Intiialize shape function and derivatives
|
// Intiialize shape function and derivatives
|
||||||
|
@ -670,20 +670,20 @@ namespace ATC {
|
||||||
// One term for each dimension, only deriv in deriv's dimension
|
// One term for each dimension, only deriv in deriv's dimension
|
||||||
for (int idr = 0; idr < nSD_; ++idr) {
|
for (int idr = 0; idr < nSD_; ++idr) {
|
||||||
if (isd == idr) dNdr(idr,inode) *= localCoords(isd,inode);
|
if (isd == idr) dNdr(idr,inode) *= localCoords(isd,inode);
|
||||||
else dNdr(idr,inode) *= 1.0 +
|
else dNdr(idr,inode) *= 1.0 +
|
||||||
point(isd)*localCoords(isd,inode);
|
point(isd)*localCoords(isd,inode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
* Class FE_InterpolateCartSerendipity
|
* Class FE_InterpolateCartSerendipity
|
||||||
*
|
*
|
||||||
* For computing shape functions for quadratic serendipity
|
* For computing shape functions for quadratic serendipity
|
||||||
* elements, implemented for SPEED.
|
* elements, implemented for SPEED.
|
||||||
*
|
*
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
FE_InterpolateCartSerendipity::FE_InterpolateCartSerendipity(
|
FE_InterpolateCartSerendipity::FE_InterpolateCartSerendipity(
|
||||||
FE_Element *feElement)
|
FE_Element *feElement)
|
||||||
|
@ -696,7 +696,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
// Handled by base class
|
// Handled by base class
|
||||||
}
|
}
|
||||||
|
|
||||||
void FE_InterpolateCartSerendipity::compute_N(const VECTOR &point,
|
void FE_InterpolateCartSerendipity::compute_N(const VECTOR &point,
|
||||||
VECTOR &N)
|
VECTOR &N)
|
||||||
{
|
{
|
||||||
|
@ -704,14 +704,14 @@ namespace ATC {
|
||||||
const DENS_MAT &localCoords = feElement_->local_coords();
|
const DENS_MAT &localCoords = feElement_->local_coords();
|
||||||
double invVol = 1.0/(feElement_->vol());
|
double invVol = 1.0/(feElement_->vol());
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
|
|
||||||
for (int inode = 0; inode < numEltNodes; ++inode) {
|
for (int inode = 0; inode < numEltNodes; ++inode) {
|
||||||
N(inode) = invVol;
|
N(inode) = invVol;
|
||||||
for (int isd = 0; isd < nSD_; ++isd) {
|
for (int isd = 0; isd < nSD_; ++isd) {
|
||||||
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
|
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
|
||||||
(isd == 0)) ||
|
(isd == 0)) ||
|
||||||
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
|
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
|
||||||
(isd == 1)) ||
|
(isd == 1)) ||
|
||||||
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
|
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
|
||||||
(isd == 2))) {
|
(isd == 2))) {
|
||||||
N(inode) *= (1.0 - pow(point(isd),2))*2;
|
N(inode) *= (1.0 - pow(point(isd),2))*2;
|
||||||
|
@ -742,7 +742,7 @@ namespace ATC {
|
||||||
bool serendipityNode = false;
|
bool serendipityNode = false;
|
||||||
double productRule1 = 0.0;
|
double productRule1 = 0.0;
|
||||||
double productRule2 = 0.0;
|
double productRule2 = 0.0;
|
||||||
|
|
||||||
if (nD != 3 && nD != 2) {
|
if (nD != 3 && nD != 2) {
|
||||||
ATC_Error("Serendipity dNdr calculations are too hard-wired to do "
|
ATC_Error("Serendipity dNdr calculations are too hard-wired to do "
|
||||||
"what you want them to. Only 2D and 3D currently work.");
|
"what you want them to. Only 2D and 3D currently work.");
|
||||||
|
@ -757,15 +757,15 @@ namespace ATC {
|
||||||
// identify nodes/dims differently if 3d or 2d case
|
// identify nodes/dims differently if 3d or 2d case
|
||||||
if (nD == 3) {
|
if (nD == 3) {
|
||||||
serendipityNode =
|
serendipityNode =
|
||||||
(((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
|
(((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
|
||||||
(id == 0)) ||
|
(id == 0)) ||
|
||||||
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
|
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
|
||||||
(id == 1)) ||
|
(id == 1)) ||
|
||||||
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
|
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
|
||||||
(id == 2)));
|
(id == 2)));
|
||||||
} else if (nD == 2) {
|
} else if (nD == 2) {
|
||||||
serendipityNode =
|
serendipityNode =
|
||||||
(((inode == 4 || inode == 6) && (id == 0)) ||
|
(((inode == 4 || inode == 6) && (id == 0)) ||
|
||||||
((inode == 5 || inode == 7) && (id == 1)));
|
((inode == 5 || inode == 7) && (id == 1)));
|
||||||
}
|
}
|
||||||
if (serendipityNode) {
|
if (serendipityNode) {
|
||||||
|
@ -794,7 +794,7 @@ namespace ATC {
|
||||||
productRule2 = (point(0)*localCoords(0,inode) +
|
productRule2 = (point(0)*localCoords(0,inode) +
|
||||||
point(1)*localCoords(1,inode) - 1);
|
point(1)*localCoords(1,inode) - 1);
|
||||||
}
|
}
|
||||||
productRule1 = dNdr(idr,inode) *
|
productRule1 = dNdr(idr,inode) *
|
||||||
(1 + point(idr)*localCoords(idr,inode));
|
(1 + point(idr)*localCoords(idr,inode));
|
||||||
productRule2 *= dNdr(idr,inode);
|
productRule2 *= dNdr(idr,inode);
|
||||||
dNdr(idr,inode) = productRule1 + productRule2;
|
dNdr(idr,inode) = productRule1 + productRule2;
|
||||||
|
@ -830,17 +830,17 @@ namespace ATC {
|
||||||
// "0-coordinate" is in the same dimension as the one we're currently
|
// "0-coordinate" is in the same dimension as the one we're currently
|
||||||
// iterating over. If that's the case, we want to contribute to its
|
// iterating over. If that's the case, we want to contribute to its
|
||||||
// shape functions and derivatives in a modified way:
|
// shape functions and derivatives in a modified way:
|
||||||
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
|
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
|
||||||
(isd == 0)) ||
|
(isd == 0)) ||
|
||||||
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
|
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
|
||||||
(isd == 1)) ||
|
(isd == 1)) ||
|
||||||
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
|
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
|
||||||
(isd == 2))) {
|
(isd == 2))) {
|
||||||
// If the 1d shape function dimension matches the derivative
|
// If the 1d shape function dimension matches the derivative
|
||||||
// dimension...
|
// dimension...
|
||||||
if (isd == idr) {
|
if (isd == idr) {
|
||||||
// contribute to N; sloppy, but this is the easiest way to get
|
// contribute to N; sloppy, but this is the easiest way to get
|
||||||
// N to work right without adding extra, arguably unnecessary
|
// N to work right without adding extra, arguably unnecessary
|
||||||
// loops, while also computing the shape functions
|
// loops, while also computing the shape functions
|
||||||
N(inode) *= (1.0 - pow(point(isd),2))*2;
|
N(inode) *= (1.0 - pow(point(isd),2))*2;
|
||||||
// contribute to dNdr with the derivative of this shape function
|
// contribute to dNdr with the derivative of this shape function
|
||||||
|
@ -869,7 +869,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
for (int idr = 0; idr < nSD_; ++idr) {
|
for (int idr = 0; idr < nSD_; ++idr) {
|
||||||
if (inode < 8) {
|
if (inode < 8) {
|
||||||
productRule1 = dNdr(idr,inode) *
|
productRule1 = dNdr(idr,inode) *
|
||||||
(1 + point(idr)*localCoords(idr,inode));
|
(1 + point(idr)*localCoords(idr,inode));
|
||||||
productRule2 = dNdr(idr,inode) * (point(0)*localCoords(0,inode) +
|
productRule2 = dNdr(idr,inode) * (point(0)*localCoords(0,inode) +
|
||||||
point(1)*localCoords(1,inode) +
|
point(1)*localCoords(1,inode) +
|
||||||
|
@ -883,7 +883,7 @@ namespace ATC {
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
* Class FE_InterpolateSimpLin
|
* Class FE_InterpolateSimpLin
|
||||||
*
|
*
|
||||||
* For computing linear shape functions of simplices,
|
* For computing linear shape functions of simplices,
|
||||||
* which are rather different from those computed
|
* which are rather different from those computed
|
||||||
* in Cartesian coordinates.
|
* in Cartesian coordinates.
|
||||||
|
@ -895,7 +895,7 @@ namespace ATC {
|
||||||
*
|
*
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
FE_InterpolateSimpLin::FE_InterpolateSimpLin(
|
FE_InterpolateSimpLin::FE_InterpolateSimpLin(
|
||||||
FE_Element *feElement)
|
FE_Element *feElement)
|
||||||
: FE_Interpolate(feElement)
|
: FE_Interpolate(feElement)
|
||||||
{
|
{
|
||||||
set_quadrature(TETRA,GAUSS2);
|
set_quadrature(TETRA,GAUSS2);
|
||||||
|
@ -910,7 +910,7 @@ namespace ATC {
|
||||||
VECTOR &N)
|
VECTOR &N)
|
||||||
{
|
{
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
|
|
||||||
// Fill in for each node
|
// Fill in for each node
|
||||||
for (int inode = 0; inode < numEltNodes; ++inode) {
|
for (int inode = 0; inode < numEltNodes; ++inode) {
|
||||||
if (inode == 0) {
|
if (inode == 0) {
|
||||||
|
@ -948,7 +948,7 @@ namespace ATC {
|
||||||
// (which map to x, y, and z). Therefore, the derivative in
|
// (which map to x, y, and z). Therefore, the derivative in
|
||||||
// each dimension are -1.
|
// each dimension are -1.
|
||||||
//
|
//
|
||||||
// The idea is similar for 2 dimensions, which this can
|
// The idea is similar for 2 dimensions, which this can
|
||||||
// handle as well.
|
// handle as well.
|
||||||
for (int idr = 0; idr < nD; ++idr) {
|
for (int idr = 0; idr < nD; ++idr) {
|
||||||
if (inode == 0) {
|
if (inode == 0) {
|
||||||
|
@ -965,7 +965,7 @@ namespace ATC {
|
||||||
DENS_MAT &dNdr) const
|
DENS_MAT &dNdr) const
|
||||||
{
|
{
|
||||||
int numEltNodes = feElement_->num_elt_nodes();
|
int numEltNodes = feElement_->num_elt_nodes();
|
||||||
|
|
||||||
// Fill in for each node
|
// Fill in for each node
|
||||||
for (int inode = 0; inode < numEltNodes; ++inode) {
|
for (int inode = 0; inode < numEltNodes; ++inode) {
|
||||||
// Fill N...
|
// Fill N...
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace ATC {
|
||||||
FE_Interpolate(FE_Element *feElement);
|
FE_Interpolate(FE_Element *feElement);
|
||||||
|
|
||||||
virtual ~FE_Interpolate();
|
virtual ~FE_Interpolate();
|
||||||
|
|
||||||
/** compute the quadrature for a given element type */
|
/** compute the quadrature for a given element type */
|
||||||
void set_quadrature(FeEltGeometry geo, FeIntQuadrature quad);
|
void set_quadrature(FeEltGeometry geo, FeIntQuadrature quad);
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ namespace ATC {
|
||||||
* quadrature */
|
* quadrature */
|
||||||
virtual void precalculate_shape_functions();
|
virtual void precalculate_shape_functions();
|
||||||
|
|
||||||
/** compute the shape functions at the given point;
|
/** compute the shape functions at the given point;
|
||||||
* we use CLON_VECs */
|
* we use CLON_VECs */
|
||||||
virtual void compute_N(const VECTOR &point,
|
virtual void compute_N(const VECTOR &point,
|
||||||
VECTOR &N) = 0;
|
VECTOR &N) = 0;
|
||||||
|
|
||||||
// middle args get no names because they won't be used by some
|
// middle args get no names because they won't be used by some
|
||||||
// child classes.
|
// child classes.
|
||||||
/** compute the shape function derivatives at the given point;
|
/** compute the shape function derivatives at the given point;
|
||||||
* generic, so can work for 2D or 3D case */
|
* generic, so can work for 2D or 3D case */
|
||||||
virtual void compute_dNdr(const VECTOR &point,
|
virtual void compute_dNdr(const VECTOR &point,
|
||||||
const int,
|
const int,
|
||||||
|
@ -51,7 +51,7 @@ namespace ATC {
|
||||||
VECTOR &N,
|
VECTOR &N,
|
||||||
DENS_MAT &dNdr) const = 0;
|
DENS_MAT &dNdr) const = 0;
|
||||||
|
|
||||||
/** compute shape functions at a single point, given the local
|
/** compute shape functions at a single point, given the local
|
||||||
* coordinates; eltCoords needed for derivatives:
|
* coordinates; eltCoords needed for derivatives:
|
||||||
* indexed: N(node)
|
* indexed: N(node)
|
||||||
* dN[nsd](node) */
|
* dN[nsd](node) */
|
||||||
|
@ -72,7 +72,7 @@ namespace ATC {
|
||||||
* weights(ip) */
|
* weights(ip) */
|
||||||
virtual void shape_function(const DENS_MAT &eltCoords,
|
virtual void shape_function(const DENS_MAT &eltCoords,
|
||||||
DENS_MAT &N,
|
DENS_MAT &N,
|
||||||
std::vector<DENS_MAT> &dN,
|
std::vector<DENS_MAT> &dN,
|
||||||
DIAG_MAT &weights);
|
DIAG_MAT &weights);
|
||||||
|
|
||||||
/** compute shape functions at all face ip's:
|
/** compute shape functions at all face ip's:
|
||||||
|
@ -132,7 +132,7 @@ namespace ATC {
|
||||||
// matrix of shape functions at ip's: N_(ip, node)
|
// matrix of shape functions at ip's: N_(ip, node)
|
||||||
DENS_MAT N_;
|
DENS_MAT N_;
|
||||||
|
|
||||||
|
|
||||||
std::vector<DENS_MAT> dNdr_;
|
std::vector<DENS_MAT> dNdr_;
|
||||||
|
|
||||||
// matrix of shape functions at ip's: N_(ip, node)
|
// matrix of shape functions at ip's: N_(ip, node)
|
||||||
|
@ -160,7 +160,7 @@ namespace ATC {
|
||||||
|
|
||||||
virtual void compute_N(const VECTOR &point,
|
virtual void compute_N(const VECTOR &point,
|
||||||
VECTOR &N);
|
VECTOR &N);
|
||||||
|
|
||||||
virtual void compute_dNdr(const VECTOR &point,
|
virtual void compute_dNdr(const VECTOR &point,
|
||||||
const int numNodes,
|
const int numNodes,
|
||||||
const int nD,
|
const int nD,
|
||||||
|
@ -187,7 +187,7 @@ namespace ATC {
|
||||||
|
|
||||||
virtual void compute_N(const VECTOR &point,
|
virtual void compute_N(const VECTOR &point,
|
||||||
VECTOR &N);
|
VECTOR &N);
|
||||||
|
|
||||||
virtual void compute_dNdr(const VECTOR &point,
|
virtual void compute_dNdr(const VECTOR &point,
|
||||||
const int numNodes,
|
const int numNodes,
|
||||||
const int nD,
|
const int nD,
|
||||||
|
@ -214,7 +214,7 @@ namespace ATC {
|
||||||
|
|
||||||
virtual void compute_N(const VECTOR &point,
|
virtual void compute_N(const VECTOR &point,
|
||||||
VECTOR &N);
|
VECTOR &N);
|
||||||
|
|
||||||
virtual void compute_dNdr(const VECTOR &point,
|
virtual void compute_dNdr(const VECTOR &point,
|
||||||
const int numNodes,
|
const int numNodes,
|
||||||
const int nD,
|
const int nD,
|
||||||
|
@ -242,7 +242,7 @@ namespace ATC {
|
||||||
|
|
||||||
virtual void compute_N(const VECTOR &point,
|
virtual void compute_N(const VECTOR &point,
|
||||||
VECTOR &N);
|
VECTOR &N);
|
||||||
|
|
||||||
// middle args get no names because they won't be used by some
|
// middle args get no names because they won't be used by some
|
||||||
// child classes.
|
// child classes.
|
||||||
virtual void compute_dNdr(const VECTOR &,
|
virtual void compute_dNdr(const VECTOR &,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,7 +31,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** constructor */
|
/** constructor */
|
||||||
FE_Mesh();
|
FE_Mesh();
|
||||||
|
|
||||||
/** destructor */
|
/** destructor */
|
||||||
virtual ~FE_Mesh();
|
virtual ~FE_Mesh();
|
||||||
|
|
||||||
|
@ -65,41 +65,41 @@ namespace ATC {
|
||||||
|
|
||||||
/** evaluate shape function at real coordinates */
|
/** evaluate shape function at real coordinates */
|
||||||
void position(const int elem,
|
void position(const int elem,
|
||||||
const VECTOR &xi,
|
const VECTOR &xi,
|
||||||
DENS_VEC &x) const;
|
DENS_VEC &x) const;
|
||||||
|
|
||||||
/** evaluate shape function at real coordinates */
|
/** evaluate shape function at real coordinates */
|
||||||
void shape_functions(const VECTOR &x,
|
void shape_functions(const VECTOR &x,
|
||||||
DENS_VEC &N,
|
DENS_VEC &N,
|
||||||
Array<int> &nodeList) const;
|
Array<int> &nodeList) const;
|
||||||
|
|
||||||
/** evaluate shape function at real coordinates */
|
/** evaluate shape function at real coordinates */
|
||||||
void shape_functions(const VECTOR &x,
|
void shape_functions(const VECTOR &x,
|
||||||
DENS_VEC &N,
|
DENS_VEC &N,
|
||||||
Array<int> &nodeList,
|
Array<int> &nodeList,
|
||||||
const Array<bool> &) const;
|
const Array<bool> &) const;
|
||||||
|
|
||||||
/** evaluate shape function at real coordinates */
|
/** evaluate shape function at real coordinates */
|
||||||
void shape_functions(const DENS_VEC &x,
|
void shape_functions(const DENS_VEC &x,
|
||||||
DENS_VEC &N,
|
DENS_VEC &N,
|
||||||
DENS_MAT &dNdx,
|
DENS_MAT &dNdx,
|
||||||
Array<int> &nodeList) const;
|
Array<int> &nodeList) const;
|
||||||
|
|
||||||
/** evaluate shape function at real coordinates */
|
/** evaluate shape function at real coordinates */
|
||||||
void shape_functions(const VECTOR &x,
|
void shape_functions(const VECTOR &x,
|
||||||
const int eltID,
|
const int eltID,
|
||||||
DENS_VEC &N,
|
DENS_VEC &N,
|
||||||
Array<int> &nodeList) const;
|
Array<int> &nodeList) const;
|
||||||
|
|
||||||
/** evaluate shape function at real coordinates */
|
/** evaluate shape function at real coordinates */
|
||||||
void shape_functions(const DENS_VEC &x,
|
void shape_functions(const DENS_VEC &x,
|
||||||
const int eltID,
|
const int eltID,
|
||||||
DENS_VEC &N,
|
DENS_VEC &N,
|
||||||
DENS_MAT &dNdx,
|
DENS_MAT &dNdx,
|
||||||
Array<int> &nodeList) const;
|
Array<int> &nodeList) const;
|
||||||
|
|
||||||
/** evaluate shape function at real coordinates */
|
/** evaluate shape function at real coordinates */
|
||||||
void shape_function_derivatives(const DENS_VEC &x,
|
void shape_function_derivatives(const DENS_VEC &x,
|
||||||
const int eltID,
|
const int eltID,
|
||||||
DENS_MAT &dNdx,
|
DENS_MAT &dNdx,
|
||||||
Array<int> &nodeList) const;
|
Array<int> &nodeList) const;
|
||||||
|
@ -176,7 +176,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return spatial coordinates for element nodes on eltID,
|
* return spatial coordinates for element nodes on eltID,
|
||||||
* indexed xCoords(isd,inode)
|
* indexed xCoords(isd,inode)
|
||||||
*/
|
*/
|
||||||
|
@ -199,21 +199,21 @@ namespace ATC {
|
||||||
virtual int map_to_element(const DENS_VEC &x) const = 0;
|
virtual int map_to_element(const DENS_VEC &x) const = 0;
|
||||||
|
|
||||||
/** map global node numbering to unique node numbering */
|
/** map global node numbering to unique node numbering */
|
||||||
int map_global_to_unique(const int global_id) const
|
int map_global_to_unique(const int global_id) const
|
||||||
{
|
{
|
||||||
return globalToUniqueMap_(global_id);
|
return globalToUniqueMap_(global_id);
|
||||||
}
|
}
|
||||||
inline const Array<int>& global_to_unique_map(void) const
|
inline const Array<int>& global_to_unique_map(void) const
|
||||||
{
|
{
|
||||||
return globalToUniqueMap_;
|
return globalToUniqueMap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** map unique node numbering a global node numbering */
|
/** map unique node numbering a global node numbering */
|
||||||
int map_unique_to_global(const int unique_id)
|
int map_unique_to_global(const int unique_id)
|
||||||
{
|
{
|
||||||
return uniqueToGlobalMap_(unique_id);
|
return uniqueToGlobalMap_(unique_id);
|
||||||
}
|
}
|
||||||
inline const Array<int>& unique_to_global_map(void) const
|
inline const Array<int>& unique_to_global_map(void) const
|
||||||
{
|
{
|
||||||
return uniqueToGlobalMap_;
|
return uniqueToGlobalMap_;
|
||||||
}
|
}
|
||||||
|
@ -248,43 +248,43 @@ namespace ATC {
|
||||||
|
|
||||||
|
|
||||||
/** get the minimal element set from a nodeset by name */
|
/** get the minimal element set from a nodeset by name */
|
||||||
void nodeset_to_minimal_elementset(const std::string &name,
|
void nodeset_to_minimal_elementset(const std::string &name,
|
||||||
std::set<int> &elemSet) const;
|
std::set<int> &elemSet) const;
|
||||||
/** get the minimal element set from a set of nodes */
|
/** get the minimal element set from a set of nodes */
|
||||||
void nodeset_to_minimal_elementset(const std::set<int> &nodeSet,
|
void nodeset_to_minimal_elementset(const std::set<int> &nodeSet,
|
||||||
std::set<int> &elemSet) const;
|
std::set<int> &elemSet) const;
|
||||||
/** get the maximal element set from a nodeset by name */
|
/** get the maximal element set from a nodeset by name */
|
||||||
void nodeset_to_maximal_elementset(const std::string &name,
|
void nodeset_to_maximal_elementset(const std::string &name,
|
||||||
std::set<int> &elemSet) const;
|
std::set<int> &elemSet) const;
|
||||||
/** get the maximal element set from a set of nodes */
|
/** get the maximal element set from a set of nodes */
|
||||||
void nodeset_to_maximal_elementset(const std::set<int> &nodeSet,
|
void nodeset_to_maximal_elementset(const std::set<int> &nodeSet,
|
||||||
std::set<int> &elemSet) const;
|
std::set<int> &elemSet) const;
|
||||||
|
|
||||||
/** get complement of element set by name */
|
/** get complement of element set by name */
|
||||||
void elementset_complement(const std::string &name,
|
void elementset_complement(const std::string &name,
|
||||||
std::set<int> &elemSet) const;
|
std::set<int> &elemSet) const;
|
||||||
void elementset_complement(const std::set<int> &elemSet,
|
void elementset_complement(const std::set<int> &elemSet,
|
||||||
std::set<int> &elemSetComplement) const;
|
std::set<int> &elemSetComplement) const;
|
||||||
|
|
||||||
/** get the node set from an element set by name */
|
/** get the node set from an element set by name */
|
||||||
void elementset_to_minimal_nodeset(const std::string &name,
|
void elementset_to_minimal_nodeset(const std::string &name,
|
||||||
std::set<int> &nodeSet) const;
|
std::set<int> &nodeSet) const;
|
||||||
|
|
||||||
void elementset_to_nodeset(const std::string &name,
|
void elementset_to_nodeset(const std::string &name,
|
||||||
std::set<int> nodeSet) const;
|
std::set<int> nodeSet) const;
|
||||||
void elementset_to_nodeset(const std::set<int> &elemSet,
|
void elementset_to_nodeset(const std::set<int> &elemSet,
|
||||||
std::set<int> nodeSet) const;
|
std::set<int> nodeSet) const;
|
||||||
std::set<int> elementset_to_nodeset(const std::string &name) const;
|
std::set<int> elementset_to_nodeset(const std::string &name) const;
|
||||||
|
|
||||||
/** convert faceset to nodeset in _unique_ node numbering */
|
/** convert faceset to nodeset in _unique_ node numbering */
|
||||||
void faceset_to_nodeset(const std::string &name,
|
void faceset_to_nodeset(const std::string &name,
|
||||||
std::set<int> &nodeSet) const;
|
std::set<int> &nodeSet) const;
|
||||||
void faceset_to_nodeset(const std::set<PAIR> &faceSet,
|
void faceset_to_nodeset(const std::set<PAIR> &faceSet,
|
||||||
std::set<int> &nodeSet) const;
|
std::set<int> &nodeSet) const;
|
||||||
|
|
||||||
void faceset_to_nodeset_global(const std::string &name,
|
void faceset_to_nodeset_global(const std::string &name,
|
||||||
std::set<int> &nodeSet) const;
|
std::set<int> &nodeSet) const;
|
||||||
void faceset_to_nodeset_global(const std::set<PAIR> &faceSet,
|
void faceset_to_nodeset_global(const std::set<PAIR> &faceSet,
|
||||||
std::set<int> &nodeSet) const;
|
std::set<int> &nodeSet) const;
|
||||||
|
|
||||||
/** get face set from the string name assigned to the set */
|
/** get face set from the string name assigned to the set */
|
||||||
|
@ -294,7 +294,7 @@ namespace ATC {
|
||||||
void create_faceset(const std::string & name,
|
void create_faceset(const std::string & name,
|
||||||
double xmin, double xmax,
|
double xmin, double xmax,
|
||||||
double ymin, double ymax,
|
double ymin, double ymax,
|
||||||
double zmin, double zmax,
|
double zmin, double zmax,
|
||||||
bool outward);
|
bool outward);
|
||||||
/** create face set with tag "name" from faces aligned with plane */
|
/** create face set with tag "name" from faces aligned with plane */
|
||||||
void create_faceset(const std::string & name, double x, int idir, int isgn,
|
void create_faceset(const std::string & name, double x, int idir, int isgn,
|
||||||
|
@ -303,7 +303,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** cut mesh */
|
/** cut mesh */
|
||||||
virtual void cut_mesh(const std::set<PAIR> & faceSet, const std::set<int> & nodeSet) = 0;
|
virtual void cut_mesh(const std::set<PAIR> & faceSet, const std::set<int> & nodeSet) = 0;
|
||||||
|
|
||||||
/** delete elements */
|
/** delete elements */
|
||||||
virtual void delete_elements(const std::set<int> & elementList) = 0;
|
virtual void delete_elements(const std::set<int> & elementList) = 0;
|
||||||
|
|
||||||
|
@ -330,10 +330,10 @@ namespace ATC {
|
||||||
|
|
||||||
/** return number of faces per element */
|
/** return number of faces per element */
|
||||||
int num_faces_per_element() const;
|
int num_faces_per_element() const;
|
||||||
|
|
||||||
/** return number of nodes per face */
|
/** return number of nodes per face */
|
||||||
int num_nodes_per_face() const;
|
int num_nodes_per_face() const;
|
||||||
|
|
||||||
/** return number of integration points per face */
|
/** return number of integration points per face */
|
||||||
int num_ips_per_face() const;
|
int num_ips_per_face() const;
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ namespace ATC {
|
||||||
when mesh is not partitioned. */
|
when mesh is not partitioned. */
|
||||||
Array2D<int> * connectivity(void) { return &connectivity_; }
|
Array2D<int> * connectivity(void) { return &connectivity_; }
|
||||||
/** return a pointer to the connectivity */
|
/** return a pointer to the connectivity */
|
||||||
DENS_MAT * coordinates(void) { return &nodalCoords_;}
|
DENS_MAT * coordinates(void) { return &nodalCoords_;}
|
||||||
/** Engine nodeMap stuff */
|
/** Engine nodeMap stuff */
|
||||||
Array<int> *node_map(void) { return &globalToUniqueMap_;}
|
Array<int> *node_map(void) { return &globalToUniqueMap_;}
|
||||||
|
|
||||||
|
@ -353,19 +353,19 @@ namespace ATC {
|
||||||
|
|
||||||
/** local face connectivity */
|
/** local face connectivity */
|
||||||
const Array2D<int> & local_face_connectivity() const;
|
const Array2D<int> & local_face_connectivity() const;
|
||||||
|
|
||||||
/** element size in each direction */
|
|
||||||
virtual void bounding_box(const int ielem,
|
|
||||||
DENS_VEC & xmin, DENS_VEC & xmax);
|
|
||||||
|
|
||||||
/** element size in each direction */
|
/** element size in each direction */
|
||||||
virtual void element_size(const int ielem,
|
virtual void bounding_box(const int ielem,
|
||||||
double & hx, double & hy, double & hz);
|
DENS_VEC & xmin, DENS_VEC & xmax);
|
||||||
|
|
||||||
/** element size in each direction */
|
/** element size in each direction */
|
||||||
virtual double min_element_size(void) const {return 0.0 ;}
|
virtual void element_size(const int ielem,
|
||||||
|
double & hx, double & hy, double & hz);
|
||||||
|
|
||||||
/** get nodal coordinates for a given element */
|
/** element size in each direction */
|
||||||
|
virtual double min_element_size(void) const {return 0.0 ;}
|
||||||
|
|
||||||
|
/** get nodal coordinates for a given element */
|
||||||
void element_field(const int eltIdx, const DENS_MAT f,
|
void element_field(const int eltIdx, const DENS_MAT f,
|
||||||
DENS_MAT &local_field)
|
DENS_MAT &local_field)
|
||||||
{
|
{
|
||||||
|
@ -387,25 +387,25 @@ namespace ATC {
|
||||||
virtual double coordinate_tolerance(void) const {return 1.e-8;}
|
virtual double coordinate_tolerance(void) const {return 1.e-8;}
|
||||||
|
|
||||||
/** element type */
|
/** element type */
|
||||||
std::string element_type(void) const ;
|
std::string element_type(void) const ;
|
||||||
|
|
||||||
/** output mesh subsets */
|
/** output mesh subsets */
|
||||||
void output(std::string prefix) const;
|
void output(std::string prefix) const;
|
||||||
|
|
||||||
/* Parallelization data members */
|
/* Parallelization data members */
|
||||||
|
|
||||||
/** return element vector for this processor */
|
/** return element vector for this processor */
|
||||||
const std::vector<int> & owned_elts() const { return myElts_; }
|
const std::vector<int> & owned_elts() const { return myElts_; }
|
||||||
const std::vector<int> & owned_and_ghost_elts() const {
|
const std::vector<int> & owned_and_ghost_elts() const {
|
||||||
return (decomposition_) ? myAndGhostElts_: myElts_; }
|
return (decomposition_) ? myAndGhostElts_: myElts_; }
|
||||||
bool is_owned_elt(int elt) const;
|
bool is_owned_elt(int elt) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void parse_plane(int & argIdx, int narg, char ** arg,
|
void parse_plane(int & argIdx, int narg, char ** arg,
|
||||||
int & ndir, int * idir, int & isgn, double xlimits[][2]);
|
int & ndir, int * idir, int & isgn, double xlimits[][2]);
|
||||||
|
|
||||||
void parse_units(int & argIdx, int narg, char ** arg,
|
void parse_units(int & argIdx, int narg, char ** arg,
|
||||||
double & xmin, double & xmax, double & ymin, double & ymax, double & zmin, double & zmax);
|
double & xmin, double & xmax, double & ymin, double & ymax, double & zmin, double & zmax);
|
||||||
|
|
||||||
/** will this mesh use data decomposition? */
|
/** will this mesh use data decomposition? */
|
||||||
|
@ -488,9 +488,9 @@ namespace ATC {
|
||||||
|
|
||||||
/** maps between my IDs and the total IDs */
|
/** maps between my IDs and the total IDs */
|
||||||
std::map<int,int> elemToMyElemMap_;
|
std::map<int,int> elemToMyElemMap_;
|
||||||
|
|
||||||
/** Lists of ghost nodes/neighbor ghost nodes */
|
/** Lists of ghost nodes/neighbor ghost nodes */
|
||||||
std::vector<int> ghostNodesL_;
|
std::vector<int> ghostNodesL_;
|
||||||
std::vector<int> ghostNodesR_;
|
std::vector<int> ghostNodesR_;
|
||||||
std::vector<int> shareNodesL_;
|
std::vector<int> shareNodesL_;
|
||||||
std::vector<int> shareNodesR_;
|
std::vector<int> shareNodesR_;
|
||||||
|
@ -509,11 +509,11 @@ namespace ATC {
|
||||||
class FE_3DMesh : public FE_Mesh {
|
class FE_3DMesh : public FE_Mesh {
|
||||||
public:
|
public:
|
||||||
/** constructor */
|
/** constructor */
|
||||||
FE_3DMesh(){};
|
FE_3DMesh(){};
|
||||||
|
|
||||||
/** constructor for read-in mesh **/
|
/** constructor for read-in mesh **/
|
||||||
// can later be extended to take nodesets, elementsets, etc.
|
// can later be extended to take nodesets, elementsets, etc.
|
||||||
FE_3DMesh(const std::string elementType,
|
FE_3DMesh(const std::string elementType,
|
||||||
const int nNodes,
|
const int nNodes,
|
||||||
const int nElements,
|
const int nElements,
|
||||||
const Array2D<int> *connectivity,
|
const Array2D<int> *connectivity,
|
||||||
|
@ -532,34 +532,34 @@ namespace ATC {
|
||||||
|
|
||||||
/** Removes duplicate elements that appear in more than one vector
|
/** Removes duplicate elements that appear in more than one vector
|
||||||
within procEltLists. **/
|
within procEltLists. **/
|
||||||
void prune_duplicate_elements(std::vector<std::vector<int> > &procEltLists,
|
void prune_duplicate_elements(std::vector<std::vector<int> > &procEltLists,
|
||||||
int *eltToOwners);
|
int *eltToOwners);
|
||||||
|
|
||||||
/** Takes procEltLists, and if there are more than nProcs of them
|
/** Takes procEltLists, and if there are more than nProcs of them
|
||||||
it takes the extra elements and distributes them to other vectors
|
it takes the extra elements and distributes them to other vectors
|
||||||
in procEltLists. */
|
in procEltLists. */
|
||||||
|
|
||||||
// processors if during pruning processors end up
|
// processors if during pruning processors end up
|
||||||
// elementless. This is slightly complicated because of
|
// elementless. This is slightly complicated because of
|
||||||
// ghost nodes.
|
// ghost nodes.
|
||||||
void redistribute_extra_proclists(std::vector<std::vector<int> > &procEltLists,
|
void redistribute_extra_proclists(std::vector<std::vector<int> > &procEltLists,
|
||||||
int *eltToOwners, int nProcs);
|
int *eltToOwners, int nProcs);
|
||||||
|
|
||||||
/** This takes in a dense matrix and a list of elements
|
/** This takes in a dense matrix and a list of elements
|
||||||
and fills in a standard adjacency list (within the matrix)
|
and fills in a standard adjacency list (within the matrix)
|
||||||
for those elements. **/
|
for those elements. **/
|
||||||
|
|
||||||
// the set intersection, which does redundant computations
|
// the set intersection, which does redundant computations
|
||||||
// right now, and filling in the adjacencies for both elements
|
// right now, and filling in the adjacencies for both elements
|
||||||
// simultaneously when two elements share a face.
|
// simultaneously when two elements share a face.
|
||||||
void compute_face_adjacencies(const std::list<int> &elts,
|
void compute_face_adjacencies(const std::list<int> &elts,
|
||||||
DENS_MAT &faceAdjacencies);
|
DENS_MAT &faceAdjacencies);
|
||||||
|
|
||||||
/** Counts the number of nonempty vectors in a vector of vectors. **/
|
/** Counts the number of nonempty vectors in a vector of vectors. **/
|
||||||
int numNonempty(std::vector<std::vector<int> > &v);
|
int numNonempty(std::vector<std::vector<int> > &v);
|
||||||
|
|
||||||
/** In the partitioning, we want to sort vectors of integers by size,
|
/** In the partitioning, we want to sort vectors of integers by size,
|
||||||
and furthermore we want empty vectors to count as the "largest"
|
and furthermore we want empty vectors to count as the "largest"
|
||||||
possible vector because they dont want to count in the minimum. **/
|
possible vector because they dont want to count in the minimum. **/
|
||||||
struct vectorComparer {
|
struct vectorComparer {
|
||||||
bool operator() (std::vector<int> l, std::vector<int> r) {
|
bool operator() (std::vector<int> l, std::vector<int> r) {
|
||||||
|
@ -578,12 +578,12 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
virtual void cut_mesh(const std::set<PAIR> &faceSet,
|
virtual void cut_mesh(const std::set<PAIR> &faceSet,
|
||||||
const std::set<int> &nodeSet);
|
const std::set<int> &nodeSet);
|
||||||
|
|
||||||
virtual void delete_elements(const std::set<int> &elementSet);
|
virtual void delete_elements(const std::set<int> &elementSet);
|
||||||
|
|
||||||
/** map spatial location to element */
|
/** map spatial location to element */
|
||||||
virtual int map_to_element(const DENS_VEC &x) const;
|
virtual int map_to_element(const DENS_VEC &x) const;
|
||||||
|
|
||||||
/** sends out data to processors during partitioning */
|
/** sends out data to processors during partitioning */
|
||||||
void distribute_mesh_data();
|
void distribute_mesh_data();
|
||||||
protected:
|
protected:
|
||||||
|
@ -610,18 +610,18 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class FE_Rectangular3DMesh
|
* @class FE_Rectangular3DMesh
|
||||||
* @brief Derived class for a structured mesh with
|
* @brief Derived class for a structured mesh with
|
||||||
* variable element sizes in x, y, and z directions
|
* variable element sizes in x, y, and z directions
|
||||||
*/
|
*/
|
||||||
class FE_Rectangular3DMesh : public FE_3DMesh {
|
class FE_Rectangular3DMesh : public FE_3DMesh {
|
||||||
public:
|
public:
|
||||||
/** constructor */
|
/** constructor */
|
||||||
FE_Rectangular3DMesh(){};
|
FE_Rectangular3DMesh(){};
|
||||||
FE_Rectangular3DMesh(
|
FE_Rectangular3DMesh(
|
||||||
const Array<double> & hx,
|
const Array<double> & hx,
|
||||||
const Array<double> & hy,
|
const Array<double> & hy,
|
||||||
const Array<double> & hz,
|
const Array<double> & hz,
|
||||||
const double xmin, const double xmax,
|
const double xmin, const double xmax,
|
||||||
const double ymin, const double ymax,
|
const double ymin, const double ymax,
|
||||||
const double zmin, const double zmax,
|
const double zmin, const double zmax,
|
||||||
const Array<bool> periodicity,
|
const Array<bool> periodicity,
|
||||||
|
@ -631,13 +631,13 @@ namespace ATC {
|
||||||
|
|
||||||
/** destructor */
|
/** destructor */
|
||||||
virtual ~FE_Rectangular3DMesh() {};
|
virtual ~FE_Rectangular3DMesh() {};
|
||||||
|
|
||||||
void partition_mesh(void);
|
void partition_mesh(void);
|
||||||
|
|
||||||
void departition_mesh(void);
|
void departition_mesh(void);
|
||||||
|
|
||||||
/** map spatial location to element */
|
/** map spatial location to element */
|
||||||
virtual int map_to_element(const DENS_VEC &x) const;
|
virtual int map_to_element(const DENS_VEC &x) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -650,7 +650,7 @@ namespace ATC {
|
||||||
/** Region size in each direction */
|
/** Region size in each direction */
|
||||||
double L_[3];
|
double L_[3];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** create global-to-unique node mapping */
|
/** create global-to-unique node mapping */
|
||||||
virtual void setup_periodicity(); // note no "tol"
|
virtual void setup_periodicity(); // note no "tol"
|
||||||
|
@ -665,11 +665,11 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class FE_Uniform3DMesh
|
* @class FE_Uniform3DMesh
|
||||||
* @brief Derived class for a uniform structured mesh with
|
* @brief Derived class for a uniform structured mesh with
|
||||||
* fixed element sizes in x, y, and z directions
|
* fixed element sizes in x, y, and z directions
|
||||||
*/
|
*/
|
||||||
class FE_Uniform3DMesh : public FE_Rectangular3DMesh {
|
class FE_Uniform3DMesh : public FE_Rectangular3DMesh {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** constructor */
|
/** constructor */
|
||||||
|
@ -690,8 +690,8 @@ namespace ATC {
|
||||||
void partition_mesh(void);
|
void partition_mesh(void);
|
||||||
|
|
||||||
void departition_mesh(void);
|
void departition_mesh(void);
|
||||||
|
|
||||||
virtual void element_size(const int /* ielem */,
|
virtual void element_size(const int /* ielem */,
|
||||||
double &hx, double &hy, double &hz)
|
double &hx, double &hy, double &hz)
|
||||||
{ hx = L_[0]/n_[0]; hy = L_[1]/n_[1]; hz = L_[2]/n_[2]; }
|
{ hx = L_[0]/n_[0]; hy = L_[1]/n_[1]; hz = L_[2]/n_[2]; }
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ namespace ATC {
|
||||||
{ return std::min(L_[0]/n_[0], std::min(L_[1]/n_[1], L_[2]/n_[2])); }
|
{ return std::min(L_[0]/n_[0], std::min(L_[1]/n_[1], L_[2]/n_[2])); }
|
||||||
|
|
||||||
/** map spatial location to element */
|
/** map spatial location to element */
|
||||||
virtual int map_to_element(const DENS_VEC &x) const;
|
virtual int map_to_element(const DENS_VEC &x) const;
|
||||||
|
|
||||||
private: // only used by this class
|
private: // only used by this class
|
||||||
/** Element size in each direction */
|
/** Element size in each direction */
|
||||||
|
|
|
@ -39,27 +39,27 @@ namespace ATC {
|
||||||
ipFaceWeights.reset(numFaceIPs);
|
ipFaceWeights.reset(numFaceIPs);
|
||||||
|
|
||||||
// "Matrix" of integration point location
|
// "Matrix" of integration point location
|
||||||
ipCoords(0,0) = 0.0;
|
ipCoords(0,0) = 0.0;
|
||||||
ipCoords(1,0) = 0.0;
|
ipCoords(1,0) = 0.0;
|
||||||
ipCoords(2,0) = 0.0;
|
ipCoords(2,0) = 0.0;
|
||||||
|
|
||||||
// Integration point for each face
|
// Integration point for each face
|
||||||
ipFaceCoords[0](0,0) = -1.0; ipFaceCoords[3](0,0) = 0.0;
|
ipFaceCoords[0](0,0) = -1.0; ipFaceCoords[3](0,0) = 0.0;
|
||||||
ipFaceCoords[0](1,0) = 0.0; ipFaceCoords[3](1,0) = 1.0;
|
ipFaceCoords[0](1,0) = 0.0; ipFaceCoords[3](1,0) = 1.0;
|
||||||
ipFaceCoords[0](2,0) = 0.0; ipFaceCoords[3](2,0) = 0.0;
|
ipFaceCoords[0](2,0) = 0.0; ipFaceCoords[3](2,0) = 0.0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[1](0,0) = 1.0; ipFaceCoords[4](0,0) = 0.0;
|
ipFaceCoords[1](0,0) = 1.0; ipFaceCoords[4](0,0) = 0.0;
|
||||||
ipFaceCoords[1](1,0) = 0.0; ipFaceCoords[4](1,0) = 0.0;
|
ipFaceCoords[1](1,0) = 0.0; ipFaceCoords[4](1,0) = 0.0;
|
||||||
ipFaceCoords[1](2,0) = 0.0; ipFaceCoords[4](2,0) = -1.0;
|
ipFaceCoords[1](2,0) = 0.0; ipFaceCoords[4](2,0) = -1.0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,0) = 0.0; ipFaceCoords[5](0,0) = 0.0;
|
ipFaceCoords[2](0,0) = 0.0; ipFaceCoords[5](0,0) = 0.0;
|
||||||
ipFaceCoords[2](1,0) = -1.0; ipFaceCoords[5](1,0) = 0.0;
|
ipFaceCoords[2](1,0) = -1.0; ipFaceCoords[5](1,0) = 0.0;
|
||||||
ipFaceCoords[2](2,0) = 0.0; ipFaceCoords[5](2,0) = 1.0;
|
ipFaceCoords[2](2,0) = 0.0; ipFaceCoords[5](2,0) = 1.0;
|
||||||
|
|
||||||
// 2D integration scheme for the faces
|
// 2D integration scheme for the faces
|
||||||
ipFace2DCoords(0,0) = 0.0;
|
ipFace2DCoords(0,0) = 0.0;
|
||||||
ipFace2DCoords(1,0) = 0.0;
|
ipFace2DCoords(1,0) = 0.0;
|
||||||
|
|
||||||
// Integration point weights
|
// Integration point weights
|
||||||
ipWeights = 8.0;
|
ipWeights = 8.0;
|
||||||
|
|
||||||
|
@ -85,41 +85,41 @@ namespace ATC {
|
||||||
// Dictates difference in node locations for nodal/GAUSS2
|
// Dictates difference in node locations for nodal/GAUSS2
|
||||||
double a = 1.0/sqrt(3.0);
|
double a = 1.0/sqrt(3.0);
|
||||||
if (quad == NODAL) a = 1.0;
|
if (quad == NODAL) a = 1.0;
|
||||||
|
|
||||||
// Matrix of integration point locations & follows local
|
// Matrix of integration point locations & follows local
|
||||||
// conn
|
// conn
|
||||||
ipCoords(0,0) = -a; ipCoords(0,4) = -a;
|
ipCoords(0,0) = -a; ipCoords(0,4) = -a;
|
||||||
ipCoords(1,0) = -a; ipCoords(1,4) = -a;
|
ipCoords(1,0) = -a; ipCoords(1,4) = -a;
|
||||||
ipCoords(2,0) = -a; ipCoords(2,4) = a;
|
ipCoords(2,0) = -a; ipCoords(2,4) = a;
|
||||||
//
|
//
|
||||||
ipCoords(0,1) = a; ipCoords(0,5) = a;
|
ipCoords(0,1) = a; ipCoords(0,5) = a;
|
||||||
ipCoords(1,1) = -a; ipCoords(1,5) = -a;
|
ipCoords(1,1) = -a; ipCoords(1,5) = -a;
|
||||||
ipCoords(2,1) = -a; ipCoords(2,5) = a;
|
ipCoords(2,1) = -a; ipCoords(2,5) = a;
|
||||||
//
|
//
|
||||||
ipCoords(0,2) = a; ipCoords(0,6) = a;
|
ipCoords(0,2) = a; ipCoords(0,6) = a;
|
||||||
ipCoords(1,2) = a; ipCoords(1,6) = a;
|
ipCoords(1,2) = a; ipCoords(1,6) = a;
|
||||||
ipCoords(2,2) = -a; ipCoords(2,6) = a;
|
ipCoords(2,2) = -a; ipCoords(2,6) = a;
|
||||||
//
|
//
|
||||||
ipCoords(0,3) = -a; ipCoords(0,7) = -a;
|
ipCoords(0,3) = -a; ipCoords(0,7) = -a;
|
||||||
ipCoords(1,3) = a; ipCoords(1,7) = a;
|
ipCoords(1,3) = a; ipCoords(1,7) = a;
|
||||||
ipCoords(2,3) = -a; ipCoords(2,7) = a;
|
ipCoords(2,3) = -a; ipCoords(2,7) = a;
|
||||||
|
|
||||||
// Integration points by face
|
// Integration points by face
|
||||||
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
|
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
|
||||||
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
|
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
|
||||||
ipFaceCoords[0](2,0) = -a; ipFaceCoords[3](2,0) = -a;
|
ipFaceCoords[0](2,0) = -a; ipFaceCoords[3](2,0) = -a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = a;
|
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = a;
|
||||||
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
|
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
|
||||||
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = -a;
|
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = -a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
|
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
|
||||||
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
|
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
|
||||||
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
|
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = -a;
|
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = -a;
|
||||||
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
|
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
|
||||||
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = a;
|
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = a;
|
||||||
|
|
||||||
ipFaceCoords[1](0,0) = 1; ipFaceCoords[4](0,0) = -a;
|
ipFaceCoords[1](0,0) = 1; ipFaceCoords[4](0,0) = -a;
|
||||||
ipFaceCoords[1](1,0) = -a; ipFaceCoords[4](1,0) = -a;
|
ipFaceCoords[1](1,0) = -a; ipFaceCoords[4](1,0) = -a;
|
||||||
|
@ -136,30 +136,30 @@ namespace ATC {
|
||||||
ipFaceCoords[1](0,3) = 1; ipFaceCoords[4](0,3) = -a;
|
ipFaceCoords[1](0,3) = 1; ipFaceCoords[4](0,3) = -a;
|
||||||
ipFaceCoords[1](1,3) = -a; ipFaceCoords[4](1,3) = a;
|
ipFaceCoords[1](1,3) = -a; ipFaceCoords[4](1,3) = a;
|
||||||
ipFaceCoords[1](2,3) = a; ipFaceCoords[4](2,3) = -1;
|
ipFaceCoords[1](2,3) = a; ipFaceCoords[4](2,3) = -1;
|
||||||
|
|
||||||
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
|
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
|
||||||
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
|
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
|
||||||
ipFaceCoords[2](2,0) = -a; ipFaceCoords[5](2,0) = 1;
|
ipFaceCoords[2](2,0) = -a; ipFaceCoords[5](2,0) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,1) = a; ipFaceCoords[5](0,1) = a;
|
ipFaceCoords[2](0,1) = a; ipFaceCoords[5](0,1) = a;
|
||||||
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
|
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
|
||||||
ipFaceCoords[2](2,1) = -a; ipFaceCoords[5](2,1) = 1;
|
ipFaceCoords[2](2,1) = -a; ipFaceCoords[5](2,1) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
|
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
|
||||||
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
|
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
|
||||||
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
|
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,3) = -a; ipFaceCoords[5](0,3) = -a;
|
ipFaceCoords[2](0,3) = -a; ipFaceCoords[5](0,3) = -a;
|
||||||
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
|
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
|
||||||
ipFaceCoords[2](2,3) = a; ipFaceCoords[5](2,3) = 1;
|
ipFaceCoords[2](2,3) = a; ipFaceCoords[5](2,3) = 1;
|
||||||
|
|
||||||
// Integration points for all faces ignoring the
|
// Integration points for all faces ignoring the
|
||||||
// redundant dim
|
// redundant dim
|
||||||
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
|
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
|
||||||
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
|
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
|
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
|
||||||
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
|
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
|
||||||
|
|
||||||
// Integration point weights
|
// Integration point weights
|
||||||
ipWeights = 1.0;
|
ipWeights = 1.0;
|
||||||
|
@ -185,36 +185,36 @@ namespace ATC {
|
||||||
|
|
||||||
// Use GAUSS2 for faces for now...
|
// Use GAUSS2 for faces for now...
|
||||||
double a = 1.0/sqrt(3.0);
|
double a = 1.0/sqrt(3.0);
|
||||||
|
|
||||||
// Matrix of integration point locations
|
// Matrix of integration point locations
|
||||||
ipCoords(0,0) = 1.0; ipCoords(0,3) = 0.0;
|
ipCoords(0,0) = 1.0; ipCoords(0,3) = 0.0;
|
||||||
ipCoords(1,0) = 0.0; ipCoords(1,3) = -1.0;
|
ipCoords(1,0) = 0.0; ipCoords(1,3) = -1.0;
|
||||||
ipCoords(2,0) = 0.0; ipCoords(2,3) = 0.0;
|
ipCoords(2,0) = 0.0; ipCoords(2,3) = 0.0;
|
||||||
//
|
//
|
||||||
ipCoords(0,1) = -1.0; ipCoords(0,4) = 0.0;
|
ipCoords(0,1) = -1.0; ipCoords(0,4) = 0.0;
|
||||||
ipCoords(1,1) = 0.0; ipCoords(1,4) = 0.0;
|
ipCoords(1,1) = 0.0; ipCoords(1,4) = 0.0;
|
||||||
ipCoords(2,1) = 0.0; ipCoords(2,4) = 1.0;
|
ipCoords(2,1) = 0.0; ipCoords(2,4) = 1.0;
|
||||||
//
|
//
|
||||||
ipCoords(0,2) = 0.0; ipCoords(0,5) = 0.0;
|
ipCoords(0,2) = 0.0; ipCoords(0,5) = 0.0;
|
||||||
ipCoords(1,2) = 1.0; ipCoords(1,5) = 0.0;
|
ipCoords(1,2) = 1.0; ipCoords(1,5) = 0.0;
|
||||||
ipCoords(2,2) = 0.0; ipCoords(2,5) = -1.0;
|
ipCoords(2,2) = 0.0; ipCoords(2,5) = -1.0;
|
||||||
|
|
||||||
// Integration points by face
|
// Integration points by face
|
||||||
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
|
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
|
||||||
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
|
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
|
||||||
ipFaceCoords[0](2,0) = -a; ipFaceCoords[3](2,0) = -a;
|
ipFaceCoords[0](2,0) = -a; ipFaceCoords[3](2,0) = -a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = -a;
|
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = -a;
|
||||||
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
|
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
|
||||||
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = a;
|
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
|
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
|
||||||
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
|
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
|
||||||
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
|
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = a;
|
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = a;
|
||||||
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
|
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
|
||||||
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = -a;
|
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = -a;
|
||||||
|
|
||||||
ipFaceCoords[1](0,0) = 1; ipFaceCoords[4](0,0) = -a;
|
ipFaceCoords[1](0,0) = 1; ipFaceCoords[4](0,0) = -a;
|
||||||
ipFaceCoords[1](1,0) = -a; ipFaceCoords[4](1,0) = -a;
|
ipFaceCoords[1](1,0) = -a; ipFaceCoords[4](1,0) = -a;
|
||||||
|
@ -231,30 +231,30 @@ namespace ATC {
|
||||||
ipFaceCoords[1](0,3) = 1; ipFaceCoords[4](0,3) = -a;
|
ipFaceCoords[1](0,3) = 1; ipFaceCoords[4](0,3) = -a;
|
||||||
ipFaceCoords[1](1,3) = -a; ipFaceCoords[4](1,3) = a;
|
ipFaceCoords[1](1,3) = -a; ipFaceCoords[4](1,3) = a;
|
||||||
ipFaceCoords[1](2,3) = a; ipFaceCoords[4](2,3) = -1;
|
ipFaceCoords[1](2,3) = a; ipFaceCoords[4](2,3) = -1;
|
||||||
|
|
||||||
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
|
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
|
||||||
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
|
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
|
||||||
ipFaceCoords[2](2,0) = -a; ipFaceCoords[5](2,0) = 1;
|
ipFaceCoords[2](2,0) = -a; ipFaceCoords[5](2,0) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,1) = -a; ipFaceCoords[5](0,1) = a;
|
ipFaceCoords[2](0,1) = -a; ipFaceCoords[5](0,1) = a;
|
||||||
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
|
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
|
||||||
ipFaceCoords[2](2,1) = a; ipFaceCoords[5](2,1) = 1;
|
ipFaceCoords[2](2,1) = a; ipFaceCoords[5](2,1) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
|
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
|
||||||
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
|
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
|
||||||
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
|
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,3) = a; ipFaceCoords[5](0,3) = -a;
|
ipFaceCoords[2](0,3) = a; ipFaceCoords[5](0,3) = -a;
|
||||||
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
|
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
|
||||||
ipFaceCoords[2](2,3) = -a; ipFaceCoords[5](2,3) = 1;
|
ipFaceCoords[2](2,3) = -a; ipFaceCoords[5](2,3) = 1;
|
||||||
|
|
||||||
// Integration points for all faces ignoring the
|
// Integration points for all faces ignoring the
|
||||||
// redundant dim
|
// redundant dim
|
||||||
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
|
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
|
||||||
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
|
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
|
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
|
||||||
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
|
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
|
||||||
|
|
||||||
// Integration point weights
|
// Integration point weights
|
||||||
ipWeights = 4.0/3.0;
|
ipWeights = 4.0/3.0;
|
||||||
|
@ -278,166 +278,166 @@ namespace ATC {
|
||||||
ipFaceWeights.reset(numFaceIPs);
|
ipFaceWeights.reset(numFaceIPs);
|
||||||
|
|
||||||
double a = sqrt(3.0/5.0);
|
double a = sqrt(3.0/5.0);
|
||||||
|
|
||||||
// Matrix of integration point locations & follows local
|
// Matrix of integration point locations & follows local
|
||||||
// conn
|
// conn
|
||||||
ipCoords(0,0) = -a; ipCoords(0,16) = -a;
|
ipCoords(0,0) = -a; ipCoords(0,16) = -a;
|
||||||
ipCoords(1,0) = -a; ipCoords(1,16) = -a;
|
ipCoords(1,0) = -a; ipCoords(1,16) = -a;
|
||||||
ipCoords(2,0) = -a; ipCoords(2,16) = 0;
|
ipCoords(2,0) = -a; ipCoords(2,16) = 0;
|
||||||
//
|
//
|
||||||
ipCoords(0,1) = a; ipCoords(0,17) = -a;
|
ipCoords(0,1) = a; ipCoords(0,17) = -a;
|
||||||
ipCoords(1,1) = -a; ipCoords(1,17) = a;
|
ipCoords(1,1) = -a; ipCoords(1,17) = a;
|
||||||
ipCoords(2,1) = -a; ipCoords(2,17) = 0;
|
ipCoords(2,1) = -a; ipCoords(2,17) = 0;
|
||||||
//
|
//
|
||||||
ipCoords(0,2) = a; ipCoords(0,18) = a;
|
ipCoords(0,2) = a; ipCoords(0,18) = a;
|
||||||
ipCoords(1,2) = a; ipCoords(1,18) = -a;
|
ipCoords(1,2) = a; ipCoords(1,18) = -a;
|
||||||
ipCoords(2,2) = -a; ipCoords(2,18) = 0;
|
ipCoords(2,2) = -a; ipCoords(2,18) = 0;
|
||||||
//
|
//
|
||||||
ipCoords(0,3) = -a; ipCoords(0,19) = a;
|
ipCoords(0,3) = -a; ipCoords(0,19) = a;
|
||||||
ipCoords(1,3) = a; ipCoords(1,19) = a;
|
ipCoords(1,3) = a; ipCoords(1,19) = a;
|
||||||
ipCoords(2,3) = -a; ipCoords(2,19) = 0;
|
ipCoords(2,3) = -a; ipCoords(2,19) = 0;
|
||||||
|
|
||||||
ipCoords(0,4) = -a; ipCoords(0,20) = 0;
|
ipCoords(0,4) = -a; ipCoords(0,20) = 0;
|
||||||
ipCoords(1,4) = -a; ipCoords(1,20) = 0;
|
ipCoords(1,4) = -a; ipCoords(1,20) = 0;
|
||||||
ipCoords(2,4) = a; ipCoords(2,20) = -a;
|
ipCoords(2,4) = a; ipCoords(2,20) = -a;
|
||||||
|
|
||||||
ipCoords(0,5) = a; ipCoords(0,21) = 0;
|
ipCoords(0,5) = a; ipCoords(0,21) = 0;
|
||||||
ipCoords(1,5) = -a; ipCoords(1,21) = 0;
|
ipCoords(1,5) = -a; ipCoords(1,21) = 0;
|
||||||
ipCoords(2,5) = a; ipCoords(2,21) = a;
|
ipCoords(2,5) = a; ipCoords(2,21) = a;
|
||||||
|
|
||||||
ipCoords(0,6) = a; ipCoords(0,22) = 0;
|
ipCoords(0,6) = a; ipCoords(0,22) = 0;
|
||||||
ipCoords(1,6) = a; ipCoords(1,22) = -a;
|
ipCoords(1,6) = a; ipCoords(1,22) = -a;
|
||||||
ipCoords(2,6) = a; ipCoords(2,22) = 0;
|
ipCoords(2,6) = a; ipCoords(2,22) = 0;
|
||||||
|
|
||||||
ipCoords(0,7) = -a; ipCoords(0,23) = 0;
|
ipCoords(0,7) = -a; ipCoords(0,23) = 0;
|
||||||
ipCoords(1,7) = a; ipCoords(1,23) = a;
|
ipCoords(1,7) = a; ipCoords(1,23) = a;
|
||||||
ipCoords(2,7) = a; ipCoords(2,23) = 0;
|
ipCoords(2,7) = a; ipCoords(2,23) = 0;
|
||||||
|
|
||||||
ipCoords(0,8) = 0; ipCoords(0,24) = -a;
|
ipCoords(0,8) = 0; ipCoords(0,24) = -a;
|
||||||
ipCoords(1,8) = -a; ipCoords(1,24) = 0;
|
ipCoords(1,8) = -a; ipCoords(1,24) = 0;
|
||||||
ipCoords(2,8) = -a; ipCoords(2,24) = 0;
|
ipCoords(2,8) = -a; ipCoords(2,24) = 0;
|
||||||
|
|
||||||
ipCoords(0,9) = 0; ipCoords(0,25) = a;
|
ipCoords(0,9) = 0; ipCoords(0,25) = a;
|
||||||
ipCoords(1,9) = -a; ipCoords(1,25) = 0;
|
ipCoords(1,9) = -a; ipCoords(1,25) = 0;
|
||||||
ipCoords(2,9) = a; ipCoords(2,25) = 0;
|
ipCoords(2,9) = a; ipCoords(2,25) = 0;
|
||||||
|
|
||||||
ipCoords(0,10) = 0; ipCoords(0,26) = 0;
|
ipCoords(0,10) = 0; ipCoords(0,26) = 0;
|
||||||
ipCoords(1,10) = a; ipCoords(1,26) = 0;
|
ipCoords(1,10) = a; ipCoords(1,26) = 0;
|
||||||
ipCoords(2,10) = -a; ipCoords(2,26) = 0;
|
ipCoords(2,10) = -a; ipCoords(2,26) = 0;
|
||||||
|
|
||||||
ipCoords(0,11) = 0;
|
ipCoords(0,11) = 0;
|
||||||
ipCoords(1,11) = a;
|
ipCoords(1,11) = a;
|
||||||
ipCoords(2,11) = a;
|
ipCoords(2,11) = a;
|
||||||
|
|
||||||
ipCoords(0,12) = -a;
|
ipCoords(0,12) = -a;
|
||||||
ipCoords(1,12) = 0;
|
ipCoords(1,12) = 0;
|
||||||
ipCoords(2,12) = -a;
|
ipCoords(2,12) = -a;
|
||||||
|
|
||||||
ipCoords(0,13) = -a;
|
ipCoords(0,13) = -a;
|
||||||
ipCoords(1,13) = 0;
|
ipCoords(1,13) = 0;
|
||||||
ipCoords(2,13) = a;
|
ipCoords(2,13) = a;
|
||||||
|
|
||||||
ipCoords(0,14) = a;
|
ipCoords(0,14) = a;
|
||||||
ipCoords(1,14) = 0;
|
ipCoords(1,14) = 0;
|
||||||
ipCoords(2,14) = -a;
|
ipCoords(2,14) = -a;
|
||||||
|
|
||||||
ipCoords(0,15) = a;
|
ipCoords(0,15) = a;
|
||||||
ipCoords(1,15) = 0;
|
ipCoords(1,15) = 0;
|
||||||
ipCoords(2,15) = a;
|
ipCoords(2,15) = a;
|
||||||
|
|
||||||
// Integration points by face
|
// Integration points by face
|
||||||
ipFaceCoords[0](0,0) = -1; ipFaceCoords[0](0,5) = -1;
|
ipFaceCoords[0](0,0) = -1; ipFaceCoords[0](0,5) = -1;
|
||||||
ipFaceCoords[0](1,0) = -a; ipFaceCoords[0](1,5) = 0;
|
ipFaceCoords[0](1,0) = -a; ipFaceCoords[0](1,5) = 0;
|
||||||
ipFaceCoords[0](2,0) = -a; ipFaceCoords[0](2,5) = a;
|
ipFaceCoords[0](2,0) = -a; ipFaceCoords[0](2,5) = a;
|
||||||
//
|
|
||||||
ipFaceCoords[0](0,1) = -1; ipFaceCoords[0](0,6) = -1;
|
|
||||||
ipFaceCoords[0](1,1) = a; ipFaceCoords[0](1,6) = -a;
|
|
||||||
ipFaceCoords[0](2,1) = -a; ipFaceCoords[0](2,6) = 0;
|
|
||||||
//
|
|
||||||
ipFaceCoords[0](0,2) = -1; ipFaceCoords[0](0,7) = -1;
|
|
||||||
ipFaceCoords[0](1,2) = a; ipFaceCoords[0](1,7) = a;
|
|
||||||
ipFaceCoords[0](2,2) = a; ipFaceCoords[0](2,7) = 0;
|
|
||||||
//
|
|
||||||
ipFaceCoords[0](0,3) = -1; ipFaceCoords[0](0,8) = -1;
|
|
||||||
ipFaceCoords[0](1,3) = -a; ipFaceCoords[0](1,8) = 0;
|
|
||||||
ipFaceCoords[0](2,3) = a; ipFaceCoords[0](2,8) = 0;
|
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,4) = -1;
|
ipFaceCoords[0](0,1) = -1; ipFaceCoords[0](0,6) = -1;
|
||||||
ipFaceCoords[0](1,4) = 0;
|
ipFaceCoords[0](1,1) = a; ipFaceCoords[0](1,6) = -a;
|
||||||
ipFaceCoords[0](2,4) = -a;
|
ipFaceCoords[0](2,1) = -a; ipFaceCoords[0](2,6) = 0;
|
||||||
|
//
|
||||||
ipFaceCoords[1](0,0) = 1; ipFaceCoords[1](0,5) = 1;
|
ipFaceCoords[0](0,2) = -1; ipFaceCoords[0](0,7) = -1;
|
||||||
ipFaceCoords[1](1,0) = -a; ipFaceCoords[1](1,5) = 0;
|
ipFaceCoords[0](1,2) = a; ipFaceCoords[0](1,7) = a;
|
||||||
|
ipFaceCoords[0](2,2) = a; ipFaceCoords[0](2,7) = 0;
|
||||||
|
//
|
||||||
|
ipFaceCoords[0](0,3) = -1; ipFaceCoords[0](0,8) = -1;
|
||||||
|
ipFaceCoords[0](1,3) = -a; ipFaceCoords[0](1,8) = 0;
|
||||||
|
ipFaceCoords[0](2,3) = a; ipFaceCoords[0](2,8) = 0;
|
||||||
|
//
|
||||||
|
ipFaceCoords[0](0,4) = -1;
|
||||||
|
ipFaceCoords[0](1,4) = 0;
|
||||||
|
ipFaceCoords[0](2,4) = -a;
|
||||||
|
|
||||||
|
ipFaceCoords[1](0,0) = 1; ipFaceCoords[1](0,5) = 1;
|
||||||
|
ipFaceCoords[1](1,0) = -a; ipFaceCoords[1](1,5) = 0;
|
||||||
ipFaceCoords[1](2,0) = -a; ipFaceCoords[1](2,5) = a;
|
ipFaceCoords[1](2,0) = -a; ipFaceCoords[1](2,5) = a;
|
||||||
//
|
|
||||||
ipFaceCoords[1](0,1) = 1; ipFaceCoords[1](0,6) = 1;
|
|
||||||
ipFaceCoords[1](1,1) = a; ipFaceCoords[1](1,6) = -a;
|
|
||||||
ipFaceCoords[1](2,1) = -a; ipFaceCoords[1](2,6) = 0;
|
|
||||||
//
|
|
||||||
ipFaceCoords[1](0,2) = 1; ipFaceCoords[1](0,7) = 1;
|
|
||||||
ipFaceCoords[1](1,2) = a; ipFaceCoords[1](1,7) = a;
|
|
||||||
ipFaceCoords[1](2,2) = a; ipFaceCoords[1](2,7) = 0;
|
|
||||||
//
|
|
||||||
ipFaceCoords[1](0,3) = 1; ipFaceCoords[1](0,8) = 1;
|
|
||||||
ipFaceCoords[1](1,3) = -a; ipFaceCoords[1](1,8) = 0;
|
|
||||||
ipFaceCoords[1](2,3) = a; ipFaceCoords[1](2,8) = 0;
|
|
||||||
//
|
//
|
||||||
ipFaceCoords[1](0,4) = 1;
|
ipFaceCoords[1](0,1) = 1; ipFaceCoords[1](0,6) = 1;
|
||||||
ipFaceCoords[1](1,4) = 0;
|
ipFaceCoords[1](1,1) = a; ipFaceCoords[1](1,6) = -a;
|
||||||
ipFaceCoords[1](2,4) = -a;
|
ipFaceCoords[1](2,1) = -a; ipFaceCoords[1](2,6) = 0;
|
||||||
|
//
|
||||||
ipFaceCoords[2](0,0) = -a; ipFaceCoords[2](0,5) = 0;
|
ipFaceCoords[1](0,2) = 1; ipFaceCoords[1](0,7) = 1;
|
||||||
ipFaceCoords[2](1,0) = -1; ipFaceCoords[2](1,5) = -1;
|
ipFaceCoords[1](1,2) = a; ipFaceCoords[1](1,7) = a;
|
||||||
|
ipFaceCoords[1](2,2) = a; ipFaceCoords[1](2,7) = 0;
|
||||||
|
//
|
||||||
|
ipFaceCoords[1](0,3) = 1; ipFaceCoords[1](0,8) = 1;
|
||||||
|
ipFaceCoords[1](1,3) = -a; ipFaceCoords[1](1,8) = 0;
|
||||||
|
ipFaceCoords[1](2,3) = a; ipFaceCoords[1](2,8) = 0;
|
||||||
|
//
|
||||||
|
ipFaceCoords[1](0,4) = 1;
|
||||||
|
ipFaceCoords[1](1,4) = 0;
|
||||||
|
ipFaceCoords[1](2,4) = -a;
|
||||||
|
|
||||||
|
ipFaceCoords[2](0,0) = -a; ipFaceCoords[2](0,5) = 0;
|
||||||
|
ipFaceCoords[2](1,0) = -1; ipFaceCoords[2](1,5) = -1;
|
||||||
ipFaceCoords[2](2,0) = -a; ipFaceCoords[2](2,5) = a;
|
ipFaceCoords[2](2,0) = -a; ipFaceCoords[2](2,5) = a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,1) = -a; ipFaceCoords[2](0,6) = -a;
|
ipFaceCoords[2](0,1) = -a; ipFaceCoords[2](0,6) = -a;
|
||||||
ipFaceCoords[2](1,1) = -1; ipFaceCoords[2](1,6) = -1;
|
ipFaceCoords[2](1,1) = -1; ipFaceCoords[2](1,6) = -1;
|
||||||
ipFaceCoords[2](2,1) = a; ipFaceCoords[2](2,6) = 0;
|
ipFaceCoords[2](2,1) = a; ipFaceCoords[2](2,6) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,2) = a; ipFaceCoords[2](0,7) = a;
|
ipFaceCoords[2](0,2) = a; ipFaceCoords[2](0,7) = a;
|
||||||
ipFaceCoords[2](1,2) = -1; ipFaceCoords[2](1,7) = -1;
|
ipFaceCoords[2](1,2) = -1; ipFaceCoords[2](1,7) = -1;
|
||||||
ipFaceCoords[2](2,2) = a; ipFaceCoords[2](2,7) = 0;
|
ipFaceCoords[2](2,2) = a; ipFaceCoords[2](2,7) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,3) = a; ipFaceCoords[2](0,8) = 0;
|
ipFaceCoords[2](0,3) = a; ipFaceCoords[2](0,8) = 0;
|
||||||
ipFaceCoords[2](1,3) = -1; ipFaceCoords[2](1,8) = -1;
|
ipFaceCoords[2](1,3) = -1; ipFaceCoords[2](1,8) = -1;
|
||||||
ipFaceCoords[2](2,3) = -a; ipFaceCoords[2](2,8) = 0;
|
ipFaceCoords[2](2,3) = -a; ipFaceCoords[2](2,8) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[2](0,4) = 0;
|
ipFaceCoords[2](0,4) = 0;
|
||||||
ipFaceCoords[2](1,4) = -1;
|
ipFaceCoords[2](1,4) = -1;
|
||||||
ipFaceCoords[2](2,4) = -a;
|
ipFaceCoords[2](2,4) = -a;
|
||||||
|
|
||||||
ipFaceCoords[3](0,0) = -a; ipFaceCoords[3](0,5) = 0;
|
ipFaceCoords[3](0,0) = -a; ipFaceCoords[3](0,5) = 0;
|
||||||
ipFaceCoords[3](1,0) = 1; ipFaceCoords[3](1,5) = 1;
|
ipFaceCoords[3](1,0) = 1; ipFaceCoords[3](1,5) = 1;
|
||||||
ipFaceCoords[3](2,0) = -a; ipFaceCoords[3](2,5) = a;
|
ipFaceCoords[3](2,0) = -a; ipFaceCoords[3](2,5) = a;
|
||||||
//
|
//
|
||||||
ipFaceCoords[3](0,1) = -a; ipFaceCoords[3](0,6) = -a;
|
ipFaceCoords[3](0,1) = -a; ipFaceCoords[3](0,6) = -a;
|
||||||
ipFaceCoords[3](1,1) = 1; ipFaceCoords[3](1,6) = 1;
|
ipFaceCoords[3](1,1) = 1; ipFaceCoords[3](1,6) = 1;
|
||||||
ipFaceCoords[3](2,1) = a; ipFaceCoords[3](2,6) = 0;
|
ipFaceCoords[3](2,1) = a; ipFaceCoords[3](2,6) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[3](0,2) = a; ipFaceCoords[3](0,7) = a;
|
ipFaceCoords[3](0,2) = a; ipFaceCoords[3](0,7) = a;
|
||||||
ipFaceCoords[3](1,2) = 1; ipFaceCoords[3](1,7) = 1;
|
ipFaceCoords[3](1,2) = 1; ipFaceCoords[3](1,7) = 1;
|
||||||
ipFaceCoords[3](2,2) = a; ipFaceCoords[3](2,7) = 0;
|
ipFaceCoords[3](2,2) = a; ipFaceCoords[3](2,7) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[3](0,3) = a; ipFaceCoords[3](0,8) = 0;
|
ipFaceCoords[3](0,3) = a; ipFaceCoords[3](0,8) = 0;
|
||||||
ipFaceCoords[3](1,3) = 1; ipFaceCoords[3](1,8) = 1;
|
ipFaceCoords[3](1,3) = 1; ipFaceCoords[3](1,8) = 1;
|
||||||
ipFaceCoords[3](2,3) = -a; ipFaceCoords[3](2,8) = 0;
|
ipFaceCoords[3](2,3) = -a; ipFaceCoords[3](2,8) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[3](0,4) = 0;
|
ipFaceCoords[3](0,4) = 0;
|
||||||
ipFaceCoords[3](1,4) = 1;
|
ipFaceCoords[3](1,4) = 1;
|
||||||
ipFaceCoords[3](2,4) = -a;
|
ipFaceCoords[3](2,4) = -a;
|
||||||
|
|
||||||
ipFaceCoords[4](0,0) = -a; ipFaceCoords[4](0,5) = 0;
|
ipFaceCoords[4](0,0) = -a; ipFaceCoords[4](0,5) = 0;
|
||||||
ipFaceCoords[4](1,0) = -a; ipFaceCoords[4](1,5) = a;
|
ipFaceCoords[4](1,0) = -a; ipFaceCoords[4](1,5) = a;
|
||||||
ipFaceCoords[4](2,0) = -1; ipFaceCoords[4](2,5) = -1;
|
ipFaceCoords[4](2,0) = -1; ipFaceCoords[4](2,5) = -1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[4](0,1) = a; ipFaceCoords[4](0,6) = -a;
|
ipFaceCoords[4](0,1) = a; ipFaceCoords[4](0,6) = -a;
|
||||||
ipFaceCoords[4](1,1) = -a; ipFaceCoords[4](1,6) = 0;
|
ipFaceCoords[4](1,1) = -a; ipFaceCoords[4](1,6) = 0;
|
||||||
ipFaceCoords[4](2,1) = -1; ipFaceCoords[4](2,6) = -1;
|
ipFaceCoords[4](2,1) = -1; ipFaceCoords[4](2,6) = -1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[4](0,2) = a; ipFaceCoords[4](0,7) = a;
|
ipFaceCoords[4](0,2) = a; ipFaceCoords[4](0,7) = a;
|
||||||
ipFaceCoords[4](1,2) = a; ipFaceCoords[4](1,7) = 0;
|
ipFaceCoords[4](1,2) = a; ipFaceCoords[4](1,7) = 0;
|
||||||
ipFaceCoords[4](2,2) = -1; ipFaceCoords[4](2,7) = -1;
|
ipFaceCoords[4](2,2) = -1; ipFaceCoords[4](2,7) = -1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[4](0,3) = -a; ipFaceCoords[4](0,8) = 0;
|
ipFaceCoords[4](0,3) = -a; ipFaceCoords[4](0,8) = 0;
|
||||||
ipFaceCoords[4](1,3) = a; ipFaceCoords[4](1,8) = 0;
|
ipFaceCoords[4](1,3) = a; ipFaceCoords[4](1,8) = 0;
|
||||||
ipFaceCoords[4](2,3) = -1; ipFaceCoords[4](2,8) = -1;
|
ipFaceCoords[4](2,3) = -1; ipFaceCoords[4](2,8) = -1;
|
||||||
|
@ -445,19 +445,19 @@ namespace ATC {
|
||||||
ipFaceCoords[4](0,4) = 0;
|
ipFaceCoords[4](0,4) = 0;
|
||||||
ipFaceCoords[4](1,4) = -a;
|
ipFaceCoords[4](1,4) = -a;
|
||||||
ipFaceCoords[4](2,4) = -1;
|
ipFaceCoords[4](2,4) = -1;
|
||||||
|
|
||||||
ipFaceCoords[5](0,0) = -a; ipFaceCoords[5](0,5) = 0;
|
ipFaceCoords[5](0,0) = -a; ipFaceCoords[5](0,5) = 0;
|
||||||
ipFaceCoords[5](1,0) = -a; ipFaceCoords[5](1,5) = a;
|
ipFaceCoords[5](1,0) = -a; ipFaceCoords[5](1,5) = a;
|
||||||
ipFaceCoords[5](2,0) = 1; ipFaceCoords[5](2,5) = 1;
|
ipFaceCoords[5](2,0) = 1; ipFaceCoords[5](2,5) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[5](0,1) = a; ipFaceCoords[5](0,6) = -a;
|
ipFaceCoords[5](0,1) = a; ipFaceCoords[5](0,6) = -a;
|
||||||
ipFaceCoords[5](1,1) = -a; ipFaceCoords[5](1,6) = 0;
|
ipFaceCoords[5](1,1) = -a; ipFaceCoords[5](1,6) = 0;
|
||||||
ipFaceCoords[5](2,1) = 1; ipFaceCoords[5](2,6) = 1;
|
ipFaceCoords[5](2,1) = 1; ipFaceCoords[5](2,6) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[5](0,2) = a; ipFaceCoords[5](0,7) = a;
|
ipFaceCoords[5](0,2) = a; ipFaceCoords[5](0,7) = a;
|
||||||
ipFaceCoords[5](1,2) = a; ipFaceCoords[5](1,7) = 0;
|
ipFaceCoords[5](1,2) = a; ipFaceCoords[5](1,7) = 0;
|
||||||
ipFaceCoords[5](2,2) = 1; ipFaceCoords[5](2,7) = 1;
|
ipFaceCoords[5](2,2) = 1; ipFaceCoords[5](2,7) = 1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[5](0,3) = -a; ipFaceCoords[5](0,8) = 0;
|
ipFaceCoords[5](0,3) = -a; ipFaceCoords[5](0,8) = 0;
|
||||||
ipFaceCoords[5](1,3) = a; ipFaceCoords[5](1,8) = 0;
|
ipFaceCoords[5](1,3) = a; ipFaceCoords[5](1,8) = 0;
|
||||||
ipFaceCoords[5](2,3) = 1; ipFaceCoords[5](2,8) = 1;
|
ipFaceCoords[5](2,3) = 1; ipFaceCoords[5](2,8) = 1;
|
||||||
|
@ -465,23 +465,23 @@ namespace ATC {
|
||||||
ipFaceCoords[5](0,4) = 0;
|
ipFaceCoords[5](0,4) = 0;
|
||||||
ipFaceCoords[5](1,4) = -a;
|
ipFaceCoords[5](1,4) = -a;
|
||||||
ipFaceCoords[5](2,4) = 1;
|
ipFaceCoords[5](2,4) = 1;
|
||||||
|
|
||||||
// Integration points for all faces ignoring the
|
// Integration points for all faces ignoring the
|
||||||
// redundant dim
|
// redundant dim
|
||||||
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,5) = 0;
|
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,5) = 0;
|
||||||
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,5) = a;
|
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,5) = a;
|
||||||
//
|
|
||||||
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,6) = -a;
|
|
||||||
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,6) = 0;
|
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,2) = a; ipFace2DCoords(0,7) = a;
|
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,6) = -a;
|
||||||
ipFace2DCoords(1,2) = a; ipFace2DCoords(1,7) = 0;
|
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,6) = 0;
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,3) = -a; ipFace2DCoords(0,8) = 0;
|
ipFace2DCoords(0,2) = a; ipFace2DCoords(0,7) = a;
|
||||||
ipFace2DCoords(1,3) = a; ipFace2DCoords(1,8) = 0;
|
ipFace2DCoords(1,2) = a; ipFace2DCoords(1,7) = 0;
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,4) = 0;
|
ipFace2DCoords(0,3) = -a; ipFace2DCoords(0,8) = 0;
|
||||||
ipFace2DCoords(1,4) = -a;
|
ipFace2DCoords(1,3) = a; ipFace2DCoords(1,8) = 0;
|
||||||
|
//
|
||||||
|
ipFace2DCoords(0,4) = 0;
|
||||||
|
ipFace2DCoords(1,4) = -a;
|
||||||
|
|
||||||
// Integration point weights
|
// Integration point weights
|
||||||
for (int i=0; i<numIPs; ++i) {
|
for (int i=0; i<numIPs; ++i) {
|
||||||
|
@ -534,59 +534,59 @@ namespace ATC {
|
||||||
a1 = 1;
|
a1 = 1;
|
||||||
a2 = 0;
|
a2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Integration point coordinates
|
// Integration point coordinates
|
||||||
ipCoords.resize(4, numIPs);
|
ipCoords.resize(4, numIPs);
|
||||||
ipCoords(0,0) = v2; ipCoords(0,2) = v2;
|
ipCoords(0,0) = v2; ipCoords(0,2) = v2;
|
||||||
ipCoords(1,0) = v2; ipCoords(1,2) = v1;
|
ipCoords(1,0) = v2; ipCoords(1,2) = v1;
|
||||||
ipCoords(2,0) = v2; ipCoords(2,2) = v2;
|
ipCoords(2,0) = v2; ipCoords(2,2) = v2;
|
||||||
ipCoords(3,0) = v1; ipCoords(3,2) = v2;
|
ipCoords(3,0) = v1; ipCoords(3,2) = v2;
|
||||||
//
|
//
|
||||||
ipCoords(0,1) = v1; ipCoords(0,3) = v2;
|
ipCoords(0,1) = v1; ipCoords(0,3) = v2;
|
||||||
ipCoords(1,1) = v2; ipCoords(1,3) = v2;
|
ipCoords(1,1) = v2; ipCoords(1,3) = v2;
|
||||||
ipCoords(2,1) = v2; ipCoords(2,3) = v1;
|
ipCoords(2,1) = v2; ipCoords(2,3) = v1;
|
||||||
ipCoords(3,1) = v2; ipCoords(3,3) = v2;
|
ipCoords(3,1) = v2; ipCoords(3,3) = v2;
|
||||||
|
|
||||||
// Integration points by face
|
// Integration points by face
|
||||||
|
|
||||||
// ...face 0 ...face 2
|
// ...face 0 ...face 2
|
||||||
ipFaceCoords[0](0,0) = a1; ipFaceCoords[2](0,0) = a2;
|
ipFaceCoords[0](0,0) = a1; ipFaceCoords[2](0,0) = a2;
|
||||||
ipFaceCoords[0](1,0) = a2; ipFaceCoords[2](1,0) = 0;
|
ipFaceCoords[0](1,0) = a2; ipFaceCoords[2](1,0) = 0;
|
||||||
ipFaceCoords[0](2,0) = a2; ipFaceCoords[2](2,0) = a2;
|
ipFaceCoords[0](2,0) = a2; ipFaceCoords[2](2,0) = a2;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,1) = a2; ipFaceCoords[2](0,1) = a1;
|
ipFaceCoords[0](0,1) = a2; ipFaceCoords[2](0,1) = a1;
|
||||||
ipFaceCoords[0](1,1) = a1; ipFaceCoords[2](1,1) = 0;
|
ipFaceCoords[0](1,1) = a1; ipFaceCoords[2](1,1) = 0;
|
||||||
ipFaceCoords[0](2,1) = a2; ipFaceCoords[2](2,1) = a2;
|
ipFaceCoords[0](2,1) = a2; ipFaceCoords[2](2,1) = a2;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,2) = a2; ipFaceCoords[2](0,2) = a2;
|
ipFaceCoords[0](0,2) = a2; ipFaceCoords[2](0,2) = a2;
|
||||||
ipFaceCoords[0](1,2) = a2; ipFaceCoords[2](1,2) = 0;
|
ipFaceCoords[0](1,2) = a2; ipFaceCoords[2](1,2) = 0;
|
||||||
ipFaceCoords[0](2,2) = a1; ipFaceCoords[2](2,2) = a1;
|
ipFaceCoords[0](2,2) = a1; ipFaceCoords[2](2,2) = a1;
|
||||||
|
|
||||||
// ...face 1 ...face 3
|
// ...face 1 ...face 3
|
||||||
ipFaceCoords[1](0,0) = 0; ipFaceCoords[3](0,0) = a2;
|
ipFaceCoords[1](0,0) = 0; ipFaceCoords[3](0,0) = a2;
|
||||||
ipFaceCoords[1](1,0) = a1; ipFaceCoords[3](1,0) = a2;
|
ipFaceCoords[1](1,0) = a1; ipFaceCoords[3](1,0) = a2;
|
||||||
ipFaceCoords[1](2,0) = a2; ipFaceCoords[3](2,0) = 0;
|
ipFaceCoords[1](2,0) = a2; ipFaceCoords[3](2,0) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[1](0,1) = 0; ipFaceCoords[3](0,1) = a2;
|
ipFaceCoords[1](0,1) = 0; ipFaceCoords[3](0,1) = a2;
|
||||||
ipFaceCoords[1](1,1) = a2; ipFaceCoords[3](1,1) = a1;
|
ipFaceCoords[1](1,1) = a2; ipFaceCoords[3](1,1) = a1;
|
||||||
ipFaceCoords[1](2,1) = a2; ipFaceCoords[3](2,1) = 0;
|
ipFaceCoords[1](2,1) = a2; ipFaceCoords[3](2,1) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[1](0,2) = 0; ipFaceCoords[3](0,2) = a1;
|
ipFaceCoords[1](0,2) = 0; ipFaceCoords[3](0,2) = a1;
|
||||||
ipFaceCoords[1](1,2) = a2; ipFaceCoords[3](1,2) = a2;
|
ipFaceCoords[1](1,2) = a2; ipFaceCoords[3](1,2) = a2;
|
||||||
ipFaceCoords[1](2,2) = a1; ipFaceCoords[3](2,2) = 0;
|
ipFaceCoords[1](2,2) = a1; ipFaceCoords[3](2,2) = 0;
|
||||||
|
|
||||||
// 2D integration points for faces
|
// 2D integration points for faces
|
||||||
ipFace2DCoords(0,0) = a2; ipFace2DCoords(0,2) = a2;
|
ipFace2DCoords(0,0) = a2; ipFace2DCoords(0,2) = a2;
|
||||||
ipFace2DCoords(1,0) = a2; ipFace2DCoords(1,2) = a1;
|
ipFace2DCoords(1,0) = a2; ipFace2DCoords(1,2) = a1;
|
||||||
ipFace2DCoords(2,0) = a1; ipFace2DCoords(2,2) = a2;
|
ipFace2DCoords(2,0) = a1; ipFace2DCoords(2,2) = a2;
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,1) = a1;
|
ipFace2DCoords(0,1) = a1;
|
||||||
ipFace2DCoords(1,1) = a2;
|
ipFace2DCoords(1,1) = a2;
|
||||||
ipFace2DCoords(2,1) = a2;
|
ipFace2DCoords(2,1) = a2;
|
||||||
|
|
||||||
// Integration point weights
|
// Integration point weights
|
||||||
ipWeights = (1.0/6.0)/numIPs;
|
ipWeights = (1.0/6.0)/numIPs;
|
||||||
|
|
||||||
// Integration point face weights
|
// Integration point face weights
|
||||||
ipFaceWeights = (1.0/2.0)/numFaceIPs;
|
ipFaceWeights = (1.0/2.0)/numFaceIPs;
|
||||||
|
|
||||||
|
@ -605,11 +605,11 @@ namespace ATC {
|
||||||
ipFaceWeights.reset(numFaceIPs);
|
ipFaceWeights.reset(numFaceIPs);
|
||||||
|
|
||||||
double v1, v2, v3, a1, a2, a3;
|
double v1, v2, v3, a1, a2, a3;
|
||||||
/* These weights for calculating Gaussian Quadrature
|
/* These weights for calculating Gaussian Quadrature
|
||||||
* points are taken from the paper "Integration Points
|
* points are taken from the paper "Integration Points
|
||||||
* for Triangles and Tetrahedra Obtained from the
|
* for Triangles and Tetrahedra Obtained from the
|
||||||
* Gaussian Quadrature Points for a Line" by K. S. Sunder
|
* Gaussian Quadrature Points for a Line" by K. S. Sunder
|
||||||
* and R. A. Cookson, Computers and Structures, Vol 21,
|
* and R. A. Cookson, Computers and Structures, Vol 21,
|
||||||
* No. 5, 1985. */
|
* No. 5, 1985. */
|
||||||
v1 = 1.0/4.0;
|
v1 = 1.0/4.0;
|
||||||
v2 = 1.0/2.0;
|
v2 = 1.0/2.0;
|
||||||
|
@ -617,7 +617,7 @@ namespace ATC {
|
||||||
a1 = 1.0/3.0;
|
a1 = 1.0/3.0;
|
||||||
a2 = 3.0/5.0;
|
a2 = 3.0/5.0;
|
||||||
a3 = 1.0/5.0;
|
a3 = 1.0/5.0;
|
||||||
|
|
||||||
// Integration point coordinates
|
// Integration point coordinates
|
||||||
ipCoords.resize(4, numIPs);
|
ipCoords.resize(4, numIPs);
|
||||||
ipCoords(0,0) = v1;
|
ipCoords(0,0) = v1;
|
||||||
|
@ -625,61 +625,61 @@ namespace ATC {
|
||||||
ipCoords(2,0) = v1;
|
ipCoords(2,0) = v1;
|
||||||
ipCoords(3,0) = v1;
|
ipCoords(3,0) = v1;
|
||||||
//
|
//
|
||||||
ipCoords(0,1) = v3; ipCoords(0,3) = v3;
|
ipCoords(0,1) = v3; ipCoords(0,3) = v3;
|
||||||
ipCoords(1,1) = v3; ipCoords(1,3) = v2;
|
ipCoords(1,1) = v3; ipCoords(1,3) = v2;
|
||||||
ipCoords(2,1) = v3; ipCoords(2,3) = v3;
|
ipCoords(2,1) = v3; ipCoords(2,3) = v3;
|
||||||
ipCoords(3,1) = v2; ipCoords(3,3) = v3;
|
ipCoords(3,1) = v2; ipCoords(3,3) = v3;
|
||||||
//
|
//
|
||||||
ipCoords(0,2) = v2; ipCoords(0,4) = v3;
|
ipCoords(0,2) = v2; ipCoords(0,4) = v3;
|
||||||
ipCoords(1,2) = v3; ipCoords(1,4) = v3;
|
ipCoords(1,2) = v3; ipCoords(1,4) = v3;
|
||||||
ipCoords(2,2) = v3; ipCoords(2,4) = v2;
|
ipCoords(2,2) = v3; ipCoords(2,4) = v2;
|
||||||
ipCoords(3,2) = v3; ipCoords(3,4) = v3;
|
ipCoords(3,2) = v3; ipCoords(3,4) = v3;
|
||||||
|
|
||||||
// Integration points by face
|
// Integration points by face
|
||||||
|
|
||||||
// ...face 0 ...face 2
|
// ...face 0 ...face 2
|
||||||
ipFaceCoords[0](0,0) = a1; ipFaceCoords[2](0,0) = a1;
|
ipFaceCoords[0](0,0) = a1; ipFaceCoords[2](0,0) = a1;
|
||||||
ipFaceCoords[0](1,0) = a1; ipFaceCoords[2](1,0) = 0;
|
ipFaceCoords[0](1,0) = a1; ipFaceCoords[2](1,0) = 0;
|
||||||
ipFaceCoords[0](2,0) = a1; ipFaceCoords[2](2,0) = a1;
|
ipFaceCoords[0](2,0) = a1; ipFaceCoords[2](2,0) = a1;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,1) = a2; ipFaceCoords[2](0,1) = a3;
|
ipFaceCoords[0](0,1) = a2; ipFaceCoords[2](0,1) = a3;
|
||||||
ipFaceCoords[0](1,1) = a3; ipFaceCoords[2](1,1) = 0;
|
ipFaceCoords[0](1,1) = a3; ipFaceCoords[2](1,1) = 0;
|
||||||
ipFaceCoords[0](2,1) = a3; ipFaceCoords[2](2,1) = a3;
|
ipFaceCoords[0](2,1) = a3; ipFaceCoords[2](2,1) = a3;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,2) = a3; ipFaceCoords[2](0,2) = a2;
|
ipFaceCoords[0](0,2) = a3; ipFaceCoords[2](0,2) = a2;
|
||||||
ipFaceCoords[0](1,2) = a2; ipFaceCoords[2](1,2) = 0;
|
ipFaceCoords[0](1,2) = a2; ipFaceCoords[2](1,2) = 0;
|
||||||
ipFaceCoords[0](2,2) = a3; ipFaceCoords[2](2,2) = a3;
|
ipFaceCoords[0](2,2) = a3; ipFaceCoords[2](2,2) = a3;
|
||||||
//
|
//
|
||||||
ipFaceCoords[0](0,3) = a3; ipFaceCoords[2](0,3) = a3;
|
ipFaceCoords[0](0,3) = a3; ipFaceCoords[2](0,3) = a3;
|
||||||
ipFaceCoords[0](1,3) = a3; ipFaceCoords[2](1,3) = 0;
|
ipFaceCoords[0](1,3) = a3; ipFaceCoords[2](1,3) = 0;
|
||||||
ipFaceCoords[0](2,3) = a2; ipFaceCoords[2](2,3) = a2;
|
ipFaceCoords[0](2,3) = a2; ipFaceCoords[2](2,3) = a2;
|
||||||
|
|
||||||
// ...face 1 ...face 3
|
// ...face 1 ...face 3
|
||||||
ipFaceCoords[1](0,0) = 0; ipFaceCoords[3](0,0) = a1;
|
ipFaceCoords[1](0,0) = 0; ipFaceCoords[3](0,0) = a1;
|
||||||
ipFaceCoords[1](1,0) = a1; ipFaceCoords[3](1,0) = a1;
|
ipFaceCoords[1](1,0) = a1; ipFaceCoords[3](1,0) = a1;
|
||||||
ipFaceCoords[1](2,0) = a1; ipFaceCoords[3](2,0) = 0;
|
ipFaceCoords[1](2,0) = a1; ipFaceCoords[3](2,0) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[1](0,1) = 0; ipFaceCoords[3](0,1) = a3;
|
ipFaceCoords[1](0,1) = 0; ipFaceCoords[3](0,1) = a3;
|
||||||
ipFaceCoords[1](1,1) = a2; ipFaceCoords[3](1,1) = a3;
|
ipFaceCoords[1](1,1) = a2; ipFaceCoords[3](1,1) = a3;
|
||||||
ipFaceCoords[1](2,1) = a3; ipFaceCoords[3](2,1) = 0;
|
ipFaceCoords[1](2,1) = a3; ipFaceCoords[3](2,1) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[1](0,2) = 0; ipFaceCoords[3](0,2) = a3;
|
ipFaceCoords[1](0,2) = 0; ipFaceCoords[3](0,2) = a3;
|
||||||
ipFaceCoords[1](1,2) = a3; ipFaceCoords[3](1,2) = a2;
|
ipFaceCoords[1](1,2) = a3; ipFaceCoords[3](1,2) = a2;
|
||||||
ipFaceCoords[1](2,2) = a3; ipFaceCoords[3](2,2) = 0;
|
ipFaceCoords[1](2,2) = a3; ipFaceCoords[3](2,2) = 0;
|
||||||
//
|
//
|
||||||
ipFaceCoords[1](0,3) = 0; ipFaceCoords[3](0,3) = a2;
|
ipFaceCoords[1](0,3) = 0; ipFaceCoords[3](0,3) = a2;
|
||||||
ipFaceCoords[1](1,3) = a3; ipFaceCoords[3](1,3) = a3;
|
ipFaceCoords[1](1,3) = a3; ipFaceCoords[3](1,3) = a3;
|
||||||
ipFaceCoords[1](2,3) = a2; ipFaceCoords[3](2,3) = 0;
|
ipFaceCoords[1](2,3) = a2; ipFaceCoords[3](2,3) = 0;
|
||||||
|
|
||||||
// 2D integration points for faces
|
// 2D integration points for faces
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,0) = a1; ipFace2DCoords(0,2) = a2;
|
ipFace2DCoords(0,0) = a1; ipFace2DCoords(0,2) = a2;
|
||||||
ipFace2DCoords(1,0) = a1; ipFace2DCoords(1,2) = a3;
|
ipFace2DCoords(1,0) = a1; ipFace2DCoords(1,2) = a3;
|
||||||
ipFace2DCoords(2,0) = a1; ipFace2DCoords(2,2) = a3;
|
ipFace2DCoords(2,0) = a1; ipFace2DCoords(2,2) = a3;
|
||||||
//
|
//
|
||||||
ipFace2DCoords(0,1) = a3; ipFace2DCoords(0,3) = a3;
|
ipFace2DCoords(0,1) = a3; ipFace2DCoords(0,3) = a3;
|
||||||
ipFace2DCoords(1,1) = a3; ipFace2DCoords(1,3) = a2;
|
ipFace2DCoords(1,1) = a3; ipFace2DCoords(1,3) = a2;
|
||||||
ipFace2DCoords(2,1) = a2; ipFace2DCoords(2,3) = a3;
|
ipFace2DCoords(2,1) = a2; ipFace2DCoords(2,3) = a3;
|
||||||
|
|
||||||
for (int i=0; i<numIPs; ++i) {
|
for (int i=0; i<numIPs; ++i) {
|
||||||
if (i < 1) ipWeights[i] = -4.0/5.0;
|
if (i < 1) ipWeights[i] = -4.0/5.0;
|
||||||
|
|
|
@ -16,10 +16,10 @@ namespace ATC {
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
FieldEulerIntegrator::FieldEulerIntegrator(
|
FieldEulerIntegrator::FieldEulerIntegrator(
|
||||||
const FieldName fieldName,
|
const FieldName fieldName,
|
||||||
const PhysicsModel * physicsModel,
|
const PhysicsModel * physicsModel,
|
||||||
/*const*/ FE_Engine * feEngine,
|
/*const*/ FE_Engine * feEngine,
|
||||||
/*const*/ ATC_Coupling * atc,
|
/*const*/ ATC_Coupling * atc,
|
||||||
const Array2D< bool > & rhsMask // copy
|
const Array2D< bool > & rhsMask // copy
|
||||||
)
|
)
|
||||||
: atc_(atc),
|
: atc_(atc),
|
||||||
feEngine_(feEngine),
|
feEngine_(feEngine),
|
||||||
|
@ -35,20 +35,20 @@ FieldEulerIntegrator::FieldEulerIntegrator(
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
FieldExplicitEulerIntegrator::FieldExplicitEulerIntegrator(
|
FieldExplicitEulerIntegrator::FieldExplicitEulerIntegrator(
|
||||||
const FieldName fieldName,
|
const FieldName fieldName,
|
||||||
const PhysicsModel * physicsModel,
|
const PhysicsModel * physicsModel,
|
||||||
/*const*/ FE_Engine * feEngine,
|
/*const*/ FE_Engine * feEngine,
|
||||||
/*const*/ ATC_Coupling * atc,
|
/*const*/ ATC_Coupling * atc,
|
||||||
const Array2D< bool > & rhsMask // copy
|
const Array2D< bool > & rhsMask // copy
|
||||||
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask)
|
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// update
|
// update
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
void FieldExplicitEulerIntegrator::update(const double dt, double /* time */,
|
void FieldExplicitEulerIntegrator::update(const double dt, double /* time */,
|
||||||
FIELDS & fields, FIELDS & rhs)
|
FIELDS & fields, FIELDS & rhs)
|
||||||
{
|
{
|
||||||
// write and add update mass matrix to handled time variation
|
// write and add update mass matrix to handled time variation
|
||||||
// update mass matrix to be consistent/lumped, and handle this in apply_inverse_mass_matrix
|
// update mass matrix to be consistent/lumped, and handle this in apply_inverse_mass_matrix
|
||||||
atc_->compute_rhs_vector(rhsMask_, fields, rhs,
|
atc_->compute_rhs_vector(rhsMask_, fields, rhs,
|
||||||
|
@ -63,14 +63,14 @@ FieldExplicitEulerIntegrator::FieldExplicitEulerIntegrator(
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
FieldImplicitEulerIntegrator::FieldImplicitEulerIntegrator(
|
FieldImplicitEulerIntegrator::FieldImplicitEulerIntegrator(
|
||||||
const FieldName fieldName,
|
const FieldName fieldName,
|
||||||
const PhysicsModel * physicsModel,
|
const PhysicsModel * physicsModel,
|
||||||
/*const*/ FE_Engine * feEngine,
|
/*const*/ FE_Engine * feEngine,
|
||||||
/*const*/ ATC_Coupling * atc,
|
/*const*/ ATC_Coupling * atc,
|
||||||
const Array2D< bool > & rhsMask, // copy
|
const Array2D< bool > & rhsMask, // copy
|
||||||
const double alpha
|
const double alpha
|
||||||
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
|
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
|
||||||
alpha_(alpha),
|
alpha_(alpha),
|
||||||
dT_(1.0e-6),
|
dT_(1.0e-6),
|
||||||
maxRestarts_(50),
|
maxRestarts_(50),
|
||||||
maxIterations_(1000),
|
maxIterations_(1000),
|
||||||
tol_(1.0e-8)
|
tol_(1.0e-8)
|
||||||
|
@ -78,17 +78,17 @@ FieldImplicitEulerIntegrator::FieldImplicitEulerIntegrator(
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// update
|
// update
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
void FieldImplicitEulerIntegrator::update(const double dt, double time,
|
void FieldImplicitEulerIntegrator::update(const double dt, double time,
|
||||||
FIELDS & fields, FIELDS & /* rhs */)
|
FIELDS & fields, FIELDS & /* rhs */)
|
||||||
{ // solver handles bcs
|
{ // solver handles bcs
|
||||||
FieldImplicitSolveOperator solver(atc_,
|
FieldImplicitSolveOperator solver(atc_,
|
||||||
fields, fieldName_, rhsMask_, physicsModel_,
|
fields, fieldName_, rhsMask_, physicsModel_,
|
||||||
time, dt, alpha_);
|
time, dt, alpha_);
|
||||||
DiagonalMatrix<double> preconditioner = solver.preconditioner();
|
DiagonalMatrix<double> preconditioner = solver.preconditioner();
|
||||||
DENS_VEC rT = solver.r();
|
DENS_VEC rT = solver.r();
|
||||||
DENS_VEC dT(nNodes_); dT = dT_;
|
DENS_VEC dT(nNodes_); dT = dT_;
|
||||||
DENS_MAT H(maxRestarts_+1, maxRestarts_);
|
DENS_MAT H(maxRestarts_+1, maxRestarts_);
|
||||||
double tol = tol_; // tol returns the residual
|
double tol = tol_; // tol returns the residual
|
||||||
int iterations = maxIterations_; // iterations returns number of iterations
|
int iterations = maxIterations_; // iterations returns number of iterations
|
||||||
|
@ -106,10 +106,10 @@ void FieldImplicitEulerIntegrator::update(const double dt, double time,
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator(
|
FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator(
|
||||||
const FieldName fieldName,
|
const FieldName fieldName,
|
||||||
const PhysicsModel * physicsModel,
|
const PhysicsModel * physicsModel,
|
||||||
/*const*/ FE_Engine * feEngine,
|
/*const*/ FE_Engine * feEngine,
|
||||||
/*const*/ ATC_Coupling * atc,
|
/*const*/ ATC_Coupling * atc,
|
||||||
const Array2D< bool > & rhsMask, // copy
|
const Array2D< bool > & rhsMask, // copy
|
||||||
const double alpha
|
const double alpha
|
||||||
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
|
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
|
||||||
alpha_(alpha),solver_(nullptr)
|
alpha_(alpha),solver_(nullptr)
|
||||||
|
@ -125,24 +125,24 @@ FieldImplicitDirectEulerIntegrator::~FieldImplicitDirectEulerIntegrator()
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// initialize
|
// initialize
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
void FieldImplicitDirectEulerIntegrator::initialize(const double dt, double /* time */,
|
void FieldImplicitDirectEulerIntegrator::initialize(const double dt, double /* time */,
|
||||||
FIELDS & /* fields */)
|
FIELDS & /* fields */)
|
||||||
{
|
{
|
||||||
std::pair<FieldName,FieldName> p(fieldName_,fieldName_);
|
std::pair<FieldName,FieldName> p(fieldName_,fieldName_);
|
||||||
Array2D <bool> rmask = atc_->rhs_mask();
|
Array2D <bool> rmask = atc_->rhs_mask();
|
||||||
rmask(fieldName_,FLUX) = true;
|
rmask(fieldName_,FLUX) = true;
|
||||||
atc_->tangent_matrix(p,rmask,physicsModel_,_K_);
|
atc_->tangent_matrix(p,rmask,physicsModel_,_K_);
|
||||||
_lhsMK_ = (1./dt)*(_M_)- alpha_*(_K_);
|
_lhsMK_ = (1./dt)*(_M_)- alpha_*(_K_);
|
||||||
_rhsMK_ = (1./dt)*(_M_)+(1.+alpha_)*(_K_);
|
_rhsMK_ = (1./dt)*(_M_)+(1.+alpha_)*(_K_);
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
// update
|
// update
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
void FieldImplicitDirectEulerIntegrator::update(const double /* dt */, double /* time */,
|
void FieldImplicitDirectEulerIntegrator::update(const double /* dt */, double /* time */,
|
||||||
FIELDS & fields, FIELDS & rhs)
|
FIELDS & fields, FIELDS & rhs)
|
||||||
{
|
{
|
||||||
atc_->compute_rhs_vector(rhsMask_, fields, rhs,
|
atc_->compute_rhs_vector(rhsMask_, fields, rhs,
|
||||||
FULL_DOMAIN, physicsModel_);
|
FULL_DOMAIN, physicsModel_);
|
||||||
CLON_VEC myRhs = column( rhs[fieldName_].set_quantity(),0);
|
CLON_VEC myRhs = column( rhs[fieldName_].set_quantity(),0);
|
||||||
|
|
|
@ -60,7 +60,7 @@ class FieldEulerIntegrator {
|
||||||
const PhysicsModel * physicsModel_;
|
const PhysicsModel * physicsModel_;
|
||||||
|
|
||||||
/** field name */
|
/** field name */
|
||||||
FieldName fieldName_;
|
FieldName fieldName_;
|
||||||
|
|
||||||
/** rhs mask */
|
/** rhs mask */
|
||||||
Array2D <bool> rhsMask_;
|
Array2D <bool> rhsMask_;
|
||||||
|
|
|
@ -22,7 +22,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* restricted_atom_quantity
|
//* restricted_atom_quantity
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::restricted_atom_quantity(FieldName field, string name, PAQ * atomicQuantity)
|
DENS_MAN * FieldManager::restricted_atom_quantity(FieldName field, string name, PAQ * atomicQuantity)
|
||||||
{
|
{
|
||||||
if (name == "default") { name = field_to_restriction_name(field); }
|
if (name == "default") { name = field_to_restriction_name(field); }
|
||||||
DENS_MAN * quantity = interscaleManager_.dense_matrix(name);
|
DENS_MAN * quantity = interscaleManager_.dense_matrix(name);
|
||||||
|
@ -35,7 +35,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
atomicQuantity = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS);
|
atomicQuantity = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (!atomicQuantity) {
|
if (!atomicQuantity) {
|
||||||
throw ATC_Error("FieldManager::restricted_atom_quantity - need to supply PAQ if restricted quantity does not already exist");
|
throw ATC_Error("FieldManager::restricted_atom_quantity - need to supply PAQ if restricted quantity does not already exist");
|
||||||
}
|
}
|
||||||
|
@ -68,18 +68,18 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
|
|
||||||
if (atc_->kernel_on_the_fly()) {
|
if (atc_->kernel_on_the_fly()) {
|
||||||
if (atc_->kernel_based()) {
|
if (atc_->kernel_based()) {
|
||||||
quantity = new OnTheFlyKernelAccumulationNormalized(atc_, atomic,
|
quantity = new OnTheFlyKernelAccumulationNormalized(atc_, atomic,
|
||||||
atc_->kernel_function(),
|
atc_->kernel_function(),
|
||||||
atc_->atom_coarsegraining_positions(),
|
atc_->atom_coarsegraining_positions(),
|
||||||
normalization);
|
normalization);
|
||||||
} else {
|
} else {
|
||||||
quantity = new OnTheFlyMeshAccumulationNormalized(atc_, atomic,
|
quantity = new OnTheFlyMeshAccumulationNormalized(atc_, atomic,
|
||||||
atc_->atom_coarsegraining_positions(),
|
atc_->atom_coarsegraining_positions(),
|
||||||
normalization);
|
normalization);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
quantity = new AtfProjection(atc_, atomic,
|
quantity = new AtfProjection(atc_, atomic,
|
||||||
atc_->accumulant(),
|
atc_->accumulant(),
|
||||||
normalization);
|
normalization);
|
||||||
}
|
}
|
||||||
interscaleManager_.add_dense_matrix(quantity,name);
|
interscaleManager_.add_dense_matrix(quantity,name);
|
||||||
|
@ -102,21 +102,21 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
}
|
}
|
||||||
else if (atc_->kernel_on_the_fly()) {
|
else if (atc_->kernel_on_the_fly()) {
|
||||||
if (atc_->kernel_based()) {
|
if (atc_->kernel_based()) {
|
||||||
quantity = new OnTheFlyKernelAccumulationNormalizedReferenced(atc_,
|
quantity = new OnTheFlyKernelAccumulationNormalizedReferenced(atc_,
|
||||||
atomic,
|
atomic,
|
||||||
atc_->kernel_function(),
|
atc_->kernel_function(),
|
||||||
atc_->atom_coarsegraining_positions(),
|
atc_->atom_coarsegraining_positions(),
|
||||||
normalization,
|
normalization,
|
||||||
reference);
|
reference);
|
||||||
} else {
|
} else {
|
||||||
quantity = new OnTheFlyMeshAccumulationNormalizedReferenced(atc_,
|
quantity = new OnTheFlyMeshAccumulationNormalizedReferenced(atc_,
|
||||||
atomic,
|
atomic,
|
||||||
atc_->atom_coarsegraining_positions(),
|
atc_->atom_coarsegraining_positions(),
|
||||||
normalization,
|
normalization,
|
||||||
reference);
|
reference);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
quantity = new AtfProjectionReferenced(atc_, atomic,
|
quantity = new AtfProjectionReferenced(atc_, atomic,
|
||||||
atc_->accumulant(),
|
atc_->accumulant(),
|
||||||
reference,
|
reference,
|
||||||
normalization);
|
normalization);
|
||||||
|
@ -141,14 +141,14 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
}
|
}
|
||||||
else if (atc_->kernel_on_the_fly()) {
|
else if (atc_->kernel_on_the_fly()) {
|
||||||
if (atc_->kernel_based()) {
|
if (atc_->kernel_based()) {
|
||||||
quantity = new OnTheFlyKernelAccumulationNormalizedScaled(atc_, atomic,
|
quantity = new OnTheFlyKernelAccumulationNormalizedScaled(atc_, atomic,
|
||||||
atc_->kernel_function(),
|
atc_->kernel_function(),
|
||||||
atc_->atom_coarsegraining_positions(),
|
atc_->atom_coarsegraining_positions(),
|
||||||
normalization,
|
normalization,
|
||||||
scale);
|
scale);
|
||||||
} else {
|
} else {
|
||||||
quantity = new OnTheFlyMeshAccumulationNormalizedScaled(atc_, atomic,
|
quantity = new OnTheFlyMeshAccumulationNormalizedScaled(atc_, atomic,
|
||||||
atc_->atom_coarsegraining_positions(),
|
atc_->atom_coarsegraining_positions(),
|
||||||
normalization,
|
normalization,
|
||||||
scale);
|
scale);
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return projected_atom_quantity(NUMBER_DENSITY,name,atomic,atc_->accumulant_inverse_volumes());
|
return projected_atom_quantity(NUMBER_DENSITY,name,atomic,atc_->accumulant_inverse_volumes());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* MOMENTUM
|
//* MOMENTUM
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::momentum(string name)
|
DENS_MAN * FieldManager::momentum(string name)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +215,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return projected_atom_quantity(MOMENTUM,name,atomic,atc_->accumulant_inverse_volumes());
|
return projected_atom_quantity(MOMENTUM,name,atomic,atc_->accumulant_inverse_volumes());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* VELOCITY
|
//* VELOCITY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::velocity(string name)
|
DENS_MAN * FieldManager::velocity(string name)
|
||||||
{
|
{
|
||||||
|
@ -243,7 +243,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* PROJECTED_VELOCITY
|
//* PROJECTED_VELOCITY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::projected_velocity(string name)
|
DENS_MAN * FieldManager::projected_velocity(string name)
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return projected_atom_quantity(PROJECTED_VELOCITY,name,atomic,atc_->accumulant_inverse_volumes());
|
return projected_atom_quantity(PROJECTED_VELOCITY,name,atomic,atc_->accumulant_inverse_volumes());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* DISPLACEMENT
|
//* DISPLACEMENT
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::displacement(string name)
|
DENS_MAN * FieldManager::displacement(string name)
|
||||||
{
|
{
|
||||||
|
@ -261,8 +261,8 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
|
|
||||||
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicMassWeightedDisplacement");
|
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicMassWeightedDisplacement");
|
||||||
if (!atomic) {
|
if (!atomic) {
|
||||||
FundamentalAtomQuantity * atomMasses = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS);
|
FundamentalAtomQuantity * atomMasses = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS);
|
||||||
FundamentalAtomQuantity * atomPositions = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_POSITION);
|
FundamentalAtomQuantity * atomPositions = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_POSITION);
|
||||||
atomic = new AtomicMassWeightedDisplacement(atc_,atomPositions, atomMasses, atc_->atom_reference_positions(), INTERNAL);
|
atomic = new AtomicMassWeightedDisplacement(atc_,atomPositions, atomMasses, atc_->atom_reference_positions(), INTERNAL);
|
||||||
interscaleManager_.add_per_atom_quantity(atomic,"AtomicMassWeightedDisplacement");
|
interscaleManager_.add_per_atom_quantity(atomic,"AtomicMassWeightedDisplacement");
|
||||||
}
|
}
|
||||||
|
@ -296,12 +296,12 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* REFERENCE_POTENTIAL_ENERGY
|
//* REFERENCE_POTENTIAL_ENERGY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::reference_potential_energy(string /* name */)
|
DENS_MAN * FieldManager::reference_potential_energy(string /* name */)
|
||||||
{
|
{
|
||||||
DENS_MAN * rpe = interscaleManager_.dense_matrix(field_to_string(REFERENCE_POTENTIAL_ENERGY));
|
DENS_MAN * rpe = interscaleManager_.dense_matrix(field_to_string(REFERENCE_POTENTIAL_ENERGY));
|
||||||
if (! rpe ) {
|
if (! rpe ) {
|
||||||
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicReferencePotential");
|
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicReferencePotential");
|
||||||
if (!atomic) {
|
if (!atomic) {
|
||||||
atomic = new AtcAtomQuantity<double>(atc_);
|
atomic = new AtcAtomQuantity<double>(atc_);
|
||||||
|
@ -334,7 +334,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return rpe;
|
return rpe;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* POTENTIAL_ENERGY
|
//* POTENTIAL_ENERGY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::potential_energy(string name)
|
DENS_MAN * FieldManager::potential_energy(string name)
|
||||||
{
|
{
|
||||||
|
@ -352,7 +352,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* TEMPERATURE
|
//* TEMPERATURE
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::temperature(string name)
|
DENS_MAN * FieldManager::temperature(string name)
|
||||||
{
|
{
|
||||||
|
@ -367,10 +367,10 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
{
|
{
|
||||||
double Tcoef = 1./((atc_->nsd())*(atc_->lammps_interface())->kBoltzmann());
|
double Tcoef = 1./((atc_->nsd())*(atc_->lammps_interface())->kBoltzmann());
|
||||||
PAQ * atomic = per_atom_quantity("AtomicTwiceKineticEnergy");
|
PAQ * atomic = per_atom_quantity("AtomicTwiceKineticEnergy");
|
||||||
return scaled_projected_atom_quantity(KINETIC_TEMPERATURE,name,atomic,Tcoef,atc_->accumulant_weights());
|
return scaled_projected_atom_quantity(KINETIC_TEMPERATURE,name,atomic,Tcoef,atc_->accumulant_weights());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* THERMAL_ENERGY
|
//* THERMAL_ENERGY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::thermal_energy(string name)
|
DENS_MAN * FieldManager::thermal_energy(string name)
|
||||||
{
|
{
|
||||||
|
@ -379,7 +379,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return scaled_projected_atom_quantity(THERMAL_ENERGY,name,atomic,Ecoef,atc_->accumulant_inverse_volumes());
|
return scaled_projected_atom_quantity(THERMAL_ENERGY,name,atomic,Ecoef,atc_->accumulant_inverse_volumes());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* KINETIC_ENERGY
|
//* KINETIC_ENERGY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::kinetic_energy(string name)
|
DENS_MAN * FieldManager::kinetic_energy(string name)
|
||||||
{
|
{
|
||||||
|
@ -405,7 +405,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return projected_atom_quantity(SPECIES_FLUX,name,atomic,atc_->accumulant_inverse_volumes());
|
return projected_atom_quantity(SPECIES_FLUX,name,atomic,atc_->accumulant_inverse_volumes());
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* INTERNAL_ENERGY
|
//* INTERNAL_ENERGY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::internal_energy(string name)
|
DENS_MAN * FieldManager::internal_energy(string name)
|
||||||
{
|
{
|
||||||
|
@ -417,7 +417,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return ie;
|
return ie;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* ENERGY
|
//* ENERGY
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
DENS_MAN * FieldManager::energy(string name)
|
DENS_MAN * FieldManager::energy(string name)
|
||||||
{
|
{
|
||||||
|
@ -454,7 +454,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
return atomic;
|
return atomic;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//* 2 KE
|
//* 2 KE
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
PAQ * FieldManager::atomic_twice_kinetic_energy()
|
PAQ * FieldManager::atomic_twice_kinetic_energy()
|
||||||
{
|
{
|
||||||
|
@ -503,7 +503,7 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicSpeciesVelocity");
|
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicSpeciesVelocity");
|
||||||
if (!atomic) {
|
if (!atomic) {
|
||||||
PAQ * atomVelocity = atomic_fluctuating_velocity();
|
PAQ * atomVelocity = atomic_fluctuating_velocity();
|
||||||
PAQ * atomSpecies = atomic_species_vector();
|
PAQ * atomSpecies = atomic_species_vector();
|
||||||
atomic = new SpeciesVelocity(atc_,atomVelocity,atomSpecies);
|
atomic = new SpeciesVelocity(atc_,atomVelocity,atomSpecies);
|
||||||
interscaleManager_.add_per_atom_quantity(atomic, "AtomicSpeciesVelocity");
|
interscaleManager_.add_per_atom_quantity(atomic, "AtomicSpeciesVelocity");
|
||||||
}
|
}
|
||||||
|
@ -529,8 +529,8 @@ typedef PerAtomQuantity<double> PAQ;
|
||||||
{
|
{
|
||||||
PAQ * quantity = interscaleManager_.per_atom_quantity(field_to_prolongation_name(field));
|
PAQ * quantity = interscaleManager_.per_atom_quantity(field_to_prolongation_name(field));
|
||||||
if (!quantity) {
|
if (!quantity) {
|
||||||
|
|
||||||
|
|
||||||
DENS_MAN * coarseQuantity = interscaleManager_.dense_matrix(field_to_string(field));
|
DENS_MAN * coarseQuantity = interscaleManager_.dense_matrix(field_to_string(field));
|
||||||
if (!coarseQuantity) coarseQuantity = nodal_atomic_field(field);
|
if (!coarseQuantity) coarseQuantity = nodal_atomic_field(field);
|
||||||
if (!coarseQuantity) throw ATC_Error("can not prolong quantity: " + field_to_string(field) + " no field registered");
|
if (!coarseQuantity) throw ATC_Error("can not prolong quantity: " + field_to_string(field) + " no field registered");
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ATC {
|
||||||
PROLONGED_VELOCITY};
|
PROLONGED_VELOCITY};
|
||||||
typedef PerAtomQuantity<double> PAQ;
|
typedef PerAtomQuantity<double> PAQ;
|
||||||
/**
|
/**
|
||||||
* @class FieldManager
|
* @class FieldManager
|
||||||
* @brief Manager for constructing fields from atomic data
|
* @brief Manager for constructing fields from atomic data
|
||||||
*/
|
*/
|
||||||
class FieldManager{
|
class FieldManager{
|
||||||
|
@ -26,7 +26,7 @@ namespace ATC {
|
||||||
FieldManager(ATC_Method * atc);
|
FieldManager(ATC_Method * atc);
|
||||||
virtual ~FieldManager(void){};
|
virtual ~FieldManager(void){};
|
||||||
/** this function returns a (density) field derived from atomic data */
|
/** this function returns a (density) field derived from atomic data */
|
||||||
DENS_MAN * nodal_atomic_field(FieldName fieldName,
|
DENS_MAN * nodal_atomic_field(FieldName fieldName,
|
||||||
std::string name = "default") {
|
std::string name = "default") {
|
||||||
switch (fieldName) {
|
switch (fieldName) {
|
||||||
case CHARGE_DENSITY: return charge_density(name);
|
case CHARGE_DENSITY: return charge_density(name);
|
||||||
|
@ -51,17 +51,17 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CanonicalName string_to_canonical_name(std::string name){
|
CanonicalName string_to_canonical_name(std::string name){
|
||||||
if (name == "AtomicTwiceFluctuatingKineticEnergy")
|
if (name == "AtomicTwiceFluctuatingKineticEnergy")
|
||||||
return ATOMIC_TWICE_FLUCTUATING_KINETIC_ENERGY;
|
return ATOMIC_TWICE_FLUCTUATING_KINETIC_ENERGY;
|
||||||
else if (name == "AtomicTwiceKineticEnergy")
|
else if (name == "AtomicTwiceKineticEnergy")
|
||||||
return ATOMIC_TWICE_KINETIC_ENERGY;
|
return ATOMIC_TWICE_KINETIC_ENERGY;
|
||||||
else if (name == "AtomicTwiceKineticEnergy")
|
else if (name == "AtomicTwiceKineticEnergy")
|
||||||
return ATOMIC_TWICE_KINETIC_ENERGY;
|
return ATOMIC_TWICE_KINETIC_ENERGY;
|
||||||
else if (name == "AtomicFluctuatingVelocity")
|
else if (name == "AtomicFluctuatingVelocity")
|
||||||
return ATOMIC_FLUCTUATING_VELOCITY;
|
return ATOMIC_FLUCTUATING_VELOCITY;
|
||||||
else if (name == "AtomicChargeVelocity") // ionic current
|
else if (name == "AtomicChargeVelocity") // ionic current
|
||||||
return ATOMIC_CHARGE_VELOCITY;
|
return ATOMIC_CHARGE_VELOCITY;
|
||||||
else if (name == "AtomicSpeciesVelocity") // per species momentum
|
else if (name == "AtomicSpeciesVelocity") // per species momentum
|
||||||
return ATOMIC_SPECIES_VELOCITY;
|
return ATOMIC_SPECIES_VELOCITY;
|
||||||
else if (name == field_to_prolongation_name(VELOCITY))
|
else if (name == field_to_prolongation_name(VELOCITY))
|
||||||
return PROLONGED_VELOCITY;
|
return PROLONGED_VELOCITY;
|
||||||
|
@ -70,11 +70,11 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
PAQ * per_atom_quantity(std::string name) {
|
PAQ * per_atom_quantity(std::string name) {
|
||||||
switch (string_to_canonical_name(name)) {
|
switch (string_to_canonical_name(name)) {
|
||||||
case ATOMIC_TWICE_FLUCTUATING_KINETIC_ENERGY:
|
case ATOMIC_TWICE_FLUCTUATING_KINETIC_ENERGY:
|
||||||
return atomic_twice_fluctuating_kinetic_energy();
|
return atomic_twice_fluctuating_kinetic_energy();
|
||||||
case ATOMIC_TWICE_KINETIC_ENERGY:
|
case ATOMIC_TWICE_KINETIC_ENERGY:
|
||||||
return atomic_twice_kinetic_energy();
|
return atomic_twice_kinetic_energy();
|
||||||
case ATOMIC_FLUCTUATING_VELOCITY:
|
case ATOMIC_FLUCTUATING_VELOCITY:
|
||||||
return atomic_fluctuating_velocity();
|
return atomic_fluctuating_velocity();
|
||||||
case ATOMIC_CHARGE_VELOCITY:
|
case ATOMIC_CHARGE_VELOCITY:
|
||||||
return atomic_charge_velocity();
|
return atomic_charge_velocity();
|
||||||
|
@ -82,7 +82,7 @@ namespace ATC {
|
||||||
return atomic_species_velocity();
|
return atomic_species_velocity();
|
||||||
case PROLONGED_VELOCITY:
|
case PROLONGED_VELOCITY:
|
||||||
return prolonged_field(VELOCITY);
|
return prolonged_field(VELOCITY);
|
||||||
default:
|
default:
|
||||||
throw ATC_Error("FieldManager:: unknown PAQ"); return nullptr;
|
throw ATC_Error("FieldManager:: unknown PAQ"); return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace ATC {
|
||||||
UXT_Function* UXT_Function_Mgr::copy_UXT_function(UXT_Function* other)
|
UXT_Function* UXT_Function_Mgr::copy_UXT_function(UXT_Function* other)
|
||||||
{
|
{
|
||||||
string tag = other->tag();
|
string tag = other->tag();
|
||||||
|
|
||||||
UXT_Function * returnFunction = nullptr;
|
UXT_Function * returnFunction = nullptr;
|
||||||
if (tag=="linear") {
|
if (tag=="linear") {
|
||||||
ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other;
|
ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other;
|
||||||
|
@ -103,7 +103,7 @@ namespace ATC {
|
||||||
// ScalarLinearFunction
|
// ScalarLinearFunction
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
ScalarLinearFunction::ScalarLinearFunction(int narg, double* args)
|
ScalarLinearFunction::ScalarLinearFunction(int narg, double* args)
|
||||||
: UXT_Function(narg,args)
|
: UXT_Function(narg,args)
|
||||||
{
|
{
|
||||||
tag_ = "linear";
|
tag_ = "linear";
|
||||||
|
@ -119,19 +119,19 @@ namespace ATC {
|
||||||
// XT_Function
|
// XT_Function
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
XT_Function::XT_Function(int narg, double* args)
|
XT_Function::XT_Function(int narg, double* args)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (narg > 5 ) {
|
if (narg > 5 ) {
|
||||||
x0[0] = args[0];
|
x0[0] = args[0];
|
||||||
x0[1] = args[1];
|
x0[1] = args[1];
|
||||||
x0[2] = args[2];
|
x0[2] = args[2];
|
||||||
mask[0] = args[3];
|
mask[0] = args[3];
|
||||||
mask[1] = args[4];
|
mask[1] = args[4];
|
||||||
mask[2] = args[5];
|
mask[2] = args[5];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x0[0] = 0.0;
|
x0[0] = 0.0;
|
||||||
x0[1] = 0.0;
|
x0[1] = 0.0;
|
||||||
x0[2] = 0.0;
|
x0[2] = 0.0;
|
||||||
mask[0] = 0.0;
|
mask[0] = 0.0;
|
||||||
|
@ -211,7 +211,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
double *dargs = (double *) alloca(sizeof(double) * narg);
|
double *dargs = (double *) alloca(sizeof(double) * narg);
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < narg; ++i) dargs[i] = atof(args[i+1]);
|
for (int i = 0; i < narg; ++i) dargs[i] = atof(args[i+1]);
|
||||||
|
|
||||||
return function(type, narg, dargs);
|
return function(type, narg, dargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
XT_Function* XT_Function_Mgr::copy_XT_function(XT_Function* other)
|
XT_Function* XT_Function_Mgr::copy_XT_function(XT_Function* other)
|
||||||
{
|
{
|
||||||
string tag = other->tag();
|
string tag = other->tag();
|
||||||
|
|
||||||
XT_Function * returnFunction = nullptr;
|
XT_Function * returnFunction = nullptr;
|
||||||
if (tag=="linear") {
|
if (tag=="linear") {
|
||||||
LinearFunction * other_cast = (LinearFunction*) other;
|
LinearFunction * other_cast = (LinearFunction*) other;
|
||||||
|
@ -268,14 +268,14 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// ConstantFunction
|
// ConstantFunction
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
ConstantFunction::ConstantFunction(int narg, double* args)
|
ConstantFunction::ConstantFunction(int narg, double* args)
|
||||||
: XT_Function(narg,args),
|
: XT_Function(narg,args),
|
||||||
C0(args[0])
|
C0(args[0])
|
||||||
{
|
{
|
||||||
tag_ = "constant";
|
tag_ = "constant";
|
||||||
}
|
}
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
ConstantFunction::ConstantFunction(double arg)
|
ConstantFunction::ConstantFunction(double arg)
|
||||||
: XT_Function(1,&arg),
|
: XT_Function(1,&arg),
|
||||||
C0(arg)
|
C0(arg)
|
||||||
{
|
{
|
||||||
|
@ -286,7 +286,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// LinearFunction
|
// LinearFunction
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
LinearFunction::LinearFunction(int narg, double* args)
|
LinearFunction::LinearFunction(int narg, double* args)
|
||||||
: XT_Function(narg,args)
|
: XT_Function(narg,args)
|
||||||
{
|
{
|
||||||
C0 = args[6];
|
C0 = args[6];
|
||||||
|
@ -300,7 +300,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// PiecewiseLinearFunction
|
// PiecewiseLinearFunction
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
PiecewiseLinearFunction::PiecewiseLinearFunction(int narg, double* args)
|
PiecewiseLinearFunction::PiecewiseLinearFunction(int narg, double* args)
|
||||||
: XT_Function(narg,args)
|
: XT_Function(narg,args)
|
||||||
{
|
{
|
||||||
int i=0, idx = 6, n = (narg-idx)/2;
|
int i=0, idx = 6, n = (narg-idx)/2;
|
||||||
|
@ -327,7 +327,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
if (index < 0) return fi(0);
|
if (index < 0) return fi(0);
|
||||||
else if (index >= xi.size()-1 ) return fi(xi.size()-1);
|
else if (index >= xi.size()-1 ) return fi(xi.size()-1);
|
||||||
else {
|
else {
|
||||||
double f = fi(index)
|
double f = fi(index)
|
||||||
+ (fi(index+1)-fi(index))*(s-xi(index))/(xi(index+1)-xi(index));
|
+ (fi(index+1)-fi(index))*(s-xi(index))/(xi(index+1)-xi(index));
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// QuadraticFunction
|
// QuadraticFunction
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
QuadraticFunction::QuadraticFunction(int narg, double* args)
|
QuadraticFunction::QuadraticFunction(int narg, double* args)
|
||||||
: XT_Function(narg,args)
|
: XT_Function(narg,args)
|
||||||
{
|
{
|
||||||
C0 = args[6];
|
C0 = args[6];
|
||||||
|
@ -387,7 +387,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// SineFunction
|
// SineFunction
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
SineFunction::SineFunction(int narg, double* args)
|
SineFunction::SineFunction(int narg, double* args)
|
||||||
: XT_Function(narg,args)
|
: XT_Function(narg,args)
|
||||||
{
|
{
|
||||||
C = args[6];
|
C = args[6];
|
||||||
|
@ -403,7 +403,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// GaussianFunction
|
// GaussianFunction
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
GaussianFunction::GaussianFunction(int narg, double* args)
|
GaussianFunction::GaussianFunction(int narg, double* args)
|
||||||
: XT_Function(narg,args)
|
: XT_Function(narg,args)
|
||||||
{
|
{
|
||||||
tau = args[6];
|
tau = args[6];
|
||||||
|
@ -416,7 +416,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// GaussianTemporalRamp
|
// GaussianTemporalRamp
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
GaussianTemporalRamp::GaussianTemporalRamp(int narg, double* args)
|
GaussianTemporalRamp::GaussianTemporalRamp(int narg, double* args)
|
||||||
: GaussianFunction(narg,args)
|
: GaussianFunction(narg,args)
|
||||||
{
|
{
|
||||||
tau_initial = args[9];
|
tau_initial = args[9];
|
||||||
|
@ -457,7 +457,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// TemporalRamp
|
// TemporalRamp
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
TemporalRamp::TemporalRamp(int narg, double* args)
|
TemporalRamp::TemporalRamp(int narg, double* args)
|
||||||
: XT_Function(narg,args)
|
: XT_Function(narg,args)
|
||||||
{
|
{
|
||||||
f_initial = args[0];
|
f_initial = args[0];
|
||||||
|
@ -471,7 +471,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
// RadialPower
|
// RadialPower
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
RadialPower::RadialPower(int narg, double* args)
|
RadialPower::RadialPower(int narg, double* args)
|
||||||
: XT_Function(narg,args)
|
: XT_Function(narg,args)
|
||||||
{
|
{
|
||||||
C0 = args[6];
|
C0 = args[6];
|
||||||
|
@ -499,8 +499,8 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
fps_(i)=coef*fp;
|
fps_(i)=coef*fp;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
// scale tangents
|
// scale tangents
|
||||||
double dx, dx0 = xs_(1)-xs_(0);
|
double dx, dx0 = xs_(1)-xs_(0);
|
||||||
for (int i = 0; i < npts_ ; i++) {
|
for (int i = 0; i < npts_ ; i++) {
|
||||||
if (i == 0) { dx = xs_(1)-xs_(0); }
|
if (i == 0) { dx = xs_(1)-xs_(0); }
|
||||||
else if (i+1 == npts_) { dx = xs_(npts_-1)-xs_(npts_-2); }
|
else if (i+1 == npts_) { dx = xs_(npts_-1)-xs_(npts_-2); }
|
||||||
|
@ -512,14 +512,14 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double InterpolationFunction::coordinate(double x,
|
double InterpolationFunction::coordinate(double x,
|
||||||
double & f0, double & fp0, double & f1, double & fp1, double & inv_dx ) const
|
double & f0, double & fp0, double & f1, double & fp1, double & inv_dx ) const
|
||||||
{
|
{
|
||||||
int i0 = xs_.index(x);
|
int i0 = xs_.index(x);
|
||||||
int i1 = i0+1;
|
int i1 = i0+1;
|
||||||
if (i0 < 0) {
|
if (i0 < 0) {
|
||||||
double x0 = xs_(0), x1 = xs_(1);
|
double x0 = xs_(0), x1 = xs_(1);
|
||||||
inv_dx = 1./(x1-x0);
|
inv_dx = 1./(x1-x0);
|
||||||
fp0 = fp1 = fps_(0);
|
fp0 = fp1 = fps_(0);
|
||||||
f1 = fs_(0);
|
f1 = fs_(0);
|
||||||
f0 = fp0*(x-xs_(0))+f1;
|
f0 = fp0*(x-xs_(0))+f1;
|
||||||
|
@ -527,7 +527,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
}
|
}
|
||||||
else if (i1 >= npts_) {
|
else if (i1 >= npts_) {
|
||||||
double x0 = xs_(npts_-2), x1 = xs_(npts_-1);
|
double x0 = xs_(npts_-2), x1 = xs_(npts_-1);
|
||||||
inv_dx = 1./(x1-x0);
|
inv_dx = 1./(x1-x0);
|
||||||
fp0 = fp1 = fps_(i0);
|
fp0 = fp1 = fps_(i0);
|
||||||
f0 = fs_(i0);
|
f0 = fs_(i0);
|
||||||
f1 = fp0*(x-xs_(i0))+f0;
|
f1 = fp0*(x-xs_(i0))+f0;
|
||||||
|
@ -535,7 +535,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
double x0 = xs_(i0), x1 = xs_(i1);
|
double x0 = xs_(i0), x1 = xs_(i1);
|
||||||
inv_dx = 1./(x1-x0);
|
inv_dx = 1./(x1-x0);
|
||||||
f0 = fs_ (i0); f1 = fs_ (i1);
|
f0 = fs_ (i0); f1 = fs_ (i1);
|
||||||
fp0 = fps_(i0); fp1 = fps_(i1);
|
fp0 = fps_(i0); fp1 = fps_(i1);
|
||||||
double t = (x-x0)*inv_dx;
|
double t = (x-x0)*inv_dx;
|
||||||
|
@ -546,7 +546,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
{
|
{
|
||||||
double f0,fp0,f1,fp1,inv_dx;
|
double f0,fp0,f1,fp1,inv_dx;
|
||||||
double t = coordinate(x,f0,fp0,f1,fp1,inv_dx);
|
double t = coordinate(x,f0,fp0,f1,fp1,inv_dx);
|
||||||
double t2 = t*t;
|
double t2 = t*t;
|
||||||
double t3 = t*t2;
|
double t3 = t*t2;
|
||||||
double h00 = 2*t3 - 3*t2 + 1;
|
double h00 = 2*t3 - 3*t2 + 1;
|
||||||
double h10 = t3 - 2*t2 + t;
|
double h10 = t3 - 2*t2 + t;
|
||||||
|
@ -559,7 +559,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
|
||||||
{
|
{
|
||||||
double f0,fp0,f1,fp1,inv_dx;
|
double f0,fp0,f1,fp1,inv_dx;
|
||||||
double t = coordinate(x,f0,fp0,f1,fp1,inv_dx);
|
double t = coordinate(x,f0,fp0,f1,fp1,inv_dx);
|
||||||
double t2 = t*t;
|
double t2 = t*t;
|
||||||
double d00 = 6*t2 - 6*t;
|
double d00 = 6*t2 - 6*t;
|
||||||
double d10 = 3*t2 - 4*t + 1;
|
double d10 = 3*t2 - 4*t + 1;
|
||||||
double d01 =-6*t2 + 6*t;
|
double d01 =-6*t2 + 6*t;
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class LinearFieldFunction
|
* @class LinearFieldFunction
|
||||||
* @brief Class for functions returning values linear a given field
|
* @brief Class for functions returning values linear a given field
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +69,7 @@ namespace ATC {
|
||||||
public:
|
public:
|
||||||
LinearFieldFunction(int nargs, char** args);
|
LinearFieldFunction(int nargs, char** args);
|
||||||
virtual ~LinearFieldFunction(void) {};
|
virtual ~LinearFieldFunction(void) {};
|
||||||
|
|
||||||
inline double f(double* u, double* /* x */, double /* t */) {return c1_*u[0]-c0_;}
|
inline double f(double* u, double* /* x */, double /* t */) {return c1_*u[0]-c0_;}
|
||||||
inline double dfd(FieldName /* field */, ARGS& /* args */) {return c1_;}
|
inline double dfd(FieldName /* field */, ARGS& /* args */) {return c1_;}
|
||||||
|
|
||||||
|
@ -124,16 +124,16 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ScalarLinearFunction
|
* @class ScalarLinearFunction
|
||||||
* @brief Class for functions returning values linear in space
|
* @brief Class for functions returning values linear in space
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ScalarLinearFunction : public UXT_Function {
|
class ScalarLinearFunction : public UXT_Function {
|
||||||
public:
|
public:
|
||||||
ScalarLinearFunction(int nargs, double* args);
|
ScalarLinearFunction(int nargs, double* args);
|
||||||
virtual ~ScalarLinearFunction(void) {};
|
virtual ~ScalarLinearFunction(void) {};
|
||||||
|
|
||||||
//inline double f(double* u, double* x, double t) {return c1_*(u[0]-c0_);}
|
//inline double f(double* u, double* x, double t) {return c1_*(u[0]-c0_);}
|
||||||
|
|
||||||
inline double f(double* u, double* /* x */, double /* t */) {return c1_*u[0]+c0_;}
|
inline double f(double* u, double* /* x */, double /* t */) {return c1_*u[0]+c0_;}
|
||||||
|
@ -145,7 +145,7 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class XT_Function
|
* @class XT_Function
|
||||||
* @brief Base class for functions based on space and time variables
|
* @brief Base class for functions based on space and time variables
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class XT_Function {
|
class XT_Function {
|
||||||
|
@ -201,7 +201,7 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ConstantFunction
|
* @class ConstantFunction
|
||||||
* @brief Class for functions returning constant values
|
* @brief Class for functions returning constant values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ConstantFunction : public XT_Function {
|
class ConstantFunction : public XT_Function {
|
||||||
|
@ -209,33 +209,33 @@ namespace ATC {
|
||||||
ConstantFunction(int nargs, double* args);
|
ConstantFunction(int nargs, double* args);
|
||||||
ConstantFunction(double arg);
|
ConstantFunction(double arg);
|
||||||
virtual ~ConstantFunction(void) {};
|
virtual ~ConstantFunction(void) {};
|
||||||
|
|
||||||
inline double f(double* /* x */, double /* t */)
|
inline double f(double* /* x */, double /* t */)
|
||||||
{return C0;};
|
{return C0;};
|
||||||
|
|
||||||
private :
|
private :
|
||||||
double C0;
|
double C0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class LinearFunction
|
* @class LinearFunction
|
||||||
* @brief Class for functions returning values linear in space
|
* @brief Class for functions returning values linear in space
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class LinearFunction : public XT_Function {
|
class LinearFunction : public XT_Function {
|
||||||
public:
|
public:
|
||||||
LinearFunction(int nargs, double* args);
|
LinearFunction(int nargs, double* args);
|
||||||
virtual ~LinearFunction(void) {};
|
virtual ~LinearFunction(void) {};
|
||||||
|
|
||||||
double f(double* x, double /* t */)
|
double f(double* x, double /* t */)
|
||||||
{return mask[0]*(x[0]-x0[0])+mask[1]*(x[1]-x0[1])+mask[2]*(x[2]-x0[2]) + C0;};
|
{return mask[0]*(x[0]-x0[0])+mask[1]*(x[1]-x0[1])+mask[2]*(x[2]-x0[2]) + C0;};
|
||||||
|
|
||||||
private :
|
private :
|
||||||
double C0;
|
double C0;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @class PiecewiseLinearFunction
|
* @class PiecewiseLinearFunction
|
||||||
* @brief Class for functions returning values piecewise linear in space
|
* @brief Class for functions returning values piecewise linear in space
|
||||||
* along given direction
|
* along given direction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -243,31 +243,31 @@ namespace ATC {
|
||||||
public:
|
public:
|
||||||
PiecewiseLinearFunction(int nargs, double* args);
|
PiecewiseLinearFunction(int nargs, double* args);
|
||||||
virtual ~PiecewiseLinearFunction(void) {};
|
virtual ~PiecewiseLinearFunction(void) {};
|
||||||
|
|
||||||
double f(double* x, double t) ;
|
double f(double* x, double t) ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
Array<double> xi;
|
Array<double> xi;
|
||||||
Array<double> fi;
|
Array<double> fi;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class LinearTemporalRamp
|
* @class LinearTemporalRamp
|
||||||
* @brief Class for functions returning values linear in space and time
|
* @brief Class for functions returning values linear in space and time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class LinearTemporalRamp : public XT_Function {
|
class LinearTemporalRamp : public XT_Function {
|
||||||
public:
|
public:
|
||||||
LinearTemporalRamp(int nargs, double* args);
|
LinearTemporalRamp(int nargs, double* args);
|
||||||
~LinearTemporalRamp(void) {};
|
~LinearTemporalRamp(void) {};
|
||||||
|
|
||||||
double f(double* x, double t);
|
double f(double* x, double t);
|
||||||
double dfdt(double* x, double t);
|
double dfdt(double* x, double t);
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
double mask_slope[3];
|
double mask_slope[3];
|
||||||
double C0_initial, C0_slope;
|
double C0_initial, C0_slope;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -279,9 +279,9 @@ namespace ATC {
|
||||||
public:
|
public:
|
||||||
QuadraticFunction(int nargs, double* args);
|
QuadraticFunction(int nargs, double* args);
|
||||||
virtual ~QuadraticFunction(void) {};
|
virtual ~QuadraticFunction(void) {};
|
||||||
|
|
||||||
inline double f(double* x, double /* t */)
|
inline double f(double* x, double /* t */)
|
||||||
{return
|
{return
|
||||||
C2[0]*(x[0]-x0[0])*(x[0]-x0[0])+
|
C2[0]*(x[0]-x0[0])*(x[0]-x0[0])+
|
||||||
C2[1]*(x[1]-x0[1])*(x[1]-x0[1])+
|
C2[1]*(x[1]-x0[1])*(x[1]-x0[1])+
|
||||||
C2[2]*(x[2]-x0[2])*(x[2]-x0[2])+
|
C2[2]*(x[2]-x0[2])*(x[2]-x0[2])+
|
||||||
|
@ -295,7 +295,7 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class SineFunction
|
* @class SineFunction
|
||||||
* @brief Class for functions returning values sinusoidally varying in space and time
|
* @brief Class for functions returning values sinusoidally varying in space and time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ namespace ATC {
|
||||||
SineFunction(int nargs, double* args);
|
SineFunction(int nargs, double* args);
|
||||||
virtual ~SineFunction(void){};
|
virtual ~SineFunction(void){};
|
||||||
|
|
||||||
inline double f(double* x, double t)
|
inline double f(double* x, double t)
|
||||||
{return C*sin( mask[0]*(x[0]-x0[0])
|
{return C*sin( mask[0]*(x[0]-x0[0])
|
||||||
+mask[1]*(x[1]-x0[1])
|
+mask[1]*(x[1]-x0[1])
|
||||||
+mask[2]*(x[2]-x0[2]) - w*t) + C0;};
|
+mask[2]*(x[2]-x0[2]) - w*t) + C0;};
|
||||||
|
@ -324,7 +324,7 @@ namespace ATC {
|
||||||
virtual ~GaussianFunction(void){};
|
virtual ~GaussianFunction(void){};
|
||||||
|
|
||||||
// 1/(2 pi \sigma)^(n/2) exp(-1/2 x.x/\sigma^2 ) for n = dimension
|
// 1/(2 pi \sigma)^(n/2) exp(-1/2 x.x/\sigma^2 ) for n = dimension
|
||||||
inline double f(double* x, double /* t */)
|
inline double f(double* x, double /* t */)
|
||||||
{return C*exp(-(mask[0]*(x[0]-x0[0])*(x[0]-x0[0])
|
{return C*exp(-(mask[0]*(x[0]-x0[0])*(x[0]-x0[0])
|
||||||
+mask[1]*(x[1]-x0[1])*(x[1]-x0[1])
|
+mask[1]*(x[1]-x0[1])*(x[1]-x0[1])
|
||||||
+mask[2]*(x[2]-x0[2])*(x[2]-x0[2]))/tau/tau) + C0;};
|
+mask[2]*(x[2]-x0[2])*(x[2]-x0[2]))/tau/tau) + C0;};
|
||||||
|
@ -334,7 +334,7 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class GaussianTemporalRamp
|
* @class GaussianTemporalRamp
|
||||||
* @brief Class for functions returning values according to a Gaussian distribution in space and linearly in time
|
* @brief Class for functions returning values according to a Gaussian distribution in space and linearly in time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -351,9 +351,9 @@ namespace ATC {
|
||||||
double C_initial, C_slope;
|
double C_initial, C_slope;
|
||||||
double C0_initial, C0_slope;
|
double C0_initial, C0_slope;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class TemporalRamp
|
* @class TemporalRamp
|
||||||
* @brief Class for functions returning values constant in space and varying linearly in time
|
* @brief Class for functions returning values constant in space and varying linearly in time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -361,11 +361,11 @@ namespace ATC {
|
||||||
public:
|
public:
|
||||||
TemporalRamp(int nargs, double* args);
|
TemporalRamp(int nargs, double* args);
|
||||||
virtual ~TemporalRamp(void) {};
|
virtual ~TemporalRamp(void) {};
|
||||||
|
|
||||||
inline double f(double* /* x */, double t)
|
inline double f(double* /* x */, double t)
|
||||||
{return f_initial + slope*t;};
|
{return f_initial + slope*t;};
|
||||||
|
|
||||||
inline double dfdt(double* /* x */, double /* t */)
|
inline double dfdt(double* /* x */, double /* t */)
|
||||||
{return slope;};
|
{return slope;};
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
@ -373,29 +373,29 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class RadialPower
|
* @class RadialPower
|
||||||
* @brief Class for functions returning values based on distance from a fix point raised to a specified power
|
* @brief Class for functions returning values based on distance from a fix point raised to a specified power
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class RadialPower : public XT_Function {
|
class RadialPower : public XT_Function {
|
||||||
public:
|
public:
|
||||||
RadialPower(int nargs, double* args);
|
RadialPower(int nargs, double* args);
|
||||||
virtual ~RadialPower(void) {};
|
virtual ~RadialPower(void) {};
|
||||||
|
|
||||||
inline double f(double* x, double /* t */)
|
inline double f(double* x, double /* t */)
|
||||||
{
|
{
|
||||||
double dx = x[0]-x0[0]; double dy = x[1]-x0[1]; double dz = x[2]-x0[2];
|
double dx = x[0]-x0[0]; double dy = x[1]-x0[1]; double dz = x[2]-x0[2];
|
||||||
double r = mask[0]*dx*dx+mask[1]*dy*dy+mask[2]*dz*dz; r = sqrt(r);
|
double r = mask[0]*dx*dx+mask[1]*dy*dy+mask[2]*dz*dz; r = sqrt(r);
|
||||||
return C0*pow(r,n);
|
return C0*pow(r,n);
|
||||||
};
|
};
|
||||||
|
|
||||||
private :
|
private :
|
||||||
double C0, n;
|
double C0, n;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class InterpolationFunction
|
* @class InterpolationFunction
|
||||||
* @brief Base class for interpolation functions
|
* @brief Base class for interpolation functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class InterpolationFunction {
|
class InterpolationFunction {
|
||||||
|
@ -412,7 +412,7 @@ namespace ATC {
|
||||||
double dfdt(const double t) const;
|
double dfdt(const double t) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double coordinate(double x,
|
double coordinate(double x,
|
||||||
double & f0, double & fp0, double & f1, double & fp1, double & inv_dx) const;
|
double & f0, double & fp0, double & f1, double & fp1, double & inv_dx) const;
|
||||||
int npts_;
|
int npts_;
|
||||||
Array<double> xs_;
|
Array<double> xs_;
|
||||||
|
|
|
@ -37,13 +37,13 @@ namespace ATC {
|
||||||
if (atomType_ == ALL || atomType_ == PROC_GHOST) {
|
if (atomType_ == ALL || atomType_ == PROC_GHOST) {
|
||||||
if (nCols_==1) { // scalar
|
if (nCols_==1) { // scalar
|
||||||
double * lammpsQuantity = lammps_scalar();
|
double * lammpsQuantity = lammps_scalar();
|
||||||
|
|
||||||
for (int i = 0; i < atc_.nlocal_total(); i++)
|
for (int i = 0; i < atc_.nlocal_total(); i++)
|
||||||
lammpsQuantity[i] = quantity_(i,0)/unitsConversion_;
|
lammpsQuantity[i] = quantity_(i,0)/unitsConversion_;
|
||||||
}
|
}
|
||||||
else{ // vector
|
else{ // vector
|
||||||
double ** lammpsQuantity = lammps_vector();
|
double ** lammpsQuantity = lammps_vector();
|
||||||
|
|
||||||
for (int i = 0; i < atc_.nlocal_total(); i++)
|
for (int i = 0; i < atc_.nlocal_total(); i++)
|
||||||
for (int j = 0; j < nCols_; j++)
|
for (int j = 0; j < nCols_; j++)
|
||||||
lammpsQuantity[i][j] = quantity_(i,j)/unitsConversion_;
|
lammpsQuantity[i][j] = quantity_(i,j)/unitsConversion_;
|
||||||
|
@ -52,7 +52,7 @@ namespace ATC {
|
||||||
// mapped copy
|
// mapped copy
|
||||||
else {
|
else {
|
||||||
int atomIndex;
|
int atomIndex;
|
||||||
|
|
||||||
if (nCols_==1) { // scalar
|
if (nCols_==1) { // scalar
|
||||||
double * lammpsQuantity = lammps_scalar();
|
double * lammpsQuantity = lammps_scalar();
|
||||||
for (int i = 0; i < quantity_.nRows(); i++) {
|
for (int i = 0; i < quantity_.nRows(); i++) {
|
||||||
|
@ -77,7 +77,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Class AtomMass
|
// Class AtomMass
|
||||||
// Access-only operations when mass is
|
// Access-only operations when mass is
|
||||||
// defined per type.
|
// defined per type.
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -98,7 +98,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
const int * type = lammpsInterface_->atom_type();
|
const int * type = lammpsInterface_->atom_type();
|
||||||
const double * mass = lammpsInterface_->atom_mass();
|
const double * mass = lammpsInterface_->atom_mass();
|
||||||
|
|
||||||
if (atomType_ == ALL || atomType_ == PROC_GHOST) {
|
if (atomType_ == ALL || atomType_ == PROC_GHOST) {
|
||||||
for (int i = 0; i < quantity_.nRows(); i++)
|
for (int i = 0; i < quantity_.nRows(); i++)
|
||||||
quantity_(i,0) = mass[type[i]];
|
quantity_(i,0) = mass[type[i]];
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace ATC {
|
||||||
// be initialized.
|
// be initialized.
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class ComputedAtomQuantity : public ShallowAtomQuantity<double> {
|
class ComputedAtomQuantity : public ShallowAtomQuantity<double> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -220,7 +220,7 @@ namespace ATC {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** pointer to Lammps compute, meant as rapid indexing only (do not use!) */
|
/** pointer to Lammps compute, meant as rapid indexing only (do not use!) */
|
||||||
COMPUTE_POINTER computePointer_;
|
COMPUTE_POINTER computePointer_;
|
||||||
|
|
||||||
/** tag for Lammps compute */
|
/** tag for Lammps compute */
|
||||||
std::string computeTag_;
|
std::string computeTag_;
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
//*****************************************************************
|
//*****************************************************************
|
||||||
// Iterative template routine -- GMRES
|
// Iterative template routine -- GMRES
|
||||||
//
|
//
|
||||||
// GMRES solves the unsymmetric linear system Ax = b using the
|
// GMRES solves the unsymmetric linear system Ax = b using the
|
||||||
// Generalized Minimum Residual method
|
// Generalized Minimum Residual method
|
||||||
//
|
//
|
||||||
// GMRES follows the algorithm described on p. 20 of the
|
// GMRES follows the algorithm described on p. 20 of the
|
||||||
// SIAM Templates book.
|
// SIAM Templates book.
|
||||||
//
|
//
|
||||||
// The return value indicates convergence within max_iter (input)
|
// The return value indicates convergence within max_iter (input)
|
||||||
// iterations (0), or no convergence within max_iter iterations (1).
|
// iterations (0), or no convergence within max_iter iterations (1).
|
||||||
//
|
//
|
||||||
// Upon successful return, output arguments have the following values:
|
// Upon successful return, output arguments have the following values:
|
||||||
//
|
//
|
||||||
// x -- approximate solution to Ax = b
|
// x -- approximate solution to Ax = b
|
||||||
// max_iter -- the number of iterations performed before the
|
// max_iter -- the number of iterations performed before the
|
||||||
// tolerance was reached
|
// tolerance was reached
|
||||||
// tol -- the residual after the final iteration
|
// tol -- the residual after the final iteration
|
||||||
//
|
//
|
||||||
//*****************************************************************
|
//*****************************************************************
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -29,12 +29,12 @@ template<class Real>
|
||||||
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn);
|
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn);
|
||||||
|
|
||||||
template < class Matrix, class Vector >
|
template < class Matrix, class Vector >
|
||||||
void
|
void
|
||||||
Update(Vector &x, int k, Matrix &h, Vector &s, Vector v[])
|
Update(Vector &x, int k, Matrix &h, Vector &s, Vector v[])
|
||||||
{
|
{
|
||||||
Vector y(s);
|
Vector y(s);
|
||||||
|
|
||||||
// Backsolve:
|
// Backsolve:
|
||||||
for (int i = k; i >= 0; i--) {
|
for (int i = k; i >= 0; i--) {
|
||||||
y(i) /= h(i,i);
|
y(i) /= h(i,i);
|
||||||
for (int j = i - 1; j >= 0; j--)
|
for (int j = i - 1; j >= 0; j--)
|
||||||
|
@ -47,7 +47,7 @@ Update(Vector &x, int k, Matrix &h, Vector &s, Vector v[])
|
||||||
|
|
||||||
|
|
||||||
template < class Real >
|
template < class Real >
|
||||||
Real
|
Real
|
||||||
abs(Real x)
|
abs(Real x)
|
||||||
{
|
{
|
||||||
return (x > 0 ? x : -x);
|
return (x > 0 ? x : -x);
|
||||||
|
@ -56,7 +56,7 @@ abs(Real x)
|
||||||
|
|
||||||
template < class Operator, class Vector, class Preconditioner,
|
template < class Operator, class Vector, class Preconditioner,
|
||||||
class Matrix, class Real >
|
class Matrix, class Real >
|
||||||
int
|
int
|
||||||
GMRES(const Operator &A, Vector &x, const Vector &b,
|
GMRES(const Operator &A, Vector &x, const Vector &b,
|
||||||
const Preconditioner &M, Matrix &H, int &m, int &max_iter,
|
const Preconditioner &M, Matrix &H, int &m, int &max_iter,
|
||||||
Real &tol)
|
Real &tol)
|
||||||
|
@ -64,15 +64,15 @@ GMRES(const Operator &A, Vector &x, const Vector &b,
|
||||||
Real resid;
|
Real resid;
|
||||||
int i, j = 1, k;
|
int i, j = 1, k;
|
||||||
Vector s(m+1), cs(m+1), sn(m+1), w;
|
Vector s(m+1), cs(m+1), sn(m+1), w;
|
||||||
|
|
||||||
Vector p = inv(M)*b;
|
Vector p = inv(M)*b;
|
||||||
Real normb = p.norm();
|
Real normb = p.norm();
|
||||||
Vector r = inv(M) * (b - A * x);
|
Vector r = inv(M) * (b - A * x);
|
||||||
Real beta = r.norm();
|
Real beta = r.norm();
|
||||||
|
|
||||||
if (normb == 0.0)
|
if (normb == 0.0)
|
||||||
normb = 1;
|
normb = 1;
|
||||||
|
|
||||||
if ((resid = r.norm() / normb) <= tol) {
|
if ((resid = r.norm() / normb) <= tol) {
|
||||||
tol = resid;
|
tol = resid;
|
||||||
max_iter = 0;
|
max_iter = 0;
|
||||||
|
@ -85,7 +85,7 @@ GMRES(const Operator &A, Vector &x, const Vector &b,
|
||||||
v[0] = r * (1.0 / beta); // ??? r / beta
|
v[0] = r * (1.0 / beta); // ??? r / beta
|
||||||
s = 0.0;
|
s = 0.0;
|
||||||
s(0) = beta;
|
s(0) = beta;
|
||||||
|
|
||||||
for (i = 0; i < m && j <= max_iter; i++, j++) {
|
for (i = 0; i < m && j <= max_iter; i++, j++) {
|
||||||
w = inv(M) * (A * v[i]);
|
w = inv(M) * (A * v[i]);
|
||||||
for (k = 0; k <= i; k++) {
|
for (k = 0; k <= i; k++) {
|
||||||
|
@ -97,11 +97,11 @@ GMRES(const Operator &A, Vector &x, const Vector &b,
|
||||||
|
|
||||||
for (k = 0; k < i; k++)
|
for (k = 0; k < i; k++)
|
||||||
ApplyPlaneRotation(H(k,i), H(k+1,i), cs(k), sn(k));
|
ApplyPlaneRotation(H(k,i), H(k+1,i), cs(k), sn(k));
|
||||||
|
|
||||||
GeneratePlaneRotation(H(i,i), H(i+1,i), cs(i), sn(i));
|
GeneratePlaneRotation(H(i,i), H(i+1,i), cs(i), sn(i));
|
||||||
ApplyPlaneRotation(H(i,i), H(i+1,i), cs(i), sn(i));
|
ApplyPlaneRotation(H(i,i), H(i+1,i), cs(i), sn(i));
|
||||||
ApplyPlaneRotation(s(i), s(i+1), cs(i), sn(i));
|
ApplyPlaneRotation(s(i), s(i+1), cs(i), sn(i));
|
||||||
|
|
||||||
if ((resid = abs(s(i+1)) / normb) < tol) {
|
if ((resid = abs(s(i+1)) / normb) < tol) {
|
||||||
Update(x, i, H, s, v);
|
Update(x, i, H, s, v);
|
||||||
tol = resid;
|
tol = resid;
|
||||||
|
@ -120,14 +120,14 @@ GMRES(const Operator &A, Vector &x, const Vector &b,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tol = resid;
|
tol = resid;
|
||||||
delete [] v;
|
delete [] v;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Real>
|
template<class Real>
|
||||||
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
|
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
|
||||||
{
|
{
|
||||||
if (dy == 0.0) {
|
if (dy == 0.0) {
|
||||||
|
@ -145,7 +145,7 @@ void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Real>
|
template<class Real>
|
||||||
void ApplyPlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
|
void ApplyPlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
|
||||||
{
|
{
|
||||||
Real temp = cs * dx + sn * dy;
|
Real temp = cs * dx + sn * dy;
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace ATC {
|
||||||
// Class GhostManager
|
// Class GhostManager
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -30,7 +30,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -46,7 +46,7 @@ namespace ATC {
|
||||||
bool GhostManager::modify(int narg, char **arg)
|
bool GhostManager::modify(int narg, char **arg)
|
||||||
{
|
{
|
||||||
int argIndex = 0;
|
int argIndex = 0;
|
||||||
|
|
||||||
/*! \page man_boundary_dynamics fix_modify AtC boundary_dynamics
|
/*! \page man_boundary_dynamics fix_modify AtC boundary_dynamics
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC boundary_dynamics < on | damped_harmonic | prescribed | coupled | none > [args] \n
|
fix_modify AtC boundary_dynamics < on | damped_harmonic | prescribed | coupled | none > [args] \n
|
||||||
|
@ -91,7 +91,7 @@ namespace ATC {
|
||||||
gamma_.push_back(atof(arg[argIndex++]));
|
gamma_.push_back(atof(arg[argIndex++]));
|
||||||
mu_.push_back(atof(arg[argIndex++]));
|
mu_.push_back(atof(arg[argIndex++]));
|
||||||
}
|
}
|
||||||
|
|
||||||
boundaryDynamics_ = DAMPED_LAYERS;
|
boundaryDynamics_ = DAMPED_LAYERS;
|
||||||
needReset_ = true;
|
needReset_ = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -123,7 +123,7 @@ namespace ATC {
|
||||||
ghostModifier_ = new GhostModifier(this);
|
ghostModifier_ = new GhostModifier(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (boundaryDynamics_) {
|
switch (boundaryDynamics_) {
|
||||||
case VERLET: {
|
case VERLET: {
|
||||||
ghostModifier_ = new GhostModifier(this);
|
ghostModifier_ = new GhostModifier(this);
|
||||||
|
@ -175,7 +175,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// construct_transfers
|
// construct_transfers
|
||||||
// sets/constructs all required dependency managed data
|
// sets/constructs all required dependency managed data
|
||||||
|
@ -184,7 +184,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
ghostModifier_->construct_transfers();
|
ghostModifier_->construct_transfers();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// initialize
|
// initialize
|
||||||
// initialize all data and variables before a run
|
// initialize all data and variables before a run
|
||||||
|
@ -204,7 +204,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
ghostModifier_->pre_exchange();
|
ghostModifier_->pre_exchange();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// initial_integrate_velocity
|
// initial_integrate_velocity
|
||||||
// velocity update in first part of velocity-verlet
|
// velocity update in first part of velocity-verlet
|
||||||
|
@ -213,7 +213,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
ghostModifier_->init_integrate_velocity(dt);
|
ghostModifier_->init_integrate_velocity(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// initial_integrate_position
|
// initial_integrate_position
|
||||||
// position update in first part of velocity-verlet
|
// position update in first part of velocity-verlet
|
||||||
|
@ -246,7 +246,7 @@ namespace ATC {
|
||||||
// Class GhostModifier
|
// Class GhostModifier
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -291,7 +291,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
atomTimeIntegrator_->init_integrate_velocity(dt);
|
atomTimeIntegrator_->init_integrate_velocity(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// initial_integrate_position
|
// initial_integrate_position
|
||||||
// position update in first part of velocity-verlet
|
// position update in first part of velocity-verlet
|
||||||
|
@ -315,7 +315,7 @@ namespace ATC {
|
||||||
// Class GhostModifierPrescribed
|
// Class GhostModifierPrescribed
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -353,10 +353,10 @@ namespace ATC {
|
||||||
atomShapeFunctions,
|
atomShapeFunctions,
|
||||||
GHOST);
|
GHOST);
|
||||||
interscaleManager.add_per_atom_quantity(atomFeDisplacement_,field_to_prolongation_name(DISPLACEMENT)+"Ghost");
|
interscaleManager.add_per_atom_quantity(atomFeDisplacement_,field_to_prolongation_name(DISPLACEMENT)+"Ghost");
|
||||||
|
|
||||||
atomRefPositions_ = interscaleManager.per_atom_quantity("AtomicGhostCoarseGrainingPositions");
|
atomRefPositions_ = interscaleManager.per_atom_quantity("AtomicGhostCoarseGrainingPositions");
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// post_init_integrate
|
// post_init_integrate
|
||||||
// after integration, fix ghost atoms' positions
|
// after integration, fix ghost atoms' positions
|
||||||
|
@ -373,7 +373,7 @@ namespace ATC {
|
||||||
// Class GhostModifierDampedHarmonic
|
// Class GhostModifierDampedHarmonic
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -399,7 +399,7 @@ namespace ATC {
|
||||||
void GhostModifierDampedHarmonic::construct_transfers()
|
void GhostModifierDampedHarmonic::construct_transfers()
|
||||||
{
|
{
|
||||||
GhostModifierPrescribed::construct_transfers();
|
GhostModifierPrescribed::construct_transfers();
|
||||||
|
|
||||||
InterscaleManager & interscaleManager((ghostManager_->atc())->interscale_manager());
|
InterscaleManager & interscaleManager((ghostManager_->atc())->interscale_manager());
|
||||||
atomVelocities_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_VELOCITY,GHOST);
|
atomVelocities_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_VELOCITY,GHOST);
|
||||||
atomForces_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE,GHOST);
|
atomForces_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE,GHOST);
|
||||||
|
@ -431,7 +431,7 @@ namespace ATC {
|
||||||
atomTimeIntegrator_->init_integrate_velocity(dt);
|
atomTimeIntegrator_->init_integrate_velocity(dt);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// initial_integrate_position
|
// initial_integrate_position
|
||||||
// position update in first part of velocity-verlet
|
// position update in first part of velocity-verlet
|
||||||
|
@ -477,7 +477,7 @@ namespace ATC {
|
||||||
// Class GhostModifierDampedHarmonicLayers
|
// Class GhostModifierDampedHarmonicLayers
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -489,7 +489,7 @@ namespace ATC {
|
||||||
ghostToBoundaryDistance_(nullptr),
|
ghostToBoundaryDistance_(nullptr),
|
||||||
layerId_(nullptr)
|
layerId_(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ namespace ATC {
|
||||||
void GhostModifierDampedHarmonicLayers::construct_transfers()
|
void GhostModifierDampedHarmonicLayers::construct_transfers()
|
||||||
{
|
{
|
||||||
GhostModifierDampedHarmonic::construct_transfers();
|
GhostModifierDampedHarmonic::construct_transfers();
|
||||||
|
|
||||||
InterscaleManager & interscaleManager((ghostManager_->atc())->interscale_manager());
|
InterscaleManager & interscaleManager((ghostManager_->atc())->interscale_manager());
|
||||||
|
|
||||||
// transfer for distance to boundary
|
// transfer for distance to boundary
|
||||||
|
@ -529,14 +529,14 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// find atomic mononlayers
|
// find atomic mononlayers
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
bool compare( pair<int,double> a, pair<int,double> b) {
|
bool compare( pair<int,double> a, pair<int,double> b) {
|
||||||
return (a.second < b.second);
|
return (a.second < b.second);
|
||||||
}
|
}
|
||||||
int GhostModifierDampedHarmonicLayers::find_layers()
|
int GhostModifierDampedHarmonicLayers::find_layers()
|
||||||
{
|
{
|
||||||
DENS_MAT & d(ghostToBoundaryDistance_->set_quantity());
|
DENS_MAT & d(ghostToBoundaryDistance_->set_quantity());
|
||||||
DenseMatrix<int> & ids = layerId_->set_quantity();
|
DenseMatrix<int> & ids = layerId_->set_quantity();
|
||||||
|
|
||||||
// get distances for every ghost atom for sorting
|
// get distances for every ghost atom for sorting
|
||||||
// size arrays of length number of processors
|
// size arrays of length number of processors
|
||||||
int commSize = LammpsInterface::instance()->comm_size();
|
int commSize = LammpsInterface::instance()->comm_size();
|
||||||
|
@ -608,7 +608,7 @@ namespace ATC {
|
||||||
ATC::LammpsInterface::instance()->print_msg_once(msg.str());
|
ATC::LammpsInterface::instance()->print_msg_once(msg.str());
|
||||||
return nlayers;
|
return nlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// compute distances to boundary faces
|
// compute distances to boundary faces
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -640,7 +640,7 @@ namespace ATC {
|
||||||
feMesh->face_connectivity_unique(PAIR(elt,face),faceNodes);
|
feMesh->face_connectivity_unique(PAIR(elt,face),faceNodes);
|
||||||
|
|
||||||
// identify the boundary face by the face which contains only boundary nodes
|
// identify the boundary face by the face which contains only boundary nodes
|
||||||
isBoundaryFace = true;
|
isBoundaryFace = true;
|
||||||
for (int i = 0; i < faceNodes.size(); ++i) {
|
for (int i = 0; i < faceNodes.size(); ++i) {
|
||||||
if (nodeType(faceNodes(i),0) != BOUNDARY) {
|
if (nodeType(faceNodes(i),0) != BOUNDARY) {
|
||||||
isBoundaryFace = false;
|
isBoundaryFace = false;
|
||||||
|
@ -665,7 +665,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
centroid *= -1./double(nfe); // -1 gets outward normal from ATC region => all distances should be > 0
|
centroid *= -1./double(nfe); // -1 gets outward normal from ATC region => all distances should be > 0
|
||||||
|
|
||||||
// for each boundary face get the normal
|
// for each boundary face get the normal
|
||||||
// ASSUMES all faces are planar
|
// ASSUMES all faces are planar
|
||||||
feMesh->face_normal(PAIR(elt,face),0,normal);
|
feMesh->face_normal(PAIR(elt,face),0,normal);
|
||||||
|
@ -692,7 +692,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// final_integrate
|
// final_integrate
|
||||||
// velocity update in second part of velocity-verlet
|
// velocity update in second part of velocity-verlet
|
||||||
|
@ -723,7 +723,7 @@ namespace ATC {
|
||||||
// Class GhostIntegratorVerletSwap
|
// Class GhostIntegratorVerletSwap
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace ATC {
|
||||||
/** types of ghost boundary conditions in momentum */
|
/** types of ghost boundary conditions in momentum */
|
||||||
enum BoundaryDynamicsType {
|
enum BoundaryDynamicsType {
|
||||||
NO_BOUNDARY_DYNAMICS=0,
|
NO_BOUNDARY_DYNAMICS=0,
|
||||||
VERLET, // performs velocity-verlet
|
VERLET, // performs velocity-verlet
|
||||||
PRESCRIBED, // forces ghost locations to conform to interpolated finite element locations
|
PRESCRIBED, // forces ghost locations to conform to interpolated finite element locations
|
||||||
DAMPED_HARMONIC, // turns ghost atoms into spring-mass-dashpot systems
|
DAMPED_HARMONIC, // turns ghost atoms into spring-mass-dashpot systems
|
||||||
DAMPED_LAYERS, // oer layer DAMPED_HARMONIC
|
DAMPED_LAYERS, // oer layer DAMPED_HARMONIC
|
||||||
|
@ -113,7 +113,7 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GhostModifier {
|
class GhostModifier {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -171,7 +171,7 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GhostModifierPrescribed : public GhostModifier {
|
class GhostModifierPrescribed : public GhostModifier {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -210,7 +210,7 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GhostModifierDampedHarmonic : public GhostModifierPrescribed {
|
class GhostModifierDampedHarmonic : public GhostModifierPrescribed {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -276,7 +276,7 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GhostModifierDampedHarmonicLayers : public GhostModifierDampedHarmonic {
|
class GhostModifierDampedHarmonicLayers : public GhostModifierDampedHarmonic {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -308,7 +308,7 @@ namespace ATC {
|
||||||
// data
|
// data
|
||||||
/** distance from all ghost atoms to boundary, i.e. boundary face of containing element */
|
/** distance from all ghost atoms to boundary, i.e. boundary face of containing element */
|
||||||
PerAtomQuantity<double> * ghostToBoundaryDistance_;
|
PerAtomQuantity<double> * ghostToBoundaryDistance_;
|
||||||
|
|
||||||
/** layer id for ghost atoms */
|
/** layer id for ghost atoms */
|
||||||
PerAtomQuantity<int> * layerId_;
|
PerAtomQuantity<int> * layerId_;
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ namespace ATC {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class GhostIntegratorSwap : public GhostModifier {
|
class GhostIntegratorSwap : public GhostModifier {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -355,7 +355,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** internal to element map */
|
/** internal to element map */
|
||||||
PerAtomQuantity<int> * atomElement_;
|
PerAtomQuantity<int> * atomElement_;
|
||||||
|
|
||||||
/** ghost to element map */
|
/** ghost to element map */
|
||||||
PerAtomQuantity<int> * atomGhostElement_;
|
PerAtomQuantity<int> * atomGhostElement_;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ ImplicitSolveOperator::operator * (const DENS_VEC & x) const
|
||||||
// fast field. In brief, if the ODE for the fast field can be written:
|
// fast field. In brief, if the ODE for the fast field can be written:
|
||||||
//
|
//
|
||||||
// dx/dt = R(x)
|
// dx/dt = R(x)
|
||||||
//
|
//
|
||||||
// A generalized discretization can be written:
|
// A generalized discretization can be written:
|
||||||
//
|
//
|
||||||
// 1/dt * (x^n+1 - x^n) = alpha * R(x^n+1) + (1-alpha) * R(x^n)
|
// 1/dt * (x^n+1 - x^n) = alpha * R(x^n+1) + (1-alpha) * R(x^n)
|
||||||
|
@ -120,14 +120,14 @@ FieldImplicitSolveOperator(ATC_Coupling * atc,
|
||||||
int nNodes = f.nRows();
|
int nNodes = f.nRows();
|
||||||
set<int> fixedNodes_ = atc_->prescribed_data_manager()->fixed_nodes(fieldName_);
|
set<int> fixedNodes_ = atc_->prescribed_data_manager()->fixed_nodes(fieldName_);
|
||||||
n_ = nNodes;
|
n_ = nNodes;
|
||||||
vector<bool> tag(nNodes);
|
vector<bool> tag(nNodes);
|
||||||
set<int>::const_iterator it; int i = 0;
|
set<int>::const_iterator it; int i = 0;
|
||||||
for (i = 0; i < nNodes; ++i) { tag[i] = true; }
|
for (i = 0; i < nNodes; ++i) { tag[i] = true; }
|
||||||
for (it=fixedNodes_.begin();it!=fixedNodes_.end();++it) {tag[*it]=false;}
|
for (it=fixedNodes_.begin();it!=fixedNodes_.end();++it) {tag[*it]=false;}
|
||||||
int m = 0;
|
int m = 0;
|
||||||
for (i = 0; i < nNodes; ++i) { if (tag[i]) freeNodes_[i]= m++; }
|
for (i = 0; i < nNodes; ++i) { if (tag[i]) freeNodes_[i]= m++; }
|
||||||
//std::cout << " nodes " << n_ << " " << nNodes << "\n";
|
//std::cout << " nodes " << n_ << " " << nNodes << "\n";
|
||||||
|
|
||||||
// Save current field
|
// Save current field
|
||||||
x0_.reset(n_);
|
x0_.reset(n_);
|
||||||
to_free(f,x0_);
|
to_free(f,x0_);
|
||||||
|
@ -143,7 +143,7 @@ FieldImplicitSolveOperator(ATC_Coupling * atc,
|
||||||
massMask_.reset(1);
|
massMask_.reset(1);
|
||||||
massMask_(0) = fieldName_;
|
massMask_(0) = fieldName_;
|
||||||
rhs_[fieldName_].reset(nNodes,dof_);
|
rhs_[fieldName_].reset(nNodes,dof_);
|
||||||
// Compute the RHS vector R(T^n)
|
// Compute the RHS vector R(T^n)
|
||||||
R0_.reset(n_);
|
R0_.reset(n_);
|
||||||
R_ .reset(n_);
|
R_ .reset(n_);
|
||||||
R(x0_, R0_);
|
R(x0_, R0_);
|
||||||
|
@ -163,7 +163,7 @@ void FieldImplicitSolveOperator::to_free(const MATRIX &r, VECTOR &v) const
|
||||||
v(i) = r(i,0);
|
v(i) = r(i,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
FieldImplicitSolveOperator::R(const DENS_VEC &x, DENS_VEC &v ) const
|
FieldImplicitSolveOperator::R(const DENS_VEC &x, DENS_VEC &v ) const
|
||||||
{
|
{
|
||||||
DENS_MAT & f = fields_[fieldName_].set_quantity();
|
DENS_MAT & f = fields_[fieldName_].set_quantity();
|
||||||
|
@ -192,7 +192,7 @@ void FieldImplicitSolveOperator::solution(const DENS_MAT & dx, DENS_MAT &f) cons
|
||||||
}
|
}
|
||||||
void FieldImplicitSolveOperator::rhs(const DENS_MAT & r, DENS_MAT &rhs) const
|
void FieldImplicitSolveOperator::rhs(const DENS_MAT & r, DENS_MAT &rhs) const
|
||||||
{
|
{
|
||||||
|
|
||||||
to_all(column(r,0),rhs);
|
to_all(column(r,0),rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ImplicitSolveOperator {
|
||||||
mutable DENS_VEC R_; // condensed current
|
mutable DENS_VEC R_; // condensed current
|
||||||
double dt_; // timestep
|
double dt_; // timestep
|
||||||
double alpha_; // implicit/explicit parameter (0 -> explicit, else implicit)
|
double alpha_; // implicit/explicit parameter (0 -> explicit, else implicit)
|
||||||
double epsilon0_; // small parameter to compute increment
|
double epsilon0_; // small parameter to compute increment
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace ATC{
|
||||||
{
|
{
|
||||||
prefix_ = (atc_->lammps_interface())->fix_id() + prefix_;
|
prefix_ = (atc_->lammps_interface())->fix_id() + prefix_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Destructor
|
// Destructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -155,7 +155,7 @@ namespace ATC{
|
||||||
int myIndex = index;
|
int myIndex = index;
|
||||||
set<DependencyManager * >::iterator it;
|
set<DependencyManager * >::iterator it;
|
||||||
bool isTemporary = (quantity->memory_type()==TEMPORARY);
|
bool isTemporary = (quantity->memory_type()==TEMPORARY);
|
||||||
|
|
||||||
for (it = (quantity->dependentQuantities_).begin(); it != (quantity->dependentQuantities_).end(); it++) {
|
for (it = (quantity->dependentQuantities_).begin(); it != (quantity->dependentQuantities_).end(); it++) {
|
||||||
// make sure that if quantity isn't persistent, none of it's dependencies are
|
// make sure that if quantity isn't persistent, none of it's dependencies are
|
||||||
if ((*it)->memory_type()==PERSISTENT && isTemporary) {
|
if ((*it)->memory_type()==PERSISTENT && isTemporary) {
|
||||||
|
@ -454,7 +454,7 @@ namespace ATC{
|
||||||
{
|
{
|
||||||
// REFACTOR add check for duplicate entries
|
// REFACTOR add check for duplicate entries
|
||||||
DependencyManager * quantity = nullptr;
|
DependencyManager * quantity = nullptr;
|
||||||
|
|
||||||
quantity = find_in_list(perAtomQuantities_,tag);
|
quantity = find_in_list(perAtomQuantities_,tag);
|
||||||
if (quantity) return quantity;
|
if (quantity) return quantity;
|
||||||
quantity = find_in_list(perAtomIntQuantities_,tag);
|
quantity = find_in_list(perAtomIntQuantities_,tag);
|
||||||
|
@ -613,7 +613,7 @@ namespace ATC{
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// pack_comm
|
// pack_comm
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
int InterscaleManager::pack_comm(int index, double *buf,
|
int InterscaleManager::pack_comm(int index, double *buf,
|
||||||
int pbc_flag, int *pbc)
|
int pbc_flag, int *pbc)
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
|
@ -35,12 +35,12 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
class InterscaleManager {
|
class InterscaleManager {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
InterscaleManager(ATC_Method * atc);
|
InterscaleManager(ATC_Method * atc);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
~InterscaleManager();
|
~InterscaleManager();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** set lammps data prefix */
|
/** set lammps data prefix */
|
||||||
void set_lammps_data_prefix();
|
void set_lammps_data_prefix();
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
bool modify(int narg, char **arg);
|
bool modify(int narg, char **arg);
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ namespace ATC {
|
||||||
int unpack_exchange(int i, double *buffer);
|
int unpack_exchange(int i, double *buffer);
|
||||||
|
|
||||||
/** packs up data for parallel transfer to ghost atoms on other processors */
|
/** packs up data for parallel transfer to ghost atoms on other processors */
|
||||||
int pack_comm(int index, double *buf,
|
int pack_comm(int index, double *buf,
|
||||||
int pbc_flag, int *pbc);
|
int pbc_flag, int *pbc);
|
||||||
|
|
||||||
/** unpacks data after parallel transfer to ghost atoms on other processors */
|
/** unpacks data after parallel transfer to ghost atoms on other processors */
|
||||||
|
@ -196,7 +196,7 @@ namespace ATC {
|
||||||
void copy_arrays(int i, int j);
|
void copy_arrays(int i, int j);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** pointer to access ATC methods */
|
/** pointer to access ATC methods */
|
||||||
ATC_Method * atc_;
|
ATC_Method * atc_;
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** helper function to pack arrays of all data in a list, only valid with comm lists */
|
/** helper function to pack arrays of all data in a list, only valid with comm lists */
|
||||||
template <typename data>
|
template <typename data>
|
||||||
void pack_comm_loop(std::vector<data * > & list, int & size, int index, double *buf,
|
void pack_comm_loop(std::vector<data * > & list, int & size, int index, double *buf,
|
||||||
int pbc_flag, int *pbc)
|
int pbc_flag, int *pbc)
|
||||||
{
|
{
|
||||||
for (typename std::vector<data* >::iterator it = list.begin(); it != list.end(); ++it)
|
for (typename std::vector<data* >::iterator it = list.begin(); it != list.end(); ++it)
|
||||||
|
@ -455,9 +455,9 @@ namespace ATC {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
InterscaleManager();
|
InterscaleManager();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
KD_Tree *KD_Tree::create_KD_tree(const int nNodesPerElem, const int nNodes,
|
KD_Tree *KD_Tree::create_KD_tree(const int nNodesPerElem, const int nNodes,
|
||||||
const DENS_MAT *nodalCoords, const int nElems,
|
const DENS_MAT *nodalCoords, const int nElems,
|
||||||
const Array2D<int> &conn) {
|
const Array2D<int> &conn) {
|
||||||
vector<Node> *points = new vector<Node>(); // Initialize an empty list of Nodes
|
vector<Node> *points = new vector<Node>(); // Initialize an empty list of Nodes
|
||||||
for (int node = 0; node < nNodes; node++) { // Insert all nodes into list
|
for (int node = 0; node < nNodes; node++) { // Insert all nodes into list
|
||||||
|
@ -30,7 +30,7 @@ KD_Tree::~KD_Tree() {
|
||||||
delete rightChild_;
|
delete rightChild_;
|
||||||
}
|
}
|
||||||
|
|
||||||
KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
|
KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
|
||||||
int dimension)
|
int dimension)
|
||||||
: candElems_(elements) {
|
: candElems_(elements) {
|
||||||
// Set up comparison functions
|
// Set up comparison functions
|
||||||
|
@ -44,14 +44,14 @@ KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort points by their coordinate in the current dimension
|
// Sort points by their coordinate in the current dimension
|
||||||
sort(points->begin(), points->end(), compare);
|
sort(points->begin(), points->end(), compare);
|
||||||
sortedPts_ = points;
|
sortedPts_ = points;
|
||||||
|
|
||||||
// Pick the median point as the root of the tree
|
// Pick the median point as the root of the tree
|
||||||
size_t nNodes = points->size();
|
size_t nNodes = points->size();
|
||||||
size_t med = nNodes/2;
|
size_t med = nNodes/2;
|
||||||
value_ = (*sortedPts_)[med];
|
value_ = (*sortedPts_)[med];
|
||||||
|
|
||||||
// Recursively construct the left sub-tree
|
// Recursively construct the left sub-tree
|
||||||
vector<Node> *leftPts = new vector<Node>;
|
vector<Node> *leftPts = new vector<Node>;
|
||||||
vector<Elem> *leftElems = new vector<Elem>;
|
vector<Elem> *leftElems = new vector<Elem>;
|
||||||
|
@ -103,8 +103,8 @@ KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
|
||||||
|
|
||||||
vector<int> KD_Tree::find_nearest_elements(Node query, int dimension) {
|
vector<int> KD_Tree::find_nearest_elements(Node query, int dimension) {
|
||||||
// if the root coordinate is less than the query coordinate
|
// if the root coordinate is less than the query coordinate
|
||||||
|
|
||||||
|
|
||||||
// If the query point is less that the value (split) point of this
|
// If the query point is less that the value (split) point of this
|
||||||
// tree, either recurse to the left or return this node's elements
|
// tree, either recurse to the left or return this node's elements
|
||||||
// if there is no left child.
|
// if there is no left child.
|
||||||
|
@ -132,10 +132,10 @@ vector<int> KD_Tree::find_nearest_elements(Node query, int dimension) {
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<vector<int> > KD_Tree::getElemIDs(int depth) {
|
vector<vector<int> > KD_Tree::getElemIDs(int depth) {
|
||||||
|
|
||||||
vector<vector<int> > result;
|
vector<vector<int> > result;
|
||||||
vector<vector<int> > temp;
|
vector<vector<int> > temp;
|
||||||
|
|
||||||
assert(depth >= 0 );
|
assert(depth >= 0 );
|
||||||
if (depth == 0) {
|
if (depth == 0) {
|
||||||
vector<int> candElemIDs;
|
vector<int> candElemIDs;
|
||||||
|
@ -164,6 +164,6 @@ vector<vector<int> > KD_Tree::getElemIDs(int depth) {
|
||||||
temp = rightChild_->getElemIDs(depth);
|
temp = rightChild_->getElemIDs(depth);
|
||||||
result.insert(result.end(), temp.begin(), temp.end());
|
result.insert(result.end(), temp.begin(), temp.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Node {
|
||||||
// Zero argument constructor just for default initialization.
|
// Zero argument constructor just for default initialization.
|
||||||
}
|
}
|
||||||
|
|
||||||
Node(int node, double x, double y, double z)
|
Node(int node, double x, double y, double z)
|
||||||
: index_(node)
|
: index_(node)
|
||||||
{
|
{
|
||||||
coords_[0] = x;
|
coords_[0] = x;
|
||||||
|
@ -26,8 +26,8 @@ class Node {
|
||||||
double coords_[3];
|
double coords_[3];
|
||||||
|
|
||||||
double distanceSquared(Node query) {
|
double distanceSquared(Node query) {
|
||||||
return pow(coords_[0] - query.coords_[0], 2)
|
return pow(coords_[0] - query.coords_[0], 2)
|
||||||
+ pow(coords_[1] - query.coords_[1], 2)
|
+ pow(coords_[1] - query.coords_[1], 2)
|
||||||
+ pow(coords_[2] - query.coords_[2], 2);
|
+ pow(coords_[2] - query.coords_[2], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ typedef std::pair<int,std::vector<Node> > Elem;
|
||||||
|
|
||||||
class KD_Tree {
|
class KD_Tree {
|
||||||
public:
|
public:
|
||||||
static KD_Tree* create_KD_tree(const int nNodesPerElement, const int nNodes,
|
static KD_Tree* create_KD_tree(const int nNodesPerElement, const int nNodes,
|
||||||
const DENS_MAT *points, const int nElems,
|
const DENS_MAT *points, const int nElems,
|
||||||
const Array2D<int> &conn);
|
const Array2D<int> &conn);
|
||||||
|
|
||||||
KD_Tree(std::vector<Node> *points, std::vector<Elem> *elems,
|
KD_Tree(std::vector<Node> *points, std::vector<Elem> *elems,
|
||||||
|
@ -67,13 +67,13 @@ class KD_Tree {
|
||||||
|
|
||||||
~KD_Tree();
|
~KD_Tree();
|
||||||
|
|
||||||
std::vector<int> find_nearest(DENS_VEC query) {
|
std::vector<int> find_nearest(DENS_VEC query) {
|
||||||
// Create a fake Node and find the nearest Node in the tree to it.
|
// Create a fake Node and find the nearest Node in the tree to it.
|
||||||
return find_nearest_elements(Node(-1, query(0), query(1), query(2)));
|
return find_nearest_elements(Node(-1, query(0), query(1), query(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> find_nearest_elements(Node query, int dimension=0);
|
std::vector<int> find_nearest_elements(Node query, int dimension=0);
|
||||||
|
|
||||||
std::vector<std::vector<int> > getElemIDs(int depth);
|
std::vector<std::vector<int> > getElemIDs(int depth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -11,12 +11,12 @@ using namespace ATC_Utility;
|
||||||
|
|
||||||
static const double tol = 1.0e-8;
|
static const double tol = 1.0e-8;
|
||||||
|
|
||||||
static const int line_ngauss = 10;
|
static const int line_ngauss = 10;
|
||||||
static double line_xg[line_ngauss], line_wg[line_ngauss];
|
static double line_xg[line_ngauss], line_wg[line_ngauss];
|
||||||
|
|
||||||
namespace ATC {
|
namespace ATC {
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// KernelFunctionMgr
|
// KernelFunctionMgr
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
@ -36,10 +36,10 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
KernelFunction* KernelFunctionMgr::function(char ** arg, int narg)
|
KernelFunction* KernelFunctionMgr::function(char ** arg, int narg)
|
||||||
{
|
{
|
||||||
/*! \page man_kernel_function fix_modify AtC kernel
|
/*! \page man_kernel_function fix_modify AtC kernel
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC kernel <type> <parameters>
|
fix_modify AtC kernel <type> <parameters>
|
||||||
- type (keyword) = step, cell, cubic_bar, cubic_cylinder, cubic_sphere,
|
- type (keyword) = step, cell, cubic_bar, cubic_cylinder, cubic_sphere,
|
||||||
quartic_bar, quartic_cylinder, quartic_sphere \n
|
quartic_bar, quartic_cylinder, quartic_sphere \n
|
||||||
- parameters :\n
|
- parameters :\n
|
||||||
step = radius (double) \n
|
step = radius (double) \n
|
||||||
|
@ -54,7 +54,7 @@ namespace ATC {
|
||||||
fix_modify AtC kernel cell 1.0 1.0 1.0
|
fix_modify AtC kernel cell 1.0 1.0 1.0
|
||||||
fix_modify AtC kernel quartic_sphere 10.0
|
fix_modify AtC kernel quartic_sphere 10.0
|
||||||
\section description
|
\section description
|
||||||
|
|
||||||
\section restrictions
|
\section restrictions
|
||||||
Must be used with the hardy AtC fix \n
|
Must be used with the hardy AtC fix \n
|
||||||
For bar kernel types, half-width oriented along x-direction \n
|
For bar kernel types, half-width oriented along x-direction \n
|
||||||
|
@ -80,11 +80,11 @@ namespace ATC {
|
||||||
ptr = new KernelFunctionCell(2,parameters);
|
ptr = new KernelFunctionCell(2,parameters);
|
||||||
}
|
}
|
||||||
else if (strcmp(type,"cubic_bar")==0) {
|
else if (strcmp(type,"cubic_bar")==0) {
|
||||||
double parameters[1] = {atof(arg[argIdx])}; // cutoff half-length
|
double parameters[1] = {atof(arg[argIdx])}; // cutoff half-length
|
||||||
ptr = new KernelFunctionCubicBar(1,parameters);
|
ptr = new KernelFunctionCubicBar(1,parameters);
|
||||||
}
|
}
|
||||||
else if (strcmp(type,"linear_bar")==0) {
|
else if (strcmp(type,"linear_bar")==0) {
|
||||||
double parameters[1] = {atof(arg[argIdx])}; // cutoff half-length
|
double parameters[1] = {atof(arg[argIdx])}; // cutoff half-length
|
||||||
ptr = new KernelFunctionLinearBar(1,parameters);
|
ptr = new KernelFunctionLinearBar(1,parameters);
|
||||||
}
|
}
|
||||||
else if (strcmp(type,"cubic_cylinder")==0) {
|
else if (strcmp(type,"cubic_cylinder")==0) {
|
||||||
|
@ -96,7 +96,7 @@ namespace ATC {
|
||||||
ptr = new KernelFunctionCubicSphere(1,parameters);
|
ptr = new KernelFunctionCubicSphere(1,parameters);
|
||||||
}
|
}
|
||||||
else if (strcmp(type,"quartic_bar")==0) {
|
else if (strcmp(type,"quartic_bar")==0) {
|
||||||
double parameters[1] = {atof(arg[argIdx])}; // cutoff half-length
|
double parameters[1] = {atof(arg[argIdx])}; // cutoff half-length
|
||||||
ptr = new KernelFunctionQuarticBar(1,parameters);
|
ptr = new KernelFunctionQuarticBar(1,parameters);
|
||||||
}
|
}
|
||||||
else if (strcmp(type,"quartic_cylinder")==0) {
|
else if (strcmp(type,"quartic_cylinder")==0) {
|
||||||
|
@ -126,7 +126,7 @@ namespace ATC {
|
||||||
KernelFunction::KernelFunction(int /* nparameters */, double* parameters):
|
KernelFunction::KernelFunction(int /* nparameters */, double* parameters):
|
||||||
Rc_(0),invRc_(0),nsd_(3),
|
Rc_(0),invRc_(0),nsd_(3),
|
||||||
lammpsInterface_(LammpsInterface::instance())
|
lammpsInterface_(LammpsInterface::instance())
|
||||||
{
|
{
|
||||||
Rc_ = parameters[0];
|
Rc_ = parameters[0];
|
||||||
invRc_ = 1.0/Rc_;
|
invRc_ = 1.0/Rc_;
|
||||||
Rc_ = parameters[0];
|
Rc_ = parameters[0];
|
||||||
|
@ -142,8 +142,8 @@ namespace ATC {
|
||||||
box_bounds[0][1],box_bounds[1][1],
|
box_bounds[0][1],box_bounds[1][1],
|
||||||
box_bounds[0][2],box_bounds[1][2]);
|
box_bounds[0][2],box_bounds[1][2]);
|
||||||
for (int k = 0; k < 3; k++) {
|
for (int k = 0; k < 3; k++) {
|
||||||
box_length[k] = box_bounds[1][k] - box_bounds[0][k];
|
box_length[k] = box_bounds[1][k] - box_bounds[0][k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// does an input node's kernel intersect bonds on this processor
|
// does an input node's kernel intersect bonds on this processor
|
||||||
|
@ -160,7 +160,7 @@ namespace ATC {
|
||||||
if (i < nsd_) {
|
if (i < nsd_) {
|
||||||
kernel_bounds[0][i] -= (Rc_+lammpsInterface_->pair_cutoff());
|
kernel_bounds[0][i] -= (Rc_+lammpsInterface_->pair_cutoff());
|
||||||
kernel_bounds[1][i] += (Rc_+lammpsInterface_->pair_cutoff());
|
kernel_bounds[1][i] += (Rc_+lammpsInterface_->pair_cutoff());
|
||||||
contributes = contributes && (node(i) >= kernel_bounds[0][i])
|
contributes = contributes && (node(i) >= kernel_bounds[0][i])
|
||||||
&& (node(i) < kernel_bounds[1][i]);
|
&& (node(i) < kernel_bounds[1][i]);
|
||||||
if (periodicity[i]) {
|
if (periodicity[i]) {
|
||||||
if (node[i] <= box_bounds[0][i] + box_length[i]/2) {
|
if (node[i] <= box_bounds[0][i] + box_length[i]/2) {
|
||||||
|
@ -168,8 +168,8 @@ namespace ATC {
|
||||||
} else {
|
} else {
|
||||||
ghostNode[i] -= box_length[i];
|
ghostNode[i] -= box_length[i];
|
||||||
}
|
}
|
||||||
ghostContributes = ghostContributes
|
ghostContributes = ghostContributes
|
||||||
&& ((ghostNode(i) >= kernel_bounds[0][i]) ||
|
&& ((ghostNode(i) >= kernel_bounds[0][i]) ||
|
||||||
(node(i) >= kernel_bounds[0][i]))
|
(node(i) >= kernel_bounds[0][i]))
|
||||||
&& ((ghostNode(i) < kernel_bounds[1][i]) ||
|
&& ((ghostNode(i) < kernel_bounds[1][i]) ||
|
||||||
(node(i) < kernel_bounds[1][i]));
|
(node(i) < kernel_bounds[1][i]));
|
||||||
|
@ -202,12 +202,12 @@ namespace ATC {
|
||||||
return 0.5*(lam2-lam1)*bhsum;
|
return 0.5*(lam2-lam1)*bhsum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// localization-volume intercepts for bond calculation
|
// localization-volume intercepts for bond calculation
|
||||||
// bond intercept values assuming spherical support
|
// bond intercept values assuming spherical support
|
||||||
void KernelFunction::bond_intercepts(DENS_VEC& xa,
|
void KernelFunction::bond_intercepts(DENS_VEC& xa,
|
||||||
DENS_VEC& xb, double &lam1, double &lam2) const
|
DENS_VEC& xb, double &lam1, double &lam2) const
|
||||||
{
|
{
|
||||||
if (nsd_ == 2) {// for cylinders, axis is always z!
|
if (nsd_ == 2) {// for cylinders, axis is always z!
|
||||||
const int iaxis = 2;
|
const int iaxis = 2;
|
||||||
xa[iaxis] = 0.0;
|
xa[iaxis] = 0.0;
|
||||||
xb[iaxis] = 0.0;
|
xb[iaxis] = 0.0;
|
||||||
|
@ -223,8 +223,8 @@ namespace ATC {
|
||||||
bool a_in = (ra_n <= 1.0);
|
bool a_in = (ra_n <= 1.0);
|
||||||
bool b_in = (rb_n <= 1.0);
|
bool b_in = (rb_n <= 1.0);
|
||||||
if (a_in && b_in) {
|
if (a_in && b_in) {
|
||||||
lam1 = 0.0;
|
lam1 = 0.0;
|
||||||
lam2 = 1.0;
|
lam2 = 1.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DENS_VEC xab = xa - xb;
|
DENS_VEC xab = xa - xb;
|
||||||
|
@ -240,7 +240,7 @@ namespace ATC {
|
||||||
double aux = -0.5*(b-sqrt(discrim));
|
double aux = -0.5*(b-sqrt(discrim));
|
||||||
s1 = c/aux;
|
s1 = c/aux;
|
||||||
s2 = aux/a;
|
s2 = aux/a;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
double aux = -0.5*(b+sqrt(discrim));
|
double aux = -0.5*(b+sqrt(discrim));
|
||||||
s1 = aux/a;
|
s1 = aux/a;
|
||||||
|
@ -249,15 +249,15 @@ namespace ATC {
|
||||||
if (a_in && !b_in) {
|
if (a_in && !b_in) {
|
||||||
lam1 = s1;
|
lam1 = s1;
|
||||||
lam2 = 1.0;
|
lam2 = 1.0;
|
||||||
}
|
}
|
||||||
else if (!a_in && b_in) {
|
else if (!a_in && b_in) {
|
||||||
lam1 = 0.0;
|
lam1 = 0.0;
|
||||||
lam2 = s2;
|
lam2 = s2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (s1 >= 0.0 && s2 <= 1.0) {
|
if (s1 >= 0.0 && s2 <= 1.0) {
|
||||||
lam1 = s1;
|
lam1 = s1;
|
||||||
lam2 = s2;
|
lam2 = s2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,8 +265,8 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionStep::KernelFunctionStep
|
KernelFunctionStep::KernelFunctionStep
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < nsd_; k++ ) {
|
for (int k = 0; k < nsd_; k++ ) {
|
||||||
if ((bool) periodicity[k]) {
|
if ((bool) periodicity[k]) {
|
||||||
|
@ -274,7 +274,7 @@ namespace ATC {
|
||||||
throw ATC_Error("Size of localization volume is too large for periodic boundary condition");
|
throw ATC_Error("Size of localization volume is too large for periodic boundary condition");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function value
|
// function value
|
||||||
|
@ -284,7 +284,7 @@ namespace ATC {
|
||||||
if (rn <= 1.0) { return 1.0; }
|
if (rn <= 1.0) { return 1.0; }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionStep::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
void KernelFunctionStep::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
||||||
{
|
{
|
||||||
|
@ -295,8 +295,8 @@ namespace ATC {
|
||||||
/** a step with rectangular support suitable for a rectangular grid */
|
/** a step with rectangular support suitable for a rectangular grid */
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionCell::KernelFunctionCell
|
KernelFunctionCell::KernelFunctionCell
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
hx = parameters[0];
|
hx = parameters[0];
|
||||||
hy = parameters[1];
|
hy = parameters[1];
|
||||||
|
@ -309,7 +309,7 @@ namespace ATC {
|
||||||
cellBounds_(3) = hy;
|
cellBounds_(3) = hy;
|
||||||
cellBounds_(4) = -hz;
|
cellBounds_(4) = -hz;
|
||||||
cellBounds_(5) = hz;
|
cellBounds_(5) = hz;
|
||||||
|
|
||||||
for (int k = 0; k < nsd_; k++ ) {
|
for (int k = 0; k < nsd_; k++ ) {
|
||||||
if ((bool) periodicity[k]) {
|
if ((bool) periodicity[k]) {
|
||||||
if (parameters[k] > 0.5*box_length[k]) {
|
if (parameters[k] > 0.5*box_length[k]) {
|
||||||
|
@ -332,9 +332,9 @@ namespace ATC {
|
||||||
for (int i=0; i<3; ++i) {
|
for (int i=0; i<3; ++i) {
|
||||||
kernel_bounds[0][i] -= (cellBounds_(i*2+1) +
|
kernel_bounds[0][i] -= (cellBounds_(i*2+1) +
|
||||||
lammpsInterface_->pair_cutoff());
|
lammpsInterface_->pair_cutoff());
|
||||||
kernel_bounds[1][i] += (cellBounds_(i*2+1) +
|
kernel_bounds[1][i] += (cellBounds_(i*2+1) +
|
||||||
lammpsInterface_->pair_cutoff());
|
lammpsInterface_->pair_cutoff());
|
||||||
contributes = contributes && (node(i) >= kernel_bounds[0][i])
|
contributes = contributes && (node(i) >= kernel_bounds[0][i])
|
||||||
&& (node(i) < kernel_bounds[1][i]);
|
&& (node(i) < kernel_bounds[1][i]);
|
||||||
if (periodicity[i]) {
|
if (periodicity[i]) {
|
||||||
if (node[i] <= box_bounds[0][i] + box_length[i]/2) {
|
if (node[i] <= box_bounds[0][i] + box_length[i]/2) {
|
||||||
|
@ -342,7 +342,7 @@ namespace ATC {
|
||||||
} else {
|
} else {
|
||||||
ghostNode[i] -= box_length[i];
|
ghostNode[i] -= box_length[i];
|
||||||
}
|
}
|
||||||
ghostContributes = ghostContributes
|
ghostContributes = ghostContributes
|
||||||
&& ((ghostNode(i) >= kernel_bounds[0][i]) ||
|
&& ((ghostNode(i) >= kernel_bounds[0][i]) ||
|
||||||
(node(i) >= kernel_bounds[0][i]))
|
(node(i) >= kernel_bounds[0][i]))
|
||||||
&& ((ghostNode(i) < kernel_bounds[1][i]) ||
|
&& ((ghostNode(i) < kernel_bounds[1][i]) ||
|
||||||
|
@ -367,13 +367,13 @@ namespace ATC {
|
||||||
// function value
|
// function value
|
||||||
double KernelFunctionCell::value(DENS_VEC& x_atom) const
|
double KernelFunctionCell::value(DENS_VEC& x_atom) const
|
||||||
{
|
{
|
||||||
if ((cellBounds_(0) <= x_atom(0)) && (x_atom(0) < cellBounds_(1))
|
if ((cellBounds_(0) <= x_atom(0)) && (x_atom(0) < cellBounds_(1))
|
||||||
&& (cellBounds_(2) <= x_atom(1)) && (x_atom(1) < cellBounds_(3))
|
&& (cellBounds_(2) <= x_atom(1)) && (x_atom(1) < cellBounds_(3))
|
||||||
&& (cellBounds_(4) <= x_atom(2)) && (x_atom(2) < cellBounds_(5))) {
|
&& (cellBounds_(4) <= x_atom(2)) && (x_atom(2) < cellBounds_(5))) {
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
deriv.reset(nsd_);
|
deriv.reset(nsd_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bond intercept values for rectangular region : origin is the node position
|
// bond intercept values for rectangular region : origin is the node position
|
||||||
void KernelFunctionCell::bond_intercepts(DENS_VEC& xa,
|
void KernelFunctionCell::bond_intercepts(DENS_VEC& xa,
|
||||||
DENS_VEC& xb, double &lam1, double &lam2) const
|
DENS_VEC& xb, double &lam1, double &lam2) const
|
||||||
|
@ -409,21 +409,21 @@ namespace ATC {
|
||||||
double s = (cellBounds_(2*i+j) - xb(i))/xab(i);
|
double s = (cellBounds_(2*i+j) - xb(i))/xab(i);
|
||||||
// check if between a & b
|
// check if between a & b
|
||||||
if (s >= 0 && s <= 1) {
|
if (s >= 0 && s <= 1) {
|
||||||
bool in_bounds = false;
|
bool in_bounds = false;
|
||||||
DENS_VEC x = xb + s*xab;
|
DENS_VEC x = xb + s*xab;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if ((cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))
|
if ((cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))
|
||||||
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
||||||
in_bounds = true;
|
in_bounds = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i == 1) {
|
else if (i == 1) {
|
||||||
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
||||||
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
||||||
in_bounds = true;
|
in_bounds = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i == 2) {
|
else if (i == 2) {
|
||||||
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
||||||
&& (cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))) {
|
&& (cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))) {
|
||||||
in_bounds = true;
|
in_bounds = true;
|
||||||
|
@ -436,7 +436,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw ATC_Error("logic failure in HardyKernel Cell for single intersection\n");
|
throw ATC_Error("logic failure in HardyKernel Cell for single intersection\n");
|
||||||
}
|
}
|
||||||
|
@ -455,19 +455,19 @@ namespace ATC {
|
||||||
if (s >= 0 && s <= 1) {
|
if (s >= 0 && s <= 1) {
|
||||||
// check if in face
|
// check if in face
|
||||||
DENS_VEC x = xb + s*xab;
|
DENS_VEC x = xb + s*xab;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if ((cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))
|
if ((cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))
|
||||||
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
||||||
ss[is++] = s;
|
ss[is++] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i == 1) {
|
else if (i == 1) {
|
||||||
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
||||||
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
|
||||||
ss[is++] = s;
|
ss[is++] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i == 2) {
|
else if (i == 2) {
|
||||||
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
|
||||||
&& (cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))) {
|
&& (cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))) {
|
||||||
ss[is++] = s;
|
ss[is++] = s;
|
||||||
|
@ -475,7 +475,7 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is == 1) {
|
if (is == 1) {
|
||||||
// intersection occurs at a box edge - leave lam1 = lam2
|
// intersection occurs at a box edge - leave lam1 = lam2
|
||||||
|
@ -496,8 +496,8 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionCubicSphere::KernelFunctionCubicSphere
|
KernelFunctionCubicSphere::KernelFunctionCubicSphere
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < nsd_; k++ ) {
|
for (int k = 0; k < nsd_; k++ ) {
|
||||||
if ((bool) periodicity[k]) {
|
if ((bool) periodicity[k]) {
|
||||||
|
@ -515,7 +515,7 @@ namespace ATC {
|
||||||
double rn=r/Rc_;
|
double rn=r/Rc_;
|
||||||
if (rn < 1.0) { return 5.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
|
if (rn < 1.0) { return 5.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionCubicSphere::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
void KernelFunctionCubicSphere::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
||||||
|
@ -526,8 +526,8 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionQuarticSphere::KernelFunctionQuarticSphere
|
KernelFunctionQuarticSphere::KernelFunctionQuarticSphere
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < nsd_; k++ ) {
|
for (int k = 0; k < nsd_; k++ ) {
|
||||||
if ((bool) periodicity[k]) {
|
if ((bool) periodicity[k]) {
|
||||||
|
@ -539,13 +539,13 @@ namespace ATC {
|
||||||
}
|
}
|
||||||
|
|
||||||
// function value
|
// function value
|
||||||
double KernelFunctionQuarticSphere::value(DENS_VEC& x_atom) const
|
double KernelFunctionQuarticSphere::value(DENS_VEC& x_atom) const
|
||||||
{
|
{
|
||||||
double r=x_atom.norm();
|
double r=x_atom.norm();
|
||||||
double rn=r/Rc_;
|
double rn=r/Rc_;
|
||||||
if (rn < 1.0) { return 35.0/8.0*pow((1.0-rn*rn),2); }
|
if (rn < 1.0) { return 35.0/8.0*pow((1.0-rn*rn),2); }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionQuarticSphere::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
void KernelFunctionQuarticSphere::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
||||||
|
@ -556,7 +556,7 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionCubicCyl::KernelFunctionCubicCyl
|
KernelFunctionCubicCyl::KernelFunctionCubicCyl
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
nsd_ = 2;
|
nsd_ = 2;
|
||||||
|
@ -578,7 +578,7 @@ namespace ATC {
|
||||||
double rn=r/Rc_;
|
double rn=r/Rc_;
|
||||||
if (rn < 1.0) { return 10.0/3.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
|
if (rn < 1.0) { return 10.0/3.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionCubicCyl::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
void KernelFunctionCubicCyl::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
||||||
|
@ -589,7 +589,7 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionQuarticCyl::KernelFunctionQuarticCyl
|
KernelFunctionQuarticCyl::KernelFunctionQuarticCyl
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
nsd_ = 2;
|
nsd_ = 2;
|
||||||
|
@ -611,7 +611,7 @@ namespace ATC {
|
||||||
double rn=r/Rc_;
|
double rn=r/Rc_;
|
||||||
if (rn < 1.0) { return 3.0*pow((1.0-rn*rn),2); }
|
if (rn < 1.0) { return 3.0*pow((1.0-rn*rn),2); }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionQuarticCyl::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
void KernelFunctionQuarticCyl::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
||||||
|
@ -621,7 +621,7 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionCubicBar::KernelFunctionCubicBar
|
KernelFunctionCubicBar::KernelFunctionCubicBar
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
// Note: Bar is assumed to be oriented in the x(0) direction
|
// Note: Bar is assumed to be oriented in the x(0) direction
|
||||||
|
@ -643,7 +643,7 @@ namespace ATC {
|
||||||
double rn=r/Rc_;
|
double rn=r/Rc_;
|
||||||
if (rn < 1.0) { return 2.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
|
if (rn < 1.0) { return 2.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionCubicBar::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
void KernelFunctionCubicBar::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
||||||
|
@ -654,7 +654,7 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionLinearBar::KernelFunctionLinearBar
|
KernelFunctionLinearBar::KernelFunctionLinearBar
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
// Note: Bar is assumed to be oriented in the z(0) direction
|
// Note: Bar is assumed to be oriented in the z(0) direction
|
||||||
|
@ -675,7 +675,7 @@ namespace ATC {
|
||||||
double rn=r/Rc_;
|
double rn=r/Rc_;
|
||||||
if (rn < 1.0) { return 1.0-rn; }
|
if (rn < 1.0) { return 1.0-rn; }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionLinearBar::derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const
|
void KernelFunctionLinearBar::derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const
|
||||||
|
@ -693,7 +693,7 @@ namespace ATC {
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionQuarticBar::KernelFunctionQuarticBar
|
KernelFunctionQuarticBar::KernelFunctionQuarticBar
|
||||||
(int nparameters, double* parameters):
|
(int nparameters, double* parameters):
|
||||||
KernelFunction(nparameters, parameters)
|
KernelFunction(nparameters, parameters)
|
||||||
{
|
{
|
||||||
// Note: Bar is assumed to be oriented in the x(0) direction
|
// Note: Bar is assumed to be oriented in the x(0) direction
|
||||||
|
@ -716,7 +716,7 @@ namespace ATC {
|
||||||
// if (rn < 1.0) { return 5.0/2.0*(1.0-6*rn*rn+8*rn*rn*rn-3*rn*rn*rn*rn); } - alternative quartic
|
// if (rn < 1.0) { return 5.0/2.0*(1.0-6*rn*rn+8*rn*rn*rn-3*rn*rn*rn*rn); } - alternative quartic
|
||||||
if (rn < 1.0) { return 15.0/8.0*pow((1.0-rn*rn),2); }
|
if (rn < 1.0) { return 15.0/8.0*pow((1.0-rn*rn),2); }
|
||||||
else { return 0.0; }
|
else { return 0.0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// function derivative value
|
// function derivative value
|
||||||
void KernelFunctionQuarticBar::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
void KernelFunctionQuarticBar::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace ATC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KernelFunctionMgr
|
* @class KernelFunctionMgr
|
||||||
* @brief Base class for managing kernels
|
* @brief Base class for managing kernels
|
||||||
*/
|
*/
|
||||||
class KernelFunctionMgr {
|
class KernelFunctionMgr {
|
||||||
public:
|
public:
|
||||||
/** Static instance of this class */
|
/** Static instance of this class */
|
||||||
|
@ -25,26 +25,26 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KernelFunction
|
* @class KernelFunction
|
||||||
* @brief Base class for kernels for atom-continuum transfer
|
* @brief Base class for kernels for atom-continuum transfer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KernelFunction {
|
class KernelFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunction(int nparameters, double* parameters);
|
KernelFunction(int nparameters, double* parameters);
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~KernelFunction() {};
|
virtual ~KernelFunction() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const =0 ;
|
virtual double value(DENS_VEC& x_atom) const =0 ;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const =0 ;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const =0 ;
|
||||||
// bond function value via quadrature
|
// bond function value via quadrature
|
||||||
virtual double bond(DENS_VEC& xa, DENS_VEC&xb, double lam1, double lam2) const;
|
virtual double bond(DENS_VEC& xa, DENS_VEC&xb, double lam1, double lam2) const;
|
||||||
// localization-volume intercepts for bond calculation
|
// localization-volume intercepts for bond calculation
|
||||||
virtual void bond_intercepts(DENS_VEC& xa,
|
virtual void bond_intercepts(DENS_VEC& xa,
|
||||||
DENS_VEC& xb, double &lam1, double &lam2) const;
|
DENS_VEC& xb, double &lam1, double &lam2) const;
|
||||||
virtual bool node_contributes(DENS_VEC node) const;
|
virtual bool node_contributes(DENS_VEC node) const;
|
||||||
virtual bool in_support(DENS_VEC node) const;
|
virtual bool in_support(DENS_VEC node) const;
|
||||||
|
@ -54,7 +54,7 @@ namespace ATC {
|
||||||
protected:
|
protected:
|
||||||
double invVol_; // normalization factor
|
double invVol_; // normalization factor
|
||||||
double Rc_, invRc_; // cutoff radius
|
double Rc_, invRc_; // cutoff radius
|
||||||
int nsd_ ; // number of dimensions
|
int nsd_ ; // number of dimensions
|
||||||
|
|
||||||
/** pointer to lammps interface class */
|
/** pointer to lammps interface class */
|
||||||
LammpsInterface * lammpsInterface_;
|
LammpsInterface * lammpsInterface_;
|
||||||
|
@ -67,10 +67,10 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KernelFunctionStep
|
* @class KernelFunctionStep
|
||||||
* @brief Class for defining kernel function of a step with spherical support
|
* @brief Class for defining kernel function of a step with spherical support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KernelFunctionStep : public KernelFunction {
|
class KernelFunctionStep : public KernelFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -80,7 +80,7 @@ namespace ATC {
|
||||||
virtual ~KernelFunctionStep() {};
|
virtual ~KernelFunctionStep() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
// bond function value
|
// bond function value
|
||||||
virtual double bond(DENS_VEC& /* xa */, DENS_VEC& /* xb */, double lam1, double lam2) const
|
virtual double bond(DENS_VEC& /* xa */, DENS_VEC& /* xb */, double lam1, double lam2) const
|
||||||
|
@ -88,27 +88,27 @@ namespace ATC {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KernelFunctionCell
|
* @class KernelFunctionCell
|
||||||
* @brief Class for defining kernel function of a step with rectangular support
|
* @brief Class for defining kernel function of a step with rectangular support
|
||||||
* suitable for a rectangular grid
|
* suitable for a rectangular grid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KernelFunctionCell : public KernelFunction {
|
class KernelFunctionCell : public KernelFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionCell(int nparameters, double* parameters);
|
KernelFunctionCell(int nparameters, double* parameters);
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~KernelFunctionCell() {};
|
virtual ~KernelFunctionCell() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
// bond function value
|
// bond function value
|
||||||
virtual double bond(DENS_VEC& /* xa */, DENS_VEC& /* xb */, double lam1, double lam2) const
|
virtual double bond(DENS_VEC& /* xa */, DENS_VEC& /* xb */, double lam1, double lam2) const
|
||||||
{return lam2 -lam1;}
|
{return lam2 -lam1;}
|
||||||
// bond intercept values : origin is the node position
|
// bond intercept values : origin is the node position
|
||||||
void bond_intercepts(DENS_VEC& xa, DENS_VEC& xb,
|
void bond_intercepts(DENS_VEC& xa, DENS_VEC& xb,
|
||||||
double &lam1, double &lam2) const;
|
double &lam1, double &lam2) const;
|
||||||
bool node_contributes(DENS_VEC node) const;
|
bool node_contributes(DENS_VEC node) const;
|
||||||
bool in_support(DENS_VEC dx) const;
|
bool in_support(DENS_VEC dx) const;
|
||||||
|
@ -132,8 +132,8 @@ namespace ATC {
|
||||||
virtual ~KernelFunctionCubicSphere() {};
|
virtual ~KernelFunctionCubicSphere() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,8 +150,8 @@ namespace ATC {
|
||||||
virtual ~KernelFunctionQuarticSphere() {};
|
virtual ~KernelFunctionQuarticSphere() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,8 +168,8 @@ namespace ATC {
|
||||||
virtual ~KernelFunctionCubicCyl() {};
|
virtual ~KernelFunctionCubicCyl() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
virtual double dimensionality_factor(void) const { return 0.5; }
|
virtual double dimensionality_factor(void) const { return 0.5; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,21 +181,21 @@ namespace ATC {
|
||||||
class KernelFunctionQuarticCyl : public KernelFunction {
|
class KernelFunctionQuarticCyl : public KernelFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
KernelFunctionQuarticCyl(int nparameters, double* parameters);
|
KernelFunctionQuarticCyl(int nparameters, double* parameters);
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~KernelFunctionQuarticCyl() {};
|
virtual ~KernelFunctionQuarticCyl() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
virtual double dimensionality_factor(void) const { return 0.5; }
|
virtual double dimensionality_factor(void) const { return 0.5; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KernelFunctionCubicBar
|
* @class KernelFunctionCubicBar
|
||||||
* @brief Class for defining kernel function of a cubic with 1-dimensional (bar) support
|
* @brief Class for defining kernel function of a cubic with 1-dimensional (bar) support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KernelFunctionCubicBar : public KernelFunction {
|
class KernelFunctionCubicBar : public KernelFunction {
|
||||||
|
@ -207,14 +207,14 @@ namespace ATC {
|
||||||
virtual ~KernelFunctionCubicBar() {};
|
virtual ~KernelFunctionCubicBar() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
virtual double dimensionality_factor(void) const { return 0.25; }
|
virtual double dimensionality_factor(void) const { return 0.25; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KernelFunctionCubicBar
|
* @class KernelFunctionCubicBar
|
||||||
* @brief Class for defining kernel function of a cubic with 1-dimensional (bar) support
|
* @brief Class for defining kernel function of a cubic with 1-dimensional (bar) support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KernelFunctionLinearBar : public KernelFunction {
|
class KernelFunctionLinearBar : public KernelFunction {
|
||||||
|
@ -226,8 +226,8 @@ namespace ATC {
|
||||||
virtual ~KernelFunctionLinearBar() {};
|
virtual ~KernelFunctionLinearBar() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
virtual double dimensionality_factor(void) const { return 0.25; }
|
virtual double dimensionality_factor(void) const { return 0.25; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -246,8 +246,8 @@ namespace ATC {
|
||||||
virtual ~KernelFunctionQuarticBar() {};
|
virtual ~KernelFunctionQuarticBar() {};
|
||||||
// function value
|
// function value
|
||||||
virtual double value(DENS_VEC& x_atom) const;
|
virtual double value(DENS_VEC& x_atom) const;
|
||||||
// function derivative
|
// function derivative
|
||||||
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
|
||||||
virtual double dimensionality_factor(void) const { return 0.25; }
|
virtual double dimensionality_factor(void) const { return 0.25; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// construct_methods:
|
// construct_methods:
|
||||||
// instantiations desired regulator method(s)
|
// instantiations desired regulator method(s)
|
||||||
|
|
||||||
// dependence, but in general there is also a
|
// dependence, but in general there is also a
|
||||||
// time integrator dependence. In general the
|
// time integrator dependence. In general the
|
||||||
// precedence order is:
|
// precedence order is:
|
||||||
// time filter -> time integrator -> thermostat
|
// time filter -> time integrator -> thermostat
|
||||||
// In the future this may need to be added if
|
// In the future this may need to be added if
|
||||||
|
@ -92,7 +92,7 @@ namespace ATC {
|
||||||
if (timeFilterManager->need_reset() ) {
|
if (timeFilterManager->need_reset() ) {
|
||||||
timeFilter_ = timeFilterManager->construct(TimeFilterManager::EXPLICIT_IMPLICIT);
|
timeFilter_ = timeFilterManager->construct(TimeFilterManager::EXPLICIT_IMPLICIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeFilterManager->filter_dynamics()) {
|
if (timeFilterManager->filter_dynamics()) {
|
||||||
switch (regulatorTarget_) {
|
switch (regulatorTarget_) {
|
||||||
case NONE: {
|
case NONE: {
|
||||||
|
@ -130,7 +130,7 @@ namespace ATC {
|
||||||
throw ATC_Error("Unknown thermostat target in Thermostat::initialize");
|
throw ATC_Error("Unknown thermostat target in Thermostat::initialize");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicRegulator::reset_method();
|
AtomicRegulator::reset_method();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -143,7 +143,7 @@ namespace ATC {
|
||||||
// Class VelocityRescaleCombined
|
// Class VelocityRescaleCombined
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -182,7 +182,7 @@ namespace ATC {
|
||||||
// Class ThermostatRescaleCombined
|
// Class ThermostatRescaleCombined
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -219,7 +219,7 @@ namespace ATC {
|
||||||
// Class KinetoThermostatRescale
|
// Class KinetoThermostatRescale
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -239,7 +239,7 @@ namespace ATC {
|
||||||
kinetostat_ = new VelocityRescaleCombined(kinetoThermostat);
|
kinetostat_ = new VelocityRescaleCombined(kinetoThermostat);
|
||||||
// data associated with stage 3 in ATC_Method::initialize
|
// data associated with stage 3 in ATC_Method::initialize
|
||||||
lambdaMomentum_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",atc_->nsd());
|
lambdaMomentum_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",atc_->nsd());
|
||||||
lambdaEnergy_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaEnergy",1);
|
lambdaEnergy_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaEnergy",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -334,7 +334,7 @@ namespace ATC {
|
||||||
|
|
||||||
// update thermostat
|
// update thermostat
|
||||||
thermostat_->compute_thermostat(dt);
|
thermostat_->compute_thermostat(dt);
|
||||||
|
|
||||||
// update kinetostat
|
// update kinetostat
|
||||||
kinetostat_->compute_kinetostat(dt);
|
kinetostat_->compute_kinetostat(dt);
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ namespace ATC {
|
||||||
// Class ThermostatRescaleMixedKePeCombined
|
// Class ThermostatRescaleMixedKePeCombined
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -447,7 +447,7 @@ namespace ATC {
|
||||||
// Class KinetoThermostatGlcFs
|
// Class KinetoThermostatGlcFs
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -598,7 +598,7 @@ namespace ATC {
|
||||||
// do full prediction if we just redid the shape functions
|
// do full prediction if we just redid the shape functions
|
||||||
if (full_prediction()) {
|
if (full_prediction()) {
|
||||||
this->compute_lambda(dt);
|
this->compute_lambda(dt);
|
||||||
|
|
||||||
atomThermostatForces_->unfix_quantity(); // allow update of atomic force applied by lambda
|
atomThermostatForces_->unfix_quantity(); // allow update of atomic force applied by lambda
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ namespace ATC {
|
||||||
|
|
||||||
if (full_prediction())
|
if (full_prediction())
|
||||||
atomThermostatForces_->fix_quantity();
|
atomThermostatForces_->fix_quantity();
|
||||||
|
|
||||||
// SPLIT OUT FUNCTION TO CREATE DELTA VARIABLES IN BASES, ONLY NEED THESE
|
// SPLIT OUT FUNCTION TO CREATE DELTA VARIABLES IN BASES, ONLY NEED THESE
|
||||||
// update predicted nodal variables for second half of time step
|
// update predicted nodal variables for second half of time step
|
||||||
// velocity
|
// velocity
|
||||||
|
@ -672,8 +672,8 @@ namespace ATC {
|
||||||
this->add_to_energy(myNodalAtomicLambdaPower,deltaEnergy2_,0.5*dt);
|
this->add_to_energy(myNodalAtomicLambdaPower,deltaEnergy2_,0.5*dt);
|
||||||
atc_->apply_inverse_mass_matrix(deltaEnergy2_,TEMPERATURE);
|
atc_->apply_inverse_mass_matrix(deltaEnergy2_,TEMPERATURE);
|
||||||
myTemperature += deltaEnergy2_;
|
myTemperature += deltaEnergy2_;
|
||||||
|
|
||||||
|
|
||||||
isFirstTimestep_ = false;
|
isFirstTimestep_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ namespace ATC {
|
||||||
void KinetoThermostatGlcFs::output(OUTPUT_LIST & /* outputData */)
|
void KinetoThermostatGlcFs::output(OUTPUT_LIST & /* outputData */)
|
||||||
{
|
{
|
||||||
// DO NOT CALL INDIVIDUAL REGULATORS
|
// DO NOT CALL INDIVIDUAL REGULATORS
|
||||||
// OUTPUT TOTAL FORCE AND TOTAL POWER
|
// OUTPUT TOTAL FORCE AND TOTAL POWER
|
||||||
// OUTPUT EACH LAMBDA
|
// OUTPUT EACH LAMBDA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,23 +25,23 @@ namespace ATC {
|
||||||
* @brief Manager class for atom-continuum simulataneous control of momentum and thermal energy
|
* @brief Manager class for atom-continuum simulataneous control of momentum and thermal energy
|
||||||
*/
|
*/
|
||||||
class KinetoThermostat : public AtomicRegulator {
|
class KinetoThermostat : public AtomicRegulator {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
KinetoThermostat(ATC_Coupling * atc,
|
KinetoThermostat(ATC_Coupling * atc,
|
||||||
const std::string & regulatorPrefix = "");
|
const std::string & regulatorPrefix = "");
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~KinetoThermostat(){};
|
virtual ~KinetoThermostat(){};
|
||||||
|
|
||||||
/** parser/modifier */
|
/** parser/modifier */
|
||||||
virtual bool modify(int narg, char **arg);
|
virtual bool modify(int narg, char **arg);
|
||||||
|
|
||||||
/** instantiate up the desired method(s) */
|
/** instantiate up the desired method(s) */
|
||||||
virtual void construct_methods();
|
virtual void construct_methods();
|
||||||
|
|
||||||
|
|
||||||
// data access, intended for method objects
|
// data access, intended for method objects
|
||||||
/** reset the nodal power to a prescribed value */
|
/** reset the nodal power to a prescribed value */
|
||||||
virtual void reset_lambda_contribution(const DENS_MAT & target,
|
virtual void reset_lambda_contribution(const DENS_MAT & target,
|
||||||
|
@ -56,10 +56,10 @@ namespace ATC {
|
||||||
int couplingMaxIterations_;
|
int couplingMaxIterations_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
KinetoThermostat();
|
KinetoThermostat();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,12 +67,12 @@ namespace ATC {
|
||||||
* @brief Class for kinetostat/thermostat algorithms using the shape function matrices
|
* @brief Class for kinetostat/thermostat algorithms using the shape function matrices
|
||||||
* (thermostats have general for of N^T w N lambda = rhs)
|
* (thermostats have general for of N^T w N lambda = rhs)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KinetoThermostatShapeFunction : public RegulatorMethod {
|
class KinetoThermostatShapeFunction : public RegulatorMethod {
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
KinetoThermostatShapeFunction(AtomicRegulator * kinetoThermostat,
|
KinetoThermostatShapeFunction(AtomicRegulator * kinetoThermostat,
|
||||||
int couplingMaxIterations,
|
int couplingMaxIterations,
|
||||||
const std::string & /* regulatorPrefix */) : RegulatorMethod(kinetoThermostat),
|
const std::string & /* regulatorPrefix */) : RegulatorMethod(kinetoThermostat),
|
||||||
|
@ -80,7 +80,7 @@ namespace ATC {
|
||||||
KinetoThermostatShapeFunction(AtomicRegulator * kinetoThermostat,
|
KinetoThermostatShapeFunction(AtomicRegulator * kinetoThermostat,
|
||||||
int couplingMaxIterations)
|
int couplingMaxIterations)
|
||||||
: RegulatorMethod(kinetoThermostat), couplingMaxIterations_(couplingMaxIterations) {};
|
: RegulatorMethod(kinetoThermostat), couplingMaxIterations_(couplingMaxIterations) {};
|
||||||
|
|
||||||
virtual ~KinetoThermostatShapeFunction() {};
|
virtual ~KinetoThermostatShapeFunction() {};
|
||||||
|
|
||||||
/** instantiate all needed data */
|
/** instantiate all needed data */
|
||||||
|
@ -108,25 +108,25 @@ namespace ATC {
|
||||||
* @class VelocityRescaleCombined
|
* @class VelocityRescaleCombined
|
||||||
* @brief Enforces constraints on atomic velocity based on FE temperature and velocity
|
* @brief Enforces constraints on atomic velocity based on FE temperature and velocity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class VelocityRescaleCombined : public VelocityGlc {
|
class VelocityRescaleCombined : public VelocityGlc {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
friend class KinetoThermostatRescale; // since this is basically a set of member functions for friend
|
friend class KinetoThermostatRescale; // since this is basically a set of member functions for friend
|
||||||
|
|
||||||
VelocityRescaleCombined(AtomicRegulator * kinetostat);
|
VelocityRescaleCombined(AtomicRegulator * kinetostat);
|
||||||
|
|
||||||
virtual ~VelocityRescaleCombined(){};
|
virtual ~VelocityRescaleCombined(){};
|
||||||
|
|
||||||
/** pre-run initialization of method data */
|
/** pre-run initialization of method data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
/** applies kinetostat to atoms */
|
/** applies kinetostat to atoms */
|
||||||
virtual void apply_mid_predictor(double /* dt */){};
|
virtual void apply_mid_predictor(double /* dt */){};
|
||||||
/** applies kinetostat to atoms */
|
/** applies kinetostat to atoms */
|
||||||
virtual void apply_post_corrector(double /* dt */){};
|
virtual void apply_post_corrector(double /* dt */){};
|
||||||
|
|
||||||
/** local shape function matrices are incompatible with this mode */
|
/** local shape function matrices are incompatible with this mode */
|
||||||
virtual bool use_local_shape_functions() const {return false;};
|
virtual bool use_local_shape_functions() const {return false;};
|
||||||
|
|
||||||
|
@ -135,10 +135,10 @@ namespace ATC {
|
||||||
// data
|
// data
|
||||||
/** reference to AtC FE velocity */
|
/** reference to AtC FE velocity */
|
||||||
DENS_MAN & velocity_;
|
DENS_MAN & velocity_;
|
||||||
|
|
||||||
/** RHS correct based on thermostat */
|
/** RHS correct based on thermostat */
|
||||||
DENS_MAN * thermostatCorrection_;
|
DENS_MAN * thermostatCorrection_;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
/** sets up appropriate rhs for kinetostat equations */
|
/** sets up appropriate rhs for kinetostat equations */
|
||||||
virtual void set_kinetostat_rhs(DENS_MAT & rhs, double dt);
|
virtual void set_kinetostat_rhs(DENS_MAT & rhs, double dt);
|
||||||
|
@ -161,29 +161,29 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
VelocityRescaleCombined();
|
VelocityRescaleCombined();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ThermostatRescaleCombined
|
* @class ThermostatRescaleCombined
|
||||||
* @brief Enforces constraint on atomic kinetic energy based on FE temperature and velocity
|
* @brief Enforces constraint on atomic kinetic energy based on FE temperature and velocity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ThermostatRescaleCombined : public ThermostatRescale {
|
class ThermostatRescaleCombined : public ThermostatRescale {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ThermostatRescaleCombined(AtomicRegulator * thermostat);
|
ThermostatRescaleCombined(AtomicRegulator * thermostat);
|
||||||
|
|
||||||
virtual ~ThermostatRescaleCombined() {};
|
virtual ~ThermostatRescaleCombined() {};
|
||||||
|
|
||||||
/** pre-run initialization of method data */
|
/** pre-run initialization of method data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
// deactivate un-needed methods
|
// deactivate un-needed methods
|
||||||
/** applies thermostat to atoms in the post-corrector phase */
|
/** applies thermostat to atoms in the post-corrector phase */
|
||||||
virtual void apply_post_corrector(double /* dt */){};
|
virtual void apply_post_corrector(double /* dt */){};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
@ -201,21 +201,21 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
ThermostatRescaleCombined();
|
ThermostatRescaleCombined();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KinetoThermostatRescale
|
* @class KinetoThermostatRescale
|
||||||
* @brief Enforces constraints on atomic kinetic energy and velocity based on FE temperature and velocity
|
* @brief Enforces constraints on atomic kinetic energy and velocity based on FE temperature and velocity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KinetoThermostatRescale : public KinetoThermostatShapeFunction {
|
class KinetoThermostatRescale : public KinetoThermostatShapeFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
KinetoThermostatRescale(AtomicRegulator * kinetoThermostat,
|
KinetoThermostatRescale(AtomicRegulator * kinetoThermostat,
|
||||||
int couplingMaxIterations);
|
int couplingMaxIterations);
|
||||||
|
|
||||||
virtual ~KinetoThermostatRescale();
|
virtual ~KinetoThermostatRescale();
|
||||||
|
|
||||||
/** instantiate all needed data */
|
/** instantiate all needed data */
|
||||||
|
@ -223,7 +223,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** pre-run initialization of method data */
|
/** pre-run initialization of method data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
/** applies thermostat to atoms in the post-corrector phase */
|
/** applies thermostat to atoms in the post-corrector phase */
|
||||||
virtual void apply_post_corrector(double dt);
|
virtual void apply_post_corrector(double dt);
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** get data for output */
|
/** get data for output */
|
||||||
virtual void output(OUTPUT_LIST & outputData);
|
virtual void output(OUTPUT_LIST & outputData);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
|
@ -275,29 +275,29 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
KinetoThermostatRescale();
|
KinetoThermostatRescale();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ThermostatRescaleMixedKePeCombined
|
* @class ThermostatRescaleMixedKePeCombined
|
||||||
* @brief Enforces constraint on atomic kinetic energy based on FE temperature and velocity when the temperature is comprised of both KE and PE contributions
|
* @brief Enforces constraint on atomic kinetic energy based on FE temperature and velocity when the temperature is comprised of both KE and PE contributions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ThermostatRescaleMixedKePeCombined : public ThermostatRescaleMixedKePe {
|
class ThermostatRescaleMixedKePeCombined : public ThermostatRescaleMixedKePe {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat);
|
ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat);
|
||||||
|
|
||||||
virtual ~ThermostatRescaleMixedKePeCombined() {};
|
virtual ~ThermostatRescaleMixedKePeCombined() {};
|
||||||
|
|
||||||
/** pre-run initialization of method data */
|
/** pre-run initialization of method data */
|
||||||
virtual void initialize();
|
virtual void initialize();
|
||||||
|
|
||||||
// deactivate un-needed methods
|
// deactivate un-needed methods
|
||||||
/** applies thermostat to atoms in the post-corrector phase */
|
/** applies thermostat to atoms in the post-corrector phase */
|
||||||
virtual void apply_post_corrector(double /* dt */){};
|
virtual void apply_post_corrector(double /* dt */){};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
@ -315,7 +315,7 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
ThermostatRescaleMixedKePeCombined();
|
ThermostatRescaleMixedKePeCombined();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -323,16 +323,16 @@ namespace ATC {
|
||||||
* @brief Enforces constraint on atomic kinetic energy based on FE temperature
|
* @brief Enforces constraint on atomic kinetic energy based on FE temperature
|
||||||
* when the temperature is a mix of the KE and PE
|
* when the temperature is a mix of the KE and PE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KinetoThermostatRescaleMixedKePe : public KinetoThermostatRescale {
|
class KinetoThermostatRescaleMixedKePe : public KinetoThermostatRescale {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
KinetoThermostatRescaleMixedKePe(AtomicRegulator * kinetoThermostat,
|
KinetoThermostatRescaleMixedKePe(AtomicRegulator * kinetoThermostat,
|
||||||
int couplingMaxIterations);
|
int couplingMaxIterations);
|
||||||
|
|
||||||
virtual ~KinetoThermostatRescaleMixedKePe() {};
|
virtual ~KinetoThermostatRescaleMixedKePe() {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** creates the appropriate rescaling thermostat */
|
/** creates the appropriate rescaling thermostat */
|
||||||
|
@ -342,22 +342,22 @@ namespace ATC {
|
||||||
|
|
||||||
// DO NOT define this
|
// DO NOT define this
|
||||||
KinetoThermostatRescaleMixedKePe();
|
KinetoThermostatRescaleMixedKePe();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class KinetoThermostatGlcFs
|
* @class KinetoThermostatGlcFs
|
||||||
* @brief Class for regulation algorithms based on Gaussian least constraints (GLC) for fractional step (FS) algorithsm
|
* @brief Class for regulation algorithms based on Gaussian least constraints (GLC) for fractional step (FS) algorithsm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class KinetoThermostatGlcFs : public KinetoThermostatShapeFunction {
|
class KinetoThermostatGlcFs : public KinetoThermostatShapeFunction {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
KinetoThermostatGlcFs(AtomicRegulator * kinetoThermostat,
|
KinetoThermostatGlcFs(AtomicRegulator * kinetoThermostat,
|
||||||
int couplingMaxIterations,
|
int couplingMaxIterations,
|
||||||
const std::string & regulatorPrefix = "");
|
const std::string & regulatorPrefix = "");
|
||||||
|
|
||||||
virtual ~KinetoThermostatGlcFs() {};
|
virtual ~KinetoThermostatGlcFs() {};
|
||||||
|
|
||||||
/** instantiate all needed data */
|
/** instantiate all needed data */
|
||||||
|
@ -374,7 +374,7 @@ namespace ATC {
|
||||||
|
|
||||||
/** applies thermostat to atoms in the post-corrector phase */
|
/** applies thermostat to atoms in the post-corrector phase */
|
||||||
virtual void apply_post_corrector(double dt);
|
virtual void apply_post_corrector(double dt);
|
||||||
|
|
||||||
/** get data for output */
|
/** get data for output */
|
||||||
virtual void output(OUTPUT_LIST & outputData);
|
virtual void output(OUTPUT_LIST & outputData);
|
||||||
|
|
||||||
|
@ -494,12 +494,12 @@ namespace ATC {
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
|
|
||||||
/* class ThermostatFlux : public ThermostatGlcFs { */
|
/* class ThermostatFlux : public ThermostatGlcFs { */
|
||||||
|
|
||||||
/* public: */
|
/* public: */
|
||||||
|
|
||||||
/* ThermostatFlux(Thermostat * thermostat, */
|
/* ThermostatFlux(Thermostat * thermostat, */
|
||||||
/* const std::string & regulatorPrefix = ""); */
|
/* const std::string & regulatorPrefix = ""); */
|
||||||
|
|
||||||
/* virtual ~ThermostatFlux() {}; */
|
/* virtual ~ThermostatFlux() {}; */
|
||||||
|
|
||||||
/* /\** instantiate all needed data *\/ */
|
/* /\** instantiate all needed data *\/ */
|
||||||
|
@ -507,7 +507,7 @@ namespace ATC {
|
||||||
|
|
||||||
/* /\** pre-run initialization of method data *\/ */
|
/* /\** pre-run initialization of method data *\/ */
|
||||||
/* virtual void initialize(); */
|
/* virtual void initialize(); */
|
||||||
|
|
||||||
/* protected: */
|
/* protected: */
|
||||||
|
|
||||||
/* /\** sets up appropriate rhs for thermostat equations *\/ */
|
/* /\** sets up appropriate rhs for thermostat equations *\/ */
|
||||||
|
@ -539,12 +539,12 @@ namespace ATC {
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
|
|
||||||
/* class ThermostatFixed : public ThermostatGlcFs { */
|
/* class ThermostatFixed : public ThermostatGlcFs { */
|
||||||
|
|
||||||
/* public: */
|
/* public: */
|
||||||
|
|
||||||
/* ThermostatFixed(Thermostat * thermostat, */
|
/* ThermostatFixed(Thermostat * thermostat, */
|
||||||
/* const std::string & regulatorPrefix = ""); */
|
/* const std::string & regulatorPrefix = ""); */
|
||||||
|
|
||||||
/* virtual ~ThermostatFixed() {}; */
|
/* virtual ~ThermostatFixed() {}; */
|
||||||
|
|
||||||
/* /\** instantiate all needed data *\/ */
|
/* /\** instantiate all needed data *\/ */
|
||||||
|
@ -552,7 +552,7 @@ namespace ATC {
|
||||||
|
|
||||||
/* /\** pre-run initialization of method data *\/ */
|
/* /\** pre-run initialization of method data *\/ */
|
||||||
/* virtual void initialize(); */
|
/* virtual void initialize(); */
|
||||||
|
|
||||||
/* /\** applies thermostat to atoms in the predictor phase *\/ */
|
/* /\** applies thermostat to atoms in the predictor phase *\/ */
|
||||||
/* virtual void apply_pre_predictor(double dt); */
|
/* virtual void apply_pre_predictor(double dt); */
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ namespace ATC {
|
||||||
|
|
||||||
/* /\** determine if local shape function matrices are needed *\/ */
|
/* /\** determine if local shape function matrices are needed *\/ */
|
||||||
/* virtual bool use_local_shape_functions() const {return atomicRegulator_->use_localized_lambda();}; */
|
/* virtual bool use_local_shape_functions() const {return atomicRegulator_->use_localized_lambda();}; */
|
||||||
|
|
||||||
/* protected: */
|
/* protected: */
|
||||||
|
|
||||||
/* // methods */
|
/* // methods */
|
||||||
|
@ -639,12 +639,12 @@ namespace ATC {
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
|
|
||||||
/* class ThermostatFluxFiltered : public ThermostatFlux { */
|
/* class ThermostatFluxFiltered : public ThermostatFlux { */
|
||||||
|
|
||||||
/* public: */
|
/* public: */
|
||||||
|
|
||||||
/* ThermostatFluxFiltered(Thermostat * thermostat, */
|
/* ThermostatFluxFiltered(Thermostat * thermostat, */
|
||||||
/* const std::string & regulatorPrefix = ""); */
|
/* const std::string & regulatorPrefix = ""); */
|
||||||
|
|
||||||
/* virtual ~ThermostatFluxFiltered() {}; */
|
/* virtual ~ThermostatFluxFiltered() {}; */
|
||||||
|
|
||||||
/* /\** pre-run initialization of method data *\/ */
|
/* /\** pre-run initialization of method data *\/ */
|
||||||
|
@ -655,7 +655,7 @@ namespace ATC {
|
||||||
|
|
||||||
/* /\** get data for output *\/ */
|
/* /\** get data for output *\/ */
|
||||||
/* virtual void output(OUTPUT_LIST & outputData); */
|
/* virtual void output(OUTPUT_LIST & outputData); */
|
||||||
|
|
||||||
/* protected: */
|
/* protected: */
|
||||||
|
|
||||||
/* /\** sets up appropriate rhs for thermostat equations *\/ */
|
/* /\** sets up appropriate rhs for thermostat equations *\/ */
|
||||||
|
@ -685,19 +685,19 @@ namespace ATC {
|
||||||
/* * @brief Class for thermostatting using the temperature matching constraint and is compatible with */
|
/* * @brief Class for thermostatting using the temperature matching constraint and is compatible with */
|
||||||
/* the fractional step time-integration with time filtering */
|
/* the fractional step time-integration with time filtering */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
|
|
||||||
/* class ThermostatFixedFiltered : public ThermostatFixed { */
|
/* class ThermostatFixedFiltered : public ThermostatFixed { */
|
||||||
|
|
||||||
/* public: */
|
/* public: */
|
||||||
|
|
||||||
/* ThermostatFixedFiltered(Thermostat * thermostat, */
|
/* ThermostatFixedFiltered(Thermostat * thermostat, */
|
||||||
/* const std::string & regulatorPrefix = ""); */
|
/* const std::string & regulatorPrefix = ""); */
|
||||||
|
|
||||||
/* virtual ~ThermostatFixedFiltered() {}; */
|
/* virtual ~ThermostatFixedFiltered() {}; */
|
||||||
|
|
||||||
/* /\** get data for output *\/ */
|
/* /\** get data for output *\/ */
|
||||||
/* virtual void output(OUTPUT_LIST & outputData); */
|
/* virtual void output(OUTPUT_LIST & outputData); */
|
||||||
|
|
||||||
/* protected: */
|
/* protected: */
|
||||||
|
|
||||||
/* // methods */
|
/* // methods */
|
||||||
|
@ -734,7 +734,7 @@ namespace ATC {
|
||||||
|
|
||||||
/* ThermostatFluxFixed(Thermostat * thermostat, */
|
/* ThermostatFluxFixed(Thermostat * thermostat, */
|
||||||
/* bool constructThermostats = true); */
|
/* bool constructThermostats = true); */
|
||||||
|
|
||||||
/* virtual ~ThermostatFluxFixed(); */
|
/* virtual ~ThermostatFluxFixed(); */
|
||||||
|
|
||||||
/* /\** instantiate all needed data *\/ */
|
/* /\** instantiate all needed data *\/ */
|
||||||
|
@ -751,7 +751,7 @@ namespace ATC {
|
||||||
|
|
||||||
/* /\** applies thermostat to atoms in the post-corrector phase *\/ */
|
/* /\** applies thermostat to atoms in the post-corrector phase *\/ */
|
||||||
/* virtual void apply_post_corrector(double dt); */
|
/* virtual void apply_post_corrector(double dt); */
|
||||||
|
|
||||||
/* /\** get data for output *\/ */
|
/* /\** get data for output *\/ */
|
||||||
/* virtual void output(OUTPUT_LIST & outputData); */
|
/* virtual void output(OUTPUT_LIST & outputData); */
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ namespace ATC {
|
||||||
/* public: */
|
/* public: */
|
||||||
|
|
||||||
/* ThermostatFluxFixedFiltered(Thermostat * thermostat); */
|
/* ThermostatFluxFixedFiltered(Thermostat * thermostat); */
|
||||||
|
|
||||||
/* virtual ~ThermostatFluxFixedFiltered(){}; */
|
/* virtual ~ThermostatFluxFixedFiltered(){}; */
|
||||||
|
|
||||||
/* private: */
|
/* private: */
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// modify:
|
// modify:
|
||||||
// parses and adjusts kinetostat state based on
|
// parses and adjusts kinetostat state based on
|
||||||
|
@ -46,20 +46,20 @@ namespace ATC {
|
||||||
/*! \page man_control_momentum fix_modify AtC control momentum
|
/*! \page man_control_momentum fix_modify AtC control momentum
|
||||||
\section syntax
|
\section syntax
|
||||||
fix_modify AtC control momentum none \n
|
fix_modify AtC control momentum none \n
|
||||||
|
|
||||||
fix_modify AtC control momentum rescale <frequency>\n
|
fix_modify AtC control momentum rescale <frequency>\n
|
||||||
- frequency (int) = time step frequency for applying displacement and velocity rescaling \n
|
- frequency (int) = time step frequency for applying displacement and velocity rescaling \n
|
||||||
|
|
||||||
fix_modify AtC control momentum glc_displacement \n
|
fix_modify AtC control momentum glc_displacement \n
|
||||||
|
|
||||||
fix_modify AtC control momentum glc_velocity \n
|
fix_modify AtC control momentum glc_velocity \n
|
||||||
|
|
||||||
fix_modify AtC control momentum hoover \n
|
fix_modify AtC control momentum hoover \n
|
||||||
|
|
||||||
fix_modify AtC control momentum flux [faceset face_set_id, interpolate]
|
fix_modify AtC control momentum flux [faceset face_set_id, interpolate]
|
||||||
- face_set_id (string) = id of boundary face set, if not specified
|
- face_set_id (string) = id of boundary face set, if not specified
|
||||||
(or not possible when the atomic domain does not line up with
|
(or not possible when the atomic domain does not line up with
|
||||||
mesh boundaries) defaults to an atomic-quadrature approximate
|
mesh boundaries) defaults to an atomic-quadrature approximate
|
||||||
evaulation\n
|
evaulation\n
|
||||||
\section examples
|
\section examples
|
||||||
fix_modify AtC control momentum glc_velocity \n
|
fix_modify AtC control momentum glc_velocity \n
|
||||||
|
@ -108,7 +108,7 @@ namespace ATC {
|
||||||
foundMatch = true;
|
foundMatch = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundMatch)
|
if (!foundMatch)
|
||||||
foundMatch = AtomicRegulator::modify(narg,arg);
|
foundMatch = AtomicRegulator::modify(narg,arg);
|
||||||
if (foundMatch)
|
if (foundMatch)
|
||||||
|
@ -126,13 +126,13 @@ namespace ATC {
|
||||||
DENS_MAN * lambdaForceFiltered = regulator_data("LambdaForceFiltered",nsd_);
|
DENS_MAN * lambdaForceFiltered = regulator_data("LambdaForceFiltered",nsd_);
|
||||||
lambdaForceFiltered->set_quantity() = target;
|
lambdaForceFiltered->set_quantity() = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// initialize:
|
// initialize:
|
||||||
// sets up methods before a run
|
// sets up methods before a run
|
||||||
|
|
||||||
// dependence, but in general there is also a
|
// dependence, but in general there is also a
|
||||||
// time integrator dependence. In general the
|
// time integrator dependence. In general the
|
||||||
// precedence order is:
|
// precedence order is:
|
||||||
// time filter -> time integrator -> kinetostat
|
// time filter -> time integrator -> kinetostat
|
||||||
// In the future this may need to be added if
|
// In the future this may need to be added if
|
||||||
|
@ -147,7 +147,7 @@ namespace ATC {
|
||||||
if (atc_->reset_methods()) {
|
if (atc_->reset_methods()) {
|
||||||
// eliminate existing methods
|
// eliminate existing methods
|
||||||
delete_method();
|
delete_method();
|
||||||
|
|
||||||
DENS_MAT nodalGhostForceFiltered;
|
DENS_MAT nodalGhostForceFiltered;
|
||||||
TimeIntegrator::TimeIntegrationType myIntegrationType = (atc_->time_integrator(VELOCITY))->time_integration_type();
|
TimeIntegrator::TimeIntegrationType myIntegrationType = (atc_->time_integrator(VELOCITY))->time_integration_type();
|
||||||
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
|
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
|
||||||
|
@ -156,9 +156,9 @@ namespace ATC {
|
||||||
myMethod = dynamic_cast<StressFlux *>(regulatorMethod_);
|
myMethod = dynamic_cast<StressFlux *>(regulatorMethod_);
|
||||||
nodalGhostForceFiltered = (myMethod->filtered_ghost_force()).quantity();
|
nodalGhostForceFiltered = (myMethod->filtered_ghost_force()).quantity();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update time filter
|
// update time filter
|
||||||
|
|
||||||
if (timeFilterManager->need_reset()) {
|
if (timeFilterManager->need_reset()) {
|
||||||
if (myIntegrationType == TimeIntegrator::FRACTIONAL_STEP) {
|
if (myIntegrationType == TimeIntegrator::FRACTIONAL_STEP) {
|
||||||
timeFilter_ = timeFilterManager->construct(TimeFilterManager::EXPLICIT_IMPLICIT);
|
timeFilter_ = timeFilterManager->construct(TimeFilterManager::EXPLICIT_IMPLICIT);
|
||||||
|
@ -167,7 +167,7 @@ namespace ATC {
|
||||||
timeFilter_ = timeFilterManager->construct(TimeFilterManager::IMPLICIT_UPDATE);
|
timeFilter_ = timeFilterManager->construct(TimeFilterManager::IMPLICIT_UPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeFilterManager->filter_dynamics()) {
|
if (timeFilterManager->filter_dynamics()) {
|
||||||
switch (regulatorTarget_) {
|
switch (regulatorTarget_) {
|
||||||
case NONE: {
|
case NONE: {
|
||||||
|
@ -297,7 +297,7 @@ namespace ATC {
|
||||||
// Class KinetostatShapeFunction
|
// Class KinetostatShapeFunction
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -369,7 +369,7 @@ namespace ATC {
|
||||||
// Class GlcKinetostat
|
// Class GlcKinetostat
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -391,7 +391,7 @@ namespace ATC {
|
||||||
|
|
||||||
// needed fundamental quantities
|
// needed fundamental quantities
|
||||||
atomPositions_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_POSITION);
|
atomPositions_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_POSITION);
|
||||||
|
|
||||||
// base class transfers
|
// base class transfers
|
||||||
KinetostatShapeFunction::construct_transfers();
|
KinetostatShapeFunction::construct_transfers();
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
KinetostatShapeFunction::initialize();
|
KinetostatShapeFunction::initialize();
|
||||||
|
|
||||||
|
|
||||||
// set up list of nodes using Hoover coupling
|
// set up list of nodes using Hoover coupling
|
||||||
// (a) nodes with prescribed values
|
// (a) nodes with prescribed values
|
||||||
PrescribedDataManager * prescribedDataMgr(atc_->prescribed_data_manager());
|
PrescribedDataManager * prescribedDataMgr(atc_->prescribed_data_manager());
|
||||||
|
@ -455,7 +455,7 @@ namespace ATC {
|
||||||
// Class DisplacementGlc
|
// Class DisplacementGlc
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -501,7 +501,7 @@ namespace ATC {
|
||||||
else {
|
else {
|
||||||
linearSolverType_ = AtomicRegulator::CG_SOLVE;
|
linearSolverType_ = AtomicRegulator::CG_SOLVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// base class transfers
|
// base class transfers
|
||||||
GlcKinetostat::construct_transfers();
|
GlcKinetostat::construct_transfers();
|
||||||
|
@ -510,14 +510,14 @@ namespace ATC {
|
||||||
atomKinetostatForce_ = new AtomicKinetostatForceDisplacement(atc_);
|
atomKinetostatForce_ = new AtomicKinetostatForceDisplacement(atc_);
|
||||||
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
|
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
|
||||||
regulatorPrefix_+"AtomKinetostatForce");
|
regulatorPrefix_+"AtomKinetostatForce");
|
||||||
|
|
||||||
// restricted force due to kinetostat
|
// restricted force due to kinetostat
|
||||||
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
|
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
|
||||||
atomKinetostatForce_,
|
atomKinetostatForce_,
|
||||||
interscaleManager.per_atom_sparse_matrix("Interpolant"));
|
interscaleManager.per_atom_sparse_matrix("Interpolant"));
|
||||||
interscaleManager.add_dense_matrix(nodalAtomicLambdaForce_,
|
interscaleManager.add_dense_matrix(nodalAtomicLambdaForce_,
|
||||||
regulatorPrefix_+"NodalAtomicLambdaForce");
|
regulatorPrefix_+"NodalAtomicLambdaForce");
|
||||||
|
|
||||||
// nodal displacement restricted from atoms
|
// nodal displacement restricted from atoms
|
||||||
nodalAtomicMassWeightedDisplacement_ = interscaleManager.dense_matrix("NodalAtomicMassWeightedDisplacement");
|
nodalAtomicMassWeightedDisplacement_ = interscaleManager.dense_matrix("NodalAtomicMassWeightedDisplacement");
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ namespace ATC {
|
||||||
DENS_MAT & nodalField,
|
DENS_MAT & nodalField,
|
||||||
double weight)
|
double weight)
|
||||||
{
|
{
|
||||||
|
|
||||||
DENS_MAT nodalLambdaRoc(nNodes_,nsd_);
|
DENS_MAT nodalLambdaRoc(nNodes_,nsd_);
|
||||||
atc_->apply_inverse_mass_matrix(source,
|
atc_->apply_inverse_mass_matrix(source,
|
||||||
nodalLambdaRoc,
|
nodalLambdaRoc,
|
||||||
|
@ -666,13 +666,13 @@ namespace ATC {
|
||||||
outputData[regulatorPrefix_+"NodalLambdaForce"] = &(_nodalAtomicLambdaForceOut_);
|
outputData[regulatorPrefix_+"NodalLambdaForce"] = &(_nodalAtomicLambdaForceOut_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Class DisplacementGlcFiltered
|
// Class DisplacementGlcFiltered
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -683,7 +683,7 @@ namespace ATC {
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_pre_filtering
|
// apply_pre_filtering
|
||||||
// applies first step of filtering to
|
// applies first step of filtering to
|
||||||
|
@ -750,13 +750,13 @@ namespace ATC {
|
||||||
outputData[regulatorPrefix_+"NodalLambdaForce"] = &lambdaForceFiltered;
|
outputData[regulatorPrefix_+"NodalLambdaForce"] = &lambdaForceFiltered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Class VelocityGlc
|
// Class VelocityGlc
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -805,7 +805,7 @@ namespace ATC {
|
||||||
else {
|
else {
|
||||||
linearSolverType_ = AtomicRegulator::CG_SOLVE;
|
linearSolverType_ = AtomicRegulator::CG_SOLVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// base class transfers
|
// base class transfers
|
||||||
GlcKinetostat::construct_transfers();
|
GlcKinetostat::construct_transfers();
|
||||||
|
|
||||||
|
@ -813,18 +813,18 @@ namespace ATC {
|
||||||
atomKinetostatForce_ = new AtomicKinetostatForceVelocity(atc_);
|
atomKinetostatForce_ = new AtomicKinetostatForceVelocity(atc_);
|
||||||
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
|
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
|
||||||
regulatorPrefix_+"AtomKinetostatForce");
|
regulatorPrefix_+"AtomKinetostatForce");
|
||||||
|
|
||||||
// restricted force due to kinetostat
|
// restricted force due to kinetostat
|
||||||
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
|
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
|
||||||
atomKinetostatForce_,
|
atomKinetostatForce_,
|
||||||
interscaleManager.per_atom_sparse_matrix("Interpolant"));
|
interscaleManager.per_atom_sparse_matrix("Interpolant"));
|
||||||
interscaleManager.add_dense_matrix(nodalAtomicLambdaForce_,
|
interscaleManager.add_dense_matrix(nodalAtomicLambdaForce_,
|
||||||
regulatorPrefix_+"NodalAtomicLambdaForce");
|
regulatorPrefix_+"NodalAtomicLambdaForce");
|
||||||
|
|
||||||
// nodal momentum restricted from atoms
|
// nodal momentum restricted from atoms
|
||||||
nodalAtomicMomentum_ = interscaleManager.dense_matrix("NodalAtomicMomentum");
|
nodalAtomicMomentum_ = interscaleManager.dense_matrix("NodalAtomicMomentum");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -891,7 +891,7 @@ namespace ATC {
|
||||||
// set up rhs
|
// set up rhs
|
||||||
DENS_MAT rhs(nNodes_,nsd_);
|
DENS_MAT rhs(nNodes_,nsd_);
|
||||||
this->set_kinetostat_rhs(rhs,dt);
|
this->set_kinetostat_rhs(rhs,dt);
|
||||||
|
|
||||||
// solve linear system for lambda
|
// solve linear system for lambda
|
||||||
solve_for_lambda(rhs,lambda_->set_quantity());
|
solve_for_lambda(rhs,lambda_->set_quantity());
|
||||||
#ifdef OBSOLETE
|
#ifdef OBSOLETE
|
||||||
|
@ -975,7 +975,7 @@ namespace ATC {
|
||||||
DENS_MAT & nodalField,
|
DENS_MAT & nodalField,
|
||||||
double weight)
|
double weight)
|
||||||
{
|
{
|
||||||
|
|
||||||
DENS_MAT nodalLambdaRoc(nNodes_,nsd_);
|
DENS_MAT nodalLambdaRoc(nNodes_,nsd_);
|
||||||
atc_->apply_inverse_mass_matrix(source,
|
atc_->apply_inverse_mass_matrix(source,
|
||||||
nodalLambdaRoc,
|
nodalLambdaRoc,
|
||||||
|
@ -984,7 +984,7 @@ namespace ATC {
|
||||||
for (iter = hooverNodes_.begin(); iter != hooverNodes_.end(); ++iter) {
|
for (iter = hooverNodes_.begin(); iter != hooverNodes_.end(); ++iter) {
|
||||||
nodalLambdaRoc(iter->first,iter->second) = 0.;
|
nodalLambdaRoc(iter->first,iter->second) = 0.;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodalField += weight*nodalLambdaRoc;
|
nodalField += weight*nodalLambdaRoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,18 +1000,18 @@ namespace ATC {
|
||||||
outputData[regulatorPrefix_+"NodalLambdaForce"] = &(_nodalAtomicLambdaForceOut_);
|
outputData[regulatorPrefix_+"NodalLambdaForce"] = &(_nodalAtomicLambdaForceOut_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Class VelocityGlcFiltered
|
// Class VelocityGlcFiltered
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
VelocityGlcFiltered::VelocityGlcFiltered(AtomicRegulator *kinetostat)
|
VelocityGlcFiltered::VelocityGlcFiltered(AtomicRegulator *kinetostat)
|
||||||
: VelocityGlc(kinetostat),
|
: VelocityGlc(kinetostat),
|
||||||
nodalAtomicVelocities_(atc_->nodal_atomic_field(VELOCITY))
|
nodalAtomicVelocities_(atc_->nodal_atomic_field(VELOCITY))
|
||||||
{
|
{
|
||||||
|
@ -1087,7 +1087,7 @@ namespace ATC {
|
||||||
// Class StressFlux
|
// Class StressFlux
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -1152,7 +1152,7 @@ namespace ATC {
|
||||||
atomKinetostatForce_ = new AtomicKinetostatForceStress(atc_,atomLambdas_);
|
atomKinetostatForce_ = new AtomicKinetostatForceStress(atc_,atomLambdas_);
|
||||||
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
|
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
|
||||||
regulatorPrefix_+"AtomKinetostatForce");
|
regulatorPrefix_+"AtomKinetostatForce");
|
||||||
|
|
||||||
// restricted force due to kinetostat
|
// restricted force due to kinetostat
|
||||||
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
|
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
|
||||||
atomKinetostatForce_,
|
atomKinetostatForce_,
|
||||||
|
@ -1254,7 +1254,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void StressFlux::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
void StressFlux::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
||||||
{
|
{
|
||||||
// (a) for flux based :
|
// (a) for flux based :
|
||||||
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
||||||
// sources are set in ATC transfer
|
// sources are set in ATC transfer
|
||||||
rhs.reset(nNodes_,nsd_);
|
rhs.reset(nNodes_,nsd_);
|
||||||
|
@ -1262,9 +1262,9 @@ namespace ATC {
|
||||||
if (nodalGhostForce_) {
|
if (nodalGhostForce_) {
|
||||||
rhs -= nodalGhostForce_->quantity();
|
rhs -= nodalGhostForce_->quantity();
|
||||||
}
|
}
|
||||||
|
|
||||||
// (b) for ess. bcs
|
// (b) for ess. bcs
|
||||||
|
|
||||||
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
|
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
|
||||||
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
|
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
|
||||||
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
|
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
|
||||||
|
@ -1352,7 +1352,7 @@ namespace ATC {
|
||||||
// Class StressFluxGhost
|
// Class StressFluxGhost
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -1409,14 +1409,14 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void StressFluxGhost::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
void StressFluxGhost::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
||||||
{
|
{
|
||||||
// (a) for flux based :
|
// (a) for flux based :
|
||||||
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
||||||
// sources are set in ATC transfer
|
// sources are set in ATC transfer
|
||||||
rhs.reset(nNodes_,nsd_);
|
rhs.reset(nNodes_,nsd_);
|
||||||
rhs = momentumSource_.quantity();
|
rhs = momentumSource_.quantity();
|
||||||
|
|
||||||
// (b) for ess. bcs
|
// (b) for ess. bcs
|
||||||
|
|
||||||
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
|
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
|
||||||
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
|
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
|
||||||
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
|
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
|
||||||
|
@ -1434,7 +1434,7 @@ namespace ATC {
|
||||||
// Class StressFluxFiltered
|
// Class StressFluxFiltered
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
@ -1453,14 +1453,14 @@ namespace ATC {
|
||||||
void StressFluxFiltered::set_kinetostat_rhs(DENS_MAT & rhs, double dt)
|
void StressFluxFiltered::set_kinetostat_rhs(DENS_MAT & rhs, double dt)
|
||||||
{
|
{
|
||||||
// set basic terms
|
// set basic terms
|
||||||
// (a) for flux based :
|
// (a) for flux based :
|
||||||
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
||||||
// sources are set in ATC transfer
|
// sources are set in ATC transfer
|
||||||
rhs.reset(nNodes_,nsd_);
|
rhs.reset(nNodes_,nsd_);
|
||||||
rhs = momentumSource_.quantity() - nodalGhostForceFiltered_.quantity();
|
rhs = momentumSource_.quantity() - nodalGhostForceFiltered_.quantity();
|
||||||
|
|
||||||
// (b) for ess. bcs
|
// (b) for ess. bcs
|
||||||
|
|
||||||
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
|
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
|
||||||
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
|
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
|
||||||
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
|
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
|
||||||
|
@ -1530,7 +1530,7 @@ namespace ATC {
|
||||||
// Class KinetostatGlcFs
|
// Class KinetostatGlcFs
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -1597,7 +1597,7 @@ namespace ATC {
|
||||||
void KinetostatGlcFs::initialize()
|
void KinetostatGlcFs::initialize()
|
||||||
{
|
{
|
||||||
KinetostatShapeFunction::initialize();
|
KinetostatShapeFunction::initialize();
|
||||||
|
|
||||||
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
|
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
|
||||||
if (!timeFilterManager->end_equilibrate()) {
|
if (!timeFilterManager->end_equilibrate()) {
|
||||||
// we should reset lambda and lambdaForce to zero in this case
|
// we should reset lambda and lambdaForce to zero in this case
|
||||||
|
@ -1675,7 +1675,7 @@ namespace ATC {
|
||||||
// update filtered forces
|
// update filtered forces
|
||||||
timeFilter_->apply_pre_step1(lambdaForceFiltered,nodalAtomicLambdaForce,dt);
|
timeFilter_->apply_pre_step1(lambdaForceFiltered,nodalAtomicLambdaForce,dt);
|
||||||
|
|
||||||
// apply lambda force to atoms and compute instantaneous lambda force
|
// apply lambda force to atoms and compute instantaneous lambda force
|
||||||
this->apply_to_atoms(atomVelocities_,nodalAtomicMomentum_,
|
this->apply_to_atoms(atomVelocities_,nodalAtomicMomentum_,
|
||||||
atomKinetostatForce_->quantity(),
|
atomKinetostatForce_->quantity(),
|
||||||
nodalAtomicLambdaForce,0.5*dt);
|
nodalAtomicLambdaForce,0.5*dt);
|
||||||
|
@ -1710,13 +1710,13 @@ namespace ATC {
|
||||||
nodalAtomicPredictedMomentum_,
|
nodalAtomicPredictedMomentum_,
|
||||||
atomKinetostatForce_->quantity(),
|
atomKinetostatForce_->quantity(),
|
||||||
myNodalAtomicLambdaForce,0.5*dt);
|
myNodalAtomicLambdaForce,0.5*dt);
|
||||||
|
|
||||||
// update predicted nodal variables for second half of time step
|
// update predicted nodal variables for second half of time step
|
||||||
this->add_to_momentum(myNodalAtomicLambdaForce,deltaMomentum_,0.5*dt);
|
this->add_to_momentum(myNodalAtomicLambdaForce,deltaMomentum_,0.5*dt);
|
||||||
atc_->apply_inverse_mass_matrix(deltaMomentum_,VELOCITY);
|
atc_->apply_inverse_mass_matrix(deltaMomentum_,VELOCITY);
|
||||||
velocity_ += deltaMomentum_;
|
velocity_ += deltaMomentum_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_post_corrector:
|
// apply_post_corrector:
|
||||||
// apply the kinetostat to the atoms in the
|
// apply the kinetostat to the atoms in the
|
||||||
|
@ -1746,7 +1746,7 @@ namespace ATC {
|
||||||
atc_->apply_inverse_mass_matrix(deltaMomentum_,VELOCITY);
|
atc_->apply_inverse_mass_matrix(deltaMomentum_,VELOCITY);
|
||||||
velocity_ += deltaMomentum_;
|
velocity_ += deltaMomentum_;
|
||||||
|
|
||||||
|
|
||||||
isFirstTimestep_ = false;
|
isFirstTimestep_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1787,7 +1787,7 @@ namespace ATC {
|
||||||
// Class KinetostatFlux
|
// Class KinetostatFlux
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -1838,7 +1838,7 @@ namespace ATC {
|
||||||
|
|
||||||
// sets up space for ghost force related variables
|
// sets up space for ghost force related variables
|
||||||
if (atc_->groupbit_ghost()) {
|
if (atc_->groupbit_ghost()) {
|
||||||
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap =
|
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap =
|
||||||
interscaleManager.dense_matrix_int(regulatorPrefix_+"NodeToOverlapMap");
|
interscaleManager.dense_matrix_int(regulatorPrefix_+"NodeToOverlapMap");
|
||||||
GhostCouplingMatrix * shapeFunctionGhost = new GhostCouplingMatrix(atc_,interscaleManager.per_atom_sparse_matrix("InterpolantGhost"),
|
GhostCouplingMatrix * shapeFunctionGhost = new GhostCouplingMatrix(atc_,interscaleManager.per_atom_sparse_matrix("InterpolantGhost"),
|
||||||
regulatedNodes_,
|
regulatedNodes_,
|
||||||
|
@ -1861,7 +1861,7 @@ namespace ATC {
|
||||||
void KinetostatFlux::initialize()
|
void KinetostatFlux::initialize()
|
||||||
{
|
{
|
||||||
KinetostatGlcFs::initialize();
|
KinetostatGlcFs::initialize();
|
||||||
|
|
||||||
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
|
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
|
||||||
if (!timeFilterManager->end_equilibrate()) {
|
if (!timeFilterManager->end_equilibrate()) {
|
||||||
// we should reset lambda and lambdaForce to zero in this case
|
// we should reset lambda and lambdaForce to zero in this case
|
||||||
|
@ -1894,13 +1894,13 @@ namespace ATC {
|
||||||
interscaleManager.add_set_int(regulatedNodes_,
|
interscaleManager.add_set_int(regulatedNodes_,
|
||||||
regulatorPrefix_+"KinetostatRegulatedNodes");
|
regulatorPrefix_+"KinetostatRegulatedNodes");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if localized monitor nodes with applied fluxes
|
// if localized monitor nodes with applied fluxes
|
||||||
if (atomicRegulator_->use_localized_lambda()) {
|
if (atomicRegulator_->use_localized_lambda()) {
|
||||||
if ((atomicRegulator_->coupling_mode() == Kinetostat::FLUX) && (atomicRegulator_->boundary_integration_type() != NO_QUADRATURE)) {
|
if ((atomicRegulator_->coupling_mode() == Kinetostat::FLUX) && (atomicRegulator_->boundary_integration_type() != NO_QUADRATURE)) {
|
||||||
// include boundary nodes
|
// include boundary nodes
|
||||||
applicationNodes_ = new FluxBoundaryNodes(atc_);
|
applicationNodes_ = new FluxBoundaryNodes(atc_);
|
||||||
|
|
||||||
boundaryNodes_ = new BoundaryNodes(atc_);
|
boundaryNodes_ = new BoundaryNodes(atc_);
|
||||||
interscaleManager.add_set_int(boundaryNodes_,
|
interscaleManager.add_set_int(boundaryNodes_,
|
||||||
regulatorPrefix_+"KinetostatBoundaryNodes");
|
regulatorPrefix_+"KinetostatBoundaryNodes");
|
||||||
|
@ -1916,7 +1916,7 @@ namespace ATC {
|
||||||
applicationNodes_ = regulatedNodes_;
|
applicationNodes_ = regulatedNodes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// special set of boundary elements for boundary flux quadrature
|
// special set of boundary elements for boundary flux quadrature
|
||||||
if ((atomicRegulator_->boundary_integration_type() == FE_INTERPOLATION)
|
if ((atomicRegulator_->boundary_integration_type() == FE_INTERPOLATION)
|
||||||
&& (atomicRegulator_->use_localized_lambda())) {
|
&& (atomicRegulator_->use_localized_lambda())) {
|
||||||
elementMask_ = interscaleManager.dense_matrix_bool(regulatorPrefix_+"BoundaryElementMask");
|
elementMask_ = interscaleManager.dense_matrix_bool(regulatorPrefix_+"BoundaryElementMask");
|
||||||
|
@ -1943,7 +1943,7 @@ namespace ATC {
|
||||||
|
|
||||||
KinetostatGlcFs::apply_pre_predictor(dt);
|
KinetostatGlcFs::apply_pre_predictor(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_post_corrector:
|
// apply_post_corrector:
|
||||||
// apply the kinetostat to the atoms in the
|
// apply the kinetostat to the atoms in the
|
||||||
|
@ -1956,7 +1956,7 @@ namespace ATC {
|
||||||
timeFilter_->apply_post_step1(nodalGhostForceFiltered_->set_quantity(),
|
timeFilter_->apply_post_step1(nodalGhostForceFiltered_->set_quantity(),
|
||||||
nodalGhostForce_->quantity(),dt);
|
nodalGhostForce_->quantity(),dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute the kinetostat equation and update lambda
|
// compute the kinetostat equation and update lambda
|
||||||
KinetostatGlcFs::apply_post_corrector(dt);
|
KinetostatGlcFs::apply_post_corrector(dt);
|
||||||
}
|
}
|
||||||
|
@ -1987,7 +1987,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void KinetostatFlux::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
void KinetostatFlux::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
||||||
{
|
{
|
||||||
// (a) for flux based :
|
// (a) for flux based :
|
||||||
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
||||||
// sources are set in ATC transfer
|
// sources are set in ATC transfer
|
||||||
rhs.reset(nNodes_,nsd_);
|
rhs.reset(nNodes_,nsd_);
|
||||||
|
@ -2026,7 +2026,7 @@ namespace ATC {
|
||||||
// Class KinetostatFluxGhost
|
// Class KinetostatFluxGhost
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -2088,7 +2088,7 @@ namespace ATC {
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void KinetostatFluxGhost::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
void KinetostatFluxGhost::set_kinetostat_rhs(DENS_MAT & rhs, double /* dt */)
|
||||||
{
|
{
|
||||||
// (a) for flux based :
|
// (a) for flux based :
|
||||||
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
|
||||||
// sources are set in ATC transfer
|
// sources are set in ATC transfer
|
||||||
rhs.reset(nNodes_,nsd_);
|
rhs.reset(nNodes_,nsd_);
|
||||||
|
@ -2107,7 +2107,7 @@ namespace ATC {
|
||||||
// Class KinetostatFixed
|
// Class KinetostatFixed
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
// Grab references to ATC and kinetostat data
|
// Grab references to ATC and kinetostat data
|
||||||
|
@ -2211,14 +2211,14 @@ namespace ATC {
|
||||||
else {
|
else {
|
||||||
throw ATC_Error("KinetostatFixed::construct_regulated_nodes - couldn't determine set of regulated nodes");
|
throw ATC_Error("KinetostatFixed::construct_regulated_nodes - couldn't determine set of regulated nodes");
|
||||||
}
|
}
|
||||||
|
|
||||||
interscaleManager.add_set_int(regulatedNodes_,
|
interscaleManager.add_set_int(regulatedNodes_,
|
||||||
regulatorPrefix_+"RegulatedNodes");
|
regulatorPrefix_+"RegulatedNodes");
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationNodes_ = regulatedNodes_;
|
applicationNodes_ = regulatedNodes_;
|
||||||
|
|
||||||
// special set of boundary elements for defining regulated atoms
|
// special set of boundary elements for defining regulated atoms
|
||||||
if (atomicRegulator_->use_localized_lambda()) {
|
if (atomicRegulator_->use_localized_lambda()) {
|
||||||
elementMask_ = interscaleManager.dense_matrix_bool(regulatorPrefix_+"BoundaryElementMask");
|
elementMask_ = interscaleManager.dense_matrix_bool(regulatorPrefix_+"BoundaryElementMask");
|
||||||
if (!elementMask_) {
|
if (!elementMask_) {
|
||||||
|
@ -2310,15 +2310,15 @@ namespace ATC {
|
||||||
nodalAtomicMomentumFiltered_ = _tempNodalAtomicMomentumFiltered_;
|
nodalAtomicMomentumFiltered_ = _tempNodalAtomicMomentumFiltered_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// apply_post_corrector:
|
// apply_post_corrector:
|
||||||
// apply the kinetostat to the atoms in the
|
// apply the kinetostat to the atoms in the
|
||||||
// post-corrector integration phase
|
// post-corrector integration phase
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
void KinetostatFixed::apply_post_corrector(double dt)
|
void KinetostatFixed::apply_post_corrector(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool halveForce = halve_force();
|
bool halveForce = halve_force();
|
||||||
|
|
||||||
KinetostatGlcFs::apply_post_corrector(dt);
|
KinetostatGlcFs::apply_post_corrector(dt);
|
||||||
|
@ -2333,8 +2333,8 @@ namespace ATC {
|
||||||
// 1) makes up for poor initial condition
|
// 1) makes up for poor initial condition
|
||||||
// 2) accounts for possibly large value of lambda when atomic shape function values change
|
// 2) accounts for possibly large value of lambda when atomic shape function values change
|
||||||
// from eulerian mapping after more than 1 timestep
|
// from eulerian mapping after more than 1 timestep
|
||||||
// avoids unstable oscillations arising from
|
// avoids unstable oscillations arising from
|
||||||
// thermostat having to correct for error introduced in lambda changing the
|
// thermostat having to correct for error introduced in lambda changing the
|
||||||
// shape function matrices
|
// shape function matrices
|
||||||
*lambda_ *= 0.5;
|
*lambda_ *= 0.5;
|
||||||
}
|
}
|
||||||
|
@ -2396,7 +2396,7 @@ namespace ATC {
|
||||||
// Class KinetostatFluxFixed
|
// Class KinetostatFluxFixed
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue