Short answer:
1. I know several serious bugs in primaryfield. I would like to see primaryfield removed. Many of the bugs can't be fixed because existing solvers rely on strange behvaior. See below for a bit of a rant.
2. No.
I recommend using (a very recent) TransientTransportProblem as the template, but even in that code I have to put in a lot of temporary work-arounds otherwise I would break backwards compatibility with some input files.
http://www.oofem.org/forum/viewtopic.php?id=1598
Long answer;
The big problem is that a lot of code relies on inconsistent means of applying initial & boundary conditions.
These should be stored in the field, and when the elements request the values to compute strains/fluxes these should fetch all whatever is stored in the field.
This does not happen. See MasterDof :: giveUnknown
double MasterDof :: giveUnknown(ValueModeType mode, TimeStep *tStep)
{
if ( dofManager->giveParallelMode() == DofManager_null ) {
return 0.0;
}
*************** THIS IS INCONSISTENT TIME DISCRETIZATION ************
// first try if IC apply
if ( tStep->giveNumber() == dofManager->giveDomain()->giveEngngModel()->giveNumberOfTimeStepWhenIcApply() ) { // step when Ic apply
if ( this->hasIcOn(mode) ) {
return this->giveIc()->give(mode);
} else if ( this->hasBc(tStep) ) {
return this->giveBcValue(mode, tStep);
} else {
return 0.;
}
}
if ( !dofManager->giveDomain()->giveEngngModel()->requiresUnknownsDictionaryUpdate() && this->hasBc(tStep) ) {
return this->giveBcValue(mode, tStep);
}
return ( dofManager->giveDomain()->giveEngngModel()->
giveUnknownComponent(mode, tStep, dofManager->giveDomain(), this) );
}
and what I am suggesting is that it would simply change to
double MasterDof :: giveUnknown(ValueModeType mode, TimeStep *tStep)
{
if ( dofManager->giveParallelMode() == DofManager_null ) {
return 0.0;
}
return ( dofManager->giveDomain()->giveEngngModel()->
giveUnknownComponent(mode, tStep, dofManager->giveDomain(), this) );
}
We then let the engineering model (or the field) handle the time discretization for all values. I simply store the initial condition and b.c. in the field (only reading the IC/BC once), and it is all consistently treated by the time discretization.
However, I cannot simply do these fixes, because it breaks tests that relies on inconsistent time discretization / inconsistent BC IC.
I'm trying to get nonstationarytransport and nltrasienttransport deprecated so that I can start to fix these things, but I need to check with the other developers before, but so far, noone has replied (see thread http://www.oofem.org/forum/viewtopic.php?id=1598 )
There is also no reason for PrimaryField to exist. Changing b.c.s, adaptivity, xfem, contact b.c.s, load balancing etc., and all of these nice things will require something like DofDistributedPrimaryField anyway (or need to duplicate the functionality), so DofDistributedPrimaryField has a very real potential to actually be *faster* than PrimaryField as well (because we read many times, only store the value once per newton-iteration), though most likely cost of either field is beyond negligible.
Storing the "vectorized" solution arrays is only suitable for the brief "u=K^(-1) * f" step. Codes that has options for either PrimaryField or DofDistributedField just makes the incorrect assumption that it's costly to copy the solution vector once per iteration (it is of course a very very cheap operation).