define right hand side without dx or ds

Asked by markus

I want to set up a system Ax = b, where b is zero except for two entries. I defined the two variables affected with the real function space FunctionSpace(mesh, "R", 0) and can address them in the test function with "v[1]" and "v[2]". So in order to set up the vector b, I run:

temp = Constant(1)*v[1]*dx + Constant(2)*v[2]*dx
b = assemble(temp)

When I then control the values in b they are not 1 and 2, so they must have been multiplied by the value of "dx". How can I prevent that?

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:
Revision history for this message
Best Johan Hake (johan-hake) said :
#1

On 07/25/2012 06:56 PM, markus wrote:
> New question #204172 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/204172
>
> I want to set up a system Ax = b, where b is zero except for two entries. I defined the two variables affected with the real function space FunctionSpace(mesh, "R", 0) and can address them in the test function with "v[1]" and "v[2]". So in order to set up the vector b, I run:
>
> temp = Constant(1)*v[1]*dx + Constant(2)*v[2]*dx
> b = assemble(temp)
>
> When I then control the values in b they are not 1 and 2, so they must have been multiplied by the value of "dx". How can I prevent that?

Try:

temp = Constant(1)*v[1]/volume*dx + Constant(2)*v[2]/volume*dx

where volume is the volume of the domain (change to area if the domain
is in 2D).

Johan

Revision history for this message
markus (markus-jehl-11) said :
#2

Thanks Johan Hake, that solved my question.