Combination of Domain-wise CoefficientFunctions

Dear all,
I would like to know if there’s a way to encode the following, from mlset_basic.ipynb in ngsxfem, inside a CoefficientFunction or a GridFunction

Draw(CoefficientFunction((level_sets_p1[0], level_sets_p1[1], level_sets_p1[2], 0)),
     mesh, "NEG-NEG-NEG", min=-1, max=1,
     eval_function="value.x<0.0?(value.y<0.0?(value.z<0.0?1.0:-1.0):-1.0):-1.0")

I need the versatility of one of the formers, instead of resorting to

dCut(level_sets_p1, (NEG, NEG, NEG), order=0), mesh=mesh)

Best,
Francesco

Hi Francesco,

I think that I don’t get you here. Are you looking for some feature for the visualization or for the integration? Which information would you like to put into a CF or a GF?

Can you make an example of the functionality that you are looking for by writing a few lines of (not working) code that you would like to exist?!

Best,
Christoph

Hi Christoph,

I would like to have something like this

CoefficientFunction(   CoefficientFunction((level_sets_p1[0], level_sets_p1[1], level_sets_p1[2], 0)),
                       mesh, "NEG-NEG-NEG", min=-1, max=1,
                       eval_function="value.x<0.0?(value.y<0.0?(value.z<0.0?1.0:-1.0):-1.0):-1.0") 
                    )

so that I can use it freely to later integrate but also set into a GridFunction. I hope I explained myself.

Best,
Francesco

Hi,

Well, you can define the CF piecewise using IfPos(...,...). That will allow you to put this into GFs and treat it as a standard CF.

However, the information on how the function should be treated in numerical integration will be lost. There is no convenient way to combine this automatically at the moment.

Setting this into a GF will lose the information about the discontinuity anyway.

Best,
Christoph