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

Re-meshing patches function #299

Closed
krober10nd opened this issue Sep 9, 2023 · 0 comments
Closed

Re-meshing patches function #299

krober10nd opened this issue Sep 9, 2023 · 0 comments

Comments

@krober10nd
Copy link
Collaborator

krober10nd commented Sep 9, 2023

Created a new function for msh that simplifies the steps to re-mesh a polygonal region and insert it back perfectly into the parent mesh.

To be inserted into msh.m

        
        function [m_remeshed]=remesh_patch(obj, poly, efdx, const_resolution)
            % Remeshes the region inside the polygon poly
            % Uses the existing mesh resolution patterns to re-mesh the 
            % patch by default but if user specifies const_resolution (in meters), 
            % then it will use a uniform resolution in the patch. 
            % efdx is the background grid resolution. Should be finer than
            % the intended minimum element size to correctly capture
            % element sizes.
            if nargin < 3 
                const_resolution = -999;
            end
            subdomain = extract_subdomain(obj,poly{1});
            poly = get_poly(subdomain);
            [ef,efx,efy]=reconstructEdgefx(subdomain,efdx,const_resolution);
            fh = griddedInterpolant(efx,efy,ef);
            hfun = @(p)fh(p);
            subdomain_new = mesh2dgen(poly,hfun);
            m_w_hole = extract_subdomain(obj,poly{1},"keep_inverse",1);
            m_remeshed = plus(subdomain_new, m_w_hole,...
                'match',{'djc',0.0,'ds',0,'db',0,'con',5,'mqa',1e-4,'sc_maxit',0});   
        end
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

No branches or pull requests

1 participant