finite element method – How to explain the meaning of `NeumannValue` function in detail

I saw here that NeumannValue is used to represent the stress boundary condition when solving the plane stress problem.

In the help information of the x function, we can see some mathematical explanations:

enter image description here

Locations where Neumann values might be specified are shown in green. They appear on the boundary (PartialD)(CapitalOmega) of the region (CapitalOmega) and specify a flux across those edges in the direction of the outward normal.

enter image description here

I want to know how NeumannValue(1000, x == 1) specifically represents the stress boundary $sigma_x=1000$. I want to get a simple explanation of the mathematical principles.

And I want to know the specific calculation details of (Del).(-c1 (Del)u(x, y) - (Alpha)1 u + (Gamma)1 - c2 (Del)v(x, y) - (Alpha)2 v + (Gamma)2), how is it equal to $sigma_{x}=frac{mathrm{Y}}{1-v^{2}}left(frac{partial mathrm{u}(mathrm{x}, mathrm{y})}{partial mathrm{x}}+v frac{partial mathrm{v}(mathrm{x}, mathrm{y})}{partial mathrm{y}}right)$.

Additional information:

Using displacement functions to express stress:

$$begin{array}{l}
sigma_{x}=frac{mathrm{Y}}{1-v^{2}}left(frac{partial mathrm{u}(mathrm{x}, mathrm{y})}{partial mathrm{x}}+v frac{partial mathrm{v}(mathrm{x}, mathrm{y})}{partial mathrm{y}}right) \
sigma_{mathrm{y}}=frac{mathrm{Y}}{1-v^{2}}left(frac{partial mathrm{v}(mathrm{x}, mathrm{y})}{partial mathrm{y}}+v frac{partial mathrm{u}(mathrm{x}, mathrm{y})}{partial mathrm{x}}right) \
sigma_{mathrm{xy}}=frac{(1-v) mathrm{Y}}{2left(1-v^{2}right)} quadleft(frac{partial mathrm{u}(mathrm{x}, mathrm{y})}{partial mathrm{y}}+frac{partial mathrm{v}(mathrm{x}, mathrm{y})}{partial mathrm{x}}right)
end{array}$$

In the above formula, $Y$ represents Young’s modulus and $v$ represents Poisson’s ratio.

$$begin{array}{l}
frac{partial sigma_{x}}{partial x}+frac{partial sigma_{x y}}{partial y}=0 \
frac{partial sigma_{y}}{partial y}+frac{partial sigma_{x y}}{partial x}=0
end{array}$$

$$begin{array}{l}
frac{Y}{2(1+v)}left(frac{partial^{2} u}{partial x^{2}}+frac{partial^{2} u}{partial y^{2}}right)+frac{Y}{2(1-v)}left(frac{partial u}{partial x}+frac{partial v}{partial y}right)=0 \
frac{Y}{2(1+v)}left(frac{partial^{2} v}{partial x^{2}}+frac{partial^{2} v}{partial y^{2}}right)+frac{Y}{2(1-v)}left(frac{partial u}{partial x}+frac{partial v}{partial y}right)=0
end{array}$$

optimization – Is there any good method to find if a grammar is optimal for a problem?

I’ve been thinking about grammatical evolution problems and how the grammar influences the algorithm performance. It came to my mind the huge impact that the grammar that you’re using has in the time that takes an algorithm to reach an optimum solution.

The simplest example would be if your problem doesn’t involve trigonometric operations. If you’re trying to find f(x) = 3x - 1/2, including sins, tangents or square roots in your grammar will, almost certainly, slowen your algorithm as the population complexity will grow. Other not-so-evident simplifications for a grammar would be trigonometric identities:

tan(x) = sen(x) / cos(x)

Talking about this last example, I don’t know how to determine the importance of the impact of including tan(x) between the grammar rules to produce valid solutions. Or in other words, knowing if adding tan(x) will be better in terms of performance than don’t doing it and thus, forcing the evolution to combine two or more operators and terminals to being able to use that operation and making the grammar ambiguous.

So this two are the questions:

  1. Is there any way of knowing if a grammar is optimal for finding a solution?
  2. Which evolutionary algorithm or machine learning method (considering that I’m almost profane in this discipline, some explanation is wellcome) would you use for finding optimal or sub-optimal grammars?

Thanks

Youtube Chanel Promotion – 2020 Real Method for $5

Youtube Chanel Promotion – 2020 Real Method

YouTube +200 Channel Promotion very fast and Non drop

1.100% guaranteed and non drop.
2.extra all bonus.
3.Very fast delivery.
4.We do not use any fake system so your video is safe.
5.I am fast seller.
6.100% Organic and natural promotion.
7.Online support after order complete.

Note: Once you have order this service don’t ask for change this link or cancellation this order.

So Please order me sir and enjoy my service.

.

Naming conventions for set/unset method parameter

The most important is that the method name reflects a behavior. You do this perfectly well with the Set prefix (if your project indeed doesn’t use lower camel case for method names).

The consumers would then write something very unambiguous and self-documenting:

myobject.SetLock(true);

If as a consumer I read your interface, it is clear to be that the parameter name reflects the target state that results from the operation:

SetLock (boolean isLocked):

For the maintainers, the name of the parameter will probably be understood the same way. You just should avoid any confusion with the internal state of your class. In the implementation, it all depends. the following seems clear:

internallyLocked = isLocked; 

But it is true that the following could appear ambiguous:

if (isLocked) 

Now, if you’re perfectionist, the problem with is not so much the ending of your parameter but its beginning. In all objectivity:

  • if it starts with is, the end should be locked for the sake of grammatical consistency
  • is prefix suggests a current state. If you want to avoid any potential ambiguity, you could use another prefix that is more clear about the intent and reflects a change of state or the target state.

The exact choice of wording is opinion based. For example: toBeLocked (target state clearly expressed) or willLock (change action clearly expressed). But there are certainly many other possibilities that comply with these basic principles.

splunk – Best method to keep lookup file value fresh

Say, I have to monitor users’ activities from 3 specific departments: Science, History, and Math.

The goal is to send an alert if any of the users in any of those departments download a file from site XYZ.

Currently, I have a lookup file for all the users from those three departments.

users
----------------------
user1@organization.edu
user2@organization.edu
user3@organization.edu
user4@organization.edu
user5@organization.edu

One problem: users can join, leave, or transfer to another department anytime.

Fortunately, those activities (join and leave) are tracked and they are Splunk-able.

index=directory status=*
-----------------------------------------------
{
"username":"user1@organization.edu",
"department":"Science",
"status":"added"
}
{
"username":"user1@organization.edu",
"department":"Science",
"status":"removed"
}
{
"username":"user2@organization.edu",
"department":"History",
"status":"added"
}
{
"username":"user3@organization.edu",
"department":"Math",
"status":"added"
}
{
"username":"MRROBOT@organization.edu",
"department":"Math",
"status":"added"
}

In this example, assuming I forgot to update the lookup file, I won’t get an alert when MRROBOT@organization.edu downloads a file, and at the same time, I will still get an alert when user1@organization.edu downloads a file.

One solution that I could think of is to update the lookup manually via using inputlookup and outputlook method like:

inputlookup users.csv | users!=user1@organization.edu | outputlookup users.csv

But, I don’t think this is an efficient method, especially there’s high likely I might miss a user or two.

Is there a better way to keep the lookup file up-to-date? I googled around, and one suggestion is to use a cronjob CURL to update the list. But, I was wondering if there’s a simpler or better alternative than that.

finite element method – Problem with NDSolveValue : “The function value {$Failed} is not a list of numbers with dimensions…”

I was having fun modifying a code given to me as an answer to a previous problem here, courtesy of user Alex Trounev (Thank you again), when I encountered a certain error which I had never seen before.

Here is the aforesaid code :

(*parameters*)
r0 = 0.5;
h = 1;
(Alpha) = 0.8;

(*region definition*)
reg = Cuboid({.5, 0., 0.}, {1., 2 Pi, 1.});

reg3D = ImplicitRegion(
   r0^2 <= x^2 + y^2 <= 1 && 0 <= z <= 1, {x, y, z});

(*equation + conditions*)
eq1 = D(u(t, r, (Theta), z), 
    t) - (D(u(t, r, (Theta), z), r, r) + 
     1/r*D(u(t, r, (Theta), z), r) - 
     1/((Alpha)^2 r^2) D(u(t, r, (Theta), z), (Theta), (Theta)) + 
     D(u(t, r, (Theta), z), z, z));

ic = u(0, r, (Theta), z) == 1;

bc = DirichletCondition(u(t, r, (Theta), z) == Exp(-5 t), r == r0);
nV = NeumannValue(1, r == 1);
pbc = PeriodicBoundaryCondition(u(t, r, (Theta), z), (Theta) == 0, 
   TranslationTransform({0, 2 (Pi)*(Alpha), 0}));


(*solution computation*)
sol = NDSolveValue({eq1 == nV, ic, bc, pbc}, 
   u, {t, 0, 2}, {r, (Theta), z} (Element) reg);

(*frames=Table(DensityPlot3D(sol(t,Sqrt(x^2+y^2),ArcTan(x,y),z),{x,y,
z}(Element)reg3D,ColorFunction(Rule)"Rainbow",OpacityFunction(Rule)
None,Boxed(Rule)False,Axes(Rule)False,PlotRange(Rule){0,1.5},
PlotPoints(Rule)50,PlotLabel(Rule)Row({"t = 
",t}),ColorFunctionScaling(Rule)False),{t,.05,1,.05})
ListAnimate(frames)*)

When I run the code, after some time, I get greeted with the following error :

NDSolveValue::nlnum: The function value {$Failed} is not a list of numbers with dimensions {39639} at {t,u(t,r,(Theta),z),(u^(1,0,0,0))(t,r,(Theta),z)} = {0.0138161,{<<1>>},{-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,<<15>>,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,<<39589>>}}.

When I click on the three dots next to the error, I don’t find any information on the error like it’s usually the case. I then decide to google some answers.
I found some answers here while also trying to comprehend the error by looking at this and finally that answer here.

So if I did understand it correctly, such error arises when you use NDSolve (or NDSolveValue) to get a symbolical solution to your equation, but problems come up when you try to numerically evaluate it for plotting purpose, or when trying to get a symbolical result with a function that requires numerical values ?

In any case, I do not really understand why I get such error as my plot part is currently between (* … *) so it shouldn’t matter. As for the rest of the code, I do not really see an error but I am just a beginner so…

Anyway, can a kind fellow enlighten me please ?

algorithm – How to make Print() method memory & CPU efficient?

You are receiving n objects in a random order, and you need to print them to stdout correctly ordered by sequence number.

The sequence numbers start from 0 (zero) and you have to wait until you get a complete, unbroken sequence batch of j objects before you output them.

You have to process all objects without loss. The program should exit once it completes outputting the first 50000 objects Batch size j = 100

The object is defined as such:

    {
    "id" : "object_id", // object ID (string)
    "seq" : 0, // object sequence number (int64, 0-49999)
    "data" : "" // ()bytes
    }
    Step                Input Value                Output State j = 1                  Output state j = 3
    0                       6
    1                       0                           0
    2                       4                           0
    3                       2                           0
    4                       1                           0,1,2                               0,1,2
    5                       3                           0,1,2,3,4                           0,1,2
    6                       9                           0,1,2,3,4                           0,1,2
    7                       5                           0,1,2,3,4,5,6                       0,1,2,3,4,5

func (receiver *Receiver) Print(seqNumber uint64, batchSize uint64, outputFile io.Writer) (error, bool) {

    fmt.Fprintf(outputFile, "( ")
    if seqNumber >= receiver.outputSequence.length {
        receiver.outputSequence.bufferSizeIncrease(seqNumber)
    }
    receiver.outputSequence.sequence(seqNumber) = true

    printedCount := uint64(0) // check for MAX_OBJECTS_TO_PRINT
    var nthBatchStartingIndex uint64
    MaxObjectsToPrint := config.GetMaxPrintSize()
Loop:
    for nthBatchStartingIndex < receiver.outputSequence.length { // check unbroken sequence
        var assessIndex = nthBatchStartingIndex
        for j := assessIndex; j < nthBatchStartingIndex+batchSize; j++ { // Assess nth batch
            if j >= receiver.outputSequence.length { //index out of range - edge case
                break Loop
            }
            if receiver.outputSequence.sequence(j) == false {
                break Loop
            }
        }

        count, printThresholdReached := receiver.printAssessedBatchIndexes(assessIndex, printedCount, batchSize, MaxObjectsToPrint, outputFile)
        if printThresholdReached { // print sequence threshold reached MAX_OBJECTS_TO_PRINT
            fmt.Fprintf(outputFile, " )  ")
            fmt.Fprintf(outputFile, " ----for input value %dn", seqNumber)
            return nil, false
        }
        printedCount += count
        if printedCount >= MaxObjectsToPrint { // print sequence threshold reached MAX_OBJECTS_TO_PRINT
            fmt.Fprintf(outputFile, " )  ")
            fmt.Fprintf(outputFile, " ----for input value %dn", seqNumber)
            receiver.Log.Printf("****MaxObjectsToPrint threshold(%d) reached n", MaxObjectsToPrint)
            return nil, false
        }
        nthBatchStartingIndex = assessIndex + batchSize // next batch
    }
    fmt.Fprintf(outputFile, " )  ")
    fmt.Fprintf(outputFile, " ----for input value %dn", seqNumber)
    return nil, true
}

Here is the complete solution, written for this problem.


Print() is the method that does heavy lifting in this code, with varying size of memory & heavy CPU usage:

  1. How to make receiver.outputSequence memory effective by using datastructure other than array? because newBufferSize := 2 * seqNumber is doubling memory…

  2. How to make Print method have effective CPU usage?