Itterating over vertically aligned nodes

Discussion about coding and new developments
Post Reply
andrewdnolan
Posts: 16
Joined: 26 Oct 2020, 18:33
Antispam: Yes

Itterating over vertically aligned nodes

Post 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
Attachments
SurfaceBoundary.f90
(12.19 KiB) Downloaded 173 times
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Itterating over vertically aligned nodes

Post 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
andrewdnolan
Posts: 16
Joined: 26 Oct 2020, 18:33
Antispam: Yes

Re: Itterating over vertically aligned nodes

Post 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
andrewdnolan
Posts: 16
Joined: 26 Oct 2020, 18:33
Antispam: Yes

Re: Itterating over vertically aligned nodes

Post 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
Attachments
409_Elements.zip
(180.85 KiB) Downloaded 174 times
Post Reply