replace tabs and remove trailing whitespace in lib folder with updated script

This commit is contained in:
Axel Kohlmeyer 2021-08-22 20:45:24 -04:00
parent 30821b37e5
commit 92b5b159e5
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
311 changed files with 9176 additions and 9176 deletions

View File

@ -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
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
first, so that the appropriate library files exist for LAMMPS to link

File diff suppressed because it is too large Load Diff

View File

@ -20,16 +20,16 @@ namespace ATC {
/**
* @class ATC_Coupling
* @brief Base class for atom-continuum coupling
* @brief Base class for atom-continuum coupling
*/
class ATC_Coupling : public ATC_Method {
public: /** methods */
friend class ExtrinsicModel; // friend is not inherited
friend class ExtrinsicModelTwoTemperature;
friend class ExtrinsicModelDriftDiffusion;
friend class ExtrinsicModelDriftDiffusion;
friend class ExtrinsicModelDriftDiffusionConvection;
friend class ExtrinsicModelElectrostatic;
friend class ExtrinsicModelElectrostaticMomentum;
@ -72,13 +72,13 @@ namespace ATC {
virtual void pre_init_integrate();
/** Predictor phase, Verlet first step for velocity and position */
virtual void init_integrate();
virtual void init_integrate();
/** Predictor phase, executed after Verlet */
virtual void post_init_integrate();
/** Corrector phase, executed after Verlet*/
virtual void post_final_integrate();
/** pre/post atomic force calculation in minimize */
@ -95,9 +95,9 @@ namespace ATC {
const std::set<std::string> & boundary_face_names() {return boundaryFaceNames_;};
/** access to boundary integration method */
int boundary_integration_type() {return bndyIntType_;};
void set_boundary_integration_type(int boundaryIntegrationType)
void set_boundary_integration_type(int 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;};
BoundaryIntegrationType parse_boundary_integration
(int narg, char **arg, const std::set< std::pair<int,int> > * boundaryFaceSet);
@ -107,10 +107,10 @@ namespace ATC {
//--------------------------------------------------------
/** access to all boundary fluxes */
FIELDS &boundary_fluxes() {return boundaryFlux_;};
FIELDS &boundary_fluxes() {return boundaryFlux_;};
/** wrapper for FE_Engine's compute_boundary_flux functions */
void compute_boundary_flux(const Array2D<bool> & rhs_mask,
const FIELDS &fields,
const FIELDS &fields,
FIELDS &rhs,
const Array< std::set <int> > atomMaterialGroups,
const VectorDependencyManager<SPAR_MAT * > * shpFcnDerivs,
@ -128,12 +128,12 @@ namespace ATC {
DENS_MAN &field_rhs(FieldName thisField) { return rhs_[thisField]; };
/** 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
bool source_atomic_quadrature(FieldName /* field */)
bool source_atomic_quadrature(FieldName /* field */)
{ return (sourceIntegration_ == FULL_DOMAIN_ATOMIC_QUADRATURE_SOURCE); }
ATC::IntegrationDomainType source_integration()
ATC::IntegrationDomainType source_integration()
{ return sourceIntegration_; }
/** wrapper for FE_Engine's compute_sources */
@ -143,25 +143,25 @@ namespace ATC {
FIELD_MATS & atomicSources);
/** computes tangent matrix using atomic quadrature near FE region */
void masked_atom_domain_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
const RHS_MASK & rhsMask,
const FIELDS & fields,
const RHS_MASK & rhsMask,
const FIELDS & fields,
SPAR_MAT & stiffness,
const PhysicsModel * physicsModel);
/** wrapper for FE_Engine's compute_rhs_vector functions */
void compute_rhs_vector(const RHS_MASK & rhs_mask,
const FIELDS &fields,
const FIELDS &fields,
FIELDS &rhs,
const IntegrationDomainType domain, // = FULL_DOMAIN
const PhysicsModel * physicsModel=nullptr);
/** wrapper for FE_Engine's compute_tangent_matrix */
void compute_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
const RHS_MASK & rhsMask,
const FIELDS & fields,
const RHS_MASK & rhsMask,
const FIELDS & fields,
SPAR_MAT & stiffness,
const IntegrationDomainType integrationType,
const PhysicsModel * physicsModel=nullptr);
void tangent_matrix(const std::pair<FieldName,FieldName> row_col,
const RHS_MASK & rhsMask,
const RHS_MASK & rhsMask,
const PhysicsModel * physicsModel,
SPAR_MAT & stiffness);
@ -172,7 +172,7 @@ namespace ATC {
// public for ImplicitSolveOperator
/** return pointer to PrescribedDataManager */
PrescribedDataManager * prescribed_data_manager()
PrescribedDataManager * prescribed_data_manager()
{ return prescribedDataMgr_; }
// public for Kinetostat
// TODO rename to "mass_matrix"
@ -228,7 +228,7 @@ namespace ATC {
void set_mass_mat_time_filter(FieldName thisField,TimeFilterManager::FilterIntegrationType filterIntegrationType);
/** return reference to ExtrinsicModelManager */
ExtrinsicModelManager & extrinsic_model_manager()
ExtrinsicModelManager & extrinsic_model_manager()
{ return extrinsicModelManager_; }
/** access to time integrator */
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 */
void construct_prescribed_data_manager (void);
void construct_prescribed_data_manager (void);
/** method to create physics model */
void create_physics_model(const PhysicsType & physicsType,
std::string matFileName);
@ -289,7 +289,7 @@ namespace ATC {
void set_sources();
/** assemble various contributions to the heat flux in the atomic region */
void compute_atomic_sources(const Array2D<bool> & rhs_mask,
const FIELDS &fields,
const FIELDS &fields,
FIELDS &atomicSources);
DENS_MAT &get_source(FieldName thisField){return sources_[thisField].set_quantity();};
@ -313,25 +313,25 @@ namespace ATC {
//---------------------------------------------------------------
/*@{*/
/** access for field mask */
Array2D<bool> &field_mask() {return fieldMask_;};
Array2D<bool> &field_mask() {return fieldMask_;};
/** create field mask */
void reset_flux_mask();
/** field mask for intrinsic integration */
Array2D<bool> intrinsicMask_;
/** wrapper for FE_Engine's compute_flux functions */
void compute_flux(const Array2D<bool> & rhs_mask,
const FIELDS &fields,
const FIELDS &fields,
GRAD_FIELD_MATS &flux,
const PhysicsModel * physicsModel=nullptr,
const bool normalize = false);
/** evaluate rhs on the atomic domain which is near the FE region */
void masked_atom_domain_rhs_integral(const Array2D<bool> & rhs_mask,
const FIELDS &fields,
const FIELDS &fields,
FIELDS &rhs,
const PhysicsModel * physicsModel);
/** evaluate rhs on a specified domain defined by mask and physics model */
void evaluate_rhs_integral(const Array2D<bool> & rhs_mask,
const FIELDS &fields,
const FIELDS &fields,
FIELDS &rhs,
const IntegrationDomainType domain,
const PhysicsModel * physicsModel=nullptr);
@ -422,8 +422,8 @@ namespace ATC {
/*@{*/
Array<int> elementToMaterialMap_; // ATOMIC_TAG * elementToMaterialMap_;
/** atomic ATC material tag */
Array< std::set <int> > atomMaterialGroups_; // ATOMIC_TAG*atomMaterialGroups_;
Array< std::set <int> > atomMaterialGroupsMask_; // ATOMIC_TAG*atomMaterialGroupsMask_;
/*@}*/
@ -432,7 +432,7 @@ namespace ATC {
/** computational geometry */
//---------------------------------------------------------------
/*@{*/
bool atomQuadForInternal_;
bool atomQuadForInternal_;
MatrixDependencyManager<DenseMatrix, bool> * elementMask_;
MatrixDependencyManager<DenseMatrix, bool> * elementMaskMass_;
MatrixDependencyManager<DenseMatrix, bool> * elementMaskMassMd_;
@ -465,7 +465,7 @@ namespace ATC {
DIAG_MAN * atomicWeightsMask_;
SPAR_MAN * shpFcnMask_;
VectorDependencyManager<SPAR_MAT * > * shpFcnDerivsMask_;
Array<bool> atomMask_;
Array<bool> atomMask_;
SPAR_MAN atomToOverlapMat_;
DIAG_MAN nodalMaskMat_;
/*@}*/
@ -475,7 +475,7 @@ namespace ATC {
//---------------------------------------------------------------
/*@{*/
/** mask for computation of fluxes */
Array2D<bool> fieldMask_;
Array2D<bool> fieldMask_;
DIAG_MAT fluxMask_;
DIAG_MAT fluxMaskComplement_;
/** sources */

View File

@ -20,7 +20,7 @@ namespace ATC {
// Class ATC_CouplingEnergy
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -33,18 +33,18 @@ namespace ATC {
nodalAtomicKineticTemperature_(nullptr),
nodalAtomicConfigurationalTemperature_(nullptr)
{
// Allocate PhysicsModel
// Allocate PhysicsModel
create_physics_model(THERMAL, matParamFile);
// create extrinsic physics model
if (extrinsicModel != NO_MODEL) {
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
}
// Defaults
set_time();
bndyIntType_ = FE_INTERPOLATION;
// set up field data based on physicsModel
physicsModel_->num_fields(fieldSizes_,fieldMask_);
@ -182,16 +182,16 @@ namespace ATC {
// register the per-atom quantity for the temperature definition
interscaleManager_.add_per_atom_quantity(atomEnergyForTemperature,
"AtomicEnergyForTemperature");
// nodal restriction of the atomic energy quantity for the temperature definition
AtfShapeFunctionRestriction * nodalAtomicEnergy = new AtfShapeFunctionRestriction(this,
atomEnergyForTemperature,
shpFcn_);
interscaleManager_.add_dense_matrix(nodalAtomicEnergy,
"NodalAtomicEnergy");
// nodal atomic temperature field
AtfShapeFunctionMdProjection * nodalAtomicTemperature = new AtfShapeFunctionMdProjection(this,
nodalAtomicEnergy,
TEMPERATURE);
@ -210,18 +210,18 @@ namespace ATC {
//---------------------------------------------------------
void ATC_CouplingEnergy::init_filter()
{
TimeIntegrator::TimeIntegrationType timeIntegrationType = timeIntegrators_[TEMPERATURE]->time_integration_type();
if (timeFilterManager_.end_equilibrate()) {
if (timeFilterManager_.end_equilibrate()) {
if (timeIntegrationType==TimeIntegrator::GEAR) {
if (equilibriumStart_) {
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
atomicRegulator_->reset_lambda_contribution(vdotflamMat);
@ -249,7 +249,7 @@ namespace ATC {
{
bool foundMatch = false;
int argIndx = 0;
// check to see if input is a transfer class command
// check derived class before base class
@ -311,19 +311,19 @@ namespace ATC {
// output[2] = average temperature
double mvv2e = lammpsInterface_->mvv2e(); // convert to lammps energy units
if (n == 0) {
Array<FieldName> mask(1);
FIELD_MATS energy;
mask(0) = TEMPERATURE;
feEngine_->compute_energy(mask,
feEngine_->compute_energy(mask,
fields_,
physicsModel_,
elementToMaterialMap_,
energy,
&(elementMask_->quantity()));
double phononEnergy = mvv2e * energy[TEMPERATURE].col_sum();
return phononEnergy;
}
@ -353,9 +353,9 @@ namespace ATC {
_keTemp_ = nodalAtomicKineticTemperature_->quantity();
if (nodalAtomicConfigurationalTemperature_)
_peTemp_ = nodalAtomicConfigurationalTemperature_->quantity();
OUTPUT_LIST outputData;
// base class output
ATC_Method::output();
@ -370,7 +370,7 @@ namespace ATC {
}
atomicRegulator_->output(outputData);
extrinsicModelManager_.output(outputData);
DENS_MAT & temperature(nodalAtomicFields_[TEMPERATURE].set_quantity());
DENS_MAT & dotTemperature(dot_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);
double Ta_mean = (nodalAtomicFields_[TEMPERATURE].quantity()).col_sum(0)/nNodes_;
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);
// different temperature measures, if appropriate
if (nodalAtomicKineticTemperature_)
outputData["kinetic_temperature"] = & _keTemp_;
if (nodalAtomicConfigurationalTemperature_) {
_peTemp_ *= 2; // account for full temperature
outputData["configurational_temperature"] = & _peTemp_;
}
// mesh data
outputData["NodalAtomicTemperature"] = &temperature;
outputData["dot_temperature"] = &dotTemperature;

View File

@ -25,9 +25,9 @@ namespace ATC {
class ATC_CouplingEnergy : public ATC_Coupling {
public:
// constructor
ATC_CouplingEnergy(std::string groupName,
ATC_CouplingEnergy(std::string groupName,
double ** & perAtomArray,
LAMMPS_NS::Fix * thisFix,
std::string matParamFile,
@ -64,7 +64,7 @@ namespace ATC {
/** physics specific filter initialization */
void init_filter();
double compute_lambda_power(int gid);
/** kinetic temperature for post-processing */
@ -77,6 +77,6 @@ namespace ATC {
DENS_MAT _keTemp_, _peTemp_;
};
};
#endif

View File

@ -31,11 +31,11 @@ namespace ATC {
// Class ATC_CouplingMass
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
ATC_CouplingMass::ATC_CouplingMass(string groupName,
ATC_CouplingMass::ATC_CouplingMass(string groupName,
double **& perAtomArray,
LAMMPS_NS::Fix * thisFix,
string matParamFile,
@ -43,19 +43,19 @@ namespace ATC {
: ATC_Coupling(groupName,perAtomArray,thisFix),
resetNlocal_(false)
{
// Allocate PhysicsModel
create_physics_model(SPECIES, matParamFile);
// Allocate PhysicsModel
create_physics_model(SPECIES, matParamFile);
// create extrinsic physics model
if (extrinsicModel != NO_MODEL) {
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
}
// Defaults
set_time();
bndyIntType_ = NO_QUADRATURE;
// set up field data based on physicsModel
physicsModel_->num_fields(fieldSizes_,fieldMask_);
@ -87,13 +87,13 @@ namespace ATC {
//--------------------------------------------------------
// modify
// parses inputs and modifies state
// parses inputs and modifies state
//--------------------------------------------------------
bool ATC_CouplingMass::modify(int narg, char **arg)
{
bool match = false;
// check to see if it is a transfer class command
// check derived class before base class
int argIndex = 0;
// pass-through to concentration regulator
@ -117,7 +117,7 @@ namespace ATC {
//--------------------------------------------------------
void ATC_CouplingMass::initialize()
{
fieldSizes_[SPECIES_CONCENTRATION] = ntracked();
// Base class initalizations
@ -135,9 +135,9 @@ namespace ATC {
FieldManager fmgr(this);
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));
//if (atomicRegulator_->needs_temperature()) {
atomicFields_[TEMPERATURE] = fmgr.nodal_atomic_field(KINETIC_TEMPERATURE, field_to_intrinsic_name(TEMPERATURE));
@ -146,7 +146,7 @@ namespace ATC {
//}
}
else {
throw ATC_Error("ATC_CouplingMass: no tracked species");
}
@ -161,14 +161,14 @@ namespace ATC {
const string moleculeName = molecule->first;
SmallMoleculeSet * smallMoleculeSet = interscaleManager_.small_molecule_set(moleculeName);
SPAR_MAN * shpFcnMol = interscaleManager_.sparse_matrix("ShapeFunction"+moleculeName);
AtomToSmallMoleculeTransfer<double> * moleculeMass =
AtomToSmallMoleculeTransfer<double> * moleculeMass =
new AtomToSmallMoleculeTransfer<double>(this,mass,smallMoleculeSet);
interscaleManager_.add_dense_matrix(moleculeMass,"MoleculeMass"+moleculeName);
MotfShapeFunctionRestriction * nodalAtomicMoleculeMass =
MotfShapeFunctionRestriction * nodalAtomicMoleculeMass =
new MotfShapeFunctionRestriction(moleculeMass,shpFcnMol);
interscaleManager_.add_dense_matrix(nodalAtomicMoleculeMass,"NodalMoleculeMass"+moleculeName);
AtfShapeFunctionMdProjection * nodalAtomicMoleculeMassDensity =
new AtfShapeFunctionMdProjection(this,nodalAtomicMoleculeMass,MASS_DENSITY);
interscaleManager_.add_dense_matrix(nodalAtomicMoleculeMassDensity,"NodalMoleculeMassDensity"+moleculeName);
@ -180,7 +180,7 @@ namespace ATC {
void ATC_CouplingMass::init_filter()
{
ATC_Coupling::init_filter();
}
@ -192,11 +192,11 @@ namespace ATC {
void ATC_CouplingMass::pre_exchange()
{
ATC_Coupling::pre_exchange();
//if (atomicRegulator_->needs_temperature()) {
field(TEMPERATURE) = atomicFields_[TEMPERATURE]->quantity();
field(TEMPERATURE) = atomicFields_[TEMPERATURE]->quantity();
///}
atomicRegulator_->pre_exchange();
atomicRegulator_->pre_exchange();
if (resetNlocal_) {
this->reset_nlocal();
resetNlocal_ = false;
@ -208,7 +208,7 @@ namespace ATC {
// does post-processing steps and outputs data
//--------------------------------------------------------
void ATC_CouplingMass::output()
{
{
if (output_now()) {
feEngine_->departition_mesh();
OUTPUT_LIST outputData;
@ -226,10 +226,10 @@ namespace ATC {
(_tiIt_->second)->output(outputData);
}
extrinsicModelManager_.output(outputData);
atomicRegulator_->output(outputData);
atomicRegulator_->output(outputData);
FIELD_POINTERS::iterator itr;
for (itr=atomicFields_.begin(); itr!=atomicFields_.end();itr++) {
for (itr=atomicFields_.begin(); itr!=atomicFields_.end();itr++) {
FieldName name = itr->first;
const DENS_MAT & data = (itr->second)->quantity();
outputData[field_to_intrinsic_name(name)] = & data;

View File

@ -32,20 +32,20 @@ namespace ATC {
class ATC_CouplingMass : public ATC_Coupling {
public:
// constructor
ATC_CouplingMass(std::string groupName,
ATC_CouplingMass(std::string groupName,
double **& perAtomArray,
LAMMPS_NS::Fix * thisFix,
std::string matParamFile,
ExtrinsicModelType extrinsic = NO_MODEL);
// destructor
virtual ~ATC_CouplingMass();
/** parser/modifier */
virtual bool modify(int narg, char **arg);
/** pre time integration */
virtual void initialize();
@ -78,8 +78,8 @@ namespace ATC {
bool resetNlocal_;
// i.e. we only need the correct shape function matrix for restriction
};

View File

@ -22,11 +22,11 @@ namespace ATC {
// Class ATC_CouplingMomentum
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
ATC_CouplingMomentum::ATC_CouplingMomentum(string groupName,
ATC_CouplingMomentum::ATC_CouplingMomentum(string groupName,
double **& perAtomArray,
LAMMPS_NS::Fix * thisFix,
string matParamFile,
@ -35,14 +35,14 @@ namespace ATC {
: ATC_Coupling(groupName,perAtomArray,thisFix),
refPE_(0)
{
// Allocate PhysicsModel
// Allocate PhysicsModel
create_physics_model(intrinsicModel, matParamFile);
// create extrinsic physics model
if (extrinsicModel != NO_MODEL) {
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
}
// set up field data based on physicsModel
physicsModel_->num_fields(fieldSizes_,fieldMask_);
@ -166,14 +166,14 @@ namespace ATC {
atomicMassWeightedDisplacement = new AtomicMassWeightedDisplacement(this);
interscaleManager_.add_per_atom_quantity(atomicMassWeightedDisplacement,
"AtomicMassWeightedDisplacement");
// nodal (RHS) mass-weighted displacement
AtfShapeFunctionRestriction * nodalAtomicMassWeightedDisplacement = new AtfShapeFunctionRestriction(this,
atomicMassWeightedDisplacement,
shpFcn_);
interscaleManager_.add_dense_matrix(nodalAtomicMassWeightedDisplacement,
"NodalAtomicMassWeightedDisplacement");
// nodal displacement derived only from atoms
AtfShapeFunctionMdProjection * nodalAtomicDisplacement = new AtfShapeFunctionMdProjection(this,
nodalAtomicMassWeightedDisplacement,
@ -194,7 +194,7 @@ namespace ATC {
//---------------------------------------------------------
void ATC_CouplingMomentum::init_filter()
{
ATC_Coupling::init_filter();
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();
// Set sources
prescribedDataMgr_->set_sources(time(),sources_);
extrinsicModelManager_.set_sources(fields_,extrinsicSources_);
extrinsicModelManager_.pre_final_integrate();
if (outputNow_) {
update_time(1.0);
update_step();
output();
outputNow_ = false;
}
localStep_ += 1;
}
//--------------------------------------------------------
// output
// does post-processing steps and outputs data
//--------------------------------------------------------
void ATC_CouplingMomentum::output()
void ATC_CouplingMomentum::output()
{
if (output_now()) {
feEngine_->departition_mesh();
OUTPUT_LIST outputData;
// base class output
ATC_Method::output();
@ -331,7 +331,7 @@ namespace ATC {
}
atomicRegulator_->output(outputData);
extrinsicModelManager_.output(outputData);
DENS_MAT & velocity(nodalAtomicFields_[VELOCITY].set_quantity());
DENS_MAT & rhs(rhs_[VELOCITY].set_quantity());
if (lammpsInterface_->rank_zero()) {
@ -341,7 +341,7 @@ namespace ATC {
if (trackDisplacement_) {
outputData["NodalAtomicDisplacement"] = & nodalAtomicFields_[DISPLACEMENT].set_quantity();
}
feEngine_->write_data(output_index(), fields_, & outputData);
}
// force optional variables to reset to keep in sync
@ -376,7 +376,7 @@ namespace ATC {
kineticEnergy += v.dot(M*v);
}
if (domain == FE_DOMAIN) {
Array<FieldName> massMask(1);
massMask(0) = VELOCITY;
feEngine_->compute_lumped_mass_matrix(massMask,fields_,physicsModel_,atomMaterialGroups_,
@ -388,20 +388,20 @@ namespace ATC {
kineticEnergy -= v.dot(Ma*v);
}
}
double mvv2e = lammpsInterface_->mvv2e();
double mvv2e = lammpsInterface_->mvv2e();
kineticEnergy *= 0.5*mvv2e; // convert to LAMMPS units
return kineticEnergy;
}
//--------------------------------------------------------------------
// potential/strain energy
// potential/strain energy
//--------------------------------------------------------------------
double ATC_CouplingMomentum::potential_energy(const IntegrationDomainType domain) const
{
Array<FieldName> mask(1);
mask(0) = VELOCITY;
FIELD_MATS energy;
feEngine_->compute_energy(mask,
feEngine_->compute_energy(mask,
fields_,
physicsModel_,
elementToMaterialMap_,
@ -424,7 +424,7 @@ namespace ATC {
// output[3] = total coarse scale energy
// output[4] = fe-only coarse scale kinetic energy
// output[5] = fe-only coarse scale potential energy
if (n == 0) {

View File

@ -26,21 +26,21 @@ namespace ATC {
class ATC_CouplingMomentum : public ATC_Coupling {
public:
// constructor
ATC_CouplingMomentum(std::string groupName,
ATC_CouplingMomentum(std::string groupName,
double **& perAtomArray,
LAMMPS_NS::Fix * thisFix,
std::string matParamFile,
PhysicsType intrinsicModel,
ExtrinsicModelType extrinsicModel = NO_MODEL);
// destructor
virtual ~ATC_CouplingMomentum();
/** parser/modifier */
virtual bool modify(int narg, char **arg);
/** pre time integration */
virtual void initialize();

View File

@ -22,7 +22,7 @@ namespace ATC {
// Class ATC_CouplingMomentumEnergy
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -36,12 +36,12 @@ namespace ATC {
nodalAtomicConfigurationalTemperature_(nullptr),
refPE_(0)
{
// Allocate PhysicsModel
// Allocate PhysicsModel
create_physics_model(THERMO_ELASTIC, matParamFile);
// create extrinsic physics model
if (extrinsicModel != NO_MODEL) {
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
extrinsicModelManager_.create_model(extrinsicModel,matParamFile);
}
// set up field data based on physicsModel
@ -129,14 +129,14 @@ namespace ATC {
AtomicMomentum * atomicMomentum = new AtomicMomentum(this);
interscaleManager_.add_per_atom_quantity(atomicMomentum,
"AtomicMomentum");
// nodal momentum for RHS
AtfShapeFunctionRestriction * nodalAtomicMomentum = new AtfShapeFunctionRestriction(this,
atomicMomentum,
shpFcn_);
interscaleManager_.add_dense_matrix(nodalAtomicMomentum,
"NodalAtomicMomentum");
// nodal forces
FundamentalAtomQuantity * atomicForce = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE);
AtfShapeFunctionRestriction * nodalAtomicForce = new AtfShapeFunctionRestriction(this,
@ -144,14 +144,14 @@ namespace ATC {
shpFcn_);
interscaleManager_.add_dense_matrix(nodalAtomicForce,
"NodalAtomicForce");
// nodal velocity derived only from atoms
AtfShapeFunctionMdProjection * nodalAtomicVelocity = new AtfShapeFunctionMdProjection(this,
nodalAtomicMomentum,
VELOCITY);
interscaleManager_.add_dense_matrix(nodalAtomicVelocity,
"NodalAtomicVelocity");
if (trackDisplacement_) {
// mass-weighted (center-of-mass) displacement of each atom
AtomicMassWeightedDisplacement * atomicMassWeightedDisplacement;
@ -166,14 +166,14 @@ namespace ATC {
atomicMassWeightedDisplacement = new AtomicMassWeightedDisplacement(this);
interscaleManager_.add_per_atom_quantity(atomicMassWeightedDisplacement,
"AtomicMassWeightedDisplacement");
// nodal (RHS) mass-weighted displacement
AtfShapeFunctionRestriction * nodalAtomicMassWeightedDisplacement = new AtfShapeFunctionRestriction(this,
atomicMassWeightedDisplacement,
shpFcn_);
interscaleManager_.add_dense_matrix(nodalAtomicMassWeightedDisplacement,
"NodalAtomicMassWeightedDisplacement");
// nodal displacement derived only from atoms
AtfShapeFunctionMdProjection * nodalAtomicDisplacement = new AtfShapeFunctionMdProjection(this,
nodalAtomicMassWeightedDisplacement,
@ -183,7 +183,7 @@ namespace ATC {
}
// always need fluctuating velocity and kinetic energy
FtaShapeFunctionProlongation * atomicMeanVelocity = new FtaShapeFunctionProlongation(this,&fields_[VELOCITY],shpFcn_);
interscaleManager_.add_per_atom_quantity(atomicMeanVelocity,
field_to_prolongation_name(VELOCITY));
@ -267,16 +267,16 @@ namespace ATC {
// register the per-atom quantity for the temperature definition
interscaleManager_.add_per_atom_quantity(atomEnergyForTemperature,
"AtomicEnergyForTemperature");
// nodal restriction of the atomic energy quantity for the temperature definition
AtfShapeFunctionRestriction * nodalAtomicEnergy = new AtfShapeFunctionRestriction(this,
atomEnergyForTemperature,
shpFcn_);
interscaleManager_.add_dense_matrix(nodalAtomicEnergy,
"NodalAtomicEnergy");
// nodal atomic temperature field
AtfShapeFunctionMdProjection * nodalAtomicTemperature = new AtfShapeFunctionMdProjection(this,
nodalAtomicEnergy,
TEMPERATURE);
@ -299,17 +299,17 @@ namespace ATC {
throw ATC_Error("ATC_CouplingMomentumEnergy::initialize - method only valid with fractional step time integration");
}
ATC_Coupling::init_filter();
if (timeFilterManager_.end_equilibrate() && equilibriumStart_) {
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
atomicRegulator_->reset_lambda_contribution(nodalAtomicFieldsRoc_[VELOCITY].quantity(),VELOCITY);
DENS_MAT powerMat(-1.*(nodalAtomicFields_[TEMPERATURE].quantity()));
atomicRegulator_->reset_lambda_contribution(powerMat,TEMPERATURE);
}
@ -360,7 +360,7 @@ namespace ATC {
Array<FieldName> mask(1);
mask(0) = VELOCITY;
FIELD_MATS energy;
feEngine_->compute_energy(mask,
feEngine_->compute_energy(mask,
fields_,
physicsModel_,
elementToMaterialMap_,
@ -371,7 +371,7 @@ namespace ATC {
potentialEnergy *= mvv2e; // convert to LAMMPS units
return potentialEnergy-refPE_;
}
//--------------------------------------------------------------------
// compute_vector
//--------------------------------------------------------------------
@ -399,14 +399,14 @@ namespace ATC {
Array<FieldName> mask(1);
FIELD_MATS energy;
mask(0) = TEMPERATURE;
feEngine_->compute_energy(mask,
feEngine_->compute_energy(mask,
fields_,
physicsModel_,
elementToMaterialMap_,
energy,
&(elementMask_->quantity()));
double phononEnergy = mvv2e * energy[TEMPERATURE].col_sum();
return phononEnergy;
}
@ -435,9 +435,9 @@ namespace ATC {
_keTemp_ = nodalAtomicKineticTemperature_->quantity();
if (nodalAtomicConfigurationalTemperature_)
_peTemp_ = nodalAtomicConfigurationalTemperature_->quantity();
OUTPUT_LIST outputData;
// base class output
ATC_Method::output();
@ -447,13 +447,13 @@ namespace ATC {
}
// auxiliary data
for (_tiIt_ = timeIntegrators_.begin(); _tiIt_ != timeIntegrators_.end(); ++_tiIt_) {
(_tiIt_->second)->output(outputData);
}
atomicRegulator_->output(outputData);
extrinsicModelManager_.output(outputData);
DENS_MAT & velocity(nodalAtomicFields_[VELOCITY].set_quantity());
DENS_MAT & rhs(rhs_[VELOCITY].set_quantity());
DENS_MAT & temperature(nodalAtomicFields_[TEMPERATURE].set_quantity());
@ -469,18 +469,18 @@ namespace ATC {
feEngine_->add_global("temperature_std_dev", T_stddev);
double Ta_mean = (nodalAtomicFields_[TEMPERATURE].quantity()).col_sum(0)/nNodes_;
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);
// different temperature measures, if appropriate
if (nodalAtomicKineticTemperature_)
outputData["kinetic_temperature"] = & _keTemp_;
if (nodalAtomicConfigurationalTemperature_) {
_peTemp_ *= 2; // account for full temperature
outputData["configurational_temperature"] = & _peTemp_;
}
// mesh data
outputData["NodalAtomicVelocity"] = &velocity;
outputData["FE_Force"] = &rhs;
@ -491,10 +491,10 @@ namespace ATC {
outputData["ddot_temperature"] = &ddotTemperature;
outputData["NodalAtomicPower"] = &rocTemperature;
outputData["fePower"] = &fePower;
feEngine_->write_data(output_index(), fields_, & outputData);
}
// hence propagation is performed on proc 0 but not others.
// The real fix is to have const data in the output list
// force optional variables to reset to keep in sync

View File

@ -25,9 +25,9 @@ namespace ATC {
class ATC_CouplingMomentumEnergy : public ATC_Coupling {
public:
// constructor
ATC_CouplingMomentumEnergy(std::string groupName,
ATC_CouplingMomentumEnergy(std::string groupName,
double ** & perAtomArray,
LAMMPS_NS::Fix * thisFix,
std::string matParamFile,
@ -78,6 +78,6 @@ namespace ATC {
// data
double refPE_;
};
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -66,12 +66,12 @@ namespace ATC {
/** Predictor phase, executed before Verlet */
virtual void pre_init_integrate() {
feEngine_->partition_mesh();
feEngine_->partition_mesh();
update_step();
};
/** Predictor phase, Verlet first step for velocity and position */
virtual void init_integrate();
virtual void init_integrate();
/** Predictor phase, executed after Verlet */
virtual void post_init_integrate();
@ -127,7 +127,7 @@ namespace ATC {
/** access to interscale manager */
InterscaleManager & interscale_manager() {return interscaleManager_;};
/** access to lammps interface */
LammpsInterface const * lammps_interface() const {return lammpsInterface_;};
/** access to time filter */
TimeFilterManager * time_filter_manager() {return &timeFilterManager_;};
@ -142,7 +142,7 @@ namespace ATC {
/** compute vector for output */
virtual double compute_vector(int /* n */) {return 0.;}
/** 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 vector_flag() const {return vectorFlag_;}
int size_vector() const {return sizeVector_;}
@ -164,16 +164,16 @@ namespace ATC {
/** time/step functions */
bool sample_now(void) const
{
{
int s = step();
bool now = ( (sampleFrequency_ > 0) && (s % sampleFrequency_ == 0));
return now;
}
bool output_now(void) const
{
{
int s = step();
bool now = ( (outputFrequency_ > 0) && (s == 1 || s % outputFrequency_ == 0) );
bool now = ( (outputFrequency_ > 0) && (s == 1 || s % outputFrequency_ == 0) );
now = now || outputNow_;
return now;
}
@ -328,7 +328,7 @@ namespace ATC {
const std::map<std::string,std::pair<MolSize,int> > & molecule_ids() const {return moleculeIds_;};
/** access to internal element set */
const std::string & internal_element_set() {return internalElementSet_;};
//----------------------------------------------------------------
/** \name mass matrix operations */
@ -339,7 +339,7 @@ namespace ATC {
// inverted using GMRES
void apply_inverse_mass_matrix(MATRIX & data, FieldName thisField)
{
if (useConsistentMassMatrix_(thisField)) {
//data = consistentMassInverse_*data;
data = (consistentMassMatsInv_[thisField].quantity())*data;
@ -351,7 +351,7 @@ namespace ATC {
void apply_inverse_mass_matrix(const MATRIX & data_in, MATRIX & data_out,
FieldName thisField)
{
if (useConsistentMassMatrix_(thisField)) {
if (useConsistentMassMatrix_(thisField)) {
//data_out = consistentMassInverse_*data_in;
data_out = (consistentMassMatsInv_[thisField].quantity())*data_in;
return;
@ -365,7 +365,7 @@ namespace ATC {
DIAG_MAN &mass_mat(FieldName thisField)
{ return massMats_[thisField];};
//---------------------------------------------------------------
/** \name mass matrices */
@ -383,13 +383,13 @@ namespace ATC {
void register_mass_matrix_dependency(DependencyManager * dependent,
FieldName thisField)
{
if (useConsistentMassMatrix_(thisField)) {
if (useConsistentMassMatrix_(thisField)) {
consistentMassMatsInv_[thisField].register_dependence(dependent);
return;
}
massMatsInv_[thisField].register_dependence(dependent);
};
void apply_inverse_md_mass_matrix(MATRIX & data, FieldName thisField)
{ data = (massMatsMdInv_[thisField].quantity())*data; };
void register_md_mass_matrix_dependency(DependencyManager * dependent,
@ -416,11 +416,11 @@ namespace ATC {
return man->second;
};
/*@}*/
//----------------------------------------------------------------
/** \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_on_the_fly() const { return kernelOnTheFly_;}
bool has_kernel_function() { return kernelFunction_ != nullptr; }
@ -439,20 +439,20 @@ namespace ATC {
double ke_scale() { return keScale_; }
double pe_scale() { return peScale_; }
/** 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);
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,
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 */
void restrict_volumetric_quantity(const MATRIX &atomData,
MATRIX &nodeData);
MATRIX &nodeData);
void restrict_volumetric_quantity(const MATRIX &atomData,
MATRIX &nodeData,
const SPAR_MAT & shpFcn);
@ -474,7 +474,7 @@ namespace ATC {
protected: /** methods */
/** time functions */
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();
simTime_ += alpha*dt;
@ -506,7 +506,7 @@ namespace ATC {
virtual void read_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 */
DIAG_MAT massMatInv_;
@ -564,11 +564,11 @@ namespace ATC {
void reset_fields();
private: /** methods */
private: /** methods */
ATC_Method(); // do not define
protected: /** data */
/* parsed input requires changes */
bool needReset_;
@ -609,7 +609,7 @@ namespace ATC {
PerAtomQuantity<double> * atomProcGhostCoarseGrainingPositions_;
PerAtomQuantity<double> * atomReferencePositions_;
/** number of unique FE nodes */
int nNodes_;
@ -631,17 +631,17 @@ namespace ATC {
bool trackDisplacement_;
/** map from reference positions to element id, pointer is to internal only */
bool needsAtomToElementMap_;
PerAtomQuantity<int> * atomElement_;
PerAtomQuantity<int> * atomGhostElement_;
/* use element sets to define internal and/or ghost regions */
std::string internalElementSet_;
/** atomic ATC material tag */
double Xprd_,Yprd_,Zprd_; // lengths of periodic box in reference frame
double XY_,YZ_,XZ_;
double boxXlo_,boxXhi_; // lo/hi bounds of periodic box in reference frame
@ -671,22 +671,22 @@ namespace ATC {
/** base name for output files */
std::string outputPrefix_;
/** output flag */
/** output flag */
bool outputNow_;
/** output time or step (for lammps compatibility) */
bool outputTime_;
/** output frequency */
int outputFrequency_;
/** sample frequency */
int sampleFrequency_;
/** sample counter */
int sampleCounter_;
TAG_FIELDS filteredData_;
TAG_FIELDS filteredData_;
double peScale_,keScale_;
@ -702,7 +702,7 @@ namespace ATC {
int sizeVector_; // N = size of global vector
int scalarVectorFreq_; // frequency compute s/v data is available at
int sizePerAtomCols_; // N = size of per atom vector to dump
double **perAtomOutput_; // per atom data
double **&perAtomArray_; // per atom data
int extScalar_; // 0/1 if scalar is intensive/extensive
@ -724,15 +724,15 @@ namespace ATC {
/** \name time integration and filtering fields */
//---------------------------------------------------------------
/*@{*/
FIELDS dot_fields_;
FIELDS dot_fields_;
FIELDS ddot_fields_;
FIELDS dddot_fields_;
/** Restricted Fields */
FIELDS nodalAtomicFields_; // replaces fieldNdFiltered_
FIELDS nodalAtomicFieldsRoc_;
FIELDS nodalAtomicFieldsRoc_;
/*@}*/
@ -740,9 +740,9 @@ namespace ATC {
/** \name quadrature weights */
//---------------------------------------------------------------
/*@{*/
DIAG_MAT NodeVolumes_;
DIAG_MAN invNodeVolumes_;
DIAG_MAT NodeVolumes_;
DIAG_MAN invNodeVolumes_;
/** atomic quadrature integration weights (V_\alpha) */
ProtectedAtomDiagonalMatrix<double> * atomVolume_;
std::string atomicWeightsFile_;
@ -770,7 +770,7 @@ namespace ATC {
bool needProcGhost_;
std::string groupTag_;
std::string groupTagGhost_;
/** number of atoms of correct type,
ghosts are atoms outside our domain of interest
boundary are atoms contributing to boundary flux terms */
@ -824,7 +824,7 @@ namespace ATC {
SPAR_MAN kernelAccumulantMol_; // KKM add
SPAR_MAN kernelAccumulantMolGrad_; // KKM add
DIAG_MAN* accumulantWeights_;
DIAG_MAN* accumulantInverseVolumes_;
DIAG_MAN* accumulantInverseVolumes_;
int accumulantBandwidth_;
/*@}*/
@ -845,7 +845,7 @@ namespace ATC {
//---------------------------------------------------------------
/** \name reference data */
/** \name reference data */
//---------------------------------------------------------------
bool hasRefPE_;
bool setRefPE_;

View File

@ -68,7 +68,7 @@ namespace ATC {
LAMMPS_NS::Fix * thisFix,
string matParamFile)
: ATC_Method(groupName,perAtomArray,thisFix),
xPointer_(nullptr),
xPointer_(nullptr),
outputStepZero_(true),
neighborReset_(false),
pairMap_(nullptr),
@ -95,7 +95,7 @@ namespace ATC {
lmp->lattice(cb.cell_vectors, cb.basis_vectors);
cb.inv_atom_volume = 1.0 / lmp->volume_per_atom();
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.hbar = lmp->hbar();
cauchyBornStress_ = new StressCauchyBorn(fileId, cb);
@ -103,7 +103,7 @@ namespace ATC {
// Defaults
set_time();
outputFlags_.reset(NUM_TOTAL_FIELDS);
outputFlags_ = false;
fieldFlags_.reset(NUM_TOTAL_FIELDS);
@ -117,20 +117,20 @@ namespace ATC {
for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = nullptr; }
// Hardy requires ref positions for processor ghosts for bond list
//needXrefProcessorGhosts_ = true;
}
//-------------------------------------------------------------------
ATC_Transfer::~ATC_Transfer()
{
interscaleManager_.clear();
if (cauchyBornStress_) delete cauchyBornStress_;
interscaleManager_.clear();
if (cauchyBornStress_) delete cauchyBornStress_;
}
//-------------------------------------------------------------------
// called before the beginning of a "run"
void ATC_Transfer::initialize()
void ATC_Transfer::initialize()
{
if (kernelOnTheFly_ && !readRefPE_ && !setRefPEvalue_) {
if (setRefPE_) {
@ -143,7 +143,7 @@ namespace ATC {
ATC_Method::initialize();
if (!initialized_) {
if (!initialized_) {
if (cauchyBornStress_) cauchyBornStress_->initialize();
}
@ -164,16 +164,16 @@ namespace ATC {
ghostManager_.initialize();
// initialize bond matrix B_Iab
if ((! bondOnTheFly_)
&& ( ( fieldFlags_(STRESS)
|| fieldFlags_(ESHELBY_STRESS)
if ((! bondOnTheFly_)
&& ( ( fieldFlags_(STRESS)
|| fieldFlags_(ESHELBY_STRESS)
|| fieldFlags_(HEAT_FLUX) ) ) ) {
try {
compute_bond_matrix();
}
catch(bad_alloc&) {
compute_bond_matrix();
}
catch(bad_alloc&) {
ATC::LammpsInterface::instance()->print_msg("stress/heat_flux will be computed on-the-fly");
bondOnTheFly_ = true;
}
}
@ -181,7 +181,7 @@ namespace ATC {
// set sample frequency to output if sample has not be specified
if (sampleFrequency_ == 0) sampleFrequency_ = outputFrequency_;
// output for step 0
// output for step 0
if (!initialized_) {
if (outputFrequency_ > 0) {
// initialize filtered data
@ -224,9 +224,9 @@ namespace ATC {
lammpsInterface_->computes_addstep(lammpsInterface_->ntimestep()+sampleFrequency_);
//remap_ghost_ref_positions();
update_peratom_output();
update_peratom_output();
}
//-------------------------------------------------------------------
@ -242,7 +242,7 @@ namespace ATC {
void ATC_Transfer::construct_time_integration_data()
{
if (!initialized_) {
// size arrays for requested/required fields
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
if (fieldFlags_(index)) {
@ -298,13 +298,13 @@ namespace ATC {
{
// interpolant
if (!(kernelOnTheFly_)) {
// finite element shape functions for interpolants
// finite element shape functions for interpolants
PerAtomShapeFunction * atomShapeFunctions = new PerAtomShapeFunction(this);
interscaleManager_.add_per_atom_sparse_matrix(atomShapeFunctions,"Interpolant");
shpFcn_ = atomShapeFunctions;
}
// accummulant and weights
this->create_atom_volume();
// accumulants
if (kernelFunction_) {
@ -312,7 +312,7 @@ namespace ATC {
if (kernelOnTheFly_) {
ConstantQuantity<double> * atomCount = new ConstantQuantity<double>(this,1.);
interscaleManager_.add_per_atom_quantity(atomCount,"AtomCount");
OnTheFlyKernelAccumulation * myWeights
OnTheFlyKernelAccumulation * myWeights
= new OnTheFlyKernelAccumulation(this,
atomCount, kernelFunction_, atomCoarseGrainingPositions_);
interscaleManager_.add_dense_matrix(myWeights,
@ -337,7 +337,7 @@ namespace ATC {
if (kernelOnTheFly_) {
ConstantQuantity<double> * atomCount = new ConstantQuantity<double>(this,1.);
interscaleManager_.add_per_atom_quantity(atomCount,"AtomCount");
OnTheFlyMeshAccumulation * myWeights
OnTheFlyMeshAccumulation * myWeights
= new OnTheFlyMeshAccumulation(this,
atomCount, atomCoarseGrainingPositions_);
interscaleManager_.add_dense_matrix(myWeights,
@ -363,13 +363,13 @@ namespace ATC {
// molecule centroid, molecule charge, dipole moment and quadrupole moment calculations KKM add
if (!moleculeIds_.empty()) {
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");
FundamentalAtomQuantity * mass = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS,PROC_GHOST);
molecule = moleculeIds_.begin();
int groupbit = (molecule->second).second;
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");
moleculeCentroid_ = new SmallMoleculeCentroid(this,mass,smallMoleculeSet_,atomProcGhostCoarseGrainingPositions_);
interscaleManager_.add_dense_matrix(moleculeCentroid_,"MoleculeCentroid");
@ -393,7 +393,7 @@ namespace ATC {
// set pointer to positions
// REFACTOR use method's handling of xref/xpointer
set_xPointer();
set_xPointer();
ATC_Method::construct_transfers();
@ -412,7 +412,7 @@ namespace ATC {
}
// for hardy-based fluxes
bool needsBondMatrix = (! bondOnTheFly_ ) &&
(fieldFlags_(STRESS)
|| fieldFlags_(ESHELBY_STRESS)
@ -434,7 +434,7 @@ namespace ATC {
const FE_Mesh * fe_mesh = feEngine_->fe_mesh();
if (!kernelBased_) {
bondMatrix_ = new BondMatrixPartitionOfUnity(lammpsInterface_,*pairMap_,xPointer_,fe_mesh,accumulantInverseVolumes_);
bondMatrix_ = new BondMatrixPartitionOfUnity(lammpsInterface_,*pairMap_,xPointer_,fe_mesh,accumulantInverseVolumes_);
}
else {
bondMatrix_ = new BondMatrixKernel(lammpsInterface_,*pairMap_,xPointer_,fe_mesh,kernelFunction_);
@ -470,7 +470,7 @@ namespace ATC {
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) {
FieldName index = indices_[i];
if (fieldFlags_(index)) {
@ -492,9 +492,9 @@ namespace ATC {
interscaleManager_.add_per_atom_quantity(c,tag);
int projection = iter->second;
DIAG_MAN * w = nullptr;
if (projection == VOLUME_NORMALIZATION )
if (projection == VOLUME_NORMALIZATION )
{ w = accumulantInverseVolumes_; }
else if (projection == NUMBER_NORMALIZATION )
else if (projection == NUMBER_NORMALIZATION )
{ w = accumulantWeights_; }
if (kernelFunction_ && kernelOnTheFly_) {
OnTheFlyKernelAccumulationNormalized * C = new OnTheFlyKernelAccumulationNormalized(this, c, kernelFunction_, atomCoarseGrainingPositions_, w);
@ -507,7 +507,7 @@ namespace ATC {
outputFieldsTagged_[tag] = C;
}
}
}
//-------------------------------------------------------------------
@ -519,18 +519,18 @@ namespace ATC {
if ((!initialized_) || timeFilterManager_.need_reset()) {
timeFilters_.reset(NUM_TOTAL_FIELDS+nComputes_);
sampleCounter_ = 0;
// for filtered fields
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
if (fieldFlags_(index)) {
string name = field_to_string((FieldName) index);
filteredData_[name] = 0.0;
timeFilters_(index) = timeFilterManager_.construct();
timeFilters_(index) = timeFilterManager_.construct();
}
}
// for filtered projected computes
// lists/accessing of fields ( & computes)
map <string,int>::const_iterator iter;
int index = NUM_TOTAL_FIELDS;
@ -546,7 +546,7 @@ namespace ATC {
//-------------------------------------------------------------------
// called after the end of a "run"
void ATC_Transfer::finish()
void ATC_Transfer::finish()
{
// base class
ATC_Method::finish();
@ -560,7 +560,7 @@ namespace ATC {
int argIdx = 0;
// 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
fix_modify AtC fields <all | none> \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
kinetic_temperature : temperature derived from the full kinetic energy \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
1st Piola-Kirchhoff stress tensor for lagrangian analysis \n
transformed_stress :
1st Piola-Kirchhoff stress tensor for eulerian analysis (atom_element_map), or
transformed_stress :
1st Piola-Kirchhoff stress tensor for eulerian analysis (atom_element_map), or
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
potential_energy : potential 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
number_density : number of atoms per unit volume \n
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
vacancy_concentration: volume fraction of vacancy content \n
type_concentration: volume fraction of a specific atom type \n
\section examples
<TT> fix_modify AtC fields add velocity temperature </TT>
\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
<TT> fix_modify AtC fields none </TT> \n
followed by \n
<TT> fix_modify AtC fields none </TT> \n
followed by \n
<TT> fix_modify AtC fields add velocity temperature </TT> \n
will only output the velocity and temperature fields.
\section restrictions
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
central force potentials, e.g. Lennard-Jones and EAM
Currently, the stress and heat flux formulas are only correct for
central force potentials, e.g. Lennard-Jones and EAM
but not Stillinger-Weber.
\section related
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) {
argIdx++;
if (strcmp(arg[argIdx],"all")==0) {
if (strcmp(arg[argIdx],"all")==0) {
outputFlags_ = true;
match = true;
}
else if (strcmp(arg[argIdx],"none")==0) {
}
else if (strcmp(arg[argIdx],"none")==0) {
outputFlags_ = false;
match = true;
}
else if (strcmp(arg[argIdx],"add")==0) {
}
else if (strcmp(arg[argIdx],"add")==0) {
argIdx++;
for (int i = argIdx; i < narg; ++i) {
FieldName field_name = string_to_field(arg[i]);
outputFlags_(field_name) = true;
outputFlags_(field_name) = true;
}
match = true;
}
else if (strcmp(arg[argIdx],"delete")==0) {
}
else if (strcmp(arg[argIdx],"delete")==0) {
argIdx++;
for (int i = argIdx; i < narg; ++i) {
FieldName field_name = string_to_field(arg[i]);
outputFlags_(field_name) = false;
outputFlags_(field_name) = false;
}
match = true;
}
}
check_field_dependencies();
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
- fields (keyword) = \n
gradients can be calculated for all fields listed in \ref man_hardy_fields
\section examples
<TT> fix_modify AtC gradients add temperature velocity stress </TT> \n
<TT> fix_modify AtC gradients delete velocity </TT> \n
\section description
Requests calculation and output of gradients of the fields from the
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 )
\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 )
\section related
\section default
@ -667,33 +667,33 @@ namespace ATC {
*/
else if (strcmp(arg[argIdx],"gradients")==0) {
argIdx++;
if (strcmp(arg[argIdx],"add")==0) {
if (strcmp(arg[argIdx],"add")==0) {
argIdx++;
FieldName field_name;
for (int i = argIdx; i < narg; ++i) {
field_name = string_to_field(arg[i]);
gradFlags_(field_name) = true;
gradFlags_(field_name) = true;
}
match = true;
}
else if (strcmp(arg[argIdx],"delete")==0) {
}
else if (strcmp(arg[argIdx],"delete")==0) {
argIdx++;
FieldName field_name;
for (int i = argIdx; i < narg; ++i) {
field_name = string_to_field(arg[i]);
gradFlags_(field_name) = false;
gradFlags_(field_name) = false;
}
match = true;
}
}
}
/*! \page man_hardy_rates fix_modify AtC rates
/*! \page man_hardy_rates fix_modify AtC rates
\section syntax
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
- fields (keyword) = \n
rates can be calculated for all fields listed in \ref man_hardy_fields
\section examples
<TT> fix_modify AtC rates add temperature velocity 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
derivatives. \n
\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 )
\section related
\section default
@ -711,16 +711,16 @@ namespace ATC {
*/
else if (strcmp(arg[argIdx],"rates")==0) {
argIdx++;
if (strcmp(arg[argIdx],"add")==0) {
if (strcmp(arg[argIdx],"add")==0) {
argIdx++;
FieldName field_name;
for (int i = argIdx; i < narg; ++i) {
field_name = string_to_field(arg[i]);
rateFlags_(field_name) = true;
rateFlags_(field_name) = true;
}
match = true;
}
else if (strcmp(arg[argIdx],"delete")==0) {
}
else if (strcmp(arg[argIdx],"delete")==0) {
argIdx++;
FieldName field_name;
for (int i = argIdx; i < narg; ++i) {
@ -728,7 +728,7 @@ namespace ATC {
rateFlags_(field_name) = false;
}
match = true;
}
}
}
@ -736,7 +736,7 @@ namespace ATC {
\section syntax
fix_modify AtC pair_interactions <on|off> \n
fix_modify AtC bond_interactions <on|off> \n
\section examples
<TT> fix_modify AtC bond_interactions on </TT> \n
\section description
@ -748,27 +748,27 @@ namespace ATC {
*/
if (strcmp(arg[argIdx],"pair_interactions")==0) { // default true
argIdx++;
if (strcmp(arg[argIdx],"on")==0) { hasPairs_ = true; }
if (strcmp(arg[argIdx],"on")==0) { hasPairs_ = true; }
else { hasPairs_ = false;}
match = true;
}
}
if (strcmp(arg[argIdx],"bond_interactions")==0) { // default false
argIdx++;
if (strcmp(arg[argIdx],"on")==0) { hasBonds_ = true; }
if (strcmp(arg[argIdx],"on")==0) { hasBonds_ = true; }
else { hasBonds_ = false;}
match = true;
}
/*! \page man_hardy_computes fix_modify AtC computes
}
/*! \page man_hardy_computes fix_modify AtC computes
\section syntax
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
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
- 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
<TT> compute virial all stress/atom </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
Per-atom compute must be specified before corresponding continuum field can be requested \n
\section related
See manual page for compute
See manual page for compute
\section default
No defaults exist for this command
*/
else if (strcmp(arg[argIdx],"computes")==0) {
argIdx++;
if (strcmp(arg[argIdx],"add")==0) {
if (strcmp(arg[argIdx],"add")==0) {
argIdx++;
string tag(arg[argIdx++]);
int normalization = NO_NORMALIZATION;
if (narg > argIdx) {
if (strcmp(arg[argIdx],"volume")==0) {
if (strcmp(arg[argIdx],"volume")==0) {
normalization = VOLUME_NORMALIZATION;
}
else if (strcmp(arg[argIdx],"number")==0) {
else if (strcmp(arg[argIdx],"number")==0) {
normalization = NUMBER_NORMALIZATION;
}
else if (strcmp(arg[argIdx],"mass")==0) {
else if (strcmp(arg[argIdx],"mass")==0) {
normalization = MASS_NORMALIZATION;
throw ATC_Error("mass normalized not implemented");
}
@ -807,8 +807,8 @@ namespace ATC {
computes_[tag] = normalization;
nComputes_++;
match = true;
}
else if (strcmp(arg[argIdx],"delete")==0) {
}
else if (strcmp(arg[argIdx],"delete")==0) {
argIdx++;
string tag(arg[argIdx]);
if (computes_.find(tag) != computes_.end()) {
@ -816,10 +816,10 @@ namespace ATC {
nComputes_--;
}
else {
throw ATC_Error(tag+" compute is not in list");
throw ATC_Error(tag+" compute is not in list");
}
match = true;
}
}
}
@ -833,7 +833,7 @@ namespace ATC {
Specifies a frequency at which fields are computed for the case
where time filters are being applied.
\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.
\section related
\section default
@ -869,11 +869,11 @@ namespace ATC {
// REFACTOR move this to post_neighbor
void ATC_Transfer::pre_final_integrate()
{
// update time
// update time
update_time(); // time uses step if dt = 0
if ( neighborReset_ && sample_now() ) {
if (! kernelOnTheFly_ ) {
if (!moleculeIds_.empty()) compute_kernel_matrix_molecule(); //KKM add
@ -889,7 +889,7 @@ namespace ATC {
// compute spatially smoothed quantities
double dt = lammpsInterface_->dt();
if ( sample_now() ) {
bool needsBond = (! bondOnTheFly_ ) &&
(fieldFlags_(STRESS)
|| fieldFlags_(ESHELBY_STRESS)
@ -898,7 +898,7 @@ namespace ATC {
if ( needsBond ) {
if (pairMap_->need_reset()) {
// ATC::LammpsInterface::instance()->print_msg("Recomputing bond matrix due to atomReset_ value");
compute_bond_matrix();
compute_bond_matrix();
}
}
time_filter_pre (dt);
@ -923,8 +923,8 @@ namespace ATC {
//-------------------------------------------------------------------
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)
interscaleManager_.lammps_force_reset();
@ -937,16 +937,16 @@ namespace ATC {
}
}
if (fieldFlags_(STRESS))
if (fieldFlags_(STRESS))
compute_stress(hardyData_["stress"].set_quantity());
if (fieldFlags_(HEAT_FLUX))
if (fieldFlags_(HEAT_FLUX))
compute_heatflux(hardyData_["heat_flux"].set_quantity());
// molecule data
if (fieldFlags_(DIPOLE_MOMENT))
compute_dipole_moment(hardyData_["dipole_moment"].set_quantity());
compute_dipole_moment(hardyData_["dipole_moment"].set_quantity());
if (fieldFlags_(QUADRUPOLE_MOMENT))
compute_quadrupole_moment(hardyData_["quadrupole_moment"].set_quantity());
if (fieldFlags_(DISLOCATION_DENSITY))
if (fieldFlags_(DISLOCATION_DENSITY))
compute_dislocation_density(hardyData_["dislocation_density"].set_quantity());
// (2) derived quantities
@ -963,7 +963,7 @@ namespace ATC {
}
}
}
// compute: eshelby stress
// compute: eshelby stress
if (fieldFlags_(ESHELBY_STRESS)) {
{
compute_eshelby_stress(hardyData_["eshelby_stress"].set_quantity(),
@ -985,18 +985,18 @@ namespace ATC {
E,hardyData_["stress"].quantity(),
hardyData_["displacement_gradient"].quantity());
}
// compute: cauchy born stress
// compute: cauchy born stress
if (fieldFlags_(CAUCHY_BORN_STRESS)) {
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity());
cauchy_born_stress(hardyData_["displacement_gradient"].quantity(),
hardyData_["cauchy_born_stress"].set_quantity(), temp);
}
// compute: cauchy born energy
// compute: cauchy born energy
if (fieldFlags_(CAUCHY_BORN_ENERGY)) {
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature");
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);
}
// 1st PK transformed to cauchy (lag) or cauchy transformed to 1st PK (eul)
@ -1014,13 +1014,13 @@ namespace ATC {
compute_electric_potential(
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)) {
compute_polar_decomposition(hardyData_["rotation"].set_quantity(),
hardyData_["stretch"].set_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)) {
compute_elastic_deformation_gradient2(hardyData_["elastic_deformation_gradient"].set_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;
FT = F.transpose();
FTINV = inv(FT);
// volumes are already reference volumes.
PK1 = CAUCHY*FTINV;
PK1 = CAUCHY*FTINV;
matrix_to_vector(k,PK1,myData);
}
}
@ -1094,7 +1094,7 @@ namespace ATC {
}
#endif
}
}// end of compute_fields routine
//-------------------------------------------------------------------
@ -1156,7 +1156,7 @@ namespace ATC {
filteredData_[grad_field] = hardyData_[grad_field];
}
}
// lists/accessing of fields ( & computes)
map <string,int>::const_iterator iter;
int index = NUM_TOTAL_FIELDS;
@ -1177,7 +1177,7 @@ namespace ATC {
void ATC_Transfer::output()
{
feEngine_->departition_mesh();
for(int index=0; index < NUM_TOTAL_FIELDS; ++index) {
if (outputFlags_(index)) {
FieldName fName = (FieldName) index;
@ -1185,7 +1185,7 @@ namespace ATC {
fields_[fName] = filteredData_[name];
}
}
ATC_Method::output();
if (lammpsInterface_->comm_rank() == 0) {
// data
@ -1209,7 +1209,7 @@ namespace ATC {
output_data[grad_name] = & ( filteredData_[grad_name].set_quantity());
}
}
// lists/accessing of fields ( & computes)
map <string,int>::const_iterator iter;
for (iter = computes_.begin(); iter != computes_.end(); iter++) {
@ -1226,7 +1226,7 @@ namespace ATC {
output_data["NodalInverseVolumes"] = &nodalInverseVolumes;
// output
feEngine_->write_data(output_index(), & output_data);
feEngine_->write_data(output_index(), & output_data);
}
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,
DENS_MAT & nodeData)
{
@ -1290,8 +1290,8 @@ namespace ATC {
void ATC_Transfer::project_count_normalized(const DENS_MAT & atomData,
DENS_MAT & nodeData)
{
DENS_MAT tmp;
project(atomData,tmp);
DENS_MAT tmp;
project(atomData,tmp);
nodeData = (accumulantWeights_->quantity())*tmp;
}
@ -1301,7 +1301,7 @@ namespace ATC {
DENS_MAT & nodeData)
{
DENS_MAT tmp;
project(atomData,tmp);
project(atomData,tmp);
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
}
@ -1310,8 +1310,8 @@ namespace ATC {
void ATC_Transfer::project_volume_normalized_molecule(const DENS_MAT & molData,
DENS_MAT & nodeData)
{
DENS_MAT tmp;
project_molecule(molData,tmp);
DENS_MAT tmp;
project_molecule(molData,tmp);
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
}
@ -1320,8 +1320,8 @@ namespace ATC {
void ATC_Transfer::project_volume_normalized_molecule_gradient(const DENS_MAT & molData,
DENS_MAT & nodeData)
{
DENS_MAT tmp;
project_molecule_gradient(molData,tmp);
DENS_MAT tmp;
project_molecule_gradient(molData,tmp);
nodeData = (accumulantInverseVolumes_->quantity())*tmp;
}
@ -1354,14 +1354,14 @@ namespace ATC {
//-------------------------------------------------------------------
// 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()
{
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()
{
xPointer_ = xref_;
@ -1386,7 +1386,7 @@ namespace ATC {
fieldFlags_(DISPLACEMENT) = true;
}
if (fieldFlags_(CAUCHY_BORN_STRESS)
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|| fieldFlags_(CAUCHY_BORN_ESHELBY_STRESS)
|| fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)) {
if (! (cauchyBornStress_) ) {
@ -1419,7 +1419,7 @@ namespace ATC {
fieldFlags_(KINETIC_ENERGY) = true;
}
if (fieldFlags_(TEMPERATURE) || fieldFlags_(HEAT_FLUX) ||
fieldFlags_(KINETIC_ENERGY) || fieldFlags_(THERMAL_ENERGY) ||
fieldFlags_(KINETIC_ENERGY) || fieldFlags_(THERMAL_ENERGY) ||
fieldFlags_(ENERGY) || fieldFlags_(INTERNAL_ENERGY) ||
fieldFlags_(KINETIC_ENERGY) || (fieldFlags_(STRESS) &&
atomToElementMapType_ == EULERIAN) ) {
@ -1438,15 +1438,15 @@ namespace ATC {
fieldFlags_(NUMBER_DENSITY) = true;
}
if (fieldFlags_(ROTATION) ||
if (fieldFlags_(ROTATION) ||
fieldFlags_(STRETCH)) {
fieldFlags_(DISPLACEMENT) = true;
}
if (fieldFlags_(ESHELBY_STRESS)
|| fieldFlags_(CAUCHY_BORN_STRESS)
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|| fieldFlags_(CAUCHY_BORN_ESHELBY_STRESS)
|| fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)
|| fieldFlags_(CAUCHY_BORN_STRESS)
|| fieldFlags_(CAUCHY_BORN_ENERGY)
|| fieldFlags_(CAUCHY_BORN_ESHELBY_STRESS)
|| fieldFlags_(CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT)
|| fieldFlags_(VACANCY_CONCENTRATION)
|| fieldFlags_(ROTATION)
|| fieldFlags_(STRETCH) ) {
@ -1459,8 +1459,8 @@ namespace ATC {
throw ATC_Error("Calculation of stress field not possible with selected pair type.");
}
}
}
}
//============== THIN WRAPPERS ====================================
// OBSOLETE
@ -1492,7 +1492,7 @@ namespace ATC {
// calculate kinetic energy tensor part of stress for Eulerian analysis
if (atomToElementMapType_ == EULERIAN && nLocal_>0) {
compute_kinetic_stress(stress);
compute_kinetic_stress(stress);
}
else {
// zero stress table for Lagrangian analysis or if nLocal_ = 0
@ -1511,7 +1511,7 @@ namespace ATC {
compute_force_matrix();
// calculate force part of stress tensor
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
@ -1570,7 +1570,7 @@ namespace ATC {
compute_kinetic_heatflux(flux);
}
else {
flux.zero(); // zero stress table for Lagrangian analysis
flux.zero(); // zero stress table for Lagrangian analysis
}
// add potential part of heat flux vector
int nrows = flux.nRows();
@ -1628,11 +1628,11 @@ namespace ATC {
// - e^0_I v_I + \sigma^T_I v_I
for (int i = 0; i < nNodes_; i++) {
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);
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);
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);
}
}
@ -1643,7 +1643,7 @@ namespace ATC {
const DENS_MAT & rho = (restrictedCharge_->quantity());
SPAR_MAT K;
feEngine_->stiffness_matrix(K);
double permittivity = lammpsInterface_->dielectric();
double permittivity = lammpsInterface_->dielectric();
permittivity *= LammpsInterface::instance()->epsilon0();
K *= permittivity;
BC_SET bcs;
@ -1670,7 +1670,7 @@ namespace ATC {
for (int i = 0; i < nLocal_; i++) {
int atomIdx = internalToAtom_(i);
if (type[atomIdx] != 13) {
if (type[atomIdx] != 13) {
atomCnt(i,0) = myAtomicWeights(i,i);
atomic_weight_sum += myAtomicWeights(i,i);
number_atoms++;
@ -1725,7 +1725,7 @@ namespace ATC {
#ifndef H_BASED
F(0,0) += 1.0; F(1,1) += 1.0; F(2,2) += 1.0;
#endif
FT = F.transpose();
FT = F.transpose();
}
else if (atomToElementMapType_ == EULERIAN) {
vector_to_symm_matrix(i,S,P);
@ -1741,9 +1741,9 @@ namespace ATC {
// Q stores (1-H)
Q -= FT.transpose();
DENS_MAT F(3,3);
F = inv(Q);
F = inv(Q);
FT = F.transpose();
ESH = FT*ESH;
ESH = FT*ESH;
}
// copy to global
matrix_to_vector(i,ESH,M);
@ -1761,7 +1761,7 @@ namespace ATC {
DENS_MAT_VEC &h = hField[DISPLACEMENT];
h.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]);
const double nktv2p = lammpsInterface_->nktv2p();
const double fact = -lammpsInterface_->mvv2e()*nktv2p;
@ -1779,7 +1779,7 @@ namespace ATC {
DENS_MAT S(nNodes_,6);
symm_dens_mat_vec_to_vector(tField,S);
S *= fact;
// tField/S holds the 2nd P-K stress tensor. Transform to
// Cauchy for EULERIAN analysis, transform to 1st P-K
// for LAGRANGIAN analysis.
@ -1799,7 +1799,7 @@ namespace ATC {
FT = transpose(F);
double J = det(F);
STRESS = F*PK2*FT;
STRESS *= 1/J;
STRESS *= 1/J;
symm_matrix_to_vector(i,STRESS,T);
}
else{
@ -1810,7 +1810,7 @@ namespace ATC {
STRESS = F*PK2;
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)
{
FIELD_MATS uField; // uField should contain temperature.
uField[TEMPERATURE] = T;
uField[TEMPERATURE] = T;
GRAD_FIELD_MATS hField;
DENS_MAT_VEC &h = hField[DISPLACEMENT];
h.assign(nsd_, DENS_MAT(nNodes_,nsd_));
@ -1916,13 +1916,13 @@ namespace ATC {
vector_to_matrix(i,H,F);
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);
FT *= 1/J;
if (atomToElementMapType_ == EULERIAN) {
FT = inv(FT);
FT = inv(FT);
}
S = P*FT;
matrix_to_vector(i,S,stress);
@ -1933,10 +1933,10 @@ namespace ATC {
DENS_MAT & stretch, const DENS_MAT & H)
{
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);
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
else {
polar_decomposition(F,R,U); } // F = R U
@ -1953,12 +1953,12 @@ namespace ATC {
//--------------------------------------------------------------------
void ATC_Transfer::compute_elastic_deformation_gradient(DENS_MAT & Fe,
const DENS_MAT & P, const DENS_MAT & H)
{
// calculate Fe for every node
const double nktv2p = lammpsInterface_->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);
Pv *= fact;
CBElasticTangentOperator tangent(cauchyBornStress_, Pv);
@ -1977,11 +1977,11 @@ namespace ATC {
const double nktv2p = lammpsInterface_->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);
for (int i = 0; i < nNodes_; i++) {
for (int i = 0; i < nNodes_; i++) {
// get F = RU
vector_to_matrix(i,H,F);
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
else {
polar_decomposition(F,R,U); } // F = R U
@ -1989,7 +1989,7 @@ namespace ATC {
vector_to_matrix(i,P,PP);
//S = PP*transpose(F);
S = inv(F)*PP;
S += S.transpose(); S *= 0.5; // symmetrize
DENS_VEC Sv = to_voigt(S);
Sv *= fact;

View File

@ -22,9 +22,9 @@ class TimeFilter;
class ATC_Transfer : public ATC_Method {
public:
// constructor
ATC_Transfer(std::string groupName,
ATC_Transfer(std::string groupName,
double **& perAtomArray,
LAMMPS_NS::Fix * thisFix,
std::string matParamFile = "none");
@ -52,7 +52,7 @@ class ATC_Transfer : public ATC_Method {
virtual void pre_neighbor() {ATC_Method::pre_neighbor(); neighborReset_ = true;};
/** output function */
virtual void output();
virtual void output();
/** external access to hardy data and other information*/
const DENS_MAT * hardy_data(std::string field) { return &hardyData_[field].quantity(); }
@ -63,25 +63,25 @@ class ATC_Transfer : public ATC_Method {
double ** xPointer_;
/** data */
TAG_FIELDS hardyData_;
TAG_FIELDS hardyData_;
SmallMoleculeSet * smallMoleculeSet_; // KKM add
SmallMoleculeCentroid * moleculeCentroid_; // KKM add
SmallMoleculeDipoleMoment * dipoleMoment_; // KKM add
SmallMoleculeQuadrupoleMoment * quadrupoleMoment_; // KKM add
/** container for dependency managed data */
std::vector < DENS_MAN * > outputFields_;
std::map < std::string, DENS_MAN * > outputFieldsTagged_;
DENS_MAN * restrictedCharge_; // WIP/TEMP
/** work space */
/** work space */
DENS_MAT atomicScalar_;
DENS_MAT atomicVector_;
DENS_MAT atomicTensor_;
/** calculation flags */
Array<bool> fieldFlags_;
Array<bool> fieldFlags_;
Array<bool> outputFlags_;
Array<bool> gradFlags_;
Array<bool> rateFlags_;
@ -117,7 +117,7 @@ class ATC_Transfer : public ATC_Method {
void compute_heatflux(DENS_MAT & flux);
/** derived quantities: compute nodal to nodal quantities */
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);
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);
@ -151,15 +151,15 @@ class ATC_Transfer : public ATC_Method {
virtual void compute_dislocation_density(DENS_MAT & dislocation_density) = 0;
/** compute smooth fields */
void compute_fields(void);
void time_filter_pre (double dt);
void time_filter_post(double dt);
void compute_fields(void);
void time_filter_pre (double dt);
void time_filter_post(double dt);
/** mapping of atomic pairs to pair index value */
class PairMap * pairMap_;
class BondMatrix * bondMatrix_;
class PairVirial * pairVirial_;
class PairPotentialHeatFlux * pairHeatFlux_;
class PairMap * pairMap_;
class BondMatrix * bondMatrix_;
class PairVirial * pairVirial_;
class PairPotentialHeatFlux * pairHeatFlux_;
/** routine to calculate matrix of force & position dyads */
void compute_force_matrix();
@ -176,7 +176,7 @@ class ATC_Transfer : public ATC_Method {
DENS_MAT & nodeData) = 0;
/** 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 */
void set_xPointer();
@ -200,21 +200,21 @@ class ATC_Transfer : public ATC_Method {
void project_count_normalized(const DENS_MAT & atomData,
DENS_MAT & nodeData);
/** hardy_project (volume density): given w_\alpha,
w_I = 1/\Omega_I \sum_\alpha N_{I\alpha} w_\alpha
/** hardy_project (volume density): given 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 */
// REFACTOR AtfNodeWeightedShapeFunctionRestriction
void project_volume_normalized(const DENS_MAT & atomData,
DENS_MAT & nodeData);
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,
DENS_MAT & nodeData); // KKM add
/** gradient_compute: given w_I,
w_J = \sum_I N_I'{xJ} \dyad w_I
where N_I'{xJ} is the gradient of the normalized
DENS_MAT & nodeData); // KKM add
/** gradient_compute: given w_I,
w_J = \sum_I N_I'{xJ} \dyad w_I
where N_I'{xJ} is the gradient of the normalized
shape function of node I evaluated at node J */
// REFACTOR MatToGradBySparse
void gradient_compute(const DENS_MAT & inNodeData,
@ -226,7 +226,7 @@ class ATC_Transfer : public ATC_Method {
/** workset data */
VectorDependencyManager<SPAR_MAT * > * gradientMatrix_;
SPAR_MAT atomicBondMatrix_;
DENS_MAT atomicForceMatrix_;
DENS_MAT atomicHeatMatrix_;
@ -247,7 +247,7 @@ class ATC_Transfer : public ATC_Method {
Array<TimeFilter *> timeFilters_;
/** check consistency of fieldFlags_ */
void check_field_dependencies();
void check_field_dependencies();
};

View File

@ -1,4 +1,4 @@
// ATC headers
// ATC headers
#include "ATC_TransferKernel.h"
#include "ATC_Error.h"
#include "FE_Engine.h"
@ -44,10 +44,10 @@ using ATC_Utility::to_string;
{
bool match = false;
/*! \page man_hardy_kernel fix_modify AtC kernel
/*! \page man_hardy_kernel fix_modify AtC kernel
\section syntax
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
- parameters :\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 quartic_sphere 10.0 </TT>
\section description
\section restrictions
Must be used with the hardy AtC fix \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());
dN.reset(nLocalMol,nNodes_);
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());
ATC::LammpsInterface::instance()->stream_msg_once("computing kernel matrix molecule ",true,false);
int heartbeatFreq = (nNodes_ <= 10 ? 1 : (int) nNodes_ / 10);
ATC::LammpsInterface::instance()->stream_msg_once("computing kernel matrix molecule ",true,false);
int heartbeatFreq = (nNodes_ <= 10 ? 1 : (int) nNodes_ / 10);
for (int i = 0; i < nNodes_; i++) {
if (i % heartbeatFreq == 0 ) {
if (i % heartbeatFreq == 0 ) {
ATC::LammpsInterface::instance()->stream_msg_once(".",false,false);
}
}
xI = (feEngine_->fe_mesh())->nodal_coordinates(i);
for (int j = 0; j < nLocalMol; j++) {
for (int k = 0; k < nsd_; k++) {
xm(k) = centroidMolMatrix(j,k);
}
xmI = xm - xI;
xmI = xm - xI;
lammpsInterface_->periodicity_correction(xmI.ptr());
double val = kernelFunction_->value(xmI);
if (val > 0) N.add(j,i,val);
kernelFunction_->derivative(xmI,derivKer);
double val_grad = derivKer(2);
if (val_grad!= 0) dN.add(j,i,val_grad);
}
}
}
}
// reset kernelShpFunctions with the weights of molecules on processors
DENS_VEC fractions(N.nRows());
DENS_VEC fractions_deriv(dN.nRows());
@ -126,10 +126,10 @@ using ATC_Utility::to_string;
dN.compress();
if (lammpsInterface_->rank_zero()) {
ATC::LammpsInterface::instance()->stream_msg_once("done",false,true);
}
}
}
}
}
//-------------------------------------------------------------------
void ATC_TransferKernel::compute_projection(const DENS_MAT & atomData,
DENS_MAT & nodeData)
@ -183,7 +183,7 @@ using ATC_Utility::to_string;
int **firstneigh = lammpsInterface_->neighbor_list_firstneigh();
double ** xatom = lammpsInterface_->xatom();
double lam1,lam2;
double bond_value;
double bond_value;
// process differently for mesh vs translation-invariant kernels
ATC::LammpsInterface::instance()->stream_msg_once("computing potential stress: ",true,false);
int heartbeatFreq = (nNodes_ <= 10 ? 1 : (int) nNodes_ / 10);
@ -202,7 +202,7 @@ using ATC_Utility::to_string;
int inode = i;
for (int j = 0; j < nLocal_; j++) {
// second (neighbor) atom location
int lammps_j = internalToAtom_(j);
int lammps_j = internalToAtom_(j);
xa.copy(xPointer_[lammps_j],3);
// difference vector
xaI = xa - xI;
@ -217,8 +217,8 @@ using ATC_Utility::to_string;
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
// compute virial
if (lam1 < lam2) {
bond_value
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
bond_value
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
double delx = xatom[lammps_j][0] - xatom[lammps_k][0];
double dely = xatom[lammps_j][1] - xatom[lammps_k][1];
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);
fforce *= 0.5; // dbl count
if (atomToElementMapType_ == LAGRANGIAN) {
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
stress(inode,0) +=-delx*fforce*delX*bond_value;
stress(inode,1) +=-delx*fforce*delY*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();
double ** xatom = lammpsInterface_->xatom();
double ** vatom = lammpsInterface_->vatom();
double lam1,lam2;
double bond_value;
double bond_value;
// process differently for mesh vs translation-invariant kernels
// "normal" kernel functions
DENS_VEC xa(nsd_),xI(nsd_),xaI(nsd_),xb(nsd_),xbI(nsd_),xba(nsd_);
@ -281,7 +281,7 @@ using ATC_Utility::to_string;
continue;
}
for (int j = 0; j < nLocal_; j++) {
int lammps_j = internalToAtom_(j);
int lammps_j = internalToAtom_(j);
xa.copy(xPointer_[lammps_j],3);
// difference vector
xaI = xa - xI;
@ -296,8 +296,8 @@ using ATC_Utility::to_string;
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
// compute virial
if (lam1 < lam2) {
bond_value
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
bond_value
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
double delx = xatom[lammps_j][0] - xatom[lammps_k][0];
double dely = xatom[lammps_j][1] - xatom[lammps_k][1];
double delz = xatom[lammps_j][2] - xatom[lammps_k][2];
@ -308,9 +308,9 @@ using ATC_Utility::to_string;
double * v = vatom[lammps_j];
fforce *= (delx*v[0] + dely*v[1] + delz*v[2]);
if (atomToElementMapType_ == LAGRANGIAN) {
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
flux(inode,0) +=fforce*delX*bond_value;
flux(inode,1) +=fforce*delY*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)
{
A.reset(nNodes_,9);
@ -348,7 +348,7 @@ using ATC_Utility::to_string;
lammpsInterface_->int_allsum(&localNumberLines,&totalNumberLines,1);
if (totalNumberLines == 0) {
ATC::LammpsInterface::instance()->print_msg_once("no dislocation lines found");
return;
return;
}
// for output
@ -366,7 +366,7 @@ using ATC_Utility::to_string;
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_);
double kernel_inv_vol = kernelFunction_->inv_vol();
int iPt = 0, iSeg= 0;
@ -393,7 +393,7 @@ using ATC_Utility::to_string;
xa(k) = x1[k];
xb(k) = x2[k];
xba(k) = delta[k];
}
}
for (int I = 0; I < nNodes_; I++) {
xI = (feEngine_->fe_mesh())->nodal_coordinates(I);
if (!kernelFunction_->node_contributes(xI)) {
@ -405,7 +405,7 @@ using ATC_Utility::to_string;
double lam1=0,lam2=0;
kernelFunction_->bond_intercepts(xaI,xbI,lam1,lam2);
if (lam1 < lam2) {
double bond_value
double bond_value
= kernel_inv_vol*(kernelFunction_->bond(xaI,xbI,lam1,lam2));
local_A(I,0) += xba(0)*burgers[0]*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);
// output
double volume = lammpsInterface_->domain_volume();
double volume = lammpsInterface_->domain_volume();
stringstream ss;
ss << "total dislocation line length = " << totalDislocationDensity;
ss << " lines = " << totalNumberLines << " segments = " << totalNumberSegments;
@ -474,10 +474,10 @@ using ATC_Utility::to_string;
segOutput.write_geometry(&segCoor,&segConn);
OUTPUT_LIST segOut;
segOut["burgers_vector"] = &segBurg;
segOutput.write_data(0,&segOut);
segOutput.write_data(0,&segOut);
}
#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
}

View File

@ -12,9 +12,9 @@ class KernelFunction;
class ATC_TransferKernel : public ATC_Transfer {
public:
// constructor
ATC_TransferKernel(std::string groupName,
ATC_TransferKernel(std::string groupName,
double **& perAtomArray,
LAMMPS_NS::Fix * thisFix,
std::string matParamFile = "none");
@ -27,7 +27,7 @@ class ATC_TransferKernel : public ATC_Transfer {
protected:
/** routine to calculate matrix of kernel functions */
virtual void compute_kernel_matrix_molecule();
/** calculate projection on the fly*/

View File

@ -1,4 +1,4 @@
// ATC headers
// ATC headers
#include "ATC_TransferPartitionOfUnity.h"
#include "ATC_Error.h"
#include "FE_Engine.h"
@ -27,7 +27,7 @@ static double line_xg[line_ngauss], line_wg[line_ngauss];
namespace ATC {
ATC_TransferPartitionOfUnity::ATC_TransferPartitionOfUnity(
string groupName,
string groupName,
double ** & perAtomArray,
LAMMPS_NS::Fix * thisFix,
string matParamFile)
@ -67,7 +67,7 @@ namespace ATC {
//-------------------------------------------------------------------
// kinetic energy portion of stress
/**
* @class KineticTensor
* @brief Class for computing the quantity - m v' (x) v'
@ -83,7 +83,7 @@ namespace ATC {
double mvv2e = lammpsInterface_->mvv2e(); // [MV^2]-->[Energy]
DENS_MAT & v = variationVelocity_;
atomicTensor_.reset(nLocal_,6);
for (int i = 0; i < nLocal_; i++) {
int atomIdx = internalToAtom_(i);
@ -132,7 +132,7 @@ namespace ATC {
ATC::LammpsInterface::instance()->stream_msg_once(".",false,false);
}
// first atom location
int lammps_j = internalToAtom_(j);
int lammps_j = internalToAtom_(j);
xa.copy(xPointer_[lammps_j],3);
for (int k = 0; k < numneigh[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);
fforce *= 0.5; // 1/2 sum_ab = sum_(ab)
if (atomToElementMapType_ == LAGRANGIAN) {
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
virial[0] =-delx*fforce*delX;
virial[1] =-delx*fforce*delY;
virial[2] =-delx*fforce*delZ;
@ -172,7 +172,7 @@ namespace ATC {
for (int i = 0; i < line_ngauss; i++) {
double lambda = line_xg[i];
xlambda = lambda*xab + xb;
lammpsInterface_->periodicity_correction(xlambda.ptr());
feEngine_->shape_functions(xlambda,shp,node_list);
// 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_);
for (int j = 0; j < nLocal_; j++) {
// first atom location
int lammps_j = internalToAtom_(j);
int lammps_j = internalToAtom_(j);
xa.copy(xPointer_[lammps_j],3);
for (int k = 0; k < numneigh[lammps_j]; ++k) {
int lammps_k = firstneigh[lammps_j][k];
@ -260,9 +260,9 @@ namespace ATC {
delz*variationVelocity_(j,2));
double flux_vec[3];
if (atomToElementMapType_ == LAGRANGIAN) {
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
double delX = xref_[lammps_j][0] - xref_[lammps_k][0];
double delY = xref_[lammps_j][1] - xref_[lammps_k][1];
double delZ = xref_[lammps_j][2] - xref_[lammps_k][2];
flux_vec[0] =fforce*delX;
flux_vec[1] =fforce*delY;
flux_vec[2] =fforce*delZ;
@ -276,7 +276,7 @@ namespace ATC {
for (int i = 0; i < line_ngauss; i++) {
double lambda = line_xg[i];
xlambda = lambda*xab + xb;
lammpsInterface_->periodicity_correction(xlambda.ptr());
feEngine_->shape_functions(xlambda,shp,node_list);
// accumulate to nodes whose support overlaps the integration point
@ -316,7 +316,7 @@ namespace ATC {
field_to_prolongation_name(VELOCITY));
}
// use of prolong assumes atom system contained within mesh
vbar_ = vbar->quantity();
vbar_ = vbar->quantity();
// compute and store variation velocities of atoms
for (int i = 0; i < nLocal_; 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)
{
A.reset(nNodes_,9);
#ifdef HAS_DXA
double cnaCutoff = lammpsInterface_->near_neighbor_cutoff();
@ -368,7 +368,7 @@ namespace ATC {
DENS_MAT local_A(nNodes_,9);
local_A.zero();
local_A.zero();
Array<bool> latticePeriodicity(3);
latticePeriodicity(0) = (bool) periodicity[0];
latticePeriodicity(1) = (bool) periodicity[1];
@ -406,7 +406,7 @@ namespace ATC {
for (int i = 0; i < line_ngauss; i++) {
double lambda = line_xg[i];
xlambda = lambda*xba + xa;
lammpsInterface_->periodicity_correction(xlambda.ptr());
feEngine_->shape_functions(xlambda,shp,node_list);
// accumulate to nodes whose support overlaps the integration point
@ -472,7 +472,7 @@ namespace ATC {
}
ATC::LammpsInterface::instance()->print_msg_once(ss.str());
ss.str("");
DENS_VEC A_avg(9);
DENS_VEC A_avg(9);
for (int i = 0; i < nNodes_; i++) {
for (int j = 0; j < 9; j++) {
A_avg(j) += A(i,j);
@ -480,9 +480,9 @@ namespace ATC {
}
A_avg /= nNodes_;
ss << "average nodal dislocation density tensor = \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(6) << " " << A_avg(7) << " " << A_avg(8) << "\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(6) << " " << A_avg(7) << " " << A_avg(8) << "\n";
ATC::LammpsInterface::instance()->print_msg_once(ss.str());
if (nSeg > 0) {
@ -495,7 +495,7 @@ namespace ATC {
segOutput.write_geometry(&segCoor,&segConn);
OUTPUT_LIST segOut;
segOut["burgers_vector"] = &segBurg;
segOutput.write_data(0,&segOut);
segOutput.write_data(0,&segOut);
}
#else
throw ATC_Error("TransferParititionOfUnity::compute_dislocaton_density - unimplemented function");

View File

@ -9,9 +9,9 @@ namespace ATC {
class ATC_TransferPartitionOfUnity : public ATC_Transfer {
public:
// constructor
ATC_TransferPartitionOfUnity(std::string groupName,
ATC_TransferPartitionOfUnity(std::string groupName,
double **& perAtomArray,
LAMMPS_NS::Fix * thisFix,
std::string matParamFile = "none");
@ -49,7 +49,7 @@ class ATC_TransferPartitionOfUnity : public ATC_Transfer {
virtual void compute_dislocation_density(DENS_MAT & dislocation_density);
private:
DENS_MAT variationVelocity_;
DENS_MAT vbar_;
};

View File

@ -23,7 +23,7 @@ namespace ATC
static const double kBeV_ = 8.617343e-5;// [eV/K]
/** unsigned ints, when needed */
typedef int INDEX;
typedef int INDEX;
/** elementset integral */
enum ElementsetOperationType {
@ -53,13 +53,13 @@ namespace ATC
FULL_DOMAIN=0,
ATOM_DOMAIN,
FE_DOMAIN,
FULL_DOMAIN_ATOMIC_QUADRATURE_SOURCE,
FULL_DOMAIN_ATOMIC_QUADRATURE_SOURCE,
FULL_DOMAIN_FREE_ONLY
};
/** domain decomposition */
enum DomainDecompositionType {
REPLICATED_MEMORY=0,
DISTRIBUTED_MEMORY
DISTRIBUTED_MEMORY
};
/** atomic weight specification */
enum AtomicWeightType {
@ -100,7 +100,7 @@ namespace ATC
NUM_ATOM_TYPES
};
/** field types */
enum FieldName {
enum FieldName {
TIME=-2,
POSITION=-1,
TEMPERATURE=0, // Intrinsic Fields
@ -114,9 +114,9 @@ namespace ATC
ELECTRON_TEMPERATURE,
ELECTRIC_POTENTIAL,
ELECTRON_WAVEFUNCTION,
ELECTRON_WAVEFUNCTIONS,
ELECTRON_WAVEFUNCTION_ENERGIES,
FERMI_ENERGY,
ELECTRON_WAVEFUNCTIONS,
ELECTRON_WAVEFUNCTION_ENERGIES,
FERMI_ENERGY,
MOMENTUM,
PROJECTED_VELOCITY,
KINETIC_TEMPERATURE,
@ -144,9 +144,9 @@ namespace ATC
QUADRUPOLE_MOMENT,
CAUCHY_BORN_ELASTIC_DEFORMATION_GRADIENT,
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
static const int FieldSizes[NUM_TOTAL_FIELDS] = {
@ -193,7 +193,7 @@ namespace ATC
NDIM*NDIM // DISLOCATION_DENSITY
};
enum NodalAtomicFieldNormalization {
enum NodalAtomicFieldNormalization {
NO_NORMALIZATION=0,
VOLUME_NORMALIZATION, NUMBER_NORMALIZATION, MASS_NORMALIZATION,
MASS_MATRIX
@ -209,7 +209,7 @@ namespace ATC
enum FeIntQuadrature {NODAL, GAUSS1, GAUSS2, GAUSS3, FACE};
/** 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")
return NODAL;
@ -226,7 +226,7 @@ namespace ATC
}
/** 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) {
case TEMPERATURE:
@ -313,7 +313,7 @@ namespace ATC
}
/** 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")
return TEMPERATURE;
@ -397,7 +397,7 @@ namespace ATC
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
|| field_enum==DISPLACEMENT
@ -412,7 +412,7 @@ namespace ATC
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)) {
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");
}
}
inline std::string field_to_restriction_name(const FieldName index)
inline std::string field_to_restriction_name(const FieldName index)
{
if (is_intrinsic(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");
}
}
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));
}
@ -473,9 +473,9 @@ namespace ATC
THERMO_ELASTIC,
SPECIES // aka Mass
};
/** rhs types */
enum FluxType
enum FluxType
{
FLUX = 0, // has a source weighted by gradient of shape function
SOURCE, // has a source term weighted by the shape function
@ -487,12 +487,12 @@ namespace ATC
};
/** stiffness/ derivative of rhs types */
enum StiffnessType
enum StiffnessType
{
BB_STIFFNESS = 0,
NN_STIFFNESS,
BN_STIFFNESS,
NB_STIFFNESS,
BB_STIFFNESS = 0,
NN_STIFFNESS,
BN_STIFFNESS,
NB_STIFFNESS,
NUM_STIFFNESS
};
@ -519,8 +519,8 @@ namespace ATC
typedef std::set<int> ESET; // elementset
/** typedefs for N and B integrand functions */
typedef std::set<FieldName> ARG_NAMES;
typedef std::map<FieldName, ATC_matrix::DenseMatrix<double> > ARGS;
typedef std::set<FieldName> ARG_NAMES;
typedef std::map<FieldName, ATC_matrix::DenseMatrix<double> > ARGS;
typedef ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> FIELD;
typedef std::vector<ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > GRAD_FIELD;
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, Array2D<XT_Function *> > VOLUME_SOURCE;
typedef std::map<std::string, ATC::MatrixDependencyManager<ATC_matrix::DenseMatrix, double> > ATOMIC_DATA;
/** typedefs for FE_Mesh */
typedef std::map<std::string, std::set<int > > NODE_SET_MAP;
typedef std::map<std::string, std::set<int > > ELEMENT_SET_MAP;
@ -603,14 +603,14 @@ namespace ATC
return true;
}
inline std::string print_mask(const Array2D<bool> & rhsMask)
inline std::string print_mask(const Array2D<bool> & rhsMask)
{
std::string msg;
for (int i = 0; i < NUM_FIELDS; i++) {
for (int i = 0; i < NUM_FIELDS; i++) {
FieldName field = (FieldName) i;
std::string name = field_to_string(field);
if (rhsMask(field,FLUX)
|| rhsMask(field,SOURCE)
|| rhsMask(field,SOURCE)
|| rhsMask(field,PRESCRIBED_SOURCE)
|| rhsMask(field,ROBIN_SOURCE)
|| rhsMask(field,OPEN_SOURCE)

View File

@ -12,8 +12,8 @@
namespace ATC_matrix {
/**
* @class Array
* @brief Base class for creating, sizing and operating on 1-D arrays of data
* @class Array
* @brief Base class for creating, sizing and operating on 1-D arrays of data
*/
template<typename T>
@ -24,7 +24,7 @@ public:
Array(const Array<T>& A);
virtual ~Array();
// Resize and reinitialize the array
// Resize and reinitialize the array
virtual void reset(int len);
//* resizes the matrix, copy what fits default to OFF
virtual void resize(int len, bool copy=false);
@ -38,17 +38,17 @@ public:
int size() const;
// Do I have this element?
bool has_member(T val) const;
// range
// range
bool check_range(T min, T max) const;
void range(T & min, T & max) const;
// search an ordered array
int index(T& val) const;
// Return pointer to internal data
const T* data() const;
const T* data() const;
T* ptr() const;
// print
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;
protected:
@ -66,7 +66,7 @@ public:
virtual ~AliasArray();
virtual AliasArray<T>& operator= (const Array<T> &other);
virtual AliasArray<T>& operator= (const T &value);
const T& operator() (int i) const;
int size() const;
T* ptr() const;
@ -135,8 +135,8 @@ void Array<T>::resize(int len, bool copy) {
delete[] data_;
data_ = new T[len_];
for (int i = 0 ; i < len_; i++) {
if (i < temp.size())
data_[i] = temp.data_[i];
if (i < temp.size())
data_[i] = temp.data_[i];
}
}
else {
@ -269,7 +269,7 @@ AliasArray<T>::AliasArray(const AliasArray<T> & other) {
// for a mem continguous slice
template<typename T>
AliasArray<T>::AliasArray(int len, T * ptr) {
AliasArray<T>::AliasArray(int len, T * ptr) {
len_ = len;
data_ = ptr;
}
@ -281,8 +281,8 @@ AliasArray<T>::AliasArray(const Array<T>& A) {
}
template<typename T>
AliasArray<T>::~AliasArray(void) {
len_ = 0;
AliasArray<T>::~AliasArray(void) {
len_ = 0;
data_ = nullptr; // trick base class into not deleting parent data
}

View File

@ -20,20 +20,20 @@ namespace ATC_matrix {
template<typename T>
class Array2D {
public:
public:
Array2D();
Array2D(int nrows, int ncols);
Array2D(const Array2D<T>& A); // copy constructor
~Array2D();
// Resize and reinitalize matrix
void reset(int nrows, int ncols);
// Access method to get the (i,j) element:
T& operator() (int i, int j);
// Access method to get the i-th col
AliasArray<T> column(int i) const;
T& operator() (int i, int j);
// Access method to get the i-th col
AliasArray<T> column(int i) const;
// 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
Array2D<T>& operator= (const Array2D<T>& other);
// assignment operator
@ -48,10 +48,10 @@ public:
// Dump templated type to disk; operation not safe for all types
void write_restart(FILE *f) const;
private:
private:
int nrows_, ncols_;
T *data_;
};
T *data_;
};
template<typename T>
Array2D<T>::Array2D() {
@ -172,7 +172,7 @@ template<typename T>
Array2D<T>::~Array2D() {
if (data_ != nullptr)
delete[] data_;
}
}
template<typename T>
void Array2D<T>::print(std::string name) const {

View File

@ -1,4 +1,4 @@
// ATC headers
// ATC headers
#include "AtomToMoleculeTransfer.h"
#include "ATC_Method.h"
@ -19,15 +19,15 @@ namespace ATC {
{
atomPositions_->register_dependence(this);
}
//--------------------------------------------------------
// Destructor
// Destructor
//--------------------------------------------------------
SmallMoleculeCentroid::~SmallMoleculeCentroid()
{
atomPositions_->remove_dependence(this);
}
//--------------------------------------------------------
// Quantity
//--------------------------------------------------------
@ -42,7 +42,7 @@ namespace ATC {
for (int i = 0; i < nLocalMol; i++) {
const set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
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++) {
totalSourceMol += sourceMatrix(*atomsLocalMolID,0);
} // compute total source
@ -62,11 +62,11 @@ namespace ATC {
}
}
}
//--------------------------------------------------------
//--------------------------------------------------------
// Class SmallMoleculeDipoleMoment
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
@ -100,8 +100,8 @@ namespace ATC {
quantity_.reset(nLocalMol,nsd);
double dx[3];
//call the SmallMoleculeCentroid here to find Centroid ....
const DENS_MAT & centroidMolMatrix(centroid_->quantity());
//call the SmallMoleculeCentroid here to find Centroid ....
const DENS_MAT & centroidMolMatrix(centroid_->quantity());
for (int i = 0; i < nLocalMol; i++) {
const set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
set<int>::const_iterator atomsLocalMolID;;
@ -111,15 +111,15 @@ namespace ATC {
}
lammps->minimum_image(dx[0], dx[1], dx[2]);
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
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
@ -202,9 +202,9 @@ namespace ATC {
// reallocate memory only if sizing has changed
const SPAR_MAT & shapeFunctionMatrix(shapeFunction_->quantity());
quantity_.resize(shapeFunctionMatrix.nCols(),sourceMatrix.nCols());
local_restriction(sourceMatrix,shapeFunctionMatrix);
// communicate for total restriction
int count = quantity_.nRows()*quantity_.nCols();
lammpsInterface_->allsum(_workspace_.ptr(),quantity_.ptr(),count);
@ -222,4 +222,4 @@ namespace ATC {
_workspace_.reset(quantity_.nRows(),quantity_.nCols());
}
} // end namespace
} // end namespace

View File

@ -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
#define ATOM_TO_MOLECULE_TRANSFER_H
@ -15,18 +15,18 @@ namespace ATC {
// forward declarations
class ATC_Method;
/**
/**
* @class PerMoleculeQuantity
*
*/
template <typename T>
class PerMoleculeQuantity : public DenseMatrixTransfer<T> {
public:
PerMoleculeQuantity(ATC_Method * atc):DenseMatrixTransfer<T>(), atc_(atc) {};
virtual ~PerMoleculeQuantity() {};
protected:
@ -34,8 +34,8 @@ namespace ATC {
/** utility object for atc information */
ATC_Method * atc_;
private:
private:
//do not define
PerMoleculeQuantity();
@ -48,7 +48,7 @@ namespace ATC {
*/
template <typename T>
class AtomToSmallMoleculeTransfer : public PerMoleculeQuantity<T> {
public:
//constructor
@ -61,20 +61,20 @@ namespace ATC {
source_->register_dependence(this);
smallMoleculeSet_->register_dependence(this);
};
//destructor
//destructor
virtual ~AtomToSmallMoleculeTransfer()
{
source_->remove_dependence(this);
smallMoleculeSet_->remove_dependence(this);
};
// apply transfer operator
// apply transfer operator
void reset_quantity() const
{
const DenseMatrix<T> & sourceMatrix(source_->quantity());
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++) {
const std::set<int> & atomsLocalMolArray = smallMoleculeSet_->atoms_by_local_molecule(i);
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_;
// pointer to molecule data
// pointer to molecule data
SmallMoleculeSet * smallMoleculeSet_;
private:
// do not define
AtomToSmallMoleculeTransfer();
};
/**
* @class SmallMoleculeCentroid
* @class SmallMoleculeCentroid
* @brief Class for defining objects to transfer molecular centroid (center of mass)
*/
class SmallMoleculeCentroid : public AtomToSmallMoleculeTransfer<double> {
public:
public:
//constructor
SmallMoleculeCentroid(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions);
@ -116,15 +116,15 @@ namespace ATC {
//destructor
virtual ~SmallMoleculeCentroid();
// apply transfer operator
// apply transfer operator
virtual void reset_quantity() const;
protected:
protected:
// pointer to source atomic quantity date : positions of atoms in a molecule
PerAtomQuantity<double> * atomPositions_;
private:
private:
//do not define
SmallMoleculeCentroid();
@ -133,28 +133,28 @@ namespace ATC {
/**
* @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 {
public:
public:
//constructor
SmallMoleculeDipoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);
//destructor
virtual ~SmallMoleculeDipoleMoment();
// apply transfer operator
// apply transfer operator
virtual void reset_quantity() const;
protected:
protected:
//pointer to the centroid data
//pointer to the centroid data
SmallMoleculeCentroid * centroid_;
private:
private:
//do not define
SmallMoleculeDipoleMoment();
@ -162,14 +162,14 @@ namespace ATC {
};
/**
* @class AtomToFeTransfer
* @class AtomToFeTransfer
* @brief Class for defining objects to transfer molecular quadrupole moments
*/
class SmallMoleculeQuadrupoleMoment : public SmallMoleculeCentroid {
public:
public:
//constructor
SmallMoleculeQuadrupoleMoment(ATC_Method * atc, PerAtomQuantity<double> * source, SmallMoleculeSet * smallMoleculeSet, PerAtomQuantity<double> * atomPositions, SmallMoleculeCentroid * centroid);
@ -179,10 +179,10 @@ namespace ATC {
//apply transfer operator
virtual void reset_quantity() const;
protected:
//pointer to the centroid data
//pointer to the centroid data
SmallMoleculeCentroid * centroid_;
private:
@ -190,7 +190,7 @@ namespace ATC {
//do not define
SmallMoleculeQuadrupoleMoment();
};
};
/**
* @class MotfShapeFunctionRestriction
@ -201,11 +201,11 @@ namespace ATC {
class MotfShapeFunctionRestriction : public MatToMatTransfer<double> {
public:
// constructor
MotfShapeFunctionRestriction(PerMoleculeQuantity<double> * source,
SPAR_MAN * shapeFunction);
// destructor
virtual ~MotfShapeFunctionRestriction();
@ -218,8 +218,8 @@ namespace ATC {
SPAR_MAN * shapeFunction_;
/** persistent workspace */
mutable DENS_MAT _workspace_;
/** applies restriction operation on this processor */
@ -236,4 +236,4 @@ namespace ATC {
}
#endif

View File

@ -13,7 +13,7 @@ using std::pair;
namespace ATC {
// 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 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
- physics_type (string) = thermal | momentum\n
- solution_parameter (string) = max_iterations | tolerance\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
@ -209,14 +209,14 @@ namespace ATC {
foundMatch = true;
}
/*! \page man_localized_lambda fix_modify AtC control localized_lambda
/*! \page man_localized_lambda fix_modify AtC control localized_lambda
\section syntax
fix_modify AtC control localized_lambda <on|off>
fix_modify AtC control localized_lambda <on|off>
\section examples
<TT> fix_modify atc control localized_lambda on </TT> \n
\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.
\section restrictions
\section restrictions
\section related
\section default
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
fix_modify AtC control lumped_lambda_solve <on|off>
fix_modify AtC control lumped_lambda_solve <on|off>
\section examples
<TT> fix_modify atc control lumped_lambda_solve on </TT> \n
\section description
Command to use or not use lumped matrix for lambda solve
\section restrictions
\section restrictions
\section related
\section default
*/
@ -260,12 +260,12 @@ namespace ATC {
/*! \page man_mask_direction fix_modify AtC control mask_direction
\section syntax
fix_modify AtC control mask_direction <direction> <on|off>
fix_modify AtC control mask_direction <direction> <on|off>
\section examples
<TT> fix_modify atc control mask_direction 0 on </TT> \n
\section description
Command to mask out certain dimensions from the atomic regulator
\section restrictions
\section restrictions
\section related
\section default
*/
@ -404,7 +404,7 @@ namespace ATC {
//--------------------------------------------------------
// apply_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)
{
@ -415,7 +415,7 @@ namespace ATC {
//--------------------------------------------------------
// apply_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)
{
@ -426,14 +426,14 @@ namespace ATC {
//--------------------------------------------------------
// apply_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)
{
if (timeStep % howOften_==0) // apply full integration scheme, including filter
regulatorMethod_->apply_post_predictor(dt);
}
//--------------------------------------------------------
// apply_pre_corrector:
// applies the controller in the pre-corrector phase
@ -441,7 +441,7 @@ namespace ATC {
//--------------------------------------------------------
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);
}
@ -497,7 +497,7 @@ namespace ATC {
//--------------------------------------------------------
// 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)
{
@ -509,7 +509,7 @@ namespace ATC {
// Class RegulatorMethod
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -545,7 +545,7 @@ namespace ATC {
// Class RegulatorShapeFunction
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -604,7 +604,7 @@ namespace ATC {
interscaleManager.add_dense_matrix_int(overlapToNodeMap_,
regulatorPrefix_+"OverlapToNodeMap");
}
}
//--------------------------------------------------------
@ -690,7 +690,7 @@ namespace ATC {
//--------------------------------------------------------
void RegulatorShapeFunction::compute_sparsity(void)
{
// first get local pattern from N N^T
int nNodeOverlap = nodeToOverlapMap_->size();
DENS_MAT tmpLocal(nNodeOverlap,nNodeOverlap);
@ -699,7 +699,7 @@ namespace ATC {
if (myShapeFunctionMatrix.nRows() > 0) {
tmpLocal = myShapeFunctionMatrix.transMat(myShapeFunctionMatrix);
}
// second accumulate total pattern across processors
LammpsInterface::instance()->allsum(tmpLocal.ptr(), tmp.ptr(), tmp.size());
// third extract non-zero entries & construct sparse template
@ -724,13 +724,13 @@ namespace ATC {
{
// assemble N^T W N with appropriate weighting matrix
DIAG_MAT weights;
if (shapeFunctionMatrix_->nRows() > 0) {
weights.reset(weights_->quantity());
}
matrixSolver_->assemble_matrix(weights);
// solve on overlap nodes
int nNodeOverlap = nodeToOverlapMap_->size();
DENS_MAT rhsOverlap(nNodeOverlap,rhs.nCols());
@ -747,7 +747,7 @@ namespace ATC {
tempLambda = 0.;
}
}
// map solution back to all nodes
map_overlap_to_unique(lambdaOverlap,lambda);
}
@ -761,8 +761,8 @@ namespace ATC {
RegulatorMethod::reset_nlocal();
nLocal_ = atomicRegulator_->nlocal();
//compute_sparsity();
}
@ -903,7 +903,7 @@ namespace ATC {
void LambdaMatrixSolver::assemble_matrix(DIAG_MAT & weights)
{
// form matrix : sum_a N_Ia * W_a * N_Ja
SPAR_MAT lambdaMatrixLocal(matrixTemplate_.quantity());
if (weights.nRows()>0)
lambdaMatrixLocal.weighted_least_squares(shapeFunctionMatrix_->quantity(),weights);
@ -941,13 +941,13 @@ namespace ATC {
void LambdaMatrixSolverLumped::assemble_matrix(DIAG_MAT & weights)
{
LambdaMatrixSolver::assemble_matrix(weights);
lumpedMatrix_ = lambdaMatrix_.row_sum_lump();
}
void LambdaMatrixSolverLumped::execute(VECTOR & rhs, VECTOR & lambda)
void LambdaMatrixSolverLumped::execute(VECTOR & rhs, VECTOR & lambda)
{
// solve lumped equation
const set<int> & applicationNodes(applicationNodes_->quantity());
const INT_ARRAY & nodeToOverlapMap(nodeToOverlapMap_->quantity());

View File

@ -44,7 +44,7 @@ namespace ATC {
//--------------------------------------------------------
class AtomicRegulator {
public:
/** linear solver types */
@ -68,14 +68,14 @@ namespace ATC {
GHOST_FLUX,
FIXED
};
// constructor
AtomicRegulator(ATC_Coupling * atc,
const std::string & regulatorPrefix = "");
// destructor
virtual ~AtomicRegulator();
/** parser/modifier */
virtual bool modify(int narg, char **arg);
@ -87,11 +87,11 @@ namespace ATC {
/** initialization of method data */
virtual void initialize();
/** add output information */
virtual void output(OUTPUT_LIST & outputData) const;
virtual double compute_vector(int /* n */) const {return 0;}
/** final work at the end of a run */
virtual void finish();
@ -101,7 +101,7 @@ namespace ATC {
/** set up atom to material identification */
virtual void reset_atom_materials(const Array<int> & elementToMaterialMap,
const MatrixDependencyManager<DenseMatrix, int> * atomElement);
// application steps
/** apply the regulator in the pre-predictor phase */
virtual void apply_pre_predictor(double dt, int timeStep);
@ -136,7 +136,7 @@ namespace ATC {
virtual void compute_boundary_flux(FIELDS & fields);
/** add contributions (if any) to the finite element right-hand side */
virtual void add_to_rhs(FIELDS & rhs);
// data access, intended for method objects
/** 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);
@ -158,7 +158,7 @@ namespace ATC {
/** access for number of spatial dimensions */
int nsd() {return nsd_;};
/** access for number of local atoms */
int nlocal() {return nLocal_;};
int nlocal() {return nLocal_;};
/** access for boundary integration methods */
BoundaryIntegrationType boundary_integration_type()
{return boundaryIntegrationType_;};
@ -176,7 +176,7 @@ namespace ATC {
/** check to see if this direction is being used */
bool apply_in_direction(int i) const {return applyInDirection_[i];};
/** checks if there are any fixed nodes in the MD region */
bool md_fixed_nodes(FieldName fieldName = NUM_TOTAL_FIELDS) const;
@ -185,7 +185,7 @@ namespace ATC {
/** returns prefix tag for regulator */
const std::string & regulator_prefix() const {return regulatorPrefix_;};
protected:
// methods
@ -200,11 +200,11 @@ namespace ATC {
/** sets all data to be used */
void set_all_data_to_used();
// data
/** point to atc_transfer object */
ATC_Coupling * atc_;
/** how often in number of time steps regulator is applied */
int howOften_;
@ -227,7 +227,7 @@ namespace ATC {
RegulatorTargetType regulatorTarget_;
/** regulator fe coupling type flag */
RegulatorCouplingType couplingMode_;
/** number of nodes */
int nNodes_;
/** number of spatial dimensions */
@ -241,7 +241,7 @@ namespace ATC {
/** restrict application in certain directions */
std::vector<bool> applyInDirection_;
// method pointers
/** time filtering object */
TimeFilter * timeFilter_;
@ -256,30 +256,30 @@ namespace ATC {
const std::string regulatorPrefix_;
private:
// DO NOT define this
AtomicRegulator();
};
/**
* @class RegulatorMethod
* @brief Base class for implementation of control algorithms
*/
//--------------------------------------------------------
//--------------------------------------------------------
// Class RegulatorMethod
//--------------------------------------------------------
//--------------------------------------------------------
class RegulatorMethod {
public:
RegulatorMethod(AtomicRegulator * atomicRegulator,
const std::string & regulatorPrefix = "");
virtual ~RegulatorMethod(){};
/** instantiate all needed data */
@ -294,7 +294,7 @@ namespace ATC {
/** set up atom to material identification */
virtual void reset_atom_materials(const Array<int> & /* elementToMaterialMap */,
const MatrixDependencyManager<DenseMatrix, int> * /* atomElement */){};
/** applies regulator to atoms in the pre-predictor phase */
virtual void apply_pre_predictor(double /* dt */){};
@ -340,7 +340,7 @@ namespace ATC {
/** pack fields for restart */
virtual void pack_fields(RESTART_LIST & /* data */){};
protected:
//data
@ -372,7 +372,7 @@ namespace ATC {
// DO NOT define this
RegulatorMethod();
};
/**
@ -389,14 +389,14 @@ namespace ATC {
// of N^T w N lambda = rhs
//--------------------------------------------------------
//--------------------------------------------------------
class RegulatorShapeFunction : public RegulatorMethod {
public:
RegulatorShapeFunction(AtomicRegulator * atomicRegulator,
const std::string & regulatorPrefix = "");
virtual ~RegulatorShapeFunction();
/** instantiate all needed data */
@ -524,18 +524,18 @@ namespace ATC {
// Class LambdaMatrixSolver
//--------------------------------------------------------
//--------------------------------------------------------
class LambdaMatrixSolver {
public:
LambdaMatrixSolver(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance);
virtual ~LambdaMatrixSolver(){};
/** assemble the matrix */
virtual void assemble_matrix(DIAG_MAT & weights);
/** execute the solver */
virtual void execute(VECTOR & rhs, VECTOR & lambda)=0;
@ -549,7 +549,7 @@ namespace ATC {
/** matrix used to solve for lambda */
SPAR_MAT lambdaMatrix_;
/** maximum number of iterations */
int maxIterations_;
@ -560,7 +560,7 @@ namespace ATC {
// DO NOT define this
LambdaMatrixSolver();
};
//--------------------------------------------------------
@ -568,21 +568,21 @@ namespace ATC {
// Class LambdaMatrixSolverLumped
//--------------------------------------------------------
//--------------------------------------------------------
class LambdaMatrixSolverLumped : public LambdaMatrixSolver {
public:
LambdaMatrixSolverLumped(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance, const SetDependencyManager<int> * applicationNodes, const NodeToSubset * nodeToOverlapMap);
virtual ~LambdaMatrixSolverLumped(){};
/** assemble the matrix */
virtual void assemble_matrix(DIAG_MAT & weights);
/** execute the solver */
virtual void execute(VECTOR & rhs, VECTOR & lambda);
virtual void execute(VECTOR & rhs, VECTOR & lambda);
protected:
/** lumped version of the matrix governing lambda */
@ -598,7 +598,7 @@ namespace ATC {
// DO NOT define this
LambdaMatrixSolverLumped();
};
//--------------------------------------------------------
@ -606,18 +606,18 @@ namespace ATC {
// Class LambdaMatrixSolverCg
//--------------------------------------------------------
//--------------------------------------------------------
class LambdaMatrixSolverCg : public LambdaMatrixSolver {
public:
LambdaMatrixSolverCg(SPAR_MAN & matrixTemplate, SPAR_MAN * shapeFunctionMatrix, int maxIterations, double tolerance);
virtual ~LambdaMatrixSolverCg(){};
/** execute the solver */
virtual void execute(VECTOR & rhs, VECTOR & lambda);
virtual void execute(VECTOR & rhs, VECTOR & lambda);
protected:
@ -625,7 +625,7 @@ namespace ATC {
// DO NOT define this
LambdaMatrixSolverCg();
};
};

View File

@ -16,14 +16,14 @@ using std::vector;
namespace ATC {
BodyForceViscous::BodyForceViscous(
fstream &fileId, std::map<std::string,double> & parameters)
fstream &fileId, std::map<std::string,double> & parameters)
: BodyForce(), gamma_(0)
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
std::vector<std::string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "gamma") {

View File

@ -9,7 +9,7 @@
namespace ATC {
/**
* @class BodyForce
* @class BodyForce
* @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);
virtual ~BodyForceViscous() {};
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);
const DENS_MAT & v = v_field->second;
@ -49,20 +49,20 @@ namespace ATC {
class BodyForceElectricField : public BodyForce
{
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"); }
virtual ~BodyForceElectricField() {};
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);
const DENS_MAT & v = v_field->second;
int nNodes = v.nRows();
flux.reset(nNodes,1);
flux.reset(nNodes,1);
return true;
}
};
}
#endif
#endif

View File

@ -12,7 +12,7 @@ namespace ATC {
std::vector<DENS_VEC>::iterator R(ref_coords_.begin()), Rp;
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++) {
if (sum_difference_squared(*Rp, *R) < TOL) {
ref_coords_.erase(R--);
@ -59,13 +59,13 @@ namespace ATC {
fid << ((i+1)%3==0 ? "\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";
for (int i=0; i<npts; i++) fid << "1" << "\n";
}
//===========================================================================
// constructor
// constructor
// @param N 3x3 DenseMatrix with each column as a base 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
@ -79,7 +79,7 @@ namespace ATC {
for (int a=-1; a<2; a++)
for (int b=-1; b<2; b++)
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
@ -111,7 +111,7 @@ namespace ATC {
_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
{
@ -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$
// @param a cell x-index
// @param b cell y-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 double A=double(a), B=double(b), C=double(c);
bool found=false;
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
R0(i) = A*N_(0,i) + B*N_(1,i) + C*N_(2,i); // reference
}

View File

@ -14,7 +14,7 @@ namespace ATC
/**
* @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).
* Provides routines for outputting the atoms in the cluster to a vtk file,
* and checking for any overlapping atoms (which should not happen).
@ -23,7 +23,7 @@ namespace ATC
class AtomCluster
{
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);
public:
//* 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]; }
//* Returns a reference to the deformation gradient tensor.
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;
//* Computes the force constant matrix between atoms I and 0.
DENS_MAT force_constants(INDEX I, const CbPotential *p) const;
private:
std::vector<double> cur_bond_len_; //*> Bond lengths (current)
std::vector<DENS_VEC> ref_coords_; //*> Atom coordinates (ref)
DENS_MAT F_; //*> Deformation gradient
};
/**
* @class CBLattice
* @brief Base class that generates a virtual atom clusters given a lattice and
* @class CBLattice
* @brief Base class that generates a virtual atom clusters given a lattice and
* a deformation gradient.
*/
class CBLattice
{
protected:
@ -76,7 +76,7 @@ namespace ATC
public:
//* Operator that outputs the lattice and basis to a stream.
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
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]
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;
b = ((r>>8)&0xFF) - 128;

View File

@ -4,28 +4,28 @@
// CG solves the symmetric positive definite linear
// 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.
//
// The return value indicates convergence within max_iter (input)
// iterations (0), or no convergence within max_iter iterations (1).
//
// Upon successful return, output arguments have the following values:
//
//
// x -- approximate solution to Ax = b
// max_iter -- the number of iterations performed before the
// tolerance was reached
// tol -- the residual after the final iteration
//
//
//*****************************************************************
/**
* @class CG
* @brief Base class for solving the linear system Ax=b using the Conjugate Gradient method
* @class CG
* @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 >
int
int
CG(const Matrix &A, Vector &x, const DataVector &b, const Preconditioner &M, int &max_iter, Real &tol) {
Real resid;
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
Preconditioner Minv = M.inv();
if (normb == 0.0)
if (normb == 0.0)
normb = 1;
if ((resid = r.norm() / normb) <= tol) {
tol = resid;
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++) {
z = Minv*r;
rho = r.dot(z);
if (i == 0)
p = z;
else {
@ -64,18 +64,18 @@ CG(const Matrix &A, Vector &x, const DataVector &b, const Preconditioner &M, int
tmp = p*beta;
p = z + tmp;
}
q = A*p;
alpha = rho / p.dot(q);
x += p*alpha;
r -= q*alpha;
if ((resid = r.norm() / normb) <= tol)
if ((resid = r.norm() / normb) <= tol)
{
tol = resid;
max_iter = i+1;
return 0;
return 0;
}
rho_1 = rho;
}

View File

@ -32,7 +32,7 @@ namespace ATC {
DENS_MAT L0;
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.
if (finite_temp) {
D.reset(3,3);
@ -42,11 +42,11 @@ namespace ATC {
l0.reset(3);
}
if (F) *F = 0.0;
if (F) *F = 0.0;
// if using EAM potential, calculate embedding function and derivatives
if (args.potential->terms.embedding) {
for (INDEX a=0; a<args.vac.size(); a++) {
PairParam pair(args.vac.R(a), args.vac.bond_length(a));
e_density += args.potential->rho(pair.d);
@ -58,7 +58,7 @@ namespace ATC {
DENS_MAT rR = tensor_product(pair.r, pair.R);
L0.add_scaled(rR, pair.di*pair.rho_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;
for (int i = 0; i < 3; i++) {
for (int k = 0; k < 3; k++) {
@ -96,7 +96,7 @@ namespace ATC {
// Loop on all cluster atoms (origin atom not included).
for (INDEX a=0; a<args.vac.size(); 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);
pair.phi_r = args.potential->phi_r(pair.d);
pairwise_stress(pair, s);
@ -104,7 +104,7 @@ namespace ATC {
if (args.potential->terms.embedding) {
pair.F_p = embed_p;
pair.rho_r = args.potential->rho_r(pair.d);
embedding_stress(pair, s);
embedding_stress(pair, s);
}
if (finite_temp) { // Compute finite T terms.
@ -177,7 +177,7 @@ namespace ATC {
for (INDEX a=0; a<args.vac.size(); 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);
}
@ -185,11 +185,11 @@ namespace ATC {
pair.r = args.vac.r(a);
if (args.potential->terms.pairwise) {
pair.phi_r = args.potential->phi_r(pair.d);
pair.phi_rr = args.potential->phi_rr(pair.d);
pair.phi_rrr = args.potential->phi_rrr(pair.d);
pair.phi_rr = args.potential->phi_rr(pair.d);
pair.phi_rrr = args.potential->phi_rrr(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_rr = args.potential->rho_rr(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
}
}
// Finish finite temperature Cauchy-Born.
const double kB = args.boltzmann_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));
return F;
}
}
//===========================================================================
// Computes the entropic energy TS (minus c_v T)
//===========================================================================
@ -268,7 +268,7 @@ namespace ATC {
const double hbar = args.planck_constant;;
double F = kB*T*log(pow(hbar/(kB*T),3.0)*sqrt(det(D)));
return F;
}
}
//===========================================================================
// 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)
{
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 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;
// 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);
// compute the dynamical matrix
// compute the dynamical matrix
D.add_scaled(rr, f);
diagonal(D) += g;
if (!dDdF) return; // skip derivative
const double gp_r = g_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);
DENS_MAT_VEC &dD = *dDdF;
// compute first term in A.13
dD[0].add_scaled(rR, fp_r*rr(0,0) + 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 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);
// compute the dynamical matrix
// compute the dynamical matrix
D.add_scaled(rr, y);
diagonal(D) += z;
if (!dDdF) return; // skip derivative
DENS_MAT_VEC &dD = *dDdF;
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[4].add_scaled(L0, b*rr(0,2));
dD[5].add_scaled(L0, b*rr(0,1));
//add remaining term
//add remaining term
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++) {
dD[0](0,L) += 2*awr[0]*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 factor = 0.5*kb*T/detD;
// converts from PK1 to PK2
dd = inv(F)*dd;
// converts from PK1 to PK2
dd = inv(F)*dd;
for (INDEX i=0; i<3; i++)
for (INDEX j=i; j<3; 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);
}
//============================================================================
// 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)
{
// Compute the invariants of 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 IIIc = voigt3::det(C);
const DENS_VEC I = voigt3::eye(3);
@ -460,16 +460,16 @@ namespace ATC {
dU = tensor_product(dIc*dlambda, dIc); // may not be correct
return;
}
// Find the largest eigenvalue of C
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(dIIIc, 13.5);
dL.add_scaled(dIIIc, 13.5);
const double kpow = pow(k,-1.5);
const double dkpow = -1.5*kpow/k;
const double phi = acos(L*kpow); // phi - good
// temporary factors for dphi
const double d1 = -1.0/sqrt(1.0-L*L*kpow*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 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(dphi, (-2.0/9.0)*sqrt_k*sin((1.0/3.0)*phi));
const double lambda = sqrt(lam2);
const DENS_VEC dlambda = (0.5/lambda)*dlam2;
// Compute the invariants of U
// Compute the invariants of U
const double IIIu = sqrt(IIIc);
const DENS_VEC dIIIu (0.5/IIIu*dIIIc);
@ -504,20 +504,20 @@ namespace ATC {
dfct.add_scaled(dIIu, Iu);
dfct -= dIIIu;
dfct *= -fct*fct;
U = voigt3::eye(3, Iu*IIIu);
U.add_scaled(C, Iu*Iu-IIu);
U -= C2;
DENS_MAT da = tensor_product(I, dIu); da *= IIIu;
da.add_scaled(tensor_product(I, dIIIu), Iu);
da += tensor_product(C, 2.0*Iu*dIu-dIIu);
da.add_scaled(eye<double>(6,6),Iu*Iu-IIu);
da -= voigt3::derivative_of_square(C);
dU = tensor_product(U, dfct);
dU.add_scaled(da, fct);
U *= fct;
U *= fct;
}
//============================================================================
// Computes the dynamical matrix (TESTING FUNCTION)
@ -526,11 +526,11 @@ namespace ATC {
{
DENS_MAT D(3,3);
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.r = args.vac.r(a);
pair.phi_rr = args.potential->phi_rr(pair.d);
pair.phi_rrr = args.potential->phi_rrr(pair.d);
pair.phi_rr = args.potential->phi_rr(pair.d);
pair.phi_rrr = args.potential->phi_rrr(pair.d);
pairwise_thermal(pair, D);
}
return D;
@ -558,7 +558,7 @@ namespace ATC {
args.vac.F_(i,j) = Fij - EPS;
DENS_MAT Db = compute_dynamical_matrix(args);
args.vac.F_(i,j) = Fij;
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[2](i,j) = (Da(2,2)-Db(2,2))*(0.5/EPS);

View File

@ -13,9 +13,9 @@ namespace ATC {
class AtomCluster;
/**
* @class StressAtIP
* @brief Class for passing the vector of stresses at quadrature points
* Done by storing the quadrature point and providing indexing
* @class StressAtIP
* @brief Class for passing the vector of stresses at quadrature points
* Done by storing the quadrature point and providing indexing
*/
class StressAtIP {
@ -30,7 +30,7 @@ namespace ATC {
void set_quadrature_point(INDEX qp) { q = qp; }
//* Operator that outputs the stress
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(1,0) << " " << s(1,1) << " " << s(1,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
*/
struct PairParam {
@ -82,7 +82,7 @@ namespace ATC {
void cb_stress(const StressArgs &args, StressAtIP &s, double *F=0);
//* Computes the elastic energy (free or potential if T=0).
double cb_energy(const StressArgs &args);
//* Computes the entropic energy
//* Computes the entropic energy
double cb_entropic_energy(const StressArgs &args);
//* 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);
//* 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,
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).
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).
void stretch_tensor_derivative(const DENS_VEC &C, DENS_VEC &U, DENS_MAT &dU);
//@}

View File

@ -11,75 +11,75 @@ namespace ATC
{
/**
* @class CbEam
* @brief Class for computing Cauchy-Born quantities for an Embeded-Atom Method material
* (A factor of one-half is already included to split the
* @class CbEam
* @brief Class for computing Cauchy-Born quantities for an Embeded-Atom Method material
* (A factor of one-half is already included to split the
* bond energy between atoms)
*/
class CbEam : public CbPotential
{
public:
//! Constructor
CbEam(void) : CbPotential(Interactions(PAIRWISE,EAM)) {
//! Constructor
CbEam(void) : CbPotential(Interactions(PAIRWISE,EAM)) {
// get pointer to lammps' pair_eam object
lammps_eam = ATC::LammpsInterface::instance()->pair_eam();
nrho = &lammps_eam->nrho;
nr = &lammps_eam->nr;
nfrho = &lammps_eam->nfrho;
nrhor = &lammps_eam->nrhor;
nz2r = &lammps_eam->nz2r;
lammps_eam = ATC::LammpsInterface::instance()->pair_eam();
nrho = &lammps_eam->nrho;
nr = &lammps_eam->nr;
nfrho = &lammps_eam->nfrho;
nrhor = &lammps_eam->nrhor;
nz2r = &lammps_eam->nz2r;
type2frho = lammps_eam->type2frho;
type2rhor = lammps_eam->type2rhor;
type2z2r = lammps_eam->type2z2r;
dr = &lammps_eam->dr;
rdr = &lammps_eam->rdr;
drho = &lammps_eam->drho;
rdrho = &lammps_eam->rdrho;
dr = &lammps_eam->dr;
rdr = &lammps_eam->rdr;
drho = &lammps_eam->drho;
rdrho = &lammps_eam->rdrho;
rhor_spline = &lammps_eam->rhor_spline;
frho_spline = &lammps_eam->frho_spline;
z2r_spline = &lammps_eam->z2r_spline;
cutmax = &lammps_eam->cutmax;
}
//! Returns the cutoff readius of the EAM potential functions rho and z2r.
double cutoff_radius() const { return *cutmax; }
//! Returns the EAM pair energy
double phi(const double &r) const
//! Returns the EAM pair energy
double phi(const double &r) const
{
double p = r*(*rdr) + 1.0;
int m = static_cast<int> (p);
m = MIN(m,(*nr)-1);
p -= m;
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 z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
return z2/r;
}
//! 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;
int m = static_cast<int> (p);
m = MIN(m,(*nr)-1);
p -= m;
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 z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
return (1.0/r)*(z2p-z2/r);
}
//! 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;
int m = static_cast<int> (p);
m = MIN(m,(*nr)-1);
p -= m;
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 z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
@ -94,7 +94,7 @@ namespace ATC
m = MIN(m,(*nr)-1);
p -= m;
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 z2 = ((coeff[3]*p + coeff[4])*p + coeff[5])*p + coeff[6];
double z2p = (coeff[0]*p + coeff[1])*p + coeff[2];
@ -102,7 +102,7 @@ namespace ATC
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));
}
//! Returns the EAM atomic charge density.
//! Returns the EAM atomic charge density.
double rho(const double &r) const
{
double p = r*(*rdr) + 1.0;
@ -150,7 +150,7 @@ namespace ATC
double *coeff = (*rhor_spline)[type2rhor[1][1]][m];
return ((*rdr)*(*rdr)*2.0*coeff[0]);
}
//! Returns the EAM embedding energy.
//! Returns the EAM embedding energy.
double F(const double &p) const
{
double q = p*(*rdrho) + 1.0;
@ -202,7 +202,7 @@ namespace ATC
int *type2frho,**type2rhor,**type2z2r;
double *cutmax;
double *dr,*rdr,*drho,*rdrho;
double ****rhor_spline,****frho_spline,****z2r_spline;
double ****rhor_spline,****frho_spline,****z2r_spline;
LAMMPS_NS::PairEAM* lammps_eam;
};
}

View File

@ -24,24 +24,24 @@ namespace ATC
B (4.0*eps*pow(sig, 6)),
rcut(cutoff_radius)
{ }
//! Returns the cutoff readius of the LJ potential.
double cutoff_radius() const { return rcut; }
//! 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));
return r6i*(A*r6i - B);
}
//! 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 r6i = (ri*ri*ri)*(ri*ri*ri);
return r6i*ri*(6.0*B - 12.0*A*r6i);
}
//! 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 r6i = r2i*r2i*r2i;

View File

@ -23,20 +23,20 @@ namespace ATC
A (4.0*eps*pow(sig, 12)),
B (4.0*eps*pow(sig, 6)),
rcut(cutoff_radius)
{
{
ricut = 1.0/rcut;
r6icut = (ricut*ricut*ricut)*(ricut*ricut*ricut);
r6icut = (ricut*ricut*ricut)*(ricut*ricut*ricut);
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.
double cutoff_radius() const { return rcut; }
//! 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));
if (r < rcut) {
if (r < rcut) {
return (r6i*(A*r6i - B) - phicut - (r-rcut)*dphicut);
}
else {
@ -44,11 +44,11 @@ namespace ATC
}
}
//! 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 r6i = (ri*ri*ri)*(ri*ri*ri);
if (r < rcut) {
if (r < rcut) {
return (r6i*ri*(6.0*B - 12.0*A*r6i) - dphicut);
}
else {
@ -56,7 +56,7 @@ namespace ATC
}
}
//! 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 r6i = r2i*r2i*r2i;

View File

@ -17,7 +17,7 @@ namespace ATC
return (phi_r(r+dr)-phi_r(r)) / dr;
}
// 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;
return (phi_rr(r+dr)-phi_rr(r)) / dr;
@ -34,8 +34,8 @@ namespace ATC
const double dr = r*EPS;
return (rho_r(r+dr)-rho_r(r)) / dr;
}
// Approximates the third derivative of rho
double CbPotential::rho_rrr(const double &r) const
// Approximates the third derivative of rho
double CbPotential::rho_rrr(const double &r) const
{
const double dr = r*EPS;
return (rho_rr(r+dr)-rho_rr(r)) / dr;
@ -44,7 +44,7 @@ namespace ATC
double CbPotential::F_p(const double &p) const
{
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
double CbPotential::F_pp(const double &p) const
@ -79,7 +79,7 @@ namespace ATC
Interactions::Interactions(int a, int b, int c)
{
// bitwise OR combines the terms that are listed
const int abc = a|b|c;
const int abc = a|b|c;
pairwise = (abc&PAIRWISE)>0;
embedding = (abc&EAM)>0;
three_body = (abc&THREE_BDY)>0;

View File

@ -29,10 +29,10 @@ namespace ATC
protected:
//! CbPotential base constructor:
//! 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) {}
public:
virtual ~CbPotential() {}
virtual ~CbPotential() {}
const Interactions terms; //!< switches for types of potential terms.
//! Returns the minimum distance that all interactions get neglected.

View File

@ -20,7 +20,7 @@ using std::vector;
using std::set;
using std::pair;
using std::string;
namespace ATC {
@ -47,7 +47,7 @@ namespace ATC {
}
}
//--------------------------------------------------------
// modify:
// parses and adjusts charge regulator state based on
@ -97,7 +97,7 @@ namespace ATC {
regulators_[tag] = new ChargeRegulatorMethodEffectiveCharge(this,p);
break;
}
default:
default:
throw ATC_Error("ChargeRegulator::construct_method unknown charge regulator type");
}
}
@ -110,12 +110,12 @@ namespace ATC {
void ChargeRegulator::initialize()
{
map<string, ChargeRegulatorMethod *>::iterator itr;
for (itr = regulators_.begin();
itr != regulators_.end(); itr++) { itr->second->initialize(); }
atc_->set_boundary_integration_type(boundaryIntegrationType_);
atc_->set_boundary_integration_type(boundaryIntegrationType_);
AtomicRegulator::reset_nlocal();
AtomicRegulator::delete_unused_data();
needReset_ = false;
@ -152,23 +152,23 @@ namespace ATC {
//========================================================
// Class ChargeRegulatorMethod
//========================================================
//--------------------------------------------------------
// Constructor
// Grab references to ATC and ChargeRegulator
// Grab references to ATC and ChargeRegulator
//--------------------------------------------------------
ChargeRegulatorMethod::ChargeRegulatorMethod
(ChargeRegulator *chargeRegulator,
(ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & p)
: RegulatorShapeFunction(chargeRegulator),
: RegulatorShapeFunction(chargeRegulator),
chargeRegulator_(chargeRegulator),
lammpsInterface_(LammpsInterface::instance()),
rC_(0), rCsq_(0),
targetValue_(nullptr),
targetPhi_(p.value),
targetValue_(nullptr),
targetPhi_(p.value),
surface_(p.faceset),
atomGroupBit_(p.groupBit),
boundary_(false),
atomGroupBit_(p.groupBit),
boundary_(false),
depth_(p.depth),
surfaceType_(p.surfaceType),
permittivity_(p.permittivity),
@ -185,7 +185,7 @@ namespace ATC {
point_.reset(nsd_);
for (int i=0; i < nsd_; i++) { point_(i) = faceCoords(i,0); }
#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());
#endif
sum_.reset(nsd_);
@ -193,7 +193,7 @@ namespace ATC {
//--------------------------------------------------------
// Initialize
//--------------------------------------------------------
@ -217,7 +217,7 @@ namespace ATC {
// note derived method set initialized to true
}
int ChargeRegulatorMethod::nlocal() { return atc_->nlocal(); }
void ChargeRegulatorMethod::set_greens_functions(void)
@ -260,14 +260,14 @@ namespace ATC {
// Constructor
//--------------------------------------------------------
ChargeRegulatorMethodFeedback::ChargeRegulatorMethodFeedback
(ChargeRegulator *chargeRegulator,
(ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & p)
: ChargeRegulatorMethod (chargeRegulator, p),
controlNodes_(nodes_),
influenceGroupBit_(p.groupBit)
{
nControlNodes_ = controlNodes_.size();
sum_.resize(1);
nControlNodes_ = controlNodes_.size();
sum_.resize(1);
}
//--------------------------------------------------------
// Initialize
@ -275,10 +275,10 @@ namespace ATC {
void ChargeRegulatorMethodFeedback::initialize(void)
{
ChargeRegulatorMethod::initialize();
if (surfaceType_ != ChargeRegulator::CONDUCTOR)
if (surfaceType_ != ChargeRegulator::CONDUCTOR)
throw ATC_Error("currently charge feedback can only mimic a conductor");
set_influence();
set_influence_matrix();
set_influence();
set_influence_matrix();
initialized_ = true;
}
//--------------------------------------------------------
@ -299,13 +299,13 @@ namespace ATC {
}
}
//--------------------------------------------------------
// find measurement atoms and nodes
// find measurement atoms and nodes
//--------------------------------------------------------
void ChargeRegulatorMethodFeedback::set_influence(void)
{
// get nodes that overlap influence atoms & compact list of influence atoms
boundary_ =
boundary_ =
atc_->nodal_influence(influenceGroupBit_,influenceNodes_,influenceAtoms_);
nInfluenceAtoms_ = influenceAtoms_.size(); // local
nInfluenceNodes_ = influenceNodes_.size(); // global
@ -313,13 +313,13 @@ namespace ATC {
lammpsInterface_->print_msg(ss.str());
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++) {
influenceAtomsIds_.insert(map(*itr));
}
}
//--------------------------------------------------------
// constuct a Green's submatrix
// constuct a Green's submatrix
//--------------------------------------------------------
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(" solve not possible ");
DENS_MAT G(nInfluenceNodes_,nControlNodes_);
DENS_MAT G(nInfluenceNodes_,nControlNodes_);
DENS_VEC G_I;
set<int>::const_iterator itr,itr2,itr3;
const Array<int> & nmap = atc_->fe_engine()->fe_mesh()->global_to_unique_map();
@ -339,7 +339,7 @@ namespace ATC {
int j = 0;
for (itr2 = controlNodes_.begin(); itr2 != controlNodes_.end(); itr2++) {
int jnode = nmap(*itr2);
G(i,j++) = G_I(jnode);
G(i,j++) = G_I(jnode);
}
i++;
}
@ -371,33 +371,33 @@ namespace ATC {
}
// swap contributions across processors
DENS_MAT localNNT = NNT;
int count = NNT.nRows()*NNT.nCols();
int count = NNT.nRows()*NNT.nCols();
lammpsInterface_->allsum(localNNT.ptr(),NNT.ptr(),count);
invNNT_ = inv(NNT);
// total influence matrix
if (nInfluenceAtoms_ > 0) { NTinvNNTinvG_ = NT_*invNNT_*invG_; }
}
//--------------------------------------------------------
// change potential/charge pre-force calculation
//--------------------------------------------------------
void ChargeRegulatorMethodFeedback::apply_pre_force(double /* dt */)
{
sum_ = 0;
sum_ = 0;
if (nInfluenceAtoms_ == 0) return; // nothing to do
apply_feedback_charges();
}
//--------------------------------------------------------
// apply feedback charges to atoms
// apply feedback charges to atoms
//--------------------------------------------------------
void ChargeRegulatorMethodFeedback::apply_feedback_charges()
{
double * q = lammpsInterface_->atom_charge();
// calculate error in potential on the control nodes
const DENS_MAT & phiField = (atc_->field(ELECTRIC_POTENTIAL)).quantity();
DENS_MAT dphi(nControlNodes_,1);
int i = 0;
@ -410,10 +410,10 @@ namespace ATC {
DENS_MAT dq = NTinvNNTinvG_*dphi;
i = 0;
for (itr = influenceAtomsIds_.begin(); itr != influenceAtomsIds_.end(); itr++) {
sum_(0) += dq(i,0);
q[*itr] += dq(i++,0);
sum_(0) += dq(i,0);
q[*itr] += dq(i++,0);
}
(interscaleManager_->fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE))->force_reset();
(interscaleManager_->fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE, GHOST))->force_reset();
}
@ -425,7 +425,7 @@ namespace ATC {
// Constructor
//--------------------------------------------------------
ChargeRegulatorMethodImageCharge::ChargeRegulatorMethodImageCharge
(ChargeRegulator *chargeRegulator,
(ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & p)
: ChargeRegulatorMethod (chargeRegulator, p),
imageNodes_(nodes_)
@ -459,12 +459,12 @@ namespace ATC {
{
sum_ = 0;
apply_local_forces();
//correct_forces();
}
//--------------------------------------------------------
// apply local coulomb forces
// apply local coulomb forces
// -- due to image charges
//--------------------------------------------------------
void ChargeRegulatorMethodImageCharge::apply_local_forces()
@ -477,8 +477,8 @@ namespace ATC {
const int *mask = lammpsInterface_->atom_mask();
///..............................................
double ** x = lammpsInterface_->xatom();
double ** f = lammpsInterface_->fatom();
double ** x = lammpsInterface_->xatom();
double ** f = lammpsInterface_->fatom();
double * q = lammpsInterface_->atom_charge();
// loop over neighbor list
@ -487,13 +487,13 @@ namespace ATC {
double qi = q[i];
if ((mask[i] & atomGroupBit_) && qi != 0.) {
double* fi = f[i];
DENS_VEC xi(x[i],nsd_);
DENS_VEC xi(x[i],nsd_);
// distance to surface
double dn = reflect(xi);
// all ions near the interface/wall
// (a) self image
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 fn = factor_coul*qi*qi*permittivityRatio_/dx;
fi[0] += fn*normal_[0];
@ -513,8 +513,8 @@ namespace ATC {
dn = reflect(xj);
DENS_VEC dx = xi-xj;
double r2 = dx.norm_sq();
// neighbor image j' inside cutoff from i
if (r2 < rCsq_) {
// neighbor image j' inside cutoff from i
if (r2 < rCsq_) {
double fm = factor_coul*qi*qj*permittivityRatio_/r2;
fi[0] += fm*dx(0);
fi[1] += fm*dx(1);
@ -532,7 +532,7 @@ namespace ATC {
//--------------------------------------------------------
// correct charge densities
// - to reflect image charges
// - to reflect image charges
//--------------------------------------------------------
void ChargeRegulatorMethodImageCharge::correct_charge_densities()
{
@ -554,19 +554,19 @@ namespace ATC {
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
ChargeRegulatorMethodEffectiveCharge::ChargeRegulatorMethodEffectiveCharge(
ChargeRegulator *chargeRegulator,
ChargeRegulatorMethodEffectiveCharge::ChargeRegulatorMethodEffectiveCharge(
ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & p)
: ChargeRegulatorMethod (chargeRegulator, p),
chargeDensity_(p.value),
useSlab_(false)
useSlab_(false)
{
}
//--------------------------------------------------------
// add_charged_surface
//--------------------------------------------------------
void ChargeRegulatorMethodEffectiveCharge::initialize( )
void ChargeRegulatorMethodEffectiveCharge::initialize( )
{
ChargeRegulatorMethod::initialize();
boundary_ = atc_->is_ghost_group(atomGroupBit_);
@ -644,7 +644,7 @@ namespace ATC {
//--------------------------------------------------------
// add effective forces post LAMMPS force call
//--------------------------------------------------------
void ChargeRegulatorMethodEffectiveCharge::apply_post_force(double /* dt */)
void ChargeRegulatorMethodEffectiveCharge::apply_post_force(double /* dt */)
{
apply_local_forces();
}
@ -664,7 +664,7 @@ namespace ATC {
const DENS_MAT & xa((interscaleManager_->per_atom_quantity("AtomicCoarseGrainingPositions"))->quantity());
// WORKSPACE - most are static
SparseVector<double> dv(nNodes_);
SparseVector<double> dv(nNodes_);
vector<SparseVector<double> > derivativeVectors;
derivativeVectors.reserve(nsd_);
const SPAR_MAT_VEC & shapeFunctionDerivatives((interscaleManager_->vector_sparse_matrix("InterpolateGradient"))->quantity());
@ -674,7 +674,7 @@ namespace ATC {
NODE_TO_XF_MAP::const_iterator inode;
for (inode = nodeXFMap_.begin(); inode != nodeXFMap_.end(); inode++) {
int node = inode->first;
DENS_VEC xI = (inode->second).first;
double qI = (inode->second).second;
@ -682,46 +682,46 @@ namespace ATC {
for (int i = 0; i < nlocal(); i++) {
int atom = (atc_->internal_to_atom_map())(i);
double qa = q[atom];
if (qa != 0) {
if (qa != 0) {
double dxSq = 0.;
for (int j = 0; j < nsd_; j++) {
dx[j] = xa(i,j) - xI(j);
dxSq += dx[j]*dx[j];
}
if (dxSq < rCsq_) {
if (dxSq < rCsq_) {
// first apply pairwise coulombic interaction
if (!useSlab_) {
if (!useSlab_) {
double coulForce = qqrd2e_*qI*qa/(dxSq*sqrtf(dxSq));
for (int j = 0; j < nsd_; j++) {
_atomElectricalForce_(i,j) += dx[j]*coulForce; }
}
// second correct for FE potential induced by BCs
// determine shape function derivatives at atomic location
// and construct sparse vectors to store derivative data
for (int j = 0; j < nsd_; j++) {
shapeFunctionDerivatives[j]->row(i,nodeValues,nodeIndices);
derivativeVectors.push_back(dv);
for (int k = 0; k < nodeIndices.size(); k++) {
derivativeVectors[j](nodeIndices(k)) = nodeValues(k); }
}
// compute greens function from charge quadrature
SparseVector<double> shortFePotential(nNodes_);
SparseVector<double> shortFePotential(nNodes_);
shortFePotential.add_scaled(greensFunctions_[node],penalty*phiI);
// compute electric field induced by charge
DENS_VEC efield(nsd_);
for (int j = 0; j < nsd_; j++) {
efield(j) = -.1*dot(derivativeVectors[j],shortFePotential); }
// apply correction in atomic forces
double c = qV2e_*qa;
for (int j = 0; j < nsd_; j++) {
if ((!useSlab_) || (j==nsd_)) {
if ((!useSlab_) || (j==nsd_)) {
_atomElectricalForce_(i,j) -= c*efield(j);
}
}
@ -729,7 +729,7 @@ namespace ATC {
}
}
}
}
}; // end namespace

View File

@ -17,7 +17,7 @@ namespace ATC {
class ChargeRegulatorMethod;
class ChargeRegulator : public AtomicRegulator {
public:
/** charge regulator types */
@ -43,21 +43,21 @@ namespace ATC {
permittivity(0),
surfaceType(INSULATOR) { };
ChargeRegulatorType method;
double value;
double value;
int groupBit;
std::string groupTag;
double depth;
double permittivity;
double permittivity;
ChargedSurfaceType surfaceType;
FSET faceset;
FSET faceset;
};
/** constructor */
ChargeRegulator(ATC_Coupling *atc);
/** destructor */
~ChargeRegulator();
/** parser/modifier */
virtual bool modify(int narg, char **arg);
virtual void construct_methods();
@ -67,8 +67,8 @@ namespace ATC {
virtual void output(OUTPUT_LIST & outputData) const;
virtual double compute_vector(int /* n */) const {return 0;} // TODO
void assign_poisson_solver(PoissonSolver * solver) { poissonSolver_ = solver;}
PoissonSolver * poisson_solver(void) { return poissonSolver_;}
void assign_poisson_solver(PoissonSolver * solver) { poissonSolver_ = solver;}
PoissonSolver * poisson_solver(void) { return poissonSolver_;}
protected:
@ -86,19 +86,19 @@ namespace ATC {
/**
* @class ChargeRegulatorMethod
* @brief Base class for implementation of ChargeRegulator algorithms
* @brief Base class for implementation of ChargeRegulator algorithms
*/
class ChargeRegulatorMethod : public RegulatorShapeFunction {
public:
ChargeRegulatorMethod(ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & parameters);
~ChargeRegulatorMethod(){};
virtual void initialize(void);
virtual void initialize(void);
void set_greens_functions();
virtual void apply_pre_force(double /* dt */){};
virtual void apply_post_force(double /* dt */){};
virtual void apply_pre_force(double /* dt */){};
virtual void apply_post_force(double /* dt */){};
virtual void set_weights() {};
const DENS_VEC & total_influence() const { return sum_;}
virtual void output(OUTPUT_LIST & outputData);
@ -120,13 +120,13 @@ namespace ATC {
/** conversion constants */
double qV2e_, qqrd2e_;
/** member data */
XT_Function * targetValue_;
double targetPhi_;
// controlling
XT_Function * targetValue_;
double targetPhi_;
// controlling
FSET surface_;
NSET nodes_;
int atomGroupBit_;
bool boundary_; // atoms on boundary
bool boundary_; // atoms on boundary
DENS_VEC point_;
DENS_VEC normal_;
double depth_;
@ -147,13 +147,13 @@ namespace ATC {
*/
class ChargeRegulatorMethodFeedback : public ChargeRegulatorMethod {
public:
/** constructor */
ChargeRegulatorMethodFeedback(ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & parameters);
/** destructor */
~ChargeRegulatorMethodFeedback(){};
@ -161,30 +161,30 @@ namespace ATC {
virtual void construct_transfers();
/** 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_matrix(void);
void set_influence_matrix(void);
/** post first verlet step */
virtual void apply_pre_force(double dt);
virtual void apply_pre_force(double dt);
void apply_feedback_charges();
protected:
int nControlNodes_;
int nControlNodes_;
NSET & controlNodes_;
// measurement/controlled
int influenceGroupBit_;
int nInfluenceAtoms_;
NSET influenceAtoms_, influenceAtomsIds_;
NSET influenceAtoms_, influenceAtomsIds_;
int nInfluenceNodes_;
NSET influenceNodes_;
DENS_MAT invG_;
DENS_MAT invNNT_;
DENS_MAT NT_;
@ -200,26 +200,26 @@ namespace ATC {
*/
class ChargeRegulatorMethodImageCharge : public ChargeRegulatorMethod {
public:
/** constructor */
ChargeRegulatorMethodImageCharge(ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & parameters);
/** destructor */
~ChargeRegulatorMethodImageCharge(){};
/** initialize */
virtual void initialize(void);
virtual void initialize(void);
/** post first verlet step */
virtual void apply_post_force(double dt);
virtual void apply_post_force(double dt);
protected:
double reflect(DENS_VEC & x) const {
double reflect(DENS_VEC & x) const {
double dn = (x-point_).dot(normal_);
x -= 2*dn*normal_;
x -= 2*dn*normal_;
return dn;
}
// internal functions
@ -229,8 +229,8 @@ namespace ATC {
double layerDepth_;
double permittivityRatio_;
NSET & imageNodes_;
DENS_MAT imageTransferOp_;
NSET & imageNodes_;
DENS_MAT imageTransferOp_;
private:
ChargeRegulatorMethodImageCharge(); // DO NOT define this
@ -244,21 +244,21 @@ namespace ATC {
class ChargeRegulatorMethodEffectiveCharge : public ChargeRegulatorMethod {
typedef std::map<int,std::pair<DENS_VEC,double> > NODE_TO_XF_MAP;
public:
/** constructor */
ChargeRegulatorMethodEffectiveCharge(ChargeRegulator *chargeRegulator,
ChargeRegulator::ChargeRegulatorParameters & parameters);
/** destructor */
~ChargeRegulatorMethodEffectiveCharge(){};
/** initialize */
virtual void initialize(void);
virtual void initialize(void);
/** post first verlet step */
virtual void apply_post_force(double dt);
virtual void apply_post_force(double dt);
protected:
// internal functions
@ -268,7 +268,7 @@ namespace ATC {
double chargeDensity_;
std::map<int,double> nodalChargePotential_;
NODE_TO_XF_MAP nodeXFMap_;
NODE_TO_XF_MAP nodeXFMap_;
bool useSlab_;
@ -276,7 +276,7 @@ namespace ATC {
private:
ChargeRegulatorMethodEffectiveCharge(); // DO NOT define this
};
};
#endif

View File

@ -7,7 +7,7 @@
namespace ATC_matrix {
/**
* @class CloneVector
* @class CloneVector
* @brief Class for creating objects that wrap matrix data for manipulation through vector operations
*/
@ -39,7 +39,7 @@ public:
private:
void _resize(INDEX nRows, INDEX nCols, bool copy, bool zero);
Vector<T> * const _baseV; // ptr to a base vector
Matrix<T> * const _baseM; // ptr to a base matrix
int _clone_type; // what to clone (see enum CLONE_TYPE)
@ -52,7 +52,7 @@ private:
//-----------------------------------------------------------------------------
template<typename T>
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
@ -64,7 +64,7 @@ CloneVector<T>::CloneVector(const Vector<T> &c)
*/
//-----------------------------------------------------------------------------
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))
, _clone_type(dim), _idx(idx)
{}
@ -72,7 +72,7 @@ CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
// Construct from a DiagonalMatrix
//-----------------------------------------------------------------------------
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))
, _clone_type(CLONE_DIAG), _idx(0)
{}
@ -80,7 +80,7 @@ CloneVector<T>::CloneVector(const DiagonalMatrix<T> &c, INDEX /* idx */)
// value (const) indexing operator
//-----------------------------------------------------------------------------
template<typename T>
T CloneVector<T>::operator()(INDEX i, INDEX /* j */) const
T CloneVector<T>::operator()(INDEX i, INDEX /* j */) const
{
return (*this)[i];
}
@ -134,7 +134,7 @@ INDEX CloneVector<T>::nRows() const
template<typename T>
CloneVector<T>& CloneVector<T>::operator=(const T &v)
{
this->set_all_elements_to(v);
this->set_all_elements_to(v);
return *this;
}
//-----------------------------------------------------------------------------
@ -144,7 +144,7 @@ template<typename T>
CloneVector<T>& CloneVector<T>::operator=(const CloneVector<T> &C)
{
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];
return *this;
}
@ -155,7 +155,7 @@ template<typename T>
CloneVector<T>& CloneVector<T>::operator=(const Matrix<T> &C)
{
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];
return *this;
}
@ -168,7 +168,7 @@ bool CloneVector<T>::memory_contiguous() const
// drill down through clone of clones
if (_baseV) return _baseV->memory_contiguous();
// 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
return _clone_type == CLONE_ROW;
#else
@ -199,7 +199,7 @@ T* CloneVector<T>::ptr() const
template<typename T>
void CloneVector<T>::_resize(INDEX nRows, INDEX nCols, bool copy, bool zero)
{
if (_baseV)
if (_baseV)
{
if (copy) _baseV->resize(nRows, nCols, copy);
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);
}
//-----------------------------------------------------------------------------
// resizes the matrix and optionally zeros it out
// resizes the matrix and optionally zeros it out
//-----------------------------------------------------------------------------
template<typename T>
void CloneVector<T>::reset(INDEX nRows, INDEX nCols, bool zero)

View File

@ -41,7 +41,7 @@ const double kMinScale_ = 10000.;
}
if (parameters_.size()) parameters_.clear();
}
//--------------------------------------------------------
// modify:
// parses and adjusts charge regulator state based on
@ -66,7 +66,7 @@ const double kMinScale_ = 10000.;
// consruct new ones
map<string, ConcentrationRegulatorParameters>::iterator itr;
for (itr = parameters_.begin();
itr != parameters_.end(); itr++) {
itr != parameters_.end(); itr++) {
string tag = itr->first;
if (regulators_.find(tag) != regulators_.end()) delete regulators_[tag];
ConcentrationRegulatorParameters & p = itr->second;
@ -82,7 +82,7 @@ const double kMinScale_ = 10000.;
regulators_[tag] = new ConcentrationRegulatorMethodTransition(this,p);
break;
}
default:
default:
throw ATC_Error("ConcentrationRegulator::initialize unknown concentration regulator type");
}
}
@ -93,12 +93,12 @@ const double kMinScale_ = 10000.;
//--------------------------------------------------------
void ConcentrationRegulator::initialize()
{
map<string, ConcentrationRegulatorMethod *>::iterator itr;
for (itr = regulators_.begin();
itr != regulators_.end(); itr++) { itr->second->initialize(); }
atc_->set_boundary_integration_type(boundaryIntegrationType_);
atc_->set_boundary_integration_type(boundaryIntegrationType_);
AtomicRegulator::reset_nlocal();
AtomicRegulator::delete_unused_data();
needReset_ = false;
@ -157,7 +157,7 @@ const double kMinScale_ = 10000.;
map<string, ConcentrationRegulatorMethod *>::const_iterator itr;
for (itr = regulators_.begin();
itr != regulators_.end(); itr++) {
itr != regulators_.end(); itr++) {
if (c++ == n) { return itr->second->compute_vector(m); }
}
return 0.;
@ -168,34 +168,34 @@ const double kMinScale_ = 10000.;
//--------------------------------------------------------
int ConcentrationRegulator::size_vector(int /* i */) const
{
int n = (regulators_.size())*5;
if (n==0) n = 20;
return n;
int n = (regulators_.size())*5;
if (n==0) n = 20;
return n;
}
//========================================================
// Class ConcentrationRegulatorMethodTransition
//========================================================
//--------------------------------------------------------
// Constructor
// Grab references to ATC and ConcentrationRegulator
// Grab references to ATC and ConcentrationRegulator
//--------------------------------------------------------
ConcentrationRegulatorMethodTransition::ConcentrationRegulatorMethodTransition
(ConcentrationRegulator *concReg,
(ConcentrationRegulator *concReg,
ConcentrationRegulator::ConcentrationRegulatorParameters & p)
: ConcentrationRegulatorMethod(concReg),
: ConcentrationRegulatorMethod(concReg),
concentrationRegulator_(concReg),
interscaleManager_(nullptr),
lammpsInterface_(LammpsInterface::instance()),
list_(nullptr),
targetConcentration_(p.value),
targetCount_(0),
targetConcentration_(p.value),
targetCount_(0),
elemset_(p.elemset),
p_(nullptr),
randomNumberGenerator_(nullptr),
randomNumberGenerator_(nullptr),
q0_(0),
controlType_(p.type),
controlType_(p.type),
controlIndex_(0),
transitionType_(p.transitionType),
transitionInterval_(p.transitionInterval),
@ -241,7 +241,7 @@ const double kMinScale_ = 10000.;
PerAtomQuantity<int> * a2el = atc_->atom_to_element_map();
list_ = new AtomInElementSet(atc_,a2el,elemset_,controlType_);
nNodes_ = atc_->num_nodes();
DENS_MAT conc(nNodes_,1); conc = targetConcentration_;
DENS_VEC integral = atc_->fe_engine()->integrate(conc,elemset_);
@ -250,7 +250,7 @@ const double kMinScale_ = 10000.;
volumes_.resize(elemset_.size());
ESET::const_iterator itr;
int i = 0;
DENS_MAT c(nNodes_,1); c = 1;
DENS_MAT c(nNodes_,1); c = 1;
V_ = 0.;
for (itr = elemset_.begin(); itr != elemset_.end(); itr++, i++) {
ESET e; e.insert(*itr);
@ -261,14 +261,14 @@ const double kMinScale_ = 10000.;
volumes_ *= 1./V_;
for (int i = 1; i < volumes_.size(); i++) {
volumes_(i) += volumes_(i-1);
}
}
// record original energetic properties
int ntypes = lammpsInterface_->ntypes();
epsilon0_.reset(ntypes);
p_ = lammpsInterface_->potential();
lammpsInterface_->epsilons(controlType_,p_,epsilon0_.ptr());
#ifdef ATC_VERBOSE
string msg = "type "+to_string(controlType_)+" target count " + to_string(targetCount_);
msg += " volume " + to_string(V_);
@ -280,11 +280,11 @@ const double kMinScale_ = 10000.;
}
double ConcentrationRegulatorMethodTransition::uniform() const {
_rngUniformCounter_++;
return lammpsInterface_->random_uniform(randomNumberGenerator_);
return lammpsInterface_->random_uniform(randomNumberGenerator_);
}
double ConcentrationRegulatorMethodTransition::normal() const {
_rngNormalCounter_++;
return lammpsInterface_->random_normal(randomNumberGenerator_);
return lammpsInterface_->random_normal(randomNumberGenerator_);
}
//--------------------------------------------------------
// pre exchange
@ -294,7 +294,7 @@ const double kMinScale_ = 10000.;
// return if should not be called on this timestep
if ( ! lammpsInterface_->now(frequency_)) return;
nexchanges_ = excess();
int n = abs(nexchanges_);
int n = abs(nexchanges_);
bool success = false;
if (nexchanges_ > 0) { success = delete_atoms(n); }
else if (nexchanges_ < 0) { success = insert_atoms(n); }
@ -308,7 +308,7 @@ const double kMinScale_ = 10000.;
}
transitionCounter_=0;
transition();
}
}
//--------------------------------------------------------
// pre force
//--------------------------------------------------------
@ -319,28 +319,28 @@ const double kMinScale_ = 10000.;
//--------------------------------------------------------
// accept
//--------------------------------------------------------
bool ConcentrationRegulatorMethodTransition::accept(double energy, double /* T */) const
{
bool ConcentrationRegulatorMethodTransition::accept(double energy, double /* T */) const
{
#ifdef ATC_VERBOSE2
if (energy < maxEnergy_) lammpsInterface_->print_msg(" energy "+to_string(energy)+" "+to_string(rngCounter_));
#endif
return (energy < maxEnergy_);
}
}
//--------------------------------------------------------
// energy
//--------------------------------------------------------
double ConcentrationRegulatorMethodTransition::energy(int id) const
double ConcentrationRegulatorMethodTransition::energy(int id) const
{
double e = lammpsInterface_->shortrange_energy(id,maxEnergy_);
#ifdef ATC_VERBOSE
{
{
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_));
}
#endif
return e;
}
double ConcentrationRegulatorMethodTransition::energy(double * x) const
double ConcentrationRegulatorMethodTransition::energy(double * x) const
{
double e = lammpsInterface_->shortrange_energy(x,controlType_,maxEnergy_);
#ifdef ATC_VERBOSE
@ -375,8 +375,8 @@ const double kMinScale_ = 10000.;
bool ConcentrationRegulatorMethodTransition::delete_atoms(int n)
{
ID_PAIR idPair;
deletionIds_.clear();
deletionIds_.clear();
int deletions = 0;
int attempts = 0;
while(deletions < n && attempts < maxAttempts_){
@ -406,7 +406,7 @@ const double kMinScale_ = 10000.;
//--------------------------------------------------------
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);
}
double ConcentrationRegulatorMethodTransition::deletion_id_consistent(ID_PAIR & id) const
@ -422,12 +422,12 @@ const double kMinScale_ = 10000.;
double min = ntotal;
int * tag = lammpsInterface_->atom_tag();
for (itr = list.begin(); itr != list.end(); itr++) {
int atag = tag[itr->second];
int atag = tag[itr->second];
double d = fabs(atag-r);
if (d < min) {
min = d;
idx = i;
}
}
i++;
}
int imin = kMinScale_*min;
@ -455,7 +455,7 @@ const double kMinScale_ = 10000.;
r *= ntotal;
if ( (r >= nrank-n) && (r < nrank)) { // pick processor
r = uniform();
r = uniform();
int idx = rnd(r*(n-1));
id = list_->item(idx);
// avoid repeats
@ -463,7 +463,7 @@ const double kMinScale_ = 10000.;
l.erase(l.begin()+idx);
return energy(id.second);
}
else {
else {
return maxEnergy_;
}
}
@ -474,7 +474,7 @@ const double kMinScale_ = 10000.;
{
insertionIds_.clear();
DENS_VEC x(3); x = 0;
DENS_VEC x(3); x = 0;
DENS_VEC v(3); v = 0;
const DENS_MAN & T = atc_->field(TEMPERATURE);
int additions = 0;
@ -482,7 +482,7 @@ const double kMinScale_ = 10000.;
while(additions < n && attempts < maxAttempts_){
if(accept(insertion_location(x))) {
DENS_VEC Tv = atc_->fe_engine()->interpolate_field(x,T);
Tv(0) = 300.;
Tv(0) = 300.;
pick_velocity(v,Tv(0)); // 3 normal
int nlocal = lammpsInterface_->insert_atom(transitionType_,controlMask_,x.ptr(),v.ptr()); // no charge
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
{
// pick random element
// pick random element
int elem = pick_element(); // 1 uniform
// pick random local coordinate
DENS_VEC xi(3);
@ -552,8 +552,8 @@ Tv(0) = 300.;
#endif
return energy(x.ptr());
}
else {
return maxEnergy_;
else {
return maxEnergy_;
}
}
//--------------------------------------------------------
@ -573,7 +573,7 @@ Tv(0) = 300.;
// pick coordinates
//--------------------------------------------------------
void ConcentrationRegulatorMethodTransition::pick_coordinates(const int elem,
DENS_VEC & xi,
DENS_VEC & xi,
DENS_VEC & x) const
{
xi.reset(3);
@ -600,9 +600,9 @@ Tv(0) = 300.;
void ConcentrationRegulatorMethodTransition::transition()
{
transitionCounter_++;
//if (insertionIds_.size() == 0) return; //
if (transitionCounter_> transitionInterval_) {
nInTransition_ = 0;
//if (insertionIds_.size() == 0) return; //
if (transitionCounter_> transitionInterval_) {
nInTransition_ = 0;
return;
}
else if (transitionCounter_==transitionInterval_) {
@ -611,10 +611,10 @@ Tv(0) = 300.;
else {
transitionFactor_ = insertion_factor(transitionCounter_);
if (nInTransition_ < 0) transitionFactor_ = 1-transitionFactor_;
double q = 0;
double q = 0;
lammpsInterface_->set_charge(transitionType_,q);
DENS_VEC eps = epsilon0_;
lammpsInterface_->set_epsilons(transitionType_,p_,eps.ptr());
lammpsInterface_->pair_reinit(); // epsilon
}
@ -624,7 +624,7 @@ Tv(0) = 300.;
//--------------------------------------------------------
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==2) return (1.-transitionFactor_)*nInTransition_;
else if (n==3) return _rngUniformCounter_;

View File

@ -16,13 +16,13 @@ namespace ATC {
class ConcentrationRegulatorMethod;
class ConcentrationRegulator : public AtomicRegulator {
public:
enum ConcentrationRegulatorType {NONE=0,TRANSITION};
/** parser data */
struct ConcentrationRegulatorParameters {
ConcentrationRegulatorParameters():
method(NONE),
method(NONE),
type(0),
groupbit(0),
transitionType(0),
@ -36,14 +36,14 @@ namespace ATC {
int type;
int groupbit;
int transitionType;
double value;
double value;
int frequency;
int transitionInterval;
double maxEnergy;
int maxExchanges;
int maxAttempts;
std::string transitionTag;
ESET elemset;
ESET elemset;
};
/** constructor */
@ -96,22 +96,22 @@ namespace ATC {
private:
ConcentrationRegulator(); // DO NOT define this
};
/**
* @class ConcentrationRegulatorMethod
* @brief Base class for ConcentrationRegulator algorithms
* @brief Base class for ConcentrationRegulator algorithms
*/
class ConcentrationRegulatorMethod : public RegulatorShapeFunction {
public:
ConcentrationRegulatorMethod(ConcentrationRegulator *c)
: RegulatorShapeFunction(c) {};
~ConcentrationRegulatorMethod() {};
void initialize(void) {};
virtual void pre_force() {};
virtual void pre_exchange() {};
virtual void finish() {};
virtual void pre_force() {};
virtual void pre_exchange() {};
virtual void finish() {};
virtual void set_weights() {};
virtual double compute_vector(int /* n */) const { return 0;}
virtual void output(OUTPUT_LIST & /* outputData */){};
@ -124,7 +124,7 @@ namespace ATC {
* @brief GCMC + thermodynamic integration
*/
class ConcentrationRegulatorMethodTransition : public ConcentrationRegulatorMethod {
public:
/** constructor */
ConcentrationRegulatorMethodTransition(
@ -135,11 +135,11 @@ namespace ATC {
if (randomNumberGenerator_) delete randomNumberGenerator_;
}
/** initialize */
void initialize(void);
void initialize(void);
/** prior to force evaluation */
virtual void pre_force();
virtual void pre_force();
/** prior to exchanges */
virtual void pre_exchange();
virtual void pre_exchange();
/** "thermo" output */
virtual double compute_vector(int n) const;
protected:
@ -155,13 +155,13 @@ namespace ATC {
double deletion_id_free(ID_PAIR & id) const ;
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;
}
void transition();
bool accept(double energy, double T = 0) const;
bool delete_atoms(int n);
bool insert_atoms(int n);
bool insert_atoms(int n);
int pick_element() const;
void pick_coordinates(const int elem, DENS_VEC & xi, DENS_VEC& x ) const;
void pick_velocity(DENS_VEC & v, const double T ) const;
@ -179,9 +179,9 @@ namespace ATC {
/** member data */
class AtomInElementSet * list_;
double targetConcentration_;
double targetCount_;
ESET elemset_;
double targetConcentration_;
double targetCount_;
ESET elemset_;
POTENTIAL p_;
RNG_POINTER randomNumberGenerator_;
DENS_VEC volumes_;

View File

@ -8,8 +8,8 @@
namespace ATC_matrix {
/**
* @class DenseMatrix
* @brief Class for storing data in a "dense" matrix form
* @class DenseMatrix
* @brief Class for storing data in a "dense" matrix form
*/
template <typename T>
@ -36,7 +36,7 @@ public:
DenseMatrix<T> mult_by_element(const DenseMatrix<T>& B) const;
/** returns by element multiply A_ij = this_ij / B_ij */
DenseMatrix<T> div_by_element(const DenseMatrix<T>& B) const;
/** 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); }
@ -50,7 +50,7 @@ public:
void from_file(std::string & name);
void set_all_elements_to(const T &v);
DiagonalMatrix<T> diag() const;
DenseMatrix<T>& operator=(const T &v);
DenseMatrix<T>& operator=(const Matrix<T> &c);
DenseMatrix<T>& operator=(const DenseMatrix<T> &c);
@ -120,8 +120,8 @@ void DenseMatrix<T>::resize(INDEX rows, INDEX cols, bool copy)
_delete();
_create(rows, cols);
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
(*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;
C.reset(_nRows,_nCols);
if (B.nCols() == _nCols) {
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
C(i,j) = (*this)(i,j)*B(i,j);
}
else if (B.nCols() == 1) {
std::cout << "MULTIPLYING\n";
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
C(i,j) = (*this)(i,j)*B(i,0);
}
else {
SSCK(B, *this, "DenseMatrix::mult_by_element");
else {
SSCK(B, *this, "DenseMatrix::mult_by_element");
}
return C;
}
@ -182,21 +182,21 @@ DenseMatrix<T> DenseMatrix<T>::div_by_element(const DenseMatrix<T>& B) const
C.reset(_nRows,_nCols);
if (B.nCols() == _nCols) {
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
C(i,j) = (*this)(i,j)/B(i,j);
}
else if (B.nCols() == 1) {
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
C(i,j) = (*this)(i,j)/B(i,0);
}
else {
SSCK(B, *this, "DenseMatrix::div_by_element");
else {
SSCK(B, *this, "DenseMatrix::div_by_element");
}
return C;
}
@ -214,7 +214,7 @@ void DenseMatrix<T>::write_restart(FILE *f) const
// reads matrix from text file (matrix needs to be sized)
//----------------------------------------------------------------------------
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(_nCols == 0,"from_file needs nCols > 0");
@ -223,10 +223,10 @@ void DenseMatrix<T>::from_file(std::string & name)
char line[lineSize];
if (! in.good()) gerror(name+" is not available");
in.getline(line,lineSize); // header
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; j++)
int szi = this->nRows();
int szj = this->nCols();
for (INDEX i = 0; i < szi; i++)
for (INDEX j = 0; j < szj; 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;
}
//-----------------------------------------------------------------------------
// 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>
DiagonalMatrix<T> DenseMatrix<T>::diag() const
DiagonalMatrix<T> DenseMatrix<T>::diag() const
{
DiagonalMatrix<T> D(nRows(), true); // initialized to zero
INDEX i;
for (i=0; i<nRows(); i++)
{
{
D(i,i) = DATA(i,i);
}
return D;
@ -259,7 +259,7 @@ template <typename T>
void DenseMatrix<T>::_delete()
{
_nRows = _nCols = 0;
if (_data){
if (_data){
delete [] _data;
_data = nullptr;
}
@ -271,7 +271,7 @@ template <typename T>
void DenseMatrix<T>::_create(INDEX rows, INDEX cols, bool zero)
{
_nRows=rows;
_nRows=rows;
_nCols=cols;
_data = (this->size() ? new T [_nCols*_nRows] : nullptr);
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
//----------------------------------------------------------------------------
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())
{
_delete();
_delete();
_create(c.nRows(), c.nCols());
}
else
else
{
_nRows = c.nRows();
_nCols = c.nCols();
@ -295,7 +295,7 @@ void DenseMatrix<T>::_copy(const Matrix<T> &c)
memcpy(_data, c.ptr(), c.size()*sizeof(T));
}
//----------------------------------------------------------------------------
// sets all elements to a constant
// sets all elements to a constant
//----------------------------------------------------------------------------
template <typename T>
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.
//* see http://en.wikipedia.org/wiki/Adjugate_matrix
//* symmetric flag only affects cases N>3
template<typename T>
//* see http://en.wikipedia.org/wiki/Adjugate_matrix
//* symmetric flag only affects cases N>3
template<typename T>
DenseMatrix<T> adjugate(const Matrix<T> &A, bool symmetric)
{
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()) {
case 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(1,0) =-A(1,0); C(1,1) = A(0,0);
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(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(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);
break;
default:
default:
// this feature is neither tested nor optimal - use at your own risk!!!
DenseMatrix<T> m(A.nRows()-1, A.nRows()-1);
double sign[] = {1.0, -1.0};
for (INDEX j=0; j<A.nCols(); j++) {
for (INDEX i=0; i<A.nRows(); i++) {
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
}
}

View File

@ -9,7 +9,7 @@ template<typename T>
/**
* @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>
@ -20,7 +20,7 @@ public:
DenseVector(const Vector<T> &c) : Vector<T>(), _data(nullptr) { _copy(c); }
DenseVector(const T * ptr, INDEX nrows) : Vector<T>(), _data(nullptr) { copy(ptr,nrows); }
virtual ~DenseVector() { _delete(); }
//* resizes the Vector, ignores nCols, optionally copys what fits
void resize(INDEX rows, INDEX cols=1, bool copy=false);
//* 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) const { 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();
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
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())
{
_delete();

View File

@ -20,7 +20,7 @@ namespace ATC {
};
/**
* @class DependencyManager
* @class DependencyManager
* @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
friend class InterscaleManager;
// constructor
DependencyManager() : needReset_(true), isFixed_(false), memoryType_(TEMPORARY), dfsFound_(false) {};
// destructor
virtual ~DependencyManager() {};
/** registration by other PerAtomQuantity objects */
void register_dependence(DependencyManager * dependentQuantity)
{dependentQuantities_.insert(dependentQuantity);};
@ -47,7 +47,7 @@ namespace ATC {
/** check if a reset is required */
bool need_reset() const {return needReset_ && !isFixed_;};
/** propagate need to reset to to dependencies */
void propagate_reset()
{
@ -91,10 +91,10 @@ namespace ATC {
protected:
/** list of dependent atomic quantities */
std::set<DependencyManager * > dependentQuantities_;
/** flag for needing a recent */
// mutable is applied because there can be internal updates because we update when needed rather than when pushed
mutable bool needReset_;
@ -107,9 +107,9 @@ namespace ATC {
/** flag for if the node has been found in depth-first search */
bool dfsFound_;
};
/**
* @class MatrixDependencyManager
* @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 */
virtual T<U> & set_quantity() {propagate_reset(); return get_quantity();};
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
virtual const T<U> & quantity() const {return get_quantity();};
@ -210,12 +210,12 @@ namespace ATC {
{
public:
MatrixDependencyManager(MPI_Comm comm) :
MatrixDependencyManager(MPI_Comm comm) :
MatrixDependencyManager<SparseMatrix, T>(), quantity_(comm) {};
MatrixDependencyManager(MPI_Comm comm, int nRows, int nCols) :
MatrixDependencyManager<SparseMatrix, T>(), quantity_(comm, nRows, nCols) {};
virtual ~MatrixDependencyManager() {};
protected:
@ -238,12 +238,12 @@ namespace ATC {
{
public:
MatrixDependencyManager(MPI_Comm comm) :
MatrixDependencyManager(MPI_Comm comm) :
MatrixDependencyManager<DiagonalMatrix, T>(), quantity_(comm) {};
MatrixDependencyManager(MPI_Comm comm, int nRows, int nCols) :
MatrixDependencyManager<DiagonalMatrix, T>(), quantity_(comm, nRows, nCols) {};
virtual ~MatrixDependencyManager() {};
protected:
@ -267,13 +267,13 @@ namespace ATC {
// constructor
SetDependencyManager() :
DependencyManager(), quantity_() {};
// destructor
virtual ~SetDependencyManager() {};
/** returns a non-const version for manipulations and changes, resets dependent quantities */
virtual std::set<T> & set_quantity() {propagate_reset(); return quantity_;};
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
virtual const std::set<T> & quantity() const {return quantity_;};
@ -300,13 +300,13 @@ namespace ATC {
// constructor
VectorDependencyManager() :
DependencyManager(), quantity_() {};
// destructor
virtual ~VectorDependencyManager() {};
/** returns a non-const version for manipulations and changes, resets dependent quantities */
virtual std::vector<T> & set_quantity() {propagate_reset(); return quantity_;};
/** access to a constant dense matrix of the quantity, indexed by AtC atom counts */
virtual const std::vector<T> & quantity() const {return quantity_;};

View File

@ -7,19 +7,19 @@ namespace ATC_matrix {
/**
* @class DiagonalMatrix
* @brief Class for storing data as a diagonal matrix
* @brief Class for storing data as a diagonal matrix
*/
template<typename T>
class DiagonalMatrix : public Matrix<T>
{
public:
public:
explicit DiagonalMatrix(INDEX nRows=0, bool zero=0);
DiagonalMatrix(const DiagonalMatrix<T>& c);
DiagonalMatrix(const Vector<T>& v);
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);
//* resizes the matrix, ignores nCols, optionally copies what fits
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(); }
//* computes the inverse of this matrix
DiagonalMatrix<T>& inv_this();
DiagonalMatrix<T>& inv_this();
//* returns a copy of the inverse of this matrix
DiagonalMatrix<T> inv() const;
@ -82,19 +82,19 @@ protected:
DiagonalMatrix& operator=(const Vector<T> & /* c */) {}
DiagonalMatrix& operator=(const Matrix<T> & /* c */) {}
private:
private:
void _delete();
Vector<T> *_data;
};
};
//-----------------------------------------------------------------------------
// DiagonalMatrix-DiagonalMatrix multiplication
//-----------------------------------------------------------------------------
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");
DiagonalMatrix<T> R(A);
DiagonalMatrix<T> R(A);
for (INDEX i=0; i<R.nRows(); i++) R[i] *= B[i];
return R;
}
@ -149,7 +149,7 @@ DenseVector<T> operator*(const Vector<T> &b, const DiagonalMatrix<T>& A)
// DiagonalMatrix-SparseMatrix multiplication
//-----------------------------------------------------------------------------
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");
SparseMatrix<T> R(B);
@ -171,7 +171,7 @@ DiagonalMatrix<T> operator*(DiagonalMatrix<T> &A, const T s)
// Commute with DiagonalMatrix * double
//-----------------------------------------------------------------------------
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);
R *= s;
@ -231,10 +231,10 @@ DiagonalMatrix<T>::DiagonalMatrix(const Vector<T>& v)
// destructor
//-----------------------------------------------------------------------------
template<typename T>
DiagonalMatrix<T>::~DiagonalMatrix()
DiagonalMatrix<T>::~DiagonalMatrix()
{
_delete();
}
}
//-----------------------------------------------------------------------------
// deletes the data stored by this matrix
//-----------------------------------------------------------------------------
@ -244,7 +244,7 @@ void DiagonalMatrix<T>::_delete()
if (_data) delete _data;
}
//-----------------------------------------------------------------------------
// resizes the matrix, ignores nCols, optionally zeros
// resizes the matrix, ignores nCols, optionally zeros
//-----------------------------------------------------------------------------
template<typename T>
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>
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)
//-----------------------------------------------------------------------------
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
_delete();
@ -274,7 +274,7 @@ void DiagonalMatrix<T>::reset(const Vector<T>& v)
// copys from another DiagonalMatrix
//-----------------------------------------------------------------------------
template<typename T>
void DiagonalMatrix<T>::reset(const DiagonalMatrix<T>& c)
void DiagonalMatrix<T>::reset(const DiagonalMatrix<T>& c)
{
reset(*(c._data));
}
@ -337,41 +337,41 @@ T& DiagonalMatrix<T>::operator()(INDEX i, INDEX /* j */)
// value indexing operator - returns 0 if i!=j
//-----------------------------------------------------------------------------
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
//-----------------------------------------------------------------------------
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
//-----------------------------------------------------------------------------
template<typename T>
T DiagonalMatrix<T>::operator[](INDEX i) const
{
return (*_data)(i);
T DiagonalMatrix<T>::operator[](INDEX i) const
{
return (*_data)(i);
}
//-----------------------------------------------------------------------------
// returns the number of rows
//-----------------------------------------------------------------------------
template<typename T>
INDEX DiagonalMatrix<T>::nRows() const
{
return _data->size();
INDEX DiagonalMatrix<T>::nRows() const
{
return _data->size();
}
//-----------------------------------------------------------------------------
// returns the number of columns (same as nCols())
//-----------------------------------------------------------------------------
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!
@ -379,13 +379,13 @@ INDEX DiagonalMatrix<T>::nCols() const
template<typename T>
T* DiagonalMatrix<T>::ptr() const
{
return _data->ptr();
}
return _data->ptr();
}
//-----------------------------------------------------------------------------
// writes the diagonal to a binary data restart file
//-----------------------------------------------------------------------------
template<typename T>
void DiagonalMatrix<T>::write_restart(FILE *f) const
void DiagonalMatrix<T>::write_restart(FILE *f) const
{
_data->write_restart(f);
}
@ -393,7 +393,7 @@ void DiagonalMatrix<T>::write_restart(FILE *f) const
// sets the diagonal to a constant
//-----------------------------------------------------------------------------
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);
return *this;
@ -402,7 +402,7 @@ DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const T v)
// assignment operator with another diagonal matrix
//-----------------------------------------------------------------------------
template<typename T>
DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const DiagonalMatrix<T>& C)
DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const DiagonalMatrix<T>& C)
{
reset(C);
return *this;
@ -411,7 +411,7 @@ DiagonalMatrix<T>& DiagonalMatrix<T>::operator=(const DiagonalMatrix<T>& C)
// writes a matlab command to duplicate this sparse matrix
//-----------------------------------------------------------------------------
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);
o << s <<"=diag("<<s<<",0);\n";
@ -422,16 +422,16 @@ void DiagonalMatrix<T>::matlab(std::ostream &o, const std::string &s)
template<typename T>
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];
else
else
{
std::cout<<"DiagonalMatrix::inv(): ("<<i<<","<<i<<")=0\n";
ERROR_FOR_BACKTRACE
exit(EXIT_FAILURE);
}
}
}
// Error check info
const double min_max = _data->minabs() / _data->maxabs();
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
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];
else
else
{
std::cout<<"DiagonalMatrix::inv(): ("<<i<<","<<i<<")=0\n";
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>
const DiagonalMatrix<T> *diag_cast(const Matrix<T> *m)

View File

@ -15,7 +15,7 @@ namespace ATC {
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
//--------------------------------------------------------
MomentumTimeIntegrator::MomentumTimeIntegrator(ATC_Coupling * atc,
TimeIntegrationType timeIntegrationType) :
TimeIntegrator(atc, timeIntegrationType)
@ -36,7 +36,7 @@ namespace ATC {
\section syntax
fix_modify AtC time_integration <descriptor> \n
- descriptor (string) = time integration type \n
various time integration methods for the finite elements\n
\section description
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
see \ref man_fix_atc
\section default
none
none
*/
if (strcmp(arg[argIndex],"verlet")==0) {
timeIntegrationType_ = VERLET;
@ -78,7 +78,7 @@ namespace ATC {
if (atc_->reset_methods()) {
if (timeIntegrationMethod_)
delete timeIntegrationMethod_;
if (timeFilterManager_->need_reset()) {
switch (timeIntegrationType_) {
case VERLET:
@ -122,7 +122,7 @@ namespace ATC {
default:
throw ATC_Error("Unknown time integration type in MomentumTimeIntegrator::Initialize()");
}
}
}
}
}
@ -146,7 +146,7 @@ namespace ATC {
//--------------------------------------------------------
// Constructor
// Grab data from ATC
//--------------------------------------------------------
//--------------------------------------------------------
MomentumIntegrationMethod::MomentumIntegrationMethod(MomentumTimeIntegrator * momentumTimeIntegrator) :
TimeIntegrationMethod(momentumTimeIntegrator),
timeFilter_(timeIntegrator_->time_filter()),
@ -178,7 +178,7 @@ namespace ATC {
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
//--------------------------------------------------------
ElasticTimeIntegratorVerlet::ElasticTimeIntegratorVerlet(MomentumTimeIntegrator * momentumTimeIntegrator) :
MomentumIntegrationMethod(momentumTimeIntegrator),
displacement_(atc_->field(DISPLACEMENT)),
@ -217,7 +217,7 @@ namespace ATC {
if (timeFilterManager->need_reset()) {
timeFilter_->initialize(nodalAtomicForce_->quantity());
}
if (!(timeFilterManager->end_equilibrate())) {
nodalAtomicForceFiltered_.reset(atc_->num_nodes(),atc_->nsd());
}
@ -238,14 +238,14 @@ namespace ATC {
explicit_1(velocity_.set_quantity(),acceleration_.quantity(),.5*dt);
}
//--------------------------------------------------------
// post_initial_integrate1
// time integration after Verlet step 1
//--------------------------------------------------------
void ElasticTimeIntegratorVerlet::post_initial_integrate1(double dt)
{
// for improved accuracy, but this would be inconsistent with
// the atomic integration scheme
explicit_1(displacement_.set_quantity(),velocity_.quantity(),dt);
@ -253,7 +253,7 @@ namespace ATC {
//--------------------------------------------------------
// pre_final_integrate1
// first time integration computations
// first time integration computations
// before Verlet step 2
//--------------------------------------------------------
void ElasticTimeIntegratorVerlet::pre_final_integrate1(double dt)
@ -325,7 +325,7 @@ namespace ATC {
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
//--------------------------------------------------------
ElasticTimeIntegratorVerletFiltered::ElasticTimeIntegratorVerletFiltered(MomentumTimeIntegrator * momentumTimeIntegrator) :
ElasticTimeIntegratorVerlet(momentumTimeIntegrator),
nodalAtomicAcceleration_(atc_->nodal_atomic_field_roc(VELOCITY))
@ -349,7 +349,7 @@ namespace ATC {
//--------------------------------------------------------
void ElasticTimeIntegratorVerletFiltered::post_initial_integrate1(double dt)
{
// for improved accuracy, but this would be inconsistent with
// the atomic integration scheme
explicit_1(displacement_.set_quantity(),velocity_.quantity(),dt);
@ -367,7 +367,7 @@ namespace ATC {
acceleration_.set_quantity(),
VELOCITY);
explicit_1(velocity_.set_quantity(),acceleration_.quantity(),.5*dt);
atc_->apply_inverse_md_mass_matrix(nodalAtomicForceFiltered_.quantity(),
nodalAtomicAcceleration_.set_quantity(),
VELOCITY);
@ -404,7 +404,7 @@ namespace ATC {
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
//--------------------------------------------------------
ElasticTimeIntegratorFractionalStep::ElasticTimeIntegratorFractionalStep(MomentumTimeIntegrator * momentumTimeIntegrator) :
MomentumIntegrationMethod(momentumTimeIntegrator),
displacement_(atc_->field(DISPLACEMENT)),
@ -413,7 +413,7 @@ namespace ATC {
nodalAtomicMomentum_(nullptr),
nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()),
nodalAtomicDisplacement_(nullptr),
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),
nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd())
{
// do nothing
@ -450,7 +450,7 @@ namespace ATC {
// the form of this integrator implies no time filters that require history data can be used
timeFilter_->initialize();
}
// sets up time filter for post-processing the filtered power
// this time integrator should use an explicit-implicit filter
// to mirror the 2nd order Verlet integration scheme
@ -513,7 +513,7 @@ namespace ATC {
atomicVelocityDelta,
VELOCITY);
velocity_ += atomicVelocityDelta;
// approximation to force for output
nodalAtomicForce_ /= 0.5*dt;
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
@ -549,16 +549,16 @@ namespace ATC {
// atomic contributions to change in momentum
// compute change in restricted atomic momentum
nodalAtomicForce_ += nodalAtomicMomentum_->quantity();
// update FE temperature with change in temperature from MD
compute_velocity_delta(nodalAtomicForce_,dt);
velocity_ += atomicVelocityDelta_.quantity();
// approximation to power for output
nodalAtomicForce_ /= 0.5*dt;
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),
nodalAtomicForce_,dt);
// change to velocity from FE dynamics
atc_->apply_inverse_mass_matrix(velocityRhs_.quantity(),
acceleration_.set_quantity(),
@ -681,7 +681,7 @@ namespace ATC {
if (!timeFilterManager->end_equilibrate()) {
// implies an initial condition of the instantaneous atomic energy
// for the corresponding filtered variable, consistent with the temperature
nodalAtomicMomentumFiltered_ = nodalAtomicMomentum_->quantity();
nodalAtomicMomentumFiltered_ = nodalAtomicMomentum_->quantity();
nodalAtomicForceFiltered_.reset(atc_->num_nodes(),atc_->nsd());
}
}
@ -709,7 +709,7 @@ namespace ATC {
apply_gear_predictor(dt);
// update filtered nodal atomic force
// that way kinetostat and integrator can be consistent
timeFilter_->apply_pre_step1(nodalAtomicForceFiltered_.set_quantity(),
nodalAtomicForce_,dt);
@ -724,15 +724,15 @@ namespace ATC {
//--------------------------------------------------------
void FluidsTimeIntegratorGear::pre_final_integrate1(double dt)
{
// before the new rhs is computed but after atomic velocity is updated.
// compute change in restricted atomic momentum
nodalAtomicForce_ += nodalAtomicMomentum_->quantity();
// update FE velocity with change in velocity from MD
compute_velocity_delta(nodalAtomicForce_,dt);
velocity_ += atomicVelocityDelta_.quantity();
// approximation to force for output
nodalAtomicForce_ /= dt;
timeFilter_->apply_post_step1(nodalAtomicForceFiltered_.set_quantity(),

View File

@ -16,19 +16,19 @@ namespace ATC {
*/
class MomentumTimeIntegrator : public TimeIntegrator {
public:
// constructor
MomentumTimeIntegrator(ATC_Coupling * atc,
TimeIntegrationType timeIntegrationType);
// destructor
virtual ~MomentumTimeIntegrator(){};
/** parser/modifier */
virtual bool modify(int narg, char **arg);
/** create objects to implement requested numerical method */
virtual void construct_methods();
@ -47,7 +47,7 @@ namespace ATC {
protected:
/** filtered atomic force */
DENS_MAN nodalAtomicForceFiltered_;
/** filtered atomic momentum due initial conditions and MD updates */
@ -58,7 +58,7 @@ namespace ATC {
// DO NOT define this
MomentumTimeIntegrator();
};
/**
@ -67,12 +67,12 @@ namespace ATC {
*/
class MomentumIntegrationMethod : public TimeIntegrationMethod {
public:
// constructor
MomentumIntegrationMethod(MomentumTimeIntegrator * momentumTimeIntegrator);
// destructor
virtual ~MomentumIntegrationMethod(){};
@ -81,17 +81,17 @@ namespace ATC {
/** checks to see if first RHS computation is needed */
virtual bool has_final_predictor() {return true;};
protected:
/** time filtering object */
TimeFilter * timeFilter_;
/** finite element velocity field */
DENS_MAN & velocity_;
/** finite element acceleration field */
DENS_MAN & acceleration_;
/** atomic nodal velocity field */
DENS_MAN & nodalAtomicVelocityOut_;
/** right-hand side of velocity equation */
@ -106,7 +106,7 @@ namespace ATC {
// DO NOT define this
MomentumIntegrationMethod();
};
/**
@ -115,21 +115,21 @@ namespace ATC {
*/
class ElasticTimeIntegratorVerlet : public MomentumIntegrationMethod {
public:
// constructor
ElasticTimeIntegratorVerlet(MomentumTimeIntegrator * momentumTimeIntegrator);
// destructor
virtual ~ElasticTimeIntegratorVerlet(){};
/** create and get necessary transfer operators */
virtual void construct_transfers();
/** pre time integration initialization of data */
virtual void initialize();
// time step methods, corresponding to ATC_Transfer
/** first part of pre_initial_integrate */
virtual void pre_initial_integrate1(double dt);
@ -143,52 +143,52 @@ namespace ATC {
virtual void add_to_rhs();
/** post processing step before output */
virtual void post_process();
/** add output data */
virtual void output(OUTPUT_LIST & outputData);
/** operations at end of a run */
virtual void finish();
protected:
/** finite element displacement field */
DENS_MAN & displacement_;
/** atomic nodal displacement field */
DENS_MAN & nodalAtomicDisplacementOut_;
/** filtered atomic force */
DENS_MAN & nodalAtomicForceFiltered_;
/** transfer for computing atomic displacement */
DENS_MAN * nodalAtomicDisplacement_;
/** transfer for computing nodal atomic force */
DENS_MAN * nodalAtomicForce_;
private:
// DO NOT define this
ElasticTimeIntegratorVerlet();
};
/**
* @class ElasticTimeIntegratorVerlet
* @brief Verlet integration for FE elastic quantities with time filtering
*/
class ElasticTimeIntegratorVerletFiltered : public ElasticTimeIntegratorVerlet {
public:
// constructor
ElasticTimeIntegratorVerletFiltered(MomentumTimeIntegrator * momentumTimeIntegrator);
// destructor
virtual ~ElasticTimeIntegratorVerletFiltered(){};
// time step methods, corresponding to ATC_Transfer
/** first part of pre_initial_integrate */
virtual void pre_initial_integrate1(double dt);
@ -203,7 +203,7 @@ namespace ATC {
/** add output data */
virtual void output(OUTPUT_LIST & outputData);
protected:
/** atomic nodal acceleration field */
@ -213,16 +213,16 @@ namespace ATC {
// DO NOT define this
ElasticTimeIntegratorVerletFiltered();
};
/**
* @class ElasticTimeIntegratorFractionalStep
* @class ElasticTimeIntegratorFractionalStep
* @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
* elements as are used by the LAMMPS integration scheme
* (Uses same update for the atomic contributions to the finite
* elements as are used by the LAMMPS integration scheme
* for the atomic velocities and positions, i.e. Verlet.)
*/
*/
class ElasticTimeIntegratorFractionalStep : public MomentumIntegrationMethod {
@ -230,16 +230,16 @@ namespace ATC {
// constructor
ElasticTimeIntegratorFractionalStep(MomentumTimeIntegrator * momentumTimeIntegrator);
// destructor
virtual ~ElasticTimeIntegratorFractionalStep() {};
/** create and get necessary transfer operators */
virtual void construct_transfers();
/** pre time integration initialization of data */
virtual void initialize();
// time step methods, corresponding to ATC_Transfer
/** first part of pre_initial_integrate */
virtual void pre_initial_integrate1(double dt);
@ -272,13 +272,13 @@ namespace ATC {
// data
/** finite element displacement field */
DENS_MAN & displacement_;
/** atomic nodal displacement field */
DENS_MAN & nodalAtomicDisplacementOut_;
/** equivalent nodal force due to atomic momentum change */
DENS_MAT nodalAtomicForce_;
/** filtered atomic force */
DENS_MAN & nodalAtomicForceFiltered_;
@ -287,7 +287,7 @@ namespace ATC {
/** filtered atomic momentum */
DENS_MAN & nodalAtomicMomentumFiltered_;
/** transfer for computing atomic displacement */
DENS_MAN * nodalAtomicDisplacement_;
@ -312,7 +312,7 @@ namespace ATC {
* @class FluidsTimeIntegratorGear
* @brief Class for using 3rd order Gear integration to update FE contributions to momentum field
* and fractional step method for atomic contributions
*/
*/
class FluidsTimeIntegratorGear : public MomentumIntegrationMethod {
@ -320,16 +320,16 @@ namespace ATC {
// constructor
FluidsTimeIntegratorGear(MomentumTimeIntegrator * MomentumTimeIntegrator);
// destructor
virtual ~FluidsTimeIntegratorGear() {};
/** create and get necessary transfer operators */
virtual void construct_transfers();
/** pre time integration initialization of data */
virtual void initialize();
// time step methods, corresponding to ATC_Transfer
/** first part of pre_initial_integrate */
virtual void pre_initial_integrate1(double dt);
@ -371,7 +371,7 @@ namespace ATC {
// data
/** equivalent nodal force due to atomic momentum change */
DENS_MAT nodalAtomicForce_;
/** filtered atomic force */
DENS_MAN & nodalAtomicForceFiltered_;

View File

@ -14,7 +14,7 @@ using std::vector;
namespace ATC {
ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
fstream &fileId, map<string,double> & /* parameters */)
fstream &fileId, map<string,double> & /* parameters */)
: ElectronChargeDensity(), n_()
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
@ -23,7 +23,7 @@ ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
double coef = 1.;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line.size() == 0) continue;
if (line[0] == "end") return;
else if (line[0] == "scale") coef = str2dbl(line[1]);
else if (line[0] == "number_of_points") {
@ -34,14 +34,14 @@ ElectronChargeDensityInterpolation::ElectronChargeDensityInterpolation(
}
ElectronChargeDensityLinear::ElectronChargeDensityLinear(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronChargeDensity()
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");
vector<string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "coefficient") {
@ -52,7 +52,7 @@ ElectronChargeDensityLinear::ElectronChargeDensityLinear(
}
ElectronChargeDensityExponential::ElectronChargeDensityExponential(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronChargeDensity(),
intrinsicConcentration_(0),
intrinsicEnergy_(0),
@ -62,7 +62,7 @@ ElectronChargeDensityExponential::ElectronChargeDensityExponential(
vector<string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "intrinsic_concentration") {
@ -84,7 +84,7 @@ ElectronChargeDensityExponential::ElectronChargeDensityExponential(
}
ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronChargeDensity(),
Ef_(0),
referenceTemperature_(0),
@ -96,7 +96,7 @@ ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
vector<string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "fermi_energy") {
@ -120,7 +120,7 @@ ElectronChargeDensityFermiDirac::ElectronChargeDensityFermiDirac(
else if (line[0] == "donor_concentration") {
donorIonization_ = true;
Nd_ = value;
parameters["donor_concentration"] = Nd_;
parameters["donor_concentration"] = Nd_;
}
else {
throw ATC_Error( "unrecognized material function "+line[0]);

View File

@ -12,8 +12,8 @@ const double tol = 1.e-8;
namespace ATC {
/**
* @class ElectronChargeDensity
* @brief Base class for models of extrinsic electric charges
* @class ElectronChargeDensity
* @brief Base class for models of extrinsic electric charges
*/
class ElectronChargeDensity
@ -24,10 +24,10 @@ namespace ATC {
virtual bool electron_charge_density(const FIELD_MATS & /* fields */,
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 */,
DENS_MAT & /* flux */) const
DENS_MAT & /* flux */) const
{ throw ATC_Error("Charge density D_electron_charge_density unimplemented function");}
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);
const DENS_MAT & phi = phi_field->second;
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
flux(i,0) = n_.f(phi(i,0));
flux(i,0) = n_.f(phi(i,0));
}
flux *= -1.;
return true;
};
};
virtual void D_electron_charge_density(const FieldName /* field */,
const FIELD_MATS &fields,
DENS_MAT &coef) const
@ -65,10 +65,10 @@ namespace ATC {
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
const DENS_MAT & phi = phi_field->second;
int nNodes = phi.nRows();
coef.reset(nNodes,1,false);
for (int i = 0; i < nNodes; i++) {
coef(i,0) = n_.dfdt(phi(i,0));
coef(i,0) = n_.dfdt(phi(i,0));
coef.reset(nNodes,1,false);
for (int i = 0; i < nNodes; i++) {
coef(i,0) = n_.dfdt(phi(i,0));
coef(i,0) = n_.dfdt(phi(i,0));
}
coef *= -1.;
}
@ -93,7 +93,7 @@ namespace ATC {
flux = phi_field->second;
flux *= -C_;
return true;
};
};
virtual void D_electron_charge_density(const FieldName /* field */,
const FIELD_MATS &fields,
DENS_MAT &coef) const
@ -111,7 +111,7 @@ namespace ATC {
/**
* @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)
*/
*/
class ElectronChargeDensityExponential : public ElectronChargeDensity
{
@ -121,13 +121,13 @@ namespace ATC {
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
{
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
{
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
@ -139,17 +139,17 @@ namespace ATC {
density.resize(nNodes,1);
if (hasTref) {
T = referenceTemperature_;
for (int i = 0; i < nNodes; i++) {
for (int i = 0; i < nNodes; i++) {
density(i,0) = n(phi(i,0),T); }
}
else {
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 *= -1.;
return true;
};
};
virtual void D_electron_charge_density(const FieldName /* field */,
const FIELD_MATS &fields,
DENS_MAT &coef) const
@ -163,16 +163,16 @@ namespace ATC {
coef.resize(nNodes,1);
if (hasTref) {
T = referenceTemperature_;
for (int i = 0; i < nNodes; i++) {
for (int i = 0; i < nNodes; i++) {
coef(i,0) = dndphi(phi(i,0),T); }
}
else {
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 *= -1.;
};
};
protected:
double intrinsicConcentration_,intrinsicEnergy_;
double referenceTemperature_;
@ -181,8 +181,8 @@ namespace ATC {
//-----------------------------------------------------------------------
/**
* @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
{
@ -195,7 +195,7 @@ namespace ATC {
if (T > 0) f = 1.0 / ( exp((E-Ef_)/kBeV_/T)+1.0 );
else if (E > Ef_) f = 0;
return f;
};
};
virtual bool electron_charge_density(const FIELD_MATS &fields,
DENS_MAT &density) const
{
@ -215,34 +215,34 @@ namespace ATC {
const DENS_MAT & phi = phi_field->second;
int nNodes = psi.nRows();
density.reset(nNodes,1);
density.reset(nNodes,1);
double T = referenceTemperature_;
int count = 0;
for (int i = 0; i < nNodes; i++) {
if (!hasReferenceTemperature_) { T = Ts(i,0); }
int j = 0;
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);
if (f < tol) break;
else count++;
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
if ( E + Eb_ > Ef_+Ed_) density(i,0) += Nd_; // > 0
}
}
return true;
};
virtual void D_electron_charge_density(const FieldName /* fieldName */,
};
virtual void D_electron_charge_density(const FieldName /* fieldName */,
const FIELD_MATS &fields,
DENS_MAT &coef) const
{
FIELD_MATS::const_iterator phi_field = fields.find(ELECTRIC_POTENTIAL);
const DENS_MAT & phi = phi_field->second;
int nNodes = phi.nRows();
coef.reset(nNodes,1,false);
coef.reset(nNodes,1,false);
}
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);
const DENS_MAT & phi = p_field->second;
int nNodes = phi.nRows();
density.reset(nNodes,1,false);
density.reset(nNodes,1,false);
density = Eb_;
};
@ -264,6 +264,6 @@ namespace ATC {
};
}
#endif
#endif

View File

@ -16,7 +16,7 @@ namespace ATC {
ElectronDragPowerLinear::ElectronDragPowerLinear(fstream &fileId,
map<string,double> & parameters,
Material * material)
Material * material)
: ElectronDragPower(),
electronDragInvTau_(0),
material_(material)
@ -42,7 +42,7 @@ ElectronDragPowerLinear::ElectronDragPowerLinear(fstream &fileId,
const GRAD_FIELD_MATS & /* gradFields */,
DENS_MAT & flux)
{
FIELD_MATS::const_iterator evField = fields.find(ELECTRON_VELOCITY);
const DENS_MAT & v = evField->second;
@ -57,7 +57,7 @@ ElectronDragPowerLinear::ElectronDragPowerLinear(fstream &fileId,
return true;
}
void ElectronDragPowerLinear::electron_drag_velocity_coefficient(const FIELD_MATS &fields,
DENS_MAT & dragCoef)
{

View File

@ -11,7 +11,7 @@
namespace ATC {
/**
* @class ElectronDragPower
* @class ElectronDragPower
* @brief Base class for defining the lattice drag power from electrons
*/
@ -35,12 +35,12 @@ namespace ATC {
};
};
//-------------------------------------------------------------------
/**
* @class ElectronDragPowerLinear
* @brief Class for electron drag that linearly depends on the difference between the electron and lattice velocities
*/
*/
class ElectronDragPowerLinear : public ElectronDragPower
{
public:
@ -66,6 +66,6 @@ namespace ATC {
};
}
#endif
#endif

View File

@ -22,8 +22,8 @@ ElectronFlux::ElectronFlux() :
ElectronFluxLinear::ElectronFluxLinear(
fstream &fileId, map<string,double> & parameters)
: ElectronFlux(),
fstream &fileId, map<string,double> & parameters)
: ElectronFlux(),
electronMobility_(0),
electronDiffusivity_(0)
{
@ -52,7 +52,7 @@ ElectronFluxLinear::ElectronFluxLinear(
}
ElectronFluxThermopower::ElectronFluxThermopower(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronFlux(),
electronMobility_(0),
seebeckCoef_(0)
@ -61,7 +61,7 @@ ElectronFluxThermopower::ElectronFluxThermopower(
vector<string> line;
while(fileId.good()) {
command_line(fileId, line);
if (line.size() == 0) continue;
if (line.size() == 0) continue;
if (line[0] == "end") return;
double value = str2dbl(line[1]);
if (line[0] == "mobility") {
@ -79,7 +79,7 @@ ElectronFluxThermopower::ElectronFluxThermopower(
}
ElectronFluxConvection::ElectronFluxConvection(
fstream &fileId, map<string,double> & /* parameters */)
fstream &fileId, map<string,double> & /* parameters */)
: ElectronFlux()
{
if (!fileId.is_open()) throw ATC_Error("cannot open material file");

View File

@ -20,12 +20,12 @@ namespace ATC {
/** computes flux */
virtual void electron_flux(const FIELD_MATS &fields,
const GRAD_FIELD_MATS & /* gradFields */,
DENS_MAT_VEC &flux)
DENS_MAT_VEC &flux)
{
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
const DENS_MAT & etMat = etField->second;
zeroWorkspace_.reset(etMat.nRows(),etMat.nCols());
@ -75,12 +75,12 @@ namespace ATC {
DENS_MAT zeroWorkspace_;
};
//-----------------------------------------------------------------------
/**
* @class ElectronFluxLinear
* @brief Class for drift-diffusion electron flux with linear dependency on the electron density gradient
*/
*/
class ElectronFluxLinear : public ElectronFlux
{
public:
@ -98,7 +98,7 @@ namespace ATC {
const DENS_MAT & n = edField->second;
const DENS_MAT_VEC & dn = dEdField->second;
const DENS_MAT_VEC & dphi = dPhiField->second;
//n.print("DENSITY");
//for (int i = 0; i < 3; i++) {
// dn[i].print("GRAD N");
@ -131,17 +131,17 @@ namespace ATC {
flux[2] += -electronDiffusivity_* dn[2];
}
};
};
protected:
double electronMobility_, electronDiffusivity_;
};
//-----------------------------------------------------------------------
/**
* @class ElectronFluxThermopower
* @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
{
public:
@ -165,13 +165,13 @@ namespace ATC {
GRAD_FIELD_MATS::const_iterator dPhiField = gradFields.find(ELECTRIC_POTENTIAL);
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
const DENS_MAT & n = edField->second;
const DENS_MAT_VEC & dn = dEdField->second;
const DENS_MAT_VEC & dphi = dPhiField->second;
const DENS_MAT_VEC & dT = dEtField->second;
flux[0] = -electronMobility_*dphi[0];
flux[1] = -electronMobility_*dphi[1];
flux[2] = -electronMobility_*dphi[2];
@ -179,7 +179,7 @@ namespace ATC {
flux[0] += coef* dT[0];
flux[1] += coef* dT[1];
flux[2] += coef* dT[2];
flux[0] *= n; // scale by n
flux[0] *= n; // scale by n
flux[1] *= n;
flux[2] *= n;
@ -188,23 +188,23 @@ namespace ATC {
//tmp[0] *= Te;
//tmp[1] *= Te;
//tmp[2] *= Te;
coef = -electronMobility_*kBeV_;
coef = -electronMobility_*kBeV_;
//flux[0] += tmp[0];
flux[0] += dn[0].mult_by_element(Te);
flux[1] += dn[1].mult_by_element(Te);
flux[2] += dn[2].mult_by_element(Te);
}
};
};
protected:
double electronMobility_, seebeckCoef_;
};
//-----------------------------------------------------------------------
/**
* @class ElectronFluxConvection
* @brief Class for electron flux based on the standard convection term
*/
*/
class ElectronFluxConvection : public ElectronFlux
{
public:
@ -220,6 +220,6 @@ namespace ATC {
};
}
#endif
#endif

View File

@ -15,7 +15,7 @@ using std::vector;
namespace ATC {
ElectronHeatCapacityConstant::ElectronHeatCapacityConstant(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronHeatCapacity(),
electronHeatCapacity_(0)
{
@ -36,7 +36,7 @@ ElectronHeatCapacityConstant::ElectronHeatCapacityConstant(
}
ElectronHeatCapacityLinear::ElectronHeatCapacityLinear(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronHeatCapacity(),
electronHeatCapacity_(0)
{
@ -58,7 +58,7 @@ ElectronHeatCapacityLinear::ElectronHeatCapacityLinear(
ElectronHeatCapacityConstantAddDensity::ElectronHeatCapacityConstantAddDensity(fstream &fileId,
map<string,double> & parameters,
Material * material)
Material * material)
: ElectronHeatCapacityConstant(fileId, parameters),
material_(material)
{
@ -67,7 +67,7 @@ ElectronHeatCapacityConstantAddDensity::ElectronHeatCapacityConstantAddDensity(f
ElectronHeatCapacityLinearAddDensity::ElectronHeatCapacityLinearAddDensity(fstream &fileId,
map<string,double> & parameters,
Material * material)
Material * material)
: ElectronHeatCapacityLinear(fileId, parameters),
material_(material)
{

View File

@ -27,19 +27,19 @@ namespace ATC {
DENS_MAT_VEC & Dcapacity)=0;
/** computes thermal energy */
virtual void electron_thermal_energy(const FIELD_MATS &fields,
DENS_MAT &energy)=0;
DENS_MAT &energy)=0;
};
//-------------------------------------------------------------------
/**
* @class ElectronHeatCapacityConstant
* @brief Class for a constant electron heat capacity
*/
*/
class ElectronHeatCapacityConstant : public ElectronHeatCapacity
{
public:
ElectronHeatCapacityConstant(std::fstream &matfile,
ElectronHeatCapacityConstant(std::fstream &matfile,
std::map<std::string,double> & parameters);
virtual ~ElectronHeatCapacityConstant() {};
virtual void electron_heat_capacity(const FIELD_MATS &fields,
@ -59,25 +59,25 @@ namespace ATC {
Dcapacity[0] = zeroWorkspace_;
Dcapacity[1] = zeroWorkspace_;
Dcapacity[2] = zeroWorkspace_;
}
}
virtual void electron_thermal_energy(const FIELD_MATS &fields,
DENS_MAT &energy)
{
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
const DENS_MAT & T = etField->second;
energy = electronHeatCapacity_ * T;
};
};
protected:
double electronHeatCapacity_;
DENS_MAT zeroWorkspace_;
};
//-------------------------------------------------------------------
/**
* @class ElectronHeatCapacityLinear
* @brief Class for an electron capacity that is directly proportional to the electron temperature
*/
*/
class ElectronHeatCapacityLinear : public ElectronHeatCapacity
{
public:
@ -108,21 +108,21 @@ namespace ATC {
const DENS_MAT & T = etField->second;
energy = electronHeatCapacity_ * T;
energy *= T;
};
};
protected:
double electronHeatCapacity_;
};
//-------------------------------------------------------------------
/**
* @class ElectronHeatCapacityConstantAddDensity
* @brief Class for a constant electron specific heat capacity (i.e, does not include the electron density)
*/
*/
class ElectronHeatCapacityConstantAddDensity : public ElectronHeatCapacityConstant
{
public:
ElectronHeatCapacityConstantAddDensity(std::fstream &matfile,
ElectronHeatCapacityConstantAddDensity(std::fstream &matfile,
std::map<std::string,double> & parameters,
Material * material);
virtual ~ElectronHeatCapacityConstantAddDensity() {};
@ -165,12 +165,12 @@ namespace ATC {
DENS_MAT capacityMat_; // avoid resizing if possible
};
//-------------------------------------------------------------------
/**
* @class ElectronHeatCapacityLinearAddDensity
* @brief Class for a electron specific heat capacity that is proportional to the temperature (i.e., does not include density)
*/
*/
class ElectronHeatCapacityLinearAddDensity : public ElectronHeatCapacityLinear
{
public:
@ -199,7 +199,7 @@ namespace ATC {
GRAD_FIELD_MATS::const_iterator dEdField = gradFields.find(ELECTRON_DENSITY);
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[1] += Ddensity[1].mult_by_element(capacityWorkspace_);
Dcapacity[2] += Ddensity[2].mult_by_element(capacityWorkspace_);
@ -208,7 +208,7 @@ namespace ATC {
DENS_MAT &energy)
{
ElectronHeatCapacityLinear::electron_thermal_energy(fields,energy);
FIELD_MATS::const_iterator edField = fields.find(ELECTRON_DENSITY);
const DENS_MAT & density = edField->second;
@ -220,6 +220,6 @@ namespace ATC {
};
}
#endif
#endif

View File

@ -22,7 +22,7 @@ ElectronHeatFlux::ElectronHeatFlux(ElectronHeatCapacity * electronHeatCapacity)
}
ElectronHeatFluxLinear::ElectronHeatFluxLinear(fstream &fileId, map<string,double> & parameters,
ElectronHeatCapacity * electronHeatCapacity)
ElectronHeatCapacity * electronHeatCapacity)
: ElectronHeatFlux(electronHeatCapacity),
conductivity_(0)
{
@ -43,7 +43,7 @@ ElectronHeatFluxLinear::ElectronHeatFluxLinear(fstream &fileId, map<string,doubl
}
ElectronHeatFluxPowerLaw::ElectronHeatFluxPowerLaw(fstream &fileId, map<string,double> & parameters,
ElectronHeatCapacity * electronHeatCapacity)
ElectronHeatCapacity * electronHeatCapacity)
: ElectronHeatFlux(electronHeatCapacity),
conductivity_(0)
{
@ -66,7 +66,7 @@ ElectronHeatFluxPowerLaw::ElectronHeatFluxPowerLaw(fstream &fileId, map<string,d
ElectronHeatFluxThermopower::ElectronHeatFluxThermopower(
fstream &fileId, map<string,double> & parameters,
/*const*/ ElectronFlux * electronFlux,
ElectronHeatCapacity * electronHeatCapacity)
ElectronHeatCapacity * electronHeatCapacity)
: ElectronHeatFlux(electronHeatCapacity),
conductivity_(0),
seebeckCoef_(0),
@ -86,7 +86,7 @@ ElectronHeatFluxThermopower::ElectronHeatFluxThermopower(
else {
throw ATC_Error( "unrecognized material function "+line[0]);
}
seebeckCoef_ = parameters["seebeck_coefficient"];
}
}

View File

@ -24,7 +24,7 @@ namespace ATC {
const GRAD_FIELD_MATS & /* gradFields */,
DENS_MAT_VEC &flux)
{
FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
const DENS_MAT & Te = etField->second;
zeroWorkspace_.reset(Te.nRows(),Te.nCols());
@ -47,7 +47,7 @@ namespace ATC {
flux[0] = vx;
flux[1] = vy;
flux[2] = vz;
// scale by thermal energy
// scale by thermal energy
flux[0] *= cpTeWorkspace_;
flux[1] *= cpTeWorkspace_;
flux[2] *= cpTeWorkspace_;
@ -58,12 +58,12 @@ namespace ATC {
DENS_MAT cpTeWorkspace_; // hopefully avoid resizing
};
//-----------------------------------------------------------------------
/**
* @class ElectronHeatFluxLinear
* @brief Class for an electron heat flux proportional to the temperature gradient with constant conductivity
*/
*/
class ElectronHeatFluxLinear : public ElectronHeatFlux
{
public:
@ -80,17 +80,17 @@ namespace ATC {
flux[0] = -conductivity_ * dT[0];
flux[1] = -conductivity_ * dT[1];
flux[2] = -conductivity_ * dT[2];
};
};
protected:
double conductivity_;
};
//-----------------------------------------------------------------------
/**
* @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
*/
*/
class ElectronHeatFluxPowerLaw : public ElectronHeatFlux
{
public:
@ -116,23 +116,23 @@ namespace ATC {
flux[0] *= electronConductivity_;
flux[1] *= electronConductivity_;
flux[2] *= electronConductivity_;
};
};
protected:
double conductivity_;
DENS_MAT electronConductivity_; // hopefully avoid resizing
};
//-----------------------------------------------------------------------
/**
* @class ElectronHeatFluxThermopower
* @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
*/
*/
class ElectronHeatFluxThermopower : public ElectronHeatFlux
{
public:
ElectronHeatFluxThermopower(std::fstream &matfile,
ElectronHeatFluxThermopower(std::fstream &matfile,
std::map<std::string,double> & parameters,
/*const*/ ElectronFlux * electronFlux = 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 & T = tField->second;
const DENS_MAT & Te = etField->second;
// flux = -ke * ( Te / T ) dT + pi J_e;
flux[0] = dT[0];
flux[1] = dT[1];
@ -163,16 +163,16 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t
tmp_[2] *= Te;
flux[0] += seebeckCoef_*tmp_[0];
flux[1] += seebeckCoef_*tmp_[1];
flux[2] += seebeckCoef_*tmp_[2];
};
flux[2] += seebeckCoef_*tmp_[2];
};
protected:
double conductivity_,seebeckCoef_;
ElectronFlux * electronFlux_;
DENS_MAT elecCondWorkspace_; // hopefully avoid resizing
DENS_MAT_VEC tmp_;
DENS_MAT_VEC tmp_;
};
}
#endif
#endif

View File

@ -18,7 +18,7 @@ using std::vector;
namespace ATC {
ElectronPhononExchangeLinear::ElectronPhononExchangeLinear(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronPhononExchange(),
exchangeCoef_(0)
{
@ -39,7 +39,7 @@ ElectronPhononExchangeLinear::ElectronPhononExchangeLinear(
}
ElectronPhononExchangePowerLaw::ElectronPhononExchangePowerLaw(
fstream &fileId, map<string,double> & parameters)
fstream &fileId, map<string,double> & parameters)
: ElectronPhononExchange(),
exchangeCoef_(0),
exponent_(1)
@ -65,7 +65,7 @@ ElectronPhononExchangePowerLaw::ElectronPhononExchangePowerLaw(
ElectronPhononExchangeHertel::ElectronPhononExchangeHertel(fstream &fileId,
map<string,double> & parameters,
Material * material)
Material * material)
: ElectronPhononExchange(),
exchangeCoef_(0),
debeyeTemperature_(1),
@ -93,7 +93,7 @@ ElectronPhononExchangeHertel::ElectronPhononExchangeHertel(fstream &fileId,
// coupling coefficient, eqn. 15 of Hertel 2002
double kb = LammpsInterface::instance()->kBoltzmann();
double hbar = LammpsInterface::instance()->hbar();
double PI = 3.141592653589793238;
double PI = 3.141592653589793238;
exchangeCoef_ = 144.*1.0369*kb/(PI*hbar);
exchangeCoef_ *= massEnhancement_/pow(debeyeTemperature_,2);
}

View File

@ -7,7 +7,7 @@
#include "ATC_TypeDefs.h"
namespace ATC {
class Material;
/**
@ -54,16 +54,16 @@ namespace ATC {
double exchangeCoef_;
};
//-------------------------------------------------------------------
/**
* @class ElectronPhononExchangePowerLaw
* @brief Class for electron-phonon exchange proportional to the temperature difference raised to a constant power
*/
*/
class ElectronPhononExchangePowerLaw : public ElectronPhononExchange
{
public:
ElectronPhononExchangePowerLaw(std::fstream &matfile,
ElectronPhononExchangePowerLaw(std::fstream &matfile,
std::map<std::string,double> & parameters);
virtual ~ElectronPhononExchangePowerLaw() {};
virtual bool electron_phonon_exchange(const FIELD_MATS &fields,
@ -78,22 +78,22 @@ namespace ATC {
flux = (Te - T).pow(exponent_);
flux *= exchangeCoef_;
return true;
};
};
protected:
double exchangeCoef_;
int exponent_;
};
//-------------------------------------------------------------------
/**
* @class ElectronPhononExchangeHertel
* @brief Class for electron-phonon exchange based on the formulation of Hertel for Cu
*/
*/
class ElectronPhononExchangeHertel : public ElectronPhononExchange
{
public:
ElectronPhononExchangeHertel(std::fstream &matfile,
ElectronPhononExchangeHertel(std::fstream &matfile,
std::map<std::string,double> & parameters,
Material * material);
virtual ~ElectronPhononExchangeHertel() {};
@ -104,13 +104,13 @@ namespace ATC {
double debeyeTemperature_;
double massEnhancement_;
Material * material_;
private:
ElectronPhononExchangeHertel() {};
DENS_MAT capacityWorkspace_;
};
}
#endif
#endif

View File

@ -32,7 +32,7 @@ namespace ATC {
{
// do nothing
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -48,16 +48,16 @@ namespace ATC {
//--------------------------------------------------------
bool ExtrinsicModelManager::modify(int narg, char **arg)
{
bool foundMatch = false;
bool foundMatch = false;
// loop over models with command
vector<ExtrinsicModel *>::iterator imodel;
for(imodel=extrinsicModels_.begin();
for(imodel=extrinsicModels_.begin();
imodel!=extrinsicModels_.end(); imodel++) {
foundMatch = (*imodel)->modify(narg,arg);
if (foundMatch) break;
}
return foundMatch;
}
@ -81,10 +81,10 @@ namespace ATC {
myModel = new ExtrinsicModelTwoTemperature
(this,modelType,matFileName);
}
else if (modelType==DRIFT_DIFFUSION
else if (modelType==DRIFT_DIFFUSION
|| modelType==DRIFT_DIFFUSION_EQUILIBRIUM
|| modelType==DRIFT_DIFFUSION_SCHRODINGER
|| modelType==DRIFT_DIFFUSION_SCHRODINGER_SLICE)
|| modelType==DRIFT_DIFFUSION_SCHRODINGER_SLICE)
{
stringstream ss;
ss << "creating drift_diffusion extrinsic model";
@ -92,7 +92,7 @@ namespace ATC {
myModel = new ExtrinsicModelDriftDiffusion
(this,modelType,matFileName);
}
else if (modelType==CONVECTIVE_DRIFT_DIFFUSION
else if (modelType==CONVECTIVE_DRIFT_DIFFUSION
|| modelType==CONVECTIVE_DRIFT_DIFFUSION_EQUILIBRIUM
|| modelType==CONVECTIVE_DRIFT_DIFFUSION_SCHRODINGER) {
stringstream ss;
@ -129,7 +129,7 @@ namespace ATC {
void ExtrinsicModelManager::construct_transfers()
{
vector<ExtrinsicModel *>::iterator imodel;
for(imodel=extrinsicModels_.begin();
for(imodel=extrinsicModels_.begin();
imodel!=extrinsicModels_.end(); imodel++) {
// initialize models
(*imodel)->construct_transfers();
@ -142,7 +142,7 @@ namespace ATC {
void ExtrinsicModelManager::initialize()
{
vector<ExtrinsicModel *>::iterator imodel;
for(imodel=extrinsicModels_.begin();
for(imodel=extrinsicModels_.begin();
imodel!=extrinsicModels_.end(); imodel++) {
// initialize models
(*imodel)->initialize();
@ -168,13 +168,13 @@ namespace ATC {
{
int extrinsicSize = 0;
vector<ExtrinsicModel *>::iterator imodel;
for(imodel=extrinsicModels_.begin();
for(imodel=extrinsicModels_.begin();
imodel!=extrinsicModels_.end(); imodel++) {
// query all models for LAMMPS display
int currentSize = intrinsicSize + extrinsicSize;
extrinsicSize += (*imodel)->size_vector(currentSize);
}
return extrinsicSize;
}
@ -185,7 +185,7 @@ namespace ATC {
{
double value = 0.;
vector<ExtrinsicModel *>::iterator imodel;
for(imodel=extrinsicModels_.begin();
for(imodel=extrinsicModels_.begin();
imodel!=extrinsicModels_.end(); imodel++) {
value += (*imodel)->compute_scalar(); // sum
}
@ -199,7 +199,7 @@ namespace ATC {
{
double value = 0.;
vector<ExtrinsicModel *>::iterator imodel;
for(imodel=extrinsicModels_.begin();
for(imodel=extrinsicModels_.begin();
imodel!=extrinsicModels_.end(); imodel++) {
// query all models for LAMMPS display
if ((*imodel)->compute_vector(n,value))
@ -348,7 +348,7 @@ namespace ATC {
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
rhsMaskIntrinsic_ = false;
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -371,7 +371,7 @@ namespace ATC {
//--------------------------------------------------------
void ExtrinsicModel::num_fields(map<FieldName,int> & fieldSizes)
{
physicsModel_->num_fields(fieldSizes,atc_->fieldMask_);
physicsModel_->num_fields(fieldSizes,atc_->fieldMask_);
}
};

View File

@ -42,7 +42,7 @@ namespace ATC {
//--------------------------------------------------------
class ExtrinsicModelManager {
public:
// constructor
@ -98,7 +98,7 @@ namespace ATC {
/** 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) {
case NO_MODEL:
@ -141,11 +141,11 @@ namespace ATC {
return false;
break;
}
return true;
return true;
};
/** 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")
index = NO_MODEL;
@ -174,7 +174,7 @@ namespace ATC {
else
return false;
return true;
};
@ -209,7 +209,7 @@ namespace ATC {
//--------------------------------------------------------
class ExtrinsicModel {
public:
// constructor
@ -295,8 +295,8 @@ namespace ATC {
/** rhs mask for coupling with MD */
Array2D<bool> rhsMaskIntrinsic_;
GRAD_FIELD_MATS fluxes_;
/** number of nodes */

View File

@ -39,7 +39,7 @@ namespace ATC {
string matFileName) :
ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName),
continuityIntegrator_(nullptr),
poissonSolverType_(DIRECT), // ITERATIVE | DIRECT
poissonSolver_(nullptr),
baseSize_(0),
@ -49,34 +49,34 @@ namespace ATC {
schrodingerSolver_(nullptr),
schrodingerPoissonMgr_(),
schrodingerPoissonSolver_(nullptr),
maxConsistencyIter_(0), maxConstraintIter_(1),
maxConsistencyIter_(0), maxConstraintIter_(1),
safe_dEf_(0.1), Ef_shift_(0.0),
oneD_(false), oneDcoor_(0), oneDconserve_(0)
{
// delete base class's version of the physics model
if (physicsModel_) delete physicsModel_;
if (physicsModel_) delete physicsModel_;
if (modelType == DRIFT_DIFFUSION_EQUILIBRIUM) {
physicsModel_ = new PhysicsModelDriftDiffusionEquilibrium(matFileName);
physicsModel_ = new PhysicsModelDriftDiffusionEquilibrium(matFileName);
electronDensityEqn_ = ELECTRON_EQUILIBRIUM;
}
else if (modelType == DRIFT_DIFFUSION_SCHRODINGER) {
physicsModel_ = new PhysicsModelDriftDiffusionSchrodinger(matFileName);
physicsModel_ = new PhysicsModelDriftDiffusionSchrodinger(matFileName);
electronDensityEqn_ = ELECTRON_SCHRODINGER;
maxConsistencyIter_ = 1;
}
else if (modelType == DRIFT_DIFFUSION_SCHRODINGER_SLICE) {
physicsModel_ = new PhysicsModelDriftDiffusionSchrodingerSlice(matFileName);
physicsModel_ = new PhysicsModelDriftDiffusionSchrodingerSlice(matFileName);
electronDensityEqn_ = ELECTRON_SCHRODINGER;
maxConsistencyIter_ = 1;
}
else {
physicsModel_ = new PhysicsModelDriftDiffusion(matFileName);
physicsModel_ = new PhysicsModelDriftDiffusion(matFileName);
}
atc_->useConsistentMassMatrix_(ELECTRON_DENSITY) = true;
rhsMaskIntrinsic_(ELECTRON_TEMPERATURE,SOURCE) = true;
//atc_->fieldMask_(ELECTRON_TEMPERATURE,EXTRINSIC_SOURCE) = true;
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -89,7 +89,7 @@ namespace ATC {
}
//--------------------------------------------------------
// modify
// modify
//--------------------------------------------------------
bool ExtrinsicModelDriftDiffusion::modify(int narg, char **arg)
{
@ -110,9 +110,9 @@ namespace ATC {
nNodes_ = atc_->num_nodes();
rhs_[ELECTRON_DENSITY].reset(nNodes_,1);
rhs_[ELECTRIC_POTENTIAL].reset(nNodes_,1);
// set up electron continuity integrator
Array2D <bool> rhsMask(NUM_TOTAL_FIELDS,NUM_FLUX);
Array2D <bool> rhsMask(NUM_TOTAL_FIELDS,NUM_FLUX);
rhsMask = false;
for (int i = 0; i < NUM_FLUX; i++) {
rhsMask(ELECTRON_DENSITY,i) = atc_->fieldMask_(ELECTRON_DENSITY,i);
@ -121,7 +121,7 @@ namespace ATC {
atc_->set_fixed_nodes();
if (continuityIntegrator_) delete continuityIntegrator_;
if (electronTimeIntegration_ == TimeIntegrator::IMPLICIT) {
if (electronTimeIntegration_ == TimeIntegrator::IMPLICIT) {
continuityIntegrator_ = new FieldImplicitEulerIntegrator(ELECTRON_DENSITY,
physicsModel_, atc_->feEngine_, atc_, rhsMask);
}
@ -142,7 +142,7 @@ namespace ATC {
rhsMask(ELECTRIC_POTENTIAL,i) = atc_->fieldMask_(ELECTRIC_POTENTIAL,i);
}
int type = ATC::LinearSolver::ITERATIVE_SOLVE_SYMMETRIC;
if (poissonSolverType_ == DIRECT) {
if (poissonSolverType_ == DIRECT) {
type = ATC::LinearSolver::DIRECT_SOLVE;
}
if (poissonSolver_) delete poissonSolver_;
@ -154,12 +154,12 @@ namespace ATC {
// set up schrodinger solver
if ( electronDensityEqn_ == ELECTRON_SCHRODINGER ) {
if ( schrodingerSolver_ ) delete schrodingerSolver_;
if ( oneD_ ) {
if ( oneD_ ) {
EfHistory_.reset(oneDslices_.size(),2);
schrodingerSolver_ = new SliceSchrodingerSolver(ELECTRON_DENSITY,
physicsModel_, atc_->feEngine_, atc_->prescribedDataMgr_, atc_,
oneDslices_,oneDdxs_);
}
}
else {
schrodingerSolver_ = new SchrodingerSolver(ELECTRON_DENSITY,
physicsModel_, atc_->feEngine_, atc_->prescribedDataMgr_, atc_);
@ -192,7 +192,7 @@ namespace ATC {
double dt = atc_->lammpsInterface_->dt();
double time = atc_->time();
int step = atc_->step();
if (step % fluxUpdateFreq_ != 0) return;
if (step % fluxUpdateFreq_ != 0) return;
// set Dirchlet data
atc_->set_fixed_nodes();
@ -201,25 +201,25 @@ namespace ATC {
atc_->set_sources();
// subcyle integration of fast electron variable/s
double idt = dt/nsubcycle_;
for (int i = 0; i < nsubcycle_ ; ++i) {
if (electronDensityEqn_ == ELECTRON_CONTINUITY) {
// update continuity eqn
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_DENSITY) )
continuityIntegrator_->update(idt,time,atc_->fields_,rhs_);
atc_->set_fixed_nodes();
atc_->set_fixed_nodes();
// solve poisson eqn for electric potential
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) )
poissonSolver_->solve(atc_->fields(),rhs_);
}
}
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) ) )
schrodingerPoissonSolver_->solve(rhs_,fluxes_);
}
// update electron temperature
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_TEMPERATURE)
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_TEMPERATURE)
&& temperatureIntegrator_ ) {
#ifdef ATC_VERBOSE
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);
#endif
}
atc_->set_fixed_nodes();
atc_->set_fixed_nodes();
}
}
//--------------------------------------------------------
// set coupling source terms
@ -249,7 +249,7 @@ namespace ATC {
// output
//--------------------------------------------------------
void ExtrinsicModelDriftDiffusion::output(OUTPUT_LIST & outputData)
{
{
#ifdef ATC_VERBOSE
// ATC::LammpsInterface::instance()->print_msg_once("start output",true,false);
#endif
@ -355,13 +355,13 @@ namespace ATC {
baseSize_(0)
{
// delete base class's version of the physics model
if (physicsModel_) delete physicsModel_;
if (physicsModel_) delete physicsModel_;
if (modelType == CONVECTIVE_DRIFT_DIFFUSION_SCHRODINGER) {
physicsModel_ = new PhysicsModelDriftDiffusionConvectionSchrodinger(matFileName);
physicsModel_ = new PhysicsModelDriftDiffusionConvectionSchrodinger(matFileName);
electronDensityEqn_ = ELECTRON_SCHRODINGER;
}
else {
physicsModel_ = new PhysicsModelDriftDiffusionConvection(matFileName);
physicsModel_ = new PhysicsModelDriftDiffusionConvection(matFileName);
}
atc_->useConsistentMassMatrix_(ELECTRON_VELOCITY) = false;
atc_->useConsistentMassMatrix_(ELECTRON_TEMPERATURE) = false;
@ -388,7 +388,7 @@ namespace ATC {
nsd_ = atc_->nsd();
rhs_[ELECTRON_VELOCITY].reset(nNodes_,nsd_);
atc_->set_fixed_nodes(); // needed to correctly set BC data
// initialize Poisson solver
if (cddmPoissonSolver_) delete cddmPoissonSolver_;
@ -397,9 +397,9 @@ namespace ATC {
rhsMask(ELECTRIC_POTENTIAL,FLUX) = true;
pair<FieldName,FieldName> row_col(ELECTRIC_POTENTIAL,ELECTRIC_POTENTIAL);
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);
const BC_SET & bcs = (atc_->prescribedDataMgr_->bcs(ELECTRIC_POTENTIAL))[0];
cddmPoissonSolver_ = new LinearSolver(stiffness, bcs, poissonSolverType_,
@ -427,7 +427,7 @@ namespace ATC {
double dt = atc_->lammpsInterface_->dt();
double time = atc_->time();
int step = atc_->step();
if (step % fluxUpdateFreq_ != 0) return;
if (step % fluxUpdateFreq_ != 0) return;
// set Dirchlet data
atc_->set_fixed_nodes();
@ -436,16 +436,16 @@ namespace ATC {
atc_->set_sources();
// subcyle integration of fast electron variable/s
double idt = dt/nsubcycle_;
for (int i = 0; i < nsubcycle_ ; ++i) {
// update electron temperature mass matrix
atc_->compute_mass_matrix(ELECTRON_VELOCITY,physicsModel_);
// update electron velocity
if (!(atc_->prescribedDataMgr_)->all_fixed(ELECTRON_VELOCITY)) {
//const BCS & bcs
//const BCS & bcs
// = atc_->prescribedDataMgr_->bcs(ELECTRON_VELOCITY);
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
rhsMask = false;
rhsMask(ELECTRON_VELOCITY,SOURCE) = atc_->fieldMask_(ELECTRON_VELOCITY,SOURCE);
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_);
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();
for (int j = 0; j < nsd_; ++j) {
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRON_VELOCITY,j) ) {
@ -477,12 +477,12 @@ namespace ATC {
}
}
}
//atc_->set_fixed_nodes();
if (electronDensityEqn_ == ELECTRON_CONTINUITY) {
// update continuity eqn
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
Array2D <bool> rhsMask(NUM_FIELDS,NUM_FLUX);
rhsMask = false;
rhsMask(ELECTRON_DENSITY,FLUX) = atc_->fieldMask_(ELECTRON_DENSITY,FLUX);
rhsMask(ELECTRON_DENSITY,SOURCE) = atc_->fieldMask_(ELECTRON_DENSITY,SOURCE);
@ -490,11 +490,11 @@ namespace ATC {
FIELDS rhs;
rhs[ELECTRON_DENSITY].reset(nNodes_,1);
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);
atc_->set_fixed_nodes();
atc_->set_fixed_nodes();
// solve poisson eqn for electric potential
if (! atc_->prescribedDataMgr_->all_fixed(ELECTRIC_POTENTIAL) ) {
//poissonSolver_->solve(atc_->fields_,rhs_);
rhsMask = false;
@ -507,12 +507,12 @@ namespace ATC {
const CLON_VEC r =column(rhs[ELECTRIC_POTENTIAL].quantity(),0);
cddmPoissonSolver_->solve(x,r);
}
}
}
else if (electronDensityEqn_ == ELECTRON_SCHRODINGER) {
schrodingerPoissonSolver_->solve(rhs_,fluxes_);
}
atc_->set_fixed_nodes();
atc_->set_fixed_nodes();
// update electron temperature mass matrix
atc_->compute_mass_matrix(ELECTRON_TEMPERATURE,physicsModel_);
// update electron temperature
@ -521,11 +521,11 @@ namespace ATC {
temperatureIntegrator_->update(idt,time,atc_->fields_,rhs_);
//}
//else { // lumped mass matrix
//}
}
atc_->set_fixed_nodes();
atc_->set_fixed_nodes();
}
}
@ -536,8 +536,8 @@ namespace ATC {
void ExtrinsicModelDriftDiffusionConvection::output(OUTPUT_LIST & outputData)
{
ExtrinsicModelDriftDiffusion::output(outputData);
//FIELD jouleHeating(atc_->num_nodes(),1);
//set_kinetic_energy_source(atc_->fields(),jouleHeating);
outputData["joule_heating"] = & (atc_->extrinsic_source(TEMPERATURE)).set_quantity();
@ -587,7 +587,7 @@ namespace ATC {
DENS_MAT & velocity((atc_->field(ELECTRON_VELOCITY)).set_quantity());
SPAR_MAT & velocityMassMat = (atc_->consistentMassMats_[ELECTRON_VELOCITY]).set_quantity();
kineticEnergy.reset(nNodes_,1);
for (int j = 0; j < nsd_; j++) {
CLON_VEC myVelocity(velocity,CLONE_COL,j);
DENS_MAT velocityMat(nNodes_,1);

View File

@ -32,7 +32,7 @@ namespace ATC {
//--------------------------------------------------------
class ExtrinsicModelDriftDiffusion : public ExtrinsicModelTwoTemperature {
public:
// constructor
@ -63,7 +63,7 @@ namespace ATC {
/** get LAMMPS display variables */
virtual bool compute_vector(int n, double & value);
protected:
/** Poisson solve */
void poisson_solve();
@ -91,7 +91,7 @@ namespace ATC {
enum electronDensityEqnType { ELECTRON_CONTINUITY,
ELECTRON_EQUILIBRIUM,
ELECTRON_SCHRODINGER};
/** frequency for updating the electron state */
int fluxUpdateFreq_;
@ -139,7 +139,7 @@ namespace ATC {
//--------------------------------------------------------
class ExtrinsicModelDriftDiffusionConvection : public ExtrinsicModelDriftDiffusion {
public:
// constructor
@ -167,7 +167,7 @@ namespace ATC {
/** get LAMMPS display variables */
virtual bool compute_vector(int n, double & value);
protected:
/** compute the total kinetic energy of the electrons */
@ -176,7 +176,7 @@ namespace ATC {
/** Linear solver for velocity */
std::vector<LinearSolver * > velocitySolvers_;
/** Linear solver for solving the poisson equations */
LinearSolver * cddmPoissonSolver_;

View File

@ -53,11 +53,11 @@ namespace ATC {
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
rhsMaskIntrinsic_ = false;
if (atc_->track_charge()) {
if (! chargeRegulator_) chargeRegulator_ = new ChargeRegulator(atc_);
}
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -68,7 +68,7 @@ namespace ATC {
}
//--------------------------------------------------------
// modify
// modify
//--------------------------------------------------------
bool ExtrinsicModelElectrostatic::modify(int narg, char **arg)
{
@ -82,7 +82,7 @@ namespace ATC {
if (strcmp(arg[argIndx],"max_solves")==0) {
argIndx++;
maxSolves_ = atoi(arg[argIndx]) ; }
else if (strcmp(arg[argIndx],"tolerance")==0) {
argIndx++;
poissonSolverTol_ = atof(arg[argIndx]);
@ -97,7 +97,7 @@ namespace ATC {
poissonSolverType_ = DIRECT; }
match = true;
} // end "poisson_solver"
/** creates fixed charge on faceset
@ -177,9 +177,9 @@ namespace ATC {
"InterpolantGradient");
}
FundamentalAtomQuantity * atomicCharge =
FundamentalAtomQuantity * atomicCharge =
interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE);
AtfShapeFunctionRestriction * nodalAtomicCharge =
AtfShapeFunctionRestriction * nodalAtomicCharge =
new AtfShapeFunctionRestriction(atc_,atomicCharge,atc_->accumulant());
interscaleManager.add_dense_matrix(nodalAtomicCharge,"NodalAtomicCharge");
AtfShapeFunctionMdProjection * nodalAtomicChargeDensity =
@ -198,10 +198,10 @@ namespace ATC {
const string moleculeName = molecule->first;
SmallMoleculeSet * smallMoleculeSet = interscaleManager.small_molecule_set(moleculeName);
// calculate nodal charge from the molecules
AtomToSmallMoleculeTransfer<double> * moleculeCharge =
AtomToSmallMoleculeTransfer<double> * moleculeCharge =
new AtomToSmallMoleculeTransfer<double>(atc_,charge,smallMoleculeSet);
interscaleManager.add_dense_matrix(moleculeCharge,"MoleculeCharge"+moleculeName);
MotfShapeFunctionRestriction * nodalAtomicMoleculeCharge =
MotfShapeFunctionRestriction * nodalAtomicMoleculeCharge =
new MotfShapeFunctionRestriction(moleculeCharge,
interscaleManager.sparse_matrix("ShapeFunction"+moleculeName));
interscaleManager.add_dense_matrix(nodalAtomicMoleculeCharge,"NodalMoleculeCharge"+moleculeName);
@ -212,10 +212,10 @@ namespace ATC {
// dipole moment density
// calculate the dipole moment of the molecules
SmallMoleculeCentroid * moleculeCentroid = static_cast<SmallMoleculeCentroid*>(interscaleManager.dense_matrix("MoleculeCentroid"+moleculeName));
SmallMoleculeDipoleMoment * dipoleMoment =
SmallMoleculeDipoleMoment * dipoleMoment =
new SmallMoleculeDipoleMoment(atc_,charge,smallMoleculeSet,atomProcGhostCoarseGrainingPositions,moleculeCentroid);
interscaleManager.add_dense_matrix(dipoleMoment,"DipoleMoment"+moleculeName);
MotfShapeFunctionRestriction * nodalAtomicMoleculeDipole =
MotfShapeFunctionRestriction * nodalAtomicMoleculeDipole =
new MotfShapeFunctionRestriction(dipoleMoment,
interscaleManager.sparse_matrix("ShapeFunction"+moleculeName));
interscaleManager.add_dense_matrix(nodalAtomicMoleculeDipole,"NodalMoleculeDipole"+moleculeName);
@ -224,7 +224,7 @@ namespace ATC {
interscaleManager.add_dense_matrix(nodalAtomicMoleculeDipoleDensity,"NodalMoleculeDipoleDensity"+moleculeName);
}
}
}
//--------------------------------------------------------
@ -255,7 +255,7 @@ namespace ATC {
}
rhsMask_(ELECTRIC_POTENTIAL,FLUX) = false;// for poisson solve & rhs compute
// need to create the bcs for the solver to configure properly
atc_->set_fixed_nodes();
atc_->set_fixed_nodes();
if (poissonSolver_) delete poissonSolver_;
@ -278,14 +278,14 @@ namespace ATC {
// set up Green's function per node
for (int i = 0; i < nNodes; i++) {
set<int> localNodes;
for (int j = 0; j < nNodes; j++)
localNodes.insert(j);
// call Poisson solver to get Green's function for node i
DENS_VEC globalGreensFunction;
poissonSolver_->greens_function(i,globalGreensFunction);
// store green's functions as sparse vectors only on local nodes
set<int>::const_iterator thisNode;
SparseVector<double> sparseGreensFunction(nNodes);
@ -311,7 +311,7 @@ namespace ATC {
nodalAtomicGhostCharge_ = interscaleManager.dense_matrix("NodalAtomicGhostCharge");
if (! nodalAtomicGhostCharge_) {
FundamentalAtomQuantity * ghostCharge = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_CHARGE, GHOST);
PerAtomSparseMatrix<double> * ghostShapeFunctions = interscaleManager.per_atom_sparse_matrix("InterpolantGhost");
if (!ghostShapeFunctions) {
ghostShapeFunctions = new PerAtomShapeFunction(atc_,
@ -353,10 +353,10 @@ namespace ATC {
{
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
// set Dirchlet data
atc_->set_fixed_nodes();
@ -365,7 +365,7 @@ namespace ATC {
// compute Poisson equation RHS sources
atc_->compute_rhs_vector(rhsMask_, atc_->fields_, rhs_, atc_->source_integration(), physicsModel_);
// add atomic charges to rhs
DENS_MAT & rhs = rhs_[ELECTRIC_POTENTIAL].set_quantity();
if (atc_->track_charge()) {
@ -376,9 +376,9 @@ namespace ATC {
}
}
// solve poisson eqn for electric potential
// 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
if (atc_->track_charge()
if (atc_->track_charge()
|| ( LammpsInterface::instance()->atom_charge() && atc_->source_atomic_quadrature(ELECTRIC_POTENTIAL) ) ) {
_atomElectricalForce_.resize(atc_->nlocal(),atc_->nsd());
add_electrostatic_forces(potential);
@ -400,8 +400,8 @@ namespace ATC {
apply_charged_surfaces(potential);
#endif
InterscaleManager & interscaleManager_ = atc_->interscale_manager();
atomForces_ = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE);
InterscaleManager & interscaleManager_ = atc_->interscale_manager();
atomForces_ = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE);
(*atomForces_) += _atomElectricalForce_; // f_E in ours, f in lammps ultimately
}
}
@ -421,7 +421,7 @@ namespace ATC {
else {
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()) {
atc_->feEngine_->add_global("electrostatic_force_x", totalElectricalForce_[0]);
atc_->feEngine_->add_global("electrostatic_force_y", totalElectricalForce_[1]);
@ -435,9 +435,9 @@ namespace ATC {
InterscaleManager & interscaleManager(atc_->interscale_manager());
const DENS_MAN * atomicChargeDensity(interscaleManager.dense_matrix("NodalAtomicChargeDensity"));
atc_->nodal_atomic_field(CHARGE_DENSITY) = atomicChargeDensity->quantity();
fields[CHARGE_DENSITY] = atomicChargeDensity->quantity();
DENS_MAT & chargeDensity(fields[CHARGE_DENSITY].set_quantity());
DENS_MAT & nodalAtomicChargeDensity((atc_->nodal_atomic_field(CHARGE_DENSITY)).set_quantity());
if ((atc_->lammps_interface())->rank_zero()) {
@ -446,7 +446,7 @@ namespace ATC {
}
}
if (fields.find(ELECTRON_DENSITY)==fields.end()) {
fields[ELECTRON_DENSITY].reset(fields[CHARGE_DENSITY].nRows(),1);
DENS_MAT & electronDensity(fields[ELECTRON_DENSITY].set_quantity());
@ -454,7 +454,7 @@ namespace ATC {
outputData["electron_density"] = &electronDensity;
}
}
const map<string,pair<MolSize,int> > & moleculeIds(atc_->molecule_ids());
map<string,pair<MolSize,int> >::const_iterator 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();
const DENS_MAT & atomPosition = ((atc_->interscale_manager()).fundamental_atom_quantity(LammpsInterface::ATOM_POSITION))->quantity();
double local_fdotx = 0, fdotx;
for (int i = 0; i < _atomElectricalForce_.nRows() ; i++) {
for (int j = 0; j < _atomElectricalForce_.nCols() ; j++) {
local_fdotx -= _atomElectricalForce_(i,j)*atomPosition(i,j);
@ -505,7 +505,7 @@ namespace ATC {
bool ExtrinsicModelElectrostatic::compute_vector(int n, double & value)
{
if (n == baseSize_) {
double nSum = ((atc_->field(ELECTRON_DENSITY)).quantity()).col_sum();
value = nSum;
return true;
@ -532,7 +532,7 @@ namespace ATC {
void ExtrinsicModelElectrostatic::add_electrostatic_forces
(MATRIX & potential)
{
//double qE2f = LammpsInterface::instance()->qe2f();
double qV2e = LammpsInterface::instance()->qv2e(); // charge volts to our energy units
//double ** f = LammpsInterface::instance()->fatom();
@ -548,7 +548,7 @@ namespace ATC {
Ei = -1.*(*(shapeFucntionDerivatives[i])*potential);
}
}
int dimOffset = 0;
if (useSlab_) dimOffset = nsd - 1;
for (int i = 0; i < nLocal; i++) {
@ -559,7 +559,7 @@ namespace ATC {
for (int j = dimOffset; j < nsd; j ++)
_atomElectricalForce_(i,j) = c*E(i,j);
}
// correct field for short range interactions
if (includeShortRange_)
correct_electrostatic_forces();
@ -577,7 +577,7 @@ namespace ATC {
double * q = LammpsInterface::instance()->atom_charge();
vector<SparseVector<double> > atomicFePotential;
int nLocal = atc_->nlocal();
int nGhostLammps = LammpsInterface::instance()->nghost();
int nLocalLammps = LammpsInterface::instance()->nlocal();
int nLocalTotal = nLocalLammps + nGhostLammps; // total number of atoms on this processor
@ -593,18 +593,18 @@ namespace ATC {
DenseVector<INDEX> nodeIndices;
DENS_VEC nodeValues;
myShpFcn.row(i,nodeValues,nodeIndices);
int atomIdx = atc_->internalToAtom_(i);
//double c = qE2f*q[atomIdx];
//double c = qV2e*q[atomIdx];
//nodeValues *= c;
nodeValues *= q[atomIdx];
for (int j = 0; j < nodeIndices.size(); 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,
// this will grab both processor and periodic neighbors,
// so we need to add in neighbor contributions using lammps indices
@ -621,7 +621,7 @@ namespace ATC {
Array<int> nodeIndices(nodesPerElement);
DENS_VEC nodeValues(nodesPerElement);
(atc_->feEngine_)->shape_functions(coords,nodeValues,nodeIndices);
//double c = qV2e*q[i];
//nodeValues *= c;
nodeValues *= q[i];
@ -633,7 +633,7 @@ namespace ATC {
}
// Get sparse vectors of derivatives at each atom
// to compute this only when the shape functions change
vector<vector<SparseVector<double> > > atomicDerivatives;
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
// need to use specific coulombic cutoff from different pairs
// see pair_coul_cut for an example of the data structures
// 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 cutoffSq = cutoffRadius*cutoffRadius;
int inum = LammpsInterface::instance()->neighbor_list_inum();
int * ilist = LammpsInterface::instance()->neighbor_list_ilist();
int * numneigh = LammpsInterface::instance()->neighbor_list_numneigh();
int ** firstneigh = LammpsInterface::instance()->neighbor_list_firstneigh();
// loop over neighbors of my atoms
for (int ii = 0; ii < inum; ii++) {
int i = ilist[ii];
@ -683,10 +683,10 @@ namespace ATC {
double xtmp = xatom[i][0];
double ytmp = xatom[i][1];
double ztmp = xatom[i][2];
int * jlist = firstneigh[i];
int jnum = numneigh[i];
for (int jj = 0; jj < jnum; jj++) {
int j = jlist[jj];
if (mask[j] & atc_->groupbit_) {
@ -696,7 +696,7 @@ namespace ATC {
double delx = xtmp - xatom[j][0];
double dely = ytmp - xatom[j][1];
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) {
DENS_VEC efield(nsd);
efield = 0.;
@ -732,7 +732,7 @@ namespace ATC {
// get faceset information
int nNodes = atc_->num_nodes();
const FE_Mesh * feMesh = (atc_->feEngine_)->fe_mesh();
const set< pair <int,int> > * faceset
const set< pair <int,int> > * faceset
= & ( feMesh->faceset(facesetName));
// 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);
Array<bool> fieldMask(NUM_FIELDS);
fieldMask(ELECTRIC_POTENTIAL) = true;
(atc_->feEngine_)->add_fluxes(fieldMask,0.,faceSources,nodalFaceWeights);
// set up data structure holding charged faceset information
FIELDS sources;
@ -774,7 +774,7 @@ namespace ATC {
for (myNodeData = myFaceset.begin(); myNodeData != myFaceset.end(); myNodeData++) {
// evaluate voltage at each node I
// set up X_T function for integration: k*chargeDensity/||x_I - x_s||
// 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
// 2) far part evaluated using Gaussian quadrature on faceset
@ -790,7 +790,7 @@ namespace ATC {
string radialPower = "radial_power";
f = XT_Function_Mgr::instance()->function(radialPower,8,xtArgs);
for (iset = faceset->begin(); iset != faceset->end(); iset++) {
pair<int,int> face = *iset;
// allocate
@ -850,7 +850,7 @@ namespace ATC {
string facesetName = isurface->first;
map<int,pair<DENS_VEC,double> >::const_iterator inode;
for (inode = (isurface->second).begin(); inode != (isurface->second).end(); inode++) {
int nodeId = inode->first;
DENS_VEC nodalCoords = (inode->second).first;
double nodalCharge = (inode->second).second;
@ -858,26 +858,26 @@ namespace ATC {
PerAtomQuantity<double> * atomicCoords = (atc_->interscale_manager()).per_atom_quantity("AtomicCoarseGrainingPositions");
const DENS_MAT & myAtomicCoords(atomicCoords->quantity());
for (int i = 0; i < nLocal; i++) {
if (abs(qatom(i,0)) > 0) {
if (abs(qatom(i,0)) > 0) {
double distanceSq = 0.;
double deltaX[3];
for (int j = 0; j < nsd; j++) {
deltaX[j] = myAtomicCoords(i,j) - nodalCoords(j);
distanceSq += deltaX[j]*deltaX[j];
}
if (distanceSq < cutoffSq) {
if (distanceSq < cutoffSq) {
// first apply pairwise coulombic interaction
if (!useSlab_) {
if (!useSlab_) {
double coulForce = qqrd2e*nodalCharge*qatom(i,0)/(distanceSq*sqrtf(distanceSq));
for (int j = 0; j < nsd; j++)
//fatom[atomIdx][j] += deltaX[j]*coulForce;
_atomElectricalForce_(i,j) += deltaX[j]*coulForce;
}
// second correct for FE potential induced by BCs
// determine shape function derivatives at atomic location
// and construct sparse vectors to store derivative data
vector<SparseVector<double> > derivativeVectors;
derivativeVectors.reserve(nsd);
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++)
derivativeVectors[j](nodeIndices(k)) = nodeValues(k);
}
// compute greens function from charge quadrature
SparseVector<double> shortFePotential(nNodes);
shortFePotential.add_scaled(greensFunctions_[nodeId],penalty*nodalPotential);
// compute electric field induced by charge
DENS_VEC efield(nsd);
efield = 0.;
for (int j = 0; j < nsd; j++)
efield(j) = -.1*dot(derivativeVectors[j],shortFePotential);
// apply correction in atomic forces
//double c = qE2f*qatom[atomIdx];
double c = qV2e*qatom(i,0);
for (int j = 0; j < nsd; j++)
if ((!useSlab_) || (j==nsd)) {
if ((!useSlab_) || (j==nsd)) {
//fatom[atomIdx][j] -= c*efield(j);
_atomElectricalForce_(i,j) -= c*efield(j);
}
@ -932,7 +932,7 @@ namespace ATC {
string matFileName) :
ExtrinsicModelElectrostatic(modelManager,modelType,matFileName)
{
if (physicsModel_) delete physicsModel_;
if (physicsModel_) delete physicsModel_;
if (modelType == ELECTROSTATIC) {
physicsModel_ = new PhysicsModelElectrostatic(matFileName);
}
@ -943,7 +943,7 @@ namespace ATC {
rhsMaskIntrinsic_(VELOCITY,SOURCE) = true;
atc_->fieldMask_(VELOCITY,EXTRINSIC_SOURCE) = true;
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -953,7 +953,7 @@ namespace ATC {
}
//--------------------------------------------------------
// modify
// modify
//--------------------------------------------------------
bool ExtrinsicModelElectrostaticMomentum::modify(int narg, char **arg)
{
@ -983,7 +983,7 @@ namespace ATC {
void ExtrinsicModelElectrostaticMomentum::set_sources(FIELDS & fields, FIELDS & sources)
{
// compute charge density
if (modelType_ == ELECTROSTATIC_EQUILIBRIUM) {
if (modelType_ == ELECTROSTATIC_EQUILIBRIUM) {
DENS_MAN & n = atc_->field(ELECTRON_DENSITY);
atc_->nodal_projection(ELECTRON_DENSITY,physicsModel_,n);
}
@ -997,7 +997,7 @@ namespace ATC {
// compute source term with appropriate masking and physics model
atc_->evaluate_rhs_integral(rhsMaskIntrinsic_, fields, sources,
atc_->source_integration(), physicsModel_);
atc_->source_integration(), physicsModel_);
//(sources[VELOCITY].quantity()).print("V SRC");
}

View File

@ -25,7 +25,7 @@ namespace ATC {
/**
* @class ExtrinsicModelElectrostatic
* @brief add self-consistent electrostatic forces
* owned field: ELECTRIC_POTENTIAL
* owned field: ELECTRIC_POTENTIAL
*/
//--------------------------------------------------------
@ -35,7 +35,7 @@ namespace ATC {
//--------------------------------------------------------
class ExtrinsicModelElectrostatic : public ExtrinsicModel {
public:
// constructor
@ -71,9 +71,9 @@ namespace ATC {
virtual double compute_scalar(void);
virtual bool compute_vector(int n, double & value);
PoissonSolver * poisson_solver(void) const { return poissonSolver_;}
PoissonSolver * poisson_solver(void) const { return poissonSolver_;}
protected:
/** poisson solver type */
SolverType poissonSolverType_;
@ -91,7 +91,7 @@ namespace ATC {
/** rhs mask for Poisson solver */
Array2D<bool> rhsMask_;
/** estimate intrinsic charge density */
void add_electrostatic_forces(MATRIX & nodalPotential);
@ -107,7 +107,7 @@ namespace ATC {
const double chargeDensity);
#endif
/** charge regulator */
ChargeRegulator * chargeRegulator_;
ChargeRegulator * chargeRegulator_;
/** local electric potential Green's function for each node */
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 */
std::map<std::string,std::map<int,double> > nodalChargePotential_;
/** allows electric force only applied only in z direction to complement LAMMPS slab command */
bool useSlab_;
/** enables method when short range interactions are off */
bool includeShortRange_;
@ -158,7 +158,7 @@ namespace ATC {
//--------------------------------------------------------
class ExtrinsicModelElectrostaticMomentum : public ExtrinsicModelElectrostatic {
public:
// constructor
@ -180,7 +180,7 @@ namespace ATC {
/** Add model-specific output data */
virtual void output(OUTPUT_LIST & outputData);
};
};

View File

@ -28,7 +28,7 @@ namespace ATC {
electronTimeIntegration_(TimeIntegrator::IMPLICIT),
temperatureIntegrator_(nullptr),
nsubcycle_(1),
exchangeFlag_(true),
exchangeFlag_(true),
baseSize_(0)
{
physicsModel_ = new PhysicsModelTwoTemperature(matFileName);
@ -39,7 +39,7 @@ namespace ATC {
rhsMaskIntrinsic_(TEMPERATURE,SOURCE) = true;
atc_->fieldMask_(TEMPERATURE,EXTRINSIC_SOURCE) = true;
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -49,7 +49,7 @@ namespace ATC {
}
//--------------------------------------------------------
// modify
// modify
//--------------------------------------------------------
bool ExtrinsicModelTwoTemperature::modify(int narg, char **arg)
{
@ -174,12 +174,12 @@ namespace ATC {
else if (electronTimeIntegration_ == TimeIntegrator::IMPLICIT) {
double alpha = 1; // backwards Euler
temperatureIntegrator_ = new FieldImplicitEulerIntegrator(
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
rhsMask, alpha);
}
else if (electronTimeIntegration_ == TimeIntegrator::EXPLICIT) {
temperatureIntegrator_ = new FieldExplicitEulerIntegrator(
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
ELECTRON_TEMPERATURE, physicsModel_, atc_->feEngine_, atc_,
rhsMask);
}
double dt = atc_->lammpsInterface_->dt();
@ -267,18 +267,18 @@ namespace ATC {
// output[1] = total electron energy
// output[2] = average electron temperature
if (n == baseSize_) {
if (n == baseSize_) {
Array<FieldName> mask(1);
FIELD_MATS energy;
mask(0) = ELECTRON_TEMPERATURE;
(atc_->feEngine_)->compute_energy(mask,
(atc_->feEngine_)->compute_energy(mask,
atc_->fields(),
physicsModel_,
atc_->elementToMaterialMap_,
energy);
// 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();
value = electronEnergy;
return true;
@ -288,7 +288,7 @@ namespace ATC {
value = electronTemperature;
return true;
}
return false;
}

View File

@ -25,7 +25,7 @@ namespace ATC {
//--------------------------------------------------------
class ExtrinsicModelTwoTemperature : public ExtrinsicModel {
public:
// constructor
@ -50,7 +50,7 @@ namespace ATC {
/** Add model-specific output data */
virtual void output(OUTPUT_LIST & outputData);
/** set up LAMMPS display variables */
virtual int size_vector(int externalSize);

View File

@ -45,22 +45,22 @@ static const double localCoordinatesTolerance = 1.e-09;
}
int FE_Element::num_ips() const
{
return feInterpolate_->num_ips();
{
return feInterpolate_->num_ips();
}
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,
DENS_MAT & faceCoords) const
{
faceCoords.reset(nSD_, numFaceNodes_);
for (int inode=0; inode < numFaceNodes_; inode++)
for (int inode=0; inode < numFaceNodes_; inode++)
{
int id = localFaceConn_(faceID,inode);
for (int isd=0; isd<nSD_; isd++) {
@ -94,7 +94,7 @@ static const double localCoordinatesTolerance = 1.e-09;
centroid(i) = eltCoords.row_mean(i);
}
}
// -------------------------------------------------------------
// generic conversion from global to local coordinates using
// 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(1)) > 1.0) xiGuess(1) = 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
// and the actual global position of x to zero
//
@ -127,12 +127,12 @@ static const double localCoordinatesTolerance = 1.e-09;
while (count < localCoordinatesMaxIterations_) {
feInterpolate_->compute_N_dNdr(xiGuess,N,dNdr);
xGuess = N*eltCoordsT;
xDiff = xGuess-x;
xDiff = xGuess-x;
// determine if the guess is close enough.
// if it is, take it and run
// if not, use Newton's method to update the guess
if (!dbl_geq(abs(xDiff(0)),tolerance_) &&
!dbl_geq(abs(xDiff(1)),tolerance_) &&
if (!dbl_geq(abs(xDiff(0)),tolerance_) &&
!dbl_geq(abs(xDiff(1)),tolerance_) &&
!dbl_geq(abs(xDiff(2)),tolerance_)) {
converged = true;
xi = xiGuess;
@ -160,11 +160,11 @@ static const double localCoordinatesTolerance = 1.e-09;
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 x0(nSD_), dx(nSD_);
centroid(eltCoords,x0);
dx = x - x0;
centroid(eltCoords,x0);
dx = x - x0;
vector<DENS_VEC> ts; ts.reserve(nSD_);
tangents(eltCoords,xi0,ts);
DENS_VEC & t1 = ts[0];
@ -178,7 +178,7 @@ static const double localCoordinatesTolerance = 1.e-09;
xi(1) = J2/J;
xi(2) = J3/J;
}
else if (projectionGuess_ == TWOD_ANALYTIC) {
else if (projectionGuess_ == TWOD_ANALYTIC) {
// assume x-y planar and HEX8
double x0 = x(0), y0 = x(1);
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[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
xi(0) = xi1[0];
xi(1) = xi2[0];
xi(2) = 0;
xi(0) = xi1[0];
xi(1) = xi2[0];
xi(2) = 0;
}
}
bool FE_Element::range_check(const DENS_MAT &eltCoords,
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
// -------------------------------------------------------------
bool FE_Element::contains_point(const DENS_MAT &eltCoords,
@ -229,7 +229,7 @@ static const double localCoordinatesTolerance = 1.e-09;
bool inside = true;
for (int faceID=0; faceID<numFaces_; ++faceID) {
face_coordinates(eltCoords, faceID, faceCoords);
feInterpolate_->face_normal(faceCoords,
feInterpolate_->face_normal(faceCoords,
0,
normal);
faceToPoint = x - column(faceCoords, 0);
@ -258,8 +258,8 @@ static const double localCoordinatesTolerance = 1.e-09;
if (dbl_geq(eltCoords(dim,it),min)) {
++it;
} else {
// set min to this node's coord in the specified dim, if it's
// smaller than the value previously stored
// set min to this node's coord in the specified dim, if it's
// smaller than the value previously stored
min = eltCoords(dim,it);
}
} else {
@ -277,7 +277,7 @@ static const double localCoordinatesTolerance = 1.e-09;
}
}
}
// -------------------------------------------------------------
// 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);
feInterpolate_->shape_function(eltCoords, xi, N, dNdx);
}
}
void FE_Element::shape_function_derivatives(const DENS_MAT eltCoords,
const VECTOR &x,
@ -316,7 +316,7 @@ static const double localCoordinatesTolerance = 1.e-09;
local_coordinates(eltCoords, x, xi);
feInterpolate_->shape_function_derivatives(eltCoords, xi, dNdx);
}
}
void FE_Element::shape_function(const DENS_MAT eltCoords,
@ -334,8 +334,8 @@ static const double localCoordinatesTolerance = 1.e-09;
DIAG_MAT &weights)
{
DENS_MAT faceCoords;
face_coordinates(eltCoords, faceID, faceCoords);
face_coordinates(eltCoords, faceID, faceCoords);
feInterpolate_->face_shape_function(eltCoords, faceCoords, faceID,
N, n, weights);
}
@ -348,8 +348,8 @@ static const double localCoordinatesTolerance = 1.e-09;
DIAG_MAT &weights)
{
DENS_MAT faceCoords;
face_coordinates(eltCoords, faceID, faceCoords);
face_coordinates(eltCoords, faceID, faceCoords);
feInterpolate_->face_shape_function(eltCoords, faceCoords, faceID,
N, dN, Nn, weights);
}
@ -357,7 +357,7 @@ static const double localCoordinatesTolerance = 1.e-09;
double FE_Element::face_normal(const DENS_MAT &eltCoords,
const int faceID,
int ip,
DENS_VEC &normal)
DENS_VEC &normal)
{
DENS_MAT faceCoords;
face_coordinates(eltCoords, faceID, faceCoords);
@ -373,12 +373,12 @@ static const double localCoordinatesTolerance = 1.e-09;
{
feInterpolate_->tangents(eltCoords,localCoords,tangents,normalize);
}
// =============================================================
// class FE_ElementHex
// =============================================================
FE_ElementHex::FE_ElementHex(int numNodes,
FE_ElementHex::FE_ElementHex(int numNodes,
int numFaceNodes,
int numNodes1d)
: FE_Element(3, // number of spatial dimensions
@ -396,126 +396,126 @@ static const double localCoordinatesTolerance = 1.e-09;
// /
// /
// z
// Basic properties of element:
vol_ = 8.0;
faceArea_ = 4.0;
// Order-specific information:
if (numNodes != 8 &&
numNodes != 20 &&
numNodes != 27) {
throw ATC_Error("Unrecognized interpolation order specified "
"for element class: \n"
" element only knows how to construct lin "
throw ATC_Error("Unrecognized interpolation order specified "
"for element class: \n"
" element only knows how to construct lin "
"and quad elements.");
}
localCoords_.resize(nSD_,numNodes_);
localFaceConn_ = Array2D<int>(numFaces_,numFaceNodes_);
// Matrix of local nodal coordinates
localCoords_(0,0) = -1; localCoords_(0,4) = -1;
localCoords_(1,0) = -1; localCoords_(1,4) = -1;
localCoords_(0,0) = -1; localCoords_(0,4) = -1;
localCoords_(1,0) = -1; localCoords_(1,4) = -1;
localCoords_(2,0) = -1; localCoords_(2,4) = 1;
//
localCoords_(0,1) = 1; localCoords_(0,5) = 1;
localCoords_(1,1) = -1; localCoords_(1,5) = -1;
//
localCoords_(0,1) = 1; localCoords_(0,5) = 1;
localCoords_(1,1) = -1; localCoords_(1,5) = -1;
localCoords_(2,1) = -1; localCoords_(2,5) = 1;
//
localCoords_(0,2) = 1; localCoords_(0,6) = 1;
localCoords_(1,2) = 1; localCoords_(1,6) = 1;
localCoords_(0,2) = 1; localCoords_(0,6) = 1;
localCoords_(1,2) = 1; localCoords_(1,6) = 1;
localCoords_(2,2) = -1; localCoords_(2,6) = 1;
//
localCoords_(0,3) = -1; localCoords_(0,7) = -1;
localCoords_(1,3) = 1; localCoords_(1,7) = 1;
localCoords_(0,3) = -1; localCoords_(0,7) = -1;
localCoords_(1,3) = 1; localCoords_(1,7) = 1;
localCoords_(2,3) = -1; localCoords_(2,7) = 1;
if (numNodes >= 20) {
// only for quads
localCoords_(0,8) = 0; localCoords_(0,14) = 1;
localCoords_(1,8) = -1; localCoords_(1,14) = 1;
localCoords_(0,8) = 0; localCoords_(0,14) = 1;
localCoords_(1,8) = -1; localCoords_(1,14) = 1;
localCoords_(2,8) = -1; localCoords_(2,14) = 0;
//
localCoords_(0,9) = 1; localCoords_(0,15) = -1;
localCoords_(1,9) = 0; localCoords_(1,15) = 1;
//
localCoords_(0,9) = 1; localCoords_(0,15) = -1;
localCoords_(1,9) = 0; localCoords_(1,15) = 1;
localCoords_(2,9) = -1; localCoords_(2,15) = 0;
//
localCoords_(0,10) = 0; localCoords_(0,16) = 0;
localCoords_(1,10) = 1; localCoords_(1,16) = -1;
localCoords_(0,10) = 0; localCoords_(0,16) = 0;
localCoords_(1,10) = 1; localCoords_(1,16) = -1;
localCoords_(2,10) = -1; localCoords_(2,16) = 1;
//
localCoords_(0,11) = -1; localCoords_(0,17) = 1;
localCoords_(1,11) = 0; localCoords_(1,17) = 0;
localCoords_(0,11) = -1; localCoords_(0,17) = 1;
localCoords_(1,11) = 0; localCoords_(1,17) = 0;
localCoords_(2,11) = -1; localCoords_(2,17) = 1;
//
localCoords_(0,12) = -1; localCoords_(0,18) = 0;
localCoords_(1,12) = -1; localCoords_(1,18) = 1;
localCoords_(0,12) = -1; localCoords_(0,18) = 0;
localCoords_(1,12) = -1; localCoords_(1,18) = 1;
localCoords_(2,12) = 0; localCoords_(2,18) = 1;
//
localCoords_(0,13) = 1; localCoords_(0,19) = -1;
localCoords_(1,13) = -1; localCoords_(1,19) = 0;
localCoords_(0,13) = 1; localCoords_(0,19) = -1;
localCoords_(1,13) = -1; localCoords_(1,19) = 0;
localCoords_(2,13) = 0; localCoords_(2,19) = 1;
if (numNodes >= 27) {
// only for quads
localCoords_(0,20) = 0; localCoords_(0,24) = 1;
localCoords_(1,20) = 0; localCoords_(1,24) = 0;
localCoords_(0,20) = 0; localCoords_(0,24) = 1;
localCoords_(1,20) = 0; localCoords_(1,24) = 0;
localCoords_(2,20) = 0; localCoords_(2,24) = 0;
//
localCoords_(0,21) = 0; localCoords_(0,25) = 0;
localCoords_(1,21) = 0; localCoords_(1,25) = -1;
localCoords_(0,21) = 0; localCoords_(0,25) = 0;
localCoords_(1,21) = 0; localCoords_(1,25) = -1;
localCoords_(2,21) = -1; localCoords_(2,25) = 0;
//
localCoords_(0,22) = 0; localCoords_(0,26) = 0;
localCoords_(1,22) = 0; localCoords_(1,26) = 1;
localCoords_(0,22) = 0; localCoords_(0,26) = 0;
localCoords_(1,22) = 0; localCoords_(1,26) = 1;
localCoords_(2,22) = 1; localCoords_(2,26) = 0;
//
localCoords_(0,23) = -1;
localCoords_(1,23) = 0;
localCoords_(0,23) = -1;
localCoords_(1,23) = 0;
localCoords_(2,23) = 0;
}
}
// Matrix of local face connectivity
// -x // +x
localFaceConn_(0,0) = 0; localFaceConn_(1,0) = 1;
localFaceConn_(0,1) = 4; localFaceConn_(1,1) = 2;
localFaceConn_(0,2) = 7; localFaceConn_(1,2) = 6;
localFaceConn_(0,3) = 3; localFaceConn_(1,3) = 5;
localFaceConn_(0,0) = 0; localFaceConn_(1,0) = 1;
localFaceConn_(0,1) = 4; localFaceConn_(1,1) = 2;
localFaceConn_(0,2) = 7; localFaceConn_(1,2) = 6;
localFaceConn_(0,3) = 3; localFaceConn_(1,3) = 5;
if (numNodes >= 20) {
localFaceConn_(0,4) = 12; localFaceConn_(1,4) = 9;
localFaceConn_(0,5) = 19; localFaceConn_(1,5) = 14;
localFaceConn_(0,6) = 15; localFaceConn_(1,6) = 17;
localFaceConn_(0,7) = 11; localFaceConn_(1,7) = 13;
localFaceConn_(0,4) = 12; localFaceConn_(1,4) = 9;
localFaceConn_(0,5) = 19; localFaceConn_(1,5) = 14;
localFaceConn_(0,6) = 15; localFaceConn_(1,6) = 17;
localFaceConn_(0,7) = 11; localFaceConn_(1,7) = 13;
if (numNodes >= 27) {
localFaceConn_(0,8) = 23; localFaceConn_(1,8) = 24;
}
}
// -y // +y
localFaceConn_(2,0) = 0; localFaceConn_(3,0) = 3;
localFaceConn_(2,1) = 1; localFaceConn_(3,1) = 7;
localFaceConn_(2,2) = 5; localFaceConn_(3,2) = 6;
localFaceConn_(2,3) = 4; localFaceConn_(3,3) = 2;
localFaceConn_(2,0) = 0; localFaceConn_(3,0) = 3;
localFaceConn_(2,1) = 1; localFaceConn_(3,1) = 7;
localFaceConn_(2,2) = 5; localFaceConn_(3,2) = 6;
localFaceConn_(2,3) = 4; localFaceConn_(3,3) = 2;
if (numNodes >= 20) {
localFaceConn_(2,4) = 8; localFaceConn_(3,4) = 15;
localFaceConn_(2,5) = 13; localFaceConn_(3,5) = 18;
localFaceConn_(2,6) = 16; localFaceConn_(3,6) = 14;
localFaceConn_(2,7) = 12; localFaceConn_(3,7) = 10;
localFaceConn_(2,4) = 8; localFaceConn_(3,4) = 15;
localFaceConn_(2,5) = 13; localFaceConn_(3,5) = 18;
localFaceConn_(2,6) = 16; localFaceConn_(3,6) = 14;
localFaceConn_(2,7) = 12; localFaceConn_(3,7) = 10;
if (numNodes >= 27) {
localFaceConn_(2,8) = 25; localFaceConn_(3,8) = 26;
}
}
// -z // +z
localFaceConn_(4,0) = 0; localFaceConn_(5,0) = 4;
localFaceConn_(4,1) = 3; localFaceConn_(5,1) = 5;
localFaceConn_(4,2) = 2; localFaceConn_(5,2) = 6;
localFaceConn_(4,3) = 1; localFaceConn_(5,3) = 7;
localFaceConn_(4,0) = 0; localFaceConn_(5,0) = 4;
localFaceConn_(4,1) = 3; localFaceConn_(5,1) = 5;
localFaceConn_(4,2) = 2; localFaceConn_(5,2) = 6;
localFaceConn_(4,3) = 1; localFaceConn_(5,3) = 7;
if (numNodes >= 20) {
localFaceConn_(4,4) = 8; localFaceConn_(5,4) = 16;
localFaceConn_(4,5) = 11; localFaceConn_(5,5) = 17;
localFaceConn_(4,6) = 10; localFaceConn_(5,6) = 18;
localFaceConn_(4,7) = 9; localFaceConn_(5,7) = 19;
localFaceConn_(4,4) = 8; localFaceConn_(5,4) = 16;
localFaceConn_(4,5) = 11; localFaceConn_(5,5) = 17;
localFaceConn_(4,6) = 10; localFaceConn_(5,6) = 18;
localFaceConn_(4,7) = 9; localFaceConn_(5,7) = 19;
if (numNodes >= 27) {
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
}
FE_ElementHex::~FE_ElementHex()
@ -538,18 +538,18 @@ static const double localCoordinatesTolerance = 1.e-09;
// Handled by base class
}
void FE_ElementHex::set_quadrature(FeIntQuadrature type)
{
void FE_ElementHex::set_quadrature(FeIntQuadrature type)
{
feInterpolate_->set_quadrature(HEXA,type);
}
bool FE_ElementHex::contains_point(const DENS_MAT &eltCoords,
const DENS_VEC &x) const
{
if (! range_check(eltCoords,x) ) return false;
DENS_VEC xi;
bool converged = local_coordinates(eltCoords,x,xi);
bool converged = local_coordinates(eltCoords,x,xi);
if (!converged) return false;
for (int i=0; i<nSD_; ++i) {
if (!dbl_geq(1.0,abs(xi(i)))) return false;
@ -592,7 +592,7 @@ static const double localCoordinatesTolerance = 1.e-09;
}
return true;
}
// =============================================================
// class FE_ElementTet
@ -614,12 +614,12 @@ static const double localCoordinatesTolerance = 1.e-09;
// 3 .7
// |\```--- .
// | \ ```--2 .
// | \ .|
// | \ .|
// | \ . |
// | . \ |
// | . \ |
// |.___________\| -------> r
// 0 1
// 0 1
//
// (This is as dictated by the EXODUSII standard.)
//
@ -631,18 +631,18 @@ static const double localCoordinatesTolerance = 1.e-09;
// Basic properties of element:
vol_ = 1.0/6.0; // local volume
faceArea_ = 1.0/2.0;
// Order-specific information:
if (numNodes != 4 && numNodes != 10) {
throw ATC_Error("Unrecognized interpolation order specified "
"for element class: \n"
" element only knows how to construct lin "
throw ATC_Error("Unrecognized interpolation order specified "
"for element class: \n"
" element only knows how to construct lin "
"and quad elements.");
}
localCoords_.resize(nSD_+1, numNodes_);
localFaceConn_ = Array2D<int>(numFaces_,numFaceNodes_);
// Matrix of local nodal coordinates
//
// 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),
// for the canonical element.
// Everyone gets these nodes...
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_(3,0) = 1; localCoords_(3,2) = 0;
//
localCoords_(0,1) = 1; localCoords_(0,3) = 0;
localCoords_(1,1) = 0; localCoords_(1,3) = 0;
localCoords_(2,1) = 0; localCoords_(2,3) = 1;
localCoords_(0,1) = 1; localCoords_(0,3) = 0;
localCoords_(1,1) = 0; localCoords_(1,3) = 0;
localCoords_(2,1) = 0; localCoords_(2,3) = 1;
localCoords_(3,1) = 0; localCoords_(3,3) = 0;
if (numNodes >= 10) {
// ...quads get even more!
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_(3,4) = 0.5; localCoords_(3,5) = 0.0;
//
localCoords_(0,6) = 0.0; localCoords_(0,7) = 0.0;
localCoords_(1,6) = 0.5; localCoords_(1,7) = 0.0;
localCoords_(2,6) = 0.0; localCoords_(2,7) = 0.5;
localCoords_(0,6) = 0.0; localCoords_(0,7) = 0.0;
localCoords_(1,6) = 0.5; localCoords_(1,7) = 0.0;
localCoords_(2,6) = 0.0; localCoords_(2,7) = 0.5;
localCoords_(3,6) = 0.5; localCoords_(3,7) = 0.5;
//
localCoords_(0,8) = 0.5; localCoords_(0,9) = 0.0;
localCoords_(1,8) = 0.0; localCoords_(1,9) = 0.5;
localCoords_(2,8) = 0.5; localCoords_(2,9) = 0.5;
localCoords_(0,8) = 0.5; localCoords_(0,9) = 0.0;
localCoords_(1,8) = 0.0; localCoords_(1,9) = 0.5;
localCoords_(2,8) = 0.5; localCoords_(2,9) = 0.5;
localCoords_(3,8) = 0.0; localCoords_(3,9) = 0.0;
}
// 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,1) = 2; localFaceConn_(2,1) = 1;
localFaceConn_(0,2) = 3; localFaceConn_(2,2) = 3;
// ...opposite point 1, ...opposite point 3.
localFaceConn_(1,0) = 2; localFaceConn_(3,0) = 0;
localFaceConn_(1,1) = 0; localFaceConn_(3,1) = 2;
localFaceConn_(1,2) = 3; localFaceConn_(3,2) = 1;
localFaceConn_(1,0) = 2; localFaceConn_(3,0) = 0;
localFaceConn_(1,1) = 0; localFaceConn_(3,1) = 2;
localFaceConn_(1,2) = 3; localFaceConn_(3,2) = 1;
feInterpolate_ = new FE_InterpolateSimpLin(this);
}
@ -701,8 +701,8 @@ static const double localCoordinatesTolerance = 1.e-09;
// Handled by base class
}
void FE_ElementTet::set_quadrature(FeIntQuadrature type)
{
void FE_ElementTet::set_quadrature(FeIntQuadrature type)
{
feInterpolate_->set_quadrature(TETRA,type);
}

View File

@ -12,7 +12,7 @@
namespace ATC {
enum ProjectionGuessType {
COORDINATE_ALIGNED=0,
COORDINATE_ALIGNED=0,
CENTROID_LINEARIZED,
TWOD_ANALYTIC};
@ -23,23 +23,23 @@ namespace ATC {
* @class FE_Element
* @brief Base class for a finite element holding info for canonical element
*/
class FE_Element {
public:
///////////////////////////////////////////////////////////////////////////
//
// CONSTRUCTOR AND DESTRUCTOR
// CONSTRUCTOR AND DESTRUCTOR
FE_Element(const int nSD,
int numFaces,
int numFaces,
int numNodes,
int numFaceNodes,
int numNodes1d);
virtual ~FE_Element();
///////////////////////////////////////////////////////////////////////////
//
// GETTERS
@ -49,23 +49,23 @@ namespace ATC {
/** get number of element nodes */
int num_elt_nodes() { return numNodes_; }
/** get number of element nodes */
int num_elt_nodes_1d() { return numNodes1d_; }
/** get number of faces */
int num_faces() { return numFaces_; }
/** get number of face nodes */
int num_face_nodes() { return numFaceNodes_; }
// Getters for FE_Interpoate to have access to coordinates and connectivity
/** get canonical coordinates */
const DENS_MAT &local_coords() const { return localCoords_; }
/** get canonical coordinates in 1d */
DENS_VEC local_coords_1d() const;
DENS_VEC local_coords_1d() const;
/** get canonical connectivity of nodes and faces */
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
// can thus only be declared in the class body (or else the
// interpolate class is "incomplete" and cannot be referenced)
/** get number of integration points */
int num_ips() const;
/** get number of integration points */
int num_face_ips() const;
/** order of interpolation */
int order() const {return numNodes1d_;}
int order() const {return numNodes1d_;}
/** 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 */
void mapping(const int inode, std::vector<int> &mapping) const;
/** extract face coordinates from element coordinates */
void face_coordinates(const DENS_MAT &eltCoords,
void face_coordinates(const DENS_MAT &eltCoords,
const int faceID,
DENS_MAT &faceCoords) const;
/** set initial guess type for point in element search */
void set_projection_guess(ProjectionGuessType type)
/** set initial guess type for point in element search */
void set_projection_guess(ProjectionGuessType type)
{ projectionGuess_ = type;}
///////////////////////////////////////////////////////////////////////////
//
@ -122,7 +122,7 @@ namespace ATC {
/** check if element bounding box contains the given point */
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 */
void bounds_in_dim(const DENS_MAT &eltCoords, const int dim,
double &min, double &max) const;
@ -133,7 +133,7 @@ namespace ATC {
virtual void shape_function(const VECTOR & xi,
DENS_VEC &N) const;
/**
/**
* compute shape functions at all ip's:
* indexed: N(ip,node)
* dN[nsd](ip,node)
@ -141,11 +141,11 @@ namespace ATC {
*/
virtual void shape_function(const DENS_MAT eltCoords,
DENS_MAT &N,
std::vector<DENS_MAT> &dN,
std::vector<DENS_MAT> &dN,
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
* indexed: N(node)
*/
@ -153,8 +153,8 @@ namespace ATC {
const VECTOR &x,
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
* indexed: N(node)
* dNdx(ip,nSD)
@ -164,17 +164,17 @@ namespace ATC {
DENS_VEC &N,
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
* indexed:
* indexed:
* dNdx(ip,nSD)
*/
virtual void shape_function_derivatives(const DENS_MAT eltCoords,
const VECTOR &x,
DENS_MAT &dNdx);
/**
/**
* compute shape functions at all face ip's:
* indexed: N(ip,node)
* n[nsd](ip,node)
@ -186,7 +186,7 @@ namespace ATC {
DENS_MAT &n,
DIAG_MAT &weights);
/**
/**
* compute shape functions at all face ip's:
* indexed: N(ip,node)
* dN[nsd](ip,node)
@ -200,32 +200,32 @@ namespace ATC {
std::vector<DENS_MAT> &Nn,
DIAG_MAT &weights);
/**
/**
* compute normal vector from the specified face
* indexed: normal(nSD)
*/
virtual double face_normal(const DENS_MAT &eltCoords,
const int faceID,
int ip,
DENS_VEC &normal);
/**
DENS_VEC &normal);
/**
* compute tangents to local coordinates
* indexed:
* indexed:
*/
virtual void tangents(const DENS_MAT &eltCoords,
const DENS_VEC &x,
std::vector<DENS_VEC> & tangents,
const bool normalize=false) const;
const bool normalize=false) const;
protected:
///////////////////////////////////////////////////////////////////////////
//
// HELPERS
/**
* generate the appropriate interpolation class
/**
* generate the appropriate interpolation class
*/
FE_Interpolate *interpolate_factory(std::string interpolateType);
@ -233,11 +233,11 @@ namespace ATC {
virtual void initial_local_coordinates(const DENS_MAT &eltCoords,
const DENS_VEC &x,
DENS_VEC &xiInitial) const;
///////////////////////////////////////////////////////////////////////////
//
// PROTECTED MEMBERS
// Currently used interpolation class
FE_Interpolate *feInterpolate_;
@ -251,7 +251,7 @@ namespace ATC {
// Number of face nodes
int numFaceNodes_;
// Number of nodes in one dimension
int numNodes1d_;
int numNodes1d_;
// local coords of nodes: localCoords_(isd, ip)
@ -269,7 +269,7 @@ namespace ATC {
/** tolerance used in solving Newton's method for local coordinates */
double tolerance_;
ProjectionGuessType projectionGuess_;
};
@ -290,7 +290,7 @@ namespace ATC {
~FE_ElementHex();
void set_quadrature(FeIntQuadrature type);
void set_quadrature(FeIntQuadrature type);
bool contains_point(const DENS_MAT &eltCoords,
const DENS_VEC &x) const;
@ -312,7 +312,7 @@ namespace ATC {
void write_restart(FILE *);
~FE_ElementRect();
bool local_coordinates(const DENS_MAT &eltCoords,
const DENS_VEC &x,
DENS_VEC &xi) const;
@ -320,7 +320,7 @@ namespace ATC {
protected:
virtual bool contains_point(const DENS_MAT &eltCoords,
const DENS_VEC &x) const;
};
@ -338,10 +338,10 @@ namespace ATC {
// Dump state info to disk for later restart (unimplemented)
void write_restart(FILE *);
~FE_ElementTet();
void set_quadrature(FeIntQuadrature type);
void set_quadrature(FeIntQuadrature type);
bool local_coordinates(const DENS_MAT &eltCoords,
const DENS_VEC &x,

File diff suppressed because it is too large Load Diff

View File

@ -16,36 +16,36 @@
#include "mpi.h"
namespace ATC {
class ATC_Method;
class FE_Element;
class XT_Function;
class KernelFunction;
/**
* @class FE_Engine
* @brief Base class for computing and assembling mass matrix
* @class FE_Engine
* @brief Base class for computing and assembling mass matrix
* and rhs vectors
*/
*/
class FE_Engine{
public:
/** constructor/s */
FE_Engine(MPI_Comm comm);
/** destructor */
~FE_Engine();
/** initialize */
void initialize();
MPI_Comm communicator() {return communicator_;}
void partition_mesh();
void departition_mesh();
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); }
int map_myElem_to_elem(int myElemID) const
int map_myElem_to_elem(int myElemID) const
{ return feMesh_->map_myElem_to_elem(myElemID); }
// note: it is misleading to declare the following const
@ -60,7 +60,7 @@ namespace ATC {
// are more pertinent to other classes (FE_Interpolate,
// for the most part) that it uses temporarily for space/
// time speedups while doing it's computations.
//
//
// I approve of this usage of mutable, but the const/
// non-const member function declaring in this class is
// really all wrong to begin with.
@ -71,7 +71,7 @@ namespace ATC {
/** parser/modifier */
bool modify(int narg, char **arg);
/** finish up */
void finish();
@ -84,11 +84,11 @@ namespace ATC {
/*@{*/
/** these assume the caller is handling the parallel collection */
void initialize_output(int rank, std::string outputPrefix, std::set<int> otypes);
/** write geometry */
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 */
void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=nullptr);
void write_data(double time, OUTPUT_LIST *data);
@ -102,7 +102,7 @@ namespace ATC {
void delete_elements(const std::set<int> &elementList);
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); }
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 */
void compute_mass_matrix(SPAR_MAT &mass_matrix) const;
/** computes a dimensionless mass matrix for the given-quadrature */
void compute_mass_matrix(const DIAG_MAT &weights,
const SPAR_MAT &N,
SPAR_MAT &mass_matrix) const;
/** compute a single dimensionless mass matrix */
void compute_lumped_mass_matrix(DIAG_MAT &lumped_mass_matrix) const;
/** compute lumped mass matrix = diag (\int \rho N_I dV) */
void compute_lumped_mass_matrix(
const Array<FieldName> &mask,
const Array<FieldName> &mask,
const FIELDS &fields,
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
@ -195,7 +195,7 @@ namespace ATC {
/** compute dimensional lumped mass matrix using given quadrature */
void compute_lumped_mass_matrix(
const Array<FieldName> &mask,
const Array<FieldName> &mask,
const FIELDS &fields,
const PhysicsModel *physicsModel,
const Array<std::set<int> > &pointMaterialGroups,
@ -211,7 +211,7 @@ namespace ATC {
const FIELDS &fields,
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
FIELD_MATS &energy,
FIELD_MATS &energy,
const DenseMatrix<bool> *elementMask=nullptr,
const IntegrationDomainType domain=FULL_DOMAIN) const;
@ -250,15 +250,15 @@ namespace ATC {
const FIELDS &fields,
const PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
GRAD_FIELD_MATS &flux,
GRAD_FIELD_MATS &flux,
const DenseMatrix<bool> *elementMask=nullptr) const;
/** 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 PhysicsModel *physicsModel,
const Array<int> &elementMaterials,
const std::set<PAIR> &faceSet,
const std::set<PAIR> &faceSet,
FIELDS &rhs) const;
/** compute the flux on using an L2 interpolation of the flux */
@ -276,21 +276,21 @@ namespace ATC {
const std::set<int> *nodeSet=nullptr) const;
/** 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 SURFACE_SOURCE &sourceFunctions,
const SURFACE_SOURCE &sourceFunctions,
FIELDS &nodalSources) const;
void compute_fluxes(const Array<bool> &fieldMask,
void compute_fluxes(const Array<bool> &fieldMask,
const double time,
const SURFACE_SOURCE &sourceFunctions,
const SURFACE_SOURCE &sourceFunctions,
FIELDS &nodalSources) const
{
SURFACE_SOURCE::const_iterator src_iter;
for (src_iter=sourceFunctions.begin(); src_iter!=sourceFunctions.end(); src_iter++) {
_fieldName_ = src_iter->first;
if (!fieldMask((int)_fieldName_)) continue;
if (nodalSources[_fieldName_].nRows()==0) {
nodalSources[_fieldName_].reset(nNodesUnique_,1);
if (nodalSources[_fieldName_].nRows()==0) {
nodalSources[_fieldName_].reset(nNodesUnique_,1);
}
}
add_fluxes(fieldMask, time, sourceFunctions, nodalSources);
@ -310,7 +310,7 @@ namespace ATC {
SPAR_MAT &tangent) const;
/** compute open flux given a face set */
void add_open_fluxes(const Array2D<bool> &rhsMask,
const FIELDS &fields,
const OPEN_SURFACE &openFaces,
@ -324,13 +324,13 @@ namespace ATC {
const FieldName velocity = ELECTRON_VELOCITY) const;
/** 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 VOLUME_SOURCE &sourceFunctions,
const VOLUME_SOURCE &sourceFunctions,
FIELDS &nodalSources) const;
void add_sources(const Array<bool> &fieldMask,
void add_sources(const Array<bool> &fieldMask,
const double time,
const FIELDS &sources,
const FIELDS &sources,
FIELDS &nodalSources) const;
/** compute surface flux of a nodal field */
@ -356,37 +356,37 @@ namespace ATC {
/*@{*/
/** 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;
/** 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_VEC &dN) const;
/** 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,
SPAR_MAT &N) const;
/** 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,
SPAR_MAT &N,
SPAR_MAT_VEC &dN) const;
SPAR_MAT_VEC &dN) const;
/** 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,
SPAR_MAT_VEC &dN) const;
void shape_functions(const VECTOR &x,
void shape_functions(const VECTOR &x,
DENS_VEC &shp,
Array<int> &node_list) const
{ feMesh_->shape_functions(x,shp,node_list); }
void shape_functions(const VECTOR & x,
DENS_VEC& shp,
DENS_VEC& shp,
DENS_MAT& dshp,
Array<int> &node_list) const
{ feMesh_->shape_functions(x,shp,dshp,node_list); }
@ -405,7 +405,7 @@ namespace ATC {
void shape_functions(const VECTOR &x,
const int eltId,
DENS_VEC &shp,
DENS_VEC &shp,
DENS_MAT &dshp,
Array<int> &node_list) const
{ feMesh_->shape_functions(x,eltId,shp,dshp,node_list); }
@ -425,21 +425,21 @@ namespace ATC {
/** \name nodeset */
//----------------------------------------------------------------
/** 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); }
//----------------------------------------------------------------
/** \name accessors */
//----------------------------------------------------------------
/*@{*/
/** even though these are pass-throughs there is a necessary
/** even though these are pass-throughs there is a necessary
* translation */
/** return number of unique nodes */
int num_nodes() const { return feMesh_->num_nodes_unique(); }
/** return number of total nodes */
int nNodesTotal() const { return feMesh_->num_nodes(); }
/** return number of elements */
int num_elements() const { return feMesh_->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(); }
/** return element connectivity */
void element_connectivity(const int eltID,
void element_connectivity(const int eltID,
Array<int> & nodes) const
{ feMesh_->element_connectivity_unique(eltID, nodes); }
/** return face connectivity */
void face_connectivity(const PAIR &faceID,
void face_connectivity(const PAIR &faceID,
Array<int> &nodes) const
{ feMesh_->face_connectivity_unique(faceID, nodes); }
/** in lieu of pass-throughs const accessors ... */
/** return const ptr to mesh */
const FE_Mesh* fe_mesh() const { return feMesh_; }
/** return number of spatial dimensions */
int nsd() const { return feMesh_->num_spatial_dimensions(); }
/** return if the FE mesh has been created */
int has_mesh() const { return feMesh_!=nullptr; }
/** get nodal coordinates for a given element */
void element_coordinates(const int eltIdx, DENS_MAT &coords)
{ feMesh_->element_coordinates(eltIdx,coords); }
/** 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)
{ feMesh_->element_field(eltIdx, field, local_field); }
/** access list of elements to be deleted */
const std::set<int> &null_elements(void) const
{ return nullElements_; }
{ return nullElements_; }
/** access to the amended nodal coordinate values */
const DENS_MAT &nodal_coordinates(void) const
const DENS_MAT &nodal_coordinates(void) const
{ return (*feMesh_->coordinates()); }
/** map global node numbering to unique node numbering for
/** map global node numbering to unique node numbering for
* 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); }
int number_of_global_nodes(void) const { return nNodes_; }
/*@}*/
/** set kernel */
void set_kernel(KernelFunction* ptr);
KernelFunction *kernel(int /* i */) { return kernelFunction_; }
KernelFunction *kernel() { return kernelFunction_; }
@ -512,8 +512,8 @@ namespace ATC {
/** auxiliary kernel function */
KernelFunction *kernelFunction_;
/** initialized flag */
/** initialized flag */
bool initialized_;
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;
/** create a uniform, structured mesh */
void create_mesh(Array<double> &dx,
Array<double> &dy,
Array<double> &dz,
void create_mesh(Array<double> &dx,
Array<double> &dy,
Array<double> &dz,
const char *regionName,
Array<bool> periodic);
void create_mesh(int nx, int ny, int nz,
void create_mesh(int nx, int ny, int nz,
const char *regionName,
Array<bool> periodic);
@ -537,11 +537,11 @@ namespace ATC {
/** data that can be used for a subset of original mesh */
std::set<int> nullElements_;
/** faces upon which nodes are duplicated */
std::set<PAIR> cutFaces_;
std::set<int> cutEdge_;
/** workspace */
int nNodesPerElement_;
int nSD_;
@ -551,9 +551,9 @@ namespace ATC {
mutable int nIPsPerElement_;
mutable int nIPsPerFace_;
mutable FeIntQuadrature quadrature_;
mutable FIELDS::const_iterator _fieldItr_;
mutable FIELDS::const_iterator _fieldItr_;
mutable FieldName _fieldName_;
/** sized arrays */
mutable DIAG_MAT _weights_;
mutable DENS_MAT _N_, _Nw_;
@ -565,14 +565,14 @@ namespace ATC {
/** unsized arrays */
mutable DENS_MAT _Nmat_;
mutable FIELD_MATS _fieldsAtIPs_;
mutable GRAD_FIELD_MATS _gradFieldsAtIPs_;
mutable GRAD_FIELD_MATS _gradFieldsAtIPs_;
mutable DENS_MAT _Nfluxes_;
mutable AliasArray<int> _conn_;
mutable DENS_MAT_VEC _Bfluxes_;
/** output object */
OutputManager outputManager_;
};
}; // end namespace ATC

View File

@ -31,7 +31,7 @@ namespace ATC {
}
void FE_Interpolate::set_quadrature(FeEltGeometry geo,
FeIntQuadrature quad)
FeIntQuadrature quad)
{
if (feQuadList_.count(quad) == 0) {
feQuad_ = new FE_Quadrature(geo,quad);
@ -47,7 +47,7 @@ namespace ATC {
int numEltNodes = feElement_->num_elt_nodes();
int numFaces = feElement_->num_faces();
int numFaceNodes = feElement_->num_face_nodes();
int numIPs = feQuad_->numIPs;
DENS_MAT &ipCoords = feQuad_->ipCoords;
int numFaceIPs = feQuad_->numFaceIPs;
@ -79,7 +79,7 @@ namespace ATC {
compute_N_dNdr(thisIP,thisN,thisdNdr);
}
}
// Compute 2D face shape function derivatives
dNdrFace2D_.assign(numFaceIPs,DENS_MAT(nSD_-1,numFaceNodes));
for (int ip = 0; ip < numFaceIPs; ip++) {
@ -111,14 +111,14 @@ namespace ATC {
N.resize(numEltNodes);
DENS_MAT dNdr(nSD_,numEltNodes,false);
compute_N_dNdr(xi,N,dNdr);
DENS_MAT eltCoordsT = transpose(eltCoords);
DENS_MAT dxdr, drdx;
dxdr = dNdr*eltCoordsT;
drdx = inv(dxdr);
dNdx = drdx*dNdr;
}
}
void FE_Interpolate::shape_function_derivatives(const DENS_MAT &eltCoords,
const VECTOR &xi,
@ -126,16 +126,16 @@ namespace ATC {
{
int numEltNodes = feElement_->num_elt_nodes();
DENS_MAT dNdr(nSD_,numEltNodes,false);
DENS_VEC N(numEltNodes);
DENS_VEC N(numEltNodes);
compute_N_dNdr(xi,N,dNdr);
DENS_MAT eltCoordsT = transpose(eltCoords);
DENS_MAT dxdr, drdx;
dxdr = dNdr*eltCoordsT; // tangents or Jacobian matrix
drdx = inv(dxdr);
dNdx = drdx*dNdr; // dN/dx = dN/dxi (dx/dxi)^-1
}
}
void FE_Interpolate::tangents(const DENS_MAT &eltCoords,
const VECTOR &xi,
@ -143,15 +143,15 @@ namespace ATC {
{
int numEltNodes = feElement_->num_elt_nodes();
DENS_MAT dNdr(nSD_,numEltNodes,false);
DENS_VEC N(numEltNodes);
DENS_VEC N(numEltNodes);
compute_N_dNdr(xi,N,dNdr);
//dNdr.print("dNdr");
DENS_MAT eltCoordsT = transpose(eltCoords);
//eltCoordsT.print("elt coords");
dxdr = dNdr*eltCoordsT;
//dxdr.print("dxdr");
}
}
void FE_Interpolate::tangents(const DENS_MAT &eltCoords,
const VECTOR &xi,
@ -162,7 +162,7 @@ namespace ATC {
tangents(eltCoords,xi,dxdr);
//dxdr.print("dxdr-post");
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) {
dxdxi[i].resize(nSD_);
for (int j = 0; j < nSD_; ++j) {
@ -192,7 +192,7 @@ namespace ATC {
DIAG_MAT &weights)
{
int numEltNodes = feElement_->num_elt_nodes();
// Transpose eltCoords
DENS_MAT eltCoordsT(transpose(eltCoords));
@ -201,7 +201,7 @@ namespace ATC {
// Set sizes of matrices and vectors
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);
weights.resize(feQuad_->numIPs,feQuad_->numIPs);
@ -218,7 +218,7 @@ namespace ATC {
// Compute dNdx and fill dN matrix
dNdx = drdx * dNdr_[ip];
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);
// 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));
// 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
weights(ip,ip) = feQuad_->ipFaceWeights(ip)*J;
weights(ip,ip) = feQuad_->ipFaceWeights(ip)*J;
}
}
void FE_Interpolate::face_shape_function(const DENS_MAT &eltCoords,
@ -323,9 +323,9 @@ namespace ATC {
}
// 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,
int ip,
DENS_VEC &normal)
DENS_VEC &normal)
{
// Compute dx/dr for deformed element
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);
// Jacobian (3D)
double J = sqrt(normal(0)*normal(0) +
normal(1)*normal(1) +
double J = sqrt(normal(0)*normal(0) +
normal(1)*normal(1) +
normal(2)*normal(2));
double invJ = 1.0/J;
normal(0) *= invJ;
@ -354,24 +354,24 @@ namespace ATC {
normal(2) *= invJ;
return J;
}
int FE_Interpolate::num_ips() const
{
return feQuad_->numIPs;
{
return feQuad_->numIPs;
}
int FE_Interpolate::num_face_ips() const
{
return feQuad_->numFaceIPs;
{
return feQuad_->numFaceIPs;
}
/*********************************************************
* Class FE_InterpolateCartLagrange
*
* For computing Lagrange shape functions using Cartesian
* 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
* should be implemented for SPEED.
*
@ -395,7 +395,7 @@ namespace ATC {
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
int numEltNodes = feElement_->num_elt_nodes();
int numEltNodes1d = feElement_->num_elt_nodes_1d();
DENS_MAT lagrangeTerms(nSD_,numEltNodes1d);
DENS_MAT lagrangeDenom(nSD_,numEltNodes1d);
lagrangeTerms = 1.0;
@ -404,7 +404,7 @@ namespace ATC {
for (int inode = 0; inode < numEltNodes1d; ++inode) {
for (int icont = 0; icont < numEltNodes1d; ++icont) {
if (inode != icont) {
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
localCoords1d(icont));
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
}
@ -439,7 +439,7 @@ namespace ATC {
// *** see comments for compute_N_dNdr ***
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
int numEltNodes1d = feElement_->num_elt_nodes_1d();
DENS_MAT lagrangeTerms(nD,numEltNodes1d);
DENS_MAT lagrangeDenom(nD,numEltNodes1d);
DENS_MAT lagrangeDeriv(nD,numEltNodes1d);
@ -453,7 +453,7 @@ namespace ATC {
for (int icont = 0; icont < numEltNodes1d; ++icont) {
if (inode != icont) {
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
localCoords1d(icont));
for (int dcont=0; dcont<numEltNodes1d; ++dcont) {
if (inode == dcont) {
@ -477,7 +477,7 @@ namespace ATC {
lagrangeDeriv(iSD,inode) /= lagrangeDenom(iSD,inode);
}
}
dNdr = 1.0;
vector<int> mapping(nD);
for (int inode=0; inode<numNodes; ++inode) {
@ -502,7 +502,7 @@ namespace ATC {
const DENS_VEC &localCoords1d = feElement_->local_coords_1d();
int numEltNodes = feElement_->num_elt_nodes();
int numEltNodes1d = feElement_->num_elt_nodes_1d();
// lagrangeTerms stores the numerator for the various Lagrange polynomials
// in one dimension, that will be used to produce the three dimensional
// shape functions
@ -526,13 +526,13 @@ namespace ATC {
for (int inode = 0; inode < numEltNodes1d; ++inode) {
for (int icont = 0; icont < numEltNodes1d; ++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
lagrangeTerms(iSD,inode) *= (point(iSD)-localCoords1d(icont));
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
lagrangeDenom(iSD,inode) *= (localCoords1d(inode) -
localCoords1d(icont));
// 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
for (int dcont=0; dcont<numEltNodes1d; ++dcont) {
if (inode == dcont) {
@ -561,7 +561,7 @@ namespace ATC {
lagrangeDeriv(iSD,inode) /= lagrangeDenom(iSD,inode);
}
}
N = 1.0;
dNdr = 1.0;
// 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
* coordinate systems (all quads/hexes fall under this
* category, and any elements derived by degenerating
* category, and any elements derived by degenerating
* them).
*
*********************************************************/
@ -604,7 +604,7 @@ namespace ATC {
{
// Handled by base class
}
void FE_InterpolateCartLin::compute_N(const VECTOR &point,
VECTOR &N)
{
@ -612,7 +612,7 @@ namespace ATC {
const DENS_MAT &localCoords = feElement_->local_coords();
double invVol = 1.0/(feElement_->vol());
int numEltNodes = feElement_->num_elt_nodes();
for (int inode = 0; inode < numEltNodes; ++inode) {
N(inode) = invVol;
for (int isd = 0; isd < nSD_; ++isd) {
@ -633,7 +633,7 @@ namespace ATC {
// *** see comments for compute_N_dNdr ***
const DENS_MAT &localCoords = feElement_->local_coords();
double invVol = 1.0/vol;
for (int inode = 0; inode < numNodes; ++inode) {
for (int idr = 0; idr < nD; ++idr) {
dNdr(idr,inode) = invVol;
@ -641,7 +641,7 @@ namespace ATC {
for (int id = 0; id < nD; ++id) {
for (int idr = 0; idr < nD; ++idr) {
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);
}
}
@ -656,7 +656,7 @@ namespace ATC {
const DENS_MAT &localCoords = feElement_->local_coords();
double invVol = 1.0/(feElement_->vol());
int numEltNodes = feElement_->num_elt_nodes();
// Fill in for each node
for (int inode = 0; inode < numEltNodes; ++inode) {
// Intiialize shape function and derivatives
@ -670,20 +670,20 @@ namespace ATC {
// One term for each dimension, only deriv in deriv's dimension
for (int idr = 0; idr < nSD_; ++idr) {
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);
}
}
}
}
/*********************************************************
* Class FE_InterpolateCartSerendipity
*
* For computing shape functions for quadratic serendipity
* elements, implemented for SPEED.
*
*
*********************************************************/
FE_InterpolateCartSerendipity::FE_InterpolateCartSerendipity(
FE_Element *feElement)
@ -696,7 +696,7 @@ namespace ATC {
{
// Handled by base class
}
void FE_InterpolateCartSerendipity::compute_N(const VECTOR &point,
VECTOR &N)
{
@ -704,14 +704,14 @@ namespace ATC {
const DENS_MAT &localCoords = feElement_->local_coords();
double invVol = 1.0/(feElement_->vol());
int numEltNodes = feElement_->num_elt_nodes();
for (int inode = 0; inode < numEltNodes; ++inode) {
N(inode) = invVol;
for (int isd = 0; isd < nSD_; ++isd) {
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
(isd == 0)) ||
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
(isd == 0)) ||
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
(isd == 1)) ||
(isd == 1)) ||
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
(isd == 2))) {
N(inode) *= (1.0 - pow(point(isd),2))*2;
@ -742,7 +742,7 @@ namespace ATC {
bool serendipityNode = false;
double productRule1 = 0.0;
double productRule2 = 0.0;
if (nD != 3 && nD != 2) {
ATC_Error("Serendipity dNdr calculations are too hard-wired to do "
"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
if (nD == 3) {
serendipityNode =
(((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
(id == 0)) ||
(((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
(id == 0)) ||
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
(id == 1)) ||
(id == 1)) ||
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
(id == 2)));
} else if (nD == 2) {
serendipityNode =
(((inode == 4 || inode == 6) && (id == 0)) ||
(((inode == 4 || inode == 6) && (id == 0)) ||
((inode == 5 || inode == 7) && (id == 1)));
}
if (serendipityNode) {
@ -794,7 +794,7 @@ namespace ATC {
productRule2 = (point(0)*localCoords(0,inode) +
point(1)*localCoords(1,inode) - 1);
}
productRule1 = dNdr(idr,inode) *
productRule1 = dNdr(idr,inode) *
(1 + point(idr)*localCoords(idr,inode));
productRule2 *= dNdr(idr,inode);
dNdr(idr,inode) = productRule1 + productRule2;
@ -830,17 +830,17 @@ namespace ATC {
// "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
// shape functions and derivatives in a modified way:
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
(isd == 0)) ||
if (((inode == 8 || inode == 10 || inode == 16 || inode == 18) &&
(isd == 0)) ||
((inode == 9 || inode == 11 || inode == 17 || inode == 19) &&
(isd == 1)) ||
(isd == 1)) ||
((inode == 12 || inode == 13 || inode == 14 || inode == 15) &&
(isd == 2))) {
// If the 1d shape function dimension matches the derivative
// dimension...
if (isd == idr) {
// 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
N(inode) *= (1.0 - pow(point(isd),2))*2;
// contribute to dNdr with the derivative of this shape function
@ -869,7 +869,7 @@ namespace ATC {
}
for (int idr = 0; idr < nSD_; ++idr) {
if (inode < 8) {
productRule1 = dNdr(idr,inode) *
productRule1 = dNdr(idr,inode) *
(1 + point(idr)*localCoords(idr,inode));
productRule2 = dNdr(idr,inode) * (point(0)*localCoords(0,inode) +
point(1)*localCoords(1,inode) +
@ -883,7 +883,7 @@ namespace ATC {
/*********************************************************
* Class FE_InterpolateSimpLin
*
*
* For computing linear shape functions of simplices,
* which are rather different from those computed
* in Cartesian coordinates.
@ -895,7 +895,7 @@ namespace ATC {
*
*********************************************************/
FE_InterpolateSimpLin::FE_InterpolateSimpLin(
FE_Element *feElement)
FE_Element *feElement)
: FE_Interpolate(feElement)
{
set_quadrature(TETRA,GAUSS2);
@ -910,7 +910,7 @@ namespace ATC {
VECTOR &N)
{
int numEltNodes = feElement_->num_elt_nodes();
// Fill in for each node
for (int inode = 0; inode < numEltNodes; ++inode) {
if (inode == 0) {
@ -948,7 +948,7 @@ namespace ATC {
// (which map to x, y, and z). Therefore, the derivative in
// 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.
for (int idr = 0; idr < nD; ++idr) {
if (inode == 0) {
@ -965,7 +965,7 @@ namespace ATC {
DENS_MAT &dNdr) const
{
int numEltNodes = feElement_->num_elt_nodes();
// Fill in for each node
for (int inode = 0; inode < numEltNodes; ++inode) {
// Fill N...

View File

@ -22,7 +22,7 @@ namespace ATC {
FE_Interpolate(FE_Element *feElement);
virtual ~FE_Interpolate();
/** compute the quadrature for a given element type */
void set_quadrature(FeEltGeometry geo, FeIntQuadrature quad);
@ -30,14 +30,14 @@ namespace ATC {
* quadrature */
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 */
virtual void compute_N(const VECTOR &point,
VECTOR &N) = 0;
// middle args get no names because they won't be used by some
// 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 */
virtual void compute_dNdr(const VECTOR &point,
const int,
@ -51,7 +51,7 @@ namespace ATC {
VECTOR &N,
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:
* indexed: N(node)
* dN[nsd](node) */
@ -72,7 +72,7 @@ namespace ATC {
* weights(ip) */
virtual void shape_function(const DENS_MAT &eltCoords,
DENS_MAT &N,
std::vector<DENS_MAT> &dN,
std::vector<DENS_MAT> &dN,
DIAG_MAT &weights);
/** compute shape functions at all face ip's:
@ -132,7 +132,7 @@ namespace ATC {
// matrix of shape functions at ip's: N_(ip, node)
DENS_MAT N_;
std::vector<DENS_MAT> dNdr_;
// matrix of shape functions at ip's: N_(ip, node)
@ -160,7 +160,7 @@ namespace ATC {
virtual void compute_N(const VECTOR &point,
VECTOR &N);
virtual void compute_dNdr(const VECTOR &point,
const int numNodes,
const int nD,
@ -187,7 +187,7 @@ namespace ATC {
virtual void compute_N(const VECTOR &point,
VECTOR &N);
virtual void compute_dNdr(const VECTOR &point,
const int numNodes,
const int nD,
@ -214,7 +214,7 @@ namespace ATC {
virtual void compute_N(const VECTOR &point,
VECTOR &N);
virtual void compute_dNdr(const VECTOR &point,
const int numNodes,
const int nD,
@ -242,7 +242,7 @@ namespace ATC {
virtual void compute_N(const VECTOR &point,
VECTOR &N);
// middle args get no names because they won't be used by some
// child classes.
virtual void compute_dNdr(const VECTOR &,

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ namespace ATC {
/** constructor */
FE_Mesh();
/** destructor */
virtual ~FE_Mesh();
@ -65,41 +65,41 @@ namespace ATC {
/** evaluate shape function at real coordinates */
void position(const int elem,
const VECTOR &xi,
const VECTOR &xi,
DENS_VEC &x) const;
/** evaluate shape function at real coordinates */
void shape_functions(const VECTOR &x,
void shape_functions(const VECTOR &x,
DENS_VEC &N,
Array<int> &nodeList) const;
/** evaluate shape function at real coordinates */
void shape_functions(const VECTOR &x,
void shape_functions(const VECTOR &x,
DENS_VEC &N,
Array<int> &nodeList,
const Array<bool> &) const;
/** evaluate shape function at real coordinates */
void shape_functions(const DENS_VEC &x,
void shape_functions(const DENS_VEC &x,
DENS_VEC &N,
DENS_MAT &dNdx,
Array<int> &nodeList) const;
/** evaluate shape function at real coordinates */
void shape_functions(const VECTOR &x,
void shape_functions(const VECTOR &x,
const int eltID,
DENS_VEC &N,
Array<int> &nodeList) const;
/** evaluate shape function at real coordinates */
void shape_functions(const DENS_VEC &x,
void shape_functions(const DENS_VEC &x,
const int eltID,
DENS_VEC &N,
DENS_MAT &dNdx,
Array<int> &nodeList) const;
/** 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,
DENS_MAT &dNdx,
Array<int> &nodeList) const;
@ -176,7 +176,7 @@ namespace ATC {
}
}
/**
/**
* return spatial coordinates for element nodes on eltID,
* indexed xCoords(isd,inode)
*/
@ -199,21 +199,21 @@ namespace ATC {
virtual int map_to_element(const DENS_VEC &x) const = 0;
/** 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);
}
inline const Array<int>& global_to_unique_map(void) const
inline const Array<int>& global_to_unique_map(void) const
{
return globalToUniqueMap_;
}
/** 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);
}
inline const Array<int>& unique_to_global_map(void) const
inline const Array<int>& unique_to_global_map(void) const
{
return uniqueToGlobalMap_;
}
@ -248,43 +248,43 @@ namespace ATC {
/** 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;
/** 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;
/** 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;
/** 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;
/** 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;
void elementset_complement(const std::set<int> &elemSet,
void elementset_complement(const std::set<int> &elemSet,
std::set<int> &elemSetComplement) const;
/** 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;
void elementset_to_nodeset(const std::string &name,
void elementset_to_nodeset(const std::string &name,
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> elementset_to_nodeset(const std::string &name) const;
/** 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;
void faceset_to_nodeset(const std::set<PAIR> &faceSet,
void faceset_to_nodeset(const std::set<PAIR> &faceSet,
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;
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;
/** get face set from the string name assigned to the set */
@ -294,7 +294,7 @@ namespace ATC {
void create_faceset(const std::string & name,
double xmin, double xmax,
double ymin, double ymax,
double zmin, double zmax,
double zmin, double zmax,
bool outward);
/** create face set with tag "name" from faces aligned with plane */
void create_faceset(const std::string & name, double x, int idir, int isgn,
@ -303,7 +303,7 @@ namespace ATC {
/** cut mesh */
virtual void cut_mesh(const std::set<PAIR> & faceSet, const std::set<int> & nodeSet) = 0;
/** delete elements */
virtual void delete_elements(const std::set<int> & elementList) = 0;
@ -330,10 +330,10 @@ namespace ATC {
/** return number of faces per element */
int num_faces_per_element() const;
/** return number of nodes per face */
int num_nodes_per_face() const;
/** return number of integration points per face */
int num_ips_per_face() const;
@ -341,7 +341,7 @@ namespace ATC {
when mesh is not partitioned. */
Array2D<int> * connectivity(void) { return &connectivity_; }
/** return a pointer to the connectivity */
DENS_MAT * coordinates(void) { return &nodalCoords_;}
DENS_MAT * coordinates(void) { return &nodalCoords_;}
/** Engine nodeMap stuff */
Array<int> *node_map(void) { return &globalToUniqueMap_;}
@ -353,19 +353,19 @@ namespace ATC {
/** local face connectivity */
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 */
virtual void element_size(const int ielem,
double & hx, double & hy, double & hz);
virtual void bounding_box(const int ielem,
DENS_VEC & xmin, DENS_VEC & xmax);
/** 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,
DENS_MAT &local_field)
{
@ -387,25 +387,25 @@ namespace ATC {
virtual double coordinate_tolerance(void) const {return 1.e-8;}
/** element type */
std::string element_type(void) const ;
std::string element_type(void) const ;
/** output mesh subsets */
void output(std::string prefix) const;
void output(std::string prefix) const;
/* Parallelization data members */
/** return element vector for this processor */
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_; }
bool is_owned_elt(int elt) const;
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]);
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);
/** will this mesh use data decomposition? */
@ -488,9 +488,9 @@ namespace ATC {
/** maps between my IDs and the total IDs */
std::map<int,int> elemToMyElemMap_;
/** Lists of ghost nodes/neighbor ghost nodes */
std::vector<int> ghostNodesL_;
std::vector<int> ghostNodesL_;
std::vector<int> ghostNodesR_;
std::vector<int> shareNodesL_;
std::vector<int> shareNodesR_;
@ -509,11 +509,11 @@ namespace ATC {
class FE_3DMesh : public FE_Mesh {
public:
/** constructor */
FE_3DMesh(){};
FE_3DMesh(){};
/** constructor for read-in mesh **/
// 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 nElements,
const Array2D<int> *connectivity,
@ -532,34 +532,34 @@ namespace ATC {
/** Removes duplicate elements that appear in more than one vector
within procEltLists. **/
void prune_duplicate_elements(std::vector<std::vector<int> > &procEltLists,
void prune_duplicate_elements(std::vector<std::vector<int> > &procEltLists,
int *eltToOwners);
/** Takes procEltLists, and if there are more than nProcs of them
it takes the extra elements and distributes them to other vectors
in procEltLists. */
// processors if during pruning processors end up
// elementless. This is slightly complicated because of
// ghost nodes.
void redistribute_extra_proclists(std::vector<std::vector<int> > &procEltLists,
int *eltToOwners, int nProcs);
/** This takes in a dense matrix and a list of elements
and fills in a standard adjacency list (within the matrix)
for those elements. **/
// the set intersection, which does redundant computations
// right now, and filling in the adjacencies for both elements
// 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);
/** Counts the number of nonempty vectors in a vector of vectors. **/
int numNonempty(std::vector<std::vector<int> > &v);
/** In the partitioning, we want to sort vectors of integers by size,
and furthermore we want empty vectors to count as the "largest"
/** In the partitioning, we want to sort vectors of integers by size,
and furthermore we want empty vectors to count as the "largest"
possible vector because they dont want to count in the minimum. **/
struct vectorComparer {
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,
const std::set<int> &nodeSet);
virtual void delete_elements(const std::set<int> &elementSet);
/** map spatial location to element */
virtual int map_to_element(const DENS_VEC &x) const;
/** sends out data to processors during partitioning */
void distribute_mesh_data();
protected:
@ -610,18 +610,18 @@ namespace ATC {
/**
* @class FE_Rectangular3DMesh
* @brief Derived class for a structured mesh with
* variable element sizes in x, y, and z directions
* @brief Derived class for a structured mesh with
* variable element sizes in x, y, and z directions
*/
class FE_Rectangular3DMesh : public FE_3DMesh {
public:
/** constructor */
FE_Rectangular3DMesh(){};
FE_Rectangular3DMesh(){};
FE_Rectangular3DMesh(
const Array<double> & hx,
const Array<double> & hy,
const Array<double> & hz,
const double xmin, const double xmax,
const double xmin, const double xmax,
const double ymin, const double ymax,
const double zmin, const double zmax,
const Array<bool> periodicity,
@ -631,13 +631,13 @@ namespace ATC {
/** destructor */
virtual ~FE_Rectangular3DMesh() {};
void partition_mesh(void);
void departition_mesh(void);
/** 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:
@ -650,7 +650,7 @@ namespace ATC {
/** Region size in each direction */
double L_[3];
/** create global-to-unique node mapping */
virtual void setup_periodicity(); // note no "tol"
@ -665,11 +665,11 @@ namespace ATC {
/**
* @class FE_Uniform3DMesh
* @brief Derived class for a uniform structured mesh with
* fixed element sizes in x, y, and z directions
* @brief Derived class for a uniform structured mesh with
* fixed element sizes in x, y, and z directions
*/
class FE_Uniform3DMesh : public FE_Rectangular3DMesh {
public:
/** constructor */
@ -690,8 +690,8 @@ namespace ATC {
void partition_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)
{ 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])); }
/** 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
/** Element size in each direction */

View File

@ -39,27 +39,27 @@ namespace ATC {
ipFaceWeights.reset(numFaceIPs);
// "Matrix" of integration point location
ipCoords(0,0) = 0.0;
ipCoords(1,0) = 0.0;
ipCoords(0,0) = 0.0;
ipCoords(1,0) = 0.0;
ipCoords(2,0) = 0.0;
// Integration point for each face
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](0,0) = -1.0; ipFaceCoords[3](0,0) = 0.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[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](0,0) = 1.0; ipFaceCoords[4](0,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[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;
// 2D integration scheme for the faces
ipFace2DCoords(0,0) = 0.0;
ipFace2DCoords(0,0) = 0.0;
ipFace2DCoords(1,0) = 0.0;
// Integration point weights
ipWeights = 8.0;
@ -85,41 +85,41 @@ namespace ATC {
// Dictates difference in node locations for nodal/GAUSS2
double a = 1.0/sqrt(3.0);
if (quad == NODAL) a = 1.0;
// Matrix of integration point locations & follows local
// Matrix of integration point locations & follows local
// conn
ipCoords(0,0) = -a; ipCoords(0,4) = -a;
ipCoords(1,0) = -a; ipCoords(1,4) = -a;
ipCoords(0,0) = -a; ipCoords(0,4) = -a;
ipCoords(1,0) = -a; ipCoords(1,4) = -a;
ipCoords(2,0) = -a; ipCoords(2,4) = a;
//
ipCoords(0,1) = a; ipCoords(0,5) = a;
ipCoords(1,1) = -a; ipCoords(1,5) = -a;
ipCoords(0,1) = a; ipCoords(0,5) = a;
ipCoords(1,1) = -a; ipCoords(1,5) = -a;
ipCoords(2,1) = -a; ipCoords(2,5) = a;
//
ipCoords(0,2) = a; ipCoords(0,6) = a;
ipCoords(1,2) = a; ipCoords(1,6) = a;
ipCoords(0,2) = a; ipCoords(0,6) = a;
ipCoords(1,2) = a; ipCoords(1,6) = a;
ipCoords(2,2) = -a; ipCoords(2,6) = a;
//
ipCoords(0,3) = -a; ipCoords(0,7) = -a;
ipCoords(1,3) = a; ipCoords(1,7) = a;
ipCoords(0,3) = -a; ipCoords(0,7) = -a;
ipCoords(1,3) = a; ipCoords(1,7) = a;
ipCoords(2,3) = -a; ipCoords(2,7) = a;
// Integration points by face
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
ipFaceCoords[0](2,0) = -a; ipFaceCoords[3](2,0) = -a;
//
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = a;
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = -a;
//
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
//
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = -a;
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = a;
//
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = a;
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = -a;
//
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
//
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = -a;
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = a;
ipFaceCoords[1](0,0) = 1; ipFaceCoords[4](0,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](1,3) = -a; ipFaceCoords[4](1,3) = a;
ipFaceCoords[1](2,3) = a; ipFaceCoords[4](2,3) = -1;
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
ipFaceCoords[2](2,0) = -a; ipFaceCoords[5](2,0) = 1;
//
ipFaceCoords[2](0,1) = a; ipFaceCoords[5](0,1) = a;
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
ipFaceCoords[2](2,1) = -a; ipFaceCoords[5](2,1) = 1;
//
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
//
ipFaceCoords[2](0,3) = -a; ipFaceCoords[5](0,3) = -a;
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
ipFaceCoords[2](2,3) = a; ipFaceCoords[5](2,3) = 1;
// Integration points for all faces ignoring the
//
ipFaceCoords[2](0,1) = a; ipFaceCoords[5](0,1) = a;
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
ipFaceCoords[2](2,1) = -a; ipFaceCoords[5](2,1) = 1;
//
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
//
ipFaceCoords[2](0,3) = -a; ipFaceCoords[5](0,3) = -a;
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
ipFaceCoords[2](2,3) = a; ipFaceCoords[5](2,3) = 1;
// Integration points for all faces ignoring the
// redundant dim
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
//
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
//
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
// Integration point weights
ipWeights = 1.0;
@ -185,36 +185,36 @@ namespace ATC {
// Use GAUSS2 for faces for now...
double a = 1.0/sqrt(3.0);
// Matrix of integration point locations
ipCoords(0,0) = 1.0; ipCoords(0,3) = 0.0;
ipCoords(1,0) = 0.0; ipCoords(1,3) = -1.0;
// Matrix of integration point locations
ipCoords(0,0) = 1.0; ipCoords(0,3) = 0.0;
ipCoords(1,0) = 0.0; ipCoords(1,3) = -1.0;
ipCoords(2,0) = 0.0; ipCoords(2,3) = 0.0;
//
ipCoords(0,1) = -1.0; ipCoords(0,4) = 0.0;
ipCoords(1,1) = 0.0; ipCoords(1,4) = 0.0;
//
ipCoords(0,1) = -1.0; ipCoords(0,4) = 0.0;
ipCoords(1,1) = 0.0; ipCoords(1,4) = 0.0;
ipCoords(2,1) = 0.0; ipCoords(2,4) = 1.0;
//
ipCoords(0,2) = 0.0; ipCoords(0,5) = 0.0;
ipCoords(1,2) = 1.0; ipCoords(1,5) = 0.0;
//
ipCoords(0,2) = 0.0; ipCoords(0,5) = 0.0;
ipCoords(1,2) = 1.0; ipCoords(1,5) = 0.0;
ipCoords(2,2) = 0.0; ipCoords(2,5) = -1.0;
// Integration points by face
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
ipFaceCoords[0](0,0) = -1; ipFaceCoords[3](0,0) = -a;
ipFaceCoords[0](1,0) = -a; ipFaceCoords[3](1,0) = 1;
ipFaceCoords[0](2,0) = -a; ipFaceCoords[3](2,0) = -a;
//
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = -a;
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = a;
//
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
//
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = a;
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = -a;
//
ipFaceCoords[0](0,1) = -1; ipFaceCoords[3](0,1) = -a;
ipFaceCoords[0](1,1) = a; ipFaceCoords[3](1,1) = 1;
ipFaceCoords[0](2,1) = -a; ipFaceCoords[3](2,1) = a;
//
ipFaceCoords[0](0,2) = -1; ipFaceCoords[3](0,2) = a;
ipFaceCoords[0](1,2) = a; ipFaceCoords[3](1,2) = 1;
ipFaceCoords[0](2,2) = a; ipFaceCoords[3](2,2) = a;
//
ipFaceCoords[0](0,3) = -1; ipFaceCoords[3](0,3) = a;
ipFaceCoords[0](1,3) = -a; ipFaceCoords[3](1,3) = 1;
ipFaceCoords[0](2,3) = a; ipFaceCoords[3](2,3) = -a;
ipFaceCoords[1](0,0) = 1; ipFaceCoords[4](0,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](1,3) = -a; ipFaceCoords[4](1,3) = a;
ipFaceCoords[1](2,3) = a; ipFaceCoords[4](2,3) = -1;
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
ipFaceCoords[2](0,0) = -a; ipFaceCoords[5](0,0) = -a;
ipFaceCoords[2](1,0) = -1; ipFaceCoords[5](1,0) = -a;
ipFaceCoords[2](2,0) = -a; ipFaceCoords[5](2,0) = 1;
//
ipFaceCoords[2](0,1) = -a; ipFaceCoords[5](0,1) = a;
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
ipFaceCoords[2](2,1) = a; ipFaceCoords[5](2,1) = 1;
//
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
//
ipFaceCoords[2](0,3) = a; ipFaceCoords[5](0,3) = -a;
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
ipFaceCoords[2](2,3) = -a; ipFaceCoords[5](2,3) = 1;
// Integration points for all faces ignoring the
//
ipFaceCoords[2](0,1) = -a; ipFaceCoords[5](0,1) = a;
ipFaceCoords[2](1,1) = -1; ipFaceCoords[5](1,1) = -a;
ipFaceCoords[2](2,1) = a; ipFaceCoords[5](2,1) = 1;
//
ipFaceCoords[2](0,2) = a; ipFaceCoords[5](0,2) = a;
ipFaceCoords[2](1,2) = -1; ipFaceCoords[5](1,2) = a;
ipFaceCoords[2](2,2) = a; ipFaceCoords[5](2,2) = 1;
//
ipFaceCoords[2](0,3) = a; ipFaceCoords[5](0,3) = -a;
ipFaceCoords[2](1,3) = -1; ipFaceCoords[5](1,3) = a;
ipFaceCoords[2](2,3) = -a; ipFaceCoords[5](2,3) = 1;
// Integration points for all faces ignoring the
// redundant dim
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
//
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,2) = a;
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,2) = a;
//
ipFace2DCoords(0,1) = a; ipFace2DCoords(0,3) = -a;
ipFace2DCoords(1,1) = -a; ipFace2DCoords(1,3) = a;
// Integration point weights
ipWeights = 4.0/3.0;
@ -278,166 +278,166 @@ namespace ATC {
ipFaceWeights.reset(numFaceIPs);
double a = sqrt(3.0/5.0);
// Matrix of integration point locations & follows local
// Matrix of integration point locations & follows local
// conn
ipCoords(0,0) = -a; ipCoords(0,16) = -a;
ipCoords(1,0) = -a; ipCoords(1,16) = -a;
ipCoords(0,0) = -a; ipCoords(0,16) = -a;
ipCoords(1,0) = -a; ipCoords(1,16) = -a;
ipCoords(2,0) = -a; ipCoords(2,16) = 0;
//
ipCoords(0,1) = a; ipCoords(0,17) = -a;
ipCoords(1,1) = -a; ipCoords(1,17) = a;
//
ipCoords(0,1) = a; ipCoords(0,17) = -a;
ipCoords(1,1) = -a; ipCoords(1,17) = a;
ipCoords(2,1) = -a; ipCoords(2,17) = 0;
//
ipCoords(0,2) = a; ipCoords(0,18) = a;
ipCoords(1,2) = a; ipCoords(1,18) = -a;
//
ipCoords(0,2) = a; ipCoords(0,18) = a;
ipCoords(1,2) = a; ipCoords(1,18) = -a;
ipCoords(2,2) = -a; ipCoords(2,18) = 0;
//
ipCoords(0,3) = -a; ipCoords(0,19) = a;
ipCoords(1,3) = a; ipCoords(1,19) = a;
//
ipCoords(0,3) = -a; ipCoords(0,19) = a;
ipCoords(1,3) = a; ipCoords(1,19) = a;
ipCoords(2,3) = -a; ipCoords(2,19) = 0;
ipCoords(0,4) = -a; ipCoords(0,20) = 0;
ipCoords(1,4) = -a; ipCoords(1,20) = 0;
ipCoords(0,4) = -a; ipCoords(0,20) = 0;
ipCoords(1,4) = -a; ipCoords(1,20) = 0;
ipCoords(2,4) = a; ipCoords(2,20) = -a;
ipCoords(0,5) = a; ipCoords(0,21) = 0;
ipCoords(1,5) = -a; ipCoords(1,21) = 0;
ipCoords(0,5) = a; ipCoords(0,21) = 0;
ipCoords(1,5) = -a; ipCoords(1,21) = 0;
ipCoords(2,5) = a; ipCoords(2,21) = a;
ipCoords(0,6) = a; ipCoords(0,22) = 0;
ipCoords(1,6) = a; ipCoords(1,22) = -a;
ipCoords(0,6) = a; ipCoords(0,22) = 0;
ipCoords(1,6) = a; ipCoords(1,22) = -a;
ipCoords(2,6) = a; ipCoords(2,22) = 0;
ipCoords(0,7) = -a; ipCoords(0,23) = 0;
ipCoords(1,7) = a; ipCoords(1,23) = a;
ipCoords(0,7) = -a; ipCoords(0,23) = 0;
ipCoords(1,7) = a; ipCoords(1,23) = a;
ipCoords(2,7) = a; ipCoords(2,23) = 0;
ipCoords(0,8) = 0; ipCoords(0,24) = -a;
ipCoords(1,8) = -a; ipCoords(1,24) = 0;
ipCoords(0,8) = 0; ipCoords(0,24) = -a;
ipCoords(1,8) = -a; ipCoords(1,24) = 0;
ipCoords(2,8) = -a; ipCoords(2,24) = 0;
ipCoords(0,9) = 0; ipCoords(0,25) = a;
ipCoords(1,9) = -a; ipCoords(1,25) = 0;
ipCoords(0,9) = 0; ipCoords(0,25) = a;
ipCoords(1,9) = -a; ipCoords(1,25) = 0;
ipCoords(2,9) = a; ipCoords(2,25) = 0;
ipCoords(0,10) = 0; ipCoords(0,26) = 0;
ipCoords(1,10) = a; ipCoords(1,26) = 0;
ipCoords(0,10) = 0; ipCoords(0,26) = 0;
ipCoords(1,10) = a; ipCoords(1,26) = 0;
ipCoords(2,10) = -a; ipCoords(2,26) = 0;
ipCoords(0,11) = 0;
ipCoords(1,11) = a;
ipCoords(2,11) = a;
ipCoords(0,11) = 0;
ipCoords(1,11) = a;
ipCoords(2,11) = a;
ipCoords(0,12) = -a;
ipCoords(1,12) = 0;
ipCoords(2,12) = -a;
ipCoords(0,13) = -a;
ipCoords(1,13) = 0;
ipCoords(2,13) = a;
ipCoords(0,14) = a;
ipCoords(1,14) = 0;
ipCoords(2,14) = -a;
ipCoords(0,15) = a;
ipCoords(1,15) = 0;
ipCoords(2,15) = a;
// Integration points by face
ipFaceCoords[0](0,0) = -1; ipFaceCoords[0](0,5) = -1;
ipFaceCoords[0](1,0) = -a; ipFaceCoords[0](1,5) = 0;
ipFaceCoords[0](0,0) = -1; ipFaceCoords[0](0,5) = -1;
ipFaceCoords[0](1,0) = -a; ipFaceCoords[0](1,5) = 0;
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](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[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](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](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](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[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](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](0,1) = -a; ipFaceCoords[2](0,6) = -a;
ipFaceCoords[2](1,1) = -1; ipFaceCoords[2](1,6) = -1;
ipFaceCoords[2](2,1) = a; ipFaceCoords[2](2,6) = 0;
//
ipFaceCoords[2](0,2) = a; ipFaceCoords[2](0,7) = a;
ipFaceCoords[2](1,2) = -1; ipFaceCoords[2](1,7) = -1;
ipFaceCoords[2](2,2) = a; ipFaceCoords[2](2,7) = 0;
//
ipFaceCoords[2](0,3) = a; ipFaceCoords[2](0,8) = 0;
ipFaceCoords[2](1,3) = -1; ipFaceCoords[2](1,8) = -1;
ipFaceCoords[2](2,3) = -a; ipFaceCoords[2](2,8) = 0;
//
ipFaceCoords[2](0,4) = 0;
ipFaceCoords[2](1,4) = -1;
ipFaceCoords[2](2,4) = -a;
ipFaceCoords[3](0,0) = -a; ipFaceCoords[3](0,5) = 0;
ipFaceCoords[3](1,0) = 1; ipFaceCoords[3](1,5) = 1;
//
ipFaceCoords[2](0,1) = -a; ipFaceCoords[2](0,6) = -a;
ipFaceCoords[2](1,1) = -1; ipFaceCoords[2](1,6) = -1;
ipFaceCoords[2](2,1) = a; ipFaceCoords[2](2,6) = 0;
//
ipFaceCoords[2](0,2) = a; ipFaceCoords[2](0,7) = a;
ipFaceCoords[2](1,2) = -1; ipFaceCoords[2](1,7) = -1;
ipFaceCoords[2](2,2) = a; ipFaceCoords[2](2,7) = 0;
//
ipFaceCoords[2](0,3) = a; ipFaceCoords[2](0,8) = 0;
ipFaceCoords[2](1,3) = -1; ipFaceCoords[2](1,8) = -1;
ipFaceCoords[2](2,3) = -a; ipFaceCoords[2](2,8) = 0;
//
ipFaceCoords[2](0,4) = 0;
ipFaceCoords[2](1,4) = -1;
ipFaceCoords[2](2,4) = -a;
ipFaceCoords[3](0,0) = -a; ipFaceCoords[3](0,5) = 0;
ipFaceCoords[3](1,0) = 1; ipFaceCoords[3](1,5) = 1;
ipFaceCoords[3](2,0) = -a; ipFaceCoords[3](2,5) = a;
//
ipFaceCoords[3](0,1) = -a; ipFaceCoords[3](0,6) = -a;
ipFaceCoords[3](1,1) = 1; ipFaceCoords[3](1,6) = 1;
ipFaceCoords[3](2,1) = a; ipFaceCoords[3](2,6) = 0;
//
ipFaceCoords[3](0,2) = a; ipFaceCoords[3](0,7) = a;
ipFaceCoords[3](1,2) = 1; ipFaceCoords[3](1,7) = 1;
ipFaceCoords[3](2,2) = a; ipFaceCoords[3](2,7) = 0;
//
ipFaceCoords[3](0,3) = a; ipFaceCoords[3](0,8) = 0;
ipFaceCoords[3](1,3) = 1; ipFaceCoords[3](1,8) = 1;
ipFaceCoords[3](2,3) = -a; ipFaceCoords[3](2,8) = 0;
//
ipFaceCoords[3](0,4) = 0;
ipFaceCoords[3](1,4) = 1;
ipFaceCoords[3](2,4) = -a;
//
ipFaceCoords[3](0,1) = -a; ipFaceCoords[3](0,6) = -a;
ipFaceCoords[3](1,1) = 1; ipFaceCoords[3](1,6) = 1;
ipFaceCoords[3](2,1) = a; ipFaceCoords[3](2,6) = 0;
//
ipFaceCoords[3](0,2) = a; ipFaceCoords[3](0,7) = a;
ipFaceCoords[3](1,2) = 1; ipFaceCoords[3](1,7) = 1;
ipFaceCoords[3](2,2) = a; ipFaceCoords[3](2,7) = 0;
//
ipFaceCoords[3](0,3) = a; ipFaceCoords[3](0,8) = 0;
ipFaceCoords[3](1,3) = 1; ipFaceCoords[3](1,8) = 1;
ipFaceCoords[3](2,3) = -a; ipFaceCoords[3](2,8) = 0;
//
ipFaceCoords[3](0,4) = 0;
ipFaceCoords[3](1,4) = 1;
ipFaceCoords[3](2,4) = -a;
ipFaceCoords[4](0,0) = -a; ipFaceCoords[4](0,5) = 0;
ipFaceCoords[4](1,0) = -a; ipFaceCoords[4](1,5) = a;
ipFaceCoords[4](2,0) = -1; ipFaceCoords[4](2,5) = -1;
//
//
ipFaceCoords[4](0,1) = a; ipFaceCoords[4](0,6) = -a;
ipFaceCoords[4](1,1) = -a; ipFaceCoords[4](1,6) = 0;
ipFaceCoords[4](2,1) = -1; ipFaceCoords[4](2,6) = -1;
//
//
ipFaceCoords[4](0,2) = a; ipFaceCoords[4](0,7) = a;
ipFaceCoords[4](1,2) = a; ipFaceCoords[4](1,7) = 0;
ipFaceCoords[4](2,2) = -1; ipFaceCoords[4](2,7) = -1;
//
//
ipFaceCoords[4](0,3) = -a; ipFaceCoords[4](0,8) = 0;
ipFaceCoords[4](1,3) = a; ipFaceCoords[4](1,8) = 0;
ipFaceCoords[4](2,3) = -1; ipFaceCoords[4](2,8) = -1;
@ -445,19 +445,19 @@ namespace ATC {
ipFaceCoords[4](0,4) = 0;
ipFaceCoords[4](1,4) = -a;
ipFaceCoords[4](2,4) = -1;
ipFaceCoords[5](0,0) = -a; ipFaceCoords[5](0,5) = 0;
ipFaceCoords[5](1,0) = -a; ipFaceCoords[5](1,5) = a;
ipFaceCoords[5](2,0) = 1; ipFaceCoords[5](2,5) = 1;
//
//
ipFaceCoords[5](0,1) = a; ipFaceCoords[5](0,6) = -a;
ipFaceCoords[5](1,1) = -a; ipFaceCoords[5](1,6) = 0;
ipFaceCoords[5](2,1) = 1; ipFaceCoords[5](2,6) = 1;
//
//
ipFaceCoords[5](0,2) = a; ipFaceCoords[5](0,7) = a;
ipFaceCoords[5](1,2) = a; ipFaceCoords[5](1,7) = 0;
ipFaceCoords[5](2,2) = 1; ipFaceCoords[5](2,7) = 1;
//
//
ipFaceCoords[5](0,3) = -a; ipFaceCoords[5](0,8) = 0;
ipFaceCoords[5](1,3) = a; ipFaceCoords[5](1,8) = 0;
ipFaceCoords[5](2,3) = 1; ipFaceCoords[5](2,8) = 1;
@ -465,23 +465,23 @@ namespace ATC {
ipFaceCoords[5](0,4) = 0;
ipFaceCoords[5](1,4) = -a;
ipFaceCoords[5](2,4) = 1;
// Integration points for all faces ignoring the
// Integration points for all faces ignoring the
// redundant dim
ipFace2DCoords(0,0) = -a; ipFace2DCoords(0,5) = 0;
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,0) = -a; ipFace2DCoords(0,5) = 0;
ipFace2DCoords(1,0) = -a; ipFace2DCoords(1,5) = a;
//
ipFace2DCoords(0,2) = a; ipFace2DCoords(0,7) = a;
ipFace2DCoords(1,2) = a; ipFace2DCoords(1,7) = 0;
//
ipFace2DCoords(0,3) = -a; ipFace2DCoords(0,8) = 0;
ipFace2DCoords(1,3) = a; ipFace2DCoords(1,8) = 0;
//
ipFace2DCoords(0,4) = 0;
ipFace2DCoords(1,4) = -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(1,2) = a; ipFace2DCoords(1,7) = 0;
//
ipFace2DCoords(0,3) = -a; ipFace2DCoords(0,8) = 0;
ipFace2DCoords(1,3) = a; ipFace2DCoords(1,8) = 0;
//
ipFace2DCoords(0,4) = 0;
ipFace2DCoords(1,4) = -a;
// Integration point weights
for (int i=0; i<numIPs; ++i) {
@ -534,59 +534,59 @@ namespace ATC {
a1 = 1;
a2 = 0;
}
// Integration point coordinates
ipCoords.resize(4, numIPs);
ipCoords(0,0) = v2; ipCoords(0,2) = v2;
ipCoords(1,0) = v2; ipCoords(1,2) = v1;
ipCoords(2,0) = v2; ipCoords(2,2) = v2;
ipCoords(0,0) = v2; ipCoords(0,2) = v2;
ipCoords(1,0) = v2; ipCoords(1,2) = v1;
ipCoords(2,0) = v2; ipCoords(2,2) = v2;
ipCoords(3,0) = v1; ipCoords(3,2) = v2;
//
ipCoords(0,1) = v1; ipCoords(0,3) = v2;
ipCoords(1,1) = v2; ipCoords(1,3) = v2;
ipCoords(2,1) = v2; ipCoords(2,3) = v1;
ipCoords(0,1) = v1; ipCoords(0,3) = v2;
ipCoords(1,1) = v2; ipCoords(1,3) = v2;
ipCoords(2,1) = v2; ipCoords(2,3) = v1;
ipCoords(3,1) = v2; ipCoords(3,3) = v2;
// Integration points by face
// ...face 0 ...face 2
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](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](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;
// ...face 1 ...face 3
ipFaceCoords[1](0,0) = 0; ipFaceCoords[3](0,0) = a2;
ipFaceCoords[1](1,0) = a1; ipFaceCoords[3](1,0) = a2;
ipFaceCoords[1](2,0) = a2; ipFaceCoords[3](2,0) = 0;
//
//
ipFaceCoords[1](0,1) = 0; ipFaceCoords[3](0,1) = a2;
ipFaceCoords[1](1,1) = a2; ipFaceCoords[3](1,1) = a1;
ipFaceCoords[1](2,1) = a2; ipFaceCoords[3](2,1) = 0;
//
//
ipFaceCoords[1](0,2) = 0; ipFaceCoords[3](0,2) = a1;
ipFaceCoords[1](1,2) = a2; ipFaceCoords[3](1,2) = a2;
ipFaceCoords[1](2,2) = a1; ipFaceCoords[3](2,2) = 0;
// 2D integration points for faces
ipFace2DCoords(0,0) = a2; ipFace2DCoords(0,2) = a2;
ipFace2DCoords(1,0) = a2; ipFace2DCoords(1,2) = a1;
ipFace2DCoords(2,0) = a1; ipFace2DCoords(2,2) = a2;
ipFace2DCoords(0,0) = a2; ipFace2DCoords(0,2) = a2;
ipFace2DCoords(1,0) = a2; ipFace2DCoords(1,2) = a1;
ipFace2DCoords(2,0) = a1; ipFace2DCoords(2,2) = a2;
//
ipFace2DCoords(0,1) = a1;
ipFace2DCoords(1,1) = a2;
ipFace2DCoords(0,1) = a1;
ipFace2DCoords(1,1) = a2;
ipFace2DCoords(2,1) = a2;
// Integration point weights
ipWeights = (1.0/6.0)/numIPs;
// Integration point face weights
ipFaceWeights = (1.0/2.0)/numFaceIPs;
@ -605,11 +605,11 @@ namespace ATC {
ipFaceWeights.reset(numFaceIPs);
double v1, v2, v3, a1, a2, a3;
/* These weights for calculating Gaussian Quadrature
* points are taken from the paper "Integration Points
* for Triangles and Tetrahedra Obtained from the
/* These weights for calculating Gaussian Quadrature
* points are taken from the paper "Integration Points
* for Triangles and Tetrahedra Obtained from the
* 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. */
v1 = 1.0/4.0;
v2 = 1.0/2.0;
@ -617,7 +617,7 @@ namespace ATC {
a1 = 1.0/3.0;
a2 = 3.0/5.0;
a3 = 1.0/5.0;
// Integration point coordinates
ipCoords.resize(4, numIPs);
ipCoords(0,0) = v1;
@ -625,61 +625,61 @@ namespace ATC {
ipCoords(2,0) = v1;
ipCoords(3,0) = v1;
//
ipCoords(0,1) = v3; ipCoords(0,3) = v3;
ipCoords(1,1) = v3; ipCoords(1,3) = v2;
ipCoords(2,1) = v3; ipCoords(2,3) = v3;
ipCoords(0,1) = v3; ipCoords(0,3) = v3;
ipCoords(1,1) = v3; ipCoords(1,3) = v2;
ipCoords(2,1) = v3; ipCoords(2,3) = v3;
ipCoords(3,1) = v2; ipCoords(3,3) = v3;
//
ipCoords(0,2) = v2; ipCoords(0,4) = v3;
ipCoords(1,2) = v3; ipCoords(1,4) = v3;
ipCoords(2,2) = v3; ipCoords(2,4) = v2;
ipCoords(0,2) = v2; ipCoords(0,4) = v3;
ipCoords(1,2) = v3; ipCoords(1,4) = v3;
ipCoords(2,2) = v3; ipCoords(2,4) = v2;
ipCoords(3,2) = v3; ipCoords(3,4) = v3;
// Integration points by face
// ...face 0 ...face 2
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](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](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](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;
// ...face 1 ...face 3
ipFaceCoords[1](0,0) = 0; ipFaceCoords[3](0,0) = a1;
ipFaceCoords[1](1,0) = a1; ipFaceCoords[3](1,0) = a1;
ipFaceCoords[1](2,0) = a1; ipFaceCoords[3](2,0) = 0;
//
//
ipFaceCoords[1](0,1) = 0; ipFaceCoords[3](0,1) = a3;
ipFaceCoords[1](1,1) = a2; ipFaceCoords[3](1,1) = a3;
ipFaceCoords[1](2,1) = a3; ipFaceCoords[3](2,1) = 0;
//
//
ipFaceCoords[1](0,2) = 0; ipFaceCoords[3](0,2) = a3;
ipFaceCoords[1](1,2) = a3; ipFaceCoords[3](1,2) = a2;
ipFaceCoords[1](2,2) = a3; ipFaceCoords[3](2,2) = 0;
//
//
ipFaceCoords[1](0,3) = 0; ipFaceCoords[3](0,3) = a2;
ipFaceCoords[1](1,3) = a3; ipFaceCoords[3](1,3) = a3;
ipFaceCoords[1](2,3) = a2; ipFaceCoords[3](2,3) = 0;
// 2D integration points for faces
//
ipFace2DCoords(0,0) = a1; ipFace2DCoords(0,2) = a2;
ipFace2DCoords(1,0) = a1; ipFace2DCoords(1,2) = a3;
ipFace2DCoords(0,0) = a1; ipFace2DCoords(0,2) = a2;
ipFace2DCoords(1,0) = a1; ipFace2DCoords(1,2) = a3;
ipFace2DCoords(2,0) = a1; ipFace2DCoords(2,2) = a3;
//
ipFace2DCoords(0,1) = a3; ipFace2DCoords(0,3) = a3;
ipFace2DCoords(1,1) = a3; ipFace2DCoords(1,3) = a2;
ipFace2DCoords(2,1) = a2; ipFace2DCoords(2,3) = a3;
ipFace2DCoords(0,1) = a3; ipFace2DCoords(0,3) = a3;
ipFace2DCoords(1,1) = a3; ipFace2DCoords(1,3) = a2;
ipFace2DCoords(2,1) = a2; ipFace2DCoords(2,3) = a3;
for (int i=0; i<numIPs; ++i) {
if (i < 1) ipWeights[i] = -4.0/5.0;

View File

@ -16,10 +16,10 @@ namespace ATC {
// ====================================================================
FieldEulerIntegrator::FieldEulerIntegrator(
const FieldName fieldName,
const PhysicsModel * physicsModel,
const PhysicsModel * physicsModel,
/*const*/ FE_Engine * feEngine,
/*const*/ ATC_Coupling * atc,
const Array2D< bool > & rhsMask // copy
const Array2D< bool > & rhsMask // copy
)
: atc_(atc),
feEngine_(feEngine),
@ -35,20 +35,20 @@ FieldEulerIntegrator::FieldEulerIntegrator(
// ====================================================================
FieldExplicitEulerIntegrator::FieldExplicitEulerIntegrator(
const FieldName fieldName,
const PhysicsModel * physicsModel,
const PhysicsModel * physicsModel,
/*const*/ FE_Engine * feEngine,
/*const*/ ATC_Coupling * atc,
const Array2D< bool > & rhsMask // copy
const Array2D< bool > & rhsMask // copy
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask)
{
}
// --------------------------------------------------------------------
// update
// update
// --------------------------------------------------------------------
void FieldExplicitEulerIntegrator::update(const double dt, double /* time */,
FIELDS & fields, FIELDS & rhs)
{
{
// 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
atc_->compute_rhs_vector(rhsMask_, fields, rhs,
@ -63,14 +63,14 @@ FieldExplicitEulerIntegrator::FieldExplicitEulerIntegrator(
// ====================================================================
FieldImplicitEulerIntegrator::FieldImplicitEulerIntegrator(
const FieldName fieldName,
const PhysicsModel * physicsModel,
const PhysicsModel * physicsModel,
/*const*/ FE_Engine * feEngine,
/*const*/ ATC_Coupling * atc,
const Array2D< bool > & rhsMask, // copy
const Array2D< bool > & rhsMask, // copy
const double alpha
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
alpha_(alpha),
dT_(1.0e-6),
dT_(1.0e-6),
maxRestarts_(50),
maxIterations_(1000),
tol_(1.0e-8)
@ -78,17 +78,17 @@ FieldImplicitEulerIntegrator::FieldImplicitEulerIntegrator(
}
// --------------------------------------------------------------------
// update
// update
// --------------------------------------------------------------------
void FieldImplicitEulerIntegrator::update(const double dt, double time,
FIELDS & fields, FIELDS & /* rhs */)
FIELDS & fields, FIELDS & /* rhs */)
{ // solver handles bcs
FieldImplicitSolveOperator solver(atc_,
FieldImplicitSolveOperator solver(atc_,
fields, fieldName_, rhsMask_, physicsModel_,
time, dt, alpha_);
DiagonalMatrix<double> preconditioner = solver.preconditioner();
DENS_VEC rT = solver.r();
DENS_VEC dT(nNodes_); dT = dT_;
DENS_VEC dT(nNodes_); dT = dT_;
DENS_MAT H(maxRestarts_+1, maxRestarts_);
double tol = tol_; // tol returns the residual
int iterations = maxIterations_; // iterations returns number of iterations
@ -106,10 +106,10 @@ void FieldImplicitEulerIntegrator::update(const double dt, double time,
// ====================================================================
FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator(
const FieldName fieldName,
const PhysicsModel * physicsModel,
const PhysicsModel * physicsModel,
/*const*/ FE_Engine * feEngine,
/*const*/ ATC_Coupling * atc,
const Array2D< bool > & rhsMask, // copy
const Array2D< bool > & rhsMask, // copy
const double alpha
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
alpha_(alpha),solver_(nullptr)
@ -125,24 +125,24 @@ FieldImplicitDirectEulerIntegrator::~FieldImplicitDirectEulerIntegrator()
}
// --------------------------------------------------------------------
// initialize
// initialize
// --------------------------------------------------------------------
void FieldImplicitDirectEulerIntegrator::initialize(const double dt, double /* time */,
FIELDS & /* fields */)
{
FIELDS & /* fields */)
{
std::pair<FieldName,FieldName> p(fieldName_,fieldName_);
Array2D <bool> rmask = atc_->rhs_mask();
rmask(fieldName_,FLUX) = true;
rmask(fieldName_,FLUX) = true;
atc_->tangent_matrix(p,rmask,physicsModel_,_K_);
_lhsMK_ = (1./dt)*(_M_)- alpha_*(_K_);
_rhsMK_ = (1./dt)*(_M_)+(1.+alpha_)*(_K_);
}
// --------------------------------------------------------------------
// update
// update
// --------------------------------------------------------------------
void FieldImplicitDirectEulerIntegrator::update(const double /* dt */, double /* time */,
FIELDS & fields, FIELDS & rhs)
{
FIELDS & fields, FIELDS & rhs)
{
atc_->compute_rhs_vector(rhsMask_, fields, rhs,
FULL_DOMAIN, physicsModel_);
CLON_VEC myRhs = column( rhs[fieldName_].set_quantity(),0);

View File

@ -60,7 +60,7 @@ class FieldEulerIntegrator {
const PhysicsModel * physicsModel_;
/** field name */
FieldName fieldName_;
FieldName fieldName_;
/** rhs mask */
Array2D <bool> rhsMask_;

View File

@ -22,7 +22,7 @@ typedef PerAtomQuantity<double> PAQ;
//-----------------------------------------------------------------------------
//* 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); }
DENS_MAN * quantity = interscaleManager_.dense_matrix(name);
@ -35,7 +35,7 @@ typedef PerAtomQuantity<double> PAQ;
atomicQuantity = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS);
}
else {
if (!atomicQuantity) {
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_based()) {
quantity = new OnTheFlyKernelAccumulationNormalized(atc_, atomic,
atc_->kernel_function(),
atc_->atom_coarsegraining_positions(),
quantity = new OnTheFlyKernelAccumulationNormalized(atc_, atomic,
atc_->kernel_function(),
atc_->atom_coarsegraining_positions(),
normalization);
} else {
quantity = new OnTheFlyMeshAccumulationNormalized(atc_, atomic,
atc_->atom_coarsegraining_positions(),
quantity = new OnTheFlyMeshAccumulationNormalized(atc_, atomic,
atc_->atom_coarsegraining_positions(),
normalization);
}
} else {
quantity = new AtfProjection(atc_, atomic,
atc_->accumulant(),
quantity = new AtfProjection(atc_, atomic,
atc_->accumulant(),
normalization);
}
interscaleManager_.add_dense_matrix(quantity,name);
@ -102,21 +102,21 @@ typedef PerAtomQuantity<double> PAQ;
}
else if (atc_->kernel_on_the_fly()) {
if (atc_->kernel_based()) {
quantity = new OnTheFlyKernelAccumulationNormalizedReferenced(atc_,
atomic,
atc_->kernel_function(),
atc_->atom_coarsegraining_positions(),
quantity = new OnTheFlyKernelAccumulationNormalizedReferenced(atc_,
atomic,
atc_->kernel_function(),
atc_->atom_coarsegraining_positions(),
normalization,
reference);
} else {
quantity = new OnTheFlyMeshAccumulationNormalizedReferenced(atc_,
atomic,
atc_->atom_coarsegraining_positions(),
quantity = new OnTheFlyMeshAccumulationNormalizedReferenced(atc_,
atomic,
atc_->atom_coarsegraining_positions(),
normalization,
reference);
}
} else {
quantity = new AtfProjectionReferenced(atc_, atomic,
quantity = new AtfProjectionReferenced(atc_, atomic,
atc_->accumulant(),
reference,
normalization);
@ -141,14 +141,14 @@ typedef PerAtomQuantity<double> PAQ;
}
else if (atc_->kernel_on_the_fly()) {
if (atc_->kernel_based()) {
quantity = new OnTheFlyKernelAccumulationNormalizedScaled(atc_, atomic,
atc_->kernel_function(),
atc_->atom_coarsegraining_positions(),
quantity = new OnTheFlyKernelAccumulationNormalizedScaled(atc_, atomic,
atc_->kernel_function(),
atc_->atom_coarsegraining_positions(),
normalization,
scale);
} else {
quantity = new OnTheFlyMeshAccumulationNormalizedScaled(atc_, atomic,
atc_->atom_coarsegraining_positions(),
quantity = new OnTheFlyMeshAccumulationNormalizedScaled(atc_, atomic,
atc_->atom_coarsegraining_positions(),
normalization,
scale);
}
@ -203,7 +203,7 @@ typedef PerAtomQuantity<double> PAQ;
return projected_atom_quantity(NUMBER_DENSITY,name,atomic,atc_->accumulant_inverse_volumes());
}
//-----------------------------------------------------------------------------
//* MOMENTUM
//* MOMENTUM
//-----------------------------------------------------------------------------
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());
}
//-----------------------------------------------------------------------------
//* VELOCITY
//* VELOCITY
//-----------------------------------------------------------------------------
DENS_MAN * FieldManager::velocity(string name)
{
@ -243,7 +243,7 @@ typedef PerAtomQuantity<double> PAQ;
return v;
}
//-----------------------------------------------------------------------------
//* PROJECTED_VELOCITY
//* PROJECTED_VELOCITY
//-----------------------------------------------------------------------------
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());
}
//-----------------------------------------------------------------------------
//* DISPLACEMENT
//* DISPLACEMENT
//-----------------------------------------------------------------------------
DENS_MAN * FieldManager::displacement(string name)
{
@ -261,8 +261,8 @@ typedef PerAtomQuantity<double> PAQ;
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicMassWeightedDisplacement");
if (!atomic) {
FundamentalAtomQuantity * atomMasses = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS);
FundamentalAtomQuantity * atomPositions = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_POSITION);
FundamentalAtomQuantity * atomMasses = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_MASS);
FundamentalAtomQuantity * atomPositions = interscaleManager_.fundamental_atom_quantity(LammpsInterface::ATOM_POSITION);
atomic = new AtomicMassWeightedDisplacement(atc_,atomPositions, atomMasses, atc_->atom_reference_positions(), INTERNAL);
interscaleManager_.add_per_atom_quantity(atomic,"AtomicMassWeightedDisplacement");
}
@ -296,12 +296,12 @@ typedef PerAtomQuantity<double> PAQ;
return u;
}
//-----------------------------------------------------------------------------
//* REFERENCE_POTENTIAL_ENERGY
//* REFERENCE_POTENTIAL_ENERGY
//-----------------------------------------------------------------------------
DENS_MAN * FieldManager::reference_potential_energy(string /* name */)
{
DENS_MAN * rpe = interscaleManager_.dense_matrix(field_to_string(REFERENCE_POTENTIAL_ENERGY));
if (! rpe ) {
if (! rpe ) {
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicReferencePotential");
if (!atomic) {
atomic = new AtcAtomQuantity<double>(atc_);
@ -334,7 +334,7 @@ typedef PerAtomQuantity<double> PAQ;
return rpe;
}
//-----------------------------------------------------------------------------
//* POTENTIAL_ENERGY
//* POTENTIAL_ENERGY
//-----------------------------------------------------------------------------
DENS_MAN * FieldManager::potential_energy(string name)
{
@ -352,7 +352,7 @@ typedef PerAtomQuantity<double> PAQ;
}
}
//-----------------------------------------------------------------------------
//* TEMPERATURE
//* TEMPERATURE
//-----------------------------------------------------------------------------
DENS_MAN * FieldManager::temperature(string name)
{
@ -367,10 +367,10 @@ typedef PerAtomQuantity<double> PAQ;
{
double Tcoef = 1./((atc_->nsd())*(atc_->lammps_interface())->kBoltzmann());
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)
{
@ -379,7 +379,7 @@ typedef PerAtomQuantity<double> PAQ;
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)
{
@ -405,7 +405,7 @@ typedef PerAtomQuantity<double> PAQ;
return projected_atom_quantity(SPECIES_FLUX,name,atomic,atc_->accumulant_inverse_volumes());
}
//-----------------------------------------------------------------------------
//* INTERNAL_ENERGY
//* INTERNAL_ENERGY
//-----------------------------------------------------------------------------
DENS_MAN * FieldManager::internal_energy(string name)
{
@ -417,7 +417,7 @@ typedef PerAtomQuantity<double> PAQ;
return ie;
}
//-----------------------------------------------------------------------------
//* ENERGY
//* ENERGY
//-----------------------------------------------------------------------------
DENS_MAN * FieldManager::energy(string name)
{
@ -454,7 +454,7 @@ typedef PerAtomQuantity<double> PAQ;
return atomic;
}
//-----------------------------------------------------------------------------
//* 2 KE
//* 2 KE
//-----------------------------------------------------------------------------
PAQ * FieldManager::atomic_twice_kinetic_energy()
{
@ -503,7 +503,7 @@ typedef PerAtomQuantity<double> PAQ;
PAQ * atomic = interscaleManager_.per_atom_quantity("AtomicSpeciesVelocity");
if (!atomic) {
PAQ * atomVelocity = atomic_fluctuating_velocity();
PAQ * atomSpecies = atomic_species_vector();
PAQ * atomSpecies = atomic_species_vector();
atomic = new SpeciesVelocity(atc_,atomVelocity,atomSpecies);
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));
if (!quantity) {
DENS_MAN * coarseQuantity = interscaleManager_.dense_matrix(field_to_string(field));
if (!coarseQuantity) coarseQuantity = nodal_atomic_field(field);
if (!coarseQuantity) throw ATC_Error("can not prolong quantity: " + field_to_string(field) + " no field registered");

View File

@ -17,7 +17,7 @@ namespace ATC {
PROLONGED_VELOCITY};
typedef PerAtomQuantity<double> PAQ;
/**
* @class FieldManager
* @class FieldManager
* @brief Manager for constructing fields from atomic data
*/
class FieldManager{
@ -26,7 +26,7 @@ namespace ATC {
FieldManager(ATC_Method * atc);
virtual ~FieldManager(void){};
/** 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") {
switch (fieldName) {
case CHARGE_DENSITY: return charge_density(name);
@ -51,17 +51,17 @@ namespace ATC {
}
}
CanonicalName string_to_canonical_name(std::string name){
if (name == "AtomicTwiceFluctuatingKineticEnergy")
if (name == "AtomicTwiceFluctuatingKineticEnergy")
return ATOMIC_TWICE_FLUCTUATING_KINETIC_ENERGY;
else if (name == "AtomicTwiceKineticEnergy")
else if (name == "AtomicTwiceKineticEnergy")
return ATOMIC_TWICE_KINETIC_ENERGY;
else if (name == "AtomicTwiceKineticEnergy")
else if (name == "AtomicTwiceKineticEnergy")
return ATOMIC_TWICE_KINETIC_ENERGY;
else if (name == "AtomicFluctuatingVelocity")
else if (name == "AtomicFluctuatingVelocity")
return ATOMIC_FLUCTUATING_VELOCITY;
else if (name == "AtomicChargeVelocity") // ionic current
return ATOMIC_CHARGE_VELOCITY;
else if (name == "AtomicSpeciesVelocity") // per species momentum
else if (name == "AtomicSpeciesVelocity") // per species momentum
return ATOMIC_SPECIES_VELOCITY;
else if (name == field_to_prolongation_name(VELOCITY))
return PROLONGED_VELOCITY;
@ -70,11 +70,11 @@ namespace ATC {
}
PAQ * per_atom_quantity(std::string 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();
case ATOMIC_TWICE_KINETIC_ENERGY:
case ATOMIC_TWICE_KINETIC_ENERGY:
return atomic_twice_kinetic_energy();
case ATOMIC_FLUCTUATING_VELOCITY:
case ATOMIC_FLUCTUATING_VELOCITY:
return atomic_fluctuating_velocity();
case ATOMIC_CHARGE_VELOCITY:
return atomic_charge_velocity();
@ -82,7 +82,7 @@ namespace ATC {
return atomic_species_velocity();
case PROLONGED_VELOCITY:
return prolonged_field(VELOCITY);
default:
default:
throw ATC_Error("FieldManager:: unknown PAQ"); return nullptr;
}
}

View File

@ -89,7 +89,7 @@ namespace ATC {
UXT_Function* UXT_Function_Mgr::copy_UXT_function(UXT_Function* other)
{
string tag = other->tag();
UXT_Function * returnFunction = nullptr;
if (tag=="linear") {
ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other;
@ -103,7 +103,7 @@ namespace ATC {
// ScalarLinearFunction
//--------------------------------------------------------------------
//--------------------------------------------------------------------
ScalarLinearFunction::ScalarLinearFunction(int narg, double* args)
ScalarLinearFunction::ScalarLinearFunction(int narg, double* args)
: UXT_Function(narg,args)
{
tag_ = "linear";
@ -119,19 +119,19 @@ namespace ATC {
// XT_Function
//--------------------------------------------------------------------
//--------------------------------------------------------------------
XT_Function::XT_Function(int narg, double* args)
XT_Function::XT_Function(int narg, double* args)
{
if (narg > 5 ) {
x0[0] = args[0];
if (narg > 5 ) {
x0[0] = args[0];
x0[1] = args[1];
x0[2] = args[2];
mask[0] = args[3];
mask[1] = args[4];
mask[2] = args[5];
}
}
else {
x0[0] = 0.0;
x0[0] = 0.0;
x0[1] = 0.0;
x0[2] = 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);
#endif
for (int i = 0; i < narg; ++i) dargs[i] = atof(args[i+1]);
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)
{
string tag = other->tag();
XT_Function * returnFunction = nullptr;
if (tag=="linear") {
LinearFunction * other_cast = (LinearFunction*) other;
@ -268,14 +268,14 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// ConstantFunction
//--------------------------------------------------------------------
//--------------------------------------------------------------------
ConstantFunction::ConstantFunction(int narg, double* args)
ConstantFunction::ConstantFunction(int narg, double* args)
: XT_Function(narg,args),
C0(args[0])
{
tag_ = "constant";
}
//--------------------------------------------------------------------
ConstantFunction::ConstantFunction(double arg)
ConstantFunction::ConstantFunction(double arg)
: XT_Function(1,&arg),
C0(arg)
{
@ -286,7 +286,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// LinearFunction
//--------------------------------------------------------------------
//--------------------------------------------------------------------
LinearFunction::LinearFunction(int narg, double* args)
LinearFunction::LinearFunction(int narg, double* args)
: XT_Function(narg,args)
{
C0 = args[6];
@ -300,7 +300,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// PiecewiseLinearFunction
//--------------------------------------------------------------------
//--------------------------------------------------------------------
PiecewiseLinearFunction::PiecewiseLinearFunction(int narg, double* args)
PiecewiseLinearFunction::PiecewiseLinearFunction(int narg, double* args)
: XT_Function(narg,args)
{
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);
else if (index >= xi.size()-1 ) return fi(xi.size()-1);
else {
double f = fi(index)
double f = fi(index)
+ (fi(index+1)-fi(index))*(s-xi(index))/(xi(index+1)-xi(index));
return f;
}
@ -370,7 +370,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// QuadraticFunction
//--------------------------------------------------------------------
//--------------------------------------------------------------------
QuadraticFunction::QuadraticFunction(int narg, double* args)
QuadraticFunction::QuadraticFunction(int narg, double* args)
: XT_Function(narg,args)
{
C0 = args[6];
@ -387,7 +387,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// SineFunction
//--------------------------------------------------------------------
//--------------------------------------------------------------------
SineFunction::SineFunction(int narg, double* args)
SineFunction::SineFunction(int narg, double* args)
: XT_Function(narg,args)
{
C = args[6];
@ -403,7 +403,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// GaussianFunction
//--------------------------------------------------------------------
//--------------------------------------------------------------------
GaussianFunction::GaussianFunction(int narg, double* args)
GaussianFunction::GaussianFunction(int narg, double* args)
: XT_Function(narg,args)
{
tau = args[6];
@ -416,7 +416,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// GaussianTemporalRamp
//--------------------------------------------------------------------
//--------------------------------------------------------------------
GaussianTemporalRamp::GaussianTemporalRamp(int narg, double* args)
GaussianTemporalRamp::GaussianTemporalRamp(int narg, double* args)
: GaussianFunction(narg,args)
{
tau_initial = args[9];
@ -457,7 +457,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// TemporalRamp
//--------------------------------------------------------------------
//--------------------------------------------------------------------
TemporalRamp::TemporalRamp(int narg, double* args)
TemporalRamp::TemporalRamp(int narg, double* args)
: XT_Function(narg,args)
{
f_initial = args[0];
@ -471,7 +471,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// RadialPower
//--------------------------------------------------------------------
//--------------------------------------------------------------------
RadialPower::RadialPower(int narg, double* args)
RadialPower::RadialPower(int narg, double* args)
: XT_Function(narg,args)
{
C0 = args[6];
@ -499,8 +499,8 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
fps_(i)=coef*fp;
i++;
}
// scale tangents
double dx, dx0 = xs_(1)-xs_(0);
// scale tangents
double dx, dx0 = xs_(1)-xs_(0);
for (int i = 0; i < npts_ ; i++) {
if (i == 0) { dx = xs_(1)-xs_(0); }
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
{
int i0 = xs_.index(x);
int i1 = i0+1;
if (i0 < 0) {
double x0 = xs_(0), x1 = xs_(1);
inv_dx = 1./(x1-x0);
inv_dx = 1./(x1-x0);
fp0 = fp1 = fps_(0);
f1 = fs_(0);
f0 = fp0*(x-xs_(0))+f1;
@ -527,7 +527,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
}
else if (i1 >= npts_) {
double x0 = xs_(npts_-2), x1 = xs_(npts_-1);
inv_dx = 1./(x1-x0);
inv_dx = 1./(x1-x0);
fp0 = fp1 = fps_(i0);
f0 = fs_(i0);
f1 = fp0*(x-xs_(i0))+f0;
@ -535,7 +535,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
}
else {
double x0 = xs_(i0), x1 = xs_(i1);
inv_dx = 1./(x1-x0);
inv_dx = 1./(x1-x0);
f0 = fs_ (i0); f1 = fs_ (i1);
fp0 = fps_(i0); fp1 = fps_(i1);
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 t = coordinate(x,f0,fp0,f1,fp1,inv_dx);
double t2 = t*t;
double t2 = t*t;
double t3 = t*t2;
double h00 = 2*t3 - 3*t2 + 1;
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 t = coordinate(x,f0,fp0,f1,fp1,inv_dx);
double t2 = t*t;
double t2 = t*t;
double d00 = 6*t2 - 6*t;
double d10 = 3*t2 - 4*t + 1;
double d01 =-6*t2 + 6*t;

View File

@ -60,7 +60,7 @@ namespace ATC {
};
/**
/**
* @class LinearFieldFunction
* @brief Class for functions returning values linear a given field
*/
@ -69,7 +69,7 @@ namespace ATC {
public:
LinearFieldFunction(int nargs, char** args);
virtual ~LinearFieldFunction(void) {};
inline double f(double* u, double* /* x */, double /* t */) {return c1_*u[0]-c0_;}
inline double dfd(FieldName /* field */, ARGS& /* args */) {return c1_;}
@ -124,16 +124,16 @@ namespace ATC {
};
/**
/**
* @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 {
public:
ScalarLinearFunction(int nargs, double* args);
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_;}
@ -145,7 +145,7 @@ namespace ATC {
/**
* @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 {
@ -201,7 +201,7 @@ namespace ATC {
/**
* @class ConstantFunction
* @brief Class for functions returning constant values
* @brief Class for functions returning constant values
*/
class ConstantFunction : public XT_Function {
@ -209,33 +209,33 @@ namespace ATC {
ConstantFunction(int nargs, double* args);
ConstantFunction(double arg);
virtual ~ConstantFunction(void) {};
inline double f(double* /* x */, double /* t */)
inline double f(double* /* x */, double /* t */)
{return C0;};
private :
double C0;
};
/**
/**
* @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 {
public:
LinearFunction(int nargs, double* args);
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;};
private :
double C0;
};
/**
/**
* @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
*/
@ -243,31 +243,31 @@ namespace ATC {
public:
PiecewiseLinearFunction(int nargs, double* args);
virtual ~PiecewiseLinearFunction(void) {};
double f(double* x, double t) ;
private :
Array<double> xi;
Array<double> fi;
Array<double> xi;
Array<double> fi;
};
/**
/**
* @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 {
public:
LinearTemporalRamp(int nargs, double* args);
~LinearTemporalRamp(void) {};
double f(double* x, double t);
double dfdt(double* x, double t);
protected :
double mask_slope[3];
double C0_initial, C0_slope;
};
/**
@ -279,9 +279,9 @@ namespace ATC {
public:
QuadraticFunction(int nargs, double* args);
virtual ~QuadraticFunction(void) {};
inline double f(double* x, double /* t */)
{return
inline double f(double* x, double /* t */)
{return
C2[0]*(x[0]-x0[0])*(x[0]-x0[0])+
C2[1]*(x[1]-x0[1])*(x[1]-x0[1])+
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
*/
@ -304,7 +304,7 @@ namespace ATC {
SineFunction(int nargs, double* args);
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])
+mask[1]*(x[1]-x0[1])
+mask[2]*(x[2]-x0[2]) - w*t) + C0;};
@ -324,7 +324,7 @@ namespace ATC {
virtual ~GaussianFunction(void){};
// 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])
+mask[1]*(x[1]-x0[1])*(x[1]-x0[1])
+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
*/
@ -351,9 +351,9 @@ namespace ATC {
double C_initial, C_slope;
double C0_initial, C0_slope;
};
/**
* @class TemporalRamp
* @class TemporalRamp
* @brief Class for functions returning values constant in space and varying linearly in time
*/
@ -361,11 +361,11 @@ namespace ATC {
public:
TemporalRamp(int nargs, double* args);
virtual ~TemporalRamp(void) {};
inline double f(double* /* x */, double t)
inline double f(double* /* x */, double t)
{return f_initial + slope*t;};
inline double dfdt(double* /* x */, double /* t */)
inline double dfdt(double* /* x */, double /* t */)
{return slope;};
private :
@ -373,29 +373,29 @@ namespace ATC {
};
/**
* @class RadialPower
* @brief Class for functions returning values based on distance from a fix point raised to a specified power
* @class RadialPower
* @brief Class for functions returning values based on distance from a fix point raised to a specified power
*/
class RadialPower : public XT_Function {
public:
RadialPower(int nargs, double* args);
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 r = mask[0]*dx*dx+mask[1]*dy*dy+mask[2]*dz*dz; r = sqrt(r);
return C0*pow(r,n);
};
private :
double C0, n;
};
/**
* @class InterpolationFunction
* @brief Base class for interpolation functions
* @brief Base class for interpolation functions
*/
class InterpolationFunction {
@ -412,7 +412,7 @@ namespace ATC {
double dfdt(const double t) const;
protected:
double coordinate(double x,
double coordinate(double x,
double & f0, double & fp0, double & f1, double & fp1, double & inv_dx) const;
int npts_;
Array<double> xs_;

View File

@ -37,13 +37,13 @@ namespace ATC {
if (atomType_ == ALL || atomType_ == PROC_GHOST) {
if (nCols_==1) { // scalar
double * lammpsQuantity = lammps_scalar();
for (int i = 0; i < atc_.nlocal_total(); i++)
lammpsQuantity[i] = quantity_(i,0)/unitsConversion_;
}
else{ // vector
double ** lammpsQuantity = lammps_vector();
for (int i = 0; i < atc_.nlocal_total(); i++)
for (int j = 0; j < nCols_; j++)
lammpsQuantity[i][j] = quantity_(i,j)/unitsConversion_;
@ -52,7 +52,7 @@ namespace ATC {
// mapped copy
else {
int atomIndex;
if (nCols_==1) { // scalar
double * lammpsQuantity = lammps_scalar();
for (int i = 0; i < quantity_.nRows(); i++) {
@ -77,7 +77,7 @@ namespace ATC {
//--------------------------------------------------------
//--------------------------------------------------------
// Class AtomMass
// Access-only operations when mass is
// Access-only operations when mass is
// defined per type.
//--------------------------------------------------------
//--------------------------------------------------------
@ -98,7 +98,7 @@ namespace ATC {
{
const int * type = lammpsInterface_->atom_type();
const double * mass = lammpsInterface_->atom_mass();
if (atomType_ == ALL || atomType_ == PROC_GHOST) {
for (int i = 0; i < quantity_.nRows(); i++)
quantity_(i,0) = mass[type[i]];

View File

@ -153,7 +153,7 @@ namespace ATC {
// be initialized.
//--------------------------------------------------------
//--------------------------------------------------------
class ComputedAtomQuantity : public ShallowAtomQuantity<double> {
public:
@ -220,7 +220,7 @@ namespace ATC {
protected:
/** pointer to Lammps compute, meant as rapid indexing only (do not use!) */
COMPUTE_POINTER computePointer_;
COMPUTE_POINTER computePointer_;
/** tag for Lammps compute */
std::string computeTag_;

View File

@ -1,22 +1,22 @@
//*****************************************************************
// 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
//
// GMRES follows the algorithm described on p. 20 of the
// GMRES follows the algorithm described on p. 20 of the
// SIAM Templates book.
//
// The return value indicates convergence within max_iter (input)
// iterations (0), or no convergence within max_iter iterations (1).
//
// Upon successful return, output arguments have the following values:
//
//
// x -- approximate solution to Ax = b
// max_iter -- the number of iterations performed before the
// tolerance was reached
// tol -- the residual after the final iteration
//
//
//*****************************************************************
#include <cmath>
@ -29,12 +29,12 @@ template<class Real>
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn);
template < class Matrix, class Vector >
void
void
Update(Vector &x, int k, Matrix &h, Vector &s, Vector v[])
{
Vector y(s);
// Backsolve:
// Backsolve:
for (int i = k; i >= 0; i--) {
y(i) /= h(i,i);
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 >
Real
Real
abs(Real x)
{
return (x > 0 ? x : -x);
@ -56,7 +56,7 @@ abs(Real x)
template < class Operator, class Vector, class Preconditioner,
class Matrix, class Real >
int
int
GMRES(const Operator &A, Vector &x, const Vector &b,
const Preconditioner &M, Matrix &H, int &m, int &max_iter,
Real &tol)
@ -64,15 +64,15 @@ GMRES(const Operator &A, Vector &x, const Vector &b,
Real resid;
int i, j = 1, k;
Vector s(m+1), cs(m+1), sn(m+1), w;
Vector p = inv(M)*b;
Real normb = p.norm();
Vector r = inv(M) * (b - A * x);
Real beta = r.norm();
if (normb == 0.0)
normb = 1;
if ((resid = r.norm() / normb) <= tol) {
tol = resid;
max_iter = 0;
@ -85,7 +85,7 @@ GMRES(const Operator &A, Vector &x, const Vector &b,
v[0] = r * (1.0 / beta); // ??? r / beta
s = 0.0;
s(0) = beta;
for (i = 0; i < m && j <= max_iter; i++, j++) {
w = inv(M) * (A * v[i]);
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++)
ApplyPlaneRotation(H(k,i), H(k+1,i), cs(k), sn(k));
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(s(i), s(i+1), cs(i), sn(i));
if ((resid = abs(s(i+1)) / normb) < tol) {
Update(x, i, H, s, v);
tol = resid;
@ -120,14 +120,14 @@ GMRES(const Operator &A, Vector &x, const Vector &b,
return 0;
}
}
tol = resid;
delete [] v;
return 1;
}
template<class Real>
template<class Real>
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
{
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)
{
Real temp = cs * dx + sn * dy;

View File

@ -18,7 +18,7 @@ namespace ATC {
// Class GhostManager
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -30,7 +30,7 @@ namespace ATC {
{
// do nothing
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -46,7 +46,7 @@ namespace ATC {
bool GhostManager::modify(int narg, char **arg)
{
int argIndex = 0;
/*! \page man_boundary_dynamics fix_modify AtC boundary_dynamics
\section syntax
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++]));
mu_.push_back(atof(arg[argIndex++]));
}
boundaryDynamics_ = DAMPED_LAYERS;
needReset_ = true;
return true;
@ -123,7 +123,7 @@ namespace ATC {
ghostModifier_ = new GhostModifier(this);
return;
}
switch (boundaryDynamics_) {
case VERLET: {
ghostModifier_ = new GhostModifier(this);
@ -175,7 +175,7 @@ namespace ATC {
}
}
}
//--------------------------------------------------------
// construct_transfers
// sets/constructs all required dependency managed data
@ -184,7 +184,7 @@ namespace ATC {
{
ghostModifier_->construct_transfers();
}
//--------------------------------------------------------
// initialize
// initialize all data and variables before a run
@ -204,7 +204,7 @@ namespace ATC {
{
ghostModifier_->pre_exchange();
}
//--------------------------------------------------------
// initial_integrate_velocity
// velocity update in first part of velocity-verlet
@ -213,7 +213,7 @@ namespace ATC {
{
ghostModifier_->init_integrate_velocity(dt);
}
//--------------------------------------------------------
// initial_integrate_position
// position update in first part of velocity-verlet
@ -246,7 +246,7 @@ namespace ATC {
// Class GhostModifier
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -291,7 +291,7 @@ namespace ATC {
{
atomTimeIntegrator_->init_integrate_velocity(dt);
}
//--------------------------------------------------------
// initial_integrate_position
// position update in first part of velocity-verlet
@ -315,7 +315,7 @@ namespace ATC {
// Class GhostModifierPrescribed
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -353,10 +353,10 @@ namespace ATC {
atomShapeFunctions,
GHOST);
interscaleManager.add_per_atom_quantity(atomFeDisplacement_,field_to_prolongation_name(DISPLACEMENT)+"Ghost");
atomRefPositions_ = interscaleManager.per_atom_quantity("AtomicGhostCoarseGrainingPositions");
}
//--------------------------------------------------------
// post_init_integrate
// after integration, fix ghost atoms' positions
@ -373,7 +373,7 @@ namespace ATC {
// Class GhostModifierDampedHarmonic
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -399,7 +399,7 @@ namespace ATC {
void GhostModifierDampedHarmonic::construct_transfers()
{
GhostModifierPrescribed::construct_transfers();
InterscaleManager & interscaleManager((ghostManager_->atc())->interscale_manager());
atomVelocities_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_VELOCITY,GHOST);
atomForces_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_FORCE,GHOST);
@ -431,7 +431,7 @@ namespace ATC {
atomTimeIntegrator_->init_integrate_velocity(dt);
#endif
}
//--------------------------------------------------------
// initial_integrate_position
// position update in first part of velocity-verlet
@ -477,7 +477,7 @@ namespace ATC {
// Class GhostModifierDampedHarmonicLayers
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -489,7 +489,7 @@ namespace ATC {
ghostToBoundaryDistance_(nullptr),
layerId_(nullptr)
{
// do nothing
}
@ -500,7 +500,7 @@ namespace ATC {
void GhostModifierDampedHarmonicLayers::construct_transfers()
{
GhostModifierDampedHarmonic::construct_transfers();
InterscaleManager & interscaleManager((ghostManager_->atc())->interscale_manager());
// transfer for distance to boundary
@ -529,14 +529,14 @@ namespace ATC {
//--------------------------------------------------------
// 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);
}
int GhostModifierDampedHarmonicLayers::find_layers()
{
DENS_MAT & d(ghostToBoundaryDistance_->set_quantity());
DenseMatrix<int> & ids = layerId_->set_quantity();
// get distances for every ghost atom for sorting
// size arrays of length number of processors
int commSize = LammpsInterface::instance()->comm_size();
@ -608,7 +608,7 @@ namespace ATC {
ATC::LammpsInterface::instance()->print_msg_once(msg.str());
return nlayers;
}
//--------------------------------------------------------
// compute distances to boundary faces
//--------------------------------------------------------
@ -640,7 +640,7 @@ namespace ATC {
feMesh->face_connectivity_unique(PAIR(elt,face),faceNodes);
// identify the boundary face by the face which contains only boundary nodes
isBoundaryFace = true;
isBoundaryFace = true;
for (int i = 0; i < faceNodes.size(); ++i) {
if (nodeType(faceNodes(i),0) != BOUNDARY) {
isBoundaryFace = false;
@ -665,7 +665,7 @@ namespace ATC {
}
}
centroid *= -1./double(nfe); // -1 gets outward normal from ATC region => all distances should be > 0
// for each boundary face get the normal
// ASSUMES all faces are planar
feMesh->face_normal(PAIR(elt,face),0,normal);
@ -692,7 +692,7 @@ namespace ATC {
}
}
//--------------------------------------------------------
// final_integrate
// velocity update in second part of velocity-verlet
@ -723,7 +723,7 @@ namespace ATC {
// Class GhostIntegratorVerletSwap
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------

View File

@ -26,7 +26,7 @@ namespace ATC {
/** types of ghost boundary conditions in momentum */
enum BoundaryDynamicsType {
NO_BOUNDARY_DYNAMICS=0,
VERLET, // performs velocity-verlet
VERLET, // performs velocity-verlet
PRESCRIBED, // forces ghost locations to conform to interpolated finite element locations
DAMPED_HARMONIC, // turns ghost atoms into spring-mass-dashpot systems
DAMPED_LAYERS, // oer layer DAMPED_HARMONIC
@ -113,7 +113,7 @@ namespace ATC {
*/
class GhostModifier {
public:
// constructor
@ -171,7 +171,7 @@ namespace ATC {
*/
class GhostModifierPrescribed : public GhostModifier {
public:
// constructor
@ -210,7 +210,7 @@ namespace ATC {
*/
class GhostModifierDampedHarmonic : public GhostModifierPrescribed {
public:
// constructor
@ -276,7 +276,7 @@ namespace ATC {
*/
class GhostModifierDampedHarmonicLayers : public GhostModifierDampedHarmonic {
public:
// constructor
@ -308,7 +308,7 @@ namespace ATC {
// data
/** distance from all ghost atoms to boundary, i.e. boundary face of containing element */
PerAtomQuantity<double> * ghostToBoundaryDistance_;
/** layer id for ghost atoms */
PerAtomQuantity<int> * layerId_;
@ -327,7 +327,7 @@ namespace ATC {
*/
class GhostIntegratorSwap : public GhostModifier {
public:
// constructor
@ -355,7 +355,7 @@ namespace ATC {
/** internal to element map */
PerAtomQuantity<int> * atomElement_;
/** ghost to element map */
PerAtomQuantity<int> * atomGhostElement_;

View File

@ -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:
//
// dx/dt = R(x)
//
//
// A generalized discretization can be written:
//
// 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();
set<int> fixedNodes_ = atc_->prescribed_data_manager()->fixed_nodes(fieldName_);
n_ = nNodes;
vector<bool> tag(nNodes);
vector<bool> tag(nNodes);
set<int>::const_iterator it; int i = 0;
for (i = 0; i < nNodes; ++i) { tag[i] = true; }
for (it=fixedNodes_.begin();it!=fixedNodes_.end();++it) {tag[*it]=false;}
int m = 0;
for (i = 0; i < nNodes; ++i) { if (tag[i]) freeNodes_[i]= m++; }
//std::cout << " nodes " << n_ << " " << nNodes << "\n";
// Save current field
x0_.reset(n_);
to_free(f,x0_);
@ -143,7 +143,7 @@ FieldImplicitSolveOperator(ATC_Coupling * atc,
massMask_.reset(1);
massMask_(0) = fieldName_;
rhs_[fieldName_].reset(nNodes,dof_);
// Compute the RHS vector R(T^n)
// Compute the RHS vector R(T^n)
R0_.reset(n_);
R_ .reset(n_);
R(x0_, R0_);
@ -163,7 +163,7 @@ void FieldImplicitSolveOperator::to_free(const MATRIX &r, VECTOR &v) const
v(i) = r(i,0);
}
}
void
void
FieldImplicitSolveOperator::R(const DENS_VEC &x, DENS_VEC &v ) const
{
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
{
to_all(column(r,0),rhs);
}

View File

@ -45,7 +45,7 @@ class ImplicitSolveOperator {
mutable DENS_VEC R_; // condensed current
double dt_; // timestep
double alpha_; // implicit/explicit parameter (0 -> explicit, else implicit)
double epsilon0_; // small parameter to compute increment
double epsilon0_; // small parameter to compute increment
};
/**

View File

@ -41,7 +41,7 @@ namespace ATC{
{
prefix_ = (atc_->lammps_interface())->fix_id() + prefix_;
}
//--------------------------------------------------------
// Destructor
//--------------------------------------------------------
@ -155,7 +155,7 @@ namespace ATC{
int myIndex = index;
set<DependencyManager * >::iterator it;
bool isTemporary = (quantity->memory_type()==TEMPORARY);
for (it = (quantity->dependentQuantities_).begin(); it != (quantity->dependentQuantities_).end(); it++) {
// make sure that if quantity isn't persistent, none of it's dependencies are
if ((*it)->memory_type()==PERSISTENT && isTemporary) {
@ -454,7 +454,7 @@ namespace ATC{
{
// REFACTOR add check for duplicate entries
DependencyManager * quantity = nullptr;
quantity = find_in_list(perAtomQuantities_,tag);
if (quantity) return quantity;
quantity = find_in_list(perAtomIntQuantities_,tag);
@ -613,7 +613,7 @@ namespace ATC{
//--------------------------------------------------------
// pack_comm
//--------------------------------------------------------
int InterscaleManager::pack_comm(int index, double *buf,
int InterscaleManager::pack_comm(int index, double *buf,
int pbc_flag, int *pbc)
{
int size = 0;

View File

@ -35,12 +35,12 @@ namespace ATC {
//--------------------------------------------------------
class InterscaleManager {
public:
// constructor
InterscaleManager(ATC_Method * atc);
// destructor
~InterscaleManager();
@ -52,7 +52,7 @@ namespace ATC {
/** set lammps data prefix */
void set_lammps_data_prefix();
/** parser/modifier */
bool modify(int narg, char **arg);
@ -183,7 +183,7 @@ namespace ATC {
int unpack_exchange(int i, double *buffer);
/** 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);
/** unpacks data after parallel transfer to ghost atoms on other processors */
@ -196,7 +196,7 @@ namespace ATC {
void copy_arrays(int i, int j);
protected:
/** pointer to access ATC methods */
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 */
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)
{
for (typename std::vector<data* >::iterator it = list.begin(); it != list.end(); ++it)
@ -455,9 +455,9 @@ namespace ATC {
private:
InterscaleManager();
};
}

View File

@ -3,8 +3,8 @@
using std::vector;
KD_Tree *KD_Tree::create_KD_tree(const int nNodesPerElem, const int nNodes,
const DENS_MAT *nodalCoords, const int nElems,
KD_Tree *KD_Tree::create_KD_tree(const int nNodesPerElem, const int nNodes,
const DENS_MAT *nodalCoords, const int nElems,
const Array2D<int> &conn) {
vector<Node> *points = new vector<Node>(); // Initialize an empty list of Nodes
for (int node = 0; node < nNodes; node++) { // Insert all nodes into list
@ -30,7 +30,7 @@ KD_Tree::~KD_Tree() {
delete rightChild_;
}
KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
int dimension)
: candElems_(elements) {
// 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->begin(), points->end(), compare);
sort(points->begin(), points->end(), compare);
sortedPts_ = points;
// Pick the median point as the root of the tree
size_t nNodes = points->size();
size_t med = nNodes/2;
value_ = (*sortedPts_)[med];
// Recursively construct the left sub-tree
vector<Node> *leftPts = new vector<Node>;
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) {
// if the root coordinate is less than the query coordinate
// 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
// 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> > result;
vector<vector<int> > temp;
assert(depth >= 0 );
if (depth == 0) {
vector<int> candElemIDs;
@ -164,6 +164,6 @@ vector<vector<int> > KD_Tree::getElemIDs(int depth) {
temp = rightChild_->getElemIDs(depth);
result.insert(result.end(), temp.begin(), temp.end());
}
return result;
}

View File

@ -14,7 +14,7 @@ class Node {
// 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)
{
coords_[0] = x;
@ -26,8 +26,8 @@ class Node {
double coords_[3];
double distanceSquared(Node query) {
return pow(coords_[0] - query.coords_[0], 2)
+ pow(coords_[1] - query.coords_[1], 2)
return pow(coords_[0] - query.coords_[0], 2)
+ pow(coords_[1] - query.coords_[1], 2)
+ pow(coords_[2] - query.coords_[2], 2);
}
@ -58,8 +58,8 @@ typedef std::pair<int,std::vector<Node> > Elem;
class KD_Tree {
public:
static KD_Tree* create_KD_tree(const int nNodesPerElement, const int nNodes,
const DENS_MAT *points, const int nElems,
static KD_Tree* create_KD_tree(const int nNodesPerElement, const int nNodes,
const DENS_MAT *points, const int nElems,
const Array2D<int> &conn);
KD_Tree(std::vector<Node> *points, std::vector<Elem> *elems,
@ -67,13 +67,13 @@ class 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.
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<std::vector<int> > getElemIDs(int depth);
private:

View File

@ -11,12 +11,12 @@ using namespace ATC_Utility;
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];
namespace ATC {
//========================================================================
// KernelFunctionMgr
//========================================================================
@ -36,10 +36,10 @@ namespace ATC {
//------------------------------------------------------------------------
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
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
- parameters :\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 quartic_sphere 10.0
\section description
\section restrictions
Must be used with the hardy AtC fix \n
For bar kernel types, half-width oriented along x-direction \n
@ -80,11 +80,11 @@ namespace ATC {
ptr = new KernelFunctionCell(2,parameters);
}
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);
}
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);
}
else if (strcmp(type,"cubic_cylinder")==0) {
@ -96,7 +96,7 @@ namespace ATC {
ptr = new KernelFunctionCubicSphere(1,parameters);
}
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);
}
else if (strcmp(type,"quartic_cylinder")==0) {
@ -126,7 +126,7 @@ namespace ATC {
KernelFunction::KernelFunction(int /* nparameters */, double* parameters):
Rc_(0),invRc_(0),nsd_(3),
lammpsInterface_(LammpsInterface::instance())
{
{
Rc_ = parameters[0];
invRc_ = 1.0/Rc_;
Rc_ = parameters[0];
@ -142,8 +142,8 @@ namespace ATC {
box_bounds[0][1],box_bounds[1][1],
box_bounds[0][2],box_bounds[1][2]);
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
@ -160,7 +160,7 @@ namespace ATC {
if (i < nsd_) {
kernel_bounds[0][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]);
if (periodicity[i]) {
if (node[i] <= box_bounds[0][i] + box_length[i]/2) {
@ -168,8 +168,8 @@ namespace ATC {
} else {
ghostNode[i] -= box_length[i];
}
ghostContributes = ghostContributes
&& ((ghostNode(i) >= kernel_bounds[0][i]) ||
ghostContributes = ghostContributes
&& ((ghostNode(i) >= kernel_bounds[0][i]) ||
(node(i) >= kernel_bounds[0][i]))
&& ((ghostNode(i) < kernel_bounds[1][i]) ||
(node(i) < kernel_bounds[1][i]));
@ -202,12 +202,12 @@ namespace ATC {
return 0.5*(lam2-lam1)*bhsum;
}
// localization-volume intercepts for bond calculation
// localization-volume intercepts for bond calculation
// bond intercept values assuming spherical support
void KernelFunction::bond_intercepts(DENS_VEC& xa,
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;
xa[iaxis] = 0.0;
xb[iaxis] = 0.0;
@ -223,8 +223,8 @@ namespace ATC {
bool a_in = (ra_n <= 1.0);
bool b_in = (rb_n <= 1.0);
if (a_in && b_in) {
lam1 = 0.0;
lam2 = 1.0;
lam1 = 0.0;
lam2 = 1.0;
return;
}
DENS_VEC xab = xa - xb;
@ -240,7 +240,7 @@ namespace ATC {
double aux = -0.5*(b-sqrt(discrim));
s1 = c/aux;
s2 = aux/a;
}
}
else {
double aux = -0.5*(b+sqrt(discrim));
s1 = aux/a;
@ -249,15 +249,15 @@ namespace ATC {
if (a_in && !b_in) {
lam1 = s1;
lam2 = 1.0;
}
else if (!a_in && b_in) {
}
else if (!a_in && b_in) {
lam1 = 0.0;
lam2 = s2;
lam2 = s2;
}
else {
if (s1 >= 0.0 && s2 <= 1.0) {
lam1 = s1;
lam2 = s2;
if (s1 >= 0.0 && s2 <= 1.0) {
lam1 = s1;
lam2 = s2;
}
}
}
@ -265,8 +265,8 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionStep::KernelFunctionStep
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
for (int k = 0; k < nsd_; 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");
}
}
}
}
}
// function value
@ -284,7 +284,7 @@ namespace ATC {
if (rn <= 1.0) { return 1.0; }
else { return 0.0; }
}
// function derivative value
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 */
// constructor
KernelFunctionCell::KernelFunctionCell
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
hx = parameters[0];
hy = parameters[1];
@ -309,7 +309,7 @@ namespace ATC {
cellBounds_(3) = hy;
cellBounds_(4) = -hz;
cellBounds_(5) = hz;
for (int k = 0; k < nsd_; k++ ) {
if ((bool) periodicity[k]) {
if (parameters[k] > 0.5*box_length[k]) {
@ -332,9 +332,9 @@ namespace ATC {
for (int i=0; i<3; ++i) {
kernel_bounds[0][i] -= (cellBounds_(i*2+1) +
lammpsInterface_->pair_cutoff());
kernel_bounds[1][i] += (cellBounds_(i*2+1) +
kernel_bounds[1][i] += (cellBounds_(i*2+1) +
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]);
if (periodicity[i]) {
if (node[i] <= box_bounds[0][i] + box_length[i]/2) {
@ -342,7 +342,7 @@ namespace ATC {
} else {
ghostNode[i] -= box_length[i];
}
ghostContributes = ghostContributes
ghostContributes = ghostContributes
&& ((ghostNode(i) >= kernel_bounds[0][i]) ||
(node(i) >= kernel_bounds[0][i]))
&& ((ghostNode(i) < kernel_bounds[1][i]) ||
@ -367,13 +367,13 @@ namespace ATC {
// function value
double KernelFunctionCell::value(DENS_VEC& x_atom) const
{
if ((cellBounds_(0) <= x_atom(0)) && (x_atom(0) < cellBounds_(1))
&& (cellBounds_(2) <= x_atom(1)) && (x_atom(1) < cellBounds_(3))
&& (cellBounds_(4) <= x_atom(2)) && (x_atom(2) < cellBounds_(5))) {
return 1.0;
}
else {
return 0.0;
if ((cellBounds_(0) <= x_atom(0)) && (x_atom(0) < cellBounds_(1))
&& (cellBounds_(2) <= x_atom(1)) && (x_atom(1) < cellBounds_(3))
&& (cellBounds_(4) <= x_atom(2)) && (x_atom(2) < cellBounds_(5))) {
return 1.0;
}
else {
return 0.0;
}
}
@ -382,7 +382,7 @@ namespace ATC {
{
deriv.reset(nsd_);
}
// bond intercept values for rectangular region : origin is the node position
void KernelFunctionCell::bond_intercepts(DENS_VEC& xa,
DENS_VEC& xb, double &lam1, double &lam2) const
@ -409,21 +409,21 @@ namespace ATC {
double s = (cellBounds_(2*i+j) - xb(i))/xab(i);
// check if between a & b
if (s >= 0 && s <= 1) {
bool in_bounds = false;
bool in_bounds = false;
DENS_VEC x = xb + s*xab;
if (i == 0) {
if (i == 0) {
if ((cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
in_bounds = true;
}
}
else if (i == 1) {
else if (i == 1) {
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
in_bounds = true;
}
}
else if (i == 2) {
else if (i == 2) {
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
&& (cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))) {
in_bounds = true;
@ -436,7 +436,7 @@ namespace ATC {
}
}
}
}
}
}
throw ATC_Error("logic failure in HardyKernel Cell for single intersection\n");
}
@ -455,19 +455,19 @@ namespace ATC {
if (s >= 0 && s <= 1) {
// check if in face
DENS_VEC x = xb + s*xab;
if (i == 0) {
if (i == 0) {
if ((cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
ss[is++] = s;
}
}
else if (i == 1) {
else if (i == 1) {
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
&& (cellBounds_(4) <= x(2)) && (x(2) <= cellBounds_(5))) {
ss[is++] = s;
}
}
else if (i == 2) {
else if (i == 2) {
if ((cellBounds_(0) <= x(0)) && (x(0) <= cellBounds_(1))
&& (cellBounds_(2) <= x(1)) && (x(1) <= cellBounds_(3))) {
ss[is++] = s;
@ -475,7 +475,7 @@ namespace ATC {
}
}
}
}
}
}
if (is == 1) {
// intersection occurs at a box edge - leave lam1 = lam2
@ -496,8 +496,8 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionCubicSphere::KernelFunctionCubicSphere
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
for (int k = 0; k < nsd_; k++ ) {
if ((bool) periodicity[k]) {
@ -515,7 +515,7 @@ namespace ATC {
double rn=r/Rc_;
if (rn < 1.0) { return 5.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
else { return 0.0; }
}
}
// function derivative value
void KernelFunctionCubicSphere::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
@ -526,8 +526,8 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionQuarticSphere::KernelFunctionQuarticSphere
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
for (int k = 0; k < nsd_; k++ ) {
if ((bool) periodicity[k]) {
@ -539,13 +539,13 @@ namespace ATC {
}
// function value
double KernelFunctionQuarticSphere::value(DENS_VEC& x_atom) const
double KernelFunctionQuarticSphere::value(DENS_VEC& x_atom) const
{
double r=x_atom.norm();
double rn=r/Rc_;
if (rn < 1.0) { return 35.0/8.0*pow((1.0-rn*rn),2); }
else { return 0.0; }
}
}
// function derivative value
void KernelFunctionQuarticSphere::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
@ -556,7 +556,7 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionCubicCyl::KernelFunctionCubicCyl
(int nparameters, double* parameters):
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
nsd_ = 2;
@ -578,7 +578,7 @@ namespace ATC {
double rn=r/Rc_;
if (rn < 1.0) { return 10.0/3.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
else { return 0.0; }
}
}
// function derivative value
void KernelFunctionCubicCyl::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
@ -589,7 +589,7 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionQuarticCyl::KernelFunctionQuarticCyl
(int nparameters, double* parameters):
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
nsd_ = 2;
@ -611,7 +611,7 @@ namespace ATC {
double rn=r/Rc_;
if (rn < 1.0) { return 3.0*pow((1.0-rn*rn),2); }
else { return 0.0; }
}
}
// function derivative value
void KernelFunctionQuarticCyl::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
@ -621,7 +621,7 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionCubicBar::KernelFunctionCubicBar
(int nparameters, double* parameters):
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
// Note: Bar is assumed to be oriented in the x(0) direction
@ -643,7 +643,7 @@ namespace ATC {
double rn=r/Rc_;
if (rn < 1.0) { return 2.0*(1.0-3.0*rn*rn+2.0*rn*rn*rn); }
else { return 0.0; }
}
}
// function derivative value
void KernelFunctionCubicBar::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const
@ -654,7 +654,7 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionLinearBar::KernelFunctionLinearBar
(int nparameters, double* parameters):
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
// Note: Bar is assumed to be oriented in the z(0) direction
@ -675,7 +675,7 @@ namespace ATC {
double rn=r/Rc_;
if (rn < 1.0) { return 1.0-rn; }
else { return 0.0; }
}
}
// function derivative value
void KernelFunctionLinearBar::derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const
@ -693,7 +693,7 @@ namespace ATC {
//------------------------------------------------------------------------
// constructor
KernelFunctionQuarticBar::KernelFunctionQuarticBar
(int nparameters, double* parameters):
(int nparameters, double* parameters):
KernelFunction(nparameters, parameters)
{
// 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 15.0/8.0*pow((1.0-rn*rn),2); }
else { return 0.0; }
}
}
// function derivative value
void KernelFunctionQuarticBar::derivative(const DENS_VEC& /* x_atom */, DENS_VEC& deriv) const

View File

@ -9,8 +9,8 @@ namespace ATC {
/**
* @class KernelFunctionMgr
* @brief Base class for managing kernels
*/
* @brief Base class for managing kernels
*/
class KernelFunctionMgr {
public:
/** Static instance of this class */
@ -25,26 +25,26 @@ namespace ATC {
};
/**
* @class KernelFunction
* @brief Base class for kernels for atom-continuum transfer
*/
* @class KernelFunction
* @brief Base class for kernels for atom-continuum transfer
*/
class KernelFunction {
public:
// constructor
KernelFunction(int nparameters, double* parameters);
// destructor
virtual ~KernelFunction() {};
// function value
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 ;
// bond function value via quadrature
virtual double bond(DENS_VEC& xa, DENS_VEC&xb, double lam1, double lam2) const;
// 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;
virtual bool node_contributes(DENS_VEC node) const;
virtual bool in_support(DENS_VEC node) const;
@ -54,7 +54,7 @@ namespace ATC {
protected:
double invVol_; // normalization factor
double Rc_, invRc_; // cutoff radius
int nsd_ ; // number of dimensions
int nsd_ ; // number of dimensions
/** pointer to lammps interface class */
LammpsInterface * lammpsInterface_;
@ -67,10 +67,10 @@ namespace ATC {
};
/**
* @class KernelFunctionStep
* @class KernelFunctionStep
* @brief Class for defining kernel function of a step with spherical support
*/
*/
class KernelFunctionStep : public KernelFunction {
public:
@ -80,7 +80,7 @@ namespace ATC {
virtual ~KernelFunctionStep() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// bond function value
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
* suitable for a rectangular grid
*/
*/
class KernelFunctionCell : public KernelFunction {
public:
// constructor
KernelFunctionCell(int nparameters, double* parameters);
KernelFunctionCell(int nparameters, double* parameters);
// destructor
virtual ~KernelFunctionCell() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// bond function value
virtual double bond(DENS_VEC& /* xa */, DENS_VEC& /* xb */, double lam1, double lam2) const
{return lam2 -lam1;}
// 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;
bool node_contributes(DENS_VEC node) const;
bool in_support(DENS_VEC dx) const;
@ -132,8 +132,8 @@ namespace ATC {
virtual ~KernelFunctionCubicSphere() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
};
/**
@ -150,8 +150,8 @@ namespace ATC {
virtual ~KernelFunctionQuarticSphere() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
};
/**
@ -168,8 +168,8 @@ namespace ATC {
virtual ~KernelFunctionCubicCyl() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
virtual double dimensionality_factor(void) const { return 0.5; }
};
@ -181,21 +181,21 @@ namespace ATC {
class KernelFunctionQuarticCyl : public KernelFunction {
public:
// constructor
KernelFunctionQuarticCyl(int nparameters, double* parameters);
// destructor
virtual ~KernelFunctionQuarticCyl() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
virtual double dimensionality_factor(void) const { return 0.5; }
};
/**
* @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 {
@ -207,14 +207,14 @@ namespace ATC {
virtual ~KernelFunctionCubicBar() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
virtual double dimensionality_factor(void) const { return 0.25; }
};
/**
* @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 {
@ -226,8 +226,8 @@ namespace ATC {
virtual ~KernelFunctionLinearBar() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
virtual double dimensionality_factor(void) const { return 0.25; }
};
@ -246,8 +246,8 @@ namespace ATC {
virtual ~KernelFunctionQuarticBar() {};
// function value
virtual double value(DENS_VEC& x_atom) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
// function derivative
virtual void derivative(const DENS_VEC& x_atom, DENS_VEC& deriv) const;
virtual double dimensionality_factor(void) const { return 0.25; }
};

View File

@ -62,9 +62,9 @@ namespace ATC {
//--------------------------------------------------------
// construct_methods:
// instantiations desired regulator method(s)
// dependence, but in general there is also a
// time integrator dependence. In general the
// time integrator dependence. In general the
// precedence order is:
// time filter -> time integrator -> thermostat
// In the future this may need to be added if
@ -92,7 +92,7 @@ namespace ATC {
if (timeFilterManager->need_reset() ) {
timeFilter_ = timeFilterManager->construct(TimeFilterManager::EXPLICIT_IMPLICIT);
}
if (timeFilterManager->filter_dynamics()) {
switch (regulatorTarget_) {
case NONE: {
@ -130,7 +130,7 @@ namespace ATC {
throw ATC_Error("Unknown thermostat target in Thermostat::initialize");
}
}
AtomicRegulator::reset_method();
}
else {
@ -143,7 +143,7 @@ namespace ATC {
// Class VelocityRescaleCombined
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -182,7 +182,7 @@ namespace ATC {
// Class ThermostatRescaleCombined
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -219,7 +219,7 @@ namespace ATC {
// Class KinetoThermostatRescale
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -239,7 +239,7 @@ namespace ATC {
kinetostat_ = new VelocityRescaleCombined(kinetoThermostat);
// data associated with stage 3 in ATC_Method::initialize
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
thermostat_->compute_thermostat(dt);
// update kinetostat
kinetostat_->compute_kinetostat(dt);
@ -383,7 +383,7 @@ namespace ATC {
// Class ThermostatRescaleMixedKePeCombined
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -447,7 +447,7 @@ namespace ATC {
// Class KinetoThermostatGlcFs
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -598,7 +598,7 @@ namespace ATC {
// do full prediction if we just redid the shape functions
if (full_prediction()) {
this->compute_lambda(dt);
atomThermostatForces_->unfix_quantity(); // allow update of atomic force applied by lambda
}
@ -612,7 +612,7 @@ namespace ATC {
if (full_prediction())
atomThermostatForces_->fix_quantity();
// SPLIT OUT FUNCTION TO CREATE DELTA VARIABLES IN BASES, ONLY NEED THESE
// update predicted nodal variables for second half of time step
// velocity
@ -672,8 +672,8 @@ namespace ATC {
this->add_to_energy(myNodalAtomicLambdaPower,deltaEnergy2_,0.5*dt);
atc_->apply_inverse_mass_matrix(deltaEnergy2_,TEMPERATURE);
myTemperature += deltaEnergy2_;
isFirstTimestep_ = false;
}
@ -695,7 +695,7 @@ namespace ATC {
void KinetoThermostatGlcFs::output(OUTPUT_LIST & /* outputData */)
{
// DO NOT CALL INDIVIDUAL REGULATORS
// OUTPUT TOTAL FORCE AND TOTAL POWER
// OUTPUT TOTAL FORCE AND TOTAL POWER
// OUTPUT EACH LAMBDA
}

View File

@ -25,23 +25,23 @@ namespace ATC {
* @brief Manager class for atom-continuum simulataneous control of momentum and thermal energy
*/
class KinetoThermostat : public AtomicRegulator {
public:
// constructor
KinetoThermostat(ATC_Coupling * atc,
const std::string & regulatorPrefix = "");
// destructor
virtual ~KinetoThermostat(){};
/** parser/modifier */
virtual bool modify(int narg, char **arg);
/** instantiate up the desired method(s) */
virtual void construct_methods();
// data access, intended for method objects
/** reset the nodal power to a prescribed value */
virtual void reset_lambda_contribution(const DENS_MAT & target,
@ -56,10 +56,10 @@ namespace ATC {
int couplingMaxIterations_;
private:
// DO NOT define this
KinetoThermostat();
};
/**
@ -67,12 +67,12 @@ namespace ATC {
* @brief Class for kinetostat/thermostat algorithms using the shape function matrices
* (thermostats have general for of N^T w N lambda = rhs)
*/
class KinetoThermostatShapeFunction : public RegulatorMethod {
public:
KinetoThermostatShapeFunction(AtomicRegulator * kinetoThermostat,
int couplingMaxIterations,
const std::string & /* regulatorPrefix */) : RegulatorMethod(kinetoThermostat),
@ -80,7 +80,7 @@ namespace ATC {
KinetoThermostatShapeFunction(AtomicRegulator * kinetoThermostat,
int couplingMaxIterations)
: RegulatorMethod(kinetoThermostat), couplingMaxIterations_(couplingMaxIterations) {};
virtual ~KinetoThermostatShapeFunction() {};
/** instantiate all needed data */
@ -108,25 +108,25 @@ namespace ATC {
* @class VelocityRescaleCombined
* @brief Enforces constraints on atomic velocity based on FE temperature and velocity
*/
class VelocityRescaleCombined : public VelocityGlc {
public:
friend class KinetoThermostatRescale; // since this is basically a set of member functions for friend
VelocityRescaleCombined(AtomicRegulator * kinetostat);
virtual ~VelocityRescaleCombined(){};
/** pre-run initialization of method data */
virtual void initialize();
/** applies kinetostat to atoms */
virtual void apply_mid_predictor(double /* dt */){};
/** applies kinetostat to atoms */
virtual void apply_post_corrector(double /* dt */){};
/** local shape function matrices are incompatible with this mode */
virtual bool use_local_shape_functions() const {return false;};
@ -135,10 +135,10 @@ namespace ATC {
// data
/** reference to AtC FE velocity */
DENS_MAN & velocity_;
/** RHS correct based on thermostat */
DENS_MAN * thermostatCorrection_;
// methods
/** sets up appropriate rhs for kinetostat equations */
virtual void set_kinetostat_rhs(DENS_MAT & rhs, double dt);
@ -161,29 +161,29 @@ namespace ATC {
// DO NOT define this
VelocityRescaleCombined();
};
/**
* @class ThermostatRescaleCombined
* @brief Enforces constraint on atomic kinetic energy based on FE temperature and velocity
*/
class ThermostatRescaleCombined : public ThermostatRescale {
public:
ThermostatRescaleCombined(AtomicRegulator * thermostat);
virtual ~ThermostatRescaleCombined() {};
/** pre-run initialization of method data */
virtual void initialize();
// deactivate un-needed methods
/** applies thermostat to atoms in the post-corrector phase */
virtual void apply_post_corrector(double /* dt */){};
protected:
// data
@ -201,21 +201,21 @@ namespace ATC {
// DO NOT define this
ThermostatRescaleCombined();
};
/**
* @class KinetoThermostatRescale
* @brief Enforces constraints on atomic kinetic energy and velocity based on FE temperature and velocity
*/
class KinetoThermostatRescale : public KinetoThermostatShapeFunction {
public:
KinetoThermostatRescale(AtomicRegulator * kinetoThermostat,
int couplingMaxIterations);
virtual ~KinetoThermostatRescale();
/** instantiate all needed data */
@ -223,7 +223,7 @@ namespace ATC {
/** pre-run initialization of method data */
virtual void initialize();
/** applies thermostat to atoms in the post-corrector phase */
virtual void apply_post_corrector(double dt);
@ -233,7 +233,7 @@ namespace ATC {
/** get data for output */
virtual void output(OUTPUT_LIST & outputData);
protected:
// methods
@ -275,29 +275,29 @@ namespace ATC {
// DO NOT define this
KinetoThermostatRescale();
};
/**
* @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
*/
class ThermostatRescaleMixedKePeCombined : public ThermostatRescaleMixedKePe {
public:
ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat);
virtual ~ThermostatRescaleMixedKePeCombined() {};
/** pre-run initialization of method data */
virtual void initialize();
// deactivate un-needed methods
/** applies thermostat to atoms in the post-corrector phase */
virtual void apply_post_corrector(double /* dt */){};
protected:
// data
@ -315,7 +315,7 @@ namespace ATC {
// DO NOT define this
ThermostatRescaleMixedKePeCombined();
};
/**
@ -323,16 +323,16 @@ namespace ATC {
* @brief Enforces constraint on atomic kinetic energy based on FE temperature
* when the temperature is a mix of the KE and PE
*/
class KinetoThermostatRescaleMixedKePe : public KinetoThermostatRescale {
public:
KinetoThermostatRescaleMixedKePe(AtomicRegulator * kinetoThermostat,
int couplingMaxIterations);
virtual ~KinetoThermostatRescaleMixedKePe() {};
protected:
/** creates the appropriate rescaling thermostat */
@ -342,22 +342,22 @@ namespace ATC {
// DO NOT define this
KinetoThermostatRescaleMixedKePe();
};
/**
* @class KinetoThermostatGlcFs
* @brief Class for regulation algorithms based on Gaussian least constraints (GLC) for fractional step (FS) algorithsm
*/
class KinetoThermostatGlcFs : public KinetoThermostatShapeFunction {
public:
KinetoThermostatGlcFs(AtomicRegulator * kinetoThermostat,
int couplingMaxIterations,
const std::string & regulatorPrefix = "");
virtual ~KinetoThermostatGlcFs() {};
/** instantiate all needed data */
@ -374,7 +374,7 @@ namespace ATC {
/** applies thermostat to atoms in the post-corrector phase */
virtual void apply_post_corrector(double dt);
/** get data for output */
virtual void output(OUTPUT_LIST & outputData);
@ -494,12 +494,12 @@ namespace ATC {
/* *\/ */
/* class ThermostatFlux : public ThermostatGlcFs { */
/* public: */
/* ThermostatFlux(Thermostat * thermostat, */
/* const std::string & regulatorPrefix = ""); */
/* virtual ~ThermostatFlux() {}; */
/* /\** instantiate all needed data *\/ */
@ -507,7 +507,7 @@ namespace ATC {
/* /\** pre-run initialization of method data *\/ */
/* virtual void initialize(); */
/* protected: */
/* /\** sets up appropriate rhs for thermostat equations *\/ */
@ -539,12 +539,12 @@ namespace ATC {
/* *\/ */
/* class ThermostatFixed : public ThermostatGlcFs { */
/* public: */
/* ThermostatFixed(Thermostat * thermostat, */
/* const std::string & regulatorPrefix = ""); */
/* virtual ~ThermostatFixed() {}; */
/* /\** instantiate all needed data *\/ */
@ -552,7 +552,7 @@ namespace ATC {
/* /\** pre-run initialization of method data *\/ */
/* virtual void initialize(); */
/* /\** applies thermostat to atoms in the predictor phase *\/ */
/* virtual void apply_pre_predictor(double dt); */
@ -568,7 +568,7 @@ namespace ATC {
/* /\** determine if local shape function matrices are needed *\/ */
/* virtual bool use_local_shape_functions() const {return atomicRegulator_->use_localized_lambda();}; */
/* protected: */
/* // methods */
@ -639,12 +639,12 @@ namespace ATC {
/* *\/ */
/* class ThermostatFluxFiltered : public ThermostatFlux { */
/* public: */
/* ThermostatFluxFiltered(Thermostat * thermostat, */
/* const std::string & regulatorPrefix = ""); */
/* virtual ~ThermostatFluxFiltered() {}; */
/* /\** pre-run initialization of method data *\/ */
@ -655,7 +655,7 @@ namespace ATC {
/* /\** get data for output *\/ */
/* virtual void output(OUTPUT_LIST & outputData); */
/* protected: */
/* /\** 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 */
/* the fractional step time-integration with time filtering */
/* *\/ */
/* class ThermostatFixedFiltered : public ThermostatFixed { */
/* public: */
/* ThermostatFixedFiltered(Thermostat * thermostat, */
/* const std::string & regulatorPrefix = ""); */
/* virtual ~ThermostatFixedFiltered() {}; */
/* /\** get data for output *\/ */
/* virtual void output(OUTPUT_LIST & outputData); */
/* protected: */
/* // methods */
@ -734,7 +734,7 @@ namespace ATC {
/* ThermostatFluxFixed(Thermostat * thermostat, */
/* bool constructThermostats = true); */
/* virtual ~ThermostatFluxFixed(); */
/* /\** instantiate all needed data *\/ */
@ -751,7 +751,7 @@ namespace ATC {
/* /\** applies thermostat to atoms in the post-corrector phase *\/ */
/* virtual void apply_post_corrector(double dt); */
/* /\** get data for output *\/ */
/* virtual void output(OUTPUT_LIST & outputData); */
@ -787,7 +787,7 @@ namespace ATC {
/* public: */
/* ThermostatFluxFixedFiltered(Thermostat * thermostat); */
/* virtual ~ThermostatFluxFixedFiltered(){}; */
/* private: */

View File

@ -28,7 +28,7 @@ namespace ATC {
{
// do nothing
}
//--------------------------------------------------------
// modify:
// parses and adjusts kinetostat state based on
@ -46,20 +46,20 @@ namespace ATC {
/*! \page man_control_momentum fix_modify AtC control momentum
\section syntax
fix_modify AtC control momentum none \n
fix_modify AtC control momentum rescale <frequency>\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_velocity \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
(or not possible when the atomic domain does not line up with
mesh boundaries) defaults to an atomic-quadrature approximate
(or not possible when the atomic domain does not line up with
mesh boundaries) defaults to an atomic-quadrature approximate
evaulation\n
\section examples
fix_modify AtC control momentum glc_velocity \n
@ -108,7 +108,7 @@ namespace ATC {
foundMatch = true;
}
}
if (!foundMatch)
foundMatch = AtomicRegulator::modify(narg,arg);
if (foundMatch)
@ -126,13 +126,13 @@ namespace ATC {
DENS_MAN * lambdaForceFiltered = regulator_data("LambdaForceFiltered",nsd_);
lambdaForceFiltered->set_quantity() = target;
}
//--------------------------------------------------------
// initialize:
// sets up methods before a run
// dependence, but in general there is also a
// time integrator dependence. In general the
// time integrator dependence. In general the
// precedence order is:
// time filter -> time integrator -> kinetostat
// In the future this may need to be added if
@ -147,7 +147,7 @@ namespace ATC {
if (atc_->reset_methods()) {
// eliminate existing methods
delete_method();
DENS_MAT nodalGhostForceFiltered;
TimeIntegrator::TimeIntegrationType myIntegrationType = (atc_->time_integrator(VELOCITY))->time_integration_type();
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
@ -156,9 +156,9 @@ namespace ATC {
myMethod = dynamic_cast<StressFlux *>(regulatorMethod_);
nodalGhostForceFiltered = (myMethod->filtered_ghost_force()).quantity();
}
// update time filter
if (timeFilterManager->need_reset()) {
if (myIntegrationType == TimeIntegrator::FRACTIONAL_STEP) {
timeFilter_ = timeFilterManager->construct(TimeFilterManager::EXPLICIT_IMPLICIT);
@ -167,7 +167,7 @@ namespace ATC {
timeFilter_ = timeFilterManager->construct(TimeFilterManager::IMPLICIT_UPDATE);
}
}
if (timeFilterManager->filter_dynamics()) {
switch (regulatorTarget_) {
case NONE: {
@ -297,7 +297,7 @@ namespace ATC {
// Class KinetostatShapeFunction
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -369,7 +369,7 @@ namespace ATC {
// Class GlcKinetostat
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -391,7 +391,7 @@ namespace ATC {
// needed fundamental quantities
atomPositions_ = interscaleManager.fundamental_atom_quantity(LammpsInterface::ATOM_POSITION);
// base class transfers
KinetostatShapeFunction::construct_transfers();
}
@ -404,7 +404,7 @@ namespace ATC {
{
KinetostatShapeFunction::initialize();
// set up list of nodes using Hoover coupling
// (a) nodes with prescribed values
PrescribedDataManager * prescribedDataMgr(atc_->prescribed_data_manager());
@ -455,7 +455,7 @@ namespace ATC {
// Class DisplacementGlc
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -501,7 +501,7 @@ namespace ATC {
else {
linearSolverType_ = AtomicRegulator::CG_SOLVE;
}
// base class transfers
GlcKinetostat::construct_transfers();
@ -510,14 +510,14 @@ namespace ATC {
atomKinetostatForce_ = new AtomicKinetostatForceDisplacement(atc_);
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
regulatorPrefix_+"AtomKinetostatForce");
// restricted force due to kinetostat
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
atomKinetostatForce_,
interscaleManager.per_atom_sparse_matrix("Interpolant"));
interscaleManager.add_dense_matrix(nodalAtomicLambdaForce_,
regulatorPrefix_+"NodalAtomicLambdaForce");
// nodal displacement restricted from atoms
nodalAtomicMassWeightedDisplacement_ = interscaleManager.dense_matrix("NodalAtomicMassWeightedDisplacement");
}
@ -640,7 +640,7 @@ namespace ATC {
DENS_MAT & nodalField,
double weight)
{
DENS_MAT nodalLambdaRoc(nNodes_,nsd_);
atc_->apply_inverse_mass_matrix(source,
nodalLambdaRoc,
@ -666,13 +666,13 @@ namespace ATC {
outputData[regulatorPrefix_+"NodalLambdaForce"] = &(_nodalAtomicLambdaForceOut_);
}
}
//--------------------------------------------------------
//--------------------------------------------------------
// Class DisplacementGlcFiltered
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -683,7 +683,7 @@ namespace ATC {
{
// do nothing
}
//--------------------------------------------------------
// apply_pre_filtering
// applies first step of filtering to
@ -750,13 +750,13 @@ namespace ATC {
outputData[regulatorPrefix_+"NodalLambdaForce"] = &lambdaForceFiltered;
}
}
//--------------------------------------------------------
//--------------------------------------------------------
// Class VelocityGlc
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -805,7 +805,7 @@ namespace ATC {
else {
linearSolverType_ = AtomicRegulator::CG_SOLVE;
}
// base class transfers
GlcKinetostat::construct_transfers();
@ -813,18 +813,18 @@ namespace ATC {
atomKinetostatForce_ = new AtomicKinetostatForceVelocity(atc_);
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
regulatorPrefix_+"AtomKinetostatForce");
// restricted force due to kinetostat
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
atomKinetostatForce_,
interscaleManager.per_atom_sparse_matrix("Interpolant"));
interscaleManager.add_dense_matrix(nodalAtomicLambdaForce_,
regulatorPrefix_+"NodalAtomicLambdaForce");
// nodal momentum restricted from atoms
nodalAtomicMomentum_ = interscaleManager.dense_matrix("NodalAtomicMomentum");
}
//--------------------------------------------------------
@ -891,7 +891,7 @@ namespace ATC {
// set up rhs
DENS_MAT rhs(nNodes_,nsd_);
this->set_kinetostat_rhs(rhs,dt);
// solve linear system for lambda
solve_for_lambda(rhs,lambda_->set_quantity());
#ifdef OBSOLETE
@ -975,7 +975,7 @@ namespace ATC {
DENS_MAT & nodalField,
double weight)
{
DENS_MAT nodalLambdaRoc(nNodes_,nsd_);
atc_->apply_inverse_mass_matrix(source,
nodalLambdaRoc,
@ -984,7 +984,7 @@ namespace ATC {
for (iter = hooverNodes_.begin(); iter != hooverNodes_.end(); ++iter) {
nodalLambdaRoc(iter->first,iter->second) = 0.;
}
nodalField += weight*nodalLambdaRoc;
}
@ -1000,18 +1000,18 @@ namespace ATC {
outputData[regulatorPrefix_+"NodalLambdaForce"] = &(_nodalAtomicLambdaForceOut_);
}
}
//--------------------------------------------------------
//--------------------------------------------------------
// Class VelocityGlcFiltered
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
//--------------------------------------------------------
VelocityGlcFiltered::VelocityGlcFiltered(AtomicRegulator *kinetostat)
VelocityGlcFiltered::VelocityGlcFiltered(AtomicRegulator *kinetostat)
: VelocityGlc(kinetostat),
nodalAtomicVelocities_(atc_->nodal_atomic_field(VELOCITY))
{
@ -1087,7 +1087,7 @@ namespace ATC {
// Class StressFlux
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -1152,7 +1152,7 @@ namespace ATC {
atomKinetostatForce_ = new AtomicKinetostatForceStress(atc_,atomLambdas_);
interscaleManager.add_per_atom_quantity(atomKinetostatForce_,
regulatorPrefix_+"AtomKinetostatForce");
// restricted force due to kinetostat
nodalAtomicLambdaForce_ = new AtfShapeFunctionRestriction(atc_,
atomKinetostatForce_,
@ -1254,7 +1254,7 @@ namespace ATC {
//--------------------------------------------------------
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
// sources are set in ATC transfer
rhs.reset(nNodes_,nsd_);
@ -1262,9 +1262,9 @@ namespace ATC {
if (nodalGhostForce_) {
rhs -= nodalGhostForce_->quantity();
}
// (b) for ess. bcs
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
@ -1352,7 +1352,7 @@ namespace ATC {
// Class StressFluxGhost
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -1409,14 +1409,14 @@ namespace ATC {
//--------------------------------------------------------
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
// sources are set in ATC transfer
rhs.reset(nNodes_,nsd_);
rhs = momentumSource_.quantity();
// (b) for ess. bcs
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
@ -1434,7 +1434,7 @@ namespace ATC {
// Class StressFluxFiltered
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------
@ -1453,14 +1453,14 @@ namespace ATC {
void StressFluxFiltered::set_kinetostat_rhs(DENS_MAT & rhs, double dt)
{
// set basic terms
// (a) for flux based :
// (a) for flux based :
// form rhs : \int N_I r dV - \sum_g N_Ig^* f_g
// sources are set in ATC transfer
rhs.reset(nNodes_,nsd_);
rhs = momentumSource_.quantity() - nodalGhostForceFiltered_.quantity();
// (b) for ess. bcs
// form rhs : {sum_a (N_Ia * f_ia) - M_md * (ddupsilon/dt)_I}
DENS_MAT rhsPrescribed = -1.*nodalForce_.quantity();
atc_->apply_inverse_mass_matrix(rhsPrescribed,VELOCITY);
@ -1530,7 +1530,7 @@ namespace ATC {
// Class KinetostatGlcFs
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -1597,7 +1597,7 @@ namespace ATC {
void KinetostatGlcFs::initialize()
{
KinetostatShapeFunction::initialize();
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
if (!timeFilterManager->end_equilibrate()) {
// we should reset lambda and lambdaForce to zero in this case
@ -1675,7 +1675,7 @@ namespace ATC {
// update filtered forces
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_,
atomKinetostatForce_->quantity(),
nodalAtomicLambdaForce,0.5*dt);
@ -1710,13 +1710,13 @@ namespace ATC {
nodalAtomicPredictedMomentum_,
atomKinetostatForce_->quantity(),
myNodalAtomicLambdaForce,0.5*dt);
// update predicted nodal variables for second half of time step
this->add_to_momentum(myNodalAtomicLambdaForce,deltaMomentum_,0.5*dt);
atc_->apply_inverse_mass_matrix(deltaMomentum_,VELOCITY);
velocity_ += deltaMomentum_;
}
//--------------------------------------------------------
// apply_post_corrector:
// apply the kinetostat to the atoms in the
@ -1746,7 +1746,7 @@ namespace ATC {
atc_->apply_inverse_mass_matrix(deltaMomentum_,VELOCITY);
velocity_ += deltaMomentum_;
isFirstTimestep_ = false;
}
@ -1787,7 +1787,7 @@ namespace ATC {
// Class KinetostatFlux
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -1838,7 +1838,7 @@ namespace ATC {
// sets up space for ghost force related variables
if (atc_->groupbit_ghost()) {
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap =
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap =
interscaleManager.dense_matrix_int(regulatorPrefix_+"NodeToOverlapMap");
GhostCouplingMatrix * shapeFunctionGhost = new GhostCouplingMatrix(atc_,interscaleManager.per_atom_sparse_matrix("InterpolantGhost"),
regulatedNodes_,
@ -1861,7 +1861,7 @@ namespace ATC {
void KinetostatFlux::initialize()
{
KinetostatGlcFs::initialize();
TimeFilterManager * timeFilterManager = atc_->time_filter_manager();
if (!timeFilterManager->end_equilibrate()) {
// we should reset lambda and lambdaForce to zero in this case
@ -1894,13 +1894,13 @@ namespace ATC {
interscaleManager.add_set_int(regulatedNodes_,
regulatorPrefix_+"KinetostatRegulatedNodes");
}
// if localized monitor nodes with applied fluxes
if (atomicRegulator_->use_localized_lambda()) {
if ((atomicRegulator_->coupling_mode() == Kinetostat::FLUX) && (atomicRegulator_->boundary_integration_type() != NO_QUADRATURE)) {
// include boundary nodes
applicationNodes_ = new FluxBoundaryNodes(atc_);
boundaryNodes_ = new BoundaryNodes(atc_);
interscaleManager.add_set_int(boundaryNodes_,
regulatorPrefix_+"KinetostatBoundaryNodes");
@ -1916,7 +1916,7 @@ namespace ATC {
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)
&& (atomicRegulator_->use_localized_lambda())) {
elementMask_ = interscaleManager.dense_matrix_bool(regulatorPrefix_+"BoundaryElementMask");
@ -1943,7 +1943,7 @@ namespace ATC {
KinetostatGlcFs::apply_pre_predictor(dt);
}
//--------------------------------------------------------
// apply_post_corrector:
// apply the kinetostat to the atoms in the
@ -1956,7 +1956,7 @@ namespace ATC {
timeFilter_->apply_post_step1(nodalGhostForceFiltered_->set_quantity(),
nodalGhostForce_->quantity(),dt);
}
// compute the kinetostat equation and update lambda
KinetostatGlcFs::apply_post_corrector(dt);
}
@ -1987,7 +1987,7 @@ namespace ATC {
//--------------------------------------------------------
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
// sources are set in ATC transfer
rhs.reset(nNodes_,nsd_);
@ -2026,7 +2026,7 @@ namespace ATC {
// Class KinetostatFluxGhost
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -2088,7 +2088,7 @@ namespace ATC {
//--------------------------------------------------------
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
// sources are set in ATC transfer
rhs.reset(nNodes_,nsd_);
@ -2107,7 +2107,7 @@ namespace ATC {
// Class KinetostatFixed
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
// Grab references to ATC and kinetostat data
@ -2211,14 +2211,14 @@ namespace ATC {
else {
throw ATC_Error("KinetostatFixed::construct_regulated_nodes - couldn't determine set of regulated nodes");
}
interscaleManager.add_set_int(regulatedNodes_,
regulatorPrefix_+"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()) {
elementMask_ = interscaleManager.dense_matrix_bool(regulatorPrefix_+"BoundaryElementMask");
if (!elementMask_) {
@ -2310,15 +2310,15 @@ namespace ATC {
nodalAtomicMomentumFiltered_ = _tempNodalAtomicMomentumFiltered_;
}
}
//--------------------------------------------------------
// apply_post_corrector:
// apply the kinetostat to the atoms in the
// post-corrector integration phase
//--------------------------------------------------------
void KinetostatFixed::apply_post_corrector(double dt)
{
{
bool halveForce = halve_force();
KinetostatGlcFs::apply_post_corrector(dt);
@ -2333,8 +2333,8 @@ namespace ATC {
// 1) makes up for poor initial condition
// 2) accounts for possibly large value of lambda when atomic shape function values change
// from eulerian mapping after more than 1 timestep
// avoids unstable oscillations arising from
// thermostat having to correct for error introduced in lambda changing the
// avoids unstable oscillations arising from
// thermostat having to correct for error introduced in lambda changing the
// shape function matrices
*lambda_ *= 0.5;
}
@ -2396,7 +2396,7 @@ namespace ATC {
// Class KinetostatFluxFixed
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Constructor
//--------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More