Vectorial equations Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » Vectorial equations « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Luca Naso (adman)
New member
Username: adman

Post Number: 1
Registered: 04-2008
Posted on Tuesday, April 22, 2008 - 06:26 am:   

Hello everybody,

I am quite new to FlexPDE, but for what I have seen up to now I think it is great.
However I have to say the man page is not so great :-(

I have some questions and I am sure they can be trivial for many users but I could not find any answers, so I am posting them here.

The core-problem for me are vectorial equations. How should I treat them?
Suppose I want to solve a diffusion equation for a vector field: dt(B) = curl(-n*curl(B)), where B is a vector and n a scalar (which in general might depend on space).

1. How do I define variable B to be a vector of a given dimension?
2. How do I define initial conditions and boundary conditions on the components of B?
3. If I try to modify the equation in this way: dt(B) = curl(B-n*curl(B)), I get an error ('operands are not of the same type') and the minus is highlighted. What does this mean?

As an attempt I just decleared B as variable, in cartesian2, set B=x^2+y^2 as initial value, and zero boundary conditions (ok I know that the initial value is not consistent with 0 BCs but it is just a trial and however flexPDE seems to be able to handle this quite well).
With n=10 if I monitor surface(B) I see it is really going to zero, and after t=10 the maximum of B is ~ 1E-9.
But if I monitor Vector(B) I see that the y component is always zero, so that B=Bx.
(As a domain I used the square [1,10]x[1,10])


I hope someone can shed a bit of light in all of this!
cheers-
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1107
Registered: 06-2003
Posted on Tuesday, April 22, 2008 - 06:35 pm:   

You're right, we have not been very explicit about the treatment of vector variables, except that the definition of "Variables" says "Each variable is assumed to define a continuous scalar field over the problem domain." Also, many of the example problems treat vector fields, so there is some information by implication there.

The rule is: "Each variable is assumed to define a continuous scalar field over the problem domain." If you want to treat a vector variable, you must define each component individually, and provide the proper scalar equation for each component. See for example "Samples|Steady_State|Magnetism|3D_Magnetron.pde".

1.
To define B to be a vector of three dimensions, define
VARIABLES Bx,By,Bz
DEFINITIONS B=Vector(Bx,By,Bz)
EQUATIONS
Bx: ...
By: ...
Bz: ...

2.
Example boundary conditions:
NATURAL(Bx)=0
VALUE(By)=0
(note that the Natural BC for a curl operator is the tangential component of its argument. See "Natural" in the Help Index.)

3.
In a two-dimensional problem, a Vector value is assumed to lie in the plane of the computation, and its third component (as generated by the Curl operator) is assumed to be a scalar. So if your example was declared to be a 2D problem, the expression (B-n*curl(B)) results in a vector minus a scalar. This is flagged as "operands are not of the same type".


Top of pagePrevious messageNext messageBottom of page Link to this message

Luca Naso (adman)
New member
Username: adman

Post Number: 2
Registered: 04-2008
Posted on Wednesday, April 23, 2008 - 03:48 am:   

Thank you for your answer.

1.
The logic behind this point is clear, however as regards wiriting the equations: how can I select a single component of the curl?
If my vectorial equation is B=curl(A), is there any projection operand such that I can write Bx=[curl(A)]_x ? Or I have to write explicitly the x component of the curl by doing the derivatives? If this is the case then one has to change the equations everytime he changes the coordinates, because of the geometrical factors which enter in the calculation of the curl (and of the div, the grad, ...).
In the example you are referring to derivatives are calculated esplicitly (i.e. "Bzz= dx(Ay)-dy(Ax)"), but if we were in spherical coordinates for example then we had to add terms like 1/sin(theta) and 1/r (for the third component: B3 = 1/r * [ d1(rA2) - d2(A1) ] ).

3.
I do not understand very well what you say about the curl. The result of curl(B) is a vector, with the same dimension of the working space. Therefore if I am in a 2D space curl(B) is a vector with two components. If I work in a 3D space then curl(B) and B are both vectors with 3 components.
Why curl(B) should be a scalar? I think there is something I do not grasp here.
Moreover in my test code when I wrote curl(B), B was a variable, therefore by definition a "continuous scalar field". How can the curl work on a scalar field???
Top of pagePrevious messageNext messageBottom of page Link to this message

Luca Naso (adman)
Junior Member
Username: adman

Post Number: 3
Registered: 04-2008
Posted on Wednesday, April 23, 2008 - 04:07 am:   

Sorry for my last question. The answer is on the man page about "Differential Operators".

I report that part here for completness:

CURL ( arg )
Curl of vector arg. In 3D, returns the vector curl; in 2D, returns a scalar value equal to the magnitude of the curl, which necessarily must lie normal to the computation plane.

CURL ( scalar_arg )
Curl of a scalar_arg (2D only). Assumes arg to be the magnitude of a vector normal to the computation plane, and returns a vector result in the computation plane.

CURL ( argx, argy {, argz } )
Curl of a vector whose components in the computation plane are argx and argy (and possibly argz in 3D).


So the expression (B-n*curl(B)) does not results in a vector minus a scalar, but in a scalar minus a vecotr. Is it?
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1112
Registered: 06-2003
Posted on Thursday, April 24, 2008 - 02:34 pm:   

If you are working in 2D and B is a vector (Bx,By) in the computation plane, then curl(B) is a vector with a single component out of the computation plane. This value is treated as a scalar by FlexPDE (since it cannot be represented as a vector in the 2D space). Therefore, (B-n*curl(B)) is (vector - scalar*scalar).

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration