Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing error message for mixing a 2D solver with a 3D case #27

Closed
MakisH opened this issue Jun 26, 2020 · 6 comments · Fixed by #28
Closed

Missing error message for mixing a 2D solver with a 3D case #27

MakisH opened this issue Jun 26, 2020 · 6 comments · Fixed by #28

Comments

@MakisH
Copy link
Member

MakisH commented Jun 26, 2020

With deal.II 9.2, the latest state of the deal.II adapter and OpenFOAM 5 (and also v1912), I get the following error in the (3D) solid side very early in the simulation:

$ ./runSolid -linear
---[precice]  This is preCICE version 2.0.2
---[precice]  Revision info: v2.0.2
---[precice]  Configuring preCICE with configuration: "precice-config.xml"
Triangulation:
	 Number of active cells: 54
	 Polynomial degree: 2
	 Number of degrees of freedom: 518
	 Output written to solution-0.vtk 

	 Number of coupling nodes:     79
---[precice]  Setting up master communication to coupling partner/s
---[precice]  Masters are connected
---[precice]  Setting up preliminary slaves communication to coupling partner/s
---[precice]  Receive global mesh Fluid-Mesh-Centers
---[precice]  Receive global mesh Fluid-Mesh-Nodes
---[precice]  Prepare partition for mesh Solid_mesh
---[precice]  Gather mesh Solid_mesh
---[precice]  Send global mesh Solid_mesh
---[precice]  Setting up slaves communication to coupling partner/s
---[precice]  Slaves are connected
---[precice]  Compute read mapping from mesh "Fluid-Mesh-Centers" to mesh "Solid_mesh".
---[precice]  Using tree-based preallocation for matrix C
---[precice]  Using tree-based preallocation for matrix A
---[precice]  Mapping Stress consistent from Fluid-Mesh-Centers (ID 0) to Solid_mesh (ID 2) for dimension 0) with polynomial set to separate
---[precice]  Mapping Stress consistent from Fluid-Mesh-Centers (ID 0) to Solid_mesh (ID 2) for dimension 1) with polynomial set to separate
---[precice]  Mapping Stress consistent from Fluid-Mesh-Centers (ID 0) to Solid_mesh (ID 2) for dimension 2) with polynomial set to separate
---[precice]  it 1 of 50 | dt# 1 | t 0 of 5 | dt 0.01 | max dt 0.01 | ongoing yes | dt complete no | write-iteration-checkpoint | 
*** Error in `./linear_elasticity': free(): invalid pointer: 0x000000000218c4e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f511e0307e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f511e03937a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f511e03d53c]
./linear_elasticity(_ZNSt8_Rb_treeIjSt4pairIKjN6dealii5PointILi2EdEEESt10_Select1stIS5_ESt4lessIjESaIS5_EE8_M_eraseEPSt13_Rb_tree_nodeIS5_E+0x269)[0x442be9]
./linear_elasticity(_ZNSt8_Rb_treeIjSt4pairIKjN6dealii5PointILi2EdEEESt10_Select1stIS5_ESt4lessIjESaIS5_EE8_M_eraseEPSt13_Rb_tree_nodeIS5_E+0xb2)[0x442a32]
./linear_elasticity(_ZN7Adapter7AdapterILi2EN6dealii6VectorIdEEN17Linear_Elasticity10Parameters13AllParametersEE10initializeERKNS1_10DoFHandlerILi2ELi2EEERKS3_RS3_+0x5b3)[0x445c83]
./linear_elasticity(_ZN17Linear_Elasticity14ElastoDynamicsILi2EE3runEv+0x7c)[0x45cdcc]
./linear_elasticity(main+0xd0)[0x4338e0]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f511dfd9830]
./linear_elasticity(_start+0x29)[0x433ba9]

Can anybody reproduce this?

The 2D case works for me.

@davidscn
Copy link
Member

davidscn commented Jun 26, 2020

This is an actual issue in your compilation. You have still compiled deal.II with dim=2.
For the 3D cases, you need to compile the code using cmake -DDIM=3. You can see it in the number of DOFs: It should be higher for 3D.

Providing preCICE a 2D mesh leads then to the crash in preCICE

@MakisH
Copy link
Member Author

MakisH commented Jun 26, 2020

Very good catch! Could we also implement a user-friendly error message? It could simply compare the dimension from the precice-config.xml with DIM.

(could we even somehow make the two versions one?)

@MakisH MakisH changed the title 3D flap_perp linear case: preCICE crashes in mapping Missing error message for mixing a 2D solver with a 3D case Jun 26, 2020
@davidscn
Copy link
Member

There is one in the adapter:

Assert(dim == precice.getDimensions(),
ExcDimensionMismatch(dim, precice.getDimensions()));

But I assume you built your code in (the default) release mode, and the Assertion is removed by the compiler, let me change this.

@davidscn
Copy link
Member

(could we even somehow make the two versions one?)

Hm we could use explicit instantiations (the dimension is templated) and read the parameter file before jumping in the class i.e. passing in the dimension via a parameter file.

So, to your question: Yes, it is possible, but a little bit more code shifting.

@MakisH
Copy link
Member Author

MakisH commented Jun 26, 2020

(could we even somehow make the two versions one?)

Hm we could use explicit instantiations (the dimension is templated) and read the parameter file before jumping in the class i.e. passing in the dimension via a parameter file.

This sounds like a great idea!

There is one in the adapter:

Assert(dim == precice.getDimensions(),
ExcDimensionMismatch(dim, precice.getDimensions()));

But I assume you built your code in (the default) release mode, and the Assertion is removed by the compiler, let me change this.

Yes, I followed the adapter documentation. Since this is a user error rather than a check for something that could internally break, it would be better to have this implemented as an error message, so that it is also checked (once) in the release mode. Also in preCICE, we distinguish between error messages and assertions in this way.

@davidscn
Copy link
Member

(could we even somehow make the two versions one?)

Hm we could use explicit instantiations (the dimension is templated) and read the parameter file before jumping in the class i.e. passing in the dimension via a parameter file.

This sounds like a great idea!

This depends a little bit how you and @uekerman prioritize tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants