58 int *iparm,
double *rparm,
59 int *iwork,
double *rwork,
61 double *xf,
double *yf,
double *zf,
62 double *gxcf,
double *gycf,
double *gzcf,
63 double *a1cf,
double *a2cf,
double *a3cf,
64 double *ccf,
double *fcf,
double *tcf) {
102 nrwk = VAT(iparm, 1);
103 niwk = VAT(iparm, 2);
107 nlev = VAT(iparm, 6);
110 VASSERT_MSG0(nlev > 0,
"The nlev parameter must be positive");
111 VASSERT_MSG0(nx > 0,
"The nx parameter must be positive");
112 VASSERT_MSG0(ny > 0,
"The ny parameter must be positive");
113 VASSERT_MSG0(nz > 0,
"The nz parameter must be positive");
115 mxlv = Vmaxlev(nx,ny,nz);
117 VASSERT_MSG1(nlev <= mxlv,
"Max lev for your grid size is: %d", mxlv);
120 mgcoar = VAT(iparm, 18);
121 mgdisc = VAT(iparm, 19);
122 mgsolv = VAT(iparm, 21);
124 Vmgsz(&mgcoar, &mgdisc, &mgsolv,
130 &n_rpc, &n_iz, &n_ipc,
134 iretot = iretot + 2 * nf;
137 VASSERT_MSG1( nrwk >= iretot,
"Real work space must be: %d", iretot );
138 VASSERT_MSG1( niwk >= iintot,
"Integer work space must be: %d", iintot );
146 k_cc = k_rpc + n_rpc;
151 k_ac = k_pc + 27 * narrc;
158 RAT(rwork, k_w1), RAT(rwork, k_w2),
159 RAT(iwork, k_ipc), RAT(rwork, k_rpc),
160 RAT(rwork, k_pc), RAT(rwork, k_ac), RAT(rwork, k_cc), RAT(rwork, k_fc),
170 int *nx,
int *ny,
int *nz,
172 double *w1,
double *w2,
173 int *ipc,
double *rpc,
174 double *pc,
double *ac,
double *cc,
double *fc,
175 double *xf,
double *yf,
double *zf,
176 double *gxcf,
double *gycf,
double *gzcf,
177 double *a1cf,
double *a2cf,
double *a3cf,
178 double *ccf,
double *fcf,
double *tcf) {
228 nlev = VAT(iparm, 6);
231 mgkey = VAT(iparm, 9);
232 itmax = VAT(iparm, 10);
233 istop = VAT(iparm, 11);
234 iinfo = VAT(iparm, 12);
235 ipkey = VAT(iparm, 14);
236 mgprol = VAT(iparm, 17);
237 mgcoar = VAT(iparm, 18);
238 mgdisc = VAT(iparm, 19);
239 mgsmoo = VAT(iparm, 20);
240 mgsolv = VAT(iparm, 21);
242 errtol = VAT(rparm, 1);
243 omegal = VAT(rparm, 9);
244 omegan = VAT(rparm, 10);
246 Vprtstp(0, -99, 0.0, 0.0, 0.0);
252 Vnm_tstart(30,
"Vnewdrv2: fine problem setup");
257 &nlev, &ipkey, &iinfo, &ido, iz,
258 &mgprol, &mgcoar, &mgsolv, &mgdisc,
267 Vnm_tstop(30,
"Vnewdrv2: fine problem setup");
270 Vnm_tstart(30,
"Vnewdrv2: coarse problem setup");
275 &nlev, &ipkey, &iinfo, &ido, iz,
276 &mgprol, &mgcoar, &mgsolv, &mgdisc,
285 Vnm_tstop(30,
"Vnewdrv2: coarse problem setup");
295 if (istop == 4 || istop == 5) {
297 Vbuildalg(nx, ny, nz,
299 ipc, rpc, ac, cc, ccf, tcf, fc, fcf);
305 epsiln = Vnm_epsmac();
311 Vnm_tstart(30,
"Vnewdrv2: solve");
321 &istop, &itmax, &iters, &ierror,
322 &nlev, &ilev, &nlev_real, &mgsolv,
324 &epsiln, &errtol, &omegan,
328 pc, ac, cc, fc, tcf);
329 }
else if (mgkey == 1) {
331 u, iz, ccf, fcf, w1, w2,
332 &istop, &itmax, &iters, &ierror,
333 &nlev, &ilev, &nlev_real, &mgsolv,
335 &epsiln, &errtol, &omegan,
339 pc, ac, cc, fc, tcf);
341 VABORT_MSG1(
"Bad mgkey given: %d", mgkey);
345 Vnm_tstop(30,
"Vnewdrv2: solve");
349 VfboundPMG(&ibound, nx, ny, nz, u, gxcf, gycf, gzcf);
VPUBLIC void VfboundPMG(int *ibound, int *nx, int *ny, int *nz, double *x, double *gxc, double *gyc, double *gzc)
Initialize a grid function to have a certain boundary value,.
VPUBLIC void Vbuildops(int *nx, int *ny, int *nz, int *nlev, int *ipkey, int *iinfo, int *ido, int *iz, int *mgprol, int *mgcoar, int *mgsolv, int *mgdisc, int *ipc, double *rpc, double *pc, double *ac, double *cc, double *fc, double *xf, double *yf, double *zf, double *gxcf, double *gycf, double *gzcf, double *a1cf, double *a2cf, double *a3cf, double *ccf, double *fcf, double *tcf)
Build operators, boundary arrays, modify affine vectors ido==0: do only fine level ido==1: do only co...
VPUBLIC void Vnewton(int *nx, int *ny, int *nz, double *x, int *iz, double *w0, double *w1, double *w2, double *w3, int *istop, int *itmax, int *iters, int *ierror, int *nlev, int *ilev, int *nlev_real, int *mgsolv, int *iok, int *iinfo, double *epsiln, double *errtol, double *omega, int *nu1, int *nu2, int *mgsmoo, double *cprime, double *rhs, double *xtmp, int *ipc, double *rpc, double *pc, double *ac, double *cc, double *fc, double *tru)
Inexact-newton-multilevel method.
VPUBLIC void Vnewdriv2(int *iparm, double *rparm, int *nx, int *ny, int *nz, double *u, int *iz, double *w1, double *w2, int *ipc, double *rpc, double *pc, double *ac, double *cc, double *fc, double *xf, double *yf, double *zf, double *gxcf, double *gycf, double *gzcf, double *a1cf, double *a2cf, double *a3cf, double *ccf, double *fcf, double *tcf)
Solves using Newton's Method.
VEXTERNC void Vnewdriv(int *iparm, double *rparm, int *iwork, double *rwork, double *u, double *xf, double *yf, double *zf, double *gxcf, double *gycf, double *gzcf, double *a1cf, double *a2cf, double *a3cf, double *ccf, double *fcf, double *tcf)
Driver for the Newton Solver.
VPUBLIC void Vbuildstr(int *nx, int *ny, int *nz, int *nlev, int *iz)
Build the nexted operator framework in the array iz.
VPUBLIC void Vmgsz(int *mgcoar, int *mgdisc, int *mgsolv, int *nx, int *ny, int *nz, int *nlev, int *nxc, int *nyc, int *nzc, int *nf, int *nc, int *narr, int *narrc, int *n_rpc, int *n_iz, int *n_ipc, int *iretot, int *iintot)
This routine computes the required sizes of the real and integer work arrays for the multigrid code....
VPUBLIC void VfboundPMG00(int *nx, int *ny, int *nz, double *x)
Initialize a grid function to have a zero boundary value.
VPUBLIC void Vfnewton(int *nx, int *ny, int *nz, double *x, int *iz, double *w0, double *w1, double *w2, double *w3, int *istop, int *itmax, int *iters, int *ierror, int *nlev, int *ilev, int *nlev_real, int *mgsolv, int *iok, int *iinfo, double *epsiln, double *errtol, double *omega, int *nu1, int *nu2, int *mgsmoo, double *cprime, double *rhs, double *xtmp, int *ipc, double *rpc, double *pc, double *ac, double *cc, double *fc, double *tru)
Driver routines for the Newton method.