Skip to content

Commit edc4bbb

Browse files
authored
Merge pull request #25 from yangbai90/devel
Devel
2 parents 947eddb + 2ff9ac6 commit edc4bbb

32 files changed

Lines changed: 410 additions & 102 deletions

CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ set(CMAKE_CXX_STANDARD 17)
88
### The only things to modify is the ###
99
### following two lines(PETSC/MPI_DIR) ###
1010
###############################################
11-
set(PETSC_DIR "/home/by/Programs/petsc/3.14.2")
12-
set(MPI_DIR "/home/by/Programs/mpich/3.3.2")
11+
set(PETSC_DIR "/home/by/Programs/petsc/3.14.3")
12+
set(MPI_DIR "/home/by/Programs/mpich/3.4")
1313

1414
###############################################
1515
### For your PETSc library file (edit) ###
@@ -30,14 +30,12 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/external/eigen")
3030
###############################################
3131
### For debug mode ###
3232
###############################################
33-
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -O2 -fopenmp")
33+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -O2 -fopenmp")
3434

3535
###############################################
3636
### For release mode ###
3737
###############################################
38-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fopenmp -O3 -march=native -DNDEBUG")
39-
# if you have mumps installed, please use the following line
40-
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fopenmp -O3 -march=native -DNDEBUG -DHASMUMPS")
38+
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fopenmp -O3 -march=native -DNDEBUG")
4139

4240

4341
###############################################

examples/tutorial/step1.i

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//*** this is the input file for your first step in AsFem
2+
3+
[mesh]
4+
type=asfem
5+
dim=3
6+
nx=10
7+
ny=10
8+
nz=10
9+
meshtype=hex8
10+
savemesh=true
11+
[end]

examples/tutorial/step2-3d.i

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//*** this is the input file for step-2
2+
3+
[mesh]
4+
type=asfem
5+
dim=3
6+
nx=25
7+
ny=25
8+
nz=25
9+
meshtype=hex8
10+
savemesh=true
11+
[end]
12+
13+
[dofs]
14+
name=phi
15+
[end]
16+
17+
[elmts]
18+
[elmt1]
19+
type=poisson
20+
dofs=phi
21+
mate=mymate
22+
[end]
23+
[end]
24+
25+
[mates]
26+
[mymate]
27+
type=constpoisson
28+
params=1.0 1.0e1
29+
[end]
30+
[end]
31+
32+
[bcs]
33+
[fixleft]
34+
type=dirichlet
35+
dof=phi
36+
value=0.1
37+
boundary=left
38+
[end]
39+
[fixright]
40+
type=dirichlet
41+
dof=phi
42+
value=0.5
43+
boundary=right
44+
[end]
45+
[end]
46+
47+
48+
[job]
49+
type=static
50+
debug=dep
51+
[end]

examples/tutorial/step2.i

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//*** this is the input file for step-2
2+
3+
[mesh]
4+
type=asfem
5+
dim=2
6+
nx=50
7+
ny=50
8+
meshtype=quad4
9+
[end]
10+
11+
[dofs]
12+
name=phi
13+
[end]
14+
15+
[elmts]
16+
[elmt1]
17+
type=poisson
18+
dofs=phi
19+
mate=mymate
20+
[end]
21+
[end]
22+
23+
[mates]
24+
[mymate]
25+
type=constpoisson
26+
params=1.0 1.0e1
27+
[end]
28+
[end]
29+
30+
[bcs]
31+
[fixleft]
32+
type=dirichlet
33+
dof=phi
34+
value=0.1
35+
boundary=left
36+
[end]
37+
[fixright]
38+
type=dirichlet
39+
dof=phi
40+
value=0.5
41+
boundary=right
42+
[end]
43+
[end]
44+
45+
46+
[job]
47+
type=static
48+
[end]

include/ElmtSystem/BulkElmtSystem.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class BulkElmtSystem{
5050

5151

5252
void RunBulkElmtLibs(const FECalcType &calctype,const ElmtType &elmtytype,
53-
const int &nDim,const int &nNodes,
53+
const int &nDim,const int &nNodes,const int &nDofs,
5454
const double &t,const double &dt,const double (&ctan)[2],
5555
const Vector3d &gpCoords,
5656
const vector<double> &gpU,const vector<double> &gpV,
@@ -78,7 +78,7 @@ class BulkElmtSystem{
7878
//****************************************************************************
7979
//*** the laplace means: \int(\nabla U*\nabla test)dV
8080
void LaplaceElmt(const FECalcType &calctype,
81-
const int &nDim,const int &nNodes,
81+
const int &nDim,const int &nNodes,const int &nDofs,
8282
const double &t,const double &dt,const double (&ctan)[2],
8383
const Vector3d &gpCoords,
8484
const vector<double> &gpU,const vector<double> &gpV,
@@ -93,7 +93,7 @@ class BulkElmtSystem{
9393
MatrixXd &localK,VectorXd &localR);
9494
//*** the body source means int(f*test)dV
9595
void BodySourceElmt(const FECalcType &calctype,
96-
const int &nDim,const int &nNodes,
96+
const int &nDim,const int &nNodes,const int &nDofs,
9797
const double &t,const double &dt,const double (&ctan)[2],
9898
const Vector3d &gpCoords,
9999
const vector<double> &gpU,const vector<double> &gpV,
@@ -110,7 +110,7 @@ class BulkElmtSystem{
110110
//*** for general time derivative
111111
//************************************************************************************
112112
void TimeDerivElmt(const FECalcType &calctype,
113-
const int &nDim,const int &nNodes,
113+
const int &nDim,const int &nNodes,const int &nDofs,
114114
const double &t,const double &dt,const double (&ctan)[2],
115115
const Vector3d &gpCoords,
116116
const vector<double> &gpU,const vector<double> &gpV,
@@ -127,7 +127,7 @@ class BulkElmtSystem{
127127
//*** for general poisson element
128128
//************************************************************************************
129129
void PoissonElmt(const FECalcType &calctype,
130-
const int &nDim,const int &nNodes,
130+
const int &nDim,const int &nNodes,const int &nDofs,
131131
const double &t,const double &dt,const double (&ctan)[2],
132132
const Vector3d &gpCoords,
133133
const vector<double> &gpU,const vector<double> &gpV,
@@ -145,7 +145,7 @@ class BulkElmtSystem{
145145
//*** for general diffusion element
146146
//************************************************************************************
147147
void DiffusionElmt(const FECalcType &calctype,
148-
const int &nDim,const int &nNodes,
148+
const int &nDim,const int &nNodes,const int &nDofs,
149149
const double &t,const double &dt,const double (&ctan)[2],
150150
const Vector3d &gpCoords,
151151
const vector<double> &gpU,const vector<double> &gpV,
@@ -162,7 +162,7 @@ class BulkElmtSystem{
162162
//*** for Cahn-Hilliard element in mixed-formula
163163
//************************************************************************************
164164
void CahnHilliardElmt(const FECalcType &calctype,
165-
const int &nDim,const int &nNodes,
165+
const int &nDim,const int &nNodes,const int &nDofs,
166166
const double &t,const double &dt,const double (&ctan)[2],
167167
const Vector3d &gpCoords,
168168
const vector<double> &gpU,const vector<double> &gpV,
@@ -180,7 +180,7 @@ class BulkElmtSystem{
180180
//*** for mechanics element
181181
//************************************************************************************
182182
void MechanicsElmt(const FECalcType &calctype,
183-
const int &nDim,const int &nNodes,
183+
const int &nDim,const int &nNodes,const int &nDofs,
184184
const double &t,const double &dt,const double (&ctan)[2],
185185
const Vector3d &gpCoords,
186186
const vector<double> &gpU,const vector<double> &gpV,

include/InputSystem/InputSystem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class InputSystem{
6060
TimeStepping &timestepping,
6161
FEJobBlock &feJobBlock);
6262

63+
bool IsReadOnlyMode()const{return _IsReadOnly;}
64+
6365
private:
6466
//******************************************************
6567
//*** functions for reading each block

include/Mesh/LagrangeMesh.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ class LagrangeMesh{
155155
nodes(i,0)=0.0;
156156
nodes(i,1)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthElmtJthNodeID(e,i),1);
157157
nodes(i,2)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthElmtJthNodeID(e,i),2);
158-
nodes(i,2)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthElmtJthNodeID(e,i),2);
158+
nodes(i,3)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthElmtJthNodeID(e,i),3);
159159
}
160160
}
161161
inline void GetBulkMeshIthBulkElmtNodes(const int &e,Nodes &nodes)const{
162162
for(int i=1;i<=GetBulkMeshIthBulkElmtNodesNum(e);i++){
163163
nodes(i,0)=0.0;
164164
nodes(i,1)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthBulkElmtJthNodeID(e,i),1);
165165
nodes(i,2)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthBulkElmtJthNodeID(e,i),2);
166-
nodes(i,2)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthBulkElmtJthNodeID(e,i),2);
166+
nodes(i,3)=GetBulkMeshIthNodeJthCoord(GetBulkMeshIthBulkElmtJthNodeID(e,i),3);
167167
}
168168
}
169169
//*** for elmt connectivity information

include/NonlinearSolver/NonlinearSolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class NonlinearSolver{
103103
int _MaxIters,_Iters;
104104
bool _IsConvergent;
105105
NonlinearSolverType _SolverType;
106-
string _SolverName;
106+
string _LinearSolverName,_SolverTypeName;
107107
string _PCTypeName;
108108

109109
//*********************************************

include/NonlinearSolver/NonlinearSolverBlock.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,30 @@ class NonlinearSolverBlock{
2828
NonlinearSolverBlock(){
2929
_SolverTypeName="newton with line search";
3030
_SolverType=NonlinearSolverType::NEWTONLS;
31-
_MaxIters=20;
32-
_RAbsTol=2.5e-8;
31+
_MaxIters=25;
32+
_RAbsTol=4.5e-8;
3333
_RRelTol=1.0e-9;
3434
_STol=1.0e-16; // |dx|<|x|*stol
3535
_PCTypeName="lu";
36+
_LinearSolverName="ksp";
3637
}
3738

3839
string _SolverTypeName;
3940
NonlinearSolverType _SolverType;
4041
int _MaxIters;
4142
double _RAbsTol,_RRelTol,_STol;
43+
string _LinearSolverName;// for linear solver, i.e., ksp, mumps, superlu_dist
4244

4345
string _PCTypeName;
4446

4547
void Init(){
4648
_SolverTypeName="newton with line search";
4749
_SolverType=NonlinearSolverType::NEWTONLS;
48-
_MaxIters=20;
49-
_RAbsTol=2.5e-8;
50+
_MaxIters=25;
51+
_RAbsTol=4.5e-8;
5052
_RRelTol=1.0e-9;
5153
_STol=1.0e-16; // |dx|<|x|*stol
5254
_PCTypeName="lu";
55+
_LinearSolverName="ksp";
5356
}
5457
};

include/TimeStepping/TimeStepping.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class TimeStepping{
120120
long int _CurrentStep=-1;
121121
TimeSteppingType _TimeSteppingType=TimeSteppingType::BACKWARDEULER;
122122
string _TimeSteppingTypeName="backward-euler";
123+
string _LinearSolverName="ksp";
123124
double _GrowthFactor=1.1,_CutBackFactor=0.85;
124125
int _OptIters;
125126
double _DtMin,_DtMax;

0 commit comments

Comments
 (0)