I am trying to model the growth of a crystal in solution by solving the
diffusion equation. I modified the heat equation example I found in one of the
posts in this list, and it works as far as I can tell. The complication is that
the crystal changes shape. My algorithm is as follows: solve one timestep,
evaluate grad rho averaged over the faces, move the faces a proportional amount,
remesh, repeat. Now I noticed the OnGrid postprocessor should do what I want,
but it returns all zeros on every element, even when given the same mesh. Any
suggestions? Also how can I output this in a form that getdp can read back as an
initial condition? And how do I evaluate the average normal gradient over a surface?

Thanks in advance,
Wolf Goetze

======

Point(1) = {1,1,1,0.2};
Point(2) = {1,1,-1,0.2};
Point(3) = {1,-1,1,0.2};
Point(4) = {-1,1,1,0.2};
Point(5) = {1,-1,-1,0.2};
Point(6) = {-1,1,-1,0.2};
Point(7) = {-1,-1,1,0.2};
Point(8) = {-1,-1,-1,0.2};

Line(1) = {1,2};
Line(2) = {1,3};
Line(3) = {1,4};
Line(4) = {2,5};
Line(5) = {2,6};
Line(6) = {3,5};
Line(7) = {3,7};
Line(8) = {4,6};
Line(9) = {4,7};
Line(10) = {5,8};
Line(11) = {6,8};
Line(12) = {7,8};

Line Loop(13) = {1,4,-6,-2};
Line Loop(14) = {1,5,-8,-3};
Line Loop(15) = {2,7,-9,-3};
Line Loop(16) = {-10,-4,5,11};
Line Loop(17) = {-10,-6,7,12};
Line Loop(18) = {-11,-8,9,12};

Plane Surface(19) = {13};
Plane Surface(20) = {14};
Plane Surface(21) = {15};
Plane Surface(22) = {16};
Plane Surface(23) = {17};
Plane Surface(24) = {18};

Surface Loop(25) = {23,22,19,20,24,21};

radius=6;
radius2=8;


Point(41) = {0, 0, 0, 1};
Point(42) = {-radius, 0, 0, 1};
Point(43) = {0, radius, 0, 1};
Point(46) = {0, 0, radius, 1};
Circle(21) = {42, 41, 43};
Circle(25)= {46,41,42};
Circle(26)= {46,41,43};
Line Loop(50) = {21, -26, 25} ;
Ruled Surface (60) = {50};

Point(72) = {-radius2, 0, 0, 1.5};
Point(73) = {0, radius2, 0, 1.5};
Point(76) = {0, 0, radius2, 1.5};
Circle(81) = {72, 41, 73};
Circle(85)= {76,41,72};
Circle(86)= {76,41,73};
Line Loop(90) = {81, -86, 85} ;
Ruled Surface (91) = {90};

t1[] = Rotate {{0,0,1},{0,0,0},Pi/2} {Duplicata{Surface{60};}};
t2[] = Rotate {{0,0,1},{0,0,0},Pi} {Duplicata{Surface{60};}};
t3[] = Rotate {{0,0,1},{0,0,0},Pi/2*3} {Duplicata{Surface{60};}};
t4[] = Rotate {{0,1,0},{0,0,0},-Pi/2} {Duplicata{Surface{60};}};
t5[] = Rotate {{0,0,1},{0,0,0},Pi/2} {Duplicata{Surface{t4[0]};}};
t6[] = Rotate {{0,0,1},{0,0,0},Pi} {Duplicata{Surface{t4[0]};}};
t7[] = Rotate {{0,0,1},{0,0,0},Pi/2*3} {Duplicata{Surface{t4[0]};}};

Surface Loop(100)={60,t1[0],t2[0],t3[0],t7[0],t4[0],t5[0],t6[0]};

Volume(200)={25,100};
Physical Volume(201)={200};

t8[] = Rotate {{0,0,1},{0,0,0},Pi/2} {Duplicata{Surface{91};}};
t9[] = Rotate {{0,0,1},{0,0,0},Pi} {Duplicata{Surface{91};}};
t10[] = Rotate {{0,0,1},{0,0,0},Pi/2*3} {Duplicata{Surface{91};}};
t11[] = Rotate {{0,1,0},{0,0,0},-Pi/2} {Duplicata{Surface{91};}};
t12[] = Rotate {{0,0,1},{0,0,0},Pi/2} {Duplicata{Surface{t11[0]};}};
t13[] = Rotate {{0,0,1},{0,0,0},Pi} {Duplicata{Surface{t11[0]};}};
t14[] = Rotate {{0,0,1},{0,0,0},Pi/2*3} {Duplicata{Surface{t11[0]};}};
Surface Loop(105)={91,t8[0],t9[0],t10[0],t11[0],t12[0],t13[0],t14[0]};
Volume(202)={100,105};
Physical Volume(203)={202};

Physical Surface(299)={60,t8[0],t9[0],t10[0],t11[0],t12[0],t13[0],t14[0]};
Physical Surface(300)={60,t1[0],t2[0],t3[0],t7[0],t4[0],t5[0],t6[0]};

Physical Surface(301)={19};
Physical Surface(302)={20};
Physical Surface(303)={21};
Physical Surface(304)={22};
Physical Surface(305)={23};
Physical Surface(306)={24};

======

// --- Group -----------------------------------------------------------
//
Group {
  Sfca = Region[301];
  Sfcb = Region[302];
  Sfcc = Region[303];
  Sfcd = Region[304];
  Sfce = Region[305];
  Sfcf = Region[306];
  SfcO = Region[300];
  SfcI = Region[299];
  Vol  = Region[201];
  VolI  = Region[203];

  SfcC   = Region[{Sfca,Sfcb,Sfcc,Sfcd,Sfce,Sfcf}];
  Dmn    = Region[{SfcC,SfcO,SfcI,Vol,VolI}];
}
//
// --- Function --------------------------------------------------------
//
Function {
  D = 1.0;

  InitTmp = 10.0;

  TmeStt = 0.0;
  TmeStp = 10.0;
  TmeDel = 1.0;
}
//
// --- Constraint ------------------------------------------------------
//
Constraint {
  {Name TmpCst; Type Assign;
    Case {
      {Region Sfca; Type Assign; Value 1.0;}
      {Region Sfcb; Type Assign; Value 2.0;}
      {Region Sfcc; Type Assign; Value 3.0;}
      {Region Sfcd; Type Assign; Value 4.0;}
      {Region Sfce; Type Assign; Value 5.0;}
      {Region Sfcf; Type Assign; Value 6.0;}
      {Region Dmn; Type Init; Value InitTmp;}
    }
  }
}
//
// --- Jacobian --------------------------------------------------------
//
Jacobian {
  {Name TmpJac;
    Case { 
      {Region VolI; Jacobian VolSphShell {6.0,8.0};}
      {Region SfcC; Jacobian Sur;}
      {Region All; Jacobian Vol;}
    }
  }
  {Name SurJac;
    Case { 
      {Region All; Jacobian Sur;}
    }
  }
}
//
// --- Integration -----------------------------------------------------
//
Integration {
  {Name TmpInt;
    Case { 
      {Type Gauss;
        Case { 
          {GeoElement Point      ; NumberOfPoints 1;}
          {GeoElement Line       ; NumberOfPoints 3;}
          {GeoElement Triangle   ; NumberOfPoints 4;}
          {GeoElement Quadrangle ; NumberOfPoints 4;}
          {GeoElement Tetrahedron; NumberOfPoints 4;}
          {GeoElement Hexahedron ; NumberOfPoints 6;}
          {GeoElement Prism      ; NumberOfPoints 6;}
        }
      }
    }
  }
}
//
// --- FunctionSpace ---------------------------------------------------
//
FunctionSpace {
  {Name TmpSpc; Type Form0; 
    BasisFunction {
      {Name sn; NameOfCoef Tmpn; Function BF_Node; Support Dmn; Entity
NodesOf[All];}
    }
    Constraint {
      {NameOfCoef Tmpn; EntityType NodesOf; NameOfConstraint TmpCst;}
    }
  }
}
//
// --- Formulation -----------------------------------------------------
//
Formulation {
  {Name TmpFrm; Type FemEquation; 
    Quantity { 
      {Name Tmp; Type Local; NameOfSpace TmpSpc;}
    }
    Equation {
      Galerkin {    [ D * Dof{d Tmp}, {d Tmp} ];
                 In Dmn ; Integration TmpInt; Jacobian TmpJac;}

      Galerkin { Dt [ Dof{  Tmp}, {Tmp} ];
                 In Dmn ; Integration TmpInt; Jacobian TmpJac;}
    }
  }
}
//
// --- Resolution ------------------------------------------------------
//
Resolution {
  {Name TmpRes;
    System {
      {Name Tmp; NameOfFormulation TmpFrm;}
    }
    Operation { 
      InitSolution[Tmp]; SaveSolution[Tmp];
      TimeLoopTheta[TmeStt,TmeStp,TmeDel,1.]
	{ 
	  Generate[Tmp]; Solve[Tmp]; SaveSolution[Tmp];
        }
    }
  }
}
//
// --- PostProcessing --------------------------------------------------
//
PostProcessing {
  {Name TmpPst; NameOfFormulation TmpFrm;
    Quantity {
      {Name Tmp; Value{ Local{[ {Tmp} ]; In Dmn; Jacobian TmpJac;} }}
      {Name GTmp; Value{ Local{[ D *  {Grad Tmp} ]; In Dmn; Jacobian TmpJac;} }}
    }
  }
}
//
// --- PostOperation ---------------------------------------------------
//
PostOperation {
  {Name TmpOps; NameOfPostProcessing TmpPst;
    Operation {
      Print[Tmp, OnGrid Dmn, TimeStep 1, File "Tmp_3D.pos"];
    }
  }
  {Name TmpGrad; NameOfPostProcessing TmpPst;
    Operation {
      Print[GTmp, OnPoint {1,0,0}, TimeStep 1, File "GTmp_3D.pos"];
    }
  }
}


