Skip to content

Commit

Permalink
coef -> coeff consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiangrimberg committed May 9, 2024
1 parent 01b6574 commit e285f87
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 59 deletions.
12 changes: 6 additions & 6 deletions palace/fem/lumpedelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ UniformElementData::UniformElementData(const std::array<double, 3> &input_dir,
}

std::unique_ptr<mfem::VectorCoefficient>
UniformElementData::GetModeCoefficient(double coef) const
UniformElementData::GetModeCoefficient(double coeff) const
{
mfem::Vector source = direction;
source *= coef;
source *= coeff;
return std::make_unique<RestrictedVectorCoefficient<mfem::VectorConstantCoefficient>>(
attr_list, source);
}
Expand Down Expand Up @@ -134,16 +134,16 @@ CoaxialElementData::CoaxialElementData(const std::array<double, 3> &input_dir,
}

std::unique_ptr<mfem::VectorCoefficient>
CoaxialElementData::GetModeCoefficient(double coef) const
CoaxialElementData::GetModeCoefficient(double coeff) const
{
coef *= direction;
coeff *= direction;
mfem::Vector x0(origin);
auto Source = [coef, x0](const mfem::Vector &x, mfem::Vector &f) -> void
auto Source = [coeff, x0](const mfem::Vector &x, mfem::Vector &f) -> void
{
f = x;
f -= x0;
double oor = 1.0 / f.Norml2();
f *= coef * oor * oor;
f *= coeff * oor * oor;
};
return std::make_unique<RestrictedVectorCoefficient<mfem::VectorFunctionCoefficient>>(
attr_list, x0.Size(), Source);
Expand Down
6 changes: 3 additions & 3 deletions palace/fem/lumpedelement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LumpedElementData
virtual double GetGeometryWidth() const = 0;

virtual std::unique_ptr<mfem::VectorCoefficient>
GetModeCoefficient(double coef = 1.0) const = 0;
GetModeCoefficient(double coeff = 1.0) const = 0;
};

class UniformElementData : public LumpedElementData
Expand All @@ -51,7 +51,7 @@ class UniformElementData : public LumpedElementData
double GetGeometryWidth() const override { return w; }

std::unique_ptr<mfem::VectorCoefficient>
GetModeCoefficient(double coef = 1.0) const override;
GetModeCoefficient(double coeff = 1.0) const override;
};

class CoaxialElementData : public LumpedElementData
Expand All @@ -75,7 +75,7 @@ class CoaxialElementData : public LumpedElementData
double GetGeometryWidth() const override { return 2.0 * M_PI; }

std::unique_ptr<mfem::VectorCoefficient>
GetModeCoefficient(double coef = 1.0) const override;
GetModeCoefficient(double coeff = 1.0) const override;
};

} // namespace palace
Expand Down
4 changes: 2 additions & 2 deletions palace/models/farfieldboundaryoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ FarfieldBoundaryOperator::SetUpBoundaryProperties(const IoData &iodata,
return farfield_bcs;
}

void FarfieldBoundaryOperator::AddDampingBdrCoefficients(double coef,
void FarfieldBoundaryOperator::AddDampingBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// First-order absorbing boundary condition.
Expand All @@ -94,7 +94,7 @@ void FarfieldBoundaryOperator::AddDampingBdrCoefficients(double coef,
mat_op.GetInvImpedance());
invz0_func.RestrictCoefficient(mat_op.GetCeedBdrAttributes(farfield_attr));
fb.AddCoefficient(invz0_func.GetAttributeToMaterial(),
invz0_func.GetMaterialProperties(), coef);
invz0_func.GetMaterialProperties(), coeff);
}
}

Expand Down
2 changes: 1 addition & 1 deletion palace/models/farfieldboundaryoperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FarfieldBoundaryOperator

// Add contributions to system matrices from first- or second-order absorbing boundary
// condition.
void AddDampingBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddDampingBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddExtraSystemBdrCoefficients(double omega, MaterialPropertyCoefficient &dfbr,
MaterialPropertyCoefficient &dfbi);
};
Expand Down
12 changes: 6 additions & 6 deletions palace/models/lumpedportoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ mfem::Array<int> LumpedPortOperator::GetCsAttrList() const
return attr_list;
}

void LumpedPortOperator::AddStiffnessBdrCoefficients(double coef,
void LumpedPortOperator::AddStiffnessBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Add lumped inductor boundaries to the bilinear form.
Expand All @@ -586,13 +586,13 @@ void LumpedPortOperator::AddStiffnessBdrCoefficients(double coef,
{
const double Ls = data.L * data.GetToSquare(*elem);
fb.AddMaterialProperty(data.mat_op.GetCeedBdrAttributes(elem->GetAttrList()),
coef / Ls);
coeff / Ls);
}
}
}
}

void LumpedPortOperator::AddDampingBdrCoefficients(double coef,
void LumpedPortOperator::AddDampingBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Add lumped resistor boundaries to the bilinear form.
Expand All @@ -608,13 +608,13 @@ void LumpedPortOperator::AddDampingBdrCoefficients(double coef,
{
const double Rs = data.R * data.GetToSquare(*elem);
fb.AddMaterialProperty(data.mat_op.GetCeedBdrAttributes(elem->GetAttrList()),
coef / Rs);
coeff / Rs);
}
}
}
}

void LumpedPortOperator::AddMassBdrCoefficients(double coef,
void LumpedPortOperator::AddMassBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Add lumped capacitance boundaries to the bilinear form.
Expand All @@ -630,7 +630,7 @@ void LumpedPortOperator::AddMassBdrCoefficients(double coef,
{
const double Cs = data.C / data.GetToSquare(*elem);
fb.AddMaterialProperty(data.mat_op.GetCeedBdrAttributes(elem->GetAttrList()),
coef * Cs);
coeff * Cs);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions palace/models/lumpedportoperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ class LumpedPortOperator

// Add contributions to system matrices from lumped elements with nonzero inductance,
// resistance, and/or capacitance.
void AddStiffnessBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddDampingBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddMassBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddStiffnessBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddDampingBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddMassBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);

// Add contributions to the right-hand side source term vector for an incident field at
// excited port boundaries, -U_inc/(iω) for the real version (versus the full -U_inc for
Expand Down
43 changes: 22 additions & 21 deletions palace/models/spaceoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,69 +810,70 @@ std::unique_ptr<OperType> SpaceOperator::GetPreconditionerMatrix(double a0, doub
return B;
}

void SpaceOperator::AddStiffnessCoefficients(double coef, MaterialPropertyCoefficient &df,
void SpaceOperator::AddStiffnessCoefficients(double coeff, MaterialPropertyCoefficient &df,
MaterialPropertyCoefficient &f)
{
// Contribution from material permeability.
df.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetInvPermeability(), coef);
df.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetInvPermeability(), coeff);

// Contribution for London superconductors.
if (mat_op.HasLondonDepth())
{
df.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetInvLondonDepth(), coef);
df.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetInvLondonDepth(), coeff);
}
}

void SpaceOperator::AddStiffnessBdrCoefficients(double coef,
void SpaceOperator::AddStiffnessBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Robin BC contributions due to surface impedance and lumped ports (inductance).
surf_z_op.AddStiffnessBdrCoefficients(coef, fb);
lumped_port_op.AddStiffnessBdrCoefficients(coef, fb);
surf_z_op.AddStiffnessBdrCoefficients(coeff, fb);
lumped_port_op.AddStiffnessBdrCoefficients(coeff, fb);
}

void SpaceOperator::AddDampingCoefficients(double coef, MaterialPropertyCoefficient &f)
void SpaceOperator::AddDampingCoefficients(double coeff, MaterialPropertyCoefficient &f)
{
// Contribution for domain conductivity.
if (mat_op.HasConductivity())
{
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetConductivity(), coef);
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetConductivity(), coeff);
}
}

void SpaceOperator::AddDampingBdrCoefficients(double coef, MaterialPropertyCoefficient &fb)
void SpaceOperator::AddDampingBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb)
{
// Robin BC contributions due to surface impedance, lumped ports, and absorbing
// boundaries (resistance).
farfield_op.AddDampingBdrCoefficients(coef, fb);
surf_z_op.AddDampingBdrCoefficients(coef, fb);
lumped_port_op.AddDampingBdrCoefficients(coef, fb);
farfield_op.AddDampingBdrCoefficients(coeff, fb);
surf_z_op.AddDampingBdrCoefficients(coeff, fb);
lumped_port_op.AddDampingBdrCoefficients(coeff, fb);
}

void SpaceOperator::AddRealMassCoefficients(double coef, MaterialPropertyCoefficient &f)
void SpaceOperator::AddRealMassCoefficients(double coeff, MaterialPropertyCoefficient &f)
{
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetPermittivityReal(), coef);
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetPermittivityReal(), coeff);
}

void SpaceOperator::AddRealMassBdrCoefficients(double coef, MaterialPropertyCoefficient &fb)
void SpaceOperator::AddRealMassBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Robin BC contributions due to surface impedance and lumped ports (capacitance).
surf_z_op.AddMassBdrCoefficients(coef, fb);
lumped_port_op.AddMassBdrCoefficients(coef, fb);
surf_z_op.AddMassBdrCoefficients(coeff, fb);
lumped_port_op.AddMassBdrCoefficients(coeff, fb);
}

void SpaceOperator::AddImagMassCoefficients(double coef, MaterialPropertyCoefficient &f)
void SpaceOperator::AddImagMassCoefficients(double coeff, MaterialPropertyCoefficient &f)
{
// Contribution for loss tangent: ε -> ε * (1 - i tan(δ)).
if (mat_op.HasLossTangent())
{
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetPermittivityImag(), coef);
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetPermittivityImag(), coeff);
}
}

void SpaceOperator::AddAbsMassCoefficients(double coef, MaterialPropertyCoefficient &f)
void SpaceOperator::AddAbsMassCoefficients(double coeff, MaterialPropertyCoefficient &f)
{
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetPermittivityAbs(), coef);
f.AddCoefficient(mat_op.GetAttributeToMaterial(), mat_op.GetPermittivityAbs(), coeff);
}

void SpaceOperator::AddExtraSystemBdrCoefficients(double omega,
Expand Down
16 changes: 8 additions & 8 deletions palace/models/spaceoperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class SpaceOperator

// Helper functions for building the bilinear forms corresponding to the discretized
// operators in Maxwell's equations.
void AddStiffnessCoefficients(double coef, MaterialPropertyCoefficient &df,
void AddStiffnessCoefficients(double coeff, MaterialPropertyCoefficient &df,
MaterialPropertyCoefficient &f);
void AddStiffnessBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddDampingCoefficients(double coef, MaterialPropertyCoefficient &f);
void AddDampingBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddRealMassCoefficients(double coef, MaterialPropertyCoefficient &f);
void AddRealMassBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddImagMassCoefficients(double coef, MaterialPropertyCoefficient &f);
void AddAbsMassCoefficients(double coef, MaterialPropertyCoefficient &f);
void AddStiffnessBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddDampingCoefficients(double coeff, MaterialPropertyCoefficient &f);
void AddDampingBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddRealMassCoefficients(double coeff, MaterialPropertyCoefficient &f);
void AddRealMassBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddImagMassCoefficients(double coeff, MaterialPropertyCoefficient &f);
void AddAbsMassCoefficients(double coeff, MaterialPropertyCoefficient &f);
void AddExtraSystemBdrCoefficients(double omega, MaterialPropertyCoefficient &dfbr,
MaterialPropertyCoefficient &dfbi,
MaterialPropertyCoefficient &fbr,
Expand Down
12 changes: 6 additions & 6 deletions palace/models/surfaceimpedanceoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,41 +174,41 @@ mfem::Array<int> SurfaceImpedanceOperator::GetCsAttrList() const
return attr_list;
}

void SurfaceImpedanceOperator::AddStiffnessBdrCoefficients(double coef,
void SurfaceImpedanceOperator::AddStiffnessBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Lumped inductor boundaries.
for (const auto &bdr : boundaries)
{
if (std::abs(bdr.Ls) > 0.0)
{
fb.AddMaterialProperty(mat_op.GetCeedBdrAttributes(bdr.attr_list), coef / bdr.Ls);
fb.AddMaterialProperty(mat_op.GetCeedBdrAttributes(bdr.attr_list), coeff / bdr.Ls);
}
}
}

void SurfaceImpedanceOperator::AddDampingBdrCoefficients(double coef,
void SurfaceImpedanceOperator::AddDampingBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Lumped resistor boundaries.
for (const auto &bdr : boundaries)
{
if (std::abs(bdr.Rs) > 0.0)
{
fb.AddMaterialProperty(mat_op.GetCeedBdrAttributes(bdr.attr_list), coef / bdr.Rs);
fb.AddMaterialProperty(mat_op.GetCeedBdrAttributes(bdr.attr_list), coeff / bdr.Rs);
}
}
}

void SurfaceImpedanceOperator::AddMassBdrCoefficients(double coef,
void SurfaceImpedanceOperator::AddMassBdrCoefficients(double coeff,
MaterialPropertyCoefficient &fb)
{
// Lumped capacitor boundaries.
for (const auto &bdr : boundaries)
{
if (std::abs(bdr.Cs) > 0.0)
{
fb.AddMaterialProperty(mat_op.GetCeedBdrAttributes(bdr.attr_list), coef * bdr.Cs);
fb.AddMaterialProperty(mat_op.GetCeedBdrAttributes(bdr.attr_list), coeff * bdr.Cs);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions palace/models/surfaceimpedanceoperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class SurfaceImpedanceOperator
// Add contributions to system matrices from impedance boundaries with nonzero inductance,
// resistance, and/or capacitance. For boundaries with more than R/L/C, impedances add in
// parallel.
void AddStiffnessBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddDampingBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddMassBdrCoefficients(double coef, MaterialPropertyCoefficient &fb);
void AddStiffnessBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddDampingBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
void AddMassBdrCoefficients(double coeff, MaterialPropertyCoefficient &fb);
};

} // namespace palace
Expand Down

0 comments on commit e285f87

Please sign in to comment.