Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

[solved] Distributed DC voltage source

Please login with a confirmed email address before reporting spam

Hi,

How do I create a distributed voltage source in comsol?

The electrical circuit illustrated in the attached image is a very simple model of a fuel cell stack containing two fuel cells. What I would like to do is to replace R1, R2, U1 and U2 with 2D or 3D structures with R and U being functions of x and y. For R I can easily create solids with their conductance being a function of x and y. However, I can't figure out how to create the distributed voltage sources. Any suggestions?

Thanks
Anders


8 Replies Last Post Oct 15, 2010, 4:34 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 6, 2010, 8:59 a.m. EDT
Anders,

just as you do with the conductance in the subdomains you can assign functions of the spatial coordinates to the boundaries. All input fields in COMSOL accept expressions.

Best regards
Edgar
Anders, just as you do with the conductance in the subdomains you can assign functions of the spatial coordinates to the boundaries. All input fields in COMSOL accept expressions. Best regards Edgar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 6, 2010, 2:40 p.m. EDT
Edgar, thanks for your input.

OK, for the two voltage sources I could create 3D solids and specify potentials that depend on x and y on the boundaries. However, those potentials would be fixed with respect to some reference potential. This is not what I want. I need only to specify the voltage drops between the positive and the negative terminals of each the two voltage sources.

Please help me if mess things up here.

Anders
Edgar, thanks for your input. OK, for the two voltage sources I could create 3D solids and specify potentials that depend on x and y on the boundaries. However, those potentials would be fixed with respect to some reference potential. This is not what I want. I need only to specify the voltage drops between the positive and the negative terminals of each the two voltage sources. Please help me if mess things up here. Anders

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 7, 2010, 4:01 a.m. EDT
Anders,

you can refer to other boundaries in your expressions. Assume you ground the minus (MinusU1=0) of U1 and you apply a voltage difference deltaU1 to the plus of U1 (PlusU1 = deltaU1). You can apply a voltage drop across U2 by referring to the potential of the respective boundary: PlusU2 = V(MinusU2) + deltaU2.

V stands for the appropriate potential variable in the application mode you use.

Best regards
Edgar
Anders, you can refer to other boundaries in your expressions. Assume you ground the minus (MinusU1=0) of U1 and you apply a voltage difference deltaU1 to the plus of U1 (PlusU1 = deltaU1). You can apply a voltage drop across U2 by referring to the potential of the respective boundary: PlusU2 = V(MinusU2) + deltaU2. V stands for the appropriate potential variable in the application mode you use. Best regards Edgar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 7, 2010, 5:49 a.m. EDT
Edgar, thanks again!

How do I enter the following BC: PlusU2 = V(MinusU2) + deltaU2.

The attached screen dump explains my question. Boundary 28 corresponds to PlusU2 and boundary 25 corresponds to MinusU2. For simplicity deltaU2=0.53.

Anders
Edgar, thanks again! How do I enter the following BC: PlusU2 = V(MinusU2) + deltaU2. The attached screen dump explains my question. Boundary 28 corresponds to PlusU2 and boundary 25 corresponds to MinusU2. For simplicity deltaU2=0.53. Anders


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 7, 2010, 6:01 a.m. EDT
Anders,

your expression would be V(x, y, z)+0.53. For (x, y, z) you use a point on your MinusU2 boundary or in the corresponding electrode subdomain. The variable V is the variable for electric potential in COMSOL 3.5a. You may need to check if it is the same in V4.0.

Let me know if it works
Edgar
Anders, your expression would be V(x, y, z)+0.53. For (x, y, z) you use a point on your MinusU2 boundary or in the corresponding electrode subdomain. The variable V is the variable for electric potential in COMSOL 3.5a. You may need to check if it is the same in V4.0. Let me know if it works Edgar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 7, 2010, 8:54 a.m. EDT
Hello again,

I can't get it to work.

The attached mph file (comsol 3.5) models a conducting cube. The bottom boundary is set to V=1 the top boundary is set to V=V(0.5,0.5,0)+3, where (x,y,z) = (0.5,0.5,0) is a point on the bottom boundary. Other boundaries are insulating. The solution gives a voltage of 3 at the top boundary and not 4 as expected.

Furthermore, I did save save the model as a model m file. Running this file from matlab gives the following error:


??? Java exception occurred:
Exception:
com.femlab.server.MlError: Error using ==> feval
Undefined function or method 'V' for input arguments of type 'double'.
(rethrown as com.femlab.jni.FlNativeException)
Messages:
Error using ==> feval
Undefined function or method 'V' for input arguments of type 'double'.

Failed to evaluate expression
- Expression: -V+V0_dc

Failed to evaluate variable
- Variable: V0_dc
- Defined as: (V(0.5,0.5,0)+3)

Error in external function
- Function: V
Hello again, I can't get it to work. The attached mph file (comsol 3.5) models a conducting cube. The bottom boundary is set to V=1 the top boundary is set to V=V(0.5,0.5,0)+3, where (x,y,z) = (0.5,0.5,0) is a point on the bottom boundary. Other boundaries are insulating. The solution gives a voltage of 3 at the top boundary and not 4 as expected. Furthermore, I did save save the model as a model m file. Running this file from matlab gives the following error: ??? Java exception occurred: Exception: com.femlab.server.MlError: Error using ==> feval Undefined function or method 'V' for input arguments of type 'double'. (rethrown as com.femlab.jni.FlNativeException) Messages: Error using ==> feval Undefined function or method 'V' for input arguments of type 'double'. Failed to evaluate expression - Expression: -V+V0_dc Failed to evaluate variable - Variable: V0_dc - Defined as: (V(0.5,0.5,0)+3) Error in external function - Function: V


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 7, 2010, 12:13 p.m. EDT
Anders,

to be honest, I am pretty surprised. I also couldn't read the potential as a function of space coordinates.

Maybe someone else has a clue?

Best regards
Edgar
Anders, to be honest, I am pretty surprised. I also couldn't read the potential as a function of space coordinates. Maybe someone else has a clue? Best regards Edgar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 15, 2010, 4:34 a.m. EDT
It seems that I finally found a solution to the problem. The voltage drop across the voltage source can be specified using a periodic boundary condition. The attached model shows how it can be done.

Anders
It seems that I finally found a solution to the problem. The voltage drop across the voltage source can be specified using a periodic boundary condition. The attached model shows how it can be done. Anders

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.