50 "Computes C0 projection.");
56 true,
"0",
"Just perform a local to global mapping and back");
59 "Use boundary conditions given in xml file. Requires all "
60 "projected fields to be defined in xml file");
63 "Use a Helmholtz smoother to remove high frequency "
64 "components above specified L");
66 f->m_declareExpansionAsContField =
true;
78 if (
m_f->m_exp[0]->GetNumElmts() == 0)
85 if (
m_f->m_graph->GetMeshDimension() == 3)
87 if (boost::iequals(
m_f->m_session->GetSolverInfo(
"GLOBALSYSSOLN"),
88 "IterativeStaticCond"))
90 if (boost::iequals(
m_f->m_session->GetSolverInfo(
"PRECONDITIONER"),
93 m_f->m_session->SetSolverInfo(
"PRECONDITIONER",
96 if (boost::iequals(
m_f->m_session->GetSolverInfo(
"PRECONDITIONER"),
97 "FullLinearSpaceWithDiagonal"))
99 m_f->m_session->SetSolverInfo(
100 "PRECONDITIONER",
"FullLinearSpaceWithLowEnergyBlock");
105 if (
m_f->m_comm->GetRank() == 0)
107 cout <<
"Resetting diagonal precondition to low energy "
114 bool JustPerformLocToGloMap =
m_config[
"localtoglobalmap"].as<
bool>();
116 (boost::iequals(
m_config[
"helmsmoothing"].as<string>(),
"Not Set"))
119 int nfields =
m_f->m_exp.size();
121 if (
m_config[
"usexmlbcs"].as<bool>())
123 for (
int i = 0; i < nfields; ++i)
125 C0ProjectExp[i] =
m_f->m_exp[i];
131 bool savedef =
m_f->m_declareExpansionAsContField;
132 bool savedef2 =
m_f->m_requireBoundaryExpansion;
133 m_f->m_declareExpansionAsContField =
true;
134 m_f->m_requireBoundaryExpansion =
false;
136 m_f->AppendExpList(
m_f->m_numHomogeneousDir,
"DefaultVar",
true);
137 m_f->m_declareExpansionAsContField = savedef;
138 m_f->m_requireBoundaryExpansion = savedef2;
139 for (
int i = 1; i < nfields; ++i)
141 C0ProjectExp[i] = C0ProjectExp[0];
145 string fields =
m_config[
"fields"].as<
string>();
146 vector<unsigned int> processFields;
149 if (fields.compare(
"All") == 0)
151 for (
int i = 0; i < nfields; ++i)
153 processFields.push_back(i);
159 "Failed to interpret field string in C0Projection");
162 for (
int i = 0; i < processFields.size(); ++i)
164 ASSERTL0(processFields[i] < nfields,
165 "Attempt to process field that is larger than then number of "
170 if (
m_f->m_comm->GetRank() == 0)
172 cout <<
"\t Processing field: " << processFields[i] << endl;
176 if (JustPerformLocToGloMap)
178 int ncoeffs =
m_f->m_exp[0]->GetNcoeffs();
182 C0ProjectExp[processFields[i]]->LocalToGlobal(Coeffs, Coeffs);
183 C0ProjectExp[processFields[i]]->GlobalToLocal(Coeffs, Coeffs);
186 tmp =
m_f->m_exp[processFields[i]]->UpdateCoeffs(), 1);
190 int ncoeffs =
m_f->m_exp[0]->GetNcoeffs();
193 int npoints =
m_f->m_exp[0]->GetNpoints();
195 lambda = 2 * M_PI / lambda;
196 lambda = lambda * lambda;
200 cout <<
"Setting up Helmholtz smoother with lambda = "
209 m_f->m_exp[processFields[i]]->GetPhys(), 1, forcing,
212 m_f->m_exp[processFields[i]]->UpdateCoeffs(), 1);
213 C0ProjectExp[processFields[i]]->HelmSolve(
214 forcing,
m_f->m_exp[processFields[i]]->UpdateCoeffs(),
220 m_f->m_exp[processFields[i]]->UpdateCoeffs(), 1);
221 C0ProjectExp[processFields[i]]->FwdTrans(
222 m_f->m_exp[processFields[i]]->GetPhys(),
223 m_f->m_exp[processFields[i]]->UpdateCoeffs());
226 C0ProjectExp[processFields[i]]->BwdTrans(
227 m_f->m_exp[processFields[i]]->GetCoeffs(),
228 tmp =
m_f->m_exp[processFields[i]]->UpdatePhys());
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
void v_Process(po::variables_map &vm) override
Write mesh to output file.
static ModuleKey className
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
~ProcessC0Projection() override
ProcessC0Projection(FieldSharedPtr f)
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
std::map< ConstFactorType, NekDouble > ConstFactorMap
StdRegions::ConstFactorMap factors
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Represents a command-line configuration option.