fix(poly): working to resolve overshoot mode
This commit is contained in:
@@ -50,8 +50,9 @@ namespace polyMFEMUtils {
|
||||
int dof = el.GetDof();
|
||||
elvect.SetSize(dof);
|
||||
elvect = 0.0;
|
||||
|
||||
|
||||
mfem::Vector shape(dof);
|
||||
mfem::Vector physCoord;
|
||||
for (int iqp = 0; iqp < ir->GetNPoints(); iqp++) {
|
||||
mfem::IntegrationPoint ip = ir->IntPoint(iqp);
|
||||
Trans.SetIntPoint(&ip);
|
||||
@@ -65,10 +66,19 @@ namespace polyMFEMUtils {
|
||||
}
|
||||
|
||||
double u_nl;
|
||||
if (u_val < m_epsilon) {
|
||||
u_nl = fmod(u_val, m_polytropicIndex, m_epsilon);
|
||||
Trans.Transform(ip, physCoord);
|
||||
const double r = physCoord.Norml2();
|
||||
std::ofstream outFile("r.dat", std::ios::app);
|
||||
outFile << r << '\n';
|
||||
outFile.close();
|
||||
if (r > m_regularizationRadius) {
|
||||
if (u_val < m_epsilon) {
|
||||
u_nl = fmod(u_val, m_polytropicIndex, m_epsilon);
|
||||
} else {
|
||||
u_nl = std::pow(u_val, m_polytropicIndex);
|
||||
}
|
||||
} else {
|
||||
u_nl = std::pow(u_val, m_polytropicIndex);
|
||||
u_nl = 1.0 - m_polytropicIndex * m_regularizationCoeff * std::pow(r, 2);
|
||||
}
|
||||
|
||||
for (int i = 0; i < dof; i++){
|
||||
@@ -91,14 +101,14 @@ namespace polyMFEMUtils {
|
||||
mfem::Vector shape(dof);
|
||||
mfem::DenseMatrix dshape(dof, 3);
|
||||
mfem::DenseMatrix invJ(3, 3);
|
||||
mfem::Vector gradPhys(3);
|
||||
mfem::Vector physCoord(3);
|
||||
mfem::Vector physCoord;
|
||||
|
||||
for (int iqp = 0; iqp < ir->GetNPoints(); iqp++) {
|
||||
const mfem::IntegrationPoint &ip = ir->IntPoint(iqp);
|
||||
Trans.SetIntPoint(&ip);
|
||||
const double weight = ip.weight * Trans.Weight();
|
||||
|
||||
Trans.Transform(ip, physCoord);
|
||||
double r = physCoord.Norml2();
|
||||
|
||||
el.CalcShape(ip, shape);
|
||||
|
||||
@@ -108,14 +118,15 @@ namespace polyMFEMUtils {
|
||||
u_val += elfun(j) * shape(j);
|
||||
}
|
||||
|
||||
// Calculate the Jacobian
|
||||
|
||||
// TODO: Check for when theta ~ 0?
|
||||
double d_u_nl;
|
||||
if (u_val < m_epsilon) {
|
||||
d_u_nl = dfmod(m_epsilon, m_polytropicIndex);
|
||||
if (r > m_regularizationRadius) {
|
||||
if (u_val < m_epsilon) {
|
||||
d_u_nl = dfmod(m_epsilon, m_polytropicIndex);
|
||||
} else {
|
||||
d_u_nl = m_polytropicIndex * std::pow(u_val, m_polytropicIndex - 1.0);
|
||||
}
|
||||
} else {
|
||||
d_u_nl = m_polytropicIndex * std::pow(u_val, m_polytropicIndex - 1.0);
|
||||
d_u_nl = 0.0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < dof; i++) {
|
||||
|
||||
Reference in New Issue
Block a user