Skip to content

Cover parser by tests #369

Open
Open
@KirillZubov

Description

@KirillZubov

create a bunch of tests covering the parser to keep track of that the symbolic part is working correctly
MWE

@parameters x
@variables u(..)

Dx = Differential(x)
eq = Dx(u(x)) ~ 0.
bcs = [u(0.) ~ u(0.)]
domains = [x  Interval(0.0,1.0)]
chain = FastChain((x,p) -> x.^2)

chain([1],Float32[])
strategy_ = NeuralPDE.GridTraining(0.1)
discretization = NeuralPDE.PhysicsInformedNN(chain,strategy_)
pde_system = PDESystem(eq,bcs,domains,[x],[u])
prob = NeuralPDE.discretize(pde_system,discretization)

train_data =prob.f.f.loss_function.pde_loss_function.pde_loss_functions.contents[1].train_set
inner_loss =prob.f.f.loss_function.pde_loss_function.pde_loss_functions.contents[1].loss_function

dudx(x) = @. 2*x
@test inner_loss(train_data, Float32[])  dudx(train_data) rtol = 0.001

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions