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/)
-   -   Implicit equation solving (https://www.cfd-online.com/Forums/openfoam-solving/60673-implicit-equation-solving.html)

Dr B.M. Smith (Smith) December 9, 2004 15:50

When I want to have a solver
 
When I want to have a solver that must solve for a vector implicitly defined, but which can be written explicitly by matrix inversion, is this possible? Can I write an implicit equation and request foam to solve for a particular vector field within the equation? Or rather must one write all equations to be solved in explicit form, and if so, when using the expression "inv(M)" to invert a matrix M, if M is a complicated sum of products of tensors, say "M=A+div(nu, U)" for example, can one write combined expressions as equation terms such as "inv(A+div(nu, U))", or must one separate such operations by first solving the field eqn for M on the mesh and then later solve the eqn involving the inverse? (I'd like to get some hints before committing to writing solver before I commit to trial and error testing.)

Thanks in advance for any help,
Blair.

Mattijs Janssens (Mattijs) December 10, 2004 05:20

The latter, you must separate
 
The latter, you must separate the operations. You create an equation for a single variable (can be a vector or tensor) using explicit terms (e.g. fvc::div) or implicit terms (e.g. fvm::laplacian) where the implicitness is only in the variable solved for. You can then call 'solve' on it which does your 'inv'.

Have a look at a simple solver, e.g. icoFoam ($FOAM_SOLVERS/incompressible/icoFoam/icoFoam/C)

Hope this answers some of your questions.

Mattijs

Eugene de Villiers (Eugene) December 10, 2004 05:36

Here as an example, is the mem
 
Here as an example, is the mementum predictor step from icoFoam:

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

solve(UEqn == -fvc::grad(p));

As Mattijs said the elements prefaced by fvm are implicit terms in the Ueqn matrix, while the fvc term will be treated explicitly by the solver.
(U = velocity, phi = face flux, nu = viscosity, p = pressure)

Eugene


All times are GMT -4. The time now is 12:02.