Topic: Error estimator for mesh quality

In my simulations I continously deform the mesh. After a while the quality of the mesh starts to suffer and I figured it would be a good idea to write up some class for estimating such quality.

The ErrorEstimator seems like a suitable base for such a class.
It seems to be pretty straight forward. I'm leaning towards letting the element calculate the quality itself, or possible have some common meassurements in the error estimator, based on the geometry type.

I'm writing this thread in order to open up for some potential discussion on the implementation.

2

Re: Error estimator for mesh quality

Mikael,

my suggestion is to implement as much as possible inside ErrorEstimator class. This is motivated by the fact, that every additional functionality implemented at element level will always lead to extending basic element interface. After a while, element interface will be poisoned by many additional methods, that are not required for basic element implementation. This will confuse users and will potentially be messy, even if well documented.
The idea used in oofem is generally to implement as much as possible under specific classes (error estimator, for example) and the element dependent stuff is selectively implemented by elements by implementing so called interfaces. Your mesh quality estimator class will declare associated abstract elementinterface class, containing methods that are supposed to be provided by individual elements. Particular element can then "implement" interface by inheriting from interface class. Another advantage is, that this concept allows to implement interfaces selectively by if particular elements. There are many examples of this concept in oofem, for example smoothing support, etc.

Borek

Re: Error estimator for mesh quality

Naturally, I had planned on making an interface for the elements, although keep it optional.
The mesh quality is just a measurement of the geometry itself, so there will be a sane quality measurement for pretty much all common elements and they need to implement the interface.

Re: Error estimator for mesh quality

Hi,

I would like to get the outputs corresponding to the ZZ-estimator in both the L2-norm and in the energy norm:
EET_ZZEE  normtype 0
EET_ZZEE  normtype 1
I do not want to change the mesh automtically, i.e. I just want to see the error. Is there a possibility to print the error values e.g. in the gp-file. I have found the variables 32-34 associated with error but I am not sure what to use in my input file.

Could somebody explain to me what I have to write in the input file and how I could get the error for each element.

Best,
Marco

Re: Error estimator for mesh quality

Marco,
You should specify the "vars" keyboard, with the corresponding number. As for as the GP-export and VTK-export is concerned that should be enough.

However, only the adaptive classes bother with creating and updating errors, unfortunately.
I could look into adding support to error estimators to the base engngineering model class, since that makes sense that you might want to export this without wanting full blown adaptivity.
It should be as simple as copying this segment from AdaptiveLinearStatic

    int  eeTypeId = -1;
    IR_GIVE_OPTIONAL_FIELD(ir, eeTypeId, IFT_AdaptiveLinearStatic_eetype, "eetype"); // Macro
    if (eeTypeId >= 0) {
        eeType = ( ErrorEstimatorType ) eeTypeId;
        this->ee = CreateUsrDefErrorEstimator( eeType, 1, this->giveDomain(1) );
        ee->initializeFrom(ir);
    }

and adding some call to update the error after solution is obtained. Possibly in the EngngModel::updateYourself() function

    this->ee->estimateError( temporaryEM, this->giveCurrentStep() );

That should be about all you need to add.

Re: Error estimator for mesh quality

Hi Mikael,

thanks for Your comments.
My problem is that I usually just use oofem but do not implement anything. Thus, I am not quite sure what You mean with specifying the vars keyboard.

Moreover, in what file(s) do I have to copy the code lines You have sent this afternoon?

Best,
Marco

Re: Error estimator for mesh quality

Well, there is a few more minor things that need to be modified.
Me or someone else will probably implement this shortly.

The vars keyword is for the input file, for the gauss-point export module. When the necessary code is implemented, it should probably work with VTK-export as well.

Re: Error estimator for mesh quality

It would be great, if it could be done in the short run. VTK-export is not as important from my time-perspective.
Thanks.

Re: Error estimator for mesh quality

It shouldn't take more than 5 minutes, but I'm in the middle of making lots of other changes. I'll try do it tomorrow. You will need to work with the SVN-version.

Re: Error estimator for mesh quality

Marco, I moved some parts around.
Please try the SVN version. You should be able to add eetype to any engineering model now and have it export the error estimate for the solution.

Re: Error estimator for mesh quality

I just noticed that I didn't commit the changes before. They are in now, revision 1338.

Re: Error estimator for mesh quality

Hi Mikael,

I was not able to check Your adjustments concerning error estimation so far. However, now I have got some more time again. But I do not know what to write in the input file. Below you see a very easy example just for explanation. Could You please tell me what to write in the file so that I get the error results in the gp-file. Moreover, which svn version is the most appropriate at the moment (because the most recently seems to have some bugs)?

Thanks in advance.

Best,
Marco


Test.out
Test
#
linearstatic nsteps 1 nmodules 1
#
GPExportModule 2 tstep_all domain_all ncoords 3 vars 2 1 4
#
domain 2dPlaneStress
#
OutputManager tstep_all dofman_all element_all_error
ndofman 9 nelem 4 ncrosssect 1 nmat 1 nbc 2 nic 0 nltf 1
#
node     1. coords 2    0.0000000000    0.0000000000 bc 2 1 1
node     2. coords 2   30.000000000     0.0000000000 bc 2 0 0
node     3. coords 2   30.000000000    30.0000000000 bc 2 0 0
node     4. coords 2    0.0000000000   30.0000000000 bc 2 1 1
node     5. coords 2   60.0000000000    0.0000000000 bc 2 0 0 load 1 2
node     6. coords 2   60.0000000000   30.0000000000 bc 2 0 0
node     7. coords 2   30.0000000000   60.0000000000 bc 2 0 0
node     8. coords 2    0.0000000000   60.0000000000 bc 2 1 1
node     9. coords 2   60.0000000000   60.0000000000 bc 2 0 0
PlaneStress2d     1. nodes 4     1.     2.     3.     4. mat 1 crossSect 1
PlaneStress2d     2. nodes 4     2.     5.     6.     3. mat 1 crossSect 1
PlaneStress2d     3. nodes 4     4.     3.     7.     8. mat 1 crossSect 1
PlaneStress2d     4. nodes 4     3.     6.     9.     7. mat 1 crossSect 1
#       
SimpleCS 1 thick 1.0
#
IsoLe 1 d 0.  E 200000 n 0.3 tAlpha 0.
#
BoundaryCondition 1 loadTimeFunction 1 conditions 1 d 0.0
NodalLoad 2 loadTimeFunction 1 Components 2 0 -500
#
ConstantFunction 1 f(t) 1.0
#
#%BEGIN_CHECK%
#
#REACTION number 1 dof 1
#REACTION number 4 dof 1
#REACTION number 8 dof 1
#%END_CHECK%

Re: Error estimator for mesh quality

You need to add an error estimator, just like you would for any adaptive problem, with all its additional parameters to the engineering model (eetype and all those)
Then add the corresponding number to "vars" output to write the error (i.e. 32-34 like you pointed out)

Re: Error estimator for mesh quality

Hi Mikael,

actually, I am not quite sure if it works.

I have added eetype 1 to the code. I do not want to skip a region and I do not want to obtain a certain error level. I would just like to see the amount of error in each element after the solution (e.g. in the L2-norm). And so far, variables 32-34 are exactly zero in the gp-file.

Are nodal values used in the oofem code for the ZZ-estimator?

I have checked this simple 4-element example with Ansys and also with my Matlab code so that I know what the errors are in each node. Thus, I still have the same question - as in the last weeks: does it work in oofem and what do I have to do to obtain the values since they are not zero.

Best,
Marco

Re: Error estimator for mesh quality

I know nothing about error estimators.
You should plug in all the options and settings you want from the ZZ-estimator, just as you would for an AdaptiveLinearStatic-problem (whatever those might be).

All I added was the option to use an error estimator in every engineering model, and being able to output that as you would any other internal variable.
After each time step, the error estimator updates its error value. I added a call to "estimateError" at the end of EngngModel :: updateYourself(TimeStep *stepN).
Other than this, I'll have to refer to Borek for expertise.