Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couple two physics in two domains #82

Open
xrfe opened this issue Aug 15, 2023 · 3 comments
Open

couple two physics in two domains #82

xrfe opened this issue Aug 15, 2023 · 3 comments

Comments

@xrfe
Copy link

xrfe commented Aug 15, 2023

Hi,
I am new to VoronoiFVM.jl. After one week try, I found it is really fantastic at solving diffusion problems, it is faster than similar problem I solved in c++ using FEM. So, I decide to try further.
Currently I have the time-dependent mass diffusion equation (c) in 1D domain, and heat conduction equation (T) in a 2D domain. the top boundary of the 2D domain is actually the 1D domain where mass diffusion happens. The equation are coupled (mass diffusion coefficient depends on temperature e.g., D(T), mass diffusion also generate heat, e.g., Q(c)) .

+=============mass diffusion============+
+++++++++++++++++++++++++++++++++++++++
++++++++++++++ heat conduction+++++++++++
+++++++++++++++++++++++++++++++++++++++

I first solve the 2D heat equation and get temperature T, then I solve the mass diffusion equation and get generated heat Q, Can you tell me how can I pass the T, and Q to each other in VoronoiFVM.jl?

@j-fu
Copy link
Member

j-fu commented Aug 15, 2023

Hi, I would define a joint System for both:

You can add the concentration as boundary species and define a boundary flux function for the mass flux. It would be better to use
unknown_storage=:sparse then.

How does the term for mass diffusion generating heat look like?
Do you use an EdgeReaction to implement this ? If so I would
have to add another callback function for this (which is not much work).

Some of these features have been used in the examples:

https://j-fu.github.io/VoronoiFVM.jl/stable/examples/Example220_NonlinearPoisson2D_BoundarySpecies/

https://j-fu.github.io/VoronoiFVM.jl/stable/examples/Example311_HeatEquation_BoundaryDiffusion/

For coupling two systems as you proposed, you could try to define the 1D mass grid as a subgrid of the 2D heat grid, so you have coupling information between them. You always have node.index and edge.node[1], edge.node[2] in the callbacks to index into respective grid functions.

The advantage of the "one system approach" is that all is solved in one general Newton method.

@xrfe
Copy link
Author

xrfe commented Aug 15, 2023

Thank you so much for your prompt reply. My equations are like these:
∂c/∂t = ∂ (D(T)∂c/∂x) / ∂x + λT in 1D
​ ∂T/∂t = KΔu, in 2D, with BC: ∂T/∂n = ∂(∂c/∂x) / ∂x

My problem is quite similar to the second example you give. It's really helpful.
Curiously, if my heat equation is anisotropic (e.g., K is zero in x direction), then

∂T/∂t = K∂ (∂c/∂y) / ∂y, in 2D with BC: ∂T/∂n = ∂(∂c/∂x) / ∂x.

can I still use VoronoiFVM.jl to discretize them in an "one system approach"?

@j-fu
Copy link
Member

j-fu commented Aug 19, 2023

Yes, I think this can work. You would need to check the direction of the edge. E.g. you could have a K matrix and multiply this by the normalized edge vector.

Please be aware that this will be only correct if you work with a rectangular simplex grid and the main directions of K are aligned with the x and y directions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants