CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   electroMagnetoStaticFoam solver - solve static electric and magnetic fields (https://www.cfd-online.com/Forums/openfoam-solving/135575-electromagnetostaticfoam-solver-solve-static-electric-magnetic-fields.html)

chriss85 May 15, 2014 06:51

electroMagnetoStaticFoam solver - solve static electric and magnetic fields
 
2 Attachment(s)
I have created a simple solver for calculating static electric potentials/fields, currents and magnetic potentials/fields, given a conductivity distribution. The magnetic fields currently assume a constant magnetic permeability.

The solver is attached together with an example, feel free to use it.
I have also included the boundary conditions from http://www.cfd-online.com/Forums/ope...particles.html, so credits go to Dzhordzhs for them. I haven't used them successfully yet, but maybe someone will find it useful.

I also have a problem regarding the supplied example that I haven't been able to solve yet.

The example is a simple, rectangular conductor made out of two materials with different conductivities. Physics require that the current is divergence-free everywhere. However, this is not the case at the step.
The problem happens because of interpolation issues while calculating the gradient of the electric potential. The step in conductivity is instantaneous, so the slope of the electric potential changes its steepness. In the continuum one would have different electric field strengths for the two materials. However, the gradient can't be infinite, and so the current will have a divergence at the border, since j=sigma*E, and sigma and E aren't consistent to each other. The attached image shows this behavior.

I have tried to use a higher order gradient scheme, but this has only lowered the problem by a very small amount.

Is there any other formulation one could use to prevent this kind of problems? Maybe calculate the gradients as surfaceScalarFields?

bigphil May 15, 2014 07:09

Hi,

This is very similar to solid mechanics when there are joined materials, so there is a step jump in diffusivity (i.e. Young's modulus) at the interface. The standard finite volume discretisation results in erroneous peaks.

For the multi-material solids, a special discretisation must be used, see this paper:
http://onlinelibrary.wiley.com/doi/1....4390/abstract
The accepted draft can be downloaded from here: http://irserver.ucd.ie/bitstream/han...pdf?sequence=2

This has been implemented as an option in the elasticSolidFoam solver where the discretisation coefficients at the interface are corrected.

Best regards,
Philip

chriss85 May 15, 2014 07:35

Thanks, this looks interesting.

I looked a bit in the implementation of solidElasticFoam, and on first sight it looks like it specifically treats interfaces. In a general case I have a continous variation of conductivity though. Is this method suitable there?

bigphil May 15, 2014 07:50

Quote:

Originally Posted by chriss85 (Post 492009)
In a general case I have a continous variation of conductivity though. Is this method suitable there?

That's a good question;

standard FV discretisation (e.g. standard central-differencing for Laplacian term) assumes a linear distribution across the face in the face normal direction, but if there is a step jump at the interface then this assumption is poor (and actually gets worse with mesh refinement) hence the special procedure.

But if there is no step jump (continuously varying diffusivity and grad of solution variable) then the standard FV discretisation should actually be OK as the mesh is refined.

So the special procedure is only necessary for step jumps in gradU due to step jumps in material properties, but it actually reduces to standard form when there is no jump in properties.

In your previous post you have a step and hence you get error peaks; but if you had a smooth continuous distribution then I suppose it should be OK as the mesh is refined, but I have not really looked in to continuously varying diffusivity, so I'm not sure.

Philip

chriss85 May 15, 2014 08:06

Yes, that's more or less what I've been thinking.
In my real application (plasmas) I'm using a model that has a different conductivity in the first cell layer to a wall, and I notice this behavior there. I also think that this causes a rather large error there, because the current significantly influences the energy balance in the plasma.
I may have to think of other ways then, maybe applying a gaussian filter to the conductivity to smooth it a bit?

I will try to take a deeper look in the paper you linked and see if I can use this method though. Unfortunately I don't know much about solid displacement modelling, but I hope I can manage :)


All times are GMT -4. The time now is 01:59.