### Goal-Oriented Adaptive mesh refinement at a single point

128

views

0

Hello,

I am solving a problem on the unit square, with 2 singularities at the points (0,1) and (1,1). I'd like to be able to tell my AdaptiveLinearVariationalSolver to refine at the singularity a=(0,1). I have an approximate solution u(x,y) = (u1(x,y), u2(x,y)), of which I am only interested in the horizontal component u1. I am attempting to do this by making my goal:

M =$\int\delta_a^A\left(x\right)u_1\left(x\right)dx$∫

where $\delta_a^A\left(x\right)$

*** Reason: Invalid value rank for coefficient 1 (got 1 but expecting 0). You might have forgotten to specify the value rank correctly in an Expression subclass.

*** Where: This error was encountered inside AssemblerBase.cpp.". Attached is the relevant portion of the code.
Sorry about that, but thanks for your response. It actually works if instead of splitting u I grab the first component function of u via dotting it with the vector (1,0).

I am solving a problem on the unit square, with 2 singularities at the points (0,1) and (1,1). I'd like to be able to tell my AdaptiveLinearVariationalSolver to refine at the singularity a=(0,1). I have an approximate solution u(x,y) = (u1(x,y), u2(x,y)), of which I am only interested in the horizontal component u1. I am attempting to do this by making my goal:

M =$\int\delta_a^A\left(x\right)u_1\left(x\right)dx$∫

`δ`_{a}^{A}(`x`)`u`_{1}(`x`)`d``x`where $\delta_a^A\left(x\right)$

`δ`_{a}^{A}(`x`) is the delta function modeled by a Gaussian curve at the point a. I obtain u1 by splitting u which lives in a VectorFunctionSpace, and I define my delta function via an Expression. When I say M = delta*u1*dx, I get the error that "*** Error: Unable to assemble form.*** Reason: Invalid value rank for coefficient 1 (got 1 but expecting 0). You might have forgotten to specify the value rank correctly in an Expression subclass.

*** Where: This error was encountered inside AssemblerBase.cpp.". Attached is the relevant portion of the code.

```
V = VectorFunctionSpace(mesh, "Lagrange", 4)
W = FunctionSpace(mesh, "Lagrange", 4)
u = TrialFunction(V)
v = TestFunction(V)
w = Function(V)
u = Function(V)
u1, u2 = split(u)
u1, u2 = u.split(True)# not sure the difference
# GOAL for adaptive refinement
amps = 10000
delta = Expression("A*exp(-mpi*A*(pow(x[0]-0.000013,2)+pow(x[1]-.999983, 2)))", A=amps, mpi=math.pi, degree=4)
J = delta*u1*dx # GOAL
pde = LinearVariationalProblem(a, F-b, u, bc)
solver = AdaptiveLinearVariationalSolver(pde, J)
```

Community: FEniCS Project

written
4 months ago by
Mae Markowski

Just a comment: I am surprised that you have to manually tell the adaptive solver to refine these singularities. This sounds a lot like the lid-driven cavity benchmark, for which I use fenics.AdaptiveNonlinearVariationalSolver with a goal which is also the horizontal velocity.

written
4 months ago by
Alexander G. Zimmerman

Do you really want your goal to be the horizontal velocity near the singularity? Do you care about the velocity elsewhere? If so, then why are you using a model with a singularity at the point of interest? It seems to me like you shouldn't be using the adaptive solver for this, since the entire point of the adaptive method is to indicate which cells should be refined based on an error estimator. If you already know which cells to refine (i.e. the ones near your singularity), then just refine them.

written
4 months ago by
Alexander G. Zimmerman

It is a lid driven cavity problem--you're right. This problem has 2 singularities, one at my top left corner and the other at my top right corner. I was interested in seeing if I manually tell it to focus on the left singularity, whether it will ignore the singularity at the right and asymmetrically refine the mesh, or whether it will still hone in on the right corner the same way.

written
4 months ago by
Mae Markowski

### 1 Answer

0

Instead of splitting u, use:

```
n = Expression(("1.0","0.0"), degree=4)
u1 = dot(u, n)
```

Please login to add an answer/comment or follow this question.

Also, always include a MWE (Minimum Working Example). I can't run this.