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

non-linear diffusion problem #4257

Open
karthichockalingam opened this issue Apr 22, 2024 · 3 comments
Open

non-linear diffusion problem #4257

karthichockalingam opened this issue Apr 22, 2024 · 3 comments
Assignees

Comments

@karthichockalingam
Copy link

Hello,

I am looking to solve a non-linear diffusion problem

$-\nabla \cdot \kappa(u)\nabla u = f$

I checked the documentation for linear integrators and bilinear integrators:
https://mfem.org/lininteg/
https://mfem.org/bilininteg/
and ex0.cpp for a simple diffusion equation.

From what I gather from the above documentation, you can use the above linear operators to solve linear PDEs if not wrong. However, I do not know how to go about solving non-linear PDEs.

I am relatively new to mfem, if there is an existing example or a sample code, from which I can build that would be great. Thank you.

Kind regards,
Karthik.

@j-signorelli j-signorelli self-assigned this Apr 25, 2024
@j-signorelli
Copy link
Contributor

Hi @karthichockalingam ,

You have to use a NonlinearForm with an appropriately-prepared NonlinearFormIntegrator for this - please check out #3975, I had pretty much this same question when first starting up with MFEM and hope that the linked discussion helps!

@karthichockalingam
Copy link
Author

Thank you @j-signorelli for your response. I will have a look.

@karthichockalingam
Copy link
Author

karthichockalingam commented May 8, 2024

Hi @j-signorelli I was able to go over the issue and understand how to implement non-linear PDEs :)
Thanks a lot. Please let me know how I can make it a time-dependent problem.

$\frac{\partial u}{\partial t} -\nabla \cdot \kappa(u)\nabla u = f$

In the sample non-linear code gist, shared by @pazner , the AddDomainIntegrator is called using NonlinearForm

// 6. Set up the nonlinear form n(u,v) = (grad u, grad v) + (f(u), v)
   NonlinearForm n(&fespace);
   n.AddDomainIntegrator(new NonlinearMassIntegrator(fespace));
   n.AddDomainIntegrator(new DiffusionIntegrator);
   n.SetEssentialBC(boundary_dofs);

In the above code, I believe everything is assembled elementwise.

In ex16 were a time depenedent non-linear PDE is solved, the AddDomainIntegrator is called using BilinearForm

void ConductionOperator::SetParameters(const Vector &u)
{
   GridFunction u_alpha_gf(&fespace);
   u_alpha_gf.SetFromTrueDofs(u);
   for (int i = 0; i < u_alpha_gf.Size(); i++)
   {
      u_alpha_gf(i) = kappa + alpha*u_alpha_gf(i);
   }

   delete K;
   K = new BilinearForm(&fespace);

   GridFunctionCoefficient u_coeff(&u_alpha_gf);

   K->AddDomainIntegrator(new DiffusionIntegrator(u_coeff));
   K->Assemble();
   K->FormSystemMatrix(ess_tdof_list, Kmat);
   delete T;
   T = NULL; // re-compute T on the next ImplicitSolve
}

Maybe ex16, K is to setting up the global assembly of Kmat. I am not sure if I should proceed element-wise or by globally assembled matrix to make the problem time-dependent. If I should be using NonlinearForm or not.

If the sample non-linear code gist can be extended to time-dependent problems, it would be helpful.

Many thanks!!

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