Hello everyone, I ran an example of PETSc on Windows,
load “PETSc”
macro dimension()2// EOM
include “macro_ddm.idp”
macro grad(u)[dx(u), dy(u)]// EOM
load “Element_P3”
func Pk = P3;
border upper(t=0, pi) { x=cos(t); y=sin(t); label=1; }
border lower(t=pi, 2*pi) { x=cos(t); y=sin(t); label=2; }
mesh Th = buildmesh(upper(100) + lower(100));
Mat A;
createMat(Th, A, Pk)
fespace Vh(Th, Pk);
varf vPb(u, v) = intN(Th)(grad(u)’ * grad(v)) + intN(Th)(v) + on(2, u = 0);
matrix Loc = vPb(Vh, Vh, tgv = -2);
real[int] b = vPb(0, Vh, tgv = -1);
A = Loc;
Vh u;
set(A, sparams = “-pc_type cholesky -ksp_type bcgs -ksp_converged_reason”);
ObjectView(A, object = “ksp”);
u[] = A^-1 * b;
plotD(Th, u, cmm = “Solution with -pc_type cholesky”)
set(A, sparams = “-pc_type gamg -ksp_type gmres”);
u[] = 0;
u[] = A^-1 * b;
ObjectView(A, object = “ksp”);
plotD(Th, u, cmm = “Solution with -pc_type gamg”)
but failed to run,
– FreeFem++ v4.1 (Sat, Nov 13, 2021 7:40:01 PM - git v4.10)
file : C:\Users\DELL\Desktop\kg\Text122
Load: lg_fem lg_mesh lg_mesh3 eigenvalue
1 : load “PETSc”(load: loadLibary E:\FreeFem++\.\PETSc = 0)
2 : macro dimension()2// EOM
2 & macro macroDDMidp()1// EOMACRO(!macroDDMidp)
5 & macro partitioner()metis// EOM
6 & ENDIFMACRO
9 & macro partitionerSeq(part, Th, size){ if(size <= 1) part = 0; else metisdual(part, Th, size); }// EOM
10 & macro partitionerPar(part, Th, comm, size)broadcast(processor(0, comm), part)// EOM
11 & ENDIFMACRO
14 & macro partitionerSeq(part, Th, size){ if(size <= 1) part = 0; else scotch(part, Th, size); }// EOM
15 & macro partitionerPar(part, Th, comm, size)broadcast(processor(0, comm), part)// EOM
16 & ENDIFMACRO
19 & macro partitionerSeq(part, Th, size)// EOM
20 & macro partitionerPar(part, Th, comm, size)parmetis(part, Th, size, communicator = comm, worker = getARGV("-parmetis_worker", 1))// EOM
21 & ENDIFMACRO
25 & ENDIFMACROhe macro ‘partitioner’ must be set to ‘metis’, ‘scotch’, or ‘parmetis’" << endl;
27 & macro meshN()mesh// EOM // two-dimensional problem
28 & macro intN()int2d// EOM // two-dimensional integral
29 & macro intN1()int1d// EOM // one-dimensional integral
30 & macro readmeshN()readmesh// EOM // two-dimensional problem
31 & macro defVel(u)[u, u#Y]// EOM // two-dimensional velocity for convect/advect
…
927 @
927 @ ThTab.resize( 1);
928 @ ThBorderTab.resize( 1);
929 @ prolongation.resize( 1 - 1);
930 @ real timerPartition = mpiWtime The Identifier mpiWtime does not exist
Error line number 930, in file macro: buildOverlapEdgePeriodicRecursive in E:\FreeFem++\idp\macro_ddm.idp, before token mpiWtime
current line = 930
Compile error :
line number :930, mpiWtime
error Compile error :
line number :930, mpiWtime
code = 1 mpirank: 0
why,Seek guidance .