1 (edited by johnnyontheweb 15-11-2018 20:33:13)

Topic: error in restoring context for simple model

Dear all,
I'm interested in the restart capabilities in OOFEM, and I'm trying a simple model with a Beam3d element (see attachment) with the following commands:

1. oofem -f testSEQall.in -c

and then

2. oofem -f testSEQall.in -r 11

Since the restart AFAIK is not well documented (correct me if I'm wrong, I found nothing in the user's manual) I have some doubts:
a. in the command line (1.), can I specify the step in which the analysis has to stop, or I have to perform all the steps?

b. are modifications in the structures accepted? or do I have to use the restart for adaptive analysis? (what exactly is this?)

c. in the command line (2.), there's an error with the following stack:

oofem.dll!oofem::CrossSection::give(oofem::CrossSectionProperty aProperty, oofem::GaussPoint * gp) Riga 157    C++
    oofem.dll!oofem::SimpleCrossSection::give(oofem::CrossSectionProperty a, oofem::GaussPoint * gp) Riga 154    C++
>    oofem.dll!oofem::SimpleCrossSection::give3dBeamStiffMtrx(oofem::FloatMatrix & answer, oofem::MatResponseMode rMode, oofem::GaussPoint * gp, oofem::TimeStep * tStep) Riga 347    C++
    oofem.dll!oofem::Beam3d::computeConstitutiveMatrixAt(oofem::FloatMatrix & answer, oofem::MatResponseMode rMode, oofem::GaussPoint * gp, oofem::TimeStep * tStep) Riga 696    C++
    oofem.dll!oofem::Beam3d::computeKappaCoeffs(oofem::TimeStep * tStep) Riga 447    C++
    oofem.dll!oofem::Beam3d::giveKappayCoeff(oofem::TimeStep * tStep) Riga 471    C++
    oofem.dll!oofem::Beam3d::computeBmatrixAt(oofem::GaussPoint * gp, oofem::FloatMatrix & answer, int li, int ui) Riga 103    C++
    oofem.dll!oofem::Beam3d::computeClampedStiffnessMatrix(oofem::FloatMatrix & answer, oofem::MatResponseMode rMode, oofem::TimeStep * tStep) Riga 238    C++
    oofem.dll!oofem::Beam3d::computeLocalStiffnessMatrix(oofem::FloatMatrix & answer, oofem::MatResponseMode rMode, oofem::TimeStep * tStep) Riga 207    C++
    oofem.dll!oofem::Beam3d::computeStiffnessMatrix(oofem::FloatMatrix & answer, oofem::MatResponseMode rMode, oofem::TimeStep * tStep) Riga 218    C++
    oofem.dll!oofem::StructuralElement::giveCharacteristicMatrix(oofem::FloatMatrix & answer, oofem::CharType mtrx, oofem::TimeStep * tStep) Riga 891    C++
    oofem.dll!oofem::TangentAssembler::matrixFromElement(oofem::FloatMatrix & mat, oofem::Element & element, oofem::TimeStep * tStep) Riga 205    C++
    oofem.dll!oofem::EngngModel::assemble(oofem::SparseMtrx & answer, oofem::TimeStep * tStep, const oofem::MatrixAssembler & ma, const oofem::UnknownNumberingScheme & s, oofem::Domain * domain) Riga 838    C++
    oofem.dll!oofem::NonLinearStatic::assemble(oofem::SparseMtrx & answer, oofem::TimeStep * tStep, const oofem::MatrixAssembler & ma, const oofem::UnknownNumberingScheme & s, oofem::Domain * domain) Riga 788    C++
    oofem.dll!oofem::NonLinearStatic::updateComponent(oofem::TimeStep * tStep, oofem::NumericalCmpn cmpn, oofem::Domain * d) Riga 567    C++
    oofem.dll!oofem::NRSolver::solve(oofem::SparseMtrx & k, oofem::FloatArray & R, oofem::FloatArray * R0, oofem::FloatArray & X, oofem::FloatArray & dX, oofem::FloatArray & F, const oofem::FloatArray & internalForcesEBENorm, double & l, oofem::SparseNonLinearSystemNM::referenceLoadInputModeType rlm, int & nite, oofem::TimeStep * tStep) Riga 239    C++
    oofem.dll!oofem::NonLinearStatic::proceedStep(int di, oofem::TimeStep * tStep) Riga 537    C++
    oofem.dll!oofem::NonLinearStatic::solveYourselfAt(oofem::TimeStep * tStep) Riga 362    C++
    oofem.dll!oofem::EngngModel::solveYourself() Riga 553    C++
    oofem.dll!oofem::NonLinearStatic::solveYourself() Riga 355    C++

The error, in other words, is that the property CS_Area has not been saved.
In crosssection.C I cannot find the method called "saveContext". May I have to overload it in crosssection.C? If not, where? If yes, how to save propertyDictionary?

d. finally, is restart possible between different types of analyses? I need to perform a static NL to apply vertical loads, and then a dynamic NL.
EDIT: By reading the code, it seems the same kind of analysis has to be used. If so, can the eta parameter (mass damping) be changed at restart?

thanks

Post's attachments

testSEQall.in 1.5 kb, 2 downloads since 2018-11-15 

You don't have the permssions to download the attachments of this post.

2

Re: error in restoring context for simple model

Hi,
I have tried to run the test you have provided with the latest git version and restart seems to work. I had to only comment out the two modules, that I don't have. What oofem version have you used?

Your additional questions:
a. in the command line (1.), can I specify the step in which the analysis has to stop, or I have to perform all the steps?
You can restart from any solution step for which context file exists. So you can stop simulation anytime.

b. are modifications in the structures accepted? or do I have to use the restart for adaptive analysis? (what exactly is this?)
If some modifications are made during the soloution process (like remeshing, etc) they are recovered after restart, of course.
Regardin, if you can make some modifications of inputs: basically you can only change solver attributes in input file before restarting. The rest is moreless fixed. More control could be gained when using custom python script, that reads the context and which can then changes some parameters.

Borek

Re: error in restoring context for simple model

Hi Borek,
thanks for your answer. I'm not up-to-date in my fork of OOFEM, I'll try import the modifications I need for this. I saw the needed functions are still present in crosssection.C, sorry I'm noticing it only right now (I was mssing your commit a1f38c6ad7)

Anyway:
a. I know that I can stop the simulation anytime, but, referring to the NL dynamic analysis I told before, I can set the vertical loads to be applied after a few steps (i.e., say 2) and then to perform a NL dyn with modified eta for other 100 steps. Then, if I have to run it in a batcj file, there's no way to stop the simulation at step 3 from OOFEM.

b. ok thanks for such explanation.

4

Re: error in restoring context for simple model

Hi,
not sure if I understood the question (a) correctly, but you could not  specify on the command line the step in which the analysis has to stop. But you can specify that in your input file, by modifying nsteps keyword. So you can compute first only 3 time steps which are common, then modify number of steps in input file and possibly other solver parameters and restart analysis from step 3. This should work.

Re: error in restoring context for simple model

Yes, definitely right, I was assuming to change the input deck as less as possibile.

One final question: I imported save and restore context files that were missing. I found that I must initiliaze the int variable subsoilMat in beam3d.c to 0, because otherwise there's error in restoring the analysis (the beam3d elements has subsoilMat unitialized, and believes it has a subsoil material, it seeks for this and then fails).
I'm wondering why this does not happen in your copy of the code.

6

Re: error in restoring context for simple model

The subsoilmat attribute is initialized in Beam3d :: initializeFrom, so it should be correctly set when element is instantiated from input file. However, may be uninitialized, if element is created by other meas. It would be definitely safe to initialize it in a constructor. Will commit a fix.

Re: error in restoring context for simple model

Borek,

I've been (as I've worked over code), always made sure that the definition, in the header file.
We have a whole bunch of different, ctors, initializers, and, I encountered several bugs in multithreading due to initialized doubles.

So, Instead of doing it in every ctor, I think it's cleaner, and much simpler to see if you have missed any variable if one always defines them at their declaration in the header file.

It just affects double, int, bool, pointers (though we should avoid these anyway). The non-p.o.d types like strings, vectors, etc. all have a default ctor that doesn't leave uninitialized values around.

8

Re: error in restoring context for simple model

Mikael,
thank you, this is good point,