I am new to NGSolve and would like to follow up on a similar question.
I am solving a three dimensional problem and as part of my weak form, I need to implement a vector valued quantity that arises through integration of a coefficient function defined on the bottom of my domain. The integration is wrt z and the result should be a CoefficientFunction or a GridFunction defined on the whole domain.
To do this, I am trying to implement numerical integration myself and essentially create a CoefficientFunction holding the result (though I am not certain this is the most convenient way to do this either). Therefore I would need to create a CoefficientFunction or a GridFunction from a vector or array holding the values from the numerical integration.
My questions are:
[ol]
[li]Is there a better way to do this numerical integration?[/li]
[li]How could I go about setting a GridFunction or CoefficientFunction containing the results if there is no better way?[/li]
[/ol]
Could you provide a short mathematical description of what you want to do? Maybe with a sketch or something? From what I would understand you can do something like:
integration_val = Parameter(0)
# use this integration val in some SymbolicBFI or so...
a +=SymbolicBFI(integration_val * u * v)
# then in some loop, etc...
integration_val.Set(Integrate(cf, mesh, definedon=mesh.Boundaries("bottom"))
# use the new val in the bf,...
a.Assemble()
sorry for being unclear. A rough explanation of my problem is that my bilinear form is a convection operator and I was having trouble implementing the vector that acts as the wind.
wind = ???
a = SymbolicBFI( InnerProduct( grad(u) * wind, v ) )
This is because each component of the wind arises through integration of a function (that we will call phi), i.e.
wind_i(x,y,z) = \int_0^z \phi_i (x,y,\tilde{z}) d\tilde{z}, i = 1,...,3
The expression for the wind is actually more complicated, but my question is about evaluating this type of integral: Is there a nicer way to evaluate this integral using NGSolve than by writing a numerical integration scheme myself?
Thanks,
Josie