← Back to team overview

ffc team mailing list archive

Re: [Fwd: [Branch ~ffc-core/ffc/main] Rev 1423: merge]

 


Kristian Oelgaard wrote:
> 
> On 16 February 2010 13:26, Garth N. Wells <gnw20@xxxxxxxxx> wrote:
>>
>>
>> Garth N. Wells wrote:
>>>
>>> Garth N. Wells wrote:
>>>> This change broke my solver :(.
>>>>
>>
>> I managed to fix the first bug, but now with optimisation on I get:
>>
>>  File
>> "/usr/local/lib/python2.6/dist-packages/ffc/quadrature/quadraturegenerator.py",
>>
>> line 210, in _generate_element_tensor
>>    integral_code, ops = _generate_integral_code(points, terms, sets,
>> optimise_parameters)
>>  File
>> "/usr/local/lib/python2.6/dist-packages/ffc/quadrature/quadraturegenerator.py",
>>
>> line 344, in _generate_integral_code
>>    "Linear forms must be defined using test functions only: " +
>> repr(key))
>>  File "/usr/local/lib/python2.6/dist-packages/ffc/log.py", line 32, in
>> ffc_assert
>>    condition or error(*message)
>>  File "<string>", line 1, in <lambda>
>>  File "/usr/local/lib/python2.6/dist-packages/ufl/log.py", line 124, in
>> error
>>    raise UFLException(self._format_raw(*message))
>> ufl.log.UFLException: Linear forms must be defined using test functions
>> only: (1, '7', 1, 16)
> 
> What does your form look like?
> 


Problem is when taking the adjoint of a problem with interior facet
integrals. See form below.

Garth






BDM = FiniteElement("Brezzi-Douglas-Marini", triangle, 1)
DG  = FiniteElement("Discontinuous Lagrange", triangle, 0)
ME  = MixedElement([BDM, DG, DG])


V   = TestFunction(ME)
dU  = TrialFunction(ME)
U   = Coefficient(ME)
U0  = Coefficient(ME)

pbar = Coefficient(DG)
sbar = Coefficient(DG)
dt = Coefficient(DG)
mu_rel = Coefficient(DG)

v, q, r = split(V)
u, p, s = split(U)
u0, p0, s0 = split(U0)
s_mid = 0.5*(s0 + s)

n = triangle.n

#kinv = Expression("1.0/std::max(exp(-pow((x[1] - 0.5 -
0.1*sin(10*x[0]))/0.1, 2.0)), 0.01)")
#zero = Expression("0.0")
#Kinv = as_matrix(((kinv, zero), (zero, kinv)))

# Total mobility
def lmbdainv(s):
    return 1.0/((1.0/mu_rel)*s**2 + (1.0 - s)**2)

# Fractional flow function
def F(s):
    return s**2/(s**2 + mu_rel*(1.0 - s)**2)


L1 = inner(v, s_mid*u)*dx - div(v)*p*dx \
    + inner(v, pbar*n)*ds
L2 = q*div(u)*dx

# Upwind normal velocity: (inner(v, n) + |inner(v, n)|)/2.0
# (using velocity from previous step on facets)
un   = 0.5*(inner(u0, n) + sqrt(inner(u0, n)*inner(u0, n)))
un_h = 0.5*(inner(u0, n) - sqrt(inner(u0, n)*inner(u0, n)))
stabilisation = dt('+')*inner(jump(r), un('+')*F(s_mid)('+') -
un('-')*F(s_mid)('-'))*dS \
                                  + dt*r*un_h*sbar*ds
L3 = r*(s - s0)*dx - dt*inner(grad(r), F(s_mid)*u)*dx \
    + dt*r*F(s_mid)*un*ds + stabilisation

# Total L
L = L1 + L2 + L3

# Jacobian
a_p = derivative(L, U, dU)

a = adjoint(a_p)





>> Garth
>>
>>>> Hard to say what it is because I just get the Python/SWIG error
>>>>
>>>
>>> Here's how to reproduce the error:
>>>
>>>    ffc -l dolfin -O -r quadrature --debug MixedPoisson.ufl
>>>
>>> Is this not in the test cases?
> 
> The form is in the test cases, but unlike what we had before, forms are
> only compile with one set of parameters. I think this is a flaw in the
> design of the regression tests.
> 
> Kristian
> 
>>> Garth
>>>
>>>>  Exception: Swig director method error. Error detected when calling
>>>> 'NonlinearProblem.J'
>>>>
>>>> Garth
>>>>
>>>>
>>>> -------- Original Message --------
>>>> Subject: [Branch ~ffc-core/ffc/main] Rev 1423: merge
>>>> Date: Mon, 15 Feb 2010 19:34:25 -0000
>>>> From: noreply@xxxxxxxxxxxxx
>>>> Reply-To: noreply@xxxxxxxxxxxxx
>>>> To: Garth Wells <gnw20@xxxxxxxxx>
>>>>
>>>> Merge authors:
>>>>   Anders Logg (logg)
>>>>   Marie Rognes (meg-simula)
>>>> ------------------------------------------------------------
>>>> revno: 1423 [merge]
>>>> committer: Kristian B. Ølgaard <k.b.oelgaard@xxxxxxxxx>
>>>> branch nick: ffc
>>>> timestamp: Mon 2010-02-15 19:52:37 +0100
>>>> message:
>>>>   merge
>>>> added:
>>>>   test/regression/references/test.h
>>>> modified:
>>>>   ChangeLog
>>>>   ffc/analysis.py
>>>>   ffc/constants.py
>>>>   ffc/cpp.py
>>>>   ffc/formatting.py
>>>>   ffc/jitcompiler.py
>>>>   ffc/log.py
>>>>   ffc/tensor/monomialtransformation.py
>>>>   ffc/tensor/tensorgenerator.py
>>>>   ffc/tensor/tensoroptimization.py
>>>>   ffc/tensor/tensorreordering.py
>>>>   ffc/tensor/tensorrepresentation.py
>>>>   ffc/utils.py
>>>>   release.conf
>>>>   setup.py
>>>>   test/regression/references/Biharmonic.h
>>>>   test/regression/references/Biharmonic.out
>>>>   test/regression/references/Constant.h
>>>>   test/regression/references/Constant.out
>>>>   test/regression/references/Elasticity.h
>>>>   test/regression/references/ElementRestriction.h
>>>>   test/regression/references/EnergyNorm.h
>>>>   test/regression/references/Equation.h
>>>>   test/regression/references/FacetIntegrals.h
>>>>   test/regression/references/FacetIntegrals.out
>>>>   test/regression/references/FunctionOperators.h
>>>>   test/regression/references/Heat.h
>>>>   test/regression/references/Heat.out
>>>>   test/regression/references/HyperElasticity.h
>>>>   test/regression/references/Mass.h
>>>>   test/regression/references/Mass.out
>>>>   test/regression/references/MetaData.h
>>>>   test/regression/references/MixedMixedElement.h
>>>>   test/regression/references/MixedMixedElement.out
>>>>   test/regression/references/MixedPoisson.h
>>>>   test/regression/references/MixedPoisson.out
>>>>   test/regression/references/NavierStokes.h
>>>>   test/regression/references/NeumannProblem.h
>>>>   test/regression/references/Normals.h
>>>>   test/regression/references/Optimization.h
>>>>   test/regression/references/Optimization.out
>>>>   test/regression/references/P5tet.h
>>>>   test/regression/references/P5tri.h
>>>>   test/regression/references/Poisson.h
>>>>   test/regression/references/PoissonDG.h
>>>>   test/regression/references/PoissonDG.out
>>>>   test/regression/references/PoissonSystem.h
>>>>   test/regression/references/QuadratureElement.h
>>>>   test/regression/references/QuadratureElement.out
>>>>   test/regression/references/ReactionDiffusion.h
>>>>   test/regression/references/StabilisedStokes.h
>>>>   test/regression/references/Stokes.h
>>>>   test/regression/references/SubDomain.h
>>>>   test/regression/references/SubDomains.h
>>>>   test/regression/references/TensorWeightedPoisson.h
>>>>   test/regression/references/TensorWeightedPoisson.out
>>>>   test/regression/references/VectorLaplaceGradCurl.h
>>>>   test/regression/references/VectorPoisson.h
>>>>   test/regression/references/X_Element0.h
>>>>   test/regression/references/X_Element0.out
>>>>   test/regression/test.py
>>>> The size of the diff (15669 lines) is larger than your specified limit
>>>> of 1000 lines
>>>>
>>>> -- 
>>>> lp:ffc
>>>> https://code.launchpad.net/~ffc-core/ffc/main
>>>>
>>>> Your team FFC Core Team is subscribed to branch lp:ffc.
>>>> To unsubscribe from this branch go to
>>>> https://code.launchpad.net/~ffc-core/ffc/main/+edit-subscription.
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~ffc
>>>> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~ffc
>>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~ffc
>>> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~ffc
>>> More help   : https://help.launchpad.net/ListHelp
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~ffc
>> Post to     : ffc@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~ffc
>> More help   : https://help.launchpad.net/ListHelp
>>
> 



Follow ups

References