Page 1 of 1

Itterating over vertically aligned nodes

Posted: 08 Sep 2021, 20:54
by andrewdnolan
Hello,

I'm looking to loop over vertically aligned nodes for a structured quadrilateral mesh within a user defined subroutine. I'm able to do this successfully for a 1st order quadrilateral elements (404) and am interested in the feasibility of doing the same for 2nd order quadrilateral elements (408).

I need to loop over vertically aligned nodes to properly specify surface boundary conditions as part of an Elmer/Ice simulation. A nearly identical problem is addressed in the "SurfaceBoundaryEnthalpy.F90" file within "elmerfem/elmerice/Solvers" on the GitHub repository. Here's a link to the exact lines where the looping over vertically aligned nodes is done. I should highlight a notable difference between the solver linked above and my test case; the solver linked above is only intended to be used in 3D simulations while I am running my simulations in 2D (the x-z plane). That, in part, is the reason I'm writing my own subroutine, which I've attached for reference.

Also, is there any way to check the order of elements within a user defined subroutine? I'd like to throw an error when the subroutine is used on unsupported elements types.

Thank you for taking the time to look into this.

Best,
Andrew

Re: Itterating over vertically aligned nodes

Posted: 09 Sep 2021, 01:12
by raback
Hi

The algo seems to rely on certain node numbering of the layers. So you are implicitely assuming something for 404 elements. For 408 elements this is not as easy as the midlayers have fever nodes. For 409 elements you can again have this kind of favorable numbering. Maybe this could be an option?

Btw, there is a bunch of code to compute stuff on vertical strided (StructureProjectToPlane & StructredMeshMapper). These do not make any assumptions on numbering but also might not work out of box for 408 element.

In the end, what do you want to compute over the stride? Integral of some variable?

-Peter

Re: Itterating over vertically aligned nodes

Posted: 09 Sep 2021, 02:44
by andrewdnolan
Thanks for the timely reply!

Using 409 elements sounds like a good option, it would allow us to use second order elements without having to make major changes to our current subroutine. I'll do some tests and report back.

In terms of what we are actually doing; at this point looking to set the density profile within a small layer below the free surface. This layer has a variable thickness, as determined surface mass balance. A little later down the line, we will use the density within this layer and a modeled amount of surface melting (from our mass balance model) to calculate the latent heat source from melt water refreezing. Generally, we are following the approach of Gilbert et al. 2020 , with some simplifications since we are working in 2D rather than 3D.

Thanks again,
Andrew

Re: Itterating over vertically aligned nodes

Posted: 09 Sep 2021, 21:13
by andrewdnolan
Hello,

I've tried using 409 elements, but unfortunately am running into some problems. The problem seems to be with the mesh extrusion. I've created a ".grd" file that scales a unit square to my domain length, while keeping unit height. Then within a ".sif" file, I use the "StructuredMeshMapper" to extrude the unit height onto my top and bottom surfaces. This was approach has worked successfully with 404 elements, but doesn't seem to be working for 409 elements.

I've attached a minimum working example, and any guidance you could provide would be greatly appreciated. To generate the actual mesh is used the command:

Code: Select all

ElmerGrid 1 2 409_elements.grd -out second_order -autoclean

Maybe this isn't the best sub-forum for this question. If it would be better off somewhere just let me know and I can move it over there.

Thanks,
Andrew