Solver connections question

Numerical methods and mathematical models of Elmer
Post Reply
drmike
Posts: 38
Joined: 17 Mar 2024, 18:52
Antispam: Yes

Solver connections question

Post by drmike »

I'd like to manipulate the Load or BodyForce in the StaticElecSolver using a custom Solver. Seems like this should be straight forward, but I'm very confused about how to accomplish it.

Do I use Exported Variable 1 = "Charge Density" in the StaticElecSolver section and Variable = "Charge Density" in the custom section? The custom solver won't actually solve any differential equations, it will just change the charge density each time step based on the potential and fields found in the StaticElecSolver. I looked at the ParticleElstat example, but can't get it to do what I want. I think I'm trying to do something simpler.
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Solver connections question

Post by raback »

Maybe you could be more specific what you want to compute. Devil lies in the detail. -Peter
drmike
Posts: 38
Joined: 17 Mar 2024, 18:52
Antispam: Yes

Re: Solver connections question

Post by drmike »

I'm going to have "charge clouds" which will have a specific shape. Eventually I want several species with different charges. I'll map some fraction of each cloud to a node point. After summing all the different clouds onto the nodes, I want to pass that as the Charge Density to the StaticElecSolver. It's a very, very crude model, but I hope to understand enough physics to help me figure out if some ideas might work. It's essentially a particle in cell plasma, just crude.
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Solver connections question

Post by raback »

Hi drmike,

You might take use of the "DataToFieldSolver". Also the particle machinery has internal operation that also does sharing of particle properties to the nodes. The DataToFieldSolver allows solution by FEM and therefore you can add diffusion etc. for a smoother field.

The particle machinery can treat several particle types.

-Peter
drmike
Posts: 38
Joined: 17 Mar 2024, 18:52
Antispam: Yes

Re: Solver connections question

Post by drmike »

What do I feed to Variable [FieldName] and Target Variable <> in the DataToFieldSolver? The result has to get to the Charge Density body force portion of the StaticElecSolver. Is that just Potential_Load in the global variable list?

I guess another way to ask the question is how to send data to the RHS of the StaticElecSolver from outside the solver. Either the DataToFieldSolver or a crude custom routine would do it the same way.
drmike
Posts: 38
Joined: 17 Mar 2024, 18:52
Antispam: Yes

Re: Solver connections question

Post by drmike »

I think I have a solution which might work. The charge density routine is called every bulk assembly time. I can check model % solver % TimesVisited to determine if I should move the charges. As long as I remember to set the Calculate Electric Field bit in the StaticElecSolver I can find the E field from the solver itself. Should be interesting debugging this idea.
drmike
Posts: 38
Joined: 17 Mar 2024, 18:52
Antispam: Yes

Re: Solver connections question

Post by drmike »

This does in fact do what I want. I'm pretty sure there are more elegant methods - I'm learning a lot about Elmer as I go along. For now I can use the tool to study physics rather than study coding of differential equations and that is super helpful. A big thank you to the crew making Elmer work!
Post Reply