# chtMultiRegionFoam | merging the two regions after solving

 Register Blogs Members List Search Today's Posts Mark Forums Read

 May 12, 2022, 05:11 chtMultiRegionFoam | merging the two regions after solving #1 New Member   Zeinab Abosedaira Join Date: Mar 2022 Posts: 24 Rep Power: 4 Hello all, I have a multi-region problem between a solid region and a fluid region. I edited the solver for my new problem, but it's the same base of operation. My problem basically is I am solving for electric potential in solid and fluid regions; each has different permittivity so that's why I am using a solver like chtMultiRegion. When I finish solving, I need to merge the two regions because I need a continuous electric potential field in order to calculate the electric field which is the negative gradient of the electric potential. So, I need one continuous field for electric potential but I need to solve for each region separately. I used mapFields utility but the mapped field is not exactly the same as the original one.

 May 12, 2022, 09:45 #2 Senior Member   Join Date: Sep 2013 Posts: 353 Rep Power: 20 From my point of view you could solve the electric potential as well with a coupling boundary condition. But since that is not what you are asking: It sounds like you are limiting yourself to meshing both regions in such a way, that the boundary faces are identical. Why not simply save the unsplit mesh (or merged mesh) and transfer everything to that? Since it is identical. You can cleanly map every cell center from both region meshes to that. You could use mapFields, or simply copy the contents. For example create a file called cellNumber in your 0 directory and set these for internalField / well obviously it needs to be as long as your cell size of each region. And view that in paraview. Now you know how those cells are numbered: Code: ```regionA internalField nonuniform List 5 ( 0 1 2 3 4 ); regionB internalField nonuniform List 5 ( 0 1 2 3 4 ); region0 / unsplit internalField nonuniform List 10 ( 0 1 2 3 4 5 6 7 8 9 );``` Or use postProcess -writeCellCentres, which will output the x,y,z position of each cell centre. It should be as easy as just copying both of those into one array.

 May 12, 2022, 12:06 #3 New Member   Zeinab Abosedaira Join Date: Mar 2022 Posts: 24 Rep Power: 4 I tried mapFields yes, but it generates a slight difference, so I was thinking of another way. Concerning the second way of copying the data, maybe I should try it and see the results. It's just I have a geometry with proximity and curvature so It didn't come to my mind that that copying would do the job. You mentioned that I can calculate the electric field directly even with the two regions are separated with a coupling boundary condition. Can you explain to me how exactly I can do that?

 May 13, 2022, 11:26 #4 Senior Member   Join Date: Sep 2013 Posts: 353 Rep Power: 20 Is that the case for all mapping methods? Or is it that one can't use the identical mesh method when the cell size differs? Could be...never tested that. And what i meant was: You could use a coupling boundary condition like temperaturecoupledbaffleMixed. All that boundary condition does is make sure that value and gradient at the coupling face are identical. That should work for the electric field as well. Although you would need to modify it. There is currently no coupling condition that works on arbitrary fields. Or vector/tensorfields. mikulo likes this.

 June 21, 2022, 04:29 #5 New Member   Zeinab Abosedaira Join Date: Mar 2022 Posts: 24 Rep Power: 4 Hello, I haven't replied in a while. I just wanted to let you know that I used the approach of copying the data, and it now works. Thank you so much.

September 14, 2022, 05:07
#6
Member

Join Date: Nov 2020
Posts: 53
Rep Power: 5
Quote:
 Originally Posted by Bloerb Is that the case for all mapping methods? Or is it that one can't use the identical mesh method when the cell size differs? Could be...never tested that. And what i meant was: You could use a coupling boundary condition like temperaturecoupledbaffleMixed. All that boundary condition does is make sure that value and gradient at the coupling face are identical. That should work for the electric field as well. Although you would need to modify it. There is currently no coupling condition that works on arbitrary fields. Or vector/tensorfields.
Hello,

What do you mean by modifying? Do you mean to make another boundary condition or simply use the same boundary condition name but with "kappa = sigma (electrical conductivity) ?

e.g.

type compressible::turbulentTemperatureCoupledBaffleMix ed;
kappa kappa;
Tnbr T;
value \$internalField;

change to,

type compressible::turbulentTemperatureCoupledBaffleMix ed;
kappa sigma;
Tnbr phi(electric potential);
value \$internalField;

Thank you.

Regards,
Michael

 September 14, 2022, 16:49 #7 Senior Member   Join Date: Sep 2013 Posts: 353 Rep Power: 20 Look into other posts of mine. I shared the derivation for this boundary condition. This BC forces two things, that both regions agree on temperature, and that the heatflux exiting one domain enters the other. Hence this would lead to these: phi_1=phi_2...so the same phi on the shared wall sigma_1*grad(phi_1)=-sigma_2*grad(phi_2) mikulo likes this.

 September 14, 2022, 21:41 #8 Member   Join Date: Nov 2020 Posts: 53 Rep Power: 5 Hi Bloerb, Yeah, I got you. I am just thinking whether is it still necessary to change it or just supply the ones I wrote above. After all, they are the same laplace equations. Thanks by the way! Regards, Mike

 September 15, 2022, 11:09 #9 Senior Member   Join Date: Sep 2013 Posts: 353 Rep Power: 20 There is no reason to change them function wise. The only thing i could think of is, that they do load the thermo libraries for kappa etc., which your solver might not need. Hence you could simplify them, but that is up to you. mikulo likes this.

 Tags chtmultiregion, electric field, electric potencial, merge, region