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,
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.
Here as an example, is the mem
Here as an example, is the mementum predictor step from icoFoam:
+ 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)
|All times are GMT -4. The time now is 19:11.|