本文整理汇总了C++中MultiLevelMesh::GenerateCoarseBoxMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiLevelMesh::GenerateCoarseBoxMesh方法的具体用法?C++ MultiLevelMesh::GenerateCoarseBoxMesh怎么用?C++ MultiLevelMesh::GenerateCoarseBoxMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiLevelMesh
的用法示例。
在下文中一共展示了MultiLevelMesh::GenerateCoarseBoxMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** args)
{
SlepcInitialize(&argc, &args, PETSC_NULL, PETSC_NULL);
// init Petsc-MPI communicator
FemusInit mpinit(argc, args, MPI_COMM_WORLD);
// define multilevel mesh
MultiLevelMesh mlMsh;
double scalingFactor = 1.;
unsigned numberOfUniformLevels = 1;
unsigned numberOfSelectiveLevels = 0;
unsigned nx = static_cast<unsigned>(floor(pow(2.,11) + 0.5));
double length = 2. * 1465700.;
mlMsh.GenerateCoarseBoxMesh(nx, 0, 0, -length / 2, length / 2, 0., 0., 0., 0., EDGE3, "seventh");
//mlMsh.RefineMesh(numberOfUniformLevels + numberOfSelectiveLevels, numberOfUniformLevels , NULL);
mlMsh.PrintInfo();
// define the multilevel solution and attach the mlMsh object to it
MultiLevelSolution mlSol(&mlMsh);
for(unsigned i = 0; i < NumberOfLayers; i++) {
char name[10];
sprintf(name, "h%d", i);
mlSol.AddSolution(name, DISCONTINUOUS_POLYNOMIAL, ZERO);
sprintf(name, "v%d", i);
mlSol.AddSolution(name, LAGRANGE, FIRST);
sprintf(name, "T%d", i);
mlSol.AddSolution(name, DISCONTINUOUS_POLYNOMIAL, ZERO);
sprintf(name, "HT%d", i);
mlSol.AddSolution(name, DISCONTINUOUS_POLYNOMIAL, ZERO);
}
mlSol.AddSolution("b", DISCONTINUOUS_POLYNOMIAL, ZERO, 1, false);
mlSol.AddSolution("eta", DISCONTINUOUS_POLYNOMIAL, ZERO, 1, false);
mlSol.Initialize("All");
mlSol.Initialize("h0",InitalValueH0);
mlSol.Initialize("T0",InitalValueT0);
if(NumberOfLayers > 1){
mlSol.Initialize("h1",InitalValueH1);
mlSol.Initialize("T1",InitalValueT1);
if(NumberOfLayers > 2){
mlSol.Initialize("h2",InitalValueH2);
mlSol.Initialize("T2",InitalValueT2);
}
}
for(unsigned i = 0; i < NumberOfLayers; i++) {
char name[10];
sprintf(name, "v%d", i);
mlSol.Initialize(name, InitalValueV);
}
mlSol.Initialize("b", InitalValueB);
mlSol.AttachSetBoundaryConditionFunction(SetBoundaryCondition);
mlSol.GenerateBdc("All");
MultiLevelProblem ml_prob(&mlSol);
// ******* Add FEM system to the MultiLevel problem *******
LinearImplicitSystem& system = ml_prob.add_system < LinearImplicitSystem > ("SW");
for(unsigned i = 0; i < NumberOfLayers; i++) {
char name[10];
sprintf(name, "h%d", i);
system.AddSolutionToSystemPDE(name);
sprintf(name, "v%d", i);
system.AddSolutionToSystemPDE(name);
sprintf(name, "HT%d", i);
system.AddSolutionToSystemPDE(name);
}
system.init();
mlSol.SetWriter(VTK);
std::vector<std::string> print_vars;
print_vars.push_back("All");
//mlSol.GetWriter()->SetDebugOutput(true);
mlSol.GetWriter()->Write(DEFAULT_OUTPUTDIR, "linear", print_vars, 0);
unsigned numberOfTimeSteps = 2000;
for(unsigned i = 0; i < numberOfTimeSteps; i++) {
ETD(ml_prob);
mlSol.GetWriter()->Write(DEFAULT_OUTPUTDIR, "linear", print_vars, (i + 1)/1);
}
return 0;
}