Models describe the evolution of some state variables of the material during a time step.
To illustrate how a model can be implemented using
MFront
, let us consider a simple solid swelling model which
describes the evolution of the swelling \(s\) as a function of the porosity \(f\) and the burn-up \(\tau\):
\[ \frac{\partial s}{\partial \tau}=C_{1}\,\exp\left(C_{2}-f\right) \]
A simple semi-implicit scheme can be used to integrate this equation upon a time step:
\[ \Delta\,s=C_{1}\,\exp\left(C_{2}-\left.f\right|_{t+\theta\,\Delta\,t}\right)\,\Delta\,\tau \]
which can be also written as:
\[ \left.s\right|_{t+\Delta\,t}=\left.s\right|_{t}+C_{1}\,\exp\left(C_{2}-\left.f\right|_{t+\theta\,\Delta\,t}\right)\,\left(\left.\tau\right|_{t+\Delta\,t}-\left.\tau\right|_{t}\right) \]
This equation is the basis of the MFront
implementation
of the model:
@Parser Model;
@Model SolidSwellingModel;
@Material UPuC;
@Author Helfer Thomas;
@Date 06 december 2007;
@Output s;
s.setGlossaryName("SolidSwelling");
s.setDefaultInitialValue(0.);
s.setDepth(1);
@Input Bu;
Bu.setGlossaryName("BurnUp");
Bu.setDepth(1);
@Input f;
f.setGlossaryName("Porosity");
f.setDepth(1);
@Function compute
{
const real coef1 = 8.e-3;
const real coef2 = 4.e-2;
const real f_ = 0.5*(f+f_1);
s = s_1 + coef1*exp(coef2-f_)*(Bu-Bu_1);
} // end of function compute