 # Discussion Forum

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.

## Calculating subdomain volumes with integration coupling variables

Hello,

I am trying to use integration coupling variables to calculate the volumes of my subdomains, but without success. I know how to use ICVs to calculate the total volume for one or more subdomains, but is there a way to calculate the volume subdomain by subdomain?

My problem is that I'd like to calculate the magnetic energy in a magnetic circuit I'm designing. I can calculate the magnetic energy density (1/2*B*H), but it would be much better to show the magnetic energy itself (1/2*B*H*Volume). I was hoping there would be some way to calculate the subdomain volumes do that I would be able to use an expression like

1/2*normB_emqa*normH_emqa*volume

and have my slice plot rescale results in each subdomain by the volume of the subdomain they were in. Is there a way to do this? Any help would be much appreciated.

Thanks!

Scott

11 Replies Last Post Nov 4, 2010, 11:09 AM EDT

Hi Scott,

You can integrate the expression 1.0 over the sub-domain, and store it in a variable for a subsequent use.

TJ

Thanks for the quick reply TJ! The process you described is the approach I am taking, but I am unsure how to extend it for multiple subdomains. In my model, the magnetic flux flows through several subdomains, and I'd like to create a plot showing the magnetic energy in each subdomain. When I create an ICV with the expression 1.0 for all the subdomains, the result is the total volume. I guess I'm looking for some way to solve for a variable that is the volume of the subdomain in which it is evalutated. Is this even possible?

I've thought about using multiple expressions - one for each subdomain - but that doesn't make sense to me either because I am not sure how I would be able to plot that.

Thanks again for the suggestion.

Scott

can you try something like this: 1*(dom==1)

Hi

with the expression forthe integrant

(dom == dest(dom))

you can specify a range with the source and destination that is not the sum of them all

but this is somewhat tricky to understad

have fun Comsoling
Ivar

Hi Scott,

you are already on the right track. Here my recommendation how to finish the job.

1) you first need to define a integration coupling variable for each subdomain, e.g
I1 = \int Wm_av (on subdomain 1)
I2 = \int Wm_av (on subdomain 2)
I3 = \int Wm_av (on subdomain 3)
This is what you probvaly have done already.

2) Now you can define a subdomain variable that has the value of I1, I2, I3 in the respective subdomains
Wm = I1 if domain = subdomain 1
Wm = I2 if domain = subdomain 2
Wm = I3 if domain = subdomain 3

Finally you postprocess Wm in a surface plot and should get the desired result. See the attached example based on the library model eddy_coil.

Best regards,
Sven

Hi Scott,

you are already on the right track. Here my recommendation how to finish the job.

1) you first need to define a integration coupling variable for each subdomain, e.g
I1 = \int Wm_av (on subdomain 1)
I2 = \int Wm_av (on subdomain 2)
I3 = \int Wm_av (on subdomain 3)
This is what you probvaly have done already.

2) Now you can define a subdomain variable that has the value of I1, I2, I3 in the respective subdomains
Wm = I1 if domain = subdomain 1
Wm = I2 if domain = subdomain 2
Wm = I3 if domain = subdomain 3

Finally you postprocess Wm in a surface plot and should get the desired result. See the attached example based on the library model eddy_coil.

Best regards,
Sven

Ivar, Sven,

Thank you for your helpful suggestions! I was able to implement Sven's approach and it worked beautifully. Thank you so much!

Scott

Posted: 10 years ago
Hello,

I am trying to calculate the magnetic energy in a magnetic circuit using comsol 4.0a.
I already managed to do this in comsol 3.5a after using the comsol support, but in the new version everything seems a little different.
My intention is to calulate the magnetic enrgy density using a interpolation table with wmag beeing a function of B. Normally comsol considers every Material to have a linear characteristic which doesn´t make sense using ferromangetic materials. But i don´t know how it works in the newest version and I am not able to apply this property to a Material properly or even have a look to this Variable wmag.

I hope somebody can help me with that as soon as possible.

Posted: 10 years ago
Hi
You can make your material as non lienar as you want ;),
the only thing to understand is that if you have several materials, some linear other not and some depending on a BH curve and other not, then you need to add extra main physics nodes for the material that have different physical properties / governing laws.

When you select domaisn the main physics GUI must be correct for all of them as it defines the main physical properties, of you have one anisotropic material, add simple a new physcs node for this one and set up the appropriate physics for it.

There the difference of the node type, the one that are additiev and the one that are overriding, see the doc

--
Good luck
Ivar

Posted: 10 years ago
Hi Ivar,

thanks for responding quickly.
With physic nodes u mean the subdomain property Ampere´s Law, right?
There u can determine if material uses HB-curve, etc.
But my question is: does comsol now calculates the magnetic energy accordingly to that Amperes Law node.
I know from Mr. Olsson (comsol support) that in COMSOL 3.5a magnetic energy density is calculated by wmag=0.5*B*H (default setting) and u could see the eqation in a Variables table. But there is no such table in 4.0a, or I can´t find it. I Think I just found it.
U have to activate "show eqation view" on top of the Model builder. Now I can see and change mf.Wm under Amperes Law node.
And indeed, comsol unfortunately assumes every Material to be linear (Wm=0.5*H*B)...