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/)
-   -   coupled equations (https://www.cfd-online.com/Forums/openfoam-solving/178118-coupled-equations.html)

Mohammad Jam September 29, 2016 06:22

coupled equations
 
Hi Foamers,

How to to solve coupled equations?
there are two variable A & B , which A is volVectorfield & B is volScalarField

fvm::ddt(A)+fvm::div(B)=0
fvm::laplacian(A)+fvm::grad(B)+source term=0

I.C.::
A= 0 for 0 < x < L when t = 0
B=20 for 0 < x < L when t = 0

B.C.
A = 0 for x = 0, L when t > 0
B=10 for x = 0 & T=30 for x = L when t > 0

Thanks in advance.

anishtain4 September 29, 2016 13:41

Hi Mohammad,
What exactly do you mean by solving coupled equations?
Your equations could be solved as a system of equation in a coupled or non-coupled manner.
To solve them in a non-coupled manner you can find one of the simpler solvers (such as the cases in the test directory) and modify it so it solves your equations. This is the easier approach.
To solve them in a coupled manner you need to solve the linear system of equation for all of the variables at once (usually not very favourable in CFD due to big size of the problem). Since your equations are not similar the only way comes to my mind is to modify some of the solvers and overload the matrix coefficient formation so it includes all of them, which is quiet complicated and time consuming.

Mohammad Jam September 29, 2016 18:02

Quote:

Originally Posted by anishtain4 (Post 619768)
Hi Mohammad,
What exactly do you mean by solving coupled equations?
Your equations could be solved as a system of equation in a coupled or non-coupled manner.
To solve them in a non-coupled manner you can find one of the simpler solvers (such as the cases in the test directory) and modify it so it solves your equations. This is the easier approach.
To solve them in a coupled manner you need to solve the linear system of equation for all of the variables at once (usually not very favourable in CFD due to big size of the problem). Since your equations are not similar the only way comes to my mind is to modify some of the solvers and overload the matrix coefficient formation so it includes all of them, which is quiet complicated and time consuming.

Hi Mahdi , thanks for your kind response

you are right, this is a system of equation and no need to solve them simultaneously .
A refers to volScalarField and B refers to volVectorField

i just need to get "A" but there is "B" in equations too .

i think its a kind of series coupled equation! i mean i should find variable ''B'' from first equation and put it in second equation to find variable "A".

Mohammad Jam September 29, 2016 18:15

Quote:

Originally Posted by anishtain4 (Post 619768)
To solve them in a non-coupled manner you can find one of the simpler solvers (such as the cases in the test directory) and modify it so it solves your equations. This is the easier approach.
.

i am working with chtMultiregionFoam solver and implementation of these Eq. is my problem because when i implement them it gives some unwanted errors because it doesnt allow to put two passive variable in one equation.

Best regards,
Mohammad

Mohammad Jam September 30, 2016 11:32

Quote:

Originally Posted by anishtain4 (Post 619768)
Hi Mohammad,
What exactly do you mean by solving coupled equations?
Your equations could be solved as a system of equation in a coupled or non-coupled manner.
To solve them in a non-coupled manner you can find one of the simpler solvers (such as the cases in the test directory) and modify it so it solves your equations. This is the easier approach.
To solve them in a coupled manner you need to solve the linear system of equation for all of the variables at once (usually not very favourable in CFD due to big size of the problem). Since your equations are not similar the only way comes to my mind is to modify some of the solvers and overload the matrix coefficient formation so it includes all of them, which is quiet complicated and time consuming.

Dear Mahdi,

implementation of grad and div schemes is not allowed by chtMultiRegionFoam solver !! ,
any hint or idea is welcome.

anishtain4 September 30, 2016 11:33

The general case is no different than NS and continuity equation!
1. Set initial condition
2. Solve Eq. 1, then solve Eq. 2
3. Repeat step 2 until desired error is low
4. move to the next step.

You can check pimpleFoam or pisoFoam as they do the same thing for momentum and pressure correction steps.

Mohammad Jam September 30, 2016 11:40

Quote:

Originally Posted by anishtain4 (Post 619899)
The general case is no different than NS and continuity equation!
1. Set initial condition
2. Solve Eq. 1, then solve Eq. 2
3. Repeat step 2 until desired error is low
4. move to the next step.

You can check pimpleFoam or pisoFoam as they do the same thing for momentum and pressure correction steps.

thats exactly true, but my problem is div and grad scheme doesnt allow to compile .
when i change the schemes to e.g. ddt or laplacian , the solver compile correctly and without error.
should i use any algorithm like piso or simple?

best regards

Mohammad Jam September 30, 2016 11:52

Quote:

Originally Posted by anishtain4 (Post 619899)
The general case is no different than NS and continuity equation!
1. Set initial condition
2. Solve Eq. 1, then solve Eq. 2
3. Repeat step 2 until desired error is low
4. move to the next step.

You can check pimpleFoam or pisoFoam as they do the same thing for momentum and pressure correction steps.

May i email you my solver and you take a look ?

nimasam September 30, 2016 12:11

------------- paste in wrong post--------------

Mohammad Jam September 30, 2016 12:30

Quote:

Originally Posted by nimasam (Post 619908)
following syntax:
Code:

typedef typename Foam::KinematicParcel<Foam::particle> parcelType ;

forAllIter( basicNewKinematicCloud , kinematicCloud, iter)
{
    parcelType& p = iter(); //paticle
  kinematicCloud.deleteParticle(p);
}


Dear nima,
i couldnt found what you hint!!
where should i implement this syntax?


All times are GMT -4. The time now is 03:43.