Move a 3D object in COMSOL and calculate of charge in every position - comsol

I am trying to solve with Comsol the problem of the figureTwo blue big electrodes with fixed potentials V1,V2. One red small electrode that moves above the others along x axis at constant distance and voltage V0. The charge in V0 depends on the electric field at each point 8(x). I have one small electrode with a potential V0 moving along x axis above two bigger electrodes with fixed potentials V1,V2.
I can easily compute with comsol the potential and field at each point in 3D and the resulting charge in V0 electrode. However i would like to simulate this charge along the x axis and eventually map it also for z and y direction so i have a V0 charge 2D map at a fixed distance.
How can i do this in COMSOL without changing the geometry coordinates manually and computing again the charge at each point?
Thank you for your answers,
Jorge

I'll describe how to setup the system so that you can move V0 around. Note that this requires changing the mesh throughout the simulation. For this reason, I don't think you want a "time dependent" study but instead you want to use the "parametric sweep" option.
First, go to your Global Parameters and create a parameter called block_x_pos or whatever you want.
Go to Component → Geometry and select V0 and in the appropriate field under the "Position" tab (in the Setting Panel), write block_x_pos in the X Position. This makes that position controllable by whatever value is in block_x_pos.
Right click on the appropriate Study and select "Parametric Sweep". The purpose (as far as I know) for the Parametric Sweep is that when the geometry is changing during computation, it updates the mesh accordingly, so you don't have to do it manually through some painful repetition. Select the "Parametric Sweep" node which has now appeared. Look in the Settings Panel and find the "Study Settings" tab. Below the empty table, you'll see some arrows and a "+" sign. Click the "+". This will add a new sweep parameter to the table. Click the dropdown menu on the table and select the "time" Global Parameter. In the "Parameter Value List" field, write the range of values you'd like to have it take.
i.e. if you want the block_x_pos parameter to vary from 0 to 10 in steps of 0.1, you would write range(0, 0.1, 10). Or you could write '-3 0 1 2 4 5 9 11' and it will take those values.
Now Compute using that same Study.
When you are making plots, be sure to use the correct Solution. It will be labeled something like "Study1/ParametricSolutions1". When you select this as your "Data Set", you will find (in your Settings Panel) a new dropdown menu below the "Data Set" field called "Parametric selection (time)". You can choose to show multiple values for the "time" parameter on most plot types.

Related

What TeeChart Tool can I use to Interactively select points from a FastLine Graph

While using Delphi Seattle 10 and Steema TeeChart Pro VCL FMX 2016.18, I am looking to Highlight a Selection of a Line Graph (multiple series) in the way that Zooming allows / makes a square around a highlighted selection of a Line Graph to indicate which part of it to zoom into (as long as the onmousedown action is in progress).
The purpose of this would be to allow the selection to remain highlighted while the mouse is no longer being clicked, to potentially "Delete" the highlighted Data points. All I need this for is to obtain the (X0 Y0 X1 Y1) values to possibly obtain the CalcPosPoint(X) and remove all the points inside. The data is currently obtained through a Record Struct (Memory Mapped) file, and it will there for be used to set/check for a property "deleted" to indicate on the next redraw of the graph which rows to completely ignore and which to continue printing.
I hope to be able to do this (select from 1 chart), and have it simultaneously draw on multiple graphs. I have tried to look for an example of this feature through the use of TSelectorTool (FMXTee). One of the pages I found referring to such a tool is Interactive data point selection as well as Multiple selections with Selector Tool
And my second question has to do with TeeCharts directly. Where would I find fmx240.bpl as TeeChart_Pro_Firemonkey_Demo.exe requires this file in order to run? I did manage to copy vcl240.bpl from "Embarcadero\Studio\18.0\bin" and put it into "Embarcadero\Studio\17.0\bin"
[Edited]
I have managed to capture / create a sample code (MVCE) from which I can now select a portion and create a square around a particular sample of graph lines.
The control graph right now is the bottom graph (Chart5). If anyone is interested in seeing the code, I have put up a pastebin sample.
PasteBin Sample Code
And a TeeCharts.tar.gz is accessible to anyone who wishes to see a sample of the code, as well as the data sample.
filetolink.com Source Files
I no longer feel the need for mathematical equation to differentiate the top graphs from the bottom (because the bottom axes are automatic where as the top are defined). I intend to only use the space which is adherent to the visible space, and do not intend to extend in either direction (left or right). That means at this point the size of the graph does not matter, because once I over populate the charts above, the position in the bottom graph would become irrelevant, and therefor I do not intend to use the bottom chart.
The next step is to save the positions of the boxes so that they can reappear when the graph is shift from left (past data) to the right (live data). And then uses the buttons above to make the appropriate action to the graphs.
I would like to know what way would be the most sufficient way to record the positions of the rectangles, so when the chart is shifted (via the ScrollBar1), the rectangles are moving with the direction of the scrollbar. But I'm sure I can achieve that.
I think I have found a solution. The red squares are only prevalent for the visual aspect, they can be drawn on, I don't need to do anything special with each chart, as I already know what the X0..Y1 parameters are, they are known from the initial chart. The problem h/e has to do with the initial chart. As long as the screens are all full, I can zoom in correctly w/ alignment with on all the charts (ZoomRect/Rectf(X0..Y1))
But what kind of equation would it take to adjust the charts that are not in the same zoom / max / min when the Chart5.Axes.Bottom.Automatic = True?
From there I just simply have to disable the immediate zoom feature, and allow buttons to become functional, to decide what the next course of action would be.

Find available grid position

I'm building a color box connecting game with objective-C and trying to figure out how to find the correct position when a block of boxes is placed incorrectly over another block of boxes.
See the attach image. In the image, you only need to move the left box one step to the right in order to connect the boxes and win.
However, if you place the left box on top of the other box (Image 2), I want to move it to the closest available free grid position.
This would be easy if the box was a simple square (a 1x1 grid, 2x2 grid, etc), but since the boxes can be complex, It's harder. There might also be a lot of boxes on the grid.
Any suggestions would be very appreciated.
If you're new to heuristics like this, just take the KISS approach.
It couldn't be easier...
The user tries the object at x,y ok?
It does not "fit" there.
So, simply "spiral" outwards, trying it in other possible places.
Just keep trying until you find one where it fits.
234
915
876
so that's like "radius 1", you see? then try "radius 2"
and so on.
It's that easy. Just keep trying until you find one that "does work".
Work from the start position outwards, so that, you find the closest one.

How to swap the X and Y axis of a graph in Excel 2010

Transposing the table does not help. Every time I get this graph:
I tried to swap the axes in the Select Data Source dialogue but then I get this:
Now the letters (they are departments in real world, I just simplified it) are on the vertical axis, but the horizontal axis is wrong. Of course the graph is also wrong as I don't need two vertical axes. I need the columns to be horizontal as that graph would be much easier to read.
Is this possible?
You have to choose another type of graph. Try the 'bar'-type. (You can change it by right-click -> Change type).

Boardgame-Map with crossroads etc

I have a little logical problem over here.
As the title says, I try to build a boardgame as a computer-program (maybe with internet-support, but thats another story)
As for now, I have a map, which has some crossroads in it, hence I cannot simply define the fields as '1, 2, 3, 4, ...' because if there is a crossroad at field 10, I would have more than one field which has to be labeled 11 (Because then there is a field left and right of field 10, for example.)
So the problem is, if I cannot define the Board in numbers then I cannot simply get the possible positions a player can take when he rolls 2d6-dices with calculating 'Field-Nr. + RandomRange(1,6) + RandomRange(1,6)'
Does anybody have an idea, how to define a Map like this on another way, where I still can calculate the possible new-fields for Player X with a 2d6-dice-roll?
Thanks in advance.
If i understand well... (i don't thing so) this might help you. Just use dynamic arrays for your boardgame field and change your actions after the dimensions x,y .... Look at this "type Name = array of {array of ...} Base type; // Dynamic array"
It sounds like you have a graph of connected vertices. When a player is at a particular vertex of N edges, assuming N < 12, the new Field will be reached from traversing edge number N % ( rand(6) + rand(6) ).
You could also just do rand(12), but that would have an even distribution, unlike 2d6.
Instead of dynamic arrays, I would recommend using a linked-list of records to describe the surrounding cells, and traverse the player's location and possible moves using that linked-list.
First, define a record that describes each cell in your board's playable grid (the cells on the grid can be four-sided like a chessboard, or hexagonal like in Civilization V) ... each cell record should contain info such as coordinates, which players are also in that cell, any rewards/hazards/etc that would affect gameplay, etc. (you get the idea).
Finally, the linked-list joins all of these cells, effectively pointing to any connected cells. That way, all you'd need is the cell location of Player X and calculate possible moves over n amount of cells (determined by the dice roll), traversing the adjoining cells (that don't have hazards, for example).
If all you want is to track the possible roads, you can also use this approach to identify possible paths (instead of cells) Player X can travel on.

SSRS line chart not connecting data points

I've looked high and low and can't seem to find an answer to what appears to be quite a straightforward issues (I would think).
I have a line chart where there is data at several points in a series but only only one set of points link up.
Does anyone know why this is? Is it to do with my data? If it is, I am struggling to see any relationships in the data that may explain this behavior.
Here is what I mean:
As you can see, the red diamonds should be connecting - the same could be said about the blue squares and the dark blue triangles. Any thoughts?
Apologies if my colors are wrong - I'm colorblind.
Okay, so I worked this out.
Firstly, in order to get the lines to join up, you need to set the EmptyPoint colour for the series.
select your series in your chart
In the properties tab (not the dialog) drill down into the EmptyPoint property and set the colour to be Black
This will get them joining up - yay! But part of the line is colour and the other part is black, right? That's a bit silly, especially considering if you leave the colour to Automatic on the EmptyPoint that it will be transparent.
So, then we need to get the series and the EmptyPoint's colours in sync.
Using code from here. I added some code to the code of the report.
1). Right click on an empty space on the report and select "Report Properties"
2). In the code tab, paste the following:
Private colorPalette As String() = {"#418CF0", "#FCB441", "#E0400A", "#05642E", "#1A3B69", "#BFBFBF", "#E0400A", "#FCB441", "DarkBlue", "Tomato", "Orange", "CornflowerBlue", "Gold", "Red", "Green", "LightBlue", "Lime", "Maroon", "LightSteelBlue", "Tan", "Silver"}
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
Then we need to call this code when setting the colour of the series and of the EmptyPoint.
Select your series
In the properties tab paste something the following (replace WhateverTheGroupIsForYourSeries with your series group name): =Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)
Drill down to the color element of the EmptyPoint Series property
Paste the same text as from point two [e.g. =Code.GetColor(Fields!*WhateverTheGroupIsForYourSeries*.Value)]
And voila! You're done!
I can't believe how unnecessarily difficult this is :D
I just had a problem where it was showing markers but not the lines. I ended up solving it by wrapping the expression in a CInt() to convert it to an integer.
Another way to handle this is to do a recursive select (if you have very large data sets don't do this, it kills performance). So you could make your dataset:
SELECT *, ROW_NUMBER() over(partition by Store order by Date desc) as rn
FROM StorePerformance
Now you can have your category group be rn (it should group by rn and sort by rn) but select date for its label. This will still display the date on your x axis, but since you are grouping by rn the data will still be continuous and all of the lines will connect. Also your legend will still match.
I still haven't looked deeply into how much this shifts the data points since we are plotting with row number and displaying date, but if you are mainly concerned with visualizing trends in the lines and aren't as concerned with where they are at a given point in time in relation to one another, it will serve you just fine. Otherwise I would leave the chart the way it is and just read the plot points, which are still valid data.
Solution
Just put your Fields!(YourSeriesGroup).Value in Series Groups to above of
Fields!(YourCategoryGroup).Value in Category Groups, your series group should be in both Series Groups and Category Groups (should be above of your initial category group).
And after that right click horizontal axis and select Horizontal Axis Properties. Set Axis Type to Scalar and click OK.
Result

Resources